@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.
Files changed (111) hide show
  1. package/dist/{arrayUtils-BF1P8iHS.mjs → arrayUtils-C9sO4qLO.mjs} +3 -75
  2. package/dist/arrayUtils-C9sO4qLO.mjs.map +1 -0
  3. package/dist/arrayUtils-QxZOZTf6.js +73 -0
  4. package/dist/arrayUtils-QxZOZTf6.js.map +1 -0
  5. package/dist/basic-BmpEwexQ.d.mts +363 -0
  6. package/dist/basic-CDDA-KZa.d.ts +363 -0
  7. package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +553 -1247
  8. package/dist/cjs/react-querybuilder_core.cjs.development.js +408 -121
  9. package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
  10. package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +553 -1247
  11. package/dist/cjs/react-querybuilder_core.cjs.production.js +1 -1
  12. package/dist/cjs/react-querybuilder_core.cjs.production.js.map +1 -1
  13. package/dist/{convertQuery-H7RhQiIc.mjs → convertQuery-BUgyz1GA.mjs} +2 -2
  14. package/dist/{convertQuery-H7RhQiIc.mjs.map → convertQuery-BUgyz1GA.mjs.map} +1 -1
  15. package/dist/{export-r-V7bU31.d.mts → export-Ccjfea21.d.mts} +3 -2
  16. package/dist/{export-DyrnTh6K.d.ts → export-GUuxJ7zR.d.ts} +3 -2
  17. package/dist/formatQuery.d.mts +3 -2
  18. package/dist/formatQuery.d.ts +3 -2
  19. package/dist/formatQuery.js +217 -87
  20. package/dist/formatQuery.js.map +1 -1
  21. package/dist/formatQuery.mjs +217 -87
  22. package/dist/formatQuery.mjs.map +1 -1
  23. package/dist/{import-Cksobmln.d.ts → import-D-hm1phN.d.ts} +2 -2
  24. package/dist/{import-BwbbP4oU.d.mts → import-Dxevzw_-.d.mts} +2 -2
  25. package/dist/{isRuleGroup-CnhYpLOM.mjs → isRuleGroup-CGe_rb2w.mjs} +1 -1
  26. package/dist/{isRuleGroup-CnhYpLOM.mjs.map → isRuleGroup-CGe_rb2w.mjs.map} +1 -1
  27. package/dist/{optGroupUtils-CXLgyg2i.js → optGroupUtils-B0hTpodo.js} +114 -1
  28. package/dist/optGroupUtils-B0hTpodo.js.map +1 -0
  29. package/dist/{optGroupUtils-Duv-M8rf.mjs → optGroupUtils-DrubUpx0.mjs} +86 -3
  30. package/dist/optGroupUtils-DrubUpx0.mjs.map +1 -0
  31. package/dist/parseCEL.d.mts +292 -11
  32. package/dist/parseCEL.d.ts +292 -11
  33. package/dist/parseCEL.js +114 -30
  34. package/dist/parseCEL.js.map +1 -1
  35. package/dist/parseCEL.mjs +69 -31
  36. package/dist/parseCEL.mjs.map +1 -1
  37. package/dist/parseJSONata.d.mts +3 -2
  38. package/dist/parseJSONata.d.ts +3 -2
  39. package/dist/parseJSONata.js +49 -77
  40. package/dist/parseJSONata.js.map +1 -1
  41. package/dist/parseJSONata.mjs +4 -5
  42. package/dist/parseJSONata.mjs.map +1 -1
  43. package/dist/parseJsonLogic.d.mts +4 -3
  44. package/dist/parseJsonLogic.d.ts +4 -3
  45. package/dist/parseJsonLogic.js +5 -6
  46. package/dist/parseJsonLogic.js.map +1 -1
  47. package/dist/parseJsonLogic.mjs +5 -6
  48. package/dist/parseJsonLogic.mjs.map +1 -1
  49. package/dist/parseMongoDB.d.mts +3 -2
  50. package/dist/parseMongoDB.d.ts +3 -2
  51. package/dist/parseMongoDB.js +15 -16
  52. package/dist/parseMongoDB.js.map +1 -1
  53. package/dist/parseMongoDB.mjs +5 -6
  54. package/dist/parseMongoDB.mjs.map +1 -1
  55. package/dist/{parseNumber-BtGKa58z.mjs → parseNumber-B_-sR6d5.mjs} +1 -1
  56. package/dist/{parseNumber-BtGKa58z.mjs.map → parseNumber-B_-sR6d5.mjs.map} +1 -1
  57. package/dist/{parseNumber-Bcys1kOH.js → parseNumber-D4iQDxK-.js} +1 -1
  58. package/dist/{parseNumber-Bcys1kOH.js.map → parseNumber-D4iQDxK-.js.map} +1 -1
  59. package/dist/parseSQL.d.mts +3 -2
  60. package/dist/parseSQL.d.ts +3 -2
  61. package/dist/parseSQL.js +11 -15
  62. package/dist/parseSQL.js.map +1 -1
  63. package/dist/parseSQL.mjs +12 -16
  64. package/dist/parseSQL.mjs.map +1 -1
  65. package/dist/parseSpEL.d.mts +3 -2
  66. package/dist/parseSpEL.d.ts +3 -2
  67. package/dist/parseSpEL.js +7 -9
  68. package/dist/parseSpEL.js.map +1 -1
  69. package/dist/parseSpEL.mjs +5 -6
  70. package/dist/parseSpEL.mjs.map +1 -1
  71. package/dist/{prepareQueryObjects-BqFEs4eV.js → prepareQueryObjects-BOUWfel5.js} +4 -5
  72. package/dist/prepareQueryObjects-BOUWfel5.js.map +1 -0
  73. package/dist/{prepareQueryObjects-CS6Wmhmf.mjs → prepareQueryObjects-CJNpnGcJ.mjs} +5 -6
  74. package/dist/prepareQueryObjects-CJNpnGcJ.mjs.map +1 -0
  75. package/dist/query-builder-layout.css +1 -1
  76. package/dist/query-builder-layout.css.map +1 -1
  77. package/dist/query-builder.css +1 -1
  78. package/dist/query-builder.css.map +1 -1
  79. package/dist/react-querybuilder_core.d.mts +553 -1247
  80. package/dist/react-querybuilder_core.legacy-esm.d.ts +553 -1247
  81. package/dist/react-querybuilder_core.legacy-esm.js +412 -119
  82. package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
  83. package/dist/react-querybuilder_core.mjs +405 -122
  84. package/dist/react-querybuilder_core.mjs.map +1 -1
  85. package/dist/react-querybuilder_core.production.d.mts +553 -1247
  86. package/dist/react-querybuilder_core.production.mjs +1 -1
  87. package/dist/react-querybuilder_core.production.mjs.map +1 -1
  88. package/dist/styles/_layout.scss +61 -17
  89. package/dist/styles/_main.scss +17 -4
  90. package/dist/{transformQuery-FL_nlpp5.js → transformQuery-CWDPogO5.js} +1 -1
  91. package/dist/{transformQuery-FL_nlpp5.js.map → transformQuery-CWDPogO5.js.map} +1 -1
  92. package/dist/{transformQuery-DdMvmrCh.mjs → transformQuery-DHvtgDgZ.mjs} +2 -2
  93. package/dist/{transformQuery-DdMvmrCh.mjs.map → transformQuery-DHvtgDgZ.mjs.map} +1 -1
  94. package/dist/transformQuery.d.mts +1 -1
  95. package/dist/transformQuery.d.ts +1 -1
  96. package/dist/transformQuery.js +1 -1
  97. package/dist/transformQuery.mjs +2 -2
  98. package/package.json +14 -12
  99. package/dist/arrayUtils-BF1P8iHS.mjs.map +0 -1
  100. package/dist/arrayUtils-D5EoIsKP.js +0 -164
  101. package/dist/arrayUtils-D5EoIsKP.js.map +0 -1
  102. package/dist/basic-BfD-7CN3.d.mts +0 -1235
  103. package/dist/basic-C8xXKHIA.d.ts +0 -1235
  104. package/dist/objectUtils-BBZSfZJz.js +0 -17
  105. package/dist/objectUtils-BBZSfZJz.js.map +0 -1
  106. package/dist/objectUtils-BtWdcZVG.mjs +0 -11
  107. package/dist/objectUtils-BtWdcZVG.mjs.map +0 -1
  108. package/dist/optGroupUtils-CXLgyg2i.js.map +0 -1
  109. package/dist/optGroupUtils-Duv-M8rf.mjs.map +0 -1
  110. package/dist/prepareQueryObjects-BqFEs4eV.js.map +0 -1
  111. package/dist/prepareQueryObjects-CS6Wmhmf.mjs.map +0 -1
