@react-querybuilder/core 8.14.0 → 8.14.2
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/{basic-Dxm6jWFu.d.ts → basic-BXJVfD0P.d.ts} +68 -50
- package/dist/{basic-GFsWfi0Z.d.mts → basic-CNIjb6rI.d.mts} +68 -50
- package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +183 -127
- package/dist/cjs/react-querybuilder_core.cjs.development.js +311 -252
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +183 -127
- 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-DAj92cbM.mjs → convertQuery-CeJSNn37.mjs} +30 -22
- package/dist/convertQuery-CeJSNn37.mjs.map +1 -0
- package/dist/convertQuery-J8LpTG-7.js +94 -0
- package/dist/convertQuery-J8LpTG-7.js.map +1 -0
- package/dist/{export-_wipiqJZ.d.mts → export-6x7MilFR.d.mts} +2 -3
- package/dist/{export-6VbkhCrf.d.ts → export-CpJOQuZv.d.ts} +2 -3
- package/dist/formatQuery.d.mts +4 -3
- package/dist/formatQuery.d.ts +4 -3
- package/dist/formatQuery.js +75 -107
- package/dist/formatQuery.js.map +1 -1
- package/dist/formatQuery.mjs +17 -49
- package/dist/formatQuery.mjs.map +1 -1
- package/dist/{import-D8M7awTx.d.ts → import-B5Iq8XmL.d.ts} +2 -3
- package/dist/{import-DRmutNSr.d.mts → import-Bltb2mT4.d.mts} +2 -3
- package/dist/objectUtils-ButT0Mng.js +105 -0
- package/dist/objectUtils-ButT0Mng.js.map +1 -0
- package/dist/{isRuleGroup-DztIOOKa.mjs → objectUtils-C0WB-8ex.mjs} +16 -5
- package/dist/objectUtils-C0WB-8ex.mjs.map +1 -0
- package/dist/parseCEL.d.mts +2 -2
- package/dist/parseCEL.d.ts +2 -2
- package/dist/parseCEL.js +14 -16
- package/dist/parseCEL.js.map +1 -1
- package/dist/parseCEL.mjs +7 -10
- package/dist/parseCEL.mjs.map +1 -1
- package/dist/parseJSONata.d.mts +2 -3
- package/dist/parseJSONata.d.ts +2 -3
- package/dist/parseJSONata.js +40 -5614
- package/dist/parseJSONata.js.map +1 -1
- package/dist/parseJSONata.mjs +11 -13
- package/dist/parseJSONata.mjs.map +1 -1
- package/dist/parseJsonLogic.d.mts +3 -4
- package/dist/parseJsonLogic.d.ts +3 -4
- package/dist/parseJsonLogic.js +47 -48
- package/dist/parseJsonLogic.js.map +1 -1
- package/dist/parseJsonLogic.mjs +19 -21
- package/dist/parseJsonLogic.mjs.map +1 -1
- package/dist/parseMongoDB.d.mts +2 -3
- package/dist/parseMongoDB.d.ts +2 -3
- package/dist/parseMongoDB.js +26 -27
- package/dist/parseMongoDB.js.map +1 -1
- package/dist/parseMongoDB.mjs +6 -8
- package/dist/parseMongoDB.mjs.map +1 -1
- package/dist/parseSQL.d.mts +2 -3
- package/dist/parseSQL.d.ts +2 -3
- package/dist/parseSQL.js +13 -15
- package/dist/parseSQL.js.map +1 -1
- package/dist/parseSQL.mjs +7 -10
- package/dist/parseSQL.mjs.map +1 -1
- package/dist/parseSpEL.d.mts +2 -3
- package/dist/parseSpEL.d.ts +2 -3
- package/dist/parseSpEL.js +13 -2702
- package/dist/parseSpEL.js.map +1 -1
- package/dist/parseSpEL.mjs +7 -9
- package/dist/parseSpEL.mjs.map +1 -1
- package/dist/{prepareQueryObjects-BBayjIn2.mjs → prepareQueryObjects-BfMlS4ql.mjs} +34 -18
- package/dist/prepareQueryObjects-BfMlS4ql.mjs.map +1 -0
- package/dist/{prepareQueryObjects-BxWvIPI4.js → prepareQueryObjects-DO3qXriW.js} +50 -35
- package/dist/prepareQueryObjects-DO3qXriW.js.map +1 -0
- package/dist/react-querybuilder_core.d.mts +183 -127
- package/dist/react-querybuilder_core.legacy-esm.d.ts +183 -127
- package/dist/react-querybuilder_core.legacy-esm.js +307 -280
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +299 -248
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +183 -127
- package/dist/react-querybuilder_core.production.mjs +1 -1
- package/dist/react-querybuilder_core.production.mjs.map +1 -1
- package/dist/transformQuery.d.mts +1 -2
- package/dist/transformQuery.d.ts +1 -2
- package/dist/transformQuery.js +45 -2
- package/dist/transformQuery.js.map +1 -0
- package/dist/transformQuery.mjs +44 -2
- package/dist/transformQuery.mjs.map +1 -0
- package/dist/{utils-nQU7WCM9.mjs → utils-BlMGIhvx.mjs} +32 -92
- package/dist/utils-BlMGIhvx.mjs.map +1 -0
- package/dist/{utils-CR1ToTMW.js → utils-CZRhzje-.js} +187 -265
- package/dist/utils-CZRhzje-.js.map +1 -0
- package/package.json +25 -17
- package/dist/chunk-U64pC571.js +0 -41
- package/dist/convertQuery-DAj92cbM.mjs.map +0 -1
- package/dist/convertQuery-DRldbzhZ.js +0 -87
- package/dist/convertQuery-DRldbzhZ.js.map +0 -1
- package/dist/isRuleGroup-Cjk1Q2mj.js +0 -82
- package/dist/isRuleGroup-Cjk1Q2mj.js.map +0 -1
- package/dist/isRuleGroup-DztIOOKa.mjs.map +0 -1
- package/dist/prepareQueryObjects-BBayjIn2.mjs.map +0 -1
- package/dist/prepareQueryObjects-BxWvIPI4.js.map +0 -1
- package/dist/transformQuery-ClBRfnFg.js +0 -54
- package/dist/transformQuery-ClBRfnFg.js.map +0 -1
- package/dist/transformQuery-DUpbpqjX.mjs +0 -48
- package/dist/transformQuery-DUpbpqjX.mjs.map +0 -1
- package/dist/utils-CR1ToTMW.js.map +0 -1
- package/dist/utils-nQU7WCM9.mjs.map +0 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { produce } from "immer";
|
|
2
1
|
import { numericQuantity, numericRegex as numericRegex$1 } from "numeric-quantity";
|
|
3
|
-
|
|
2
|
+
import { current, isDraft, produce } from "immer";
|
|
4
3
|
//#region src/defaults.ts
|
|
5
4
|
/**
|
|
6
5
|
* @group Defaults
|
|
@@ -15,7 +14,7 @@ const defaultPlaceholderLabel = "------";
|
|
|
15
14
|
*
|
|
16
15
|
* @group Defaults
|
|
17
16
|
*/
|
|
18
|
-
const defaultPlaceholderFieldName =
|
|
17
|
+
const defaultPlaceholderFieldName = "~";
|
|
19
18
|
/**
|
|
20
19
|
* Default `label` for placeholder option in the `fields` array.
|
|
21
20
|
*
|
|
@@ -33,7 +32,7 @@ const defaultPlaceholderFieldGroupLabel = defaultPlaceholderLabel;
|
|
|
33
32
|
*
|
|
34
33
|
* @group Defaults
|
|
35
34
|
*/
|
|
36
|
-
const defaultPlaceholderOperatorName =
|
|
35
|
+
const defaultPlaceholderOperatorName = "~";
|
|
37
36
|
/**
|
|
38
37
|
* Default `label` for placeholder option in the `operators` array.
|
|
39
38
|
*
|
|
@@ -51,7 +50,7 @@ const defaultPlaceholderOperatorGroupLabel = defaultPlaceholderLabel;
|
|
|
51
50
|
*
|
|
52
51
|
* @group Defaults
|
|
53
52
|
*/
|
|
54
|
-
const defaultPlaceholderValueName =
|
|
53
|
+
const defaultPlaceholderValueName = "~";
|
|
55
54
|
/**
|
|
56
55
|
* Default `label` for placeholder option in the `values` array.
|
|
57
56
|
*
|
|
@@ -72,19 +71,19 @@ const defaultPlaceholderValueGroupLabel = defaultPlaceholderLabel;
|
|
|
72
71
|
const defaultTranslations = {
|
|
73
72
|
fields: {
|
|
74
73
|
title: "Field",
|
|
75
|
-
placeholderName:
|
|
74
|
+
placeholderName: "~",
|
|
76
75
|
placeholderLabel: defaultPlaceholderFieldLabel,
|
|
77
76
|
placeholderGroupLabel: defaultPlaceholderFieldGroupLabel
|
|
78
77
|
},
|
|
79
78
|
operators: {
|
|
80
79
|
title: "Operator",
|
|
81
|
-
placeholderName:
|
|
80
|
+
placeholderName: "~",
|
|
82
81
|
placeholderLabel: defaultPlaceholderOperatorLabel,
|
|
83
82
|
placeholderGroupLabel: defaultPlaceholderOperatorGroupLabel
|
|
84
83
|
},
|
|
85
84
|
values: {
|
|
86
85
|
title: "Values",
|
|
87
|
-
placeholderName:
|
|
86
|
+
placeholderName: "~",
|
|
88
87
|
placeholderLabel: defaultPlaceholderValueLabel,
|
|
89
88
|
placeholderGroupLabel: defaultPlaceholderValueGroupLabel
|
|
90
89
|
},
|
|
@@ -562,7 +561,6 @@ const queryBuilderFlagDefaults = {
|
|
|
562
561
|
showShiftActions: false,
|
|
563
562
|
suppressStandardClassnames: false
|
|
564
563
|
};
|
|
565
|
-
|
|
566
564
|
//#endregion
|
|
567
565
|
//#region src/utils/arrayUtils.ts
|
|
568
566
|
/**
|
|
@@ -577,7 +575,7 @@ const queryBuilderFlagDefaults = {
|
|
|
577
575
|
* // would return
|
|
578
576
|
* ['this,,that', '', 'the other', '', '', ',']
|
|
579
577
|
*/
|
|
580
|
-
const splitBy = (str, splitChar =
|
|
578
|
+
const splitBy = (str, splitChar = ",") => typeof str === "string" ? str.split(`\\${splitChar}`).map((c) => c.split(splitChar)).reduce((prev, curr, idx) => {
|
|
581
579
|
if (idx === 0) return curr;
|
|
582
580
|
return [
|
|
583
581
|
...prev.slice(0, -1),
|
|
@@ -598,7 +596,7 @@ const splitBy = (str, splitChar = defaultJoinChar) => typeof str === "string" ?
|
|
|
598
596
|
* // would return
|
|
599
597
|
* 'this\\,\\,that, , the other, , , \\,'
|
|
600
598
|
*/
|
|
601
|
-
const joinWith = (strArr, joinChar =
|
|
599
|
+
const joinWith = (strArr, joinChar = ",") => strArr.map((str) => `${str !== null && str !== void 0 ? str : ""}`.replaceAll(joinChar[0], `\\${joinChar[0]}`)).join(joinChar);
|
|
602
600
|
/**
|
|
603
601
|
* Trims the value if it is a string. Otherwise returns the value as is.
|
|
604
602
|
*/
|
|
@@ -607,12 +605,11 @@ const trimIfString = (val) => typeof val === "string" ? val.trim() : val;
|
|
|
607
605
|
* Splits a string by comma then trims each element. Arrays are returned as is except
|
|
608
606
|
* any string elements are trimmed.
|
|
609
607
|
*/
|
|
610
|
-
const toArray = (
|
|
608
|
+
const toArray = (a, { retainEmptyStrings } = {}) => Array.isArray(a) ? a.map((v) => trimIfString(v)) : typeof a === "string" ? splitBy(a, ",").filter(retainEmptyStrings ? () => true : (s) => !/^\s*$/.test(s)).map((s) => s.trim()) : typeof a === "number" ? [a] : [];
|
|
611
609
|
/**
|
|
612
610
|
* Determines if an array is free of `null`/`undefined`.
|
|
613
611
|
*/
|
|
614
612
|
const nullFreeArray = (arr) => arr.every((el) => el === false || (el !== null && el !== void 0 ? el : false) !== false);
|
|
615
|
-
|
|
616
613
|
//#endregion
|
|
617
614
|
//#region src/utils/clsx.ts
|
|
618
615
|
// istanbul ignore next
|
|
@@ -653,7 +650,6 @@ function clsx(...args) {
|
|
|
653
650
|
}
|
|
654
651
|
return str;
|
|
655
652
|
}
|
|
656
|
-
|
|
657
653
|
//#endregion
|
|
658
654
|
//#region src/utils/misc.ts
|
|
659
655
|
/**
|
|
@@ -674,7 +670,6 @@ const isPojo = (obj) => obj === null || typeof obj !== "object" ? false : Object
|
|
|
674
670
|
* Simple helper to determine whether a value is null, undefined, or an empty string.
|
|
675
671
|
*/
|
|
676
672
|
const nullOrUndefinedOrEmpty = (value) => value === null || value === void 0 || value === "";
|
|
677
|
-
|
|
678
673
|
//#endregion
|
|
679
674
|
//#region src/utils/isRuleGroup.ts
|
|
680
675
|
/**
|
|
@@ -693,20 +688,18 @@ const isRuleGroupType = (rg) => isRuleGroup(rg) && typeof rg.combinator === "str
|
|
|
693
688
|
* Determines if an object is a {@link RuleGroupTypeIC}.
|
|
694
689
|
*/
|
|
695
690
|
const isRuleGroupTypeIC = (rg) => isRuleGroup(rg) && rg.combinator === void 0;
|
|
696
|
-
|
|
697
691
|
//#endregion
|
|
698
|
-
//#region \0@oxc-project+runtime@0.
|
|
692
|
+
//#region \0@oxc-project+runtime@0.115.0/helpers/typeof.js
|
|
699
693
|
function _typeof(o) {
|
|
700
694
|
"@babel/helpers - typeof";
|
|
701
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o
|
|
702
|
-
return typeof o
|
|
703
|
-
} : function(o
|
|
704
|
-
return o
|
|
695
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
696
|
+
return typeof o;
|
|
697
|
+
} : function(o) {
|
|
698
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
705
699
|
}, _typeof(o);
|
|
706
700
|
}
|
|
707
|
-
|
|
708
701
|
//#endregion
|
|
709
|
-
//#region \0@oxc-project+runtime@0.
|
|
702
|
+
//#region \0@oxc-project+runtime@0.115.0/helpers/toPrimitive.js
|
|
710
703
|
function toPrimitive(t, r) {
|
|
711
704
|
if ("object" != _typeof(t) || !t) return t;
|
|
712
705
|
var e = t[Symbol.toPrimitive];
|
|
@@ -717,16 +710,14 @@ function toPrimitive(t, r) {
|
|
|
717
710
|
}
|
|
718
711
|
return ("string" === r ? String : Number)(t);
|
|
719
712
|
}
|
|
720
|
-
|
|
721
713
|
//#endregion
|
|
722
|
-
//#region \0@oxc-project+runtime@0.
|
|
714
|
+
//#region \0@oxc-project+runtime@0.115.0/helpers/toPropertyKey.js
|
|
723
715
|
function toPropertyKey(t) {
|
|
724
716
|
var i = toPrimitive(t, "string");
|
|
725
717
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
726
718
|
}
|
|
727
|
-
|
|
728
719
|
//#endregion
|
|
729
|
-
//#region \0@oxc-project+runtime@0.
|
|
720
|
+
//#region \0@oxc-project+runtime@0.115.0/helpers/defineProperty.js
|
|
730
721
|
function _defineProperty(e, r, t) {
|
|
731
722
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
732
723
|
value: t,
|
|
@@ -735,15 +726,14 @@ function _defineProperty(e, r, t) {
|
|
|
735
726
|
writable: !0
|
|
736
727
|
}) : e[r] = t, e;
|
|
737
728
|
}
|
|
738
|
-
|
|
739
729
|
//#endregion
|
|
740
|
-
//#region \0@oxc-project+runtime@0.
|
|
730
|
+
//#region \0@oxc-project+runtime@0.115.0/helpers/objectSpread2.js
|
|
741
731
|
function ownKeys(e, r) {
|
|
742
732
|
var t = Object.keys(e);
|
|
743
733
|
if (Object.getOwnPropertySymbols) {
|
|
744
734
|
var o = Object.getOwnPropertySymbols(e);
|
|
745
|
-
r && (o = o.filter(function(r
|
|
746
|
-
return Object.getOwnPropertyDescriptor(e, r
|
|
735
|
+
r && (o = o.filter(function(r) {
|
|
736
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
747
737
|
})), t.push.apply(t, o);
|
|
748
738
|
}
|
|
749
739
|
return t;
|
|
@@ -751,17 +741,16 @@ function ownKeys(e, r) {
|
|
|
751
741
|
function _objectSpread2(e) {
|
|
752
742
|
for (var r = 1; r < arguments.length; r++) {
|
|
753
743
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
754
|
-
r % 2 ? ownKeys(Object(t), !0).forEach(function(r
|
|
755
|
-
_defineProperty(e, r
|
|
756
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r
|
|
757
|
-
Object.defineProperty(e, r
|
|
744
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
745
|
+
_defineProperty(e, r, t[r]);
|
|
746
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
747
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
758
748
|
});
|
|
759
749
|
}
|
|
760
750
|
return e;
|
|
761
751
|
}
|
|
762
|
-
|
|
763
752
|
//#endregion
|
|
764
|
-
//#region \0@oxc-project+runtime@0.
|
|
753
|
+
//#region \0@oxc-project+runtime@0.115.0/helpers/objectWithoutPropertiesLoose.js
|
|
765
754
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
766
755
|
if (null == r) return {};
|
|
767
756
|
var t = {};
|
|
@@ -771,9 +760,8 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
771
760
|
}
|
|
772
761
|
return t;
|
|
773
762
|
}
|
|
774
|
-
|
|
775
763
|
//#endregion
|
|
776
|
-
//#region \0@oxc-project+runtime@0.
|
|
764
|
+
//#region \0@oxc-project+runtime@0.115.0/helpers/objectWithoutProperties.js
|
|
777
765
|
function _objectWithoutProperties(e, t) {
|
|
778
766
|
if (null == e) return {};
|
|
779
767
|
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
@@ -783,7 +771,6 @@ function _objectWithoutProperties(e, t) {
|
|
|
783
771
|
}
|
|
784
772
|
return i;
|
|
785
773
|
}
|
|
786
|
-
|
|
787
774
|
//#endregion
|
|
788
775
|
//#region src/utils/convertQuery.ts
|
|
789
776
|
const _excluded = ["combinator"];
|
|
@@ -796,20 +783,24 @@ const isSameString = (a, b) => lc(a) === b;
|
|
|
796
783
|
const generateRuleGroupICWithConsistentCombinators = (rg, baseCombinatorLevel = 0) => {
|
|
797
784
|
const baseCombinator = combinatorLevels[baseCombinatorLevel];
|
|
798
785
|
if (!rg.rules.includes(baseCombinator)) return baseCombinatorLevel < combinatorLevels.length - 2 ? generateRuleGroupICWithConsistentCombinators(rg, baseCombinatorLevel + 1) : rg;
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
}
|
|
806
|
-
const nextBaseCombinatorIndex = draft.rules.findIndex((r, i) => i > cursor && typeof r === "string" && lc(r) === baseCombinator);
|
|
807
|
-
if (nextBaseCombinatorIndex === -1) {
|
|
808
|
-
draft.rules.splice(cursor, draft.rules.length, generateRuleGroupICWithConsistentCombinators({ rules: draft.rules.slice(cursor) }, baseCombinatorLevel + 1));
|
|
809
|
-
break;
|
|
810
|
-
} else draft.rules.splice(cursor, nextBaseCombinatorIndex - cursor, generateRuleGroupICWithConsistentCombinators({ rules: draft.rules.slice(cursor, nextBaseCombinatorIndex) }, baseCombinatorLevel + 1));
|
|
786
|
+
const newRules = [...rg.rules];
|
|
787
|
+
let cursor = 0;
|
|
788
|
+
while (cursor < newRules.length - 2) {
|
|
789
|
+
if (isSameString(newRules[cursor + 1], baseCombinator)) {
|
|
790
|
+
cursor += 2;
|
|
791
|
+
continue;
|
|
811
792
|
}
|
|
812
|
-
|
|
793
|
+
let nextBaseCombinatorIndex = -1;
|
|
794
|
+
for (let i = cursor + 2; i < newRules.length; i++) if (typeof newRules[i] === "string" && lc(newRules[i]) === baseCombinator) {
|
|
795
|
+
nextBaseCombinatorIndex = i;
|
|
796
|
+
break;
|
|
797
|
+
}
|
|
798
|
+
if (nextBaseCombinatorIndex === -1) {
|
|
799
|
+
newRules.splice(cursor, newRules.length, generateRuleGroupICWithConsistentCombinators({ rules: newRules.slice(cursor) }, baseCombinatorLevel + 1));
|
|
800
|
+
break;
|
|
801
|
+
} else newRules.splice(cursor, nextBaseCombinatorIndex - cursor, generateRuleGroupICWithConsistentCombinators({ rules: newRules.slice(cursor, nextBaseCombinatorIndex) }, baseCombinatorLevel + 1));
|
|
802
|
+
}
|
|
803
|
+
return _objectSpread2(_objectSpread2({}, rg), {}, { rules: newRules });
|
|
813
804
|
};
|
|
814
805
|
/**
|
|
815
806
|
* Converts a {@link RuleGroupTypeIC} to {@link RuleGroupType}.
|
|
@@ -822,9 +813,11 @@ const generateRuleGroupICWithConsistentCombinators = (rg, baseCombinatorLevel =
|
|
|
822
813
|
const convertFromIC = (rg) => {
|
|
823
814
|
if (isRuleGroupType(rg)) return rg;
|
|
824
815
|
const processedRG = generateRuleGroupICWithConsistentCombinators(rg);
|
|
825
|
-
const
|
|
826
|
-
|
|
827
|
-
const
|
|
816
|
+
const rules = [];
|
|
817
|
+
let combinator = "and";
|
|
818
|
+
for (const [idx, r] of processedRG.rules.entries()) if (typeof r === "string") {
|
|
819
|
+
if (idx === 1) combinator = r;
|
|
820
|
+
} else rules.push(isRuleGroup(r) ? convertFromIC(r) : r);
|
|
828
821
|
return _objectSpread2(_objectSpread2({}, processedRG), {}, {
|
|
829
822
|
combinator,
|
|
830
823
|
rules
|
|
@@ -843,7 +836,8 @@ const convertToIC = (rg) => {
|
|
|
843
836
|
const { combinator } = rg, queryWithoutCombinator = _objectWithoutProperties(rg, _excluded);
|
|
844
837
|
const rules = [];
|
|
845
838
|
const { length } = rg.rules;
|
|
846
|
-
for (
|
|
839
|
+
for (let idx = 0; idx < length; idx++) {
|
|
840
|
+
const r = rg.rules[idx];
|
|
847
841
|
if (isRuleGroup(r)) rules.push(convertToIC(r));
|
|
848
842
|
else rules.push(r);
|
|
849
843
|
if (combinator && idx < length - 1) rules.push(combinator);
|
|
@@ -853,7 +847,6 @@ const convertToIC = (rg) => {
|
|
|
853
847
|
function convertQuery(query) {
|
|
854
848
|
return isRuleGroupTypeIC(query) ? convertFromIC(query) : convertToIC(query);
|
|
855
849
|
}
|
|
856
|
-
|
|
857
850
|
//#endregion
|
|
858
851
|
//#region src/utils/defaultValidator.ts
|
|
859
852
|
/**
|
|
@@ -890,7 +883,6 @@ const defaultValidator = (query) => {
|
|
|
890
883
|
validateGroup(query);
|
|
891
884
|
return result;
|
|
892
885
|
};
|
|
893
|
-
|
|
894
886
|
//#endregion
|
|
895
887
|
//#region src/utils/objectUtils.ts
|
|
896
888
|
/**
|
|
@@ -905,7 +897,11 @@ const objectKeys = Object.keys;
|
|
|
905
897
|
* [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-entries.ts)
|
|
906
898
|
*/
|
|
907
899
|
const objectEntries = Object.entries;
|
|
908
|
-
|
|
900
|
+
/**
|
|
901
|
+
* Returns `true` if the key could cause prototype pollution when used
|
|
902
|
+
* as a property name in bracket-notation assignment.
|
|
903
|
+
*/
|
|
904
|
+
const isUnsafeKey = (key) => key === "__proto__" || key === "constructor" || key === "prototype";
|
|
909
905
|
//#endregion
|
|
910
906
|
//#region src/utils/optGroupUtils.ts
|
|
911
907
|
const isOptionWithName = (opt) => isPojo(opt) && "name" in opt && typeof opt.name === "string";
|
|
@@ -917,26 +913,25 @@ const isOptionWithValue = (opt) => isPojo(opt) && "value" in opt && typeof opt.v
|
|
|
917
913
|
* @group Option Lists
|
|
918
914
|
*/
|
|
919
915
|
function toFullOption(opt, baseProperties, labelMap) {
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
})(opt);
|
|
916
|
+
if (typeof opt === "string") {
|
|
917
|
+
var _labelMap$opt;
|
|
918
|
+
return _objectSpread2(_objectSpread2({}, baseProperties), {}, {
|
|
919
|
+
name: opt,
|
|
920
|
+
value: opt,
|
|
921
|
+
label: (_labelMap$opt = labelMap === null || labelMap === void 0 ? void 0 : labelMap[opt]) !== null && _labelMap$opt !== void 0 ? _labelMap$opt : opt
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
const idObj = {};
|
|
925
|
+
let needsUpdating = !!baseProperties;
|
|
926
|
+
if (isOptionWithName(opt) && !isOptionWithValue(opt)) {
|
|
927
|
+
idObj.value = opt.name;
|
|
928
|
+
needsUpdating = true;
|
|
929
|
+
} else if (!isOptionWithName(opt) && isOptionWithValue(opt)) {
|
|
930
|
+
idObj.name = opt.value;
|
|
931
|
+
needsUpdating = true;
|
|
932
|
+
}
|
|
933
|
+
if (needsUpdating) return Object.assign({}, baseProperties, opt, idObj);
|
|
934
|
+
return opt;
|
|
940
935
|
}
|
|
941
936
|
/**
|
|
942
937
|
* Converts an {@link OptionList} or {@link FlexibleOptionList} into a {@link FullOptionList}.
|
|
@@ -946,10 +941,9 @@ function toFullOption(opt, baseProperties, labelMap) {
|
|
|
946
941
|
*/
|
|
947
942
|
function toFullOptionList(optList, baseProperties, labelMap) {
|
|
948
943
|
if (!Array.isArray(optList)) return [];
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
})(optList);
|
|
944
|
+
const list = optList;
|
|
945
|
+
if (isFlexibleOptionGroupArray(list)) return list.map((optGroup) => _objectSpread2(_objectSpread2({}, optGroup), {}, { options: optGroup.options.map((opt) => toFullOption(opt, baseProperties, labelMap)) }));
|
|
946
|
+
return list.map((opt) => toFullOption(opt, baseProperties, labelMap));
|
|
953
947
|
}
|
|
954
948
|
/**
|
|
955
949
|
* Converts a {@link FlexibleOptionList} into a {@link FullOptionList}.
|
|
@@ -1095,7 +1089,7 @@ const uniqOptList = (originalArray) => {
|
|
|
1095
1089
|
};
|
|
1096
1090
|
const prepareOptionList = (props) => {
|
|
1097
1091
|
// istanbul ignore next
|
|
1098
|
-
const { optionList: optionListPropOriginal, baseOption = {}, labelMap = {}, placeholder: { placeholderName =
|
|
1092
|
+
const { optionList: optionListPropOriginal, baseOption = {}, labelMap = {}, placeholder: { placeholderName = "~", placeholderLabel = defaultPlaceholderLabel, placeholderGroupLabel = defaultPlaceholderLabel } = {}, autoSelectOption = true } = props;
|
|
1099
1093
|
const defaultOption = {
|
|
1100
1094
|
id: placeholderName,
|
|
1101
1095
|
name: placeholderName,
|
|
@@ -1131,7 +1125,6 @@ const prepareOptionList = (props) => {
|
|
|
1131
1125
|
optionsMap
|
|
1132
1126
|
};
|
|
1133
1127
|
};
|
|
1134
|
-
|
|
1135
1128
|
//#endregion
|
|
1136
1129
|
//#region src/utils/filterFieldsByComparator.ts
|
|
1137
1130
|
const filterByComparator = (field, operator, fieldToCompare) => {
|
|
@@ -1165,7 +1158,6 @@ const filterFieldsByComparator = (field, fields, operator) => {
|
|
|
1165
1158
|
if (isFlexibleOptionGroupArray(fields)) return fields.map((og) => _objectSpread2(_objectSpread2({}, og), {}, { options: og.options.filter((f) => filterByComparator(field, operator, f)) })).filter((og) => og.options.length > 0);
|
|
1166
1159
|
return fields.filter((f) => filterByComparator(field, operator, f));
|
|
1167
1160
|
};
|
|
1168
|
-
|
|
1169
1161
|
//#endregion
|
|
1170
1162
|
//#region src/utils/parseNumber.ts
|
|
1171
1163
|
/**
|
|
@@ -1185,23 +1177,21 @@ const parseNumber = (val, { parseNumbers, bigIntOnOverflow } = {}) => {
|
|
|
1185
1177
|
});
|
|
1186
1178
|
return typeof valAsNum === "bigint" || !Number.isNaN(valAsNum) ? valAsNum : val;
|
|
1187
1179
|
};
|
|
1188
|
-
|
|
1189
1180
|
//#endregion
|
|
1190
1181
|
//#region src/utils/transformQuery.ts
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
draft[v] = draft[k];
|
|
1202
|
-
if (deleteRemappedProperties) delete draft[k];
|
|
1182
|
+
const remapProperties = (obj, propertyMap, deleteRemappedProperties) => {
|
|
1183
|
+
const result = {};
|
|
1184
|
+
for (const key in obj) {
|
|
1185
|
+
if (isUnsafeKey(key)) continue;
|
|
1186
|
+
const mappedKey = propertyMap[key];
|
|
1187
|
+
if (mappedKey === false) continue;
|
|
1188
|
+
if (mappedKey && key !== mappedKey) {
|
|
1189
|
+
if (!isUnsafeKey(mappedKey)) result[mappedKey] = obj[key];
|
|
1190
|
+
if (!deleteRemappedProperties) result[key] = obj[key];
|
|
1191
|
+
} else result[key] = obj[key];
|
|
1203
1192
|
}
|
|
1204
|
-
|
|
1193
|
+
return result;
|
|
1194
|
+
};
|
|
1205
1195
|
function transformQuery(query, options = {}) {
|
|
1206
1196
|
const { ruleProcessor = (r) => r, ruleGroupProcessor = (rg) => rg, propertyMap = {}, combinatorMap = {}, operatorMap = {}, omitPath = false, deleteRemappedProperties = true } = options;
|
|
1207
1197
|
const processGroup = (rg) => {
|
|
@@ -1218,7 +1208,6 @@ function transformQuery(query, options = {}) {
|
|
|
1218
1208
|
};
|
|
1219
1209
|
return processGroup(_objectSpread2(_objectSpread2({}, query), omitPath ? null : { path: [] }));
|
|
1220
1210
|
}
|
|
1221
|
-
|
|
1222
1211
|
//#endregion
|
|
1223
1212
|
//#region src/utils/isRuleOrGroupValid.ts
|
|
1224
1213
|
/**
|
|
@@ -1242,7 +1231,6 @@ const isRuleOrGroupValid = (rg, validationResult, validator) => {
|
|
|
1242
1231
|
}
|
|
1243
1232
|
return true;
|
|
1244
1233
|
};
|
|
1245
|
-
|
|
1246
1234
|
//#endregion
|
|
1247
1235
|
//#region src/utils/getParseNumberMethod.ts
|
|
1248
1236
|
const getParseNumberMethod = ({ parseNumbers, inputType }) => {
|
|
@@ -1253,7 +1241,6 @@ const getParseNumberMethod = ({ parseNumbers, inputType }) => {
|
|
|
1253
1241
|
}
|
|
1254
1242
|
return parseNumbers ? "strict" : false;
|
|
1255
1243
|
};
|
|
1256
|
-
|
|
1257
1244
|
//#endregion
|
|
1258
1245
|
//#region src/utils/formatQuery/utils.ts
|
|
1259
1246
|
/**
|
|
@@ -1335,7 +1322,8 @@ const jsonLogicAdditionalOperators = {
|
|
|
1335
1322
|
endsWith: (a, b) => typeof a === "string" && a.endsWith(b)
|
|
1336
1323
|
};
|
|
1337
1324
|
/**
|
|
1338
|
-
*
|
|
1325
|
+
* Returns a new query object with all `string`-type `value` properties converted
|
|
1326
|
+
* to `number` where appropriate.
|
|
1339
1327
|
*
|
|
1340
1328
|
* Used by {@link formatQuery} for the `json*` formats when `parseNumbers` is `true`.
|
|
1341
1329
|
*
|
|
@@ -1499,7 +1487,6 @@ const bigIntJsonStringifyReplacer = (_key, value) => typeof value === "bigint" ?
|
|
|
1499
1487
|
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#use_within_json
|
|
1500
1488
|
*/
|
|
1501
1489
|
const bigIntJsonParseReviver = (_key, value) => isPojo(value) && Object.keys(value).length === 1 && typeof value.$bigint === "string" ? BigInt(value.$bigint) : value;
|
|
1502
|
-
|
|
1503
1490
|
//#endregion
|
|
1504
1491
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorCEL.ts
|
|
1505
1492
|
/**
|
|
@@ -1556,7 +1543,6 @@ const defaultRuleGroupProcessorCEL = (ruleGroup, options) => {
|
|
|
1556
1543
|
};
|
|
1557
1544
|
return processRuleGroup(ruleGroup, true);
|
|
1558
1545
|
};
|
|
1559
|
-
|
|
1560
1546
|
//#endregion
|
|
1561
1547
|
//#region src/utils/formatQuery/defaultRuleProcessorCEL.ts
|
|
1562
1548
|
const shouldNegate$2 = (op) => op.startsWith("not") || op.startsWith("doesnot");
|
|
@@ -1634,7 +1620,6 @@ const defaultRuleProcessorCEL = (rule, opts = {}) => {
|
|
|
1634
1620
|
}
|
|
1635
1621
|
return "";
|
|
1636
1622
|
};
|
|
1637
|
-
|
|
1638
1623
|
//#endregion
|
|
1639
1624
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorMongoDBQuery.ts
|
|
1640
1625
|
/**
|
|
@@ -1672,11 +1657,11 @@ const defaultRuleGroupProcessorMongoDBQuery = (ruleGroup, options, meta) => {
|
|
|
1672
1657
|
fieldData
|
|
1673
1658
|
}), meta);
|
|
1674
1659
|
}).filter(Boolean);
|
|
1675
|
-
|
|
1660
|
+
const result = expressions.length > 0 ? expressions.length === 1 && !hasChildRules ? expressions[0] : { [combinator]: expressions } : mongoDbFallback;
|
|
1661
|
+
return rg.not ? { $not: result } : result;
|
|
1676
1662
|
};
|
|
1677
1663
|
return processRuleGroup(convertFromIC(ruleGroup), true);
|
|
1678
1664
|
};
|
|
1679
|
-
|
|
1680
1665
|
//#endregion
|
|
1681
1666
|
//#region src/utils/formatQuery/defaultRuleProcessorMongoDBQuery.ts
|
|
1682
1667
|
const processNumber$1 = (value, fallback, parseNumbers = false) => shouldRenderAsNumber(value, parseNumbers || typeof value === "bigint") ? Number(parseNumber(value, { parseNumbers: "strict" })) : fallback;
|
|
@@ -1791,7 +1776,6 @@ const defaultRuleProcessorMongoDBQuery = (rule, options = {}) => {
|
|
|
1791
1776
|
}
|
|
1792
1777
|
return "";
|
|
1793
1778
|
};
|
|
1794
|
-
|
|
1795
1779
|
//#endregion
|
|
1796
1780
|
//#region src/utils/formatQuery/defaultRuleProcessorMongoDB.ts
|
|
1797
1781
|
/**
|
|
@@ -1805,7 +1789,6 @@ const defaultRuleProcessorMongoDB = (rule, options) => {
|
|
|
1805
1789
|
const queryObj = defaultRuleProcessorMongoDBQuery(rule, options);
|
|
1806
1790
|
return queryObj ? JSON.stringify(queryObj) : "";
|
|
1807
1791
|
};
|
|
1808
|
-
|
|
1809
1792
|
//#endregion
|
|
1810
1793
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorSpEL.ts
|
|
1811
1794
|
/**
|
|
@@ -1862,11 +1845,10 @@ const defaultRuleGroupProcessorSpEL = (ruleGroup, options) => {
|
|
|
1862
1845
|
};
|
|
1863
1846
|
return processRuleGroup(ruleGroup, true);
|
|
1864
1847
|
};
|
|
1865
|
-
|
|
1866
1848
|
//#endregion
|
|
1867
1849
|
//#region src/utils/formatQuery/defaultRuleProcessorSpEL.ts
|
|
1868
1850
|
const shouldNegate$1 = (op) => op.startsWith("not") || op.startsWith("doesnot");
|
|
1869
|
-
const wrapInNegation = (clause, negate
|
|
1851
|
+
const wrapInNegation = (clause, negate) => negate ? `!(${clause})` : clause;
|
|
1870
1852
|
const escapeSingleQuotes = (v, escapeQuotes) => typeof v !== "string" || !escapeQuotes ? `${v}` : v.replaceAll(`'`, `\\'`);
|
|
1871
1853
|
/**
|
|
1872
1854
|
* Default rule processor used by {@link formatQuery} for "spel" format.
|
|
@@ -1916,9 +1898,9 @@ const defaultRuleProcessorSpEL = (rule, opts = {}) => {
|
|
|
1916
1898
|
case "notnull": return `${field} != null`;
|
|
1917
1899
|
case "in":
|
|
1918
1900
|
case "notin": {
|
|
1919
|
-
const negate
|
|
1901
|
+
const negate = shouldNegate$1(operatorTL) ? "!" : "";
|
|
1920
1902
|
const valueAsArray = toArray(value);
|
|
1921
|
-
return valueAsArray.length > 0 ? `${negate
|
|
1903
|
+
return valueAsArray.length > 0 ? `${negate}(${valueAsArray.map((val) => `${field} == ${valueIsField || shouldRenderAsNumber(val, parseNumbers) ? `${trimIfString(val)}` : `'${escapeSingleQuotes(val, escapeQuotes)}'`}`).join(" or ")})` : "";
|
|
1922
1904
|
}
|
|
1923
1905
|
case "between":
|
|
1924
1906
|
case "notbetween": {
|
|
@@ -1941,7 +1923,6 @@ const defaultRuleProcessorSpEL = (rule, opts = {}) => {
|
|
|
1941
1923
|
}
|
|
1942
1924
|
return "";
|
|
1943
1925
|
};
|
|
1944
|
-
|
|
1945
1926
|
//#endregion
|
|
1946
1927
|
//#region src/utils/formatQuery/defaultValueProcessorByRule.ts
|
|
1947
1928
|
const escapeStringValueQuotes$1 = (v, quoteChar, escapeQuotes) => escapeQuotes && typeof v === "string" ? v.replaceAll(`${quoteChar}`, `${quoteChar}${quoteChar}`) : v;
|
|
@@ -1998,7 +1979,6 @@ const defaultValueProcessorByRule = ({ operator, value, valueSource }, { escapeQ
|
|
|
1998
1979
|
if (typeof value === "boolean") return value ? "TRUE" : "FALSE";
|
|
1999
1980
|
return valueIsField ? wrapFieldName(value) : shouldRenderAsNumber(value, parseNumbers) ? `${trimIfString(value)}` : `${wrapAndEscape(value)}`;
|
|
2000
1981
|
};
|
|
2001
|
-
|
|
2002
1982
|
//#endregion
|
|
2003
1983
|
//#region src/utils/formatQuery/defaultRuleProcessorDrizzle.ts
|
|
2004
1984
|
/**
|
|
@@ -2086,7 +2066,6 @@ const defaultRuleProcessorDrizzle = (rule, _options) => {
|
|
|
2086
2066
|
default: return;
|
|
2087
2067
|
}
|
|
2088
2068
|
};
|
|
2089
|
-
|
|
2090
2069
|
//#endregion
|
|
2091
2070
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorDrizzle.ts
|
|
2092
2071
|
/**
|
|
@@ -2129,7 +2108,6 @@ const defaultRuleGroupProcessorDrizzle = (ruleGroup, options, _meta) => (columns
|
|
|
2129
2108
|
};
|
|
2130
2109
|
return processRuleGroup(convertFromIC(ruleGroup), true);
|
|
2131
2110
|
};
|
|
2132
|
-
|
|
2133
2111
|
//#endregion
|
|
2134
2112
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorElasticSearch.ts
|
|
2135
2113
|
/**
|
|
@@ -2158,7 +2136,6 @@ const defaultRuleGroupProcessorElasticSearch = (ruleGroup, options) => {
|
|
|
2158
2136
|
const processedRuleGroup = processRuleGroup(convertFromIC(ruleGroup));
|
|
2159
2137
|
return processedRuleGroup === false ? {} : processedRuleGroup;
|
|
2160
2138
|
};
|
|
2161
|
-
|
|
2162
2139
|
//#endregion
|
|
2163
2140
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorJSONata.ts
|
|
2164
2141
|
/**
|
|
@@ -2215,7 +2192,6 @@ const defaultRuleGroupProcessorJSONata = (ruleGroup, options) => {
|
|
|
2215
2192
|
};
|
|
2216
2193
|
return processRuleGroup(ruleGroup, true);
|
|
2217
2194
|
};
|
|
2218
|
-
|
|
2219
2195
|
//#endregion
|
|
2220
2196
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorJsonLogic.ts
|
|
2221
2197
|
/**
|
|
@@ -2245,7 +2221,6 @@ const defaultRuleGroupProcessorJsonLogic = (ruleGroup, options) => {
|
|
|
2245
2221
|
};
|
|
2246
2222
|
return processRuleGroup(query, true);
|
|
2247
2223
|
};
|
|
2248
|
-
|
|
2249
2224
|
//#endregion
|
|
2250
2225
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorLDAP.ts
|
|
2251
2226
|
/**
|
|
@@ -2277,7 +2252,6 @@ const defaultRuleGroupProcessorLDAP = (ruleGroup, options) => {
|
|
|
2277
2252
|
};
|
|
2278
2253
|
return processRuleGroup(convertFromIC(ruleGroup), true);
|
|
2279
2254
|
};
|
|
2280
|
-
|
|
2281
2255
|
//#endregion
|
|
2282
2256
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorMongoDB.ts
|
|
2283
2257
|
const isBracketed = (str) => str.startsWith("{") && str.endsWith("}");
|
|
@@ -2312,12 +2286,12 @@ const defaultRuleGroupProcessorMongoDB = (ruleGroup, options, meta) => {
|
|
|
2312
2286
|
fieldData
|
|
2313
2287
|
}), meta);
|
|
2314
2288
|
}).filter(Boolean);
|
|
2315
|
-
|
|
2289
|
+
const result = expressions.length > 0 ? expressions.length === 1 && !hasChildRules ? expressions[0] : `${combinator}:[${expressions.join(",")}]` : fallbackExpression;
|
|
2290
|
+
return rg.not ? `"$not":${isBracketed(result) ? result : `{${result}}`}` : result;
|
|
2316
2291
|
};
|
|
2317
2292
|
const processedQuery = processRuleGroup(convertFromIC(ruleGroup), true);
|
|
2318
2293
|
return isBracketed(processedQuery) ? processedQuery : `{${processedQuery}}`;
|
|
2319
2294
|
};
|
|
2320
|
-
|
|
2321
2295
|
//#endregion
|
|
2322
2296
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorNL.ts
|
|
2323
2297
|
/**
|
|
@@ -2384,7 +2358,6 @@ const defaultRuleGroupProcessorNL = (ruleGroup, options) => {
|
|
|
2384
2358
|
};
|
|
2385
2359
|
return processRuleGroup(ruleGroup, true);
|
|
2386
2360
|
};
|
|
2387
|
-
|
|
2388
2361
|
//#endregion
|
|
2389
2362
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorParameterized.ts
|
|
2390
2363
|
/**
|
|
@@ -2474,7 +2447,6 @@ const defaultRuleGroupProcessorParameterized = (ruleGroup, options) => {
|
|
|
2474
2447
|
params: paramsNamed
|
|
2475
2448
|
};
|
|
2476
2449
|
};
|
|
2477
|
-
|
|
2478
2450
|
//#endregion
|
|
2479
2451
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorPrisma.ts
|
|
2480
2452
|
/**
|
|
@@ -2517,7 +2489,6 @@ const defaultRuleGroupProcessorPrisma = (ruleGroup, options) => {
|
|
|
2517
2489
|
const result = processRuleGroup(convertFromIC(ruleGroup), true);
|
|
2518
2490
|
return ruleGroup.not ? { NOT: result } : result;
|
|
2519
2491
|
};
|
|
2520
|
-
|
|
2521
2492
|
//#endregion
|
|
2522
2493
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorSequelize.ts
|
|
2523
2494
|
/**
|
|
@@ -2558,7 +2529,6 @@ const defaultRuleGroupProcessorSequelize = (ruleGroup, options) => {
|
|
|
2558
2529
|
};
|
|
2559
2530
|
return processRuleGroup(convertFromIC(ruleGroup), true);
|
|
2560
2531
|
};
|
|
2561
|
-
|
|
2562
2532
|
//#endregion
|
|
2563
2533
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorSQL.ts
|
|
2564
2534
|
/**
|
|
@@ -2616,7 +2586,6 @@ const defaultRuleGroupProcessorSQL = (ruleGroup, options) => {
|
|
|
2616
2586
|
};
|
|
2617
2587
|
return processRuleGroup(ruleGroup, true);
|
|
2618
2588
|
};
|
|
2619
|
-
|
|
2620
2589
|
//#endregion
|
|
2621
2590
|
//#region src/utils/formatQuery/defaultRuleProcessorElasticSearch.ts
|
|
2622
2591
|
const rangeOperatorMap = {
|
|
@@ -2766,12 +2735,11 @@ const defaultRuleProcessorElasticSearch = (rule, options = {}) => {
|
|
|
2766
2735
|
}
|
|
2767
2736
|
return false;
|
|
2768
2737
|
};
|
|
2769
|
-
|
|
2770
2738
|
//#endregion
|
|
2771
2739
|
//#region src/utils/formatQuery/defaultRuleProcessorJSONata.ts
|
|
2772
2740
|
const shouldNegate = (op) => op.startsWith("not") || op.startsWith("doesnot");
|
|
2773
2741
|
const quote = (v, escapeQuotes) => `"${typeof v !== "string" || !escapeQuotes ? `${v}` : v.replaceAll(`"`, `\\"`)}"`;
|
|
2774
|
-
const negate = (clause,
|
|
2742
|
+
const negate = (clause, neg) => neg ? `$not(${clause})` : clause;
|
|
2775
2743
|
const escapeStringRegex = (s) => `${s}`.replaceAll(/[/$()*+.?[\\\]^{|}]/g, String.raw`\$&`).replaceAll("-", String.raw`\x2d`);
|
|
2776
2744
|
/**
|
|
2777
2745
|
* Default rule processor used by {@link formatQuery} for "jsonata" format.
|
|
@@ -2850,7 +2818,6 @@ const defaultRuleProcessorJSONata = (rule, options = {}) => {
|
|
|
2850
2818
|
}
|
|
2851
2819
|
return "";
|
|
2852
2820
|
};
|
|
2853
|
-
|
|
2854
2821
|
//#endregion
|
|
2855
2822
|
//#region src/utils/formatQuery/defaultRuleProcessorJsonLogic.ts
|
|
2856
2823
|
const convertOperator = (op) => op.replace(/^(=)$/, "$1=").replace(/^notnull$/i, "!=").replace(/^null$/i, "==");
|
|
@@ -2945,10 +2912,9 @@ const defaultRuleProcessorJsonLogic = (rule, options = {}) => {
|
|
|
2945
2912
|
}
|
|
2946
2913
|
return false;
|
|
2947
2914
|
};
|
|
2948
|
-
|
|
2949
2915
|
//#endregion
|
|
2950
2916
|
//#region src/utils/formatQuery/defaultRuleProcessorLDAP.ts
|
|
2951
|
-
const negateIf = (clause, negate
|
|
2917
|
+
const negateIf = (clause, negate) => negate ? `(!${clause})` : `${clause}`;
|
|
2952
2918
|
const ldapEscape = (s) => `${trimIfString(s)}`.replaceAll(/[()&|=<>~*\\/]/g, (m) => `\\${m.codePointAt(0).toString(16)}`);
|
|
2953
2919
|
/**
|
|
2954
2920
|
* Default rule processor used by {@link formatQuery} for "ldap" format.
|
|
@@ -2997,7 +2963,6 @@ const defaultRuleProcessorLDAP = (rule, options = {}) => {
|
|
|
2997
2963
|
// istanbul ignore next
|
|
2998
2964
|
return "";
|
|
2999
2965
|
};
|
|
3000
|
-
|
|
3001
2966
|
//#endregion
|
|
3002
2967
|
//#region src/utils/formatQuery/defaultValueProcessorNL.ts
|
|
3003
2968
|
const escapeStringValueQuotes = (v, quoteChar, escapeQuotes) => escapeQuotes && typeof v === "string" ? v.replaceAll(`${quoteChar}`, `${quoteChar}${quoteChar}`) : v;
|
|
@@ -3051,7 +3016,6 @@ const defaultValueProcessorNL = (rule, opts = {}) => {
|
|
|
3051
3016
|
if (typeof rule.value === "boolean") return rule.value ? trueTL : falseTL;
|
|
3052
3017
|
return valueIsField ? wrapFieldName((_getOption$label3 = (_getOption3 = getOption((_ref3 = fields) !== null && _ref3 !== void 0 ? _ref3 : [], rule.value)) === null || _getOption3 === void 0 ? void 0 : _getOption3.label) !== null && _getOption$label3 !== void 0 ? _getOption$label3 : rule.value) : shouldRenderAsNumber(rule.value, parseNumbers) ? `${trimIfString(rule.value)}` : `${wrapAndEscape(rule.value)}`;
|
|
3053
3018
|
};
|
|
3054
|
-
|
|
3055
3019
|
//#endregion
|
|
3056
3020
|
//#region src/utils/formatQuery/defaultRuleProcessorNL.ts
|
|
3057
3021
|
/**
|
|
@@ -3160,7 +3124,6 @@ const defaultRuleProcessorNL = (rule, opts) => {
|
|
|
3160
3124
|
};
|
|
3161
3125
|
return normalizeConstituentWordOrder(wordOrder).map((term) => `${wordOrderMap[term]}`).join(" ").trim();
|
|
3162
3126
|
};
|
|
3163
|
-
|
|
3164
3127
|
//#endregion
|
|
3165
3128
|
//#region src/utils/formatQuery/defaultRuleProcessorSQL.ts
|
|
3166
3129
|
/**
|
|
@@ -3211,7 +3174,6 @@ const defaultRuleProcessorSQL = (rule, opts = {}) => {
|
|
|
3211
3174
|
if ((operatorLowerCase === "in" || operatorLowerCase === "not in" || operatorLowerCase === "between" || operatorLowerCase === "not between") && !value) return "";
|
|
3212
3175
|
return `${ruleField} ${operator} ${value}`.trim();
|
|
3213
3176
|
};
|
|
3214
|
-
|
|
3215
3177
|
//#endregion
|
|
3216
3178
|
//#region src/utils/formatQuery/defaultRuleProcessorParameterized.ts
|
|
3217
3179
|
/**
|
|
@@ -3310,7 +3272,6 @@ const defaultRuleProcessorParameterized = (rule, opts, meta) => {
|
|
|
3310
3272
|
}
|
|
3311
3273
|
return finalize(`${qPre}${rule.field}${qPost} ${sqlOperator} ${parameterized ? numberedParams ? `${paramPrefix}${processedParams.length + 1}` : "?" : `${paramPrefix}${paramName}`}`.trim());
|
|
3312
3274
|
};
|
|
3313
|
-
|
|
3314
3275
|
//#endregion
|
|
3315
3276
|
//#region src/utils/formatQuery/defaultRuleProcessorPrisma.ts
|
|
3316
3277
|
const processNumber = (value, fallback, parseNumbers) => shouldRenderAsNumber(value, !!parseNumbers || typeof value === "bigint") ? Number(parseNumber(value, { parseNumbers: !!parseNumbers })) : fallback;
|
|
@@ -3372,7 +3333,6 @@ const defaultRuleProcessorPrisma = (rule, options = {}) => {
|
|
|
3372
3333
|
}
|
|
3373
3334
|
return "";
|
|
3374
3335
|
};
|
|
3375
|
-
|
|
3376
3336
|
//#endregion
|
|
3377
3337
|
//#region src/utils/formatQuery/defaultRuleProcessorSequelize.ts
|
|
3378
3338
|
/**
|
|
@@ -3439,7 +3399,6 @@ const defaultRuleProcessorSequelize = (rule, { parseNumbers, preserveValueOrder,
|
|
|
3439
3399
|
}
|
|
3440
3400
|
}
|
|
3441
3401
|
};
|
|
3442
|
-
|
|
3443
3402
|
//#endregion
|
|
3444
3403
|
//#region src/utils/formatQuery/formatQuery.ts
|
|
3445
3404
|
/**
|
|
@@ -3528,8 +3487,8 @@ const defaultFormatQueryOptions = {
|
|
|
3528
3487
|
paramsKeepPrefix: false,
|
|
3529
3488
|
numberedParams: false,
|
|
3530
3489
|
preserveValueOrder: false,
|
|
3531
|
-
placeholderFieldName:
|
|
3532
|
-
placeholderOperatorName:
|
|
3490
|
+
placeholderFieldName: "~",
|
|
3491
|
+
placeholderOperatorName: "~",
|
|
3533
3492
|
quoteValuesWith: "'",
|
|
3534
3493
|
concatOperator: "||",
|
|
3535
3494
|
preset: "ansi",
|
|
@@ -3635,7 +3594,7 @@ function formatQuery(ruleGroup, optionParam = {}) {
|
|
|
3635
3594
|
switch (format) {
|
|
3636
3595
|
case "json":
|
|
3637
3596
|
case "json_without_ids": {
|
|
3638
|
-
const rg = parseNumbers ?
|
|
3597
|
+
const rg = parseNumbers ? numerifyValues(ruleGroup, finalOptions) : ruleGroup;
|
|
3639
3598
|
if (format === "json_without_ids") return JSON.stringify(rg, (key, value) => key === "id" || key === "path" ? void 0 : bigIntJsonStringifyReplacer(key, value));
|
|
3640
3599
|
return JSON.stringify(rg, bigIntJsonStringifyReplacer, 2);
|
|
3641
3600
|
}
|
|
@@ -3657,7 +3616,6 @@ function formatQuery(ruleGroup, optionParam = {}) {
|
|
|
3657
3616
|
default: return "";
|
|
3658
3617
|
}
|
|
3659
3618
|
}
|
|
3660
|
-
|
|
3661
3619
|
//#endregion
|
|
3662
3620
|
//#region src/utils/formatQuery/index.ts
|
|
3663
3621
|
const generateValueProcessor = (vpbr) => (field, operator, value, valueSource) => vpbr({
|
|
@@ -3708,7 +3666,6 @@ const defaultValueProcessorMongoDBByRule = defaultRuleProcessorMongoDB;
|
|
|
3708
3666
|
* @group Export
|
|
3709
3667
|
*/
|
|
3710
3668
|
const defaultValueProcessorSpELByRule = defaultRuleProcessorSpEL;
|
|
3711
|
-
|
|
3712
3669
|
//#endregion
|
|
3713
3670
|
//#region src/utils/pathUtils.ts
|
|
3714
3671
|
/**
|
|
@@ -3767,7 +3724,7 @@ const pathsAreEqual = (path1, path2) => path1.length === path2.length && path1.e
|
|
|
3767
3724
|
* Determines if the first path is an ancestor of the second path. The first path must
|
|
3768
3725
|
* be shorter and exactly match the second path up through the length of the first path.
|
|
3769
3726
|
*/
|
|
3770
|
-
const isAncestor = (maybeAncestor, path) => maybeAncestor.length < path.length &&
|
|
3727
|
+
const isAncestor = (maybeAncestor, path) => maybeAncestor.length < path.length && new RegExp(`^${maybeAncestor.join("-")}`).test(path.join("-"));
|
|
3771
3728
|
/**
|
|
3772
3729
|
* Finds the deepest/longest path that two paths have in common.
|
|
3773
3730
|
*/
|
|
@@ -3800,11 +3757,9 @@ const pathIsDisabled = (path, query) => {
|
|
|
3800
3757
|
}
|
|
3801
3758
|
return disabled;
|
|
3802
3759
|
};
|
|
3803
|
-
|
|
3804
3760
|
//#endregion
|
|
3805
3761
|
//#region src/utils/generateAccessibleDescription.ts
|
|
3806
3762
|
const generateAccessibleDescription = (params) => pathsAreEqual([], params.path) ? `Query builder` : `Rule group at path ${params.path.join("-")}`;
|
|
3807
|
-
|
|
3808
3763
|
//#endregion
|
|
3809
3764
|
//#region src/utils/generateID.ts
|
|
3810
3765
|
const cryptoModule = globalThis.crypto;
|
|
@@ -3839,7 +3794,6 @@ if (cryptoModule) {
|
|
|
3839
3794
|
};
|
|
3840
3795
|
}
|
|
3841
3796
|
}
|
|
3842
|
-
|
|
3843
3797
|
//#endregion
|
|
3844
3798
|
//#region src/utils/getMatchModesUtil.ts
|
|
3845
3799
|
const dummyFD$1 = {
|
|
@@ -3871,7 +3825,6 @@ const getMatchModesUtil = (fieldData, getMatchModes) => {
|
|
|
3871
3825
|
};
|
|
3872
3826
|
})) !== null && _matchModes$map !== void 0 ? _matchModes$map : [];
|
|
3873
3827
|
};
|
|
3874
|
-
|
|
3875
3828
|
//#endregion
|
|
3876
3829
|
//#region src/utils/getValidationClassNames.ts
|
|
3877
3830
|
/**
|
|
@@ -3882,7 +3835,6 @@ const getValidationClassNames = (validationResult) => {
|
|
|
3882
3835
|
const valid = typeof validationResult === "boolean" ? validationResult : typeof validationResult === "object" && validationResult !== null ? validationResult.valid : null;
|
|
3883
3836
|
return typeof valid === "boolean" ? valid ? standardClassnames.valid : standardClassnames.invalid : "";
|
|
3884
3837
|
};
|
|
3885
|
-
|
|
3886
3838
|
//#endregion
|
|
3887
3839
|
//#region src/utils/getValueSourcesUtil.ts
|
|
3888
3840
|
const defaultValueSourcesArray = [{
|
|
@@ -3919,23 +3871,28 @@ const getValueSourcesUtil = (fieldData, operator, getValueSources) => {
|
|
|
3919
3871
|
};
|
|
3920
3872
|
});
|
|
3921
3873
|
};
|
|
3922
|
-
|
|
3923
3874
|
//#endregion
|
|
3924
3875
|
//#region src/utils/mergeAnyTranslations.ts
|
|
3925
3876
|
/**
|
|
3926
3877
|
* Merges any number of partial translations into a single definition.
|
|
3927
3878
|
*/
|
|
3928
|
-
const mergeAnyTranslations = (base, ...otherTranslations) =>
|
|
3879
|
+
const mergeAnyTranslations = (base, ...otherTranslations) => {
|
|
3880
|
+
const result = _objectSpread2({}, base);
|
|
3929
3881
|
for (const translations of otherTranslations)
|
|
3930
3882
|
// istanbul ignore else
|
|
3931
|
-
if (translations) for (const
|
|
3932
|
-
|
|
3933
|
-
});
|
|
3883
|
+
if (translations) for (const key of objectKeys(translations)) {
|
|
3884
|
+
if (isUnsafeKey(key)) continue;
|
|
3885
|
+
if (result[key]) result[key] = _objectSpread2(_objectSpread2({}, result[key]), translations[key]);
|
|
3886
|
+
else result[key] = _objectSpread2({}, translations[key]);
|
|
3887
|
+
}
|
|
3888
|
+
return result;
|
|
3889
|
+
};
|
|
3934
3890
|
const mergeAnyTranslation = (el, keyPropContextMap, defaults) => {
|
|
3891
|
+
if (isUnsafeKey(el)) return void 0;
|
|
3935
3892
|
const finalKeys = objectEntries(keyPropContextMap).map(([key, [pT, cT]]) => {
|
|
3936
3893
|
var _ref, _defaults$el;
|
|
3937
3894
|
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]];
|
|
3938
|
-
}).filter((k) => !!k[1]);
|
|
3895
|
+
}).filter((k) => !isUnsafeKey(k[0]) && !!k[1]);
|
|
3939
3896
|
if (finalKeys.length > 0 || defaults) {
|
|
3940
3897
|
var _defaults$el2;
|
|
3941
3898
|
const defaultProperties = (_defaults$el2 = defaults === null || defaults === void 0 ? void 0 : defaults[el]) !== null && _defaults$el2 !== void 0 ? _defaults$el2 : {};
|
|
@@ -3943,7 +3900,6 @@ const mergeAnyTranslation = (el, keyPropContextMap, defaults) => {
|
|
|
3943
3900
|
return { [el]: finalObject };
|
|
3944
3901
|
}
|
|
3945
3902
|
};
|
|
3946
|
-
|
|
3947
3903
|
//#endregion
|
|
3948
3904
|
//#region src/utils/mergeClassnames.ts
|
|
3949
3905
|
const joinClassnamesByName = (name, args) => clsx(args.map((c) => clsx(c === null || c === void 0 ? void 0 : c[name])));
|
|
@@ -3993,7 +3949,6 @@ const mergeClassnames = (...args) => ({
|
|
|
3993
3949
|
hasSubQuery: joinClassnamesByName("hasSubQuery", args),
|
|
3994
3950
|
loading: joinClassnamesByName("loading", args)
|
|
3995
3951
|
});
|
|
3996
|
-
|
|
3997
3952
|
//#endregion
|
|
3998
3953
|
//#region src/utils/preferProp.ts
|
|
3999
3954
|
const preferPropDefaultTrue = (prop, context) => prop === false ? false : prop ? true : !(context === false);
|
|
@@ -4016,29 +3971,41 @@ const preferFlagProps = (props = {}, contextVals = {}, finalize) => objectEntrie
|
|
|
4016
3971
|
acc[key] = preferProp(def, props[key], contextVals[key], !finalize);
|
|
4017
3972
|
return acc;
|
|
4018
3973
|
}, {});
|
|
4019
|
-
|
|
4020
3974
|
//#endregion
|
|
4021
3975
|
//#region src/utils/prepareQueryObjects.ts
|
|
4022
3976
|
/**
|
|
4023
3977
|
* Ensures that a rule is valid by adding an `id` property if it does not already exist.
|
|
4024
3978
|
*/
|
|
4025
|
-
const prepareRule = (rule, { idGenerator = generateID } = {}) =>
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
3979
|
+
const prepareRule = (rule, { idGenerator = generateID } = {}) => {
|
|
3980
|
+
const needsId = !rule.id;
|
|
3981
|
+
const hasMatchMode = processMatchMode(rule);
|
|
3982
|
+
if (!needsId && !hasMatchMode) return rule;
|
|
3983
|
+
return _objectSpread2(_objectSpread2(_objectSpread2({}, rule), needsId && { id: idGenerator() }), hasMatchMode && { value: prepareRuleGroup(rule.value, { idGenerator }) });
|
|
3984
|
+
};
|
|
4029
3985
|
/**
|
|
4030
3986
|
* Ensures that a rule group is valid by recursively adding an `id` property to the group itself
|
|
4031
3987
|
* and all its rules and subgroups where one does not already exist.
|
|
4032
3988
|
*/
|
|
4033
|
-
const prepareRuleGroup = (queryObject, { idGenerator = generateID } = {}) =>
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
3989
|
+
const prepareRuleGroup = (queryObject, { idGenerator = generateID } = {}) => {
|
|
3990
|
+
const needsId = !queryObject.id;
|
|
3991
|
+
let rulesChanged = false;
|
|
3992
|
+
const newRules = [];
|
|
3993
|
+
for (let i = 0; i < queryObject.rules.length; i++) {
|
|
3994
|
+
const r = queryObject.rules[i];
|
|
3995
|
+
if (typeof r === "string") newRules.push(r);
|
|
3996
|
+
else {
|
|
3997
|
+
const prepared = isRuleGroup(r) ? prepareRuleGroup(r, { idGenerator }) : prepareRule(r, { idGenerator });
|
|
3998
|
+
newRules.push(prepared);
|
|
3999
|
+
if (prepared !== r) rulesChanged = true;
|
|
4000
|
+
}
|
|
4001
|
+
}
|
|
4002
|
+
if (!needsId && !rulesChanged) return queryObject;
|
|
4003
|
+
return _objectSpread2(_objectSpread2(_objectSpread2({}, queryObject), needsId && { id: idGenerator() }), {}, { rules: newRules });
|
|
4004
|
+
};
|
|
4037
4005
|
/**
|
|
4038
4006
|
* Ensures that a rule or group is valid. See {@link prepareRule} and {@link prepareRuleGroup}.
|
|
4039
4007
|
*/
|
|
4040
4008
|
const prepareRuleOrGroup = (rg, { idGenerator = generateID } = {}) => isRuleGroup(rg) ? prepareRuleGroup(rg, { idGenerator }) : prepareRule(rg, { idGenerator });
|
|
4041
|
-
|
|
4042
4009
|
//#endregion
|
|
4043
4010
|
//#region src/utils/regenerateIDs.ts
|
|
4044
4011
|
/**
|
|
@@ -4056,44 +4023,65 @@ const regenerateIDs = (subject, { idGenerator = generateID } = {}) => {
|
|
|
4056
4023
|
if (Array.isArray(newGroup.rules)) newGroup.rules = subject.rules.map((r) => typeof r === "string" ? r : isRuleGroup(r) ? regenerateIDs(r, { idGenerator }) : regenerateID(r, { idGenerator }));
|
|
4057
4024
|
return newGroup;
|
|
4058
4025
|
};
|
|
4059
|
-
|
|
4060
4026
|
//#endregion
|
|
4061
4027
|
//#region src/utils/queryTools.ts
|
|
4062
4028
|
/**
|
|
4063
|
-
* Adds a rule or group to a query.
|
|
4064
|
-
*
|
|
4029
|
+
* Adds a rule or group to a query without mutating the original query.
|
|
4030
|
+
*
|
|
4031
|
+
* @returns A new query with the rule or group added.
|
|
4065
4032
|
*
|
|
4066
4033
|
* @group Query Tools
|
|
4067
4034
|
*/
|
|
4068
|
-
const add = (query, ruleOrGroup, parentPathOrID,
|
|
4069
|
-
|
|
4070
|
-
|
|
4035
|
+
const add = (query, ruleOrGroup, parentPathOrID, options = {}) => produce(query, (q) => addInPlace(q, ruleOrGroup, parentPathOrID, options));
|
|
4036
|
+
/**
|
|
4037
|
+
* Adds a rule or group to a query in place.
|
|
4038
|
+
*
|
|
4039
|
+
* @returns The query (mutated in place) with the rule or group added.
|
|
4040
|
+
*
|
|
4041
|
+
* @group Query Tools
|
|
4042
|
+
*/
|
|
4043
|
+
const addInPlace = (query, ruleOrGroup, parentPathOrID, options = {}) => {
|
|
4044
|
+
const { combinators = defaultCombinators, combinatorPreceding, idGenerator = generateID } = options;
|
|
4045
|
+
const parent = Array.isArray(parentPathOrID) ? findPath(parentPathOrID, query) : findID(parentPathOrID, query);
|
|
4046
|
+
if (!parent || !isRuleGroup(parent)) return query;
|
|
4071
4047
|
if (isRuleGroupTypeIC(parent) && parent.rules.length > 0) {
|
|
4072
4048
|
const prevCombinator = parent.rules.at(-2);
|
|
4073
4049
|
parent.rules.push(combinatorPreceding !== null && combinatorPreceding !== void 0 ? combinatorPreceding : typeof prevCombinator === "string" ? prevCombinator : getFirstOption(combinators));
|
|
4074
4050
|
}
|
|
4075
4051
|
parent.rules.push(prepareRuleOrGroup(ruleOrGroup, { idGenerator }));
|
|
4076
|
-
|
|
4052
|
+
return query;
|
|
4053
|
+
};
|
|
4054
|
+
/**
|
|
4055
|
+
* Updates a property of a rule or group within a query without mutating the original query.
|
|
4056
|
+
*
|
|
4057
|
+
* @returns A new query with the rule or group property updated.
|
|
4058
|
+
*
|
|
4059
|
+
* @group Query Tools
|
|
4060
|
+
*/
|
|
4061
|
+
const update = (query, prop, value, pathOrID, options = {}) => produce(query, (q) => updateInPlace(q, prop, value, pathOrID, options));
|
|
4077
4062
|
/**
|
|
4078
|
-
* Updates a property of a rule or group within a query.
|
|
4079
|
-
*
|
|
4063
|
+
* Updates a property of a rule or group within a query in place.
|
|
4064
|
+
*
|
|
4065
|
+
* @returns The query (mutated in place) with the rule or group property updated.
|
|
4080
4066
|
*
|
|
4081
4067
|
* @group Query Tools
|
|
4082
4068
|
*/
|
|
4083
|
-
const
|
|
4084
|
-
const
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4069
|
+
const updateInPlace = (query, prop, value, pathOrID, options = {}) => {
|
|
4070
|
+
const { resetOnFieldChange: _resetOnFieldChange = true, resetOnOperatorChange = false, getRuleDefaultOperator = () => "=", getValueSources = () => ["value"], getRuleDefaultValue = () => "", getMatchModes = () => [] } = options;
|
|
4071
|
+
let resetOnFieldChange = _resetOnFieldChange;
|
|
4072
|
+
const path = Array.isArray(pathOrID) ? pathOrID : getPathOfID(pathOrID, query);
|
|
4073
|
+
if (!path) return query;
|
|
4074
|
+
if (prop === "combinator" && !isRuleGroupType(query)) {
|
|
4075
|
+
const parentRules = findPath(getParentPath(path), query).rules;
|
|
4088
4076
|
if (path.at(-1) % 2 === 1) parentRules[path.at(-1)] = value;
|
|
4089
|
-
return;
|
|
4077
|
+
return query;
|
|
4090
4078
|
}
|
|
4091
|
-
const ruleOrGroup = findPath(path,
|
|
4092
|
-
if (!ruleOrGroup) return;
|
|
4079
|
+
const ruleOrGroup = findPath(path, query);
|
|
4080
|
+
if (!ruleOrGroup) return query;
|
|
4093
4081
|
const isGroup = isRuleGroup(ruleOrGroup);
|
|
4094
|
-
if (ruleOrGroup[prop] === value) return;
|
|
4082
|
+
if (ruleOrGroup[prop] === value) return query;
|
|
4095
4083
|
if (prop !== "valueSource") ruleOrGroup[prop] = value;
|
|
4096
|
-
if (isGroup) return;
|
|
4084
|
+
if (isGroup) return query;
|
|
4097
4085
|
let resetValueSource = false;
|
|
4098
4086
|
let resetValue = false;
|
|
4099
4087
|
if (prop === "field") {
|
|
@@ -4129,25 +4117,33 @@ const update = (query, prop, value, pathOrID, { resetOnFieldChange = true, reset
|
|
|
4129
4117
|
ruleOrGroup.valueSource = resetValueSource ? defaultValueSource : value;
|
|
4130
4118
|
}
|
|
4131
4119
|
if (resetValue) ruleOrGroup.value = getRuleDefaultValue(ruleOrGroup);
|
|
4132
|
-
|
|
4120
|
+
return query;
|
|
4121
|
+
};
|
|
4122
|
+
/**
|
|
4123
|
+
* Removes a rule or group from a query without mutating the original query.
|
|
4124
|
+
*
|
|
4125
|
+
* @returns A new query with the rule or group removed.
|
|
4126
|
+
*
|
|
4127
|
+
* @group Query Tools
|
|
4128
|
+
*/
|
|
4129
|
+
const remove = (query, pathOrID) => produce(query, (q) => removeInPlace(q, pathOrID));
|
|
4133
4130
|
/**
|
|
4134
|
-
* Removes a rule or group from a query.
|
|
4135
|
-
*
|
|
4131
|
+
* Removes a rule or group from a query in place.
|
|
4132
|
+
*
|
|
4133
|
+
* @returns The query (mutated in place) with the rule or group removed.
|
|
4136
4134
|
*
|
|
4137
4135
|
* @group Query Tools
|
|
4138
4136
|
*/
|
|
4139
|
-
const
|
|
4137
|
+
const removeInPlace = (query, pathOrID) => {
|
|
4140
4138
|
const path = Array.isArray(pathOrID) ? pathOrID : getPathOfID(pathOrID, query);
|
|
4141
|
-
if (!path) return query;
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
const
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
} else parent.rules.splice(index, 1);
|
|
4150
|
-
});
|
|
4139
|
+
if (!path || path.length === 0 || !isRuleGroupType(query) && !findPath(path, query)) return query;
|
|
4140
|
+
const index = path.at(-1);
|
|
4141
|
+
const parent = findPath(getParentPath(path), query);
|
|
4142
|
+
if (parent && isRuleGroup(parent)) if (!isRuleGroupType(parent) && parent.rules.length > 1) {
|
|
4143
|
+
const idxStartDelete = index === 0 ? 0 : index - 1;
|
|
4144
|
+
parent.rules.splice(idxStartDelete, 2);
|
|
4145
|
+
} else parent.rules.splice(index, 1);
|
|
4146
|
+
return query;
|
|
4151
4147
|
};
|
|
4152
4148
|
const getNextPath = (query, currentPath, newPathOrShiftDirection) => {
|
|
4153
4149
|
if (Array.isArray(newPathOrShiftDirection)) return newPathOrShiftDirection;
|
|
@@ -4174,65 +4170,85 @@ const getNextPath = (query, currentPath, newPathOrShiftDirection) => {
|
|
|
4174
4170
|
return currentPath;
|
|
4175
4171
|
};
|
|
4176
4172
|
/**
|
|
4177
|
-
* Moves a rule or group from one path to another
|
|
4178
|
-
* `{ clone: true }` to copy instead of move.
|
|
4179
|
-
*
|
|
4173
|
+
* Moves a rule or group from one path to another without mutating the original query.
|
|
4174
|
+
* In the options parameter, pass `{ clone: true }` to copy instead of move.
|
|
4175
|
+
*
|
|
4176
|
+
* @returns A new query with the rule or group moved or cloned.
|
|
4180
4177
|
*
|
|
4181
4178
|
* @group Query Tools
|
|
4182
4179
|
*/
|
|
4183
|
-
const move = (query, oldPathOrID, newPath,
|
|
4180
|
+
const move = (query, oldPathOrID, newPath, options = {}) => produce(query, (q) => moveInPlace(q, oldPathOrID, newPath, options));
|
|
4181
|
+
/**
|
|
4182
|
+
* Moves a rule or group from one path to another in place.
|
|
4183
|
+
* In the options parameter, pass `{ clone: true }` to copy instead of move.
|
|
4184
|
+
*
|
|
4185
|
+
* @returns The query (mutated in place) with the rule or group moved or cloned.
|
|
4186
|
+
*
|
|
4187
|
+
* @group Query Tools
|
|
4188
|
+
*/
|
|
4189
|
+
const moveInPlace = (query, oldPathOrID, newPath, options = {}) => {
|
|
4190
|
+
const { clone = false, combinators = defaultCombinators, idGenerator = generateID } = options;
|
|
4184
4191
|
const oldPath = Array.isArray(oldPathOrID) ? oldPathOrID : getPathOfID(oldPathOrID, query);
|
|
4185
4192
|
if (!oldPath) return query;
|
|
4186
4193
|
const nextPath = getNextPath(query, oldPath, newPath);
|
|
4187
4194
|
if (oldPath.length === 0 || pathsAreEqual(oldPath, nextPath) || !findPath(getParentPath(nextPath), query)) return query;
|
|
4188
4195
|
const ruleOrGroupOriginal = findPath(oldPath, query);
|
|
4189
4196
|
if (!ruleOrGroupOriginal) return query;
|
|
4190
|
-
const ruleOrGroup = clone ? regenerateIDs(ruleOrGroupOriginal, { idGenerator }) : ruleOrGroupOriginal;
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
});
|
|
4197
|
+
const ruleOrGroup = clone ? regenerateIDs(isDraft(ruleOrGroupOriginal) ? current(ruleOrGroupOriginal) : ruleOrGroupOriginal, { idGenerator }) : ruleOrGroupOriginal;
|
|
4198
|
+
const independentCombinators = isRuleGroupTypeIC(query);
|
|
4199
|
+
const parentOfRuleToRemove = findPath(getParentPath(oldPath), query);
|
|
4200
|
+
const ruleToRemoveIndex = oldPath.at(-1);
|
|
4201
|
+
const oldPrevCombinator = independentCombinators && ruleToRemoveIndex > 0 ? parentOfRuleToRemove.rules[ruleToRemoveIndex - 1] : null;
|
|
4202
|
+
const oldNextCombinator = independentCombinators && ruleToRemoveIndex < parentOfRuleToRemove.rules.length - 1 ? parentOfRuleToRemove.rules[ruleToRemoveIndex + 1] : null;
|
|
4203
|
+
if (!clone) {
|
|
4204
|
+
const idxStartDelete = independentCombinators ? Math.max(0, ruleToRemoveIndex - 1) : ruleToRemoveIndex;
|
|
4205
|
+
const deleteLength = independentCombinators ? 2 : 1;
|
|
4206
|
+
parentOfRuleToRemove.rules.splice(idxStartDelete, deleteLength);
|
|
4207
|
+
}
|
|
4208
|
+
const newNewPath = [...nextPath];
|
|
4209
|
+
const commonAncestorPath = getCommonAncestorPath(oldPath, nextPath);
|
|
4210
|
+
if (!clone && oldPath.length === commonAncestorPath.length + 1 && nextPath[commonAncestorPath.length] > oldPath[commonAncestorPath.length]) newNewPath[commonAncestorPath.length] -= independentCombinators ? 2 : 1;
|
|
4211
|
+
const parentToInsertInto = findPath(getParentPath(newNewPath), query);
|
|
4212
|
+
const newIndex = newNewPath.at(-1);
|
|
4213
|
+
/**
|
|
4214
|
+
* This function 1) glosses over the need for type assertions to splice directly
|
|
4215
|
+
* into `parentToInsertInto.rules`, and 2) shortens the actual insertion code.
|
|
4216
|
+
*/
|
|
4217
|
+
const insertRuleOrGroup = (...args) => parentToInsertInto.rules.splice(newIndex, 0, ...args);
|
|
4218
|
+
if (parentToInsertInto.rules.length === 0 || !independentCombinators) insertRuleOrGroup(ruleOrGroup);
|
|
4219
|
+
else if (newIndex === 0) if (ruleToRemoveIndex === 0 && oldNextCombinator) insertRuleOrGroup(ruleOrGroup, oldNextCombinator);
|
|
4220
|
+
else {
|
|
4221
|
+
var _ref, _parentToInsertInto$r;
|
|
4222
|
+
insertRuleOrGroup(ruleOrGroup, (_ref = (_parentToInsertInto$r = parentToInsertInto.rules[1]) !== null && _parentToInsertInto$r !== void 0 ? _parentToInsertInto$r : oldPrevCombinator) !== null && _ref !== void 0 ? _ref : getFirstOption(combinators));
|
|
4223
|
+
}
|
|
4224
|
+
else if (oldPrevCombinator) insertRuleOrGroup(oldPrevCombinator, ruleOrGroup);
|
|
4225
|
+
else {
|
|
4226
|
+
var _ref2, _parentToInsertInto$r2;
|
|
4227
|
+
insertRuleOrGroup((_ref2 = (_parentToInsertInto$r2 = parentToInsertInto.rules[newIndex - 2]) !== null && _parentToInsertInto$r2 !== void 0 ? _parentToInsertInto$r2 : oldNextCombinator) !== null && _ref2 !== void 0 ? _ref2 : getFirstOption(combinators), ruleOrGroup);
|
|
4228
|
+
}
|
|
4229
|
+
return query;
|
|
4224
4230
|
};
|
|
4225
4231
|
/**
|
|
4226
|
-
* Inserts a rule or group into a query.
|
|
4227
|
-
*
|
|
4232
|
+
* Inserts a rule or group into a query without mutating the original query.
|
|
4233
|
+
*
|
|
4234
|
+
* @returns A new query with the rule or group inserted.
|
|
4235
|
+
*
|
|
4236
|
+
* @group Query Tools
|
|
4237
|
+
*/
|
|
4238
|
+
const insert = (query, ruleOrGroup, path, options = {}) => produce(query, (q) => insertInPlace(q, ruleOrGroup, path, options));
|
|
4239
|
+
/**
|
|
4240
|
+
* Inserts a rule or group into a query in place.
|
|
4241
|
+
*
|
|
4242
|
+
* @returns The query (mutated in place) with the rule or group inserted.
|
|
4228
4243
|
*
|
|
4229
4244
|
* @group Query Tools
|
|
4230
4245
|
*/
|
|
4231
|
-
const
|
|
4232
|
-
const
|
|
4233
|
-
|
|
4246
|
+
const insertInPlace = (query, ruleOrGroup, path, options = {}) => {
|
|
4247
|
+
const { combinators = defaultCombinators, combinatorPreceding, combinatorSucceeding, idGenerator = generateID, replace = false } = options;
|
|
4248
|
+
const parentToInsertInto = findPath(getParentPath(path), query);
|
|
4249
|
+
if (!parentToInsertInto || !isRuleGroup(parentToInsertInto)) return query;
|
|
4234
4250
|
const rorg = regenerateIDs(ruleOrGroup, { idGenerator });
|
|
4235
|
-
const independentCombinators = isRuleGroupTypeIC(
|
|
4251
|
+
const independentCombinators = isRuleGroupTypeIC(query);
|
|
4236
4252
|
const newIndex = path.at(-1);
|
|
4237
4253
|
/**
|
|
4238
4254
|
* This function 1) glosses over the need for type assertions to splice directly
|
|
@@ -4256,17 +4272,29 @@ const insert = (query, ruleOrGroup, path, { combinators = defaultCombinators, co
|
|
|
4256
4272
|
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);
|
|
4257
4273
|
}
|
|
4258
4274
|
}
|
|
4259
|
-
|
|
4275
|
+
return query;
|
|
4276
|
+
};
|
|
4277
|
+
/**
|
|
4278
|
+
* Creates a new group at a target path with its `rules` array containing the current
|
|
4279
|
+
* objects at the target path and the source path without mutating the original query.
|
|
4280
|
+
* In the options parameter, pass `{ clone: true }` to copy the source rule/group instead of move.
|
|
4281
|
+
*
|
|
4282
|
+
* @returns A new query with the rules or groups grouped.
|
|
4283
|
+
*
|
|
4284
|
+
* @group Query Tools
|
|
4285
|
+
*/
|
|
4286
|
+
const group = (query, sourcePathOrID, targetPathOrID, options = {}) => produce(query, (q) => groupInPlace(q, sourcePathOrID, targetPathOrID, options));
|
|
4260
4287
|
/**
|
|
4261
4288
|
* Creates a new group at a target path with its `rules` array containing the current
|
|
4262
|
-
* objects at the target path and the source path
|
|
4263
|
-
* `{ clone: true }` to copy the source rule/group instead of move.
|
|
4289
|
+
* objects at the target path and the source path in place.
|
|
4290
|
+
* In the options parameter, pass `{ clone: true }` to copy the source rule/group instead of move.
|
|
4264
4291
|
*
|
|
4265
|
-
* @returns The
|
|
4292
|
+
* @returns The query (mutated in place) with the rules or groups grouped.
|
|
4266
4293
|
*
|
|
4267
4294
|
* @group Query Tools
|
|
4268
4295
|
*/
|
|
4269
|
-
const
|
|
4296
|
+
const groupInPlace = (query, sourcePathOrID, targetPathOrID, options = {}) => {
|
|
4297
|
+
const { clone = false, combinators = defaultCombinators, idGenerator = generateID } = options;
|
|
4270
4298
|
const sourcePath = Array.isArray(sourcePathOrID) ? sourcePathOrID : getPathOfID(sourcePathOrID, query);
|
|
4271
4299
|
const targetPath = Array.isArray(targetPathOrID) ? targetPathOrID : getPathOfID(targetPathOrID, query);
|
|
4272
4300
|
if (!sourcePath || !targetPath) return query;
|
|
@@ -4275,32 +4303,31 @@ const group = (query, sourcePathOrID, targetPathOrID, { clone = false, combinato
|
|
|
4275
4303
|
const sourceRuleOrGroupOriginal = findPath(sourcePath, query);
|
|
4276
4304
|
const targetRuleOrGroup = findPath(targetPath, query);
|
|
4277
4305
|
if (!sourceRuleOrGroupOriginal || !targetRuleOrGroup) return query;
|
|
4278
|
-
const sourceRuleOrGroup = clone ? regenerateIDs(sourceRuleOrGroupOriginal, { idGenerator }) : sourceRuleOrGroupOriginal;
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
});
|
|
4306
|
+
const sourceRuleOrGroup = clone ? regenerateIDs(isDraft(sourceRuleOrGroupOriginal) ? current(sourceRuleOrGroupOriginal) : sourceRuleOrGroupOriginal, { idGenerator }) : sourceRuleOrGroupOriginal;
|
|
4307
|
+
const independentCombinators = isRuleGroupTypeIC(query);
|
|
4308
|
+
const parentOfRuleToRemove = findPath(getParentPath(sourcePath), query);
|
|
4309
|
+
const ruleToRemoveIndex = sourcePath.at(-1);
|
|
4310
|
+
if (!clone) {
|
|
4311
|
+
const idxStartDelete = independentCombinators ? Math.max(0, ruleToRemoveIndex - 1) : ruleToRemoveIndex;
|
|
4312
|
+
const deleteLength = independentCombinators ? 2 : 1;
|
|
4313
|
+
parentOfRuleToRemove.rules.splice(idxStartDelete, deleteLength);
|
|
4314
|
+
}
|
|
4315
|
+
const newNewPath = [...nextPath];
|
|
4316
|
+
const commonAncestorPath = getCommonAncestorPath(sourcePath, nextPath);
|
|
4317
|
+
if (!clone && sourcePath.length === commonAncestorPath.length + 1 && nextPath[commonAncestorPath.length] > sourcePath[commonAncestorPath.length]) newNewPath[commonAncestorPath.length] -= independentCombinators ? 2 : 1;
|
|
4318
|
+
const parentOfTargetPath = findPath(getParentPath(newNewPath), query);
|
|
4319
|
+
const targetPathIndex = newNewPath.at(-1);
|
|
4320
|
+
parentOfTargetPath.rules.splice(targetPathIndex, 1, prepareRuleOrGroup(independentCombinators ? { rules: [
|
|
4321
|
+
targetRuleOrGroup,
|
|
4322
|
+
getFirstOption(combinators),
|
|
4323
|
+
sourceRuleOrGroup
|
|
4324
|
+
] } : {
|
|
4325
|
+
combinator: getFirstOption(combinators),
|
|
4326
|
+
rules: [targetRuleOrGroup, sourceRuleOrGroup]
|
|
4327
|
+
}, { idGenerator }));
|
|
4328
|
+
return query;
|
|
4302
4329
|
};
|
|
4303
|
-
|
|
4304
4330
|
//#endregion
|
|
4305
|
-
export { LogType, TestID, add, bigIntJsonParseReviver, bigIntJsonStringifyReplacer, celCombinatorMap, clsx, convertFromIC, convertQuery, convertToIC, defaultCELValueProcessor, defaultCombinatorLabelMap, defaultCombinators, defaultCombinatorsExtended, defaultControlClassnames, defaultExportOperatorMap, defaultJoinChar, defaultMatchModes, defaultMongoDBValueProcessor, defaultNLTranslations, defaultOperatorLabelMap, defaultOperatorNegationMap, defaultOperatorProcessorNL, defaultOperatorProcessorSQL, defaultOperators, defaultPlaceholderFieldGroupLabel, defaultPlaceholderFieldLabel, defaultPlaceholderFieldName, defaultPlaceholderLabel, defaultPlaceholderName, defaultPlaceholderOperatorGroupLabel, defaultPlaceholderOperatorLabel, defaultPlaceholderOperatorName, defaultPlaceholderValueGroupLabel, defaultPlaceholderValueLabel, defaultPlaceholderValueName, defaultRuleGroupProcessorCEL, defaultRuleGroupProcessorDrizzle, defaultRuleGroupProcessorElasticSearch, defaultRuleGroupProcessorJSONata, defaultRuleGroupProcessorJsonLogic, defaultRuleGroupProcessorLDAP, defaultRuleGroupProcessorMongoDB, defaultRuleGroupProcessorMongoDBQuery, defaultRuleGroupProcessorNL, defaultRuleGroupProcessorParameterized, defaultRuleGroupProcessorPrisma, defaultRuleGroupProcessorSQL, defaultRuleGroupProcessorSequelize, defaultRuleGroupProcessorSpEL, defaultRuleProcessorCEL, defaultRuleProcessorDrizzle, defaultRuleProcessorElasticSearch, defaultRuleProcessorJSONata, defaultRuleProcessorJsonLogic, defaultRuleProcessorLDAP, defaultRuleProcessorMongoDB, defaultRuleProcessorMongoDBQuery, defaultRuleProcessorNL, defaultRuleProcessorParameterized, defaultRuleProcessorPrisma, defaultRuleProcessorSQL, defaultRuleProcessorSequelize, defaultRuleProcessorSpEL, defaultSpELValueProcessor, defaultTranslations, defaultValidator, defaultValueProcessor, defaultValueProcessorByRule, defaultValueProcessorCELByRule, defaultValueProcessorMongoDBByRule, defaultValueProcessorNL, defaultValueProcessorSpELByRule, filterFieldsByComparator, findID, findPath, formatQuery, formatQueryOptionPresets, generateAccessibleDescription, generateID, getCommonAncestorPath, getFirstOption, getMatchModesUtil, getNLTranslataion, getOption, getParentPath, getParseNumberMethod, getPathOfID, getQuoteFieldNamesWithArray, getQuotedFieldName, getValidationClassNames, getValueSourcesUtil, group, groupInvalidReasons, insert, isAncestor, isFlexibleOptionArray, isFlexibleOptionGroupArray, isFullOptionArray, isFullOptionGroupArray, isOptionGroupArray, isPojo, isRuleGroup, isRuleGroupType, isRuleGroupTypeIC, isRuleOrGroupValid, isRuleType, isValidValue, isValidationResult, isValueProcessorLegacy, joinWith, jsonLogicAdditionalOperators, lc, mapSQLOperator, mergeAnyTranslation, mergeAnyTranslations, mergeClassnames, mongoDbFallback, mongoOperators, move, normalizeConstituentWordOrder, nullFreeArray, nullOrUndefinedOrEmpty, numericRegex, numerifyValues, objectEntries, objectKeys, parseNumber, pathIsDisabled, pathsAreEqual, preferAnyProp, preferFlagProps, preferProp, prepareOptionList, prepareRule, prepareRuleGroup, prepareRuleOrGroup, prismaFallback, prismaOperators, processMatchMode, queryBuilderFlagDefaults, regenerateID, regenerateIDs, remove, rootPath, shouldRenderAsNumber, splitBy, sqlDialectPresets, standardClassnames, toArray, toFlatOptionArray, toFullOption, toFullOptionList, toFullOptionMap, transformQuery, trimIfString, uniqByIdentifier, uniqByName, uniqOptGroups, uniqOptList, update };
|
|
4331
|
+
export { LogType, TestID, add, addInPlace, 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, groupInPlace, groupInvalidReasons, insert, insertInPlace, isAncestor, isFlexibleOptionArray, isFlexibleOptionGroupArray, isFullOptionArray, isFullOptionGroupArray, isOptionGroupArray, isPojo, isRuleGroup, isRuleGroupType, isRuleGroupTypeIC, isRuleOrGroupValid, isRuleType, isUnsafeKey, isValidValue, isValidationResult, isValueProcessorLegacy, joinWith, jsonLogicAdditionalOperators, lc, mapSQLOperator, mergeAnyTranslation, mergeAnyTranslations, mergeClassnames, mongoDbFallback, mongoOperators, move, moveInPlace, normalizeConstituentWordOrder, nullFreeArray, nullOrUndefinedOrEmpty, numericRegex, numerifyValues, objectEntries, objectKeys, parseNumber, pathIsDisabled, pathsAreEqual, preferAnyProp, preferFlagProps, preferProp, prepareOptionList, prepareRule, prepareRuleGroup, prepareRuleOrGroup, prismaFallback, prismaOperators, processMatchMode, queryBuilderFlagDefaults, regenerateID, regenerateIDs, remove, removeInPlace, rootPath, shouldRenderAsNumber, splitBy, sqlDialectPresets, standardClassnames, toArray, toFlatOptionArray, toFullOption, toFullOptionList, toFullOptionMap, transformQuery, trimIfString, uniqByIdentifier, uniqByName, uniqOptGroups, uniqOptList, update, updateInPlace };
|
|
4332
|
+
|
|
4306
4333
|
//# sourceMappingURL=react-querybuilder_core.legacy-esm.js.map
|