TransformQueryOptions<RG>
Defined in: packages/core/src/utils/transformQuery.ts:35
Options object for index!transformQuery transformQuery.
Type Parameters
| Type Parameter | Default type |
|---|---|
RG extends RuleGroupTypeAny | RuleGroupType |
Properties
combinatorMap?
optionalcombinatorMap:Record<string,string>
Defined in: packages/core/src/utils/transformQuery.ts:89
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?
optionaldeleteRemappedProperties:boolean
Defined in: packages/core/src/utils/transformQuery.ts:130
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?
optionalomitPath:boolean
Defined in: packages/core/src/utils/transformQuery.ts:115
Prevents the path property (see index!Path Path) from being added to each
rule and group in the hierarchy.
Default Value
false
operatorMap?
optionaloperatorMap:Record<string,string>
Defined in: packages/core/src/utils/transformQuery.ts:108
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?
optionalpropertyMap:Record<string,string|false>
Defined in: packages/core/src/utils/transformQuery.ts:73
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()?
optionalruleGroupProcessor: (ruleGroup:RG) =>Record<string,any>
Defined in: packages/core/src/utils/transformQuery.ts:51
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
| Parameter | Type |
|---|---|
ruleGroup | RG |
Returns
Record<string, any>
Default Value
rg => rg
ruleProcessor()?
optionalruleProcessor: (rule:RuleType) =>any
Defined in: packages/core/src/utils/transformQuery.ts:43
When a rule is encountered in the hierarchy, it will be replaced with the result of this function.
Parameters
| Parameter | Type |
|---|---|
rule | RuleType |
Returns
any
Default Value
r => r
API documentation is generated from the latest commit on the main branch. It may be somewhat inconsistent with official releases of React Query Builder.