@@ -90,6 +90,108 @@ const defaultPlaceholderValueLabel = defaultPlaceholderLabel;
90
90
  */
91
91
  const defaultPlaceholderValueGroupLabel = defaultPlaceholderLabel;
92
92
  /**
93
+ * Default configuration of translatable strings.
94
+ *
95
+ * @group Defaults
96
+ */
97
+ const defaultTranslations = {
98
+ fields: {
99
+ title: "Field",
100
+ placeholderName: defaultPlaceholderFieldName,
101
+ placeholderLabel: defaultPlaceholderFieldLabel,
102
+ placeholderGroupLabel: defaultPlaceholderFieldGroupLabel
103
+ },
104
+ operators: {
105
+ title: "Operator",
106
+ placeholderName: defaultPlaceholderOperatorName,
107
+ placeholderLabel: defaultPlaceholderOperatorLabel,
108
+ placeholderGroupLabel: defaultPlaceholderOperatorGroupLabel
109
+ },
110
+ values: {
111
+ title: "Values",
112
+ placeholderName: defaultPlaceholderValueName,
113
+ placeholderLabel: defaultPlaceholderValueLabel,
114
+ placeholderGroupLabel: defaultPlaceholderValueGroupLabel
115
+ },
116
+ matchMode: { title: "Match mode" },
117
+ matchThreshold: { title: "Match threshold" },
118
+ value: { title: "Value" },
119
+ removeRule: {
120
+ label: "⨯",
121
+ title: "Remove rule"
122
+ },
123
+ removeGroup: {
124
+ label: "⨯",
125
+ title: "Remove group"
126
+ },
127
+ addRule: {
128
+ label: "+ Rule",
129
+ title: "Add rule"
130
+ },
131
+ addGroup: {
132
+ label: "+ Group",
133
+ title: "Add group"
134
+ },
135
+ combinators: { title: "Combinator" },
136
+ notToggle: {
137
+ label: "Not",
138
+ title: "Invert this group"
139
+ },
140
+ cloneRule: {
141
+ label: "⧉",
142
+ title: "Clone rule"
143
+ },
144
+ cloneRuleGroup: {
145
+ label: "⧉",
146
+ title: "Clone group"
147
+ },
148
+ shiftActionUp: {
149
+ label: "˄",
150
+ title: "Shift up"
151
+ },
152
+ shiftActionDown: {
153
+ label: "˅",
154
+ title: "Shift down"
155
+ },
156
+ dragHandle: {
157
+ label: "⁞⁞",
158
+ title: "Drag handle"
159
+ },
160
+ lockRule: {
161
+ label: "🔓",
162
+ title: "Lock rule"
163
+ },
164
+ lockGroup: {
165
+ label: "🔓",
166
+ title: "Lock group"
167
+ },
168
+ lockRuleDisabled: {
169
+ label: "🔒",
170
+ title: "Unlock rule"
171
+ },
172
+ lockGroupDisabled: {
173
+ label: "🔒",
174
+ title: "Unlock group"
175
+ },
176
+ muteRule: {
177
+ label: "🔊",
178
+ title: "Mute rule"
179
+ },
180
+ muteGroup: {
181
+ label: "🔊",
182
+ title: "Mute group"
183
+ },
184
+ unmuteRule: {
185
+ label: "🔇",
186
+ title: "Unmute rule"
187
+ },
188
+ unmuteGroup: {
189
+ label: "🔇",
190
+ title: "Unmute group"
191
+ },
192
+ valueSourceSelector: { title: "Value source" }
193
+ };
194
+ /**
93
195
  * Default character used to `.join` and `.split` arrays.
94
196
  *
95
197
  * @group Defaults
@@ -338,8 +440,11 @@ const standardClassnames = {
338
440
  dndDropNotAllowed: "dndDropNotAllowed",
339
441
  dragHandle: "queryBuilder-dragHandle",
340
442
  disabled: "queryBuilder-disabled",
443
+ muted: "queryBuilder-muted",
341
444
  lockRule: "rule-lock",
342
445
  lockGroup: "ruleGroup-lock",
446
+ muteRule: "rule-mute",
447
+ muteGroup: "ruleGroup-mute",
343
448
  valueSource: "rule-valueSource",
344
449
  valueListItem: "rule-value-list-item",
345
450
  branches: "queryBuilder-branches",
@@ -374,6 +479,9 @@ const defaultControlClassnames = {
374
479
  dragHandle: "",
375
480
  lockRule: "",
376
481
  lockGroup: "",
482
+ muteRule: "",
483
+ muteGroup: "",
484
+ muted: "",
377
485
  valueSource: "",
378
486
  actionElement: "",
379
487
  valueSelector: "",
@@ -424,6 +532,8 @@ const TestID = {
424
532
  dragHandle: "drag-handle",
425
533
  lockRule: "lock-rule",
426
534
  lockGroup: "lock-group",
535
+ muteRule: "mute-rule",
536
+ muteGroup: "mute-group",
427
537
  valueSourceSelector: "value-source-selector",
428
538
  matchModeEditor: "match-mode-editor"
429
539
  };
@@ -692,6 +802,21 @@ const defaultValidator = (query) => {
692
802
  return result;
693
803
  };
694
804
 
805
+ //#endregion
806
+ //#region src/utils/objectUtils.ts
807
+ /**
808
+ * A strongly-typed version of `Object.keys()`.
809
+ *
810
+ * [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-keys.ts)
811
+ */
812
+ const objectKeys = Object.keys;
813
+ /**
814
+ * A strongly-typed version of `Object.entries()`.
815
+ *
816
+ * [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-entries.ts)
817
+ */
818
+ const objectEntries = Object.entries;
819
+
695
820
  //#endregion
696
821
  //#region src/utils/optGroupUtils.ts
697
822
  const isOptionWithName = (opt) => isPojo(opt) && "name" in opt && typeof opt.name === "string";
@@ -868,6 +993,42 @@ const uniqOptList = (originalArray) => {
868
993
  if (isFlexibleOptionGroupArray(originalArray)) return uniqOptGroups(originalArray);
869
994
  return uniqByIdentifier(originalArray.map((o) => toFullOption(o)));
870
995
  };
