@react-querybuilder/core 8.9.2 → 8.11.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/dist/{arrayUtils-BF1P8iHS.mjs → arrayUtils-A_OXU9W1.mjs} +3 -75
- package/dist/arrayUtils-A_OXU9W1.mjs.map +1 -0
- package/dist/arrayUtils-QxZOZTf6.js +73 -0
- package/dist/arrayUtils-QxZOZTf6.js.map +1 -0
- package/dist/basic-DEc65Kng.d.mts +363 -0
- package/dist/basic-Dd_M2f3M.d.ts +363 -0
- package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +806 -1366
- package/dist/cjs/react-querybuilder_core.cjs.development.js +455 -116
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +806 -1366
- 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-H7RhQiIc.mjs → convertQuery-CqX3rPvj.mjs} +3 -3
- package/dist/{convertQuery-H7RhQiIc.mjs.map → convertQuery-CqX3rPvj.mjs.map} +1 -1
- package/dist/{export-DyrnTh6K.d.ts → export-Dy4FckB-.d.ts} +7 -6
- package/dist/{export-r-V7bU31.d.mts → export-t1V2N8pz.d.mts} +7 -6
- package/dist/formatQuery.d.mts +3 -2
- package/dist/formatQuery.d.ts +3 -2
- package/dist/formatQuery.js +217 -87
- package/dist/formatQuery.js.map +1 -1
- package/dist/formatQuery.mjs +217 -87
- package/dist/formatQuery.mjs.map +1 -1
- package/dist/{import-Cksobmln.d.ts → import-Cz8canKo.d.mts} +3 -3
- package/dist/{import-BwbbP4oU.d.mts → import-DtS9Ocx5.d.ts} +3 -3
- package/dist/{isRuleGroup-CnhYpLOM.mjs → isRuleGroup-CYcfPgbg.mjs} +2 -2
- package/dist/{isRuleGroup-CnhYpLOM.mjs.map → isRuleGroup-CYcfPgbg.mjs.map} +1 -1
- package/dist/lexer-C53tqS2p.js +406 -0
- package/dist/lexer-C53tqS2p.js.map +1 -0
- package/dist/{optGroupUtils-CXLgyg2i.js → optGroupUtils-B0hTpodo.js} +114 -1
- package/dist/optGroupUtils-B0hTpodo.js.map +1 -0
- package/dist/{optGroupUtils-Duv-M8rf.mjs → optGroupUtils-VeZ3k7-1.mjs} +86 -3
- package/dist/optGroupUtils-VeZ3k7-1.mjs.map +1 -0
- package/dist/parseCEL.d.mts +292 -11
- package/dist/parseCEL.d.ts +292 -11
- package/dist/parseCEL.js +874 -1125
- package/dist/parseCEL.js.map +1 -1
- package/dist/parseCEL.mjs +828 -1126
- package/dist/parseCEL.mjs.map +1 -1
- package/dist/parseJSONata.d.mts +3 -2
- package/dist/parseJSONata.d.ts +3 -2
- package/dist/parseJSONata.js +49 -77
- package/dist/parseJSONata.js.map +1 -1
- package/dist/parseJSONata.mjs +4 -5
- package/dist/parseJSONata.mjs.map +1 -1
- package/dist/parseJsonLogic.d.mts +4 -3
- package/dist/parseJsonLogic.d.ts +4 -3
- package/dist/parseJsonLogic.js +5 -6
- package/dist/parseJsonLogic.js.map +1 -1
- package/dist/parseJsonLogic.mjs +5 -6
- package/dist/parseJsonLogic.mjs.map +1 -1
- package/dist/parseMongoDB.d.mts +3 -2
- package/dist/parseMongoDB.d.ts +3 -2
- package/dist/parseMongoDB.js +15 -16
- package/dist/parseMongoDB.js.map +1 -1
- package/dist/parseMongoDB.mjs +5 -6
- package/dist/parseMongoDB.mjs.map +1 -1
- package/dist/{parseNumber-BtGKa58z.mjs → parseNumber-CXdMVNFx.mjs} +2 -2
- package/dist/{parseNumber-BtGKa58z.mjs.map → parseNumber-CXdMVNFx.mjs.map} +1 -1
- package/dist/{parseNumber-Bcys1kOH.js → parseNumber-D4iQDxK-.js} +1 -1
- package/dist/{parseNumber-Bcys1kOH.js.map → parseNumber-D4iQDxK-.js.map} +1 -1
- package/dist/parseSQL.d.mts +3 -2
- package/dist/parseSQL.d.ts +3 -2
- package/dist/parseSQL.js +2691 -3036
- package/dist/parseSQL.js.map +1 -1
- package/dist/parseSQL.mjs +2691 -3037
- package/dist/parseSQL.mjs.map +1 -1
- package/dist/parseSpEL.d.mts +3 -2
- package/dist/parseSpEL.d.ts +3 -2
- package/dist/parseSpEL.js +7 -9
- package/dist/parseSpEL.js.map +1 -1
- package/dist/parseSpEL.mjs +5 -6
- package/dist/parseSpEL.mjs.map +1 -1
- package/dist/{prepareQueryObjects-BqFEs4eV.js → prepareQueryObjects-BOUWfel5.js} +4 -5
- package/dist/prepareQueryObjects-BOUWfel5.js.map +1 -0
- package/dist/{prepareQueryObjects-CS6Wmhmf.mjs → prepareQueryObjects-DPCC-iHp.mjs} +6 -7
- package/dist/prepareQueryObjects-DPCC-iHp.mjs.map +1 -0
- package/dist/query-builder-layout.css +1 -1
- package/dist/query-builder-layout.css.map +1 -1
- package/dist/query-builder.css +1 -1
- package/dist/query-builder.css.map +1 -1
- package/dist/react-querybuilder_core.d.mts +806 -1366
- package/dist/react-querybuilder_core.legacy-esm.d.ts +806 -1366
- package/dist/react-querybuilder_core.legacy-esm.js +455 -114
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +448 -117
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +806 -1366
- package/dist/react-querybuilder_core.production.mjs +1 -1
- package/dist/react-querybuilder_core.production.mjs.map +1 -1
- package/dist/styles/_layout.scss +61 -17
- package/dist/styles/_main.scss +22 -4
- package/dist/{transformQuery-FL_nlpp5.js → transformQuery-CWDPogO5.js} +1 -1
- package/dist/{transformQuery-FL_nlpp5.js.map → transformQuery-CWDPogO5.js.map} +1 -1
- package/dist/{transformQuery-DdMvmrCh.mjs → transformQuery-DCCpjtyq.mjs} +3 -3
- package/dist/{transformQuery-DdMvmrCh.mjs.map → transformQuery-DCCpjtyq.mjs.map} +1 -1
- package/dist/transformQuery.d.mts +1 -1
- package/dist/transformQuery.d.ts +1 -1
- package/dist/transformQuery.js +1 -1
- package/dist/transformQuery.mjs +2 -2
- package/package.json +14 -12
- package/dist/arrayUtils-BF1P8iHS.mjs.map +0 -1
- package/dist/arrayUtils-D5EoIsKP.js +0 -164
- package/dist/arrayUtils-D5EoIsKP.js.map +0 -1
- package/dist/basic-BfD-7CN3.d.mts +0 -1235
- package/dist/basic-C8xXKHIA.d.ts +0 -1235
- package/dist/objectUtils-BBZSfZJz.js +0 -17
- package/dist/objectUtils-BBZSfZJz.js.map +0 -1
- package/dist/objectUtils-BtWdcZVG.mjs +0 -11
- package/dist/objectUtils-BtWdcZVG.mjs.map +0 -1
- package/dist/optGroupUtils-CXLgyg2i.js.map +0 -1
- package/dist/optGroupUtils-Duv-M8rf.mjs.map +0 -1
- package/dist/prepareQueryObjects-BqFEs4eV.js.map +0 -1
- package/dist/prepareQueryObjects-CS6Wmhmf.mjs.map +0 -1
|
@@ -65,6 +65,108 @@ const defaultPlaceholderValueLabel = defaultPlaceholderLabel;
|
|
|
65
65
|
*/
|
|
66
66
|
const defaultPlaceholderValueGroupLabel = defaultPlaceholderLabel;
|
|
67
67
|
/**
|
|
68
|
+
* Default configuration of translatable strings.
|
|
69
|
+
*
|
|
70
|
+
* @group Defaults
|
|
71
|
+
*/
|
|
72
|
+
const defaultTranslations = {
|
|
73
|
+
fields: {
|
|
74
|
+
title: "Field",
|
|
75
|
+
placeholderName: defaultPlaceholderFieldName,
|
|
76
|
+
placeholderLabel: defaultPlaceholderFieldLabel,
|
|
77
|
+
placeholderGroupLabel: defaultPlaceholderFieldGroupLabel
|
|
78
|
+
},
|
|
79
|
+
operators: {
|
|
80
|
+
title: "Operator",
|
|
81
|
+
placeholderName: defaultPlaceholderOperatorName,
|
|
82
|
+
placeholderLabel: defaultPlaceholderOperatorLabel,
|
|
83
|
+
placeholderGroupLabel: defaultPlaceholderOperatorGroupLabel
|
|
84
|
+
},
|
|
85
|
+
values: {
|
|
86
|
+
title: "Values",
|
|
87
|
+
placeholderName: defaultPlaceholderValueName,
|
|
88
|
+
placeholderLabel: defaultPlaceholderValueLabel,
|
|
89
|
+
placeholderGroupLabel: defaultPlaceholderValueGroupLabel
|
|
90
|
+
},
|
|
91
|
+
matchMode: { title: "Match mode" },
|
|
92
|
+
matchThreshold: { title: "Match threshold" },
|
|
93
|
+
value: { title: "Value" },
|
|
94
|
+
removeRule: {
|
|
95
|
+
label: "⨯",
|
|
96
|
+
title: "Remove rule"
|
|
97
|
+
},
|
|
98
|
+
removeGroup: {
|
|
99
|
+
label: "⨯",
|
|
100
|
+
title: "Remove group"
|
|
101
|
+
},
|
|
102
|
+
addRule: {
|
|
103
|
+
label: "+ Rule",
|
|
104
|
+
title: "Add rule"
|
|
105
|
+
},
|
|
106
|
+
addGroup: {
|
|
107
|
+
label: "+ Group",
|
|
108
|
+
title: "Add group"
|
|
109
|
+
},
|
|
110
|
+
combinators: { title: "Combinator" },
|
|
111
|
+
notToggle: {
|
|
112
|
+
label: "Not",
|
|
113
|
+
title: "Invert this group"
|
|
114
|
+
},
|
|
115
|
+
cloneRule: {
|
|
116
|
+
label: "⧉",
|
|
117
|
+
title: "Clone rule"
|
|
118
|
+
},
|
|
119
|
+
cloneRuleGroup: {
|
|
120
|
+
label: "⧉",
|
|
121
|
+
title: "Clone group"
|
|
122
|
+
},
|
|
123
|
+
shiftActionUp: {
|
|
124
|
+
label: "˄",
|
|
125
|
+
title: "Shift up"
|
|
126
|
+
},
|
|
127
|
+
shiftActionDown: {
|
|
128
|
+
label: "˅",
|
|
129
|
+
title: "Shift down"
|
|
130
|
+
},
|
|
131
|
+
dragHandle: {
|
|
132
|
+
label: "⁞⁞",
|
|
133
|
+
title: "Drag handle"
|
|
134
|
+
},
|
|
135
|
+
lockRule: {
|
|
136
|
+
label: "🔓",
|
|
137
|
+
title: "Lock rule"
|
|
138
|
+
},
|
|
139
|
+
lockGroup: {
|
|
140
|
+
label: "🔓",
|
|
141
|
+
title: "Lock group"
|
|
142
|
+
},
|
|
143
|
+
lockRuleDisabled: {
|
|
144
|
+
label: "🔒",
|
|
145
|
+
title: "Unlock rule"
|
|
146
|
+
},
|
|
147
|
+
lockGroupDisabled: {
|
|
148
|
+
label: "🔒",
|
|
149
|
+
title: "Unlock group"
|
|
150
|
+
},
|
|
151
|
+
muteRule: {
|
|
152
|
+
label: "🔊",
|
|
153
|
+
title: "Mute rule"
|
|
154
|
+
},
|
|
155
|
+
muteGroup: {
|
|
156
|
+
label: "🔊",
|
|
157
|
+
title: "Mute group"
|
|
158
|
+
},
|
|
159
|
+
unmuteRule: {
|
|
160
|
+
label: "🔇",
|
|
161
|
+
title: "Unmute rule"
|
|
162
|
+
},
|
|
163
|
+
unmuteGroup: {
|
|
164
|
+
label: "🔇",
|
|
165
|
+
title: "Unmute group"
|
|
166
|
+
},
|
|
167
|
+
valueSourceSelector: { title: "Value source" }
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
68
170
|
* Default character used to `.join` and `.split` arrays.
|
|
69
171
|
*
|
|
70
172
|
* @group Defaults
|
|
@@ -313,8 +415,11 @@ const standardClassnames = {
|
|
|
313
415
|
dndDropNotAllowed: "dndDropNotAllowed",
|
|
314
416
|
dragHandle: "queryBuilder-dragHandle",
|
|
315
417
|
disabled: "queryBuilder-disabled",
|
|
418
|
+
muted: "queryBuilder-muted",
|
|
316
419
|
lockRule: "rule-lock",
|
|
317
420
|
lockGroup: "ruleGroup-lock",
|
|
421
|
+
muteRule: "rule-mute",
|
|
422
|
+
muteGroup: "ruleGroup-mute",
|
|
318
423
|
valueSource: "rule-valueSource",
|
|
319
424
|
valueListItem: "rule-value-list-item",
|
|
320
425
|
branches: "queryBuilder-branches",
|
|
@@ -349,6 +454,9 @@ const defaultControlClassnames = {
|
|
|
349
454
|
dragHandle: "",
|
|
350
455
|
lockRule: "",
|
|
351
456
|
lockGroup: "",
|
|
457
|
+
muteRule: "",
|
|
458
|
+
muteGroup: "",
|
|
459
|
+
muted: "",
|
|
352
460
|
valueSource: "",
|
|
353
461
|
actionElement: "",
|
|
354
462
|
valueSelector: "",
|
|
@@ -399,6 +507,8 @@ const TestID = {
|
|
|
399
507
|
dragHandle: "drag-handle",
|
|
400
508
|
lockRule: "lock-rule",
|
|
401
509
|
lockGroup: "lock-group",
|
|
510
|
+
muteRule: "mute-rule",
|
|
511
|
+
muteGroup: "mute-group",
|
|
402
512
|
valueSourceSelector: "value-source-selector",
|
|
403
513
|
matchModeEditor: "match-mode-editor"
|
|
404
514
|
};
|
|
@@ -425,6 +535,31 @@ const LogType = {
|
|
|
425
535
|
* @group Defaults
|
|
426
536
|
*/
|
|
427
537
|
const rootPath = [];
|
|
538
|
+
/**
|
|
539
|
+
* Default values for all `boolean`
|
|
540
|
+
* {@link react-querybuilder!QueryBuilder QueryBuilder} options.
|
|
541
|
+
*
|
|
542
|
+
* @group Defaults
|
|
543
|
+
*/
|
|
544
|
+
const queryBuilderFlagDefaults = {
|
|
545
|
+
addRuleToNewGroups: false,
|
|
546
|
+
autoSelectField: true,
|
|
547
|
+
autoSelectOperator: true,
|
|
548
|
+
autoSelectValue: false,
|
|
549
|
+
debugMode: false,
|
|
550
|
+
enableDragAndDrop: false,
|
|
551
|
+
enableMountQueryChange: true,
|
|
552
|
+
listsAsArrays: false,
|
|
553
|
+
resetOnFieldChange: true,
|
|
554
|
+
resetOnOperatorChange: false,
|
|
555
|
+
showCloneButtons: false,
|
|
556
|
+
showCombinatorsBetweenRules: false,
|
|
557
|
+
showLockButtons: false,
|
|
558
|
+
showMuteButtons: false,
|
|
559
|
+
showNotToggle: false,
|
|
560
|
+
showShiftActions: false,
|
|
561
|
+
suppressStandardClassnames: false
|
|
562
|
+
};
|
|
428
563
|
|
|
429
564
|
//#endregion
|
|
430
565
|
//#region src/utils/arrayUtils.ts
|
|
@@ -558,7 +693,7 @@ const isRuleGroupType = (rg) => isRuleGroup(rg) && typeof rg.combinator === "str
|
|
|
558
693
|
const isRuleGroupTypeIC = (rg) => isRuleGroup(rg) && rg.combinator === void 0;
|
|
559
694
|
|
|
560
695
|
//#endregion
|
|
561
|
-
//#region \0@oxc-project+runtime@0.
|
|
696
|
+
//#region \0@oxc-project+runtime@0.95.0/helpers/typeof.js
|
|
562
697
|
function _typeof(o) {
|
|
563
698
|
"@babel/helpers - typeof";
|
|
564
699
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
@@ -569,7 +704,7 @@ function _typeof(o) {
|
|
|
569
704
|
}
|
|
570
705
|
|
|
571
706
|
//#endregion
|
|
572
|
-
//#region \0@oxc-project+runtime@0.
|
|
707
|
+
//#region \0@oxc-project+runtime@0.95.0/helpers/toPrimitive.js
|
|
573
708
|
function toPrimitive(t, r) {
|
|
574
709
|
if ("object" != _typeof(t) || !t) return t;
|
|
575
710
|
var e = t[Symbol.toPrimitive];
|
|
@@ -582,14 +717,14 @@ function toPrimitive(t, r) {
|
|
|
582
717
|
}
|
|
583
718
|
|
|
584
719
|
//#endregion
|
|
585
|
-
//#region \0@oxc-project+runtime@0.
|
|
720
|
+
//#region \0@oxc-project+runtime@0.95.0/helpers/toPropertyKey.js
|
|
586
721
|
function toPropertyKey(t) {
|
|
587
722
|
var i = toPrimitive(t, "string");
|
|
588
723
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
589
724
|
}
|
|
590
725
|
|
|
591
726
|
//#endregion
|
|
592
|
-
//#region \0@oxc-project+runtime@0.
|
|
727
|
+
//#region \0@oxc-project+runtime@0.95.0/helpers/defineProperty.js
|
|
593
728
|
function _defineProperty(e, r, t) {
|
|
594
729
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
595
730
|
value: t,
|
|
@@ -600,7 +735,7 @@ function _defineProperty(e, r, t) {
|
|
|
600
735
|
}
|
|
601
736
|
|
|
602
737
|
//#endregion
|
|
603
|
-
//#region \0@oxc-project+runtime@0.
|
|
738
|
+
//#region \0@oxc-project+runtime@0.95.0/helpers/objectSpread2.js
|
|
604
739
|
function ownKeys(e, r) {
|
|
605
740
|
var t = Object.keys(e);
|
|
606
741
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -624,7 +759,7 @@ function _objectSpread2(e) {
|
|
|
624
759
|
}
|
|
625
760
|
|
|
626
761
|
//#endregion
|
|
627
|
-
//#region \0@oxc-project+runtime@0.
|
|
762
|
+
//#region \0@oxc-project+runtime@0.95.0/helpers/objectWithoutPropertiesLoose.js
|
|
628
763
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
629
764
|
if (null == r) return {};
|
|
630
765
|
var t = {};
|
|
@@ -636,7 +771,7 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
636
771
|
}
|
|
637
772
|
|
|
638
773
|
//#endregion
|
|
639
|
-
//#region \0@oxc-project+runtime@0.
|
|
774
|
+
//#region \0@oxc-project+runtime@0.95.0/helpers/objectWithoutProperties.js
|
|
640
775
|
function _objectWithoutProperties(e, t) {
|
|
641
776
|
if (null == e) return {};
|
|
642
777
|
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
@@ -720,7 +855,7 @@ function convertQuery(query) {
|
|
|
720
855
|
//#endregion
|
|
721
856
|
//#region src/utils/defaultValidator.ts
|
|
722
857
|
/**
|
|
723
|
-
* This is an example validation function you can pass to {@link QueryBuilder} in the
|
|
858
|
+
* This is an example validation function you can pass to {@link react-querybuilder!QueryBuilder QueryBuilder} in the
|
|
724
859
|
* `validator` prop. It assumes that you want to validate groups, and has a no-op
|
|
725
860
|
* for validating rules which you can replace with your own implementation.
|
|
726
861
|
*/
|
|
@@ -754,6 +889,21 @@ const defaultValidator = (query) => {
|
|
|
754
889
|
return result;
|
|
755
890
|
};
|
|
756
891
|
|
|
892
|
+
//#endregion
|
|
893
|
+
//#region src/utils/objectUtils.ts
|
|
894
|
+
/**
|
|
895
|
+
* A strongly-typed version of `Object.keys()`.
|
|
896
|
+
*
|
|
897
|
+
* [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-keys.ts)
|
|
898
|
+
*/
|
|
899
|
+
const objectKeys = Object.keys;
|
|
900
|
+
/**
|
|
901
|
+
* A strongly-typed version of `Object.entries()`.
|
|
902
|
+
*
|
|
903
|
+
* [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-entries.ts)
|
|
904
|
+
*/
|
|
905
|
+
const objectEntries = Object.entries;
|
|
906
|
+
|
|
757
907
|
//#endregion
|
|
758
908
|
//#region src/utils/optGroupUtils.ts
|
|
759
909
|
const isOptionWithName = (opt) => isPojo(opt) && "name" in opt && typeof opt.name === "string";
|
|
@@ -941,6 +1091,44 @@ const uniqOptList = (originalArray) => {
|
|
|
941
1091
|
if (isFlexibleOptionGroupArray(originalArray)) return uniqOptGroups(originalArray);
|
|
942
1092
|
return uniqByIdentifier(originalArray.map((o) => toFullOption(o)));
|
|
943
1093
|
};
|
|
1094
|
+
const prepareOptionList = (props) => {
|
|
1095
|
+
// istanbul ignore next
|
|
1096
|
+
const { optionList: optionListPropOriginal, baseOption = {}, labelMap = {}, placeholder: { placeholderName = defaultPlaceholderName, placeholderLabel = defaultPlaceholderLabel, placeholderGroupLabel = defaultPlaceholderLabel } = {}, autoSelectOption = true } = props;
|
|
1097
|
+
const defaultOption = {
|
|
1098
|
+
id: placeholderName,
|
|
1099
|
+
name: placeholderName,
|
|
1100
|
+
value: placeholderName,
|
|
1101
|
+
label: placeholderLabel
|
|
1102
|
+
};
|
|
1103
|
+
const optionsProp = optionListPropOriginal !== null && optionListPropOriginal !== void 0 ? optionListPropOriginal : [defaultOption];
|
|
1104
|
+
let optionList = [];
|
|
1105
|
+
const opts = Array.isArray(optionsProp) ? toFullOptionList(optionsProp, baseOption, labelMap) : objectKeys(toFullOptionMap(optionsProp, baseOption)).map((opt) => _objectSpread2(_objectSpread2({}, optionsProp[opt]), {}, {
|
|
1106
|
+
name: opt,
|
|
1107
|
+
value: opt
|
|
1108
|
+
})).sort((a, b) => a.label.localeCompare(b.label));
|
|
1109
|
+
if (isFlexibleOptionGroupArray(opts)) optionList = autoSelectOption ? uniqOptGroups(opts) : uniqOptGroups([{
|
|
1110
|
+
label: placeholderGroupLabel,
|
|
1111
|
+
options: [defaultOption]
|
|
1112
|
+
}, ...opts]);
|
|
1113
|
+
else optionList = autoSelectOption ? uniqByIdentifier(opts) : uniqByIdentifier([defaultOption, ...opts]);
|
|
1114
|
+
let optionsMap = {};
|
|
1115
|
+
if (!Array.isArray(optionsProp)) {
|
|
1116
|
+
const op = toFullOptionMap(optionsProp, baseOption);
|
|
1117
|
+
optionsMap = autoSelectOption ? op : _objectSpread2(_objectSpread2({}, op), {}, { [placeholderName]: defaultOption });
|
|
1118
|
+
} else if (isFlexibleOptionGroupArray(optionList)) for (const og of optionList) for (const opt of og.options) {
|
|
1119
|
+
var _opt$value3;
|
|
1120
|
+
optionsMap[(_opt$value3 = opt.value) !== null && _opt$value3 !== void 0 ? _opt$value3 : opt.name] = toFullOption(opt, baseOption);
|
|
1121
|
+
}
|
|
1122
|
+
else for (const opt of optionList) {
|
|
1123
|
+
var _opt$value4;
|
|
1124
|
+
optionsMap[(_opt$value4 = opt.value) !== null && _opt$value4 !== void 0 ? _opt$value4 : opt.name] = toFullOption(opt, baseOption);
|
|
1125
|
+
}
|
|
1126
|
+
return {
|
|
1127
|
+
defaultOption,
|
|
1128
|
+
optionList,
|
|
1129
|
+
optionsMap
|
|
1130
|
+
};
|
|
1131
|
+
};
|
|
944
1132
|
|
|
945
1133
|
//#endregion
|
|
946
1134
|
//#region src/utils/filterFieldsByComparator.ts
|
|
@@ -1030,9 +1218,11 @@ function transformQuery(query, options = {}) {
|
|
|
1030
1218
|
const isValidationResult = (vr) => isPojo(vr) && typeof vr.valid === "boolean";
|
|
1031
1219
|
/**
|
|
1032
1220
|
* Determines if a rule or group is valid based on a validation result (if defined)
|
|
1033
|
-
* or a validator function. Returns `true` if neither are defined
|
|
1221
|
+
* or a validator function. Returns `true` if neither are defined and the `muted`
|
|
1222
|
+
* property is not `true`.
|
|
1034
1223
|
*/
|
|
1035
1224
|
const isRuleOrGroupValid = (rg, validationResult, validator) => {
|
|
1225
|
+
if (rg.muted) return false;
|
|
1036
1226
|
if (typeof validationResult === "boolean") return validationResult;
|
|
1037
1227
|
if (isValidationResult(validationResult)) return validationResult.valid;
|
|
1038
1228
|
if (typeof validator === "function" && !isRuleGroup(rg)) {
|
|
@@ -1302,19 +1492,45 @@ const defaultRuleGroupProcessorCEL = (ruleGroup, options) => {
|
|
|
1302
1492
|
const processRuleGroup = (rg, outermost) => {
|
|
1303
1493
|
var _rg$id;
|
|
1304
1494
|
if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermost ? fallbackExpression : "";
|
|
1305
|
-
const
|
|
1495
|
+
const processedRules = [];
|
|
1496
|
+
let precedingCombinator = "";
|
|
1497
|
+
let firstRule = true;
|
|
1498
|
+
for (const rule of rg.rules) {
|
|
1306
1499
|
var _rule$valueSource;
|
|
1307
|
-
if (typeof rule === "string")
|
|
1308
|
-
|
|
1500
|
+
if (typeof rule === "string") {
|
|
1501
|
+
precedingCombinator = celCombinatorMap[rule];
|
|
1502
|
+
continue;
|
|
1503
|
+
}
|
|
1504
|
+
if (isRuleGroup(rule)) {
|
|
1505
|
+
const processedGroup = processRuleGroup(rule);
|
|
1506
|
+
if (processedGroup) {
|
|
1507
|
+
if (!firstRule && precedingCombinator) {
|
|
1508
|
+
processedRules.push(precedingCombinator);
|
|
1509
|
+
precedingCombinator = "";
|
|
1510
|
+
}
|
|
1511
|
+
firstRule = false;
|
|
1512
|
+
processedRules.push(processedGroup);
|
|
1513
|
+
}
|
|
1514
|
+
continue;
|
|
1515
|
+
}
|
|
1309
1516
|
const [validationResult, fieldValidator] = validateRule(rule);
|
|
1310
|
-
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName)
|
|
1517
|
+
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName) continue;
|
|
1311
1518
|
const fieldData = getOption(fields, rule.field);
|
|
1312
|
-
|
|
1519
|
+
const processedRule = ruleProcessor(rule, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
1313
1520
|
parseNumbers: getParseNumberBoolean(fieldData === null || fieldData === void 0 ? void 0 : fieldData.inputType),
|
|
1314
1521
|
escapeQuotes: ((_rule$valueSource = rule.valueSource) !== null && _rule$valueSource !== void 0 ? _rule$valueSource : "value") === "value",
|
|
1315
1522
|
fieldData
|
|
1316
1523
|
}));
|
|
1317
|
-
|
|
1524
|
+
if (processedRule) {
|
|
1525
|
+
if (!firstRule && precedingCombinator) {
|
|
1526
|
+
processedRules.push(precedingCombinator);
|
|
1527
|
+
precedingCombinator = "";
|
|
1528
|
+
}
|
|
1529
|
+
firstRule = false;
|
|
1530
|
+
processedRules.push(processedRule);
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
const expression = processedRules.join(isRuleGroupType(rg) ? ` ${celCombinatorMap[rg.combinator]} ` : " ");
|
|
1318
1534
|
const [prefix, suffix] = rg.not || !outermost ? [`${rg.not ? "!" : ""}(`, ")"] : ["", ""];
|
|
1319
1535
|
return expression ? `${prefix}${expression}${suffix}` : fallbackExpression;
|
|
1320
1536
|
};
|
|
@@ -1341,8 +1557,7 @@ const defaultRuleProcessorCEL = (rule, opts = {}) => {
|
|
|
1341
1557
|
else if (matchEval) {
|
|
1342
1558
|
const { mode, threshold } = matchEval;
|
|
1343
1559
|
const arrayElementAlias = "elem_alias";
|
|
1344
|
-
const
|
|
1345
|
-
const nestedArrayFilter = defaultRuleGroupProcessorCEL(celQuery, opts);
|
|
1560
|
+
const nestedArrayFilter = defaultRuleGroupProcessorCEL(transformQuery(rule.value, { ruleProcessor: (r) => _objectSpread2(_objectSpread2({}, r), {}, { field: `${arrayElementAlias}${r.field ? `.${r.field}` : ""}` }) }), opts);
|
|
1346
1561
|
switch (mode) {
|
|
1347
1562
|
case "all": return `${field}.all(${arrayElementAlias}, ${nestedArrayFilter})`;
|
|
1348
1563
|
case "none":
|
|
@@ -1376,8 +1591,7 @@ const defaultRuleProcessorCEL = (rule, opts = {}) => {
|
|
|
1376
1591
|
case "in":
|
|
1377
1592
|
case "notin": {
|
|
1378
1593
|
const [prefix, suffix] = shouldNegate$2(operatorTL) ? ["!(", ")"] : ["", ""];
|
|
1379
|
-
|
|
1380
|
-
return `${prefix}${field} in [${valueAsArray.map((val) => valueIsField || shouldRenderAsNumber(val, parseNumbers) ? `${trimIfString(val)}` : `"${escapeDoubleQuotes(val, escapeQuotes)}"`).join(", ")}]${suffix}`;
|
|
1594
|
+
return `${prefix}${field} in [${toArray(value).map((val) => valueIsField || shouldRenderAsNumber(val, parseNumbers) ? `${trimIfString(val)}` : `"${escapeDoubleQuotes(val, escapeQuotes)}"`).join(", ")}]${suffix}`;
|
|
1381
1595
|
}
|
|
1382
1596
|
case "between":
|
|
1383
1597
|
case "notbetween": {
|
|
@@ -1584,19 +1798,45 @@ const defaultRuleGroupProcessorSpEL = (ruleGroup, options) => {
|
|
|
1584
1798
|
const processRuleGroup = (rg, outermost) => {
|
|
1585
1799
|
var _rg$id;
|
|
1586
1800
|
if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermost ? fallbackExpression : "";
|
|
1587
|
-
const
|
|
1801
|
+
const processedRules = [];
|
|
1802
|
+
let precedingCombinator = "";
|
|
1803
|
+
let firstRule = true;
|
|
1804
|
+
for (const rule of rg.rules) {
|
|
1588
1805
|
var _rule$valueSource;
|
|
1589
|
-
if (typeof rule === "string")
|
|
1590
|
-
|
|
1806
|
+
if (typeof rule === "string") {
|
|
1807
|
+
precedingCombinator = rule;
|
|
1808
|
+
continue;
|
|
1809
|
+
}
|
|
1810
|
+
if (isRuleGroup(rule)) {
|
|
1811
|
+
const processedGroup = processRuleGroup(rule);
|
|
1812
|
+
if (processedGroup) {
|
|
1813
|
+
if (!firstRule && precedingCombinator) {
|
|
1814
|
+
processedRules.push(precedingCombinator);
|
|
1815
|
+
precedingCombinator = "";
|
|
1816
|
+
}
|
|
1817
|
+
firstRule = false;
|
|
1818
|
+
processedRules.push(processedGroup);
|
|
1819
|
+
}
|
|
1820
|
+
continue;
|
|
1821
|
+
}
|
|
1591
1822
|
const [validationResult, fieldValidator] = validateRule(rule);
|
|
1592
|
-
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName)
|
|
1823
|
+
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName) continue;
|
|
1593
1824
|
const fieldData = getOption(fields, rule.field);
|
|
1594
|
-
|
|
1825
|
+
const processedRule = ruleProcessor(rule, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
1595
1826
|
parseNumbers: getParseNumberBoolean(fieldData === null || fieldData === void 0 ? void 0 : fieldData.inputType),
|
|
1596
1827
|
escapeQuotes: ((_rule$valueSource = rule.valueSource) !== null && _rule$valueSource !== void 0 ? _rule$valueSource : "value") === "value",
|
|
1597
1828
|
fieldData
|
|
1598
1829
|
}));
|
|
1599
|
-
|
|
1830
|
+
if (processedRule) {
|
|
1831
|
+
if (!firstRule && precedingCombinator) {
|
|
1832
|
+
processedRules.push(precedingCombinator);
|
|
1833
|
+
precedingCombinator = "";
|
|
1834
|
+
}
|
|
1835
|
+
firstRule = false;
|
|
1836
|
+
processedRules.push(processedRule);
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
const expression = processedRules.join(isRuleGroupType(rg) ? ` ${rg.combinator} ` : " ");
|
|
1600
1840
|
const [prefix, suffix] = rg.not || !outermost ? [`${rg.not ? "!" : ""}(`, ")"] : ["", ""];
|
|
1601
1841
|
return expression ? `${prefix}${expression}${suffix}` : fallbackExpression;
|
|
1602
1842
|
};
|
|
@@ -1649,15 +1889,9 @@ const defaultRuleProcessorSpEL = (rule, opts = {}) => {
|
|
|
1649
1889
|
case "contains":
|
|
1650
1890
|
case "doesnotcontain": return wrapInNegation(`${field} matches ${valueIsField || useBareValue ? trimIfString(value) : `'${escapeSingleQuotes(value, escapeQuotes)}'`}`, shouldNegate$1(operatorTL));
|
|
1651
1891
|
case "beginswith":
|
|
1652
|
-
case "doesnotbeginwith": {
|
|
1653
|
-
const valueTL = valueIsField ? `'^'.concat(${trimIfString(value)})` : `'${typeof value === "string" && !value.startsWith("^") || useBareValue ? "^" : ""}${escapeSingleQuotes(value, escapeQuotes)}'`;
|
|
1654
|
-
return wrapInNegation(`${field} matches ${valueTL}`, shouldNegate$1(operatorTL));
|
|
1655
|
-
}
|
|
1892
|
+
case "doesnotbeginwith": return wrapInNegation(`${field} matches ${valueIsField ? `'^'.concat(${trimIfString(value)})` : `'${typeof value === "string" && !value.startsWith("^") || useBareValue ? "^" : ""}${escapeSingleQuotes(value, escapeQuotes)}'`}`, shouldNegate$1(operatorTL));
|
|
1656
1893
|
case "endswith":
|
|
1657
|
-
case "doesnotendwith": {
|
|
1658
|
-
const valueTL = valueIsField ? `${trimIfString(value)}.concat('$')` : `'${escapeSingleQuotes(value, escapeQuotes)}${typeof value === "string" && !value.endsWith("$") || useBareValue ? "$" : ""}'`;
|
|
1659
|
-
return wrapInNegation(`${field} matches ${valueTL}`, shouldNegate$1(operatorTL));
|
|
1660
|
-
}
|
|
1894
|
+
case "doesnotendwith": return wrapInNegation(`${field} matches ${valueIsField ? `${trimIfString(value)}.concat('$')` : `'${escapeSingleQuotes(value, escapeQuotes)}${typeof value === "string" && !value.endsWith("$") || useBareValue ? "$" : ""}'`}`, shouldNegate$1(operatorTL));
|
|
1661
1895
|
case "null": return `${field} == null`;
|
|
1662
1896
|
case "notnull": return `${field} != null`;
|
|
1663
1897
|
case "in":
|
|
@@ -1771,8 +2005,7 @@ const defaultRuleProcessorDrizzle = (rule, _options) => {
|
|
|
1771
2005
|
if (opts.preset !== "postgresql") return;
|
|
1772
2006
|
const { mode, threshold } = matchEval;
|
|
1773
2007
|
const arrayElementAlias = "elem_alias";
|
|
1774
|
-
const
|
|
1775
|
-
const nestedArrayFilter = defaultRuleGroupProcessorDrizzle(sqlQuery, _objectSpread2(_objectSpread2({}, opts), {}, { context: _objectSpread2(_objectSpread2({}, opts.context), {}, { useRawFields: true }) }));
|
|
2008
|
+
const nestedArrayFilter = defaultRuleGroupProcessorDrizzle(transformQuery(rule.value, { ruleProcessor: (r) => _objectSpread2(_objectSpread2({}, r), {}, { field: arrayElementAlias }) }), _objectSpread2(_objectSpread2({}, opts), {}, { context: _objectSpread2(_objectSpread2({}, opts.context), {}, { useRawFields: true }) }));
|
|
1776
2009
|
switch (mode) {
|
|
1777
2010
|
case "all": return sql`(select count(*) from unnest(${column}) as ${sql.raw(arrayElementAlias)} where ${nestedArrayFilter({}, drizzleOperators)}) = array_length(${column}, 1)`;
|
|
1778
2011
|
case "none": return sql`not exists (select 1 from unnest(${column}) as ${sql.raw(arrayElementAlias)} where ${nestedArrayFilter({}, drizzleOperators)})`;
|
|
@@ -1852,7 +2085,6 @@ const defaultRuleGroupProcessorDrizzle = (ruleGroup, options, _meta) => (columns
|
|
|
1852
2085
|
const { fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, validateRule, validationMap } = options;
|
|
1853
2086
|
if (!columns || !drizzleOperators) return;
|
|
1854
2087
|
const { and, not, or } = drizzleOperators;
|
|
1855
|
-
const query = isRuleGroupType(ruleGroup) ? ruleGroup : convertFromIC(ruleGroup);
|
|
1856
2088
|
const ruleProcessor = defaultRuleProcessorDrizzle;
|
|
1857
2089
|
const processRuleGroup = (rg, _outermost) => {
|
|
1858
2090
|
var _rg$id;
|
|
@@ -1875,7 +2107,7 @@ const defaultRuleGroupProcessorDrizzle = (ruleGroup, options, _meta) => (columns
|
|
|
1875
2107
|
const ruleGroupSQL = rg.combinator === "or" ? or(...processedRules) : and(...processedRules);
|
|
1876
2108
|
return rg.not ? not(ruleGroupSQL) : ruleGroupSQL;
|
|
1877
2109
|
};
|
|
1878
|
-
return processRuleGroup(
|
|
2110
|
+
return processRuleGroup(convertFromIC(ruleGroup), true);
|
|
1879
2111
|
};
|
|
1880
2112
|
|
|
1881
2113
|
//#endregion
|
|
@@ -1887,7 +2119,6 @@ const defaultRuleGroupProcessorDrizzle = (ruleGroup, options, _meta) => (columns
|
|
|
1887
2119
|
*/
|
|
1888
2120
|
const defaultRuleGroupProcessorElasticSearch = (ruleGroup, options) => {
|
|
1889
2121
|
const { fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
|
|
1890
|
-
const query = convertFromIC(ruleGroup);
|
|
1891
2122
|
const processRuleGroup = (rg) => {
|
|
1892
2123
|
var _rg$id;
|
|
1893
2124
|
if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return false;
|
|
@@ -1904,7 +2135,7 @@ const defaultRuleGroupProcessorElasticSearch = (ruleGroup, options) => {
|
|
|
1904
2135
|
if (processedRules.length === 0) return false;
|
|
1905
2136
|
return { bool: rg.not ? { must_not: /^or$/i.test(rg.combinator) ? { bool: { should: processedRules } } : processedRules } : { [/^or$/i.test(rg.combinator) ? "should" : "must"]: processedRules } };
|
|
1906
2137
|
};
|
|
1907
|
-
const processedRuleGroup = processRuleGroup(
|
|
2138
|
+
const processedRuleGroup = processRuleGroup(convertFromIC(ruleGroup));
|
|
1908
2139
|
return processedRuleGroup === false ? {} : processedRuleGroup;
|
|
1909
2140
|
};
|
|
1910
2141
|
|
|
@@ -1920,19 +2151,45 @@ const defaultRuleGroupProcessorJSONata = (ruleGroup, options) => {
|
|
|
1920
2151
|
const processRuleGroup = (rg, outermost) => {
|
|
1921
2152
|
var _rg$id;
|
|
1922
2153
|
if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermost ? fallbackExpression : "";
|
|
1923
|
-
const
|
|
2154
|
+
const processedRules = [];
|
|
2155
|
+
let precedingCombinator = "";
|
|
2156
|
+
let firstRule = true;
|
|
2157
|
+
for (const rule of rg.rules) {
|
|
1924
2158
|
var _rule$valueSource;
|
|
1925
|
-
if (typeof rule === "string")
|
|
1926
|
-
|
|
2159
|
+
if (typeof rule === "string") {
|
|
2160
|
+
precedingCombinator = rule;
|
|
2161
|
+
continue;
|
|
2162
|
+
}
|
|
2163
|
+
if (isRuleGroup(rule)) {
|
|
2164
|
+
const processedGroup = processRuleGroup(rule);
|
|
2165
|
+
if (processedGroup) {
|
|
2166
|
+
if (!firstRule && precedingCombinator) {
|
|
2167
|
+
processedRules.push(precedingCombinator);
|
|
2168
|
+
precedingCombinator = "";
|
|
2169
|
+
}
|
|
2170
|
+
firstRule = false;
|
|
2171
|
+
processedRules.push(processedGroup);
|
|
2172
|
+
}
|
|
2173
|
+
continue;
|
|
2174
|
+
}
|
|
1927
2175
|
const [validationResult, fieldValidator] = validateRule(rule);
|
|
1928
|
-
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName)
|
|
2176
|
+
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName) continue;
|
|
1929
2177
|
const fieldData = getOption(fields, rule.field);
|
|
1930
|
-
|
|
2178
|
+
const processedRule = ruleProcessor(rule, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
1931
2179
|
parseNumbers: getParseNumberBoolean(fieldData === null || fieldData === void 0 ? void 0 : fieldData.inputType),
|
|
1932
2180
|
escapeQuotes: ((_rule$valueSource = rule.valueSource) !== null && _rule$valueSource !== void 0 ? _rule$valueSource : "value") === "value",
|
|
1933
2181
|
fieldData
|
|
1934
2182
|
}));
|
|
1935
|
-
|
|
2183
|
+
if (processedRule) {
|
|
2184
|
+
if (!firstRule && precedingCombinator) {
|
|
2185
|
+
processedRules.push(precedingCombinator);
|
|
2186
|
+
precedingCombinator = "";
|
|
2187
|
+
}
|
|
2188
|
+
firstRule = false;
|
|
2189
|
+
processedRules.push(processedRule);
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
const expression = processedRules.join(isRuleGroupType(rg) ? ` ${rg.combinator} ` : " ");
|
|
1936
2193
|
const [prefix, suffix] = rg.not || !outermost ? [`${rg.not ? "$not" : ""}(`, ")"] : ["", ""];
|
|
1937
2194
|
return expression ? `${prefix}${expression}${suffix}` : fallbackExpression;
|
|
1938
2195
|
};
|
|
@@ -1978,7 +2235,6 @@ const defaultRuleGroupProcessorJsonLogic = (ruleGroup, options) => {
|
|
|
1978
2235
|
*/
|
|
1979
2236
|
const defaultRuleGroupProcessorLDAP = (ruleGroup, options) => {
|
|
1980
2237
|
const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
|
|
1981
|
-
const query = convertFromIC(ruleGroup);
|
|
1982
2238
|
const processRuleGroup = (rg, outermost) => {
|
|
1983
2239
|
var _rg$id;
|
|
1984
2240
|
if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermost ? fallbackExpression : "";
|
|
@@ -1999,7 +2255,7 @@ const defaultRuleGroupProcessorLDAP = (ruleGroup, options) => {
|
|
|
1999
2255
|
const [prefix, suffix] = rules.length > 1 ? [`${notPrefix}(${rg.combinator === "or" ? "|" : "&"}`, `)${notSuffix}`] : [notPrefix, notSuffix];
|
|
2000
2256
|
return expression ? `${prefix}${expression}${suffix}` : fallbackExpression;
|
|
2001
2257
|
};
|
|
2002
|
-
return processRuleGroup(
|
|
2258
|
+
return processRuleGroup(convertFromIC(ruleGroup), true);
|
|
2003
2259
|
};
|
|
2004
2260
|
|
|
2005
2261
|
//#endregion
|
|
@@ -2055,26 +2311,48 @@ const defaultRuleGroupProcessorNL = (ruleGroup, options) => {
|
|
|
2055
2311
|
var _rg$id, _rg2$combinator2, _translations2;
|
|
2056
2312
|
if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
|
|
2057
2313
|
const rg2 = isRuleGroupTypeIC(rg) && rg.rules.some((r) => typeof r === "string" && lc(r) === "xor") ? convertFromIC(rg) : rg;
|
|
2058
|
-
const processedRules =
|
|
2314
|
+
const processedRules = [];
|
|
2315
|
+
let precedingCombinator = "";
|
|
2316
|
+
let firstRule = true;
|
|
2317
|
+
for (const rule of rg2.rules) {
|
|
2059
2318
|
var _rule$valueSource;
|
|
2060
2319
|
if (typeof rule === "string") {
|
|
2061
2320
|
var _translations;
|
|
2062
|
-
|
|
2321
|
+
precedingCombinator = `, ${(_translations = translations[rule]) !== null && _translations !== void 0 ? _translations : rule} `;
|
|
2322
|
+
continue;
|
|
2063
2323
|
}
|
|
2064
2324
|
if (isRuleGroup(rule)) {
|
|
2065
2325
|
var _rg2$combinator;
|
|
2066
|
-
|
|
2326
|
+
const processedGroup = processRuleGroup(rule, rg2.rules.length === 1 && !(rg2.not || /^xor$/i.test((_rg2$combinator = rg2.combinator) !== null && _rg2$combinator !== void 0 ? _rg2$combinator : "")));
|
|
2327
|
+
// istanbul ignore else
|
|
2328
|
+
if (processedGroup) {
|
|
2329
|
+
if (!firstRule && precedingCombinator) {
|
|
2330
|
+
processedRules.push(precedingCombinator);
|
|
2331
|
+
precedingCombinator = "";
|
|
2332
|
+
}
|
|
2333
|
+
firstRule = false;
|
|
2334
|
+
processedRules.push(processedGroup);
|
|
2335
|
+
}
|
|
2336
|
+
continue;
|
|
2067
2337
|
}
|
|
2068
2338
|
const [validationResult, fieldValidator] = validateRule(rule);
|
|
2069
|
-
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName)
|
|
2339
|
+
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName) continue;
|
|
2070
2340
|
const escapeQuotes = ((_rule$valueSource = rule.valueSource) !== null && _rule$valueSource !== void 0 ? _rule$valueSource : "value") === "value";
|
|
2071
2341
|
const fieldData = getOption(fields, rule.field);
|
|
2072
|
-
|
|
2342
|
+
const processedRule = ruleProcessor(rule, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
2073
2343
|
parseNumbers: getParseNumberBoolean(fieldData === null || fieldData === void 0 ? void 0 : fieldData.inputType),
|
|
2074
2344
|
escapeQuotes,
|
|
2075
2345
|
fieldData
|
|
2076
2346
|
}));
|
|
2077
|
-
|
|
2347
|
+
if (processedRule) {
|
|
2348
|
+
if (!firstRule && precedingCombinator) {
|
|
2349
|
+
processedRules.push(precedingCombinator);
|
|
2350
|
+
precedingCombinator = "";
|
|
2351
|
+
}
|
|
2352
|
+
firstRule = false;
|
|
2353
|
+
processedRules.push(processedRule);
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2078
2356
|
if (processedRules.length === 0) return fallbackExpression;
|
|
2079
2357
|
const isXOR = lc((_rg2$combinator2 = rg2.combinator) !== null && _rg2$combinator2 !== void 0 ? _rg2$combinator2 : "") === "xor";
|
|
2080
2358
|
const combinator = isXOR ? rg2.combinator.slice(1) : rg2.combinator;
|
|
@@ -2082,7 +2360,7 @@ const defaultRuleGroupProcessorNL = (ruleGroup, options) => {
|
|
|
2082
2360
|
const [prefixTL, suffixTL] = ["groupPrefix", "groupSuffix"].map((key) => rg2.not ? isXOR ? getNLTranslataion(key, translations, ["not", "xor"]) : getNLTranslataion(key, translations, ["not"]) : isXOR ? getNLTranslataion(key, translations, ["xor"]) : getNLTranslataion(key, translations));
|
|
2083
2361
|
const prefix = mustWrap ? `${prefixTL} (`.trim() : "";
|
|
2084
2362
|
const suffix = mustWrap ? `) ${suffixTL}`.trim() : "";
|
|
2085
|
-
return `${prefix}${processedRules.
|
|
2363
|
+
return `${prefix}${processedRules.join(isRuleGroupType(rg2) ? `, ${(_translations2 = translations[combinator]) !== null && _translations2 !== void 0 ? _translations2 : combinator} ` : "")}${suffix}`;
|
|
2086
2364
|
};
|
|
2087
2365
|
return processRuleGroup(ruleGroup, true);
|
|
2088
2366
|
};
|
|
@@ -2133,11 +2411,37 @@ const defaultRuleGroupProcessorParameterized = (ruleGroup, options) => {
|
|
|
2133
2411
|
const processRuleGroup = (rg, outermostOrLonelyInGroup) => {
|
|
2134
2412
|
var _rg$id;
|
|
2135
2413
|
if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
|
|
2136
|
-
const processedRules =
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2414
|
+
const processedRules = [];
|
|
2415
|
+
let precedingCombinator = "";
|
|
2416
|
+
let firstRule = true;
|
|
2417
|
+
for (const rule of rg.rules) {
|
|
2418
|
+
if (typeof rule === "string") {
|
|
2419
|
+
precedingCombinator = rule;
|
|
2420
|
+
continue;
|
|
2421
|
+
}
|
|
2422
|
+
if (isRuleGroup(rule)) {
|
|
2423
|
+
const processedGroup = processRuleGroup(rule, rg.rules.length === 1);
|
|
2424
|
+
// istanbul ignore else
|
|
2425
|
+
if (processedGroup) {
|
|
2426
|
+
if (!firstRule && precedingCombinator) {
|
|
2427
|
+
processedRules.push(precedingCombinator);
|
|
2428
|
+
precedingCombinator = "";
|
|
2429
|
+
}
|
|
2430
|
+
firstRule = false;
|
|
2431
|
+
processedRules.push(processedGroup);
|
|
2432
|
+
}
|
|
2433
|
+
continue;
|
|
2434
|
+
}
|
|
2435
|
+
const processedRule = processRule(rule);
|
|
2436
|
+
if (processedRule) {
|
|
2437
|
+
if (!firstRule && precedingCombinator) {
|
|
2438
|
+
processedRules.push(precedingCombinator);
|
|
2439
|
+
precedingCombinator = "";
|
|
2440
|
+
}
|
|
2441
|
+
firstRule = false;
|
|
2442
|
+
processedRules.push(processedRule);
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2141
2445
|
if (processedRules.length === 0) return fallbackExpression;
|
|
2142
2446
|
return `${rg.not ? "NOT " : ""}(${processedRules.join(isRuleGroupType(rg) ? ` ${rg.combinator} ` : " ")})`;
|
|
2143
2447
|
};
|
|
@@ -2247,20 +2551,46 @@ const defaultRuleGroupProcessorSQL = (ruleGroup, options) => {
|
|
|
2247
2551
|
const processRuleGroup = (rg, outermostOrLonelyInGroup) => {
|
|
2248
2552
|
var _rg$id;
|
|
2249
2553
|
if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
|
|
2250
|
-
const processedRules =
|
|
2554
|
+
const processedRules = [];
|
|
2555
|
+
let precedingCombinator = "";
|
|
2556
|
+
let firstRule = true;
|
|
2557
|
+
for (const rule of rg.rules) {
|
|
2251
2558
|
var _rule$valueSource;
|
|
2252
|
-
if (typeof rule === "string")
|
|
2253
|
-
|
|
2559
|
+
if (typeof rule === "string") {
|
|
2560
|
+
precedingCombinator = rule;
|
|
2561
|
+
continue;
|
|
2562
|
+
}
|
|
2563
|
+
if (isRuleGroup(rule)) {
|
|
2564
|
+
const processedGroup = processRuleGroup(rule, rg.rules.length === 1);
|
|
2565
|
+
// istanbul ignore else
|
|
2566
|
+
if (processedGroup) {
|
|
2567
|
+
if (!firstRule && precedingCombinator) {
|
|
2568
|
+
processedRules.push(precedingCombinator);
|
|
2569
|
+
precedingCombinator = "";
|
|
2570
|
+
}
|
|
2571
|
+
firstRule = false;
|
|
2572
|
+
processedRules.push(processedGroup);
|
|
2573
|
+
}
|
|
2574
|
+
continue;
|
|
2575
|
+
}
|
|
2254
2576
|
const [validationResult, fieldValidator] = validateRule(rule);
|
|
2255
|
-
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName)
|
|
2577
|
+
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName) continue;
|
|
2256
2578
|
const escapeQuotes = ((_rule$valueSource = rule.valueSource) !== null && _rule$valueSource !== void 0 ? _rule$valueSource : "value") === "value";
|
|
2257
2579
|
const fieldData = getOption(fields, rule.field);
|
|
2258
|
-
|
|
2580
|
+
const processedRule = ruleProcessor(rule, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
2259
2581
|
parseNumbers: getParseNumberBoolean(fieldData === null || fieldData === void 0 ? void 0 : fieldData.inputType),
|
|
2260
2582
|
escapeQuotes,
|
|
2261
2583
|
fieldData
|
|
2262
2584
|
}));
|
|
2263
|
-
|
|
2585
|
+
if (processedRule) {
|
|
2586
|
+
if (!firstRule && precedingCombinator) {
|
|
2587
|
+
processedRules.push(precedingCombinator);
|
|
2588
|
+
precedingCombinator = "";
|
|
2589
|
+
}
|
|
2590
|
+
firstRule = false;
|
|
2591
|
+
processedRules.push(processedRule);
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2264
2594
|
if (processedRules.length === 0) return fallbackExpression;
|
|
2265
2595
|
return `${rg.not ? "NOT " : ""}(${processedRules.join(isRuleGroupType(rg) ? ` ${rg.combinator} ` : " ")})`;
|
|
2266
2596
|
};
|
|
@@ -2536,10 +2866,7 @@ const defaultRuleProcessorJsonLogic = (rule, options = {}) => {
|
|
|
2536
2866
|
case "null":
|
|
2537
2867
|
case "notnull": return { [`${operatorLC === "notnull" ? "!" : "="}=`]: [fieldObject, null] };
|
|
2538
2868
|
case "in":
|
|
2539
|
-
case "notin": {
|
|
2540
|
-
const valueAsArray = toArray(value).map((v) => fieldOrNumberRenderer(v));
|
|
2541
|
-
return negateIfNotOp(operatorLC, { in: [fieldObject, valueAsArray] });
|
|
2542
|
-
}
|
|
2869
|
+
case "notin": return negateIfNotOp(operatorLC, { in: [fieldObject, toArray(value).map((v) => fieldOrNumberRenderer(v))] });
|
|
2543
2870
|
case "between":
|
|
2544
2871
|
case "notbetween": {
|
|
2545
2872
|
const valueAsArray = toArray(value);
|
|
@@ -2570,20 +2897,11 @@ const defaultRuleProcessorJsonLogic = (rule, options = {}) => {
|
|
|
2570
2897
|
return false;
|
|
2571
2898
|
}
|
|
2572
2899
|
case "contains":
|
|
2573
|
-
case "doesnotcontain": {
|
|
2574
|
-
const jsonRule = { in: [fieldOrNumberRenderer(value), fieldObject] };
|
|
2575
|
-
return negateIfNotOp(operatorLC, jsonRule);
|
|
2576
|
-
}
|
|
2900
|
+
case "doesnotcontain": return negateIfNotOp(operatorLC, { in: [fieldOrNumberRenderer(value), fieldObject] });
|
|
2577
2901
|
case "beginswith":
|
|
2578
|
-
case "doesnotbeginwith": {
|
|
2579
|
-
const jsonRule = { startsWith: [fieldObject, fieldOrNumberRenderer(value)] };
|
|
2580
|
-
return negateIfNotOp(operatorLC, jsonRule);
|
|
2581
|
-
}
|
|
2902
|
+
case "doesnotbeginwith": return negateIfNotOp(operatorLC, { startsWith: [fieldObject, fieldOrNumberRenderer(value)] });
|
|
2582
2903
|
case "endswith":
|
|
2583
|
-
case "doesnotendwith": {
|
|
2584
|
-
const jsonRule = { endsWith: [fieldObject, fieldOrNumberRenderer(value)] };
|
|
2585
|
-
return negateIfNotOp(operatorLC, jsonRule);
|
|
2586
|
-
}
|
|
2904
|
+
case "doesnotendwith": return negateIfNotOp(operatorLC, { endsWith: [fieldObject, fieldOrNumberRenderer(value)] });
|
|
2587
2905
|
}
|
|
2588
2906
|
return false;
|
|
2589
2907
|
};
|
|
@@ -2618,10 +2936,7 @@ const defaultRuleProcessorLDAP = (rule, options = {}) => {
|
|
|
2618
2936
|
case "null":
|
|
2619
2937
|
case "notnull": return negateIf(`(${field}=*)`, operatorLC === "notnull");
|
|
2620
2938
|
case "in":
|
|
2621
|
-
case "notin": {
|
|
2622
|
-
const valueAsArray = toArray(value);
|
|
2623
|
-
return negateIf(`(|${valueAsArray.map((val) => `(${field}=${ldapEscape(val)})`).join("")})`, operatorLC === "notin");
|
|
2624
|
-
}
|
|
2939
|
+
case "notin": return negateIf(`(|${toArray(value).map((val) => `(${field}=${ldapEscape(val)})`).join("")})`, operatorLC === "notin");
|
|
2625
2940
|
case "between":
|
|
2626
2941
|
case "notbetween": {
|
|
2627
2942
|
const valueAsArray = toArray(value);
|
|
@@ -2792,10 +3107,9 @@ const defaultRuleProcessorNL = (rule, opts) => {
|
|
|
2792
3107
|
}));
|
|
2793
3108
|
const operatorLC = lc(operator);
|
|
2794
3109
|
if ((operatorLC === "in" || operatorLC === "notin" || operatorLC === "between" || operatorLC === "notbetween") && !value) return "";
|
|
2795
|
-
const processedOperator = operatorProcessor(rule, opts);
|
|
2796
3110
|
const wordOrderMap = {
|
|
2797
3111
|
S: processedField,
|
|
2798
|
-
V:
|
|
3112
|
+
V: operatorProcessor(rule, opts),
|
|
2799
3113
|
O: value
|
|
2800
3114
|
};
|
|
2801
3115
|
return normalizeConstituentWordOrder(wordOrder).map((term) => `${wordOrderMap[term]}`).join(" ").trim();
|
|
@@ -3560,6 +3874,30 @@ const getValueSourcesUtil = (fieldData, operator, getValueSources) => {
|
|
|
3560
3874
|
});
|
|
3561
3875
|
};
|
|
3562
3876
|
|
|
3877
|
+
//#endregion
|
|
3878
|
+
//#region src/utils/mergeAnyTranslations.ts
|
|
3879
|
+
/**
|
|
3880
|
+
* Merges any number of partial translations into a single definition.
|
|
3881
|
+
*/
|
|
3882
|
+
const mergeAnyTranslations = (base, ...otherTranslations) => produce(base, (draft) => {
|
|
3883
|
+
for (const translations of otherTranslations)
|
|
3884
|
+
// istanbul ignore else
|
|
3885
|
+
if (translations) for (const t of objectKeys(translations)) if (draft[t]) Object.assign(draft[t], translations[t]);
|
|
3886
|
+
else Object.assign(draft, { [t]: translations[t] });
|
|
3887
|
+
});
|
|
3888
|
+
const mergeAnyTranslation = (el, keyPropContextMap, defaults) => {
|
|
3889
|
+
const finalKeys = objectEntries(keyPropContextMap).map(([key, [pT, cT]]) => {
|
|
3890
|
+
var _ref, _defaults$el;
|
|
3891
|
+
return [key, (_ref = pT !== null && pT !== void 0 ? pT : cT) !== null && _ref !== void 0 ? _ref : defaults === null || defaults === void 0 || (_defaults$el = defaults[el]) === null || _defaults$el === void 0 ? void 0 : _defaults$el[key]];
|
|
3892
|
+
}).filter((k) => !!k[1]);
|
|
3893
|
+
if (finalKeys.length > 0 || defaults) {
|
|
3894
|
+
var _defaults$el2;
|
|
3895
|
+
const defaultProperties = (_defaults$el2 = defaults === null || defaults === void 0 ? void 0 : defaults[el]) !== null && _defaults$el2 !== void 0 ? _defaults$el2 : {};
|
|
3896
|
+
const finalObject = Object.assign({}, defaultProperties, Object.fromEntries(finalKeys));
|
|
3897
|
+
return { [el]: finalObject };
|
|
3898
|
+
}
|
|
3899
|
+
};
|
|
3900
|
+
|
|
3563
3901
|
//#endregion
|
|
3564
3902
|
//#region src/utils/mergeClassnames.ts
|
|
3565
3903
|
const joinClassnamesByName = (name, args) => clsx(args.map((c) => clsx(c === null || c === void 0 ? void 0 : c[name])));
|
|
@@ -3587,6 +3925,9 @@ const mergeClassnames = (...args) => ({
|
|
|
3587
3925
|
dragHandle: joinClassnamesByName("dragHandle", args),
|
|
3588
3926
|
lockRule: joinClassnamesByName("lockRule", args),
|
|
3589
3927
|
lockGroup: joinClassnamesByName("lockGroup", args),
|
|
3928
|
+
muteRule: joinClassnamesByName("muteRule", args),
|
|
3929
|
+
muteGroup: joinClassnamesByName("muteGroup", args),
|
|
3930
|
+
muted: joinClassnamesByName("muted", args),
|
|
3590
3931
|
valueSource: joinClassnamesByName("valueSource", args),
|
|
3591
3932
|
actionElement: joinClassnamesByName("actionElement", args),
|
|
3592
3933
|
valueSelector: joinClassnamesByName("valueSelector", args),
|
|
@@ -3607,19 +3948,27 @@ const mergeClassnames = (...args) => ({
|
|
|
3607
3948
|
});
|
|
3608
3949
|
|
|
3609
3950
|
//#endregion
|
|
3610
|
-
//#region src/utils/
|
|
3951
|
+
//#region src/utils/preferProp.ts
|
|
3952
|
+
const preferPropDefaultTrue = (prop, context) => prop === false ? false : prop ? true : !(context === false);
|
|
3953
|
+
const preferPropDefaultFalse = (prop, context) => prop ? true : prop === false ? false : !!context;
|
|
3611
3954
|
/**
|
|
3612
|
-
*
|
|
3613
|
-
*
|
|
3614
|
-
* [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-keys.ts)
|
|
3955
|
+
* For given default, prop, and context values, return the first provided of prop,
|
|
3956
|
+
* context, and default, in that order.
|
|
3615
3957
|
*/
|
|
3616
|
-
const
|
|
3958
|
+
const preferProp = (def, prop, context, doNotFinalize) => !doNotFinalize ? def ? preferPropDefaultTrue(prop, context) : preferPropDefaultFalse(prop, context) : prop !== null && prop !== void 0 ? prop : context;
|
|
3617
3959
|
/**
|
|
3618
|
-
*
|
|
3619
|
-
*
|
|
3620
|
-
* [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-entries.ts)
|
|
3960
|
+
* For given default, prop, and context values, return the first provided of prop,
|
|
3961
|
+
* context, and default, in that order.
|
|
3621
3962
|
*/
|
|
3622
|
-
const
|
|
3963
|
+
const preferAnyProp = (def, prop, context) => prop !== void 0 && prop != null ? prop : context !== void 0 && context != null ? context : def;
|
|
3964
|
+
/**
|
|
3965
|
+
* For a given set of defaults, props, and context values, return the first provided of prop,
|
|
3966
|
+
* context, and default—in that order—for each property in the defaults object.
|
|
3967
|
+
*/
|
|
3968
|
+
const preferFlagProps = (props = {}, contextVals = {}, finalize) => objectEntries(queryBuilderFlagDefaults).reduce((acc, [key, def]) => {
|
|
3969
|
+
acc[key] = preferProp(def, props[key], contextVals[key], !finalize);
|
|
3970
|
+
return acc;
|
|
3971
|
+
}, {});
|
|
3623
3972
|
|
|
3624
3973
|
//#endregion
|
|
3625
3974
|
//#region src/utils/prepareQueryObjects.ts
|
|
@@ -3722,12 +4071,11 @@ const update = (query, prop, value, pathOrID, { resetOnFieldChange = true, reset
|
|
|
3722
4071
|
resetValueSource = true;
|
|
3723
4072
|
resetValue = true;
|
|
3724
4073
|
}
|
|
3725
|
-
const
|
|
4074
|
+
const defaultValueSource = getFirstOption(getValueSourcesUtil({
|
|
3726
4075
|
name: ruleOrGroup.field,
|
|
3727
4076
|
value: ruleOrGroup.field,
|
|
3728
4077
|
label: ""
|
|
3729
|
-
}, ruleOrGroup.operator, getValueSources);
|
|
3730
|
-
const defaultValueSource = getFirstOption(valueSources);
|
|
4078
|
+
}, ruleOrGroup.operator, getValueSources));
|
|
3731
4079
|
if (resetValueSource && ruleOrGroup.valueSource && defaultValueSource !== ruleOrGroup.valueSource || prop === "valueSource" && value !== ruleOrGroup.valueSource) {
|
|
3732
4080
|
resetValue = !!ruleOrGroup.valueSource || !ruleOrGroup.valueSource && value !== defaultValueSource;
|
|
3733
4081
|
ruleOrGroup.valueSource = resetValueSource ? defaultValueSource : value;
|
|
@@ -3772,8 +4120,7 @@ const getNextPath = (query, currentPath, newPathOrShiftDirection) => {
|
|
|
3772
4120
|
return [...getParentPath(parentPath), parentPath.at(-1) + 1];
|
|
3773
4121
|
} else {
|
|
3774
4122
|
const evaluationPath = [...getParentPath(currentPath), currentPath.at(-1) + (ic ? 2 : 1)];
|
|
3775
|
-
|
|
3776
|
-
if (isRuleGroup(entityToEvaluate)) return [...evaluationPath, 0];
|
|
4123
|
+
if (isRuleGroup(findPath(evaluationPath, query))) return [...evaluationPath, 0];
|
|
3777
4124
|
else return [...getParentPath(currentPath), currentPath.at(-1) + (ic ? 3 : 2)];
|
|
3778
4125
|
}
|
|
3779
4126
|
return currentPath;
|
|
@@ -3807,8 +4154,7 @@ const move = (query, oldPathOrID, newPath, { clone = false, combinators = defaul
|
|
|
3807
4154
|
const newNewPath = [...nextPath];
|
|
3808
4155
|
const commonAncestorPath = getCommonAncestorPath(oldPath, nextPath);
|
|
3809
4156
|
if (!clone && oldPath.length === commonAncestorPath.length + 1 && nextPath[commonAncestorPath.length] > oldPath[commonAncestorPath.length]) newNewPath[commonAncestorPath.length] -= independentCombinators ? 2 : 1;
|
|
3810
|
-
const
|
|
3811
|
-
const parentToInsertInto = findPath(newNewParentPath, draft);
|
|
4157
|
+
const parentToInsertInto = findPath(getParentPath(newNewPath), draft);
|
|
3812
4158
|
const newIndex = newNewPath.at(-1);
|
|
3813
4159
|
/**
|
|
3814
4160
|
* This function 1) glosses over the need for type assertions to splice directly
|
|
@@ -3819,14 +4165,12 @@ const move = (query, oldPathOrID, newPath, { clone = false, combinators = defaul
|
|
|
3819
4165
|
else if (newIndex === 0) if (ruleToRemoveIndex === 0 && oldNextCombinator) insertRuleOrGroup(ruleOrGroup, oldNextCombinator);
|
|
3820
4166
|
else {
|
|
3821
4167
|
var _ref, _parentToInsertInto$r;
|
|
3822
|
-
|
|
3823
|
-
insertRuleOrGroup(ruleOrGroup, newNextCombinator);
|
|
4168
|
+
insertRuleOrGroup(ruleOrGroup, (_ref = (_parentToInsertInto$r = parentToInsertInto.rules[1]) !== null && _parentToInsertInto$r !== void 0 ? _parentToInsertInto$r : oldPrevCombinator) !== null && _ref !== void 0 ? _ref : getFirstOption(combinators));
|
|
3824
4169
|
}
|
|
3825
4170
|
else if (oldPrevCombinator) insertRuleOrGroup(oldPrevCombinator, ruleOrGroup);
|
|
3826
4171
|
else {
|
|
3827
4172
|
var _ref2, _parentToInsertInto$r2;
|
|
3828
|
-
|
|
3829
|
-
insertRuleOrGroup(newPrevCombinator, ruleOrGroup);
|
|
4173
|
+
insertRuleOrGroup((_ref2 = (_parentToInsertInto$r2 = parentToInsertInto.rules[newIndex - 2]) !== null && _parentToInsertInto$r2 !== void 0 ? _parentToInsertInto$r2 : oldNextCombinator) !== null && _ref2 !== void 0 ? _ref2 : getFirstOption(combinators), ruleOrGroup);
|
|
3830
4174
|
}
|
|
3831
4175
|
});
|
|
3832
4176
|
};
|
|
@@ -3854,16 +4198,14 @@ const insert = (query, ruleOrGroup, path, { combinators = defaultCombinators, co
|
|
|
3854
4198
|
if (((_rorg$path = rorg.path) === null || _rorg$path === void 0 ? void 0 : _rorg$path.at(-1)) === 0 && combinatorSucceeding) insertRuleOrGroup(newIndex, rorg, combinatorSucceeding);
|
|
3855
4199
|
else {
|
|
3856
4200
|
var _ref3, _parentToInsertInto$r3;
|
|
3857
|
-
|
|
3858
|
-
insertRuleOrGroup(newIndex, rorg, newNextCombinator);
|
|
4201
|
+
insertRuleOrGroup(newIndex, rorg, (_ref3 = (_parentToInsertInto$r3 = parentToInsertInto.rules[1]) !== null && _parentToInsertInto$r3 !== void 0 ? _parentToInsertInto$r3 : combinatorPreceding) !== null && _ref3 !== void 0 ? _ref3 : getFirstOption(combinators));
|
|
3859
4202
|
}
|
|
3860
4203
|
} else {
|
|
3861
4204
|
const normalizedNewIndex = newIndex % 2 === 0 ? newIndex - 1 : newIndex;
|
|
3862
4205
|
if (combinatorPreceding) insertRuleOrGroup(normalizedNewIndex, combinatorPreceding, rorg);
|
|
3863
4206
|
else {
|
|
3864
4207
|
var _ref4, _parentToInsertInto$r4;
|
|
3865
|
-
|
|
3866
|
-
insertRuleOrGroup(normalizedNewIndex, newPrevCombinator, rorg);
|
|
4208
|
+
insertRuleOrGroup(normalizedNewIndex, (_ref4 = (_parentToInsertInto$r4 = parentToInsertInto.rules[normalizedNewIndex - 2]) !== null && _parentToInsertInto$r4 !== void 0 ? _parentToInsertInto$r4 : combinatorSucceeding) !== null && _ref4 !== void 0 ? _ref4 : getFirstOption(combinators), rorg);
|
|
3867
4209
|
}
|
|
3868
4210
|
}
|
|
3869
4211
|
});
|
|
@@ -3898,8 +4240,7 @@ const group = (query, sourcePathOrID, targetPathOrID, { clone = false, combinato
|
|
|
3898
4240
|
const newNewPath = [...nextPath];
|
|
3899
4241
|
const commonAncestorPath = getCommonAncestorPath(sourcePath, nextPath);
|
|
3900
4242
|
if (!clone && sourcePath.length === commonAncestorPath.length + 1 && nextPath[commonAncestorPath.length] > sourcePath[commonAncestorPath.length]) newNewPath[commonAncestorPath.length] -= independentCombinators ? 2 : 1;
|
|
3901
|
-
const
|
|
3902
|
-
const parentOfTargetPath = findPath(newNewParentPath, draft);
|
|
4243
|
+
const parentOfTargetPath = findPath(getParentPath(newNewPath), draft);
|
|
3903
4244
|
const targetPathIndex = newNewPath.at(-1);
|
|
3904
4245
|
parentOfTargetPath.rules.splice(targetPathIndex, 1, prepareRuleOrGroup(independentCombinators ? { rules: [
|
|
3905
4246
|
targetRuleOrGroup,
|
|
@@ -3913,5 +4254,5 @@ const group = (query, sourcePathOrID, targetPathOrID, { clone = false, combinato
|
|
|
3913
4254
|
};
|
|
3914
4255
|
|
|
3915
4256
|
//#endregion
|
|
3916
|
-
export { LogType, TestID, add, bigIntJsonParseReviver, bigIntJsonStringifyReplacer, celCombinatorMap, clsx, convertFromIC, convertQuery, convertToIC, defaultCELValueProcessor, defaultCombinatorLabelMap, defaultCombinators, defaultCombinatorsExtended, defaultControlClassnames, defaultExportOperatorMap, defaultJoinChar, defaultMatchModes, defaultMongoDBValueProcessor, defaultNLTranslations, defaultOperatorLabelMap, defaultOperatorNegationMap, defaultOperatorProcessorNL, defaultOperatorProcessorSQL, defaultOperators, defaultPlaceholderFieldGroupLabel, defaultPlaceholderFieldLabel, defaultPlaceholderFieldName, defaultPlaceholderLabel, defaultPlaceholderName, defaultPlaceholderOperatorGroupLabel, defaultPlaceholderOperatorLabel, defaultPlaceholderOperatorName, defaultPlaceholderValueGroupLabel, defaultPlaceholderValueLabel, defaultPlaceholderValueName, defaultRuleGroupProcessorCEL, defaultRuleGroupProcessorDrizzle, defaultRuleGroupProcessorElasticSearch, defaultRuleGroupProcessorJSONata, defaultRuleGroupProcessorJsonLogic, defaultRuleGroupProcessorLDAP, defaultRuleGroupProcessorMongoDB, defaultRuleGroupProcessorMongoDBQuery, defaultRuleGroupProcessorNL, defaultRuleGroupProcessorParameterized, defaultRuleGroupProcessorPrisma, defaultRuleGroupProcessorSQL, defaultRuleGroupProcessorSequelize, defaultRuleGroupProcessorSpEL, defaultRuleProcessorCEL, defaultRuleProcessorDrizzle, defaultRuleProcessorElasticSearch, defaultRuleProcessorJSONata, defaultRuleProcessorJsonLogic, defaultRuleProcessorLDAP, defaultRuleProcessorMongoDB, defaultRuleProcessorMongoDBQuery, defaultRuleProcessorNL, defaultRuleProcessorParameterized, defaultRuleProcessorPrisma, defaultRuleProcessorSQL, defaultRuleProcessorSequelize, defaultRuleProcessorSpEL, defaultSpELValueProcessor, defaultValidator, defaultValueProcessor, defaultValueProcessorByRule, defaultValueProcessorCELByRule, defaultValueProcessorMongoDBByRule, defaultValueProcessorNL, defaultValueProcessorSpELByRule, filterFieldsByComparator, findID, findPath, formatQuery, formatQueryOptionPresets, generateAccessibleDescription, generateID, getCommonAncestorPath, getFirstOption, getMatchModesUtil, getNLTranslataion, getOption, getParentPath, getParseNumberMethod, getPathOfID, getQuoteFieldNamesWithArray, getQuotedFieldName, getValidationClassNames, getValueSourcesUtil, group, groupInvalidReasons, insert, isAncestor, isFlexibleOptionArray, isFlexibleOptionGroupArray, isFullOptionArray, isFullOptionGroupArray, isOptionGroupArray, isPojo, isRuleGroup, isRuleGroupType, isRuleGroupTypeIC, isRuleOrGroupValid, isRuleType, isValidValue, isValidationResult, isValueProcessorLegacy, joinWith, jsonLogicAdditionalOperators, lc, mapSQLOperator, mergeClassnames, mongoDbFallback, mongoOperators, move, normalizeConstituentWordOrder, nullFreeArray, nullOrUndefinedOrEmpty, numericRegex, numerifyValues, objectEntries, objectKeys, parseNumber, pathIsDisabled, pathsAreEqual, prepareRule, prepareRuleGroup, prepareRuleOrGroup, prismaFallback, prismaOperators, processMatchMode, regenerateID, regenerateIDs, remove, rootPath, shouldRenderAsNumber, splitBy, sqlDialectPresets, standardClassnames, toArray, toFlatOptionArray, toFullOption, toFullOptionList, toFullOptionMap, transformQuery, trimIfString, uniqByIdentifier, uniqByName, uniqOptGroups, uniqOptList, update };
|
|
4257
|
+
export { LogType, TestID, add, bigIntJsonParseReviver, bigIntJsonStringifyReplacer, celCombinatorMap, clsx, convertFromIC, convertQuery, convertToIC, defaultCELValueProcessor, defaultCombinatorLabelMap, defaultCombinators, defaultCombinatorsExtended, defaultControlClassnames, defaultExportOperatorMap, defaultJoinChar, defaultMatchModes, defaultMongoDBValueProcessor, defaultNLTranslations, defaultOperatorLabelMap, defaultOperatorNegationMap, defaultOperatorProcessorNL, defaultOperatorProcessorSQL, defaultOperators, defaultPlaceholderFieldGroupLabel, defaultPlaceholderFieldLabel, defaultPlaceholderFieldName, defaultPlaceholderLabel, defaultPlaceholderName, defaultPlaceholderOperatorGroupLabel, defaultPlaceholderOperatorLabel, defaultPlaceholderOperatorName, defaultPlaceholderValueGroupLabel, defaultPlaceholderValueLabel, defaultPlaceholderValueName, defaultRuleGroupProcessorCEL, defaultRuleGroupProcessorDrizzle, defaultRuleGroupProcessorElasticSearch, defaultRuleGroupProcessorJSONata, defaultRuleGroupProcessorJsonLogic, defaultRuleGroupProcessorLDAP, defaultRuleGroupProcessorMongoDB, defaultRuleGroupProcessorMongoDBQuery, defaultRuleGroupProcessorNL, defaultRuleGroupProcessorParameterized, defaultRuleGroupProcessorPrisma, defaultRuleGroupProcessorSQL, defaultRuleGroupProcessorSequelize, defaultRuleGroupProcessorSpEL, defaultRuleProcessorCEL, defaultRuleProcessorDrizzle, defaultRuleProcessorElasticSearch, defaultRuleProcessorJSONata, defaultRuleProcessorJsonLogic, defaultRuleProcessorLDAP, defaultRuleProcessorMongoDB, defaultRuleProcessorMongoDBQuery, defaultRuleProcessorNL, defaultRuleProcessorParameterized, defaultRuleProcessorPrisma, defaultRuleProcessorSQL, defaultRuleProcessorSequelize, defaultRuleProcessorSpEL, defaultSpELValueProcessor, defaultTranslations, defaultValidator, defaultValueProcessor, defaultValueProcessorByRule, defaultValueProcessorCELByRule, defaultValueProcessorMongoDBByRule, defaultValueProcessorNL, defaultValueProcessorSpELByRule, filterFieldsByComparator, findID, findPath, formatQuery, formatQueryOptionPresets, generateAccessibleDescription, generateID, getCommonAncestorPath, getFirstOption, getMatchModesUtil, getNLTranslataion, getOption, getParentPath, getParseNumberMethod, getPathOfID, getQuoteFieldNamesWithArray, getQuotedFieldName, getValidationClassNames, getValueSourcesUtil, group, groupInvalidReasons, insert, isAncestor, isFlexibleOptionArray, isFlexibleOptionGroupArray, isFullOptionArray, isFullOptionGroupArray, isOptionGroupArray, isPojo, isRuleGroup, isRuleGroupType, isRuleGroupTypeIC, isRuleOrGroupValid, isRuleType, isValidValue, isValidationResult, isValueProcessorLegacy, joinWith, jsonLogicAdditionalOperators, lc, mapSQLOperator, mergeAnyTranslation, mergeAnyTranslations, mergeClassnames, mongoDbFallback, mongoOperators, move, normalizeConstituentWordOrder, nullFreeArray, nullOrUndefinedOrEmpty, numericRegex, numerifyValues, objectEntries, objectKeys, parseNumber, pathIsDisabled, pathsAreEqual, preferAnyProp, preferFlagProps, preferProp, prepareOptionList, prepareRule, prepareRuleGroup, prepareRuleOrGroup, prismaFallback, prismaOperators, processMatchMode, queryBuilderFlagDefaults, regenerateID, regenerateIDs, remove, rootPath, shouldRenderAsNumber, splitBy, sqlDialectPresets, standardClassnames, toArray, toFlatOptionArray, toFullOption, toFullOptionList, toFullOptionMap, transformQuery, trimIfString, uniqByIdentifier, uniqByName, uniqOptGroups, uniqOptList, update };
|
|
3917
4258
|
//# sourceMappingURL=react-querybuilder_core.legacy-esm.js.map
|