@react-querybuilder/core 8.9.2 → 8.10.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-C9sO4qLO.mjs} +3 -75
- package/dist/arrayUtils-C9sO4qLO.mjs.map +1 -0
- package/dist/arrayUtils-QxZOZTf6.js +73 -0
- package/dist/arrayUtils-QxZOZTf6.js.map +1 -0
- package/dist/basic-BmpEwexQ.d.mts +363 -0
- package/dist/basic-CDDA-KZa.d.ts +363 -0
- package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +553 -1247
- package/dist/cjs/react-querybuilder_core.cjs.development.js +408 -121
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +553 -1247
- 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-BUgyz1GA.mjs} +2 -2
- package/dist/{convertQuery-H7RhQiIc.mjs.map → convertQuery-BUgyz1GA.mjs.map} +1 -1
- package/dist/{export-r-V7bU31.d.mts → export-Ccjfea21.d.mts} +3 -2
- package/dist/{export-DyrnTh6K.d.ts → export-GUuxJ7zR.d.ts} +3 -2
- 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-D-hm1phN.d.ts} +2 -2
- package/dist/{import-BwbbP4oU.d.mts → import-Dxevzw_-.d.mts} +2 -2
- package/dist/{isRuleGroup-CnhYpLOM.mjs → isRuleGroup-CGe_rb2w.mjs} +1 -1
- package/dist/{isRuleGroup-CnhYpLOM.mjs.map → isRuleGroup-CGe_rb2w.mjs.map} +1 -1
- 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-DrubUpx0.mjs} +86 -3
- package/dist/optGroupUtils-DrubUpx0.mjs.map +1 -0
- package/dist/parseCEL.d.mts +292 -11
- package/dist/parseCEL.d.ts +292 -11
- package/dist/parseCEL.js +114 -30
- package/dist/parseCEL.js.map +1 -1
- package/dist/parseCEL.mjs +69 -31
- 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-B_-sR6d5.mjs} +1 -1
- package/dist/{parseNumber-BtGKa58z.mjs.map → parseNumber-B_-sR6d5.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 +11 -15
- package/dist/parseSQL.js.map +1 -1
- package/dist/parseSQL.mjs +12 -16
- 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-CJNpnGcJ.mjs} +5 -6
- package/dist/prepareQueryObjects-CJNpnGcJ.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 +553 -1247
- package/dist/react-querybuilder_core.legacy-esm.d.ts +553 -1247
- package/dist/react-querybuilder_core.legacy-esm.js +412 -119
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +405 -122
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +553 -1247
- 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 +17 -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-DHvtgDgZ.mjs} +2 -2
- package/dist/{transformQuery-DdMvmrCh.mjs.map → transformQuery-DHvtgDgZ.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
|
};
|
|
@@ -558,7 +668,7 @@ const isRuleGroupType = (rg) => isRuleGroup(rg) && typeof rg.combinator === "str
|
|
|
558
668
|
const isRuleGroupTypeIC = (rg) => isRuleGroup(rg) && rg.combinator === void 0;
|
|
559
669
|
|
|
560
670
|
//#endregion
|
|
561
|
-
//#region \0@oxc-project+runtime@0.
|
|
671
|
+
//#region \0@oxc-project+runtime@0.94.0/helpers/typeof.js
|
|
562
672
|
function _typeof(o) {
|
|
563
673
|
"@babel/helpers - typeof";
|
|
564
674
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
@@ -569,7 +679,7 @@ function _typeof(o) {
|
|
|
569
679
|
}
|
|
570
680
|
|
|
571
681
|
//#endregion
|
|
572
|
-
//#region \0@oxc-project+runtime@0.
|
|
682
|
+
//#region \0@oxc-project+runtime@0.94.0/helpers/toPrimitive.js
|
|
573
683
|
function toPrimitive(t, r) {
|
|
574
684
|
if ("object" != _typeof(t) || !t) return t;
|
|
575
685
|
var e = t[Symbol.toPrimitive];
|
|
@@ -582,14 +692,14 @@ function toPrimitive(t, r) {
|
|
|
582
692
|
}
|
|
583
693
|
|
|
584
694
|
//#endregion
|
|
585
|
-
//#region \0@oxc-project+runtime@0.
|
|
695
|
+
//#region \0@oxc-project+runtime@0.94.0/helpers/toPropertyKey.js
|
|
586
696
|
function toPropertyKey(t) {
|
|
587
697
|
var i = toPrimitive(t, "string");
|
|
588
698
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
589
699
|
}
|
|
590
700
|
|
|
591
701
|
//#endregion
|
|
592
|
-
//#region \0@oxc-project+runtime@0.
|
|
702
|
+
//#region \0@oxc-project+runtime@0.94.0/helpers/defineProperty.js
|
|
593
703
|
function _defineProperty(e, r, t) {
|
|
594
704
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
595
705
|
value: t,
|
|
@@ -600,7 +710,7 @@ function _defineProperty(e, r, t) {
|
|
|
600
710
|
}
|
|
601
711
|
|
|
602
712
|
//#endregion
|
|
603
|
-
//#region \0@oxc-project+runtime@0.
|
|
713
|
+
//#region \0@oxc-project+runtime@0.94.0/helpers/objectSpread2.js
|
|
604
714
|
function ownKeys(e, r) {
|
|
605
715
|
var t = Object.keys(e);
|
|
606
716
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -624,7 +734,7 @@ function _objectSpread2(e) {
|
|
|
624
734
|
}
|
|
625
735
|
|
|
626
736
|
//#endregion
|
|
627
|
-
//#region \0@oxc-project+runtime@0.
|
|
737
|
+
//#region \0@oxc-project+runtime@0.94.0/helpers/objectWithoutPropertiesLoose.js
|
|
628
738
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
629
739
|
if (null == r) return {};
|
|
630
740
|
var t = {};
|
|
@@ -636,7 +746,7 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
636
746
|
}
|
|
637
747
|
|
|
638
748
|
//#endregion
|
|
639
|
-
//#region \0@oxc-project+runtime@0.
|
|
749
|
+
//#region \0@oxc-project+runtime@0.94.0/helpers/objectWithoutProperties.js
|
|
640
750
|
function _objectWithoutProperties(e, t) {
|
|
641
751
|
if (null == e) return {};
|
|
642
752
|
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
@@ -754,6 +864,21 @@ const defaultValidator = (query) => {
|
|
|
754
864
|
return result;
|
|
755
865
|
};
|
|
756
866
|
|
|
867
|
+
//#endregion
|
|
868
|
+
//#region src/utils/objectUtils.ts
|
|
869
|
+
/**
|
|
870
|
+
* A strongly-typed version of `Object.keys()`.
|
|
871
|
+
*
|
|
872
|
+
* [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-keys.ts)
|
|
873
|
+
*/
|
|
874
|
+
const objectKeys = Object.keys;
|
|
875
|
+
/**
|
|
876
|
+
* A strongly-typed version of `Object.entries()`.
|
|
877
|
+
*
|
|
878
|
+
* [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-entries.ts)
|
|
879
|
+
*/
|
|
880
|
+
const objectEntries = Object.entries;
|
|
881
|
+
|
|
757
882
|
//#endregion
|
|
758
883
|
//#region src/utils/optGroupUtils.ts
|
|
759
884
|
const isOptionWithName = (opt) => isPojo(opt) && "name" in opt && typeof opt.name === "string";
|
|
@@ -941,6 +1066,44 @@ const uniqOptList = (originalArray) => {
|
|
|
941
1066
|
if (isFlexibleOptionGroupArray(originalArray)) return uniqOptGroups(originalArray);
|
|
942
1067
|
return uniqByIdentifier(originalArray.map((o) => toFullOption(o)));
|
|
943
1068
|
};
|
|
1069
|
+
const prepareOptionList = (props) => {
|
|
1070
|
+
// istanbul ignore next
|
|
1071
|
+
const { optionList: optionListPropOriginal, baseOption = {}, labelMap = {}, placeholder: { placeholderName = defaultPlaceholderName, placeholderLabel = defaultPlaceholderLabel, placeholderGroupLabel = defaultPlaceholderLabel } = {}, autoSelectOption = true } = props;
|
|
1072
|
+
const defaultOption = {
|
|
1073
|
+
id: placeholderName,
|
|
1074
|
+
name: placeholderName,
|
|
1075
|
+
value: placeholderName,
|
|
1076
|
+
label: placeholderLabel
|
|
1077
|
+
};
|
|
1078
|
+
const optionsProp = optionListPropOriginal !== null && optionListPropOriginal !== void 0 ? optionListPropOriginal : [defaultOption];
|
|
1079
|
+
let optionList = [];
|
|
1080
|
+
const opts = Array.isArray(optionsProp) ? toFullOptionList(optionsProp, baseOption, labelMap) : objectKeys(toFullOptionMap(optionsProp, baseOption)).map((opt) => _objectSpread2(_objectSpread2({}, optionsProp[opt]), {}, {
|
|
1081
|
+
name: opt,
|
|
1082
|
+
value: opt
|
|
1083
|
+
})).sort((a, b) => a.label.localeCompare(b.label));
|
|
1084
|
+
if (isFlexibleOptionGroupArray(opts)) optionList = autoSelectOption ? uniqOptGroups(opts) : uniqOptGroups([{
|
|
1085
|
+
label: placeholderGroupLabel,
|
|
1086
|
+
options: [defaultOption]
|
|
1087
|
+
}, ...opts]);
|
|
1088
|
+
else optionList = autoSelectOption ? uniqByIdentifier(opts) : uniqByIdentifier([defaultOption, ...opts]);
|
|
1089
|
+
let optionsMap = {};
|
|
1090
|
+
if (!Array.isArray(optionsProp)) {
|
|
1091
|
+
const op = toFullOptionMap(optionsProp, baseOption);
|
|
1092
|
+
optionsMap = autoSelectOption ? op : _objectSpread2(_objectSpread2({}, op), {}, { [placeholderName]: defaultOption });
|
|
1093
|
+
} else if (isFlexibleOptionGroupArray(optionList)) for (const og of optionList) for (const opt of og.options) {
|
|
1094
|
+
var _opt$value3;
|
|
1095
|
+
optionsMap[(_opt$value3 = opt.value) !== null && _opt$value3 !== void 0 ? _opt$value3 : opt.name] = toFullOption(opt, baseOption);
|
|
1096
|
+
}
|
|
1097
|
+
else for (const opt of optionList) {
|
|
1098
|
+
var _opt$value4;
|
|
1099
|
+
optionsMap[(_opt$value4 = opt.value) !== null && _opt$value4 !== void 0 ? _opt$value4 : opt.name] = toFullOption(opt, baseOption);
|
|
1100
|
+
}
|
|
1101
|
+
return {
|
|
1102
|
+
defaultOption,
|
|
1103
|
+
optionList,
|
|
1104
|
+
optionsMap
|
|
1105
|
+
};
|
|
1106
|
+
};
|
|
944
1107
|
|
|
945
1108
|
//#endregion
|
|
946
1109
|
//#region src/utils/filterFieldsByComparator.ts
|
|
@@ -1030,9 +1193,11 @@ function transformQuery(query, options = {}) {
|
|
|
1030
1193
|
const isValidationResult = (vr) => isPojo(vr) && typeof vr.valid === "boolean";
|
|
1031
1194
|
/**
|
|
1032
1195
|
* 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
|
|
1196
|
+
* or a validator function. Returns `true` if neither are defined and the `muted`
|
|
1197
|
+
* property is not `true`.
|
|
1034
1198
|
*/
|
|
1035
1199
|
const isRuleOrGroupValid = (rg, validationResult, validator) => {
|
|
1200
|
+
if (rg.muted) return false;
|
|
1036
1201
|
if (typeof validationResult === "boolean") return validationResult;
|
|
1037
1202
|
if (isValidationResult(validationResult)) return validationResult.valid;
|
|
1038
1203
|
if (typeof validator === "function" && !isRuleGroup(rg)) {
|
|
@@ -1302,19 +1467,45 @@ const defaultRuleGroupProcessorCEL = (ruleGroup, options) => {
|
|
|
1302
1467
|
const processRuleGroup = (rg, outermost) => {
|
|
1303
1468
|
var _rg$id;
|
|
1304
1469
|
if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermost ? fallbackExpression : "";
|
|
1305
|
-
const
|
|
1470
|
+
const processedRules = [];
|
|
1471
|
+
let precedingCombinator = "";
|
|
1472
|
+
let firstRule = true;
|
|
1473
|
+
for (const rule of rg.rules) {
|
|
1306
1474
|
var _rule$valueSource;
|
|
1307
|
-
if (typeof rule === "string")
|
|
1308
|
-
|
|
1475
|
+
if (typeof rule === "string") {
|
|
1476
|
+
precedingCombinator = celCombinatorMap[rule];
|
|
1477
|
+
continue;
|
|
1478
|
+
}
|
|
1479
|
+
if (isRuleGroup(rule)) {
|
|
1480
|
+
const processedGroup = processRuleGroup(rule);
|
|
1481
|
+
if (processedGroup) {
|
|
1482
|
+
if (!firstRule && precedingCombinator) {
|
|
1483
|
+
processedRules.push(precedingCombinator);
|
|
1484
|
+
precedingCombinator = "";
|
|
1485
|
+
}
|
|
1486
|
+
firstRule = false;
|
|
1487
|
+
processedRules.push(processedGroup);
|
|
1488
|
+
}
|
|
1489
|
+
continue;
|
|
1490
|
+
}
|
|
1309
1491
|
const [validationResult, fieldValidator] = validateRule(rule);
|
|
1310
|
-
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName)
|
|
1492
|
+
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName) continue;
|
|
1311
1493
|
const fieldData = getOption(fields, rule.field);
|
|
1312
|
-
|
|
1494
|
+
const processedRule = ruleProcessor(rule, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
1313
1495
|
parseNumbers: getParseNumberBoolean(fieldData === null || fieldData === void 0 ? void 0 : fieldData.inputType),
|
|
1314
1496
|
escapeQuotes: ((_rule$valueSource = rule.valueSource) !== null && _rule$valueSource !== void 0 ? _rule$valueSource : "value") === "value",
|
|
1315
1497
|
fieldData
|
|
1316
1498
|
}));
|
|
1317
|
-
|
|
1499
|
+
if (processedRule) {
|
|
1500
|
+
if (!firstRule && precedingCombinator) {
|
|
1501
|
+
processedRules.push(precedingCombinator);
|
|
1502
|
+
precedingCombinator = "";
|
|
1503
|
+
}
|
|
1504
|
+
firstRule = false;
|
|
1505
|
+
processedRules.push(processedRule);
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
const expression = processedRules.join(isRuleGroupType(rg) ? ` ${celCombinatorMap[rg.combinator]} ` : " ");
|
|
1318
1509
|
const [prefix, suffix] = rg.not || !outermost ? [`${rg.not ? "!" : ""}(`, ")"] : ["", ""];
|
|
1319
1510
|
return expression ? `${prefix}${expression}${suffix}` : fallbackExpression;
|
|
1320
1511
|
};
|
|
@@ -1341,8 +1532,7 @@ const defaultRuleProcessorCEL = (rule, opts = {}) => {
|
|
|
1341
1532
|
else if (matchEval) {
|
|
1342
1533
|
const { mode, threshold } = matchEval;
|
|
1343
1534
|
const arrayElementAlias = "elem_alias";
|
|
1344
|
-
const
|
|
1345
|
-
const nestedArrayFilter = defaultRuleGroupProcessorCEL(celQuery, opts);
|
|
1535
|
+
const nestedArrayFilter = defaultRuleGroupProcessorCEL(transformQuery(rule.value, { ruleProcessor: (r) => _objectSpread2(_objectSpread2({}, r), {}, { field: `${arrayElementAlias}${r.field ? `.${r.field}` : ""}` }) }), opts);
|
|
1346
1536
|
switch (mode) {
|
|
1347
1537
|
case "all": return `${field}.all(${arrayElementAlias}, ${nestedArrayFilter})`;
|
|
1348
1538
|
case "none":
|
|
@@ -1376,8 +1566,7 @@ const defaultRuleProcessorCEL = (rule, opts = {}) => {
|
|
|
1376
1566
|
case "in":
|
|
1377
1567
|
case "notin": {
|
|
1378
1568
|
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}`;
|
|
1569
|
+
return `${prefix}${field} in [${toArray(value).map((val) => valueIsField || shouldRenderAsNumber(val, parseNumbers) ? `${trimIfString(val)}` : `"${escapeDoubleQuotes(val, escapeQuotes)}"`).join(", ")}]${suffix}`;
|
|
1381
1570
|
}
|
|
1382
1571
|
case "between":
|
|
1383
1572
|
case "notbetween": {
|
|
@@ -1584,19 +1773,45 @@ const defaultRuleGroupProcessorSpEL = (ruleGroup, options) => {
|
|
|
1584
1773
|
const processRuleGroup = (rg, outermost) => {
|
|
1585
1774
|
var _rg$id;
|
|
1586
1775
|
if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermost ? fallbackExpression : "";
|
|
1587
|
-
const
|
|
1776
|
+
const processedRules = [];
|
|
1777
|
+
let precedingCombinator = "";
|
|
1778
|
+
let firstRule = true;
|
|
1779
|
+
for (const rule of rg.rules) {
|
|
1588
1780
|
var _rule$valueSource;
|
|
1589
|
-
if (typeof rule === "string")
|
|
1590
|
-
|
|
1781
|
+
if (typeof rule === "string") {
|
|
1782
|
+
precedingCombinator = rule;
|
|
1783
|
+
continue;
|
|
1784
|
+
}
|
|
1785
|
+
if (isRuleGroup(rule)) {
|
|
1786
|
+
const processedGroup = processRuleGroup(rule);
|
|
1787
|
+
if (processedGroup) {
|
|
1788
|
+
if (!firstRule && precedingCombinator) {
|
|
1789
|
+
processedRules.push(precedingCombinator);
|
|
1790
|
+
precedingCombinator = "";
|
|
1791
|
+
}
|
|
1792
|
+
firstRule = false;
|
|
1793
|
+
processedRules.push(processedGroup);
|
|
1794
|
+
}
|
|
1795
|
+
continue;
|
|
1796
|
+
}
|
|
1591
1797
|
const [validationResult, fieldValidator] = validateRule(rule);
|
|
1592
|
-
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName)
|
|
1798
|
+
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName) continue;
|
|
1593
1799
|
const fieldData = getOption(fields, rule.field);
|
|
1594
|
-
|
|
1800
|
+
const processedRule = ruleProcessor(rule, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
1595
1801
|
parseNumbers: getParseNumberBoolean(fieldData === null || fieldData === void 0 ? void 0 : fieldData.inputType),
|
|
1596
1802
|
escapeQuotes: ((_rule$valueSource = rule.valueSource) !== null && _rule$valueSource !== void 0 ? _rule$valueSource : "value") === "value",
|
|
1597
1803
|
fieldData
|
|
1598
1804
|
}));
|
|
1599
|
-
|
|
1805
|
+
if (processedRule) {
|
|
1806
|
+
if (!firstRule && precedingCombinator) {
|
|
1807
|
+
processedRules.push(precedingCombinator);
|
|
1808
|
+
precedingCombinator = "";
|
|
1809
|
+
}
|
|
1810
|
+
firstRule = false;
|
|
1811
|
+
processedRules.push(processedRule);
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
const expression = processedRules.join(isRuleGroupType(rg) ? ` ${rg.combinator} ` : " ");
|
|
1600
1815
|
const [prefix, suffix] = rg.not || !outermost ? [`${rg.not ? "!" : ""}(`, ")"] : ["", ""];
|
|
1601
1816
|
return expression ? `${prefix}${expression}${suffix}` : fallbackExpression;
|
|
1602
1817
|
};
|
|
@@ -1649,15 +1864,9 @@ const defaultRuleProcessorSpEL = (rule, opts = {}) => {
|
|
|
1649
1864
|
case "contains":
|
|
1650
1865
|
case "doesnotcontain": return wrapInNegation(`${field} matches ${valueIsField || useBareValue ? trimIfString(value) : `'${escapeSingleQuotes(value, escapeQuotes)}'`}`, shouldNegate$1(operatorTL));
|
|
1651
1866
|
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
|
-
}
|
|
1867
|
+
case "doesnotbeginwith": return wrapInNegation(`${field} matches ${valueIsField ? `'^'.concat(${trimIfString(value)})` : `'${typeof value === "string" && !value.startsWith("^") || useBareValue ? "^" : ""}${escapeSingleQuotes(value, escapeQuotes)}'`}`, shouldNegate$1(operatorTL));
|
|
1656
1868
|
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
|
-
}
|
|
1869
|
+
case "doesnotendwith": return wrapInNegation(`${field} matches ${valueIsField ? `${trimIfString(value)}.concat('$')` : `'${escapeSingleQuotes(value, escapeQuotes)}${typeof value === "string" && !value.endsWith("$") || useBareValue ? "$" : ""}'`}`, shouldNegate$1(operatorTL));
|
|
1661
1870
|
case "null": return `${field} == null`;
|
|
1662
1871
|
case "notnull": return `${field} != null`;
|
|
1663
1872
|
case "in":
|
|
@@ -1771,8 +1980,7 @@ const defaultRuleProcessorDrizzle = (rule, _options) => {
|
|
|
1771
1980
|
if (opts.preset !== "postgresql") return;
|
|
1772
1981
|
const { mode, threshold } = matchEval;
|
|
1773
1982
|
const arrayElementAlias = "elem_alias";
|
|
1774
|
-
const
|
|
1775
|
-
const nestedArrayFilter = defaultRuleGroupProcessorDrizzle(sqlQuery, _objectSpread2(_objectSpread2({}, opts), {}, { context: _objectSpread2(_objectSpread2({}, opts.context), {}, { useRawFields: true }) }));
|
|
1983
|
+
const nestedArrayFilter = defaultRuleGroupProcessorDrizzle(transformQuery(rule.value, { ruleProcessor: (r) => _objectSpread2(_objectSpread2({}, r), {}, { field: arrayElementAlias }) }), _objectSpread2(_objectSpread2({}, opts), {}, { context: _objectSpread2(_objectSpread2({}, opts.context), {}, { useRawFields: true }) }));
|
|
1776
1984
|
switch (mode) {
|
|
1777
1985
|
case "all": return sql`(select count(*) from unnest(${column}) as ${sql.raw(arrayElementAlias)} where ${nestedArrayFilter({}, drizzleOperators)}) = array_length(${column}, 1)`;
|
|
1778
1986
|
case "none": return sql`not exists (select 1 from unnest(${column}) as ${sql.raw(arrayElementAlias)} where ${nestedArrayFilter({}, drizzleOperators)})`;
|
|
@@ -1852,7 +2060,6 @@ const defaultRuleGroupProcessorDrizzle = (ruleGroup, options, _meta) => (columns
|
|
|
1852
2060
|
const { fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, validateRule, validationMap } = options;
|
|
1853
2061
|
if (!columns || !drizzleOperators) return;
|
|
1854
2062
|
const { and, not, or } = drizzleOperators;
|
|
1855
|
-
const query = isRuleGroupType(ruleGroup) ? ruleGroup : convertFromIC(ruleGroup);
|
|
1856
2063
|
const ruleProcessor = defaultRuleProcessorDrizzle;
|
|
1857
2064
|
const processRuleGroup = (rg, _outermost) => {
|
|
1858
2065
|
var _rg$id;
|
|
@@ -1875,7 +2082,7 @@ const defaultRuleGroupProcessorDrizzle = (ruleGroup, options, _meta) => (columns
|
|
|
1875
2082
|
const ruleGroupSQL = rg.combinator === "or" ? or(...processedRules) : and(...processedRules);
|
|
1876
2083
|
return rg.not ? not(ruleGroupSQL) : ruleGroupSQL;
|
|
1877
2084
|
};
|
|
1878
|
-
return processRuleGroup(
|
|
2085
|
+
return processRuleGroup(convertFromIC(ruleGroup), true);
|
|
1879
2086
|
};
|
|
1880
2087
|
|
|
1881
2088
|
//#endregion
|
|
@@ -1887,7 +2094,6 @@ const defaultRuleGroupProcessorDrizzle = (ruleGroup, options, _meta) => (columns
|
|
|
1887
2094
|
*/
|
|
1888
2095
|
const defaultRuleGroupProcessorElasticSearch = (ruleGroup, options) => {
|
|
1889
2096
|
const { fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
|
|
1890
|
-
const query = convertFromIC(ruleGroup);
|
|
1891
2097
|
const processRuleGroup = (rg) => {
|
|
1892
2098
|
var _rg$id;
|
|
1893
2099
|
if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return false;
|
|
@@ -1904,7 +2110,7 @@ const defaultRuleGroupProcessorElasticSearch = (ruleGroup, options) => {
|
|
|
1904
2110
|
if (processedRules.length === 0) return false;
|
|
1905
2111
|
return { bool: rg.not ? { must_not: /^or$/i.test(rg.combinator) ? { bool: { should: processedRules } } : processedRules } : { [/^or$/i.test(rg.combinator) ? "should" : "must"]: processedRules } };
|
|
1906
2112
|
};
|
|
1907
|
-
const processedRuleGroup = processRuleGroup(
|
|
2113
|
+
const processedRuleGroup = processRuleGroup(convertFromIC(ruleGroup));
|
|
1908
2114
|
return processedRuleGroup === false ? {} : processedRuleGroup;
|
|
1909
2115
|
};
|
|
1910
2116
|
|
|
@@ -1920,19 +2126,45 @@ const defaultRuleGroupProcessorJSONata = (ruleGroup, options) => {
|
|
|
1920
2126
|
const processRuleGroup = (rg, outermost) => {
|
|
1921
2127
|
var _rg$id;
|
|
1922
2128
|
if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermost ? fallbackExpression : "";
|
|
1923
|
-
const
|
|
2129
|
+
const processedRules = [];
|
|
2130
|
+
let precedingCombinator = "";
|
|
2131
|
+
let firstRule = true;
|
|
2132
|
+
for (const rule of rg.rules) {
|
|
1924
2133
|
var _rule$valueSource;
|
|
1925
|
-
if (typeof rule === "string")
|
|
1926
|
-
|
|
2134
|
+
if (typeof rule === "string") {
|
|
2135
|
+
precedingCombinator = rule;
|
|
2136
|
+
continue;
|
|
2137
|
+
}
|
|
2138
|
+
if (isRuleGroup(rule)) {
|
|
2139
|
+
const processedGroup = processRuleGroup(rule);
|
|
2140
|
+
if (processedGroup) {
|
|
2141
|
+
if (!firstRule && precedingCombinator) {
|
|
2142
|
+
processedRules.push(precedingCombinator);
|
|
2143
|
+
precedingCombinator = "";
|
|
2144
|
+
}
|
|
2145
|
+
firstRule = false;
|
|
2146
|
+
processedRules.push(processedGroup);
|
|
2147
|
+
}
|
|
2148
|
+
continue;
|
|
2149
|
+
}
|
|
1927
2150
|
const [validationResult, fieldValidator] = validateRule(rule);
|
|
1928
|
-
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName)
|
|
2151
|
+
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName) continue;
|
|
1929
2152
|
const fieldData = getOption(fields, rule.field);
|
|
1930
|
-
|
|
2153
|
+
const processedRule = ruleProcessor(rule, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
1931
2154
|
parseNumbers: getParseNumberBoolean(fieldData === null || fieldData === void 0 ? void 0 : fieldData.inputType),
|
|
1932
2155
|
escapeQuotes: ((_rule$valueSource = rule.valueSource) !== null && _rule$valueSource !== void 0 ? _rule$valueSource : "value") === "value",
|
|
1933
2156
|
fieldData
|
|
1934
2157
|
}));
|
|
1935
|
-
|
|
2158
|
+
if (processedRule) {
|
|
2159
|
+
if (!firstRule && precedingCombinator) {
|
|
2160
|
+
processedRules.push(precedingCombinator);
|
|
2161
|
+
precedingCombinator = "";
|
|
2162
|
+
}
|
|
2163
|
+
firstRule = false;
|
|
2164
|
+
processedRules.push(processedRule);
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
const expression = processedRules.join(isRuleGroupType(rg) ? ` ${rg.combinator} ` : " ");
|
|
1936
2168
|
const [prefix, suffix] = rg.not || !outermost ? [`${rg.not ? "$not" : ""}(`, ")"] : ["", ""];
|
|
1937
2169
|
return expression ? `${prefix}${expression}${suffix}` : fallbackExpression;
|
|
1938
2170
|
};
|
|
@@ -1978,7 +2210,6 @@ const defaultRuleGroupProcessorJsonLogic = (ruleGroup, options) => {
|
|
|
1978
2210
|
*/
|
|
1979
2211
|
const defaultRuleGroupProcessorLDAP = (ruleGroup, options) => {
|
|
1980
2212
|
const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
|
|
1981
|
-
const query = convertFromIC(ruleGroup);
|
|
1982
2213
|
const processRuleGroup = (rg, outermost) => {
|
|
1983
2214
|
var _rg$id;
|
|
1984
2215
|
if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermost ? fallbackExpression : "";
|
|
@@ -1999,7 +2230,7 @@ const defaultRuleGroupProcessorLDAP = (ruleGroup, options) => {
|
|
|
1999
2230
|
const [prefix, suffix] = rules.length > 1 ? [`${notPrefix}(${rg.combinator === "or" ? "|" : "&"}`, `)${notSuffix}`] : [notPrefix, notSuffix];
|
|
2000
2231
|
return expression ? `${prefix}${expression}${suffix}` : fallbackExpression;
|
|
2001
2232
|
};
|
|
2002
|
-
return processRuleGroup(
|
|
2233
|
+
return processRuleGroup(convertFromIC(ruleGroup), true);
|
|
2003
2234
|
};
|
|
2004
2235
|
|
|
2005
2236
|
//#endregion
|
|
@@ -2055,26 +2286,48 @@ const defaultRuleGroupProcessorNL = (ruleGroup, options) => {
|
|
|
2055
2286
|
var _rg$id, _rg2$combinator2, _translations2;
|
|
2056
2287
|
if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
|
|
2057
2288
|
const rg2 = isRuleGroupTypeIC(rg) && rg.rules.some((r) => typeof r === "string" && lc(r) === "xor") ? convertFromIC(rg) : rg;
|
|
2058
|
-
const processedRules =
|
|
2289
|
+
const processedRules = [];
|
|
2290
|
+
let precedingCombinator = "";
|
|
2291
|
+
let firstRule = true;
|
|
2292
|
+
for (const rule of rg2.rules) {
|
|
2059
2293
|
var _rule$valueSource;
|
|
2060
2294
|
if (typeof rule === "string") {
|
|
2061
2295
|
var _translations;
|
|
2062
|
-
|
|
2296
|
+
precedingCombinator = `, ${(_translations = translations[rule]) !== null && _translations !== void 0 ? _translations : rule} `;
|
|
2297
|
+
continue;
|
|
2063
2298
|
}
|
|
2064
2299
|
if (isRuleGroup(rule)) {
|
|
2065
2300
|
var _rg2$combinator;
|
|
2066
|
-
|
|
2301
|
+
const processedGroup = processRuleGroup(rule, rg2.rules.length === 1 && !(rg2.not || /^xor$/i.test((_rg2$combinator = rg2.combinator) !== null && _rg2$combinator !== void 0 ? _rg2$combinator : "")));
|
|
2302
|
+
// istanbul ignore else
|
|
2303
|
+
if (processedGroup) {
|
|
2304
|
+
if (!firstRule && precedingCombinator) {
|
|
2305
|
+
processedRules.push(precedingCombinator);
|
|
2306
|
+
precedingCombinator = "";
|
|
2307
|
+
}
|
|
2308
|
+
firstRule = false;
|
|
2309
|
+
processedRules.push(processedGroup);
|
|
2310
|
+
}
|
|
2311
|
+
continue;
|
|
2067
2312
|
}
|
|
2068
2313
|
const [validationResult, fieldValidator] = validateRule(rule);
|
|
2069
|
-
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName)
|
|
2314
|
+
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName) continue;
|
|
2070
2315
|
const escapeQuotes = ((_rule$valueSource = rule.valueSource) !== null && _rule$valueSource !== void 0 ? _rule$valueSource : "value") === "value";
|
|
2071
2316
|
const fieldData = getOption(fields, rule.field);
|
|
2072
|
-
|
|
2317
|
+
const processedRule = ruleProcessor(rule, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
2073
2318
|
parseNumbers: getParseNumberBoolean(fieldData === null || fieldData === void 0 ? void 0 : fieldData.inputType),
|
|
2074
2319
|
escapeQuotes,
|
|
2075
2320
|
fieldData
|
|
2076
2321
|
}));
|
|
2077
|
-
|
|
2322
|
+
if (processedRule) {
|
|
2323
|
+
if (!firstRule && precedingCombinator) {
|
|
2324
|
+
processedRules.push(precedingCombinator);
|
|
2325
|
+
precedingCombinator = "";
|
|
2326
|
+
}
|
|
2327
|
+
firstRule = false;
|
|
2328
|
+
processedRules.push(processedRule);
|
|
2329
|
+
}
|
|
2330
|
+
}
|
|
2078
2331
|
if (processedRules.length === 0) return fallbackExpression;
|
|
2079
2332
|
const isXOR = lc((_rg2$combinator2 = rg2.combinator) !== null && _rg2$combinator2 !== void 0 ? _rg2$combinator2 : "") === "xor";
|
|
2080
2333
|
const combinator = isXOR ? rg2.combinator.slice(1) : rg2.combinator;
|
|
@@ -2082,7 +2335,7 @@ const defaultRuleGroupProcessorNL = (ruleGroup, options) => {
|
|
|
2082
2335
|
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
2336
|
const prefix = mustWrap ? `${prefixTL} (`.trim() : "";
|
|
2084
2337
|
const suffix = mustWrap ? `) ${suffixTL}`.trim() : "";
|
|
2085
|
-
return `${prefix}${processedRules.
|
|
2338
|
+
return `${prefix}${processedRules.join(isRuleGroupType(rg2) ? `, ${(_translations2 = translations[combinator]) !== null && _translations2 !== void 0 ? _translations2 : combinator} ` : "")}${suffix}`;
|
|
2086
2339
|
};
|
|
2087
2340
|
return processRuleGroup(ruleGroup, true);
|
|
2088
2341
|
};
|
|
@@ -2133,11 +2386,37 @@ const defaultRuleGroupProcessorParameterized = (ruleGroup, options) => {
|
|
|
2133
2386
|
const processRuleGroup = (rg, outermostOrLonelyInGroup) => {
|
|
2134
2387
|
var _rg$id;
|
|
2135
2388
|
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
|
-
|
|
2389
|
+
const processedRules = [];
|
|
2390
|
+
let precedingCombinator = "";
|
|
2391
|
+
let firstRule = true;
|
|
2392
|
+
for (const rule of rg.rules) {
|
|
2393
|
+
if (typeof rule === "string") {
|
|
2394
|
+
precedingCombinator = rule;
|
|
2395
|
+
continue;
|
|
2396
|
+
}
|
|
2397
|
+
if (isRuleGroup(rule)) {
|
|
2398
|
+
const processedGroup = processRuleGroup(rule, rg.rules.length === 1);
|
|
2399
|
+
// istanbul ignore else
|
|
2400
|
+
if (processedGroup) {
|
|
2401
|
+
if (!firstRule && precedingCombinator) {
|
|
2402
|
+
processedRules.push(precedingCombinator);
|
|
2403
|
+
precedingCombinator = "";
|
|
2404
|
+
}
|
|
2405
|
+
firstRule = false;
|
|
2406
|
+
processedRules.push(processedGroup);
|
|
2407
|
+
}
|
|
2408
|
+
continue;
|
|
2409
|
+
}
|
|
2410
|
+
const processedRule = processRule(rule);
|
|
2411
|
+
if (processedRule) {
|
|
2412
|
+
if (!firstRule && precedingCombinator) {
|
|
2413
|
+
processedRules.push(precedingCombinator);
|
|
2414
|
+
precedingCombinator = "";
|
|
2415
|
+
}
|
|
2416
|
+
firstRule = false;
|
|
2417
|
+
processedRules.push(processedRule);
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2141
2420
|
if (processedRules.length === 0) return fallbackExpression;
|
|
2142
2421
|
return `${rg.not ? "NOT " : ""}(${processedRules.join(isRuleGroupType(rg) ? ` ${rg.combinator} ` : " ")})`;
|
|
2143
2422
|
};
|
|
@@ -2247,20 +2526,46 @@ const defaultRuleGroupProcessorSQL = (ruleGroup, options) => {
|
|
|
2247
2526
|
const processRuleGroup = (rg, outermostOrLonelyInGroup) => {
|
|
2248
2527
|
var _rg$id;
|
|
2249
2528
|
if (!isRuleOrGroupValid(rg, validationMap[(_rg$id = rg.id) !== null && _rg$id !== void 0 ? _rg$id : ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
|
|
2250
|
-
const processedRules =
|
|
2529
|
+
const processedRules = [];
|
|
2530
|
+
let precedingCombinator = "";
|
|
2531
|
+
let firstRule = true;
|
|
2532
|
+
for (const rule of rg.rules) {
|
|
2251
2533
|
var _rule$valueSource;
|
|
2252
|
-
if (typeof rule === "string")
|
|
2253
|
-
|
|
2534
|
+
if (typeof rule === "string") {
|
|
2535
|
+
precedingCombinator = rule;
|
|
2536
|
+
continue;
|
|
2537
|
+
}
|
|
2538
|
+
if (isRuleGroup(rule)) {
|
|
2539
|
+
const processedGroup = processRuleGroup(rule, rg.rules.length === 1);
|
|
2540
|
+
// istanbul ignore else
|
|
2541
|
+
if (processedGroup) {
|
|
2542
|
+
if (!firstRule && precedingCombinator) {
|
|
2543
|
+
processedRules.push(precedingCombinator);
|
|
2544
|
+
precedingCombinator = "";
|
|
2545
|
+
}
|
|
2546
|
+
firstRule = false;
|
|
2547
|
+
processedRules.push(processedGroup);
|
|
2548
|
+
}
|
|
2549
|
+
continue;
|
|
2550
|
+
}
|
|
2254
2551
|
const [validationResult, fieldValidator] = validateRule(rule);
|
|
2255
|
-
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName)
|
|
2552
|
+
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName) continue;
|
|
2256
2553
|
const escapeQuotes = ((_rule$valueSource = rule.valueSource) !== null && _rule$valueSource !== void 0 ? _rule$valueSource : "value") === "value";
|
|
2257
2554
|
const fieldData = getOption(fields, rule.field);
|
|
2258
|
-
|
|
2555
|
+
const processedRule = ruleProcessor(rule, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
2259
2556
|
parseNumbers: getParseNumberBoolean(fieldData === null || fieldData === void 0 ? void 0 : fieldData.inputType),
|
|
2260
2557
|
escapeQuotes,
|
|
2261
2558
|
fieldData
|
|
2262
2559
|
}));
|
|
2263
|
-
|
|
2560
|
+
if (processedRule) {
|
|
2561
|
+
if (!firstRule && precedingCombinator) {
|
|
2562
|
+
processedRules.push(precedingCombinator);
|
|
2563
|
+
precedingCombinator = "";
|
|
2564
|
+
}
|
|
2565
|
+
firstRule = false;
|
|
2566
|
+
processedRules.push(processedRule);
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2264
2569
|
if (processedRules.length === 0) return fallbackExpression;
|
|
2265
2570
|
return `${rg.not ? "NOT " : ""}(${processedRules.join(isRuleGroupType(rg) ? ` ${rg.combinator} ` : " ")})`;
|
|
2266
2571
|
};
|
|
@@ -2536,10 +2841,7 @@ const defaultRuleProcessorJsonLogic = (rule, options = {}) => {
|
|
|
2536
2841
|
case "null":
|
|
2537
2842
|
case "notnull": return { [`${operatorLC === "notnull" ? "!" : "="}=`]: [fieldObject, null] };
|
|
2538
2843
|
case "in":
|
|
2539
|
-
case "notin": {
|
|
2540
|
-
const valueAsArray = toArray(value).map((v) => fieldOrNumberRenderer(v));
|
|
2541
|
-
return negateIfNotOp(operatorLC, { in: [fieldObject, valueAsArray] });
|
|
2542
|
-
}
|
|
2844
|
+
case "notin": return negateIfNotOp(operatorLC, { in: [fieldObject, toArray(value).map((v) => fieldOrNumberRenderer(v))] });
|
|
2543
2845
|
case "between":
|
|
2544
2846
|
case "notbetween": {
|
|
2545
2847
|
const valueAsArray = toArray(value);
|
|
@@ -2570,20 +2872,11 @@ const defaultRuleProcessorJsonLogic = (rule, options = {}) => {
|
|
|
2570
2872
|
return false;
|
|
2571
2873
|
}
|
|
2572
2874
|
case "contains":
|
|
2573
|
-
case "doesnotcontain": {
|
|
2574
|
-
const jsonRule = { in: [fieldOrNumberRenderer(value), fieldObject] };
|
|
2575
|
-
return negateIfNotOp(operatorLC, jsonRule);
|
|
2576
|
-
}
|
|
2875
|
+
case "doesnotcontain": return negateIfNotOp(operatorLC, { in: [fieldOrNumberRenderer(value), fieldObject] });
|
|
2577
2876
|
case "beginswith":
|
|
2578
|
-
case "doesnotbeginwith": {
|
|
2579
|
-
const jsonRule = { startsWith: [fieldObject, fieldOrNumberRenderer(value)] };
|
|
2580
|
-
return negateIfNotOp(operatorLC, jsonRule);
|
|
2581
|
-
}
|
|
2877
|
+
case "doesnotbeginwith": return negateIfNotOp(operatorLC, { startsWith: [fieldObject, fieldOrNumberRenderer(value)] });
|
|
2582
2878
|
case "endswith":
|
|
2583
|
-
case "doesnotendwith": {
|
|
2584
|
-
const jsonRule = { endsWith: [fieldObject, fieldOrNumberRenderer(value)] };
|
|
2585
|
-
return negateIfNotOp(operatorLC, jsonRule);
|
|
2586
|
-
}
|
|
2879
|
+
case "doesnotendwith": return negateIfNotOp(operatorLC, { endsWith: [fieldObject, fieldOrNumberRenderer(value)] });
|
|
2587
2880
|
}
|
|
2588
2881
|
return false;
|
|
2589
2882
|
};
|
|
@@ -2618,10 +2911,7 @@ const defaultRuleProcessorLDAP = (rule, options = {}) => {
|
|
|
2618
2911
|
case "null":
|
|
2619
2912
|
case "notnull": return negateIf(`(${field}=*)`, operatorLC === "notnull");
|
|
2620
2913
|
case "in":
|
|
2621
|
-
case "notin": {
|
|
2622
|
-
const valueAsArray = toArray(value);
|
|
2623
|
-
return negateIf(`(|${valueAsArray.map((val) => `(${field}=${ldapEscape(val)})`).join("")})`, operatorLC === "notin");
|
|
2624
|
-
}
|
|
2914
|
+
case "notin": return negateIf(`(|${toArray(value).map((val) => `(${field}=${ldapEscape(val)})`).join("")})`, operatorLC === "notin");
|
|
2625
2915
|
case "between":
|
|
2626
2916
|
case "notbetween": {
|
|
2627
2917
|
const valueAsArray = toArray(value);
|
|
@@ -2792,10 +3082,9 @@ const defaultRuleProcessorNL = (rule, opts) => {
|
|
|
2792
3082
|
}));
|
|
2793
3083
|
const operatorLC = lc(operator);
|
|
2794
3084
|
if ((operatorLC === "in" || operatorLC === "notin" || operatorLC === "between" || operatorLC === "notbetween") && !value) return "";
|
|
2795
|
-
const processedOperator = operatorProcessor(rule, opts);
|
|
2796
3085
|
const wordOrderMap = {
|
|
2797
3086
|
S: processedField,
|
|
2798
|
-
V:
|
|
3087
|
+
V: operatorProcessor(rule, opts),
|
|
2799
3088
|
O: value
|
|
2800
3089
|
};
|
|
2801
3090
|
return normalizeConstituentWordOrder(wordOrder).map((term) => `${wordOrderMap[term]}`).join(" ").trim();
|
|
@@ -3560,6 +3849,30 @@ const getValueSourcesUtil = (fieldData, operator, getValueSources) => {
|
|
|
3560
3849
|
});
|
|
3561
3850
|
};
|
|
3562
3851
|
|
|
3852
|
+
//#endregion
|
|
3853
|
+
//#region src/utils/mergeAnyTranslations.ts
|
|
3854
|
+
/**
|
|
3855
|
+
* Merges any number of partial translations into a single definition.
|
|
3856
|
+
*/
|
|
3857
|
+
const mergeAnyTranslations = (base, ...otherTranslations) => produce(base, (draft) => {
|
|
3858
|
+
for (const translations of otherTranslations)
|
|
3859
|
+
// istanbul ignore else
|
|
3860
|
+
if (translations) for (const t of objectKeys(translations)) if (draft[t]) Object.assign(draft[t], translations[t]);
|
|
3861
|
+
else Object.assign(draft, { [t]: translations[t] });
|
|
3862
|
+
});
|
|
3863
|
+
const mergeAnyTranslation = (el, keyPropContextMap, defaults) => {
|
|
3864
|
+
const finalKeys = objectEntries(keyPropContextMap).map(([key, [pT, cT]]) => {
|
|
3865
|
+
var _ref, _defaults$el;
|
|
3866
|
+
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]];
|
|
3867
|
+
}).filter((k) => !!k[1]);
|
|
3868
|
+
if (finalKeys.length > 0 || defaults) {
|
|
3869
|
+
var _defaults$el2;
|
|
3870
|
+
const defaultProperties = (_defaults$el2 = defaults === null || defaults === void 0 ? void 0 : defaults[el]) !== null && _defaults$el2 !== void 0 ? _defaults$el2 : {};
|
|
3871
|
+
const finalObject = Object.assign({}, defaultProperties, Object.fromEntries(finalKeys));
|
|
3872
|
+
return { [el]: finalObject };
|
|
3873
|
+
}
|
|
3874
|
+
};
|
|
3875
|
+
|
|
3563
3876
|
//#endregion
|
|
3564
3877
|
//#region src/utils/mergeClassnames.ts
|
|
3565
3878
|
const joinClassnamesByName = (name, args) => clsx(args.map((c) => clsx(c === null || c === void 0 ? void 0 : c[name])));
|
|
@@ -3587,6 +3900,9 @@ const mergeClassnames = (...args) => ({
|
|
|
3587
3900
|
dragHandle: joinClassnamesByName("dragHandle", args),
|
|
3588
3901
|
lockRule: joinClassnamesByName("lockRule", args),
|
|
3589
3902
|
lockGroup: joinClassnamesByName("lockGroup", args),
|
|
3903
|
+
muteRule: joinClassnamesByName("muteRule", args),
|
|
3904
|
+
muteGroup: joinClassnamesByName("muteGroup", args),
|
|
3905
|
+
muted: joinClassnamesByName("muted", args),
|
|
3590
3906
|
valueSource: joinClassnamesByName("valueSource", args),
|
|
3591
3907
|
actionElement: joinClassnamesByName("actionElement", args),
|
|
3592
3908
|
valueSelector: joinClassnamesByName("valueSelector", args),
|
|
@@ -3606,21 +3922,6 @@ const mergeClassnames = (...args) => ({
|
|
|
3606
3922
|
hasSubQuery: joinClassnamesByName("hasSubQuery", args)
|
|
3607
3923
|
});
|
|
3608
3924
|
|
|
3609
|
-
//#endregion
|
|
3610
|
-
//#region src/utils/objectUtils.ts
|
|
3611
|
-
/**
|
|
3612
|
-
* A strongly-typed version of `Object.keys()`.
|
|
3613
|
-
*
|
|
3614
|
-
* [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-keys.ts)
|
|
3615
|
-
*/
|
|
3616
|
-
const objectKeys = Object.keys;
|
|
3617
|
-
/**
|
|
3618
|
-
* A strongly-typed version of `Object.entries()`.
|
|
3619
|
-
*
|
|
3620
|
-
* [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-entries.ts)
|
|
3621
|
-
*/
|
|
3622
|
-
const objectEntries = Object.entries;
|
|
3623
|
-
|
|
3624
3925
|
//#endregion
|
|
3625
3926
|
//#region src/utils/prepareQueryObjects.ts
|
|
3626
3927
|
/**
|
|
@@ -3722,12 +4023,11 @@ const update = (query, prop, value, pathOrID, { resetOnFieldChange = true, reset
|
|
|
3722
4023
|
resetValueSource = true;
|
|
3723
4024
|
resetValue = true;
|
|
3724
4025
|
}
|
|
3725
|
-
const
|
|
4026
|
+
const defaultValueSource = getFirstOption(getValueSourcesUtil({
|
|
3726
4027
|
name: ruleOrGroup.field,
|
|
3727
4028
|
value: ruleOrGroup.field,
|
|
3728
4029
|
label: ""
|
|
3729
|
-
}, ruleOrGroup.operator, getValueSources);
|
|
3730
|
-
const defaultValueSource = getFirstOption(valueSources);
|
|
4030
|
+
}, ruleOrGroup.operator, getValueSources));
|
|
3731
4031
|
if (resetValueSource && ruleOrGroup.valueSource && defaultValueSource !== ruleOrGroup.valueSource || prop === "valueSource" && value !== ruleOrGroup.valueSource) {
|
|
3732
4032
|
resetValue = !!ruleOrGroup.valueSource || !ruleOrGroup.valueSource && value !== defaultValueSource;
|
|
3733
4033
|
ruleOrGroup.valueSource = resetValueSource ? defaultValueSource : value;
|
|
@@ -3772,8 +4072,7 @@ const getNextPath = (query, currentPath, newPathOrShiftDirection) => {
|
|
|
3772
4072
|
return [...getParentPath(parentPath), parentPath.at(-1) + 1];
|
|
3773
4073
|
} else {
|
|
3774
4074
|
const evaluationPath = [...getParentPath(currentPath), currentPath.at(-1) + (ic ? 2 : 1)];
|
|
3775
|
-
|
|
3776
|
-
if (isRuleGroup(entityToEvaluate)) return [...evaluationPath, 0];
|
|
4075
|
+
if (isRuleGroup(findPath(evaluationPath, query))) return [...evaluationPath, 0];
|
|
3777
4076
|
else return [...getParentPath(currentPath), currentPath.at(-1) + (ic ? 3 : 2)];
|
|
3778
4077
|
}
|
|
3779
4078
|
return currentPath;
|
|
@@ -3807,8 +4106,7 @@ const move = (query, oldPathOrID, newPath, { clone = false, combinators = defaul
|
|
|
3807
4106
|
const newNewPath = [...nextPath];
|
|
3808
4107
|
const commonAncestorPath = getCommonAncestorPath(oldPath, nextPath);
|
|
3809
4108
|
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);
|
|
4109
|
+
const parentToInsertInto = findPath(getParentPath(newNewPath), draft);
|
|
3812
4110
|
const newIndex = newNewPath.at(-1);
|
|
3813
4111
|
/**
|
|
3814
4112
|
* This function 1) glosses over the need for type assertions to splice directly
|
|
@@ -3819,14 +4117,12 @@ const move = (query, oldPathOrID, newPath, { clone = false, combinators = defaul
|
|
|
3819
4117
|
else if (newIndex === 0) if (ruleToRemoveIndex === 0 && oldNextCombinator) insertRuleOrGroup(ruleOrGroup, oldNextCombinator);
|
|
3820
4118
|
else {
|
|
3821
4119
|
var _ref, _parentToInsertInto$r;
|
|
3822
|
-
|
|
3823
|
-
insertRuleOrGroup(ruleOrGroup, newNextCombinator);
|
|
4120
|
+
insertRuleOrGroup(ruleOrGroup, (_ref = (_parentToInsertInto$r = parentToInsertInto.rules[1]) !== null && _parentToInsertInto$r !== void 0 ? _parentToInsertInto$r : oldPrevCombinator) !== null && _ref !== void 0 ? _ref : getFirstOption(combinators));
|
|
3824
4121
|
}
|
|
3825
4122
|
else if (oldPrevCombinator) insertRuleOrGroup(oldPrevCombinator, ruleOrGroup);
|
|
3826
4123
|
else {
|
|
3827
4124
|
var _ref2, _parentToInsertInto$r2;
|
|
3828
|
-
|
|
3829
|
-
insertRuleOrGroup(newPrevCombinator, ruleOrGroup);
|
|
4125
|
+
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
4126
|
}
|
|
3831
4127
|
});
|
|
3832
4128
|
};
|
|
@@ -3854,16 +4150,14 @@ const insert = (query, ruleOrGroup, path, { combinators = defaultCombinators, co
|
|
|
3854
4150
|
if (((_rorg$path = rorg.path) === null || _rorg$path === void 0 ? void 0 : _rorg$path.at(-1)) === 0 && combinatorSucceeding) insertRuleOrGroup(newIndex, rorg, combinatorSucceeding);
|
|
3855
4151
|
else {
|
|
3856
4152
|
var _ref3, _parentToInsertInto$r3;
|
|
3857
|
-
|
|
3858
|
-
insertRuleOrGroup(newIndex, rorg, newNextCombinator);
|
|
4153
|
+
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
4154
|
}
|
|
3860
4155
|
} else {
|
|
3861
4156
|
const normalizedNewIndex = newIndex % 2 === 0 ? newIndex - 1 : newIndex;
|
|
3862
4157
|
if (combinatorPreceding) insertRuleOrGroup(normalizedNewIndex, combinatorPreceding, rorg);
|
|
3863
4158
|
else {
|
|
3864
4159
|
var _ref4, _parentToInsertInto$r4;
|
|
3865
|
-
|
|
3866
|
-
insertRuleOrGroup(normalizedNewIndex, newPrevCombinator, rorg);
|
|
4160
|
+
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
4161
|
}
|
|
3868
4162
|
}
|
|
3869
4163
|
});
|
|
@@ -3898,8 +4192,7 @@ const group = (query, sourcePathOrID, targetPathOrID, { clone = false, combinato
|
|
|
3898
4192
|
const newNewPath = [...nextPath];
|
|
3899
4193
|
const commonAncestorPath = getCommonAncestorPath(sourcePath, nextPath);
|
|
3900
4194
|
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);
|
|
4195
|
+
const parentOfTargetPath = findPath(getParentPath(newNewPath), draft);
|
|
3903
4196
|
const targetPathIndex = newNewPath.at(-1);
|
|
3904
4197
|
parentOfTargetPath.rules.splice(targetPathIndex, 1, prepareRuleOrGroup(independentCombinators ? { rules: [
|
|
3905
4198
|
targetRuleOrGroup,
|
|
@@ -3913,5 +4206,5 @@ const group = (query, sourcePathOrID, targetPathOrID, { clone = false, combinato
|
|
|
3913
4206
|
};
|
|
3914
4207
|
|
|
3915
4208
|
//#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 };
|
|
4209
|
+
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, prepareOptionList, 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 };
|
|
3917
4210
|
//# sourceMappingURL=react-querybuilder_core.legacy-esm.js.map
|