996
+ const prepareOptionList = (props) => {
997
+ // istanbul ignore next
998
+ const { optionList: optionListPropOriginal, baseOption = {}, labelMap = {}, placeholder: { placeholderName = defaultPlaceholderName, placeholderLabel = defaultPlaceholderLabel, placeholderGroupLabel = defaultPlaceholderLabel } = {}, autoSelectOption = true } = props;
999
+ const defaultOption = {
1000
+ id: placeholderName,
1001
+ name: placeholderName,
1002
+ value: placeholderName,
1003
+ label: placeholderLabel
1004
+ };
1005
+ const optionsProp = optionListPropOriginal ?? [defaultOption];
1006
+ let optionList = [];
1007
+ const opts = Array.isArray(optionsProp) ? toFullOptionList(optionsProp, baseOption, labelMap) : objectKeys(toFullOptionMap(optionsProp, baseOption)).map((opt) => ({
1008
+ ...optionsProp[opt],
1009
+ name: opt,
1010
+ value: opt
1011
+ })).sort((a, b) => a.label.localeCompare(b.label));
1012
+ if (isFlexibleOptionGroupArray(opts)) optionList = autoSelectOption ? uniqOptGroups(opts) : uniqOptGroups([{
1013
+ label: placeholderGroupLabel,
1014
+ options: [defaultOption]
1015
+ }, ...opts]);
1016
+ else optionList = autoSelectOption ? uniqByIdentifier(opts) : uniqByIdentifier([defaultOption, ...opts]);
1017
+ let optionsMap = {};
1018
+ if (!Array.isArray(optionsProp)) {
1019
+ const op = toFullOptionMap(optionsProp, baseOption);
1020
+ optionsMap = autoSelectOption ? op : {
1021
+ ...op,
1022
+ [placeholderName]: defaultOption
1023
+ };
1024
+ } else if (isFlexibleOptionGroupArray(optionList)) for (const og of optionList) for (const opt of og.options) optionsMap[opt.value ?? opt.name] = toFullOption(opt, baseOption);
1025
+ else for (const opt of optionList) optionsMap[opt.value ?? opt.name] = toFullOption(opt, baseOption);
1026
+ return {
1027
+ defaultOption,
1028
+ optionList,
1029
+ optionsMap
1030
+ };
1031
+ };
871
1032
 
872
1033
  //#endregion
873
1034
  //#region src/utils/filterFieldsByComparator.ts
