Skip to main content

TransformQueryOptions<RG extends RuleGroupTypeAny = RuleGroupType>

Defined in: packages/core/src/utils/transformQuery.ts:44

Options object for transformQuery.

Type Parameters​

Type ParameterDefault type
RG extends RuleGroupTypeAnyRuleGroupType

Properties​

combinatorMap?​

optional combinatorMap?: Record<string, string>

Defined in: packages/core/src/utils/transformQuery.ts:98

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: [] }

deleteRemappedProperties?​

optional deleteRemappedProperties?: boolean

Defined in: packages/core/src/utils/transformQuery.ts:139

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: [] }

omitPath?​

optional omitPath?: boolean

Defined in: packages/core/src/utils/transformQuery.ts:124

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

Default Value​

false


operatorMap?​

optional operatorMap?: Record<string, string>

Defined in: packages/core/src/utils/transformQuery.ts:117

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' }]
// }

propertyMap?​

optional propertyMap?: Record<string, string | false>

Defined in: packages/core/src/utils/transformQuery.ts:82

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: [] }

ruleGroupProcessor?​

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

Defined in: packages/core/src/utils/transformQuery.ts:60

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.

Parameters​

ParameterType
ruleGroupRG

Returns​

Record<string, any>

Default Value​

rg => rg


ruleProcessor?​

optional ruleProcessor?: (rule: RuleType) => any

Defined in: packages/core/src/utils/transformQuery.ts:52

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

Parameters​

ParameterType
ruleRuleType

Returns​

any

Default Value​

r => r


caution

API documentation is generated from the latest commit on the main branch. It may be somewhat inconsistent with official releases of React Query Builder.