@react-querybuilder/core 8.22.5 → 8.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/derivations/package.json +4 -0
- package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +2078 -1665
- package/dist/cjs/react-querybuilder_core.cjs.development.js +1293 -422
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +2078 -1665
- package/dist/cjs/react-querybuilder_core.cjs.production.js +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.js.map +1 -1
- package/dist/{convertQuery-Cw76XFIn.js → convertQuery-BLT0GIhM.js} +17 -8
- package/dist/{convertQuery-Cw76XFIn.js.map → convertQuery-BLT0GIhM.js.map} +1 -1
- package/dist/{convertQuery-D_4J7E-Z.mjs → convertQuery-DaXv3h7S.mjs} +6 -3
- package/dist/{convertQuery-D_4J7E-Z.mjs.map → convertQuery-DaXv3h7S.mjs.map} +1 -1
- package/dist/derivations.d.mts +2902 -0
- package/dist/derivations.d.ts +2902 -0
- package/dist/derivations.js +2845 -0
- package/dist/derivations.js.map +1 -0
- package/dist/derivations.mjs +2678 -0
- package/dist/derivations.mjs.map +1 -0
- package/dist/formatQuery.d.mts +2 -895
- package/dist/formatQuery.d.ts +2 -895
- package/dist/formatQuery.js +120 -140
- package/dist/formatQuery.js.map +1 -1
- package/dist/formatQuery.mjs +8 -28
- package/dist/formatQuery.mjs.map +1 -1
- package/dist/{import-DVWI7Fdh.d.mts → import-BdKPtLzo.d.mts} +2 -2
- package/dist/{import-6ExjhifL.d.ts → import-BfZTwhp2.d.ts} +2 -2
- package/dist/{index-CX9mehdL.d.mts → index-DOIE2pwx.d.mts} +274 -3
- package/dist/{index-CX9mehdL.d.ts → index-DOIE2pwx.d.ts} +274 -3
- package/dist/index-OF2Q1gTp.d.mts +895 -0
- package/dist/index-XueTy_XQ.d.ts +895 -0
- package/dist/isRuleOrGroupValid-CIMZNkt4.mjs +27 -0
- package/dist/isRuleOrGroupValid-CIMZNkt4.mjs.map +1 -0
- package/dist/isRuleOrGroupValid-CtUf4_4x.js +38 -0
- package/dist/isRuleOrGroupValid-CtUf4_4x.js.map +1 -0
- package/dist/{isRuleGroup-CqLThsbu.mjs → objectUtils-DDZ-KhV5.mjs} +25 -2
- package/dist/objectUtils-DDZ-KhV5.mjs.map +1 -0
- package/dist/{isRuleGroup-0JNiQgLg.js → objectUtils-DfnEmDSV.js} +48 -1
- package/dist/objectUtils-DfnEmDSV.js.map +1 -0
- package/dist/parseCEL.d.mts +2 -2
- package/dist/parseCEL.d.ts +2 -2
- package/dist/parseCEL.js +19 -16
- package/dist/parseCEL.js.map +1 -1
- package/dist/parseCEL.mjs +12 -9
- package/dist/parseCEL.mjs.map +1 -1
- package/dist/parseCypher.d.mts +1 -1
- package/dist/parseCypher.d.ts +1 -1
- package/dist/parseGremlin.d.mts +1 -1
- package/dist/parseGremlin.d.ts +1 -1
- package/dist/parseJSONata.d.mts +2 -2
- package/dist/parseJSONata.d.ts +2 -2
- package/dist/parseJSONata.js +17 -14
- package/dist/parseJSONata.js.map +1 -1
- package/dist/parseJSONata.mjs +11 -8
- package/dist/parseJSONata.mjs.map +1 -1
- package/dist/parseJsonLogic.d.mts +2 -2
- package/dist/parseJsonLogic.d.ts +2 -2
- package/dist/parseJsonLogic.js +38 -38
- package/dist/parseJsonLogic.js.map +1 -1
- package/dist/parseJsonLogic.mjs +5 -5
- package/dist/parseMongoDB.d.mts +2 -2
- package/dist/parseMongoDB.d.ts +2 -2
- package/dist/parseMongoDB.js +50 -47
- package/dist/parseMongoDB.js.map +1 -1
- package/dist/parseMongoDB.mjs +35 -32
- package/dist/parseMongoDB.mjs.map +1 -1
- package/dist/parseSPARQL.d.mts +1 -1
- package/dist/parseSPARQL.d.ts +1 -1
- package/dist/parseSQL.d.mts +2 -2
- package/dist/parseSQL.d.ts +2 -2
- package/dist/parseSQL.js +27 -23
- package/dist/parseSQL.js.map +1 -1
- package/dist/parseSQL.mjs +21 -17
- package/dist/parseSQL.mjs.map +1 -1
- package/dist/parseSpEL.d.mts +2 -2
- package/dist/parseSpEL.d.ts +2 -2
- package/dist/parseSpEL.js +16 -13
- package/dist/parseSpEL.js.map +1 -1
- package/dist/parseSpEL.mjs +12 -9
- package/dist/parseSpEL.mjs.map +1 -1
- package/dist/parserUtils-BKPstAaO.mjs +30 -0
- package/dist/parserUtils-BKPstAaO.mjs.map +1 -0
- package/dist/parserUtils-DbBXyAht.js +41 -0
- package/dist/parserUtils-DbBXyAht.js.map +1 -0
- package/dist/{prepareQueryObjects-BnGL91Tt.js → prepareQueryObjects-Dj9cTl9D.js} +90 -63
- package/dist/prepareQueryObjects-Dj9cTl9D.js.map +1 -0
- package/dist/{prepareQueryObjects-ChINDIap.mjs → prepareQueryObjects-Dmyf3Wi_.mjs} +56 -59
- package/dist/prepareQueryObjects-Dmyf3Wi_.mjs.map +1 -0
- package/dist/react-querybuilder_core.d.mts +2078 -1665
- package/dist/react-querybuilder_core.legacy-esm.d.ts +2078 -1665
- package/dist/react-querybuilder_core.legacy-esm.js +1445 -635
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +1288 -424
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +2078 -1665
- package/dist/react-querybuilder_core.production.mjs +1 -1
- package/dist/react-querybuilder_core.production.mjs.map +1 -1
- package/dist/transformQuery-B7d9AWUf.d.mts +116 -0
- package/dist/transformQuery-BXDiUBGB.d.ts +116 -0
- package/dist/transformQuery.d.mts +2 -116
- package/dist/transformQuery.d.ts +2 -116
- package/dist/transformQuery.js +3 -4
- package/dist/transformQuery.js.map +1 -1
- package/dist/transformQuery.mjs +1 -2
- package/dist/transformQuery.mjs.map +1 -1
- package/dist/utils-CP5Jqy1P.mjs +1294 -0
- package/dist/utils-CP5Jqy1P.mjs.map +1 -0
- package/dist/utils-e-7KHkjV.js +1779 -0
- package/dist/utils-e-7KHkjV.js.map +1 -0
- package/package.json +33 -22
- package/dist/isRuleGroup-0JNiQgLg.js.map +0 -1
- package/dist/isRuleGroup-CqLThsbu.mjs.map +0 -1
- package/dist/objectUtils-Cr02aGxb.js +0 -27
- package/dist/objectUtils-Cr02aGxb.js.map +0 -1
- package/dist/objectUtils-DBlmJgBf.mjs +0 -16
- package/dist/objectUtils-DBlmJgBf.mjs.map +0 -1
- package/dist/prepareQueryObjects-BnGL91Tt.js.map +0 -1
- package/dist/prepareQueryObjects-ChINDIap.mjs.map +0 -1
- package/dist/utils-4k-j5FBa.mjs +0 -537
- package/dist/utils-4k-j5FBa.mjs.map +0 -1
- package/dist/utils-C79dxwZb.js +0 -752
- package/dist/utils-C79dxwZb.js.map +0 -1
|
@@ -1,5 +1,646 @@
|
|
|
1
1
|
import { numericQuantity, numericRegex as numericRegex$1 } from "numeric-quantity";
|
|
2
|
-
import { current, freeze, isDraft, produce } from "immer";
|
|
2
|
+
import { Immer, current, freeze, isDraft, produce, setAutoFreeze as setAutoFreeze$1 } from "immer";
|
|
3
|
+
//#region src/controlPropKeys.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
|
+
const controlKeys = [
|
|
22
|
+
"actionElement",
|
|
23
|
+
"addGroupAction",
|
|
24
|
+
"addRuleAction",
|
|
25
|
+
"cloneGroupAction",
|
|
26
|
+
"cloneRuleAction",
|
|
27
|
+
"combinatorSelector",
|
|
28
|
+
"dragHandle",
|
|
29
|
+
"fieldSelector",
|
|
30
|
+
"inlineCombinator",
|
|
31
|
+
"lockGroupAction",
|
|
32
|
+
"lockRuleAction",
|
|
33
|
+
"matchModeEditor",
|
|
34
|
+
"muteGroupAction",
|
|
35
|
+
"muteRuleAction",
|
|
36
|
+
"notToggle",
|
|
37
|
+
"operatorSelector",
|
|
38
|
+
"removeGroupAction",
|
|
39
|
+
"removeRuleAction",
|
|
40
|
+
"rule",
|
|
41
|
+
"ruleGroup",
|
|
42
|
+
"ruleGroupBodyElements",
|
|
43
|
+
"ruleGroupHeaderElements",
|
|
44
|
+
"shiftActions",
|
|
45
|
+
"undoRedoActions",
|
|
46
|
+
"valueEditor",
|
|
47
|
+
"valueSelector",
|
|
48
|
+
"valueSourceSelector"
|
|
49
|
+
];
|
|
50
|
+
/**
|
|
51
|
+
* The full set of prop names each default control receives. Ports can use this to declare
|
|
52
|
+
* every prop explicitly instead of relying on fall-through/attribute inheritance.
|
|
53
|
+
*
|
|
54
|
+
* Each array is the complete, alphabetized key set of the control's props interface in
|
|
55
|
+
* `react-querybuilder`. The lists are written out in full rather than composed from shared
|
|
56
|
+
* bases because `--isolatedDeclarations` cannot infer array types built with spreads. A
|
|
57
|
+
* compile-time gate in `react-querybuilder` (`types/controlPropKeys.test.ts`) fails the build
|
|
58
|
+
* if any list drifts from its interface in either direction.
|
|
59
|
+
*
|
|
60
|
+
* @group Props
|
|
61
|
+
*/
|
|
62
|
+
const controlPropKeys = {
|
|
63
|
+
actionElement: [
|
|
64
|
+
"className",
|
|
65
|
+
"context",
|
|
66
|
+
"disabled",
|
|
67
|
+
"disabledTranslation",
|
|
68
|
+
"handleOnClick",
|
|
69
|
+
"label",
|
|
70
|
+
"level",
|
|
71
|
+
"path",
|
|
72
|
+
"ruleOrGroup",
|
|
73
|
+
"rules",
|
|
74
|
+
"schema",
|
|
75
|
+
"testID",
|
|
76
|
+
"title",
|
|
77
|
+
"validation"
|
|
78
|
+
],
|
|
79
|
+
addGroupAction: [
|
|
80
|
+
"className",
|
|
81
|
+
"context",
|
|
82
|
+
"disabled",
|
|
83
|
+
"disabledTranslation",
|
|
84
|
+
"handleOnClick",
|
|
85
|
+
"label",
|
|
86
|
+
"level",
|
|
87
|
+
"path",
|
|
88
|
+
"ruleOrGroup",
|
|
89
|
+
"rules",
|
|
90
|
+
"schema",
|
|
91
|
+
"testID",
|
|
92
|
+
"title",
|
|
93
|
+
"validation"
|
|
94
|
+
],
|
|
95
|
+
addRuleAction: [
|
|
96
|
+
"className",
|
|
97
|
+
"context",
|
|
98
|
+
"disabled",
|
|
99
|
+
"disabledTranslation",
|
|
100
|
+
"handleOnClick",
|
|
101
|
+
"label",
|
|
102
|
+
"level",
|
|
103
|
+
"path",
|
|
104
|
+
"ruleOrGroup",
|
|
105
|
+
"rules",
|
|
106
|
+
"schema",
|
|
107
|
+
"testID",
|
|
108
|
+
"title",
|
|
109
|
+
"validation"
|
|
110
|
+
],
|
|
111
|
+
cloneGroupAction: [
|
|
112
|
+
"className",
|
|
113
|
+
"context",
|
|
114
|
+
"disabled",
|
|
115
|
+
"disabledTranslation",
|
|
116
|
+
"handleOnClick",
|
|
117
|
+
"label",
|
|
118
|
+
"level",
|
|
119
|
+
"path",
|
|
120
|
+
"ruleOrGroup",
|
|
121
|
+
"rules",
|
|
122
|
+
"schema",
|
|
123
|
+
"testID",
|
|
124
|
+
"title",
|
|
125
|
+
"validation"
|
|
126
|
+
],
|
|
127
|
+
cloneRuleAction: [
|
|
128
|
+
"className",
|
|
129
|
+
"context",
|
|
130
|
+
"disabled",
|
|
131
|
+
"disabledTranslation",
|
|
132
|
+
"handleOnClick",
|
|
133
|
+
"label",
|
|
134
|
+
"level",
|
|
135
|
+
"path",
|
|
136
|
+
"ruleOrGroup",
|
|
137
|
+
"rules",
|
|
138
|
+
"schema",
|
|
139
|
+
"testID",
|
|
140
|
+
"title",
|
|
141
|
+
"validation"
|
|
142
|
+
],
|
|
143
|
+
combinatorSelector: [
|
|
144
|
+
"className",
|
|
145
|
+
"context",
|
|
146
|
+
"disabled",
|
|
147
|
+
"handleOnChange",
|
|
148
|
+
"level",
|
|
149
|
+
"options",
|
|
150
|
+
"path",
|
|
151
|
+
"ruleGroup",
|
|
152
|
+
"rules",
|
|
153
|
+
"schema",
|
|
154
|
+
"testID",
|
|
155
|
+
"title",
|
|
156
|
+
"validation",
|
|
157
|
+
"value"
|
|
158
|
+
],
|
|
159
|
+
dragHandle: [
|
|
160
|
+
"className",
|
|
161
|
+
"context",
|
|
162
|
+
"disabled",
|
|
163
|
+
"dragHandleAttributes",
|
|
164
|
+
"label",
|
|
165
|
+
"level",
|
|
166
|
+
"path",
|
|
167
|
+
"ruleOrGroup",
|
|
168
|
+
"schema",
|
|
169
|
+
"testID",
|
|
170
|
+
"title",
|
|
171
|
+
"validation"
|
|
172
|
+
],
|
|
173
|
+
fieldSelector: [
|
|
174
|
+
"className",
|
|
175
|
+
"context",
|
|
176
|
+
"disabled",
|
|
177
|
+
"handleOnChange",
|
|
178
|
+
"level",
|
|
179
|
+
"operator",
|
|
180
|
+
"options",
|
|
181
|
+
"path",
|
|
182
|
+
"rule",
|
|
183
|
+
"schema",
|
|
184
|
+
"testID",
|
|
185
|
+
"title",
|
|
186
|
+
"validation",
|
|
187
|
+
"value"
|
|
188
|
+
],
|
|
189
|
+
inlineCombinator: [
|
|
190
|
+
"className",
|
|
191
|
+
"component",
|
|
192
|
+
"context",
|
|
193
|
+
"disabled",
|
|
194
|
+
"handleOnChange",
|
|
195
|
+
"level",
|
|
196
|
+
"options",
|
|
197
|
+
"path",
|
|
198
|
+
"ruleGroup",
|
|
199
|
+
"rules",
|
|
200
|
+
"schema",
|
|
201
|
+
"testID",
|
|
202
|
+
"title",
|
|
203
|
+
"validation",
|
|
204
|
+
"value"
|
|
205
|
+
],
|
|
206
|
+
lockGroupAction: [
|
|
207
|
+
"className",
|
|
208
|
+
"context",
|
|
209
|
+
"disabled",
|
|
210
|
+
"disabledTranslation",
|
|
211
|
+
"handleOnClick",
|
|
212
|
+
"label",
|
|
213
|
+
"level",
|
|
214
|
+
"path",
|
|
215
|
+
"ruleOrGroup",
|
|
216
|
+
"rules",
|
|
217
|
+
"schema",
|
|
218
|
+
"testID",
|
|
219
|
+
"title",
|
|
220
|
+
"validation"
|
|
221
|
+
],
|
|
222
|
+
lockRuleAction: [
|
|
223
|
+
"className",
|
|
224
|
+
"context",
|
|
225
|
+
"disabled",
|
|
226
|
+
"disabledTranslation",
|
|
227
|
+
"handleOnClick",
|
|
228
|
+
"label",
|
|
229
|
+
"level",
|
|
230
|
+
"path",
|
|
231
|
+
"ruleOrGroup",
|
|
232
|
+
"rules",
|
|
233
|
+
"schema",
|
|
234
|
+
"testID",
|
|
235
|
+
"title",
|
|
236
|
+
"validation"
|
|
237
|
+
],
|
|
238
|
+
matchModeEditor: [
|
|
239
|
+
"className",
|
|
240
|
+
"classNames",
|
|
241
|
+
"context",
|
|
242
|
+
"disabled",
|
|
243
|
+
"field",
|
|
244
|
+
"fieldData",
|
|
245
|
+
"handleOnChange",
|
|
246
|
+
"level",
|
|
247
|
+
"match",
|
|
248
|
+
"numericEditorComponent",
|
|
249
|
+
"options",
|
|
250
|
+
"path",
|
|
251
|
+
"rule",
|
|
252
|
+
"schema",
|
|
253
|
+
"selectorComponent",
|
|
254
|
+
"testID",
|
|
255
|
+
"thresholdPlaceholder",
|
|
256
|
+
"title",
|
|
257
|
+
"validation",
|
|
258
|
+
"value"
|
|
259
|
+
],
|
|
260
|
+
muteGroupAction: [
|
|
261
|
+
"className",
|
|
262
|
+
"context",
|
|
263
|
+
"disabled",
|
|
264
|
+
"disabledTranslation",
|
|
265
|
+
"handleOnClick",
|
|
266
|
+
"label",
|
|
267
|
+
"level",
|
|
268
|
+
"path",
|
|
269
|
+
"ruleOrGroup",
|
|
270
|
+
"rules",
|
|
271
|
+
"schema",
|
|
272
|
+
"testID",
|
|
273
|
+
"title",
|
|
274
|
+
"validation"
|
|
275
|
+
],
|
|
276
|
+
muteRuleAction: [
|
|
277
|
+
"className",
|
|
278
|
+
"context",
|
|
279
|
+
"disabled",
|
|
280
|
+
"disabledTranslation",
|
|
281
|
+
"handleOnClick",
|
|
282
|
+
"label",
|
|
283
|
+
"level",
|
|
284
|
+
"path",
|
|
285
|
+
"ruleOrGroup",
|
|
286
|
+
"rules",
|
|
287
|
+
"schema",
|
|
288
|
+
"testID",
|
|
289
|
+
"title",
|
|
290
|
+
"validation"
|
|
291
|
+
],
|
|
292
|
+
notToggle: [
|
|
293
|
+
"checked",
|
|
294
|
+
"className",
|
|
295
|
+
"context",
|
|
296
|
+
"disabled",
|
|
297
|
+
"handleOnChange",
|
|
298
|
+
"label",
|
|
299
|
+
"level",
|
|
300
|
+
"path",
|
|
301
|
+
"ruleGroup",
|
|
302
|
+
"schema",
|
|
303
|
+
"testID",
|
|
304
|
+
"title",
|
|
305
|
+
"validation"
|
|
306
|
+
],
|
|
307
|
+
operatorSelector: [
|
|
308
|
+
"className",
|
|
309
|
+
"context",
|
|
310
|
+
"disabled",
|
|
311
|
+
"field",
|
|
312
|
+
"fieldData",
|
|
313
|
+
"handleOnChange",
|
|
314
|
+
"level",
|
|
315
|
+
"options",
|
|
316
|
+
"path",
|
|
317
|
+
"rule",
|
|
318
|
+
"schema",
|
|
319
|
+
"testID",
|
|
320
|
+
"title",
|
|
321
|
+
"validation",
|
|
322
|
+
"value"
|
|
323
|
+
],
|
|
324
|
+
removeGroupAction: [
|
|
325
|
+
"className",
|
|
326
|
+
"context",
|
|
327
|
+
"disabled",
|
|
328
|
+
"disabledTranslation",
|
|
329
|
+
"handleOnClick",
|
|
330
|
+
"label",
|
|
331
|
+
"level",
|
|
332
|
+
"path",
|
|
333
|
+
"ruleOrGroup",
|
|
334
|
+
"rules",
|
|
335
|
+
"schema",
|
|
336
|
+
"testID",
|
|
337
|
+
"title",
|
|
338
|
+
"validation"
|
|
339
|
+
],
|
|
340
|
+
removeRuleAction: [
|
|
341
|
+
"className",
|
|
342
|
+
"context",
|
|
343
|
+
"disabled",
|
|
344
|
+
"disabledTranslation",
|
|
345
|
+
"handleOnClick",
|
|
346
|
+
"label",
|
|
347
|
+
"level",
|
|
348
|
+
"path",
|
|
349
|
+
"ruleOrGroup",
|
|
350
|
+
"rules",
|
|
351
|
+
"schema",
|
|
352
|
+
"testID",
|
|
353
|
+
"title",
|
|
354
|
+
"validation"
|
|
355
|
+
],
|
|
356
|
+
rule: [
|
|
357
|
+
"actions",
|
|
358
|
+
"context",
|
|
359
|
+
"disabled",
|
|
360
|
+
"dndRef",
|
|
361
|
+
"dragHandleAttributes",
|
|
362
|
+
"dragMonitorId",
|
|
363
|
+
"dragRef",
|
|
364
|
+
"dropEffect",
|
|
365
|
+
"dropMonitorId",
|
|
366
|
+
"dropNotAllowed",
|
|
367
|
+
"field",
|
|
368
|
+
"groupItems",
|
|
369
|
+
"id",
|
|
370
|
+
"isDragging",
|
|
371
|
+
"isOver",
|
|
372
|
+
"operator",
|
|
373
|
+
"parentDisabled",
|
|
374
|
+
"parentMuted",
|
|
375
|
+
"path",
|
|
376
|
+
"rule",
|
|
377
|
+
"schema",
|
|
378
|
+
"shiftDownDisabled",
|
|
379
|
+
"shiftUpDisabled",
|
|
380
|
+
"translations",
|
|
381
|
+
"value",
|
|
382
|
+
"valueSource"
|
|
383
|
+
],
|
|
384
|
+
ruleGroup: [
|
|
385
|
+
"actions",
|
|
386
|
+
"combinator",
|
|
387
|
+
"context",
|
|
388
|
+
"disabled",
|
|
389
|
+
"dragHandleAttributes",
|
|
390
|
+
"dragMonitorId",
|
|
391
|
+
"dragRef",
|
|
392
|
+
"dropEffect",
|
|
393
|
+
"dropMonitorId",
|
|
394
|
+
"dropNotAllowed",
|
|
395
|
+
"dropRef",
|
|
396
|
+
"groupItems",
|
|
397
|
+
"id",
|
|
398
|
+
"isDragging",
|
|
399
|
+
"isOver",
|
|
400
|
+
"not",
|
|
401
|
+
"parentDisabled",
|
|
402
|
+
"parentMuted",
|
|
403
|
+
"path",
|
|
404
|
+
"previewRef",
|
|
405
|
+
"ruleGroup",
|
|
406
|
+
"rules",
|
|
407
|
+
"schema",
|
|
408
|
+
"shiftDownDisabled",
|
|
409
|
+
"shiftUpDisabled",
|
|
410
|
+
"translations"
|
|
411
|
+
],
|
|
412
|
+
ruleGroupBodyElements: [
|
|
413
|
+
"accessibleDescription",
|
|
414
|
+
"actions",
|
|
415
|
+
"addGroup",
|
|
416
|
+
"addRule",
|
|
417
|
+
"classNames",
|
|
418
|
+
"cloneGroup",
|
|
419
|
+
"combinator",
|
|
420
|
+
"context",
|
|
421
|
+
"disabled",
|
|
422
|
+
"dragHandleAttributes",
|
|
423
|
+
"dragMonitorId",
|
|
424
|
+
"dragRef",
|
|
425
|
+
"dropEffect",
|
|
426
|
+
"dropMonitorId",
|
|
427
|
+
"dropNotAllowed",
|
|
428
|
+
"dropRef",
|
|
429
|
+
"groupItems",
|
|
430
|
+
"id",
|
|
431
|
+
"isDragging",
|
|
432
|
+
"isOver",
|
|
433
|
+
"muted",
|
|
434
|
+
"not",
|
|
435
|
+
"onCombinatorChange",
|
|
436
|
+
"onGroupAdd",
|
|
437
|
+
"onIndependentCombinatorChange",
|
|
438
|
+
"onNotToggleChange",
|
|
439
|
+
"outerClassName",
|
|
440
|
+
"parentDisabled",
|
|
441
|
+
"parentMuted",
|
|
442
|
+
"path",
|
|
443
|
+
"pathsMemo",
|
|
444
|
+
"previewRef",
|
|
445
|
+
"removeGroup",
|
|
446
|
+
"ruleGroup",
|
|
447
|
+
"rules",
|
|
448
|
+
"schema",
|
|
449
|
+
"shiftDownDisabled",
|
|
450
|
+
"shiftGroupDown",
|
|
451
|
+
"shiftGroupUp",
|
|
452
|
+
"shiftUpDisabled",
|
|
453
|
+
"toggleLockGroup",
|
|
454
|
+
"toggleMuteGroup",
|
|
455
|
+
"translations",
|
|
456
|
+
"validationClassName",
|
|
457
|
+
"validationResult"
|
|
458
|
+
],
|
|
459
|
+
ruleGroupHeaderElements: [
|
|
460
|
+
"accessibleDescription",
|
|
461
|
+
"actions",
|
|
462
|
+
"addGroup",
|
|
463
|
+
"addRule",
|
|
464
|
+
"classNames",
|
|
465
|
+
"cloneGroup",
|
|
466
|
+
"combinator",
|
|
467
|
+
"context",
|
|
468
|
+
"disabled",
|
|
469
|
+
"dragHandleAttributes",
|
|
470
|
+
"dragMonitorId",
|
|
471
|
+
"dragRef",
|
|
472
|
+
"dropEffect",
|
|
473
|
+
"dropMonitorId",
|
|
474
|
+
"dropNotAllowed",
|
|
475
|
+
"dropRef",
|
|
476
|
+
"groupItems",
|
|
477
|
+
"id",
|
|
478
|
+
"isDragging",
|
|
479
|
+
"isOver",
|
|
480
|
+
"muted",
|
|
481
|
+
"not",
|
|
482
|
+
"onCombinatorChange",
|
|
483
|
+
"onGroupAdd",
|
|
484
|
+
"onIndependentCombinatorChange",
|
|
485
|
+
"onNotToggleChange",
|
|
486
|
+
"outerClassName",
|
|
487
|
+
"parentDisabled",
|
|
488
|
+
"parentMuted",
|
|
489
|
+
"path",
|
|
490
|
+
"pathsMemo",
|
|
491
|
+
"previewRef",
|
|
492
|
+
"removeGroup",
|
|
493
|
+
"ruleGroup",
|
|
494
|
+
"rules",
|
|
495
|
+
"schema",
|
|
496
|
+
"shiftDownDisabled",
|
|
497
|
+
"shiftGroupDown",
|
|
498
|
+
"shiftGroupUp",
|
|
499
|
+
"shiftUpDisabled",
|
|
500
|
+
"toggleLockGroup",
|
|
501
|
+
"toggleMuteGroup",
|
|
502
|
+
"translations",
|
|
503
|
+
"validationClassName",
|
|
504
|
+
"validationResult"
|
|
505
|
+
],
|
|
506
|
+
shiftActions: [
|
|
507
|
+
"className",
|
|
508
|
+
"context",
|
|
509
|
+
"disabled",
|
|
510
|
+
"labels",
|
|
511
|
+
"level",
|
|
512
|
+
"path",
|
|
513
|
+
"ruleOrGroup",
|
|
514
|
+
"schema",
|
|
515
|
+
"shiftDown",
|
|
516
|
+
"shiftDownDisabled",
|
|
517
|
+
"shiftUp",
|
|
518
|
+
"shiftUpDisabled",
|
|
519
|
+
"testID",
|
|
520
|
+
"title",
|
|
521
|
+
"titles",
|
|
522
|
+
"validation"
|
|
523
|
+
],
|
|
524
|
+
undoRedoActions: [
|
|
525
|
+
"className",
|
|
526
|
+
"classNames",
|
|
527
|
+
"context",
|
|
528
|
+
"disabled",
|
|
529
|
+
"labels",
|
|
530
|
+
"level",
|
|
531
|
+
"path",
|
|
532
|
+
"ruleOrGroup",
|
|
533
|
+
"schema",
|
|
534
|
+
"testID",
|
|
535
|
+
"title",
|
|
536
|
+
"titles",
|
|
537
|
+
"validation"
|
|
538
|
+
],
|
|
539
|
+
valueEditor: [
|
|
540
|
+
"className",
|
|
541
|
+
"context",
|
|
542
|
+
"disabled",
|
|
543
|
+
"field",
|
|
544
|
+
"fieldData",
|
|
545
|
+
"handleOnChange",
|
|
546
|
+
"inputType",
|
|
547
|
+
"level",
|
|
548
|
+
"listsAsArrays",
|
|
549
|
+
"operator",
|
|
550
|
+
"parseNumbers",
|
|
551
|
+
"path",
|
|
552
|
+
"rule",
|
|
553
|
+
"schema",
|
|
554
|
+
"selectorComponent",
|
|
555
|
+
"separator",
|
|
556
|
+
"skipHook",
|
|
557
|
+
"testID",
|
|
558
|
+
"title",
|
|
559
|
+
"type",
|
|
560
|
+
"validation",
|
|
561
|
+
"value",
|
|
562
|
+
"valueSource",
|
|
563
|
+
"values"
|
|
564
|
+
],
|
|
565
|
+
valueSelector: [
|
|
566
|
+
"className",
|
|
567
|
+
"context",
|
|
568
|
+
"disabled",
|
|
569
|
+
"handleOnChange",
|
|
570
|
+
"level",
|
|
571
|
+
"listsAsArrays",
|
|
572
|
+
"multiple",
|
|
573
|
+
"options",
|
|
574
|
+
"path",
|
|
575
|
+
"schema",
|
|
576
|
+
"testID",
|
|
577
|
+
"title",
|
|
578
|
+
"validation",
|
|
579
|
+
"value"
|
|
580
|
+
],
|
|
581
|
+
valueSourceSelector: [
|
|
582
|
+
"className",
|
|
583
|
+
"context",
|
|
584
|
+
"disabled",
|
|
585
|
+
"field",
|
|
586
|
+
"fieldData",
|
|
587
|
+
"handleOnChange",
|
|
588
|
+
"level",
|
|
589
|
+
"options",
|
|
590
|
+
"path",
|
|
591
|
+
"rule",
|
|
592
|
+
"schema",
|
|
593
|
+
"testID",
|
|
594
|
+
"title",
|
|
595
|
+
"validation",
|
|
596
|
+
"value"
|
|
597
|
+
]
|
|
598
|
+
};
|
|
599
|
+
/**
|
|
600
|
+
* Which bulk override, if any, applies to each control: `"action"` for controls that a supplied
|
|
601
|
+
* `actionElement` replaces, `"selector"` for controls that a supplied `valueSelector` replaces,
|
|
602
|
+
* and `null` for controls that neither replaces.
|
|
603
|
+
*
|
|
604
|
+
* `actionElement` and `valueSelector` are themselves `null`—they are the _source_ of a bulk
|
|
605
|
+
* override, not a target of one.
|
|
606
|
+
*
|
|
607
|
+
* Replaces name-suffix sniffing (`key.endsWith('Action')`), which would silently misclassify a
|
|
608
|
+
* future control named e.g. `pathSelector`, and which disagrees between implementations about
|
|
609
|
+
* whether `shiftActions`/`undoRedoActions` (plural) match. They do not: neither receives the
|
|
610
|
+
* `actionElement` bulk override.
|
|
611
|
+
*
|
|
612
|
+
* @group Props
|
|
613
|
+
*/
|
|
614
|
+
const controlKind = {
|
|
615
|
+
actionElement: null,
|
|
616
|
+
addGroupAction: "action",
|
|
617
|
+
addRuleAction: "action",
|
|
618
|
+
cloneGroupAction: "action",
|
|
619
|
+
cloneRuleAction: "action",
|
|
620
|
+
combinatorSelector: "selector",
|
|
621
|
+
dragHandle: null,
|
|
622
|
+
fieldSelector: "selector",
|
|
623
|
+
inlineCombinator: null,
|
|
624
|
+
lockGroupAction: "action",
|
|
625
|
+
lockRuleAction: "action",
|
|
626
|
+
matchModeEditor: null,
|
|
627
|
+
muteGroupAction: "action",
|
|
628
|
+
muteRuleAction: "action",
|
|
629
|
+
notToggle: null,
|
|
630
|
+
operatorSelector: "selector",
|
|
631
|
+
removeGroupAction: "action",
|
|
632
|
+
removeRuleAction: "action",
|
|
633
|
+
rule: null,
|
|
634
|
+
ruleGroup: null,
|
|
635
|
+
ruleGroupBodyElements: null,
|
|
636
|
+
ruleGroupHeaderElements: null,
|
|
637
|
+
shiftActions: null,
|
|
638
|
+
undoRedoActions: null,
|
|
639
|
+
valueEditor: null,
|
|
640
|
+
valueSelector: null,
|
|
641
|
+
valueSourceSelector: "selector"
|
|
642
|
+
};
|
|
643
|
+
//#endregion
|
|
3
644
|
//#region src/defaults.ts
|
|
4
645
|
/**
|
|
5
646
|
* @group Defaults
|
|
@@ -648,6 +1289,31 @@ const defaultMaxHistory = 50;
|
|
|
648
1289
|
*/
|
|
649
1290
|
const defaultCoalesceMs = 500;
|
|
650
1291
|
//#endregion
|
|
1292
|
+
//#region src/utils/abortReasons.ts
|
|
1293
|
+
/**
|
|
1294
|
+
* Abort reasons that {@link QueryManager}'s `strict` mode treats as errors. The remaining
|
|
1295
|
+
* reasons—`"same-location"` and `"no-change"`—describe valid operations that had nothing to do,
|
|
1296
|
+
* so they are reported to `onInvalidTarget` but never throw.
|
|
1297
|
+
*
|
|
1298
|
+
* Declared apart from `QueryManager` so the `@react-querybuilder/core/derivations` entry point can
|
|
1299
|
+
* export it without putting the manager in its module graph.
|
|
1300
|
+
*
|
|
1301
|
+
* @group Query Tools
|
|
1302
|
+
*/
|
|
1303
|
+
const strictAbortReasons = [
|
|
1304
|
+
"target-not-found",
|
|
1305
|
+
"parent-not-found",
|
|
1306
|
+
"parent-not-a-group",
|
|
1307
|
+
"destination-not-found",
|
|
1308
|
+
"root-not-allowed",
|
|
1309
|
+
"not-a-combinator-slot",
|
|
1310
|
+
"target-disabled",
|
|
1311
|
+
"parent-disabled",
|
|
1312
|
+
"max-levels-exceeded"
|
|
1313
|
+
];
|
|
1314
|
+
/** @internal */
|
|
1315
|
+
const strictAbortReasonSet = new Set(strictAbortReasons);
|
|
1316
|
+
//#endregion
|
|
651
1317
|
//#region src/utils/arrayUtils.ts
|
|
652
1318
|
/**
|
|
653
1319
|
* Splits a string by a given character (see {@link defaultJoinChar}). Escaped characters
|
|
@@ -750,6 +1416,94 @@ const isRuleGroupType = (rg) => isRuleGroup(rg) && typeof rg.combinator === "str
|
|
|
750
1416
|
*/
|
|
751
1417
|
const isRuleGroupTypeIC = (rg) => isRuleGroup(rg) && rg.combinator === void 0;
|
|
752
1418
|
//#endregion
|
|
1419
|
+
//#region src/utils/signature.ts
|
|
1420
|
+
/**
|
|
1421
|
+
* Signature returned when a change alters the _shape_ of the query—rules or groups added,
|
|
1422
|
+
* removed, moved, or reordered—rather than the properties of a single node. Structural changes
|
|
1423
|
+
* never coalesce with each other, so each one produces its own history entry.
|
|
1424
|
+
*/
|
|
1425
|
+
const structuralSignature = "~structural";
|
|
1426
|
+
/**
|
|
1427
|
+
* Signature returned when two queries differ by reference only, with no observable difference
|
|
1428
|
+
* in their properties.
|
|
1429
|
+
*/
|
|
1430
|
+
const unchangedSignature = "";
|
|
1431
|
+
/**
|
|
1432
|
+
* Returns the list of property names that differ between two nodes, ignoring `rules` (which is
|
|
1433
|
+
* compared structurally by the caller).
|
|
1434
|
+
*/
|
|
1435
|
+
const changedProps = (prev, next) => {
|
|
1436
|
+
const keys = /* @__PURE__ */ new Set([...Object.keys(prev), ...Object.keys(next)]);
|
|
1437
|
+
keys.delete("rules");
|
|
1438
|
+
const changed = [];
|
|
1439
|
+
for (const key of keys) if (!Object.is(prev[key], next[key])) changed.push(key);
|
|
1440
|
+
return changed.toSorted();
|
|
1441
|
+
};
|
|
1442
|
+
const signatureOfNode = (prev, next, parentId, index) => {
|
|
1443
|
+
if (prev === next) return "";
|
|
1444
|
+
if (typeof prev === "string" || typeof next === "string") return typeof prev === typeof next ? `${parentId}:combinator[${index}]` : structuralSignature;
|
|
1445
|
+
const prevIsGroup = isRuleGroup(prev);
|
|
1446
|
+
const nextIsGroup = isRuleGroup(next);
|
|
1447
|
+
if (prevIsGroup !== nextIsGroup) return structuralSignature;
|
|
1448
|
+
if (!prevIsGroup || !nextIsGroup) {
|
|
1449
|
+
const props = changedProps(prev, next);
|
|
1450
|
+
return props.length === 0 ? "" : `${next.id ?? ""}:${props.join(",")}`;
|
|
1451
|
+
}
|
|
1452
|
+
if (prev.rules.length !== next.rules.length) return structuralSignature;
|
|
1453
|
+
const ownProps = changedProps(prev, next);
|
|
1454
|
+
let changedIndex = -1;
|
|
1455
|
+
for (const [i, prevRule] of prev.rules.entries()) if (prevRule !== next.rules[i]) {
|
|
1456
|
+
if (changedIndex !== -1) return structuralSignature;
|
|
1457
|
+
changedIndex = i;
|
|
1458
|
+
}
|
|
1459
|
+
if (changedIndex === -1) return ownProps.length === 0 ? "" : `${next.id ?? ""}:${ownProps.join(",")}`;
|
|
1460
|
+
if (ownProps.length > 0) return structuralSignature;
|
|
1461
|
+
return signatureOfNode(prev.rules[changedIndex], next.rules[changedIndex], next.id ?? "", changedIndex);
|
|
1462
|
+
};
|
|
1463
|
+
/**
|
|
1464
|
+
* Describes _what changed_ between two versions of a query as a short string, so that
|
|
1465
|
+
* consecutive edits to the same property of the same rule (e.g. typing in a value editor) can
|
|
1466
|
+
* be recognized and coalesced into a single history entry.
|
|
1467
|
+
*
|
|
1468
|
+
* Returns {@link structuralSignature} for changes to the shape of the query, {@link unchangedSignature} when the
|
|
1469
|
+
* two queries differ by reference only, and `"<id>:<props>"` otherwise.
|
|
1470
|
+
*
|
|
1471
|
+
* The walk prunes on reference equality, so it costs O(depth) rather than O(size) for the
|
|
1472
|
+
* single-node edits that make up the overwhelming majority of changes.
|
|
1473
|
+
*
|
|
1474
|
+
* Note that this relies on the structural sharing that Immer—and therefore every query
|
|
1475
|
+
* produced by RQB's own update functions—guarantees: nodes that did not change keep their
|
|
1476
|
+
* identity. A query that has been wholly rebuilt (deep-cloned, round-tripped through JSON,
|
|
1477
|
+
* re-parsed from a string) shares no identity with its predecessor, so it is reported as
|
|
1478
|
+
* {@link structuralSignature} and will not coalesce. That is a graceful degradation—every change simply
|
|
1479
|
+
* gets its own history entry—but controlled components that clone the query on every change
|
|
1480
|
+
* will not benefit from coalescing.
|
|
1481
|
+
*/
|
|
1482
|
+
const signatureOf = (prev, next) => signatureOfNode(prev, next, "", -1);
|
|
1483
|
+
//#endregion
|
|
1484
|
+
//#region src/utils/coalesce.ts
|
|
1485
|
+
/**
|
|
1486
|
+
* Determines whether a change should be absorbed into the current history entry instead of
|
|
1487
|
+
* pushing a new one. This is the exact rule {@link QueryManager} applies when recording history,
|
|
1488
|
+
* exposed so non-React implementations can manage their own history stacks without
|
|
1489
|
+
* reimplementing (and drifting from) the semantics.
|
|
1490
|
+
*
|
|
1491
|
+
* A change coalesces only when all three hold:
|
|
1492
|
+
* - the change is not structural (rules/groups added, removed, moved, or reordered)
|
|
1493
|
+
* - its signature matches the previously recorded signature
|
|
1494
|
+
* - it occurred within `coalesceMs` of the previous recording
|
|
1495
|
+
*
|
|
1496
|
+
* Note that {@link unchangedSignature} is not handled here. A change with no observable
|
|
1497
|
+
* difference is never recorded at all, which is a separate decision made before this check.
|
|
1498
|
+
*
|
|
1499
|
+
* @param prevSig Signature of the previously recorded change, or `undefined` if there is none.
|
|
1500
|
+
* @param nextSig Signature of the change being recorded, from {@link signatureOf}.
|
|
1501
|
+
* @param prevAt Timestamp of the previous recording.
|
|
1502
|
+
* @param now Timestamp of the change being recorded.
|
|
1503
|
+
* @param coalesceMs Coalescing window in milliseconds.
|
|
1504
|
+
*/
|
|
1505
|
+
const shouldCoalesce = (prevSig, nextSig, prevAt, now, coalesceMs = 500) => nextSig !== "~structural" && nextSig === prevSig && now >= prevAt && now - prevAt < coalesceMs;
|
|
1506
|
+
//#endregion
|
|
753
1507
|
//#region src/utils/convertQuery.ts
|
|
754
1508
|
const combinatorLevels = [
|
|
755
1509
|
"or",
|
|
@@ -1263,6 +2017,20 @@ const uniqOptList = (originalArray) => {
|
|
|
1263
2017
|
if (isFlexibleOptionGroupArray(originalArray)) return uniqOptGroups(originalArray);
|
|
1264
2018
|
return uniqByIdentifier(originalArray.map((o) => toFullOption(o)));
|
|
1265
2019
|
};
|
|
2020
|
+
/**
|
|
2021
|
+
* Normalizes any accepted option list shape—array, option groups, or a record—into a
|
|
2022
|
+
* `FullOptionList`, applying `baseOption` properties and (when `autoSelectOption` is `false`)
|
|
2023
|
+
* a leading placeholder option. Also returns the flattened lookup map and the option that
|
|
2024
|
+
* should be selected by default.
|
|
2025
|
+
*
|
|
2026
|
+
* Note: `labelMap` overrides only apply to array/option group input (where string options are
|
|
2027
|
+
* expanded); record input derives labels from the record values themselves.
|
|
2028
|
+
*
|
|
2029
|
+
* This is the same normalization `<QueryBuilder />` applies to `fields`, `operators`,
|
|
2030
|
+
* `combinators`, and value lists, so a non-React implementation resolves options identically.
|
|
2031
|
+
*
|
|
2032
|
+
* @group Option Lists
|
|
2033
|
+
*/
|
|
1266
2034
|
const prepareOptionList = (props) => {
|
|
1267
2035
|
// v8 ignore next
|
|
1268
2036
|
const { optionList: optionListPropOriginal, baseOption = {}, labelMap = {}, placeholder: { placeholderName = "~", placeholderLabel = defaultPlaceholderLabel, placeholderGroupLabel = defaultPlaceholderLabel } = {}, autoSelectOption = true } = props;
|
|
@@ -4561,8 +5329,10 @@ const defaultRuleProcessorParameterized = (rule, opts, meta) => {
|
|
|
4561
5329
|
return finalize(`${qPre}${rule.field}${qPost} ${sqlOperator} ${paramPrefix}${firstParamName} and ${paramPrefix}${secondParamName}`);
|
|
4562
5330
|
}
|
|
4563
5331
|
let paramValue = rule.value;
|
|
4564
|
-
if (typeof rule.value === "string")
|
|
4565
|
-
|
|
5332
|
+
if (typeof rule.value === "string") {
|
|
5333
|
+
if (shouldRenderAsNumber(rule.value, parseNumbers)) paramValue = parseNumber(rule.value, { parseNumbers });
|
|
5334
|
+
else paramValue = /^'.*'$/g.test(value) ? value.replaceAll(/(^'|'$)/g, "") : /* v8 ignore next -- @preserve */ value;
|
|
5335
|
+
}
|
|
4566
5336
|
let paramName = "";
|
|
4567
5337
|
if (parameterized) params.push(paramValue);
|
|
4568
5338
|
else {
|
|
@@ -5284,6 +6054,12 @@ const derivePathInfo = (path, childCount, { disabled = false, disabledPaths = []
|
|
|
5284
6054
|
};
|
|
5285
6055
|
//#endregion
|
|
5286
6056
|
//#region src/utils/generateAccessibleDescription.ts
|
|
6057
|
+
/**
|
|
6058
|
+
* The default `accessibleDescriptionGenerator`. Produces the `aria-label` for a rule group:
|
|
6059
|
+
* `"Query builder"` for the root group, `"Rule group at path 0-1"` for any other.
|
|
6060
|
+
*
|
|
6061
|
+
* @group Accessibility
|
|
6062
|
+
*/
|
|
5287
6063
|
const generateAccessibleDescription = (params) => pathsAreEqual([], params.path) ? `Query builder` : `Rule group at path ${params.path.join("-")}`;
|
|
5288
6064
|
//#endregion
|
|
5289
6065
|
//#region src/utils/generateID.ts
|
|
@@ -5322,6 +6098,29 @@ if (cryptoModule) {
|
|
|
5322
6098
|
}
|
|
5323
6099
|
}
|
|
5324
6100
|
//#endregion
|
|
6101
|
+
//#region src/utils/immerInstances.ts
|
|
6102
|
+
/**
|
|
6103
|
+
* Globally enables or disables immer's auto-freeze, i.e. the deep freeze applied to every query
|
|
6104
|
+
* returned by {@link add}, {@link update}, {@link remove}, {@link move}, {@link insert}, and
|
|
6105
|
+
* {@link group}.
|
|
6106
|
+
*
|
|
6107
|
+
* Re-exported from immer so that consumers mixing these tools with their own `produce` calls can
|
|
6108
|
+
* switch both at once. Prefer the per-call `freeze` option, or the {@link QueryManager} option of
|
|
6109
|
+
* the same name, when the change should not be process-wide. A per-call `freeze: false` wins
|
|
6110
|
+
* regardless of this setting; a per-call `freeze: true` does not re-enable freezing once this has
|
|
6111
|
+
* turned it off, since it selects immer's default instance.
|
|
6112
|
+
*
|
|
6113
|
+
* @group Query Tools
|
|
6114
|
+
*/
|
|
6115
|
+
const setAutoFreeze = setAutoFreeze$1;
|
|
6116
|
+
const unfrozenImmer = new Immer({ autoFreeze: false });
|
|
6117
|
+
/**
|
|
6118
|
+
* The `produce` implementation matching the requested freeze behavior.
|
|
6119
|
+
*
|
|
6120
|
+
* @internal
|
|
6121
|
+
*/
|
|
6122
|
+
const producerFor = (freeze = true) => freeze ? produce : unfrozenImmer.produce;
|
|
6123
|
+
//#endregion
|
|
5325
6124
|
//#region src/utils/getMatchModesUtil.ts
|
|
5326
6125
|
const dummyFD$1 = {
|
|
5327
6126
|
name: "name",
|
|
@@ -5574,6 +6373,46 @@ const resolveValueList = ({ field, operator, fieldData, getValues, placeholder,
|
|
|
5574
6373
|
autoSelectOption
|
|
5575
6374
|
}).optionList;
|
|
5576
6375
|
//#endregion
|
|
6376
|
+
//#region src/utils/optionsEqual.ts
|
|
6377
|
+
const isPlainObject = (x) => {
|
|
6378
|
+
const proto = Object.getPrototypeOf(x);
|
|
6379
|
+
return proto === null || proto === Object.prototype;
|
|
6380
|
+
};
|
|
6381
|
+
/**
|
|
6382
|
+
* Structural equality for {@link QueryManagerOptions} values. Arrays and plain objects are
|
|
6383
|
+
* compared by value; everything else — functions, class instances, `Map`s, `Date`s — by
|
|
6384
|
+
* identity.
|
|
6385
|
+
*
|
|
6386
|
+
* That split is what makes an options object rebuilt on every render compare equal as long as
|
|
6387
|
+
* its _data_ did not change, which is the entire point: a caller that passes object literals
|
|
6388
|
+
* (`fields={[...]}`, `translations={{...}}`) hands a fresh identity to every reconfigure, so an
|
|
6389
|
+
* identity-only comparison would report a change every time.
|
|
6390
|
+
*
|
|
6391
|
+
* Comparing functions by identity is deliberate rather than a limitation. Two functions cannot
|
|
6392
|
+
* be proven equivalent, so a caller that rebuilds `getDefaultValue` per render must either
|
|
6393
|
+
* memoize it or accept the reconfigure.
|
|
6394
|
+
*/
|
|
6395
|
+
const valuesEqual = (a, b) => {
|
|
6396
|
+
if (Object.is(a, b)) return true;
|
|
6397
|
+
if (Array.isArray(a) || Array.isArray(b)) return Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((v, i) => valuesEqual(v, b[i]));
|
|
6398
|
+
if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) return false;
|
|
6399
|
+
if (Object.getPrototypeOf(a) !== Object.getPrototypeOf(b) || !isPlainObject(a)) return false;
|
|
6400
|
+
const aKeys = Object.keys(a);
|
|
6401
|
+
return aKeys.length === Object.keys(b).length && aKeys.every((k) => valuesEqual(a[k], b[k]));
|
|
6402
|
+
};
|
|
6403
|
+
/**
|
|
6404
|
+
* Whether two {@link QueryManagerOptions} objects describe the same configuration, per
|
|
6405
|
+
* {@link valuesEqual}: data by value, functions by identity.
|
|
6406
|
+
*
|
|
6407
|
+
* {@link QueryManager.reconfigure} uses this to gate itself, so most callers never need it
|
|
6408
|
+
* directly. It is exported for framework adapters that decide whether to _call_ `reconfigure`
|
|
6409
|
+
* at all — skipping the call avoids building the merged options object in the first place.
|
|
6410
|
+
*
|
|
6411
|
+
* Nested option objects (`history`, `translations`, …) are descended into rather than compared
|
|
6412
|
+
* by identity, so `{ history: { maxHistory: 10 } }` rebuilt per render compares equal.
|
|
6413
|
+
*/
|
|
6414
|
+
const optionsEqual = (a, b) => valuesEqual(a, b);
|
|
6415
|
+
//#endregion
|
|
5577
6416
|
//#region src/utils/preferProp.ts
|
|
5578
6417
|
const preferPropDefaultTrue = (prop, context) => prop === false ? false : prop ? true : !(context === false);
|
|
5579
6418
|
const preferPropDefaultFalse = (prop, context) => prop ? true : prop === false ? false : !!context;
|
|
@@ -5710,7 +6549,7 @@ const exceedsMaxLevels = (parentPath, { maxLevels = Infinity } = {}) => !!parent
|
|
|
5710
6549
|
*
|
|
5711
6550
|
* @group Query Tools
|
|
5712
6551
|
*/
|
|
5713
|
-
const add = (query, ruleOrGroup, parentPathOrID, options = {}) =>
|
|
6552
|
+
const add = (query, ruleOrGroup, parentPathOrID, options = {}) => producerFor(options.freeze)(query, (q) => addInPlace(q, ruleOrGroup, parentPathOrID, options));
|
|
5714
6553
|
/**
|
|
5715
6554
|
* Adds a rule or group to a query in place.
|
|
5716
6555
|
*
|
|
@@ -5802,6 +6641,11 @@ const normalizeUpdateArgs = (a, b, c, d) => {
|
|
|
5802
6641
|
};
|
|
5803
6642
|
};
|
|
5804
6643
|
/**
|
|
6644
|
+
* The options argument of an {@link update} call, whose position depends on the argument form.
|
|
6645
|
+
* Cheaper than {@link normalizeUpdateArgs} when only the options are needed.
|
|
6646
|
+
*/
|
|
6647
|
+
const updateOptionsOf = (a, b, c, d) => (typeof a === "string" || Array.isArray(a) ? d : c) ?? {};
|
|
6648
|
+
/**
|
|
5805
6649
|
* Applies one or more property updates to a query in place. Shared by
|
|
5806
6650
|
* {@link update} and {@link updateInPlace}.
|
|
5807
6651
|
*/
|
|
@@ -5822,7 +6666,7 @@ const applyUpdatesInPlace = (query, a, b, c, d) => {
|
|
|
5822
6666
|
*
|
|
5823
6667
|
* @group Query Tools
|
|
5824
6668
|
*/
|
|
5825
|
-
const update = ((query, a, b, c, d) =>
|
|
6669
|
+
const update = ((query, a, b, c, d) => producerFor(updateOptionsOf(a, b, c, d).freeze)(query, (q) => {
|
|
5826
6670
|
applyUpdatesInPlace(q, a, b, c, d);
|
|
5827
6671
|
}));
|
|
5828
6672
|
/**
|
|
@@ -5870,13 +6714,14 @@ const updateInPlaceSingle = (query, prop, value, pathOrID, options = {}) => {
|
|
|
5870
6714
|
return query;
|
|
5871
6715
|
}
|
|
5872
6716
|
const parentRules = parent.rules;
|
|
5873
|
-
if (path.at(-1) % 2 === 1)
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
6717
|
+
if (path.at(-1) % 2 === 1) {
|
|
6718
|
+
if (parentRules[path.at(-1)] === value) onAbort?.({
|
|
6719
|
+
reason: "no-change",
|
|
6720
|
+
operation: "update",
|
|
6721
|
+
pathOrID
|
|
6722
|
+
});
|
|
6723
|
+
else parentRules[path.at(-1)] = value;
|
|
6724
|
+
} else onAbort?.({
|
|
5880
6725
|
reason: "not-a-combinator-slot",
|
|
5881
6726
|
operation: "update",
|
|
5882
6727
|
pathOrID
|
|
@@ -5946,7 +6791,7 @@ const updateInPlaceSingle = (query, prop, value, pathOrID, options = {}) => {
|
|
|
5946
6791
|
*
|
|
5947
6792
|
* @group Query Tools
|
|
5948
6793
|
*/
|
|
5949
|
-
const remove = (query, pathOrID, options = {}) =>
|
|
6794
|
+
const remove = (query, pathOrID, options = {}) => producerFor(options.freeze)(query, (q) => removeInPlace(q, pathOrID, options));
|
|
5950
6795
|
/**
|
|
5951
6796
|
* Removes a rule or group from a query in place.
|
|
5952
6797
|
*
|
|
@@ -6001,25 +6846,28 @@ const removeInPlace = (query, pathOrID, options = {}) => {
|
|
|
6001
6846
|
const getNextPath = (query, currentPath, newPathOrShiftDirection) => {
|
|
6002
6847
|
if (Array.isArray(newPathOrShiftDirection)) return newPathOrShiftDirection;
|
|
6003
6848
|
const ic = isRuleGroupTypeIC(query);
|
|
6004
|
-
if (newPathOrShiftDirection === "up")
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
else if (
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6849
|
+
if (newPathOrShiftDirection === "up") {
|
|
6850
|
+
if (pathsAreEqual(currentPath, [0])) return currentPath;
|
|
6851
|
+
else if (currentPath.at(-1) === 0) {
|
|
6852
|
+
const parentPath = getParentPath(currentPath);
|
|
6853
|
+
return [...getParentPath(parentPath), Math.max(0, parentPath.at(-1) - (ic ? 1 : 0))];
|
|
6854
|
+
} else {
|
|
6855
|
+
const evaluationPath = [...getParentPath(currentPath), Math.max(0, currentPath.at(-1) - (ic ? 2 : 1))];
|
|
6856
|
+
const entityAtTarget = findPath(evaluationPath, query);
|
|
6857
|
+
if (isRuleGroup(entityAtTarget)) return [...evaluationPath, entityAtTarget.rules.length];
|
|
6858
|
+
else return [...getParentPath(currentPath), Math.max(0, currentPath.at(-1) - (ic ? 3 : 1))];
|
|
6859
|
+
}
|
|
6860
|
+
} else if (newPathOrShiftDirection === "down") {
|
|
6861
|
+
if (pathsAreEqual([query.rules.length - 1], currentPath)) return currentPath;
|
|
6862
|
+
else if (currentPath.at(-1) === findPath(getParentPath(currentPath), query).rules.length - 1) {
|
|
6863
|
+
const parentPath = getParentPath(currentPath);
|
|
6864
|
+
return [...getParentPath(parentPath), parentPath.at(-1) + 1];
|
|
6865
|
+
} else {
|
|
6866
|
+
const evaluationPath = [...getParentPath(currentPath), currentPath.at(-1) + (ic ? 2 : 1)];
|
|
6867
|
+
const entityToEvaluate = findPath(evaluationPath, query);
|
|
6868
|
+
if (isRuleGroup(entityToEvaluate)) return [...evaluationPath, 0];
|
|
6869
|
+
else return [...getParentPath(currentPath), currentPath.at(-1) + (ic ? 3 : 2)];
|
|
6870
|
+
}
|
|
6023
6871
|
}
|
|
6024
6872
|
return currentPath;
|
|
6025
6873
|
};
|
|
@@ -6031,7 +6879,7 @@ const getNextPath = (query, currentPath, newPathOrShiftDirection) => {
|
|
|
6031
6879
|
*
|
|
6032
6880
|
* @group Query Tools
|
|
6033
6881
|
*/
|
|
6034
|
-
const move = (query, oldPathOrID, newPath, options = {}) =>
|
|
6882
|
+
const move = (query, oldPathOrID, newPath, options = {}) => producerFor(options.freeze)(query, (q) => moveInPlace(q, oldPathOrID, newPath, options));
|
|
6035
6883
|
/**
|
|
6036
6884
|
* Moves a rule or group from one path to another in place.
|
|
6037
6885
|
* In the options parameter, pass `{ clone: true }` to copy instead of move.
|
|
@@ -6127,9 +6975,10 @@ const moveInPlace = (query, oldPathOrID, newPath, options = {}) => {
|
|
|
6127
6975
|
*/
|
|
6128
6976
|
const insertRuleOrGroup = (...args) => parentToInsertInto.rules.splice(spliceIndex, 0, ...args);
|
|
6129
6977
|
if (parentToInsertInto.rules.length === 0 || !independentCombinators) insertRuleOrGroup(ruleOrGroup);
|
|
6130
|
-
else if (newIndex === 0)
|
|
6131
|
-
|
|
6132
|
-
|
|
6978
|
+
else if (newIndex === 0) {
|
|
6979
|
+
if (ruleToRemoveIndex === 0 && oldNextCombinator) insertRuleOrGroup(ruleOrGroup, oldNextCombinator);
|
|
6980
|
+
else insertRuleOrGroup(ruleOrGroup, parentToInsertInto.rules[1] ?? oldPrevCombinator ?? getFirstOption(combinators));
|
|
6981
|
+
} else if (oldPrevCombinator) insertRuleOrGroup(oldPrevCombinator, ruleOrGroup);
|
|
6133
6982
|
else insertRuleOrGroup(parentToInsertInto.rules[spliceIndex - 2] ?? oldNextCombinator ?? getFirstOption(combinators), ruleOrGroup);
|
|
6134
6983
|
return query;
|
|
6135
6984
|
};
|
|
@@ -6140,7 +6989,7 @@ const moveInPlace = (query, oldPathOrID, newPath, options = {}) => {
|
|
|
6140
6989
|
*
|
|
6141
6990
|
* @group Query Tools
|
|
6142
6991
|
*/
|
|
6143
|
-
const insert = (query, ruleOrGroup, path, options = {}) =>
|
|
6992
|
+
const insert = (query, ruleOrGroup, path, options = {}) => producerFor(options.freeze)(query, (q) => insertInPlace(q, ruleOrGroup, path, options));
|
|
6144
6993
|
/**
|
|
6145
6994
|
* Inserts a rule or group into a query in place.
|
|
6146
6995
|
*
|
|
@@ -6195,9 +7044,10 @@ const insertInPlace = (query, ruleOrGroup, path, options = {}) => {
|
|
|
6195
7044
|
const insertRuleOrGroup = (idx, ...args) => parentToInsertInto.rules.splice(idx, replace ? args.length : 0, ...args);
|
|
6196
7045
|
if (parentToInsertInto.rules.length === 0 || !independentCombinators) insertRuleOrGroup(newIndex, rorg);
|
|
6197
7046
|
else if (replace && independentCombinators) insertRuleOrGroup(newIndex + newIndex % 2, rorg);
|
|
6198
|
-
else if (newIndex === 0)
|
|
6199
|
-
|
|
6200
|
-
|
|
7047
|
+
else if (newIndex === 0) {
|
|
7048
|
+
if (rorg.path?.at(-1) === 0 && combinatorSucceeding) insertRuleOrGroup(newIndex, rorg, combinatorSucceeding);
|
|
7049
|
+
else insertRuleOrGroup(newIndex, rorg, parentToInsertInto.rules[1] ?? combinatorPreceding ?? getFirstOption(combinators));
|
|
7050
|
+
} else {
|
|
6201
7051
|
const normalizedNewIndex = newIndex % 2 === 0 ? newIndex - 1 : newIndex;
|
|
6202
7052
|
if (combinatorPreceding) insertRuleOrGroup(normalizedNewIndex, combinatorPreceding, rorg);
|
|
6203
7053
|
else insertRuleOrGroup(normalizedNewIndex, parentToInsertInto.rules[normalizedNewIndex - 2] ?? combinatorSucceeding ?? getFirstOption(combinators), rorg);
|
|
@@ -6213,7 +7063,7 @@ const insertInPlace = (query, ruleOrGroup, path, options = {}) => {
|
|
|
6213
7063
|
*
|
|
6214
7064
|
* @group Query Tools
|
|
6215
7065
|
*/
|
|
6216
|
-
const group = (query, sourcePathOrID, targetPathOrID, options = {}) =>
|
|
7066
|
+
const group = (query, sourcePathOrID, targetPathOrID, options = {}) => producerFor(options.freeze)(query, (q) => groupInPlace(q, sourcePathOrID, targetPathOrID, options));
|
|
6217
7067
|
/**
|
|
6218
7068
|
* Creates a new group at a target path with its `rules` array containing the current
|
|
6219
7069
|
* objects at the target path and the source path in place.
|
|
@@ -6341,7 +7191,7 @@ const groupInPlace = (query, sourcePathOrID, targetPathOrID, options = {}) => {
|
|
|
6341
7191
|
* @group Query Tools
|
|
6342
7192
|
*/
|
|
6343
7193
|
const createQueryActions = (config = {}) => {
|
|
6344
|
-
const { qbId, combinators, idGenerator, maxLevels = Infinity, queryDisabled, respectDisabled = true, disabledPaths, resetOnFieldChange, resetOnOperatorChange, getRuleDefaultOperator, getValueSources, getRuleDefaultValue, getMatchModes, onAddRule, onAddGroup, onRemove, onMoveRule, onMoveGroup, onGroupRule, onGroupGroup, onLog } = config;
|
|
7194
|
+
const { qbId, combinators, idGenerator, maxLevels = Infinity, queryDisabled, respectDisabled = true, disabledPaths, resetOnFieldChange, resetOnOperatorChange, getRuleDefaultOperator, getValueSources, getRuleDefaultValue, getMatchModes, freeze, onAddRule, onAddGroup, onRemove, onMoveRule, onMoveGroup, onGroupRule, onGroupGroup, onLog } = config;
|
|
6345
7195
|
const log = (payload) => onLog?.({
|
|
6346
7196
|
qbId,
|
|
6347
7197
|
...payload
|
|
@@ -6378,7 +7228,8 @@ const createQueryActions = (config = {}) => {
|
|
|
6378
7228
|
const newQuery = add(query, newRule, parentPath, {
|
|
6379
7229
|
combinators,
|
|
6380
7230
|
combinatorPreceding: newRule.combinatorPreceding,
|
|
6381
|
-
idGenerator
|
|
7231
|
+
idGenerator,
|
|
7232
|
+
freeze
|
|
6382
7233
|
});
|
|
6383
7234
|
log({
|
|
6384
7235
|
type: LogType.add,
|
|
@@ -6414,7 +7265,8 @@ const createQueryActions = (config = {}) => {
|
|
|
6414
7265
|
const newQuery = add(query, newGroup, parentPath, {
|
|
6415
7266
|
combinators,
|
|
6416
7267
|
combinatorPreceding: newGroup.combinatorPreceding ?? void 0,
|
|
6417
|
-
idGenerator
|
|
7268
|
+
idGenerator,
|
|
7269
|
+
freeze
|
|
6418
7270
|
});
|
|
6419
7271
|
log({
|
|
6420
7272
|
type: LogType.add,
|
|
@@ -6442,7 +7294,8 @@ const createQueryActions = (config = {}) => {
|
|
|
6442
7294
|
getRuleDefaultOperator,
|
|
6443
7295
|
getValueSources,
|
|
6444
7296
|
getRuleDefaultValue,
|
|
6445
|
-
getMatchModes
|
|
7297
|
+
getMatchModes,
|
|
7298
|
+
freeze
|
|
6446
7299
|
});
|
|
6447
7300
|
log({
|
|
6448
7301
|
type: LogType.update,
|
|
@@ -6475,7 +7328,7 @@ const createQueryActions = (config = {}) => {
|
|
|
6475
7328
|
});
|
|
6476
7329
|
return;
|
|
6477
7330
|
}
|
|
6478
|
-
const newQuery = remove(query, path);
|
|
7331
|
+
const newQuery = remove(query, path, { freeze });
|
|
6479
7332
|
log({
|
|
6480
7333
|
type: LogType.remove,
|
|
6481
7334
|
query,
|
|
@@ -6500,7 +7353,8 @@ const createQueryActions = (config = {}) => {
|
|
|
6500
7353
|
const nextQuery = move(query, oldPath, newPath, {
|
|
6501
7354
|
clone,
|
|
6502
7355
|
combinators,
|
|
6503
|
-
idGenerator
|
|
7356
|
+
idGenerator,
|
|
7357
|
+
freeze
|
|
6504
7358
|
});
|
|
6505
7359
|
const isGroup = isRuleGroup(ruleOrGroup);
|
|
6506
7360
|
const callback = isGroup ? onMoveGroup : onMoveRule;
|
|
@@ -6546,7 +7400,8 @@ const createQueryActions = (config = {}) => {
|
|
|
6546
7400
|
const nextQuery = group(query, sourcePath, targetPath, {
|
|
6547
7401
|
clone,
|
|
6548
7402
|
combinators,
|
|
6549
|
-
idGenerator
|
|
7403
|
+
idGenerator,
|
|
7404
|
+
freeze
|
|
6550
7405
|
});
|
|
6551
7406
|
const isGroup = isRuleGroup(ruleOrGroup);
|
|
6552
7407
|
const callback = isGroup ? onGroupGroup : onGroupRule;
|
|
@@ -6590,10 +7445,12 @@ const createQueryActions = (config = {}) => {
|
|
|
6590
7445
|
*/
|
|
6591
7446
|
const createRule = ({ fields, getDefaultField, getRuleDefaultOperator, getValueSources, getMatchModes, getRuleDefaultValue, idGenerator = generateID }) => {
|
|
6592
7447
|
let field = getFirstOption(fields) ?? "";
|
|
6593
|
-
if (getDefaultField)
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
7448
|
+
if (getDefaultField) {
|
|
7449
|
+
if (typeof getDefaultField === "function") {
|
|
7450
|
+
const defaultField = getDefaultField(fields);
|
|
7451
|
+
if (defaultField) field = defaultField;
|
|
7452
|
+
} else field = getDefaultField;
|
|
7453
|
+
}
|
|
6597
7454
|
const fieldData = getOption(fields, field);
|
|
6598
7455
|
const operator = getRuleDefaultOperator(field);
|
|
6599
7456
|
const valueSource = getFirstOption(getValueSources(field, operator, { fieldData })) ?? "value";
|
|
@@ -6640,92 +7497,8 @@ const createRuleGroup = ({ combinators, addRuleToNewGroups, createRule: createRu
|
|
|
6640
7497
|
};
|
|
6641
7498
|
};
|
|
6642
7499
|
//#endregion
|
|
6643
|
-
//#region src/utils/signature.ts
|
|
6644
|
-
/**
|
|
6645
|
-
* Signature returned when a change alters the _shape_ of the query—rules or groups added,
|
|
6646
|
-
* removed, moved, or reordered—rather than the properties of a single node. Structural changes
|
|
6647
|
-
* never coalesce with each other, so each one produces its own history entry.
|
|
6648
|
-
*/
|
|
6649
|
-
const structuralSignature = "~structural";
|
|
6650
|
-
/**
|
|
6651
|
-
* Signature returned when two queries differ by reference only, with no observable difference
|
|
6652
|
-
* in their properties.
|
|
6653
|
-
*/
|
|
6654
|
-
const unchangedSignature = "";
|
|
6655
|
-
/**
|
|
6656
|
-
* Returns the list of property names that differ between two nodes, ignoring `rules` (which is
|
|
6657
|
-
* compared structurally by the caller).
|
|
6658
|
-
*/
|
|
6659
|
-
const changedProps = (prev, next) => {
|
|
6660
|
-
const keys = /* @__PURE__ */ new Set([...Object.keys(prev), ...Object.keys(next)]);
|
|
6661
|
-
keys.delete("rules");
|
|
6662
|
-
const changed = [];
|
|
6663
|
-
for (const key of keys) if (!Object.is(prev[key], next[key])) changed.push(key);
|
|
6664
|
-
return changed.toSorted();
|
|
6665
|
-
};
|
|
6666
|
-
const signatureOfNode = (prev, next, parentId, index) => {
|
|
6667
|
-
if (prev === next) return "";
|
|
6668
|
-
if (typeof prev === "string" || typeof next === "string") return typeof prev === typeof next ? `${parentId}:combinator[${index}]` : structuralSignature;
|
|
6669
|
-
const prevIsGroup = isRuleGroup(prev);
|
|
6670
|
-
const nextIsGroup = isRuleGroup(next);
|
|
6671
|
-
if (prevIsGroup !== nextIsGroup) return structuralSignature;
|
|
6672
|
-
if (!prevIsGroup || !nextIsGroup) {
|
|
6673
|
-
const props = changedProps(prev, next);
|
|
6674
|
-
return props.length === 0 ? "" : `${next.id ?? ""}:${props.join(",")}`;
|
|
6675
|
-
}
|
|
6676
|
-
if (prev.rules.length !== next.rules.length) return structuralSignature;
|
|
6677
|
-
const ownProps = changedProps(prev, next);
|
|
6678
|
-
let changedIndex = -1;
|
|
6679
|
-
for (const [i, prevRule] of prev.rules.entries()) if (prevRule !== next.rules[i]) {
|
|
6680
|
-
if (changedIndex !== -1) return structuralSignature;
|
|
6681
|
-
changedIndex = i;
|
|
6682
|
-
}
|
|
6683
|
-
if (changedIndex === -1) return ownProps.length === 0 ? "" : `${next.id ?? ""}:${ownProps.join(",")}`;
|
|
6684
|
-
if (ownProps.length > 0) return structuralSignature;
|
|
6685
|
-
return signatureOfNode(prev.rules[changedIndex], next.rules[changedIndex], next.id ?? "", changedIndex);
|
|
6686
|
-
};
|
|
6687
|
-
/**
|
|
6688
|
-
* Describes _what changed_ between two versions of a query as a short string, so that
|
|
6689
|
-
* consecutive edits to the same property of the same rule (e.g. typing in a value editor) can
|
|
6690
|
-
* be recognized and coalesced into a single history entry.
|
|
6691
|
-
*
|
|
6692
|
-
* Returns {@link structuralSignature} for changes to the shape of the query, {@link unchangedSignature} when the
|
|
6693
|
-
* two queries differ by reference only, and `"<id>:<props>"` otherwise.
|
|
6694
|
-
*
|
|
6695
|
-
* The walk prunes on reference equality, so it costs O(depth) rather than O(size) for the
|
|
6696
|
-
* single-node edits that make up the overwhelming majority of changes.
|
|
6697
|
-
*
|
|
6698
|
-
* Note that this relies on the structural sharing that Immer—and therefore every query
|
|
6699
|
-
* produced by RQB's own update functions—guarantees: nodes that did not change keep their
|
|
6700
|
-
* identity. A query that has been wholly rebuilt (deep-cloned, round-tripped through JSON,
|
|
6701
|
-
* re-parsed from a string) shares no identity with its predecessor, so it is reported as
|
|
6702
|
-
* {@link structuralSignature} and will not coalesce. That is a graceful degradation—every change simply
|
|
6703
|
-
* gets its own history entry—but controlled components that clone the query on every change
|
|
6704
|
-
* will not benefit from coalescing.
|
|
6705
|
-
*/
|
|
6706
|
-
const signatureOf = (prev, next) => signatureOfNode(prev, next, "", -1);
|
|
6707
|
-
//#endregion
|
|
6708
7500
|
//#region src/utils/QueryManager.ts
|
|
6709
7501
|
/**
|
|
6710
|
-
* Abort reasons that {@link QueryManager}'s `strict` mode treats as errors. The remaining
|
|
6711
|
-
* reasons—`"same-location"` and `"no-change"`—describe valid operations that had nothing to do,
|
|
6712
|
-
* so they are reported to `onInvalidTarget` but never throw.
|
|
6713
|
-
*
|
|
6714
|
-
* @group Query Tools
|
|
6715
|
-
*/
|
|
6716
|
-
const strictAbortReasons = [
|
|
6717
|
-
"target-not-found",
|
|
6718
|
-
"parent-not-found",
|
|
6719
|
-
"parent-not-a-group",
|
|
6720
|
-
"destination-not-found",
|
|
6721
|
-
"root-not-allowed",
|
|
6722
|
-
"not-a-combinator-slot",
|
|
6723
|
-
"target-disabled",
|
|
6724
|
-
"parent-disabled",
|
|
6725
|
-
"max-levels-exceeded"
|
|
6726
|
-
];
|
|
6727
|
-
const strictAbortReasonSet = new Set(strictAbortReasons);
|
|
6728
|
-
/**
|
|
6729
7502
|
* Thrown by {@link QueryManager} methods in `strict` mode when an operation cannot be carried
|
|
6730
7503
|
* out because its target could not be used.
|
|
6731
7504
|
*
|
|
@@ -6745,6 +7518,57 @@ var QueryManagerError = class QueryManagerError extends Error {
|
|
|
6745
7518
|
}
|
|
6746
7519
|
};
|
|
6747
7520
|
/**
|
|
7521
|
+
* Key of the single own property holding every {@link QueryManager} instance's state.
|
|
7522
|
+
*
|
|
7523
|
+
* `#private` fields are unreachable from a `Proxy`: inside a method invoked through one, `this`
|
|
7524
|
+
* _is_ the proxy, and the private brand lives on the target, so every access throws
|
|
7525
|
+
* `TypeError: Cannot read private member`. Frameworks wrap objects in proxies routinely — Vue's
|
|
7526
|
+
* `reactive()`, and by extension Vue Test Utils' handling of mount props, do it implicitly — so
|
|
7527
|
+
* consumers hit that failure by accident rather than by choice.
|
|
7528
|
+
*
|
|
7529
|
+
* A `WeakMap` keyed by instance does not fix it either, for the same reason: `weakMap.get(this)`
|
|
7530
|
+
* misses the entry stored under the target. An ordinary own property is the only mechanism that
|
|
7531
|
+
* reads correctly through a proxy, because the `get` trap forwards to the target.
|
|
7532
|
+
*
|
|
7533
|
+
* The symbol is module-private and never exported. Reaching into the state bag (via
|
|
7534
|
+
* `Object.getOwnPropertySymbols`, say) is not a supported access path and its contents may change
|
|
7535
|
+
* in any release.
|
|
7536
|
+
*/
|
|
7537
|
+
const kState = Symbol("QueryManager.state");
|
|
7538
|
+
const queryChange = freeze({
|
|
7539
|
+
query: true,
|
|
7540
|
+
config: false
|
|
7541
|
+
});
|
|
7542
|
+
const configChange = freeze({
|
|
7543
|
+
query: false,
|
|
7544
|
+
config: true
|
|
7545
|
+
});
|
|
7546
|
+
const queryAndConfigChange = freeze({
|
|
7547
|
+
query: true,
|
|
7548
|
+
config: true
|
|
7549
|
+
});
|
|
7550
|
+
/**
|
|
7551
|
+
* Builds the state bag. The option-derived members are left unset for `applyOptions` to fill in,
|
|
7552
|
+
* hence the assertion.
|
|
7553
|
+
*/
|
|
7554
|
+
const createManagerState = () => {
|
|
7555
|
+
const state = {
|
|
7556
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
7557
|
+
configVersion: 0,
|
|
7558
|
+
past: [],
|
|
7559
|
+
future: [],
|
|
7560
|
+
lastAt: 0,
|
|
7561
|
+
batchDepth: 0,
|
|
7562
|
+
historyBypassed: false,
|
|
7563
|
+
pendingConfigNotify: false
|
|
7564
|
+
};
|
|
7565
|
+
Object.defineProperty(state, "__v_skip", {
|
|
7566
|
+
value: true,
|
|
7567
|
+
enumerable: false
|
|
7568
|
+
});
|
|
7569
|
+
return state;
|
|
7570
|
+
};
|
|
7571
|
+
/**
|
|
6748
7572
|
* Stateful wrapper around the {@link add}/{@link remove}/{@link update}/{@link move}/
|
|
6749
7573
|
* {@link insert}/{@link group} query tools, plus rule/group factories, {@link defaultValidator
|
|
6750
7574
|
* validation}, and {@link formatQuery formatting}.
|
|
@@ -6752,7 +7576,8 @@ var QueryManagerError = class QueryManagerError extends Error {
|
|
|
6752
7576
|
* The query is held internally, so each method takes the same arguments as its `queryTools`
|
|
6753
7577
|
* counterpart minus the leading `query` parameter, and returns the manager itself for chaining.
|
|
6754
7578
|
* Mutations use the non-`InPlace` tools, so a query previously handed out by
|
|
6755
|
-
* {@link QueryManager.getQuery} is never modified.
|
|
7579
|
+
* {@link QueryManager.getQuery} is never modified. Under `freeze: false` that remains true, but
|
|
7580
|
+
* as a convention rather than a runtime-enforced guarantee.
|
|
6756
7581
|
*
|
|
6757
7582
|
* ```ts
|
|
6758
7583
|
* const q = new QueryManager(undefined, { fields });
|
|
@@ -6768,194 +7593,188 @@ var QueryManagerError = class QueryManagerError extends Error {
|
|
|
6768
7593
|
* @group Query Tools
|
|
6769
7594
|
*/
|
|
6770
7595
|
var QueryManager = class QueryManager {
|
|
6771
|
-
#query;
|
|
6772
|
-
#options;
|
|
6773
|
-
#fields;
|
|
6774
|
-
#fieldMap;
|
|
6775
|
-
#operators;
|
|
6776
|
-
#combinators;
|
|
6777
|
-
#idGenerator;
|
|
6778
|
-
#validator;
|
|
6779
|
-
#strict;
|
|
6780
|
-
#respectDisabled;
|
|
6781
|
-
#onInvalidTarget;
|
|
6782
|
-
#listeners = /* @__PURE__ */ new Set();
|
|
6783
|
-
#historyEnabled;
|
|
6784
|
-
#maxHistory;
|
|
6785
|
-
#coalesceMs;
|
|
6786
|
-
#now;
|
|
6787
|
-
/** Incremented by every {@link QueryManager.reconfigure} call. See `getConfigVersion`. */
|
|
6788
|
-
#configVersion = 0;
|
|
6789
|
-
#past = [];
|
|
6790
|
-
#future = [];
|
|
6791
|
-
#lastSig;
|
|
6792
|
-
#lastAt = 0;
|
|
6793
|
-
#batchDepth = 0;
|
|
6794
|
-
#batchSnapshot;
|
|
6795
|
-
/** Whether a history-stack method ran inside the batch currently in progress. */
|
|
6796
|
-
#historyBypassed = false;
|
|
6797
7596
|
/**
|
|
6798
|
-
*
|
|
6799
|
-
*
|
|
6800
|
-
*
|
|
7597
|
+
* All instance state, rather than `#private` fields. See `kState` for why.
|
|
7598
|
+
*
|
|
7599
|
+
* The property itself is symbol-keyed and installed by the constructor; this accessor exists
|
|
7600
|
+
* because `isolatedDeclarations` cannot emit a computed property name keyed by a symbol the
|
|
7601
|
+
* module does not export, and exporting it would put it in the public API surface. A
|
|
7602
|
+
* prototype accessor is proxy-safe for the same reason the own property is: `this` is the
|
|
7603
|
+
* proxy, and the `get` trap forwards to the target.
|
|
6801
7604
|
*/
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
|
|
7605
|
+
get state() {
|
|
7606
|
+
return this[kState];
|
|
7607
|
+
}
|
|
6805
7608
|
constructor(query, options = {}) {
|
|
6806
|
-
this
|
|
6807
|
-
|
|
7609
|
+
Object.defineProperty(this, kState, {
|
|
7610
|
+
value: createManagerState(),
|
|
7611
|
+
enumerable: false,
|
|
7612
|
+
writable: false,
|
|
7613
|
+
configurable: false
|
|
7614
|
+
});
|
|
7615
|
+
this.applyOptions(options);
|
|
7616
|
+
this.state.query = this.freeze(query ? prepareRuleGroup(query, { idGenerator: this.state.idGenerator }) : this.createRuleGroup());
|
|
7617
|
+
}
|
|
7618
|
+
/**
|
|
7619
|
+
* Deep-freezes `x` unless the `freeze` option is `false`. Every value the manager hands out
|
|
7620
|
+
* directly goes through here; the shallow copies returned by {@link QueryManager.getOptions}
|
|
7621
|
+
* and passed to `applyOptions` are frozen unconditionally instead.
|
|
7622
|
+
*/
|
|
7623
|
+
freeze(x) {
|
|
7624
|
+
return this.state.freezeEnabled ? freeze(x, true) : x;
|
|
6808
7625
|
}
|
|
6809
7626
|
/**
|
|
6810
|
-
* Assigns
|
|
7627
|
+
* Assigns `options` and every field derived from it. Shared by the constructor and
|
|
6811
7628
|
* {@link QueryManager.reconfigure}, so the two can never drift apart. Does not touch the
|
|
6812
7629
|
* query, the history stacks, the caches, or the subscriber list.
|
|
6813
7630
|
*/
|
|
6814
|
-
|
|
6815
|
-
this
|
|
6816
|
-
this
|
|
6817
|
-
this
|
|
6818
|
-
this
|
|
6819
|
-
this
|
|
6820
|
-
this
|
|
7631
|
+
applyOptions(options) {
|
|
7632
|
+
this.state.options = options;
|
|
7633
|
+
this.state.freezeEnabled = options.freeze ?? true;
|
|
7634
|
+
this.state.idGenerator = options.idGenerator ?? generateID;
|
|
7635
|
+
this.state.validator = options.validator ?? defaultValidator;
|
|
7636
|
+
this.state.strict = options.strict ?? false;
|
|
7637
|
+
this.state.respectDisabled = options.respectDisabled ?? true;
|
|
7638
|
+
this.state.onInvalidTarget = options.onInvalidTarget;
|
|
6821
7639
|
const history = options.history ?? false;
|
|
6822
7640
|
const historyOptions = typeof history === "object" ? history : {};
|
|
6823
|
-
this
|
|
6824
|
-
this
|
|
6825
|
-
this
|
|
6826
|
-
this
|
|
7641
|
+
this.state.historyEnabled = history !== false;
|
|
7642
|
+
this.state.maxHistory = historyOptions.maxHistory ?? 50;
|
|
7643
|
+
this.state.coalesceMs = historyOptions.coalesceMs ?? 500;
|
|
7644
|
+
this.state.now = options.now ?? Date.now;
|
|
6827
7645
|
const { optionList: fields, optionsMap: fieldMap } = prepareOptionList({
|
|
6828
7646
|
optionList: options.fields,
|
|
6829
7647
|
baseOption: options.baseField,
|
|
6830
7648
|
autoSelectOption: options.autoSelectField,
|
|
6831
7649
|
placeholder: options.translations?.fields
|
|
6832
7650
|
});
|
|
6833
|
-
this
|
|
6834
|
-
this
|
|
6835
|
-
this
|
|
7651
|
+
this.state.fields = this.freeze(fields);
|
|
7652
|
+
this.state.fieldMap = this.freeze(fieldMap);
|
|
7653
|
+
this.state.operators = prepareOptionList({
|
|
6836
7654
|
optionList: options.operators ?? defaultOperators,
|
|
6837
7655
|
baseOption: options.baseOperator,
|
|
6838
7656
|
labelMap: defaultOperatorLabelMap,
|
|
6839
7657
|
autoSelectOption: options.autoSelectOperator,
|
|
6840
7658
|
placeholder: options.translations?.operators
|
|
6841
7659
|
}).optionList;
|
|
6842
|
-
this
|
|
7660
|
+
this.state.combinators = this.freeze(prepareOptionList({
|
|
6843
7661
|
optionList: options.combinators ?? defaultCombinators,
|
|
6844
7662
|
baseOption: options.baseCombinator
|
|
6845
|
-
}).optionList
|
|
7663
|
+
}).optionList);
|
|
6846
7664
|
}
|
|
6847
7665
|
/** Resolves the field configuration for a field name. */
|
|
6848
|
-
|
|
6849
|
-
return this
|
|
7666
|
+
fieldData(field) {
|
|
7667
|
+
return this.state.fieldMap[field] ?? {};
|
|
6850
7668
|
}
|
|
6851
7669
|
/** Resolves the operator list for a field, mirroring `QueryBuilder`'s precedence. */
|
|
6852
|
-
|
|
7670
|
+
operatorsFor(field) {
|
|
6853
7671
|
return resolveOperatorList({
|
|
6854
7672
|
field,
|
|
6855
|
-
fieldData: this
|
|
6856
|
-
getOperators: this
|
|
6857
|
-
operators: this
|
|
6858
|
-
baseOption: this
|
|
6859
|
-
autoSelectOption: this
|
|
6860
|
-
placeholder: this
|
|
7673
|
+
fieldData: this.fieldData(field),
|
|
7674
|
+
getOperators: this.state.options.getOperators,
|
|
7675
|
+
operators: this.state.operators,
|
|
7676
|
+
baseOption: this.state.options.baseOperator,
|
|
7677
|
+
autoSelectOption: this.state.options.autoSelectOperator,
|
|
7678
|
+
placeholder: this.state.options.translations?.operators
|
|
6861
7679
|
});
|
|
6862
7680
|
}
|
|
6863
7681
|
/** Resolves the default operator for a field, mirroring `QueryBuilder`'s precedence. */
|
|
6864
|
-
|
|
7682
|
+
defaultOperator(field) {
|
|
6865
7683
|
return resolveDefaultOperator({
|
|
6866
7684
|
field,
|
|
6867
|
-
fieldData: this
|
|
6868
|
-
getDefaultOperator: this
|
|
6869
|
-
getOperators: (f) => this
|
|
7685
|
+
fieldData: this.fieldData(field),
|
|
7686
|
+
getDefaultOperator: this.state.options.getDefaultOperator,
|
|
7687
|
+
getOperators: (f) => this.operatorsFor(f)
|
|
6870
7688
|
});
|
|
6871
7689
|
}
|
|
6872
|
-
|
|
6873
|
-
return getValueSourcesUtil(this
|
|
7690
|
+
valueSourcesFor(field, operator) {
|
|
7691
|
+
return getValueSourcesUtil(this.fieldData(field), operator, this.state.options.getValueSources);
|
|
6874
7692
|
}
|
|
6875
|
-
|
|
6876
|
-
return getMatchModesUtil(this
|
|
7693
|
+
matchModesFor(field) {
|
|
7694
|
+
return getMatchModesUtil(this.fieldData(field), this.state.options.getMatchModes);
|
|
6877
7695
|
}
|
|
6878
|
-
|
|
7696
|
+
valuesFor(field, operator) {
|
|
6879
7697
|
return resolveValueList({
|
|
6880
7698
|
field,
|
|
6881
7699
|
operator,
|
|
6882
|
-
fieldData: this
|
|
6883
|
-
getValues: this
|
|
6884
|
-
autoSelectOption: this
|
|
6885
|
-
placeholder: this
|
|
7700
|
+
fieldData: this.fieldData(field),
|
|
7701
|
+
getValues: this.state.options.getValues,
|
|
7702
|
+
autoSelectOption: this.state.options.autoSelectValue,
|
|
7703
|
+
placeholder: this.state.options.translations?.values
|
|
6886
7704
|
});
|
|
6887
7705
|
}
|
|
6888
|
-
|
|
7706
|
+
valueEditorTypeFor(field, operator) {
|
|
6889
7707
|
return resolveValueEditorType({
|
|
6890
7708
|
field,
|
|
6891
7709
|
operator,
|
|
6892
|
-
fieldData: this
|
|
6893
|
-
getValueEditorType: this
|
|
7710
|
+
fieldData: this.fieldData(field),
|
|
7711
|
+
getValueEditorType: this.state.options.getValueEditorType
|
|
6894
7712
|
});
|
|
6895
7713
|
}
|
|
6896
7714
|
/** Computes the default `value` for a rule, mirroring `QueryBuilder`'s precedence. */
|
|
6897
|
-
|
|
6898
|
-
const { getDefaultValue, getParameters, listsAsArrays } = this
|
|
7715
|
+
defaultValue(rule) {
|
|
7716
|
+
const { getDefaultValue, getParameters, listsAsArrays } = this.state.options;
|
|
6899
7717
|
return getRuleDefaultValue(rule, {
|
|
6900
|
-
fieldData: this
|
|
6901
|
-
fields: this
|
|
7718
|
+
fieldData: this.fieldData(rule.field),
|
|
7719
|
+
fields: this.state.fields,
|
|
6902
7720
|
listsAsArrays,
|
|
6903
|
-
getValueEditorType: (f, o) => this
|
|
6904
|
-
getValues: (f, o) => this
|
|
7721
|
+
getValueEditorType: (f, o) => this.valueEditorTypeFor(f, o),
|
|
7722
|
+
getValues: (f, o) => this.valuesFor(f, o),
|
|
6905
7723
|
getDefaultValue: getDefaultValue && ((r, misc) => getDefaultValue(r, misc)),
|
|
6906
|
-
getParameters: getParameters && ((f, o, misc) => this
|
|
7724
|
+
getParameters: getParameters && ((f, o, misc) => this.parametersFor(f, o, misc))
|
|
6907
7725
|
});
|
|
6908
7726
|
}
|
|
6909
7727
|
/**
|
|
6910
7728
|
* Resolves the parameter list for a field/operator pair, normalized the same way as every
|
|
6911
|
-
* other option list. Shared by {@link QueryManager
|
|
6912
|
-
*
|
|
7729
|
+
* other option list. Shared by `defaultValue` and {@link QueryManager.getRuleContext} so both
|
|
7730
|
+
* see the same shape.
|
|
6913
7731
|
*/
|
|
6914
|
-
|
|
7732
|
+
parametersFor(field, operator, misc) {
|
|
6915
7733
|
return prepareOptionList({
|
|
6916
|
-
optionList: this
|
|
6917
|
-
autoSelectOption: this
|
|
7734
|
+
optionList: this.state.options.getParameters?.(field, operator, misc) ?? [],
|
|
7735
|
+
autoSelectOption: this.state.options.autoSelectValue
|
|
6918
7736
|
}).optionList;
|
|
6919
7737
|
}
|
|
6920
7738
|
/** Defaults shared by every mutating method, overridable per call. */
|
|
6921
|
-
|
|
6922
|
-
const { maxLevels } = this
|
|
7739
|
+
guardOptions() {
|
|
7740
|
+
const { maxLevels } = this.state.options;
|
|
6923
7741
|
return {
|
|
7742
|
+
freeze: this.state.freezeEnabled,
|
|
6924
7743
|
maxLevels: (maxLevels ?? 0) > 0 ? Number(maxLevels) : Infinity,
|
|
6925
|
-
respectDisabled: this
|
|
6926
|
-
disabledPaths: this
|
|
6927
|
-
queryDisabled: this
|
|
7744
|
+
respectDisabled: this.state.respectDisabled,
|
|
7745
|
+
disabledPaths: this.state.options.disabledPaths,
|
|
7746
|
+
queryDisabled: this.state.options.queryDisabled
|
|
6928
7747
|
};
|
|
6929
7748
|
}
|
|
6930
|
-
|
|
7749
|
+
toolOptions() {
|
|
6931
7750
|
return {
|
|
6932
|
-
combinators: this
|
|
6933
|
-
idGenerator: this
|
|
6934
|
-
...this
|
|
7751
|
+
combinators: this.state.combinators,
|
|
7752
|
+
idGenerator: this.state.idGenerator,
|
|
7753
|
+
...this.guardOptions()
|
|
6935
7754
|
};
|
|
6936
7755
|
}
|
|
6937
7756
|
/**
|
|
6938
7757
|
* Builds the `onAbort` handler passed to the query tools, applying the per-call overrides on
|
|
6939
7758
|
* top of the manager's own options.
|
|
6940
7759
|
*/
|
|
6941
|
-
|
|
6942
|
-
const strictMain = strict ?? this
|
|
6943
|
-
const handler = onInvalidTarget ?? this
|
|
7760
|
+
onAbort({ strict, onInvalidTarget }) {
|
|
7761
|
+
const strictMain = strict ?? this.state.strict;
|
|
7762
|
+
const handler = onInvalidTarget ?? this.state.onInvalidTarget;
|
|
6944
7763
|
return (info) => {
|
|
6945
7764
|
handler?.(info);
|
|
6946
7765
|
if (strictMain && strictAbortReasonSet.has(info.reason)) throw new QueryManagerError(info);
|
|
6947
7766
|
};
|
|
6948
7767
|
}
|
|
6949
7768
|
/** Defaults for {@link update}, so resets mirror `QueryBuilder`'s behavior. */
|
|
6950
|
-
|
|
7769
|
+
updateOptions() {
|
|
6951
7770
|
return {
|
|
6952
|
-
getRuleDefaultOperator: (f) => this
|
|
6953
|
-
getRuleDefaultValue: (r) => this
|
|
6954
|
-
getValueSources: (f, o) => this
|
|
6955
|
-
getMatchModes: (f) => this
|
|
6956
|
-
resetOnFieldChange: this
|
|
6957
|
-
resetOnOperatorChange: this
|
|
6958
|
-
...this
|
|
7771
|
+
getRuleDefaultOperator: (f) => this.defaultOperator(f),
|
|
7772
|
+
getRuleDefaultValue: (r) => this.defaultValue(r),
|
|
7773
|
+
getValueSources: (f, o) => this.valueSourcesFor(f, o),
|
|
7774
|
+
getMatchModes: (f) => this.matchModesFor(f),
|
|
7775
|
+
resetOnFieldChange: this.state.options.resetOnFieldChange,
|
|
7776
|
+
resetOnOperatorChange: this.state.options.resetOnOperatorChange,
|
|
7777
|
+
...this.guardOptions()
|
|
6959
7778
|
};
|
|
6960
7779
|
}
|
|
6961
7780
|
/**
|
|
@@ -6963,52 +7782,52 @@ var QueryManager = class QueryManager {
|
|
|
6963
7782
|
* mutation funnels through here. A tool that could not resolve its target returns the same
|
|
6964
7783
|
* query object, which is treated as a no-op.
|
|
6965
7784
|
*/
|
|
6966
|
-
|
|
6967
|
-
const prev = this
|
|
7785
|
+
commit(next) {
|
|
7786
|
+
const prev = this.state.query;
|
|
6968
7787
|
if (prev === next) return;
|
|
6969
|
-
this
|
|
6970
|
-
if (this
|
|
6971
|
-
this
|
|
6972
|
-
this
|
|
7788
|
+
this.state.query = next;
|
|
7789
|
+
if (this.state.batchDepth > 0) return;
|
|
7790
|
+
this.record(prev, next);
|
|
7791
|
+
this.notify(queryChange);
|
|
6973
7792
|
}
|
|
6974
7793
|
/**
|
|
6975
7794
|
* Records a change, either as a new history entry or by absorbing it into the current one.
|
|
6976
7795
|
* Mirrors the recording semantics of the `react-querybuilder/history` entry point.
|
|
6977
7796
|
*/
|
|
6978
|
-
|
|
6979
|
-
if (!this
|
|
7797
|
+
record(prev, next) {
|
|
7798
|
+
if (!this.state.historyEnabled) return;
|
|
6980
7799
|
const sig = signatureOf(prev, next);
|
|
6981
7800
|
if (sig === "") return;
|
|
6982
|
-
const now = this
|
|
6983
|
-
if (!(
|
|
6984
|
-
this
|
|
6985
|
-
if (this
|
|
6986
|
-
this
|
|
7801
|
+
const now = this.state.now();
|
|
7802
|
+
if (!shouldCoalesce(this.state.lastSig, sig, this.state.lastAt, now, this.state.coalesceMs)) {
|
|
7803
|
+
this.state.past.push(prev);
|
|
7804
|
+
if (this.state.past.length > this.state.maxHistory) this.state.past.shift();
|
|
7805
|
+
this.state.future = [];
|
|
6987
7806
|
}
|
|
6988
|
-
this
|
|
6989
|
-
this
|
|
7807
|
+
this.state.lastSig = sig;
|
|
7808
|
+
this.state.lastAt = now;
|
|
6990
7809
|
}
|
|
6991
|
-
|
|
6992
|
-
for (const listener of this
|
|
7810
|
+
notify(change) {
|
|
7811
|
+
for (const listener of this.state.listeners) listener(change);
|
|
6993
7812
|
}
|
|
6994
7813
|
/**
|
|
6995
7814
|
* Records that a history-stack method ran inside the current batch. Those methods manage
|
|
6996
|
-
*
|
|
6997
|
-
* doing so would push a duplicate onto
|
|
7815
|
+
* `past`/`future` themselves, so the batch must not also record an entry on completion —
|
|
7816
|
+
* doing so would push a duplicate onto `past` and clear the redo stack that `undo` just
|
|
6998
7817
|
* populated.
|
|
6999
7818
|
*/
|
|
7000
|
-
|
|
7001
|
-
if (this
|
|
7819
|
+
markHistoryBypassed() {
|
|
7820
|
+
if (this.state.batchDepth > 0) this.state.historyBypassed = true;
|
|
7002
7821
|
}
|
|
7003
7822
|
/**
|
|
7004
7823
|
* Discards every cached derivation when the query has been replaced since they were computed.
|
|
7005
7824
|
* Called at the top of each cached reader.
|
|
7006
7825
|
*/
|
|
7007
|
-
|
|
7008
|
-
if (this
|
|
7009
|
-
this
|
|
7010
|
-
this
|
|
7011
|
-
this
|
|
7826
|
+
ensureCache() {
|
|
7827
|
+
if (this.state.cacheFor === this.state.query) return;
|
|
7828
|
+
this.state.cacheFor = this.state.query;
|
|
7829
|
+
this.state.idPathIndex = void 0;
|
|
7830
|
+
this.state.validation = void 0;
|
|
7012
7831
|
}
|
|
7013
7832
|
/**
|
|
7014
7833
|
* The single traversal implementation. Combinator strings in independent-combinator groups
|
|
@@ -7016,7 +7835,7 @@ var QueryManager = class QueryManager {
|
|
|
7016
7835
|
*
|
|
7017
7836
|
* @yields The subtree rooted at `node`, depth-first in pre-order, starting with `node` itself.
|
|
7018
7837
|
*/
|
|
7019
|
-
|
|
7838
|
+
*walkFrom(node, path, parent) {
|
|
7020
7839
|
yield {
|
|
7021
7840
|
node,
|
|
7022
7841
|
path,
|
|
@@ -7026,34 +7845,35 @@ var QueryManager = class QueryManager {
|
|
|
7026
7845
|
const startGroup = node;
|
|
7027
7846
|
for (const [index, child] of startGroup.rules.entries()) {
|
|
7028
7847
|
if (typeof child === "string") continue;
|
|
7029
|
-
yield* this
|
|
7848
|
+
yield* this.walkFrom(child, [...path, index], startGroup);
|
|
7030
7849
|
}
|
|
7031
7850
|
}
|
|
7032
7851
|
/** Builds (once per query) the `id` to {@link Path} index backing `findID`/`getPathOfID`. */
|
|
7033
|
-
|
|
7034
|
-
this
|
|
7035
|
-
if (!this
|
|
7852
|
+
index() {
|
|
7853
|
+
this.ensureCache();
|
|
7854
|
+
if (!this.state.idPathIndex) {
|
|
7036
7855
|
const index = /* @__PURE__ */ new Map();
|
|
7037
|
-
for (const { node, path } of this
|
|
7038
|
-
this
|
|
7856
|
+
for (const { node, path } of this.walkFrom(this.state.query, [], null)) if (node.id !== void 0 && !index.has(node.id)) index.set(node.id, path);
|
|
7857
|
+
this.state.idPathIndex = index;
|
|
7039
7858
|
}
|
|
7040
|
-
return this
|
|
7859
|
+
return this.state.idPathIndex;
|
|
7041
7860
|
}
|
|
7042
7861
|
/** Resolves a path or `id` to a path, or `null` when the `id` isn't present. */
|
|
7043
|
-
|
|
7044
|
-
return typeof pathOrID === "string" ? this
|
|
7862
|
+
toPath(pathOrID) {
|
|
7863
|
+
return typeof pathOrID === "string" ? this.index().get(pathOrID) ?? null : pathOrID;
|
|
7045
7864
|
}
|
|
7046
7865
|
/**
|
|
7047
|
-
* The current query. The returned object is
|
|
7048
|
-
*
|
|
7866
|
+
* The current query. The returned object is structurally shared, so it is safe to retain and
|
|
7867
|
+
* compare by reference to detect changes. It is also frozen unless the `freeze` option is
|
|
7868
|
+
* `false`.
|
|
7049
7869
|
*
|
|
7050
7870
|
* Like {@link QueryManager.subscribe}, this method is bound to the instance, so it can be
|
|
7051
7871
|
* passed as a bare reference (e.g. as the `getSnapshot` argument to `useSyncExternalStore`).
|
|
7052
7872
|
*/
|
|
7053
|
-
getQuery = () => this
|
|
7873
|
+
getQuery = () => this.state.query;
|
|
7054
7874
|
/** Replaces the current query, ensuring every rule and group has an `id`. */
|
|
7055
7875
|
setQuery(query) {
|
|
7056
|
-
this
|
|
7876
|
+
this.commit(this.freeze(prepareRuleGroup(query, { idGenerator: this.state.idGenerator })));
|
|
7057
7877
|
return this;
|
|
7058
7878
|
}
|
|
7059
7879
|
/**
|
|
@@ -7062,13 +7882,13 @@ var QueryManager = class QueryManager {
|
|
|
7062
7882
|
*/
|
|
7063
7883
|
createRule() {
|
|
7064
7884
|
return createRule({
|
|
7065
|
-
fields: this
|
|
7066
|
-
getDefaultField: this
|
|
7067
|
-
getRuleDefaultOperator: (f) => this
|
|
7068
|
-
getValueSources: (f, o) => this
|
|
7069
|
-
getMatchModes: (f) => this
|
|
7070
|
-
getRuleDefaultValue: (r) => this
|
|
7071
|
-
idGenerator: this
|
|
7885
|
+
fields: this.state.fields,
|
|
7886
|
+
getDefaultField: this.state.options.getDefaultField,
|
|
7887
|
+
getRuleDefaultOperator: (f) => this.defaultOperator(f),
|
|
7888
|
+
getValueSources: (f, o) => this.valueSourcesFor(f, o),
|
|
7889
|
+
getMatchModes: (f) => this.matchModesFor(f),
|
|
7890
|
+
getRuleDefaultValue: (r) => this.defaultValue(r),
|
|
7891
|
+
idGenerator: this.state.idGenerator
|
|
7072
7892
|
});
|
|
7073
7893
|
}
|
|
7074
7894
|
/**
|
|
@@ -7077,10 +7897,10 @@ var QueryManager = class QueryManager {
|
|
|
7077
7897
|
*/
|
|
7078
7898
|
createRuleGroup(independentCombinators) {
|
|
7079
7899
|
return createRuleGroup({
|
|
7080
|
-
combinators: this
|
|
7081
|
-
addRuleToNewGroups: this
|
|
7900
|
+
combinators: this.state.combinators,
|
|
7901
|
+
addRuleToNewGroups: this.state.options.addRuleToNewGroups,
|
|
7082
7902
|
createRule: () => this.createRule(),
|
|
7083
|
-
idGenerator: this
|
|
7903
|
+
idGenerator: this.state.idGenerator
|
|
7084
7904
|
}, independentCombinators);
|
|
7085
7905
|
}
|
|
7086
7906
|
/**
|
|
@@ -7089,10 +7909,10 @@ var QueryManager = class QueryManager {
|
|
|
7089
7909
|
*/
|
|
7090
7910
|
add(ruleOrGroup, parentPathOrID = [], options = {}) {
|
|
7091
7911
|
const { strict, onInvalidTarget, ...toolOptions } = options;
|
|
7092
|
-
this
|
|
7093
|
-
...this
|
|
7912
|
+
this.commit(add(this.state.query, ruleOrGroup, parentPathOrID, {
|
|
7913
|
+
...this.toolOptions(),
|
|
7094
7914
|
...toolOptions,
|
|
7095
|
-
onAbort: this
|
|
7915
|
+
onAbort: this.onAbort({
|
|
7096
7916
|
strict,
|
|
7097
7917
|
onInvalidTarget
|
|
7098
7918
|
})
|
|
@@ -7102,10 +7922,10 @@ var QueryManager = class QueryManager {
|
|
|
7102
7922
|
/** Removes the rule or group at the given path or `id`. The root group cannot be removed. */
|
|
7103
7923
|
remove(pathOrID, options = {}) {
|
|
7104
7924
|
const { strict, onInvalidTarget, ...toolOptions } = options;
|
|
7105
|
-
this
|
|
7106
|
-
...this
|
|
7925
|
+
this.commit(remove(this.state.query, pathOrID, {
|
|
7926
|
+
...this.guardOptions(),
|
|
7107
7927
|
...toolOptions,
|
|
7108
|
-
onAbort: this
|
|
7928
|
+
onAbort: this.onAbort({
|
|
7109
7929
|
strict,
|
|
7110
7930
|
onInvalidTarget
|
|
7111
7931
|
})
|
|
@@ -7122,23 +7942,23 @@ var QueryManager = class QueryManager {
|
|
|
7122
7942
|
];
|
|
7123
7943
|
const { strict, onInvalidTarget, ...toolOptions } = args[optionsIndex] ?? {};
|
|
7124
7944
|
args[optionsIndex] = {
|
|
7125
|
-
...this
|
|
7945
|
+
...this.updateOptions(),
|
|
7126
7946
|
...toolOptions,
|
|
7127
|
-
onAbort: this
|
|
7947
|
+
onAbort: this.onAbort({
|
|
7128
7948
|
strict,
|
|
7129
7949
|
onInvalidTarget
|
|
7130
7950
|
})
|
|
7131
7951
|
};
|
|
7132
|
-
this
|
|
7952
|
+
this.commit(update(this.state.query, ...args.slice(0, optionsIndex + 1)));
|
|
7133
7953
|
return this;
|
|
7134
7954
|
}
|
|
7135
7955
|
/** Moves the rule or group at `oldPathOrID` to `newPath`, or shifts it `'up'`/`'down'`. */
|
|
7136
7956
|
move(oldPathOrID, newPath, options = {}) {
|
|
7137
7957
|
const { strict, onInvalidTarget, ...toolOptions } = options;
|
|
7138
|
-
this
|
|
7139
|
-
...this
|
|
7958
|
+
this.commit(move(this.state.query, oldPathOrID, newPath, {
|
|
7959
|
+
...this.toolOptions(),
|
|
7140
7960
|
...toolOptions,
|
|
7141
|
-
onAbort: this
|
|
7961
|
+
onAbort: this.onAbort({
|
|
7142
7962
|
strict,
|
|
7143
7963
|
onInvalidTarget
|
|
7144
7964
|
})
|
|
@@ -7151,10 +7971,10 @@ var QueryManager = class QueryManager {
|
|
|
7151
7971
|
*/
|
|
7152
7972
|
insert(ruleOrGroup, path, options = {}) {
|
|
7153
7973
|
const { strict, onInvalidTarget, ...toolOptions } = options;
|
|
7154
|
-
this
|
|
7155
|
-
...this
|
|
7974
|
+
this.commit(insert(this.state.query, ruleOrGroup, path, {
|
|
7975
|
+
...this.toolOptions(),
|
|
7156
7976
|
...toolOptions,
|
|
7157
|
-
onAbort: this
|
|
7977
|
+
onAbort: this.onAbort({
|
|
7158
7978
|
strict,
|
|
7159
7979
|
onInvalidTarget
|
|
7160
7980
|
})
|
|
@@ -7167,10 +7987,10 @@ var QueryManager = class QueryManager {
|
|
|
7167
7987
|
*/
|
|
7168
7988
|
group(sourcePathOrID, targetPathOrID, options = {}) {
|
|
7169
7989
|
const { strict, onInvalidTarget, ...toolOptions } = options;
|
|
7170
|
-
this
|
|
7171
|
-
...this
|
|
7990
|
+
this.commit(group(this.state.query, sourcePathOrID, targetPathOrID, {
|
|
7991
|
+
...this.toolOptions(),
|
|
7172
7992
|
...toolOptions,
|
|
7173
|
-
onAbort: this
|
|
7993
|
+
onAbort: this.onAbort({
|
|
7174
7994
|
strict,
|
|
7175
7995
|
onInvalidTarget
|
|
7176
7996
|
})
|
|
@@ -7183,7 +8003,7 @@ var QueryManager = class QueryManager {
|
|
|
7183
8003
|
* defaults filled in for options that were never provided.
|
|
7184
8004
|
*/
|
|
7185
8005
|
getOptions() {
|
|
7186
|
-
return freeze({ ...this
|
|
8006
|
+
return freeze({ ...this.state.options });
|
|
7187
8007
|
}
|
|
7188
8008
|
/**
|
|
7189
8009
|
* Updates the manager's configuration in place, keeping the current query, the undo/redo
|
|
@@ -7206,24 +8026,37 @@ var QueryManager = class QueryManager {
|
|
|
7206
8026
|
* re-normalize.
|
|
7207
8027
|
*
|
|
7208
8028
|
* History options are honored immediately: lowering `maxHistory` trims the undo stack, and
|
|
7209
|
-
* turning history off clears both stacks.
|
|
7210
|
-
*
|
|
7211
|
-
*
|
|
8029
|
+
* turning history off clears both stacks.
|
|
8030
|
+
*
|
|
8031
|
+
* A call that resolves to the configuration already in effect is a **no-op**: nothing is
|
|
8032
|
+
* re-derived, {@link QueryManager.getConfigVersion} does not change, and subscribers are not
|
|
8033
|
+
* notified. Equality is structural for data and by identity for functions
|
|
8034
|
+
* ({@link optionsEqual}), so a caller that rebuilds its options object on every render — which
|
|
8035
|
+
* every framework adapter does — does not force a reconfigure as long as the data is the same.
|
|
8036
|
+
* Rebuilding a callback per render _does_ count as a change; memoize it to avoid that.
|
|
8037
|
+
*
|
|
8038
|
+
* Otherwise subscribers are notified once and `getConfigVersion` is incremented. Inside a
|
|
8039
|
+
* {@link QueryManager.batch batch} the options are still applied immediately — configuration
|
|
8040
|
+
* is not part of a batch's rollback — but the notification is deferred and merged into the
|
|
8041
|
+
* batch's single notification.
|
|
7212
8042
|
*/
|
|
7213
8043
|
reconfigure(options, config) {
|
|
7214
|
-
|
|
7215
|
-
...this
|
|
8044
|
+
const merged = config?.replace ? { ...options } : {
|
|
8045
|
+
...this.state.options,
|
|
7216
8046
|
...options
|
|
7217
|
-
}
|
|
7218
|
-
this
|
|
7219
|
-
this
|
|
7220
|
-
|
|
7221
|
-
this
|
|
8047
|
+
};
|
|
8048
|
+
if (optionsEqual(this.state.options, merged)) return this;
|
|
8049
|
+
this.applyOptions(freeze(merged));
|
|
8050
|
+
this.state.validation = void 0;
|
|
8051
|
+
this.reconcileHistoryConfig();
|
|
8052
|
+
++this.state.configVersion;
|
|
8053
|
+
if (this.state.batchDepth > 0) this.state.pendingConfigNotify = true;
|
|
8054
|
+
else this.notify(configChange);
|
|
7222
8055
|
return this;
|
|
7223
8056
|
}
|
|
7224
8057
|
/**
|
|
7225
8058
|
* Brings the history stacks in line with the current history configuration. Unlike
|
|
7226
|
-
* {@link QueryManager.clearHistory}, this does _not_ set
|
|
8059
|
+
* {@link QueryManager.clearHistory}, this does _not_ set `historyBypassed`: it reflects a
|
|
7227
8060
|
* configuration change rather than a deliberate history repositioning, so a later mutation in
|
|
7228
8061
|
* the same batch must still be recorded normally.
|
|
7229
8062
|
*
|
|
@@ -7231,13 +8064,13 @@ var QueryManager = class QueryManager {
|
|
|
7231
8064
|
* {@link QueryManager.batch batch} restores its snapshot, since that snapshot predates the
|
|
7232
8065
|
* configuration change (configuration is not part of a batch's rollback).
|
|
7233
8066
|
*/
|
|
7234
|
-
|
|
7235
|
-
if (this
|
|
7236
|
-
if (this
|
|
8067
|
+
reconcileHistoryConfig() {
|
|
8068
|
+
if (this.state.historyEnabled) {
|
|
8069
|
+
if (this.state.past.length > this.state.maxHistory) this.state.past.splice(0, this.state.past.length - this.state.maxHistory);
|
|
7237
8070
|
} else {
|
|
7238
|
-
this
|
|
7239
|
-
this
|
|
7240
|
-
this
|
|
8071
|
+
this.state.past = [];
|
|
8072
|
+
this.state.future = [];
|
|
8073
|
+
this.state.lastSig = void 0;
|
|
7241
8074
|
}
|
|
7242
8075
|
}
|
|
7243
8076
|
/**
|
|
@@ -7249,7 +8082,7 @@ var QueryManager = class QueryManager {
|
|
|
7249
8082
|
* {@link QueryManager.subscribe}. The `useQueryManager` hook from `react-querybuilder`
|
|
7250
8083
|
* already does this.
|
|
7251
8084
|
*/
|
|
7252
|
-
getConfigVersion = () => this
|
|
8085
|
+
getConfigVersion = () => this.state.configVersion;
|
|
7253
8086
|
/**
|
|
7254
8087
|
* Creates an independent manager with the same configuration and the current query.
|
|
7255
8088
|
*
|
|
@@ -7261,8 +8094,8 @@ var QueryManager = class QueryManager {
|
|
|
7261
8094
|
* is useful when both queries will be used together (e.g. inserted into the same tree).
|
|
7262
8095
|
*/
|
|
7263
8096
|
clone(options) {
|
|
7264
|
-
const query = options?.regenerateIDs ? regenerateIDs(this
|
|
7265
|
-
return new QueryManager(query, this
|
|
8097
|
+
const query = options?.regenerateIDs ? regenerateIDs(this.state.query, { idGenerator: this.state.idGenerator }) : this.state.query;
|
|
8098
|
+
return new QueryManager(query, this.state.options);
|
|
7266
8099
|
}
|
|
7267
8100
|
/**
|
|
7268
8101
|
* Registers a listener called after every change to the query, and returns a function that
|
|
@@ -7278,11 +8111,15 @@ var QueryManager = class QueryManager {
|
|
|
7278
8111
|
* ```
|
|
7279
8112
|
*
|
|
7280
8113
|
* In React, prefer the `useQueryManager` hook from `react-querybuilder`, which wraps this.
|
|
8114
|
+
*
|
|
8115
|
+
* The listener receives a {@link SubscriptionChange} describing what changed. It is optional:
|
|
8116
|
+
* a zero-argument listener — including `useSyncExternalStore`'s `onStoreChange` — is still a
|
|
8117
|
+
* valid listener and behaves as it always has.
|
|
7281
8118
|
*/
|
|
7282
8119
|
subscribe = (listener) => {
|
|
7283
|
-
this
|
|
8120
|
+
this.state.listeners.add(listener);
|
|
7284
8121
|
return () => {
|
|
7285
|
-
this
|
|
8122
|
+
this.state.listeners.delete(listener);
|
|
7286
8123
|
};
|
|
7287
8124
|
};
|
|
7288
8125
|
/**
|
|
@@ -7300,75 +8137,78 @@ var QueryManager = class QueryManager {
|
|
|
7300
8137
|
* its own, leaving the stacks exactly as those methods left them.
|
|
7301
8138
|
*/
|
|
7302
8139
|
batch(fn) {
|
|
7303
|
-
this
|
|
7304
|
-
if (this
|
|
7305
|
-
query: this
|
|
7306
|
-
past: [...this
|
|
7307
|
-
future: [...this
|
|
7308
|
-
lastSig: this
|
|
7309
|
-
lastAt: this
|
|
8140
|
+
this.state.batchDepth++;
|
|
8141
|
+
if (this.state.batchDepth === 1) this.state.batchSnapshot = {
|
|
8142
|
+
query: this.state.query,
|
|
8143
|
+
past: [...this.state.past],
|
|
8144
|
+
future: [...this.state.future],
|
|
8145
|
+
lastSig: this.state.lastSig,
|
|
8146
|
+
lastAt: this.state.lastAt
|
|
7310
8147
|
};
|
|
7311
8148
|
try {
|
|
7312
8149
|
fn();
|
|
7313
8150
|
} catch (error) {
|
|
7314
|
-
if (this
|
|
7315
|
-
const snapshot = this
|
|
7316
|
-
this
|
|
7317
|
-
this
|
|
7318
|
-
this
|
|
7319
|
-
this
|
|
7320
|
-
this
|
|
7321
|
-
this
|
|
8151
|
+
if (this.state.batchDepth === 1) {
|
|
8152
|
+
const snapshot = this.state.batchSnapshot;
|
|
8153
|
+
this.state.query = snapshot.query;
|
|
8154
|
+
this.state.past = snapshot.past;
|
|
8155
|
+
this.state.future = snapshot.future;
|
|
8156
|
+
this.state.lastSig = snapshot.lastSig;
|
|
8157
|
+
this.state.lastAt = snapshot.lastAt;
|
|
8158
|
+
this.reconcileHistoryConfig();
|
|
7322
8159
|
}
|
|
7323
8160
|
throw error;
|
|
7324
8161
|
} finally {
|
|
7325
|
-
this
|
|
7326
|
-
if (this
|
|
7327
|
-
const { query: base } = this
|
|
7328
|
-
this
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
8162
|
+
this.state.batchDepth--;
|
|
8163
|
+
if (this.state.batchDepth === 0) {
|
|
8164
|
+
const { query: base } = this.state.batchSnapshot;
|
|
8165
|
+
this.state.batchSnapshot = void 0;
|
|
8166
|
+
const queryChanged = base !== this.state.query;
|
|
8167
|
+
const configChanged = this.state.pendingConfigNotify;
|
|
8168
|
+
this.state.pendingConfigNotify = false;
|
|
8169
|
+
if (queryChanged) {
|
|
8170
|
+
if (!this.state.historyBypassed) this.record(base, this.state.query);
|
|
7332
8171
|
}
|
|
7333
|
-
this
|
|
8172
|
+
if (queryChanged || configChanged) this.notify(queryChanged ? configChanged ? queryAndConfigChange : queryChange : configChange);
|
|
8173
|
+
this.state.historyBypassed = false;
|
|
7334
8174
|
}
|
|
7335
8175
|
}
|
|
7336
8176
|
return this;
|
|
7337
8177
|
}
|
|
7338
8178
|
/** Whether there is a previous query to restore. Always `false` unless `history` is enabled. */
|
|
7339
8179
|
canUndo() {
|
|
7340
|
-
return this
|
|
8180
|
+
return this.state.past.length > 0;
|
|
7341
8181
|
}
|
|
7342
8182
|
/** Whether there is an undone query to restore. Always `false` unless `history` is enabled. */
|
|
7343
8183
|
canRedo() {
|
|
7344
|
-
return this
|
|
8184
|
+
return this.state.future.length > 0;
|
|
7345
8185
|
}
|
|
7346
8186
|
/** Restores the previous query. No-op when {@link QueryManager.canUndo} is `false`. */
|
|
7347
8187
|
undo() {
|
|
7348
|
-
if (this
|
|
7349
|
-
this
|
|
7350
|
-
this
|
|
7351
|
-
this
|
|
7352
|
-
this
|
|
7353
|
-
if (this
|
|
8188
|
+
if (this.state.past.length === 0) return this;
|
|
8189
|
+
this.state.future.unshift(this.state.query);
|
|
8190
|
+
this.state.query = this.state.past.pop();
|
|
8191
|
+
this.state.lastSig = void 0;
|
|
8192
|
+
this.markHistoryBypassed();
|
|
8193
|
+
if (this.state.batchDepth === 0) this.notify(queryChange);
|
|
7354
8194
|
return this;
|
|
7355
8195
|
}
|
|
7356
8196
|
/** Restores the most recently undone query. No-op when {@link QueryManager.canRedo} is `false`. */
|
|
7357
8197
|
redo() {
|
|
7358
|
-
if (this
|
|
7359
|
-
this
|
|
7360
|
-
this
|
|
7361
|
-
this
|
|
7362
|
-
this
|
|
7363
|
-
if (this
|
|
8198
|
+
if (this.state.future.length === 0) return this;
|
|
8199
|
+
this.state.past.push(this.state.query);
|
|
8200
|
+
this.state.query = this.state.future.shift();
|
|
8201
|
+
this.state.lastSig = void 0;
|
|
8202
|
+
this.markHistoryBypassed();
|
|
8203
|
+
if (this.state.batchDepth === 0) this.notify(queryChange);
|
|
7364
8204
|
return this;
|
|
7365
8205
|
}
|
|
7366
8206
|
/** Discards all undo/redo history without changing the current query. */
|
|
7367
8207
|
clearHistory() {
|
|
7368
|
-
this
|
|
7369
|
-
this
|
|
7370
|
-
this
|
|
7371
|
-
this
|
|
8208
|
+
this.markHistoryBypassed();
|
|
8209
|
+
this.state.past = [];
|
|
8210
|
+
this.state.future = [];
|
|
8211
|
+
this.state.lastSig = void 0;
|
|
7372
8212
|
return this;
|
|
7373
8213
|
}
|
|
7374
8214
|
/**
|
|
@@ -7377,8 +8217,8 @@ var QueryManager = class QueryManager {
|
|
|
7377
8217
|
*/
|
|
7378
8218
|
getHistory() {
|
|
7379
8219
|
return {
|
|
7380
|
-
past: [...this
|
|
7381
|
-
future: [...this
|
|
8220
|
+
past: [...this.state.past],
|
|
8221
|
+
future: [...this.state.future]
|
|
7382
8222
|
};
|
|
7383
8223
|
}
|
|
7384
8224
|
/**
|
|
@@ -7388,12 +8228,12 @@ var QueryManager = class QueryManager {
|
|
|
7388
8228
|
* one that depends on anything other than the query) may run fewer times than expected.
|
|
7389
8229
|
*/
|
|
7390
8230
|
validate() {
|
|
7391
|
-
this
|
|
7392
|
-
this
|
|
7393
|
-
return this
|
|
8231
|
+
this.ensureCache();
|
|
8232
|
+
this.state.validation ??= this.state.validator(this.state.query);
|
|
8233
|
+
return this.state.validation;
|
|
7394
8234
|
}
|
|
7395
8235
|
format(options) {
|
|
7396
|
-
return formatQuery(this
|
|
8236
|
+
return formatQuery(this.state.query, options);
|
|
7397
8237
|
}
|
|
7398
8238
|
/**
|
|
7399
8239
|
* Yields every rule and group in the query, depth-first in pre-order, starting with the root
|
|
@@ -7413,18 +8253,18 @@ var QueryManager = class QueryManager {
|
|
|
7413
8253
|
*/
|
|
7414
8254
|
*walk(options = {}) {
|
|
7415
8255
|
const { from, rulesOnly, groupsOnly } = options;
|
|
7416
|
-
let start = this
|
|
8256
|
+
let start = this.state.query;
|
|
7417
8257
|
let startPath = [];
|
|
7418
8258
|
let startParent = null;
|
|
7419
8259
|
if (from !== void 0) {
|
|
7420
|
-
const path = this
|
|
7421
|
-
const node = path && findPath(path, this
|
|
8260
|
+
const path = this.toPath(from);
|
|
8261
|
+
const node = path && findPath(path, this.state.query);
|
|
7422
8262
|
if (!path || !node) return;
|
|
7423
8263
|
start = node;
|
|
7424
8264
|
startPath = path;
|
|
7425
|
-
startParent = path.length === 0 ? null : findPath(getParentPath(path), this
|
|
8265
|
+
startParent = path.length === 0 ? null : findPath(getParentPath(path), this.state.query);
|
|
7426
8266
|
}
|
|
7427
|
-
for (const entry of this
|
|
8267
|
+
for (const entry of this.walkFrom(start, startPath, startParent)) {
|
|
7428
8268
|
if (rulesOnly && isRuleGroup(entry.node)) continue;
|
|
7429
8269
|
if (groupsOnly && !isRuleGroup(entry.node)) continue;
|
|
7430
8270
|
yield entry;
|
|
@@ -7469,34 +8309,34 @@ var QueryManager = class QueryManager {
|
|
|
7469
8309
|
* index, unresolvable paths are always normalized to `null` here.
|
|
7470
8310
|
*/
|
|
7471
8311
|
findPath(path) {
|
|
7472
|
-
return findPath(path, this
|
|
8312
|
+
return findPath(path, this.state.query) ?? null;
|
|
7473
8313
|
}
|
|
7474
8314
|
/**
|
|
7475
8315
|
* Returns the rule or group with the given `id`, or `null` if there is none. Backed by an
|
|
7476
8316
|
* index built once per query, so repeated lookups are constant time.
|
|
7477
8317
|
*/
|
|
7478
8318
|
findID(id) {
|
|
7479
|
-
const path = this
|
|
7480
|
-
return path === void 0 ? null : findPath(path, this
|
|
8319
|
+
const path = this.index().get(id);
|
|
8320
|
+
return path === void 0 ? null : findPath(path, this.state.query);
|
|
7481
8321
|
}
|
|
7482
8322
|
/**
|
|
7483
8323
|
* Returns the {@link Path} of the rule or group with the given `id`, or `null` if there is
|
|
7484
8324
|
* none. Backed by an index built once per query, so repeated lookups are constant time.
|
|
7485
8325
|
*/
|
|
7486
8326
|
getPathOfID(id) {
|
|
7487
|
-
return this
|
|
8327
|
+
return this.index().get(id) ?? null;
|
|
7488
8328
|
}
|
|
7489
8329
|
/**
|
|
7490
8330
|
* Determines whether the rule or group at the given path is disabled, either itself or by an
|
|
7491
8331
|
* ancestor group.
|
|
7492
8332
|
*/
|
|
7493
8333
|
pathIsDisabled(path) {
|
|
7494
|
-
return pathIsDisabled(path, this
|
|
8334
|
+
return pathIsDisabled(path, this.state.query);
|
|
7495
8335
|
}
|
|
7496
8336
|
/** Returns the rule or group at the given path or `id`, or `null` if it can't be resolved. */
|
|
7497
8337
|
getNode(pathOrID) {
|
|
7498
|
-
const path = this
|
|
7499
|
-
return path === null ? null : findPath(path, this
|
|
8338
|
+
const path = this.toPath(pathOrID);
|
|
8339
|
+
return path === null ? null : findPath(path, this.state.query) ?? null;
|
|
7500
8340
|
}
|
|
7501
8341
|
/**
|
|
7502
8342
|
* Returns the rule at the given path or `id`, or `null` if it can't be resolved _or_ resolves
|
|
@@ -7519,24 +8359,24 @@ var QueryManager = class QueryManager {
|
|
|
7519
8359
|
* for the root group, which has no parent, and when the target can't be resolved.
|
|
7520
8360
|
*/
|
|
7521
8361
|
getParent(pathOrID) {
|
|
7522
|
-
const path = this
|
|
8362
|
+
const path = this.toPath(pathOrID);
|
|
7523
8363
|
if (path === null || path.length === 0) return null;
|
|
7524
|
-
if (!findPath(path, this
|
|
7525
|
-
return findPath(getParentPath(path), this
|
|
8364
|
+
if (!findPath(path, this.state.query)) return null;
|
|
8365
|
+
return findPath(getParentPath(path), this.state.query);
|
|
7526
8366
|
}
|
|
7527
8367
|
/**
|
|
7528
8368
|
* The normalized field list, as the `QueryBuilder` component would render it. Needed to
|
|
7529
8369
|
* populate a field selector.
|
|
7530
8370
|
*/
|
|
7531
8371
|
getFields() {
|
|
7532
|
-
return this
|
|
8372
|
+
return this.state.fields;
|
|
7533
8373
|
}
|
|
7534
8374
|
/**
|
|
7535
8375
|
* The normalized combinator list, as the `QueryBuilder` component would render it. Needed to
|
|
7536
8376
|
* populate a combinator selector.
|
|
7537
8377
|
*/
|
|
7538
8378
|
getCombinators() {
|
|
7539
|
-
return this
|
|
8379
|
+
return this.state.combinators;
|
|
7540
8380
|
}
|
|
7541
8381
|
/**
|
|
7542
8382
|
* The field configuration for a field name. When the field isn't configured, returns the same
|
|
@@ -7544,27 +8384,51 @@ var QueryManager = class QueryManager {
|
|
|
7544
8384
|
* {@link QueryManager.getRuleContext} reports as `fieldData`, so both access paths agree.
|
|
7545
8385
|
*/
|
|
7546
8386
|
getFieldData(field) {
|
|
7547
|
-
return getFieldData(field, this
|
|
8387
|
+
return getFieldData(field, this.state.fieldMap);
|
|
7548
8388
|
}
|
|
7549
8389
|
/** The operator list for a field, mirroring `QueryBuilder`'s precedence. */
|
|
7550
8390
|
getOperators(field) {
|
|
7551
|
-
return this
|
|
8391
|
+
return this.operatorsFor(field);
|
|
7552
8392
|
}
|
|
7553
8393
|
/** The value sources available for a field/operator pair. */
|
|
7554
8394
|
getValueSources(field, operator) {
|
|
7555
|
-
return this
|
|
8395
|
+
return this.valueSourcesFor(field, operator);
|
|
7556
8396
|
}
|
|
7557
8397
|
/** The match modes available for a field. */
|
|
7558
8398
|
getMatchModes(field) {
|
|
7559
|
-
return this
|
|
8399
|
+
return this.matchModesFor(field);
|
|
7560
8400
|
}
|
|
7561
8401
|
/** The value option list for a field/operator pair. */
|
|
7562
8402
|
getValues(field, operator) {
|
|
7563
|
-
return this
|
|
8403
|
+
return this.valuesFor(field, operator);
|
|
7564
8404
|
}
|
|
7565
8405
|
/** The value editor type for a field/operator pair. */
|
|
7566
8406
|
getValueEditorType(field, operator) {
|
|
7567
|
-
return this
|
|
8407
|
+
return this.valueEditorTypeFor(field, operator);
|
|
8408
|
+
}
|
|
8409
|
+
/**
|
|
8410
|
+
* The default `operator` for a field, identical to the operator
|
|
8411
|
+
* {@link QueryManager.createRule} would assign to a new rule on that field.
|
|
8412
|
+
*/
|
|
8413
|
+
getRuleDefaultOperator(field) {
|
|
8414
|
+
return this.defaultOperator(field);
|
|
8415
|
+
}
|
|
8416
|
+
/**
|
|
8417
|
+
* The default `value` for a rule, identical to the value {@link QueryManager.createRule} and
|
|
8418
|
+
* {@link QueryManager.update} would assign after a field or operator change.
|
|
8419
|
+
*/
|
|
8420
|
+
getRuleDefaultValue(rule) {
|
|
8421
|
+
return this.defaultValue(rule);
|
|
8422
|
+
}
|
|
8423
|
+
/**
|
|
8424
|
+
* The flattened field record backing {@link QueryManager.getFieldData}, keyed by field name
|
|
8425
|
+
* with option groups flattened away.
|
|
8426
|
+
*
|
|
8427
|
+
* Treat the result as read-only. It may or may not be frozen depending on configuration, so
|
|
8428
|
+
* do not rely on frozen-ness to prevent mutation.
|
|
8429
|
+
*/
|
|
8430
|
+
getFieldMap() {
|
|
8431
|
+
return this.state.fieldMap;
|
|
7568
8432
|
}
|
|
7569
8433
|
/**
|
|
7570
8434
|
* Resolves everything about a rule that depends on the field/operator configuration—field data,
|
|
@@ -7579,16 +8443,16 @@ var QueryManager = class QueryManager {
|
|
|
7579
8443
|
if (!rule) return null;
|
|
7580
8444
|
const validation = this.validate();
|
|
7581
8445
|
return deriveRuleContext(rule, {
|
|
7582
|
-
fields: this
|
|
7583
|
-
fieldMap: this
|
|
7584
|
-
getInputType: (f, o, misc) => this
|
|
7585
|
-
getMatchModes: (f) => this
|
|
7586
|
-
getOperators: (f) => this
|
|
7587
|
-
getParameters: (f, o, misc) => this
|
|
7588
|
-
getValueEditorType: (f, o) => this
|
|
7589
|
-
getValues: (f, o) => this
|
|
8446
|
+
fields: this.state.fields,
|
|
8447
|
+
fieldMap: this.state.fieldMap,
|
|
8448
|
+
getInputType: (f, o, misc) => this.state.options.getInputType?.(f, o, misc) ?? null,
|
|
8449
|
+
getMatchModes: (f) => this.matchModesFor(f),
|
|
8450
|
+
getOperators: (f) => this.operatorsFor(f),
|
|
8451
|
+
getParameters: (f, o, misc) => this.parametersFor(f, o, misc),
|
|
8452
|
+
getValueEditorType: (f, o) => this.valueEditorTypeFor(f, o),
|
|
8453
|
+
getValues: (f, o) => this.valuesFor(f, o),
|
|
7590
8454
|
getValueSources: (f, o) => this.getValueSources(f, o),
|
|
7591
|
-
getSubQueryBuilderProps: (f, misc) => this
|
|
8455
|
+
getSubQueryBuilderProps: (f, misc) => this.state.options.getSubQueryBuilderProps?.(f, misc) ?? {}
|
|
7592
8456
|
}, {
|
|
7593
8457
|
validationMap: typeof validation === "boolean" ? {} : validation,
|
|
7594
8458
|
id: rule.id
|
|
@@ -7604,32 +8468,32 @@ var QueryManager = class QueryManager {
|
|
|
7604
8468
|
const ruleGroup = this.getGroup(pathOrID);
|
|
7605
8469
|
if (!ruleGroup) return null;
|
|
7606
8470
|
const validation = this.validate();
|
|
7607
|
-
return deriveRuleGroupContext(ruleGroup, this
|
|
8471
|
+
return deriveRuleGroupContext(ruleGroup, this.state.combinators, {
|
|
7608
8472
|
validationMap: typeof validation === "boolean" ? {} : validation,
|
|
7609
8473
|
id: ruleGroup.id
|
|
7610
8474
|
});
|
|
7611
8475
|
}
|
|
7612
8476
|
/** Whether the current query uses independent combinators. */
|
|
7613
8477
|
isIC() {
|
|
7614
|
-
return isRuleGroupTypeIC(this
|
|
8478
|
+
return isRuleGroupTypeIC(this.state.query);
|
|
7615
8479
|
}
|
|
7616
8480
|
/**
|
|
7617
8481
|
* Returns the signature describing how the current query differs from `other`, as used by
|
|
7618
8482
|
* this manager's history coalescing.
|
|
7619
8483
|
*/
|
|
7620
8484
|
signatureOf(other) {
|
|
7621
|
-
return signatureOf(this
|
|
8485
|
+
return signatureOf(this.state.query, other);
|
|
7622
8486
|
}
|
|
7623
8487
|
/** Generates a {@link DiagnosticsResult}. Shorthand for `format('diagnostics')`. */
|
|
7624
8488
|
diagnostics() {
|
|
7625
|
-
return formatQuery(this
|
|
8489
|
+
return formatQuery(this.state.query, "diagnostics");
|
|
7626
8490
|
}
|
|
7627
8491
|
/**
|
|
7628
8492
|
* Returns the current query, so `JSON.stringify(queryManager)` produces the same output as
|
|
7629
8493
|
* `JSON.stringify(queryManager.getQuery())`.
|
|
7630
8494
|
*/
|
|
7631
8495
|
toJSON() {
|
|
7632
|
-
return this
|
|
8496
|
+
return this.state.query;
|
|
7633
8497
|
}
|
|
7634
8498
|
/**
|
|
7635
8499
|
* Returns a new manager with the same configuration and the current query converted to use
|
|
@@ -7637,7 +8501,7 @@ var QueryManager = class QueryManager {
|
|
|
7637
8501
|
* {@link QueryManager.clone}, subscribers and history are not carried over.
|
|
7638
8502
|
*/
|
|
7639
8503
|
toIC() {
|
|
7640
|
-
return new QueryManager(convertToIC(this
|
|
8504
|
+
return new QueryManager(convertToIC(this.state.query), this.state.options);
|
|
7641
8505
|
}
|
|
7642
8506
|
/**
|
|
7643
8507
|
* Returns a new manager with the same configuration and the current query converted to use a
|
|
@@ -7645,7 +8509,7 @@ var QueryManager = class QueryManager {
|
|
|
7645
8509
|
* {@link QueryManager.clone}, subscribers and history are not carried over.
|
|
7646
8510
|
*/
|
|
7647
8511
|
fromIC() {
|
|
7648
|
-
return new QueryManager(convertFromIC(this
|
|
8512
|
+
return new QueryManager(convertFromIC(this.state.query), this.state.options);
|
|
7649
8513
|
}
|
|
7650
8514
|
/**
|
|
7651
8515
|
* Runs {@link transformQuery} against the current query and returns its result.
|
|
@@ -7655,10 +8519,10 @@ var QueryManager = class QueryManager {
|
|
|
7655
8519
|
* shapes that are no longer valid queries. This manager is never modified.
|
|
7656
8520
|
*/
|
|
7657
8521
|
transform(options) {
|
|
7658
|
-
return transformQuery(this
|
|
8522
|
+
return transformQuery(this.state.query, options);
|
|
7659
8523
|
}
|
|
7660
8524
|
};
|
|
7661
8525
|
//#endregion
|
|
7662
|
-
export { LogType, QueryManager, QueryManagerError, TestID, 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, 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 };
|
|
8526
|
+
export { LogType, QueryManager, QueryManagerError, TestID, 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, 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 };
|
|
7663
8527
|
|
|
7664
8528
|
//# sourceMappingURL=react-querybuilder_core.mjs.map
|