Skip to main content

QueryManagerOptions<F extends FullField = FullField, O extends FullOperator = FullOperator, C extends FullCombinator = FullCombinator>

Defined in: packages/core/src/utils/QueryManager.ts:175

Options for QueryManager. Mirrors the subset of QueryBuilder props that affect query structure rather than rendering, so the same configuration objects can drive both.

Type Parameters​

Type ParameterDefault type
F extends FullFieldFullField
O extends FullOperatorFullOperator
C extends FullCombinatorFullCombinator

Properties​

addRuleToNewGroups?​

optional addRuleToNewGroups?: boolean

Defined in: packages/core/src/utils/QueryManager.ts:242

When true, groups created by QueryManager.createRuleGroup contain one new rule.


autoSelectField?​

optional autoSelectField?: boolean

Defined in: packages/core/src/utils/QueryManager.ts:193

When false, an empty placeholder option is prepended to the field list.


autoSelectOperator?​

optional autoSelectOperator?: boolean

Defined in: packages/core/src/utils/QueryManager.ts:195

When false, an empty placeholder option is prepended to each operator list.


autoSelectValue?​

optional autoSelectValue?: boolean

Defined in: packages/core/src/utils/QueryManager.ts:197

When false, an empty placeholder option is prepended to each value list.


baseCombinator?​

optional baseCombinator?: Record<string, unknown>

Defined in: packages/core/src/utils/QueryManager.ts:191

Properties applied to every combinator in combinators.


baseField?​

optional baseField?: Record<string, unknown>

Defined in: packages/core/src/utils/QueryManager.ts:187

Properties applied to every field in fields.


baseOperator?​

optional baseOperator?: Record<string, unknown>

Defined in: packages/core/src/utils/QueryManager.ts:189

Properties applied to every operator in operators.


combinators?​

optional combinators?: FlexibleOptionListProp<C> | BaseOptionMap<C>

Defined in: packages/core/src/utils/QueryManager.ts:185

The combinators available for groups. Defaults to defaultCombinators.


disabledPaths?​

optional disabledPaths?: Path[]

Defined in: packages/core/src/utils/QueryManager.ts:274

Paths that are disabled without the corresponding rule or group carrying a disabled property. This mirrors the array form of the QueryBuilder disabled prop (e.g. disabled={[[2]]}), which disables nodes by position rather than by data.

A path is treated as disabled if it appears here or descends from a path that does. Honored only when respectDisabled is true; as with the disabled property, a node's own disabled can always be changed so it is never permanently locked.


fields?​

optional fields?: FlexibleOptionListProp<F> | BaseOptionMap<F>

Defined in: packages/core/src/utils/QueryManager.ts:181

The fields available for rules. Accepts the same shapes as the fields prop.


freeze?​

optional freeze?: boolean

Defined in: packages/core/src/utils/QueryManager.ts:310

Deep-freeze everything the manager hands out—the query, the field list, the field map, and the combinator list—so accidental mutation throws in strict mode. Defaults to true.

Pass false when the manager's output is handed to a framework that wraps objects in proxies (Vue reactive, Solid stores) or otherwise needs to mutate them. This also disables immer's auto-freeze for mutations made through the manager.

The shallow copy returned by QueryManager.getOptions is frozen either way: it is a one-level copy that no framework proxy is placed inside, so freezing it costs nothing and still prevents callers from mutating the options snapshot they were handed.


getDefaultField?​

optional getDefaultField?: DefaultFieldProp<F>

Defined in: packages/core/src/utils/QueryManager.ts:207

The default field for rules created by QueryManager.createRule.


getDefaultOperator?​

optional getDefaultOperator?: DefaultOperatorProp<F>

Defined in: packages/core/src/utils/QueryManager.ts:209

The default operator for a given field.


getDefaultValue?​

optional getDefaultValue?: (rule: RuleType, misc: { fieldData: F; }) => unknown

Defined in: packages/core/src/utils/QueryManager.ts:211

Overrides the computed default value for a new rule.

Parameters​

ParameterType
ruleRuleType
misc{ fieldData: F; }
misc.fieldDataF

Returns​

unknown


getInputType?​

optional getInputType?: (field: string, operator: string, misc: { fieldData: F; }) => InputType | null

Defined in: packages/core/src/utils/QueryManager.ts:278

The input type for a given field/operator, surfaced by QueryManager.getRuleContext.

Parameters​

ParameterType
fieldstring
operatorstring
misc{ fieldData: F; }
misc.fieldDataF

Returns​

InputType | null


getMatchModes?​

optional getMatchModes?: (field: string, misc: { fieldData: F; }) => boolean | MatchMode[] | FlexibleOption<MatchMode>[]

Defined in: packages/core/src/utils/QueryManager.ts:229

The valid match modes for a given field.

Parameters​

ParameterType
fieldstring
misc{ fieldData: F; }
misc.fieldDataF

Returns​

boolean | MatchMode[] | FlexibleOption<MatchMode>[]


getOperators?​

optional getOperators?: (field: string, misc: { fieldData: F; }) => FlexibleOptionList<O> | null

Defined in: packages/core/src/utils/QueryManager.ts:213

The operators available for a given field.

Parameters​

ParameterType
fieldstring
misc{ fieldData: F; }
misc.fieldDataF

Returns​

FlexibleOptionList<O> | null


getParameters?​

optional getParameters?: (field: string, operator: string, misc: { fieldData: F; }) => FlexibleOptionList<{[key: string]: unknown; disabled?: boolean; label: string; name: string; value?: string; }> | null

Defined in: packages/core/src/utils/QueryManager.ts:234

The named parameters available for a given field/operator.

Parameters​

ParameterType
fieldstring
operatorstring
misc{ fieldData: F; }
misc.fieldDataF

