Skip to main content

Interface: TransformQueryOptions<RG>

react-querybuilder.TransformQueryOptions

Options object for transformQuery.

Type parameters

NameType
RGextends RuleGroupTypeAny = RuleGroupType

Properties

combinatorMap

Optional combinatorMap: Record<string, string>

Any combinator values (including independent combinators) will be translated from the key in this object to the value.

Default Value

{}

Example

  transformQuery(
{ combinator: 'and', rules: [] },
{ combinatorMap: { and: '&&', or: '||' } }
)
// Returns: { combinator: '&&', rules: [] }

Defined in

packages/react-querybuilder/src/utils/transformQuery.ts:86


deleteRemappedProperties

Optional deleteRemappedProperties: boolean

Original properties remapped according to the propertyMap option will be removed.

Default Value

true

Example

  transformQuery(
{ combinator: 'and', rules: [] },
{ propertyMap: { combinator: 'AndOr' }, deleteRemappedProperties: false }
)
// Returns: { combinator: 'and', AndOr: 'and', rules: [] }

Defined in

packages/react-querybuilder/src/utils/transformQuery.ts:127


omitPath

Optional omitPath: boolean

Prevents the path property (see Path) from being added to each rule and group in the hierarchy.

Default Value

false

Defined in

packages/react-querybuilder/src/utils/transformQuery.ts:112


operatorMap

Optional operatorMap: Record<string, string>

Any operator values will be translated from the key in this object to the value.

Default Value

{}

Example

  transformQuery(
{ combinator: 'and', rules: [{ field: 'name', operator: '=', value: 'Steve Vai' }] },
{ operatorMap: { '=': 'is' } }
)
// Returns:
// {
// combinator: 'and',
// rules: [{ field: 'name', operator: 'is', value: 'Steve Vai' }]
// }

Defined in

packages/react-querybuilder/src/utils/transformQuery.ts:105


propertyMap

Optional propertyMap: Record<string, string | false>

For each rule and group in the query, any properties matching a key in this object will be renamed to the corresponding value. To retain both the new and the original properties, set deleteRemappedProperties to false.

If a key has a value of false, the corresponding property will be removed without being copied to a new property name. (Warning: { rules: false } will prevent recursion and only return the processed root group.)

Default Value

{}

Example

  transformQuery(
{ combinator: 'and', not: true, rules: [] },
{ propertyMap: { combinator: 'AndOr', not: false } }
)
// Returns: { AndOr: 'and', rules: [] }

Defined in

packages/react-querybuilder/src/utils/transformQuery.ts:70


ruleGroupProcessor

Optional ruleGroupProcessor: (ruleGroup: RG) => Record<string, any>

When a group is encountered in the hierarchy (including the root group, the query itself), it will be replaced with the result of this function.

Default Value

rg => rg

Type declaration

(ruleGroup): Record<string, any>

Parameters
NameType
ruleGroupRG
Returns

Record<string, any>

Defined in

packages/react-querybuilder/src/utils/transformQuery.ts:48


ruleProcessor

Optional ruleProcessor: (rule: RuleType<string, string, any, string>) => any

When a rule is encountered in the hierarchy, it will be replaced with the result of this function.

Default Value

r => r

Type declaration

(rule): any

Parameters
NameType
ruleRuleType<string, string, any, string>
Returns

any

Defined in

packages/react-querybuilder/src/utils/transformQuery.ts:40