@react-querybuilder/core 8.21.1 → 8.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +1426 -56
  3. package/dist/cjs/react-querybuilder_core.cjs.development.js +2241 -83
  4. package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
  5. package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +1426 -56
  6. package/dist/cjs/react-querybuilder_core.cjs.production.js +1 -1
  7. package/dist/cjs/react-querybuilder_core.cjs.production.js.map +1 -1
  8. package/dist/formatQuery.d.mts +17 -2
  9. package/dist/formatQuery.d.ts +17 -2
  10. package/dist/formatQuery.js +68 -45
  11. package/dist/formatQuery.js.map +1 -1
  12. package/dist/formatQuery.mjs +67 -46
  13. package/dist/formatQuery.mjs.map +1 -1
  14. package/dist/{import-Ddc3d_8q.d.ts → import-6ExjhifL.d.ts} +2 -2
  15. package/dist/{import-BVdxeIBO.d.mts → import-DVWI7Fdh.d.mts} +2 -2
  16. package/dist/{index-BSwFvkeI.d.mts → index-CX9mehdL.d.mts} +15 -1
  17. package/dist/{index-BSwFvkeI.d.ts → index-CX9mehdL.d.ts} +15 -1
  18. package/dist/parseCEL.d.mts +2 -2
  19. package/dist/parseCEL.d.ts +2 -2
  20. package/dist/parseCEL.js +6 -8
  21. package/dist/parseCEL.js.map +1 -1
  22. package/dist/parseCEL.mjs +6 -8
  23. package/dist/parseCEL.mjs.map +1 -1
  24. package/dist/parseCypher.d.mts +1 -1
  25. package/dist/parseCypher.d.ts +1 -1
  26. package/dist/parseCypher.js.map +1 -1
  27. package/dist/parseGremlin.d.mts +1 -1
  28. package/dist/parseGremlin.d.ts +1 -1
  29. package/dist/parseJSONata.d.mts +2 -2
  30. package/dist/parseJSONata.d.ts +2 -2
  31. package/dist/parseJSONata.js +2 -2
  32. package/dist/parseJSONata.js.map +1 -1
  33. package/dist/parseJSONata.mjs +1 -1
  34. package/dist/parseJsonLogic.d.mts +2 -2
  35. package/dist/parseJsonLogic.d.ts +2 -2
  36. package/dist/parseJsonLogic.js +3 -3
  37. package/dist/parseJsonLogic.js.map +1 -1
  38. package/dist/parseJsonLogic.mjs +3 -3
  39. package/dist/parseJsonLogic.mjs.map +1 -1
  40. package/dist/parseMongoDB.d.mts +2 -2
  41. package/dist/parseMongoDB.d.ts +2 -2
  42. package/dist/parseMongoDB.js +2 -2
  43. package/dist/parseMongoDB.mjs +2 -2
  44. package/dist/parseSPARQL.d.mts +1 -1
  45. package/dist/parseSPARQL.d.ts +1 -1
  46. package/dist/parseSPARQL.js +0 -1
  47. package/dist/parseSPARQL.js.map +1 -1
  48. package/dist/parseSPARQL.mjs +0 -1
  49. package/dist/parseSPARQL.mjs.map +1 -1
  50. package/dist/parseSQL.d.mts +2 -2
  51. package/dist/parseSQL.d.ts +2 -2
  52. package/dist/parseSQL.js +54 -62
  53. package/dist/parseSQL.js.map +1 -1
  54. package/dist/parseSQL.mjs +54 -62
  55. package/dist/parseSQL.mjs.map +1 -1
  56. package/dist/parseSpEL.d.mts +2 -2
  57. package/dist/parseSpEL.d.ts +2 -2
  58. package/dist/parseSpEL.js +3 -3
  59. package/dist/parseSpEL.js.map +1 -1
  60. package/dist/parseSpEL.mjs +3 -3
  61. package/dist/parseSpEL.mjs.map +1 -1
  62. package/dist/{prepareQueryObjects-C2-kTZvR.js → prepareQueryObjects-BnGL91Tt.js} +9 -5
  63. package/dist/{prepareQueryObjects-C2-kTZvR.js.map → prepareQueryObjects-BnGL91Tt.js.map} +1 -1
  64. package/dist/{prepareQueryObjects-Q18lHCKl.mjs → prepareQueryObjects-ChINDIap.mjs} +9 -5
  65. package/dist/{prepareQueryObjects-Q18lHCKl.mjs.map → prepareQueryObjects-ChINDIap.mjs.map} +1 -1
  66. package/dist/query-builder-layout.css +1 -1
  67. package/dist/query-builder-layout.css.map +1 -1
  68. package/dist/query-builder.css +1 -1
  69. package/dist/query-builder.css.map +1 -1
  70. package/dist/react-querybuilder_core.d.mts +1426 -56
  71. package/dist/react-querybuilder_core.legacy-esm.d.ts +1426 -56
  72. package/dist/react-querybuilder_core.legacy-esm.js +2279 -92
  73. package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
  74. package/dist/react-querybuilder_core.mjs +2198 -85
  75. package/dist/react-querybuilder_core.mjs.map +1 -1
  76. package/dist/react-querybuilder_core.production.d.mts +1426 -56
  77. package/dist/react-querybuilder_core.production.mjs +1 -1
  78. package/dist/react-querybuilder_core.production.mjs.map +1 -1
  79. package/dist/styles/_layout.scss +5 -2
  80. package/dist/transformQuery.d.mts +1 -1
  81. package/dist/transformQuery.d.ts +1 -1
  82. package/dist/{utils-Dt0D_DMV.mjs → utils-4k-j5FBa.mjs} +20 -3
  83. package/dist/utils-4k-j5FBa.mjs.map +1 -0
  84. package/dist/{utils-DEwV7F6B.js → utils-C79dxwZb.js} +31 -2
  85. package/dist/utils-C79dxwZb.js.map +1 -0
  86. package/package.json +9 -8
  87. package/dist/utils-DEwV7F6B.js.map +0 -1
  88. package/dist/utils-Dt0D_DMV.mjs.map +0 -1
@@ -2083,6 +2083,14 @@ interface ValueProcessorOptions extends FormatQueryOptions {
2083
2083
  * @default false
2084
2084
  */
2085
2085
  parseNumbers?: boolean;
2086
+ /**
2087
+ * Nesting level of the subquery currently being processed. Incremented each time a rule
2088
+ * processor recurses into a rule group stored in a rule's `value` (see `match` modes).
2089
+ * Used to generate collision-free element aliases.
2090
+ *
2091
+ * @default 0
2092
+ */
2093
+ subqueryDepth?: number;
2086
2094
  }
2087
2095
  /**
2088
2096
  * Options object curated by {@link formatQuery} and passed to a {@link RuleGroupProcessor}.
@@ -2100,6 +2108,12 @@ interface FormatQueryFinalOptions extends Required<Except<FormatQueryOptions, "c
2100
2108
  validateRule: FormatQueryValidateRule;
2101
2109
  validationMap: ValidationMap;
2102
2110
  context?: Record<string, unknown>;
2111
+ /**
2112
+ * @see {@link ValueProcessorOptions.subqueryDepth}
2113
+ *
2114
+ * @default 0
2115
+ */
2116
+ subqueryDepth?: number;
2103
2117
  }
2104
2118
  /**
2105
2119
  * Function that produces a processed value for a given {@link RuleType}.
@@ -2431,6 +2445,32 @@ type NLTranslationKey = "and" | "or" | "true" | "false" | "ruleSeparator" | "bet
2431
2445
  */
2432
2446
  type NLTranslations = Partial<Record<NLTranslationKey, string>>;
2433
2447
  //#endregion
2448
+ //#region src/types/history.d.ts
2449
+ /**
2450
+ * Options controlling how query changes are recorded for undo/redo.
2451
+ *
2452
+ * Shared by the `react-querybuilder/history` entry point and the
2453
+ * {@link index!QueryManager QueryManager} utility.
2454
+ */
2455
+ interface QueryHistoryOptions {
2456
+ /**
2457
+ * Maximum number of undo steps to retain. Older entries are discarded.
2458
+ *
2459
+ * @default 50
2460
+ */
2461
+ maxHistory?: number;
2462
+ /**
2463
+ * Consecutive changes to the same property of the same rule within this many milliseconds
2464
+ * are merged into a single undo step, so that (for example) typing a multi-character value
2465
+ * produces one history entry rather than one per keystroke.
2466
+ *
2467
+ * Set to `0` to record every change separately.
2468
+ *
2469
+ * @default 500
2470
+ */
2471
+ coalesceMs?: number;
2472
+ }
2473
+ //#endregion
2434
2474
  //#region src/types/queryBuilder.d.ts
2435
2475
  /**
2436
2476
  * Base interface for all rule subcomponents.
@@ -2522,6 +2562,18 @@ interface Classnames {
2522
2562
  * Classnames applied to the `<span>` handle for dragging rules/groups.
2523
2563
  */
2524
2564
  shiftActions: Classname;
2565
+ /**
2566
+ * Classname(s) to be applied to the undo/redo actions container.
2567
+ */
2568
+ undoRedoActions: Classname;
2569
+ /**
2570
+ * Classname(s) to be applied to the "undo" button.
2571
+ */
2572
+ undoAction: Classname;
2573
+ /**
2574
+ * Classname(s) to be applied to the "redo" button.
2575
+ */
2576
+ redoAction: Classname;
2525
2577
  /**
2526
2578
  * Classnames applied to the `<span>` handle for dragging rules/groups.
2527
2579
  */
