@react-querybuilder/core 8.22.4 → 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 +2095 -1649
- package/dist/cjs/react-querybuilder_core.cjs.development.js +1295 -424
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +2095 -1649
- 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 -862
- package/dist/formatQuery.d.ts +2 -862
- package/dist/formatQuery.js +122 -142
- package/dist/formatQuery.js.map +1 -1
- package/dist/formatQuery.mjs +10 -30
- 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 +2095 -1649
- package/dist/react-querybuilder_core.legacy-esm.d.ts +2095 -1649
- package/dist/react-querybuilder_core.legacy-esm.js +1447 -637
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +1290 -426
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +2095 -1649
- 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 +34 -23
- 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,7 +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";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
|
5
114
|
//#region ../../node_modules/type-fest/source/primitive.d.ts
|
|
6
115
|
/**
|
|
7
116
|
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
|
@@ -3198,2298 +3307,2263 @@ declare const defaultMaxHistory = 50;
|
|
|
3198
3307
|
*/
|
|
3199
3308
|
declare const defaultCoalesceMs = 500;
|
|
3200
3309
|
//#endregion
|
|
3201
|
-
//#region src/utils/
|
|
3202
|
-
/**
|
|
3203
|
-
* Splits a string by a given character (see {@link defaultJoinChar}). Escaped characters
|
|
3204
|
-
* (characters preceded by a backslash) will not apply to the split, and the backslash will
|
|
3205
|
-
* be removed in the array element. Inverse of {@link joinWith}.
|
|
3206
|
-
*
|
|
3207
|
-
* @example
|
|
3208
|
-
* splitBy('this\\,\\,that,,the other,,,\\,')
|
|
3209
|
-
* // or
|
|
3210
|
-
* splitBy('this\\,\\,that,,the other,,,\\,', ',')
|
|
3211
|
-
* // would return
|
|
3212
|
-
* ['this,,that', '', 'the other', '', '', ',']
|
|
3213
|
-
*/
|
|
3214
|
-
declare const splitBy: (str?: string, splitChar?: string) => string[];
|
|
3310
|
+
//#region src/utils/queryTools.d.ts
|
|
3215
3311
|
/**
|
|
3216
|
-
*
|
|
3217
|
-
*
|
|
3218
|
-
*
|
|
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}.
|
|
3219
3315
|
*
|
|
3220
|
-
*
|
|
3221
|
-
*
|
|
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.
|
|
3222
3318
|
*
|
|
3223
|
-
* @
|
|
3224
|
-
* joinWith(['this,,that', '', 'the other', '', '', ','], ', ')
|
|
3225
|
-
* // would return
|
|
3226
|
-
* 'this\\,\\,that, , the other, , , \\,'
|
|
3227
|
-
*/
|
|
3228
|
-
declare const joinWith: (strArr: unknown[], joinChar?: string) => string;
|
|
3229
|
-
type IsUnknown<T> = unknown extends T ? true : false;
|
|
3230
|
-
type Trimmed<T> = IsUnknown<T> extends true ? string : T;
|
|
3231
|
-
/**
|
|
3232
|
-
* Trims the value if it is a string. Otherwise returns the value as is.
|
|
3233
|
-
*/
|
|
3234
|
-
declare const trimIfString: <T>(val: T) => Trimmed<T>;
|
|
3235
|
-
type ToArrayResult<T> = IsUnknown<T> extends true ? string[] : T extends readonly (infer U)[] ? Trimmed<U>[] : T extends string ? string[] : T extends number ? number[] : never[];
|
|
3236
|
-
/**
|
|
3237
|
-
* Splits a string by comma then trims each element. Arrays are returned as is except
|
|
3238
|
-
* any string elements are trimmed.
|
|
3319
|
+
* @group Query Tools
|
|
3239
3320
|
*/
|
|
3240
|
-
|
|
3241
|
-
retainEmptyStrings?: boolean;
|
|
3242
|
-
}) => 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";
|
|
3243
3322
|
/**
|
|
3244
|
-
*
|
|
3323
|
+
* Details about an aborted query tool operation.
|
|
3324
|
+
*
|
|
3325
|
+
* @group Query Tools
|
|
3245
3326
|
*/
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
//#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
|
+
}
|
|
3255
3335
|
/**
|
|
3256
|
-
*
|
|
3336
|
+
* Options that block a mutation before it is attempted.
|
|
3257
3337
|
*
|
|
3258
|
-
*
|
|
3259
|
-
*
|
|
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.
|
|
3260
3342
|
*
|
|
3261
3343
|
* @group Query Tools
|
|
3262
3344
|
*/
|
|
3263
|
-
|
|
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
|
+
}
|
|
3264
3371
|
/**
|
|
3265
|
-
*
|
|
3266
|
-
*
|
|
3267
|
-
* This function is idempotent: {@link RuleGroupTypeIC} queries will be
|
|
3268
|
-
* returned as-is.
|
|
3372
|
+
* Options for reporting aborted query tool operations.
|
|
3269
3373
|
*
|
|
3270
3374
|
* @group Query Tools
|
|
3271
3375
|
*/
|
|
3272
|
-
|
|
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
|
+
}
|
|
3273
3384
|
/**
|
|
3274
|
-
*
|
|
3275
|
-
* operation, use {@link convertToIC}.
|
|
3385
|
+
* Options shared by every query tool.
|
|
3276
3386
|
*
|
|
3277
3387
|
* @group Query Tools
|
|
3278
3388
|
*/
|
|
3279
|
-
|
|
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
|
+
}
|
|
3280
3399
|
/**
|
|
3281
|
-
*
|
|
3282
|
-
*
|
|
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.
|
|
3283
3405
|
*
|
|
3284
3406
|
* @group Query Tools
|
|
3285
3407
|
*/
|
|
3286
|
-
declare
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
/** Classname keys that have both a standard class and a `controlClassnames` entry. */
|
|
3290
|
-
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;
|
|
3291
3411
|
/**
|
|
3292
|
-
*
|
|
3412
|
+
* Whether adding a group beneath `parentPath` would exceed `maxLevels`.
|
|
3293
3413
|
*
|
|
3294
|
-
*
|
|
3295
|
-
* entry. Set `standardOnly` when the standard class is conditional but no custom class
|
|
3296
|
-
* corresponds to it.
|
|
3414
|
+
* @group Query Tools
|
|
3297
3415
|
*/
|
|
3298
|
-
|
|
3299
|
-
key: StandardClassnameKey;
|
|
3300
|
-
when: (state: S) => boolean | undefined;
|
|
3301
|
-
standardOnly?: boolean;
|
|
3302
|
-
}
|
|
3416
|
+
declare const exceedsMaxLevels: (parentPath: Path | undefined, { maxLevels }?: GuardOptions) => boolean;
|
|
3303
3417
|
/**
|
|
3304
|
-
*
|
|
3305
|
-
*
|
|
3418
|
+
* Options for {@link add}.
|
|
3419
|
+
*
|
|
3420
|
+
* @group Query Tools
|
|
3306
3421
|
*/
|
|
3307
|
-
interface
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
/**
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
disabled?: boolean;
|
|
3326
|
-
muted?: boolean;
|
|
3327
|
-
hasSubQuery?: boolean;
|
|
3328
|
-
}
|
|
3329
|
-
/** State that contributes conditional classnames to the query builder's wrapper element. */
|
|
3330
|
-
interface QueryBuilderClassNameState {
|
|
3331
|
-
disabled?: boolean;
|
|
3332
|
-
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;
|
|
3333
3440
|
}
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
/** The merged `controlClassnames` for the query builder. */
|
|
3337
|
-
classNames: Partial<Classnames> | undefined;
|
|
3338
|
-
/** When `true`, standard (`rule`, `ruleGroup-*`, etc.) classnames are omitted. */
|
|
3339
|
-
suppressStandardClassnames?: boolean;
|
|
3441
|
+
interface AddMethod {
|
|
3442
|
+
<RG extends RuleGroupTypeAny>(query: RG, ruleOrGroup: RG | RuleType, parentPathOrID: Path | string, options?: AddOptions): RG;
|
|
3340
3443
|
}
|
|
3341
3444
|
/**
|
|
3342
|
-
*
|
|
3343
|
-
*
|
|
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.
|
|
3344
3448
|
*
|
|
3345
3449
|
* @group Query Tools
|
|
3346
3450
|
*/
|
|
3347
|
-
declare const
|
|
3451
|
+
declare const add: AddMethod;
|
|
3348
3452
|
/**
|
|
3349
|
-
*
|
|
3350
|
-
*
|
|
3351
|
-
*
|
|
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.
|
|
3352
3456
|
*
|
|
3353
3457
|
* @group Query Tools
|
|
3354
3458
|
*/
|
|
3355
|
-
declare const
|
|
3459
|
+
declare const addInPlace: AddMethod;
|
|
3356
3460
|
/**
|
|
3357
|
-
*
|
|
3358
|
-
* `header`. This is the framework-agnostic core of the `classNames` object returned by the
|
|
3359
|
-
* `useRuleGroup` hook.
|
|
3461
|
+
* Options for {@link update}.
|
|
3360
3462
|
*
|
|
3361
3463
|
* @group Query Tools
|
|
3362
3464
|
*/
|
|
3363
|
-
|
|
3364
|
-
/** Inputs common to every outer (wrapper) classname derivation. */
|
|
3365
|
-
interface OuterClassNameOptionsBase extends DeriveClassNamesOptions {
|
|
3465
|
+
interface UpdateOptions extends QueryToolOptions {
|
|
3366
3466
|
/**
|
|
3367
|
-
*
|
|
3368
|
-
*
|
|
3369
|
-
* 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`.
|
|
3370
3469
|
*/
|
|
3371
|
-
|
|
3372
|
-
/**
|
|
3373
|
-
|
|
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;
|
|
3374
3508
|
}
|
|
3375
|
-
/** Inputs to {@link deriveRuleOuterClassName} and {@link deriveRuleGroupOuterClassName}. */
|
|
3376
|
-
interface OuterClassNameOptions extends OuterClassNameOptionsBase, RuleClassNameState {}
|
|
3377
3509
|
/**
|
|
3378
|
-
*
|
|
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.
|
|
3379
3518
|
*
|
|
3380
3519
|
* @group Query Tools
|
|
3381
3520
|
*/
|
|
3382
|
-
declare const
|
|
3521
|
+
declare const update: UpdateMethod;
|
|
3383
3522
|
/**
|
|
3384
|
-
*
|
|
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.
|
|
3385
3525
|
*
|
|
3386
|
-
*
|
|
3387
|
-
* `dndDropNotAllowed`, and `hasSubQuery` do not apply—so this is not interchangeable with
|
|
3388
|
-
* {@link deriveRuleOuterClassName}.
|
|
3526
|
+
* @returns The query (mutated in place) with the rule or group properties updated.
|
|
3389
3527
|
*
|
|
3390
3528
|
* @group Query Tools
|
|
3391
3529
|
*/
|
|
3392
|
-
declare const
|
|
3530
|
+
declare const updateInPlace: UpdateMethod;
|
|
3393
3531
|
/**
|
|
3394
|
-
*
|
|
3395
|
-
* `disabled`, `valid`, and `invalid` state classes.
|
|
3532
|
+
* Options for {@link remove}.
|
|
3396
3533
|
*
|
|
3397
3534
|
* @group Query Tools
|
|
3398
3535
|
*/
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
/**
|
|
3403
|
-
* This is an example validation function you can pass to {@link react-querybuilder!QueryBuilder QueryBuilder} in the
|
|
3404
|
-
* `validator` prop. It assumes that you want to validate groups, and has a no-op
|
|
3405
|
-
* for validating rules which you can replace with your own implementation.
|
|
3406
|
-
*/
|
|
3407
|
-
declare const defaultValidator: QueryValidator;
|
|
3408
|
-
//#endregion
|
|
3409
|
-
//#region src/utils/deriveRuleContext.d.ts
|
|
3410
|
-
/**
|
|
3411
|
-
* Functions used by {@link deriveRuleContext} to resolve a rule's configuration. Each corresponds
|
|
3412
|
-
* to the `QueryBuilder` prop (or `useQueryBuilderSetup` output) of the same name.
|
|
3413
|
-
*/
|
|
3414
|
-
interface RuleContextResolvers<F extends FullField = FullField> {
|
|
3415
|
-
fields: OptionList<F>;
|
|
3416
|
-
fieldMap: Partial<FullOptionRecord<FullField>>;
|
|
3417
|
-
getInputType: (field: string, operator: string, misc: {
|
|
3418
|
-
fieldData: F;
|
|
3419
|
-
}) => InputType | null;
|
|
3420
|
-
getMatchModes: (field: string, misc: {
|
|
3421
|
-
fieldData: F;
|
|
3422
|
-
}) => MatchModeOptions;
|
|
3423
|
-
getOperators: (field: string, misc: {
|
|
3424
|
-
fieldData: F;
|
|
3425
|
-
}) => OptionList<FullOperator>;
|
|
3426
|
-
getParameters: (field: string, operator: string, misc: {
|
|
3427
|
-
fieldData: F;
|
|
3428
|
-
}) => FlexibleOptionList<Option>;
|
|
3429
|
-
getValueEditorType: (field: string, operator: string, misc: {
|
|
3430
|
-
fieldData: F;
|
|
3431
|
-
}) => ValueEditorType;
|
|
3432
|
-
getValues: (field: string, operator: string, misc: {
|
|
3433
|
-
fieldData: F;
|
|
3434
|
-
}) => FlexibleOptionList<Option>;
|
|
3435
|
-
getValueSources: (field: string, operator: string, misc: {
|
|
3436
|
-
fieldData: F;
|
|
3437
|
-
}) => ValueSourceFullOptions;
|
|
3438
|
-
getSubQueryBuilderProps?: (field: string, misc: {
|
|
3439
|
-
fieldData: F;
|
|
3440
|
-
}) => Record<string, unknown>;
|
|
3441
|
-
}
|
|
3442
|
-
/**
|
|
3443
|
-
* Everything {@link deriveRuleContext} resolves for a single rule.
|
|
3444
|
-
*/
|
|
3445
|
-
interface RuleContext<F extends FullField = FullField> {
|
|
3446
|
-
fieldData: F;
|
|
3447
|
-
hideValueControls: boolean;
|
|
3448
|
-
inputType: InputType | null;
|
|
3449
|
-
matchModes: MatchModeOptions;
|
|
3450
|
-
operatorObject: FullOperator | undefined;
|
|
3451
|
-
operators: OptionList<FullOperator>;
|
|
3452
|
-
parameters: FlexibleOptionList<Option> | null;
|
|
3453
|
-
validationResult: boolean | ValidationResult;
|
|
3454
|
-
valueEditorType: ValueEditorType;
|
|
3455
|
-
values: FlexibleOptionList<Option>;
|
|
3456
|
-
valueSourceOptions: ValueSourceFullOptions;
|
|
3457
|
-
valueSources: ValueSources;
|
|
3458
|
-
subQueryBuilderProps: Record<string, unknown>;
|
|
3536
|
+
interface RemoveOptions extends QueryToolOptions {}
|
|
3537
|
+
interface RemoveMethod {
|
|
3538
|
+
<RG extends RuleGroupTypeAny>(query: RG, pathOrID: Path | string, options?: RemoveOptions): RG;
|
|
3459
3539
|
}
|
|
3460
3540
|
/**
|
|
3461
|
-
*
|
|
3462
|
-
*
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
* The input type for a rule. A field's own `inputType` takes precedence over `getInputType`.
|
|
3467
|
-
*/
|
|
3468
|
-
declare const getRuleInputType: <F extends FullField = FullField>(field: string, operator: string, fieldData: F, getInputType: RuleContextResolvers<F>["getInputType"]) => InputType | null;
|
|
3469
|
-
/**
|
|
3470
|
-
* Whether the value editor(s) should be hidden for an operator, based on its `arity`.
|
|
3471
|
-
*/
|
|
3472
|
-
declare const hideValueControlsForOperator: (operatorObject?: FullOperator) => boolean;
|
|
3473
|
-
/**
|
|
3474
|
-
* The subset of a rule that determines its configuration. Accepting only these properties (rather
|
|
3475
|
-
* than the whole rule) lets React callers keep granular memoization dependencies, so editing a
|
|
3476
|
-
* rule's `value` doesn't recompute its operators, value sources, or option lists.
|
|
3477
|
-
*/
|
|
3478
|
-
type RuleFacet = Pick<RuleType, "field" | "operator" | "valueSource">;
|
|
3479
|
-
/**
|
|
3480
|
-
* Value source options for a rule. A `valueSource` present on the rule but absent from the
|
|
3481
|
-
* configured list is appended, so the current selection is always representable.
|
|
3482
|
-
*/
|
|
3483
|
-
declare const getRuleValueSourceOptions: <F extends FullField = FullField>(rule: RuleFacet, fieldData: F, getValueSources: RuleContextResolvers<F>["getValueSources"]) => ValueSourceFullOptions;
|
|
3484
|
-
/**
|
|
3485
|
-
* Normalizes the result of `getParameters` to a non-empty list or `null`.
|
|
3486
|
-
*/
|
|
3487
|
-
declare const getParametersAsList: (parameters: FlexibleOptionList<Option>) => FlexibleOptionList<Option> | null;
|
|
3488
|
-
/**
|
|
3489
|
-
* The value editor type for a rule. `valueSource: "field"` always uses a select list, and
|
|
3490
|
-
* `valueSource: "parameter"` uses a (multi)select when parameters are available.
|
|
3491
|
-
*/
|
|
3492
|
-
declare const getRuleValueEditorType: <F extends FullField = FullField>(rule: RuleFacet, fieldData: F, parametersAsList: FlexibleOptionList<Option> | null, getValueEditorType: RuleContextResolvers<F>["getValueEditorType"]) => ValueEditorType;
|
|
3493
|
-
/**
|
|
3494
|
-
* The option list presented by a rule's value editor, resolved from its `valueSource`.
|
|
3495
|
-
*/
|
|
3496
|
-
declare const getRuleValues: <F extends FullField = FullField>(rule: RuleFacet, fieldData: F, fields: OptionList<F>, parametersAsList: FlexibleOptionList<Option> | null, getValues: RuleContextResolvers<F>["getValues"]) => FlexibleOptionList<Option>;
|
|
3497
|
-
/**
|
|
3498
|
-
* The validation result for a rule: the entry from a query-level {@link ValidationMap} if present,
|
|
3499
|
-
* 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
|
|
3500
3546
|
*/
|
|
3501
|
-
declare const
|
|
3547
|
+
declare const remove: RemoveMethod;
|
|
3502
3548
|
/**
|
|
3503
|
-
*
|
|
3504
|
-
* its field data, operators, value editor type, value list, value sources, match modes, and
|
|
3505
|
-
* validation result.
|
|
3549
|
+
* Removes a rule or group from a query in place.
|
|
3506
3550
|
*
|
|
3507
|
-
*
|
|
3508
|
-
* {@link QueryManager.getRuleContext} so that non-React implementations derive identical results.
|
|
3509
|
-
* It performs no memoization; callers are responsible for caching as appropriate.
|
|
3551
|
+
* @returns The query (mutated in place) with the rule or group removed.
|
|
3510
3552
|
*
|
|
3511
3553
|
* @group Query Tools
|
|
3512
3554
|
*/
|
|
3513
|
-
declare const
|
|
3514
|
-
validationMap?: ValidationMap;
|
|
3515
|
-
id?: string;
|
|
3516
|
-
}) => RuleContext<F>;
|
|
3555
|
+
declare const removeInPlace: RemoveMethod;
|
|
3517
3556
|
/**
|
|
3518
|
-
*
|
|
3557
|
+
* Options for {@link move}.
|
|
3558
|
+
*
|
|
3559
|
+
* @group Query Tools
|
|
3519
3560
|
*/
|
|
3520
|
-
interface
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
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;
|
|
3528
3579
|
}
|
|
3529
3580
|
/**
|
|
3530
|
-
*
|
|
3531
|
-
*
|
|
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.
|
|
3532
3583
|
*
|
|
3533
|
-
*
|
|
3534
|
-
*
|
|
3584
|
+
* @returns A new query with the rule or group moved or cloned.
|
|
3585
|
+
*
|
|
3586
|
+
* @group Query Tools
|
|
3535
3587
|
*/
|
|
3536
|
-
declare const
|
|
3588
|
+
declare const move: MoveMethod;
|
|
3537
3589
|
/**
|
|
3538
|
-
*
|
|
3539
|
-
*
|
|
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.
|
|
3540
3592
|
*
|
|
3541
|
-
*
|
|
3542
|
-
* 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.
|
|
3543
3594
|
*
|
|
3544
3595
|
* @group Query Tools
|
|
3545
3596
|
*/
|
|
3546
|
-
declare const
|
|
3547
|
-
validationMap?: ValidationMap;
|
|
3548
|
-
id?: string;
|
|
3549
|
-
}) => RuleGroupContext<C>;
|
|
3550
|
-
//#endregion
|
|
3551
|
-
//#region src/utils/deriveValueEditor.d.ts
|
|
3597
|
+
declare const moveInPlace: MoveMethod;
|
|
3552
3598
|
/**
|
|
3553
|
-
*
|
|
3599
|
+
* Options for {@link insert}.
|
|
3554
3600
|
*
|
|
3555
|
-
* @group
|
|
3601
|
+
* @group Query Tools
|
|
3556
3602
|
*/
|
|
3557
|
-
|
|
3558
|
-
/**
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
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
|
+
}
|
|
3582
3639
|
/**
|
|
3583
|
-
*
|
|
3640
|
+
* Inserts a rule or group into a query without mutating the original query.
|
|
3584
3641
|
*
|
|
3585
|
-
*
|
|
3586
|
-
* elements, seeding the second from the first available option. The result is a comma-joined
|
|
3587
|
-
* string unless `listsAsArrays` is `true`.
|
|
3642
|
+
* @returns A new query with the rule or group inserted.
|
|
3588
3643
|
*
|
|
3589
|
-
* @group
|
|
3644
|
+
* @group Query Tools
|
|
3590
3645
|
*/
|
|
3591
|
-
declare const
|
|
3592
|
-
value: unknown;
|
|
3593
|
-
index: number;
|
|
3594
|
-
valueAsArray: unknown[];
|
|
3595
|
-
operator: string;
|
|
3596
|
-
values?: any[];
|
|
3597
|
-
listsAsArrays?: boolean;
|
|
3598
|
-
parseNumberMethod?: ParseNumberMethod;
|
|
3599
|
-
}) => unknown;
|
|
3646
|
+
declare const insert: InsertMethod;
|
|
3600
3647
|
/**
|
|
3601
|
-
*
|
|
3602
|
-
* as one (an empty string or a decimal, for example).
|
|
3648
|
+
* Inserts a rule or group into a query in place.
|
|
3603
3649
|
*
|
|
3604
|
-
* @group
|
|
3605
|
-
*/
|
|
3606
|
-
declare const coerceBigIntValue: (value: unknown, parseNumberMethod?: ParseNumberMethod) => unknown;
|
|
3607
|
-
/**
|
|
3608
|
-
* The `type` attribute an `<input>` should use for a rule. `bigint` values and the `in`/`notIn`
|
|
3609
|
-
* operators (whose value is a comma-separated list) both require a text input.
|
|
3650
|
+
* @returns The query (mutated in place) with the rule or group inserted.
|
|
3610
3651
|
*
|
|
3611
|
-
* @group
|
|
3652
|
+
* @group Query Tools
|
|
3612
3653
|
*/
|
|
3613
|
-
declare const
|
|
3654
|
+
declare const insertInPlace: InsertMethod;
|
|
3614
3655
|
/**
|
|
3615
|
-
*
|
|
3616
|
-
* first, then comma-joined unless `listsAsArrays` is `true`. Single-select values pass through.
|
|
3656
|
+
* Options for {@link group}.
|
|
3617
3657
|
*
|
|
3618
|
-
* @group
|
|
3658
|
+
* @group Query Tools
|
|
3619
3659
|
*/
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
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
|
+
}
|
|
3624
3679
|
/**
|
|
3625
|
-
*
|
|
3626
|
-
*
|
|
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.
|
|
3627
3683
|
*
|
|
3628
|
-
* @
|
|
3629
|
-
*/
|
|
3630
|
-
declare const normalizeValueSelectorValue: (value: unknown, multiple?: boolean) => any;
|
|
3631
|
-
//#endregion
|
|
3632
|
-
//#region src/utils/filterFieldsByComparator.d.ts
|
|
3633
|
-
/**
|
|
3634
|
-
* For a given {@link FullField}, returns the `fields` list filtered for
|
|
3635
|
-
* other fields that match by `comparator`. Only fields *other than the
|
|
3636
|
-
* one in question* will ever be included, even if `comparator` is `null`
|
|
3637
|
-
* or `undefined`. If `comparator` is a string, fields with the same value
|
|
3638
|
-
* for that property will be included. If `comparator` is a function, each
|
|
3639
|
-
* field will be passed to the function along with the `operator` and fields
|
|
3640
|
-
* for which the function returns `true` will be included.
|
|
3684
|
+
* @returns A new query with the rules or groups grouped.
|
|
3641
3685
|
*
|
|
3642
|
-
* @group
|
|
3686
|
+
* @group Query Tools
|
|
3643
3687
|
*/
|
|
3644
|
-
declare const
|
|
3645
|
-
options: WithUnknownIndex<FullField>[];
|
|
3646
|
-
label: string;
|
|
3647
|
-
}[];
|
|
3648
|
-
//#endregion
|
|
3649
|
-
//#region src/utils/formatQuery/defaultRuleProcessorCEL.d.ts
|
|
3688
|
+
declare const group: GroupMethod;
|
|
3650
3689
|
/**
|
|
3651
|
-
*
|
|
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.
|
|
3652
3693
|
*
|
|
3653
|
-
* @
|
|
3694
|
+
* @returns The query (mutated in place) with the rules or groups grouped.
|
|
3695
|
+
*
|
|
3696
|
+
* @group Query Tools
|
|
3654
3697
|
*/
|
|
3655
|
-
declare const
|
|
3698
|
+
declare const groupInPlace: GroupMethod;
|
|
3656
3699
|
//#endregion
|
|
3657
|
-
//#region src/utils/
|
|
3700
|
+
//#region src/utils/abortReasons.d.ts
|
|
3658
3701
|
/**
|
|
3659
|
-
*
|
|
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.
|
|
3660
3705
|
*
|
|
3661
|
-
*
|
|
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.
|
|
3662
3708
|
*
|
|
3663
|
-
* @group
|
|
3709
|
+
* @group Query Tools
|
|
3664
3710
|
*/
|
|
3665
|
-
declare const
|
|
3711
|
+
declare const strictAbortReasons: readonly AbortReason[];
|
|
3666
3712
|
//#endregion
|
|
3667
|
-
//#region src/utils/
|
|
3713
|
+
//#region src/utils/arrayUtils.d.ts
|
|
3668
3714
|
/**
|
|
3669
|
-
*
|
|
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}.
|
|
3670
3718
|
*
|
|
3671
|
-
* @
|
|
3719
|
+
* @example
|
|
3720
|
+
* splitBy('this\\,\\,that,,the other,,,\\,')
|
|
3721
|
+
* // or
|
|
3722
|
+
* splitBy('this\\,\\,that,,the other,,,\\,', ',')
|
|
3723
|
+
* // would return
|
|
3724
|
+
* ['this,,that', '', 'the other', '', '', ',']
|
|
3672
3725
|
*/
|
|
3673
|
-
declare const
|
|
3674
|
-
//#endregion
|
|
3675
|
-
//#region src/utils/formatQuery/defaultValueProcessorByRule.d.ts
|
|
3726
|
+
declare const splitBy: (str?: string, splitChar?: string) => string[];
|
|
3676
3727
|
/**
|
|
3677
|
-
*
|
|
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}.
|
|
3678
3731
|
*
|
|
3679
|
-
*
|
|
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.
|
|
3734
|
+
*
|
|
3735
|
+
* @example
|
|
3736
|
+
* joinWith(['this,,that', '', 'the other', '', '', ','], ', ')
|
|
3737
|
+
* // would return
|
|
3738
|
+
* 'this\\,\\,that, , the other, , , \\,'
|
|
3680
3739
|
*/
|
|
3681
|
-
declare const
|
|
3682
|
-
|
|
3683
|
-
|
|
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;
|
|
3684
3743
|
/**
|
|
3685
|
-
*
|
|
3686
|
-
*
|
|
3687
|
-
* @group Export
|
|
3744
|
+
* Trims the value if it is a string. Otherwise returns the value as is.
|
|
3688
3745
|
*/
|
|
3689
|
-
declare const
|
|
3690
|
-
|
|
3691
|
-
//#region src/utils/formatQuery/defaultRuleGroupProcessorCypher.d.ts
|
|
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[];
|
|
3692
3748
|
/**
|
|
3693
|
-
*
|
|
3694
|
-
*
|
|
3695
|
-
* @group Export
|
|
3749
|
+
* Splits a string by comma then trims each element. Arrays are returned as is except
|
|
3750
|
+
* any string elements are trimmed.
|
|
3696
3751
|
*/
|
|
3697
|
-
declare const
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
};
|
|
3752
|
+
declare const toArray: <T>(a: T, { retainEmptyStrings }?: {
|
|
3753
|
+
retainEmptyStrings?: boolean;
|
|
3754
|
+
}) => ToArrayResult<T>;
|
|
3701
3755
|
/**
|
|
3702
|
-
*
|
|
3703
|
-
*
|
|
3704
|
-
* @group Export
|
|
3756
|
+
* Determines if an array is free of `null`/`undefined`.
|
|
3705
3757
|
*/
|
|
3706
|
-
declare const
|
|
3758
|
+
declare const nullFreeArray: <T>(arr: T[]) => arr is Exclude<T, null>[];
|
|
3707
3759
|
//#endregion
|
|
3708
|
-
//#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
|
|
3709
3767
|
/**
|
|
3710
|
-
*
|
|
3711
|
-
*
|
|
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.
|
|
3712
3772
|
*
|
|
3713
|
-
*
|
|
3714
|
-
*
|
|
3715
|
-
*
|
|
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
|
|
3716
3777
|
*
|
|
3717
|
-
*
|
|
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.
|
|
3718
3780
|
*
|
|
3719
|
-
* @
|
|
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.
|
|
3720
3786
|
*/
|
|
3721
|
-
declare const
|
|
3787
|
+
declare const shouldCoalesce: (prevSig: string | undefined, nextSig: string, prevAt: number, now: number, coalesceMs?: number) => boolean;
|
|
3722
3788
|
//#endregion
|
|
3723
|
-
//#region src/utils/
|
|
3789
|
+
//#region src/utils/convertQuery.d.ts
|
|
3724
3790
|
/**
|
|
3725
|
-
*
|
|
3791
|
+
* Converts a {@link RuleGroupTypeIC} to {@link RuleGroupType}.
|
|
3726
3792
|
*
|
|
3727
|
-
* @
|
|
3793
|
+
* This function is idempotent: {@link RuleGroupType} queries will be
|
|
3794
|
+
* returned as-is.
|
|
3795
|
+
*
|
|
3796
|
+
* @group Query Tools
|
|
3728
3797
|
*/
|
|
3729
|
-
declare const
|
|
3730
|
-
//#endregion
|
|
3731
|
-
//#region src/utils/formatQuery/defaultRuleGroupProcessorGremlin.d.ts
|
|
3798
|
+
declare const convertFromIC: <RG extends RuleGroupTypeAny>(rg: RG) => ToRuleGroupType<RG>;
|
|
3732
3799
|
/**
|
|
3733
|
-
*
|
|
3800
|
+
* Converts a {@link RuleGroupType} to {@link RuleGroupTypeIC}.
|
|
3734
3801
|
*
|
|
3735
|
-
*
|
|
3736
|
-
*
|
|
3737
|
-
* `__` anonymous traversal prefixes.
|
|
3802
|
+
* This function is idempotent: {@link RuleGroupTypeIC} queries will be
|
|
3803
|
+
* returned as-is.
|
|
3738
3804
|
*
|
|
3739
|
-
* @group
|
|
3805
|
+
* @group Query Tools
|
|
3740
3806
|
*/
|
|
3741
|
-
declare const
|
|
3742
|
-
//#endregion
|
|
3743
|
-
//#region src/utils/formatQuery/defaultRuleGroupProcessorJSONata.d.ts
|
|
3807
|
+
declare const convertToIC: <RG extends RuleGroupTypeAny>(rg: RG) => ToRuleGroupTypeIC<RG>;
|
|
3744
3808
|
/**
|
|
3745
|
-
*
|
|
3809
|
+
* Converts a {@link RuleGroupType} to {@link RuleGroupTypeIC}. For a more explicit
|
|
3810
|
+
* operation, use {@link convertToIC}.
|
|
3746
3811
|
*
|
|
3747
|
-
* @group
|
|
3812
|
+
* @group Query Tools
|
|
3748
3813
|
*/
|
|
3749
|
-
declare
|
|
3750
|
-
//#endregion
|
|
3751
|
-
//#region src/utils/formatQuery/defaultRuleGroupProcessorJsonLogic.d.ts
|
|
3814
|
+
declare function convertQuery(query: RuleGroupType): RuleGroupTypeIC;
|
|
3752
3815
|
/**
|
|
3753
|
-
*
|
|
3816
|
+
* Converts a {@link RuleGroupTypeIC} to {@link RuleGroupType}. For a more explicit
|
|
3817
|
+
* operation, use {@link convertFromIC}.
|
|
3754
3818
|
*
|
|
3755
|
-
* @group
|
|
3819
|
+
* @group Query Tools
|
|
3756
3820
|
*/
|
|
3757
|
-
declare
|
|
3821
|
+
declare function convertQuery(query: RuleGroupTypeIC): RuleGroupType;
|
|
3758
3822
|
//#endregion
|
|
3759
|
-
//#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;
|
|
3760
3826
|
/**
|
|
3761
|
-
*
|
|
3827
|
+
* A classname applied only when `when` returns true for the current state.
|
|
3762
3828
|
*
|
|
3763
|
-
*
|
|
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.
|
|
3764
3832
|
*/
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3833
|
+
interface ClassnameCondition<S> {
|
|
3834
|
+
key: StandardClassnameKey;
|
|
3835
|
+
when: (state: S) => boolean | undefined;
|
|
3836
|
+
standardOnly?: boolean;
|
|
3837
|
+
}
|
|
3768
3838
|
/**
|
|
3769
|
-
*
|
|
3770
|
-
*
|
|
3771
|
-
* Note that the "mongodb" format is deprecated in favor of the "mongodb_query" format.
|
|
3772
|
-
*
|
|
3773
|
-
* @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.
|
|
3774
3841
|
*/
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
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
|
+
}
|
|
3778
3876
|
/**
|
|
3779
|
-
*
|
|
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.
|
|
3780
3879
|
*
|
|
3781
|
-
* @group
|
|
3880
|
+
* @group Query Tools
|
|
3782
3881
|
*/
|
|
3783
|
-
declare const
|
|
3784
|
-
readonly $and: readonly [{
|
|
3785
|
-
readonly $expr: true;
|
|
3786
|
-
}];
|
|
3787
|
-
};
|
|
3882
|
+
declare const deriveRuleClassNames: (options: DeriveClassNamesOptions) => Record<RuleClassnameKey, string>;
|
|
3788
3883
|
/**
|
|
3789
|
-
*
|
|
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.
|
|
3790
3887
|
*
|
|
3791
|
-
* @group
|
|
3888
|
+
* @group Query Tools
|
|
3792
3889
|
*/
|
|
3793
|
-
declare const
|
|
3794
|
-
//#endregion
|
|
3795
|
-
//#region src/utils/formatQuery/defaultRuleGroupProcessorNL.d.ts
|
|
3890
|
+
declare const deriveRuleClassName: (key: RuleClassnameKey, options: DeriveClassNamesOptions) => string;
|
|
3796
3891
|
/**
|
|
3797
|
-
*
|
|
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.
|
|
3798
3895
|
*
|
|
3799
|
-
* @group
|
|
3896
|
+
* @group Query Tools
|
|
3800
3897
|
*/
|
|
3801
|
-
declare const
|
|
3802
|
-
|
|
3803
|
-
|
|
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 {}
|
|
3804
3912
|
/**
|
|
3805
|
-
*
|
|
3806
|
-
* "parameterized_named" formats.
|
|
3913
|
+
* The outer (wrapper) classname for a rule, including every conditional state class.
|
|
3807
3914
|
*
|
|
3808
|
-
* @group
|
|
3915
|
+
* @group Query Tools
|
|
3809
3916
|
*/
|
|
3810
|
-
declare const
|
|
3811
|
-
//#endregion
|
|
3812
|
-
//#region src/utils/formatQuery/defaultRuleGroupProcessorPrisma.d.ts
|
|
3917
|
+
declare const deriveRuleOuterClassName: (options: OuterClassNameOptions) => string;
|
|
3813
3918
|
/**
|
|
3814
|
-
*
|
|
3919
|
+
* The outer (wrapper) classname for a rule group, including every conditional state class.
|
|
3815
3920
|
*
|
|
3816
|
-
*
|
|
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
|
|
3817
3926
|
*/
|
|
3818
|
-
declare const
|
|
3927
|
+
declare const deriveRuleGroupOuterClassName: (options: OuterClassNameOptions) => string;
|
|
3819
3928
|
/**
|
|
3820
|
-
*
|
|
3929
|
+
* The outer (wrapper) classname for the query builder itself, including the conditional
|
|
3930
|
+
* `disabled`, `valid`, and `invalid` state classes.
|
|
3821
3931
|
*
|
|
3822
|
-
* @group
|
|
3932
|
+
* @group Query Tools
|
|
3823
3933
|
*/
|
|
3824
|
-
declare const
|
|
3934
|
+
declare const deriveQueryBuilderClassNames: (options: OuterClassNameOptionsBase & QueryBuilderClassNameState) => string;
|
|
3825
3935
|
//#endregion
|
|
3826
|
-
//#region src/utils/
|
|
3936
|
+
//#region src/utils/defaultValidator.d.ts
|
|
3827
3937
|
/**
|
|
3828
|
-
*
|
|
3829
|
-
*
|
|
3830
|
-
*
|
|
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.
|
|
3831
3941
|
*/
|
|
3832
|
-
declare const
|
|
3942
|
+
declare const defaultValidator: QueryValidator;
|
|
3833
3943
|
//#endregion
|
|
3834
|
-
//#region src/utils/
|
|
3944
|
+
//#region src/utils/deriveRuleContext.d.ts
|
|
3835
3945
|
/**
|
|
3836
|
-
*
|
|
3837
|
-
*
|
|
3838
|
-
* SPARQL uses the same combinators as CEL (`&&` / `||`) and `!()` for negation.
|
|
3839
|
-
*
|
|
3840
|
-
* @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.
|
|
3841
3948
|
*/
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
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
|
+
}
|
|
3845
3977
|
/**
|
|
3846
|
-
*
|
|
3847
|
-
*
|
|
3848
|
-
* @group Export
|
|
3978
|
+
* Everything {@link deriveRuleContext} resolves for a single rule.
|
|
3849
3979
|
*/
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
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
|
+
}
|
|
3853
3995
|
/**
|
|
3854
|
-
*
|
|
3855
|
-
*
|
|
3856
|
-
* @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.
|
|
3857
3998
|
*/
|
|
3858
|
-
declare const
|
|
3859
|
-
//#endregion
|
|
3860
|
-
//#region src/utils/formatQuery/tanStackDbTypes.d.ts
|
|
3861
|
-
type TanStackDbWhereCallbackReturnType = ReturnType<typeof eq>;
|
|
3862
|
-
type TanStackDbWhereCallback = (refs: Record<string, unknown>) => TanStackDbWhereCallbackReturnType;
|
|
3863
|
-
//#endregion
|
|
3864
|
-
//#region src/utils/formatQuery/defaultRuleGroupProcessorTanStackDB.d.ts
|
|
3999
|
+
declare const getFieldData: (field: string, fieldMap: Partial<FullOptionRecord<FullField>>) => FullField;
|
|
3865
4000
|
/**
|
|
3866
|
-
*
|
|
3867
|
-
* Returns a `WhereCallback` suitable for TanStack DB's `.where()` method.
|
|
3868
|
-
*
|
|
3869
|
-
* @example
|
|
3870
|
-
* const where = formatQuery(query, { format: 'tanstack_db', context: { tanstackDb: tsdb } });
|
|
3871
|
-
* const results = useLiveQuery(q => q.from({ todo: todosCollection }).where(where));
|
|
3872
|
-
*
|
|
3873
|
-
* @group Export
|
|
4001
|
+
* The input type for a rule. A field's own `inputType` takes precedence over `getInputType`.
|
|
3874
4002
|
*/
|
|
3875
|
-
declare const
|
|
3876
|
-
//#endregion
|
|
3877
|
-
//#region src/utils/formatQuery/defaultRuleGroupProcessorDiagnostics.d.ts
|
|
4003
|
+
declare const getRuleInputType: <F extends FullField = FullField>(field: string, operator: string, fieldData: F, getInputType: RuleContextResolvers<F>["getInputType"]) => InputType | null;
|
|
3878
4004
|
/**
|
|
3879
|
-
*
|
|
3880
|
-
*
|
|
3881
|
-
* Produces a {@link DiagnosticsResult} containing an annotated copy of the query
|
|
3882
|
-
* tree (`query`) with `valid`, `reasons`, `path`, and `level` properties on every
|
|
3883
|
-
* rule and group; a flat `diagnostics` array; aggregate `stats`; and a per-field
|
|
3884
|
-
* `fieldSummary`.
|
|
3885
|
-
*
|
|
3886
|
-
* @group Export
|
|
4005
|
+
* Whether the value editor(s) should be hidden for an operator, based on its `arity`.
|
|
3887
4006
|
*/
|
|
3888
|
-
declare const
|
|
3889
|
-
//#endregion
|
|
3890
|
-
//#region src/utils/formatQuery/defaultRuleProcessorCypher.d.ts
|
|
4007
|
+
declare const hideValueControlsForOperator: (operatorObject?: FullOperator) => boolean;
|
|
3891
4008
|
/**
|
|
3892
|
-
*
|
|
3893
|
-
*
|
|
3894
|
-
*
|
|
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.
|
|
3895
4012
|
*/
|
|
3896
|
-
|
|
3897
|
-
//#endregion
|
|
3898
|
-
//#region src/utils/formatQuery/defaultRuleProcessorDrizzle.d.ts
|
|
4013
|
+
type RuleFacet = Pick<RuleType, "field" | "operator" | "valueSource">;
|
|
3899
4014
|
/**
|
|
3900
|
-
*
|
|
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.
|
|
4017
|
+
*/
|
|
4018
|
+
declare const getRuleValueSourceOptions: <F extends FullField = FullField>(rule: RuleFacet, fieldData: F, getValueSources: RuleContextResolvers<F>["getValueSources"]) => ValueSourceFullOptions;
|
|
4019
|
+
/**
|
|
4020
|
+
* Normalizes the result of `getParameters` to a non-empty list or `null`.
|
|
4021
|
+
*/
|
|
4022
|
+
declare const getParametersAsList: (parameters: FlexibleOptionList<Option>) => FlexibleOptionList<Option> | null;
|
|
4023
|
+
/**
|
|
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.
|
|
3901
4041
|
*
|
|
3902
|
-
*
|
|
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.
|
|
4045
|
+
*
|
|
4046
|
+
* @group Query Tools
|
|
3903
4047
|
*/
|
|
3904
|
-
declare const
|
|
3905
|
-
|
|
3906
|
-
|
|
4048
|
+
declare const deriveRuleContext: <F extends FullField = FullField>(rule: RuleType, resolvers: RuleContextResolvers<F>, options?: {
|
|
4049
|
+
validationMap?: ValidationMap;
|
|
4050
|
+
id?: string;
|
|
4051
|
+
}) => RuleContext<F>;
|
|
3907
4052
|
/**
|
|
3908
|
-
*
|
|
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).
|
|
3909
4067
|
*
|
|
3910
|
-
*
|
|
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.
|
|
3911
4070
|
*/
|
|
3912
|
-
declare const
|
|
3913
|
-
//#endregion
|
|
3914
|
-
//#region src/utils/formatQuery/defaultRuleProcessorGremlin.d.ts
|
|
4071
|
+
declare const getRuleGroupCombinator: <C extends FullCombinator = FullCombinator>(ruleGroup: RuleGroupTypeAny, combinators: FullOptionList<C>) => string;
|
|
3915
4072
|
/**
|
|
3916
|
-
*
|
|
4073
|
+
* Resolves everything about a rule group that depends on the combinator configuration, plus its
|
|
4074
|
+
* validation result.
|
|
3917
4075
|
*
|
|
3918
|
-
*
|
|
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}.
|
|
3919
4078
|
*
|
|
3920
|
-
* @group
|
|
4079
|
+
* @group Query Tools
|
|
3921
4080
|
*/
|
|
3922
|
-
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>;
|
|
3923
4085
|
//#endregion
|
|
3924
|
-
//#region src/utils/
|
|
4086
|
+
//#region src/utils/deriveValueEditor.d.ts
|
|
3925
4087
|
/**
|
|
3926
|
-
*
|
|
4088
|
+
* Whether an operator's value is a list of two bounds.
|
|
3927
4089
|
*
|
|
3928
|
-
* @group
|
|
4090
|
+
* @group Value Editors
|
|
3929
4091
|
*/
|
|
3930
|
-
declare const
|
|
3931
|
-
//#endregion
|
|
3932
|
-
//#region src/utils/formatQuery/defaultRuleProcessorJsonLogic.d.ts
|
|
4092
|
+
declare const isBetweenOperator: (operator: string) => boolean;
|
|
3933
4093
|
/**
|
|
3934
|
-
*
|
|
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.
|
|
3935
4096
|
*
|
|
3936
|
-
*
|
|
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.
|
|
4101
|
+
*
|
|
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
|
|
3937
4106
|
*/
|
|
3938
|
-
declare const
|
|
3939
|
-
|
|
3940
|
-
|
|
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
|
+
};
|
|
3941
4117
|
/**
|
|
3942
|
-
*
|
|
4118
|
+
* Produces the next value for a series of value editors when the editor at `index` changes.
|
|
3943
4119
|
*
|
|
3944
|
-
*
|
|
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`.
|
|
4123
|
+
*
|
|
4124
|
+
* @group Value Editors
|
|
3945
4125
|
*/
|
|
3946
|
-
declare const
|
|
3947
|
-
|
|
3948
|
-
|
|
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;
|
|
3949
4135
|
/**
|
|
3950
|
-
*
|
|
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).
|
|
3951
4138
|
*
|
|
3952
|
-
* @group
|
|
4139
|
+
* @group Value Editors
|
|
3953
4140
|
*/
|
|
3954
|
-
declare const
|
|
3955
|
-
//#endregion
|
|
3956
|
-
//#region src/utils/formatQuery/defaultRuleProcessorNL.d.ts
|
|
4141
|
+
declare const coerceBigIntValue: (value: unknown, parseNumberMethod?: ParseNumberMethod) => unknown;
|
|
3957
4142
|
/**
|
|
3958
|
-
*
|
|
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.
|
|
3959
4145
|
*
|
|
3960
|
-
* @group
|
|
4146
|
+
* @group Value Editors
|
|
3961
4147
|
*/
|
|
3962
|
-
declare const
|
|
4148
|
+
declare const coerceInputType: (inputType: InputType | null | undefined, operator: string) => InputType;
|
|
3963
4149
|
/**
|
|
3964
|
-
*
|
|
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.
|
|
3965
4152
|
*
|
|
3966
|
-
* @group
|
|
4153
|
+
* @group Value Editors
|
|
3967
4154
|
*/
|
|
3968
|
-
declare const
|
|
4155
|
+
declare const getValueSelectorUpdate: (value: string | string[], { multiple, listsAsArrays }?: {
|
|
4156
|
+
multiple?: boolean;
|
|
4157
|
+
listsAsArrays?: boolean;
|
|
4158
|
+
}) => string | string[];
|
|
3969
4159
|
/**
|
|
3970
|
-
*
|
|
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"]`).
|
|
3971
4162
|
*
|
|
3972
|
-
* @group
|
|
4163
|
+
* @group Value Editors
|
|
3973
4164
|
*/
|
|
3974
|
-
declare const
|
|
4165
|
+
declare const normalizeValueSelectorValue: (value: unknown, multiple?: boolean) => any;
|
|
3975
4166
|
//#endregion
|
|
3976
|
-
//#region src/utils/
|
|
4167
|
+
//#region src/utils/filterFieldsByComparator.d.ts
|
|
3977
4168
|
/**
|
|
3978
|
-
*
|
|
3979
|
-
*
|
|
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.
|
|
3980
4176
|
*
|
|
3981
|
-
* @group
|
|
4177
|
+
* @group Option Lists
|
|
3982
4178
|
*/
|
|
3983
|
-
declare const
|
|
4179
|
+
declare const filterFieldsByComparator: (field: FullField, fields: OptionList<FullField>, operator: string) => FullField[] | {
|
|
4180
|
+
options: WithUnknownIndex<FullField>[];
|
|
4181
|
+
label: string;
|
|
4182
|
+
}[];
|
|
3984
4183
|
//#endregion
|
|
3985
|
-
//#region src/utils/formatQuery/
|
|
4184
|
+
//#region src/utils/formatQuery/defaultRuleProcessorCEL.d.ts
|
|
3986
4185
|
/**
|
|
3987
|
-
* Default rule processor used by {@link formatQuery} for "
|
|
4186
|
+
* Default rule processor used by {@link formatQuery} for "cel" format.
|
|
3988
4187
|
*
|
|
3989
4188
|
* @group Export
|
|
3990
4189
|
*/
|
|
3991
|
-
declare const
|
|
4190
|
+
declare const defaultRuleProcessorCEL: RuleProcessor;
|
|
3992
4191
|
//#endregion
|
|
3993
|
-
//#region src/utils/formatQuery/
|
|
4192
|
+
//#region src/utils/formatQuery/defaultRuleProcessorMongoDB.d.ts
|
|
3994
4193
|
/**
|
|
3995
|
-
* 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.
|
|
3996
4197
|
*
|
|
3997
4198
|
* @group Export
|
|
3998
4199
|
*/
|
|
3999
|
-
declare const
|
|
4200
|
+
declare const defaultRuleProcessorMongoDB: RuleProcessor;
|
|
4000
4201
|
//#endregion
|
|
4001
|
-
//#region src/utils/formatQuery/
|
|
4002
|
-
/**
|
|
4202
|
+
//#region src/utils/formatQuery/defaultRuleProcessorSpEL.d.ts
|
|
4203
|
+
/**
|
|
4204
|
+
* Default rule processor used by {@link formatQuery} for "spel" format.
|
|
4003
4205
|
*
|
|
4004
4206
|
* @group Export
|
|
4005
4207
|
*/
|
|
4006
|
-
declare const
|
|
4208
|
+
declare const defaultRuleProcessorSpEL: RuleProcessor;
|
|
4209
|
+
//#endregion
|
|
4210
|
+
//#region src/utils/formatQuery/defaultValueProcessorByRule.d.ts
|
|
4007
4211
|
/**
|
|
4008
|
-
* Default
|
|
4212
|
+
* Default value processor used by {@link formatQuery} for "sql" format.
|
|
4009
4213
|
*
|
|
4010
4214
|
* @group Export
|
|
4011
4215
|
*/
|
|
4012
|
-
declare const
|
|
4216
|
+
declare const defaultValueProcessorByRule: ValueProcessorByRule;
|
|
4013
4217
|
//#endregion
|
|
4014
|
-
//#region src/utils/formatQuery/
|
|
4218
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorCEL.d.ts
|
|
4015
4219
|
/**
|
|
4016
|
-
*
|
|
4220
|
+
* Rule group processor used by {@link formatQuery} for "cel" format.
|
|
4017
4221
|
*
|
|
4018
4222
|
* @group Export
|
|
4019
4223
|
*/
|
|
4020
|
-
declare const
|
|
4224
|
+
declare const defaultRuleGroupProcessorCEL: RuleGroupProcessor<string>;
|
|
4225
|
+
//#endregion
|
|
4226
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorCypher.d.ts
|
|
4021
4227
|
/**
|
|
4022
|
-
*
|
|
4228
|
+
* Maps a {@link DefaultCombinatorName} to a Cypher combinator keyword.
|
|
4023
4229
|
*
|
|
4024
4230
|
* @group Export
|
|
4025
4231
|
*/
|
|
4026
|
-
declare const
|
|
4027
|
-
|
|
4028
|
-
|
|
4232
|
+
declare const cypherCombinatorMap: {
|
|
4233
|
+
and: "AND";
|
|
4234
|
+
or: "OR";
|
|
4235
|
+
};
|
|
4029
4236
|
/**
|
|
4030
|
-
*
|
|
4237
|
+
* Rule group processor used by {@link formatQuery} for "cypher" and "gql" formats.
|
|
4031
4238
|
*
|
|
4032
4239
|
* @group Export
|
|
4033
4240
|
*/
|
|
4034
|
-
declare const
|
|
4241
|
+
declare const defaultRuleGroupProcessorCypher: RuleGroupProcessor<string>;
|
|
4035
4242
|
//#endregion
|
|
4036
|
-
//#region src/utils/formatQuery/
|
|
4243
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorDrizzle.d.ts
|
|
4037
4244
|
/**
|
|
4038
|
-
*
|
|
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`.)
|
|
4039
4248
|
*
|
|
4040
4249
|
* @group Export
|
|
4041
4250
|
*/
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4251
|
+
interface DrizzleOperatorsLike {
|
|
4252
|
+
and: (...conditions: any[]) => any;
|
|
4253
|
+
or: (...conditions: any[]) => any;
|
|
4254
|
+
not: (...conditions: any[]) => any;
|
|
4255
|
+
}
|
|
4045
4256
|
/**
|
|
4046
|
-
*
|
|
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.
|
|
4047
4260
|
*
|
|
4048
4261
|
* @group Export
|
|
4049
4262
|
*/
|
|
4050
|
-
|
|
4263
|
+
type DrizzleWhereCallback = <Ops extends DrizzleOperatorsLike>(columns: object, drizzleOperators: Ops) => ReturnType<Ops["and"]>;
|
|
4051
4264
|
/**
|
|
4052
|
-
*
|
|
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.
|
|
4267
|
+
*
|
|
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.
|
|
4053
4273
|
*
|
|
4054
4274
|
* @group Export
|
|
4055
4275
|
*/
|
|
4056
|
-
declare const
|
|
4276
|
+
declare const defaultRuleGroupProcessorDrizzle: RuleGroupProcessor<DrizzleWhereCallback>;
|
|
4277
|
+
//#endregion
|
|
4278
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorElasticSearch.d.ts
|
|
4057
4279
|
/**
|
|
4058
|
-
*
|
|
4280
|
+
* Rule group processor used by {@link formatQuery} for "elasticsearch" format.
|
|
4059
4281
|
*
|
|
4060
4282
|
* @group Export
|
|
4061
4283
|
*/
|
|
4062
|
-
declare
|
|
4284
|
+
declare const defaultRuleGroupProcessorElasticSearch: RuleGroupProcessor<Record<string, unknown>>;
|
|
4285
|
+
//#endregion
|
|
4286
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorGremlin.d.ts
|
|
4063
4287
|
/**
|
|
4064
|
-
*
|
|
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.
|
|
4065
4293
|
*
|
|
4066
4294
|
* @group Export
|
|
4067
4295
|
*/
|
|
4068
|
-
declare
|
|
4069
|
-
|
|
4070
|
-
|
|
4296
|
+
declare const defaultRuleGroupProcessorGremlin: RuleGroupProcessor<string>;
|
|
4297
|
+
//#endregion
|
|
4298
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorJSONata.d.ts
|
|
4071
4299
|
/**
|
|
4072
|
-
*
|
|
4300
|
+
* Rule group processor used by {@link formatQuery} for "jsonata" format.
|
|
4073
4301
|
*
|
|
4074
4302
|
* @group Export
|
|
4075
4303
|
*/
|
|
4076
|
-
declare
|
|
4077
|
-
|
|
4078
|
-
|
|
4304
|
+
declare const defaultRuleGroupProcessorJSONata: RuleGroupProcessor<string>;
|
|
4305
|
+
//#endregion
|
|
4306
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorJsonLogic.d.ts
|
|
4079
4307
|
/**
|
|
4080
|
-
*
|
|
4308
|
+
* Rule group processor used by {@link formatQuery} for "jsonlogic" format.
|
|
4081
4309
|
*
|
|
4082
4310
|
* @group Export
|
|
4083
4311
|
*/
|
|
4084
|
-
declare
|
|
4085
|
-
|
|
4086
|
-
|
|
4312
|
+
declare const defaultRuleGroupProcessorJsonLogic: RuleGroupProcessor<RQBJsonLogic>;
|
|
4313
|
+
//#endregion
|
|
4314
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorLDAP.d.ts
|
|
4087
4315
|
/**
|
|
4088
|
-
*
|
|
4316
|
+
* Rule group processor used by {@link formatQuery} for "ldap" format.
|
|
4089
4317
|
*
|
|
4090
4318
|
* @group Export
|
|
4091
4319
|
*/
|
|
4092
|
-
declare
|
|
4093
|
-
|
|
4094
|
-
|
|
4320
|
+
declare const defaultRuleGroupProcessorLDAP: RuleGroupProcessor<string>;
|
|
4321
|
+
//#endregion
|
|
4322
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorMongoDB.d.ts
|
|
4095
4323
|
/**
|
|
4096
|
-
*
|
|
4324
|
+
* Rule group processor used by {@link formatQuery} for "mongodb" format.
|
|
4097
4325
|
*
|
|
4098
|
-
*
|
|
4099
|
-
* You may have better results exporting "sql" format then using
|
|
4100
|
-
* [ElasticSearch SQL](https://www.elastic.co/guide/en/elasticsearch/reference/current/xpack-sql.html).
|
|
4326
|
+
* Note that the "mongodb" format is deprecated in favor of the "mongodb_query" format.
|
|
4101
4327
|
*
|
|
4102
4328
|
* @group Export
|
|
4103
4329
|
*/
|
|
4104
|
-
declare
|
|
4105
|
-
|
|
4106
|
-
|
|
4330
|
+
declare const defaultRuleGroupProcessorMongoDB: RuleGroupProcessor<string>;
|
|
4331
|
+
//#endregion
|
|
4332
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorMongoDBQuery.d.ts
|
|
4107
4333
|
/**
|
|
4108
|
-
*
|
|
4109
|
-
*
|
|
4110
|
-
* This is equivalent to the "mongodb" format, but returns a JSON object
|
|
4111
|
-
* instead of a string.
|
|
4334
|
+
* Default fallback object used by {@link formatQuery} for "mongodb_query" format.
|
|
4112
4335
|
*
|
|
4113
4336
|
* @group Export
|
|
4114
4337
|
*/
|
|
4115
|
-
declare
|
|
4116
|
-
|
|
4117
|
-
|
|
4338
|
+
declare const mongoDbFallback: {
|
|
4339
|
+
readonly $and: readonly [{
|
|
4340
|
+
readonly $expr: true;
|
|
4341
|
+
}];
|
|
4342
|
+
};
|
|
4118
4343
|
/**
|
|
4119
|
-
*
|
|
4120
|
-
*
|
|
4121
|
-
* This is equivalent to the "mongodb_query" format, but returns a string
|
|
4122
|
-
* instead of a JSON object.
|
|
4123
|
-
*
|
|
4124
|
-
* @deprecated Use the "mongodb_query" format for greater flexibility.
|
|
4344
|
+
* Rule group processor used by {@link formatQuery} for "mongodb_query" format.
|
|
4125
4345
|
*
|
|
4126
4346
|
* @group Export
|
|
4127
4347
|
*/
|
|
4128
|
-
declare
|
|
4129
|
-
|
|
4130
|
-
|
|
4348
|
+
declare const defaultRuleGroupProcessorMongoDBQuery: RuleGroupProcessor;
|
|
4349
|
+
//#endregion
|
|
4350
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorNL.d.ts
|
|
4131
4351
|
/**
|
|
4132
|
-
*
|
|
4352
|
+
* Rule group processor used by {@link formatQuery} for "natural_language" format.
|
|
4133
4353
|
*
|
|
4134
4354
|
* @group Export
|
|
4135
4355
|
*/
|
|
4136
|
-
declare
|
|
4137
|
-
|
|
4138
|
-
|
|
4356
|
+
declare const defaultRuleGroupProcessorNL: RuleGroupProcessor<string>;
|
|
4357
|
+
//#endregion
|
|
4358
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorParameterized.d.ts
|
|
4139
4359
|
/**
|
|
4140
|
-
*
|
|
4141
|
-
*
|
|
4360
|
+
* Rule group processor used by {@link formatQuery} for "parameterized" and
|
|
4361
|
+
* "parameterized_named" formats.
|
|
4142
4362
|
*
|
|
4143
4363
|
* @group Export
|
|
4144
4364
|
*/
|
|
4145
|
-
declare
|
|
4146
|
-
|
|
4147
|
-
|
|
4365
|
+
declare const defaultRuleGroupProcessorParameterized: RuleGroupProcessor<ParameterizedSQL | ParameterizedNamedSQL>;
|
|
4366
|
+
//#endregion
|
|
4367
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorPrisma.d.ts
|
|
4148
4368
|
/**
|
|
4149
|
-
*
|
|
4150
|
-
* be passed directly to TanStack DB's `.where()` method.
|
|
4369
|
+
* Default fallback object used by {@link formatQuery} for "prisma" format.
|
|
4151
4370
|
*
|
|
4152
4371
|
* @group Export
|
|
4153
4372
|
*/
|
|
4154
|
-
declare
|
|
4155
|
-
format: "tanstack_db";
|
|
4156
|
-
})): ReturnType<typeof defaultRuleGroupProcessorTanStackDB>;
|
|
4373
|
+
declare const prismaFallback: {};
|
|
4157
4374
|
/**
|
|
4158
|
-
*
|
|
4375
|
+
* Rule group processor used by {@link formatQuery} for "prisma" format.
|
|
4159
4376
|
*
|
|
4160
4377
|
* @group Export
|
|
4161
4378
|
*/
|
|
4162
|
-
declare
|
|
4163
|
-
|
|
4164
|
-
|
|
4379
|
+
declare const defaultRuleGroupProcessorPrisma: RuleGroupProcessor<Record<string, unknown> | undefined>;
|
|
4380
|
+
//#endregion
|
|
4381
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorSequelize.d.ts
|
|
4165
4382
|
/**
|
|
4166
|
-
*
|
|
4167
|
-
*
|
|
4168
|
-
*
|
|
4169
|
-
*
|
|
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 })`.
|
|
4170
4387
|
*
|
|
4171
4388
|
* @group Export
|
|
4172
4389
|
*/
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
}
|
|
4390
|
+
interface SequelizeWhereOptionsLike {
|
|
4391
|
+
[key: string | symbol]: unknown;
|
|
4392
|
+
}
|
|
4176
4393
|
/**
|
|
4177
|
-
*
|
|
4394
|
+
* Rule group processor used by {@link formatQuery} for "sequelize" format.
|
|
4178
4395
|
*
|
|
4179
4396
|
* @group Export
|
|
4180
4397
|
*/
|
|
4181
|
-
declare
|
|
4182
|
-
|
|
4183
|
-
|
|
4398
|
+
declare const defaultRuleGroupProcessorSequelize: RuleGroupProcessor<SequelizeWhereOptionsLike | undefined>;
|
|
4399
|
+
//#endregion
|
|
4400
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorSPARQL.d.ts
|
|
4184
4401
|
/**
|
|
4185
|
-
*
|
|
4186
|
-
*
|
|
4402
|
+
* Rule group processor used by {@link formatQuery} for "sparql" format.
|
|
4403
|
+
*
|
|
4404
|
+
* SPARQL uses the same combinators as CEL (`&&` / `||`) and `!()` for negation.
|
|
4187
4405
|
*
|
|
4188
4406
|
* @group Export
|
|
4189
4407
|
*/
|
|
4190
|
-
declare
|
|
4191
|
-
|
|
4192
|
-
|
|
4408
|
+
declare const defaultRuleGroupProcessorSPARQL: RuleGroupProcessor<string>;
|
|
4409
|
+
//#endregion
|
|
4410
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorSpEL.d.ts
|
|
4193
4411
|
/**
|
|
4194
|
-
*
|
|
4412
|
+
* Default rule processor used by {@link formatQuery} for "spel" format.
|
|
4195
4413
|
*
|
|
4196
4414
|
* @group Export
|
|
4197
4415
|
*/
|
|
4198
|
-
declare
|
|
4416
|
+
declare const defaultRuleGroupProcessorSpEL: RuleGroupProcessor<string>;
|
|
4417
|
+
//#endregion
|
|
4418
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorSQL.d.ts
|
|
4199
4419
|
/**
|
|
4200
|
-
*
|
|
4420
|
+
* Default rule processor used by {@link formatQuery} for "sql" format.
|
|
4201
4421
|
*
|
|
4202
4422
|
* @group Export
|
|
4203
4423
|
*/
|
|
4204
|
-
declare
|
|
4424
|
+
declare const defaultRuleGroupProcessorSQL: RuleGroupProcessor<string>;
|
|
4425
|
+
//#endregion
|
|
4426
|
+
//#region src/utils/formatQuery/tanStackDbTypes.d.ts
|
|
4205
4427
|
/**
|
|
4206
|
-
*
|
|
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.
|
|
4431
|
+
*/
|
|
4432
|
+
type TanStackDbWhereCallbackReturnType = unknown;
|
|
4433
|
+
type TanStackDbWhereCallback = (refs: Record<string, unknown>) => TanStackDbWhereCallbackReturnType;
|
|
4434
|
+
//#endregion
|
|
4435
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorTanStackDB.d.ts
|
|
4436
|
+
/**
|
|
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));
|
|
4207
4443
|
*
|
|
4208
4444
|
* @group Export
|
|
4209
4445
|
*/
|
|
4210
|
-
declare
|
|
4211
|
-
format: Exclude<ExportFormat, ExportObjectFormats>;
|
|
4212
|
-
}): string;
|
|
4446
|
+
declare const defaultRuleGroupProcessorTanStackDB: RuleGroupProcessor<TanStackDbWhereCallback>;
|
|
4213
4447
|
//#endregion
|
|
4214
|
-
//#region src/utils/formatQuery/
|
|
4448
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorDiagnostics.d.ts
|
|
4215
4449
|
/**
|
|
4216
|
-
*
|
|
4450
|
+
* Rule group processor used by {@link formatQuery} for "diagnostics" format.
|
|
4451
|
+
*
|
|
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`.
|
|
4217
4456
|
*
|
|
4218
4457
|
* @group Export
|
|
4219
4458
|
*/
|
|
4220
|
-
declare const
|
|
4459
|
+
declare const defaultRuleGroupProcessorDiagnostics: RuleGroupProcessor<DiagnosticsResult>;
|
|
4460
|
+
//#endregion
|
|
4461
|
+
//#region src/utils/formatQuery/defaultRuleProcessorCypher.d.ts
|
|
4221
4462
|
/**
|
|
4222
|
-
*
|
|
4223
|
-
* `concatOperator` is `"CONCAT"` (case-insensitive), otherwise joins with the infix operator
|
|
4224
|
-
* (e.g. `a || b`, `a + b`).
|
|
4463
|
+
* Default rule processor used by {@link formatQuery} for "cypher" and "gql" formats.
|
|
4225
4464
|
*
|
|
4226
4465
|
* @group Export
|
|
4227
4466
|
*/
|
|
4228
|
-
declare const
|
|
4467
|
+
declare const defaultRuleProcessorCypher: RuleProcessor;
|
|
4468
|
+
//#endregion
|
|
4469
|
+
//#region src/utils/formatQuery/defaultRuleProcessorDrizzle.d.ts
|
|
4229
4470
|
/**
|
|
4230
|
-
*
|
|
4231
|
-
* → `['%', '%']`, `beginsWith` → `['', '%']`, `endsWith` → `['%', '']`). Unknown operators
|
|
4232
|
-
* yield `['', '']`.
|
|
4471
|
+
* Default rule processor used by {@link formatQuery} for the "drizzle" format.
|
|
4233
4472
|
*
|
|
4234
4473
|
* @group Export
|
|
4235
4474
|
*/
|
|
4236
|
-
declare const
|
|
4475
|
+
declare const defaultRuleProcessorDrizzle: RuleProcessor;
|
|
4476
|
+
//#endregion
|
|
4477
|
+
//#region src/utils/formatQuery/defaultRuleProcessorElasticSearch.d.ts
|
|
4237
4478
|
/**
|
|
4238
|
-
*
|
|
4239
|
-
* `LIKE` wildcards for the given (lowercase) string-match operator, concatenating the literal
|
|
4240
|
-
* `%` markers via the preset-aware {@link getSQLConcat}. Returns the fragment untouched for
|
|
4241
|
-
* operators without wildcards.
|
|
4479
|
+
* Default rule processor used by {@link formatQuery} for "elasticsearch" format.
|
|
4242
4480
|
*
|
|
4243
4481
|
* @group Export
|
|
4244
4482
|
*/
|
|
4245
|
-
declare const
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
wrapValueWith?: [string, string];
|
|
4249
|
-
}) => string;
|
|
4483
|
+
declare const defaultRuleProcessorElasticSearch: RuleProcessor;
|
|
4484
|
+
//#endregion
|
|
4485
|
+
//#region src/utils/formatQuery/defaultRuleProcessorGremlin.d.ts
|
|
4250
4486
|
/**
|
|
4251
|
-
*
|
|
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).
|
|
4252
4490
|
*
|
|
4253
4491
|
* @group Export
|
|
4254
4492
|
*/
|
|
4255
|
-
declare const
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
"<": string;
|
|
4259
|
-
"<=": string;
|
|
4260
|
-
">": string;
|
|
4261
|
-
">=": string;
|
|
4262
|
-
in: string;
|
|
4263
|
-
notin: string;
|
|
4264
|
-
notIn: string;
|
|
4265
|
-
};
|
|
4493
|
+
declare const defaultRuleProcessorGremlin: RuleProcessor;
|
|
4494
|
+
//#endregion
|
|
4495
|
+
//#region src/utils/formatQuery/defaultRuleProcessorJSONata.d.ts
|
|
4266
4496
|
/**
|
|
4267
|
-
*
|
|
4497
|
+
* Default rule processor used by {@link formatQuery} for "jsonata" format.
|
|
4268
4498
|
*
|
|
4269
4499
|
* @group Export
|
|
4270
4500
|
*/
|
|
4271
|
-
declare const
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
"<": string;
|
|
4275
|
-
"<=": string;
|
|
4276
|
-
">": string;
|
|
4277
|
-
">=": string;
|
|
4278
|
-
in: string;
|
|
4279
|
-
notin: string;
|
|
4280
|
-
};
|
|
4501
|
+
declare const defaultRuleProcessorJSONata: RuleProcessor;
|
|
4502
|
+
//#endregion
|
|
4503
|
+
//#region src/utils/formatQuery/defaultRuleProcessorJsonLogic.d.ts
|
|
4281
4504
|
/**
|
|
4282
|
-
*
|
|
4505
|
+
* Default rule processor used by {@link formatQuery} for "jsonlogic" format.
|
|
4283
4506
|
*
|
|
4284
4507
|
* @group Export
|
|
4285
4508
|
*/
|
|
4286
|
-
declare const
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
};
|
|
4509
|
+
declare const defaultRuleProcessorJsonLogic: RuleProcessor;
|
|
4510
|
+
//#endregion
|
|
4511
|
+
//#region src/utils/formatQuery/defaultRuleProcessorLDAP.d.ts
|
|
4290
4512
|
/**
|
|
4291
|
-
*
|
|
4292
|
-
* of `formatQuery(query, 'jsonlogic')`.
|
|
4513
|
+
* Default rule processor used by {@link formatQuery} for "ldap" format.
|
|
4293
4514
|
*
|
|
4294
|
-
* @
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
*
|
|
4515
|
+
* @group Export
|
|
4516
|
+
*/
|
|
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.
|
|
4301
4522
|
*
|
|
4302
4523
|
* @group Export
|
|
4303
4524
|
*/
|
|
4304
|
-
declare const
|
|
4525
|
+
declare const defaultRuleProcessorMongoDBQuery: RuleProcessor;
|
|
4526
|
+
//#endregion
|
|
4527
|
+
//#region src/utils/formatQuery/defaultRuleProcessorNL.d.ts
|
|
4305
4528
|
/**
|
|
4306
|
-
*
|
|
4307
|
-
* to `number` where appropriate.
|
|
4529
|
+
* Default operator map used by {@link formatQuery} for "natural_language" format.
|
|
4308
4530
|
*
|
|
4309
|
-
*
|
|
4531
|
+
* @group Export
|
|
4532
|
+
*/
|
|
4533
|
+
declare const defaultExportOperatorMap: ExportOperatorMap;
|
|
4534
|
+
/**
|
|
4535
|
+
* Default operator processor used by {@link formatQuery} for "natural_language" format.
|
|
4310
4536
|
*
|
|
4311
4537
|
* @group Export
|
|
4312
4538
|
*/
|
|
4313
|
-
declare const
|
|
4539
|
+
declare const defaultOperatorProcessorNL: RuleProcessor;
|
|
4314
4540
|
/**
|
|
4315
|
-
*
|
|
4541
|
+
* Default rule processor used by {@link formatQuery} for "natural_language" format.
|
|
4316
4542
|
*
|
|
4317
4543
|
* @group Export
|
|
4318
4544
|
*/
|
|
4319
|
-
declare const
|
|
4545
|
+
declare const defaultRuleProcessorNL: RuleProcessor;
|
|
4546
|
+
//#endregion
|
|
4547
|
+
//#region src/utils/formatQuery/defaultRuleProcessorParameterized.d.ts
|
|
4320
4548
|
/**
|
|
4321
|
-
*
|
|
4322
|
-
*
|
|
4323
|
-
* `string` values will return `true` if they test positive against {@link numericRegex}.
|
|
4549
|
+
* Default rule processor used by {@link formatQuery} for "parameterized" and
|
|
4550
|
+
* "parameterized_named" formats.
|
|
4324
4551
|
*
|
|
4325
4552
|
* @group Export
|
|
4326
4553
|
*/
|
|
4327
|
-
declare const
|
|
4554
|
+
declare const defaultRuleProcessorParameterized: RuleProcessor;
|
|
4555
|
+
//#endregion
|
|
4556
|
+
//#region src/utils/formatQuery/defaultRuleProcessorPrisma.d.ts
|
|
4328
4557
|
/**
|
|
4329
|
-
*
|
|
4330
|
-
* "legacy" value processor by counting the number of arguments. Legacy value
|
|
4331
|
-
* processors take 3 arguments (not counting any arguments with default values), while
|
|
4332
|
-
* rule-based value processors take no more than 2 arguments.
|
|
4558
|
+
* Default rule processor used by {@link formatQuery} for "prisma" format.
|
|
4333
4559
|
*
|
|
4334
4560
|
* @group Export
|
|
4335
4561
|
*/
|
|
4336
|
-
declare const
|
|
4562
|
+
declare const defaultRuleProcessorPrisma: RuleProcessor;
|
|
4563
|
+
//#endregion
|
|
4564
|
+
//#region src/utils/formatQuery/defaultRuleProcessorSequelize.d.ts
|
|
4337
4565
|
/**
|
|
4338
|
-
*
|
|
4339
|
-
* If the option is a string, the array elements are both that string.
|
|
4566
|
+
* Default rule processor used by {@link formatQuery} for the "sequelize" format.
|
|
4340
4567
|
*
|
|
4341
|
-
* @
|
|
4342
|
-
|
|
4568
|
+
* @group Export
|
|
4569
|
+
*/
|
|
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.
|
|
4343
4574
|
*
|
|
4344
4575
|
* @group Export
|
|
4345
4576
|
*/
|
|
4346
|
-
declare const
|
|
4577
|
+
declare const sparqlVar: (name: string) => string;
|
|
4347
4578
|
/**
|
|
4348
|
-
*
|
|
4349
|
-
* wrapped in the configured quote character(s).
|
|
4579
|
+
* Default rule processor used by {@link formatQuery} for "sparql" format.
|
|
4350
4580
|
*
|
|
4351
4581
|
* @group Export
|
|
4352
4582
|
*/
|
|
4353
|
-
declare const
|
|
4583
|
+
declare const defaultRuleProcessorSPARQL: RuleProcessor;
|
|
4584
|
+
//#endregion
|
|
4585
|
+
//#region src/utils/formatQuery/defaultRuleProcessorSQL.d.ts
|
|
4354
4586
|
/**
|
|
4355
|
-
*
|
|
4356
|
-
* like "svo" or "sov", returns a permutation of `["S", "V", "O"]` based on the first occurrence of
|
|
4357
|
-
* each letter in the input string (case insensitive). This widens the valid input from abbreviations
|
|
4358
|
-
* like "svo" to more expressive strings like "subject-verb-object" or "sub ver obj". Any missing
|
|
4359
|
-
* letters are appended in the default order "SVO" (e.g., "object" would yield `["O", "S", "V"]`).
|
|
4587
|
+
* Default operator processor used by {@link formatQuery} for "sql" and "parameterized*" formats.
|
|
4360
4588
|
*
|
|
4361
4589
|
* @group Export
|
|
4362
4590
|
*/
|
|
4363
|
-
declare const
|
|
4591
|
+
declare const defaultOperatorProcessorSQL: RuleProcessor;
|
|
4364
4592
|
/**
|
|
4365
|
-
*
|
|
4366
|
-
* begins with it. Used by {@link formatQuery} to render rules whose `valueSource` is
|
|
4367
|
-
* `"parameter"` (e.g. `"p1"` with prefix `":"` → `":p1"`; `":p1"` → `":p1"`).
|
|
4593
|
+
* Default rule processor used by {@link formatQuery} for "sql" format.
|
|
4368
4594
|
*
|
|
4369
4595
|
* @group Export
|
|
4370
4596
|
*/
|
|
4371
|
-
declare const
|
|
4597
|
+
declare const defaultRuleProcessorSQL: RuleProcessor;
|
|
4598
|
+
//#endregion
|
|
4599
|
+
//#region src/utils/formatQuery/defaultRuleProcessorTanStackDB.d.ts
|
|
4372
4600
|
/**
|
|
4373
|
-
*
|
|
4374
|
-
* {@link withParamPrefix}; used to normalize parameter names for validation/lookup.
|
|
4601
|
+
* Default rule processor used by {@link formatQuery} for the "tanstack_db" format.
|
|
4375
4602
|
*
|
|
4376
4603
|
* @group Export
|
|
4377
4604
|
*/
|
|
4378
|
-
declare const
|
|
4605
|
+
declare const defaultRuleProcessorTanStackDB: RuleProcessor;
|
|
4606
|
+
//#endregion
|
|
4607
|
+
//#region src/utils/formatQuery/defaultValueProcessorNL.d.ts
|
|
4379
4608
|
/**
|
|
4380
|
-
* Default
|
|
4609
|
+
* Default value processor used by {@link formatQuery} for "natural_language" format.
|
|
4381
4610
|
*
|
|
4382
4611
|
* @group Export
|
|
4383
4612
|
*/
|
|
4384
|
-
declare const
|
|
4613
|
+
declare const defaultValueProcessorNL: ValueProcessorByRule;
|
|
4614
|
+
//#endregion
|
|
4615
|
+
//#region src/utils/formatQuery/formatQuery.d.ts
|
|
4385
4616
|
/**
|
|
4386
|
-
*
|
|
4387
|
-
* for the "natural_language" format.
|
|
4617
|
+
* A collection of option presets for {@link formatQuery}, specifically for SQL-based formats.
|
|
4388
4618
|
*
|
|
4389
4619
|
* @group Export
|
|
4390
4620
|
*/
|
|
4391
|
-
declare const
|
|
4392
|
-
type ProcessedMatchMode = {
|
|
4393
|
-
mode: "all";
|
|
4394
|
-
threshold?: number | null | undefined;
|
|
4395
|
-
} | {
|
|
4396
|
-
mode: "none";
|
|
4397
|
-
threshold?: number | null | undefined;
|
|
4398
|
-
} | {
|
|
4399
|
-
mode: "some";
|
|
4400
|
-
threshold?: number | null | undefined;
|
|
4401
|
-
} | {
|
|
4402
|
-
mode: "atleast";
|
|
4403
|
-
threshold: number;
|
|
4404
|
-
} | {
|
|
4405
|
-
mode: "atmost";
|
|
4406
|
-
threshold: number;
|
|
4407
|
-
} | {
|
|
4408
|
-
mode: "exactly";
|
|
4409
|
-
threshold: number;
|
|
4410
|
-
};
|
|
4621
|
+
declare const sqlDialectPresets: Record<SQLPreset, FormatQueryOptions>;
|
|
4411
4622
|
/**
|
|
4412
|
-
*
|
|
4413
|
-
* - `match: { mode: "atLeast", threshold: 1 }` to `match: { mode: "some" }`
|
|
4414
|
-
* - `match: { mode: "atMost", threshold: 0 }` to `match: { mode: "none" }`.
|
|
4623
|
+
* A collection of option presets for {@link formatQuery}.
|
|
4415
4624
|
*
|
|
4416
|
-
*
|
|
4417
|
-
* - Processed `{ mode, threshold }` object for valid subqueries
|
|
4418
|
-
* - `null` if match mode is not applicable for the rule
|
|
4419
|
-
* - `false` if match mode is valid, but either
|
|
4420
|
-
* 1. `threshold` is required and invalid, or
|
|
4421
|
-
* 2. `value` is not a valid rule group.
|
|
4625
|
+
* @group Export
|
|
4422
4626
|
*/
|
|
4423
|
-
declare const
|
|
4627
|
+
declare const formatQueryOptionPresets: Record<string, FormatQueryOptions>;
|
|
4424
4628
|
/**
|
|
4425
|
-
*
|
|
4426
|
-
*
|
|
4629
|
+
* Generates a formatted (indented two spaces) JSON string from a query object.
|
|
4630
|
+
*
|
|
4631
|
+
* @group Export
|
|
4427
4632
|
*/
|
|
4428
|
-
declare
|
|
4633
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny): string;
|
|
4429
4634
|
/**
|
|
4430
|
-
*
|
|
4431
|
-
* non-nested case) uses {@link subqueryElementAliasBase} unchanged; deeper levels are suffixed
|
|
4432
|
-
* with the depth, so a subquery nested within a subquery cannot shadow its parent's binding.
|
|
4635
|
+
* Generates a result based on the provided rule group processor.
|
|
4433
4636
|
*
|
|
4434
|
-
*
|
|
4637
|
+
* @group Export
|
|
4638
|
+
*/
|
|
4639
|
+
declare function formatQuery<TResult = unknown>(ruleGroup: RuleGroupTypeAny, options: FormatQueryOptions & {
|
|
4640
|
+
ruleGroupProcessor: RuleGroupProcessor<TResult>;
|
|
4641
|
+
}): TResult;
|
|
4642
|
+
/**
|
|
4643
|
+
* Generates a {@link index!ParameterizedSQL ParameterizedSQL} object from a query object.
|
|
4435
4644
|
*
|
|
4436
4645
|
* @group Export
|
|
4437
4646
|
*/
|
|
4438
|
-
declare
|
|
4647
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "parameterized" | (FormatQueryOptions & {
|
|
4648
|
+
format: "parameterized";
|
|
4649
|
+
})): ParameterizedSQL;
|
|
4439
4650
|
/**
|
|
4440
|
-
*
|
|
4441
|
-
* objects with a `$bigint` property having a value of a string representation of
|
|
4442
|
-
* the actual `bigint`-type value.
|
|
4651
|
+
* Generates a {@link index!ParameterizedNamedSQL ParameterizedNamedSQL} object from a query object.
|
|
4443
4652
|
*
|
|
4444
|
-
*
|
|
4653
|
+
* @group Export
|
|
4654
|
+
*/
|
|
4655
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "parameterized_named" | (FormatQueryOptions & {
|
|
4656
|
+
format: "parameterized_named";
|
|
4657
|
+
})): ParameterizedNamedSQL;
|
|
4658
|
+
/**
|
|
4659
|
+
* Generates a {@link index!RQBJsonLogic JsonLogic} object from a query object.
|
|
4445
4660
|
*
|
|
4446
|
-
* @
|
|
4661
|
+
* @group Export
|
|
4447
4662
|
*/
|
|
4448
|
-
declare
|
|
4663
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "jsonlogic" | (FormatQueryOptions & {
|
|
4664
|
+
format: "jsonlogic";
|
|
4665
|
+
})): RQBJsonLogic;
|
|
4449
4666
|
/**
|
|
4450
|
-
*
|
|
4451
|
-
* `$bigint: string` property to an actual `bigint` value.
|
|
4667
|
+
* Generates an ElasticSearch query object from an RQB query object.
|
|
4452
4668
|
*
|
|
4453
|
-
*
|
|
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).
|
|
4454
4672
|
*
|
|
4455
|
-
* @
|
|
4673
|
+
* @group Export
|
|
4456
4674
|
*/
|
|
4457
|
-
declare
|
|
4458
|
-
|
|
4459
|
-
|
|
4675
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "elasticsearch" | (FormatQueryOptions & {
|
|
4676
|
+
format: "elasticsearch";
|
|
4677
|
+
})): Record<string, any>;
|
|
4460
4678
|
/**
|
|
4461
|
-
*
|
|
4679
|
+
* Generates a MongoDB query object from an RQB query object.
|
|
4462
4680
|
*
|
|
4463
|
-
*
|
|
4681
|
+
* This is equivalent to the "mongodb" format, but returns a JSON object
|
|
4682
|
+
* instead of a string.
|
|
4464
4683
|
*
|
|
4465
4684
|
* @group Export
|
|
4466
4685
|
*/
|
|
4467
|
-
declare
|
|
4686
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "mongodb_query" | (FormatQueryOptions & {
|
|
4687
|
+
format: "mongodb_query";
|
|
4688
|
+
})): Record<string, any>;
|
|
4468
4689
|
/**
|
|
4469
|
-
*
|
|
4690
|
+
* Generates a JSON.stringify'd MongoDB query object from an RQB query object.
|
|
4691
|
+
*
|
|
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.
|
|
4470
4696
|
*
|
|
4471
4697
|
* @group Export
|
|
4472
4698
|
*/
|
|
4473
|
-
declare
|
|
4699
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "mongodb" | (FormatQueryOptions & {
|
|
4700
|
+
format: "mongodb";
|
|
4701
|
+
})): string;
|
|
4474
4702
|
/**
|
|
4475
|
-
*
|
|
4703
|
+
* Generates a Prisma ORM query object from an RQB query object.
|
|
4476
4704
|
*
|
|
4477
4705
|
* @group Export
|
|
4478
4706
|
*/
|
|
4479
|
-
declare
|
|
4707
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "prisma" | (FormatQueryOptions & {
|
|
4708
|
+
format: "prisma";
|
|
4709
|
+
})): Record<string, any>;
|
|
4480
4710
|
/**
|
|
4481
|
-
*
|
|
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.
|
|
4482
4713
|
*
|
|
4483
4714
|
* @group Export
|
|
4484
4715
|
*/
|
|
4485
|
-
declare
|
|
4716
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "drizzle" | (FormatQueryOptions & {
|
|
4717
|
+
format: "drizzle";
|
|
4718
|
+
})): ReturnType<typeof defaultRuleGroupProcessorDrizzle>;
|
|
4486
4719
|
/**
|
|
4487
|
-
*
|
|
4720
|
+
* Generates a TanStack DB WhereCallback from an RQB query object. The callback can
|
|
4721
|
+
* be passed directly to TanStack DB's `.where()` method.
|
|
4488
4722
|
*
|
|
4489
4723
|
* @group Export
|
|
4490
4724
|
*/
|
|
4491
|
-
declare
|
|
4725
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "tanstack_db" | (FormatQueryOptions & {
|
|
4726
|
+
format: "tanstack_db";
|
|
4727
|
+
})): ReturnType<typeof defaultRuleGroupProcessorTanStackDB>;
|
|
4492
4728
|
/**
|
|
4493
|
-
*
|
|
4729
|
+
* be assigned to the `where` property in the Sequelize query functions.
|
|
4494
4730
|
*
|
|
4495
4731
|
* @group Export
|
|
4496
4732
|
*/
|
|
4497
|
-
declare
|
|
4733
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "sequelize" | (FormatQueryOptions & {
|
|
4734
|
+
format: "sequelize";
|
|
4735
|
+
})): ReturnType<typeof defaultRuleGroupProcessorSequelize>;
|
|
4498
4736
|
/**
|
|
4499
|
-
*
|
|
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.
|
|
4500
4741
|
*
|
|
4501
4742
|
* @group Export
|
|
4502
4743
|
*/
|
|
4503
|
-
declare
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
declare const generateAccessibleDescription: AccessibleDescriptionGenerator;
|
|
4507
|
-
//#endregion
|
|
4508
|
-
//#region src/utils/generateID.d.ts
|
|
4509
|
-
type UUID = `${string}-${string}-${string}-${string}-${string}`;
|
|
4510
|
-
declare const uuidV4regex: RegExp;
|
|
4511
|
-
/**
|
|
4512
|
-
* Default `id` generator. Generates a valid v4 UUID. Uses `crypto.randomUUID()`
|
|
4513
|
-
* when available, otherwise uses an alternate method based on `getRandomValues`.
|
|
4514
|
-
* The returned string is guaranteed to match this regex:
|
|
4515
|
-
* ```
|
|
4516
|
-
* /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i
|
|
4517
|
-
* ```
|
|
4518
|
-
* @returns Valid v4 UUID
|
|
4519
|
-
*/
|
|
4520
|
-
declare let generateID: () => UUID;
|
|
4521
|
-
//#endregion
|
|
4522
|
-
//#region src/utils/getMatchModesUtil.d.ts
|
|
4523
|
-
/**
|
|
4524
|
-
* Utility function to get the match modes array for the given
|
|
4525
|
-
* field. If the field definition does not define a `matchModes`
|
|
4526
|
-
* property, the `getMatchModes` prop is used. Returns
|
|
4527
|
-
* `FullOption<MatchMode>[]` of all match modes by default.
|
|
4528
|
-
*/
|
|
4529
|
-
declare const getMatchModesUtil: <F extends FullField>(fieldData: F, getMatchModes?: (field: GetOptionIdentifierType<F>, misc: {
|
|
4530
|
-
fieldData: F;
|
|
4531
|
-
}) => boolean | MatchMode[] | FlexibleOption<MatchMode>[]) => MatchModeOptions;
|
|
4532
|
-
//#endregion
|
|
4533
|
-
//#region src/utils/getParseNumberMethod.d.ts
|
|
4534
|
-
declare const getParseNumberMethod: ({ parseNumbers, inputType }: {
|
|
4535
|
-
parseNumbers?: ParseNumbersPropConfig;
|
|
4536
|
-
inputType?: InputType | null;
|
|
4537
|
-
}) => ParseNumberMethod;
|
|
4538
|
-
//#endregion
|
|
4539
|
-
//#region src/utils/getRuleDefaultValue.d.ts
|
|
4540
|
-
/** Options for {@link getRuleDefaultValue}. */
|
|
4541
|
-
interface GetRuleDefaultValueOptions<F extends FullField = FullField> {
|
|
4542
|
-
/** Resolved field configuration for `rule.field` (e.g. `fieldMap[rule.field] ?? {}`). */
|
|
4543
|
-
fieldData: F;
|
|
4544
|
-
/** Full field list, used to seed a comparator-valid field when `valueSource` is `'field'`. */
|
|
4545
|
-
fields: FullOptionList<F>;
|
|
4546
|
-
/** Resolves the editor type for the field/operator (drives select/radio/checkbox defaults). */
|
|
4547
|
-
getValueEditorType: (field: string, operator: string, meta: {
|
|
4548
|
-
fieldData: F;
|
|
4549
|
-
}) => ValueEditorType;
|
|
4550
|
-
/** Resolves the value option list for the field/operator. */
|
|
4551
|
-
getValues: (field: string, operator: string, meta: {
|
|
4552
|
-
fieldData: F;
|
|
4553
|
-
}) => FullOptionList<Option>;
|
|
4554
|
-
/** Optional escape hatch overriding the computed default. */
|
|
4555
|
-
getDefaultValue?: (rule: RuleType, meta: {
|
|
4556
|
-
fieldData: F;
|
|
4557
|
-
}) => unknown;
|
|
4558
|
-
/** Named parameter options, used to seed a default when `valueSource` is `'parameter'`. */
|
|
4559
|
-
getParameters?: (field: string, operator: string, meta: {
|
|
4560
|
-
fieldData: F;
|
|
4561
|
-
}) => FullOptionList<Option> | null;
|
|
4562
|
-
/** When `true`, multi-value defaults are arrays instead of comma-joined strings. */
|
|
4563
|
-
listsAsArrays?: boolean;
|
|
4564
|
-
}
|
|
4744
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "jsonata" | (FormatQueryOptions & {
|
|
4745
|
+
format: "jsonata";
|
|
4746
|
+
})): string;
|
|
4565
4747
|
/**
|
|
4566
|
-
*
|
|
4567
|
-
* the precedence the {@link react-querybuilder!QueryBuilder QueryBuilder} applies: a field's
|
|
4568
|
-
* `defaultValue`, then a `getDefaultValue` override, then a value derived from the field/operator's
|
|
4569
|
-
* value list and editor type (first option for `select`/`radio`, `false` for `checkbox`, paired for
|
|
4570
|
-
* `between`/`notBetween`), or a comparator-valid field when `valueSource` is `'field'`. Falls back
|
|
4571
|
-
* to `''`.
|
|
4748
|
+
* Generates an LDAP query string from an RQB query object.
|
|
4572
4749
|
*
|
|
4573
|
-
* @group
|
|
4574
|
-
*/
|
|
4575
|
-
declare const getRuleDefaultValue$1: <F extends FullField = FullField>(rule: RuleType, options: GetRuleDefaultValueOptions<F>) => unknown;
|
|
4576
|
-
//#endregion
|
|
4577
|
-
//#region src/utils/getValidationClassNames.d.ts
|
|
4578
|
-
/**
|
|
4579
|
-
* Gets the standard classname for valid or invalid components
|
|
4580
|
-
* based on the given validation result.
|
|
4581
|
-
*/
|
|
4582
|
-
declare const getValidationClassNames: (validationResult: boolean | ValidationResult) => "" | (typeof standardClassnames)["valid"] | (typeof standardClassnames)["invalid"];
|
|
4583
|
-
//#endregion
|
|
4584
|
-
//#region src/utils/getValueSourcesUtil.d.ts
|
|
4585
|
-
/**
|
|
4586
|
-
* Utility function to get the value sources array for the given
|
|
4587
|
-
* field and operator. If the field definition does not define a
|
|
4588
|
-
* `valueSources` property, the `getValueSources` prop is used.
|
|
4589
|
-
* Returns `[FullOption<"value">]` by default.
|
|
4750
|
+
* @group Export
|
|
4590
4751
|
*/
|
|
4591
|
-
declare
|
|
4592
|
-
|
|
4593
|
-
})
|
|
4594
|
-
//#endregion
|
|
4595
|
-
//#region src/utils/isRuleGroup.d.ts
|
|
4752
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "ldap" | (FormatQueryOptions & {
|
|
4753
|
+
format: "ldap";
|
|
4754
|
+
})): string;
|
|
4596
4755
|
/**
|
|
4597
|
-
*
|
|
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
|
|
4598
4760
|
*/
|
|
4599
|
-
declare
|
|
4761
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "diagnostics" | (FormatQueryOptions & {
|
|
4762
|
+
format: "diagnostics";
|
|
4763
|
+
})): DiagnosticsResult;
|
|
4600
4764
|
/**
|
|
4601
|
-
*
|
|
4765
|
+
* Generates a formatted (indented two spaces) JSON string from a query object.
|
|
4766
|
+
*
|
|
4767
|
+
* @group Export
|
|
4602
4768
|
*/
|
|
4603
|
-
declare
|
|
4769
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: FormatQueryOptions): string;
|
|
4604
4770
|
/**
|
|
4605
|
-
*
|
|
4771
|
+
* Generates a query string in the requested format.
|
|
4772
|
+
*
|
|
4773
|
+
* @group Export
|
|
4606
4774
|
*/
|
|
4607
|
-
declare
|
|
4775
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: Exclude<ExportFormat, ExportObjectFormats>): string;
|
|
4608
4776
|
/**
|
|
4609
|
-
*
|
|
4777
|
+
* Generates a query string in the requested format.
|
|
4778
|
+
*
|
|
4779
|
+
* @group Export
|
|
4610
4780
|
*/
|
|
4611
|
-
declare
|
|
4781
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: FormatQueryOptions & {
|
|
4782
|
+
format: Exclude<ExportFormat, ExportObjectFormats>;
|
|
4783
|
+
}): string;
|
|
4612
4784
|
//#endregion
|
|
4613
|
-
//#region src/utils/
|
|
4614
|
-
/**
|
|
4615
|
-
* Determines if an object is useful as a validation result.
|
|
4616
|
-
*/
|
|
4617
|
-
declare const isValidationResult: (vr?: ValidationResult) => vr is ValidationResult;
|
|
4785
|
+
//#region src/utils/formatQuery/utils.d.ts
|
|
4618
4786
|
/**
|
|
4619
|
-
*
|
|
4620
|
-
*
|
|
4621
|
-
*
|
|
4787
|
+
* Maps a {@link DefaultOperatorName} to a SQL operator.
|
|
4788
|
+
*
|
|
4789
|
+
* @group Export
|
|
4622
4790
|
*/
|
|
4623
|
-
declare const
|
|
4624
|
-
//#endregion
|
|
4625
|
-
//#region src/utils/mergeAnyTranslations.d.ts
|
|
4791
|
+
declare const mapSQLOperator: (rqbOperator: string) => string;
|
|
4626
4792
|
/**
|
|
4627
|
-
*
|
|
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
|
|
4628
4798
|
*/
|
|
4629
|
-
declare const
|
|
4630
|
-
declare const mergeAnyTranslation: (el: string, keyPropContextMap: Record<string, [unknown, unknown]>, defaults?: Record<string, Record<string, unknown>>) => Record<string, Record<string, unknown>> | undefined;
|
|
4631
|
-
//#endregion
|
|
4632
|
-
//#region src/utils/mergeClassnames.d.ts
|
|
4633
|
-
type MergeClassnamesParams = (Partial<Classnames> | undefined)[];
|
|
4799
|
+
declare const getSQLConcat: (concatOperator?: string) => (...values: string[]) => string;
|
|
4634
4800
|
/**
|
|
4635
|
-
*
|
|
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
|
|
4636
4806
|
*/
|
|
4637
|
-
declare const
|
|
4638
|
-
//#endregion
|
|
4639
|
-
//#region src/utils/misc.d.ts
|
|
4807
|
+
declare const getLikeWildcards: (operatorLC: string) => [string, string];
|
|
4640
4808
|
/**
|
|
4641
|
-
*
|
|
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
|
|
4642
4815
|
*/
|
|
4643
|
-
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;
|
|
4644
4821
|
/**
|
|
4645
|
-
*
|
|
4646
|
-
*
|
|
4822
|
+
* Maps a (lowercase) {@link DefaultOperatorName} to a MongoDB operator.
|
|
4823
|
+
*
|
|
4824
|
+
* @group Export
|
|
4647
4825
|
*/
|
|
4648
|
-
declare const
|
|
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
|
+
};
|
|
4649
4837
|
/**
|
|
4650
|
-
*
|
|
4838
|
+
* Maps a (lowercase) {@link DefaultOperatorName} to a Prisma ORM operator.
|
|
4839
|
+
*
|
|
4840
|
+
* @group Export
|
|
4651
4841
|
*/
|
|
4652
|
-
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
|
+
};
|
|
4653
4852
|
/**
|
|
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
|
|
4661
4866
|
* ```
|
|
4662
|
-
*
|
|
4867
|
+
* for (const [op, func] of Object.entries(jsonLogicAdditionalOperators)) {
|
|
4868
|
+
* jsonLogic.add_operation(op, func);
|
|
4869
|
+
* }
|
|
4870
|
+
* jsonLogic.apply({ "startsWith": [{ "var": "firstName" }, "Stev"] }, data);
|
|
4663
4871
|
* ```
|
|
4872
|
+
*
|
|
4873
|
+
* @group Export
|
|
4664
4874
|
*/
|
|
4665
|
-
|
|
4875
|
+
declare const jsonLogicAdditionalOperators: Record<"startsWith" | "endsWith", (a: string, b: string) => boolean>;
|
|
4666
4876
|
/**
|
|
4667
|
-
*
|
|
4877
|
+
* Returns a new query object with all `string`-type `value` properties converted
|
|
4878
|
+
* to `number` where appropriate.
|
|
4668
4879
|
*
|
|
4669
|
-
*
|
|
4880
|
+
* Used by {@link formatQuery} for the `json*` formats when `parseNumbers` is `true`.
|
|
4881
|
+
*
|
|
4882
|
+
* @group Export
|
|
4670
4883
|
*/
|
|
4671
|
-
declare const
|
|
4884
|
+
declare const numerifyValues: (rg: RuleGroupTypeAny, options: SetRequired<FormatQueryOptions, "fields">) => RuleGroupTypeAny;
|
|
4672
4885
|
/**
|
|
4673
|
-
*
|
|
4886
|
+
* Determines whether a value is _anything_ except an empty `string` or `NaN`.
|
|
4674
4887
|
*
|
|
4675
|
-
*
|
|
4888
|
+
* @group Export
|
|
4676
4889
|
*/
|
|
4677
|
-
declare const
|
|
4890
|
+
declare const isValidValue: (value: unknown) => boolean;
|
|
4678
4891
|
/**
|
|
4679
|
-
*
|
|
4680
|
-
* as
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
//#region src/utils/optionResolvers.d.ts
|
|
4685
|
-
/**
|
|
4686
|
-
* Options shared by the resolvers below that produce a normalized option list.
|
|
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
|
|
4687
4897
|
*/
|
|
4688
|
-
|
|
4689
|
-
/**
|
|
4690
|
-
* Prepended as an empty placeholder option when `autoSelectOption` is `false`. Supplied by the
|
|
4691
|
-
* `translations` prop in React; omit it where translations don't apply.
|
|
4692
|
-
*/
|
|
4693
|
-
placeholder?: Placeholder;
|
|
4694
|
-
/** Properties applied to every option in the resulting list. */
|
|
4695
|
-
baseOption?: Record<string, unknown>;
|
|
4696
|
-
/** When `false`, an empty placeholder option is prepended. */
|
|
4697
|
-
autoSelectOption?: boolean;
|
|
4698
|
-
}
|
|
4898
|
+
declare const shouldRenderAsNumber: (value: unknown, parseNumbers?: boolean) => boolean;
|
|
4699
4899
|
/**
|
|
4700
|
-
*
|
|
4701
|
-
*
|
|
4702
|
-
*
|
|
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.
|
|
4703
4904
|
*
|
|
4704
|
-
* @group
|
|
4905
|
+
* @group Export
|
|
4705
4906
|
*/
|
|
4706
|
-
declare const
|
|
4707
|
-
field: string;
|
|
4708
|
-
fieldData: F;
|
|
4709
|
-
getOperators?: (field: string, misc: {
|
|
4710
|
-
fieldData: F;
|
|
4711
|
-
}) => FlexibleOptionList<O> | null;
|
|
4712
|
-
operators: FullOptionList<O>;
|
|
4713
|
-
} & ResolveOptionListOptions) => FullOptionList<O>;
|
|
4907
|
+
declare const isValueProcessorLegacy: (valueProcessor: ValueProcessorLegacy | ValueProcessorByRule) => valueProcessor is ValueProcessorLegacy;
|
|
4714
4908
|
/**
|
|
4715
|
-
*
|
|
4716
|
-
*
|
|
4717
|
-
* a function), then the first available operator.
|
|
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.
|
|
4718
4911
|
*
|
|
4719
|
-
* @
|
|
4912
|
+
* @default
|
|
4913
|
+
* ['', '']
|
|
4914
|
+
*
|
|
4915
|
+
* @group Export
|
|
4720
4916
|
*/
|
|
4721
|
-
declare const
|
|
4722
|
-
field: string;
|
|
4723
|
-
fieldData: F;
|
|
4724
|
-
getDefaultOperator?: string | ((field: string, misc: {
|
|
4725
|
-
fieldData: F;
|
|
4726
|
-
}) => string);
|
|
4727
|
-
/** Produces the operator list for the field, i.e. {@link resolveOperatorList} already bound. */
|
|
4728
|
-
getOperators: (field: string, misc: {
|
|
4729
|
-
fieldData: F;
|
|
4730
|
-
}) => FullOptionList<FullOperator>;
|
|
4731
|
-
}) => string;
|
|
4917
|
+
declare const getQuoteFieldNamesWithArray: (quoteFieldNamesWith?: null | string | [string, string]) => [string, string];
|
|
4732
4918
|
/**
|
|
4733
|
-
*
|
|
4734
|
-
*
|
|
4735
|
-
* operator), then the `getValueEditorType` callback, then `"text"`.
|
|
4919
|
+
* Given a field name and relevant {@link ValueProcessorOptions}, returns the field name
|
|
4920
|
+
* wrapped in the configured quote character(s).
|
|
4736
4921
|
*
|
|
4737
|
-
* @group
|
|
4922
|
+
* @group Export
|
|
4738
4923
|
*/
|
|
4739
|
-
declare const
|
|
4740
|
-
field: string;
|
|
4741
|
-
operator: string;
|
|
4742
|
-
fieldData: F;
|
|
4743
|
-
getValueEditorType?: (field: string, operator: string, misc: {
|
|
4744
|
-
fieldData: F;
|
|
4745
|
-
}) => ValueEditorType;
|
|
4746
|
-
}) => ValueEditorType;
|
|
4924
|
+
declare const getQuotedFieldName: (fieldName: string, { quoteFieldNamesWith, fieldIdentifierSeparator }: ValueProcessorOptions) => string;
|
|
4747
4925
|
/**
|
|
4748
|
-
*
|
|
4749
|
-
*
|
|
4750
|
-
*
|
|
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"]`).
|
|
4751
4931
|
*
|
|
4752
|
-
* @group
|
|
4932
|
+
* @group Export
|
|
4753
4933
|
*/
|
|
4754
|
-
declare const
|
|
4755
|
-
field: string;
|
|
4756
|
-
operator: string;
|
|
4757
|
-
fieldData: F;
|
|
4758
|
-
getValues?: (field: string, operator: string, misc: {
|
|
4759
|
-
fieldData: F;
|
|
4760
|
-
}) => FlexibleOptionList<Option> | null;
|
|
4761
|
-
} & ResolveOptionListOptions) => FullOptionList<Option>;
|
|
4762
|
-
//#endregion
|
|
4763
|
-
//#region src/utils/optGroupUtils.d.ts
|
|
4934
|
+
declare const normalizeConstituentWordOrder: (input: string) => ConstituentWordOrder;
|
|
4764
4935
|
/**
|
|
4765
|
-
*
|
|
4766
|
-
*
|
|
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"`).
|
|
4767
4939
|
*
|
|
4768
|
-
* @group
|
|
4940
|
+
* @group Export
|
|
4769
4941
|
*/
|
|
4770
|
-
declare
|
|
4942
|
+
declare const withParamPrefix: (value: unknown, paramPrefix?: string) => string;
|
|
4771
4943
|
/**
|
|
4772
|
-
*
|
|
4773
|
-
*
|
|
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.
|
|
4774
4946
|
*
|
|
4775
|
-
* @group
|
|
4947
|
+
* @group Export
|
|
4776
4948
|
*/
|
|
4777
|
-
declare
|
|
4949
|
+
declare const stripParamPrefix: (value: unknown, paramPrefix?: string) => string;
|
|
4778
4950
|
/**
|
|
4779
|
-
*
|
|
4780
|
-
* Lists of full options are left unchanged.
|
|
4951
|
+
* Default translations used by {@link formatQuery} for "natural_language" format.
|
|
4781
4952
|
*
|
|
4782
|
-
* @group
|
|
4953
|
+
* @group Export
|
|
4783
4954
|
*/
|
|
4784
|
-
declare
|
|
4955
|
+
declare const defaultNLTranslations: NLTranslations;
|
|
4785
4956
|
/**
|
|
4786
|
-
*
|
|
4957
|
+
* Used by {@link formatQuery} to get a translation based on certain conditions
|
|
4958
|
+
* for the "natural_language" format.
|
|
4787
4959
|
*
|
|
4788
|
-
* @group
|
|
4960
|
+
* @group Export
|
|
4789
4961
|
*/
|
|
4790
|
-
declare const
|
|
4791
|
-
|
|
4792
|
-
|
|
4962
|
+
declare const getNLTranslataion: (key: NLTranslationKey, translations: NLTranslations, conditions?: GroupVariantCondition[]) => string;
|
|
4963
|
+
type ProcessedMatchMode = {
|
|
4964
|
+
mode: "all";
|
|
4965
|
+
threshold?: number | null | undefined;
|
|
4793
4966
|
} | {
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
}
|
|
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
|
+
};
|
|
4797
4982
|
/**
|
|
4798
|
-
*
|
|
4799
|
-
*
|
|
4983
|
+
* Transforms
|
|
4984
|
+
* - `match: { mode: "atLeast", threshold: 1 }` to `match: { mode: "some" }`
|
|
4985
|
+
* - `match: { mode: "atMost", threshold: 0 }` to `match: { mode: "none" }`.
|
|
4800
4986
|
*
|
|
4801
|
-
*
|
|
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.
|
|
4802
4993
|
*/
|
|
4803
|
-
declare const
|
|
4804
|
-
name: string;
|
|
4805
|
-
value: string;
|
|
4806
|
-
}, "name" | "value">>(originalArray: T[]) => T[];
|
|
4994
|
+
declare const processMatchMode: (rule: RuleType) => null | false | ProcessedMatchMode;
|
|
4807
4995
|
/**
|
|
4808
|
-
*
|
|
4809
|
-
*
|
|
4810
|
-
* @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`).
|
|
4811
4998
|
*/
|
|
4812
|
-
declare const
|
|
4999
|
+
declare const subqueryElementAliasBase = "elem_alias";
|
|
4813
5000
|
/**
|
|
4814
|
-
*
|
|
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.
|
|
4815
5004
|
*
|
|
4816
|
-
*
|
|
5005
|
+
* Deterministic by depth rather than randomized, so output remains stable and snapshot-friendly.
|
|
5006
|
+
*
|
|
5007
|
+
* @group Export
|
|
4817
5008
|
*/
|
|
4818
|
-
declare const
|
|
5009
|
+
declare const getSubqueryElementAlias: (subqueryDepth?: number) => string;
|
|
4819
5010
|
/**
|
|
4820
|
-
*
|
|
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.
|
|
4821
5014
|
*
|
|
4822
|
-
* @
|
|
5015
|
+
* Inverse of {@link bigIntJsonParseReviver}.
|
|
5016
|
+
*
|
|
5017
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#use_within_json
|
|
4823
5018
|
*/
|
|
4824
|
-
declare const
|
|
5019
|
+
declare const bigIntJsonStringifyReplacer: (_key: string, value: unknown) => unknown;
|
|
4825
5020
|
/**
|
|
4826
|
-
*
|
|
5021
|
+
* "Reviver" method for JSON.parse's second argument. Converts objects having a single
|
|
5022
|
+
* `$bigint: string` property to an actual `bigint` value.
|
|
4827
5023
|
*
|
|
4828
|
-
* @
|
|
5024
|
+
* Inverse of {@link bigIntJsonStringifyReplacer}.
|
|
5025
|
+
*
|
|
5026
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#use_within_json
|
|
4829
5027
|
*/
|
|
4830
|
-
declare const
|
|
4831
|
-
|
|
4832
|
-
|
|
5028
|
+
declare const bigIntJsonParseReviver: (_key: string, value: unknown) => unknown;
|
|
5029
|
+
//#endregion
|
|
5030
|
+
//#region src/utils/formatQuery/index.d.ts
|
|
4833
5031
|
/**
|
|
4834
|
-
*
|
|
5032
|
+
* Default value processor used by {@link formatQuery} for "sql" format.
|
|
4835
5033
|
*
|
|
4836
|
-
* @
|
|
5034
|
+
* @deprecated Prefer {@link defaultValueProcessorByRule}.
|
|
5035
|
+
*
|
|
5036
|
+
* @group Export
|
|
4837
5037
|
*/
|
|
4838
|
-
declare const
|
|
4839
|
-
allowEmpty?: boolean;
|
|
4840
|
-
}) => arr is OptionGroup<FullOption>[];
|
|
5038
|
+
declare const defaultValueProcessor: ValueProcessorLegacy;
|
|
4841
5039
|
/**
|
|
4842
|
-
*
|
|
4843
|
-
* {@link Option} arrays as well as {@link OptionGroup} arrays.
|
|
5040
|
+
* @deprecated Prefer {@link defaultRuleProcessorMongoDB}.
|
|
4844
5041
|
*
|
|
4845
|
-
* @group
|
|
5042
|
+
* @group Export
|
|
4846
5043
|
*/
|
|
4847
|
-
declare
|
|
4848
|
-
declare function getOption<OptType extends ValueOption>(arr: FlexibleOptionList<OptType>, name: string): OptType | undefined;
|
|
4849
|
-
declare function getOption<OptType extends Option>(arr: FlexibleOptionList<OptType>, name: string): OptType | undefined;
|
|
5044
|
+
declare const defaultMongoDBValueProcessor: ValueProcessorLegacy;
|
|
4850
5045
|
/**
|
|
4851
|
-
*
|
|
5046
|
+
* @deprecated Prefer {@link defaultRuleProcessorCEL}.
|
|
4852
5047
|
*
|
|
4853
|
-
* @group
|
|
5048
|
+
* @group Export
|
|
4854
5049
|
*/
|
|
4855
|
-
declare
|
|
4856
|
-
declare function getFirstOption<Opt extends ValueOption>(arr?: OptionGroup<Opt>[] | Opt[]): GetOptionIdentifierType<Opt> | null;
|
|
4857
|
-
declare function getFirstOption<Opt extends Option>(arr?: OptionGroup<Opt>[] | Opt[]): GetOptionIdentifierType<Opt> | null;
|
|
5050
|
+
declare const defaultCELValueProcessor: ValueProcessorLegacy;
|
|
4858
5051
|
/**
|
|
4859
|
-
*
|
|
4860
|
-
* If the array is already flat, it is returned as is.
|
|
5052
|
+
* @deprecated Prefer {@link defaultRuleProcessorSpEL}.
|
|
4861
5053
|
*
|
|
4862
|
-
* @group
|
|
5054
|
+
* @group Export
|
|
4863
5055
|
*/
|
|
4864
|
-
declare const
|
|
5056
|
+
declare const defaultSpELValueProcessor: ValueProcessorLegacy;
|
|
4865
5057
|
/**
|
|
4866
|
-
*
|
|
4867
|
-
* removed based on the identifying property (`value` or `name`).
|
|
5058
|
+
* @deprecated Renamed to {@link defaultRuleProcessorCEL}.
|
|
4868
5059
|
*
|
|
4869
|
-
* @group
|
|
5060
|
+
* @group Export
|
|
4870
5061
|
*/
|
|
4871
|
-
declare const
|
|
5062
|
+
declare const defaultValueProcessorCELByRule: RuleProcessor;
|
|
4872
5063
|
/**
|
|
4873
|
-
*
|
|
4874
|
-
* removed based on the identifier property (`value` or `name`).
|
|
5064
|
+
* @deprecated Renamed to {@link defaultRuleProcessorMongoDB}.
|
|
4875
5065
|
*
|
|
4876
|
-
* @group
|
|
5066
|
+
* @group Export
|
|
4877
5067
|
*/
|
|
4878
|
-
declare const
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
placeholder?: Placeholder;
|
|
4886
|
-
optionList?: FlexibleOptionListProp<O> | BaseOptionMap<O>;
|
|
4887
|
-
baseOption?: Record<string, unknown>;
|
|
4888
|
-
labelMap?: Record<string, string>;
|
|
4889
|
-
autoSelectOption?: boolean;
|
|
4890
|
-
}
|
|
4891
|
-
declare const prepareOptionList: <O extends FullOption>(props: PrepareOptionListParams<O>) => PreparedOptionList<O>;
|
|
5068
|
+
declare const defaultValueProcessorMongoDBByRule: RuleProcessor;
|
|
5069
|
+
/**
|
|
5070
|
+
* @deprecated Renamed to {@link defaultRuleProcessorSpEL}.
|
|
5071
|
+
*
|
|
5072
|
+
* @group Export
|
|
5073
|
+
*/
|
|
5074
|
+
declare const defaultValueProcessorSpELByRule: RuleProcessor;
|
|
4892
5075
|
//#endregion
|
|
4893
|
-
//#region src/utils/
|
|
5076
|
+
//#region src/utils/generateAccessibleDescription.d.ts
|
|
4894
5077
|
/**
|
|
4895
|
-
*
|
|
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.
|
|
5080
|
+
*
|
|
5081
|
+
* @group Accessibility
|
|
4896
5082
|
*/
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
*/
|
|
4903
|
-
bigIntOnOverflow?: boolean;
|
|
4904
|
-
}
|
|
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;
|
|
4905
5088
|
/**
|
|
4906
|
-
*
|
|
4907
|
-
* otherwise uses
|
|
4908
|
-
*
|
|
4909
|
-
*
|
|
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
|
|
4910
5096
|
*/
|
|
4911
|
-
declare
|
|
5097
|
+
declare let generateID: () => UUID;
|
|
4912
5098
|
//#endregion
|
|
4913
|
-
//#region src/utils/
|
|
5099
|
+
//#region src/utils/immerInstances.d.ts
|
|
4914
5100
|
/**
|
|
4915
|
-
*
|
|
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}.
|
|
5104
|
+
*
|
|
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.
|
|
5110
|
+
*
|
|
5111
|
+
* @group Query Tools
|
|
4916
5112
|
*/
|
|
4917
|
-
|
|
5113
|
+
declare const setAutoFreeze: (autoFreeze: boolean) => void;
|
|
5114
|
+
//#endregion
|
|
5115
|
+
//#region src/utils/getMatchModesUtil.d.ts
|
|
4918
5116
|
/**
|
|
4919
|
-
*
|
|
4920
|
-
*
|
|
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.
|
|
4921
5121
|
*/
|
|
4922
|
-
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
|
+
}
|
|
4923
5158
|
/**
|
|
4924
|
-
*
|
|
4925
|
-
*
|
|
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 `''`.
|
|
5165
|
+
*
|
|
5166
|
+
* @group Option Lists
|
|
4926
5167
|
*/
|
|
4927
|
-
declare const
|
|
5168
|
+
declare const getRuleDefaultValue$1: <F extends FullField = FullField>(rule: RuleType, options: GetRuleDefaultValueOptions<F>) => unknown;
|
|
5169
|
+
//#endregion
|
|
5170
|
+
//#region src/utils/getValidationClassNames.d.ts
|
|
4928
5171
|
/**
|
|
4929
|
-
*
|
|
4930
|
-
*
|
|
5172
|
+
* Gets the standard classname for valid or invalid components
|
|
5173
|
+
* based on the given validation result.
|
|
4931
5174
|
*/
|
|
4932
|
-
declare const
|
|
5175
|
+
declare const getValidationClassNames: (validationResult: boolean | ValidationResult) => "" | (typeof standardClassnames)["valid"] | (typeof standardClassnames)["invalid"];
|
|
5176
|
+
//#endregion
|
|
5177
|
+
//#region src/utils/getValueSourcesUtil.d.ts
|
|
4933
5178
|
/**
|
|
4934
|
-
*
|
|
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.
|
|
4935
5183
|
*/
|
|
4936
|
-
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;
|
|
5187
|
+
//#endregion
|
|
5188
|
+
//#region src/utils/isRuleGroup.d.ts
|
|
4937
5189
|
/**
|
|
4938
|
-
* Determines if
|
|
5190
|
+
* Determines if an object is a {@link RuleType} (only checks for a `field` property).
|
|
4939
5191
|
*/
|
|
4940
|
-
declare const
|
|
5192
|
+
declare const isRuleType: (s: unknown) => s is RuleType;
|
|
4941
5193
|
/**
|
|
4942
|
-
* Determines if
|
|
4943
|
-
* be shorter and exactly match the second path up through the length of the first path.
|
|
5194
|
+
* Determines if an object is a {@link RuleGroupType} or {@link RuleGroupTypeIC}.
|
|
4944
5195
|
*/
|
|
4945
|
-
declare const
|
|
5196
|
+
declare const isRuleGroup: (rg: unknown) => rg is RuleGroupTypeAny;
|
|
4946
5197
|
/**
|
|
4947
|
-
*
|
|
5198
|
+
* Determines if an object is a {@link RuleGroupType}.
|
|
4948
5199
|
*/
|
|
4949
|
-
declare const
|
|
5200
|
+
declare const isRuleGroupType: (rg: unknown) => rg is RuleGroupType;
|
|
4950
5201
|
/**
|
|
4951
|
-
* Determines if
|
|
4952
|
-
* or disabled by an ancestor group.
|
|
5202
|
+
* Determines if an object is a {@link RuleGroupTypeIC}.
|
|
4953
5203
|
*/
|
|
4954
|
-
declare const
|
|
5204
|
+
declare const isRuleGroupTypeIC: (rg: unknown) => rg is RuleGroupTypeIC;
|
|
5205
|
+
//#endregion
|
|
5206
|
+
//#region src/utils/isRuleOrGroupValid.d.ts
|
|
4955
5207
|
/**
|
|
4956
|
-
* Determines if
|
|
4957
|
-
* form of the `QueryBuilder` `disabled` prop, which disables nodes by position rather than by a
|
|
4958
|
-
* `disabled` property on the node itself. A path is disabled if it appears in `disabledPaths` or
|
|
4959
|
-
* descends from a path that does.
|
|
4960
|
-
*
|
|
4961
|
-
* @group Paths
|
|
5208
|
+
* Determines if an object is useful as a validation result.
|
|
4962
5209
|
*/
|
|
4963
|
-
declare const
|
|
4964
|
-
/** The path of a child rule or group, and whether it is disabled. */ interface PathInfo {
|
|
4965
|
-
path: Path;
|
|
4966
|
-
disabled: boolean;
|
|
4967
|
-
}
|
|
5210
|
+
declare const isValidationResult: (vr?: ValidationResult) => vr is ValidationResult;
|
|
4968
5211
|
/**
|
|
4969
|
-
*
|
|
4970
|
-
*
|
|
4971
|
-
*
|
|
4972
|
-
* @group Paths
|
|
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`.
|
|
4973
5215
|
*/
|
|
4974
|
-
declare const
|
|
4975
|
-
disabled?: boolean;
|
|
4976
|
-
disabledPaths?: Path[];
|
|
4977
|
-
}) => PathInfo[];
|
|
5216
|
+
declare const isRuleOrGroupValid: (rg: RuleType | RuleGroupTypeAny, validationResult?: boolean | ValidationResult, validator?: RuleValidator) => boolean;
|
|
4978
5217
|
//#endregion
|
|
4979
|
-
//#region src/utils/
|
|
5218
|
+
//#region src/utils/mergeAnyTranslations.d.ts
|
|
4980
5219
|
/**
|
|
4981
|
-
*
|
|
4982
|
-
* context, and default, in that order.
|
|
5220
|
+
* Merges any number of partial translations into a single definition.
|
|
4983
5221
|
*/
|
|
4984
|
-
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)[];
|
|
4985
5227
|
/**
|
|
4986
|
-
*
|
|
4987
|
-
* context, and default, in that order.
|
|
5228
|
+
* Merges a list of partial {@link Classnames} definitions into a single definition.
|
|
4988
5229
|
*/
|
|
4989
|
-
declare const
|
|
5230
|
+
declare const mergeClassnames: (...args: MergeClassnamesParams) => Classnames;
|
|
5231
|
+
//#endregion
|
|
5232
|
+
//#region src/utils/misc.d.ts
|
|
4990
5233
|
/**
|
|
4991
|
-
*
|
|
4992
|
-
* context, and default—in that order—for each property in the defaults object.
|
|
5234
|
+
* Converts a value to lowercase if it's a string, otherwise returns the value as is.
|
|
4993
5235
|
*/
|
|
4994
|
-
declare const
|
|
4995
|
-
//#endregion
|
|
4996
|
-
//#region src/utils/prepareQueryObjects.d.ts
|
|
5236
|
+
declare const lc: <T>(v: T) => T;
|
|
4997
5237
|
/**
|
|
4998
|
-
*
|
|
5238
|
+
* Regex matching numeric strings. Passes for positive/negative integers, decimals,
|
|
5239
|
+
* and E notation, with optional surrounding whitespace.
|
|
4999
5240
|
*/
|
|
5000
|
-
|
|
5001
|
-
idGenerator?: () => string;
|
|
5002
|
-
}
|
|
5241
|
+
declare const numericRegex: RegExp;
|
|
5003
5242
|
/**
|
|
5004
|
-
*
|
|
5243
|
+
* Determines if a variable is a plain old JavaScript object, aka POJO.
|
|
5005
5244
|
*/
|
|
5006
|
-
declare const
|
|
5245
|
+
declare const isPojo: (obj: unknown) => obj is Record<string, any>;
|
|
5007
5246
|
/**
|
|
5008
|
-
*
|
|
5009
|
-
* and all its rules and subgroups where one does not already exist.
|
|
5247
|
+
* Simple helper to determine whether a value is null, undefined, or an empty string.
|
|
5010
5248
|
*/
|
|
5011
|
-
declare const
|
|
5249
|
+
declare const nullOrUndefinedOrEmpty: (value: unknown) => value is null | undefined | "";
|
|
5250
|
+
//#endregion
|
|
5251
|
+
//#region src/utils/objectUtils.d.ts
|
|
5012
5252
|
/**
|
|
5013
|
-
*
|
|
5253
|
+
* Original looked like this (not sure why template string is used):
|
|
5254
|
+
* ```
|
|
5255
|
+
* type ObjectKeys<T extends object> = `${Exclude<keyof T, symbol>}`;
|
|
5256
|
+
* ```
|
|
5014
5257
|
*/
|
|
5015
|
-
|
|
5258
|
+
type ObjectKeys<T extends object> = Exclude<keyof T, symbol>;
|
|
5016
5259
|
/**
|
|
5017
|
-
*
|
|
5018
|
-
* order: the controlled `query`, then whatever is already in the store, then the uncontrolled
|
|
5019
|
-
* `defaultQuery`, then a freshly created empty group.
|
|
5260
|
+
* A strongly-typed version of `Object.keys()`.
|
|
5020
5261
|
*
|
|
5021
|
-
*
|
|
5022
|
-
|
|
5023
|
-
|
|
5262
|
+
* [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-keys.ts)
|
|
5263
|
+
*/
|
|
5264
|
+
declare const objectKeys: <Type extends object>(value: Type) => Array<ObjectKeys<Type>>;
|
|
5265
|
+
/**
|
|
5266
|
+
* A strongly-typed version of `Object.entries()`.
|
|
5024
5267
|
*
|
|
5025
|
-
*
|
|
5268
|
+
* [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-entries.ts)
|
|
5026
5269
|
*/
|
|
5027
|
-
declare const
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
idGenerator?: () => string;
|
|
5034
|
-
}) => RG;
|
|
5270
|
+
declare const objectEntries: <Type extends Record<PropertyKey, unknown>>(value: Type) => Array<[ObjectKeys<Type>, Type[ObjectKeys<Type>]]>;
|
|
5271
|
+
/**
|
|
5272
|
+
* Returns `true` if the key could cause prototype pollution when used
|
|
5273
|
+
* as a property name in bracket-notation assignment.
|
|
5274
|
+
*/
|
|
5275
|
+
declare const isUnsafeKey: (key: unknown) => boolean;
|
|
5035
5276
|
//#endregion
|
|
5036
|
-
//#region src/utils/
|
|
5277
|
+
//#region src/utils/optionResolvers.d.ts
|
|
5037
5278
|
/**
|
|
5038
|
-
*
|
|
5039
|
-
* interpreted differently depending on the operation:
|
|
5040
|
-
*
|
|
5041
|
-
* - `onAddRule`/`onAddGroup` may return `true` to proceed, a falsy value to cancel, or a
|
|
5042
|
-
* _replacement rule/group_ to add instead of the one provided.
|
|
5043
|
-
* - `onMoveRule`/`onMoveGroup`/`onGroupRule`/`onGroupGroup` may return `true` to proceed, a
|
|
5044
|
-
* falsy value to cancel, or a _replacement query_ to apply instead of the computed one.
|
|
5045
|
-
* - `onRemove` is boolean only.
|
|
5046
|
-
*
|
|
5047
|
-
* @group Query Tools
|
|
5048
|
-
*/
|
|
5049
|
-
interface QueryActionCallbacks {
|
|
5050
|
-
onAddRule?: (rule: RuleType, parentPath: Path, query: any, context?: any) => RuleType | boolean;
|
|
5051
|
-
onAddGroup?: (ruleGroup: any, parentPath: Path, query: any, context?: any) => RuleGroupTypeAny | boolean;
|
|
5052
|
-
onRemove?: (ruleOrGroup: any, path: Path, query: any, context?: any) => boolean;
|
|
5053
|
-
onMoveRule?: (...args: any[]) => RuleGroupTypeAny | boolean;
|
|
5054
|
-
onMoveGroup?: (...args: any[]) => RuleGroupTypeAny | boolean;
|
|
5055
|
-
onGroupRule?: (...args: any[]) => RuleGroupTypeAny | boolean;
|
|
5056
|
-
onGroupGroup?: (...args: any[]) => RuleGroupTypeAny | boolean;
|
|
5057
|
-
}
|
|
5058
|
-
/**
|
|
5059
|
-
* Configuration for {@link createQueryActions}.
|
|
5060
|
-
*
|
|
5061
|
-
* @group Query Tools
|
|
5062
|
-
*/
|
|
5063
|
-
interface QueryActionsConfig extends QueryActionCallbacks {
|
|
5064
|
-
/** Identifier included in every log payload. */
|
|
5065
|
-
qbId?: string;
|
|
5066
|
-
combinators?: OptionList;
|
|
5067
|
-
idGenerator?: () => string;
|
|
5068
|
-
/** The maximum depth at which groups may be added. Defaults to `Infinity`. */
|
|
5069
|
-
maxLevels?: number;
|
|
5070
|
-
/** Abort every mutation, as though the entire query were disabled. */
|
|
5071
|
-
queryDisabled?: boolean;
|
|
5072
|
-
/**
|
|
5073
|
-
* Honor `disabled` properties within the query. Defaults to `true`, matching the
|
|
5074
|
-
* `QueryBuilder` component; a node's own `disabled` property can always be changed.
|
|
5075
|
-
*/
|
|
5076
|
-
respectDisabled?: boolean;
|
|
5077
|
-
/**
|
|
5078
|
-
* Paths disabled by position rather than by a `disabled` property on the node itself, mirroring
|
|
5079
|
-
* the array form of the `QueryBuilder` `disabled` prop. Honored only when `respectDisabled` is
|
|
5080
|
-
* `true`; as with the `disabled` property, a node's own `disabled` can always be changed.
|
|
5081
|
-
*/
|
|
5082
|
-
disabledPaths?: Path[];
|
|
5083
|
-
resetOnFieldChange?: boolean;
|
|
5084
|
-
resetOnOperatorChange?: boolean;
|
|
5085
|
-
getRuleDefaultOperator?: (field: string) => string;
|
|
5086
|
-
getValueSources?: (field: string, operator: string) => ValueSourceFullOptions;
|
|
5087
|
-
getRuleDefaultValue?: (rule: RuleType) => any;
|
|
5088
|
-
getMatchModes?: (field: string) => MatchModeOptions;
|
|
5089
|
-
/** Receives a structured event for every action, applied or aborted. */
|
|
5090
|
-
onLog?: (payload: Record<string, any>) => void;
|
|
5091
|
-
}
|
|
5092
|
-
/**
|
|
5093
|
-
* The six mutations a query builder performs. Each takes the current query and returns the next
|
|
5094
|
-
* one, or `undefined` when the mutation was aborted—because the target is disabled, a
|
|
5095
|
-
* confirmation callback declined, or a depth limit was reached.
|
|
5096
|
-
*
|
|
5097
|
-
* @group Query Tools
|
|
5098
|
-
*/
|
|
5099
|
-
interface QueryActionHandlers {
|
|
5100
|
-
addRule: (query: any, rule: RuleType, parentPath: Path, context?: any) => any;
|
|
5101
|
-
addGroup: (query: any, ruleGroup: any, parentPath: Path, context?: any) => any;
|
|
5102
|
-
propChange: (query: any, prop: UpdateableProperties, value: any, path: Path) => any;
|
|
5103
|
-
removeRuleOrGroup: (query: any, path: Path, context?: any) => any;
|
|
5104
|
-
moveRule: (query: any, oldPath: Path, newPath: Path | "up" | "down", clone?: boolean, context?: any) => any;
|
|
5105
|
-
groupRule: (query: any, sourcePath: Path, targetPath: Path, clone?: boolean, context?: any) => any;
|
|
5106
|
-
}
|
|
5107
|
-
/**
|
|
5108
|
-
* Builds the query builder's six mutation handlers as pure functions of the current query.
|
|
5109
|
-
*
|
|
5110
|
-
* This is the framework-agnostic core of the action handlers in `useQueryBuilderSchema`. It owns
|
|
5111
|
-
* the policy that surrounds the query tools—disabled gating, the confirmation callback protocol,
|
|
5112
|
-
* `maxLevels`, and debug logging—so an implementation only has to supply its own storage: read
|
|
5113
|
-
* the current query, call the action, and apply a non-`undefined` result.
|
|
5114
|
-
*
|
|
5115
|
-
* @group Query Tools
|
|
5116
|
-
*/
|
|
5117
|
-
declare const createQueryActions: (config?: QueryActionsConfig) => QueryActionHandlers;
|
|
5118
|
-
//#endregion
|
|
5119
|
-
//#region src/utils/queryTools.d.ts
|
|
5120
|
-
/**
|
|
5121
|
-
* Why a query tool returned the query unmodified. Query tools never throw; when they cannot
|
|
5122
|
-
* carry out an operation they return the original query and report the reason through
|
|
5123
|
-
* {@link AbortOptions.onAbort}.
|
|
5124
|
-
*
|
|
5125
|
-
* `"same-location"` and `"no-change"` describe operations that were valid but had nothing to
|
|
5126
|
-
* do, so they are not errors. Every other reason indicates a target that could not be used.
|
|
5127
|
-
*
|
|
5128
|
-
* @group Query Tools
|
|
5129
|
-
*/
|
|
5130
|
-
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";
|
|
5131
|
-
/**
|
|
5132
|
-
* Details about an aborted query tool operation.
|
|
5133
|
-
*
|
|
5134
|
-
* @group Query Tools
|
|
5135
|
-
*/
|
|
5136
|
-
interface AbortInfo {
|
|
5137
|
-
/** Why the operation was aborted. */
|
|
5138
|
-
reason: AbortReason;
|
|
5139
|
-
/** The query tool that aborted. */
|
|
5140
|
-
operation: "add" | "remove" | "update" | "move" | "insert" | "group";
|
|
5141
|
-
/** The path or `id` that could not be used, when the reason relates to a specific target. */
|
|
5142
|
-
pathOrID?: Path | string;
|
|
5143
|
-
}
|
|
5144
|
-
/**
|
|
5145
|
-
* Options that block a mutation before it is attempted.
|
|
5146
|
-
*
|
|
5147
|
-
* `disabled` is a property of the query itself, so honoring it is a matter of data integrity
|
|
5148
|
-
* rather than presentation: a query saved with a locked rule should stay locked when it is
|
|
5149
|
-
* loaded again. It is opt-in here only to preserve the existing behavior of the standalone
|
|
5150
|
-
* query tools; {@link QueryManager} enables it by default.
|
|
5151
|
-
*
|
|
5152
|
-
* @group Query Tools
|
|
5153
|
-
*/
|
|
5154
|
-
interface GuardOptions {
|
|
5155
|
-
/**
|
|
5156
|
-
* Abort when the target (or its parent, for `add`/`insert`) is disabled, either directly or
|
|
5157
|
-
* by descending from a disabled group. Defaults to `false`.
|
|
5158
|
-
*
|
|
5159
|
-
* Updating a rule or group's own `disabled` property is always permitted, since it is the
|
|
5160
|
-
* only way to re-enable it.
|
|
5161
|
-
*/
|
|
5162
|
-
respectDisabled?: boolean;
|
|
5163
|
-
/**
|
|
5164
|
-
* Paths that are disabled without the corresponding rule or group carrying a `disabled`
|
|
5165
|
-
* property, mirroring the array form of the `QueryBuilder` `disabled` prop. A path is treated
|
|
5166
|
-
* as disabled if it appears here or descends from a path that does.
|
|
5167
|
-
*
|
|
5168
|
-
* Like the `disabled` property, this is only honored when `respectDisabled` is `true`, and
|
|
5169
|
-
* updating a rule or group's own `disabled` property is still permitted.
|
|
5170
|
-
*/
|
|
5171
|
-
disabledPaths?: Path[];
|
|
5172
|
-
/** Abort every mutation, as though the entire query were disabled. Defaults to `false`. */
|
|
5173
|
-
queryDisabled?: boolean;
|
|
5174
|
-
/**
|
|
5175
|
-
* The maximum depth at which a group may be added. A group whose parent path is already this
|
|
5176
|
-
* deep is rejected by `add` and `insert`. Rules are unaffected. Defaults to `Infinity`.
|
|
5177
|
-
*/
|
|
5178
|
-
maxLevels?: number;
|
|
5179
|
-
}
|
|
5180
|
-
/**
|
|
5181
|
-
* Options for reporting aborted query tool operations.
|
|
5182
|
-
*
|
|
5183
|
-
* @group Query Tools
|
|
5279
|
+
* Options shared by the resolvers below that produce a normalized option list.
|
|
5184
5280
|
*/
|
|
5185
|
-
interface
|
|
5281
|
+
interface ResolveOptionListOptions {
|
|
5186
5282
|
/**
|
|
5187
|
-
*
|
|
5188
|
-
*
|
|
5189
|
-
* "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.
|
|
5190
5285
|
*/
|
|
5191
|
-
|
|
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;
|
|
5192
5291
|
}
|
|
5193
5292
|
/**
|
|
5194
|
-
*
|
|
5195
|
-
*
|
|
5196
|
-
*
|
|
5197
|
-
* Exported so that callers which run their own logic before mutating—such as a UI layer that
|
|
5198
|
-
* 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.
|
|
5199
5296
|
*
|
|
5200
|
-
* @group
|
|
5297
|
+
* @group Option Lists
|
|
5201
5298
|
*/
|
|
5202
|
-
declare const
|
|
5203
|
-
|
|
5204
|
-
|
|
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>;
|
|
5205
5307
|
/**
|
|
5206
|
-
*
|
|
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.
|
|
5207
5311
|
*
|
|
5208
|
-
* @group
|
|
5312
|
+
* @group Option Lists
|
|
5209
5313
|
*/
|
|
5210
|
-
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;
|
|
5211
5325
|
/**
|
|
5212
|
-
*
|
|
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"`.
|
|
5213
5329
|
*
|
|
5214
|
-
* @group
|
|
5330
|
+
* @group Option Lists
|
|
5215
5331
|
*/
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
/**
|
|
5225
|
-
* If the query extends `RuleGroupTypeIC` (i.e. the query has independent
|
|
5226
|
-
* combinators), then this combinator will be inserted before the new rule/group
|
|
5227
|
-
* if the parent group is not empty. This option will supersede `combinators`.
|
|
5228
|
-
*/
|
|
5229
|
-
combinatorPreceding?: string;
|
|
5230
|
-
/**
|
|
5231
|
-
* ID generator.
|
|
5232
|
-
*/
|
|
5233
|
-
idGenerator?: () => string;
|
|
5234
|
-
}
|
|
5235
|
-
interface AddMethod {
|
|
5236
|
-
<RG extends RuleGroupTypeAny>(query: RG, ruleOrGroup: RG | RuleType, parentPathOrID: Path | string, options?: AddOptions): RG;
|
|
5237
|
-
}
|
|
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;
|
|
5238
5340
|
/**
|
|
5239
|
-
*
|
|
5240
|
-
*
|
|
5241
|
-
*
|
|
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.
|
|
5242
5344
|
*
|
|
5243
|
-
* @group
|
|
5345
|
+
* @group Option Lists
|
|
5244
5346
|
*/
|
|
5245
|
-
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
|
|
5246
5357
|
/**
|
|
5247
|
-
*
|
|
5248
|
-
*
|
|
5249
|
-
* @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.
|
|
5250
5360
|
*
|
|
5251
|
-
* @group
|
|
5361
|
+
* @group Option Lists
|
|
5252
5362
|
*/
|
|
5253
|
-
declare
|
|
5363
|
+
declare function toFullOption<Opt extends BaseOption>(opt: Opt | string, baseProperties?: Record<string, unknown>, labelMap?: Record<string, unknown>): ToFullOption<Opt>;
|
|
5254
5364
|
/**
|
|
5255
|
-
*
|
|
5365
|
+
* Converts an {@link OptionList} or {@link FlexibleOptionList} into a {@link FullOptionList}.
|
|
5366
|
+
* Lists of full options are left unchanged.
|
|
5256
5367
|
*
|
|
5257
|
-
* @group
|
|
5368
|
+
* @group Option Lists
|
|
5258
5369
|
*/
|
|
5259
|
-
|
|
5260
|
-
/**
|
|
5261
|
-
* When updating the `field` of a rule, the rule's `operator`, `value`, and `valueSource`
|
|
5262
|
-
* will be reset to their respective defaults. Defaults to `true`.
|
|
5263
|
-
*/
|
|
5264
|
-
resetOnFieldChange?: boolean;
|
|
5265
|
-
/**
|
|
5266
|
-
* When updating the `operator` of a rule, the rule's `value` and `valueSource`
|
|
5267
|
-
* will be reset to their respective defaults. Defaults to `false`.
|
|
5268
|
-
*/
|
|
5269
|
-
resetOnOperatorChange?: boolean;
|
|
5270
|
-
/**
|
|
5271
|
-
* Determines the default operator name for a given field.
|
|
5272
|
-
*/
|
|
5273
|
-
getRuleDefaultOperator?: (field: string) => string;
|
|
5274
|
-
/**
|
|
5275
|
-
* Determines the valid value sources for a given field and operator.
|
|
5276
|
-
*/
|
|
5277
|
-
getValueSources?: (field: string, operator: string) => ValueSources | ValueSourceFlexibleOptions;
|
|
5278
|
-
/**
|
|
5279
|
-
* Gets the default value for a given rule, in case the value needs to be reset.
|
|
5280
|
-
*/
|
|
5281
|
-
getRuleDefaultValue?: (rule: RuleType) => any;
|
|
5282
|
-
/**
|
|
5283
|
-
* Determines the valid match modes for a given field.
|
|
5284
|
-
*/
|
|
5285
|
-
getMatchModes?: (field: string) => MatchModeOptions;
|
|
5286
|
-
}
|
|
5287
|
-
interface UpdateMethod {
|
|
5288
|
-
/**
|
|
5289
|
-
* Updates a single property of a rule or group.
|
|
5290
|
-
*/
|
|
5291
|
-
<RG extends RuleGroupTypeAny>(query: RG, prop: UpdateableProperties, value: any, pathOrID: Path | string, options?: UpdateOptions): RG;
|
|
5292
|
-
/**
|
|
5293
|
-
* Updates multiple properties of a rule or group using parallel arrays of
|
|
5294
|
-
* property names and corresponding values.
|
|
5295
|
-
*/
|
|
5296
|
-
<RG extends RuleGroupTypeAny>(query: RG, props: UpdateableProperties[], values: any[], pathOrID: Path | string, options?: UpdateOptions): RG;
|
|
5297
|
-
/**
|
|
5298
|
-
* Updates multiple properties of a rule or group using a map of property
|
|
5299
|
-
* names to their new values.
|
|
5300
|
-
*/
|
|
5301
|
-
<RG extends RuleGroupTypeAny>(query: RG, props: UpdateValueMap, pathOrID: Path | string, options?: UpdateOptions): RG;
|
|
5302
|
-
}
|
|
5370
|
+
declare function toFullOptionList<Opt extends BaseOption>(optList: unknown[], baseProperties?: Record<string, unknown>, labelMap?: Record<string, unknown>): FullOptionList<Opt>;
|
|
5303
5371
|
/**
|
|
5304
|
-
*
|
|
5305
|
-
*
|
|
5306
|
-
* (`prop`, `value`), as parallel arrays (`props`, `values`), or as a
|
|
5307
|
-
* property-to-value map. For multi-property updates, `field`, `operator`, and
|
|
5308
|
-
* `valueSource` are applied before `value`, so an explicit `value` is never
|
|
5309
|
-
* reset by a change to one of those properties.
|
|
5310
|
-
*
|
|
5311
|
-
* @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.
|
|
5312
5374
|
*
|
|
5313
|
-
* @group
|
|
5375
|
+
* @group Option Lists
|
|
5314
5376
|
*/
|
|
5315
|
-
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;
|
|
5316
5378
|
/**
|
|
5317
|
-
*
|
|
5318
|
-
* See {@link update} for the supported argument forms and ordering semantics.
|
|
5319
|
-
*
|
|
5320
|
-
* @returns The query (mutated in place) with the rule or group properties updated.
|
|
5379
|
+
* @deprecated Renamed to {@link uniqByIdentifier}.
|
|
5321
5380
|
*
|
|
5322
|
-
* @group
|
|
5381
|
+
* @group Option Lists
|
|
5323
5382
|
*/
|
|
5324
|
-
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[];
|
|
5325
5390
|
/**
|
|
5326
|
-
*
|
|
5391
|
+
* Generates a new array of objects with duplicates removed based
|
|
5392
|
+
* on the identifying property (`value` or `name`)
|
|
5327
5393
|
*
|
|
5328
|
-
* @group
|
|
5394
|
+
* @group Option Lists
|
|
5329
5395
|
*/
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
}
|
|
5396
|
+
declare const uniqByIdentifier: <T extends RequireAtLeastOne$1<{
|
|
5397
|
+
name: string;
|
|
5398
|
+
value: string;
|
|
5399
|
+
}, "name" | "value">>(originalArray: T[]) => T[];
|
|
5334
5400
|
/**
|
|
5335
|
-
*
|
|
5336
|
-
*
|
|
5337
|
-
* @returns A new query with the rule or group removed.
|
|
5401
|
+
* Determines if an {@link OptionList} is an {@link OptionGroup} array.
|
|
5338
5402
|
*
|
|
5339
|
-
* @group
|
|
5403
|
+
* @group Option Lists
|
|
5340
5404
|
*/
|
|
5341
|
-
declare const
|
|
5405
|
+
declare const isOptionGroupArray: (arr: unknown) => arr is OptionGroup<BaseOption>[];
|
|
5342
5406
|
/**
|
|
5343
|
-
*
|
|
5344
|
-
*
|
|
5345
|
-
* @returns The query (mutated in place) with the rule or group removed.
|
|
5407
|
+
* Determines if an array is a flat array of {@link FlexibleOption}.
|
|
5346
5408
|
*
|
|
5347
|
-
* @group
|
|
5409
|
+
* @group Option Lists
|
|
5348
5410
|
*/
|
|
5349
|
-
declare const
|
|
5411
|
+
declare const isFlexibleOptionArray: (arr: unknown) => arr is FlexibleOption[];
|
|
5350
5412
|
/**
|
|
5351
|
-
*
|
|
5413
|
+
* Determines if an array is a flat array of {@link FullOption}.
|
|
5352
5414
|
*
|
|
5353
|
-
* @group
|
|
5415
|
+
* @group Option Lists
|
|
5354
5416
|
*/
|
|
5355
|
-
|
|
5356
|
-
/**
|
|
5357
|
-
* When `true`, the source rule/group will not be removed from its original path.
|
|
5358
|
-
*/
|
|
5359
|
-
clone?: boolean;
|
|
5360
|
-
/**
|
|
5361
|
-
* If the query extends `RuleGroupTypeIC` (i.e. the query is using independent
|
|
5362
|
-
* combinators), then the first combinator in this list will be inserted before
|
|
5363
|
-
* the rule/group if necessary.
|
|
5364
|
-
*/
|
|
5365
|
-
combinators?: OptionList;
|
|
5366
|
-
/**
|
|
5367
|
-
* ID generator.
|
|
5368
|
-
*/
|
|
5369
|
-
idGenerator?: () => string;
|
|
5370
|
-
}
|
|
5371
|
-
interface MoveMethod {
|
|
5372
|
-
<RG extends RuleGroupTypeAny>(query: RG, oldPathOrID: Path | string, newPath: Path | "up" | "down", options?: MoveOptions): RG;
|
|
5373
|
-
}
|
|
5417
|
+
declare const isFullOptionArray: (arr: unknown) => arr is FullOption[];
|
|
5374
5418
|
/**
|
|
5375
|
-
*
|
|
5376
|
-
* In the options parameter, pass `{ clone: true }` to copy instead of move.
|
|
5377
|
-
*
|
|
5378
|
-
* @returns A new query with the rule or group moved or cloned.
|
|
5419
|
+
* Determines if a {@link FlexibleOptionList} is a {@link FlexibleOptionGroup} array.
|
|
5379
5420
|
*
|
|
5380
|
-
* @group
|
|
5421
|
+
* @group Option Lists
|
|
5381
5422
|
*/
|
|
5382
|
-
declare const
|
|
5423
|
+
declare const isFlexibleOptionGroupArray: (arr: unknown, { allowEmpty }?: {
|
|
5424
|
+
allowEmpty?: boolean;
|
|
5425
|
+
}) => arr is FlexibleOptionGroup[];
|
|
5383
5426
|
/**
|
|
5384
|
-
*
|
|
5385
|
-
* In the options parameter, pass `{ clone: true }` to copy instead of move.
|
|
5386
|
-
*
|
|
5387
|
-
* @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}.
|
|
5388
5428
|
*
|
|
5389
|
-
* @group
|
|
5429
|
+
* @group Option Lists
|
|
5390
5430
|
*/
|
|
5391
|
-
declare const
|
|
5431
|
+
declare const isFullOptionGroupArray: (arr: unknown, { allowEmpty }?: {
|
|
5432
|
+
allowEmpty?: boolean;
|
|
5433
|
+
}) => arr is OptionGroup<FullOption>[];
|
|
5392
5434
|
/**
|
|
5393
|
-
*
|
|
5435
|
+
* Gets the option from an {@link OptionList} with the given `name`. Handles
|
|
5436
|
+
* {@link Option} arrays as well as {@link OptionGroup} arrays.
|
|
5394
5437
|
*
|
|
5395
|
-
* @group
|
|
5438
|
+
* @group Option Lists
|
|
5396
5439
|
*/
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
* combinators), then the first combinator in this list will be inserted
|
|
5401
|
-
* before the new rule/group if the parent group is not empty. This option
|
|
5402
|
-
* is overridden by `combinatorPreceding`.
|
|
5403
|
-
*/
|
|
5404
|
-
combinators?: OptionList;
|
|
5405
|
-
/**
|
|
5406
|
-
* If the query extends `RuleGroupTypeIC` (i.e. the query has independent
|
|
5407
|
-
* combinators), then this combinator will be inserted before the new rule/group
|
|
5408
|
-
* if the parent group is not empty and the new rule/group is not the first in the
|
|
5409
|
-
* group (`path.at(-1) > 0`). This option will supersede `combinators`.
|
|
5410
|
-
*/
|
|
5411
|
-
combinatorPreceding?: string;
|
|
5412
|
-
/**
|
|
5413
|
-
* If the query extends `RuleGroupTypeIC` (i.e. the query has independent
|
|
5414
|
-
* combinators), then this combinator will be inserted after the new rule/group
|
|
5415
|
-
* if the parent group is not empty and the new rule/group is the first in the
|
|
5416
|
-
* group (`path.at(-1) === 0`). This option will supersede `combinators`.
|
|
5417
|
-
*/
|
|
5418
|
-
combinatorSucceeding?: string;
|
|
5419
|
-
/**
|
|
5420
|
-
* ID generator.
|
|
5421
|
-
*
|
|
5422
|
-
* @default generateID
|
|
5423
|
-
*/
|
|
5424
|
-
idGenerator?: () => string;
|
|
5425
|
-
/**
|
|
5426
|
-
* When `true`, the new rule/group will replace the rule/group at `path`.
|
|
5427
|
-
*/
|
|
5428
|
-
replace?: boolean;
|
|
5429
|
-
}
|
|
5430
|
-
interface InsertMethod {
|
|
5431
|
-
<RG extends RuleGroupTypeAny>(query: RG, ruleOrGroup: RG | RuleType, path: number[], options?: InsertOptions): RG;
|
|
5432
|
-
}
|
|
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;
|
|
5433
5443
|
/**
|
|
5434
|
-
*
|
|
5435
|
-
*
|
|
5436
|
-
* @returns A new query with the rule or group inserted.
|
|
5444
|
+
* Gets the first option from an {@link OptionList}.
|
|
5437
5445
|
*
|
|
5438
|
-
* @group
|
|
5446
|
+
* @group Option Lists
|
|
5439
5447
|
*/
|
|
5440
|
-
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;
|
|
5441
5451
|
/**
|
|
5442
|
-
*
|
|
5452
|
+
* Flattens {@link FlexibleOptionGroup} arrays into {@link BaseOption} arrays.
|
|
5453
|
+
* If the array is already flat, it is returned as is.
|
|
5443
5454
|
*
|
|
5444
|
-
* @
|
|
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`).
|
|
5445
5461
|
*
|
|
5446
|
-
* @group
|
|
5462
|
+
* @group Option Lists
|
|
5447
5463
|
*/
|
|
5448
|
-
declare const
|
|
5464
|
+
declare const uniqOptGroups: <T extends BaseOption>(originalArray: FlexibleOptionGroup<T>[]) => OptionGroup<ToFullOption<T>>[];
|
|
5449
5465
|
/**
|
|
5450
|
-
*
|
|
5466
|
+
* Generates a new {@link Option} or {@link OptionGroup} array with duplicates
|
|
5467
|
+
* removed based on the identifier property (`value` or `name`).
|
|
5451
5468
|
*
|
|
5452
|
-
* @group
|
|
5469
|
+
* @group Option Lists
|
|
5453
5470
|
*/
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
* If the query extends `RuleGroupTypeIC` (i.e. the query is using independent
|
|
5461
|
-
* combinators), then the first combinator in this list will be inserted between
|
|
5462
|
-
* the two rules/groups.
|
|
5463
|
-
*/
|
|
5464
|
-
combinators?: OptionList;
|
|
5465
|
-
/**
|
|
5466
|
-
* ID generator.
|
|
5467
|
-
*/
|
|
5468
|
-
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>>;
|
|
5469
5477
|
}
|
|
5470
|
-
|
|
5471
|
-
|
|
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;
|
|
5472
5485
|
}
|
|
5473
5486
|
/**
|
|
5474
|
-
*
|
|
5475
|
-
*
|
|
5476
|
-
*
|
|
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.
|
|
5477
5491
|
*
|
|
5478
|
-
*
|
|
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.
|
|
5479
5494
|
*
|
|
5480
|
-
*
|
|
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
|
|
5481
5499
|
*/
|
|
5482
|
-
declare const
|
|
5500
|
+
declare const prepareOptionList: <O extends FullOption>(props: PrepareOptionListParams<O>) => PreparedOptionList<O>;
|
|
5501
|
+
//#endregion
|
|
5502
|
+
//#region src/utils/pathUtils.d.ts
|
|
5483
5503
|
/**
|
|
5484
|
-
*
|
|
5485
|
-
|
|
5486
|
-
|
|
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.
|
|
5487
5549
|
*
|
|
5488
|
-
* @
|
|
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`.
|
|
5489
5560
|
*
|
|
5490
|
-
* @group
|
|
5561
|
+
* @group Paths
|
|
5491
5562
|
*/
|
|
5492
|
-
declare const
|
|
5563
|
+
declare const derivePathInfo: (path: Path, childCount: number, { disabled, disabledPaths }?: {
|
|
5564
|
+
disabled?: boolean;
|
|
5565
|
+
disabledPaths?: Path[];
|
|
5566
|
+
}) => PathInfo[];
|
|
5493
5567
|
//#endregion
|
|
5494
5568
|
//#region src/utils/transformQuery.d.ts
|
|
5495
5569
|
/**
|
|
@@ -5605,14 +5679,6 @@ declare function transformQuery(query: RuleGroupType, options?: TransformQueryOp
|
|
|
5605
5679
|
declare function transformQuery(query: RuleGroupTypeIC, options?: TransformQueryOptions<RuleGroupTypeIC>): any;
|
|
5606
5680
|
//#endregion
|
|
5607
5681
|
//#region src/utils/QueryManager.d.ts
|
|
5608
|
-
/**
|
|
5609
|
-
* Abort reasons that {@link QueryManager}'s `strict` mode treats as errors. The remaining
|
|
5610
|
-
* reasons—`"same-location"` and `"no-change"`—describe valid operations that had nothing to do,
|
|
5611
|
-
* so they are reported to `onInvalidTarget` but never throw.
|
|
5612
|
-
*
|
|
5613
|
-
* @group Query Tools
|
|
5614
|
-
*/
|
|
5615
|
-
declare const strictAbortReasons: readonly AbortReason[];
|
|
5616
5682
|
/**
|
|
5617
5683
|
* Thrown by {@link QueryManager} methods in `strict` mode when an operation cannot be carried
|
|
5618
5684
|
* out because its target could not be used.
|
|
@@ -5645,6 +5711,27 @@ interface StrictOptions {
|
|
|
5645
5711
|
*/
|
|
5646
5712
|
onInvalidTarget?: (info: AbortInfo) => void;
|
|
5647
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);
|
|
5648
5735
|
/**
|
|
5649
5736
|
* Options for {@link QueryManager}. Mirrors the subset of
|
|
5650
5737
|
* {@link react-querybuilder!QueryBuilder QueryBuilder} props that affect query
|
|
@@ -5680,11 +5767,9 @@ interface QueryManagerOptions<F extends FullField = FullField, O extends FullOpe
|
|
|
5680
5767
|
*/
|
|
5681
5768
|
translations?: Partial<BaseTranslations<unknown>>;
|
|
5682
5769
|
/** The default `field` for rules created by {@link QueryManager.createRule}. */
|
|
5683
|
-
getDefaultField?:
|
|
5770
|
+
getDefaultField?: DefaultFieldProp<F>;
|
|
5684
5771
|
/** The default `operator` for a given field. */
|
|
5685
|
-
getDefaultOperator?:
|
|
5686
|
-
fieldData: F;
|
|
5687
|
-
}) => string);
|
|
5772
|
+
getDefaultOperator?: DefaultOperatorProp<F>;
|
|
5688
5773
|
/** Overrides the computed default `value` for a new rule. */
|
|
5689
5774
|
getDefaultValue?: (rule: RuleType, misc: {
|
|
5690
5775
|
fieldData: F;
|
|
@@ -5776,6 +5861,19 @@ interface QueryManagerOptions<F extends FullField = FullField, O extends FullOpe
|
|
|
5776
5861
|
* `"same-location"` and `"no-change"`. Can be overridden per call.
|
|
5777
5862
|
*/
|
|
5778
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;
|
|
5779
5877
|
/** Validates the query. Defaults to {@link defaultValidator}. */
|
|
5780
5878
|
validator?: QueryValidator;
|
|
5781
5879
|
/** Generates `id` properties for new rules and groups. Defaults to {@link generateID}. */
|
|
@@ -5789,11 +5887,30 @@ interface QueryManagerOptions<F extends FullField = FullField, O extends FullOpe
|
|
|
5789
5887
|
now?: () => number;
|
|
5790
5888
|
}
|
|
5791
5889
|
/**
|
|
5792
|
-
*
|
|
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.
|
|
5793
5900
|
*
|
|
5794
5901
|
* @group Query Tools
|
|
5795
5902
|
*/
|
|
5796
|
-
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> {
|
|
5797
5914
|
/** The rule or group itself. */
|
|
5798
5915
|
node: RG | RuleType;
|
|
5799
5916
|
/** The {@link Path} of `node` within the query. The root group's path is `[]`. */
|
|
@@ -5830,7 +5947,8 @@ type AsRuleGroup<T> = T extends RuleGroupTypeAny ? T : RuleGroupTypeAny;
|
|
|
5830
5947
|
* The query is held internally, so each method takes the same arguments as its `queryTools`
|
|
5831
5948
|
* counterpart minus the leading `query` parameter, and returns the manager itself for chaining.
|
|
5832
5949
|
* Mutations use the non-`InPlace` tools, so a query previously handed out by
|
|
5833
|
-
* {@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.
|
|
5834
5952
|
*
|
|
5835
5953
|
* ```ts
|
|
5836
5954
|
* const q = new QueryManager(undefined, { fields });
|
|
@@ -5846,11 +5964,96 @@ type AsRuleGroup<T> = T extends RuleGroupTypeAny ? T : RuleGroupTypeAny;
|
|
|
5846
5964
|
* @group Query Tools
|
|
5847
5965
|
*/
|
|
5848
5966
|
declare class QueryManager<RG extends RuleGroupTypeAny = RuleGroupType, F extends FullField = FullField, O extends FullOperator = FullOperator, C extends FullCombinator = FullCombinator> {
|
|
5849
|
-
|
|
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();
|
|
5850
5977
|
constructor(query?: RG, options?: QueryManagerOptions<F, O, C>);
|
|
5851
5978
|
/**
|
|
5852
|
-
*
|
|
5853
|
-
*
|
|
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`.
|
|
5854
6057
|
*
|
|
5855
6058
|
* Like {@link QueryManager.subscribe}, this method is bound to the instance, so it can be
|
|
5856
6059
|
* passed as a bare reference (e.g. as the `getSnapshot` argument to `useSyncExternalStore`).
|
|
@@ -5920,13 +6123,34 @@ declare class QueryManager<RG extends RuleGroupTypeAny = RuleGroupType, F extend
|
|
|
5920
6123
|
* re-normalize.
|
|
5921
6124
|
*
|
|
5922
6125
|
* History options are honored immediately: lowering `maxHistory` trims the undo stack, and
|
|
5923
|
-
* turning history off clears both stacks.
|
|
5924
|
-
*
|
|
5925
|
-
*
|
|
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.
|
|
5926
6139
|
*/
|
|
5927
6140
|
reconfigure(options: Partial<QueryManagerOptions<F, O, C>>, config?: {
|
|
5928
6141
|
replace?: boolean;
|
|
5929
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;
|
|
5930
6154
|
/**
|
|
5931
6155
|
* A counter incremented by every {@link QueryManager.reconfigure} call. Because reconfiguring
|
|
5932
6156
|
* leaves the query object untouched, subscribers that compare query identity alone cannot see
|
|
@@ -5964,8 +6188,12 @@ declare class QueryManager<RG extends RuleGroupTypeAny = RuleGroupType, F extend
|
|
|
5964
6188
|
* ```
|
|
5965
6189
|
*
|
|
5966
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.
|
|
5967
6195
|
*/
|
|
5968
|
-
subscribe: (listener: () => void) => (() => void);
|
|
6196
|
+
subscribe: (listener: (change: SubscriptionChange) => void) => (() => void);
|
|
5969
6197
|
/**
|
|
5970
6198
|
* Runs `fn`, deferring history recording and subscriber notification until it returns. The
|
|
5971
6199
|
* whole batch becomes a single undo step and triggers a single notification, or neither if
|
|
@@ -6155,6 +6383,24 @@ declare class QueryManager<RG extends RuleGroupTypeAny = RuleGroupType, F extend
|
|
|
6155
6383
|
getValues(field: string, operator: string): FullOptionList<Option>;
|
|
6156
6384
|
/** The value editor type for a field/operator pair. */
|
|
6157
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>>;
|
|
6158
6404
|
/**
|
|
6159
6405
|
* Resolves everything about a rule that depends on the field/operator configuration—field data,
|
|
6160
6406
|
* operators, value editor type, value list, value sources, match modes, and validation result.
|
|
@@ -6207,6 +6453,206 @@ declare class QueryManager<RG extends RuleGroupTypeAny = RuleGroupType, F extend
|
|
|
6207
6453
|
transform<T = any>(options?: TransformQueryOptions<RG>): T;
|
|
6208
6454
|
}
|
|
6209
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
|
|
6210
6656
|
//#region src/utils/regenerateIDs.d.ts
|
|
6211
6657
|
/**
|
|
6212
6658
|
* Options object for {@link regenerateID}/{@link regenerateIDs}.
|
|
@@ -6311,5 +6757,5 @@ declare const unchangedSignature = "";
|
|
|
6311
6757
|
*/
|
|
6312
6758
|
declare const signatureOf: (prev: RuleGroupTypeAny, next: RuleGroupTypeAny) => string;
|
|
6313
6759
|
//#endregion
|
|
6314
|
-
export { AbortInfo, AbortOptions, AbortReason, AccessibleDescriptionGenerator, ActionElementEventHandler, AddMethod, AddOptions, Arity, BaseFullOption, BaseOption, BaseOptionMap, BaseTranslation, BaseTranslationWithLabel, BaseTranslationWithPlaceholders, BaseTranslations, BaseTranslationsFull, Classname, ClassnameCondition, ClassnameSpec, Classnames, Combinator, CombinatorByValue, CommonRuleAndGroupProperties, CommonRuleSubComponentProps, ConstituentWordOrder, ConstituentWordOrderString, CreateRuleGroupOptions, CreateRuleOptions, DefaultCombinator, DefaultCombinatorExtended, DefaultCombinatorName, DefaultCombinatorNameExtended, DefaultCombinators, DefaultCombinatorsExtended, DefaultMatchModes, DefaultOperator, DefaultOperatorName, DefaultOperators, DefaultRuleGroupArray, DefaultRuleGroupICArray, DefaultRuleGroupType, DefaultRuleGroupTypeAny, DefaultRuleGroupTypeIC, DefaultRuleOrGroupArray, DefaultRuleType, DeriveClassNamesOptions, DiagnosticEntry, DiagnosticsFieldSummaryEntry, DiagnosticsResult, DiagnosticsStats, DndClassNameState, DndDropTargetType, DragCollection, DraggedItem, DropCollection, DropEffect, DropResult, ExportFormat, ExportObjectFormats, ExportOperatorMap, ExpressionNode, Field, FieldByValue, FindPathReturnType, FlexibleOption, FlexibleOptionGroup, FlexibleOptionList, FlexibleOptionListProp, FormatQueryFinalOptions, FormatQueryOptions, FormatQueryValidateRule, FullCombinator, FullField, FullOperator, FullOption, FullOptionList, FullOptionMap, FullOptionRecord, GenericizeRuleGroupType, GetOptionIdentifierType, GetOptionType, GetRuleDefaultValueOptions, GetRuleGroupType, GetRuleTypeFromGroupWithFieldAndOperator, GroupMethod, GroupOptions, GroupVariantCondition, GuardOptions, InputType, InsertMethod, InsertOptions, type JsonLogicAll, type JsonLogicAnd, type JsonLogicDoubleNegation, type JsonLogicEqual, type JsonLogicGreaterThan, type JsonLogicGreaterThanOrEqual, type JsonLogicInArray, type JsonLogicInString, type JsonLogicLessThan, type JsonLogicLessThanOrEqual, type JsonLogicNegation, type JsonLogicNone, type JsonLogicNotEqual, type JsonLogicOr, type JsonLogicReservedOperations, type JsonLogicRulesLogic, type JsonLogicSome, type JsonLogicStrictEqual, type JsonLogicStrictNotEqual, type JsonLogicVar, LogType, MatchConfig, MatchMode, MatchModeOptions, MoveMethod, MoveOptions, NLTranslationKey, NLTranslations, NameLabelPair, Operator, OperatorByValue, Option, OptionGroup, OptionList, OuterClassNameOptions, 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, 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 };
|
|
6315
6761
|
//# sourceMappingURL=react-querybuilder_core.d.mts.map
|