Skip to main content

InsertOptions

Defined in: packages/core/src/utils/queryTools.ts:1097

Options for insert.

Extends​

Properties​

combinatorPreceding?​

optional combinatorPreceding?: string

Defined in: packages/core/src/utils/queryTools.ts:1111

If the query extends RuleGroupTypeIC (i.e. the query has independent combinators), then this combinator will be inserted before the new rule/group if the parent group is not empty and the new rule/group is not the first in the group (path.at(-1) > 0). This option will supersede combinators.


combinators?​

optional combinators?: OptionList

Defined in: packages/core/src/utils/queryTools.ts:1104

If the query extends RuleGroupTypeIC (i.e. the query has independent combinators), then the first combinator in this list will be inserted before the new rule/group if the parent group is not empty. This option is overridden by combinatorPreceding.


combinatorSucceeding?​

optional combinatorSucceeding?: string

Defined in: packages/core/src/utils/queryTools.ts:1118

If the query extends RuleGroupTypeIC (i.e. the query has independent combinators), then this combinator will be inserted after the new rule/group if the parent group is not empty and the new rule/group is the first in the group (path.at(-1) === 0). This option will supersede combinators.


disabledPaths?​

optional disabledPaths?: Path[]

Defined in: packages/core/src/utils/queryTools.ts:110

Paths that are disabled without the corresponding rule or group carrying a disabled property, mirroring the array form of the QueryBuilder disabled prop. A path is treated as disabled if it appears here or descends from a path that does.

Like the disabled property, this is only honored when respectDisabled is true, and updating a rule or group's own disabled property is still permitted.

Inherited from​

QueryToolOptions.disabledPaths


freeze?​

optional freeze?: boolean

Defined in: packages/core/src/utils/queryTools.ts:147

Set false to skip immer's auto-freeze on the returned query, e.g. when the query will be handed to a framework that wraps it in a proxy (Vue reactive, Solid stores) or otherwise needs to mutate it. Ignored by the *InPlace variants, which never freeze.

Default​

true

Inherited from​

QueryToolOptions.freeze


idGenerator?​

optional idGenerator?: () => string

Defined in: packages/core/src/utils/queryTools.ts:1124

ID generator.

Returns​

string

Default​

generateID

maxLevels?​

optional maxLevels?: number

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

The maximum depth at which a group may be added. A group whose parent path is already this deep is rejected by add and insert. Rules are unaffected. Defaults to Infinity.

Inherited from​

QueryToolOptions.maxLevels


onAbort?​

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

Defined in: packages/core/src/utils/queryTools.ts:131

Called when the operation returns the query unmodified, with the reason why. Query tools never throw, so this is the only way to distinguish "the target was invalid" from "the operation had nothing to do".

Parameters​

ParameterType
infoAbortInfo

Returns​

void

Inherited from​

QueryToolOptions.onAbort


queryDisabled?​

optional queryDisabled?: boolean

Defined in: packages/core/src/utils/queryTools.ts:112

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

Inherited from​

QueryToolOptions.queryDisabled


replace?​

optional replace?: boolean

Defined in: packages/core/src/utils/queryTools.ts:1128

When true, the new rule/group will replace the rule/group at path.


respectDisabled?​

optional respectDisabled?: boolean

Defined in: packages/core/src/utils/queryTools.ts:101

Abort when the target (or its parent, for add/insert) is disabled, either directly or by descending from a disabled group. Defaults to false.

Updating a rule or group's own disabled property is always permitted, since it is the only way to re-enable it.

Inherited from​

QueryToolOptions.respectDisabled


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.