Skip to main content

TransformQueryOptions<RG>

Options object for transformQuery.

Type Parameters

Type ParameterDefault type
RG extends RuleGroupTypeAnyRuleGroupType

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:94


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:135


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:120


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:113


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:78


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.

Parameters

ParameterType
ruleGroupRG

Returns

Record<string, any>

Default Value

rg => rg

Defined in

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


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.

Parameters

ParameterType
ruleRuleType<string, string, any, string>

Returns

any

Default Value

r => r

Defined in

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


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.