Returns​

FlexibleOptionList<{[key: string]: unknown; disabled?: boolean; label: string; name: string; value?: string; }> | null


getSubQueryBuilderProps?​

optional getSubQueryBuilderProps?: (field: string, misc: { fieldData: F; }) => Record<string, unknown>

Defined in: packages/core/src/utils/QueryManager.ts:280

Extra props for a subquery builder, surfaced by QueryManager.getRuleContext.

Parameters​

ParameterType
fieldstring
misc{ fieldData: F; }
misc.fieldDataF

Returns​

Record<string, unknown>


getValueEditorType?​

optional getValueEditorType?: (field: string, operator: string, misc: { fieldData: F; }) => ValueEditorType

Defined in: packages/core/src/utils/QueryManager.ts:215

The value editor type for a given field/operator, which informs the default value.

Parameters​

ParameterType
fieldstring
operatorstring
misc{ fieldData: F; }
misc.fieldDataF

Returns​

ValueEditorType


getValues?​

optional getValues?: (field: string, operator: string, misc: { fieldData: F; }) => FlexibleOptionList<{[key: string]: unknown; disabled?: boolean; label: string; name: string; value?: string; }>

Defined in: packages/core/src/utils/QueryManager.ts:217

The value list for a given field/operator, which informs the default value.

Parameters​

ParameterType
fieldstring
operatorstring
misc{ fieldData: F; }
misc.fieldDataF

Returns​

FlexibleOptionList<{[key: string]: unknown; disabled?: boolean; label: string; name: string; value?: string; }>


getValueSources?​

optional getValueSources?: (field: string, operator: string, misc: { fieldData: F; }) => ValueSources | [FlexibleOption, ...FlexibleOption[]]

Defined in: packages/core/src/utils/QueryManager.ts:223

The valid value sources for a given field/operator.

Parameters​

ParameterType
fieldstring
operatorstring
misc{ fieldData: F; }
misc.fieldDataF

Returns​

ValueSources | [FlexibleOption, ...FlexibleOption[]]


history?​

optional history?: boolean | QueryHistoryOptions

Defined in: packages/core/src/utils/QueryManager.ts:286

Enables undo/redo recording. Pass true for the defaults, or an object to configure maxHistory and/or coalesceMs. Disabled by default, so instances that never undo retain no extra references.


idGenerator?​

optional idGenerator?: () => string

Defined in: packages/core/src/utils/QueryManager.ts:314

Generates id properties for new rules and groups. Defaults to generateID.

Returns​

string


listsAsArrays?​

optional listsAsArrays?: boolean

Defined in: packages/core/src/utils/QueryManager.ts:240

When true, multi-value defaults are arrays instead of comma-joined strings.


maxLevels?​

optional maxLevels?: number

Defined in: packages/core/src/utils/QueryManager.ts:257

The maximum depth at which groups may be added. As with the QueryBuilder prop of the same name, a non-positive value means unlimited. Defaults to Infinity.


now?​

optional now?: () => number

Defined in: packages/core/src/utils/QueryManager.ts:321

Internal

Clock used to time history coalescing. Defaults to Date.now.

Test seam. Exists so that history recording can be compared against the react-querybuilder/history implementation without depending on wall-clock timing.

Returns​

number


onInvalidTarget?​

optional onInvalidTarget?: (info: AbortInfo) => void

Defined in: packages/core/src/utils/QueryManager.ts:297

Called whenever a mutation is aborted, including for the non-error reasons "same-location" and "no-change". Can be overridden per call.

Parameters​

ParameterType
infoAbortInfo

Returns​

void


operators?​

optional operators?: FlexibleOptionListProp<O> | BaseOptionMap<O>

Defined in: packages/core/src/utils/QueryManager.ts:183

The operators available for rules. Accepts the same shapes as the operators prop.


queryDisabled?​

optional queryDisabled?: boolean

Defined in: packages/core/src/utils/QueryManager.ts:276

Abort every mutation, as though the entire query were disabled. Defaults to false.


resetOnFieldChange?​

optional resetOnFieldChange?: boolean

Defined in: packages/core/src/utils/QueryManager.ts:247

When updating a rule's field, reset its operator, value, and valueSource to their defaults. Defaults to true, matching the QueryBuilder prop of the same name.


resetOnOperatorChange?​

optional resetOnOperatorChange?: boolean

Defined in: packages/core/src/utils/QueryManager.ts:252

When updating a rule's operator, reset its value to the default. Defaults to false, matching the QueryBuilder prop of the same name.


respectDisabled?​

optional respectDisabled?: boolean

Defined in: packages/core/src/utils/QueryManager.ts:264

Honor disabled properties within the query, so mutations targeting a disabled rule or group (or a descendant of a disabled group) are aborted. Updating a node's own disabled property is always permitted. Defaults to true, matching the QueryBuilder component; pass false to mutate freely regardless of the property.


strict?​

optional strict?: boolean

Defined in: packages/core/src/utils/QueryManager.ts:292

Throw a QueryManagerError when a mutation is aborted because its target could not be used. Disabled by default, in which case such mutations are silent no-ops. Can be overridden per call.


translations?​

optional translations?: Partial<BaseTranslations<unknown>>

Defined in: packages/core/src/utils/QueryManager.ts:205

Translations, accepting the same shape as the translations prop. Only the placeholder properties of fields, operators, and values are used, and only when the corresponding autoSelect* option is false; the remaining keys describe UI elements that have no meaning outside the QueryBuilder component. Labels are typed as unknown so the React Translations type, whose labels are ReactNode, can be passed as-is.


validator?​

optional validator?: QueryValidator

Defined in: packages/core/src/utils/QueryManager.ts:312

Validates the query. Defaults to defaultValidator.


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.