@@ -969,9 +1130,11 @@ function transformQuery(query, options = {}) {
969
1130
  const isValidationResult = (vr) => isPojo(vr) && typeof vr.valid === "boolean";
970
1131
  /**
971
1132
  * Determines if a rule or group is valid based on a validation result (if defined)
972
- * or a validator function. Returns `true` if neither are defined.
1133
+ * or a validator function. Returns `true` if neither are defined and the `muted`
1134
+ * property is not `true`.
973
1135
  */
974
1136
  const isRuleOrGroupValid = (rg, validationResult, validator) => {
1137
+ if (rg.muted) return false;
975
1138
  if (typeof validationResult === "boolean") return validationResult;
976
1139
  if (isValidationResult(validationResult)) return validationResult.valid;
977
1140
  if (typeof validator === "function" && !isRuleGroup(rg)) {
@@ -1245,19 +1408,45 @@ const defaultRuleGroupProcessorCEL = (ruleGroup, options) => {
1245
1408
  const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
1246
1409
  const processRuleGroup = (rg, outermost) => {
1247
1410
  if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermost ? fallbackExpression : "";
1248
- const expression = rg.rules.map((rule) => {
1249
- if (typeof rule === "string") return celCombinatorMap[rule];
1250
- if (isRuleGroup(rule)) return processRuleGroup(rule);
1411
+ const processedRules = [];
1412
+ let precedingCombinator = "";
1413
+ let firstRule = true;
1414
+ for (const rule of rg.rules) {
1415
+ if (typeof rule === "string") {
1416
+ precedingCombinator = celCombinatorMap[rule];
1417
+ continue;
1418
+ }
1419
+ if (isRuleGroup(rule)) {
1420
+ const processedGroup = processRuleGroup(rule);
1421
+ if (processedGroup) {
1422
+ if (!firstRule && precedingCombinator) {
1423
+ processedRules.push(precedingCombinator);
1424
+ precedingCombinator = "";
1425
+ }
1426
+ firstRule = false;
1427
+ processedRules.push(processedGroup);
1428
+ }
1429
+ continue;
1430
+ }
1251
1431
  const [validationResult, fieldValidator] = validateRule(rule);
1252
- if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName) return "";
1432
+ if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName) continue;
1253
1433
  const fieldData = getOption(fields, rule.field);
1254
- return ruleProcessor(rule, {
1434
+ const processedRule = ruleProcessor(rule, {
1255
1435
  ...options,
1256
1436
  parseNumbers: getParseNumberBoolean(fieldData?.inputType),
1257
1437
  escapeQuotes: (rule.valueSource ?? "value") === "value",
1258
1438
  fieldData
1259
1439
  });
1260
- }).filter(Boolean).join(isRuleGroupType(rg) ? ` ${celCombinatorMap[rg.combinator]} ` : " ");
1440
+ if (processedRule) {
1441
+ if (!firstRule && precedingCombinator) {
1442
+ processedRules.push(precedingCombinator);
1443
+ precedingCombinator = "";
1444
+ }
1445
+ firstRule = false;
1446
+ processedRules.push(processedRule);
1447
+ }
1448
+ }
1449
+ const expression = processedRules.join(isRuleGroupType(rg) ? ` ${celCombinatorMap[rg.combinator]} ` : " ");
1261
1450
  const [prefix, suffix] = rg.not || !outermost ? [`${rg.not ? "!" : ""}(`, ")"] : ["", ""];
1262
1451
  return expression ? `${prefix}${expression}${suffix}` : fallbackExpression;
1263
1452
  };
@@ -1284,11 +1473,10 @@ const defaultRuleProcessorCEL = (rule, opts = {}) => {
1284
1473
  else if (matchEval) {
1285
1474
  const { mode, threshold } = matchEval;
1286
1475
  const arrayElementAlias = "elem_alias";
1287
- const celQuery = transformQuery(rule.value, { ruleProcessor: (r) => ({
1476
+ const nestedArrayFilter = defaultRuleGroupProcessorCEL(transformQuery(rule.value, { ruleProcessor: (r) => ({
1288
1477
  ...r,
1289
1478
  field: `${arrayElementAlias}${r.field ? `.${r.field}` : ""}`
1290
- }) });
1291
- const nestedArrayFilter = defaultRuleGroupProcessorCEL(celQuery, opts);
1479
+ }) }), opts);
1292
1480
  switch (mode) {
1293
1481
  case "all": return `${field}.all(${arrayElementAlias}, ${nestedArrayFilter})`;
1294
1482
  case "none":
@@ -1322,8 +1510,7 @@ const defaultRuleProcessorCEL = (rule, opts = {}) => {
1322
1510
  case "in":
1323
1511
  case "notin": {
1324
1512
  const [prefix, suffix] = shouldNegate$2(operatorTL) ? ["!(", ")"] : ["", ""];
1325
- const valueAsArray = toArray(value);
1326
- return `${prefix}${field} in [${valueAsArray.map((val) => valueIsField || shouldRenderAsNumber(val, parseNumbers) ? `${trimIfString(val)}` : `"${escapeDoubleQuotes(val, escapeQuotes)}"`).join(", ")}]${suffix}`;
1513
+ return `${prefix}${field} in [${toArray(value).map((val) => valueIsField || shouldRenderAsNumber(val, parseNumbers) ? `${trimIfString(val)}` : `"${escapeDoubleQuotes(val, escapeQuotes)}"`).join(", ")}]${suffix}`;
1327
1514
  }
1328
1515
  case "between":
1329
1516
  case "notbetween": {
@@ -1543,19 +1730,45 @@ const defaultRuleGroupProcessorSpEL = (ruleGroup, options) => {
1543
1730
  const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
1544
1731
  const processRuleGroup = (rg, outermost) => {
1545
1732
  if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermost ? fallbackExpression : "";
1546
- const expression = rg.rules.map((rule) => {
1547
- if (typeof rule === "string") return rule;
1548
- if (isRuleGroup(rule)) return processRuleGroup(rule);
1733
+ const processedRules = [];
1734
+ let precedingCombinator = "";
1735
+ let firstRule = true;
1736
+ for (const rule of rg.rules) {
1737
+ if (typeof rule === "string") {
1738
+ precedingCombinator = rule;
1739
+ continue;
1740
+ }
1741
+ if (isRuleGroup(rule)) {
1742
+ const processedGroup = processRuleGroup(rule);
1743
+ if (processedGroup) {
1744
+ if (!firstRule && precedingCombinator) {
1745
+ processedRules.push(precedingCombinator);
1746
+ precedingCombinator = "";
1747
+ }
1748
+ firstRule = false;
1749
+ processedRules.push(processedGroup);
1750
+ }
1751
+ continue;
1752
+ }
1549
1753
  const [validationResult, fieldValidator] = validateRule(rule);
1550
- if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName) return "";
1754
+ if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName) continue;
1551
1755
  const fieldData = getOption(fields, rule.field);
1552
- return ruleProcessor(rule, {
1756
+ const processedRule = ruleProcessor(rule, {
1553
1757
  ...options,
1554
1758
  parseNumbers: getParseNumberBoolean(fieldData?.inputType),
1555
1759
  escapeQuotes: (rule.valueSource ?? "value") === "value",
1556
1760
  fieldData
1557
1761
  });
1558
- }).filter(Boolean).join(isRuleGroupType(rg) ? ` ${rg.combinator} ` : " ");
1762
+ if (processedRule) {
1763
+ if (!firstRule && precedingCombinator) {
1764
+ processedRules.push(precedingCombinator);
1765
+ precedingCombinator = "";
1766
+ }
1767
+ firstRule = false;
1768
+ processedRules.push(processedRule);
1769
+ }
1770
+ }
1771
+ const expression = processedRules.join(isRuleGroupType(rg) ? ` ${rg.combinator} ` : " ");
1559
1772
  const [prefix, suffix] = rg.not || !outermost ? [`${rg.not ? "!" : ""}(`, ")"] : ["", ""];
1560
1773
  return expression ? `${prefix}${expression}${suffix}` : fallbackExpression;
1561
1774
  };
@@ -1611,15 +1824,9 @@ const defaultRuleProcessorSpEL = (rule, opts = {}) => {
1611
1824
  case "contains":
1612
1825
  case "doesnotcontain": return wrapInNegation(`${field} matches ${valueIsField || useBareValue ? trimIfString(value) : `'${escapeSingleQuotes(value, escapeQuotes)}'`}`, shouldNegate$1(operatorTL));
1613
1826
  case "beginswith":
1614
- case "doesnotbeginwith": {
1615
- const valueTL = valueIsField ? `'^'.concat(${trimIfString(value)})` : `'${typeof value === "string" && !value.startsWith("^") || useBareValue ? "^" : ""}${escapeSingleQuotes(value, escapeQuotes)}'`;
1616
- return wrapInNegation(`${field} matches ${valueTL}`, shouldNegate$1(operatorTL));
1617
- }
1827
+ case "doesnotbeginwith": return wrapInNegation(`${field} matches ${valueIsField ? `'^'.concat(${trimIfString(value)})` : `'${typeof value === "string" && !value.startsWith("^") || useBareValue ? "^" : ""}${escapeSingleQuotes(value, escapeQuotes)}'`}`, shouldNegate$1(operatorTL));
1618
1828
  case "endswith":
1619
- case "doesnotendwith": {
1620
- const valueTL = valueIsField ? `${trimIfString(value)}.concat('$')` : `'${escapeSingleQuotes(value, escapeQuotes)}${typeof value === "string" && !value.endsWith("$") || useBareValue ? "$" : ""}'`;
1621
- return wrapInNegation(`${field} matches ${valueTL}`, shouldNegate$1(operatorTL));
1622
- }
1829
+ case "doesnotendwith": return wrapInNegation(`${field} matches ${valueIsField ? `${trimIfString(value)}.concat('$')` : `'${escapeSingleQuotes(value, escapeQuotes)}${typeof value === "string" && !value.endsWith("$") || useBareValue ? "$" : ""}'`}`, shouldNegate$1(operatorTL));
1623
1830
  case "null": return `${field} == null`;
1624
1831
  case "notnull": return `${field} != null`;
1625
1832
  case "in":
@@ -1732,11 +1939,10 @@ const defaultRuleProcessorDrizzle = (rule, _options) => {
1732
1939
  if (opts.preset !== "postgresql") return;
1733
1940
  const { mode, threshold } = matchEval;
1734
1941
  const arrayElementAlias = "elem_alias";
1735
- const sqlQuery = transformQuery(rule.value, { ruleProcessor: (r) => ({
1942
+ const nestedArrayFilter = defaultRuleGroupProcessorDrizzle(transformQuery(rule.value, { ruleProcessor: (r) => ({
1736
1943
  ...r,
1737
1944
  field: arrayElementAlias
1738
- }) });
1739
- const nestedArrayFilter = defaultRuleGroupProcessorDrizzle(sqlQuery, {
1945
+ }) }), {
1740
1946
  ...opts,
1741
1947
  context: {
1742
1948
  ...opts.context,
@@ -1822,7 +2028,6 @@ const defaultRuleGroupProcessorDrizzle = (ruleGroup, options, _meta) => (columns
1822
2028
  const { fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, validateRule, validationMap } = options;
1823
2029
  if (!columns || !drizzleOperators) return;
1824
2030
  const { and, not, or } = drizzleOperators;
1825
- const query = isRuleGroupType(ruleGroup) ? ruleGroup : convertFromIC(ruleGroup);
1826
2031
  const ruleProcessor = defaultRuleProcessorDrizzle;
1827
2032
  const processRuleGroup = (rg, _outermost) => {
1828
2033
  if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return;
@@ -1846,7 +2051,7 @@ const defaultRuleGroupProcessorDrizzle = (ruleGroup, options, _meta) => (columns
1846
2051
  const ruleGroupSQL = rg.combinator === "or" ? or(...processedRules) : and(...processedRules);
1847
2052
  return rg.not ? not(ruleGroupSQL) : ruleGroupSQL;
1848
2053
  };
1849
- return processRuleGroup(query, true);
2054
+ return processRuleGroup(convertFromIC(ruleGroup), true);
1850
2055
  };
1851
2056
 
1852
2057
  //#endregion
@@ -1858,7 +2063,6 @@ const defaultRuleGroupProcessorDrizzle = (ruleGroup, options, _meta) => (columns
1858
2063
  */
1859
2064
  const defaultRuleGroupProcessorElasticSearch = (ruleGroup, options) => {
1860
2065
  const { fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
1861
- const query = convertFromIC(ruleGroup);
1862
2066
  const processRuleGroup = (rg) => {
1863
2067
  if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return false;
1864
2068
  const processedRules = rg.rules.map((rule) => {
@@ -1875,7 +2079,7 @@ const defaultRuleGroupProcessorElasticSearch = (ruleGroup, options) => {
1875
2079
  if (processedRules.length === 0) return false;
1876
2080
  return { bool: rg.not ? { must_not: /^or$/i.test(rg.combinator) ? { bool: { should: processedRules } } : processedRules } : { [/^or$/i.test(rg.combinator) ? "should" : "must"]: processedRules } };
1877
2081
  };
1878
- const processedRuleGroup = processRuleGroup(query);
2082
+ const processedRuleGroup = processRuleGroup(convertFromIC(ruleGroup));
1879
2083
  return processedRuleGroup === false ? {} : processedRuleGroup;
1880
2084
  };
1881
2085
 
@@ -1890,19 +2094,45 @@ const defaultRuleGroupProcessorJSONata = (ruleGroup, options) => {
1890
2094
  const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
1891
2095
  const processRuleGroup = (rg, outermost) => {
1892
2096
  if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermost ? fallbackExpression : "";
1893
- const expression = rg.rules.map((rule) => {
1894
- if (typeof rule === "string") return rule;
1895
- if (isRuleGroup(rule)) return processRuleGroup(rule);
2097
+ const processedRules = [];
2098
+ let precedingCombinator = "";
2099
+ let firstRule = true;
2100
+ for (const rule of rg.rules) {
2101
+ if (typeof rule === "string") {
2102
+ precedingCombinator = rule;
2103
+ continue;
2104
+ }
2105
+ if (isRuleGroup(rule)) {
2106
+ const processedGroup = processRuleGroup(rule);
2107
+ if (processedGroup) {
2108
+ if (!firstRule && precedingCombinator) {
2109
+ processedRules.push(precedingCombinator);
2110
+ precedingCombinator = "";
2111
+ }
2112
+ firstRule = false;
2113
+ processedRules.push(processedGroup);
2114
+ }
2115
+ continue;
2116
+ }
1896
2117
  const [validationResult, fieldValidator] = validateRule(rule);
1897
- if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName) return "";
2118
+ if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName) continue;
1898
2119
  const fieldData = getOption(fields, rule.field);
1899
- return ruleProcessor(rule, {
2120
+ const processedRule = ruleProcessor(rule, {
1900
2121
  ...options,
1901
2122
  parseNumbers: getParseNumberBoolean(fieldData?.inputType),
1902
2123
  escapeQuotes: (rule.valueSource ?? "value") === "value",
1903
2124
  fieldData
1904
2125
  });
1905
- }).filter(Boolean).join(isRuleGroupType(rg) ? ` ${rg.combinator} ` : " ");
2126
+ if (processedRule) {
2127
+ if (!firstRule && precedingCombinator) {
2128
+ processedRules.push(precedingCombinator);
2129
+ precedingCombinator = "";
2130
+ }
2131
+ firstRule = false;
2132
+ processedRules.push(processedRule);
2133
+ }
2134
+ }
2135
+ const expression = processedRules.join(isRuleGroupType(rg) ? ` ${rg.combinator} ` : " ");
1906
2136
  const [prefix, suffix] = rg.not || !outermost ? [`${rg.not ? "$not" : ""}(`, ")"] : ["", ""];
1907
2137
  return expression ? `${prefix}${expression}${suffix}` : fallbackExpression;
1908
2138
  };
@@ -1948,7 +2178,6 @@ const defaultRuleGroupProcessorJsonLogic = (ruleGroup, options) => {
1948
2178
  */
1949
2179
  const defaultRuleGroupProcessorLDAP = (ruleGroup, options) => {
1950
2180
  const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
1951
- const query = convertFromIC(ruleGroup);
1952
2181
  const processRuleGroup = (rg, outermost) => {
1953
2182
  if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermost ? fallbackExpression : "";
1954
2183
  const rules = rg.rules.map((rule) => {
@@ -1968,7 +2197,7 @@ const defaultRuleGroupProcessorLDAP = (ruleGroup, options) => {
1968
2197
  const [prefix, suffix] = rules.length > 1 ? [`${notPrefix}(${rg.combinator === "or" ? "|" : "&"}`, `)${notSuffix}`] : [notPrefix, notSuffix];
1969
2198
  return expression ? `${prefix}${expression}${suffix}` : fallbackExpression;
1970
2199
  };
1971
- return processRuleGroup(query, true);
2200
+ return processRuleGroup(convertFromIC(ruleGroup), true);
1972
2201
  };
1973
2202
 
1974
2203
  //#endregion
@@ -2023,20 +2252,46 @@ const defaultRuleGroupProcessorNL = (ruleGroup, options) => {
2023
2252
  const processRuleGroup = (rg, outermostOrLonelyInGroup) => {
2024
2253
  if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
2025
2254
  const rg2 = isRuleGroupTypeIC(rg) && rg.rules.some((r) => typeof r === "string" && lc(r) === "xor") ? convertFromIC(rg) : rg;
2026
- const processedRules = rg2.rules.map((rule) => {
2027
- if (typeof rule === "string") return `, ${translations[rule] ?? rule} `;
2028
- if (isRuleGroup(rule)) return processRuleGroup(rule, rg2.rules.length === 1 && !(rg2.not || /^xor$/i.test(rg2.combinator ?? "")));
2255
+ const processedRules = [];
2256
+ let precedingCombinator = "";
2257
+ let firstRule = true;
2258
+ for (const rule of rg2.rules) {
2259
+ if (typeof rule === "string") {
2260
+ precedingCombinator = `, ${translations[rule] ?? rule} `;
2261
+ continue;
2262
+ }
2263
+ if (isRuleGroup(rule)) {
2264
+ const processedGroup = processRuleGroup(rule, rg2.rules.length === 1 && !(rg2.not || /^xor$/i.test(rg2.combinator ?? "")));
2265
+ // istanbul ignore else
2266
+ if (processedGroup) {
2267
+ if (!firstRule && precedingCombinator) {
2268
+ processedRules.push(precedingCombinator);
2269
+ precedingCombinator = "";
2270
+ }
2271
+ firstRule = false;
2272
+ processedRules.push(processedGroup);
2273
+ }
2274
+ continue;
2275
+ }
2029
2276
  const [validationResult, fieldValidator] = validateRule(rule);
2030
- if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName) return "";
2277
+ if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName) continue;
2031
2278
  const escapeQuotes = (rule.valueSource ?? "value") === "value";
2032
2279
  const fieldData = getOption(fields, rule.field);
2033
- return ruleProcessor(rule, {
2280
+ const processedRule = ruleProcessor(rule, {
2034
2281
  ...options,
2035
2282
  parseNumbers: getParseNumberBoolean(fieldData?.inputType),
2036
2283
  escapeQuotes,
2037
2284
  fieldData
2038
2285
  });
2039
- });
2286
+ if (processedRule) {
2287
+ if (!firstRule && precedingCombinator) {
2288
+ processedRules.push(precedingCombinator);
2289
+ precedingCombinator = "";
2290
+ }
2291
+ firstRule = false;
2292
+ processedRules.push(processedRule);
2293
+ }
2294
+ }
2040
2295
  if (processedRules.length === 0) return fallbackExpression;
2041
2296
  const isXOR = lc(rg2.combinator ?? "") === "xor";
2042
2297
  const combinator = isXOR ? rg2.combinator.slice(1) : rg2.combinator;
@@ -2044,7 +2299,7 @@ const defaultRuleGroupProcessorNL = (ruleGroup, options) => {
2044
2299
  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));
2045
2300
  const prefix = mustWrap ? `${prefixTL} (`.trim() : "";
2046
2301
  const suffix = mustWrap ? `) ${suffixTL}`.trim() : "";
2047
- return `${prefix}${processedRules.filter(Boolean).join(isRuleGroupType(rg2) ? `, ${translations[combinator] ?? combinator} ` : "")}${suffix}`;
2302
+ return `${prefix}${processedRules.join(isRuleGroupType(rg2) ? `, ${translations[combinator] ?? combinator} ` : "")}${suffix}`;
2048
2303
  };
2049
2304
  return processRuleGroup(ruleGroup, true);
2050
2305
  };
@@ -2094,11 +2349,37 @@ const defaultRuleGroupProcessorParameterized = (ruleGroup, options) => {
2094
2349
  };
2095
2350
  const processRuleGroup = (rg, outermostOrLonelyInGroup) => {
2096
2351
  if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
2097
- const processedRules = rg.rules.map((rule) => {
2098
- if (typeof rule === "string") return rule;
2099
- if (isRuleGroup(rule)) return processRuleGroup(rule, rg.rules.length === 1);
2100
- return processRule(rule);
2101
- }).filter(Boolean);
2352
+ const processedRules = [];
2353
+ let precedingCombinator = "";
2354
+ let firstRule = true;
2355
+ for (const rule of rg.rules) {
2356
+ if (typeof rule === "string") {
2357
+ precedingCombinator = rule;
2358
+ continue;
2359
+ }
2360
+ if (isRuleGroup(rule)) {
2361
+ const processedGroup = processRuleGroup(rule, rg.rules.length === 1);
2362
+ // istanbul ignore else
2363
+ if (processedGroup) {
2364
+ if (!firstRule && precedingCombinator) {
2365
+ processedRules.push(precedingCombinator);
2366
+ precedingCombinator = "";
2367
+ }
2368
+ firstRule = false;
2369
+ processedRules.push(processedGroup);
2370
+ }
2371
+ continue;
2372
+ }
2373
+ const processedRule = processRule(rule);
2374
+ if (processedRule) {
2375
+ if (!firstRule && precedingCombinator) {
2376
+ processedRules.push(precedingCombinator);
2377
+ precedingCombinator = "";
2378
+ }
2379
+ firstRule = false;
2380
+ processedRules.push(processedRule);
2381
+ }
2382
+ }
2102
2383
  if (processedRules.length === 0) return fallbackExpression;
2103
2384
  return `${rg.not ? "NOT " : ""}(${processedRules.join(isRuleGroupType(rg) ? ` ${rg.combinator} ` : " ")})`;
2104
2385
  };
@@ -2207,20 +2488,46 @@ const defaultRuleGroupProcessorSQL = (ruleGroup, options) => {
2207
2488
  const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
2208
2489
  const processRuleGroup = (rg, outermostOrLonelyInGroup) => {
2209
2490
  if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
2210
- const processedRules = rg.rules.map((rule) => {
2211
- if (typeof rule === "string") return rule;
2212
- if (isRuleGroup(rule)) return processRuleGroup(rule, rg.rules.length === 1);
2491
+ const processedRules = [];
2492
+ let precedingCombinator = "";
2493
+ let firstRule = true;
2494
+ for (const rule of rg.rules) {
2495
+ if (typeof rule === "string") {
2496
+ precedingCombinator = rule;
2497
+ continue;
2498
+ }
2499
+ if (isRuleGroup(rule)) {
2500
+ const processedGroup = processRuleGroup(rule, rg.rules.length === 1);
2501
+ // istanbul ignore else
2502
+ if (processedGroup) {
2503
+ if (!firstRule && precedingCombinator) {
2504
+ processedRules.push(precedingCombinator);
2505
+ precedingCombinator = "";
2506
+ }
2507
+ firstRule = false;
2508
+ processedRules.push(processedGroup);
2509
+ }
2510
+ continue;
2511
+ }
2213
2512
  const [validationResult, fieldValidator] = validateRule(rule);
2214
- if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName) return "";
2513
+ if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName) continue;
2215
2514
  const escapeQuotes = (rule.valueSource ?? "value") === "value";
2216
2515
  const fieldData = getOption(fields, rule.field);
2217
- return ruleProcessor(rule, {
2516
+ const processedRule = ruleProcessor(rule, {
2218
2517
  ...options,
2219
2518
  parseNumbers: getParseNumberBoolean(fieldData?.inputType),
2220
2519
  escapeQuotes,
2221
2520
  fieldData
2222
2521
  });
2223
- }).filter(Boolean);
2522
+ if (processedRule) {
2523
+ if (!firstRule && precedingCombinator) {
2524
+ processedRules.push(precedingCombinator);
2525
+ precedingCombinator = "";
2526
+ }
2527
+ firstRule = false;
2528
+ processedRules.push(processedRule);
2529
+ }
2530
+ }
2224
2531
  if (processedRules.length === 0) return fallbackExpression;
2225
2532
  return `${rg.not ? "NOT " : ""}(${processedRules.join(isRuleGroupType(rg) ? ` ${rg.combinator} ` : " ")})`;
2226
2533
  };
@@ -2498,10 +2805,7 @@ const defaultRuleProcessorJsonLogic = (rule, options = {}) => {
2498
2805
  case "null":
2499
2806
  case "notnull": return { [`${operatorLC === "notnull" ? "!" : "="}=`]: [fieldObject, null] };
2500
2807
  case "in":
2501
- case "notin": {
2502
- const valueAsArray = toArray(value).map((v) => fieldOrNumberRenderer(v));
2503
- return negateIfNotOp(operatorLC, { in: [fieldObject, valueAsArray] });
2504
- }
2808
+ case "notin": return negateIfNotOp(operatorLC, { in: [fieldObject, toArray(value).map((v) => fieldOrNumberRenderer(v))] });
2505
2809
  case "between":
2506
2810
  case "notbetween": {
2507
2811
  const valueAsArray = toArray(value);
@@ -2532,20 +2836,11 @@ const defaultRuleProcessorJsonLogic = (rule, options = {}) => {
2532
2836
  return false;
2533
2837
  }
2534
2838
  case "contains":
2535
- case "doesnotcontain": {
2536
- const jsonRule = { in: [fieldOrNumberRenderer(value), fieldObject] };
2537
- return negateIfNotOp(operatorLC, jsonRule);
2538
- }
2839
+ case "doesnotcontain": return negateIfNotOp(operatorLC, { in: [fieldOrNumberRenderer(value), fieldObject] });
2539
2840
  case "beginswith":
2540
- case "doesnotbeginwith": {
2541
- const jsonRule = { startsWith: [fieldObject, fieldOrNumberRenderer(value)] };
2542
- return negateIfNotOp(operatorLC, jsonRule);
2543
- }
2841
+ case "doesnotbeginwith": return negateIfNotOp(operatorLC, { startsWith: [fieldObject, fieldOrNumberRenderer(value)] });
2544
2842
  case "endswith":
2545
- case "doesnotendwith": {
2546
- const jsonRule = { endsWith: [fieldObject, fieldOrNumberRenderer(value)] };
2547
- return negateIfNotOp(operatorLC, jsonRule);
2548
- }
2843
+ case "doesnotendwith": return negateIfNotOp(operatorLC, { endsWith: [fieldObject, fieldOrNumberRenderer(value)] });
2549
2844
  }
2550
2845
  return false;
2551
2846
  };
@@ -2580,10 +2875,7 @@ const defaultRuleProcessorLDAP = (rule, options = {}) => {
2580
2875
  case "null":
2581
2876
  case "notnull": return negateIf(`(${field}=*)`, operatorLC === "notnull");
2582
2877
  case "in":
2583
- case "notin": {
2584
- const valueAsArray = toArray(value);
2585
- return negateIf(`(|${valueAsArray.map((val) => `(${field}=${ldapEscape(val)})`).join("")})`, operatorLC === "notin");
2586
- }
2878
+ case "notin": return negateIf(`(|${toArray(value).map((val) => `(${field}=${ldapEscape(val)})`).join("")})`, operatorLC === "notin");
2587
2879
  case "between":
2588
2880
  case "notbetween": {
2589
2881
  const valueAsArray = toArray(value);
@@ -2751,10 +3043,9 @@ const defaultRuleProcessorNL = (rule, opts) => {
2751
3043
  });
2752
3044
  const operatorLC = lc(operator);
2753
3045
  if ((operatorLC === "in" || operatorLC === "notin" || operatorLC === "between" || operatorLC === "notbetween") && !value) return "";
2754
- const processedOperator = operatorProcessor(rule, opts);
2755
3046
  const wordOrderMap = {
2756
3047
  S: processedField,
2757
- V: processedOperator,
3048
+ V: operatorProcessor(rule, opts),
2758
3049
  O: value
2759
3050
  };
2760
3051
  return normalizeConstituentWordOrder(wordOrder).map((term) => `${wordOrderMap[term]}`).join(" ").trim();
@@ -3520,6 +3811,26 @@ const getValueSourcesUtil = (fieldData, operator, getValueSources) => {
3520
3811
  });
3521
3812
  };
3522
3813
 
3814
+ //#endregion
3815
+ //#region src/utils/mergeAnyTranslations.ts
3816
+ /**
3817
+ * Merges any number of partial translations into a single definition.
3818
+ */
3819
+ const mergeAnyTranslations = (base, ...otherTranslations) => (0, immer.produce)(base, (draft) => {
3820
+ for (const translations of otherTranslations)
3821
+ // istanbul ignore else
3822
+ if (translations) for (const t of objectKeys(translations)) if (draft[t]) Object.assign(draft[t], translations[t]);
3823
+ else Object.assign(draft, { [t]: translations[t] });
3824
+ });
3825
+ const mergeAnyTranslation = (el, keyPropContextMap, defaults) => {
3826
+ const finalKeys = objectEntries(keyPropContextMap).map(([key, [pT, cT]]) => [key, pT ?? cT ?? defaults?.[el]?.[key]]).filter((k) => !!k[1]);
3827
+ if (finalKeys.length > 0 || defaults) {
3828
+ const defaultProperties = defaults?.[el] ?? {};
3829
+ const finalObject = Object.assign({}, defaultProperties, Object.fromEntries(finalKeys));
3830
+ return { [el]: finalObject };
3831
+ }
3832
+ };
3833
+
3523
3834
  //#endregion
3524
3835
  //#region src/utils/mergeClassnames.ts
3525
3836
  const joinClassnamesByName = (name, args) => clsx(args.map((c) => clsx(c?.[name])));
@@ -3547,6 +3858,9 @@ const mergeClassnames = (...args) => ({
3547
3858
  dragHandle: joinClassnamesByName("dragHandle", args),
3548
3859
  lockRule: joinClassnamesByName("lockRule", args),
3549
3860
  lockGroup: joinClassnamesByName("lockGroup", args),
3861
+ muteRule: joinClassnamesByName("muteRule", args),
3862
+ muteGroup: joinClassnamesByName("muteGroup", args),
3863
+ muted: joinClassnamesByName("muted", args),
3550
3864
  valueSource: joinClassnamesByName("valueSource", args),
3551
3865
  actionElement: joinClassnamesByName("actionElement", args),
3552
3866
  valueSelector: joinClassnamesByName("valueSelector", args),
@@ -3566,21 +3880,6 @@ const mergeClassnames = (...args) => ({
3566
3880
  hasSubQuery: joinClassnamesByName("hasSubQuery", args)
3567
3881
  });
3568
3882
 
3569
- //#endregion
3570
- //#region src/utils/objectUtils.ts
3571
- /**
3572
- * A strongly-typed version of `Object.keys()`.
3573
- *
3574
- * [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-keys.ts)
3575
- */
3576
- const objectKeys = Object.keys;
3577
- /**
3578
- * A strongly-typed version of `Object.entries()`.
3579
- *
3580
- * [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-entries.ts)
3581
- */
3582
- const objectEntries = Object.entries;
3583
-
3584
3883
  //#endregion
3585
3884
  //#region src/utils/prepareQueryObjects.ts
3586
3885
  /**
@@ -3690,12 +3989,11 @@ const update = (query, prop, value, pathOrID, { resetOnFieldChange = true, reset
3690
3989
  resetValueSource = true;
3691
3990
  resetValue = true;
3692
3991
  }
3693
- const valueSources = getValueSourcesUtil({
3992
+ const defaultValueSource = getFirstOption(getValueSourcesUtil({
3694
3993
  name: ruleOrGroup.field,
3695
3994
  value: ruleOrGroup.field,
3696
3995
  label: ""
3697
- }, ruleOrGroup.operator, getValueSources);
3698
- const defaultValueSource = getFirstOption(valueSources);
3996
+ }, ruleOrGroup.operator, getValueSources));
3699
3997
  if (resetValueSource && ruleOrGroup.valueSource && defaultValueSource !== ruleOrGroup.valueSource || prop === "valueSource" && value !== ruleOrGroup.valueSource) {
3700
3998
  resetValue = !!ruleOrGroup.valueSource || !ruleOrGroup.valueSource && value !== defaultValueSource;
3701
3999
  ruleOrGroup.valueSource = resetValueSource ? defaultValueSource : value;
@@ -3740,8 +4038,7 @@ const getNextPath = (query, currentPath, newPathOrShiftDirection) => {
3740
4038
  return [...getParentPath(parentPath), parentPath.at(-1) + 1];
3741
4039
  } else {
3742
4040
  const evaluationPath = [...getParentPath(currentPath), currentPath.at(-1) + (ic ? 2 : 1)];
3743
- const entityToEvaluate = findPath(evaluationPath, query);
3744
- if (isRuleGroup(entityToEvaluate)) return [...evaluationPath, 0];
4041
+ if (isRuleGroup(findPath(evaluationPath, query))) return [...evaluationPath, 0];
3745
4042
  else return [...getParentPath(currentPath), currentPath.at(-1) + (ic ? 3 : 2)];
3746
4043
  }
3747
4044
  return currentPath;
@@ -3775,8 +4072,7 @@ const move = (query, oldPathOrID, newPath, { clone = false, combinators = defaul
3775
4072
  const newNewPath = [...nextPath];
3776
4073
  const commonAncestorPath = getCommonAncestorPath(oldPath, nextPath);
3777
4074
  if (!clone && oldPath.length === commonAncestorPath.length + 1 && nextPath[commonAncestorPath.length] > oldPath[commonAncestorPath.length]) newNewPath[commonAncestorPath.length] -= independentCombinators ? 2 : 1;
3778
- const newNewParentPath = getParentPath(newNewPath);
3779
- const parentToInsertInto = findPath(newNewParentPath, draft);
4075
+ const parentToInsertInto = findPath(getParentPath(newNewPath), draft);
3780
4076
  const newIndex = newNewPath.at(-1);
3781
4077
  /**
3782
4078
  * This function 1) glosses over the need for type assertions to splice directly
@@ -3785,15 +4081,9 @@ const move = (query, oldPathOrID, newPath, { clone = false, combinators = defaul
3785
4081
  const insertRuleOrGroup = (...args) => parentToInsertInto.rules.splice(newIndex, 0, ...args);
3786
4082
  if (parentToInsertInto.rules.length === 0 || !independentCombinators) insertRuleOrGroup(ruleOrGroup);
3787
4083
  else if (newIndex === 0) if (ruleToRemoveIndex === 0 && oldNextCombinator) insertRuleOrGroup(ruleOrGroup, oldNextCombinator);
3788
- else {
3789
- const newNextCombinator = parentToInsertInto.rules[1] ?? oldPrevCombinator ?? getFirstOption(combinators);
3790
- insertRuleOrGroup(ruleOrGroup, newNextCombinator);
3791
- }
4084
+ else insertRuleOrGroup(ruleOrGroup, parentToInsertInto.rules[1] ?? oldPrevCombinator ?? getFirstOption(combinators));
3792
4085
  else if (oldPrevCombinator) insertRuleOrGroup(oldPrevCombinator, ruleOrGroup);
3793
- else {
3794
- const newPrevCombinator = parentToInsertInto.rules[newIndex - 2] ?? oldNextCombinator ?? getFirstOption(combinators);
3795
- insertRuleOrGroup(newPrevCombinator, ruleOrGroup);
3796
- }
4086
+ else insertRuleOrGroup(parentToInsertInto.rules[newIndex - 2] ?? oldNextCombinator ?? getFirstOption(combinators), ruleOrGroup);
3797
4087
  });
3798
4088
  };
3799
4089
  /**
@@ -3816,17 +4106,11 @@ const insert = (query, ruleOrGroup, path, { combinators = defaultCombinators, co
3816
4106
  if (parentToInsertInto.rules.length === 0 || !independentCombinators) insertRuleOrGroup(newIndex, rorg);
3817
4107
  else if (replace && independentCombinators) insertRuleOrGroup(newIndex + newIndex % 2, rorg);
3818
4108
  else if (newIndex === 0) if (rorg.path?.at(-1) === 0 && combinatorSucceeding) insertRuleOrGroup(newIndex, rorg, combinatorSucceeding);
3819
- else {
3820
- const newNextCombinator = parentToInsertInto.rules[1] ?? combinatorPreceding ?? getFirstOption(combinators);
3821
- insertRuleOrGroup(newIndex, rorg, newNextCombinator);
3822
- }
4109
+ else insertRuleOrGroup(newIndex, rorg, parentToInsertInto.rules[1] ?? combinatorPreceding ?? getFirstOption(combinators));
3823
4110
  else {
3824
4111
  const normalizedNewIndex = newIndex % 2 === 0 ? newIndex - 1 : newIndex;
3825
4112
  if (combinatorPreceding) insertRuleOrGroup(normalizedNewIndex, combinatorPreceding, rorg);
3826
- else {
3827
- const newPrevCombinator = parentToInsertInto.rules[normalizedNewIndex - 2] ?? combinatorSucceeding ?? getFirstOption(combinators);
3828
- insertRuleOrGroup(normalizedNewIndex, newPrevCombinator, rorg);
3829
- }
4113
+ else insertRuleOrGroup(normalizedNewIndex, parentToInsertInto.rules[normalizedNewIndex - 2] ?? combinatorSucceeding ?? getFirstOption(combinators), rorg);
3830
4114
  }
3831
4115
  });
3832
4116
  /**
@@ -3860,8 +4144,7 @@ const group = (query, sourcePathOrID, targetPathOrID, { clone = false, combinato
3860
4144
  const newNewPath = [...nextPath];
3861
4145
  const commonAncestorPath = getCommonAncestorPath(sourcePath, nextPath);
3862
4146
  if (!clone && sourcePath.length === commonAncestorPath.length + 1 && nextPath[commonAncestorPath.length] > sourcePath[commonAncestorPath.length]) newNewPath[commonAncestorPath.length] -= independentCombinators ? 2 : 1;
3863
- const newNewParentPath = getParentPath(newNewPath);
3864
- const parentOfTargetPath = findPath(newNewParentPath, draft);
4147
+ const parentOfTargetPath = findPath(getParentPath(newNewPath), draft);
3865
4148
  const targetPathIndex = newNewPath.at(-1);
3866
4149
  parentOfTargetPath.rules.splice(targetPathIndex, 1, prepareRuleOrGroup(independentCombinators ? { rules: [
3867
4150
  targetRuleOrGroup,
@@ -3940,6 +4223,7 @@ exports.defaultRuleProcessorSQL = defaultRuleProcessorSQL;
3940
4223
  exports.defaultRuleProcessorSequelize = defaultRuleProcessorSequelize;
3941
4224
  exports.defaultRuleProcessorSpEL = defaultRuleProcessorSpEL;
3942
4225
  exports.defaultSpELValueProcessor = defaultSpELValueProcessor;
4226
+ exports.defaultTranslations = defaultTranslations;
3943
4227
  exports.defaultValidator = defaultValidator;
3944
4228
  exports.defaultValueProcessor = defaultValueProcessor;
3945
4229
  exports.defaultValueProcessorByRule = defaultValueProcessorByRule;
@@ -3993,6 +4277,8 @@ exports.joinWith = joinWith;
3993
4277
  exports.jsonLogicAdditionalOperators = jsonLogicAdditionalOperators;
3994
4278
  exports.lc = lc;
3995
4279
  exports.mapSQLOperator = mapSQLOperator;
4280
+ exports.mergeAnyTranslation = mergeAnyTranslation;
4281
+ exports.mergeAnyTranslations = mergeAnyTranslations;
3996
4282
  exports.mergeClassnames = mergeClassnames;
3997
4283
  exports.mongoDbFallback = mongoDbFallback;
3998
4284
  exports.mongoOperators = mongoOperators;
@@ -4007,6 +4293,7 @@ exports.objectKeys = objectKeys;
4007
4293
  exports.parseNumber = parseNumber;
4008
4294
  exports.pathIsDisabled = pathIsDisabled;
4009
4295
  exports.pathsAreEqual = pathsAreEqual;
4296
+ exports.prepareOptionList = prepareOptionList;
4010
4297
  exports.prepareRule = prepareRule;
4011
4298
  exports.prepareRuleGroup = prepareRuleGroup;
4012
4299
  exports.prepareRuleOrGroup = prepareRuleOrGroup;