@@ -2696,6 +2748,8 @@ interface BaseTranslations<LabelType = string> {
2696
2748
  cloneRuleGroup: BaseTranslationWithLabel<LabelType>;
2697
2749
  shiftActionUp: BaseTranslationWithLabel<LabelType>;
2698
2750
  shiftActionDown: BaseTranslationWithLabel<LabelType>;
2751
+ undo: BaseTranslationWithLabel<LabelType>;
2752
+ redo: BaseTranslationWithLabel<LabelType>;
2699
2753
  dragHandle: BaseTranslationWithLabel<LabelType>;
2700
2754
  lockRule: BaseTranslationWithLabel<LabelType>;
2701
2755
  lockGroup: BaseTranslationWithLabel<LabelType>;
@@ -2735,6 +2789,18 @@ interface QueryBuilderFlags {
2735
2789
  * @default true
2736
2790
  */
2737
2791
  enableMountQueryChange?: boolean;
2792
+ /**
2793
+ * By default, when the last `QueryBuilder` component using a given `qbId` unmounts, its
2794
+ * query is removed from the internal Redux store. Set this to `true` to retain the query
2795
+ * state after unmount, which allows a subsequent `QueryBuilder` with the same `qbId` to
2796
+ * pick up where the previous one left off.
2797
+ *
2798
+ * Only meaningful in conjunction with an explicit `qbId` prop, since automatically generated
2799
+ * `qbId`s are never reused.
2800
+ *
2801
+ * @default false
2802
+ */
2803
+ preserveQueryStateOnUnmount?: boolean;
2738
2804
  /**
2739
2805
  * Enables drag-and-drop features.
2740
2806
  *
@@ -2766,6 +2832,16 @@ interface QueryBuilderFlags {
2766
2832
  * @default false
2767
2833
  */
2768
2834
  showShiftActions?: boolean;
2835
+ /**
2836
+ * Show the "Undo"/"Redo" actions in the header of the outermost group.
2837
+ *
2838
+ * Requires the `QueryBuilderHistory` component from `react-querybuilder/history`, which
2839
+ * provides the controls and records the history they navigate. Defaults to `true` when a
2840
+ * `QueryBuilderHistory` ancestor is present (pass `false` explicitly to opt out).
2841
+ *
2842
+ * @default false
2843
+ */
2844
+ showUndoRedo?: boolean;
2769
2845
  /**
2770
2846
  * Show the "Clone rule" and "Clone group" buttons.
2771
2847
  *
@@ -3004,6 +3080,9 @@ declare const standardClassnames: {
3004
3080
  readonly valid: "queryBuilder-valid";
3005
3081
  readonly invalid: "queryBuilder-invalid";
3006
3082
  readonly shiftActions: "shiftActions";
3083
+ readonly undoRedoActions: "undoRedoActions";
3084
+ readonly undoAction: "undoRedoActions-undo";
3085
+ readonly redoAction: "undoRedoActions-redo";
3007
3086
  readonly dndDragging: "dndDragging";
3008
3087
  readonly dndOver: "dndOver";
3009
3088
  readonly dndCopy: "dndCopy";
@@ -3064,6 +3143,9 @@ declare const TestID: {
3064
3143
  readonly valueEditor: "value-editor";
3065
3144
  readonly notToggle: "not-toggle";
3066
3145
  readonly shiftActions: "shift-actions";
3146
+ readonly undoRedoActions: "undo-redo-actions";
3147
+ readonly undoAction: "undo-action";
3148
+ readonly redoAction: "redo-action";
3067
3149
  readonly dragHandle: "drag-handle";
3068
3150
  readonly lockRule: "lock-rule";
3069
3151
  readonly lockGroup: "lock-group";
@@ -3102,6 +3184,19 @@ declare const rootPath: Path;
3102
3184
  * @group Defaults
3103
3185
  */
3104
3186
  declare const queryBuilderFlagDefaults: Required<QueryBuilderFlags>;
3187
+ /**
3188
+ * Default maximum number of undo steps retained by query history.
3189
+ *
3190
+ * @group Defaults
3191
+ */
3192
+ declare const defaultMaxHistory = 50;
3193
+ /**
3194
+ * Default time window (in milliseconds) within which consecutive changes to the same
3195
+ * property of the same rule are coalesced into a single undo step.
3196
+ *
3197
+ * @group Defaults
3198
+ */
3199
+ declare const defaultCoalesceMs = 500;
3105
3200
  //#endregion
3106
3201
  //#region src/utils/arrayUtils.d.ts
3107
3202
  /**
@@ -3190,6 +3285,105 @@ declare function convertQuery(query: RuleGroupType): RuleGroupTypeIC;
3190
3285
  */
3191
3286
  declare function convertQuery(query: RuleGroupTypeIC): RuleGroupType;
3192
3287
  //#endregion
3288
+ //#region src/utils/deriveClassNames.d.ts
3289
+ /** Classname keys that have both a standard class and a `controlClassnames` entry. */
3290
+ type StandardClassnameKey = keyof typeof standardClassnames & keyof Classnames;
3291
+ /**
3292
+ * A classname applied only when `when` returns true for the current state.
3293
+ *
3294
+ * `key` is used to look up both the standard classname and the corresponding `controlClassnames`
3295
+ * entry. Set `standardOnly` when the standard class is conditional but no custom class
3296
+ * corresponds to it.
3297
+ */
3298
+ interface ClassnameCondition<S> {
3299
+ key: StandardClassnameKey;
3300
+ when: (state: S) => boolean | undefined;
3301
+ standardOnly?: boolean;
3302
+ }
3303
+ /**
3304
+ * How one derived classname is composed: the `controlClassnames` keys that contribute to it (in
3305
+ * application order, after the standard classname), plus any state-dependent classes.
3306
+ */
3307
+ interface ClassnameSpec<S> {
3308
+ sources: readonly (keyof Classnames)[];
3309
+ conditions?: readonly ClassnameCondition<S>[];
3310
+ }
3311
+ /** Keys of the `classNames` object returned for a rule. */
3312
+ type RuleClassnameKey = "shiftActions" | "dragHandle" | "fields" | "matchMode" | "matchThreshold" | "operators" | "valueSource" | "value" | "cloneRule" | "lockRule" | "muteRule" | "removeRule" | "valueListItem";
3313
+ /** Keys of the `classNames` object returned for a rule group. */
3314
+ type RuleGroupClassnameKey = "header" | "shiftActions" | "undoRedoActions" | "undoAction" | "redoAction" | "dragHandle" | "combinators" | "notToggle" | "addRule" | "addGroup" | "cloneGroup" | "lockGroup" | "muteGroup" | "removeGroup" | "body";
3315
+ /** Drag-and-drop state that can contribute conditional classnames. */
3316
+ interface DndClassNameState {
3317
+ isDragging?: boolean;
3318
+ isOver?: boolean;
3319
+ dropEffect?: "move" | "copy";
3320
+ groupItems?: boolean;
3321
+ dropNotAllowed?: boolean;
3322
+ }
3323
+ /** State that contributes conditional classnames to a rule's wrapper element. */
3324
+ interface RuleClassNameState extends DndClassNameState {
3325
+ disabled?: boolean;
3326
+ muted?: boolean;
3327
+ hasSubQuery?: boolean;
3328
+ }
3329
+ /** Options common to every classname derivation. */
3330
+ interface DeriveClassNamesOptions {
3331
+ /** The merged `controlClassnames` for the query builder. */
3332
+ classNames: Partial<Classnames> | undefined;
3333
+ /** When `true`, standard (`rule`, `ruleGroup-*`, etc.) classnames are omitted. */
3334
+ suppressStandardClassnames?: boolean;
3335
+ }
3336
+ /**
3337
+ * Classnames for each element rendered by a rule. This is the framework-agnostic core of the
3338
+ * `classNames` object returned by the `useRule` hook.
3339
+ *
3340
+ * @group Query Tools
3341
+ */
3342
+ declare const deriveRuleClassNames: (options: DeriveClassNamesOptions) => Record<RuleClassnameKey, string>;
3343
+ /**
3344
+ * The classname for a single element of a rule, composed from the same table as
3345
+ * {@link deriveRuleClassNames}. Useful where only one is needed, such as the items of a
3346
+ * multi-value editor.
3347
+ *
3348
+ * @group Query Tools
3349
+ */
3350
+ declare const deriveRuleClassName: (key: RuleClassnameKey, options: DeriveClassNamesOptions) => string;
3351
+ /**
3352
+ * Classnames for each element rendered by a rule group, including its conditionally-classed
3353
+ * `header`. This is the framework-agnostic core of the `classNames` object returned by the
3354
+ * `useRuleGroup` hook.
3355
+ *
3356
+ * @group Query Tools
3357
+ */
3358
+ declare const deriveRuleGroupClassNames: (options: DeriveClassNamesOptions & DndClassNameState) => Record<RuleGroupClassnameKey, string>;
3359
+ /** Inputs to {@link deriveRuleOuterClassName} and {@link deriveRuleGroupOuterClassName}. */
3360
+ interface OuterClassNameOptions extends DeriveClassNamesOptions, RuleClassNameState {
3361
+ /**
3362
+ * Classnames contributed by the rule or group itself and its configuration, applied first.
3363
+ * For a rule that is the rule/field/operator classnames; for a group, the group and combinator
3364
+ * classnames.
3365
+ */
3366
+ leadingClassNames?: (Classname | null)[];
3367
+ /** Appended last, as produced by `getValidationClassNames`. */
3368
+ validationClassName?: Classname;
3369
+ }
3370
+ /**
3371
+ * The outer (wrapper) classname for a rule, including every conditional state class.
3372
+ *
3373
+ * @group Query Tools
3374
+ */
3375
+ declare const deriveRuleOuterClassName: (options: OuterClassNameOptions) => string;
3376
+ /**
3377
+ * The outer (wrapper) classname for a rule group, including every conditional state class.
3378
+ *
3379
+ * A group reflects fewer drag-and-drop states than a rule—`dndOver`, `dndCopy`,
3380
+ * `dndDropNotAllowed`, and `hasSubQuery` do not apply—so this is not interchangeable with
3381
+ * {@link deriveRuleOuterClassName}.
3382
+ *
3383
+ * @group Query Tools
3384
+ */
3385
+ declare const deriveRuleGroupOuterClassName: (options: OuterClassNameOptions) => string;
3386
+ //#endregion
3193
3387
  //#region src/utils/defaultValidator.d.ts
3194
3388
  /**
3195
3389
  * This is an example validation function you can pass to {@link react-querybuilder!QueryBuilder QueryBuilder} in the
@@ -3198,6 +3392,229 @@ declare function convertQuery(query: RuleGroupTypeIC): RuleGroupType;
3198
3392
  */
3199
3393
  declare const defaultValidator: QueryValidator;
3200
3394
  //#endregion
3395
+ //#region src/utils/deriveRuleContext.d.ts
3396
+ /**
3397
+ * Functions used by {@link deriveRuleContext} to resolve a rule's configuration. Each corresponds
3398
+ * to the `QueryBuilder` prop (or `useQueryBuilderSetup` output) of the same name.
3399
+ */
3400
+ interface RuleContextResolvers<F extends FullField = FullField> {
3401
+ fields: OptionList<F>;
3402
+ fieldMap: Partial<FullOptionRecord<FullField>>;
3403
+ getInputType: (field: string, operator: string, misc: {
3404
+ fieldData: F;
3405
+ }) => InputType | null;
3406
+ getMatchModes: (field: string, misc: {
3407
+ fieldData: F;
3408
+ }) => MatchModeOptions;
3409
+ getOperators: (field: string, misc: {
3410
+ fieldData: F;
3411
+ }) => OptionList<FullOperator>;
3412
+ getParameters: (field: string, operator: string, misc: {
3413
+ fieldData: F;
3414
+ }) => FlexibleOptionList<Option>;
3415
+ getValueEditorType: (field: string, operator: string, misc: {
3416
+ fieldData: F;
3417
+ }) => ValueEditorType;
3418
+ getValues: (field: string, operator: string, misc: {
3419
+ fieldData: F;
3420
+ }) => FlexibleOptionList<Option>;
3421
+ getValueSources: (field: string, operator: string, misc: {
3422
+ fieldData: F;
3423
+ }) => ValueSourceFullOptions;
3424
+ getSubQueryBuilderProps?: (field: string, misc: {
3425
+ fieldData: F;
3426
+ }) => Record<string, unknown>;
3427
+ }
3428
+ /**
3429
+ * Everything {@link deriveRuleContext} resolves for a single rule.
3430
+ */
3431
+ interface RuleContext<F extends FullField = FullField> {
3432
+ fieldData: F;
3433
+ hideValueControls: boolean;
3434
+ inputType: InputType | null;
3435
+ matchModes: MatchModeOptions;
3436
+ operatorObject: FullOperator | undefined;
3437
+ operators: OptionList<FullOperator>;
3438
+ parameters: FlexibleOptionList<Option> | null;
3439
+ validationResult: boolean | ValidationResult;
3440
+ valueEditorType: ValueEditorType;
3441
+ values: FlexibleOptionList<Option>;
3442
+ valueSourceOptions: ValueSourceFullOptions;
3443
+ valueSources: ValueSources;
3444
+ subQueryBuilderProps: Record<string, unknown>;
3445
+ }
3446
+ /**
3447
+ * Resolves the field configuration for a rule's `field`, falling back to a minimal option object
3448
+ * when the field isn't present in the field map.
3449
+ */
3450
+ declare const getFieldData: (field: string, fieldMap: Partial<FullOptionRecord<FullField>>) => FullField;
3451
+ /**
3452
+ * The input type for a rule. A field's own `inputType` takes precedence over `getInputType`.
3453
+ */
3454
+ declare const getRuleInputType: <F extends FullField = FullField>(field: string, operator: string, fieldData: F, getInputType: RuleContextResolvers<F>["getInputType"]) => InputType | null;
3455
+ /**
3456
+ * Whether the value editor(s) should be hidden for an operator, based on its `arity`.
3457
+ */
3458
+ declare const hideValueControlsForOperator: (operatorObject?: FullOperator) => boolean;
3459
+ /**
3460
+ * The subset of a rule that determines its configuration. Accepting only these properties (rather
3461
+ * than the whole rule) lets React callers keep granular memoization dependencies, so editing a
3462
+ * rule's `value` doesn't recompute its operators, value sources, or option lists.
3463
+ */
3464
+ type RuleFacet = Pick<RuleType, "field" | "operator" | "valueSource">;
3465
+ /**
3466
+ * Value source options for a rule. A `valueSource` present on the rule but absent from the
3467
+ * configured list is appended, so the current selection is always representable.
3468
+ */
3469
+ declare const getRuleValueSourceOptions: <F extends FullField = FullField>(rule: RuleFacet, fieldData: F, getValueSources: RuleContextResolvers<F>["getValueSources"]) => ValueSourceFullOptions;
3470
+ /**
3471
+ * Normalizes the result of `getParameters` to a non-empty list or `null`.
3472
+ */
3473
+ declare const getParametersAsList: (parameters: FlexibleOptionList<Option>) => FlexibleOptionList<Option> | null;
3474
+ /**
3475
+ * The value editor type for a rule. `valueSource: "field"` always uses a select list, and
3476
+ * `valueSource: "parameter"` uses a (multi)select when parameters are available.
3477
+ */
3478
+ declare const getRuleValueEditorType: <F extends FullField = FullField>(rule: RuleFacet, fieldData: F, parametersAsList: FlexibleOptionList<Option> | null, getValueEditorType: RuleContextResolvers<F>["getValueEditorType"]) => ValueEditorType;
3479
+ /**
3480
+ * The option list presented by a rule's value editor, resolved from its `valueSource`.
3481
+ */
3482
+ declare const getRuleValues: <F extends FullField = FullField>(rule: RuleFacet, fieldData: F, fields: OptionList<F>, parametersAsList: FlexibleOptionList<Option> | null, getValues: RuleContextResolvers<F>["getValues"]) => FlexibleOptionList<Option>;
3483
+ /**
3484
+ * The validation result for a rule: the entry from a query-level {@link ValidationMap} if present,
3485
+ * otherwise the field's own `validator` result, otherwise `null`.
3486
+ */
3487
+ declare const getRuleValidationResult: (rule: RuleType, fieldData: FullField, validationMap?: ValidationMap, id?: string) => boolean | ValidationResult;
3488
+ /**
3489
+ * Resolves everything about a single rule that depends on the field/operator configuration:
3490
+ * its field data, operators, value editor type, value list, value sources, match modes, and
3491
+ * validation result.
3492
+ *
3493
+ * This is the framework-agnostic core of the `useRule` hook, shared with
3494
+ * {@link QueryManager.getRuleContext} so that non-React implementations derive identical results.
3495
+ * It performs no memoization; callers are responsible for caching as appropriate.
3496
+ *
3497
+ * @group Query Tools
3498
+ */
3499
+ declare const deriveRuleContext: <F extends FullField = FullField>(rule: RuleType, resolvers: RuleContextResolvers<F>, options?: {
3500
+ validationMap?: ValidationMap;
3501
+ id?: string;
3502
+ }) => RuleContext<F>;
3503
+ /**
3504
+ * Everything {@link deriveRuleGroupContext} resolves for a single rule group.
3505
+ */
3506
+ interface RuleGroupContext<C extends FullCombinator = FullCombinator> {
3507
+ combinator: string;
3508
+ combinatorObject: C | undefined;
3509
+ combinators: FullOptionList<C>;
3510
+ /** The `className` of the selected combinator, or `null` for independent combinators. */
3511
+ combinatorBasedClassName: Classname | null;
3512
+ independentCombinators: boolean;
3513
+ validationResult: boolean | ValidationResult;
3514
+ }
3515
+ /**
3516
+ * The effective combinator for a group: its own `combinator` when it has one, otherwise the
3517
+ * first configured combinator (which is the case for groups with independent combinators).
3518
+ *
3519
+ * This intentionally covers only the current property-based API. The `RuleGroup` component
3520
+ * additionally falls back to its deprecated `combinator` prop; that fallback stays in the hook.
3521
+ */
3522
+ declare const getRuleGroupCombinator: <C extends FullCombinator = FullCombinator>(ruleGroup: RuleGroupTypeAny, combinators: FullOptionList<C>) => string;
3523
+ /**
3524
+ * Resolves everything about a rule group that depends on the combinator configuration, plus its
3525
+ * validation result.
3526
+ *
3527
+ * Note that unlike {@link deriveRuleContext}, there is no field-level validator fallback—a
3528
+ * group's validation result comes only from the query-level {@link ValidationMap}.
3529
+ *
3530
+ * @group Query Tools
3531
+ */
3532
+ declare const deriveRuleGroupContext: <C extends FullCombinator = FullCombinator>(ruleGroup: RuleGroupTypeAny, combinators: FullOptionList<C>, options?: {
3533
+ validationMap?: ValidationMap;
3534
+ id?: string;
3535
+ }) => RuleGroupContext<C>;
3536
+ //#endregion
3537
+ //#region src/utils/deriveValueEditor.d.ts
3538
+ /**
3539
+ * Whether an operator's value is a list of two bounds.
3540
+ *
3541
+ * @group Value Editors
3542
+ */
3543
+ declare const isBetweenOperator: (operator: string) => boolean;
3544
+ /**
3545
+ * Determines whether a rule's `value` needs to be collapsed to a single element because it no
3546
+ * longer represents a list, and what it should become.
3547
+ *
3548
+ * This happens when the value is an array (or a comma-containing string in a `number` input,
3549
+ * which `<input type="number">` can't display) while the operator is not one of the multi-value
3550
+ * operators and the editor is not a multiselect—typically right after the operator changes from
3551
+ * `"in"` or `"between"` to something else.
3552
+ *
3553
+ * The React `useValueEditor` hook applies the result in an effect; other implementations may
3554
+ * apply it wherever is idiomatic.
3555
+ *
3556
+ * @group Value Editors
3557
+ */
3558
+ declare const getValueEditorReset: ({ skipHook, type, operator, value, inputType }: {
3559
+ skipHook?: boolean;
3560
+ type?: string;
3561
+ operator: string;
3562
+ value: unknown;
3563
+ inputType?: InputType | null;
3564
+ }) => {
3565
+ reset: boolean;
3566
+ value: unknown;
3567
+ };
3568
+ /**
3569
+ * Produces the next value for a series of value editors when the editor at `index` changes.
3570
+ *
3571
+ * For `between`/`notBetween`, editing the first bound guarantees an array of at least two
3572
+ * elements, seeding the second from the first available option. The result is a comma-joined
3573
+ * string unless `listsAsArrays` is `true`.
3574
+ *
3575
+ * @group Value Editors
3576
+ */
3577
+ declare const getMultiValueUpdate: ({ value, index, valueAsArray, operator, values, listsAsArrays, parseNumberMethod }: {
3578
+ value: unknown;
3579
+ index: number;
3580
+ valueAsArray: unknown[];
3581
+ operator: string;
3582
+ values?: any[];
3583
+ listsAsArrays?: boolean;
3584
+ parseNumberMethod?: ParseNumberMethod;
3585
+ }) => unknown;
3586
+ /**
3587
+ * Coerces a value to a `bigint`, falling back to the parsed number when it can't be represented
3588
+ * as one (an empty string or a decimal, for example).
3589
+ *
3590
+ * @group Value Editors
3591
+ */
3592
+ declare const coerceBigIntValue: (value: unknown, parseNumberMethod?: ParseNumberMethod) => unknown;
3593
+ /**
3594
+ * The `type` attribute an `<input>` should use for a rule. `bigint` values and the `in`/`notIn`
3595
+ * operators (whose value is a comma-separated list) both require a text input.
3596
+ *
3597
+ * @group Value Editors
3598
+ */
3599
+ declare const coerceInputType: (inputType: InputType | null | undefined, operator: string) => InputType;
3600
+ /**
3601
+ * Produces the next value for a value selector. Multiselect values are normalized to an array
3602
+ * first, then comma-joined unless `listsAsArrays` is `true`. Single-select values pass through.
3603
+ *
3604
+ * @group Value Editors
3605
+ */
3606
+ declare const getValueSelectorUpdate: (value: string | string[], { multiple, listsAsArrays }?: {
3607
+ multiple?: boolean;
3608
+ listsAsArrays?: boolean;
3609
+ }) => string | string[];
3610
+ /**
3611
+ * Normalizes a value selector's current value for display. Multiselect values become an array of
3612
+ * strings so they match option names, which are always strings (e.g. `[42]` becomes `["42"]`).
3613
+ *
3614
+ * @group Value Editors
3615
+ */
3616
+ declare const normalizeValueSelectorValue: (value: unknown, multiple?: boolean) => any;
3617
+ //#endregion
3201
3618
  //#region src/utils/filterFieldsByComparator.d.ts
3202
3619
  /**
3203
3620
  * For a given {@link FullField}, returns the `fields` list filtered for
@@ -3990,6 +4407,21 @@ type ProcessedMatchMode = {
3990
4407
  * 2. `value` is not a valid rule group.
3991
4408
  */
3992
4409
  declare const processMatchMode: (rule: RuleType) => null | false | ProcessedMatchMode;
4410
+ /**
4411
+ * Base alias assigned to the element binding of a subquery generated for a rule's
4412
+ * {@link MatchMode `match` mode} (e.g. `unnest(field) as elem_alias`).
4413
+ */
4414
+ declare const subqueryElementAliasBase = "elem_alias";
4415
+ /**
4416
+ * Returns the element alias for a subquery at the given nesting depth. Depth 0 (the common,
4417
+ * non-nested case) uses {@link subqueryElementAliasBase} unchanged; deeper levels are suffixed
4418
+ * with the depth, so a subquery nested within a subquery cannot shadow its parent's binding.
4419
+ *
4420
+ * Deterministic by depth rather than randomized, so output remains stable and snapshot-friendly.
4421
+ *
4422
+ * @group Export
4423
+ */
4424
+ declare const getSubqueryElementAlias: (subqueryDepth?: number) => string;
3993
4425
  /**
3994
4426
  * "Replacer" method for JSON.stringify's second argument. Converts `bigint` values to
3995
4427
  * objects with a `$bigint` property having a value of a string representation of
@@ -4126,7 +4558,7 @@ interface GetRuleDefaultValueOptions<F extends FullField = FullField> {
4126
4558
  *
4127
4559
  * @group Option Lists
4128
4560
  */
4129
- declare const getRuleDefaultValue: <F extends FullField = FullField>(rule: RuleType, options: GetRuleDefaultValueOptions<F>) => unknown;
4561
+ declare const getRuleDefaultValue$1: <F extends FullField = FullField>(rule: RuleType, options: GetRuleDefaultValueOptions<F>) => unknown;
4130
4562
  //#endregion
4131
4563
  //#region src/utils/getValidationClassNames.d.ts
4132
4564
  /**
@@ -4235,6 +4667,85 @@ declare const objectEntries: <Type extends Record<PropertyKey, unknown>>(value:
4235
4667
  */
4236
4668
  declare const isUnsafeKey: (key: unknown) => boolean;
4237
4669
  //#endregion
4670
+ //#region src/utils/optionResolvers.d.ts
4671
+ /**
4672
+ * Options shared by the resolvers below that produce a normalized option list.
4673
+ */
4674
+ interface ResolveOptionListOptions {
4675
+ /**
4676
+ * Prepended as an empty placeholder option when `autoSelectOption` is `false`. Supplied by the
4677
+ * `translations` prop in React; omit it where translations don't apply.
4678
+ */
4679
+ placeholder?: Placeholder;
4680
+ /** Properties applied to every option in the resulting list. */
4681
+ baseOption?: Record<string, unknown>;
4682
+ /** When `false`, an empty placeholder option is prepended. */
4683
+ autoSelectOption?: boolean;
4684
+ }
4685
+ /**
4686
+ * Resolves the operator list for a field, applying the same precedence as the `QueryBuilder`
4687
+ * component: the field's own `operators`, then the `getOperators` callback, then the
4688
+ * query-level operator list.
4689
+ *
4690
+ * @group Option Lists
4691
+ */
4692
+ declare const resolveOperatorList: <F extends FullField = FullField, O extends FullOperator = FullOperator>({ field, fieldData, getOperators, operators, placeholder, baseOption, autoSelectOption }: {
4693
+ field: string;
4694
+ fieldData: F;
4695
+ getOperators?: (field: string, misc: {
4696
+ fieldData: F;
4697
+ }) => FlexibleOptionList<O> | null;
4698
+ operators: FullOptionList<O>;
4699
+ } & ResolveOptionListOptions) => FullOptionList<O>;
4700
+ /**
4701
+ * Resolves the default operator for a field, applying the same precedence as the `QueryBuilder`
4702
+ * component: the field's own `defaultOperator`, then the `getDefaultOperator` option (a string or
4703
+ * a function), then the first available operator.
4704
+ *
4705
+ * @group Option Lists
4706
+ */
4707
+ declare const resolveDefaultOperator: <F extends FullField = FullField>({ field, fieldData, getDefaultOperator, getOperators }: {
4708
+ field: string;
4709
+ fieldData: F;
4710
+ getDefaultOperator?: string | ((field: string, misc: {
4711
+ fieldData: F;
4712
+ }) => string);
4713
+ /** Produces the operator list for the field, i.e. {@link resolveOperatorList} already bound. */
4714
+ getOperators: (field: string, misc: {
4715
+ fieldData: F;
4716
+ }) => FullOptionList<FullOperator>;
4717
+ }) => string;
4718
+ /**
4719
+ * Resolves the value editor type for a field/operator pair, applying the same precedence as the
4720
+ * `QueryBuilder` component: the field's own `valueEditorType` (a string or a function of the
4721
+ * operator), then the `getValueEditorType` callback, then `"text"`.
4722
+ *
4723
+ * @group Option Lists
4724
+ */
4725
+ declare const resolveValueEditorType: <F extends FullField = FullField>({ field, operator, fieldData, getValueEditorType }: {
4726
+ field: string;
4727
+ operator: string;
4728
+ fieldData: F;
4729
+ getValueEditorType?: (field: string, operator: string, misc: {
4730
+ fieldData: F;
4731
+ }) => ValueEditorType;
4732
+ }) => ValueEditorType;
4733
+ /**
4734
+ * Resolves the value option list for a field/operator pair, applying the same precedence as the
4735
+ * `QueryBuilder` component: the field's own `values`, then the `getValues` callback, then an
4736
+ * empty list.
4737
+ *
4738
+ * @group Option Lists
4739
+ */
4740
+ declare const resolveValueList: <F extends FullField = FullField>({ field, operator, fieldData, getValues, placeholder, baseOption, autoSelectOption }: {
4741
+ field: string;
4742
+ operator: string;
4743
+ fieldData: F;
4744
+ getValues?: (field: string, operator: string, misc: {
4745
+ fieldData: F;
4746
+ }) => FlexibleOptionList<Option> | null;
4747
+ } & ResolveOptionListOptions) => FullOptionList<Option>;
4748
+ //#endregion
4238
4749
  //#region src/utils/optGroupUtils.d.ts
4239
4750
  /**
4240
4751
  * Converts an {@link Option} or {@link ValueOption} (i.e., {@link BaseOption})
@@ -4427,6 +4938,29 @@ declare const getCommonAncestorPath: (path1: Path, path2: Path) => Path;
4427
4938
  * or disabled by an ancestor group.
4428
4939
  */
4429
4940
  declare const pathIsDisabled: (path: Path, query: RuleGroupTypeAny) => boolean;
4941
+ /**
4942
+ * Determines if the rule or group at the specified path is disabled by `disabledPaths`—the array
4943
+ * form of the `QueryBuilder` `disabled` prop, which disables nodes by position rather than by a
4944
+ * `disabled` property on the node itself. A path is disabled if it appears in `disabledPaths` or
4945
+ * descends from a path that does.
4946
+ *
4947
+ * @group Paths
4948
+ */
4949
+ declare const pathIsDisabledByPaths: (path: Path, disabledPaths?: Path[]) => boolean;
4950
+ /** The path of a child rule or group, and whether it is disabled. */ interface PathInfo {
4951
+ path: Path;
4952
+ disabled: boolean;
4953
+ }
4954
+ /**
4955
+ * Builds the {@link PathInfo} for each child of a group at `path`. A child is disabled if its
4956
+ * parent is disabled or if its own path appears in `disabledPaths`.
4957
+ *
4958
+ * @group Paths
4959
+ */
4960
+ declare const derivePathInfo: (path: Path, childCount: number, { disabled, disabledPaths }?: {
4961
+ disabled?: boolean;
4962
+ disabledPaths?: Path[];
4963
+ }) => PathInfo[];
4430
4964
  //#endregion
4431
4965
  //#region src/utils/preferProp.d.ts
4432
4966
  /**
@@ -4465,57 +4999,250 @@ declare const prepareRuleGroup: <RG extends RuleGroupTypeAny>(queryObject: RG, {
4465
4999
  * Ensures that a rule or group is valid. See {@link prepareRule} and {@link prepareRuleGroup}.
4466
5000
  */
4467
5001
  declare const prepareRuleOrGroup: (rg: RuleGroupTypeAny | RuleType, { idGenerator }?: PreparerOptions) => RuleGroupType | RuleGroupTypeIC | RuleType;
4468
- //#endregion
4469
- //#region src/utils/queryTools.d.ts
4470
5002
  /**
4471
- * Options for {@link add}.
5003
+ * Resolves the query a query builder should render from the available sources, in precedence
5004
+ * order: the controlled `query`, then whatever is already in the store, then the uncontrolled
5005
+ * `defaultQuery`, then a freshly created empty group.
5006
+ *
5007
+ * The result is prepared with {@link prepareRuleGroup} unless it already has an `id`, which is
5008
+ * taken to mean it has been prepared before—most often because the caller is passing back the
5009
+ * object it received from `onQueryChange`.
4472
5010
  *
4473
5011
  * @group Query Tools
4474
5012
  */
4475
- interface AddOptions {
4476
- /**
4477
- * If the query extends `RuleGroupTypeIC` (i.e. the query has independent
4478
- * combinators), then the first combinator in this list will be inserted
4479
- * before the new rule/group if the parent group is not empty. This option
4480
- * is overridden by `combinatorPreceding`.
4481
- */
4482
- combinators?: OptionList;
4483
- /**
4484
- * If the query extends `RuleGroupTypeIC` (i.e. the query has independent
4485
- * combinators), then this combinator will be inserted before the new rule/group
4486
- * if the parent group is not empty. This option will supersede `combinators`.
4487
- */
4488
- combinatorPreceding?: string;
4489
- /**
4490
- * ID generator.
4491
- */
5013
+ declare const resolveCandidateQuery: <RG extends RuleGroupTypeAny>(sources: {
5014
+ query?: RG;
5015
+ storeQuery?: RG;
5016
+ defaultQuery?: RG;
5017
+ fallbackQuery: RG;
5018
+ }, options?: {
4492
5019
  idGenerator?: () => string;
4493
- }
4494
- interface AddMethod {
4495
- <RG extends RuleGroupTypeAny>(query: RG, ruleOrGroup: RG | RuleType, parentPathOrID: Path | string, options?: AddOptions): RG;
4496
- }
5020
+ }) => RG;
5021
+ //#endregion
5022
+ //#region src/utils/queryActions.d.ts
4497
5023
  /**
4498
- * Adds a rule or group to a query without mutating the original query.
5024
+ * Confirmation callbacks invoked before a mutation is applied. Their return values are
5025
+ * interpreted differently depending on the operation:
4499
5026
  *
4500
- * @returns A new query with the rule or group added.
5027
+ * - `onAddRule`/`onAddGroup` may return `true` to proceed, a falsy value to cancel, or a
5028
+ * _replacement rule/group_ to add instead of the one provided.
5029
+ * - `onMoveRule`/`onMoveGroup`/`onGroupRule`/`onGroupGroup` may return `true` to proceed, a
5030
+ * falsy value to cancel, or a _replacement query_ to apply instead of the computed one.
5031
+ * - `onRemove` is boolean only.
4501
5032
  *
4502
5033
  * @group Query Tools
4503
5034
  */
4504
- declare const add: AddMethod;
5035
+ interface QueryActionCallbacks {
5036
+ onAddRule?: (rule: RuleType, parentPath: Path, query: any, context?: any) => RuleType | boolean;
5037
+ onAddGroup?: (ruleGroup: any, parentPath: Path, query: any, context?: any) => RuleGroupTypeAny | boolean;
5038
+ onRemove?: (ruleOrGroup: any, path: Path, query: any, context?: any) => boolean;
5039
+ onMoveRule?: (...args: any[]) => RuleGroupTypeAny | boolean;
5040
+ onMoveGroup?: (...args: any[]) => RuleGroupTypeAny | boolean;
5041
+ onGroupRule?: (...args: any[]) => RuleGroupTypeAny | boolean;
5042
+ onGroupGroup?: (...args: any[]) => RuleGroupTypeAny | boolean;
5043
+ }
4505
5044
  /**
4506
- * Adds a rule or group to a query in place.
4507
- *
4508
- * @returns The query (mutated in place) with the rule or group added.
5045
+ * Configuration for {@link createQueryActions}.
4509
5046
  *
4510
5047
  * @group Query Tools
4511
5048
  */
4512
- declare const addInPlace: AddMethod;
5049
+ interface QueryActionsConfig extends QueryActionCallbacks {
5050
+ /** Identifier included in every log payload. */
5051
+ qbId?: string;
5052
+ combinators?: OptionList;
5053
+ idGenerator?: () => string;
5054
+ /** The maximum depth at which groups may be added. Defaults to `Infinity`. */
5055
+ maxLevels?: number;
5056
+ /** Abort every mutation, as though the entire query were disabled. */
5057
+ queryDisabled?: boolean;
5058
+ /**
5059
+ * Honor `disabled` properties within the query. Defaults to `true`, matching the
5060
+ * `QueryBuilder` component; a node's own `disabled` property can always be changed.
5061
+ */
5062
+ respectDisabled?: boolean;
5063
+ /**
5064
+ * Paths disabled by position rather than by a `disabled` property on the node itself, mirroring
5065
+ * the array form of the `QueryBuilder` `disabled` prop. Honored only when `respectDisabled` is
5066
+ * `true`; as with the `disabled` property, a node's own `disabled` can always be changed.
5067
+ */
5068
+ disabledPaths?: Path[];
5069
+ resetOnFieldChange?: boolean;
5070
+ resetOnOperatorChange?: boolean;
5071
+ getRuleDefaultOperator?: (field: string) => string;
5072
+ getValueSources?: (field: string, operator: string) => ValueSourceFullOptions;
5073
+ getRuleDefaultValue?: (rule: RuleType) => any;
5074
+ getMatchModes?: (field: string) => MatchModeOptions;
5075
+ /** Receives a structured event for every action, applied or aborted. */
5076
+ onLog?: (payload: Record<string, any>) => void;
5077
+ }
5078
+ /**
5079
+ * The six mutations a query builder performs. Each takes the current query and returns the next
5080
+ * one, or `undefined` when the mutation was aborted—because the target is disabled, a
5081
+ * confirmation callback declined, or a depth limit was reached.
5082
+ *
5083
+ * @group Query Tools
5084
+ */
5085
+ interface QueryActionHandlers {
5086
+ addRule: (query: any, rule: RuleType, parentPath: Path, context?: any) => any;
5087
+ addGroup: (query: any, ruleGroup: any, parentPath: Path, context?: any) => any;
5088
+ propChange: (query: any, prop: UpdateableProperties, value: any, path: Path) => any;
5089
+ removeRuleOrGroup: (query: any, path: Path, context?: any) => any;
5090
+ moveRule: (query: any, oldPath: Path, newPath: Path | "up" | "down", clone?: boolean, context?: any) => any;
5091
+ groupRule: (query: any, sourcePath: Path, targetPath: Path, clone?: boolean, context?: any) => any;
5092
+ }
5093
+ /**
5094
+ * Builds the query builder's six mutation handlers as pure functions of the current query.
5095
+ *
5096
+ * This is the framework-agnostic core of the action handlers in `useQueryBuilderSchema`. It owns
5097
+ * the policy that surrounds the query tools—disabled gating, the confirmation callback protocol,
5098
+ * `maxLevels`, and debug logging—so an implementation only has to supply its own storage: read
5099
+ * the current query, call the action, and apply a non-`undefined` result.
5100
+ *
5101
+ * @group Query Tools
5102
+ */
5103
+ declare const createQueryActions: (config?: QueryActionsConfig) => QueryActionHandlers;
5104
+ //#endregion
5105
+ //#region src/utils/queryTools.d.ts
5106
+ /**
5107
+ * Why a query tool returned the query unmodified. Query tools never throw; when they cannot
5108
+ * carry out an operation they return the original query and report the reason through
5109
+ * {@link AbortOptions.onAbort}.
5110
+ *
5111
+ * `"same-location"` and `"no-change"` describe operations that were valid but had nothing to
5112
+ * do, so they are not errors. Every other reason indicates a target that could not be used.
5113
+ *
5114
+ * @group Query Tools
5115
+ */
5116
+ type AbortReason = "target-not-found" | "parent-not-found" | "parent-not-a-group" | "destination-not-found" | "root-not-allowed" | "not-a-combinator-slot" | "same-location" | "no-change" | "target-disabled" | "parent-disabled" | "max-levels-exceeded";
5117
+ /**
5118
+ * Details about an aborted query tool operation.
5119
+ *
5120
+ * @group Query Tools
5121
+ */
5122
+ interface AbortInfo {
5123
+ /** Why the operation was aborted. */
5124
+ reason: AbortReason;
5125
+ /** The query tool that aborted. */
5126
+ operation: "add" | "remove" | "update" | "move" | "insert" | "group";
5127
+ /** The path or `id` that could not be used, when the reason relates to a specific target. */
5128
+ pathOrID?: Path | string;
5129
+ }
5130
+ /**
5131
+ * Options that block a mutation before it is attempted.
5132
+ *
5133
+ * `disabled` is a property of the query itself, so honoring it is a matter of data integrity
5134
+ * rather than presentation: a query saved with a locked rule should stay locked when it is
5135
+ * loaded again. It is opt-in here only to preserve the existing behavior of the standalone
5136
+ * query tools; {@link QueryManager} enables it by default.
5137
+ *
5138
+ * @group Query Tools
5139
+ */
5140
+ interface GuardOptions {
5141
+ /**
5142
+ * Abort when the target (or its parent, for `add`/`insert`) is disabled, either directly or
5143
+ * by descending from a disabled group. Defaults to `false`.
5144
+ *
5145
+ * Updating a rule or group's own `disabled` property is always permitted, since it is the
5146
+ * only way to re-enable it.
5147
+ */
5148
+ respectDisabled?: boolean;
5149
+ /**
5150
+ * Paths that are disabled without the corresponding rule or group carrying a `disabled`
5151
+ * property, mirroring the array form of the `QueryBuilder` `disabled` prop. A path is treated
5152
+ * as disabled if it appears here or descends from a path that does.
5153
+ *
5154
+ * Like the `disabled` property, this is only honored when `respectDisabled` is `true`, and
5155
+ * updating a rule or group's own `disabled` property is still permitted.
5156
+ */
5157
+ disabledPaths?: Path[];
5158
+ /** Abort every mutation, as though the entire query were disabled. Defaults to `false`. */
5159
+ queryDisabled?: boolean;
5160
+ /**
5161
+ * The maximum depth at which a group may be added. A group whose parent path is already this
5162
+ * deep is rejected by `add` and `insert`. Rules are unaffected. Defaults to `Infinity`.
5163
+ */
5164
+ maxLevels?: number;
5165
+ }
5166
+ /**
5167
+ * Options for reporting aborted query tool operations.
5168
+ *
5169
+ * @group Query Tools
5170
+ */
5171
+ interface AbortOptions extends GuardOptions {
5172
+ /**
5173
+ * Called when the operation returns the query unmodified, with the reason why. Query tools
5174
+ * never throw, so this is the only way to distinguish "the target was invalid" from
5175
+ * "the operation had nothing to do".
5176
+ */
5177
+ onAbort?: (info: AbortInfo) => void;
5178
+ }
5179
+ /**
5180
+ * Whether a mutation targeting `pathOrID` is blocked by the given guards, and why.
5181
+ * Returns `null` when the mutation may proceed.
5182
+ *
5183
+ * Exported so that callers which run their own logic before mutating—such as a UI layer that
5184
+ * invokes a confirmation callback—can apply the same rules without duplicating them.
5185
+ *
5186
+ * @group Query Tools
5187
+ */
5188
+ declare const getGuardAbortReason: (query: RuleGroupTypeAny, pathOrID: Path | string | undefined, guards?: GuardOptions, { asParent }?: {
5189
+ asParent?: boolean;
5190
+ }) => AbortReason | null;
5191
+ /**
5192
+ * Whether adding a group beneath `parentPath` would exceed `maxLevels`.
5193
+ *
5194
+ * @group Query Tools
5195
+ */
5196
+ declare const exceedsMaxLevels: (parentPath: Path | undefined, { maxLevels }?: GuardOptions) => boolean;
5197
+ /**
5198
+ * Options for {@link add}.
5199
+ *
5200
+ * @group Query Tools
5201
+ */
5202
+ interface AddOptions extends AbortOptions {
5203
+ /**
5204
+ * If the query extends `RuleGroupTypeIC` (i.e. the query has independent
5205
+ * combinators), then the first combinator in this list will be inserted
5206
+ * before the new rule/group if the parent group is not empty. This option
5207
+ * is overridden by `combinatorPreceding`.
5208
+ */
5209
+ combinators?: OptionList;
5210
+ /**
5211
+ * If the query extends `RuleGroupTypeIC` (i.e. the query has independent
5212
+ * combinators), then this combinator will be inserted before the new rule/group
5213
+ * if the parent group is not empty. This option will supersede `combinators`.
5214
+ */
5215
+ combinatorPreceding?: string;
5216
+ /**
5217
+ * ID generator.
5218
+ */
5219
+ idGenerator?: () => string;
5220
+ }
5221
+ interface AddMethod {
5222
+ <RG extends RuleGroupTypeAny>(query: RG, ruleOrGroup: RG | RuleType, parentPathOrID: Path | string, options?: AddOptions): RG;
5223
+ }
5224
+ /**
5225
+ * Adds a rule or group to a query without mutating the original query.
5226
+ *
5227
+ * @returns A new query with the rule or group added.
5228
+ *
5229
+ * @group Query Tools
5230
+ */
5231
+ declare const add: AddMethod;
5232
+ /**
5233
+ * Adds a rule or group to a query in place.
5234
+ *
5235
+ * @returns The query (mutated in place) with the rule or group added.
5236
+ *
5237
+ * @group Query Tools
5238
+ */
5239
+ declare const addInPlace: AddMethod;
4513
5240
  /**
4514
5241
  * Options for {@link update}.
4515
5242
  *
4516
5243
  * @group Query Tools
4517
5244
  */
4518
- interface UpdateOptions {
5245
+ interface UpdateOptions extends AbortOptions {
4519
5246
  /**
4520
5247
  * When updating the `field` of a rule, the rule's `operator`, `value`, and `valueSource`
4521
5248
  * will be reset to their respective defaults. Defaults to `true`.
@@ -4581,8 +5308,14 @@ declare const update: UpdateMethod;
4581
5308
  * @group Query Tools
4582
5309
  */
4583
5310
  declare const updateInPlace: UpdateMethod;
5311
+ /**
5312
+ * Options for {@link remove}.
5313
+ *
5314
+ * @group Query Tools
5315
+ */
5316
+ interface RemoveOptions extends AbortOptions {}
4584
5317
  interface RemoveMethod {
4585
- <RG extends RuleGroupTypeAny>(query: RG, pathOrID: Path | string): RG;
5318
+ <RG extends RuleGroupTypeAny>(query: RG, pathOrID: Path | string, options?: RemoveOptions): RG;
4586
5319
  }
4587
5320
  /**
4588
5321
  * Removes a rule or group from a query without mutating the original query.
@@ -4605,7 +5338,7 @@ declare const removeInPlace: RemoveMethod;
4605
5338
  *
4606
5339
  * @group Query Tools
4607
5340
  */
4608
- interface MoveOptions {
5341
+ interface MoveOptions extends AbortOptions {
4609
5342
  /**
4610
5343
  * When `true`, the source rule/group will not be removed from its original path.
4611
5344
  */
@@ -4647,7 +5380,7 @@ declare const moveInPlace: MoveMethod;
4647
5380
  *
4648
5381
  * @group Query Tools
4649
5382
  */
4650
- interface InsertOptions {
5383
+ interface InsertOptions extends AbortOptions {
4651
5384
  /**
4652
5385
  * If the query extends `RuleGroupTypeIC` (i.e. the query has independent
4653
5386
  * combinators), then the first combinator in this list will be inserted
@@ -4704,7 +5437,7 @@ declare const insertInPlace: InsertMethod;
4704
5437
  *
4705
5438
  * @group Query Tools
4706
5439
  */
4707
- interface GroupOptions {
5440
+ interface GroupOptions extends AbortOptions {
4708
5441
  /**
4709
5442
  * When `true`, the source rule/group will not be removed from its original path.
4710
5443
  */
@@ -4744,24 +5477,6 @@ declare const group: GroupMethod;
4744
5477
  */
4745
5478
  declare const groupInPlace: GroupMethod;
4746
5479
  //#endregion
4747
- //#region src/utils/regenerateIDs.d.ts
4748
- /**
4749
- * Options object for {@link regenerateID}/{@link regenerateIDs}.
4750
- */
4751
- interface RegenerateIdOptions {
4752
- idGenerator?: () => string;
4753
- }
4754
- /**
4755
- * Generates a new `id` property for a rule.
4756
- */
4757
- declare const regenerateID: <R extends RuleType>(rule: R, { idGenerator }?: RegenerateIdOptions) => SetRequired<R, "id">;
4758
- /**
4759
- * Recursively generates new `id` properties for a rule group and all its rules and subgroups.
4760
- */
4761
- declare const regenerateIDs: <RG>(subject: RG, { idGenerator }?: RegenerateIdOptions) => RG & {
4762
- id: string;
4763
- };
4764
- //#endregion
4765
5480
  //#region src/utils/transformQuery.d.ts
4766
5481
  /**
4767
5482
  * Options object for {@link index!transformQuery transformQuery}.
@@ -4875,5 +5590,660 @@ declare function transformQuery(query: RuleGroupType, options?: TransformQueryOp
4875
5590
  */
4876
5591
  declare function transformQuery(query: RuleGroupTypeIC, options?: TransformQueryOptions<RuleGroupTypeIC>): any;
4877
5592
  //#endregion
4878
- export { AccessibleDescriptionGenerator, ActionElementEventHandler, AddMethod, AddOptions, Arity, BaseFullOption, BaseOption, BaseOptionMap, BaseTranslation, BaseTranslationWithLabel, BaseTranslationWithPlaceholders, BaseTranslations, BaseTranslationsFull, Classname, Classnames, Combinator, CombinatorByValue, CommonRuleAndGroupProperties, CommonRuleSubComponentProps, ConstituentWordOrder, ConstituentWordOrderString, DefaultCombinator, DefaultCombinatorExtended, DefaultCombinatorName, DefaultCombinatorNameExtended, DefaultCombinators, DefaultCombinatorsExtended, DefaultMatchModes, DefaultOperator, DefaultOperatorName, DefaultOperators, DefaultRuleGroupArray, DefaultRuleGroupICArray, DefaultRuleGroupType, DefaultRuleGroupTypeAny, DefaultRuleGroupTypeIC, DefaultRuleOrGroupArray, DefaultRuleType, DiagnosticEntry, DiagnosticsFieldSummaryEntry, DiagnosticsResult, DiagnosticsStats, DndDropTargetType, DragCollection, DraggedItem, DropCollection, DropEffect, DropResult, ExportFormat, ExportObjectFormats, ExportOperatorMap, ExpressionNode, Field, FieldByValue, FindPathReturnType, FlexibleOption, FlexibleOptionGroup, FlexibleOptionList, FlexibleOptionListProp, FormatQueryFinalOptions, FormatQueryOptions, FormatQueryValidateRule, FullCombinator, FullField, FullOperator, FullOption, FullOptionList, FullOptionMap, FullOptionRecord, GenericizeRuleGroupType, GetOptionIdentifierType, GetOptionType, GetRuleDefaultValueOptions, GetRuleGroupType, GetRuleTypeFromGroupWithFieldAndOperator, GroupMethod, GroupOptions, GroupVariantCondition, InputType, InsertMethod, InsertOptions, type JsonLogicAll, type JsonLogicAnd, type JsonLogicDoubleNegation, type JsonLogicEqual, type JsonLogicGreaterThan, type JsonLogicGreaterThanOrEqual, type JsonLogicInArray, type JsonLogicInString, type JsonLogicLessThan, type JsonLogicLessThanOrEqual, type JsonLogicNegation, type JsonLogicNone, type JsonLogicNotEqual, type JsonLogicOr, type JsonLogicReservedOperations, type JsonLogicRulesLogic, type JsonLogicSome, type JsonLogicStrictEqual, type JsonLogicStrictNotEqual, type JsonLogicVar, LogType, MatchConfig, MatchMode, MatchModeOptions, MoveMethod, MoveOptions, NLTranslationKey, NLTranslations, NameLabelPair, Operator, OperatorByValue, Option, OptionGroup, OptionList, ParameterizedNamedSQL, ParameterizedSQL, ParseNumberMethod, ParseNumberOptions, ParseNumbersPropConfig, Path, Placeholder, PrepareOptionListParams, PreparedOptionList, PreparerOptions, QueryActions, QueryBuilderFlags, QueryValidator, RQBJsonLogic, RQBJsonLogicEndsWith, RQBJsonLogicStartsWith, RQBJsonLogicVar, RegenerateIdOptions, RemoveMethod, RemoveNullability, RuleDiagnosticsResult, RuleGroupArray, RuleGroupDiagnosticsArray, RuleGroupDiagnosticsResult, RuleGroupICArray, RuleGroupICDiagnosticsArray, RuleGroupICDiagnosticsResult, RuleGroupProcessor, RuleGroupType, RuleGroupTypeAny, RuleGroupTypeIC, RuleOrGroupArray, RuleProcessor, RuleType, RuleValidator, SQLPreset, StringUnionToFlexibleOptionArray, StringUnionToFullOptionArray, TestID, ToFlexibleOption, ToFullOption, ToRuleGroupType, ToRuleGroupTypeIC, TransformQueryOptions, UpdateMethod, UpdateOptions, UpdateValueMap, UpdateableProperties, ValidationMap, ValidationResult, ValueChangeEventHandler, ValueEditorType, ValueOption, ValueProcessor, ValueProcessorByRule, ValueProcessorLegacy, ValueProcessorOptions, ValueSource, ValueSourceFlexibleOptions, ValueSourceFullOptions, ValueSources, WithRequired, WithUnknownIndex, add, addInPlace, betweenOperators, bigIntJsonParseReviver, bigIntJsonStringifyReplacer, celCombinatorMap, clsx, convertFromIC, convertQuery, convertToIC, cypherCombinatorMap, defaultCELValueProcessor, defaultCombinatorLabelMap, defaultCombinators, defaultCombinatorsExtended, defaultControlClassnames, defaultExportOperatorMap, defaultJoinChar, defaultMatchModes, defaultMongoDBValueProcessor, defaultNLTranslations, defaultOperatorLabelMap, defaultOperatorNegationMap, defaultOperatorProcessorNL, defaultOperatorProcessorSQL, defaultOperators, defaultPlaceholderFieldGroupLabel, defaultPlaceholderFieldLabel, defaultPlaceholderFieldName, defaultPlaceholderLabel, defaultPlaceholderName, defaultPlaceholderOperatorGroupLabel, defaultPlaceholderOperatorLabel, defaultPlaceholderOperatorName, defaultPlaceholderValueGroupLabel, defaultPlaceholderValueLabel, defaultPlaceholderValueName, defaultRuleGroupProcessorCEL, defaultRuleGroupProcessorCypher, defaultRuleGroupProcessorDiagnostics, defaultRuleGroupProcessorDrizzle, defaultRuleGroupProcessorElasticSearch, defaultRuleGroupProcessorGremlin, defaultRuleGroupProcessorJSONata, defaultRuleGroupProcessorJsonLogic, defaultRuleGroupProcessorLDAP, defaultRuleGroupProcessorMongoDB, defaultRuleGroupProcessorMongoDBQuery, defaultRuleGroupProcessorNL, defaultRuleGroupProcessorParameterized, defaultRuleGroupProcessorPrisma, defaultRuleGroupProcessorSPARQL, defaultRuleGroupProcessorSQL, defaultRuleGroupProcessorSequelize, defaultRuleGroupProcessorSpEL, defaultRuleGroupProcessorTanStackDB, defaultRuleProcessorCEL, defaultRuleProcessorCypher, defaultRuleProcessorDrizzle, defaultRuleProcessorElasticSearch, defaultRuleProcessorGremlin, defaultRuleProcessorJSONata, defaultRuleProcessorJsonLogic, defaultRuleProcessorLDAP, defaultRuleProcessorMongoDB, defaultRuleProcessorMongoDBQuery, defaultRuleProcessorNL, defaultRuleProcessorParameterized, defaultRuleProcessorPrisma, defaultRuleProcessorSPARQL, defaultRuleProcessorSQL, defaultRuleProcessorSequelize, defaultRuleProcessorSpEL, defaultRuleProcessorTanStackDB, defaultSpELValueProcessor, defaultTranslations, defaultValidator, defaultValueProcessor, defaultValueProcessorByRule, defaultValueProcessorCELByRule, defaultValueProcessorMongoDBByRule, defaultValueProcessorNL, defaultValueProcessorSpELByRule, filterFieldsByComparator, findID, findPath, formatQuery, formatQueryOptionPresets, generateAccessibleDescription, generateID, getCommonAncestorPath, getFirstOption, getLikeWildcards, getMatchModesUtil, getNLTranslataion, getOption, getParentPath, getParseNumberMethod, getPathOfID, getQuoteFieldNamesWithArray, getQuotedFieldName, getRuleDefaultValue, getSQLConcat, getValidationClassNames, getValueSourcesUtil, group, groupInPlace, groupInvalidReasons, inOperators, insert, insertInPlace, isAncestor, isFlexibleOptionArray, isFlexibleOptionGroupArray, isFullOptionArray, isFullOptionGroupArray, isOptionGroupArray, isPojo, isRuleGroup, isRuleGroupType, isRuleGroupTypeIC, isRuleOrGroupValid, isRuleType, isUnsafeKey, isValidValue, isValidationResult, isValueProcessorLegacy, joinWith, jsonLogicAdditionalOperators, lc, mapSQLOperator, mergeAnyTranslation, mergeAnyTranslations, mergeClassnames, mongoDbFallback, mongoOperators, move, moveInPlace, normalizeConstituentWordOrder, nullFreeArray, nullOperators, nullOrUndefinedOrEmpty, numericRegex, numerifyValues, objectEntries, objectKeys, parseNumber, pathIsDisabled, pathsAreEqual, preferAnyProp, preferFlagProps, preferProp, prepareOptionList, prepareRule, prepareRuleGroup, prepareRuleOrGroup, prismaFallback, prismaOperators, processMatchMode, queryBuilderFlagDefaults, regenerateID, regenerateIDs, relationalOperators, remove, removeInPlace, rootPath, shouldRenderAsNumber, sparqlVar, splitBy, sqlDialectPresets, standardClassnames, stripParamPrefix, substringOperators, toArray, toFlatOptionArray, toFullOption, toFullOptionList, toFullOptionMap, transformQuery, trimIfString, uniqByIdentifier, uniqByName, uniqOptGroups, uniqOptList, update, updateInPlace, uuidV4regex, withParamPrefix, wrapLikeFragment };
5593
+ //#region src/utils/QueryManager.d.ts
5594
+ /**
5595
+ * Abort reasons that {@link QueryManager}'s `strict` mode treats as errors. The remaining
5596
+ * reasons—`"same-location"` and `"no-change"`—describe valid operations that had nothing to do,
5597
+ * so they are reported to `onInvalidTarget` but never throw.
5598
+ *
5599
+ * @group Query Tools
5600
+ */
5601
+ declare const strictAbortReasons: readonly AbortReason[];
5602
+ /**
5603
+ * Thrown by {@link QueryManager} methods in `strict` mode when an operation cannot be carried
5604
+ * out because its target could not be used.
5605
+ *
5606
+ * @group Query Tools
5607
+ */
5608
+ declare class QueryManagerError extends Error {
5609
+ /** Why the operation was aborted. */
5610
+ readonly code: AbortReason;
5611
+ /** Full details about the aborted operation. */
5612
+ readonly info: AbortInfo;
5613
+ constructor(info: AbortInfo);
5614
+ }
5615
+ /**
5616
+ * Per-call overrides for {@link QueryManager}'s abort handling. Every mutating method accepts
5617
+ * these alongside the options of the query tool it delegates to.
5618
+ *
5619
+ * @group Query Tools
5620
+ */
5621
+ interface StrictOptions {
5622
+ /**
5623
+ * Throw a {@link QueryManagerError} when an operation is aborted for one of the
5624
+ * {@link strictAbortReasons}. Overrides the manager's own `strict` option.
5625
+ */
5626
+ strict?: boolean;
5627
+ /**
5628
+ * Called whenever an operation is aborted, including for the non-error reasons
5629
+ * `"same-location"` and `"no-change"`. Runs before any `strict` throw, so an operation can be
5630
+ * both observed and enforced. Overrides the manager's own `onInvalidTarget` option.
5631
+ */
5632
+ onInvalidTarget?: (info: AbortInfo) => void;
5633
+ }
5634
+ /**
5635
+ * Options for {@link QueryManager}. Mirrors the subset of
5636
+ * {@link react-querybuilder!QueryBuilder QueryBuilder} props that affect query
5637
+ * _structure_ rather than rendering, so the same configuration objects can drive both.
5638
+ *
5639
+ * @group Query Tools
5640
+ */
5641
+ interface QueryManagerOptions<F extends FullField = FullField, O extends FullOperator = FullOperator, C extends FullCombinator = FullCombinator> {
5642
+ /** The fields available for rules. Accepts the same shapes as the `fields` prop. */
5643
+ fields?: FlexibleOptionListProp<F> | BaseOptionMap<F>;
5644
+ /** The operators available for rules. Accepts the same shapes as the `operators` prop. */
5645
+ operators?: FlexibleOptionListProp<O> | BaseOptionMap<O>;
5646
+ /** The combinators available for groups. Defaults to `defaultCombinators`. */
5647
+ combinators?: FlexibleOptionListProp<C> | BaseOptionMap<C>;
5648
+ /** Properties applied to every field in `fields`. */
5649
+ baseField?: Record<string, unknown>;
5650
+ /** Properties applied to every operator in `operators`. */
5651
+ baseOperator?: Record<string, unknown>;
5652
+ /** Properties applied to every combinator in `combinators`. */
5653
+ baseCombinator?: Record<string, unknown>;
5654
+ /** When `false`, an empty placeholder option is prepended to the field list. */
5655
+ autoSelectField?: boolean;
5656
+ /** When `false`, an empty placeholder option is prepended to each operator list. */
5657
+ autoSelectOperator?: boolean;
5658
+ /** When `false`, an empty placeholder option is prepended to each value list. */
5659
+ autoSelectValue?: boolean;
5660
+ /** The default `field` for rules created by {@link QueryManager.createRule}. */
5661
+ getDefaultField?: string | ((fieldsData: FullOptionList<F>) => string);
5662
+ /** The default `operator` for a given field. */
5663
+ getDefaultOperator?: string | ((field: string, misc: {
5664
+ fieldData: F;
5665
+ }) => string);
5666
+ /** Overrides the computed default `value` for a new rule. */
5667
+ getDefaultValue?: (rule: RuleType, misc: {
5668
+ fieldData: F;
5669
+ }) => unknown;
5670
+ /** The operators available for a given field. */
5671
+ getOperators?: (field: string, misc: {
5672
+ fieldData: F;
5673
+ }) => FlexibleOptionList<O> | null;
5674
+ /** The value editor type for a given field/operator, which informs the default value. */
5675
+ getValueEditorType?: (field: string, operator: string, misc: {
5676
+ fieldData: F;
5677
+ }) => ValueEditorType;
5678
+ /** The value list for a given field/operator, which informs the default value. */
5679
+ getValues?: (field: string, operator: string, misc: {
5680
+ fieldData: F;
5681
+ }) => FlexibleOptionList<Option>;
5682
+ /** The valid value sources for a given field/operator. */
5683
+ getValueSources?: (field: string, operator: string, misc: {
5684
+ fieldData: F;
5685
+ }) => ValueSources | ValueSourceFlexibleOptions;
5686
+ /** The valid match modes for a given field. */
5687
+ getMatchModes?: (field: string, misc: {
5688
+ fieldData: F;
5689
+ }) => boolean | MatchMode[] | FlexibleOption<MatchMode>[];
5690
+ /** The named parameters available for a given field/operator. */
5691
+ getParameters?: (field: string, operator: string, misc: {
5692
+ fieldData: F;
5693
+ }) => FlexibleOptionList<Option> | null;
5694
+ /** When `true`, multi-value defaults are arrays instead of comma-joined strings. */
5695
+ listsAsArrays?: boolean;
5696
+ /** When `true`, groups created by {@link QueryManager.createRuleGroup} contain one new rule. */
5697
+ addRuleToNewGroups?: boolean;
5698
+ /**
5699
+ * When updating a rule's `field`, reset its `operator`, `value`, and `valueSource` to their
5700
+ * defaults. Defaults to `true`, matching the `QueryBuilder` prop of the same name.
5701
+ */
5702
+ resetOnFieldChange?: boolean;
5703
+ /**
5704
+ * When updating a rule's `operator`, reset its `value` to the default. Defaults to `false`,
5705
+ * matching the `QueryBuilder` prop of the same name.
5706
+ */
5707
+ resetOnOperatorChange?: boolean;
5708
+ /**
5709
+ * The maximum depth at which groups may be added. As with the `QueryBuilder` prop of the same
5710
+ * name, a non-positive value means unlimited. Defaults to `Infinity`.
5711
+ */
5712
+ maxLevels?: number;
5713
+ /**
5714
+ * Honor `disabled` properties within the query, so mutations targeting a disabled rule or
5715
+ * group (or a descendant of a disabled group) are aborted. Updating a node's own `disabled`
5716
+ * property is always permitted. Defaults to `true`, matching the `QueryBuilder` component;
5717
+ * pass `false` to mutate freely regardless of the property.
5718
+ */
5719
+ respectDisabled?: boolean;
5720
+ /**
5721
+ * Paths that are disabled without the corresponding rule or group carrying a `disabled`
5722
+ * property. This mirrors the array form of the `QueryBuilder` `disabled` prop
5723
+ * (e.g. `disabled={[[2]]}`), which disables nodes by position rather than by data.
5724
+ *
5725
+ * A path is treated as disabled if it appears here or descends from a path that does. Honored
5726
+ * only when `respectDisabled` is `true`; as with the `disabled` property, a node's own
5727
+ * `disabled` can always be changed so it is never permanently locked.
5728
+ */
5729
+ disabledPaths?: Path[];
5730
+ /** Abort every mutation, as though the entire query were disabled. Defaults to `false`. */
5731
+ queryDisabled?: boolean;
5732
+ /** The input type for a given field/operator, surfaced by {@link QueryManager.getRuleContext}. */
5733
+ getInputType?: (field: string, operator: string, misc: {
5734
+ fieldData: F;
5735
+ }) => InputType | null;
5736
+ /** Extra props for a subquery builder, surfaced by {@link QueryManager.getRuleContext}. */
5737
+ getSubQueryBuilderProps?: (field: string, misc: {
5738
+ fieldData: F;
5739
+ }) => Record<string, unknown>;
5740
+ /**
5741
+ * Enables undo/redo recording. Pass `true` for the defaults, or an object to configure
5742
+ * `maxHistory` and/or `coalesceMs`. Disabled by default, so instances that never undo
5743
+ * retain no extra references.
5744
+ */
5745
+ history?: boolean | QueryHistoryOptions;
5746
+ /**
5747
+ * Throw a {@link QueryManagerError} when a mutation is aborted because its target could not
5748
+ * be used. Disabled by default, in which case such mutations are silent no-ops. Can be
5749
+ * overridden per call.
5750
+ */
5751
+ strict?: boolean;
5752
+ /**
5753
+ * Called whenever a mutation is aborted, including for the non-error reasons
5754
+ * `"same-location"` and `"no-change"`. Can be overridden per call.
5755
+ */
5756
+ onInvalidTarget?: (info: AbortInfo) => void;
5757
+ /** Validates the query. Defaults to {@link defaultValidator}. */
5758
+ validator?: QueryValidator;
5759
+ /** Generates `id` properties for new rules and groups. Defaults to {@link generateID}. */
5760
+ idGenerator?: () => string;
5761
+ /**
5762
+ * Clock used to time history coalescing. Defaults to `Date.now`.
5763
+ *
5764
+ * @internal Test seam. Exists so that history recording can be compared against the
5765
+ * `react-querybuilder/history` implementation without depending on wall-clock timing.
5766
+ */
5767
+ now?: () => number;
5768
+ }
5769
+ /**
5770
+ * A single rule or group encountered by {@link QueryManager.walk}, along with where it was found.
5771
+ *
5772
+ * @group Query Tools
5773
+ */
5774
+ interface QueryNode<RG extends RuleGroupTypeAny = RuleGroupType> {
5775
+ /** The rule or group itself. */
5776
+ node: RG | RuleType;
5777
+ /** The {@link Path} of `node` within the query. The root group's path is `[]`. */
5778
+ path: Path;
5779
+ /** The group containing `node`, or `null` for the root group. */
5780
+ parent: RG | null;
5781
+ }
5782
+ /**
5783
+ * Options for {@link QueryManager.walk} and its derivatives.
5784
+ *
5785
+ * @group Query Tools
5786
+ */
5787
+ interface WalkOptions {
5788
+ /**
5789
+ * Traverse only the subtree rooted at this path or `id` instead of the whole query. The node
5790
+ * itself is visited first. When the path or `id` can't be resolved, nothing is visited.
5791
+ */
5792
+ from?: Path | string;
5793
+ /** Visit only rules. Groups are still traversed, just not yielded (except as `parent`). */
5794
+ rulesOnly?: boolean;
5795
+ /** Visit only groups. */
5796
+ groupsOnly?: boolean;
5797
+ }
5798
+ /**
5799
+ * Coerces the result of a conditional query type back into something assignable to
5800
+ * {@link QueryManager}'s `RG` parameter, which TypeScript cannot verify on its own.
5801
+ */
5802
+ type AsRuleGroup<T> = T extends RuleGroupTypeAny ? T : RuleGroupTypeAny;
5803
+ /**
5804
+ * Stateful wrapper around the {@link add}/{@link remove}/{@link update}/{@link move}/
5805
+ * {@link insert}/{@link group} query tools, plus rule/group factories, {@link defaultValidator
5806
+ * validation}, and {@link formatQuery formatting}.
5807
+ *
5808
+ * The query is held internally, so each method takes the same arguments as its `queryTools`
5809
+ * counterpart minus the leading `query` parameter, and returns the manager itself for chaining.
5810
+ * Mutations use the non-`InPlace` tools, so a query previously handed out by
5811
+ * {@link QueryManager.getQuery} is never modified.
5812
+ *
5813
+ * ```ts
5814
+ * const q = new QueryManager(undefined, { fields });
5815
+ * q.add(q.createRule()).add({ field: 'firstName', operator: '=', value: 'Steve' });
5816
+ * q.format('sql');
5817
+ * ```
5818
+ *
5819
+ * Like the underlying query tools, methods are a no-op when the target path or `id` can't be
5820
+ * resolved (including attempts to remove the root group). By default nothing is thrown; pass
5821
+ * `strict: true` to raise a {@link QueryManagerError} instead, or `onInvalidTarget` to observe
5822
+ * aborted operations without changing control flow.
5823
+ *
5824
+ * @group Query Tools
5825
+ */
5826
+ declare class QueryManager<RG extends RuleGroupTypeAny = RuleGroupType, F extends FullField = FullField, O extends FullOperator = FullOperator, C extends FullCombinator = FullCombinator> {
5827
+ #private;
5828
+ constructor(query?: RG, options?: QueryManagerOptions<F, O, C>);
5829
+ /**
5830
+ * The current query. The returned object is frozen and structurally shared, so it is safe to
5831
+ * retain and compare by reference to detect changes.
5832
+ *
5833
+ * Like {@link QueryManager.subscribe}, this method is bound to the instance, so it can be
5834
+ * passed as a bare reference (e.g. as the `getSnapshot` argument to `useSyncExternalStore`).
5835
+ */
5836
+ getQuery: () => RG;
5837
+ /** Replaces the current query, ensuring every rule and group has an `id`. */
5838
+ setQuery(query: RG): this;
5839
+ /**
5840
+ * Creates a rule using the configured fields, operators, and defaults. The rule is not added
5841
+ * to the query—pass it to {@link QueryManager.add} or {@link QueryManager.insert}.
5842
+ */
5843
+ createRule(): RuleType;
5844
+ /**
5845
+ * Creates a group. Pass `true` for a group with independent combinators. The group is not
5846
+ * added to the query—pass it to {@link QueryManager.add} or {@link QueryManager.insert}.
5847
+ */
5848
+ createRuleGroup(independentCombinators?: boolean): RG;
5849
+ /**
5850
+ * Adds a rule or group to the end of the group at `parentPathOrID`, which defaults to the
5851
+ * root group.
5852
+ */
5853
+ add(ruleOrGroup: RG | RuleType, parentPathOrID?: Path | string, options?: AddOptions & StrictOptions): this;
5854
+ /** Removes the rule or group at the given path or `id`. The root group cannot be removed. */
5855
+ remove(pathOrID: Path | string, options?: RemoveOptions & StrictOptions): this;
5856
+ /** Updates a single property of the rule or group at the given path or `id`. */
5857
+ update(prop: UpdateableProperties, value: unknown, pathOrID: Path | string, options?: UpdateOptions & StrictOptions): this;
5858
+ /** Updates multiple properties using parallel arrays of names and values. */
5859
+ update(props: UpdateableProperties[], values: unknown[], pathOrID: Path | string, options?: UpdateOptions & StrictOptions): this;
5860
+ /** Updates multiple properties using a map of names to values. */
5861
+ update(props: UpdateValueMap, pathOrID: Path | string, options?: UpdateOptions & StrictOptions): this;
5862
+ /** Moves the rule or group at `oldPathOrID` to `newPath`, or shifts it `'up'`/`'down'`. */
5863
+ move(oldPathOrID: Path | string, newPath: Path | "up" | "down", options?: MoveOptions & StrictOptions): this;
5864
+ /**
5865
+ * Inserts a rule or group at the given path. Unlike the other methods, this accepts a path
5866
+ * only—inserting _at_ an `id` would be ambiguous.
5867
+ */
5868
+ insert(ruleOrGroup: RG | RuleType, path: Path, options?: InsertOptions & StrictOptions): this;
5869
+ /**
5870
+ * Creates a new group at `targetPathOrID` containing the rules/groups currently at
5871
+ * `targetPathOrID` and `sourcePathOrID`.
5872
+ */
5873
+ group(sourcePathOrID: Path | string, targetPathOrID: Path | string, options?: GroupOptions & StrictOptions): this;
5874
+ /**
5875
+ * Creates an independent manager with the same configuration and the current query.
5876
+ *
5877
+ * Subscribers and history are _not_ carried over: the clone starts with no listeners and an
5878
+ * empty undo stack. Because every mutation produces a new query object, the two managers
5879
+ * share the initial query safely and diverge from the first change.
5880
+ *
5881
+ * Pass `{ regenerateIDs: true }` to give every rule and group in the clone a new `id`, which
5882
+ * is useful when both queries will be used together (e.g. inserted into the same tree).
5883
+ */
5884
+ clone(options?: {
5885
+ regenerateIDs?: boolean;
5886
+ }): QueryManager<RG, F, O, C>;
5887
+ /**
5888
+ * Registers a listener called after every change to the query, and returns a function that
5889
+ * unregisters it. Mutations that resolve to a no-op do not notify, and a
5890
+ * {@link QueryManager.batch batch} notifies once no matter how many changes it contains.
5891
+ *
5892
+ * Together with {@link QueryManager.getQuery}, this satisfies React's `useSyncExternalStore`
5893
+ * contract. Both methods are bound to the instance, so they are stable references across
5894
+ * renders and can be passed directly:
5895
+ *
5896
+ * ```ts
5897
+ * const query = useSyncExternalStore(q.subscribe, q.getQuery);
5898
+ * ```
5899
+ *
5900
+ * In React, prefer the `useQueryManager` hook from `react-querybuilder`, which wraps this.
5901
+ */
5902
+ subscribe: (listener: () => void) => (() => void);
5903
+ /**
5904
+ * Runs `fn`, deferring history recording and subscriber notification until it returns. The
5905
+ * whole batch becomes a single undo step and triggers a single notification, or neither if
5906
+ * the query ends up unchanged.
5907
+ *
5908
+ * Batches may be nested; only the outermost one commits. If `fn` throws, the query and its
5909
+ * history are restored to their pre-batch state and the error propagates, so a batch either
5910
+ * applies completely or not at all.
5911
+ *
5912
+ * {@link QueryManager.undo}, {@link QueryManager.redo}, and {@link QueryManager.clearHistory}
5913
+ * may be called inside a batch; their notifications are deferred like everything else. Because
5914
+ * they manage the history stacks themselves, a batch containing one of them records no entry of
5915
+ * its own, leaving the stacks exactly as those methods left them.
5916
+ */
5917
+ batch(fn: () => void): this;
5918
+ /** Whether there is a previous query to restore. Always `false` unless `history` is enabled. */
5919
+ canUndo(): boolean;
5920
+ /** Whether there is an undone query to restore. Always `false` unless `history` is enabled. */
5921
+ canRedo(): boolean;
5922
+ /** Restores the previous query. No-op when {@link QueryManager.canUndo} is `false`. */
5923
+ undo(): this;
5924
+ /** Restores the most recently undone query. No-op when {@link QueryManager.canRedo} is `false`. */
5925
+ redo(): this;
5926
+ /** Discards all undo/redo history without changing the current query. */
5927
+ clearHistory(): this;
5928
+ /**
5929
+ * The recorded history: `past` oldest first, `future` newest first. Both are copies, so
5930
+ * mutating them does not affect the manager.
5931
+ */
5932
+ getHistory(): {
5933
+ past: RG[];
5934
+ future: RG[];
5935
+ };
5936
+ /**
5937
+ * Validates the current query with the configured validator.
5938
+ *
5939
+ * The result is cached until the query changes, so a custom `validator` with side effects (or
5940
+ * one that depends on anything other than the query) may run fewer times than expected.
5941
+ */
5942
+ validate(): boolean | ValidationMap;
5943
+ /** Generates a JSON string from the current query. */
5944
+ format(): string;
5945
+ /** Generates a result based on the provided rule group processor. */
5946
+ format<TResult = unknown>(options: FormatQueryOptions & {
5947
+ ruleGroupProcessor: RuleGroupProcessor<TResult>;
5948
+ }): TResult;
5949
+ /** Generates a {@link ParameterizedSQL} object from the current query. */
5950
+ format(options: "parameterized" | (FormatQueryOptions & {
5951
+ format: "parameterized";
5952
+ })): ParameterizedSQL;
5953
+ /** Generates a {@link ParameterizedNamedSQL} object from the current query. */
5954
+ format(options: "parameterized_named" | (FormatQueryOptions & {
5955
+ format: "parameterized_named";
5956
+ })): ParameterizedNamedSQL;
5957
+ /** Generates a JsonLogic object from the current query. */
5958
+ format(options: "jsonlogic" | (FormatQueryOptions & {
5959
+ format: "jsonlogic";
5960
+ })): RQBJsonLogic;
5961
+ /** Generates an ElasticSearch query object from the current query. */
5962
+ format(options: "elasticsearch" | (FormatQueryOptions & {
5963
+ format: "elasticsearch";
5964
+ })): Record<string, any>;
5965
+ /** Generates a MongoDB query object from the current query. */
5966
+ format(options: "mongodb_query" | (FormatQueryOptions & {
5967
+ format: "mongodb_query";
5968
+ })): Record<string, any>;
5969
+ /** Generates a Prisma ORM query object from the current query. */
5970
+ format(options: "prisma" | (FormatQueryOptions & {
5971
+ format: "prisma";
5972
+ })): Record<string, any>;
5973
+ /** Generates a Drizzle ORM query object from the current query. */
5974
+ format(options: "drizzle" | (FormatQueryOptions & {
5975
+ format: "drizzle";
5976
+ })): ReturnType<typeof defaultRuleGroupProcessorDrizzle>;
5977
+ /** Generates a TanStack DB query object from the current query. */
5978
+ format(options: "tanstack_db" | (FormatQueryOptions & {
5979
+ format: "tanstack_db";
5980
+ })): ReturnType<typeof defaultRuleGroupProcessorTanStackDB>;
5981
+ /** Generates a Sequelize ORM query object from the current query. */
5982
+ format(options: "sequelize" | (FormatQueryOptions & {
5983
+ format: "sequelize";
5984
+ })): ReturnType<typeof defaultRuleGroupProcessorSequelize>;
5985
+ /** Generates a diagnostics result from the current query. */
5986
+ format(options: "diagnostics" | (FormatQueryOptions & {
5987
+ format: "diagnostics";
5988
+ })): DiagnosticsResult;
5989
+ /** Generates a query string in the requested format. */
5990
+ format(options: Exclude<ExportFormat, ExportObjectFormats>): string;
5991
+ /** Generates a query string in the requested format. */
5992
+ format(options: FormatQueryOptions & {
5993
+ format: Exclude<ExportFormat, ExportObjectFormats>;
5994
+ }): string;
5995
+ /** Generates a query string in the requested format. */
5996
+ format(options: FormatQueryOptions): string;
5997
+ /**
5998
+ * Yields every rule and group in the query, depth-first in pre-order, starting with the root
5999
+ * group itself. Combinator strings in independent-combinator groups are skipped.
6000
+ *
6001
+ * ```ts
6002
+ * for (const { node, path, parent } of qm.walk({ rulesOnly: true })) {
6003
+ * console.log(path, node.field);
6004
+ * }
6005
+ * ```
6006
+ *
6007
+ * Traversal operates on the query as it was when iteration began, so mutating the manager
6008
+ * mid-iteration does not affect a walk already in progress. Because generators are lazy, that
6009
+ * happens on the first iteration step rather than when `walk` is called.
6010
+ *
6011
+ * @yields Every rule and group in the query, subject to `options`.
6012
+ */
6013
+ walk(options?: WalkOptions): Generator<QueryNode<RG>>;
6014
+ /** Yields every rule in the query. Shorthand for `walk({ ...options, rulesOnly: true })`. */
6015
+ rules(options?: Omit<WalkOptions, "rulesOnly" | "groupsOnly">): Generator<QueryNode<RG>>;
6016
+ /**
6017
+ * Yields every group in the query, including the root group. Shorthand for
6018
+ * `walk({ ...options, groupsOnly: true })`.
6019
+ */
6020
+ groups(options?: Omit<WalkOptions, "rulesOnly" | "groupsOnly">): Generator<QueryNode<RG>>;
6021
+ /** Returns the first node matching `predicate`, or `null` if there is none. */
6022
+ find(predicate: (entry: QueryNode<RG>) => boolean, options?: WalkOptions): QueryNode<RG> | null;
6023
+ /** Returns every node matching `predicate`. */
6024
+ filter(predicate: (entry: QueryNode<RG>) => boolean, options?: WalkOptions): QueryNode<RG>[];
6025
+ /** Equivalent to {@link QueryManager.walk} with no options, enabling `for...of` and spread. */
6026
+ [Symbol.iterator](): Generator<QueryNode<RG>>;
6027
+ /**
6028
+ * Returns the rule or group at the given path, or `null` if the path can't be resolved.
6029
+ *
6030
+ * Unlike the standalone {@link findPath}, which can return `undefined` for an out-of-range
6031
+ * index, unresolvable paths are always normalized to `null` here.
6032
+ */
6033
+ findPath(path: Path): FindPathReturnType;
6034
+ /**
6035
+ * Returns the rule or group with the given `id`, or `null` if there is none. Backed by an
6036
+ * index built once per query, so repeated lookups are constant time.
6037
+ */
6038
+ findID(id: string): FindPathReturnType;
6039
+ /**
6040
+ * Returns the {@link Path} of the rule or group with the given `id`, or `null` if there is
6041
+ * none. Backed by an index built once per query, so repeated lookups are constant time.
6042
+ */
6043
+ getPathOfID(id: string): Path | null;
6044
+ /**
6045
+ * Determines whether the rule or group at the given path is disabled, either itself or by an
6046
+ * ancestor group.
6047
+ */
6048
+ pathIsDisabled(path: Path): boolean;
6049
+ /** Returns the rule or group at the given path or `id`, or `null` if it can't be resolved. */
6050
+ getNode(pathOrID: Path | string): FindPathReturnType;
6051
+ /**
6052
+ * Returns the rule at the given path or `id`, or `null` if it can't be resolved _or_ resolves
6053
+ * to a group.
6054
+ */
6055
+ getRule(pathOrID: Path | string): RuleType | null;
6056
+ /**
6057
+ * Returns the group at the given path or `id`, or `null` if it can't be resolved _or_
6058
+ * resolves to a rule.
6059
+ */
6060
+ getGroup(pathOrID: Path | string): RG | null;
6061
+ /**
6062
+ * Returns the group containing the rule or group at the given path or `id`. Returns `null`
6063
+ * for the root group, which has no parent, and when the target can't be resolved.
6064
+ */
6065
+ getParent(pathOrID: Path | string): RG | null;
6066
+ /**
6067
+ * The normalized field list, as the `QueryBuilder` component would render it. Needed to
6068
+ * populate a field selector.
6069
+ */
6070
+ getFields(): FullOptionList<F>;
6071
+ /**
6072
+ * The normalized combinator list, as the `QueryBuilder` component would render it. Needed to
6073
+ * populate a combinator selector.
6074
+ */
6075
+ getCombinators(): FullOptionList<C>;
6076
+ /**
6077
+ * The field configuration for a field name. When the field isn't configured, returns the same
6078
+ * minimal fallback (`{ name, value, label }`, all set to the field name) that
6079
+ * {@link QueryManager.getRuleContext} reports as `fieldData`, so both access paths agree.
6080
+ */
6081
+ getFieldData(field: string): F;
6082
+ /** The operator list for a field, mirroring `QueryBuilder`'s precedence. */
6083
+ getOperators(field: string): FullOptionList<O>;
6084
+ /** The value sources available for a field/operator pair. */
6085
+ getValueSources(field: string, operator: string): ValueSourceFullOptions;
6086
+ /** The match modes available for a field. */
6087
+ getMatchModes(field: string): MatchModeOptions;
6088
+ /** The value option list for a field/operator pair. */
6089
+ getValues(field: string, operator: string): FullOptionList<Option>;
6090
+ /** The value editor type for a field/operator pair. */
6091
+ getValueEditorType(field: string, operator: string): ValueEditorType;
6092
+ /**
6093
+ * Resolves everything about a rule that depends on the field/operator configuration—field data,
6094
+ * operators, value editor type, value list, value sources, match modes, and validation result.
6095
+ * Returns `null` when the target can't be resolved or isn't a rule.
6096
+ *
6097
+ * This is the same derivation the `useRule` hook performs, so a non-React implementation can
6098
+ * render a rule without reimplementing the configuration precedence rules.
6099
+ */
6100
+ getRuleContext(pathOrID: Path | string): RuleContext<F> | null;
6101
+ /**
6102
+ * Resolves everything about a rule group that depends on the combinator configuration, plus its
6103
+ * validation result. Returns `null` when the target can't be resolved or isn't a group.
6104
+ *
6105
+ * This is the same derivation the `useRuleGroup` hook performs.
6106
+ */
6107
+ getRuleGroupContext(pathOrID?: Path | string): RuleGroupContext<C> | null;
6108
+ /** Whether the current query uses independent combinators. */
6109
+ isIC(): boolean;
6110
+ /**
6111
+ * Returns the signature describing how the current query differs from `other`, as used by
6112
+ * this manager's history coalescing.
6113
+ */
6114
+ signatureOf(other: RuleGroupTypeAny): string;
6115
+ /** Generates a {@link DiagnosticsResult}. Shorthand for `format('diagnostics')`. */
6116
+ diagnostics(): DiagnosticsResult;
6117
+ /**
6118
+ * Returns the current query, so `JSON.stringify(queryManager)` produces the same output as
6119
+ * `JSON.stringify(queryManager.getQuery())`.
6120
+ */
6121
+ toJSON(): RG;
6122
+ /**
6123
+ * Returns a new manager with the same configuration and the current query converted to use
6124
+ * independent combinators. Idempotent, and never modifies this manager. As with
6125
+ * {@link QueryManager.clone}, subscribers and history are not carried over.
6126
+ */
6127
+ toIC(): QueryManager<AsRuleGroup<ToRuleGroupTypeIC<RG>>, F, O, C>;
6128
+ /**
6129
+ * Returns a new manager with the same configuration and the current query converted to use a
6130
+ * single combinator per group. Idempotent, and never modifies this manager. As with
6131
+ * {@link QueryManager.clone}, subscribers and history are not carried over.
6132
+ */
6133
+ fromIC(): QueryManager<AsRuleGroup<ToRuleGroupType<RG>>, F, O, C>;
6134
+ /**
6135
+ * Runs {@link transformQuery} against the current query and returns its result.
6136
+ *
6137
+ * Unlike {@link QueryManager.toIC}/{@link QueryManager.fromIC}, this returns the raw
6138
+ * transformed value rather than a new manager, since `transformQuery` can produce arbitrary
6139
+ * shapes that are no longer valid queries. This manager is never modified.
6140
+ */
6141
+ transform<T = any>(options?: TransformQueryOptions<RG>): T;
6142
+ }
6143
+ //#endregion
6144
+ //#region src/utils/regenerateIDs.d.ts
6145
+ /**
6146
+ * Options object for {@link regenerateID}/{@link regenerateIDs}.
6147
+ */
6148
+ interface RegenerateIdOptions {
6149
+ idGenerator?: () => string;
6150
+ }
6151
+ /**
6152
+ * Generates a new `id` property for a rule.
6153
+ */
6154
+ declare const regenerateID: <R extends RuleType>(rule: R, { idGenerator }?: RegenerateIdOptions) => SetRequired<R, "id">;
6155
+ /**
6156
+ * Recursively generates new `id` properties for a rule group and all its rules and subgroups.
6157
+ */
6158
+ declare const regenerateIDs: <RG>(subject: RG, { idGenerator }?: RegenerateIdOptions) => RG & {
6159
+ id: string;
6160
+ };
6161
+ //#endregion
6162
+ //#region src/utils/ruleFactory.d.ts
6163
+ /**
6164
+ * Everything {@link createRule} needs to produce a new rule. Each member corresponds to the
6165
+ * `QueryBuilder` prop (or `useQueryBuilderSetup` output) of the same name.
6166
+ */
6167
+ interface CreateRuleOptions<F extends FullField = FullField> {
6168
+ fields: FullOptionList<F>;
6169
+ getDefaultField?: string | ((fieldsData: FullOptionList<F>) => string);
6170
+ /** Produces the default operator for a field, i.e. `resolveDefaultOperator` already bound. */
6171
+ getRuleDefaultOperator: (field: string) => string;
6172
+ /** Produces the value sources for a field/operator pair. */
6173
+ getValueSources: (field: string, operator: string, misc: {
6174
+ fieldData: F;
6175
+ }) => ValueSourceFullOptions;
6176
+ /** Produces the match modes for a field. */
6177
+ getMatchModes: (field: string, misc: {
6178
+ fieldData: F;
6179
+ }) => MatchModeOptions;
6180
+ /** Produces the default `value` for an otherwise-complete rule. */
6181
+ getRuleDefaultValue: (rule: RuleType) => unknown;
6182
+ idGenerator?: () => string;
6183
+ }
6184
+ /**
6185
+ * Creates a rule from the given configuration, applying the same precedence as the
6186
+ * `QueryBuilder` component. The `value` is computed in a second pass, once `field`, `operator`,
6187
+ * and `valueSource` are known, since the default value depends on all three.
6188
+ *
6189
+ * @group Query Tools
6190
+ */
6191
+ declare const createRule: <F extends FullField = FullField>({ fields, getDefaultField, getRuleDefaultOperator, getValueSources, getMatchModes, getRuleDefaultValue, idGenerator }: CreateRuleOptions<F>) => RuleType;
6192
+ /**
6193
+ * Everything {@link createRuleGroup} needs to produce a new group.
6194
+ */
6195
+ interface CreateRuleGroupOptions<C extends FullCombinator = FullCombinator> {
6196
+ combinators: FullOptionList<C>;
6197
+ /** When `true`, the new group contains one new rule. */
6198
+ addRuleToNewGroups?: boolean;
6199
+ /** Produces that rule, i.e. {@link createRule} already bound. */
6200
+ createRule: () => RuleType;
6201
+ idGenerator?: () => string;
6202
+ }
6203
+ /**
6204
+ * Creates a group from the given configuration. Pass `true` for `independentCombinators` to omit
6205
+ * the `combinator` property.
6206
+ *
6207
+ * The group's own `id` is generated _before_ any contained rule's, matching the order the
6208
+ * `QueryBuilder` component has always used. This is observable when `idGenerator` is
6209
+ * deterministic, as it often is in tests.
6210
+ *
6211
+ * @group Query Tools
6212
+ */
6213
+ declare const createRuleGroup: <C extends FullCombinator = FullCombinator>({ combinators, addRuleToNewGroups, createRule: createRuleMain, idGenerator }: CreateRuleGroupOptions<C>, independentCombinators?: boolean) => RuleGroupTypeAny;
6214
+ //#endregion
6215
+ //#region src/utils/signature.d.ts
6216
+ /**
6217
+ * Signature returned when a change alters the _shape_ of the query—rules or groups added,
6218
+ * removed, moved, or reordered—rather than the properties of a single node. Structural changes
6219
+ * never coalesce with each other, so each one produces its own history entry.
6220
+ */
6221
+ declare const structuralSignature = "~structural";
6222
+ /**
6223
+ * Signature returned when two queries differ by reference only, with no observable difference
6224
+ * in their properties.
6225
+ */
6226
+ declare const unchangedSignature = "";
6227
+ /**
6228
+ * Describes _what changed_ between two versions of a query as a short string, so that
6229
+ * consecutive edits to the same property of the same rule (e.g. typing in a value editor) can
6230
+ * be recognized and coalesced into a single history entry.
6231
+ *
6232
+ * Returns {@link structuralSignature} for changes to the shape of the query, {@link unchangedSignature} when the
6233
+ * two queries differ by reference only, and `"<id>:<props>"` otherwise.
6234
+ *
6235
+ * The walk prunes on reference equality, so it costs O(depth) rather than O(size) for the
6236
+ * single-node edits that make up the overwhelming majority of changes.
6237
+ *
6238
+ * Note that this relies on the structural sharing that Immer—and therefore every query
6239
+ * produced by RQB's own update functions—guarantees: nodes that did not change keep their
6240
+ * identity. A query that has been wholly rebuilt (deep-cloned, round-tripped through JSON,
6241
+ * re-parsed from a string) shares no identity with its predecessor, so it is reported as
6242
+ * {@link structuralSignature} and will not coalesce. That is a graceful degradation—every change simply
6243
+ * gets its own history entry—but controlled components that clone the query on every change
6244
+ * will not benefit from coalescing.
6245
+ */
6246
+ declare const signatureOf: (prev: RuleGroupTypeAny, next: RuleGroupTypeAny) => string;
6247
+ //#endregion
6248
+ export { AbortInfo, AbortOptions, AbortReason, AccessibleDescriptionGenerator, ActionElementEventHandler, AddMethod, AddOptions, Arity, BaseFullOption, BaseOption, BaseOptionMap, BaseTranslation, BaseTranslationWithLabel, BaseTranslationWithPlaceholders, BaseTranslations, BaseTranslationsFull, Classname, ClassnameCondition, ClassnameSpec, Classnames, Combinator, CombinatorByValue, CommonRuleAndGroupProperties, CommonRuleSubComponentProps, ConstituentWordOrder, ConstituentWordOrderString, CreateRuleGroupOptions, CreateRuleOptions, DefaultCombinator, DefaultCombinatorExtended, DefaultCombinatorName, DefaultCombinatorNameExtended, DefaultCombinators, DefaultCombinatorsExtended, DefaultMatchModes, DefaultOperator, DefaultOperatorName, DefaultOperators, DefaultRuleGroupArray, DefaultRuleGroupICArray, DefaultRuleGroupType, DefaultRuleGroupTypeAny, DefaultRuleGroupTypeIC, DefaultRuleOrGroupArray, DefaultRuleType, DeriveClassNamesOptions, DiagnosticEntry, DiagnosticsFieldSummaryEntry, DiagnosticsResult, DiagnosticsStats, DndClassNameState, DndDropTargetType, DragCollection, DraggedItem, DropCollection, DropEffect, DropResult, ExportFormat, ExportObjectFormats, ExportOperatorMap, ExpressionNode, Field, FieldByValue, FindPathReturnType, FlexibleOption, FlexibleOptionGroup, FlexibleOptionList, FlexibleOptionListProp, FormatQueryFinalOptions, FormatQueryOptions, FormatQueryValidateRule, FullCombinator, FullField, FullOperator, FullOption, FullOptionList, FullOptionMap, FullOptionRecord, GenericizeRuleGroupType, GetOptionIdentifierType, GetOptionType, GetRuleDefaultValueOptions, GetRuleGroupType, GetRuleTypeFromGroupWithFieldAndOperator, GroupMethod, GroupOptions, GroupVariantCondition, GuardOptions, InputType, InsertMethod, InsertOptions, type JsonLogicAll, type JsonLogicAnd, type JsonLogicDoubleNegation, type JsonLogicEqual, type JsonLogicGreaterThan, type JsonLogicGreaterThanOrEqual, type JsonLogicInArray, type JsonLogicInString, type JsonLogicLessThan, type JsonLogicLessThanOrEqual, type JsonLogicNegation, type JsonLogicNone, type JsonLogicNotEqual, type JsonLogicOr, type JsonLogicReservedOperations, type JsonLogicRulesLogic, type JsonLogicSome, type JsonLogicStrictEqual, type JsonLogicStrictNotEqual, type JsonLogicVar, LogType, MatchConfig, MatchMode, MatchModeOptions, MoveMethod, MoveOptions, NLTranslationKey, NLTranslations, NameLabelPair, Operator, OperatorByValue, Option, OptionGroup, OptionList, OuterClassNameOptions, ParameterizedNamedSQL, ParameterizedSQL, ParseNumberMethod, ParseNumberOptions, ParseNumbersPropConfig, Path, PathInfo, Placeholder, PrepareOptionListParams, PreparedOptionList, PreparerOptions, QueryActionCallbacks, QueryActionHandlers, QueryActions, QueryActionsConfig, QueryBuilderFlags, QueryHistoryOptions, QueryManager, QueryManagerError, QueryManagerOptions, QueryNode, QueryValidator, RQBJsonLogic, RQBJsonLogicEndsWith, RQBJsonLogicStartsWith, RQBJsonLogicVar, RegenerateIdOptions, RemoveMethod, RemoveNullability, RemoveOptions, ResolveOptionListOptions, RuleClassNameState, RuleClassnameKey, RuleContext, RuleContextResolvers, RuleDiagnosticsResult, RuleFacet, RuleGroupArray, RuleGroupClassnameKey, RuleGroupContext, RuleGroupDiagnosticsArray, RuleGroupDiagnosticsResult, RuleGroupICArray, RuleGroupICDiagnosticsArray, RuleGroupICDiagnosticsResult, RuleGroupProcessor, RuleGroupType, RuleGroupTypeAny, RuleGroupTypeIC, RuleOrGroupArray, RuleProcessor, RuleType, RuleValidator, SQLPreset, StrictOptions, StringUnionToFlexibleOptionArray, StringUnionToFullOptionArray, TestID, ToFlexibleOption, ToFullOption, ToRuleGroupType, ToRuleGroupTypeIC, TransformQueryOptions, UpdateMethod, UpdateOptions, UpdateValueMap, UpdateableProperties, ValidationMap, ValidationResult, ValueChangeEventHandler, ValueEditorType, ValueOption, ValueProcessor, ValueProcessorByRule, ValueProcessorLegacy, ValueProcessorOptions, ValueSource, ValueSourceFlexibleOptions, ValueSourceFullOptions, ValueSources, WalkOptions, WithRequired, WithUnknownIndex, add, addInPlace, betweenOperators, bigIntJsonParseReviver, bigIntJsonStringifyReplacer, celCombinatorMap, clsx, coerceBigIntValue, coerceInputType, convertFromIC, convertQuery, convertToIC, createQueryActions, createRule, createRuleGroup, cypherCombinatorMap, defaultCELValueProcessor, defaultCoalesceMs, defaultCombinatorLabelMap, defaultCombinators, defaultCombinatorsExtended, defaultControlClassnames, defaultExportOperatorMap, defaultJoinChar, defaultMatchModes, defaultMaxHistory, defaultMongoDBValueProcessor, defaultNLTranslations, defaultOperatorLabelMap, defaultOperatorNegationMap, defaultOperatorProcessorNL, defaultOperatorProcessorSQL, defaultOperators, defaultPlaceholderFieldGroupLabel, defaultPlaceholderFieldLabel, defaultPlaceholderFieldName, defaultPlaceholderLabel, defaultPlaceholderName, defaultPlaceholderOperatorGroupLabel, defaultPlaceholderOperatorLabel, defaultPlaceholderOperatorName, defaultPlaceholderValueGroupLabel, defaultPlaceholderValueLabel, defaultPlaceholderValueName, defaultRuleGroupProcessorCEL, defaultRuleGroupProcessorCypher, defaultRuleGroupProcessorDiagnostics, defaultRuleGroupProcessorDrizzle, defaultRuleGroupProcessorElasticSearch, defaultRuleGroupProcessorGremlin, defaultRuleGroupProcessorJSONata, defaultRuleGroupProcessorJsonLogic, defaultRuleGroupProcessorLDAP, defaultRuleGroupProcessorMongoDB, defaultRuleGroupProcessorMongoDBQuery, defaultRuleGroupProcessorNL, defaultRuleGroupProcessorParameterized, defaultRuleGroupProcessorPrisma, defaultRuleGroupProcessorSPARQL, defaultRuleGroupProcessorSQL, defaultRuleGroupProcessorSequelize, defaultRuleGroupProcessorSpEL, defaultRuleGroupProcessorTanStackDB, defaultRuleProcessorCEL, defaultRuleProcessorCypher, defaultRuleProcessorDrizzle, defaultRuleProcessorElasticSearch, defaultRuleProcessorGremlin, defaultRuleProcessorJSONata, defaultRuleProcessorJsonLogic, defaultRuleProcessorLDAP, defaultRuleProcessorMongoDB, defaultRuleProcessorMongoDBQuery, defaultRuleProcessorNL, defaultRuleProcessorParameterized, defaultRuleProcessorPrisma, defaultRuleProcessorSPARQL, defaultRuleProcessorSQL, defaultRuleProcessorSequelize, defaultRuleProcessorSpEL, defaultRuleProcessorTanStackDB, defaultSpELValueProcessor, defaultTranslations, defaultValidator, defaultValueProcessor, defaultValueProcessorByRule, defaultValueProcessorCELByRule, defaultValueProcessorMongoDBByRule, defaultValueProcessorNL, defaultValueProcessorSpELByRule, derivePathInfo, deriveRuleClassName, deriveRuleClassNames, deriveRuleContext, deriveRuleGroupClassNames, deriveRuleGroupContext, deriveRuleGroupOuterClassName, deriveRuleOuterClassName, exceedsMaxLevels, filterFieldsByComparator, findID, findPath, formatQuery, formatQueryOptionPresets, generateAccessibleDescription, generateID, getCommonAncestorPath, getFieldData, getFirstOption, getGuardAbortReason, getLikeWildcards, getMatchModesUtil, getMultiValueUpdate, getNLTranslataion, getOption, getParametersAsList, getParentPath, getParseNumberMethod, getPathOfID, getQuoteFieldNamesWithArray, getQuotedFieldName, getRuleDefaultValue$1 as getRuleDefaultValue, getRuleGroupCombinator, getRuleInputType, getRuleValidationResult, getRuleValueEditorType, getRuleValueSourceOptions, getRuleValues, getSQLConcat, getSubqueryElementAlias, getValidationClassNames, getValueEditorReset, getValueSelectorUpdate, getValueSourcesUtil, group, groupInPlace, groupInvalidReasons, hideValueControlsForOperator, inOperators, insert, insertInPlace, isAncestor, isBetweenOperator, isFlexibleOptionArray, isFlexibleOptionGroupArray, isFullOptionArray, isFullOptionGroupArray, isOptionGroupArray, isPojo, isRuleGroup, isRuleGroupType, isRuleGroupTypeIC, isRuleOrGroupValid, isRuleType, isUnsafeKey, isValidValue, isValidationResult, isValueProcessorLegacy, joinWith, jsonLogicAdditionalOperators, lc, mapSQLOperator, mergeAnyTranslation, mergeAnyTranslations, mergeClassnames, mongoDbFallback, mongoOperators, move, moveInPlace, normalizeConstituentWordOrder, normalizeValueSelectorValue, nullFreeArray, nullOperators, nullOrUndefinedOrEmpty, numericRegex, numerifyValues, objectEntries, objectKeys, parseNumber, pathIsDisabled, pathIsDisabledByPaths, pathsAreEqual, preferAnyProp, preferFlagProps, preferProp, prepareOptionList, prepareRule, prepareRuleGroup, prepareRuleOrGroup, prismaFallback, prismaOperators, processMatchMode, queryBuilderFlagDefaults, regenerateID, regenerateIDs, relationalOperators, remove, removeInPlace, resolveCandidateQuery, resolveDefaultOperator, resolveOperatorList, resolveValueEditorType, resolveValueList, rootPath, shouldRenderAsNumber, signatureOf, sparqlVar, splitBy, sqlDialectPresets, standardClassnames, strictAbortReasons, stripParamPrefix, structuralSignature, subqueryElementAliasBase, substringOperators, toArray, toFlatOptionArray, toFullOption, toFullOptionList, toFullOptionMap, transformQuery, trimIfString, unchangedSignature, uniqByIdentifier, uniqByName, uniqOptGroups, uniqOptList, update, updateInPlace, uuidV4regex, withParamPrefix, wrapLikeFragment };
4879
6249
  //# sourceMappingURL=react-querybuilder_core.cjs.production.d.ts.map