@react-querybuilder/core 8.22.5 → 8.23.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.
- package/derivations/package.json +4 -0
- package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +2078 -1665
- package/dist/cjs/react-querybuilder_core.cjs.development.js +1293 -422
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +2078 -1665
- package/dist/cjs/react-querybuilder_core.cjs.production.js +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.js.map +1 -1
- package/dist/{convertQuery-Cw76XFIn.js → convertQuery-BLT0GIhM.js} +17 -8
- package/dist/{convertQuery-Cw76XFIn.js.map → convertQuery-BLT0GIhM.js.map} +1 -1
- package/dist/{convertQuery-D_4J7E-Z.mjs → convertQuery-DaXv3h7S.mjs} +6 -3
- package/dist/{convertQuery-D_4J7E-Z.mjs.map → convertQuery-DaXv3h7S.mjs.map} +1 -1
- package/dist/derivations.d.mts +2902 -0
- package/dist/derivations.d.ts +2902 -0
- package/dist/derivations.js +2845 -0
- package/dist/derivations.js.map +1 -0
- package/dist/derivations.mjs +2678 -0
- package/dist/derivations.mjs.map +1 -0
- package/dist/formatQuery.d.mts +2 -895
- package/dist/formatQuery.d.ts +2 -895
- package/dist/formatQuery.js +120 -140
- package/dist/formatQuery.js.map +1 -1
- package/dist/formatQuery.mjs +8 -28
- package/dist/formatQuery.mjs.map +1 -1
- package/dist/{import-DVWI7Fdh.d.mts → import-BdKPtLzo.d.mts} +2 -2
- package/dist/{import-6ExjhifL.d.ts → import-BfZTwhp2.d.ts} +2 -2
- package/dist/{index-CX9mehdL.d.mts → index-DOIE2pwx.d.mts} +274 -3
- package/dist/{index-CX9mehdL.d.ts → index-DOIE2pwx.d.ts} +274 -3
- package/dist/index-OF2Q1gTp.d.mts +895 -0
- package/dist/index-XueTy_XQ.d.ts +895 -0
- package/dist/isRuleOrGroupValid-CIMZNkt4.mjs +27 -0
- package/dist/isRuleOrGroupValid-CIMZNkt4.mjs.map +1 -0
- package/dist/isRuleOrGroupValid-CtUf4_4x.js +38 -0
- package/dist/isRuleOrGroupValid-CtUf4_4x.js.map +1 -0
- package/dist/{isRuleGroup-CqLThsbu.mjs → objectUtils-DDZ-KhV5.mjs} +25 -2
- package/dist/objectUtils-DDZ-KhV5.mjs.map +1 -0
- package/dist/{isRuleGroup-0JNiQgLg.js → objectUtils-DfnEmDSV.js} +48 -1
- package/dist/objectUtils-DfnEmDSV.js.map +1 -0
- package/dist/parseCEL.d.mts +2 -2
- package/dist/parseCEL.d.ts +2 -2
- package/dist/parseCEL.js +19 -16
- package/dist/parseCEL.js.map +1 -1
- package/dist/parseCEL.mjs +12 -9
- package/dist/parseCEL.mjs.map +1 -1
- package/dist/parseCypher.d.mts +1 -1
- package/dist/parseCypher.d.ts +1 -1
- package/dist/parseGremlin.d.mts +1 -1
- package/dist/parseGremlin.d.ts +1 -1
- package/dist/parseJSONata.d.mts +2 -2
- package/dist/parseJSONata.d.ts +2 -2
- package/dist/parseJSONata.js +17 -14
- package/dist/parseJSONata.js.map +1 -1
- package/dist/parseJSONata.mjs +11 -8
- package/dist/parseJSONata.mjs.map +1 -1
- package/dist/parseJsonLogic.d.mts +2 -2
- package/dist/parseJsonLogic.d.ts +2 -2
- package/dist/parseJsonLogic.js +38 -38
- package/dist/parseJsonLogic.js.map +1 -1
- package/dist/parseJsonLogic.mjs +5 -5
- package/dist/parseMongoDB.d.mts +2 -2
- package/dist/parseMongoDB.d.ts +2 -2
- package/dist/parseMongoDB.js +50 -47
- package/dist/parseMongoDB.js.map +1 -1
- package/dist/parseMongoDB.mjs +35 -32
- package/dist/parseMongoDB.mjs.map +1 -1
- package/dist/parseSPARQL.d.mts +1 -1
- package/dist/parseSPARQL.d.ts +1 -1
- package/dist/parseSQL.d.mts +2 -2
- package/dist/parseSQL.d.ts +2 -2
- package/dist/parseSQL.js +27 -23
- package/dist/parseSQL.js.map +1 -1
- package/dist/parseSQL.mjs +21 -17
- package/dist/parseSQL.mjs.map +1 -1
- package/dist/parseSpEL.d.mts +2 -2
- package/dist/parseSpEL.d.ts +2 -2
- package/dist/parseSpEL.js +16 -13
- package/dist/parseSpEL.js.map +1 -1
- package/dist/parseSpEL.mjs +12 -9
- package/dist/parseSpEL.mjs.map +1 -1
- package/dist/parserUtils-BKPstAaO.mjs +30 -0
- package/dist/parserUtils-BKPstAaO.mjs.map +1 -0
- package/dist/parserUtils-DbBXyAht.js +41 -0
- package/dist/parserUtils-DbBXyAht.js.map +1 -0
- package/dist/{prepareQueryObjects-BnGL91Tt.js → prepareQueryObjects-Dj9cTl9D.js} +90 -63
- package/dist/prepareQueryObjects-Dj9cTl9D.js.map +1 -0
- package/dist/{prepareQueryObjects-ChINDIap.mjs → prepareQueryObjects-Dmyf3Wi_.mjs} +56 -59
- package/dist/prepareQueryObjects-Dmyf3Wi_.mjs.map +1 -0
- package/dist/react-querybuilder_core.d.mts +2078 -1665
- package/dist/react-querybuilder_core.legacy-esm.d.ts +2078 -1665
- package/dist/react-querybuilder_core.legacy-esm.js +1445 -635
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +1288 -424
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +2078 -1665
- package/dist/react-querybuilder_core.production.mjs +1 -1
- package/dist/react-querybuilder_core.production.mjs.map +1 -1
- package/dist/transformQuery-B7d9AWUf.d.mts +116 -0
- package/dist/transformQuery-BXDiUBGB.d.ts +116 -0
- package/dist/transformQuery.d.mts +2 -116
- package/dist/transformQuery.d.ts +2 -116
- package/dist/transformQuery.js +3 -4
- package/dist/transformQuery.js.map +1 -1
- package/dist/transformQuery.mjs +1 -2
- package/dist/transformQuery.mjs.map +1 -1
- package/dist/utils-CP5Jqy1P.mjs +1294 -0
- package/dist/utils-CP5Jqy1P.mjs.map +1 -0
- package/dist/utils-e-7KHkjV.js +1779 -0
- package/dist/utils-e-7KHkjV.js.map +1 -0
- package/package.json +33 -22
- package/dist/isRuleGroup-0JNiQgLg.js.map +0 -1
- package/dist/isRuleGroup-CqLThsbu.mjs.map +0 -1
- package/dist/objectUtils-Cr02aGxb.js +0 -27
- package/dist/objectUtils-Cr02aGxb.js.map +0 -1
- package/dist/objectUtils-DBlmJgBf.mjs +0 -16
- package/dist/objectUtils-DBlmJgBf.mjs.map +0 -1
- package/dist/prepareQueryObjects-BnGL91Tt.js.map +0 -1
- package/dist/prepareQueryObjects-ChINDIap.mjs.map +0 -1
- package/dist/utils-4k-j5FBa.mjs +0 -537
- package/dist/utils-4k-j5FBa.mjs.map +0 -1
- package/dist/utils-C79dxwZb.js +0 -752
- package/dist/utils-C79dxwZb.js.map +0 -1
|
@@ -1,4 +1,116 @@
|
|
|
1
|
+
import { produce } from "immer";
|
|
1
2
|
import { JsonLogicAll, JsonLogicAnd, JsonLogicDoubleNegation, JsonLogicEqual, JsonLogicGreaterThan, JsonLogicGreaterThanOrEqual, JsonLogicInArray, JsonLogicInString, JsonLogicLessThan, JsonLogicLessThanOrEqual, JsonLogicNegation, JsonLogicNone, JsonLogicNotEqual, JsonLogicOr, JsonLogicSome, JsonLogicStrictEqual, JsonLogicStrictNotEqual, JsonLogicVar, ReservedOperations as JsonLogicReservedOperations, RulesLogic, RulesLogic as JsonLogicRulesLogic } from "json-logic-js";
|
|
3
|
+
//#region src/controlPropKeys.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Runtime data describing the set of query builder controls and the props each one receives.
|
|
6
|
+
*
|
|
7
|
+
* These live in `@react-querybuilder/core` (not `react-querybuilder`) so that non-React ports
|
|
8
|
+
* can consume them without a React dependency.
|
|
9
|
+
*
|
|
10
|
+
* Nothing here can drift from the React implementation unnoticed:
|
|
11
|
+
* `react-querybuilder`'s `types/controlPropKeys.test.ts` gates {@link controlKeys} against
|
|
12
|
+
* `defaultControlElements` and `ControlElementsProp`, and every entry of
|
|
13
|
+
* {@link controlPropKeys} against the corresponding props interface—both at runtime and at
|
|
14
|
+
* compile time, in both directions.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* The name of every query builder control, alphabetized.
|
|
18
|
+
*
|
|
19
|
+
* @group Props
|
|
20
|
+
*/
|
|
21
|
+
declare const controlKeys: readonly ["actionElement", "addGroupAction", "addRuleAction", "cloneGroupAction", "cloneRuleAction", "combinatorSelector", "dragHandle", "fieldSelector", "inlineCombinator", "lockGroupAction", "lockRuleAction", "matchModeEditor", "muteGroupAction", "muteRuleAction", "notToggle", "operatorSelector", "removeGroupAction", "removeRuleAction", "rule", "ruleGroup", "ruleGroupBodyElements", "ruleGroupHeaderElements", "shiftActions", "undoRedoActions", "valueEditor", "valueSelector", "valueSourceSelector"];
|
|
22
|
+
/**
|
|
23
|
+
* The name of a query builder control.
|
|
24
|
+
*
|
|
25
|
+
* @group Props
|
|
26
|
+
*/
|
|
27
|
+
type ControlKey = (typeof controlKeys)[number];
|
|
28
|
+
/**
|
|
29
|
+
* The full set of prop names each default control receives. Ports can use this to declare
|
|
30
|
+
* every prop explicitly instead of relying on fall-through/attribute inheritance.
|
|
31
|
+
*
|
|
32
|
+
* Each array is the complete, alphabetized key set of the control's props interface in
|
|
33
|
+
* `react-querybuilder`. The lists are written out in full rather than composed from shared
|
|
34
|
+
* bases because `--isolatedDeclarations` cannot infer array types built with spreads. A
|
|
35
|
+
* compile-time gate in `react-querybuilder` (`types/controlPropKeys.test.ts`) fails the build
|
|
36
|
+
* if any list drifts from its interface in either direction.
|
|
37
|
+
*
|
|
38
|
+
* @group Props
|
|
39
|
+
*/
|
|
40
|
+
declare const controlPropKeys: {
|
|
41
|
+
readonly actionElement: readonly ["className", "context", "disabled", "disabledTranslation", "handleOnClick", "label", "level", "path", "ruleOrGroup", "rules", "schema", "testID", "title", "validation"];
|
|
42
|
+
readonly addGroupAction: readonly ["className", "context", "disabled", "disabledTranslation", "handleOnClick", "label", "level", "path", "ruleOrGroup", "rules", "schema", "testID", "title", "validation"];
|
|
43
|
+
readonly addRuleAction: readonly ["className", "context", "disabled", "disabledTranslation", "handleOnClick", "label", "level", "path", "ruleOrGroup", "rules", "schema", "testID", "title", "validation"];
|
|
44
|
+
readonly cloneGroupAction: readonly ["className", "context", "disabled", "disabledTranslation", "handleOnClick", "label", "level", "path", "ruleOrGroup", "rules", "schema", "testID", "title", "validation"];
|
|
45
|
+
readonly cloneRuleAction: readonly ["className", "context", "disabled", "disabledTranslation", "handleOnClick", "label", "level", "path", "ruleOrGroup", "rules", "schema", "testID", "title", "validation"];
|
|
46
|
+
readonly combinatorSelector: readonly ["className", "context", "disabled", "handleOnChange", "level", "options", "path", "ruleGroup", "rules", "schema", "testID", "title", "validation", "value"];
|
|
47
|
+
readonly dragHandle: readonly ["className", "context", "disabled", "dragHandleAttributes", "label", "level", "path", "ruleOrGroup", "schema", "testID", "title", "validation"];
|
|
48
|
+
readonly fieldSelector: readonly ["className", "context", "disabled", "handleOnChange", "level", "operator", "options", "path", "rule", "schema", "testID", "title", "validation", "value"];
|
|
49
|
+
readonly inlineCombinator: readonly ["className", "component", "context", "disabled", "handleOnChange", "level", "options", "path", "ruleGroup", "rules", "schema", "testID", "title", "validation", "value"];
|
|
50
|
+
readonly lockGroupAction: readonly ["className", "context", "disabled", "disabledTranslation", "handleOnClick", "label", "level", "path", "ruleOrGroup", "rules", "schema", "testID", "title", "validation"];
|
|
51
|
+
readonly lockRuleAction: readonly ["className", "context", "disabled", "disabledTranslation", "handleOnClick", "label", "level", "path", "ruleOrGroup", "rules", "schema", "testID", "title", "validation"];
|
|
52
|
+
readonly matchModeEditor: readonly ["className", "classNames", "context", "disabled", "field", "fieldData", "handleOnChange", "level", "match", "numericEditorComponent", "options", "path", "rule", "schema", "selectorComponent", "testID", "thresholdPlaceholder", "title", "validation", "value"];
|
|
53
|
+
readonly muteGroupAction: readonly ["className", "context", "disabled", "disabledTranslation", "handleOnClick", "label", "level", "path", "ruleOrGroup", "rules", "schema", "testID", "title", "validation"];
|
|
54
|
+
readonly muteRuleAction: readonly ["className", "context", "disabled", "disabledTranslation", "handleOnClick", "label", "level", "path", "ruleOrGroup", "rules", "schema", "testID", "title", "validation"];
|
|
55
|
+
readonly notToggle: readonly ["checked", "className", "context", "disabled", "handleOnChange", "label", "level", "path", "ruleGroup", "schema", "testID", "title", "validation"];
|
|
56
|
+
readonly operatorSelector: readonly ["className", "context", "disabled", "field", "fieldData", "handleOnChange", "level", "options", "path", "rule", "schema", "testID", "title", "validation", "value"];
|
|
57
|
+
readonly removeGroupAction: readonly ["className", "context", "disabled", "disabledTranslation", "handleOnClick", "label", "level", "path", "ruleOrGroup", "rules", "schema", "testID", "title", "validation"];
|
|
58
|
+
readonly removeRuleAction: readonly ["className", "context", "disabled", "disabledTranslation", "handleOnClick", "label", "level", "path", "ruleOrGroup", "rules", "schema", "testID", "title", "validation"];
|
|
59
|
+
readonly rule: readonly ["actions", "context", "disabled", "dndRef", "dragHandleAttributes", "dragMonitorId", "dragRef", "dropEffect", "dropMonitorId", "dropNotAllowed", "field", "groupItems", "id", "isDragging", "isOver", "operator", "parentDisabled", "parentMuted", "path", "rule", "schema", "shiftDownDisabled", "shiftUpDisabled", "translations", "value", "valueSource"];
|
|
60
|
+
readonly ruleGroup: readonly ["actions", "combinator", "context", "disabled", "dragHandleAttributes", "dragMonitorId", "dragRef", "dropEffect", "dropMonitorId", "dropNotAllowed", "dropRef", "groupItems", "id", "isDragging", "isOver", "not", "parentDisabled", "parentMuted", "path", "previewRef", "ruleGroup", "rules", "schema", "shiftDownDisabled", "shiftUpDisabled", "translations"];
|
|
61
|
+
readonly ruleGroupBodyElements: readonly ["accessibleDescription", "actions", "addGroup", "addRule", "classNames", "cloneGroup", "combinator", "context", "disabled", "dragHandleAttributes", "dragMonitorId", "dragRef", "dropEffect", "dropMonitorId", "dropNotAllowed", "dropRef", "groupItems", "id", "isDragging", "isOver", "muted", "not", "onCombinatorChange", "onGroupAdd", "onIndependentCombinatorChange", "onNotToggleChange", "outerClassName", "parentDisabled", "parentMuted", "path", "pathsMemo", "previewRef", "removeGroup", "ruleGroup", "rules", "schema", "shiftDownDisabled", "shiftGroupDown", "shiftGroupUp", "shiftUpDisabled", "toggleLockGroup", "toggleMuteGroup", "translations", "validationClassName", "validationResult"];
|
|
62
|
+
readonly ruleGroupHeaderElements: readonly ["accessibleDescription", "actions", "addGroup", "addRule", "classNames", "cloneGroup", "combinator", "context", "disabled", "dragHandleAttributes", "dragMonitorId", "dragRef", "dropEffect", "dropMonitorId", "dropNotAllowed", "dropRef", "groupItems", "id", "isDragging", "isOver", "muted", "not", "onCombinatorChange", "onGroupAdd", "onIndependentCombinatorChange", "onNotToggleChange", "outerClassName", "parentDisabled", "parentMuted", "path", "pathsMemo", "previewRef", "removeGroup", "ruleGroup", "rules", "schema", "shiftDownDisabled", "shiftGroupDown", "shiftGroupUp", "shiftUpDisabled", "toggleLockGroup", "toggleMuteGroup", "translations", "validationClassName", "validationResult"];
|
|
63
|
+
readonly shiftActions: readonly ["className", "context", "disabled", "labels", "level", "path", "ruleOrGroup", "schema", "shiftDown", "shiftDownDisabled", "shiftUp", "shiftUpDisabled", "testID", "title", "titles", "validation"];
|
|
64
|
+
readonly undoRedoActions: readonly ["className", "classNames", "context", "disabled", "labels", "level", "path", "ruleOrGroup", "schema", "testID", "title", "titles", "validation"];
|
|
65
|
+
readonly valueEditor: readonly ["className", "context", "disabled", "field", "fieldData", "handleOnChange", "inputType", "level", "listsAsArrays", "operator", "parseNumbers", "path", "rule", "schema", "selectorComponent", "separator", "skipHook", "testID", "title", "type", "validation", "value", "valueSource", "values"];
|
|
66
|
+
readonly valueSelector: readonly ["className", "context", "disabled", "handleOnChange", "level", "listsAsArrays", "multiple", "options", "path", "schema", "testID", "title", "validation", "value"];
|
|
67
|
+
readonly valueSourceSelector: readonly ["className", "context", "disabled", "field", "fieldData", "handleOnChange", "level", "options", "path", "rule", "schema", "testID", "title", "validation", "value"];
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Which bulk override, if any, applies to each control: `"action"` for controls that a supplied
|
|
71
|
+
* `actionElement` replaces, `"selector"` for controls that a supplied `valueSelector` replaces,
|
|
72
|
+
* and `null` for controls that neither replaces.
|
|
73
|
+
*
|
|
74
|
+
* `actionElement` and `valueSelector` are themselves `null`—they are the _source_ of a bulk
|
|
75
|
+
* override, not a target of one.
|
|
76
|
+
*
|
|
77
|
+
* Replaces name-suffix sniffing (`key.endsWith('Action')`), which would silently misclassify a
|
|
78
|
+
* future control named e.g. `pathSelector`, and which disagrees between implementations about
|
|
79
|
+
* whether `shiftActions`/`undoRedoActions` (plural) match. They do not: neither receives the
|
|
80
|
+
* `actionElement` bulk override.
|
|
81
|
+
*
|
|
82
|
+
* @group Props
|
|
83
|
+
*/
|
|
84
|
+
declare const controlKind: {
|
|
85
|
+
readonly actionElement: null;
|
|
86
|
+
readonly addGroupAction: "action";
|
|
87
|
+
readonly addRuleAction: "action";
|
|
88
|
+
readonly cloneGroupAction: "action";
|
|
89
|
+
readonly cloneRuleAction: "action";
|
|
90
|
+
readonly combinatorSelector: "selector";
|
|
91
|
+
readonly dragHandle: null;
|
|
92
|
+
readonly fieldSelector: "selector";
|
|
93
|
+
readonly inlineCombinator: null;
|
|
94
|
+
readonly lockGroupAction: "action";
|
|
95
|
+
readonly lockRuleAction: "action";
|
|
96
|
+
readonly matchModeEditor: null;
|
|
97
|
+
readonly muteGroupAction: "action";
|
|
98
|
+
readonly muteRuleAction: "action";
|
|
99
|
+
readonly notToggle: null;
|
|
100
|
+
readonly operatorSelector: "selector";
|
|
101
|
+
readonly removeGroupAction: "action";
|
|
102
|
+
readonly removeRuleAction: "action";
|
|
103
|
+
readonly rule: null;
|
|
104
|
+
readonly ruleGroup: null;
|
|
105
|
+
readonly ruleGroupBodyElements: null;
|
|
106
|
+
readonly ruleGroupHeaderElements: null;
|
|
107
|
+
readonly shiftActions: null;
|
|
108
|
+
readonly undoRedoActions: null;
|
|
109
|
+
readonly valueEditor: null;
|
|
110
|
+
readonly valueSelector: null;
|
|
111
|
+
readonly valueSourceSelector: "selector";
|
|
112
|
+
};
|
|
113
|
+
//#endregion
|
|
2
114
|
//#region ../../node_modules/type-fest/source/primitive.d.ts
|
|
3
115
|
/**
|
|
4
116
|
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
|
@@ -3195,2334 +3307,2263 @@ declare const defaultMaxHistory = 50;
|
|
|
3195
3307
|
*/
|
|
3196
3308
|
declare const defaultCoalesceMs = 500;
|
|
3197
3309
|
//#endregion
|
|
3198
|
-
//#region src/utils/
|
|
3199
|
-
/**
|
|
3200
|
-
* Splits a string by a given character (see {@link defaultJoinChar}). Escaped characters
|
|
3201
|
-
* (characters preceded by a backslash) will not apply to the split, and the backslash will
|
|
3202
|
-
* be removed in the array element. Inverse of {@link joinWith}.
|
|
3203
|
-
*
|
|
3204
|
-
* @example
|
|
3205
|
-
* splitBy('this\\,\\,that,,the other,,,\\,')
|
|
3206
|
-
* // or
|
|
3207
|
-
* splitBy('this\\,\\,that,,the other,,,\\,', ',')
|
|
3208
|
-
* // would return
|
|
3209
|
-
* ['this,,that', '', 'the other', '', '', ',']
|
|
3210
|
-
*/
|
|
3211
|
-
declare const splitBy: (str?: string, splitChar?: string) => string[];
|
|
3310
|
+
//#region src/utils/queryTools.d.ts
|
|
3212
3311
|
/**
|
|
3213
|
-
*
|
|
3214
|
-
*
|
|
3215
|
-
*
|
|
3312
|
+
* Why a query tool returned the query unmodified. Query tools never throw; when they cannot
|
|
3313
|
+
* carry out an operation they return the original query and report the reason through
|
|
3314
|
+
* {@link AbortOptions.onAbort}.
|
|
3216
3315
|
*
|
|
3217
|
-
*
|
|
3218
|
-
*
|
|
3316
|
+
* `"same-location"` and `"no-change"` describe operations that were valid but had nothing to
|
|
3317
|
+
* do, so they are not errors. Every other reason indicates a target that could not be used.
|
|
3219
3318
|
*
|
|
3220
|
-
* @
|
|
3221
|
-
* joinWith(['this,,that', '', 'the other', '', '', ','], ', ')
|
|
3222
|
-
* // would return
|
|
3223
|
-
* 'this\\,\\,that, , the other, , , \\,'
|
|
3224
|
-
*/
|
|
3225
|
-
declare const joinWith: (strArr: unknown[], joinChar?: string) => string;
|
|
3226
|
-
type IsUnknown<T> = unknown extends T ? true : false;
|
|
3227
|
-
type Trimmed<T> = IsUnknown<T> extends true ? string : T;
|
|
3228
|
-
/**
|
|
3229
|
-
* Trims the value if it is a string. Otherwise returns the value as is.
|
|
3230
|
-
*/
|
|
3231
|
-
declare const trimIfString: <T>(val: T) => Trimmed<T>;
|
|
3232
|
-
type ToArrayResult<T> = IsUnknown<T> extends true ? string[] : T extends readonly (infer U)[] ? Trimmed<U>[] : T extends string ? string[] : T extends number ? number[] : never[];
|
|
3233
|
-
/**
|
|
3234
|
-
* Splits a string by comma then trims each element. Arrays are returned as is except
|
|
3235
|
-
* any string elements are trimmed.
|
|
3319
|
+
* @group Query Tools
|
|
3236
3320
|
*/
|
|
3237
|
-
|
|
3238
|
-
retainEmptyStrings?: boolean;
|
|
3239
|
-
}) => ToArrayResult<T>;
|
|
3321
|
+
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";
|
|
3240
3322
|
/**
|
|
3241
|
-
*
|
|
3323
|
+
* Details about an aborted query tool operation.
|
|
3324
|
+
*
|
|
3325
|
+
* @group Query Tools
|
|
3242
3326
|
*/
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
//#region src/utils/convertQuery.d.ts
|
|
3327
|
+
interface AbortInfo {
|
|
3328
|
+
/** Why the operation was aborted. */
|
|
3329
|
+
reason: AbortReason;
|
|
3330
|
+
/** The query tool that aborted. */
|
|
3331
|
+
operation: "add" | "remove" | "update" | "move" | "insert" | "group";
|
|
3332
|
+
/** The path or `id` that could not be used, when the reason relates to a specific target. */
|
|
3333
|
+
pathOrID?: Path | string;
|
|
3334
|
+
}
|
|
3252
3335
|
/**
|
|
3253
|
-
*
|
|
3336
|
+
* Options that block a mutation before it is attempted.
|
|
3254
3337
|
*
|
|
3255
|
-
*
|
|
3256
|
-
*
|
|
3338
|
+
* `disabled` is a property of the query itself, so honoring it is a matter of data integrity
|
|
3339
|
+
* rather than presentation: a query saved with a locked rule should stay locked when it is
|
|
3340
|
+
* loaded again. It is opt-in here only to preserve the existing behavior of the standalone
|
|
3341
|
+
* query tools; {@link QueryManager} enables it by default.
|
|
3257
3342
|
*
|
|
3258
3343
|
* @group Query Tools
|
|
3259
3344
|
*/
|
|
3260
|
-
|
|
3345
|
+
interface GuardOptions {
|
|
3346
|
+
/**
|
|
3347
|
+
* Abort when the target (or its parent, for `add`/`insert`) is disabled, either directly or
|
|
3348
|
+
* by descending from a disabled group. Defaults to `false`.
|
|
3349
|
+
*
|
|
3350
|
+
* Updating a rule or group's own `disabled` property is always permitted, since it is the
|
|
3351
|
+
* only way to re-enable it.
|
|
3352
|
+
*/
|
|
3353
|
+
respectDisabled?: boolean;
|
|
3354
|
+
/**
|
|
3355
|
+
* Paths that are disabled without the corresponding rule or group carrying a `disabled`
|
|
3356
|
+
* property, mirroring the array form of the `QueryBuilder` `disabled` prop. A path is treated
|
|
3357
|
+
* as disabled if it appears here or descends from a path that does.
|
|
3358
|
+
*
|
|
3359
|
+
* Like the `disabled` property, this is only honored when `respectDisabled` is `true`, and
|
|
3360
|
+
* updating a rule or group's own `disabled` property is still permitted.
|
|
3361
|
+
*/
|
|
3362
|
+
disabledPaths?: Path[];
|
|
3363
|
+
/** Abort every mutation, as though the entire query were disabled. Defaults to `false`. */
|
|
3364
|
+
queryDisabled?: boolean;
|
|
3365
|
+
/**
|
|
3366
|
+
* The maximum depth at which a group may be added. A group whose parent path is already this
|
|
3367
|
+
* deep is rejected by `add` and `insert`. Rules are unaffected. Defaults to `Infinity`.
|
|
3368
|
+
*/
|
|
3369
|
+
maxLevels?: number;
|
|
3370
|
+
}
|
|
3261
3371
|
/**
|
|
3262
|
-
*
|
|
3263
|
-
*
|
|
3264
|
-
* This function is idempotent: {@link RuleGroupTypeIC} queries will be
|
|
3265
|
-
* returned as-is.
|
|
3372
|
+
* Options for reporting aborted query tool operations.
|
|
3266
3373
|
*
|
|
3267
3374
|
* @group Query Tools
|
|
3268
3375
|
*/
|
|
3269
|
-
|
|
3376
|
+
interface AbortOptions extends GuardOptions {
|
|
3377
|
+
/**
|
|
3378
|
+
* Called when the operation returns the query unmodified, with the reason why. Query tools
|
|
3379
|
+
* never throw, so this is the only way to distinguish "the target was invalid" from
|
|
3380
|
+
* "the operation had nothing to do".
|
|
3381
|
+
*/
|
|
3382
|
+
onAbort?: (info: AbortInfo) => void;
|
|
3383
|
+
}
|
|
3270
3384
|
/**
|
|
3271
|
-
*
|
|
3272
|
-
* operation, use {@link convertToIC}.
|
|
3385
|
+
* Options shared by every query tool.
|
|
3273
3386
|
*
|
|
3274
3387
|
* @group Query Tools
|
|
3275
3388
|
*/
|
|
3276
|
-
|
|
3389
|
+
interface QueryToolOptions extends AbortOptions {
|
|
3390
|
+
/**
|
|
3391
|
+
* Set `false` to skip immer's auto-freeze on the returned query, e.g. when the query will be
|
|
3392
|
+
* handed to a framework that wraps it in a proxy (Vue `reactive`, Solid stores) or otherwise
|
|
3393
|
+
* needs to mutate it. Ignored by the `*InPlace` variants, which never freeze.
|
|
3394
|
+
*
|
|
3395
|
+
* @default true
|
|
3396
|
+
*/
|
|
3397
|
+
freeze?: boolean;
|
|
3398
|
+
}
|
|
3277
3399
|
/**
|
|
3278
|
-
*
|
|
3279
|
-
*
|
|
3400
|
+
* Whether a mutation targeting `pathOrID` is blocked by the given guards, and why.
|
|
3401
|
+
* Returns `null` when the mutation may proceed.
|
|
3402
|
+
*
|
|
3403
|
+
* Exported so that callers which run their own logic before mutating—such as a UI layer that
|
|
3404
|
+
* invokes a confirmation callback—can apply the same rules without duplicating them.
|
|
3280
3405
|
*
|
|
3281
3406
|
* @group Query Tools
|
|
3282
3407
|
*/
|
|
3283
|
-
declare
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
/** Classname keys that have both a standard class and a `controlClassnames` entry. */
|
|
3287
|
-
type StandardClassnameKey = keyof typeof standardClassnames & keyof Classnames;
|
|
3408
|
+
declare const getGuardAbortReason: (query: RuleGroupTypeAny, pathOrID: Path | string | undefined, guards?: GuardOptions, { asParent }?: {
|
|
3409
|
+
asParent?: boolean;
|
|
3410
|
+
}) => AbortReason | null;
|
|
3288
3411
|
/**
|
|
3289
|
-
*
|
|
3412
|
+
* Whether adding a group beneath `parentPath` would exceed `maxLevels`.
|
|
3290
3413
|
*
|
|
3291
|
-
*
|
|
3292
|
-
* entry. Set `standardOnly` when the standard class is conditional but no custom class
|
|
3293
|
-
* corresponds to it.
|
|
3414
|
+
* @group Query Tools
|
|
3294
3415
|
*/
|
|
3295
|
-
|
|
3296
|
-
key: StandardClassnameKey;
|
|
3297
|
-
when: (state: S) => boolean | undefined;
|
|
3298
|
-
standardOnly?: boolean;
|
|
3299
|
-
}
|
|
3416
|
+
declare const exceedsMaxLevels: (parentPath: Path | undefined, { maxLevels }?: GuardOptions) => boolean;
|
|
3300
3417
|
/**
|
|
3301
|
-
*
|
|
3302
|
-
*
|
|
3418
|
+
* Options for {@link add}.
|
|
3419
|
+
*
|
|
3420
|
+
* @group Query Tools
|
|
3303
3421
|
*/
|
|
3304
|
-
interface
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
/**
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
disabled?: boolean;
|
|
3323
|
-
muted?: boolean;
|
|
3324
|
-
hasSubQuery?: boolean;
|
|
3325
|
-
}
|
|
3326
|
-
/** State that contributes conditional classnames to the query builder's wrapper element. */
|
|
3327
|
-
interface QueryBuilderClassNameState {
|
|
3328
|
-
disabled?: boolean;
|
|
3329
|
-
validationResult?: boolean | ValidationMap;
|
|
3422
|
+
interface AddOptions extends QueryToolOptions {
|
|
3423
|
+
/**
|
|
3424
|
+
* If the query extends `RuleGroupTypeIC` (i.e. the query has independent
|
|
3425
|
+
* combinators), then the first combinator in this list will be inserted
|
|
3426
|
+
* before the new rule/group if the parent group is not empty. This option
|
|
3427
|
+
* is overridden by `combinatorPreceding`.
|
|
3428
|
+
*/
|
|
3429
|
+
combinators?: OptionList;
|
|
3430
|
+
/**
|
|
3431
|
+
* If the query extends `RuleGroupTypeIC` (i.e. the query has independent
|
|
3432
|
+
* combinators), then this combinator will be inserted before the new rule/group
|
|
3433
|
+
* if the parent group is not empty. This option will supersede `combinators`.
|
|
3434
|
+
*/
|
|
3435
|
+
combinatorPreceding?: string;
|
|
3436
|
+
/**
|
|
3437
|
+
* ID generator.
|
|
3438
|
+
*/
|
|
3439
|
+
idGenerator?: () => string;
|
|
3330
3440
|
}
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
/** The merged `controlClassnames` for the query builder. */
|
|
3334
|
-
classNames: Partial<Classnames> | undefined;
|
|
3335
|
-
/** When `true`, standard (`rule`, `ruleGroup-*`, etc.) classnames are omitted. */
|
|
3336
|
-
suppressStandardClassnames?: boolean;
|
|
3441
|
+
interface AddMethod {
|
|
3442
|
+
<RG extends RuleGroupTypeAny>(query: RG, ruleOrGroup: RG | RuleType, parentPathOrID: Path | string, options?: AddOptions): RG;
|
|
3337
3443
|
}
|
|
3338
3444
|
/**
|
|
3339
|
-
*
|
|
3340
|
-
*
|
|
3445
|
+
* Adds a rule or group to a query without mutating the original query.
|
|
3446
|
+
*
|
|
3447
|
+
* @returns A new query with the rule or group added.
|
|
3341
3448
|
*
|
|
3342
3449
|
* @group Query Tools
|
|
3343
3450
|
*/
|
|
3344
|
-
declare const
|
|
3451
|
+
declare const add: AddMethod;
|
|
3345
3452
|
/**
|
|
3346
|
-
*
|
|
3347
|
-
*
|
|
3348
|
-
*
|
|
3453
|
+
* Adds a rule or group to a query in place.
|
|
3454
|
+
*
|
|
3455
|
+
* @returns The query (mutated in place) with the rule or group added.
|
|
3349
3456
|
*
|
|
3350
3457
|
* @group Query Tools
|
|
3351
3458
|
*/
|
|
3352
|
-
declare const
|
|
3459
|
+
declare const addInPlace: AddMethod;
|
|
3353
3460
|
/**
|
|
3354
|
-
*
|
|
3355
|
-
* `header`. This is the framework-agnostic core of the `classNames` object returned by the
|
|
3356
|
-
* `useRuleGroup` hook.
|
|
3461
|
+
* Options for {@link update}.
|
|
3357
3462
|
*
|
|
3358
3463
|
* @group Query Tools
|
|
3359
3464
|
*/
|
|
3360
|
-
|
|
3361
|
-
/** Inputs common to every outer (wrapper) classname derivation. */
|
|
3362
|
-
interface OuterClassNameOptionsBase extends DeriveClassNamesOptions {
|
|
3465
|
+
interface UpdateOptions extends QueryToolOptions {
|
|
3363
3466
|
/**
|
|
3364
|
-
*
|
|
3365
|
-
*
|
|
3366
|
-
* classnames.
|
|
3467
|
+
* When updating the `field` of a rule, the rule's `operator`, `value`, and `valueSource`
|
|
3468
|
+
* will be reset to their respective defaults. Defaults to `true`.
|
|
3367
3469
|
*/
|
|
3368
|
-
|
|
3369
|
-
/**
|
|
3370
|
-
|
|
3470
|
+
resetOnFieldChange?: boolean;
|
|
3471
|
+
/**
|
|
3472
|
+
* When updating the `operator` of a rule, the rule's `value` and `valueSource`
|
|
3473
|
+
* will be reset to their respective defaults. Defaults to `false`.
|
|
3474
|
+
*/
|
|
3475
|
+
resetOnOperatorChange?: boolean;
|
|
3476
|
+
/**
|
|
3477
|
+
* Determines the default operator name for a given field.
|
|
3478
|
+
*/
|
|
3479
|
+
getRuleDefaultOperator?: (field: string) => string;
|
|
3480
|
+
/**
|
|
3481
|
+
* Determines the valid value sources for a given field and operator.
|
|
3482
|
+
*/
|
|
3483
|
+
getValueSources?: (field: string, operator: string) => ValueSources | ValueSourceFlexibleOptions;
|
|
3484
|
+
/**
|
|
3485
|
+
* Gets the default value for a given rule, in case the value needs to be reset.
|
|
3486
|
+
*/
|
|
3487
|
+
getRuleDefaultValue?: (rule: RuleType) => any;
|
|
3488
|
+
/**
|
|
3489
|
+
* Determines the valid match modes for a given field.
|
|
3490
|
+
*/
|
|
3491
|
+
getMatchModes?: (field: string) => MatchModeOptions;
|
|
3492
|
+
}
|
|
3493
|
+
interface UpdateMethod {
|
|
3494
|
+
/**
|
|
3495
|
+
* Updates a single property of a rule or group.
|
|
3496
|
+
*/
|
|
3497
|
+
<RG extends RuleGroupTypeAny>(query: RG, prop: UpdateableProperties, value: any, pathOrID: Path | string, options?: UpdateOptions): RG;
|
|
3498
|
+
/**
|
|
3499
|
+
* Updates multiple properties of a rule or group using parallel arrays of
|
|
3500
|
+
* property names and corresponding values.
|
|
3501
|
+
*/
|
|
3502
|
+
<RG extends RuleGroupTypeAny>(query: RG, props: UpdateableProperties[], values: any[], pathOrID: Path | string, options?: UpdateOptions): RG;
|
|
3503
|
+
/**
|
|
3504
|
+
* Updates multiple properties of a rule or group using a map of property
|
|
3505
|
+
* names to their new values.
|
|
3506
|
+
*/
|
|
3507
|
+
<RG extends RuleGroupTypeAny>(query: RG, props: UpdateValueMap, pathOrID: Path | string, options?: UpdateOptions): RG;
|
|
3371
3508
|
}
|
|
3372
|
-
/** Inputs to {@link deriveRuleOuterClassName} and {@link deriveRuleGroupOuterClassName}. */
|
|
3373
|
-
interface OuterClassNameOptions extends OuterClassNameOptionsBase, RuleClassNameState {}
|
|
3374
3509
|
/**
|
|
3375
|
-
*
|
|
3510
|
+
* Updates one or more properties of a rule or group within a query without
|
|
3511
|
+
* mutating the original query. Properties may be supplied individually
|
|
3512
|
+
* (`prop`, `value`), as parallel arrays (`props`, `values`), or as a
|
|
3513
|
+
* property-to-value map. For multi-property updates, `field`, `operator`, and
|
|
3514
|
+
* `valueSource` are applied before `value`, so an explicit `value` is never
|
|
3515
|
+
* reset by a change to one of those properties.
|
|
3516
|
+
*
|
|
3517
|
+
* @returns A new query with the rule or group properties updated.
|
|
3376
3518
|
*
|
|
3377
3519
|
* @group Query Tools
|
|
3378
3520
|
*/
|
|
3379
|
-
declare const
|
|
3521
|
+
declare const update: UpdateMethod;
|
|
3380
3522
|
/**
|
|
3381
|
-
*
|
|
3523
|
+
* Updates one or more properties of a rule or group within a query in place.
|
|
3524
|
+
* See {@link update} for the supported argument forms and ordering semantics.
|
|
3382
3525
|
*
|
|
3383
|
-
*
|
|
3384
|
-
* `dndDropNotAllowed`, and `hasSubQuery` do not apply—so this is not interchangeable with
|
|
3385
|
-
* {@link deriveRuleOuterClassName}.
|
|
3526
|
+
* @returns The query (mutated in place) with the rule or group properties updated.
|
|
3386
3527
|
*
|
|
3387
3528
|
* @group Query Tools
|
|
3388
3529
|
*/
|
|
3389
|
-
declare const
|
|
3530
|
+
declare const updateInPlace: UpdateMethod;
|
|
3390
3531
|
/**
|
|
3391
|
-
*
|
|
3392
|
-
* `disabled`, `valid`, and `invalid` state classes.
|
|
3532
|
+
* Options for {@link remove}.
|
|
3393
3533
|
*
|
|
3394
3534
|
* @group Query Tools
|
|
3395
3535
|
*/
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
/**
|
|
3400
|
-
* This is an example validation function you can pass to {@link react-querybuilder!QueryBuilder QueryBuilder} in the
|
|
3401
|
-
* `validator` prop. It assumes that you want to validate groups, and has a no-op
|
|
3402
|
-
* for validating rules which you can replace with your own implementation.
|
|
3403
|
-
*/
|
|
3404
|
-
declare const defaultValidator: QueryValidator;
|
|
3405
|
-
//#endregion
|
|
3406
|
-
//#region src/utils/deriveRuleContext.d.ts
|
|
3407
|
-
/**
|
|
3408
|
-
* Functions used by {@link deriveRuleContext} to resolve a rule's configuration. Each corresponds
|
|
3409
|
-
* to the `QueryBuilder` prop (or `useQueryBuilderSetup` output) of the same name.
|
|
3410
|
-
*/
|
|
3411
|
-
interface RuleContextResolvers<F extends FullField = FullField> {
|
|
3412
|
-
fields: OptionList<F>;
|
|
3413
|
-
fieldMap: Partial<FullOptionRecord<FullField>>;
|
|
3414
|
-
getInputType: (field: string, operator: string, misc: {
|
|
3415
|
-
fieldData: F;
|
|
3416
|
-
}) => InputType | null;
|
|
3417
|
-
getMatchModes: (field: string, misc: {
|
|
3418
|
-
fieldData: F;
|
|
3419
|
-
}) => MatchModeOptions;
|
|
3420
|
-
getOperators: (field: string, misc: {
|
|
3421
|
-
fieldData: F;
|
|
3422
|
-
}) => OptionList<FullOperator>;
|
|
3423
|
-
getParameters: (field: string, operator: string, misc: {
|
|
3424
|
-
fieldData: F;
|
|
3425
|
-
}) => FlexibleOptionList<Option>;
|
|
3426
|
-
getValueEditorType: (field: string, operator: string, misc: {
|
|
3427
|
-
fieldData: F;
|
|
3428
|
-
}) => ValueEditorType;
|
|
3429
|
-
getValues: (field: string, operator: string, misc: {
|
|
3430
|
-
fieldData: F;
|
|
3431
|
-
}) => FlexibleOptionList<Option>;
|
|
3432
|
-
getValueSources: (field: string, operator: string, misc: {
|
|
3433
|
-
fieldData: F;
|
|
3434
|
-
}) => ValueSourceFullOptions;
|
|
3435
|
-
getSubQueryBuilderProps?: (field: string, misc: {
|
|
3436
|
-
fieldData: F;
|
|
3437
|
-
}) => Record<string, unknown>;
|
|
3438
|
-
}
|
|
3439
|
-
/**
|
|
3440
|
-
* Everything {@link deriveRuleContext} resolves for a single rule.
|
|
3441
|
-
*/
|
|
3442
|
-
interface RuleContext<F extends FullField = FullField> {
|
|
3443
|
-
fieldData: F;
|
|
3444
|
-
hideValueControls: boolean;
|
|
3445
|
-
inputType: InputType | null;
|
|
3446
|
-
matchModes: MatchModeOptions;
|
|
3447
|
-
operatorObject: FullOperator | undefined;
|
|
3448
|
-
operators: OptionList<FullOperator>;
|
|
3449
|
-
parameters: FlexibleOptionList<Option> | null;
|
|
3450
|
-
validationResult: boolean | ValidationResult;
|
|
3451
|
-
valueEditorType: ValueEditorType;
|
|
3452
|
-
values: FlexibleOptionList<Option>;
|
|
3453
|
-
valueSourceOptions: ValueSourceFullOptions;
|
|
3454
|
-
valueSources: ValueSources;
|
|
3455
|
-
subQueryBuilderProps: Record<string, unknown>;
|
|
3536
|
+
interface RemoveOptions extends QueryToolOptions {}
|
|
3537
|
+
interface RemoveMethod {
|
|
3538
|
+
<RG extends RuleGroupTypeAny>(query: RG, pathOrID: Path | string, options?: RemoveOptions): RG;
|
|
3456
3539
|
}
|
|
3457
3540
|
/**
|
|
3458
|
-
*
|
|
3459
|
-
*
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
* The input type for a rule. A field's own `inputType` takes precedence over `getInputType`.
|
|
3464
|
-
*/
|
|
3465
|
-
declare const getRuleInputType: <F extends FullField = FullField>(field: string, operator: string, fieldData: F, getInputType: RuleContextResolvers<F>["getInputType"]) => InputType | null;
|
|
3466
|
-
/**
|
|
3467
|
-
* Whether the value editor(s) should be hidden for an operator, based on its `arity`.
|
|
3468
|
-
*/
|
|
3469
|
-
declare const hideValueControlsForOperator: (operatorObject?: FullOperator) => boolean;
|
|
3470
|
-
/**
|
|
3471
|
-
* The subset of a rule that determines its configuration. Accepting only these properties (rather
|
|
3472
|
-
* than the whole rule) lets React callers keep granular memoization dependencies, so editing a
|
|
3473
|
-
* rule's `value` doesn't recompute its operators, value sources, or option lists.
|
|
3474
|
-
*/
|
|
3475
|
-
type RuleFacet = Pick<RuleType, "field" | "operator" | "valueSource">;
|
|
3476
|
-
/**
|
|
3477
|
-
* Value source options for a rule. A `valueSource` present on the rule but absent from the
|
|
3478
|
-
* configured list is appended, so the current selection is always representable.
|
|
3479
|
-
*/
|
|
3480
|
-
declare const getRuleValueSourceOptions: <F extends FullField = FullField>(rule: RuleFacet, fieldData: F, getValueSources: RuleContextResolvers<F>["getValueSources"]) => ValueSourceFullOptions;
|
|
3481
|
-
/**
|
|
3482
|
-
* Normalizes the result of `getParameters` to a non-empty list or `null`.
|
|
3483
|
-
*/
|
|
3484
|
-
declare const getParametersAsList: (parameters: FlexibleOptionList<Option>) => FlexibleOptionList<Option> | null;
|
|
3485
|
-
/**
|
|
3486
|
-
* The value editor type for a rule. `valueSource: "field"` always uses a select list, and
|
|
3487
|
-
* `valueSource: "parameter"` uses a (multi)select when parameters are available.
|
|
3488
|
-
*/
|
|
3489
|
-
declare const getRuleValueEditorType: <F extends FullField = FullField>(rule: RuleFacet, fieldData: F, parametersAsList: FlexibleOptionList<Option> | null, getValueEditorType: RuleContextResolvers<F>["getValueEditorType"]) => ValueEditorType;
|
|
3490
|
-
/**
|
|
3491
|
-
* The option list presented by a rule's value editor, resolved from its `valueSource`.
|
|
3492
|
-
*/
|
|
3493
|
-
declare const getRuleValues: <F extends FullField = FullField>(rule: RuleFacet, fieldData: F, fields: OptionList<F>, parametersAsList: FlexibleOptionList<Option> | null, getValues: RuleContextResolvers<F>["getValues"]) => FlexibleOptionList<Option>;
|
|
3494
|
-
/**
|
|
3495
|
-
* The validation result for a rule: the entry from a query-level {@link ValidationMap} if present,
|
|
3496
|
-
* otherwise the field's own `validator` result, otherwise `null`.
|
|
3541
|
+
* Removes a rule or group from a query without mutating the original query.
|
|
3542
|
+
*
|
|
3543
|
+
* @returns A new query with the rule or group removed.
|
|
3544
|
+
*
|
|
3545
|
+
* @group Query Tools
|
|
3497
3546
|
*/
|
|
3498
|
-
declare const
|
|
3547
|
+
declare const remove: RemoveMethod;
|
|
3499
3548
|
/**
|
|
3500
|
-
*
|
|
3501
|
-
* its field data, operators, value editor type, value list, value sources, match modes, and
|
|
3502
|
-
* validation result.
|
|
3549
|
+
* Removes a rule or group from a query in place.
|
|
3503
3550
|
*
|
|
3504
|
-
*
|
|
3505
|
-
* {@link QueryManager.getRuleContext} so that non-React implementations derive identical results.
|
|
3506
|
-
* It performs no memoization; callers are responsible for caching as appropriate.
|
|
3551
|
+
* @returns The query (mutated in place) with the rule or group removed.
|
|
3507
3552
|
*
|
|
3508
3553
|
* @group Query Tools
|
|
3509
3554
|
*/
|
|
3510
|
-
declare const
|
|
3511
|
-
validationMap?: ValidationMap;
|
|
3512
|
-
id?: string;
|
|
3513
|
-
}) => RuleContext<F>;
|
|
3555
|
+
declare const removeInPlace: RemoveMethod;
|
|
3514
3556
|
/**
|
|
3515
|
-
*
|
|
3557
|
+
* Options for {@link move}.
|
|
3558
|
+
*
|
|
3559
|
+
* @group Query Tools
|
|
3516
3560
|
*/
|
|
3517
|
-
interface
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3561
|
+
interface MoveOptions extends QueryToolOptions {
|
|
3562
|
+
/**
|
|
3563
|
+
* When `true`, the source rule/group will not be removed from its original path.
|
|
3564
|
+
*/
|
|
3565
|
+
clone?: boolean;
|
|
3566
|
+
/**
|
|
3567
|
+
* If the query extends `RuleGroupTypeIC` (i.e. the query is using independent
|
|
3568
|
+
* combinators), then the first combinator in this list will be inserted before
|
|
3569
|
+
* the rule/group if necessary.
|
|
3570
|
+
*/
|
|
3571
|
+
combinators?: OptionList;
|
|
3572
|
+
/**
|
|
3573
|
+
* ID generator.
|
|
3574
|
+
*/
|
|
3575
|
+
idGenerator?: () => string;
|
|
3576
|
+
}
|
|
3577
|
+
interface MoveMethod {
|
|
3578
|
+
<RG extends RuleGroupTypeAny>(query: RG, oldPathOrID: Path | string, newPath: Path | "up" | "down", options?: MoveOptions): RG;
|
|
3525
3579
|
}
|
|
3526
3580
|
/**
|
|
3527
|
-
*
|
|
3528
|
-
*
|
|
3581
|
+
* Moves a rule or group from one path to another without mutating the original query.
|
|
3582
|
+
* In the options parameter, pass `{ clone: true }` to copy instead of move.
|
|
3529
3583
|
*
|
|
3530
|
-
*
|
|
3531
|
-
*
|
|
3584
|
+
* @returns A new query with the rule or group moved or cloned.
|
|
3585
|
+
*
|
|
3586
|
+
* @group Query Tools
|
|
3532
3587
|
*/
|
|
3533
|
-
declare const
|
|
3588
|
+
declare const move: MoveMethod;
|
|
3534
3589
|
/**
|
|
3535
|
-
*
|
|
3536
|
-
*
|
|
3590
|
+
* Moves a rule or group from one path to another in place.
|
|
3591
|
+
* In the options parameter, pass `{ clone: true }` to copy instead of move.
|
|
3537
3592
|
*
|
|
3538
|
-
*
|
|
3539
|
-
* group's validation result comes only from the query-level {@link ValidationMap}.
|
|
3593
|
+
* @returns The query (mutated in place) with the rule or group moved or cloned.
|
|
3540
3594
|
*
|
|
3541
3595
|
* @group Query Tools
|
|
3542
3596
|
*/
|
|
3543
|
-
declare const
|
|
3544
|
-
validationMap?: ValidationMap;
|
|
3545
|
-
id?: string;
|
|
3546
|
-
}) => RuleGroupContext<C>;
|
|
3547
|
-
//#endregion
|
|
3548
|
-
//#region src/utils/deriveValueEditor.d.ts
|
|
3597
|
+
declare const moveInPlace: MoveMethod;
|
|
3549
3598
|
/**
|
|
3550
|
-
*
|
|
3599
|
+
* Options for {@link insert}.
|
|
3551
3600
|
*
|
|
3552
|
-
* @group
|
|
3601
|
+
* @group Query Tools
|
|
3553
3602
|
*/
|
|
3554
|
-
|
|
3555
|
-
/**
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3603
|
+
interface InsertOptions extends QueryToolOptions {
|
|
3604
|
+
/**
|
|
3605
|
+
* If the query extends `RuleGroupTypeIC` (i.e. the query has independent
|
|
3606
|
+
* combinators), then the first combinator in this list will be inserted
|
|
3607
|
+
* before the new rule/group if the parent group is not empty. This option
|
|
3608
|
+
* is overridden by `combinatorPreceding`.
|
|
3609
|
+
*/
|
|
3610
|
+
combinators?: OptionList;
|
|
3611
|
+
/**
|
|
3612
|
+
* If the query extends `RuleGroupTypeIC` (i.e. the query has independent
|
|
3613
|
+
* combinators), then this combinator will be inserted before the new rule/group
|
|
3614
|
+
* if the parent group is not empty and the new rule/group is not the first in the
|
|
3615
|
+
* group (`path.at(-1) > 0`). This option will supersede `combinators`.
|
|
3616
|
+
*/
|
|
3617
|
+
combinatorPreceding?: string;
|
|
3618
|
+
/**
|
|
3619
|
+
* If the query extends `RuleGroupTypeIC` (i.e. the query has independent
|
|
3620
|
+
* combinators), then this combinator will be inserted after the new rule/group
|
|
3621
|
+
* if the parent group is not empty and the new rule/group is the first in the
|
|
3622
|
+
* group (`path.at(-1) === 0`). This option will supersede `combinators`.
|
|
3623
|
+
*/
|
|
3624
|
+
combinatorSucceeding?: string;
|
|
3625
|
+
/**
|
|
3626
|
+
* ID generator.
|
|
3627
|
+
*
|
|
3628
|
+
* @default generateID
|
|
3629
|
+
*/
|
|
3630
|
+
idGenerator?: () => string;
|
|
3631
|
+
/**
|
|
3632
|
+
* When `true`, the new rule/group will replace the rule/group at `path`.
|
|
3633
|
+
*/
|
|
3634
|
+
replace?: boolean;
|
|
3635
|
+
}
|
|
3636
|
+
interface InsertMethod {
|
|
3637
|
+
<RG extends RuleGroupTypeAny>(query: RG, ruleOrGroup: RG | RuleType, path: number[], options?: InsertOptions): RG;
|
|
3638
|
+
}
|
|
3639
|
+
/**
|
|
3640
|
+
* Inserts a rule or group into a query without mutating the original query.
|
|
3563
3641
|
*
|
|
3564
|
-
*
|
|
3565
|
-
* apply it wherever is idiomatic.
|
|
3642
|
+
* @returns A new query with the rule or group inserted.
|
|
3566
3643
|
*
|
|
3567
|
-
* @group
|
|
3644
|
+
* @group Query Tools
|
|
3568
3645
|
*/
|
|
3569
|
-
declare const
|
|
3570
|
-
skipHook?: boolean;
|
|
3571
|
-
type?: string;
|
|
3572
|
-
operator: string;
|
|
3573
|
-
value: unknown;
|
|
3574
|
-
inputType?: InputType | null;
|
|
3575
|
-
}) => {
|
|
3576
|
-
reset: boolean;
|
|
3577
|
-
value: unknown;
|
|
3578
|
-
};
|
|
3646
|
+
declare const insert: InsertMethod;
|
|
3579
3647
|
/**
|
|
3580
|
-
*
|
|
3648
|
+
* Inserts a rule or group into a query in place.
|
|
3581
3649
|
*
|
|
3582
|
-
*
|
|
3583
|
-
* elements, seeding the second from the first available option. The result is a comma-joined
|
|
3584
|
-
* string unless `listsAsArrays` is `true`.
|
|
3650
|
+
* @returns The query (mutated in place) with the rule or group inserted.
|
|
3585
3651
|
*
|
|
3586
|
-
* @group
|
|
3652
|
+
* @group Query Tools
|
|
3587
3653
|
*/
|
|
3588
|
-
declare const
|
|
3589
|
-
value: unknown;
|
|
3590
|
-
index: number;
|
|
3591
|
-
valueAsArray: unknown[];
|
|
3592
|
-
operator: string;
|
|
3593
|
-
values?: any[];
|
|
3594
|
-
listsAsArrays?: boolean;
|
|
3595
|
-
parseNumberMethod?: ParseNumberMethod;
|
|
3596
|
-
}) => unknown;
|
|
3654
|
+
declare const insertInPlace: InsertMethod;
|
|
3597
3655
|
/**
|
|
3598
|
-
*
|
|
3599
|
-
* as one (an empty string or a decimal, for example).
|
|
3656
|
+
* Options for {@link group}.
|
|
3600
3657
|
*
|
|
3601
|
-
* @group
|
|
3658
|
+
* @group Query Tools
|
|
3602
3659
|
*/
|
|
3603
|
-
|
|
3660
|
+
interface GroupOptions extends QueryToolOptions {
|
|
3661
|
+
/**
|
|
3662
|
+
* When `true`, the source rule/group will not be removed from its original path.
|
|
3663
|
+
*/
|
|
3664
|
+
clone?: boolean;
|
|
3665
|
+
/**
|
|
3666
|
+
* If the query extends `RuleGroupTypeIC` (i.e. the query is using independent
|
|
3667
|
+
* combinators), then the first combinator in this list will be inserted between
|
|
3668
|
+
* the two rules/groups.
|
|
3669
|
+
*/
|
|
3670
|
+
combinators?: OptionList;
|
|
3671
|
+
/**
|
|
3672
|
+
* ID generator.
|
|
3673
|
+
*/
|
|
3674
|
+
idGenerator?: () => string;
|
|
3675
|
+
}
|
|
3676
|
+
interface GroupMethod {
|
|
3677
|
+
<RG extends RuleGroupTypeAny>(query: RG, sourcePathOrID: Path | string, targetPathOrID: Path | string, options?: GroupOptions): RG;
|
|
3678
|
+
}
|
|
3604
3679
|
/**
|
|
3605
|
-
*
|
|
3606
|
-
*
|
|
3680
|
+
* Creates a new group at a target path with its `rules` array containing the current
|
|
3681
|
+
* objects at the target path and the source path without mutating the original query.
|
|
3682
|
+
* In the options parameter, pass `{ clone: true }` to copy the source rule/group instead of move.
|
|
3607
3683
|
*
|
|
3608
|
-
* @
|
|
3609
|
-
*/
|
|
3610
|
-
declare const coerceInputType: (inputType: InputType | null | undefined, operator: string) => InputType;
|
|
3611
|
-
/**
|
|
3612
|
-
* Produces the next value for a value selector. Multiselect values are normalized to an array
|
|
3613
|
-
* first, then comma-joined unless `listsAsArrays` is `true`. Single-select values pass through.
|
|
3684
|
+
* @returns A new query with the rules or groups grouped.
|
|
3614
3685
|
*
|
|
3615
|
-
* @group
|
|
3686
|
+
* @group Query Tools
|
|
3616
3687
|
*/
|
|
3617
|
-
declare const
|
|
3618
|
-
multiple?: boolean;
|
|
3619
|
-
listsAsArrays?: boolean;
|
|
3620
|
-
}) => string | string[];
|
|
3688
|
+
declare const group: GroupMethod;
|
|
3621
3689
|
/**
|
|
3622
|
-
*
|
|
3623
|
-
*
|
|
3690
|
+
* Creates a new group at a target path with its `rules` array containing the current
|
|
3691
|
+
* objects at the target path and the source path in place.
|
|
3692
|
+
* In the options parameter, pass `{ clone: true }` to copy the source rule/group instead of move.
|
|
3624
3693
|
*
|
|
3625
|
-
* @
|
|
3694
|
+
* @returns The query (mutated in place) with the rules or groups grouped.
|
|
3695
|
+
*
|
|
3696
|
+
* @group Query Tools
|
|
3626
3697
|
*/
|
|
3627
|
-
declare const
|
|
3698
|
+
declare const groupInPlace: GroupMethod;
|
|
3628
3699
|
//#endregion
|
|
3629
|
-
//#region src/utils/
|
|
3700
|
+
//#region src/utils/abortReasons.d.ts
|
|
3630
3701
|
/**
|
|
3631
|
-
*
|
|
3632
|
-
*
|
|
3633
|
-
*
|
|
3634
|
-
* or `undefined`. If `comparator` is a string, fields with the same value
|
|
3635
|
-
* for that property will be included. If `comparator` is a function, each
|
|
3636
|
-
* field will be passed to the function along with the `operator` and fields
|
|
3637
|
-
* for which the function returns `true` will be included.
|
|
3702
|
+
* Abort reasons that {@link QueryManager}'s `strict` mode treats as errors. The remaining
|
|
3703
|
+
* reasons—`"same-location"` and `"no-change"`—describe valid operations that had nothing to do,
|
|
3704
|
+
* so they are reported to `onInvalidTarget` but never throw.
|
|
3638
3705
|
*
|
|
3639
|
-
*
|
|
3706
|
+
* Declared apart from `QueryManager` so the `@react-querybuilder/core/derivations` entry point can
|
|
3707
|
+
* export it without putting the manager in its module graph.
|
|
3708
|
+
*
|
|
3709
|
+
* @group Query Tools
|
|
3640
3710
|
*/
|
|
3641
|
-
declare const
|
|
3642
|
-
options: WithUnknownIndex<FullField>[];
|
|
3643
|
-
label: string;
|
|
3644
|
-
}[];
|
|
3711
|
+
declare const strictAbortReasons: readonly AbortReason[];
|
|
3645
3712
|
//#endregion
|
|
3646
|
-
//#region src/utils/
|
|
3713
|
+
//#region src/utils/arrayUtils.d.ts
|
|
3647
3714
|
/**
|
|
3648
|
-
*
|
|
3715
|
+
* Splits a string by a given character (see {@link defaultJoinChar}). Escaped characters
|
|
3716
|
+
* (characters preceded by a backslash) will not apply to the split, and the backslash will
|
|
3717
|
+
* be removed in the array element. Inverse of {@link joinWith}.
|
|
3649
3718
|
*
|
|
3650
|
-
* @
|
|
3719
|
+
* @example
|
|
3720
|
+
* splitBy('this\\,\\,that,,the other,,,\\,')
|
|
3721
|
+
* // or
|
|
3722
|
+
* splitBy('this\\,\\,that,,the other,,,\\,', ',')
|
|
3723
|
+
* // would return
|
|
3724
|
+
* ['this,,that', '', 'the other', '', '', ',']
|
|
3651
3725
|
*/
|
|
3652
|
-
declare const
|
|
3653
|
-
//#endregion
|
|
3654
|
-
//#region src/utils/formatQuery/defaultRuleProcessorMongoDB.d.ts
|
|
3726
|
+
declare const splitBy: (str?: string, splitChar?: string) => string[];
|
|
3655
3727
|
/**
|
|
3656
|
-
*
|
|
3728
|
+
* Joins an array of strings using the given character (see {@link defaultJoinChar}). When
|
|
3729
|
+
* the given character appears in an array element, a backslash will be added just before it
|
|
3730
|
+
* to distinguish it from the join character. Effectively the inverse of {@link splitBy}.
|
|
3657
3731
|
*
|
|
3658
|
-
*
|
|
3732
|
+
* TIP: The join character can actually be a string of any length. Only the first character
|
|
3733
|
+
* will be searched for in the array elements and preceded by a backslash.
|
|
3659
3734
|
*
|
|
3660
|
-
* @
|
|
3735
|
+
* @example
|
|
3736
|
+
* joinWith(['this,,that', '', 'the other', '', '', ','], ', ')
|
|
3737
|
+
* // would return
|
|
3738
|
+
* 'this\\,\\,that, , the other, , , \\,'
|
|
3661
3739
|
*/
|
|
3662
|
-
declare const
|
|
3740
|
+
declare const joinWith: (strArr: unknown[], joinChar?: string) => string;
|
|
3741
|
+
type IsUnknown<T> = unknown extends T ? true : false;
|
|
3742
|
+
type Trimmed<T> = IsUnknown<T> extends true ? string : T;
|
|
3743
|
+
/**
|
|
3744
|
+
* Trims the value if it is a string. Otherwise returns the value as is.
|
|
3745
|
+
*/
|
|
3746
|
+
declare const trimIfString: <T>(val: T) => Trimmed<T>;
|
|
3747
|
+
type ToArrayResult<T> = IsUnknown<T> extends true ? string[] : T extends readonly (infer U)[] ? Trimmed<U>[] : T extends string ? string[] : T extends number ? number[] : never[];
|
|
3748
|
+
/**
|
|
3749
|
+
* Splits a string by comma then trims each element. Arrays are returned as is except
|
|
3750
|
+
* any string elements are trimmed.
|
|
3751
|
+
*/
|
|
3752
|
+
declare const toArray: <T>(a: T, { retainEmptyStrings }?: {
|
|
3753
|
+
retainEmptyStrings?: boolean;
|
|
3754
|
+
}) => ToArrayResult<T>;
|
|
3755
|
+
/**
|
|
3756
|
+
* Determines if an array is free of `null`/`undefined`.
|
|
3757
|
+
*/
|
|
3758
|
+
declare const nullFreeArray: <T>(arr: T[]) => arr is Exclude<T, null>[];
|
|
3663
3759
|
//#endregion
|
|
3664
|
-
//#region
|
|
3760
|
+
//#region ../../node_modules/clsx/clsx.d.mts
|
|
3761
|
+
type ClassValue = ClassArray | ClassDictionary | string | number | bigint | null | boolean | undefined;
|
|
3762
|
+
type ClassDictionary = Record<string, any>;
|
|
3763
|
+
type ClassArray = ClassValue[];
|
|
3764
|
+
declare function clsx(...inputs: ClassValue[]): string;
|
|
3765
|
+
//#endregion
|
|
3766
|
+
//#region src/utils/coalesce.d.ts
|
|
3665
3767
|
/**
|
|
3666
|
-
*
|
|
3768
|
+
* Determines whether a change should be absorbed into the current history entry instead of
|
|
3769
|
+
* pushing a new one. This is the exact rule {@link QueryManager} applies when recording history,
|
|
3770
|
+
* exposed so non-React implementations can manage their own history stacks without
|
|
3771
|
+
* reimplementing (and drifting from) the semantics.
|
|
3667
3772
|
*
|
|
3668
|
-
*
|
|
3773
|
+
* A change coalesces only when all three hold:
|
|
3774
|
+
* - the change is not structural (rules/groups added, removed, moved, or reordered)
|
|
3775
|
+
* - its signature matches the previously recorded signature
|
|
3776
|
+
* - it occurred within `coalesceMs` of the previous recording
|
|
3777
|
+
*
|
|
3778
|
+
* Note that {@link unchangedSignature} is not handled here. A change with no observable
|
|
3779
|
+
* difference is never recorded at all, which is a separate decision made before this check.
|
|
3780
|
+
*
|
|
3781
|
+
* @param prevSig Signature of the previously recorded change, or `undefined` if there is none.
|
|
3782
|
+
* @param nextSig Signature of the change being recorded, from {@link signatureOf}.
|
|
3783
|
+
* @param prevAt Timestamp of the previous recording.
|
|
3784
|
+
* @param now Timestamp of the change being recorded.
|
|
3785
|
+
* @param coalesceMs Coalescing window in milliseconds.
|
|
3669
3786
|
*/
|
|
3670
|
-
declare const
|
|
3787
|
+
declare const shouldCoalesce: (prevSig: string | undefined, nextSig: string, prevAt: number, now: number, coalesceMs?: number) => boolean;
|
|
3671
3788
|
//#endregion
|
|
3672
|
-
//#region src/utils/
|
|
3789
|
+
//#region src/utils/convertQuery.d.ts
|
|
3673
3790
|
/**
|
|
3674
|
-
*
|
|
3791
|
+
* Converts a {@link RuleGroupTypeIC} to {@link RuleGroupType}.
|
|
3675
3792
|
*
|
|
3676
|
-
* @
|
|
3793
|
+
* This function is idempotent: {@link RuleGroupType} queries will be
|
|
3794
|
+
* returned as-is.
|
|
3795
|
+
*
|
|
3796
|
+
* @group Query Tools
|
|
3677
3797
|
*/
|
|
3678
|
-
declare const
|
|
3679
|
-
//#endregion
|
|
3680
|
-
//#region src/utils/formatQuery/defaultRuleGroupProcessorCEL.d.ts
|
|
3798
|
+
declare const convertFromIC: <RG extends RuleGroupTypeAny>(rg: RG) => ToRuleGroupType<RG>;
|
|
3681
3799
|
/**
|
|
3682
|
-
*
|
|
3800
|
+
* Converts a {@link RuleGroupType} to {@link RuleGroupTypeIC}.
|
|
3683
3801
|
*
|
|
3684
|
-
* @
|
|
3802
|
+
* This function is idempotent: {@link RuleGroupTypeIC} queries will be
|
|
3803
|
+
* returned as-is.
|
|
3804
|
+
*
|
|
3805
|
+
* @group Query Tools
|
|
3685
3806
|
*/
|
|
3686
|
-
declare const
|
|
3687
|
-
//#endregion
|
|
3688
|
-
//#region src/utils/formatQuery/defaultRuleGroupProcessorCypher.d.ts
|
|
3807
|
+
declare const convertToIC: <RG extends RuleGroupTypeAny>(rg: RG) => ToRuleGroupTypeIC<RG>;
|
|
3689
3808
|
/**
|
|
3690
|
-
*
|
|
3809
|
+
* Converts a {@link RuleGroupType} to {@link RuleGroupTypeIC}. For a more explicit
|
|
3810
|
+
* operation, use {@link convertToIC}.
|
|
3691
3811
|
*
|
|
3692
|
-
* @group
|
|
3812
|
+
* @group Query Tools
|
|
3693
3813
|
*/
|
|
3694
|
-
declare
|
|
3695
|
-
and: "AND";
|
|
3696
|
-
or: "OR";
|
|
3697
|
-
};
|
|
3814
|
+
declare function convertQuery(query: RuleGroupType): RuleGroupTypeIC;
|
|
3698
3815
|
/**
|
|
3699
|
-
*
|
|
3816
|
+
* Converts a {@link RuleGroupTypeIC} to {@link RuleGroupType}. For a more explicit
|
|
3817
|
+
* operation, use {@link convertFromIC}.
|
|
3700
3818
|
*
|
|
3701
|
-
* @group
|
|
3819
|
+
* @group Query Tools
|
|
3702
3820
|
*/
|
|
3703
|
-
declare
|
|
3821
|
+
declare function convertQuery(query: RuleGroupTypeIC): RuleGroupType;
|
|
3704
3822
|
//#endregion
|
|
3705
|
-
//#region src/utils/
|
|
3823
|
+
//#region src/utils/deriveClassNames.d.ts
|
|
3824
|
+
/** Classname keys that have both a standard class and a `controlClassnames` entry. */
|
|
3825
|
+
type StandardClassnameKey = keyof typeof standardClassnames & keyof Classnames;
|
|
3706
3826
|
/**
|
|
3707
|
-
*
|
|
3708
|
-
* surface of this package never references `drizzle-orm`, which is an optional peer dependency.
|
|
3709
|
-
* (Referencing it would force consumers to install it to typecheck without `skipLibCheck`.)
|
|
3827
|
+
* A classname applied only when `when` returns true for the current state.
|
|
3710
3828
|
*
|
|
3711
|
-
*
|
|
3829
|
+
* `key` is used to look up both the standard classname and the corresponding `controlClassnames`
|
|
3830
|
+
* entry. Set `standardOnly` when the standard class is conditional but no custom class
|
|
3831
|
+
* corresponds to it.
|
|
3712
3832
|
*/
|
|
3713
|
-
interface
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3833
|
+
interface ClassnameCondition<S> {
|
|
3834
|
+
key: StandardClassnameKey;
|
|
3835
|
+
when: (state: S) => boolean | undefined;
|
|
3836
|
+
standardOnly?: boolean;
|
|
3717
3837
|
}
|
|
3718
3838
|
/**
|
|
3719
|
-
*
|
|
3720
|
-
*
|
|
3721
|
-
* the caller's own operators object, so it stays exact without importing `drizzle-orm` here.
|
|
3722
|
-
*
|
|
3723
|
-
* @group Export
|
|
3839
|
+
* How one derived classname is composed: the `controlClassnames` keys that contribute to it (in
|
|
3840
|
+
* application order, after the standard classname), plus any state-dependent classes.
|
|
3724
3841
|
*/
|
|
3725
|
-
|
|
3842
|
+
interface ClassnameSpec<S> {
|
|
3843
|
+
sources: readonly (keyof Classnames)[];
|
|
3844
|
+
conditions?: readonly ClassnameCondition<S>[];
|
|
3845
|
+
}
|
|
3846
|
+
/** Keys of the `classNames` object returned for a rule. */
|
|
3847
|
+
type RuleClassnameKey = "shiftActions" | "dragHandle" | "fields" | "matchMode" | "matchThreshold" | "operators" | "valueSource" | "value" | "cloneRule" | "lockRule" | "muteRule" | "removeRule" | "valueListItem";
|
|
3848
|
+
/** Keys of the `classNames` object returned for a rule group. */
|
|
3849
|
+
type RuleGroupClassnameKey = "header" | "shiftActions" | "undoRedoActions" | "undoAction" | "redoAction" | "dragHandle" | "combinators" | "notToggle" | "addRule" | "addGroup" | "cloneGroup" | "lockGroup" | "muteGroup" | "removeGroup" | "body";
|
|
3850
|
+
/** Drag-and-drop state that can contribute conditional classnames. */
|
|
3851
|
+
interface DndClassNameState {
|
|
3852
|
+
isDragging?: boolean;
|
|
3853
|
+
isOver?: boolean;
|
|
3854
|
+
dropEffect?: "move" | "copy";
|
|
3855
|
+
groupItems?: boolean;
|
|
3856
|
+
dropNotAllowed?: boolean;
|
|
3857
|
+
}
|
|
3858
|
+
/** State that contributes conditional classnames to a rule's wrapper element. */
|
|
3859
|
+
interface RuleClassNameState extends DndClassNameState {
|
|
3860
|
+
disabled?: boolean;
|
|
3861
|
+
muted?: boolean;
|
|
3862
|
+
hasSubQuery?: boolean;
|
|
3863
|
+
}
|
|
3864
|
+
/** State that contributes conditional classnames to the query builder's wrapper element. */
|
|
3865
|
+
interface QueryBuilderClassNameState {
|
|
3866
|
+
disabled?: boolean;
|
|
3867
|
+
validationResult?: boolean | ValidationMap;
|
|
3868
|
+
}
|
|
3869
|
+
/** Options common to every classname derivation. */
|
|
3870
|
+
interface DeriveClassNamesOptions {
|
|
3871
|
+
/** The merged `controlClassnames` for the query builder. */
|
|
3872
|
+
classNames: Partial<Classnames> | undefined;
|
|
3873
|
+
/** When `true`, standard (`rule`, `ruleGroup-*`, etc.) classnames are omitted. */
|
|
3874
|
+
suppressStandardClassnames?: boolean;
|
|
3875
|
+
}
|
|
3726
3876
|
/**
|
|
3727
|
-
*
|
|
3728
|
-
*
|
|
3729
|
-
*
|
|
3730
|
-
* @example
|
|
3731
|
-
* const where = formatQuery(query, 'drizzle');
|
|
3732
|
-
* const results = db.query.users.findMany({ where });
|
|
3733
|
-
*
|
|
3734
|
-
* @returns Function that takes a Drizzle table config and an object of Drizzle operators.
|
|
3877
|
+
* Classnames for each element rendered by a rule. This is the framework-agnostic core of the
|
|
3878
|
+
* `classNames` object returned by the `useRule` hook.
|
|
3735
3879
|
*
|
|
3736
|
-
* @group
|
|
3880
|
+
* @group Query Tools
|
|
3737
3881
|
*/
|
|
3738
|
-
declare const
|
|
3739
|
-
//#endregion
|
|
3740
|
-
//#region src/utils/formatQuery/defaultRuleGroupProcessorElasticSearch.d.ts
|
|
3882
|
+
declare const deriveRuleClassNames: (options: DeriveClassNamesOptions) => Record<RuleClassnameKey, string>;
|
|
3741
3883
|
/**
|
|
3742
|
-
*
|
|
3884
|
+
* The classname for a single element of a rule, composed from the same table as
|
|
3885
|
+
* {@link deriveRuleClassNames}. Useful where only one is needed, such as the items of a
|
|
3886
|
+
* multi-value editor.
|
|
3743
3887
|
*
|
|
3744
|
-
* @group
|
|
3888
|
+
* @group Query Tools
|
|
3745
3889
|
*/
|
|
3746
|
-
declare const
|
|
3747
|
-
//#endregion
|
|
3748
|
-
//#region src/utils/formatQuery/defaultRuleGroupProcessorGremlin.d.ts
|
|
3890
|
+
declare const deriveRuleClassName: (key: RuleClassnameKey, options: DeriveClassNamesOptions) => string;
|
|
3749
3891
|
/**
|
|
3750
|
-
*
|
|
3751
|
-
*
|
|
3752
|
-
*
|
|
3753
|
-
* Nested groups use `.and()` / `.or()` / `.not()` compound traversals with
|
|
3754
|
-
* `__` anonymous traversal prefixes.
|
|
3892
|
+
* Classnames for each element rendered by a rule group, including its conditionally-classed
|
|
3893
|
+
* `header`. This is the framework-agnostic core of the `classNames` object returned by the
|
|
3894
|
+
* `useRuleGroup` hook.
|
|
3755
3895
|
*
|
|
3756
|
-
* @group
|
|
3896
|
+
* @group Query Tools
|
|
3757
3897
|
*/
|
|
3758
|
-
declare const
|
|
3759
|
-
|
|
3760
|
-
|
|
3898
|
+
declare const deriveRuleGroupClassNames: (options: DeriveClassNamesOptions & DndClassNameState) => Record<RuleGroupClassnameKey, string>;
|
|
3899
|
+
/** Inputs common to every outer (wrapper) classname derivation. */
|
|
3900
|
+
interface OuterClassNameOptionsBase extends DeriveClassNamesOptions {
|
|
3901
|
+
/**
|
|
3902
|
+
* Classnames contributed by the rule or group itself and its configuration, applied first.
|
|
3903
|
+
* For a rule that is the rule/field/operator classnames; for a group, the group and combinator
|
|
3904
|
+
* classnames.
|
|
3905
|
+
*/
|
|
3906
|
+
leadingClassNames?: (Classname | null)[];
|
|
3907
|
+
/** Appended last, as produced by `getValidationClassNames`. */
|
|
3908
|
+
validationClassName?: Classname;
|
|
3909
|
+
}
|
|
3910
|
+
/** Inputs to {@link deriveRuleOuterClassName} and {@link deriveRuleGroupOuterClassName}. */
|
|
3911
|
+
interface OuterClassNameOptions extends OuterClassNameOptionsBase, RuleClassNameState {}
|
|
3761
3912
|
/**
|
|
3762
|
-
*
|
|
3913
|
+
* The outer (wrapper) classname for a rule, including every conditional state class.
|
|
3763
3914
|
*
|
|
3764
|
-
* @group
|
|
3915
|
+
* @group Query Tools
|
|
3765
3916
|
*/
|
|
3766
|
-
declare const
|
|
3767
|
-
//#endregion
|
|
3768
|
-
//#region src/utils/formatQuery/defaultRuleGroupProcessorJsonLogic.d.ts
|
|
3917
|
+
declare const deriveRuleOuterClassName: (options: OuterClassNameOptions) => string;
|
|
3769
3918
|
/**
|
|
3770
|
-
*
|
|
3919
|
+
* The outer (wrapper) classname for a rule group, including every conditional state class.
|
|
3771
3920
|
*
|
|
3772
|
-
*
|
|
3921
|
+
* A group reflects fewer drag-and-drop states than a rule—`dndOver`, `dndCopy`,
|
|
3922
|
+
* `dndDropNotAllowed`, and `hasSubQuery` do not apply—so this is not interchangeable with
|
|
3923
|
+
* {@link deriveRuleOuterClassName}.
|
|
3924
|
+
*
|
|
3925
|
+
* @group Query Tools
|
|
3773
3926
|
*/
|
|
3774
|
-
declare const
|
|
3775
|
-
//#endregion
|
|
3776
|
-
//#region src/utils/formatQuery/defaultRuleGroupProcessorLDAP.d.ts
|
|
3927
|
+
declare const deriveRuleGroupOuterClassName: (options: OuterClassNameOptions) => string;
|
|
3777
3928
|
/**
|
|
3778
|
-
*
|
|
3929
|
+
* The outer (wrapper) classname for the query builder itself, including the conditional
|
|
3930
|
+
* `disabled`, `valid`, and `invalid` state classes.
|
|
3779
3931
|
*
|
|
3780
|
-
* @group
|
|
3932
|
+
* @group Query Tools
|
|
3781
3933
|
*/
|
|
3782
|
-
declare const
|
|
3934
|
+
declare const deriveQueryBuilderClassNames: (options: OuterClassNameOptionsBase & QueryBuilderClassNameState) => string;
|
|
3783
3935
|
//#endregion
|
|
3784
|
-
//#region src/utils/
|
|
3936
|
+
//#region src/utils/defaultValidator.d.ts
|
|
3785
3937
|
/**
|
|
3786
|
-
*
|
|
3787
|
-
*
|
|
3788
|
-
*
|
|
3789
|
-
*
|
|
3790
|
-
* @group Export
|
|
3938
|
+
* This is an example validation function you can pass to {@link react-querybuilder!QueryBuilder QueryBuilder} in the
|
|
3939
|
+
* `validator` prop. It assumes that you want to validate groups, and has a no-op
|
|
3940
|
+
* for validating rules which you can replace with your own implementation.
|
|
3791
3941
|
*/
|
|
3792
|
-
declare const
|
|
3942
|
+
declare const defaultValidator: QueryValidator;
|
|
3793
3943
|
//#endregion
|
|
3794
|
-
//#region src/utils/
|
|
3944
|
+
//#region src/utils/deriveRuleContext.d.ts
|
|
3795
3945
|
/**
|
|
3796
|
-
*
|
|
3797
|
-
*
|
|
3798
|
-
* @group Export
|
|
3946
|
+
* Functions used by {@link deriveRuleContext} to resolve a rule's configuration. Each corresponds
|
|
3947
|
+
* to the `QueryBuilder` prop (or `useQueryBuilderSetup` output) of the same name.
|
|
3799
3948
|
*/
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3949
|
+
interface RuleContextResolvers<F extends FullField = FullField> {
|
|
3950
|
+
fields: OptionList<F>;
|
|
3951
|
+
fieldMap: Partial<FullOptionRecord<FullField>>;
|
|
3952
|
+
getInputType: (field: string, operator: string, misc: {
|
|
3953
|
+
fieldData: F;
|
|
3954
|
+
}) => InputType | null;
|
|
3955
|
+
getMatchModes: (field: string, misc: {
|
|
3956
|
+
fieldData: F;
|
|
3957
|
+
}) => MatchModeOptions;
|
|
3958
|
+
getOperators: (field: string, misc: {
|
|
3959
|
+
fieldData: F;
|
|
3960
|
+
}) => OptionList<FullOperator>;
|
|
3961
|
+
getParameters: (field: string, operator: string, misc: {
|
|
3962
|
+
fieldData: F;
|
|
3963
|
+
}) => FlexibleOptionList<Option>;
|
|
3964
|
+
getValueEditorType: (field: string, operator: string, misc: {
|
|
3965
|
+
fieldData: F;
|
|
3966
|
+
}) => ValueEditorType;
|
|
3967
|
+
getValues: (field: string, operator: string, misc: {
|
|
3968
|
+
fieldData: F;
|
|
3969
|
+
}) => FlexibleOptionList<Option>;
|
|
3970
|
+
getValueSources: (field: string, operator: string, misc: {
|
|
3971
|
+
fieldData: F;
|
|
3972
|
+
}) => ValueSourceFullOptions;
|
|
3973
|
+
getSubQueryBuilderProps?: (field: string, misc: {
|
|
3974
|
+
fieldData: F;
|
|
3975
|
+
}) => Record<string, unknown>;
|
|
3976
|
+
}
|
|
3805
3977
|
/**
|
|
3806
|
-
*
|
|
3807
|
-
*
|
|
3808
|
-
* @group Export
|
|
3978
|
+
* Everything {@link deriveRuleContext} resolves for a single rule.
|
|
3809
3979
|
*/
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3980
|
+
interface RuleContext<F extends FullField = FullField> {
|
|
3981
|
+
fieldData: F;
|
|
3982
|
+
hideValueControls: boolean;
|
|
3983
|
+
inputType: InputType | null;
|
|
3984
|
+
matchModes: MatchModeOptions;
|
|
3985
|
+
operatorObject: FullOperator | undefined;
|
|
3986
|
+
operators: OptionList<FullOperator>;
|
|
3987
|
+
parameters: FlexibleOptionList<Option> | null;
|
|
3988
|
+
validationResult: boolean | ValidationResult;
|
|
3989
|
+
valueEditorType: ValueEditorType;
|
|
3990
|
+
values: FlexibleOptionList<Option>;
|
|
3991
|
+
valueSourceOptions: ValueSourceFullOptions;
|
|
3992
|
+
valueSources: ValueSources;
|
|
3993
|
+
subQueryBuilderProps: Record<string, unknown>;
|
|
3994
|
+
}
|
|
3813
3995
|
/**
|
|
3814
|
-
*
|
|
3815
|
-
*
|
|
3816
|
-
* @group Export
|
|
3996
|
+
* Resolves the field configuration for a rule's `field`, falling back to a minimal option object
|
|
3997
|
+
* when the field isn't present in the field map.
|
|
3817
3998
|
*/
|
|
3818
|
-
declare const
|
|
3819
|
-
//#endregion
|
|
3820
|
-
//#region src/utils/formatQuery/defaultRuleGroupProcessorParameterized.d.ts
|
|
3999
|
+
declare const getFieldData: (field: string, fieldMap: Partial<FullOptionRecord<FullField>>) => FullField;
|
|
3821
4000
|
/**
|
|
3822
|
-
*
|
|
3823
|
-
* "parameterized_named" formats.
|
|
3824
|
-
*
|
|
3825
|
-
* @group Export
|
|
4001
|
+
* The input type for a rule. A field's own `inputType` takes precedence over `getInputType`.
|
|
3826
4002
|
*/
|
|
3827
|
-
declare const
|
|
3828
|
-
//#endregion
|
|
3829
|
-
//#region src/utils/formatQuery/defaultRuleGroupProcessorPrisma.d.ts
|
|
4003
|
+
declare const getRuleInputType: <F extends FullField = FullField>(field: string, operator: string, fieldData: F, getInputType: RuleContextResolvers<F>["getInputType"]) => InputType | null;
|
|
3830
4004
|
/**
|
|
3831
|
-
*
|
|
3832
|
-
*
|
|
3833
|
-
* @group Export
|
|
4005
|
+
* Whether the value editor(s) should be hidden for an operator, based on its `arity`.
|
|
3834
4006
|
*/
|
|
3835
|
-
declare const
|
|
4007
|
+
declare const hideValueControlsForOperator: (operatorObject?: FullOperator) => boolean;
|
|
3836
4008
|
/**
|
|
3837
|
-
*
|
|
3838
|
-
*
|
|
3839
|
-
*
|
|
4009
|
+
* The subset of a rule that determines its configuration. Accepting only these properties (rather
|
|
4010
|
+
* than the whole rule) lets React callers keep granular memoization dependencies, so editing a
|
|
4011
|
+
* rule's `value` doesn't recompute its operators, value sources, or option lists.
|
|
3840
4012
|
*/
|
|
3841
|
-
|
|
3842
|
-
//#endregion
|
|
3843
|
-
//#region src/utils/formatQuery/defaultRuleGroupProcessorSequelize.d.ts
|
|
4013
|
+
type RuleFacet = Pick<RuleType, "field" | "operator" | "valueSource">;
|
|
3844
4014
|
/**
|
|
3845
|
-
*
|
|
3846
|
-
*
|
|
3847
|
-
* (Referencing it would force consumers to install it to typecheck without `skipLibCheck`.)
|
|
3848
|
-
* Assignable to `WhereOptions` at the call site, e.g. `Model.findAll({ where })`.
|
|
3849
|
-
*
|
|
3850
|
-
* @group Export
|
|
4015
|
+
* Value source options for a rule. A `valueSource` present on the rule but absent from the
|
|
4016
|
+
* configured list is appended, so the current selection is always representable.
|
|
3851
4017
|
*/
|
|
3852
|
-
|
|
3853
|
-
[key: string | symbol]: unknown;
|
|
3854
|
-
}
|
|
4018
|
+
declare const getRuleValueSourceOptions: <F extends FullField = FullField>(rule: RuleFacet, fieldData: F, getValueSources: RuleContextResolvers<F>["getValueSources"]) => ValueSourceFullOptions;
|
|
3855
4019
|
/**
|
|
3856
|
-
*
|
|
3857
|
-
*
|
|
3858
|
-
* @group Export
|
|
4020
|
+
* Normalizes the result of `getParameters` to a non-empty list or `null`.
|
|
3859
4021
|
*/
|
|
3860
|
-
declare const
|
|
3861
|
-
//#endregion
|
|
3862
|
-
//#region src/utils/formatQuery/defaultRuleGroupProcessorSPARQL.d.ts
|
|
4022
|
+
declare const getParametersAsList: (parameters: FlexibleOptionList<Option>) => FlexibleOptionList<Option> | null;
|
|
3863
4023
|
/**
|
|
3864
|
-
*
|
|
4024
|
+
* The value editor type for a rule. `valueSource: "field"` always uses a select list, and
|
|
4025
|
+
* `valueSource: "parameter"` uses a (multi)select when parameters are available.
|
|
4026
|
+
*/
|
|
4027
|
+
declare const getRuleValueEditorType: <F extends FullField = FullField>(rule: RuleFacet, fieldData: F, parametersAsList: FlexibleOptionList<Option> | null, getValueEditorType: RuleContextResolvers<F>["getValueEditorType"]) => ValueEditorType;
|
|
4028
|
+
/**
|
|
4029
|
+
* The option list presented by a rule's value editor, resolved from its `valueSource`.
|
|
4030
|
+
*/
|
|
4031
|
+
declare const getRuleValues: <F extends FullField = FullField>(rule: RuleFacet, fieldData: F, fields: OptionList<F>, parametersAsList: FlexibleOptionList<Option> | null, getValues: RuleContextResolvers<F>["getValues"]) => FlexibleOptionList<Option>;
|
|
4032
|
+
/**
|
|
4033
|
+
* The validation result for a rule: the entry from a query-level {@link ValidationMap} if present,
|
|
4034
|
+
* otherwise the field's own `validator` result, otherwise `null`.
|
|
4035
|
+
*/
|
|
4036
|
+
declare const getRuleValidationResult: (rule: RuleType, fieldData: FullField, validationMap?: ValidationMap, id?: string) => boolean | ValidationResult;
|
|
4037
|
+
/**
|
|
4038
|
+
* Resolves everything about a single rule that depends on the field/operator configuration:
|
|
4039
|
+
* its field data, operators, value editor type, value list, value sources, match modes, and
|
|
4040
|
+
* validation result.
|
|
3865
4041
|
*
|
|
3866
|
-
*
|
|
4042
|
+
* This is the framework-agnostic core of the `useRule` hook, shared with
|
|
4043
|
+
* {@link QueryManager.getRuleContext} so that non-React implementations derive identical results.
|
|
4044
|
+
* It performs no memoization; callers are responsible for caching as appropriate.
|
|
3867
4045
|
*
|
|
3868
|
-
* @group
|
|
4046
|
+
* @group Query Tools
|
|
3869
4047
|
*/
|
|
3870
|
-
declare const
|
|
3871
|
-
|
|
3872
|
-
|
|
4048
|
+
declare const deriveRuleContext: <F extends FullField = FullField>(rule: RuleType, resolvers: RuleContextResolvers<F>, options?: {
|
|
4049
|
+
validationMap?: ValidationMap;
|
|
4050
|
+
id?: string;
|
|
4051
|
+
}) => RuleContext<F>;
|
|
3873
4052
|
/**
|
|
3874
|
-
*
|
|
4053
|
+
* Everything {@link deriveRuleGroupContext} resolves for a single rule group.
|
|
4054
|
+
*/
|
|
4055
|
+
interface RuleGroupContext<C extends FullCombinator = FullCombinator> {
|
|
4056
|
+
combinator: string;
|
|
4057
|
+
combinatorObject: C | undefined;
|
|
4058
|
+
combinators: FullOptionList<C>;
|
|
4059
|
+
/** The `className` of the selected combinator, or `null` for independent combinators. */
|
|
4060
|
+
combinatorBasedClassName: Classname | null;
|
|
4061
|
+
independentCombinators: boolean;
|
|
4062
|
+
validationResult: boolean | ValidationResult;
|
|
4063
|
+
}
|
|
4064
|
+
/**
|
|
4065
|
+
* The effective combinator for a group: its own `combinator` when it has one, otherwise the
|
|
4066
|
+
* first configured combinator (which is the case for groups with independent combinators).
|
|
3875
4067
|
*
|
|
3876
|
-
*
|
|
4068
|
+
* This intentionally covers only the current property-based API. The `RuleGroup` component
|
|
4069
|
+
* additionally falls back to its deprecated `combinator` prop; that fallback stays in the hook.
|
|
3877
4070
|
*/
|
|
3878
|
-
declare const
|
|
3879
|
-
//#endregion
|
|
3880
|
-
//#region src/utils/formatQuery/defaultRuleGroupProcessorSQL.d.ts
|
|
4071
|
+
declare const getRuleGroupCombinator: <C extends FullCombinator = FullCombinator>(ruleGroup: RuleGroupTypeAny, combinators: FullOptionList<C>) => string;
|
|
3881
4072
|
/**
|
|
3882
|
-
*
|
|
4073
|
+
* Resolves everything about a rule group that depends on the combinator configuration, plus its
|
|
4074
|
+
* validation result.
|
|
3883
4075
|
*
|
|
3884
|
-
* @
|
|
4076
|
+
* Note that unlike {@link deriveRuleContext}, there is no field-level validator fallback—a
|
|
4077
|
+
* group's validation result comes only from the query-level {@link ValidationMap}.
|
|
4078
|
+
*
|
|
4079
|
+
* @group Query Tools
|
|
3885
4080
|
*/
|
|
3886
|
-
declare const
|
|
4081
|
+
declare const deriveRuleGroupContext: <C extends FullCombinator = FullCombinator>(ruleGroup: RuleGroupTypeAny, combinators: FullOptionList<C>, options?: {
|
|
4082
|
+
validationMap?: ValidationMap;
|
|
4083
|
+
id?: string;
|
|
4084
|
+
}) => RuleGroupContext<C>;
|
|
3887
4085
|
//#endregion
|
|
3888
|
-
//#region src/utils/
|
|
4086
|
+
//#region src/utils/deriveValueEditor.d.ts
|
|
3889
4087
|
/**
|
|
3890
|
-
*
|
|
3891
|
-
*
|
|
3892
|
-
*
|
|
4088
|
+
* Whether an operator's value is a list of two bounds.
|
|
4089
|
+
*
|
|
4090
|
+
* @group Value Editors
|
|
3893
4091
|
*/
|
|
3894
|
-
|
|
3895
|
-
type TanStackDbWhereCallback = (refs: Record<string, unknown>) => TanStackDbWhereCallbackReturnType;
|
|
3896
|
-
//#endregion
|
|
3897
|
-
//#region src/utils/formatQuery/defaultRuleGroupProcessorTanStackDB.d.ts
|
|
4092
|
+
declare const isBetweenOperator: (operator: string) => boolean;
|
|
3898
4093
|
/**
|
|
3899
|
-
*
|
|
3900
|
-
*
|
|
4094
|
+
* Determines whether a rule's `value` needs to be collapsed to a single element because it no
|
|
4095
|
+
* longer represents a list, and what it should become.
|
|
3901
4096
|
*
|
|
3902
|
-
*
|
|
3903
|
-
*
|
|
3904
|
-
*
|
|
4097
|
+
* This happens when the value is an array (or a comma-containing string in a `number` input,
|
|
4098
|
+
* which `<input type="number">` can't display) while the operator is not one of the multi-value
|
|
4099
|
+
* operators and the editor is not a multiselect—typically right after the operator changes from
|
|
4100
|
+
* `"in"` or `"between"` to something else.
|
|
3905
4101
|
*
|
|
3906
|
-
*
|
|
4102
|
+
* The React `useValueEditor` hook applies the result in an effect; other implementations may
|
|
4103
|
+
* apply it wherever is idiomatic.
|
|
4104
|
+
*
|
|
4105
|
+
* @group Value Editors
|
|
3907
4106
|
*/
|
|
3908
|
-
declare const
|
|
3909
|
-
|
|
3910
|
-
|
|
4107
|
+
declare const getValueEditorReset: ({ skipHook, type, operator, value, inputType }: {
|
|
4108
|
+
skipHook?: boolean;
|
|
4109
|
+
type?: string;
|
|
4110
|
+
operator: string;
|
|
4111
|
+
value: unknown;
|
|
4112
|
+
inputType?: InputType | null;
|
|
4113
|
+
}) => {
|
|
4114
|
+
reset: boolean;
|
|
4115
|
+
value: unknown;
|
|
4116
|
+
};
|
|
3911
4117
|
/**
|
|
3912
|
-
*
|
|
4118
|
+
* Produces the next value for a series of value editors when the editor at `index` changes.
|
|
3913
4119
|
*
|
|
3914
|
-
*
|
|
3915
|
-
*
|
|
3916
|
-
*
|
|
3917
|
-
* `fieldSummary`.
|
|
4120
|
+
* For `between`/`notBetween`, editing the first bound guarantees an array of at least two
|
|
4121
|
+
* elements, seeding the second from the first available option. The result is a comma-joined
|
|
4122
|
+
* string unless `listsAsArrays` is `true`.
|
|
3918
4123
|
*
|
|
3919
|
-
* @group
|
|
4124
|
+
* @group Value Editors
|
|
3920
4125
|
*/
|
|
3921
|
-
declare const
|
|
3922
|
-
|
|
3923
|
-
|
|
4126
|
+
declare const getMultiValueUpdate: ({ value, index, valueAsArray, operator, values, listsAsArrays, parseNumberMethod }: {
|
|
4127
|
+
value: unknown;
|
|
4128
|
+
index: number;
|
|
4129
|
+
valueAsArray: unknown[];
|
|
4130
|
+
operator: string;
|
|
4131
|
+
values?: any[];
|
|
4132
|
+
listsAsArrays?: boolean;
|
|
4133
|
+
parseNumberMethod?: ParseNumberMethod;
|
|
4134
|
+
}) => unknown;
|
|
3924
4135
|
/**
|
|
3925
|
-
*
|
|
4136
|
+
* Coerces a value to a `bigint`, falling back to the parsed number when it can't be represented
|
|
4137
|
+
* as one (an empty string or a decimal, for example).
|
|
3926
4138
|
*
|
|
3927
|
-
* @group
|
|
4139
|
+
* @group Value Editors
|
|
3928
4140
|
*/
|
|
3929
|
-
declare const
|
|
3930
|
-
//#endregion
|
|
3931
|
-
//#region src/utils/formatQuery/defaultRuleProcessorDrizzle.d.ts
|
|
4141
|
+
declare const coerceBigIntValue: (value: unknown, parseNumberMethod?: ParseNumberMethod) => unknown;
|
|
3932
4142
|
/**
|
|
3933
|
-
*
|
|
4143
|
+
* The `type` attribute an `<input>` should use for a rule. `bigint` values and the `in`/`notIn`
|
|
4144
|
+
* operators (whose value is a comma-separated list) both require a text input.
|
|
3934
4145
|
*
|
|
3935
|
-
* @group
|
|
4146
|
+
* @group Value Editors
|
|
3936
4147
|
*/
|
|
3937
|
-
declare const
|
|
3938
|
-
//#endregion
|
|
3939
|
-
//#region src/utils/formatQuery/defaultRuleProcessorElasticSearch.d.ts
|
|
4148
|
+
declare const coerceInputType: (inputType: InputType | null | undefined, operator: string) => InputType;
|
|
3940
4149
|
/**
|
|
3941
|
-
*
|
|
4150
|
+
* Produces the next value for a value selector. Multiselect values are normalized to an array
|
|
4151
|
+
* first, then comma-joined unless `listsAsArrays` is `true`. Single-select values pass through.
|
|
3942
4152
|
*
|
|
3943
|
-
* @group
|
|
4153
|
+
* @group Value Editors
|
|
3944
4154
|
*/
|
|
3945
|
-
declare const
|
|
3946
|
-
|
|
3947
|
-
|
|
4155
|
+
declare const getValueSelectorUpdate: (value: string | string[], { multiple, listsAsArrays }?: {
|
|
4156
|
+
multiple?: boolean;
|
|
4157
|
+
listsAsArrays?: boolean;
|
|
4158
|
+
}) => string | string[];
|
|
3948
4159
|
/**
|
|
3949
|
-
*
|
|
4160
|
+
* Normalizes a value selector's current value for display. Multiselect values become an array of
|
|
4161
|
+
* strings so they match option names, which are always strings (e.g. `[42]` becomes `["42"]`).
|
|
3950
4162
|
*
|
|
3951
|
-
*
|
|
4163
|
+
* @group Value Editors
|
|
4164
|
+
*/
|
|
4165
|
+
declare const normalizeValueSelectorValue: (value: unknown, multiple?: boolean) => any;
|
|
4166
|
+
//#endregion
|
|
4167
|
+
//#region src/utils/filterFieldsByComparator.d.ts
|
|
4168
|
+
/**
|
|
4169
|
+
* For a given {@link FullField}, returns the `fields` list filtered for
|
|
4170
|
+
* other fields that match by `comparator`. Only fields *other than the
|
|
4171
|
+
* one in question* will ever be included, even if `comparator` is `null`
|
|
4172
|
+
* or `undefined`. If `comparator` is a string, fields with the same value
|
|
4173
|
+
* for that property will be included. If `comparator` is a function, each
|
|
4174
|
+
* field will be passed to the function along with the `operator` and fields
|
|
4175
|
+
* for which the function returns `true` will be included.
|
|
3952
4176
|
*
|
|
3953
|
-
* @group
|
|
4177
|
+
* @group Option Lists
|
|
3954
4178
|
*/
|
|
3955
|
-
declare const
|
|
4179
|
+
declare const filterFieldsByComparator: (field: FullField, fields: OptionList<FullField>, operator: string) => FullField[] | {
|
|
4180
|
+
options: WithUnknownIndex<FullField>[];
|
|
4181
|
+
label: string;
|
|
4182
|
+
}[];
|
|
3956
4183
|
//#endregion
|
|
3957
|
-
//#region src/utils/formatQuery/
|
|
4184
|
+
//#region src/utils/formatQuery/defaultRuleProcessorCEL.d.ts
|
|
3958
4185
|
/**
|
|
3959
|
-
* Default rule processor used by {@link formatQuery} for "
|
|
4186
|
+
* Default rule processor used by {@link formatQuery} for "cel" format.
|
|
3960
4187
|
*
|
|
3961
4188
|
* @group Export
|
|
3962
4189
|
*/
|
|
3963
|
-
declare const
|
|
4190
|
+
declare const defaultRuleProcessorCEL: RuleProcessor;
|
|
3964
4191
|
//#endregion
|
|
3965
|
-
//#region src/utils/formatQuery/
|
|
4192
|
+
//#region src/utils/formatQuery/defaultRuleProcessorMongoDB.d.ts
|
|
3966
4193
|
/**
|
|
3967
|
-
* Default rule processor used by {@link formatQuery} for "
|
|
4194
|
+
* Default rule processor used by {@link formatQuery} for "mongodb" format.
|
|
4195
|
+
*
|
|
4196
|
+
* Note that the "mongodb" format is deprecated in favor of the "mongodb_query" format.
|
|
3968
4197
|
*
|
|
3969
4198
|
* @group Export
|
|
3970
4199
|
*/
|
|
3971
|
-
declare const
|
|
4200
|
+
declare const defaultRuleProcessorMongoDB: RuleProcessor;
|
|
3972
4201
|
//#endregion
|
|
3973
|
-
//#region src/utils/formatQuery/
|
|
4202
|
+
//#region src/utils/formatQuery/defaultRuleProcessorSpEL.d.ts
|
|
3974
4203
|
/**
|
|
3975
|
-
* Default rule processor used by {@link formatQuery} for "
|
|
4204
|
+
* Default rule processor used by {@link formatQuery} for "spel" format.
|
|
3976
4205
|
*
|
|
3977
4206
|
* @group Export
|
|
3978
4207
|
*/
|
|
3979
|
-
declare const
|
|
4208
|
+
declare const defaultRuleProcessorSpEL: RuleProcessor;
|
|
3980
4209
|
//#endregion
|
|
3981
|
-
//#region src/utils/formatQuery/
|
|
4210
|
+
//#region src/utils/formatQuery/defaultValueProcessorByRule.d.ts
|
|
3982
4211
|
/**
|
|
3983
|
-
* Default
|
|
4212
|
+
* Default value processor used by {@link formatQuery} for "sql" format.
|
|
3984
4213
|
*
|
|
3985
4214
|
* @group Export
|
|
3986
4215
|
*/
|
|
3987
|
-
declare const
|
|
4216
|
+
declare const defaultValueProcessorByRule: ValueProcessorByRule;
|
|
3988
4217
|
//#endregion
|
|
3989
|
-
//#region src/utils/formatQuery/
|
|
4218
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorCEL.d.ts
|
|
3990
4219
|
/**
|
|
3991
|
-
*
|
|
4220
|
+
* Rule group processor used by {@link formatQuery} for "cel" format.
|
|
3992
4221
|
*
|
|
3993
4222
|
* @group Export
|
|
3994
4223
|
*/
|
|
3995
|
-
declare const
|
|
4224
|
+
declare const defaultRuleGroupProcessorCEL: RuleGroupProcessor<string>;
|
|
4225
|
+
//#endregion
|
|
4226
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorCypher.d.ts
|
|
3996
4227
|
/**
|
|
3997
|
-
*
|
|
4228
|
+
* Maps a {@link DefaultCombinatorName} to a Cypher combinator keyword.
|
|
3998
4229
|
*
|
|
3999
4230
|
* @group Export
|
|
4000
4231
|
*/
|
|
4001
|
-
declare const
|
|
4232
|
+
declare const cypherCombinatorMap: {
|
|
4233
|
+
and: "AND";
|
|
4234
|
+
or: "OR";
|
|
4235
|
+
};
|
|
4002
4236
|
/**
|
|
4003
|
-
*
|
|
4237
|
+
* Rule group processor used by {@link formatQuery} for "cypher" and "gql" formats.
|
|
4004
4238
|
*
|
|
4005
4239
|
* @group Export
|
|
4006
4240
|
*/
|
|
4007
|
-
declare const
|
|
4241
|
+
declare const defaultRuleGroupProcessorCypher: RuleGroupProcessor<string>;
|
|
4008
4242
|
//#endregion
|
|
4009
|
-
//#region src/utils/formatQuery/
|
|
4243
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorDrizzle.d.ts
|
|
4010
4244
|
/**
|
|
4011
|
-
*
|
|
4012
|
-
*
|
|
4245
|
+
* Minimal structural shape of Drizzle's `Operators` object. Declared locally so the public type
|
|
4246
|
+
* surface of this package never references `drizzle-orm`, which is an optional peer dependency.
|
|
4247
|
+
* (Referencing it would force consumers to install it to typecheck without `skipLibCheck`.)
|
|
4013
4248
|
*
|
|
4014
4249
|
* @group Export
|
|
4015
4250
|
*/
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4251
|
+
interface DrizzleOperatorsLike {
|
|
4252
|
+
and: (...conditions: any[]) => any;
|
|
4253
|
+
or: (...conditions: any[]) => any;
|
|
4254
|
+
not: (...conditions: any[]) => any;
|
|
4255
|
+
}
|
|
4019
4256
|
/**
|
|
4020
|
-
*
|
|
4257
|
+
* Return type of {@link defaultRuleGroupProcessorDrizzle}—the function assignable to the `where`
|
|
4258
|
+
* property in the Drizzle relational queries API. The Drizzle `SQL` result type is inferred from
|
|
4259
|
+
* the caller's own operators object, so it stays exact without importing `drizzle-orm` here.
|
|
4021
4260
|
*
|
|
4022
4261
|
* @group Export
|
|
4023
4262
|
*/
|
|
4024
|
-
|
|
4025
|
-
//#endregion
|
|
4026
|
-
//#region src/utils/formatQuery/defaultRuleProcessorSequelize.d.ts
|
|
4263
|
+
type DrizzleWhereCallback = <Ops extends DrizzleOperatorsLike>(columns: object, drizzleOperators: Ops) => ReturnType<Ops["and"]>;
|
|
4027
4264
|
/**
|
|
4028
|
-
* Default rule processor used by {@link formatQuery} for the "
|
|
4265
|
+
* Default rule group processor used by {@link formatQuery} for the "drizzle" format. The returned
|
|
4266
|
+
* function can be assigned to the `where` property in the Drizzle relational queries API.
|
|
4029
4267
|
*
|
|
4030
|
-
* @
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
/** Auto-prefix a SPARQL variable name with `?` unless it's already prefixed, a URI, or a prefixed name.
|
|
4268
|
+
* @example
|
|
4269
|
+
* const where = formatQuery(query, 'drizzle');
|
|
4270
|
+
* const results = db.query.users.findMany({ where });
|
|
4271
|
+
*
|
|
4272
|
+
* @returns Function that takes a Drizzle table config and an object of Drizzle operators.
|
|
4036
4273
|
*
|
|
4037
4274
|
* @group Export
|
|
4038
4275
|
*/
|
|
4039
|
-
declare const
|
|
4276
|
+
declare const defaultRuleGroupProcessorDrizzle: RuleGroupProcessor<DrizzleWhereCallback>;
|
|
4277
|
+
//#endregion
|
|
4278
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorElasticSearch.d.ts
|
|
4040
4279
|
/**
|
|
4041
|
-
*
|
|
4280
|
+
* Rule group processor used by {@link formatQuery} for "elasticsearch" format.
|
|
4042
4281
|
*
|
|
4043
4282
|
* @group Export
|
|
4044
4283
|
*/
|
|
4045
|
-
declare const
|
|
4284
|
+
declare const defaultRuleGroupProcessorElasticSearch: RuleGroupProcessor<Record<string, unknown>>;
|
|
4046
4285
|
//#endregion
|
|
4047
|
-
//#region src/utils/formatQuery/
|
|
4286
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorGremlin.d.ts
|
|
4048
4287
|
/**
|
|
4049
|
-
*
|
|
4288
|
+
* Rule group processor used by {@link formatQuery} for "gremlin" format.
|
|
4289
|
+
*
|
|
4290
|
+
* At the top level, filter rules produce chained `.has()` steps (implicit AND).
|
|
4291
|
+
* Nested groups use `.and()` / `.or()` / `.not()` compound traversals with
|
|
4292
|
+
* `__` anonymous traversal prefixes.
|
|
4050
4293
|
*
|
|
4051
4294
|
* @group Export
|
|
4052
4295
|
*/
|
|
4053
|
-
declare const
|
|
4296
|
+
declare const defaultRuleGroupProcessorGremlin: RuleGroupProcessor<string>;
|
|
4297
|
+
//#endregion
|
|
4298
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorJSONata.d.ts
|
|
4054
4299
|
/**
|
|
4055
|
-
*
|
|
4300
|
+
* Rule group processor used by {@link formatQuery} for "jsonata" format.
|
|
4056
4301
|
*
|
|
4057
4302
|
* @group Export
|
|
4058
4303
|
*/
|
|
4059
|
-
declare const
|
|
4304
|
+
declare const defaultRuleGroupProcessorJSONata: RuleGroupProcessor<string>;
|
|
4060
4305
|
//#endregion
|
|
4061
|
-
//#region src/utils/formatQuery/
|
|
4306
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorJsonLogic.d.ts
|
|
4062
4307
|
/**
|
|
4063
|
-
*
|
|
4308
|
+
* Rule group processor used by {@link formatQuery} for "jsonlogic" format.
|
|
4064
4309
|
*
|
|
4065
4310
|
* @group Export
|
|
4066
4311
|
*/
|
|
4067
|
-
declare const
|
|
4312
|
+
declare const defaultRuleGroupProcessorJsonLogic: RuleGroupProcessor<RQBJsonLogic>;
|
|
4068
4313
|
//#endregion
|
|
4069
|
-
//#region src/utils/formatQuery/
|
|
4314
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorLDAP.d.ts
|
|
4070
4315
|
/**
|
|
4071
|
-
*
|
|
4316
|
+
* Rule group processor used by {@link formatQuery} for "ldap" format.
|
|
4072
4317
|
*
|
|
4073
4318
|
* @group Export
|
|
4074
4319
|
*/
|
|
4075
|
-
declare const
|
|
4320
|
+
declare const defaultRuleGroupProcessorLDAP: RuleGroupProcessor<string>;
|
|
4076
4321
|
//#endregion
|
|
4077
|
-
//#region src/utils/formatQuery/
|
|
4322
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorMongoDB.d.ts
|
|
4078
4323
|
/**
|
|
4079
|
-
*
|
|
4324
|
+
* Rule group processor used by {@link formatQuery} for "mongodb" format.
|
|
4325
|
+
*
|
|
4326
|
+
* Note that the "mongodb" format is deprecated in favor of the "mongodb_query" format.
|
|
4080
4327
|
*
|
|
4081
4328
|
* @group Export
|
|
4082
4329
|
*/
|
|
4083
|
-
declare const
|
|
4330
|
+
declare const defaultRuleGroupProcessorMongoDB: RuleGroupProcessor<string>;
|
|
4331
|
+
//#endregion
|
|
4332
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorMongoDBQuery.d.ts
|
|
4084
4333
|
/**
|
|
4085
|
-
*
|
|
4334
|
+
* Default fallback object used by {@link formatQuery} for "mongodb_query" format.
|
|
4086
4335
|
*
|
|
4087
4336
|
* @group Export
|
|
4088
4337
|
*/
|
|
4089
|
-
declare const
|
|
4338
|
+
declare const mongoDbFallback: {
|
|
4339
|
+
readonly $and: readonly [{
|
|
4340
|
+
readonly $expr: true;
|
|
4341
|
+
}];
|
|
4342
|
+
};
|
|
4090
4343
|
/**
|
|
4091
|
-
*
|
|
4344
|
+
* Rule group processor used by {@link formatQuery} for "mongodb_query" format.
|
|
4092
4345
|
*
|
|
4093
4346
|
* @group Export
|
|
4094
4347
|
*/
|
|
4095
|
-
declare
|
|
4348
|
+
declare const defaultRuleGroupProcessorMongoDBQuery: RuleGroupProcessor;
|
|
4349
|
+
//#endregion
|
|
4350
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorNL.d.ts
|
|
4096
4351
|
/**
|
|
4097
|
-
*
|
|
4352
|
+
* Rule group processor used by {@link formatQuery} for "natural_language" format.
|
|
4098
4353
|
*
|
|
4099
4354
|
* @group Export
|
|
4100
4355
|
*/
|
|
4101
|
-
declare
|
|
4102
|
-
|
|
4103
|
-
|
|
4356
|
+
declare const defaultRuleGroupProcessorNL: RuleGroupProcessor<string>;
|
|
4357
|
+
//#endregion
|
|
4358
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorParameterized.d.ts
|
|
4104
4359
|
/**
|
|
4105
|
-
*
|
|
4360
|
+
* Rule group processor used by {@link formatQuery} for "parameterized" and
|
|
4361
|
+
* "parameterized_named" formats.
|
|
4106
4362
|
*
|
|
4107
4363
|
* @group Export
|
|
4108
4364
|
*/
|
|
4109
|
-
declare
|
|
4110
|
-
|
|
4111
|
-
|
|
4365
|
+
declare const defaultRuleGroupProcessorParameterized: RuleGroupProcessor<ParameterizedSQL | ParameterizedNamedSQL>;
|
|
4366
|
+
//#endregion
|
|
4367
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorPrisma.d.ts
|
|
4112
4368
|
/**
|
|
4113
|
-
*
|
|
4369
|
+
* Default fallback object used by {@link formatQuery} for "prisma" format.
|
|
4114
4370
|
*
|
|
4115
4371
|
* @group Export
|
|
4116
4372
|
*/
|
|
4117
|
-
declare
|
|
4118
|
-
format: "parameterized_named";
|
|
4119
|
-
})): ParameterizedNamedSQL;
|
|
4373
|
+
declare const prismaFallback: {};
|
|
4120
4374
|
/**
|
|
4121
|
-
*
|
|
4375
|
+
* Rule group processor used by {@link formatQuery} for "prisma" format.
|
|
4122
4376
|
*
|
|
4123
4377
|
* @group Export
|
|
4124
4378
|
*/
|
|
4125
|
-
declare
|
|
4126
|
-
|
|
4127
|
-
|
|
4379
|
+
declare const defaultRuleGroupProcessorPrisma: RuleGroupProcessor<Record<string, unknown> | undefined>;
|
|
4380
|
+
//#endregion
|
|
4381
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorSequelize.d.ts
|
|
4128
4382
|
/**
|
|
4129
|
-
*
|
|
4130
|
-
*
|
|
4131
|
-
*
|
|
4132
|
-
*
|
|
4133
|
-
* [ElasticSearch SQL](https://www.elastic.co/guide/en/elasticsearch/reference/current/xpack-sql.html).
|
|
4383
|
+
* Structural stand-in for Sequelize's `WhereOptions`. Declared locally so the public type surface
|
|
4384
|
+
* of this package never references `sequelize`, which is an optional peer dependency.
|
|
4385
|
+
* (Referencing it would force consumers to install it to typecheck without `skipLibCheck`.)
|
|
4386
|
+
* Assignable to `WhereOptions` at the call site, e.g. `Model.findAll({ where })`.
|
|
4134
4387
|
*
|
|
4135
4388
|
* @group Export
|
|
4136
4389
|
*/
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
}
|
|
4390
|
+
interface SequelizeWhereOptionsLike {
|
|
4391
|
+
[key: string | symbol]: unknown;
|
|
4392
|
+
}
|
|
4140
4393
|
/**
|
|
4141
|
-
*
|
|
4142
|
-
*
|
|
4143
|
-
* This is equivalent to the "mongodb" format, but returns a JSON object
|
|
4144
|
-
* instead of a string.
|
|
4394
|
+
* Rule group processor used by {@link formatQuery} for "sequelize" format.
|
|
4145
4395
|
*
|
|
4146
4396
|
* @group Export
|
|
4147
4397
|
*/
|
|
4148
|
-
declare
|
|
4149
|
-
|
|
4150
|
-
|
|
4398
|
+
declare const defaultRuleGroupProcessorSequelize: RuleGroupProcessor<SequelizeWhereOptionsLike | undefined>;
|
|
4399
|
+
//#endregion
|
|
4400
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorSPARQL.d.ts
|
|
4151
4401
|
/**
|
|
4152
|
-
*
|
|
4153
|
-
*
|
|
4154
|
-
* This is equivalent to the "mongodb_query" format, but returns a string
|
|
4155
|
-
* instead of a JSON object.
|
|
4402
|
+
* Rule group processor used by {@link formatQuery} for "sparql" format.
|
|
4156
4403
|
*
|
|
4157
|
-
*
|
|
4404
|
+
* SPARQL uses the same combinators as CEL (`&&` / `||`) and `!()` for negation.
|
|
4158
4405
|
*
|
|
4159
4406
|
* @group Export
|
|
4160
4407
|
*/
|
|
4161
|
-
declare
|
|
4162
|
-
|
|
4163
|
-
|
|
4408
|
+
declare const defaultRuleGroupProcessorSPARQL: RuleGroupProcessor<string>;
|
|
4409
|
+
//#endregion
|
|
4410
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorSpEL.d.ts
|
|
4164
4411
|
/**
|
|
4165
|
-
*
|
|
4412
|
+
* Default rule processor used by {@link formatQuery} for "spel" format.
|
|
4166
4413
|
*
|
|
4167
4414
|
* @group Export
|
|
4168
4415
|
*/
|
|
4169
|
-
declare
|
|
4170
|
-
|
|
4171
|
-
|
|
4416
|
+
declare const defaultRuleGroupProcessorSpEL: RuleGroupProcessor<string>;
|
|
4417
|
+
//#endregion
|
|
4418
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorSQL.d.ts
|
|
4172
4419
|
/**
|
|
4173
|
-
*
|
|
4174
|
-
* be assigned to the `where` property in the Drizzle relational queries API.
|
|
4420
|
+
* Default rule processor used by {@link formatQuery} for "sql" format.
|
|
4175
4421
|
*
|
|
4176
4422
|
* @group Export
|
|
4177
4423
|
*/
|
|
4178
|
-
declare
|
|
4179
|
-
|
|
4180
|
-
|
|
4424
|
+
declare const defaultRuleGroupProcessorSQL: RuleGroupProcessor<string>;
|
|
4425
|
+
//#endregion
|
|
4426
|
+
//#region src/utils/formatQuery/tanStackDbTypes.d.ts
|
|
4181
4427
|
/**
|
|
4182
|
-
*
|
|
4183
|
-
*
|
|
4184
|
-
*
|
|
4185
|
-
* @group Export
|
|
4428
|
+
* Return type of the TanStack DB where-callback. Intentionally `unknown`: TanStack DB's own
|
|
4429
|
+
* `WhereCallback` returns `any`, so a precise type constrains nothing at the call site, and
|
|
4430
|
+
* naming `@tanstack/db` here would drag an optional peer dependency into the published types.
|
|
4186
4431
|
*/
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4432
|
+
type TanStackDbWhereCallbackReturnType = unknown;
|
|
4433
|
+
type TanStackDbWhereCallback = (refs: Record<string, unknown>) => TanStackDbWhereCallbackReturnType;
|
|
4434
|
+
//#endregion
|
|
4435
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorTanStackDB.d.ts
|
|
4190
4436
|
/**
|
|
4191
|
-
*
|
|
4437
|
+
* Default rule group processor used by {@link formatQuery} for the "tanstack_db" format.
|
|
4438
|
+
* Returns a `WhereCallback` suitable for TanStack DB's `.where()` method.
|
|
4439
|
+
*
|
|
4440
|
+
* @example
|
|
4441
|
+
* const where = formatQuery(query, { format: 'tanstack_db', context: { tanstackDb: tsdb } });
|
|
4442
|
+
* const results = useLiveQuery(q => q.from({ todo: todosCollection }).where(where));
|
|
4192
4443
|
*
|
|
4193
4444
|
* @group Export
|
|
4194
4445
|
*/
|
|
4195
|
-
declare
|
|
4196
|
-
|
|
4197
|
-
|
|
4446
|
+
declare const defaultRuleGroupProcessorTanStackDB: RuleGroupProcessor<TanStackDbWhereCallback>;
|
|
4447
|
+
//#endregion
|
|
4448
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorDiagnostics.d.ts
|
|
4198
4449
|
/**
|
|
4199
|
-
*
|
|
4450
|
+
* Rule group processor used by {@link formatQuery} for "diagnostics" format.
|
|
4200
4451
|
*
|
|
4201
|
-
*
|
|
4202
|
-
*
|
|
4452
|
+
* Produces a {@link DiagnosticsResult} containing an annotated copy of the query
|
|
4453
|
+
* tree (`query`) with `valid`, `reasons`, `path`, and `level` properties on every
|
|
4454
|
+
* rule and group; a flat `diagnostics` array; aggregate `stats`; and a per-field
|
|
4455
|
+
* `fieldSummary`.
|
|
4203
4456
|
*
|
|
4204
4457
|
* @group Export
|
|
4205
4458
|
*/
|
|
4206
|
-
declare
|
|
4207
|
-
|
|
4208
|
-
|
|
4459
|
+
declare const defaultRuleGroupProcessorDiagnostics: RuleGroupProcessor<DiagnosticsResult>;
|
|
4460
|
+
//#endregion
|
|
4461
|
+
//#region src/utils/formatQuery/defaultRuleProcessorCypher.d.ts
|
|
4209
4462
|
/**
|
|
4210
|
-
*
|
|
4463
|
+
* Default rule processor used by {@link formatQuery} for "cypher" and "gql" formats.
|
|
4211
4464
|
*
|
|
4212
4465
|
* @group Export
|
|
4213
4466
|
*/
|
|
4214
|
-
declare
|
|
4215
|
-
|
|
4216
|
-
|
|
4467
|
+
declare const defaultRuleProcessorCypher: RuleProcessor;
|
|
4468
|
+
//#endregion
|
|
4469
|
+
//#region src/utils/formatQuery/defaultRuleProcessorDrizzle.d.ts
|
|
4217
4470
|
/**
|
|
4218
|
-
*
|
|
4219
|
-
* query tree, a flat diagnostics array, aggregate stats, and a per-field summary.
|
|
4471
|
+
* Default rule processor used by {@link formatQuery} for the "drizzle" format.
|
|
4220
4472
|
*
|
|
4221
4473
|
* @group Export
|
|
4222
4474
|
*/
|
|
4223
|
-
declare
|
|
4224
|
-
|
|
4225
|
-
|
|
4475
|
+
declare const defaultRuleProcessorDrizzle: RuleProcessor;
|
|
4476
|
+
//#endregion
|
|
4477
|
+
//#region src/utils/formatQuery/defaultRuleProcessorElasticSearch.d.ts
|
|
4226
4478
|
/**
|
|
4227
|
-
*
|
|
4479
|
+
* Default rule processor used by {@link formatQuery} for "elasticsearch" format.
|
|
4228
4480
|
*
|
|
4229
4481
|
* @group Export
|
|
4230
4482
|
*/
|
|
4231
|
-
declare
|
|
4483
|
+
declare const defaultRuleProcessorElasticSearch: RuleProcessor;
|
|
4484
|
+
//#endregion
|
|
4485
|
+
//#region src/utils/formatQuery/defaultRuleProcessorGremlin.d.ts
|
|
4232
4486
|
/**
|
|
4233
|
-
*
|
|
4487
|
+
* Default rule processor used by {@link formatQuery} for "gremlin" format.
|
|
4488
|
+
*
|
|
4489
|
+
* Each rule becomes a `.has()` step (or `.hasNot()`/`.has()` for null checks).
|
|
4234
4490
|
*
|
|
4235
4491
|
* @group Export
|
|
4236
4492
|
*/
|
|
4237
|
-
declare
|
|
4493
|
+
declare const defaultRuleProcessorGremlin: RuleProcessor;
|
|
4494
|
+
//#endregion
|
|
4495
|
+
//#region src/utils/formatQuery/defaultRuleProcessorJSONata.d.ts
|
|
4238
4496
|
/**
|
|
4239
|
-
*
|
|
4497
|
+
* Default rule processor used by {@link formatQuery} for "jsonata" format.
|
|
4240
4498
|
*
|
|
4241
4499
|
* @group Export
|
|
4242
4500
|
*/
|
|
4243
|
-
declare
|
|
4244
|
-
format: Exclude<ExportFormat, ExportObjectFormats>;
|
|
4245
|
-
}): string;
|
|
4501
|
+
declare const defaultRuleProcessorJSONata: RuleProcessor;
|
|
4246
4502
|
//#endregion
|
|
4247
|
-
//#region src/utils/formatQuery/
|
|
4503
|
+
//#region src/utils/formatQuery/defaultRuleProcessorJsonLogic.d.ts
|
|
4248
4504
|
/**
|
|
4249
|
-
*
|
|
4505
|
+
* Default rule processor used by {@link formatQuery} for "jsonlogic" format.
|
|
4250
4506
|
*
|
|
4251
4507
|
* @group Export
|
|
4252
4508
|
*/
|
|
4253
|
-
declare const
|
|
4509
|
+
declare const defaultRuleProcessorJsonLogic: RuleProcessor;
|
|
4510
|
+
//#endregion
|
|
4511
|
+
//#region src/utils/formatQuery/defaultRuleProcessorLDAP.d.ts
|
|
4254
4512
|
/**
|
|
4255
|
-
*
|
|
4256
|
-
* `concatOperator` is `"CONCAT"` (case-insensitive), otherwise joins with the infix operator
|
|
4257
|
-
* (e.g. `a || b`, `a + b`).
|
|
4513
|
+
* Default rule processor used by {@link formatQuery} for "ldap" format.
|
|
4258
4514
|
*
|
|
4259
4515
|
* @group Export
|
|
4260
4516
|
*/
|
|
4261
|
-
declare const
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
*
|
|
4517
|
+
declare const defaultRuleProcessorLDAP: RuleProcessor;
|
|
4518
|
+
//#endregion
|
|
4519
|
+
//#region src/utils/formatQuery/defaultRuleProcessorMongoDBQuery.d.ts
|
|
4520
|
+
/**
|
|
4521
|
+
* Default rule processor used by {@link formatQuery} for "mongodb_query" format.
|
|
4266
4522
|
*
|
|
4267
4523
|
* @group Export
|
|
4268
4524
|
*/
|
|
4269
|
-
declare const
|
|
4525
|
+
declare const defaultRuleProcessorMongoDBQuery: RuleProcessor;
|
|
4526
|
+
//#endregion
|
|
4527
|
+
//#region src/utils/formatQuery/defaultRuleProcessorNL.d.ts
|
|
4270
4528
|
/**
|
|
4271
|
-
*
|
|
4272
|
-
* `LIKE` wildcards for the given (lowercase) string-match operator, concatenating the literal
|
|
4273
|
-
* `%` markers via the preset-aware {@link getSQLConcat}. Returns the fragment untouched for
|
|
4274
|
-
* operators without wildcards.
|
|
4529
|
+
* Default operator map used by {@link formatQuery} for "natural_language" format.
|
|
4275
4530
|
*
|
|
4276
4531
|
* @group Export
|
|
4277
4532
|
*/
|
|
4278
|
-
declare const
|
|
4279
|
-
concatOperator?: string;
|
|
4280
|
-
quoteValuesWith?: string;
|
|
4281
|
-
wrapValueWith?: [string, string];
|
|
4282
|
-
}) => string;
|
|
4533
|
+
declare const defaultExportOperatorMap: ExportOperatorMap;
|
|
4283
4534
|
/**
|
|
4284
|
-
*
|
|
4535
|
+
* Default operator processor used by {@link formatQuery} for "natural_language" format.
|
|
4285
4536
|
*
|
|
4286
4537
|
* @group Export
|
|
4287
4538
|
*/
|
|
4288
|
-
declare const
|
|
4289
|
-
"=": string;
|
|
4290
|
-
"!=": string;
|
|
4291
|
-
"<": string;
|
|
4292
|
-
"<=": string;
|
|
4293
|
-
">": string;
|
|
4294
|
-
">=": string;
|
|
4295
|
-
in: string;
|
|
4296
|
-
notin: string;
|
|
4297
|
-
notIn: string;
|
|
4298
|
-
};
|
|
4539
|
+
declare const defaultOperatorProcessorNL: RuleProcessor;
|
|
4299
4540
|
/**
|
|
4300
|
-
*
|
|
4541
|
+
* Default rule processor used by {@link formatQuery} for "natural_language" format.
|
|
4301
4542
|
*
|
|
4302
4543
|
* @group Export
|
|
4303
4544
|
*/
|
|
4304
|
-
declare const
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
"<": string;
|
|
4308
|
-
"<=": string;
|
|
4309
|
-
">": string;
|
|
4310
|
-
">=": string;
|
|
4311
|
-
in: string;
|
|
4312
|
-
notin: string;
|
|
4313
|
-
};
|
|
4545
|
+
declare const defaultRuleProcessorNL: RuleProcessor;
|
|
4546
|
+
//#endregion
|
|
4547
|
+
//#region src/utils/formatQuery/defaultRuleProcessorParameterized.d.ts
|
|
4314
4548
|
/**
|
|
4315
|
-
*
|
|
4549
|
+
* Default rule processor used by {@link formatQuery} for "parameterized" and
|
|
4550
|
+
* "parameterized_named" formats.
|
|
4316
4551
|
*
|
|
4317
4552
|
* @group Export
|
|
4318
4553
|
*/
|
|
4319
|
-
declare const
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
};
|
|
4554
|
+
declare const defaultRuleProcessorParameterized: RuleProcessor;
|
|
4555
|
+
//#endregion
|
|
4556
|
+
//#region src/utils/formatQuery/defaultRuleProcessorPrisma.d.ts
|
|
4323
4557
|
/**
|
|
4324
|
-
*
|
|
4325
|
-
* of `formatQuery(query, 'jsonlogic')`.
|
|
4326
|
-
*
|
|
4327
|
-
* @example
|
|
4328
|
-
* ```
|
|
4329
|
-
* for (const [op, func] of Object.entries(jsonLogicAdditionalOperators)) {
|
|
4330
|
-
* jsonLogic.add_operation(op, func);
|
|
4331
|
-
* }
|
|
4332
|
-
* jsonLogic.apply({ "startsWith": [{ "var": "firstName" }, "Stev"] }, data);
|
|
4333
|
-
* ```
|
|
4558
|
+
* Default rule processor used by {@link formatQuery} for "prisma" format.
|
|
4334
4559
|
*
|
|
4335
4560
|
* @group Export
|
|
4336
4561
|
*/
|
|
4337
|
-
declare const
|
|
4562
|
+
declare const defaultRuleProcessorPrisma: RuleProcessor;
|
|
4563
|
+
//#endregion
|
|
4564
|
+
//#region src/utils/formatQuery/defaultRuleProcessorSequelize.d.ts
|
|
4338
4565
|
/**
|
|
4339
|
-
*
|
|
4340
|
-
* to `number` where appropriate.
|
|
4341
|
-
*
|
|
4342
|
-
* Used by {@link formatQuery} for the `json*` formats when `parseNumbers` is `true`.
|
|
4566
|
+
* Default rule processor used by {@link formatQuery} for the "sequelize" format.
|
|
4343
4567
|
*
|
|
4344
4568
|
* @group Export
|
|
4345
4569
|
*/
|
|
4346
|
-
declare const
|
|
4347
|
-
|
|
4348
|
-
|
|
4570
|
+
declare const defaultRuleProcessorSequelize: RuleProcessor;
|
|
4571
|
+
//#endregion
|
|
4572
|
+
//#region src/utils/formatQuery/defaultRuleProcessorSPARQL.d.ts
|
|
4573
|
+
/** Auto-prefix a SPARQL variable name with `?` unless it's already prefixed, a URI, or a prefixed name.
|
|
4349
4574
|
*
|
|
4350
4575
|
* @group Export
|
|
4351
4576
|
*/
|
|
4352
|
-
declare const
|
|
4577
|
+
declare const sparqlVar: (name: string) => string;
|
|
4353
4578
|
/**
|
|
4354
|
-
*
|
|
4355
|
-
* As long as `parseNumbers` is `true`, `number` and `bigint` values will return `true` and
|
|
4356
|
-
* `string` values will return `true` if they test positive against {@link numericRegex}.
|
|
4579
|
+
* Default rule processor used by {@link formatQuery} for "sparql" format.
|
|
4357
4580
|
*
|
|
4358
4581
|
* @group Export
|
|
4359
4582
|
*/
|
|
4360
|
-
declare const
|
|
4583
|
+
declare const defaultRuleProcessorSPARQL: RuleProcessor;
|
|
4584
|
+
//#endregion
|
|
4585
|
+
//#region src/utils/formatQuery/defaultRuleProcessorSQL.d.ts
|
|
4361
4586
|
/**
|
|
4362
|
-
*
|
|
4363
|
-
* "legacy" value processor by counting the number of arguments. Legacy value
|
|
4364
|
-
* processors take 3 arguments (not counting any arguments with default values), while
|
|
4365
|
-
* rule-based value processors take no more than 2 arguments.
|
|
4587
|
+
* Default operator processor used by {@link formatQuery} for "sql" and "parameterized*" formats.
|
|
4366
4588
|
*
|
|
4367
4589
|
* @group Export
|
|
4368
4590
|
*/
|
|
4369
|
-
declare const
|
|
4591
|
+
declare const defaultOperatorProcessorSQL: RuleProcessor;
|
|
4370
4592
|
/**
|
|
4371
|
-
*
|
|
4372
|
-
* If the option is a string, the array elements are both that string.
|
|
4373
|
-
*
|
|
4374
|
-
* @default
|
|
4375
|
-
* ['', '']
|
|
4593
|
+
* Default rule processor used by {@link formatQuery} for "sql" format.
|
|
4376
4594
|
*
|
|
4377
4595
|
* @group Export
|
|
4378
4596
|
*/
|
|
4379
|
-
declare const
|
|
4597
|
+
declare const defaultRuleProcessorSQL: RuleProcessor;
|
|
4598
|
+
//#endregion
|
|
4599
|
+
//#region src/utils/formatQuery/defaultRuleProcessorTanStackDB.d.ts
|
|
4380
4600
|
/**
|
|
4381
|
-
*
|
|
4382
|
-
* wrapped in the configured quote character(s).
|
|
4601
|
+
* Default rule processor used by {@link formatQuery} for the "tanstack_db" format.
|
|
4383
4602
|
*
|
|
4384
4603
|
* @group Export
|
|
4385
4604
|
*/
|
|
4386
|
-
declare const
|
|
4605
|
+
declare const defaultRuleProcessorTanStackDB: RuleProcessor;
|
|
4606
|
+
//#endregion
|
|
4607
|
+
//#region src/utils/formatQuery/defaultValueProcessorNL.d.ts
|
|
4387
4608
|
/**
|
|
4388
|
-
*
|
|
4389
|
-
* like "svo" or "sov", returns a permutation of `["S", "V", "O"]` based on the first occurrence of
|
|
4390
|
-
* each letter in the input string (case insensitive). This widens the valid input from abbreviations
|
|
4391
|
-
* like "svo" to more expressive strings like "subject-verb-object" or "sub ver obj". Any missing
|
|
4392
|
-
* letters are appended in the default order "SVO" (e.g., "object" would yield `["O", "S", "V"]`).
|
|
4609
|
+
* Default value processor used by {@link formatQuery} for "natural_language" format.
|
|
4393
4610
|
*
|
|
4394
4611
|
* @group Export
|
|
4395
4612
|
*/
|
|
4396
|
-
declare const
|
|
4613
|
+
declare const defaultValueProcessorNL: ValueProcessorByRule;
|
|
4614
|
+
//#endregion
|
|
4615
|
+
//#region src/utils/formatQuery/formatQuery.d.ts
|
|
4397
4616
|
/**
|
|
4398
|
-
*
|
|
4399
|
-
* begins with it. Used by {@link formatQuery} to render rules whose `valueSource` is
|
|
4400
|
-
* `"parameter"` (e.g. `"p1"` with prefix `":"` → `":p1"`; `":p1"` → `":p1"`).
|
|
4617
|
+
* A collection of option presets for {@link formatQuery}, specifically for SQL-based formats.
|
|
4401
4618
|
*
|
|
4402
4619
|
* @group Export
|
|
4403
4620
|
*/
|
|
4404
|
-
declare const
|
|
4621
|
+
declare const sqlDialectPresets: Record<SQLPreset, FormatQueryOptions>;
|
|
4405
4622
|
/**
|
|
4406
|
-
*
|
|
4407
|
-
* {@link withParamPrefix}; used to normalize parameter names for validation/lookup.
|
|
4623
|
+
* A collection of option presets for {@link formatQuery}.
|
|
4408
4624
|
*
|
|
4409
4625
|
* @group Export
|
|
4410
4626
|
*/
|
|
4411
|
-
declare const
|
|
4627
|
+
declare const formatQueryOptionPresets: Record<string, FormatQueryOptions>;
|
|
4412
4628
|
/**
|
|
4413
|
-
*
|
|
4629
|
+
* Generates a formatted (indented two spaces) JSON string from a query object.
|
|
4414
4630
|
*
|
|
4415
4631
|
* @group Export
|
|
4416
4632
|
*/
|
|
4417
|
-
declare
|
|
4633
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny): string;
|
|
4418
4634
|
/**
|
|
4419
|
-
*
|
|
4420
|
-
* for the "natural_language" format.
|
|
4635
|
+
* Generates a result based on the provided rule group processor.
|
|
4421
4636
|
*
|
|
4422
4637
|
* @group Export
|
|
4423
4638
|
*/
|
|
4424
|
-
declare
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
threshold?: number | null | undefined;
|
|
4428
|
-
} | {
|
|
4429
|
-
mode: "none";
|
|
4430
|
-
threshold?: number | null | undefined;
|
|
4431
|
-
} | {
|
|
4432
|
-
mode: "some";
|
|
4433
|
-
threshold?: number | null | undefined;
|
|
4434
|
-
} | {
|
|
4435
|
-
mode: "atleast";
|
|
4436
|
-
threshold: number;
|
|
4437
|
-
} | {
|
|
4438
|
-
mode: "atmost";
|
|
4439
|
-
threshold: number;
|
|
4440
|
-
} | {
|
|
4441
|
-
mode: "exactly";
|
|
4442
|
-
threshold: number;
|
|
4443
|
-
};
|
|
4639
|
+
declare function formatQuery<TResult = unknown>(ruleGroup: RuleGroupTypeAny, options: FormatQueryOptions & {
|
|
4640
|
+
ruleGroupProcessor: RuleGroupProcessor<TResult>;
|
|
4641
|
+
}): TResult;
|
|
4444
4642
|
/**
|
|
4445
|
-
*
|
|
4446
|
-
* - `match: { mode: "atLeast", threshold: 1 }` to `match: { mode: "some" }`
|
|
4447
|
-
* - `match: { mode: "atMost", threshold: 0 }` to `match: { mode: "none" }`.
|
|
4643
|
+
* Generates a {@link index!ParameterizedSQL ParameterizedSQL} object from a query object.
|
|
4448
4644
|
*
|
|
4449
|
-
*
|
|
4450
|
-
* - Processed `{ mode, threshold }` object for valid subqueries
|
|
4451
|
-
* - `null` if match mode is not applicable for the rule
|
|
4452
|
-
* - `false` if match mode is valid, but either
|
|
4453
|
-
* 1. `threshold` is required and invalid, or
|
|
4454
|
-
* 2. `value` is not a valid rule group.
|
|
4645
|
+
* @group Export
|
|
4455
4646
|
*/
|
|
4456
|
-
declare
|
|
4647
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "parameterized" | (FormatQueryOptions & {
|
|
4648
|
+
format: "parameterized";
|
|
4649
|
+
})): ParameterizedSQL;
|
|
4457
4650
|
/**
|
|
4458
|
-
*
|
|
4459
|
-
*
|
|
4651
|
+
* Generates a {@link index!ParameterizedNamedSQL ParameterizedNamedSQL} object from a query object.
|
|
4652
|
+
*
|
|
4653
|
+
* @group Export
|
|
4460
4654
|
*/
|
|
4461
|
-
declare
|
|
4655
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "parameterized_named" | (FormatQueryOptions & {
|
|
4656
|
+
format: "parameterized_named";
|
|
4657
|
+
})): ParameterizedNamedSQL;
|
|
4462
4658
|
/**
|
|
4463
|
-
*
|
|
4464
|
-
* non-nested case) uses {@link subqueryElementAliasBase} unchanged; deeper levels are suffixed
|
|
4465
|
-
* with the depth, so a subquery nested within a subquery cannot shadow its parent's binding.
|
|
4466
|
-
*
|
|
4467
|
-
* Deterministic by depth rather than randomized, so output remains stable and snapshot-friendly.
|
|
4659
|
+
* Generates a {@link index!RQBJsonLogic JsonLogic} object from a query object.
|
|
4468
4660
|
*
|
|
4469
4661
|
* @group Export
|
|
4470
4662
|
*/
|
|
4471
|
-
declare
|
|
4663
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "jsonlogic" | (FormatQueryOptions & {
|
|
4664
|
+
format: "jsonlogic";
|
|
4665
|
+
})): RQBJsonLogic;
|
|
4472
4666
|
/**
|
|
4473
|
-
*
|
|
4474
|
-
* objects with a `$bigint` property having a value of a string representation of
|
|
4475
|
-
* the actual `bigint`-type value.
|
|
4667
|
+
* Generates an ElasticSearch query object from an RQB query object.
|
|
4476
4668
|
*
|
|
4477
|
-
*
|
|
4669
|
+
* NOTE: Support for the ElasticSearch format is experimental.
|
|
4670
|
+
* You may have better results exporting "sql" format then using
|
|
4671
|
+
* [ElasticSearch SQL](https://www.elastic.co/guide/en/elasticsearch/reference/current/xpack-sql.html).
|
|
4478
4672
|
*
|
|
4479
|
-
* @
|
|
4673
|
+
* @group Export
|
|
4480
4674
|
*/
|
|
4481
|
-
declare
|
|
4675
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "elasticsearch" | (FormatQueryOptions & {
|
|
4676
|
+
format: "elasticsearch";
|
|
4677
|
+
})): Record<string, any>;
|
|
4482
4678
|
/**
|
|
4483
|
-
*
|
|
4484
|
-
* `$bigint: string` property to an actual `bigint` value.
|
|
4679
|
+
* Generates a MongoDB query object from an RQB query object.
|
|
4485
4680
|
*
|
|
4486
|
-
*
|
|
4681
|
+
* This is equivalent to the "mongodb" format, but returns a JSON object
|
|
4682
|
+
* instead of a string.
|
|
4487
4683
|
*
|
|
4488
|
-
* @
|
|
4684
|
+
* @group Export
|
|
4489
4685
|
*/
|
|
4490
|
-
declare
|
|
4491
|
-
|
|
4492
|
-
|
|
4686
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "mongodb_query" | (FormatQueryOptions & {
|
|
4687
|
+
format: "mongodb_query";
|
|
4688
|
+
})): Record<string, any>;
|
|
4493
4689
|
/**
|
|
4494
|
-
*
|
|
4690
|
+
* Generates a JSON.stringify'd MongoDB query object from an RQB query object.
|
|
4495
4691
|
*
|
|
4496
|
-
*
|
|
4692
|
+
* This is equivalent to the "mongodb_query" format, but returns a string
|
|
4693
|
+
* instead of a JSON object.
|
|
4694
|
+
*
|
|
4695
|
+
* @deprecated Use the "mongodb_query" format for greater flexibility.
|
|
4497
4696
|
*
|
|
4498
4697
|
* @group Export
|
|
4499
4698
|
*/
|
|
4500
|
-
declare
|
|
4699
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "mongodb" | (FormatQueryOptions & {
|
|
4700
|
+
format: "mongodb";
|
|
4701
|
+
})): string;
|
|
4501
4702
|
/**
|
|
4502
|
-
*
|
|
4703
|
+
* Generates a Prisma ORM query object from an RQB query object.
|
|
4503
4704
|
*
|
|
4504
4705
|
* @group Export
|
|
4505
4706
|
*/
|
|
4506
|
-
declare
|
|
4707
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "prisma" | (FormatQueryOptions & {
|
|
4708
|
+
format: "prisma";
|
|
4709
|
+
})): Record<string, any>;
|
|
4507
4710
|
/**
|
|
4508
|
-
*
|
|
4711
|
+
* Generates a Drizzle ORM query function from an RQB query object. The function can
|
|
4712
|
+
* be assigned to the `where` property in the Drizzle relational queries API.
|
|
4509
4713
|
*
|
|
4510
4714
|
* @group Export
|
|
4511
4715
|
*/
|
|
4512
|
-
declare
|
|
4716
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "drizzle" | (FormatQueryOptions & {
|
|
4717
|
+
format: "drizzle";
|
|
4718
|
+
})): ReturnType<typeof defaultRuleGroupProcessorDrizzle>;
|
|
4513
4719
|
/**
|
|
4514
|
-
*
|
|
4720
|
+
* Generates a TanStack DB WhereCallback from an RQB query object. The callback can
|
|
4721
|
+
* be passed directly to TanStack DB's `.where()` method.
|
|
4515
4722
|
*
|
|
4516
4723
|
* @group Export
|
|
4517
4724
|
*/
|
|
4518
|
-
declare
|
|
4725
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "tanstack_db" | (FormatQueryOptions & {
|
|
4726
|
+
format: "tanstack_db";
|
|
4727
|
+
})): ReturnType<typeof defaultRuleGroupProcessorTanStackDB>;
|
|
4519
4728
|
/**
|
|
4520
|
-
*
|
|
4729
|
+
* be assigned to the `where` property in the Sequelize query functions.
|
|
4521
4730
|
*
|
|
4522
4731
|
* @group Export
|
|
4523
4732
|
*/
|
|
4524
|
-
declare
|
|
4733
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "sequelize" | (FormatQueryOptions & {
|
|
4734
|
+
format: "sequelize";
|
|
4735
|
+
})): ReturnType<typeof defaultRuleGroupProcessorSequelize>;
|
|
4525
4736
|
/**
|
|
4526
|
-
*
|
|
4737
|
+
* Generates a JSONata query string from an RQB query object.
|
|
4738
|
+
*
|
|
4739
|
+
* NOTE: Either `parseNumbers: "strict-limited"` or `parseNumbers: true`
|
|
4740
|
+
* are recommended for this format.
|
|
4527
4741
|
*
|
|
4528
4742
|
* @group Export
|
|
4529
4743
|
*/
|
|
4530
|
-
declare
|
|
4744
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "jsonata" | (FormatQueryOptions & {
|
|
4745
|
+
format: "jsonata";
|
|
4746
|
+
})): string;
|
|
4531
4747
|
/**
|
|
4532
|
-
*
|
|
4748
|
+
* Generates an LDAP query string from an RQB query object.
|
|
4533
4749
|
*
|
|
4534
4750
|
* @group Export
|
|
4535
4751
|
*/
|
|
4536
|
-
declare
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
declare const generateAccessibleDescription: AccessibleDescriptionGenerator;
|
|
4540
|
-
//#endregion
|
|
4541
|
-
//#region src/utils/generateID.d.ts
|
|
4542
|
-
type UUID = `${string}-${string}-${string}-${string}-${string}`;
|
|
4543
|
-
declare const uuidV4regex: RegExp;
|
|
4752
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "ldap" | (FormatQueryOptions & {
|
|
4753
|
+
format: "ldap";
|
|
4754
|
+
})): string;
|
|
4544
4755
|
/**
|
|
4545
|
-
*
|
|
4546
|
-
*
|
|
4547
|
-
*
|
|
4548
|
-
*
|
|
4549
|
-
* /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i
|
|
4550
|
-
* ```
|
|
4551
|
-
* @returns Valid v4 UUID
|
|
4756
|
+
* Generates a {@link DiagnosticsResult} from a query object, containing an annotated
|
|
4757
|
+
* query tree, a flat diagnostics array, aggregate stats, and a per-field summary.
|
|
4758
|
+
*
|
|
4759
|
+
* @group Export
|
|
4552
4760
|
*/
|
|
4553
|
-
declare
|
|
4554
|
-
|
|
4555
|
-
|
|
4761
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "diagnostics" | (FormatQueryOptions & {
|
|
4762
|
+
format: "diagnostics";
|
|
4763
|
+
})): DiagnosticsResult;
|
|
4556
4764
|
/**
|
|
4557
|
-
*
|
|
4558
|
-
*
|
|
4559
|
-
*
|
|
4560
|
-
* `FullOption<MatchMode>[]` of all match modes by default.
|
|
4765
|
+
* Generates a formatted (indented two spaces) JSON string from a query object.
|
|
4766
|
+
*
|
|
4767
|
+
* @group Export
|
|
4561
4768
|
*/
|
|
4562
|
-
declare
|
|
4563
|
-
fieldData: F;
|
|
4564
|
-
}) => boolean | MatchMode[] | FlexibleOption<MatchMode>[]) => MatchModeOptions;
|
|
4565
|
-
//#endregion
|
|
4566
|
-
//#region src/utils/getParseNumberMethod.d.ts
|
|
4567
|
-
declare const getParseNumberMethod: ({ parseNumbers, inputType }: {
|
|
4568
|
-
parseNumbers?: ParseNumbersPropConfig;
|
|
4569
|
-
inputType?: InputType | null;
|
|
4570
|
-
}) => ParseNumberMethod;
|
|
4571
|
-
//#endregion
|
|
4572
|
-
//#region src/utils/getRuleDefaultValue.d.ts
|
|
4573
|
-
/** Options for {@link getRuleDefaultValue}. */
|
|
4574
|
-
interface GetRuleDefaultValueOptions<F extends FullField = FullField> {
|
|
4575
|
-
/** Resolved field configuration for `rule.field` (e.g. `fieldMap[rule.field] ?? {}`). */
|
|
4576
|
-
fieldData: F;
|
|
4577
|
-
/** Full field list, used to seed a comparator-valid field when `valueSource` is `'field'`. */
|
|
4578
|
-
fields: FullOptionList<F>;
|
|
4579
|
-
/** Resolves the editor type for the field/operator (drives select/radio/checkbox defaults). */
|
|
4580
|
-
getValueEditorType: (field: string, operator: string, meta: {
|
|
4581
|
-
fieldData: F;
|
|
4582
|
-
}) => ValueEditorType;
|
|
4583
|
-
/** Resolves the value option list for the field/operator. */
|
|
4584
|
-
getValues: (field: string, operator: string, meta: {
|
|
4585
|
-
fieldData: F;
|
|
4586
|
-
}) => FullOptionList<Option>;
|
|
4587
|
-
/** Optional escape hatch overriding the computed default. */
|
|
4588
|
-
getDefaultValue?: (rule: RuleType, meta: {
|
|
4589
|
-
fieldData: F;
|
|
4590
|
-
}) => unknown;
|
|
4591
|
-
/** Named parameter options, used to seed a default when `valueSource` is `'parameter'`. */
|
|
4592
|
-
getParameters?: (field: string, operator: string, meta: {
|
|
4593
|
-
fieldData: F;
|
|
4594
|
-
}) => FullOptionList<Option> | null;
|
|
4595
|
-
/** When `true`, multi-value defaults are arrays instead of comma-joined strings. */
|
|
4596
|
-
listsAsArrays?: boolean;
|
|
4597
|
-
}
|
|
4769
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: FormatQueryOptions): string;
|
|
4598
4770
|
/**
|
|
4599
|
-
*
|
|
4600
|
-
* the precedence the {@link react-querybuilder!QueryBuilder QueryBuilder} applies: a field's
|
|
4601
|
-
* `defaultValue`, then a `getDefaultValue` override, then a value derived from the field/operator's
|
|
4602
|
-
* value list and editor type (first option for `select`/`radio`, `false` for `checkbox`, paired for
|
|
4603
|
-
* `between`/`notBetween`), or a comparator-valid field when `valueSource` is `'field'`. Falls back
|
|
4604
|
-
* to `''`.
|
|
4771
|
+
* Generates a query string in the requested format.
|
|
4605
4772
|
*
|
|
4606
|
-
* @group
|
|
4773
|
+
* @group Export
|
|
4607
4774
|
*/
|
|
4608
|
-
declare
|
|
4609
|
-
//#endregion
|
|
4610
|
-
//#region src/utils/getValidationClassNames.d.ts
|
|
4775
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: Exclude<ExportFormat, ExportObjectFormats>): string;
|
|
4611
4776
|
/**
|
|
4612
|
-
*
|
|
4613
|
-
*
|
|
4777
|
+
* Generates a query string in the requested format.
|
|
4778
|
+
*
|
|
4779
|
+
* @group Export
|
|
4614
4780
|
*/
|
|
4615
|
-
declare
|
|
4781
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: FormatQueryOptions & {
|
|
4782
|
+
format: Exclude<ExportFormat, ExportObjectFormats>;
|
|
4783
|
+
}): string;
|
|
4616
4784
|
//#endregion
|
|
4617
|
-
//#region src/utils/
|
|
4785
|
+
//#region src/utils/formatQuery/utils.d.ts
|
|
4618
4786
|
/**
|
|
4619
|
-
*
|
|
4620
|
-
*
|
|
4621
|
-
*
|
|
4622
|
-
* Returns `[FullOption<"value">]` by default.
|
|
4787
|
+
* Maps a {@link DefaultOperatorName} to a SQL operator.
|
|
4788
|
+
*
|
|
4789
|
+
* @group Export
|
|
4623
4790
|
*/
|
|
4624
|
-
declare const
|
|
4625
|
-
fieldData: F;
|
|
4626
|
-
}) => ValueSources | ValueSourceFlexibleOptions) => ValueSourceFullOptions;
|
|
4627
|
-
//#endregion
|
|
4628
|
-
//#region src/utils/isRuleGroup.d.ts
|
|
4791
|
+
declare const mapSQLOperator: (rqbOperator: string) => string;
|
|
4629
4792
|
/**
|
|
4630
|
-
*
|
|
4793
|
+
* Returns a preset-aware SQL string-concatenation function. Emits `CONCAT(a, b, ...)` when
|
|
4794
|
+
* `concatOperator` is `"CONCAT"` (case-insensitive), otherwise joins with the infix operator
|
|
4795
|
+
* (e.g. `a || b`, `a + b`).
|
|
4796
|
+
*
|
|
4797
|
+
* @group Export
|
|
4631
4798
|
*/
|
|
4632
|
-
declare const
|
|
4799
|
+
declare const getSQLConcat: (concatOperator?: string) => (...values: string[]) => string;
|
|
4633
4800
|
/**
|
|
4634
|
-
*
|
|
4801
|
+
* Returns the `[prefix, suffix]` `LIKE` wildcards for a string-match operator (e.g. `contains`
|
|
4802
|
+
* → `['%', '%']`, `beginsWith` → `['', '%']`, `endsWith` → `['%', '']`). Unknown operators
|
|
4803
|
+
* yield `['', '']`.
|
|
4804
|
+
*
|
|
4805
|
+
* @group Export
|
|
4635
4806
|
*/
|
|
4636
|
-
declare const
|
|
4807
|
+
declare const getLikeWildcards: (operatorLC: string) => [string, string];
|
|
4637
4808
|
/**
|
|
4638
|
-
*
|
|
4809
|
+
* Wraps an already-serialized SQL fragment (a quoted field name or an expression) with the
|
|
4810
|
+
* `LIKE` wildcards for the given (lowercase) string-match operator, concatenating the literal
|
|
4811
|
+
* `%` markers via the preset-aware {@link getSQLConcat}. Returns the fragment untouched for
|
|
4812
|
+
* operators without wildcards.
|
|
4813
|
+
*
|
|
4814
|
+
* @group Export
|
|
4639
4815
|
*/
|
|
4640
|
-
declare const
|
|
4816
|
+
declare const wrapLikeFragment: (fragment: string, operatorLC: string, { concatOperator, quoteValuesWith, wrapValueWith }?: {
|
|
4817
|
+
concatOperator?: string;
|
|
4818
|
+
quoteValuesWith?: string;
|
|
4819
|
+
wrapValueWith?: [string, string];
|
|
4820
|
+
}) => string;
|
|
4641
4821
|
/**
|
|
4642
|
-
*
|
|
4822
|
+
* Maps a (lowercase) {@link DefaultOperatorName} to a MongoDB operator.
|
|
4823
|
+
*
|
|
4824
|
+
* @group Export
|
|
4643
4825
|
*/
|
|
4644
|
-
declare const
|
|
4645
|
-
|
|
4646
|
-
|
|
4826
|
+
declare const mongoOperators: {
|
|
4827
|
+
"=": string;
|
|
4828
|
+
"!=": string;
|
|
4829
|
+
"<": string;
|
|
4830
|
+
"<=": string;
|
|
4831
|
+
">": string;
|
|
4832
|
+
">=": string;
|
|
4833
|
+
in: string;
|
|
4834
|
+
notin: string;
|
|
4835
|
+
notIn: string;
|
|
4836
|
+
};
|
|
4647
4837
|
/**
|
|
4648
|
-
*
|
|
4838
|
+
* Maps a (lowercase) {@link DefaultOperatorName} to a Prisma ORM operator.
|
|
4839
|
+
*
|
|
4840
|
+
* @group Export
|
|
4649
4841
|
*/
|
|
4650
|
-
declare const
|
|
4842
|
+
declare const prismaOperators: {
|
|
4843
|
+
"=": string;
|
|
4844
|
+
"!=": string;
|
|
4845
|
+
"<": string;
|
|
4846
|
+
"<=": string;
|
|
4847
|
+
">": string;
|
|
4848
|
+
">=": string;
|
|
4849
|
+
in: string;
|
|
4850
|
+
notin: string;
|
|
4851
|
+
};
|
|
4651
4852
|
/**
|
|
4652
|
-
*
|
|
4653
|
-
*
|
|
4654
|
-
*
|
|
4853
|
+
* Maps a {@link DefaultCombinatorName} to a CEL combinator.
|
|
4854
|
+
*
|
|
4855
|
+
* @group Export
|
|
4655
4856
|
*/
|
|
4656
|
-
declare const
|
|
4657
|
-
|
|
4658
|
-
|
|
4857
|
+
declare const celCombinatorMap: {
|
|
4858
|
+
and: "&&";
|
|
4859
|
+
or: "||";
|
|
4860
|
+
};
|
|
4659
4861
|
/**
|
|
4660
|
-
*
|
|
4862
|
+
* Register these operators with `jsonLogic` before applying the result
|
|
4863
|
+
* of `formatQuery(query, 'jsonlogic')`.
|
|
4864
|
+
*
|
|
4865
|
+
* @example
|
|
4866
|
+
* ```
|
|
4867
|
+
* for (const [op, func] of Object.entries(jsonLogicAdditionalOperators)) {
|
|
4868
|
+
* jsonLogic.add_operation(op, func);
|
|
4869
|
+
* }
|
|
4870
|
+
* jsonLogic.apply({ "startsWith": [{ "var": "firstName" }, "Stev"] }, data);
|
|
4871
|
+
* ```
|
|
4872
|
+
*
|
|
4873
|
+
* @group Export
|
|
4661
4874
|
*/
|
|
4662
|
-
declare const
|
|
4663
|
-
declare const mergeAnyTranslation: (el: string, keyPropContextMap: Record<string, [unknown, unknown]>, defaults?: Record<string, Record<string, unknown>>) => Record<string, Record<string, unknown>> | undefined;
|
|
4664
|
-
//#endregion
|
|
4665
|
-
//#region src/utils/mergeClassnames.d.ts
|
|
4666
|
-
type MergeClassnamesParams = (Partial<Classnames> | undefined)[];
|
|
4875
|
+
declare const jsonLogicAdditionalOperators: Record<"startsWith" | "endsWith", (a: string, b: string) => boolean>;
|
|
4667
4876
|
/**
|
|
4668
|
-
*
|
|
4877
|
+
* Returns a new query object with all `string`-type `value` properties converted
|
|
4878
|
+
* to `number` where appropriate.
|
|
4879
|
+
*
|
|
4880
|
+
* Used by {@link formatQuery} for the `json*` formats when `parseNumbers` is `true`.
|
|
4881
|
+
*
|
|
4882
|
+
* @group Export
|
|
4669
4883
|
*/
|
|
4670
|
-
declare const
|
|
4671
|
-
//#endregion
|
|
4672
|
-
//#region src/utils/misc.d.ts
|
|
4884
|
+
declare const numerifyValues: (rg: RuleGroupTypeAny, options: SetRequired<FormatQueryOptions, "fields">) => RuleGroupTypeAny;
|
|
4673
4885
|
/**
|
|
4674
|
-
*
|
|
4886
|
+
* Determines whether a value is _anything_ except an empty `string` or `NaN`.
|
|
4887
|
+
*
|
|
4888
|
+
* @group Export
|
|
4675
4889
|
*/
|
|
4676
|
-
declare const
|
|
4890
|
+
declare const isValidValue: (value: unknown) => boolean;
|
|
4677
4891
|
/**
|
|
4678
|
-
*
|
|
4679
|
-
* and
|
|
4892
|
+
* Determines whether {@link formatQuery} should render the given value as a number.
|
|
4893
|
+
* As long as `parseNumbers` is `true`, `number` and `bigint` values will return `true` and
|
|
4894
|
+
* `string` values will return `true` if they test positive against {@link numericRegex}.
|
|
4895
|
+
*
|
|
4896
|
+
* @group Export
|
|
4680
4897
|
*/
|
|
4681
|
-
declare const
|
|
4898
|
+
declare const shouldRenderAsNumber: (value: unknown, parseNumbers?: boolean) => boolean;
|
|
4682
4899
|
/**
|
|
4683
|
-
*
|
|
4900
|
+
* Used by {@link formatQuery} to determine whether the given value processor is a
|
|
4901
|
+
* "legacy" value processor by counting the number of arguments. Legacy value
|
|
4902
|
+
* processors take 3 arguments (not counting any arguments with default values), while
|
|
4903
|
+
* rule-based value processors take no more than 2 arguments.
|
|
4904
|
+
*
|
|
4905
|
+
* @group Export
|
|
4684
4906
|
*/
|
|
4685
|
-
declare const
|
|
4907
|
+
declare const isValueProcessorLegacy: (valueProcessor: ValueProcessorLegacy | ValueProcessorByRule) => valueProcessor is ValueProcessorLegacy;
|
|
4686
4908
|
/**
|
|
4687
|
-
*
|
|
4909
|
+
* Converts the `quoteFieldNamesWith` option into an array of two strings.
|
|
4910
|
+
* If the option is a string, the array elements are both that string.
|
|
4911
|
+
*
|
|
4912
|
+
* @default
|
|
4913
|
+
* ['', '']
|
|
4914
|
+
*
|
|
4915
|
+
* @group Export
|
|
4688
4916
|
*/
|
|
4689
|
-
declare const
|
|
4690
|
-
//#endregion
|
|
4691
|
-
//#region src/utils/objectUtils.d.ts
|
|
4917
|
+
declare const getQuoteFieldNamesWithArray: (quoteFieldNamesWith?: null | string | [string, string]) => [string, string];
|
|
4692
4918
|
/**
|
|
4693
|
-
*
|
|
4694
|
-
*
|
|
4695
|
-
*
|
|
4696
|
-
*
|
|
4919
|
+
* Given a field name and relevant {@link ValueProcessorOptions}, returns the field name
|
|
4920
|
+
* wrapped in the configured quote character(s).
|
|
4921
|
+
*
|
|
4922
|
+
* @group Export
|
|
4697
4923
|
*/
|
|
4698
|
-
|
|
4924
|
+
declare const getQuotedFieldName: (fieldName: string, { quoteFieldNamesWith, fieldIdentifierSeparator }: ValueProcessorOptions) => string;
|
|
4699
4925
|
/**
|
|
4700
|
-
*
|
|
4926
|
+
* Given a [Constituent word order](https://en.wikipedia.org/wiki/Word_order#Constituent_word_orders)
|
|
4927
|
+
* like "svo" or "sov", returns a permutation of `["S", "V", "O"]` based on the first occurrence of
|
|
4928
|
+
* each letter in the input string (case insensitive). This widens the valid input from abbreviations
|
|
4929
|
+
* like "svo" to more expressive strings like "subject-verb-object" or "sub ver obj". Any missing
|
|
4930
|
+
* letters are appended in the default order "SVO" (e.g., "object" would yield `["O", "S", "V"]`).
|
|
4701
4931
|
*
|
|
4702
|
-
*
|
|
4932
|
+
* @group Export
|
|
4703
4933
|
*/
|
|
4704
|
-
declare const
|
|
4934
|
+
declare const normalizeConstituentWordOrder: (input: string) => ConstituentWordOrder;
|
|
4705
4935
|
/**
|
|
4706
|
-
*
|
|
4936
|
+
* Prefixes a named-parameter value with the given `paramPrefix` unless the value already
|
|
4937
|
+
* begins with it. Used by {@link formatQuery} to render rules whose `valueSource` is
|
|
4938
|
+
* `"parameter"` (e.g. `"p1"` with prefix `":"` → `":p1"`; `":p1"` → `":p1"`).
|
|
4707
4939
|
*
|
|
4708
|
-
*
|
|
4940
|
+
* @group Export
|
|
4709
4941
|
*/
|
|
4710
|
-
declare const
|
|
4942
|
+
declare const withParamPrefix: (value: unknown, paramPrefix?: string) => string;
|
|
4711
4943
|
/**
|
|
4712
|
-
*
|
|
4713
|
-
*
|
|
4944
|
+
* Strips a leading `paramPrefix` from a named-parameter value if present. Inverse of
|
|
4945
|
+
* {@link withParamPrefix}; used to normalize parameter names for validation/lookup.
|
|
4946
|
+
*
|
|
4947
|
+
* @group Export
|
|
4714
4948
|
*/
|
|
4715
|
-
declare const
|
|
4716
|
-
//#endregion
|
|
4717
|
-
//#region src/utils/optionResolvers.d.ts
|
|
4949
|
+
declare const stripParamPrefix: (value: unknown, paramPrefix?: string) => string;
|
|
4718
4950
|
/**
|
|
4719
|
-
*
|
|
4951
|
+
* Default translations used by {@link formatQuery} for "natural_language" format.
|
|
4952
|
+
*
|
|
4953
|
+
* @group Export
|
|
4720
4954
|
*/
|
|
4721
|
-
|
|
4722
|
-
/**
|
|
4723
|
-
* Prepended as an empty placeholder option when `autoSelectOption` is `false`. Supplied by the
|
|
4724
|
-
* `translations` prop in React; omit it where translations don't apply.
|
|
4725
|
-
*/
|
|
4726
|
-
placeholder?: Placeholder;
|
|
4727
|
-
/** Properties applied to every option in the resulting list. */
|
|
4728
|
-
baseOption?: Record<string, unknown>;
|
|
4729
|
-
/** When `false`, an empty placeholder option is prepended. */
|
|
4730
|
-
autoSelectOption?: boolean;
|
|
4731
|
-
}
|
|
4955
|
+
declare const defaultNLTranslations: NLTranslations;
|
|
4732
4956
|
/**
|
|
4733
|
-
*
|
|
4734
|
-
*
|
|
4735
|
-
* query-level operator list.
|
|
4957
|
+
* Used by {@link formatQuery} to get a translation based on certain conditions
|
|
4958
|
+
* for the "natural_language" format.
|
|
4736
4959
|
*
|
|
4737
|
-
* @group
|
|
4960
|
+
* @group Export
|
|
4738
4961
|
*/
|
|
4739
|
-
declare const
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
}
|
|
4962
|
+
declare const getNLTranslataion: (key: NLTranslationKey, translations: NLTranslations, conditions?: GroupVariantCondition[]) => string;
|
|
4963
|
+
type ProcessedMatchMode = {
|
|
4964
|
+
mode: "all";
|
|
4965
|
+
threshold?: number | null | undefined;
|
|
4966
|
+
} | {
|
|
4967
|
+
mode: "none";
|
|
4968
|
+
threshold?: number | null | undefined;
|
|
4969
|
+
} | {
|
|
4970
|
+
mode: "some";
|
|
4971
|
+
threshold?: number | null | undefined;
|
|
4972
|
+
} | {
|
|
4973
|
+
mode: "atleast";
|
|
4974
|
+
threshold: number;
|
|
4975
|
+
} | {
|
|
4976
|
+
mode: "atmost";
|
|
4977
|
+
threshold: number;
|
|
4978
|
+
} | {
|
|
4979
|
+
mode: "exactly";
|
|
4980
|
+
threshold: number;
|
|
4981
|
+
};
|
|
4747
4982
|
/**
|
|
4748
|
-
*
|
|
4749
|
-
*
|
|
4750
|
-
*
|
|
4983
|
+
* Transforms
|
|
4984
|
+
* - `match: { mode: "atLeast", threshold: 1 }` to `match: { mode: "some" }`
|
|
4985
|
+
* - `match: { mode: "atMost", threshold: 0 }` to `match: { mode: "none" }`.
|
|
4751
4986
|
*
|
|
4752
|
-
*
|
|
4987
|
+
* Returns:
|
|
4988
|
+
* - Processed `{ mode, threshold }` object for valid subqueries
|
|
4989
|
+
* - `null` if match mode is not applicable for the rule
|
|
4990
|
+
* - `false` if match mode is valid, but either
|
|
4991
|
+
* 1. `threshold` is required and invalid, or
|
|
4992
|
+
* 2. `value` is not a valid rule group.
|
|
4753
4993
|
*/
|
|
4754
|
-
declare const
|
|
4755
|
-
field: string;
|
|
4756
|
-
fieldData: F;
|
|
4757
|
-
getDefaultOperator?: string | ((field: string, misc: {
|
|
4758
|
-
fieldData: F;
|
|
4759
|
-
}) => string);
|
|
4760
|
-
/** Produces the operator list for the field, i.e. {@link resolveOperatorList} already bound. */
|
|
4761
|
-
getOperators: (field: string, misc: {
|
|
4762
|
-
fieldData: F;
|
|
4763
|
-
}) => FullOptionList<FullOperator>;
|
|
4764
|
-
}) => string;
|
|
4994
|
+
declare const processMatchMode: (rule: RuleType) => null | false | ProcessedMatchMode;
|
|
4765
4995
|
/**
|
|
4766
|
-
*
|
|
4767
|
-
* `
|
|
4768
|
-
* operator), then the `getValueEditorType` callback, then `"text"`.
|
|
4769
|
-
*
|
|
4770
|
-
* @group Option Lists
|
|
4996
|
+
* Base alias assigned to the element binding of a subquery generated for a rule's
|
|
4997
|
+
* {@link MatchMode `match` mode} (e.g. `unnest(field) as elem_alias`).
|
|
4771
4998
|
*/
|
|
4772
|
-
declare const
|
|
4773
|
-
field: string;
|
|
4774
|
-
operator: string;
|
|
4775
|
-
fieldData: F;
|
|
4776
|
-
getValueEditorType?: (field: string, operator: string, misc: {
|
|
4777
|
-
fieldData: F;
|
|
4778
|
-
}) => ValueEditorType;
|
|
4779
|
-
}) => ValueEditorType;
|
|
4999
|
+
declare const subqueryElementAliasBase = "elem_alias";
|
|
4780
5000
|
/**
|
|
4781
|
-
*
|
|
4782
|
-
*
|
|
4783
|
-
*
|
|
5001
|
+
* Returns the element alias for a subquery at the given nesting depth. Depth 0 (the common,
|
|
5002
|
+
* non-nested case) uses {@link subqueryElementAliasBase} unchanged; deeper levels are suffixed
|
|
5003
|
+
* with the depth, so a subquery nested within a subquery cannot shadow its parent's binding.
|
|
4784
5004
|
*
|
|
4785
|
-
*
|
|
5005
|
+
* Deterministic by depth rather than randomized, so output remains stable and snapshot-friendly.
|
|
5006
|
+
*
|
|
5007
|
+
* @group Export
|
|
4786
5008
|
*/
|
|
4787
|
-
declare const
|
|
4788
|
-
field: string;
|
|
4789
|
-
operator: string;
|
|
4790
|
-
fieldData: F;
|
|
4791
|
-
getValues?: (field: string, operator: string, misc: {
|
|
4792
|
-
fieldData: F;
|
|
4793
|
-
}) => FlexibleOptionList<Option> | null;
|
|
4794
|
-
} & ResolveOptionListOptions) => FullOptionList<Option>;
|
|
4795
|
-
//#endregion
|
|
4796
|
-
//#region src/utils/optGroupUtils.d.ts
|
|
5009
|
+
declare const getSubqueryElementAlias: (subqueryDepth?: number) => string;
|
|
4797
5010
|
/**
|
|
4798
|
-
*
|
|
4799
|
-
*
|
|
5011
|
+
* "Replacer" method for JSON.stringify's second argument. Converts `bigint` values to
|
|
5012
|
+
* objects with a `$bigint` property having a value of a string representation of
|
|
5013
|
+
* the actual `bigint`-type value.
|
|
4800
5014
|
*
|
|
4801
|
-
* @
|
|
5015
|
+
* Inverse of {@link bigIntJsonParseReviver}.
|
|
5016
|
+
*
|
|
5017
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#use_within_json
|
|
4802
5018
|
*/
|
|
4803
|
-
declare
|
|
5019
|
+
declare const bigIntJsonStringifyReplacer: (_key: string, value: unknown) => unknown;
|
|
4804
5020
|
/**
|
|
4805
|
-
*
|
|
4806
|
-
*
|
|
5021
|
+
* "Reviver" method for JSON.parse's second argument. Converts objects having a single
|
|
5022
|
+
* `$bigint: string` property to an actual `bigint` value.
|
|
4807
5023
|
*
|
|
4808
|
-
* @
|
|
5024
|
+
* Inverse of {@link bigIntJsonStringifyReplacer}.
|
|
5025
|
+
*
|
|
5026
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#use_within_json
|
|
4809
5027
|
*/
|
|
4810
|
-
declare
|
|
5028
|
+
declare const bigIntJsonParseReviver: (_key: string, value: unknown) => unknown;
|
|
5029
|
+
//#endregion
|
|
5030
|
+
//#region src/utils/formatQuery/index.d.ts
|
|
4811
5031
|
/**
|
|
4812
|
-
*
|
|
4813
|
-
* Lists of full options are left unchanged.
|
|
5032
|
+
* Default value processor used by {@link formatQuery} for "sql" format.
|
|
4814
5033
|
*
|
|
4815
|
-
* @
|
|
5034
|
+
* @deprecated Prefer {@link defaultValueProcessorByRule}.
|
|
5035
|
+
*
|
|
5036
|
+
* @group Export
|
|
4816
5037
|
*/
|
|
4817
|
-
declare
|
|
5038
|
+
declare const defaultValueProcessor: ValueProcessorLegacy;
|
|
4818
5039
|
/**
|
|
4819
|
-
* @deprecated
|
|
5040
|
+
* @deprecated Prefer {@link defaultRuleProcessorMongoDB}.
|
|
4820
5041
|
*
|
|
4821
|
-
* @group
|
|
5042
|
+
* @group Export
|
|
4822
5043
|
*/
|
|
4823
|
-
declare const
|
|
4824
|
-
name: string;
|
|
4825
|
-
value?: string;
|
|
4826
|
-
} | {
|
|
4827
|
-
name?: string;
|
|
4828
|
-
value: string;
|
|
4829
|
-
}>(originalArray: T[]) => T[];
|
|
5044
|
+
declare const defaultMongoDBValueProcessor: ValueProcessorLegacy;
|
|
4830
5045
|
/**
|
|
4831
|
-
*
|
|
4832
|
-
* on the identifying property (`value` or `name`)
|
|
5046
|
+
* @deprecated Prefer {@link defaultRuleProcessorCEL}.
|
|
4833
5047
|
*
|
|
4834
|
-
* @group
|
|
5048
|
+
* @group Export
|
|
4835
5049
|
*/
|
|
4836
|
-
declare const
|
|
4837
|
-
name: string;
|
|
4838
|
-
value: string;
|
|
4839
|
-
}, "name" | "value">>(originalArray: T[]) => T[];
|
|
5050
|
+
declare const defaultCELValueProcessor: ValueProcessorLegacy;
|
|
4840
5051
|
/**
|
|
4841
|
-
*
|
|
5052
|
+
* @deprecated Prefer {@link defaultRuleProcessorSpEL}.
|
|
4842
5053
|
*
|
|
4843
|
-
* @group
|
|
5054
|
+
* @group Export
|
|
4844
5055
|
*/
|
|
4845
|
-
declare const
|
|
5056
|
+
declare const defaultSpELValueProcessor: ValueProcessorLegacy;
|
|
4846
5057
|
/**
|
|
4847
|
-
*
|
|
5058
|
+
* @deprecated Renamed to {@link defaultRuleProcessorCEL}.
|
|
4848
5059
|
*
|
|
4849
|
-
* @group
|
|
5060
|
+
* @group Export
|
|
4850
5061
|
*/
|
|
4851
|
-
declare const
|
|
5062
|
+
declare const defaultValueProcessorCELByRule: RuleProcessor;
|
|
4852
5063
|
/**
|
|
4853
|
-
*
|
|
5064
|
+
* @deprecated Renamed to {@link defaultRuleProcessorMongoDB}.
|
|
4854
5065
|
*
|
|
4855
|
-
* @group
|
|
5066
|
+
* @group Export
|
|
4856
5067
|
*/
|
|
4857
|
-
declare const
|
|
5068
|
+
declare const defaultValueProcessorMongoDBByRule: RuleProcessor;
|
|
4858
5069
|
/**
|
|
4859
|
-
*
|
|
5070
|
+
* @deprecated Renamed to {@link defaultRuleProcessorSpEL}.
|
|
4860
5071
|
*
|
|
4861
|
-
* @group
|
|
5072
|
+
* @group Export
|
|
4862
5073
|
*/
|
|
4863
|
-
declare const
|
|
4864
|
-
|
|
4865
|
-
|
|
5074
|
+
declare const defaultValueProcessorSpELByRule: RuleProcessor;
|
|
5075
|
+
//#endregion
|
|
5076
|
+
//#region src/utils/generateAccessibleDescription.d.ts
|
|
4866
5077
|
/**
|
|
4867
|
-
*
|
|
5078
|
+
* The default `accessibleDescriptionGenerator`. Produces the `aria-label` for a rule group:
|
|
5079
|
+
* `"Query builder"` for the root group, `"Rule group at path 0-1"` for any other.
|
|
4868
5080
|
*
|
|
4869
|
-
* @group
|
|
5081
|
+
* @group Accessibility
|
|
4870
5082
|
*/
|
|
4871
|
-
declare const
|
|
4872
|
-
|
|
4873
|
-
|
|
5083
|
+
declare const generateAccessibleDescription: AccessibleDescriptionGenerator;
|
|
5084
|
+
//#endregion
|
|
5085
|
+
//#region src/utils/generateID.d.ts
|
|
5086
|
+
type UUID = `${string}-${string}-${string}-${string}-${string}`;
|
|
5087
|
+
declare const uuidV4regex: RegExp;
|
|
4874
5088
|
/**
|
|
4875
|
-
*
|
|
4876
|
-
*
|
|
4877
|
-
*
|
|
4878
|
-
*
|
|
5089
|
+
* Default `id` generator. Generates a valid v4 UUID. Uses `crypto.randomUUID()`
|
|
5090
|
+
* when available, otherwise uses an alternate method based on `getRandomValues`.
|
|
5091
|
+
* The returned string is guaranteed to match this regex:
|
|
5092
|
+
* ```
|
|
5093
|
+
* /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i
|
|
5094
|
+
* ```
|
|
5095
|
+
* @returns Valid v4 UUID
|
|
4879
5096
|
*/
|
|
4880
|
-
declare
|
|
4881
|
-
|
|
4882
|
-
|
|
5097
|
+
declare let generateID: () => UUID;
|
|
5098
|
+
//#endregion
|
|
5099
|
+
//#region src/utils/immerInstances.d.ts
|
|
4883
5100
|
/**
|
|
4884
|
-
*
|
|
5101
|
+
* Globally enables or disables immer's auto-freeze, i.e. the deep freeze applied to every query
|
|
5102
|
+
* returned by {@link add}, {@link update}, {@link remove}, {@link move}, {@link insert}, and
|
|
5103
|
+
* {@link group}.
|
|
4885
5104
|
*
|
|
4886
|
-
*
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
/**
|
|
4892
|
-
* Flattens {@link FlexibleOptionGroup} arrays into {@link BaseOption} arrays.
|
|
4893
|
-
* If the array is already flat, it is returned as is.
|
|
5105
|
+
* Re-exported from immer so that consumers mixing these tools with their own `produce` calls can
|
|
5106
|
+
* switch both at once. Prefer the per-call `freeze` option, or the {@link QueryManager} option of
|
|
5107
|
+
* the same name, when the change should not be process-wide. A per-call `freeze: false` wins
|
|
5108
|
+
* regardless of this setting; a per-call `freeze: true` does not re-enable freezing once this has
|
|
5109
|
+
* turned it off, since it selects immer's default instance.
|
|
4894
5110
|
*
|
|
4895
|
-
* @group
|
|
5111
|
+
* @group Query Tools
|
|
4896
5112
|
*/
|
|
4897
|
-
declare const
|
|
5113
|
+
declare const setAutoFreeze: (autoFreeze: boolean) => void;
|
|
5114
|
+
//#endregion
|
|
5115
|
+
//#region src/utils/getMatchModesUtil.d.ts
|
|
4898
5116
|
/**
|
|
4899
|
-
*
|
|
4900
|
-
*
|
|
4901
|
-
*
|
|
4902
|
-
*
|
|
5117
|
+
* Utility function to get the match modes array for the given
|
|
5118
|
+
* field. If the field definition does not define a `matchModes`
|
|
5119
|
+
* property, the `getMatchModes` prop is used. Returns
|
|
5120
|
+
* `FullOption<MatchMode>[]` of all match modes by default.
|
|
4903
5121
|
*/
|
|
4904
|
-
declare const
|
|
5122
|
+
declare const getMatchModesUtil: <F extends FullField>(fieldData: F, getMatchModes?: (field: GetOptionIdentifierType<F>, misc: {
|
|
5123
|
+
fieldData: F;
|
|
5124
|
+
}) => boolean | MatchMode[] | FlexibleOption<MatchMode>[]) => MatchModeOptions;
|
|
5125
|
+
//#endregion
|
|
5126
|
+
//#region src/utils/getParseNumberMethod.d.ts
|
|
5127
|
+
declare const getParseNumberMethod: ({ parseNumbers, inputType }: {
|
|
5128
|
+
parseNumbers?: ParseNumbersPropConfig;
|
|
5129
|
+
inputType?: InputType | null;
|
|
5130
|
+
}) => ParseNumberMethod;
|
|
5131
|
+
//#endregion
|
|
5132
|
+
//#region src/utils/getRuleDefaultValue.d.ts
|
|
5133
|
+
/** Options for {@link getRuleDefaultValue}. */
|
|
5134
|
+
interface GetRuleDefaultValueOptions<F extends FullField = FullField> {
|
|
5135
|
+
/** Resolved field configuration for `rule.field` (e.g. `fieldMap[rule.field] ?? {}`). */
|
|
5136
|
+
fieldData: F;
|
|
5137
|
+
/** Full field list, used to seed a comparator-valid field when `valueSource` is `'field'`. */
|
|
5138
|
+
fields: FullOptionList<F>;
|
|
5139
|
+
/** Resolves the editor type for the field/operator (drives select/radio/checkbox defaults). */
|
|
5140
|
+
getValueEditorType: (field: string, operator: string, meta: {
|
|
5141
|
+
fieldData: F;
|
|
5142
|
+
}) => ValueEditorType;
|
|
5143
|
+
/** Resolves the value option list for the field/operator. */
|
|
5144
|
+
getValues: (field: string, operator: string, meta: {
|
|
5145
|
+
fieldData: F;
|
|
5146
|
+
}) => FullOptionList<Option>;
|
|
5147
|
+
/** Optional escape hatch overriding the computed default. */
|
|
5148
|
+
getDefaultValue?: (rule: RuleType, meta: {
|
|
5149
|
+
fieldData: F;
|
|
5150
|
+
}) => unknown;
|
|
5151
|
+
/** Named parameter options, used to seed a default when `valueSource` is `'parameter'`. */
|
|
5152
|
+
getParameters?: (field: string, operator: string, meta: {
|
|
5153
|
+
fieldData: F;
|
|
5154
|
+
}) => FullOptionList<Option> | null;
|
|
5155
|
+
/** When `true`, multi-value defaults are arrays instead of comma-joined strings. */
|
|
5156
|
+
listsAsArrays?: boolean;
|
|
5157
|
+
}
|
|
4905
5158
|
/**
|
|
4906
|
-
*
|
|
4907
|
-
*
|
|
5159
|
+
* Computes the default `value` for a rule given its `field`/`operator`/`valueSource`, mirroring
|
|
5160
|
+
* the precedence the {@link react-querybuilder!QueryBuilder QueryBuilder} applies: a field's
|
|
5161
|
+
* `defaultValue`, then a `getDefaultValue` override, then a value derived from the field/operator's
|
|
5162
|
+
* value list and editor type (first option for `select`/`radio`, `false` for `checkbox`, paired for
|
|
5163
|
+
* `between`/`notBetween`), or a comparator-valid field when `valueSource` is `'field'`. Falls back
|
|
5164
|
+
* to `''`.
|
|
4908
5165
|
*
|
|
4909
5166
|
* @group Option Lists
|
|
4910
5167
|
*/
|
|
4911
|
-
declare const
|
|
4912
|
-
interface PreparedOptionList<O extends FullOption> {
|
|
4913
|
-
defaultOption: FullOption;
|
|
4914
|
-
optionList: FullOptionList<O>;
|
|
4915
|
-
optionsMap: Partial<FullOptionRecord<FullOption>>;
|
|
4916
|
-
}
|
|
4917
|
-
interface PrepareOptionListParams<O extends FullOption> {
|
|
4918
|
-
placeholder?: Placeholder;
|
|
4919
|
-
optionList?: FlexibleOptionListProp<O> | BaseOptionMap<O>;
|
|
4920
|
-
baseOption?: Record<string, unknown>;
|
|
4921
|
-
labelMap?: Record<string, string>;
|
|
4922
|
-
autoSelectOption?: boolean;
|
|
4923
|
-
}
|
|
4924
|
-
declare const prepareOptionList: <O extends FullOption>(props: PrepareOptionListParams<O>) => PreparedOptionList<O>;
|
|
5168
|
+
declare const getRuleDefaultValue$1: <F extends FullField = FullField>(rule: RuleType, options: GetRuleDefaultValueOptions<F>) => unknown;
|
|
4925
5169
|
//#endregion
|
|
4926
|
-
//#region src/utils/
|
|
5170
|
+
//#region src/utils/getValidationClassNames.d.ts
|
|
4927
5171
|
/**
|
|
4928
|
-
*
|
|
5172
|
+
* Gets the standard classname for valid or invalid components
|
|
5173
|
+
* based on the given validation result.
|
|
4929
5174
|
*/
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
* Generates a `bigint` value if the string represents a valid integer
|
|
4934
|
-
* outside the safe boundaries of the `number` type.
|
|
4935
|
-
*/
|
|
4936
|
-
bigIntOnOverflow?: boolean;
|
|
4937
|
-
}
|
|
5175
|
+
declare const getValidationClassNames: (validationResult: boolean | ValidationResult) => "" | (typeof standardClassnames)["valid"] | (typeof standardClassnames)["invalid"];
|
|
5176
|
+
//#endregion
|
|
5177
|
+
//#region src/utils/getValueSourcesUtil.d.ts
|
|
4938
5178
|
/**
|
|
4939
|
-
*
|
|
4940
|
-
*
|
|
4941
|
-
*
|
|
4942
|
-
*
|
|
5179
|
+
* Utility function to get the value sources array for the given
|
|
5180
|
+
* field and operator. If the field definition does not define a
|
|
5181
|
+
* `valueSources` property, the `getValueSources` prop is used.
|
|
5182
|
+
* Returns `[FullOption<"value">]` by default.
|
|
4943
5183
|
*/
|
|
4944
|
-
declare const
|
|
5184
|
+
declare const getValueSourcesUtil: <F extends FullField, O extends string>(fieldData: F, operator: string, getValueSources?: (field: GetOptionIdentifierType<F>, operator: O, misc: {
|
|
5185
|
+
fieldData: F;
|
|
5186
|
+
}) => ValueSources | ValueSourceFlexibleOptions) => ValueSourceFullOptions;
|
|
4945
5187
|
//#endregion
|
|
4946
|
-
//#region src/utils/
|
|
5188
|
+
//#region src/utils/isRuleGroup.d.ts
|
|
4947
5189
|
/**
|
|
4948
|
-
*
|
|
5190
|
+
* Determines if an object is a {@link RuleType} (only checks for a `field` property).
|
|
4949
5191
|
*/
|
|
4950
|
-
|
|
5192
|
+
declare const isRuleType: (s: unknown) => s is RuleType;
|
|
4951
5193
|
/**
|
|
4952
|
-
*
|
|
4953
|
-
* at the given path within a query.
|
|
5194
|
+
* Determines if an object is a {@link RuleGroupType} or {@link RuleGroupTypeIC}.
|
|
4954
5195
|
*/
|
|
4955
|
-
declare const
|
|
5196
|
+
declare const isRuleGroup: (rg: unknown) => rg is RuleGroupTypeAny;
|
|
4956
5197
|
/**
|
|
4957
|
-
*
|
|
4958
|
-
* with the given `id` within a query.
|
|
5198
|
+
* Determines if an object is a {@link RuleGroupType}.
|
|
4959
5199
|
*/
|
|
4960
|
-
declare const
|
|
5200
|
+
declare const isRuleGroupType: (rg: unknown) => rg is RuleGroupType;
|
|
4961
5201
|
/**
|
|
4962
|
-
*
|
|
4963
|
-
* with the given `id` within a query.
|
|
5202
|
+
* Determines if an object is a {@link RuleGroupTypeIC}.
|
|
4964
5203
|
*/
|
|
4965
|
-
declare const
|
|
5204
|
+
declare const isRuleGroupTypeIC: (rg: unknown) => rg is RuleGroupTypeIC;
|
|
5205
|
+
//#endregion
|
|
5206
|
+
//#region src/utils/isRuleOrGroupValid.d.ts
|
|
4966
5207
|
/**
|
|
4967
|
-
*
|
|
5208
|
+
* Determines if an object is useful as a validation result.
|
|
4968
5209
|
*/
|
|
4969
|
-
declare const
|
|
5210
|
+
declare const isValidationResult: (vr?: ValidationResult) => vr is ValidationResult;
|
|
4970
5211
|
/**
|
|
4971
|
-
* Determines if
|
|
5212
|
+
* Determines if a rule or group is valid based on a validation result (if defined)
|
|
5213
|
+
* or a validator function. Returns `true` if neither are defined and the `muted`
|
|
5214
|
+
* property is not `true`.
|
|
4972
5215
|
*/
|
|
4973
|
-
declare const
|
|
5216
|
+
declare const isRuleOrGroupValid: (rg: RuleType | RuleGroupTypeAny, validationResult?: boolean | ValidationResult, validator?: RuleValidator) => boolean;
|
|
5217
|
+
//#endregion
|
|
5218
|
+
//#region src/utils/mergeAnyTranslations.d.ts
|
|
4974
5219
|
/**
|
|
4975
|
-
*
|
|
4976
|
-
* be shorter and exactly match the second path up through the length of the first path.
|
|
5220
|
+
* Merges any number of partial translations into a single definition.
|
|
4977
5221
|
*/
|
|
4978
|
-
declare const
|
|
5222
|
+
declare const mergeAnyTranslations: (base: Record<string, Record<string, unknown>>, ...otherTranslations: (Record<string, Record<string, unknown>> | undefined)[]) => Record<string, Record<string, unknown>>;
|
|
5223
|
+
declare const mergeAnyTranslation: (el: string, keyPropContextMap: Record<string, [unknown, unknown]>, defaults?: Record<string, Record<string, unknown>>) => Record<string, Record<string, unknown>> | undefined;
|
|
5224
|
+
//#endregion
|
|
5225
|
+
//#region src/utils/mergeClassnames.d.ts
|
|
5226
|
+
type MergeClassnamesParams = (Partial<Classnames> | undefined)[];
|
|
4979
5227
|
/**
|
|
4980
|
-
*
|
|
5228
|
+
* Merges a list of partial {@link Classnames} definitions into a single definition.
|
|
4981
5229
|
*/
|
|
4982
|
-
declare const
|
|
5230
|
+
declare const mergeClassnames: (...args: MergeClassnamesParams) => Classnames;
|
|
5231
|
+
//#endregion
|
|
5232
|
+
//#region src/utils/misc.d.ts
|
|
4983
5233
|
/**
|
|
4984
|
-
*
|
|
4985
|
-
* or disabled by an ancestor group.
|
|
5234
|
+
* Converts a value to lowercase if it's a string, otherwise returns the value as is.
|
|
4986
5235
|
*/
|
|
4987
|
-
declare const
|
|
5236
|
+
declare const lc: <T>(v: T) => T;
|
|
4988
5237
|
/**
|
|
4989
|
-
*
|
|
4990
|
-
*
|
|
4991
|
-
* `disabled` property on the node itself. A path is disabled if it appears in `disabledPaths` or
|
|
4992
|
-
* descends from a path that does.
|
|
4993
|
-
*
|
|
4994
|
-
* @group Paths
|
|
5238
|
+
* Regex matching numeric strings. Passes for positive/negative integers, decimals,
|
|
5239
|
+
* and E notation, with optional surrounding whitespace.
|
|
4995
5240
|
*/
|
|
4996
|
-
declare const
|
|
4997
|
-
/** The path of a child rule or group, and whether it is disabled. */ interface PathInfo {
|
|
4998
|
-
path: Path;
|
|
4999
|
-
disabled: boolean;
|
|
5000
|
-
}
|
|
5241
|
+
declare const numericRegex: RegExp;
|
|
5001
5242
|
/**
|
|
5002
|
-
*
|
|
5003
|
-
* parent is disabled or if its own path appears in `disabledPaths`.
|
|
5004
|
-
*
|
|
5005
|
-
* @group Paths
|
|
5243
|
+
* Determines if a variable is a plain old JavaScript object, aka POJO.
|
|
5006
5244
|
*/
|
|
5007
|
-
declare const
|
|
5008
|
-
disabled?: boolean;
|
|
5009
|
-
disabledPaths?: Path[];
|
|
5010
|
-
}) => PathInfo[];
|
|
5011
|
-
//#endregion
|
|
5012
|
-
//#region src/utils/preferProp.d.ts
|
|
5245
|
+
declare const isPojo: (obj: unknown) => obj is Record<string, any>;
|
|
5013
5246
|
/**
|
|
5014
|
-
*
|
|
5015
|
-
* context, and default, in that order.
|
|
5247
|
+
* Simple helper to determine whether a value is null, undefined, or an empty string.
|
|
5016
5248
|
*/
|
|
5017
|
-
declare const
|
|
5249
|
+
declare const nullOrUndefinedOrEmpty: (value: unknown) => value is null | undefined | "";
|
|
5250
|
+
//#endregion
|
|
5251
|
+
//#region src/utils/objectUtils.d.ts
|
|
5018
5252
|
/**
|
|
5019
|
-
*
|
|
5020
|
-
*
|
|
5253
|
+
* Original looked like this (not sure why template string is used):
|
|
5254
|
+
* ```
|
|
5255
|
+
* type ObjectKeys<T extends object> = `${Exclude<keyof T, symbol>}`;
|
|
5256
|
+
* ```
|
|
5021
5257
|
*/
|
|
5022
|
-
|
|
5258
|
+
type ObjectKeys<T extends object> = Exclude<keyof T, symbol>;
|
|
5023
5259
|
/**
|
|
5024
|
-
*
|
|
5025
|
-
*
|
|
5260
|
+
* A strongly-typed version of `Object.keys()`.
|
|
5261
|
+
*
|
|
5262
|
+
* [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-keys.ts)
|
|
5026
5263
|
*/
|
|
5027
|
-
declare const
|
|
5028
|
-
//#endregion
|
|
5029
|
-
//#region src/utils/prepareQueryObjects.d.ts
|
|
5264
|
+
declare const objectKeys: <Type extends object>(value: Type) => Array<ObjectKeys<Type>>;
|
|
5030
5265
|
/**
|
|
5031
|
-
*
|
|
5266
|
+
* A strongly-typed version of `Object.entries()`.
|
|
5267
|
+
*
|
|
5268
|
+
* [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-entries.ts)
|
|
5032
5269
|
*/
|
|
5033
|
-
|
|
5034
|
-
idGenerator?: () => string;
|
|
5035
|
-
}
|
|
5270
|
+
declare const objectEntries: <Type extends Record<PropertyKey, unknown>>(value: Type) => Array<[ObjectKeys<Type>, Type[ObjectKeys<Type>]]>;
|
|
5036
5271
|
/**
|
|
5037
|
-
*
|
|
5272
|
+
* Returns `true` if the key could cause prototype pollution when used
|
|
5273
|
+
* as a property name in bracket-notation assignment.
|
|
5038
5274
|
*/
|
|
5039
|
-
declare const
|
|
5275
|
+
declare const isUnsafeKey: (key: unknown) => boolean;
|
|
5276
|
+
//#endregion
|
|
5277
|
+
//#region src/utils/optionResolvers.d.ts
|
|
5040
5278
|
/**
|
|
5041
|
-
*
|
|
5042
|
-
* and all its rules and subgroups where one does not already exist.
|
|
5043
|
-
*/
|
|
5044
|
-
declare const prepareRuleGroup: <RG extends RuleGroupTypeAny>(queryObject: RG, { idGenerator }?: PreparerOptions) => RG;
|
|
5045
|
-
/**
|
|
5046
|
-
* Ensures that a rule or group is valid. See {@link prepareRule} and {@link prepareRuleGroup}.
|
|
5047
|
-
*/
|
|
5048
|
-
declare const prepareRuleOrGroup: (rg: RuleGroupTypeAny | RuleType, { idGenerator }?: PreparerOptions) => RuleGroupType | RuleGroupTypeIC | RuleType;
|
|
5049
|
-
/**
|
|
5050
|
-
* Resolves the query a query builder should render from the available sources, in precedence
|
|
5051
|
-
* order: the controlled `query`, then whatever is already in the store, then the uncontrolled
|
|
5052
|
-
* `defaultQuery`, then a freshly created empty group.
|
|
5053
|
-
*
|
|
5054
|
-
* The result is prepared with {@link prepareRuleGroup} unless it already has an `id`, which is
|
|
5055
|
-
* taken to mean it has been prepared before—most often because the caller is passing back the
|
|
5056
|
-
* object it received from `onQueryChange`.
|
|
5057
|
-
*
|
|
5058
|
-
* @group Query Tools
|
|
5059
|
-
*/
|
|
5060
|
-
declare const resolveCandidateQuery: <RG extends RuleGroupTypeAny>(sources: {
|
|
5061
|
-
query?: RG;
|
|
5062
|
-
storeQuery?: RG;
|
|
5063
|
-
defaultQuery?: RG;
|
|
5064
|
-
fallbackQuery: RG;
|
|
5065
|
-
}, options?: {
|
|
5066
|
-
idGenerator?: () => string;
|
|
5067
|
-
}) => RG;
|
|
5068
|
-
//#endregion
|
|
5069
|
-
//#region src/utils/queryActions.d.ts
|
|
5070
|
-
/**
|
|
5071
|
-
* Confirmation callbacks invoked before a mutation is applied. Their return values are
|
|
5072
|
-
* interpreted differently depending on the operation:
|
|
5073
|
-
*
|
|
5074
|
-
* - `onAddRule`/`onAddGroup` may return `true` to proceed, a falsy value to cancel, or a
|
|
5075
|
-
* _replacement rule/group_ to add instead of the one provided.
|
|
5076
|
-
* - `onMoveRule`/`onMoveGroup`/`onGroupRule`/`onGroupGroup` may return `true` to proceed, a
|
|
5077
|
-
* falsy value to cancel, or a _replacement query_ to apply instead of the computed one.
|
|
5078
|
-
* - `onRemove` is boolean only.
|
|
5079
|
-
*
|
|
5080
|
-
* @group Query Tools
|
|
5081
|
-
*/
|
|
5082
|
-
interface QueryActionCallbacks {
|
|
5083
|
-
onAddRule?: (rule: RuleType, parentPath: Path, query: any, context?: any) => RuleType | boolean;
|
|
5084
|
-
onAddGroup?: (ruleGroup: any, parentPath: Path, query: any, context?: any) => RuleGroupTypeAny | boolean;
|
|
5085
|
-
onRemove?: (ruleOrGroup: any, path: Path, query: any, context?: any) => boolean;
|
|
5086
|
-
onMoveRule?: (...args: any[]) => RuleGroupTypeAny | boolean;
|
|
5087
|
-
onMoveGroup?: (...args: any[]) => RuleGroupTypeAny | boolean;
|
|
5088
|
-
onGroupRule?: (...args: any[]) => RuleGroupTypeAny | boolean;
|
|
5089
|
-
onGroupGroup?: (...args: any[]) => RuleGroupTypeAny | boolean;
|
|
5090
|
-
}
|
|
5091
|
-
/**
|
|
5092
|
-
* Configuration for {@link createQueryActions}.
|
|
5093
|
-
*
|
|
5094
|
-
* @group Query Tools
|
|
5095
|
-
*/
|
|
5096
|
-
interface QueryActionsConfig extends QueryActionCallbacks {
|
|
5097
|
-
/** Identifier included in every log payload. */
|
|
5098
|
-
qbId?: string;
|
|
5099
|
-
combinators?: OptionList;
|
|
5100
|
-
idGenerator?: () => string;
|
|
5101
|
-
/** The maximum depth at which groups may be added. Defaults to `Infinity`. */
|
|
5102
|
-
maxLevels?: number;
|
|
5103
|
-
/** Abort every mutation, as though the entire query were disabled. */
|
|
5104
|
-
queryDisabled?: boolean;
|
|
5105
|
-
/**
|
|
5106
|
-
* Honor `disabled` properties within the query. Defaults to `true`, matching the
|
|
5107
|
-
* `QueryBuilder` component; a node's own `disabled` property can always be changed.
|
|
5108
|
-
*/
|
|
5109
|
-
respectDisabled?: boolean;
|
|
5110
|
-
/**
|
|
5111
|
-
* Paths disabled by position rather than by a `disabled` property on the node itself, mirroring
|
|
5112
|
-
* the array form of the `QueryBuilder` `disabled` prop. Honored only when `respectDisabled` is
|
|
5113
|
-
* `true`; as with the `disabled` property, a node's own `disabled` can always be changed.
|
|
5114
|
-
*/
|
|
5115
|
-
disabledPaths?: Path[];
|
|
5116
|
-
resetOnFieldChange?: boolean;
|
|
5117
|
-
resetOnOperatorChange?: boolean;
|
|
5118
|
-
getRuleDefaultOperator?: (field: string) => string;
|
|
5119
|
-
getValueSources?: (field: string, operator: string) => ValueSourceFullOptions;
|
|
5120
|
-
getRuleDefaultValue?: (rule: RuleType) => any;
|
|
5121
|
-
getMatchModes?: (field: string) => MatchModeOptions;
|
|
5122
|
-
/** Receives a structured event for every action, applied or aborted. */
|
|
5123
|
-
onLog?: (payload: Record<string, any>) => void;
|
|
5124
|
-
}
|
|
5125
|
-
/**
|
|
5126
|
-
* The six mutations a query builder performs. Each takes the current query and returns the next
|
|
5127
|
-
* one, or `undefined` when the mutation was aborted—because the target is disabled, a
|
|
5128
|
-
* confirmation callback declined, or a depth limit was reached.
|
|
5129
|
-
*
|
|
5130
|
-
* @group Query Tools
|
|
5131
|
-
*/
|
|
5132
|
-
interface QueryActionHandlers {
|
|
5133
|
-
addRule: (query: any, rule: RuleType, parentPath: Path, context?: any) => any;
|
|
5134
|
-
addGroup: (query: any, ruleGroup: any, parentPath: Path, context?: any) => any;
|
|
5135
|
-
propChange: (query: any, prop: UpdateableProperties, value: any, path: Path) => any;
|
|
5136
|
-
removeRuleOrGroup: (query: any, path: Path, context?: any) => any;
|
|
5137
|
-
moveRule: (query: any, oldPath: Path, newPath: Path | "up" | "down", clone?: boolean, context?: any) => any;
|
|
5138
|
-
groupRule: (query: any, sourcePath: Path, targetPath: Path, clone?: boolean, context?: any) => any;
|
|
5139
|
-
}
|
|
5140
|
-
/**
|
|
5141
|
-
* Builds the query builder's six mutation handlers as pure functions of the current query.
|
|
5142
|
-
*
|
|
5143
|
-
* This is the framework-agnostic core of the action handlers in `useQueryBuilderSchema`. It owns
|
|
5144
|
-
* the policy that surrounds the query tools—disabled gating, the confirmation callback protocol,
|
|
5145
|
-
* `maxLevels`, and debug logging—so an implementation only has to supply its own storage: read
|
|
5146
|
-
* the current query, call the action, and apply a non-`undefined` result.
|
|
5147
|
-
*
|
|
5148
|
-
* @group Query Tools
|
|
5149
|
-
*/
|
|
5150
|
-
declare const createQueryActions: (config?: QueryActionsConfig) => QueryActionHandlers;
|
|
5151
|
-
//#endregion
|
|
5152
|
-
//#region src/utils/queryTools.d.ts
|
|
5153
|
-
/**
|
|
5154
|
-
* Why a query tool returned the query unmodified. Query tools never throw; when they cannot
|
|
5155
|
-
* carry out an operation they return the original query and report the reason through
|
|
5156
|
-
* {@link AbortOptions.onAbort}.
|
|
5157
|
-
*
|
|
5158
|
-
* `"same-location"` and `"no-change"` describe operations that were valid but had nothing to
|
|
5159
|
-
* do, so they are not errors. Every other reason indicates a target that could not be used.
|
|
5160
|
-
*
|
|
5161
|
-
* @group Query Tools
|
|
5162
|
-
*/
|
|
5163
|
-
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";
|
|
5164
|
-
/**
|
|
5165
|
-
* Details about an aborted query tool operation.
|
|
5166
|
-
*
|
|
5167
|
-
* @group Query Tools
|
|
5168
|
-
*/
|
|
5169
|
-
interface AbortInfo {
|
|
5170
|
-
/** Why the operation was aborted. */
|
|
5171
|
-
reason: AbortReason;
|
|
5172
|
-
/** The query tool that aborted. */
|
|
5173
|
-
operation: "add" | "remove" | "update" | "move" | "insert" | "group";
|
|
5174
|
-
/** The path or `id` that could not be used, when the reason relates to a specific target. */
|
|
5175
|
-
pathOrID?: Path | string;
|
|
5176
|
-
}
|
|
5177
|
-
/**
|
|
5178
|
-
* Options that block a mutation before it is attempted.
|
|
5179
|
-
*
|
|
5180
|
-
* `disabled` is a property of the query itself, so honoring it is a matter of data integrity
|
|
5181
|
-
* rather than presentation: a query saved with a locked rule should stay locked when it is
|
|
5182
|
-
* loaded again. It is opt-in here only to preserve the existing behavior of the standalone
|
|
5183
|
-
* query tools; {@link QueryManager} enables it by default.
|
|
5184
|
-
*
|
|
5185
|
-
* @group Query Tools
|
|
5186
|
-
*/
|
|
5187
|
-
interface GuardOptions {
|
|
5188
|
-
/**
|
|
5189
|
-
* Abort when the target (or its parent, for `add`/`insert`) is disabled, either directly or
|
|
5190
|
-
* by descending from a disabled group. Defaults to `false`.
|
|
5191
|
-
*
|
|
5192
|
-
* Updating a rule or group's own `disabled` property is always permitted, since it is the
|
|
5193
|
-
* only way to re-enable it.
|
|
5194
|
-
*/
|
|
5195
|
-
respectDisabled?: boolean;
|
|
5196
|
-
/**
|
|
5197
|
-
* Paths that are disabled without the corresponding rule or group carrying a `disabled`
|
|
5198
|
-
* property, mirroring the array form of the `QueryBuilder` `disabled` prop. A path is treated
|
|
5199
|
-
* as disabled if it appears here or descends from a path that does.
|
|
5200
|
-
*
|
|
5201
|
-
* Like the `disabled` property, this is only honored when `respectDisabled` is `true`, and
|
|
5202
|
-
* updating a rule or group's own `disabled` property is still permitted.
|
|
5203
|
-
*/
|
|
5204
|
-
disabledPaths?: Path[];
|
|
5205
|
-
/** Abort every mutation, as though the entire query were disabled. Defaults to `false`. */
|
|
5206
|
-
queryDisabled?: boolean;
|
|
5207
|
-
/**
|
|
5208
|
-
* The maximum depth at which a group may be added. A group whose parent path is already this
|
|
5209
|
-
* deep is rejected by `add` and `insert`. Rules are unaffected. Defaults to `Infinity`.
|
|
5210
|
-
*/
|
|
5211
|
-
maxLevels?: number;
|
|
5212
|
-
}
|
|
5213
|
-
/**
|
|
5214
|
-
* Options for reporting aborted query tool operations.
|
|
5215
|
-
*
|
|
5216
|
-
* @group Query Tools
|
|
5279
|
+
* Options shared by the resolvers below that produce a normalized option list.
|
|
5217
5280
|
*/
|
|
5218
|
-
interface
|
|
5281
|
+
interface ResolveOptionListOptions {
|
|
5219
5282
|
/**
|
|
5220
|
-
*
|
|
5221
|
-
*
|
|
5222
|
-
* "the operation had nothing to do".
|
|
5283
|
+
* Prepended as an empty placeholder option when `autoSelectOption` is `false`. Supplied by the
|
|
5284
|
+
* `translations` prop in React; omit it where translations don't apply.
|
|
5223
5285
|
*/
|
|
5224
|
-
|
|
5286
|
+
placeholder?: Placeholder;
|
|
5287
|
+
/** Properties applied to every option in the resulting list. */
|
|
5288
|
+
baseOption?: Record<string, unknown>;
|
|
5289
|
+
/** When `false`, an empty placeholder option is prepended. */
|
|
5290
|
+
autoSelectOption?: boolean;
|
|
5225
5291
|
}
|
|
5226
5292
|
/**
|
|
5227
|
-
*
|
|
5228
|
-
*
|
|
5229
|
-
*
|
|
5230
|
-
* Exported so that callers which run their own logic before mutating—such as a UI layer that
|
|
5231
|
-
* invokes a confirmation callback—can apply the same rules without duplicating them.
|
|
5293
|
+
* Resolves the operator list for a field, applying the same precedence as the `QueryBuilder`
|
|
5294
|
+
* component: the field's own `operators`, then the `getOperators` callback, then the
|
|
5295
|
+
* query-level operator list.
|
|
5232
5296
|
*
|
|
5233
|
-
* @group
|
|
5297
|
+
* @group Option Lists
|
|
5234
5298
|
*/
|
|
5235
|
-
declare const
|
|
5236
|
-
|
|
5237
|
-
|
|
5299
|
+
declare const resolveOperatorList: <F extends FullField = FullField, O extends FullOperator = FullOperator>({ field, fieldData, getOperators, operators, placeholder, baseOption, autoSelectOption }: {
|
|
5300
|
+
field: string;
|
|
5301
|
+
fieldData: F;
|
|
5302
|
+
getOperators?: (field: string, misc: {
|
|
5303
|
+
fieldData: F;
|
|
5304
|
+
}) => FlexibleOptionList<O> | null;
|
|
5305
|
+
operators: FullOptionList<O>;
|
|
5306
|
+
} & ResolveOptionListOptions) => FullOptionList<O>;
|
|
5238
5307
|
/**
|
|
5239
|
-
*
|
|
5308
|
+
* Resolves the default operator for a field, applying the same precedence as the `QueryBuilder`
|
|
5309
|
+
* component: the field's own `defaultOperator`, then the `getDefaultOperator` option (a string or
|
|
5310
|
+
* a function), then the first available operator.
|
|
5240
5311
|
*
|
|
5241
|
-
* @group
|
|
5312
|
+
* @group Option Lists
|
|
5242
5313
|
*/
|
|
5243
|
-
declare const
|
|
5314
|
+
declare const resolveDefaultOperator: <F extends FullField = FullField>({ field, fieldData, getDefaultOperator, getOperators }: {
|
|
5315
|
+
field: string;
|
|
5316
|
+
fieldData: F;
|
|
5317
|
+
getDefaultOperator?: string | ((field: string, misc: {
|
|
5318
|
+
fieldData: F;
|
|
5319
|
+
}) => string);
|
|
5320
|
+
/** Produces the operator list for the field, i.e. {@link resolveOperatorList} already bound. */
|
|
5321
|
+
getOperators: (field: string, misc: {
|
|
5322
|
+
fieldData: F;
|
|
5323
|
+
}) => FullOptionList<FullOperator>;
|
|
5324
|
+
}) => string;
|
|
5244
5325
|
/**
|
|
5245
|
-
*
|
|
5326
|
+
* Resolves the value editor type for a field/operator pair, applying the same precedence as the
|
|
5327
|
+
* `QueryBuilder` component: the field's own `valueEditorType` (a string or a function of the
|
|
5328
|
+
* operator), then the `getValueEditorType` callback, then `"text"`.
|
|
5246
5329
|
*
|
|
5247
|
-
* @group
|
|
5330
|
+
* @group Option Lists
|
|
5248
5331
|
*/
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
/**
|
|
5258
|
-
* If the query extends `RuleGroupTypeIC` (i.e. the query has independent
|
|
5259
|
-
* combinators), then this combinator will be inserted before the new rule/group
|
|
5260
|
-
* if the parent group is not empty. This option will supersede `combinators`.
|
|
5261
|
-
*/
|
|
5262
|
-
combinatorPreceding?: string;
|
|
5263
|
-
/**
|
|
5264
|
-
* ID generator.
|
|
5265
|
-
*/
|
|
5266
|
-
idGenerator?: () => string;
|
|
5267
|
-
}
|
|
5268
|
-
interface AddMethod {
|
|
5269
|
-
<RG extends RuleGroupTypeAny>(query: RG, ruleOrGroup: RG | RuleType, parentPathOrID: Path | string, options?: AddOptions): RG;
|
|
5270
|
-
}
|
|
5332
|
+
declare const resolveValueEditorType: <F extends FullField = FullField>({ field, operator, fieldData, getValueEditorType }: {
|
|
5333
|
+
field: string;
|
|
5334
|
+
operator: string;
|
|
5335
|
+
fieldData: F;
|
|
5336
|
+
getValueEditorType?: (field: string, operator: string, misc: {
|
|
5337
|
+
fieldData: F;
|
|
5338
|
+
}) => ValueEditorType;
|
|
5339
|
+
}) => ValueEditorType;
|
|
5271
5340
|
/**
|
|
5272
|
-
*
|
|
5273
|
-
*
|
|
5274
|
-
*
|
|
5341
|
+
* Resolves the value option list for a field/operator pair, applying the same precedence as the
|
|
5342
|
+
* `QueryBuilder` component: the field's own `values`, then the `getValues` callback, then an
|
|
5343
|
+
* empty list.
|
|
5275
5344
|
*
|
|
5276
|
-
* @group
|
|
5345
|
+
* @group Option Lists
|
|
5277
5346
|
*/
|
|
5278
|
-
declare const
|
|
5347
|
+
declare const resolveValueList: <F extends FullField = FullField>({ field, operator, fieldData, getValues, placeholder, baseOption, autoSelectOption }: {
|
|
5348
|
+
field: string;
|
|
5349
|
+
operator: string;
|
|
5350
|
+
fieldData: F;
|
|
5351
|
+
getValues?: (field: string, operator: string, misc: {
|
|
5352
|
+
fieldData: F;
|
|
5353
|
+
}) => FlexibleOptionList<Option> | null;
|
|
5354
|
+
} & ResolveOptionListOptions) => FullOptionList<Option>;
|
|
5355
|
+
//#endregion
|
|
5356
|
+
//#region src/utils/optGroupUtils.d.ts
|
|
5279
5357
|
/**
|
|
5280
|
-
*
|
|
5281
|
-
*
|
|
5282
|
-
* @returns The query (mutated in place) with the rule or group added.
|
|
5358
|
+
* Converts an {@link Option} or {@link ValueOption} (i.e., {@link BaseOption})
|
|
5359
|
+
* into a {@link FullOption}. Full options are left unchanged.
|
|
5283
5360
|
*
|
|
5284
|
-
* @group
|
|
5361
|
+
* @group Option Lists
|
|
5285
5362
|
*/
|
|
5286
|
-
declare
|
|
5363
|
+
declare function toFullOption<Opt extends BaseOption>(opt: Opt | string, baseProperties?: Record<string, unknown>, labelMap?: Record<string, unknown>): ToFullOption<Opt>;
|
|
5287
5364
|
/**
|
|
5288
|
-
*
|
|
5365
|
+
* Converts an {@link OptionList} or {@link FlexibleOptionList} into a {@link FullOptionList}.
|
|
5366
|
+
* Lists of full options are left unchanged.
|
|
5289
5367
|
*
|
|
5290
|
-
* @group
|
|
5368
|
+
* @group Option Lists
|
|
5291
5369
|
*/
|
|
5292
|
-
|
|
5293
|
-
/**
|
|
5294
|
-
* When updating the `field` of a rule, the rule's `operator`, `value`, and `valueSource`
|
|
5295
|
-
* will be reset to their respective defaults. Defaults to `true`.
|
|
5296
|
-
*/
|
|
5297
|
-
resetOnFieldChange?: boolean;
|
|
5298
|
-
/**
|
|
5299
|
-
* When updating the `operator` of a rule, the rule's `value` and `valueSource`
|
|
5300
|
-
* will be reset to their respective defaults. Defaults to `false`.
|
|
5301
|
-
*/
|
|
5302
|
-
resetOnOperatorChange?: boolean;
|
|
5303
|
-
/**
|
|
5304
|
-
* Determines the default operator name for a given field.
|
|
5305
|
-
*/
|
|
5306
|
-
getRuleDefaultOperator?: (field: string) => string;
|
|
5307
|
-
/**
|
|
5308
|
-
* Determines the valid value sources for a given field and operator.
|
|
5309
|
-
*/
|
|
5310
|
-
getValueSources?: (field: string, operator: string) => ValueSources | ValueSourceFlexibleOptions;
|
|
5311
|
-
/**
|
|
5312
|
-
* Gets the default value for a given rule, in case the value needs to be reset.
|
|
5313
|
-
*/
|
|
5314
|
-
getRuleDefaultValue?: (rule: RuleType) => any;
|
|
5315
|
-
/**
|
|
5316
|
-
* Determines the valid match modes for a given field.
|
|
5317
|
-
*/
|
|
5318
|
-
getMatchModes?: (field: string) => MatchModeOptions;
|
|
5319
|
-
}
|
|
5320
|
-
interface UpdateMethod {
|
|
5321
|
-
/**
|
|
5322
|
-
* Updates a single property of a rule or group.
|
|
5323
|
-
*/
|
|
5324
|
-
<RG extends RuleGroupTypeAny>(query: RG, prop: UpdateableProperties, value: any, pathOrID: Path | string, options?: UpdateOptions): RG;
|
|
5325
|
-
/**
|
|
5326
|
-
* Updates multiple properties of a rule or group using parallel arrays of
|
|
5327
|
-
* property names and corresponding values.
|
|
5328
|
-
*/
|
|
5329
|
-
<RG extends RuleGroupTypeAny>(query: RG, props: UpdateableProperties[], values: any[], pathOrID: Path | string, options?: UpdateOptions): RG;
|
|
5330
|
-
/**
|
|
5331
|
-
* Updates multiple properties of a rule or group using a map of property
|
|
5332
|
-
* names to their new values.
|
|
5333
|
-
*/
|
|
5334
|
-
<RG extends RuleGroupTypeAny>(query: RG, props: UpdateValueMap, pathOrID: Path | string, options?: UpdateOptions): RG;
|
|
5335
|
-
}
|
|
5370
|
+
declare function toFullOptionList<Opt extends BaseOption>(optList: unknown[], baseProperties?: Record<string, unknown>, labelMap?: Record<string, unknown>): FullOptionList<Opt>;
|
|
5336
5371
|
/**
|
|
5337
|
-
*
|
|
5338
|
-
*
|
|
5339
|
-
* (`prop`, `value`), as parallel arrays (`props`, `values`), or as a
|
|
5340
|
-
* property-to-value map. For multi-property updates, `field`, `operator`, and
|
|
5341
|
-
* `valueSource` are applied before `value`, so an explicit `value` is never
|
|
5342
|
-
* reset by a change to one of those properties.
|
|
5343
|
-
*
|
|
5344
|
-
* @returns A new query with the rule or group properties updated.
|
|
5372
|
+
* Converts a {@link FlexibleOptionList} into a {@link FullOptionList}.
|
|
5373
|
+
* Lists of full options are left unchanged.
|
|
5345
5374
|
*
|
|
5346
|
-
* @group
|
|
5375
|
+
* @group Option Lists
|
|
5347
5376
|
*/
|
|
5348
|
-
declare
|
|
5377
|
+
declare function toFullOptionMap<OptMap extends BaseOptionMap>(optMap: OptMap, baseProperties?: Record<string, unknown>): OptMap extends BaseOptionMap<infer V, infer K> ? Partial<Record<K, ToFullOption<V>>> : never;
|
|
5349
5378
|
/**
|
|
5350
|
-
*
|
|
5351
|
-
* See {@link update} for the supported argument forms and ordering semantics.
|
|
5352
|
-
*
|
|
5353
|
-
* @returns The query (mutated in place) with the rule or group properties updated.
|
|
5379
|
+
* @deprecated Renamed to {@link uniqByIdentifier}.
|
|
5354
5380
|
*
|
|
5355
|
-
* @group
|
|
5381
|
+
* @group Option Lists
|
|
5356
5382
|
*/
|
|
5357
|
-
declare const
|
|
5383
|
+
declare const uniqByName: <T extends {
|
|
5384
|
+
name: string;
|
|
5385
|
+
value?: string;
|
|
5386
|
+
} | {
|
|
5387
|
+
name?: string;
|
|
5388
|
+
value: string;
|
|
5389
|
+
}>(originalArray: T[]) => T[];
|
|
5358
5390
|
/**
|
|
5359
|
-
*
|
|
5391
|
+
* Generates a new array of objects with duplicates removed based
|
|
5392
|
+
* on the identifying property (`value` or `name`)
|
|
5360
5393
|
*
|
|
5361
|
-
* @group
|
|
5394
|
+
* @group Option Lists
|
|
5362
5395
|
*/
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
}
|
|
5396
|
+
declare const uniqByIdentifier: <T extends RequireAtLeastOne$1<{
|
|
5397
|
+
name: string;
|
|
5398
|
+
value: string;
|
|
5399
|
+
}, "name" | "value">>(originalArray: T[]) => T[];
|
|
5367
5400
|
/**
|
|
5368
|
-
*
|
|
5369
|
-
*
|
|
5370
|
-
* @returns A new query with the rule or group removed.
|
|
5401
|
+
* Determines if an {@link OptionList} is an {@link OptionGroup} array.
|
|
5371
5402
|
*
|
|
5372
|
-
* @group
|
|
5403
|
+
* @group Option Lists
|
|
5373
5404
|
*/
|
|
5374
|
-
declare const
|
|
5405
|
+
declare const isOptionGroupArray: (arr: unknown) => arr is OptionGroup<BaseOption>[];
|
|
5375
5406
|
/**
|
|
5376
|
-
*
|
|
5377
|
-
*
|
|
5378
|
-
* @returns The query (mutated in place) with the rule or group removed.
|
|
5407
|
+
* Determines if an array is a flat array of {@link FlexibleOption}.
|
|
5379
5408
|
*
|
|
5380
|
-
* @group
|
|
5409
|
+
* @group Option Lists
|
|
5381
5410
|
*/
|
|
5382
|
-
declare const
|
|
5411
|
+
declare const isFlexibleOptionArray: (arr: unknown) => arr is FlexibleOption[];
|
|
5383
5412
|
/**
|
|
5384
|
-
*
|
|
5413
|
+
* Determines if an array is a flat array of {@link FullOption}.
|
|
5385
5414
|
*
|
|
5386
|
-
* @group
|
|
5415
|
+
* @group Option Lists
|
|
5387
5416
|
*/
|
|
5388
|
-
|
|
5389
|
-
/**
|
|
5390
|
-
* When `true`, the source rule/group will not be removed from its original path.
|
|
5391
|
-
*/
|
|
5392
|
-
clone?: boolean;
|
|
5393
|
-
/**
|
|
5394
|
-
* If the query extends `RuleGroupTypeIC` (i.e. the query is using independent
|
|
5395
|
-
* combinators), then the first combinator in this list will be inserted before
|
|
5396
|
-
* the rule/group if necessary.
|
|
5397
|
-
*/
|
|
5398
|
-
combinators?: OptionList;
|
|
5399
|
-
/**
|
|
5400
|
-
* ID generator.
|
|
5401
|
-
*/
|
|
5402
|
-
idGenerator?: () => string;
|
|
5403
|
-
}
|
|
5404
|
-
interface MoveMethod {
|
|
5405
|
-
<RG extends RuleGroupTypeAny>(query: RG, oldPathOrID: Path | string, newPath: Path | "up" | "down", options?: MoveOptions): RG;
|
|
5406
|
-
}
|
|
5417
|
+
declare const isFullOptionArray: (arr: unknown) => arr is FullOption[];
|
|
5407
5418
|
/**
|
|
5408
|
-
*
|
|
5409
|
-
* In the options parameter, pass `{ clone: true }` to copy instead of move.
|
|
5410
|
-
*
|
|
5411
|
-
* @returns A new query with the rule or group moved or cloned.
|
|
5419
|
+
* Determines if a {@link FlexibleOptionList} is a {@link FlexibleOptionGroup} array.
|
|
5412
5420
|
*
|
|
5413
|
-
* @group
|
|
5421
|
+
* @group Option Lists
|
|
5414
5422
|
*/
|
|
5415
|
-
declare const
|
|
5423
|
+
declare const isFlexibleOptionGroupArray: (arr: unknown, { allowEmpty }?: {
|
|
5424
|
+
allowEmpty?: boolean;
|
|
5425
|
+
}) => arr is FlexibleOptionGroup[];
|
|
5416
5426
|
/**
|
|
5417
|
-
*
|
|
5418
|
-
* In the options parameter, pass `{ clone: true }` to copy instead of move.
|
|
5419
|
-
*
|
|
5420
|
-
* @returns The query (mutated in place) with the rule or group moved or cloned.
|
|
5427
|
+
* Determines if a {@link FlexibleOptionList} is a {@link OptionGroup} array of {@link FullOption}.
|
|
5421
5428
|
*
|
|
5422
|
-
* @group
|
|
5429
|
+
* @group Option Lists
|
|
5423
5430
|
*/
|
|
5424
|
-
declare const
|
|
5431
|
+
declare const isFullOptionGroupArray: (arr: unknown, { allowEmpty }?: {
|
|
5432
|
+
allowEmpty?: boolean;
|
|
5433
|
+
}) => arr is OptionGroup<FullOption>[];
|
|
5425
5434
|
/**
|
|
5426
|
-
*
|
|
5435
|
+
* Gets the option from an {@link OptionList} with the given `name`. Handles
|
|
5436
|
+
* {@link Option} arrays as well as {@link OptionGroup} arrays.
|
|
5427
5437
|
*
|
|
5428
|
-
* @group
|
|
5438
|
+
* @group Option Lists
|
|
5429
5439
|
*/
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
* combinators), then the first combinator in this list will be inserted
|
|
5434
|
-
* before the new rule/group if the parent group is not empty. This option
|
|
5435
|
-
* is overridden by `combinatorPreceding`.
|
|
5436
|
-
*/
|
|
5437
|
-
combinators?: OptionList;
|
|
5438
|
-
/**
|
|
5439
|
-
* If the query extends `RuleGroupTypeIC` (i.e. the query has independent
|
|
5440
|
-
* combinators), then this combinator will be inserted before the new rule/group
|
|
5441
|
-
* if the parent group is not empty and the new rule/group is not the first in the
|
|
5442
|
-
* group (`path.at(-1) > 0`). This option will supersede `combinators`.
|
|
5443
|
-
*/
|
|
5444
|
-
combinatorPreceding?: string;
|
|
5445
|
-
/**
|
|
5446
|
-
* If the query extends `RuleGroupTypeIC` (i.e. the query has independent
|
|
5447
|
-
* combinators), then this combinator will be inserted after the new rule/group
|
|
5448
|
-
* if the parent group is not empty and the new rule/group is the first in the
|
|
5449
|
-
* group (`path.at(-1) === 0`). This option will supersede `combinators`.
|
|
5450
|
-
*/
|
|
5451
|
-
combinatorSucceeding?: string;
|
|
5452
|
-
/**
|
|
5453
|
-
* ID generator.
|
|
5454
|
-
*
|
|
5455
|
-
* @default generateID
|
|
5456
|
-
*/
|
|
5457
|
-
idGenerator?: () => string;
|
|
5458
|
-
/**
|
|
5459
|
-
* When `true`, the new rule/group will replace the rule/group at `path`.
|
|
5460
|
-
*/
|
|
5461
|
-
replace?: boolean;
|
|
5462
|
-
}
|
|
5463
|
-
interface InsertMethod {
|
|
5464
|
-
<RG extends RuleGroupTypeAny>(query: RG, ruleOrGroup: RG | RuleType, path: number[], options?: InsertOptions): RG;
|
|
5465
|
-
}
|
|
5440
|
+
declare function getOption<OptType extends FullOption>(arr: FullOptionList<OptType>, name: string): OptType | undefined;
|
|
5441
|
+
declare function getOption<OptType extends ValueOption>(arr: FlexibleOptionList<OptType>, name: string): OptType | undefined;
|
|
5442
|
+
declare function getOption<OptType extends Option>(arr: FlexibleOptionList<OptType>, name: string): OptType | undefined;
|
|
5466
5443
|
/**
|
|
5467
|
-
*
|
|
5468
|
-
*
|
|
5469
|
-
* @returns A new query with the rule or group inserted.
|
|
5444
|
+
* Gets the first option from an {@link OptionList}.
|
|
5470
5445
|
*
|
|
5471
|
-
* @group
|
|
5446
|
+
* @group Option Lists
|
|
5472
5447
|
*/
|
|
5473
|
-
declare
|
|
5448
|
+
declare function getFirstOption<Opt extends FullOption>(arr?: OptionGroup<Opt>[] | Opt[]): GetOptionIdentifierType<Opt> | null;
|
|
5449
|
+
declare function getFirstOption<Opt extends ValueOption>(arr?: OptionGroup<Opt>[] | Opt[]): GetOptionIdentifierType<Opt> | null;
|
|
5450
|
+
declare function getFirstOption<Opt extends Option>(arr?: OptionGroup<Opt>[] | Opt[]): GetOptionIdentifierType<Opt> | null;
|
|
5474
5451
|
/**
|
|
5475
|
-
*
|
|
5452
|
+
* Flattens {@link FlexibleOptionGroup} arrays into {@link BaseOption} arrays.
|
|
5453
|
+
* If the array is already flat, it is returned as is.
|
|
5476
5454
|
*
|
|
5477
|
-
* @
|
|
5455
|
+
* @group Option Lists
|
|
5456
|
+
*/
|
|
5457
|
+
declare const toFlatOptionArray: <T extends FullOption>(arr: FullOptionList<T>) => T[];
|
|
5458
|
+
/**
|
|
5459
|
+
* Generates a new {@link OptionGroup} array with duplicates
|
|
5460
|
+
* removed based on the identifying property (`value` or `name`).
|
|
5478
5461
|
*
|
|
5479
|
-
* @group
|
|
5462
|
+
* @group Option Lists
|
|
5480
5463
|
*/
|
|
5481
|
-
declare const
|
|
5464
|
+
declare const uniqOptGroups: <T extends BaseOption>(originalArray: FlexibleOptionGroup<T>[]) => OptionGroup<ToFullOption<T>>[];
|
|
5482
5465
|
/**
|
|
5483
|
-
*
|
|
5466
|
+
* Generates a new {@link Option} or {@link OptionGroup} array with duplicates
|
|
5467
|
+
* removed based on the identifier property (`value` or `name`).
|
|
5484
5468
|
*
|
|
5485
|
-
* @group
|
|
5469
|
+
* @group Option Lists
|
|
5486
5470
|
*/
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
* If the query extends `RuleGroupTypeIC` (i.e. the query is using independent
|
|
5494
|
-
* combinators), then the first combinator in this list will be inserted between
|
|
5495
|
-
* the two rules/groups.
|
|
5496
|
-
*/
|
|
5497
|
-
combinators?: OptionList;
|
|
5498
|
-
/**
|
|
5499
|
-
* ID generator.
|
|
5500
|
-
*/
|
|
5501
|
-
idGenerator?: () => string;
|
|
5471
|
+
declare const uniqOptList: <T extends BaseOption>(originalArray: FlexibleOptionList<T>) => WithUnknownIndex<BaseOption & FullOption>[] | OptionGroup<ToFullOption<T>>[];
|
|
5472
|
+
/** Result of {@link prepareOptionList}. */
|
|
5473
|
+
interface PreparedOptionList<O extends FullOption> {
|
|
5474
|
+
defaultOption: FullOption;
|
|
5475
|
+
optionList: FullOptionList<O>;
|
|
5476
|
+
optionsMap: Partial<FullOptionRecord<O>>;
|
|
5502
5477
|
}
|
|
5503
|
-
|
|
5504
|
-
|
|
5478
|
+
/** Parameters for {@link prepareOptionList}. */
|
|
5479
|
+
interface PrepareOptionListParams<O extends FullOption> {
|
|
5480
|
+
placeholder?: Placeholder;
|
|
5481
|
+
optionList?: FlexibleOptionListProp<O> | BaseOptionMap<O>;
|
|
5482
|
+
baseOption?: Record<string, unknown>;
|
|
5483
|
+
labelMap?: Record<string, string>;
|
|
5484
|
+
autoSelectOption?: boolean;
|
|
5505
5485
|
}
|
|
5506
5486
|
/**
|
|
5507
|
-
*
|
|
5508
|
-
*
|
|
5509
|
-
*
|
|
5487
|
+
* Normalizes any accepted option list shape—array, option groups, or a record—into a
|
|
5488
|
+
* `FullOptionList`, applying `baseOption` properties and (when `autoSelectOption` is `false`)
|
|
5489
|
+
* a leading placeholder option. Also returns the flattened lookup map and the option that
|
|
5490
|
+
* should be selected by default.
|
|
5510
5491
|
*
|
|
5511
|
-
*
|
|
5492
|
+
* Note: `labelMap` overrides only apply to array/option group input (where string options are
|
|
5493
|
+
* expanded); record input derives labels from the record values themselves.
|
|
5512
5494
|
*
|
|
5513
|
-
*
|
|
5495
|
+
* This is the same normalization `<QueryBuilder />` applies to `fields`, `operators`,
|
|
5496
|
+
* `combinators`, and value lists, so a non-React implementation resolves options identically.
|
|
5497
|
+
*
|
|
5498
|
+
* @group Option Lists
|
|
5514
5499
|
*/
|
|
5515
|
-
declare const
|
|
5500
|
+
declare const prepareOptionList: <O extends FullOption>(props: PrepareOptionListParams<O>) => PreparedOptionList<O>;
|
|
5501
|
+
//#endregion
|
|
5502
|
+
//#region src/utils/pathUtils.d.ts
|
|
5516
5503
|
/**
|
|
5517
|
-
*
|
|
5518
|
-
|
|
5519
|
-
|
|
5504
|
+
* Return type for {@link findPath}.
|
|
5505
|
+
*/
|
|
5506
|
+
type FindPathReturnType = RuleGroupTypeAny | RuleType | null;
|
|
5507
|
+
/**
|
|
5508
|
+
* Returns the {@link RuleType} or {@link RuleGroupType}/{@link RuleGroupTypeIC}
|
|
5509
|
+
* at the given path within a query.
|
|
5510
|
+
*/
|
|
5511
|
+
declare const findPath: (path: Path, query: RuleGroupTypeAny) => FindPathReturnType;
|
|
5512
|
+
/**
|
|
5513
|
+
* Returns the {@link RuleType} or {@link RuleGroupType}/{@link RuleGroupTypeIC}
|
|
5514
|
+
* with the given `id` within a query.
|
|
5515
|
+
*/
|
|
5516
|
+
declare const findID: (id: string, query: RuleGroupTypeAny) => FindPathReturnType;
|
|
5517
|
+
/**
|
|
5518
|
+
* Returns the {@link Path} of the {@link RuleType} or {@link RuleGroupType}/{@link RuleGroupTypeIC}
|
|
5519
|
+
* with the given `id` within a query.
|
|
5520
|
+
*/
|
|
5521
|
+
declare const getPathOfID: (id: string, query: RuleGroupTypeAny) => Path | null;
|
|
5522
|
+
/**
|
|
5523
|
+
* Truncates the last element of an array and returns the result as a new array.
|
|
5524
|
+
*/
|
|
5525
|
+
declare const getParentPath: (path: Path) => Path;
|
|
5526
|
+
/**
|
|
5527
|
+
* Determines if two paths (each `Path`) are equivalent.
|
|
5528
|
+
*/
|
|
5529
|
+
declare const pathsAreEqual: (path1: Path, path2: Path) => boolean;
|
|
5530
|
+
/**
|
|
5531
|
+
* Determines if the first path is an ancestor of the second path. The first path must
|
|
5532
|
+
* be shorter and exactly match the second path up through the length of the first path.
|
|
5533
|
+
*/
|
|
5534
|
+
declare const isAncestor: (maybeAncestor: Path, path: Path) => boolean;
|
|
5535
|
+
/**
|
|
5536
|
+
* Finds the deepest/longest path that two paths have in common.
|
|
5537
|
+
*/
|
|
5538
|
+
declare const getCommonAncestorPath: (path1: Path, path2: Path) => Path;
|
|
5539
|
+
/**
|
|
5540
|
+
* Determines if the rule or group at the specified path is either disabled itself
|
|
5541
|
+
* or disabled by an ancestor group.
|
|
5542
|
+
*/
|
|
5543
|
+
declare const pathIsDisabled: (path: Path, query: RuleGroupTypeAny) => boolean;
|
|
5544
|
+
/**
|
|
5545
|
+
* Determines if the rule or group at the specified path is disabled by `disabledPaths`—the array
|
|
5546
|
+
* form of the `QueryBuilder` `disabled` prop, which disables nodes by position rather than by a
|
|
5547
|
+
* `disabled` property on the node itself. A path is disabled if it appears in `disabledPaths` or
|
|
5548
|
+
* descends from a path that does.
|
|
5520
5549
|
*
|
|
5521
|
-
* @
|
|
5550
|
+
* @group Paths
|
|
5551
|
+
*/
|
|
5552
|
+
declare const pathIsDisabledByPaths: (path: Path, disabledPaths?: Path[]) => boolean;
|
|
5553
|
+
/** The path of a child rule or group, and whether it is disabled. */ interface PathInfo {
|
|
5554
|
+
path: Path;
|
|
5555
|
+
disabled: boolean;
|
|
5556
|
+
}
|
|
5557
|
+
/**
|
|
5558
|
+
* Builds the {@link PathInfo} for each child of a group at `path`. A child is disabled if its
|
|
5559
|
+
* parent is disabled or if its own path appears in `disabledPaths`.
|
|
5522
5560
|
*
|
|
5523
|
-
* @group
|
|
5561
|
+
* @group Paths
|
|
5524
5562
|
*/
|
|
5525
|
-
declare const
|
|
5563
|
+
declare const derivePathInfo: (path: Path, childCount: number, { disabled, disabledPaths }?: {
|
|
5564
|
+
disabled?: boolean;
|
|
5565
|
+
disabledPaths?: Path[];
|
|
5566
|
+
}) => PathInfo[];
|
|
5526
5567
|
//#endregion
|
|
5527
5568
|
//#region src/utils/transformQuery.d.ts
|
|
5528
5569
|
/**
|
|
@@ -5638,14 +5679,6 @@ declare function transformQuery(query: RuleGroupType, options?: TransformQueryOp
|
|
|
5638
5679
|
declare function transformQuery(query: RuleGroupTypeIC, options?: TransformQueryOptions<RuleGroupTypeIC>): any;
|
|
5639
5680
|
//#endregion
|
|
5640
5681
|
//#region src/utils/QueryManager.d.ts
|
|
5641
|
-
/**
|
|
5642
|
-
* Abort reasons that {@link QueryManager}'s `strict` mode treats as errors. The remaining
|
|
5643
|
-
* reasons—`"same-location"` and `"no-change"`—describe valid operations that had nothing to do,
|
|
5644
|
-
* so they are reported to `onInvalidTarget` but never throw.
|
|
5645
|
-
*
|
|
5646
|
-
* @group Query Tools
|
|
5647
|
-
*/
|
|
5648
|
-
declare const strictAbortReasons: readonly AbortReason[];
|
|
5649
5682
|
/**
|
|
5650
5683
|
* Thrown by {@link QueryManager} methods in `strict` mode when an operation cannot be carried
|
|
5651
5684
|
* out because its target could not be used.
|
|
@@ -5678,6 +5711,27 @@ interface StrictOptions {
|
|
|
5678
5711
|
*/
|
|
5679
5712
|
onInvalidTarget?: (info: AbortInfo) => void;
|
|
5680
5713
|
}
|
|
5714
|
+
/**
|
|
5715
|
+
* The `getDefaultField` option: either a field name or a function that picks one.
|
|
5716
|
+
*
|
|
5717
|
+
* Named separately from {@link QueryManagerOptions} so callers building the option value
|
|
5718
|
+
* conditionally can annotate the intermediate. TypeScript cannot reconcile the two arms of a
|
|
5719
|
+
* ternary against an inline union, which otherwise forces a cast.
|
|
5720
|
+
*
|
|
5721
|
+
* @group Query Tools
|
|
5722
|
+
*/
|
|
5723
|
+
type DefaultFieldProp<F extends FullField = FullField> = string | ((fieldsData: FullOptionList<F>) => string);
|
|
5724
|
+
/**
|
|
5725
|
+
* The `getDefaultOperator` option: either an operator name or a function that picks one.
|
|
5726
|
+
*
|
|
5727
|
+
* Named separately from {@link QueryManagerOptions} for the same reason as
|
|
5728
|
+
* {@link DefaultFieldProp}.
|
|
5729
|
+
*
|
|
5730
|
+
* @group Query Tools
|
|
5731
|
+
*/
|
|
5732
|
+
type DefaultOperatorProp<F extends FullField = FullField> = string | ((field: string, misc: {
|
|
5733
|
+
fieldData: F;
|
|
5734
|
+
}) => string);
|
|
5681
5735
|
/**
|
|
5682
5736
|
* Options for {@link QueryManager}. Mirrors the subset of
|
|
5683
5737
|
* {@link react-querybuilder!QueryBuilder QueryBuilder} props that affect query
|
|
@@ -5713,11 +5767,9 @@ interface QueryManagerOptions<F extends FullField = FullField, O extends FullOpe
|
|
|
5713
5767
|
*/
|
|
5714
5768
|
translations?: Partial<BaseTranslations<unknown>>;
|
|
5715
5769
|
/** The default `field` for rules created by {@link QueryManager.createRule}. */
|
|
5716
|
-
getDefaultField?:
|
|
5770
|
+
getDefaultField?: DefaultFieldProp<F>;
|
|
5717
5771
|
/** The default `operator` for a given field. */
|
|
5718
|
-
getDefaultOperator?:
|
|
5719
|
-
fieldData: F;
|
|
5720
|
-
}) => string);
|
|
5772
|
+
getDefaultOperator?: DefaultOperatorProp<F>;
|
|
5721
5773
|
/** Overrides the computed default `value` for a new rule. */
|
|
5722
5774
|
getDefaultValue?: (rule: RuleType, misc: {
|
|
5723
5775
|
fieldData: F;
|
|
@@ -5809,6 +5861,19 @@ interface QueryManagerOptions<F extends FullField = FullField, O extends FullOpe
|
|
|
5809
5861
|
* `"same-location"` and `"no-change"`. Can be overridden per call.
|
|
5810
5862
|
*/
|
|
5811
5863
|
onInvalidTarget?: (info: AbortInfo) => void;
|
|
5864
|
+
/**
|
|
5865
|
+
* Deep-freeze everything the manager hands out—the query, the field list, the field map, and
|
|
5866
|
+
* the combinator list—so accidental mutation throws in strict mode. Defaults to `true`.
|
|
5867
|
+
*
|
|
5868
|
+
* Pass `false` when the manager's output is handed to a framework that wraps objects in
|
|
5869
|
+
* proxies (Vue `reactive`, Solid stores) or otherwise needs to mutate them. This also disables
|
|
5870
|
+
* immer's auto-freeze for mutations made through the manager.
|
|
5871
|
+
*
|
|
5872
|
+
* The shallow copy returned by {@link QueryManager.getOptions} is frozen either way: it is a
|
|
5873
|
+
* one-level copy that no framework proxy is placed inside, so freezing it costs nothing and
|
|
5874
|
+
* still prevents callers from mutating the options snapshot they were handed.
|
|
5875
|
+
*/
|
|
5876
|
+
freeze?: boolean;
|
|
5812
5877
|
/** Validates the query. Defaults to {@link defaultValidator}. */
|
|
5813
5878
|
validator?: QueryValidator;
|
|
5814
5879
|
/** Generates `id` properties for new rules and groups. Defaults to {@link generateID}. */
|
|
@@ -5822,11 +5887,30 @@ interface QueryManagerOptions<F extends FullField = FullField, O extends FullOpe
|
|
|
5822
5887
|
now?: () => number;
|
|
5823
5888
|
}
|
|
5824
5889
|
/**
|
|
5825
|
-
*
|
|
5890
|
+
* What changed in the notification a {@link QueryManager.subscribe} listener is receiving.
|
|
5891
|
+
*
|
|
5892
|
+
* The two flags are independent, and at least one is always `true`. A single notification can
|
|
5893
|
+
* report both: a {@link QueryManager.batch batch} containing a
|
|
5894
|
+
* {@link QueryManager.reconfigure reconfigure} and a mutation emits one
|
|
5895
|
+
* `{ query: true, config: true }`.
|
|
5896
|
+
*
|
|
5897
|
+
* Listeners that ignore their argument keep working exactly as before — this exists so that a
|
|
5898
|
+
* framework adapter can skip the work a change does not affect (re-deriving option lists on a
|
|
5899
|
+
* query-only change, say) without diffing the manager's output to find out.
|
|
5826
5900
|
*
|
|
5827
5901
|
* @group Query Tools
|
|
5828
5902
|
*/
|
|
5829
|
-
interface
|
|
5903
|
+
interface SubscriptionChange {
|
|
5904
|
+
/** The query was replaced. */
|
|
5905
|
+
query: boolean;
|
|
5906
|
+
/** Options were applied, so option lists and any derived configuration may have changed. */
|
|
5907
|
+
config: boolean;
|
|
5908
|
+
}
|
|
5909
|
+
/**
|
|
5910
|
+
* A single rule or group encountered by {@link QueryManager.walk}, along with where it was found.
|
|
5911
|
+
*
|
|
5912
|
+
* @group Query Tools
|
|
5913
|
+
*/ interface QueryNode<RG extends RuleGroupTypeAny = RuleGroupType> {
|
|
5830
5914
|
/** The rule or group itself. */
|
|
5831
5915
|
node: RG | RuleType;
|
|
5832
5916
|
/** The {@link Path} of `node` within the query. The root group's path is `[]`. */
|
|
@@ -5863,7 +5947,8 @@ type AsRuleGroup<T> = T extends RuleGroupTypeAny ? T : RuleGroupTypeAny;
|
|
|
5863
5947
|
* The query is held internally, so each method takes the same arguments as its `queryTools`
|
|
5864
5948
|
* counterpart minus the leading `query` parameter, and returns the manager itself for chaining.
|
|
5865
5949
|
* Mutations use the non-`InPlace` tools, so a query previously handed out by
|
|
5866
|
-
* {@link QueryManager.getQuery} is never modified.
|
|
5950
|
+
* {@link QueryManager.getQuery} is never modified. Under `freeze: false` that remains true, but
|
|
5951
|
+
* as a convention rather than a runtime-enforced guarantee.
|
|
5867
5952
|
*
|
|
5868
5953
|
* ```ts
|
|
5869
5954
|
* const q = new QueryManager(undefined, { fields });
|
|
@@ -5879,11 +5964,96 @@ type AsRuleGroup<T> = T extends RuleGroupTypeAny ? T : RuleGroupTypeAny;
|
|
|
5879
5964
|
* @group Query Tools
|
|
5880
5965
|
*/
|
|
5881
5966
|
declare class QueryManager<RG extends RuleGroupTypeAny = RuleGroupType, F extends FullField = FullField, O extends FullOperator = FullOperator, C extends FullCombinator = FullCombinator> {
|
|
5882
|
-
|
|
5967
|
+
/**
|
|
5968
|
+
* All instance state, rather than `#private` fields. See `kState` for why.
|
|
5969
|
+
*
|
|
5970
|
+
* The property itself is symbol-keyed and installed by the constructor; this accessor exists
|
|
5971
|
+
* because `isolatedDeclarations` cannot emit a computed property name keyed by a symbol the
|
|
5972
|
+
* module does not export, and exporting it would put it in the public API surface. A
|
|
5973
|
+
* prototype accessor is proxy-safe for the same reason the own property is: `this` is the
|
|
5974
|
+
* proxy, and the `get` trap forwards to the target.
|
|
5975
|
+
*/
|
|
5976
|
+
private get state();
|
|
5883
5977
|
constructor(query?: RG, options?: QueryManagerOptions<F, O, C>);
|
|
5884
5978
|
/**
|
|
5885
|
-
*
|
|
5886
|
-
*
|
|
5979
|
+
* Deep-freezes `x` unless the `freeze` option is `false`. Every value the manager hands out
|
|
5980
|
+
* directly goes through here; the shallow copies returned by {@link QueryManager.getOptions}
|
|
5981
|
+
* and passed to `applyOptions` are frozen unconditionally instead.
|
|
5982
|
+
*/
|
|
5983
|
+
private freeze;
|
|
5984
|
+
/**
|
|
5985
|
+
* Assigns `options` and every field derived from it. Shared by the constructor and
|
|
5986
|
+
* {@link QueryManager.reconfigure}, so the two can never drift apart. Does not touch the
|
|
5987
|
+
* query, the history stacks, the caches, or the subscriber list.
|
|
5988
|
+
*/
|
|
5989
|
+
private applyOptions;
|
|
5990
|
+
/** Resolves the field configuration for a field name. */
|
|
5991
|
+
private fieldData;
|
|
5992
|
+
/** Resolves the operator list for a field, mirroring `QueryBuilder`'s precedence. */
|
|
5993
|
+
private operatorsFor;
|
|
5994
|
+
/** Resolves the default operator for a field, mirroring `QueryBuilder`'s precedence. */
|
|
5995
|
+
private defaultOperator;
|
|
5996
|
+
private valueSourcesFor;
|
|
5997
|
+
private matchModesFor;
|
|
5998
|
+
private valuesFor;
|
|
5999
|
+
private valueEditorTypeFor;
|
|
6000
|
+
/** Computes the default `value` for a rule, mirroring `QueryBuilder`'s precedence. */
|
|
6001
|
+
private defaultValue;
|
|
6002
|
+
/**
|
|
6003
|
+
* Resolves the parameter list for a field/operator pair, normalized the same way as every
|
|
6004
|
+
* other option list. Shared by `defaultValue` and {@link QueryManager.getRuleContext} so both
|
|
6005
|
+
* see the same shape.
|
|
6006
|
+
*/
|
|
6007
|
+
private parametersFor;
|
|
6008
|
+
/** Defaults shared by every mutating method, overridable per call. */
|
|
6009
|
+
private guardOptions;
|
|
6010
|
+
private toolOptions;
|
|
6011
|
+
/**
|
|
6012
|
+
* Builds the `onAbort` handler passed to the query tools, applying the per-call overrides on
|
|
6013
|
+
* top of the manager's own options.
|
|
6014
|
+
*/
|
|
6015
|
+
private onAbort;
|
|
6016
|
+
/** Defaults for {@link update}, so resets mirror `QueryBuilder`'s behavior. */
|
|
6017
|
+
private updateOptions;
|
|
6018
|
+
/**
|
|
6019
|
+
* Applies a new query, recording history and notifying subscribers as appropriate. Every
|
|
6020
|
+
* mutation funnels through here. A tool that could not resolve its target returns the same
|
|
6021
|
+
* query object, which is treated as a no-op.
|
|
6022
|
+
*/
|
|
6023
|
+
private commit;
|
|
6024
|
+
/**
|
|
6025
|
+
* Records a change, either as a new history entry or by absorbing it into the current one.
|
|
6026
|
+
* Mirrors the recording semantics of the `react-querybuilder/history` entry point.
|
|
6027
|
+
*/
|
|
6028
|
+
private record;
|
|
6029
|
+
private notify;
|
|
6030
|
+
/**
|
|
6031
|
+
* Records that a history-stack method ran inside the current batch. Those methods manage
|
|
6032
|
+
* `past`/`future` themselves, so the batch must not also record an entry on completion —
|
|
6033
|
+
* doing so would push a duplicate onto `past` and clear the redo stack that `undo` just
|
|
6034
|
+
* populated.
|
|
6035
|
+
*/
|
|
6036
|
+
private markHistoryBypassed;
|
|
6037
|
+
/**
|
|
6038
|
+
* Discards every cached derivation when the query has been replaced since they were computed.
|
|
6039
|
+
* Called at the top of each cached reader.
|
|
6040
|
+
*/
|
|
6041
|
+
private ensureCache;
|
|
6042
|
+
/**
|
|
6043
|
+
* The single traversal implementation. Combinator strings in independent-combinator groups
|
|
6044
|
+
* are skipped.
|
|
6045
|
+
*
|
|
6046
|
+
* @yields The subtree rooted at `node`, depth-first in pre-order, starting with `node` itself.
|
|
6047
|
+
*/
|
|
6048
|
+
private walkFrom;
|
|
6049
|
+
/** Builds (once per query) the `id` to {@link Path} index backing `findID`/`getPathOfID`. */
|
|
6050
|
+
private index;
|
|
6051
|
+
/** Resolves a path or `id` to a path, or `null` when the `id` isn't present. */
|
|
6052
|
+
private toPath;
|
|
6053
|
+
/**
|
|
6054
|
+
* The current query. The returned object is structurally shared, so it is safe to retain and
|
|
6055
|
+
* compare by reference to detect changes. It is also frozen unless the `freeze` option is
|
|
6056
|
+
* `false`.
|
|
5887
6057
|
*
|
|
5888
6058
|
* Like {@link QueryManager.subscribe}, this method is bound to the instance, so it can be
|
|
5889
6059
|
* passed as a bare reference (e.g. as the `getSnapshot` argument to `useSyncExternalStore`).
|
|
@@ -5953,13 +6123,34 @@ declare class QueryManager<RG extends RuleGroupTypeAny = RuleGroupType, F extend
|
|
|
5953
6123
|
* re-normalize.
|
|
5954
6124
|
*
|
|
5955
6125
|
* History options are honored immediately: lowering `maxHistory` trims the undo stack, and
|
|
5956
|
-
* turning history off clears both stacks.
|
|
5957
|
-
*
|
|
5958
|
-
*
|
|
6126
|
+
* turning history off clears both stacks.
|
|
6127
|
+
*
|
|
6128
|
+
* A call that resolves to the configuration already in effect is a **no-op**: nothing is
|
|
6129
|
+
* re-derived, {@link QueryManager.getConfigVersion} does not change, and subscribers are not
|
|
6130
|
+
* notified. Equality is structural for data and by identity for functions
|
|
6131
|
+
* ({@link optionsEqual}), so a caller that rebuilds its options object on every render — which
|
|
6132
|
+
* every framework adapter does — does not force a reconfigure as long as the data is the same.
|
|
6133
|
+
* Rebuilding a callback per render _does_ count as a change; memoize it to avoid that.
|
|
6134
|
+
*
|
|
6135
|
+
* Otherwise subscribers are notified once and `getConfigVersion` is incremented. Inside a
|
|
6136
|
+
* {@link QueryManager.batch batch} the options are still applied immediately — configuration
|
|
6137
|
+
* is not part of a batch's rollback — but the notification is deferred and merged into the
|
|
6138
|
+
* batch's single notification.
|
|
5959
6139
|
*/
|
|
5960
6140
|
reconfigure(options: Partial<QueryManagerOptions<F, O, C>>, config?: {
|
|
5961
6141
|
replace?: boolean;
|
|
5962
6142
|
}): this;
|
|
6143
|
+
/**
|
|
6144
|
+
* Brings the history stacks in line with the current history configuration. Unlike
|
|
6145
|
+
* {@link QueryManager.clearHistory}, this does _not_ set `historyBypassed`: it reflects a
|
|
6146
|
+
* configuration change rather than a deliberate history repositioning, so a later mutation in
|
|
6147
|
+
* the same batch must still be recorded normally.
|
|
6148
|
+
*
|
|
6149
|
+
* Called by {@link QueryManager.reconfigure} and again after a failed
|
|
6150
|
+
* {@link QueryManager.batch batch} restores its snapshot, since that snapshot predates the
|
|
6151
|
+
* configuration change (configuration is not part of a batch's rollback).
|
|
6152
|
+
*/
|
|
6153
|
+
private reconcileHistoryConfig;
|
|
5963
6154
|
/**
|
|
5964
6155
|
* A counter incremented by every {@link QueryManager.reconfigure} call. Because reconfiguring
|
|
5965
6156
|
* leaves the query object untouched, subscribers that compare query identity alone cannot see
|
|
@@ -5997,8 +6188,12 @@ declare class QueryManager<RG extends RuleGroupTypeAny = RuleGroupType, F extend
|
|
|
5997
6188
|
* ```
|
|
5998
6189
|
*
|
|
5999
6190
|
* In React, prefer the `useQueryManager` hook from `react-querybuilder`, which wraps this.
|
|
6191
|
+
*
|
|
6192
|
+
* The listener receives a {@link SubscriptionChange} describing what changed. It is optional:
|
|
6193
|
+
* a zero-argument listener — including `useSyncExternalStore`'s `onStoreChange` — is still a
|
|
6194
|
+
* valid listener and behaves as it always has.
|
|
6000
6195
|
*/
|
|
6001
|
-
subscribe: (listener: () => void) => (() => void);
|
|
6196
|
+
subscribe: (listener: (change: SubscriptionChange) => void) => (() => void);
|
|
6002
6197
|
/**
|
|
6003
6198
|
* Runs `fn`, deferring history recording and subscriber notification until it returns. The
|
|
6004
6199
|
* whole batch becomes a single undo step and triggers a single notification, or neither if
|
|
@@ -6188,6 +6383,24 @@ declare class QueryManager<RG extends RuleGroupTypeAny = RuleGroupType, F extend
|
|
|
6188
6383
|
getValues(field: string, operator: string): FullOptionList<Option>;
|
|
6189
6384
|
/** The value editor type for a field/operator pair. */
|
|
6190
6385
|
getValueEditorType(field: string, operator: string): ValueEditorType;
|
|
6386
|
+
/**
|
|
6387
|
+
* The default `operator` for a field, identical to the operator
|
|
6388
|
+
* {@link QueryManager.createRule} would assign to a new rule on that field.
|
|
6389
|
+
*/
|
|
6390
|
+
getRuleDefaultOperator(field: string): string;
|
|
6391
|
+
/**
|
|
6392
|
+
* The default `value` for a rule, identical to the value {@link QueryManager.createRule} and
|
|
6393
|
+
* {@link QueryManager.update} would assign after a field or operator change.
|
|
6394
|
+
*/
|
|
6395
|
+
getRuleDefaultValue(rule: RuleType): unknown;
|
|
6396
|
+
/**
|
|
6397
|
+
* The flattened field record backing {@link QueryManager.getFieldData}, keyed by field name
|
|
6398
|
+
* with option groups flattened away.
|
|
6399
|
+
*
|
|
6400
|
+
* Treat the result as read-only. It may or may not be frozen depending on configuration, so
|
|
6401
|
+
* do not rely on frozen-ness to prevent mutation.
|
|
6402
|
+
*/
|
|
6403
|
+
getFieldMap(): Partial<FullOptionRecord<F>>;
|
|
6191
6404
|
/**
|
|
6192
6405
|
* Resolves everything about a rule that depends on the field/operator configuration—field data,
|
|
6193
6406
|
* operators, value editor type, value list, value sources, match modes, and validation result.
|
|
@@ -6240,6 +6453,206 @@ declare class QueryManager<RG extends RuleGroupTypeAny = RuleGroupType, F extend
|
|
|
6240
6453
|
transform<T = any>(options?: TransformQueryOptions<RG>): T;
|
|
6241
6454
|
}
|
|
6242
6455
|
//#endregion
|
|
6456
|
+
//#region src/utils/optionsEqual.d.ts
|
|
6457
|
+
/**
|
|
6458
|
+
* Structural equality for {@link QueryManagerOptions} values. Arrays and plain objects are
|
|
6459
|
+
* compared by value; everything else — functions, class instances, `Map`s, `Date`s — by
|
|
6460
|
+
* identity.
|
|
6461
|
+
*
|
|
6462
|
+
* That split is what makes an options object rebuilt on every render compare equal as long as
|
|
6463
|
+
* its _data_ did not change, which is the entire point: a caller that passes object literals
|
|
6464
|
+
* (`fields={[...]}`, `translations={{...}}`) hands a fresh identity to every reconfigure, so an
|
|
6465
|
+
* identity-only comparison would report a change every time.
|
|
6466
|
+
*
|
|
6467
|
+
* Comparing functions by identity is deliberate rather than a limitation. Two functions cannot
|
|
6468
|
+
* be proven equivalent, so a caller that rebuilds `getDefaultValue` per render must either
|
|
6469
|
+
* memoize it or accept the reconfigure.
|
|
6470
|
+
*/
|
|
6471
|
+
declare const valuesEqual: (a: unknown, b: unknown) => boolean;
|
|
6472
|
+
/**
|
|
6473
|
+
* Whether two {@link QueryManagerOptions} objects describe the same configuration, per
|
|
6474
|
+
* {@link valuesEqual}: data by value, functions by identity.
|
|
6475
|
+
*
|
|
6476
|
+
* {@link QueryManager.reconfigure} uses this to gate itself, so most callers never need it
|
|
6477
|
+
* directly. It is exported for framework adapters that decide whether to _call_ `reconfigure`
|
|
6478
|
+
* at all — skipping the call avoids building the merged options object in the first place.
|
|
6479
|
+
*
|
|
6480
|
+
* Nested option objects (`history`, `translations`, …) are descended into rather than compared
|
|
6481
|
+
* by identity, so `{ history: { maxHistory: 10 } }` rebuilt per render compares equal.
|
|
6482
|
+
*/
|
|
6483
|
+
declare const optionsEqual: <F extends FullField = FullField, O extends FullOperator = FullOperator, C extends FullCombinator = FullCombinator>(a: Partial<QueryManagerOptions<F, O, C>> | undefined, b: Partial<QueryManagerOptions<F, O, C>> | undefined) => boolean;
|
|
6484
|
+
//#endregion
|
|
6485
|
+
//#region src/utils/parseNumber.d.ts
|
|
6486
|
+
/**
|
|
6487
|
+
* Options object for {@link parseNumber}.
|
|
6488
|
+
*/
|
|
6489
|
+
interface ParseNumberOptions {
|
|
6490
|
+
parseNumbers?: ParseNumberMethod;
|
|
6491
|
+
/**
|
|
6492
|
+
* Generates a `bigint` value if the string represents a valid integer
|
|
6493
|
+
* outside the safe boundaries of the `number` type.
|
|
6494
|
+
*/
|
|
6495
|
+
bigIntOnOverflow?: boolean;
|
|
6496
|
+
}
|
|
6497
|
+
/**
|
|
6498
|
+
* Converts a string to a number. Uses native `parseFloat` if `parseNumbers` is "native",
|
|
6499
|
+
* otherwise uses [`numeric-quantity`](https://jakeboone02.github.io/numeric-quantity/).
|
|
6500
|
+
* If that returns `NaN`, the string is returned unchanged. Numeric values are returned
|
|
6501
|
+
* as-is regardless of the `parseNumbers` option.
|
|
6502
|
+
*/
|
|
6503
|
+
declare const parseNumber: (val: unknown, { parseNumbers, bigIntOnOverflow }?: ParseNumberOptions) => any;
|
|
6504
|
+
//#endregion
|
|
6505
|
+
//#region src/utils/preferProp.d.ts
|
|
6506
|
+
/**
|
|
6507
|
+
* For given default, prop, and context values, return the first provided of prop,
|
|
6508
|
+
* context, and default, in that order.
|
|
6509
|
+
*/
|
|
6510
|
+
declare const preferProp: (def: boolean, prop?: boolean, context?: boolean, doNotFinalize?: boolean) => boolean;
|
|
6511
|
+
/**
|
|
6512
|
+
* For given default, prop, and context values, return the first provided of prop,
|
|
6513
|
+
* context, and default, in that order.
|
|
6514
|
+
*/
|
|
6515
|
+
declare const preferAnyProp: (def?: any, prop?: any, context?: any) => any;
|
|
6516
|
+
/**
|
|
6517
|
+
* For a given set of defaults, props, and context values, return the first provided of prop,
|
|
6518
|
+
* context, and default—in that order—for each property in the defaults object.
|
|
6519
|
+
*/
|
|
6520
|
+
declare const preferFlagProps: (props?: QueryBuilderFlags, contextVals?: QueryBuilderFlags, finalize?: boolean) => QueryBuilderFlags;
|
|
6521
|
+
//#endregion
|
|
6522
|
+
//#region src/utils/prepareQueryObjects.d.ts
|
|
6523
|
+
/**
|
|
6524
|
+
* Options for {@link prepareRule}/{@link prepareRuleGroup}.
|
|
6525
|
+
*/
|
|
6526
|
+
interface PreparerOptions {
|
|
6527
|
+
idGenerator?: () => string;
|
|
6528
|
+
}
|
|
6529
|
+
/**
|
|
6530
|
+
* Ensures that a rule is valid by adding an `id` property if it does not already exist.
|
|
6531
|
+
*/
|
|
6532
|
+
declare const prepareRule: (rule: RuleType, { idGenerator }?: PreparerOptions) => RuleType;
|
|
6533
|
+
/**
|
|
6534
|
+
* Ensures that a rule group is valid by recursively adding an `id` property to the group itself
|
|
6535
|
+
* and all its rules and subgroups where one does not already exist.
|
|
6536
|
+
*/
|
|
6537
|
+
declare const prepareRuleGroup: <RG extends RuleGroupTypeAny>(queryObject: RG, { idGenerator }?: PreparerOptions) => RG;
|
|
6538
|
+
/**
|
|
6539
|
+
* Ensures that a rule or group is valid. See {@link prepareRule} and {@link prepareRuleGroup}.
|
|
6540
|
+
*/
|
|
6541
|
+
declare const prepareRuleOrGroup: (rg: RuleGroupTypeAny | RuleType, { idGenerator }?: PreparerOptions) => RuleGroupType | RuleGroupTypeIC | RuleType;
|
|
6542
|
+
/**
|
|
6543
|
+
* Resolves the query a query builder should render from the available sources, in precedence
|
|
6544
|
+
* order: the controlled `query`, then whatever is already in the store, then the uncontrolled
|
|
6545
|
+
* `defaultQuery`, then a freshly created empty group.
|
|
6546
|
+
*
|
|
6547
|
+
* The result is prepared with {@link prepareRuleGroup} unless it already has an `id`, which is
|
|
6548
|
+
* taken to mean it has been prepared before—most often because the caller is passing back the
|
|
6549
|
+
* object it received from `onQueryChange`.
|
|
6550
|
+
*
|
|
6551
|
+
* @group Query Tools
|
|
6552
|
+
*/
|
|
6553
|
+
declare const resolveCandidateQuery: <RG extends RuleGroupTypeAny>(sources: {
|
|
6554
|
+
query?: RG;
|
|
6555
|
+
storeQuery?: RG;
|
|
6556
|
+
defaultQuery?: RG;
|
|
6557
|
+
fallbackQuery: RG;
|
|
6558
|
+
}, options?: {
|
|
6559
|
+
idGenerator?: () => string;
|
|
6560
|
+
}) => RG;
|
|
6561
|
+
//#endregion
|
|
6562
|
+
//#region src/utils/queryActions.d.ts
|
|
6563
|
+
/**
|
|
6564
|
+
* Confirmation callbacks invoked before a mutation is applied. Their return values are
|
|
6565
|
+
* interpreted differently depending on the operation:
|
|
6566
|
+
*
|
|
6567
|
+
* - `onAddRule`/`onAddGroup` may return `true` to proceed, a falsy value to cancel, or a
|
|
6568
|
+
* _replacement rule/group_ to add instead of the one provided.
|
|
6569
|
+
* - `onMoveRule`/`onMoveGroup`/`onGroupRule`/`onGroupGroup` may return `true` to proceed, a
|
|
6570
|
+
* falsy value to cancel, or a _replacement query_ to apply instead of the computed one.
|
|
6571
|
+
* - `onRemove` is boolean only.
|
|
6572
|
+
*
|
|
6573
|
+
* @group Query Tools
|
|
6574
|
+
*/
|
|
6575
|
+
interface QueryActionCallbacks {
|
|
6576
|
+
onAddRule?: (rule: RuleType, parentPath: Path, query: any, context?: any) => RuleType | boolean;
|
|
6577
|
+
onAddGroup?: (ruleGroup: any, parentPath: Path, query: any, context?: any) => RuleGroupTypeAny | boolean;
|
|
6578
|
+
onRemove?: (ruleOrGroup: any, path: Path, query: any, context?: any) => boolean;
|
|
6579
|
+
onMoveRule?: (...args: any[]) => RuleGroupTypeAny | boolean;
|
|
6580
|
+
onMoveGroup?: (...args: any[]) => RuleGroupTypeAny | boolean;
|
|
6581
|
+
onGroupRule?: (...args: any[]) => RuleGroupTypeAny | boolean;
|
|
6582
|
+
onGroupGroup?: (...args: any[]) => RuleGroupTypeAny | boolean;
|
|
6583
|
+
}
|
|
6584
|
+
/**
|
|
6585
|
+
* Configuration for {@link createQueryActions}.
|
|
6586
|
+
*
|
|
6587
|
+
* @group Query Tools
|
|
6588
|
+
*/
|
|
6589
|
+
interface QueryActionsConfig extends QueryActionCallbacks {
|
|
6590
|
+
/** Identifier included in every log payload. */
|
|
6591
|
+
qbId?: string;
|
|
6592
|
+
combinators?: OptionList;
|
|
6593
|
+
idGenerator?: () => string;
|
|
6594
|
+
/** The maximum depth at which groups may be added. Defaults to `Infinity`. */
|
|
6595
|
+
maxLevels?: number;
|
|
6596
|
+
/** Abort every mutation, as though the entire query were disabled. */
|
|
6597
|
+
queryDisabled?: boolean;
|
|
6598
|
+
/**
|
|
6599
|
+
* Honor `disabled` properties within the query. Defaults to `true`, matching the
|
|
6600
|
+
* `QueryBuilder` component; a node's own `disabled` property can always be changed.
|
|
6601
|
+
*/
|
|
6602
|
+
respectDisabled?: boolean;
|
|
6603
|
+
/**
|
|
6604
|
+
* Paths disabled by position rather than by a `disabled` property on the node itself, mirroring
|
|
6605
|
+
* the array form of the `QueryBuilder` `disabled` prop. Honored only when `respectDisabled` is
|
|
6606
|
+
* `true`; as with the `disabled` property, a node's own `disabled` can always be changed.
|
|
6607
|
+
*/
|
|
6608
|
+
disabledPaths?: Path[];
|
|
6609
|
+
resetOnFieldChange?: boolean;
|
|
6610
|
+
resetOnOperatorChange?: boolean;
|
|
6611
|
+
getRuleDefaultOperator?: (field: string) => string;
|
|
6612
|
+
getValueSources?: (field: string, operator: string) => ValueSourceFullOptions;
|
|
6613
|
+
getRuleDefaultValue?: (rule: RuleType) => any;
|
|
6614
|
+
getMatchModes?: (field: string) => MatchModeOptions;
|
|
6615
|
+
/**
|
|
6616
|
+
* Set `false` to skip immer's auto-freeze on the queries these handlers return, matching the
|
|
6617
|
+
* option of the same name on the query tools and {@link QueryManager}.
|
|
6618
|
+
*
|
|
6619
|
+
* Deep-freezing throws on the reactive proxies used by signals-based frameworks (Svelte
|
|
6620
|
+
* `$state`, Vue `reactive`), so an adapter whose storage may hand a proxied query to these
|
|
6621
|
+
* handlers has to turn it off.
|
|
6622
|
+
*
|
|
6623
|
+
* @default true
|
|
6624
|
+
*/
|
|
6625
|
+
freeze?: boolean;
|
|
6626
|
+
/** Receives a structured event for every action, applied or aborted. */
|
|
6627
|
+
onLog?: (payload: Record<string, any>) => void;
|
|
6628
|
+
}
|
|
6629
|
+
/**
|
|
6630
|
+
* The six mutations a query builder performs. Each takes the current query and returns the next
|
|
6631
|
+
* one, or `undefined` when the mutation was aborted—because the target is disabled, a
|
|
6632
|
+
* confirmation callback declined, or a depth limit was reached.
|
|
6633
|
+
*
|
|
6634
|
+
* @group Query Tools
|
|
6635
|
+
*/
|
|
6636
|
+
interface QueryActionHandlers {
|
|
6637
|
+
addRule: (query: any, rule: RuleType, parentPath: Path, context?: any) => any;
|
|
6638
|
+
addGroup: (query: any, ruleGroup: any, parentPath: Path, context?: any) => any;
|
|
6639
|
+
propChange: (query: any, prop: UpdateableProperties, value: any, path: Path) => any;
|
|
6640
|
+
removeRuleOrGroup: (query: any, path: Path, context?: any) => any;
|
|
6641
|
+
moveRule: (query: any, oldPath: Path, newPath: Path | "up" | "down", clone?: boolean, context?: any) => any;
|
|
6642
|
+
groupRule: (query: any, sourcePath: Path, targetPath: Path, clone?: boolean, context?: any) => any;
|
|
6643
|
+
}
|
|
6644
|
+
/**
|
|
6645
|
+
* Builds the query builder's six mutation handlers as pure functions of the current query.
|
|
6646
|
+
*
|
|
6647
|
+
* This is the framework-agnostic core of the action handlers in `useQueryBuilderSchema`. It owns
|
|
6648
|
+
* the policy that surrounds the query tools—disabled gating, the confirmation callback protocol,
|
|
6649
|
+
* `maxLevels`, and debug logging—so an implementation only has to supply its own storage: read
|
|
6650
|
+
* the current query, call the action, and apply a non-`undefined` result.
|
|
6651
|
+
*
|
|
6652
|
+
* @group Query Tools
|
|
6653
|
+
*/
|
|
6654
|
+
declare const createQueryActions: (config?: QueryActionsConfig) => QueryActionHandlers;
|
|
6655
|
+
//#endregion
|
|
6243
6656
|
//#region src/utils/regenerateIDs.d.ts
|
|
6244
6657
|
/**
|
|
6245
6658
|
* Options object for {@link regenerateID}/{@link regenerateIDs}.
|
|
@@ -6344,5 +6757,5 @@ declare const unchangedSignature = "";
|
|
|
6344
6757
|
*/
|
|
6345
6758
|
declare const signatureOf: (prev: RuleGroupTypeAny, next: RuleGroupTypeAny) => string;
|
|
6346
6759
|
//#endregion
|
|
6347
|
-
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, DrizzleOperatorsLike, DrizzleWhereCallback, 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, OuterClassNameOptionsBase, ParameterizedNamedSQL, ParameterizedSQL, ParseNumberMethod, ParseNumberOptions, ParseNumbersPropConfig, Path, PathInfo, Placeholder, PrepareOptionListParams, PreparedOptionList, PreparerOptions, QueryActionCallbacks, QueryActionHandlers, QueryActions, QueryActionsConfig, QueryBuilderClassNameState, 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, SequelizeWhereOptionsLike, 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, deriveQueryBuilderClassNames, 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 };
|
|
6760
|
+
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, ControlKey, CreateRuleGroupOptions, CreateRuleOptions, DefaultCombinator, DefaultCombinatorExtended, DefaultCombinatorName, DefaultCombinatorNameExtended, DefaultCombinators, DefaultCombinatorsExtended, DefaultFieldProp, DefaultMatchModes, DefaultOperator, DefaultOperatorName, DefaultOperatorProp, DefaultOperators, DefaultRuleGroupArray, DefaultRuleGroupICArray, DefaultRuleGroupType, DefaultRuleGroupTypeAny, DefaultRuleGroupTypeIC, DefaultRuleOrGroupArray, DefaultRuleType, DeriveClassNamesOptions, DiagnosticEntry, DiagnosticsFieldSummaryEntry, DiagnosticsResult, DiagnosticsStats, DndClassNameState, DndDropTargetType, DragCollection, DraggedItem, DrizzleOperatorsLike, DrizzleWhereCallback, 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, OuterClassNameOptionsBase, ParameterizedNamedSQL, ParameterizedSQL, ParseNumberMethod, ParseNumberOptions, ParseNumbersPropConfig, Path, PathInfo, Placeholder, PrepareOptionListParams, PreparedOptionList, PreparerOptions, QueryActionCallbacks, QueryActionHandlers, QueryActions, QueryActionsConfig, QueryBuilderClassNameState, QueryBuilderFlags, QueryHistoryOptions, QueryManager, QueryManagerError, QueryManagerOptions, QueryNode, QueryToolOptions, 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, SequelizeWhereOptionsLike, StrictOptions, StringUnionToFlexibleOptionArray, StringUnionToFullOptionArray, SubscriptionChange, 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, controlKeys, controlKind, controlPropKeys, 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, deriveQueryBuilderClassNames, 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, optionsEqual, 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, setAutoFreeze, shouldCoalesce, 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, valuesEqual, withParamPrefix, wrapLikeFragment };
|
|
6348
6761
|
//# sourceMappingURL=react-querybuilder_core.production.d.mts.map
|