@react-querybuilder/core 8.13.0 → 8.14.1
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-Cw014pDc.d.mts → basic-BXJVfD0P.d.ts} +77 -59
- package/dist/{basic-_KlsCAyT.d.ts → basic-CNIjb6rI.d.mts} +77 -59
- package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +201 -150
- package/dist/cjs/react-querybuilder_core.cjs.development.js +323 -252
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +201 -150
- 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-B5Qm_6ut.mjs} +30 -22
- package/dist/convertQuery-B5Qm_6ut.mjs.map +1 -0
- package/dist/convertQuery-DfZehtnd.js +94 -0
- package/dist/convertQuery-DfZehtnd.js.map +1 -0
- package/dist/{export-CffjLxEe.d.mts → export-6x7MilFR.d.mts} +2 -3
- package/dist/{export-DRA8O1Wz.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 +42 -51
- package/dist/formatQuery.js.map +1 -1
- package/dist/formatQuery.mjs +41 -50
- package/dist/formatQuery.mjs.map +1 -1
- package/dist/{import-CWYJkN_w.d.ts → import-B5Iq8XmL.d.ts} +2 -3
- package/dist/{import-DjHGaGhJ.d.mts → import-Bltb2mT4.d.mts} +2 -3
- package/dist/{isRuleGroup-Cjk1Q2mj.js → isRuleGroup-BCwaLzDj.js} +38 -40
- package/dist/isRuleGroup-BCwaLzDj.js.map +1 -0
- package/dist/{isRuleGroup-DztIOOKa.mjs → isRuleGroup-LzP0HCKh.mjs} +2 -4
- package/dist/isRuleGroup-LzP0HCKh.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 +37 -5611
- package/dist/parseJSONata.js.map +1 -1
- package/dist/parseJSONata.mjs +11 -14
- 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 +20 -21
- 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 +7 -8
- 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 +14 -16
- 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 +11 -2700
- package/dist/parseSpEL.js.map +1 -1
- package/dist/parseSpEL.mjs +7 -9
- package/dist/parseSpEL.mjs.map +1 -1
- package/dist/{prepareQueryObjects-CkN0bTKm.js → prepareQueryObjects-Dc8rqsYM.js} +50 -38
- package/dist/prepareQueryObjects-Dc8rqsYM.js.map +1 -0
- package/dist/{prepareQueryObjects-6Bxx4Bs1.mjs → prepareQueryObjects-tMukQHT9.mjs} +35 -22
- package/dist/prepareQueryObjects-tMukQHT9.mjs.map +1 -0
- package/dist/react-querybuilder_core.d.mts +201 -150
- package/dist/react-querybuilder_core.legacy-esm.d.ts +201 -150
- package/dist/react-querybuilder_core.legacy-esm.js +317 -280
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +312 -248
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +201 -150
- 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 +44 -3
- package/dist/transformQuery.js.map +1 -0
- package/dist/transformQuery.mjs +43 -3
- package/dist/transformQuery.mjs.map +1 -0
- package/dist/{utils-nQU7WCM9.mjs → utils-DQoYnxpa.mjs} +32 -84
- package/dist/utils-DQoYnxpa.mjs.map +1 -0
- package/dist/{utils-CR1ToTMW.js → utils-EsYRkPtf.js} +182 -246
- package/dist/utils-EsYRkPtf.js.map +1 -0
- package/package.json +29 -21
- 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.map +0 -1
- package/dist/isRuleGroup-DztIOOKa.mjs.map +0 -1
- package/dist/prepareQueryObjects-6Bxx4Bs1.mjs.map +0 -1
- package/dist/prepareQueryObjects-CkN0bTKm.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,6 @@ 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
|
-
|
|
909
900
|
//#endregion
|
|
910
901
|
//#region src/utils/optGroupUtils.ts
|
|
911
902
|
const isOptionWithName = (opt) => isPojo(opt) && "name" in opt && typeof opt.name === "string";
|
|
@@ -917,26 +908,25 @@ const isOptionWithValue = (opt) => isPojo(opt) && "value" in opt && typeof opt.v
|
|
|
917
908
|
* @group Option Lists
|
|
918
909
|
*/
|
|
919
910
|
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);
|
|
911
|
+
if (typeof opt === "string") {
|
|
912
|
+
var _labelMap$opt;
|
|
913
|
+
return _objectSpread2(_objectSpread2({}, baseProperties), {}, {
|
|
914
|
+
name: opt,
|
|
915
|
+
value: opt,
|
|
916
|
+
label: (_labelMap$opt = labelMap === null || labelMap === void 0 ? void 0 : labelMap[opt]) !== null && _labelMap$opt !== void 0 ? _labelMap$opt : opt
|
|
917
|
+
});
|
|
918
|
+
}
|
|
919
|
+
const idObj = {};
|
|
920
|
+
let needsUpdating = !!baseProperties;
|
|
921
|
+
if (isOptionWithName(opt) && !isOptionWithValue(opt)) {
|
|
922
|
+
idObj.value = opt.name;
|
|
923
|
+
needsUpdating = true;
|
|
924
|
+
} else if (!isOptionWithName(opt) && isOptionWithValue(opt)) {
|
|
925
|
+
idObj.name = opt.value;
|
|
926
|
+
needsUpdating = true;
|
|
927
|
+
}
|
|
928
|
+
if (needsUpdating) return Object.assign({}, baseProperties, opt, idObj);
|
|
929
|
+
return opt;
|
|
940
930
|
}
|
|
941
931
|
/**
|
|
942
932
|
* Converts an {@link OptionList} or {@link FlexibleOptionList} into a {@link FullOptionList}.
|
|
@@ -946,10 +936,9 @@ function toFullOption(opt, baseProperties, labelMap) {
|
|
|
946
936
|
*/
|
|
947
937
|
function toFullOptionList(optList, baseProperties, labelMap) {
|
|
948
938
|
if (!Array.isArray(optList)) return [];
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
})(optList);
|
|
939
|
+
const list = optList;
|
|
940
|
+
if (isFlexibleOptionGroupArray(list)) return list.map((optGroup) => _objectSpread2(_objectSpread2({}, optGroup), {}, { options: optGroup.options.map((opt) => toFullOption(opt, baseProperties, labelMap)) }));
|
|
941
|
+
return list.map((opt) => toFullOption(opt, baseProperties, labelMap));
|
|
953
942
|
}
|
|
954
943
|
/**
|
|
955
944
|
* Converts a {@link FlexibleOptionList} into a {@link FullOptionList}.
|
|
@@ -1095,7 +1084,7 @@ const uniqOptList = (originalArray) => {
|
|
|
1095
1084
|
};
|
|
1096
1085
|
const prepareOptionList = (props) => {
|
|
1097
1086
|
// istanbul ignore next
|
|
1098
|
-
const { optionList: optionListPropOriginal, baseOption = {}, labelMap = {}, placeholder: { placeholderName =
|
|
1087
|
+
const { optionList: optionListPropOriginal, baseOption = {}, labelMap = {}, placeholder: { placeholderName = "~", placeholderLabel = defaultPlaceholderLabel, placeholderGroupLabel = defaultPlaceholderLabel } = {}, autoSelectOption = true } = props;
|
|
1099
1088
|
const defaultOption = {
|
|
1100
1089
|
id: placeholderName,
|
|
1101
1090
|
name: placeholderName,
|
|
@@ -1131,7 +1120,6 @@ const prepareOptionList = (props) => {
|
|
|
1131
1120
|
optionsMap
|
|
1132
1121
|
};
|
|
1133
1122
|
};
|
|
1134
|
-
|
|
1135
1123
|
//#endregion
|
|
1136
1124
|
//#region src/utils/filterFieldsByComparator.ts
|
|
1137
1125
|
const filterByComparator = (field, operator, fieldToCompare) => {
|
|
@@ -1165,7 +1153,6 @@ const filterFieldsByComparator = (field, fields, operator) => {
|
|
|
1165
1153
|
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
1154
|
return fields.filter((f) => filterByComparator(field, operator, f));
|
|
1167
1155
|
};
|
|
1168
|
-
|
|
1169
1156
|
//#endregion
|
|
1170
1157
|
//#region src/utils/parseNumber.ts
|
|
1171
1158
|
/**
|
|
@@ -1185,23 +1172,20 @@ const parseNumber = (val, { parseNumbers, bigIntOnOverflow } = {}) => {
|
|
|
1185
1172
|
});
|
|
1186
1173
|
return typeof valAsNum === "bigint" || !Number.isNaN(valAsNum) ? valAsNum : val;
|
|
1187
1174
|
};
|
|
1188
|
-
|
|
1189
1175
|
//#endregion
|
|
1190
1176
|
//#region src/utils/transformQuery.ts
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
else if (!!v && k !== v && k in draft) {
|
|
1201
|
-
draft[v] = draft[k];
|
|
1202
|
-
if (deleteRemappedProperties) delete draft[k];
|
|
1177
|
+
const remapProperties = (obj, propertyMap, deleteRemappedProperties) => {
|
|
1178
|
+
const result = {};
|
|
1179
|
+
for (const key in obj) {
|
|
1180
|
+
const mappedKey = propertyMap[key];
|
|
1181
|
+
if (mappedKey === false) continue;
|
|
1182
|
+
if (mappedKey && key !== mappedKey) {
|
|
1183
|
+
result[mappedKey] = obj[key];
|
|
1184
|
+
if (!deleteRemappedProperties) result[key] = obj[key];
|
|
1185
|
+
} else result[key] = obj[key];
|
|
1203
1186
|
}
|
|
1204
|
-
|
|
1187
|
+
return result;
|
|
1188
|
+
};
|
|
1205
1189
|
function transformQuery(query, options = {}) {
|
|
1206
1190
|
const { ruleProcessor = (r) => r, ruleGroupProcessor = (rg) => rg, propertyMap = {}, combinatorMap = {}, operatorMap = {}, omitPath = false, deleteRemappedProperties = true } = options;
|
|
1207
1191
|
const processGroup = (rg) => {
|
|
@@ -1218,7 +1202,6 @@ function transformQuery(query, options = {}) {
|
|
|
1218
1202
|
};
|
|
1219
1203
|
return processGroup(_objectSpread2(_objectSpread2({}, query), omitPath ? null : { path: [] }));
|
|
1220
1204
|
}
|
|
1221
|
-
|
|
1222
1205
|
//#endregion
|
|
1223
1206
|
//#region src/utils/isRuleOrGroupValid.ts
|
|
1224
1207
|
/**
|
|
@@ -1242,7 +1225,6 @@ const isRuleOrGroupValid = (rg, validationResult, validator) => {
|
|
|
1242
1225
|
}
|
|
1243
1226
|
return true;
|
|
1244
1227
|
};
|
|
1245
|
-
|
|
1246
1228
|
//#endregion
|
|
1247
1229
|
//#region src/utils/getParseNumberMethod.ts
|
|
1248
1230
|
const getParseNumberMethod = ({ parseNumbers, inputType }) => {
|
|
@@ -1253,7 +1235,6 @@ const getParseNumberMethod = ({ parseNumbers, inputType }) => {
|
|
|
1253
1235
|
}
|
|
1254
1236
|
return parseNumbers ? "strict" : false;
|
|
1255
1237
|
};
|
|
1256
|
-
|
|
1257
1238
|
//#endregion
|
|
1258
1239
|
//#region src/utils/formatQuery/utils.ts
|
|
1259
1240
|
/**
|
|
@@ -1335,7 +1316,8 @@ const jsonLogicAdditionalOperators = {
|
|
|
1335
1316
|
endsWith: (a, b) => typeof a === "string" && a.endsWith(b)
|
|
1336
1317
|
};
|
|
1337
1318
|
/**
|
|
1338
|
-
*
|
|
1319
|
+
* Returns a new query object with all `string`-type `value` properties converted
|
|
1320
|
+
* to `number` where appropriate.
|
|
1339
1321
|
*
|
|
1340
1322
|
* Used by {@link formatQuery} for the `json*` formats when `parseNumbers` is `true`.
|
|
1341
1323
|
*
|
|
@@ -1499,7 +1481,6 @@ const bigIntJsonStringifyReplacer = (_key, value) => typeof value === "bigint" ?
|
|
|
1499
1481
|
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#use_within_json
|
|
1500
1482
|
*/
|
|
1501
1483
|
const bigIntJsonParseReviver = (_key, value) => isPojo(value) && Object.keys(value).length === 1 && typeof value.$bigint === "string" ? BigInt(value.$bigint) : value;
|
|
1502
|
-
|
|
1503
1484
|
//#endregion
|
|
1504
1485
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorCEL.ts
|
|
1505
1486
|
/**
|
|
@@ -1556,7 +1537,6 @@ const defaultRuleGroupProcessorCEL = (ruleGroup, options) => {
|
|
|
1556
1537
|
};
|
|
1557
1538
|
return processRuleGroup(ruleGroup, true);
|
|
1558
1539
|
};
|
|
1559
|
-
|
|
1560
1540
|
//#endregion
|
|
1561
1541
|
//#region src/utils/formatQuery/defaultRuleProcessorCEL.ts
|
|
1562
1542
|
const shouldNegate$2 = (op) => op.startsWith("not") || op.startsWith("doesnot");
|
|
@@ -1634,7 +1614,6 @@ const defaultRuleProcessorCEL = (rule, opts = {}) => {
|
|
|
1634
1614
|
}
|
|
1635
1615
|
return "";
|
|
1636
1616
|
};
|
|
1637
|
-
|
|
1638
1617
|
//#endregion
|
|
1639
1618
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorMongoDBQuery.ts
|
|
1640
1619
|
/**
|
|
@@ -1672,11 +1651,11 @@ const defaultRuleGroupProcessorMongoDBQuery = (ruleGroup, options, meta) => {
|
|
|
1672
1651
|
fieldData
|
|
1673
1652
|
}), meta);
|
|
1674
1653
|
}).filter(Boolean);
|
|
1675
|
-
|
|
1654
|
+
const result = expressions.length > 0 ? expressions.length === 1 && !hasChildRules ? expressions[0] : { [combinator]: expressions } : mongoDbFallback;
|
|
1655
|
+
return rg.not ? { $not: result } : result;
|
|
1676
1656
|
};
|
|
1677
1657
|
return processRuleGroup(convertFromIC(ruleGroup), true);
|
|
1678
1658
|
};
|
|
1679
|
-
|
|
1680
1659
|
//#endregion
|
|
1681
1660
|
//#region src/utils/formatQuery/defaultRuleProcessorMongoDBQuery.ts
|
|
1682
1661
|
const processNumber$1 = (value, fallback, parseNumbers = false) => shouldRenderAsNumber(value, parseNumbers || typeof value === "bigint") ? Number(parseNumber(value, { parseNumbers: "strict" })) : fallback;
|
|
@@ -1791,7 +1770,6 @@ const defaultRuleProcessorMongoDBQuery = (rule, options = {}) => {
|
|
|
1791
1770
|
}
|
|
1792
1771
|
return "";
|
|
1793
1772
|
};
|
|
1794
|
-
|
|
1795
1773
|
//#endregion
|
|
1796
1774
|
//#region src/utils/formatQuery/defaultRuleProcessorMongoDB.ts
|
|
1797
1775
|
/**
|
|
@@ -1805,7 +1783,6 @@ const defaultRuleProcessorMongoDB = (rule, options) => {
|
|
|
1805
1783
|
const queryObj = defaultRuleProcessorMongoDBQuery(rule, options);
|
|
1806
1784
|
return queryObj ? JSON.stringify(queryObj) : "";
|
|
1807
1785
|
};
|
|
1808
|
-
|
|
1809
1786
|
//#endregion
|
|
1810
1787
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorSpEL.ts
|
|
1811
1788
|
/**
|
|
@@ -1862,11 +1839,10 @@ const defaultRuleGroupProcessorSpEL = (ruleGroup, options) => {
|
|
|
1862
1839
|
};
|
|
1863
1840
|
return processRuleGroup(ruleGroup, true);
|
|
1864
1841
|
};
|
|
1865
|
-
|
|
1866
1842
|
//#endregion
|
|
1867
1843
|
//#region src/utils/formatQuery/defaultRuleProcessorSpEL.ts
|
|
1868
1844
|
const shouldNegate$1 = (op) => op.startsWith("not") || op.startsWith("doesnot");
|
|
1869
|
-
const wrapInNegation = (clause, negate
|
|
1845
|
+
const wrapInNegation = (clause, negate) => negate ? `!(${clause})` : clause;
|
|
1870
1846
|
const escapeSingleQuotes = (v, escapeQuotes) => typeof v !== "string" || !escapeQuotes ? `${v}` : v.replaceAll(`'`, `\\'`);
|
|
1871
1847
|
/**
|
|
1872
1848
|
* Default rule processor used by {@link formatQuery} for "spel" format.
|
|
@@ -1916,9 +1892,9 @@ const defaultRuleProcessorSpEL = (rule, opts = {}) => {
|
|
|
1916
1892
|
case "notnull": return `${field} != null`;
|
|
1917
1893
|
case "in":
|
|
1918
1894
|
case "notin": {
|
|
1919
|
-
const negate
|
|
1895
|
+
const negate = shouldNegate$1(operatorTL) ? "!" : "";
|
|
1920
1896
|
const valueAsArray = toArray(value);
|
|
1921
|
-
return valueAsArray.length > 0 ? `${negate
|
|
1897
|
+
return valueAsArray.length > 0 ? `${negate}(${valueAsArray.map((val) => `${field} == ${valueIsField || shouldRenderAsNumber(val, parseNumbers) ? `${trimIfString(val)}` : `'${escapeSingleQuotes(val, escapeQuotes)}'`}`).join(" or ")})` : "";
|
|
1922
1898
|
}
|
|
1923
1899
|
case "between":
|
|
1924
1900
|
case "notbetween": {
|
|
@@ -1941,7 +1917,6 @@ const defaultRuleProcessorSpEL = (rule, opts = {}) => {
|
|
|
1941
1917
|
}
|
|
1942
1918
|
return "";
|
|
1943
1919
|
};
|
|
1944
|
-
|
|
1945
1920
|
//#endregion
|
|
1946
1921
|
//#region src/utils/formatQuery/defaultValueProcessorByRule.ts
|
|
1947
1922
|
const escapeStringValueQuotes$1 = (v, quoteChar, escapeQuotes) => escapeQuotes && typeof v === "string" ? v.replaceAll(`${quoteChar}`, `${quoteChar}${quoteChar}`) : v;
|
|
@@ -1998,7 +1973,6 @@ const defaultValueProcessorByRule = ({ operator, value, valueSource }, { escapeQ
|
|
|
1998
1973
|
if (typeof value === "boolean") return value ? "TRUE" : "FALSE";
|
|
1999
1974
|
return valueIsField ? wrapFieldName(value) : shouldRenderAsNumber(value, parseNumbers) ? `${trimIfString(value)}` : `${wrapAndEscape(value)}`;
|
|
2000
1975
|
};
|
|
2001
|
-
|
|
2002
1976
|
//#endregion
|
|
2003
1977
|
//#region src/utils/formatQuery/defaultRuleProcessorDrizzle.ts
|
|
2004
1978
|
/**
|
|
@@ -2086,7 +2060,6 @@ const defaultRuleProcessorDrizzle = (rule, _options) => {
|
|
|
2086
2060
|
default: return;
|
|
2087
2061
|
}
|
|
2088
2062
|
};
|
|
2089
|
-
|
|
2090
2063
|
//#endregion
|
|
2091
2064
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorDrizzle.ts
|
|
2092
2065
|
/**
|
|
@@ -2129,7 +2102,6 @@ const defaultRuleGroupProcessorDrizzle = (ruleGroup, options, _meta) => (columns
|
|
|
2129
2102
|
};
|
|
2130
2103
|
return processRuleGroup(convertFromIC(ruleGroup), true);
|
|
2131
2104
|
};
|
|
2132
|
-
|
|
2133
2105
|
//#endregion
|
|
2134
2106
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorElasticSearch.ts
|
|
2135
2107
|
/**
|
|
@@ -2158,7 +2130,6 @@ const defaultRuleGroupProcessorElasticSearch = (ruleGroup, options) => {
|
|
|
2158
2130
|
const processedRuleGroup = processRuleGroup(convertFromIC(ruleGroup));
|
|
2159
2131
|
return processedRuleGroup === false ? {} : processedRuleGroup;
|
|
2160
2132
|
};
|
|
2161
|
-
|
|
2162
2133
|
//#endregion
|
|
2163
2134
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorJSONata.ts
|
|
2164
2135
|
/**
|
|
@@ -2215,7 +2186,6 @@ const defaultRuleGroupProcessorJSONata = (ruleGroup, options) => {
|
|
|
2215
2186
|
};
|
|
2216
2187
|
return processRuleGroup(ruleGroup, true);
|
|
2217
2188
|
};
|
|
2218
|
-
|
|
2219
2189
|
//#endregion
|
|
2220
2190
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorJsonLogic.ts
|
|
2221
2191
|
/**
|
|
@@ -2245,7 +2215,6 @@ const defaultRuleGroupProcessorJsonLogic = (ruleGroup, options) => {
|
|
|
2245
2215
|
};
|
|
2246
2216
|
return processRuleGroup(query, true);
|
|
2247
2217
|
};
|
|
2248
|
-
|
|
2249
2218
|
//#endregion
|
|
2250
2219
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorLDAP.ts
|
|
2251
2220
|
/**
|
|
@@ -2277,7 +2246,6 @@ const defaultRuleGroupProcessorLDAP = (ruleGroup, options) => {
|
|
|
2277
2246
|
};
|
|
2278
2247
|
return processRuleGroup(convertFromIC(ruleGroup), true);
|
|
2279
2248
|
};
|
|
2280
|
-
|
|
2281
2249
|
//#endregion
|
|
2282
2250
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorMongoDB.ts
|
|
2283
2251
|
const isBracketed = (str) => str.startsWith("{") && str.endsWith("}");
|
|
@@ -2312,12 +2280,12 @@ const defaultRuleGroupProcessorMongoDB = (ruleGroup, options, meta) => {
|
|
|
2312
2280
|
fieldData
|
|
2313
2281
|
}), meta);
|
|
2314
2282
|
}).filter(Boolean);
|
|
2315
|
-
|
|
2283
|
+
const result = expressions.length > 0 ? expressions.length === 1 && !hasChildRules ? expressions[0] : `${combinator}:[${expressions.join(",")}]` : fallbackExpression;
|
|
2284
|
+
return rg.not ? `"$not":${isBracketed(result) ? result : `{${result}}`}` : result;
|
|
2316
2285
|
};
|
|
2317
2286
|
const processedQuery = processRuleGroup(convertFromIC(ruleGroup), true);
|
|
2318
2287
|
return isBracketed(processedQuery) ? processedQuery : `{${processedQuery}}`;
|
|
2319
2288
|
};
|
|
2320
|
-
|
|
2321
2289
|
//#endregion
|
|
2322
2290
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorNL.ts
|
|
2323
2291
|
/**
|
|
@@ -2384,7 +2352,6 @@ const defaultRuleGroupProcessorNL = (ruleGroup, options) => {
|
|
|
2384
2352
|
};
|
|
2385
2353
|
return processRuleGroup(ruleGroup, true);
|
|
2386
2354
|
};
|
|
2387
|
-
|
|
2388
2355
|
//#endregion
|
|
2389
2356
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorParameterized.ts
|
|
2390
2357
|
/**
|
|
@@ -2474,7 +2441,6 @@ const defaultRuleGroupProcessorParameterized = (ruleGroup, options) => {
|
|
|
2474
2441
|
params: paramsNamed
|
|
2475
2442
|
};
|
|
2476
2443
|
};
|
|
2477
|
-
|
|
2478
2444
|
//#endregion
|
|
2479
2445
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorPrisma.ts
|
|
2480
2446
|
/**
|
|
@@ -2517,7 +2483,6 @@ const defaultRuleGroupProcessorPrisma = (ruleGroup, options) => {
|
|
|
2517
2483
|
const result = processRuleGroup(convertFromIC(ruleGroup), true);
|
|
2518
2484
|
return ruleGroup.not ? { NOT: result } : result;
|
|
2519
2485
|
};
|
|
2520
|
-
|
|
2521
2486
|
//#endregion
|
|
2522
2487
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorSequelize.ts
|
|
2523
2488
|
/**
|
|
@@ -2558,7 +2523,6 @@ const defaultRuleGroupProcessorSequelize = (ruleGroup, options) => {
|
|
|
2558
2523
|
};
|
|
2559
2524
|
return processRuleGroup(convertFromIC(ruleGroup), true);
|
|
2560
2525
|
};
|
|
2561
|
-
|
|
2562
2526
|
//#endregion
|
|
2563
2527
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorSQL.ts
|
|
2564
2528
|
/**
|
|
@@ -2616,7 +2580,6 @@ const defaultRuleGroupProcessorSQL = (ruleGroup, options) => {
|
|
|
2616
2580
|
};
|
|
2617
2581
|
return processRuleGroup(ruleGroup, true);
|
|
2618
2582
|
};
|
|
2619
|
-
|
|
2620
2583
|
//#endregion
|
|
2621
2584
|
//#region src/utils/formatQuery/defaultRuleProcessorElasticSearch.ts
|
|
2622
2585
|
const rangeOperatorMap = {
|
|
@@ -2649,7 +2612,27 @@ const defaultRuleProcessorElasticSearch = (rule, options = {}) => {
|
|
|
2649
2612
|
const { field, operator, value, valueSource } = rule;
|
|
2650
2613
|
const { parseNumbers, preserveValueOrder } = options;
|
|
2651
2614
|
const operatorLC = lc(operator);
|
|
2652
|
-
|
|
2615
|
+
const matchEval = processMatchMode(rule);
|
|
2616
|
+
if (matchEval === false) return false;
|
|
2617
|
+
else if (matchEval) {
|
|
2618
|
+
const { mode } = matchEval;
|
|
2619
|
+
const subQuery = defaultRuleGroupProcessorElasticSearch(transformQuery(rule.value, { ruleProcessor: (r) => _objectSpread2(_objectSpread2({}, r), {}, { field: r.field ? `${field}.${r.field}` : field }) }), options);
|
|
2620
|
+
if (Object.keys(subQuery).length === 0) return false;
|
|
2621
|
+
switch (mode) {
|
|
2622
|
+
case "some": return { nested: {
|
|
2623
|
+
path: field,
|
|
2624
|
+
query: subQuery
|
|
2625
|
+
} };
|
|
2626
|
+
case "none": return { bool: { must_not: { nested: {
|
|
2627
|
+
path: field,
|
|
2628
|
+
query: subQuery
|
|
2629
|
+
} } } };
|
|
2630
|
+
case "all":
|
|
2631
|
+
case "atleast":
|
|
2632
|
+
case "atmost":
|
|
2633
|
+
case "exactly": return false;
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2653
2636
|
if (valueSource === "field") {
|
|
2654
2637
|
if (toArray(value).some((v) => typeof v !== "string")) return false;
|
|
2655
2638
|
const fieldForScript = escapeSQ(field);
|
|
@@ -2746,12 +2729,11 @@ const defaultRuleProcessorElasticSearch = (rule, options = {}) => {
|
|
|
2746
2729
|
}
|
|
2747
2730
|
return false;
|
|
2748
2731
|
};
|
|
2749
|
-
|
|
2750
2732
|
//#endregion
|
|
2751
2733
|
//#region src/utils/formatQuery/defaultRuleProcessorJSONata.ts
|
|
2752
2734
|
const shouldNegate = (op) => op.startsWith("not") || op.startsWith("doesnot");
|
|
2753
2735
|
const quote = (v, escapeQuotes) => `"${typeof v !== "string" || !escapeQuotes ? `${v}` : v.replaceAll(`"`, `\\"`)}"`;
|
|
2754
|
-
const negate = (clause,
|
|
2736
|
+
const negate = (clause, neg) => neg ? `$not(${clause})` : clause;
|
|
2755
2737
|
const escapeStringRegex = (s) => `${s}`.replaceAll(/[/$()*+.?[\\\]^{|}]/g, String.raw`\$&`).replaceAll("-", String.raw`\x2d`);
|
|
2756
2738
|
/**
|
|
2757
2739
|
* Default rule processor used by {@link formatQuery} for "jsonata" format.
|
|
@@ -2830,7 +2812,6 @@ const defaultRuleProcessorJSONata = (rule, options = {}) => {
|
|
|
2830
2812
|
}
|
|
2831
2813
|
return "";
|
|
2832
2814
|
};
|
|
2833
|
-
|
|
2834
2815
|
//#endregion
|
|
2835
2816
|
//#region src/utils/formatQuery/defaultRuleProcessorJsonLogic.ts
|
|
2836
2817
|
const convertOperator = (op) => op.replace(/^(=)$/, "$1=").replace(/^notnull$/i, "!=").replace(/^null$/i, "==");
|
|
@@ -2925,10 +2906,9 @@ const defaultRuleProcessorJsonLogic = (rule, options = {}) => {
|
|
|
2925
2906
|
}
|
|
2926
2907
|
return false;
|
|
2927
2908
|
};
|
|
2928
|
-
|
|
2929
2909
|
//#endregion
|
|
2930
2910
|
//#region src/utils/formatQuery/defaultRuleProcessorLDAP.ts
|
|
2931
|
-
const negateIf = (clause, negate
|
|
2911
|
+
const negateIf = (clause, negate) => negate ? `(!${clause})` : `${clause}`;
|
|
2932
2912
|
const ldapEscape = (s) => `${trimIfString(s)}`.replaceAll(/[()&|=<>~*\\/]/g, (m) => `\\${m.codePointAt(0).toString(16)}`);
|
|
2933
2913
|
/**
|
|
2934
2914
|
* Default rule processor used by {@link formatQuery} for "ldap" format.
|
|
@@ -2977,7 +2957,6 @@ const defaultRuleProcessorLDAP = (rule, options = {}) => {
|
|
|
2977
2957
|
// istanbul ignore next
|
|
2978
2958
|
return "";
|
|
2979
2959
|
};
|
|
2980
|
-
|
|
2981
2960
|
//#endregion
|
|
2982
2961
|
//#region src/utils/formatQuery/defaultValueProcessorNL.ts
|
|
2983
2962
|
const escapeStringValueQuotes = (v, quoteChar, escapeQuotes) => escapeQuotes && typeof v === "string" ? v.replaceAll(`${quoteChar}`, `${quoteChar}${quoteChar}`) : v;
|
|
@@ -3031,7 +3010,6 @@ const defaultValueProcessorNL = (rule, opts = {}) => {
|
|
|
3031
3010
|
if (typeof rule.value === "boolean") return rule.value ? trueTL : falseTL;
|
|
3032
3011
|
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)}`;
|
|
3033
3012
|
};
|
|
3034
|
-
|
|
3035
3013
|
//#endregion
|
|
3036
3014
|
//#region src/utils/formatQuery/defaultRuleProcessorNL.ts
|
|
3037
3015
|
/**
|
|
@@ -3140,7 +3118,6 @@ const defaultRuleProcessorNL = (rule, opts) => {
|
|
|
3140
3118
|
};
|
|
3141
3119
|
return normalizeConstituentWordOrder(wordOrder).map((term) => `${wordOrderMap[term]}`).join(" ").trim();
|
|
3142
3120
|
};
|
|
3143
|
-
|
|
3144
3121
|
//#endregion
|
|
3145
3122
|
//#region src/utils/formatQuery/defaultRuleProcessorSQL.ts
|
|
3146
3123
|
/**
|
|
@@ -3191,7 +3168,6 @@ const defaultRuleProcessorSQL = (rule, opts = {}) => {
|
|
|
3191
3168
|
if ((operatorLowerCase === "in" || operatorLowerCase === "not in" || operatorLowerCase === "between" || operatorLowerCase === "not between") && !value) return "";
|
|
3192
3169
|
return `${ruleField} ${operator} ${value}`.trim();
|
|
3193
3170
|
};
|
|
3194
|
-
|
|
3195
3171
|
//#endregion
|
|
3196
3172
|
//#region src/utils/formatQuery/defaultRuleProcessorParameterized.ts
|
|
3197
3173
|
/**
|
|
@@ -3290,7 +3266,6 @@ const defaultRuleProcessorParameterized = (rule, opts, meta) => {
|
|
|
3290
3266
|
}
|
|
3291
3267
|
return finalize(`${qPre}${rule.field}${qPost} ${sqlOperator} ${parameterized ? numberedParams ? `${paramPrefix}${processedParams.length + 1}` : "?" : `${paramPrefix}${paramName}`}`.trim());
|
|
3292
3268
|
};
|
|
3293
|
-
|
|
3294
3269
|
//#endregion
|
|
3295
3270
|
//#region src/utils/formatQuery/defaultRuleProcessorPrisma.ts
|
|
3296
3271
|
const processNumber = (value, fallback, parseNumbers) => shouldRenderAsNumber(value, !!parseNumbers || typeof value === "bigint") ? Number(parseNumber(value, { parseNumbers: !!parseNumbers })) : fallback;
|
|
@@ -3352,7 +3327,6 @@ const defaultRuleProcessorPrisma = (rule, options = {}) => {
|
|
|
3352
3327
|
}
|
|
3353
3328
|
return "";
|
|
3354
3329
|
};
|
|
3355
|
-
|
|
3356
3330
|
//#endregion
|
|
3357
3331
|
//#region src/utils/formatQuery/defaultRuleProcessorSequelize.ts
|
|
3358
3332
|
/**
|
|
@@ -3419,7 +3393,6 @@ const defaultRuleProcessorSequelize = (rule, { parseNumbers, preserveValueOrder,
|
|
|
3419
3393
|
}
|
|
3420
3394
|
}
|
|
3421
3395
|
};
|
|
3422
|
-
|
|
3423
3396
|
//#endregion
|
|
3424
3397
|
//#region src/utils/formatQuery/formatQuery.ts
|
|
3425
3398
|
/**
|
|
@@ -3508,8 +3481,8 @@ const defaultFormatQueryOptions = {
|
|
|
3508
3481
|
paramsKeepPrefix: false,
|
|
3509
3482
|
numberedParams: false,
|
|
3510
3483
|
preserveValueOrder: false,
|
|
3511
|
-
placeholderFieldName:
|
|
3512
|
-
placeholderOperatorName:
|
|
3484
|
+
placeholderFieldName: "~",
|
|
3485
|
+
placeholderOperatorName: "~",
|
|
3513
3486
|
quoteValuesWith: "'",
|
|
3514
3487
|
concatOperator: "||",
|
|
3515
3488
|
preset: "ansi",
|
|
@@ -3615,7 +3588,7 @@ function formatQuery(ruleGroup, optionParam = {}) {
|
|
|
3615
3588
|
switch (format) {
|
|
3616
3589
|
case "json":
|
|
3617
3590
|
case "json_without_ids": {
|
|
3618
|
-
const rg = parseNumbers ?
|
|
3591
|
+
const rg = parseNumbers ? numerifyValues(ruleGroup, finalOptions) : ruleGroup;
|
|
3619
3592
|
if (format === "json_without_ids") return JSON.stringify(rg, (key, value) => key === "id" || key === "path" ? void 0 : bigIntJsonStringifyReplacer(key, value));
|
|
3620
3593
|
return JSON.stringify(rg, bigIntJsonStringifyReplacer, 2);
|
|
3621
3594
|
}
|
|
@@ -3637,7 +3610,6 @@ function formatQuery(ruleGroup, optionParam = {}) {
|
|
|
3637
3610
|
default: return "";
|
|
3638
3611
|
}
|
|
3639
3612
|
}
|
|
3640
|
-
|
|
3641
3613
|
//#endregion
|
|
3642
3614
|
//#region src/utils/formatQuery/index.ts
|
|
3643
3615
|
const generateValueProcessor = (vpbr) => (field, operator, value, valueSource) => vpbr({
|
|
@@ -3688,7 +3660,6 @@ const defaultValueProcessorMongoDBByRule = defaultRuleProcessorMongoDB;
|
|
|
3688
3660
|
* @group Export
|
|
3689
3661
|
*/
|
|
3690
3662
|
const defaultValueProcessorSpELByRule = defaultRuleProcessorSpEL;
|
|
3691
|
-
|
|
3692
3663
|
//#endregion
|
|
3693
3664
|
//#region src/utils/pathUtils.ts
|
|
3694
3665
|
/**
|
|
@@ -3747,7 +3718,7 @@ const pathsAreEqual = (path1, path2) => path1.length === path2.length && path1.e
|
|
|
3747
3718
|
* Determines if the first path is an ancestor of the second path. The first path must
|
|
3748
3719
|
* be shorter and exactly match the second path up through the length of the first path.
|
|
3749
3720
|
*/
|
|
3750
|
-
const isAncestor = (maybeAncestor, path) => maybeAncestor.length < path.length &&
|
|
3721
|
+
const isAncestor = (maybeAncestor, path) => maybeAncestor.length < path.length && new RegExp(`^${maybeAncestor.join("-")}`).test(path.join("-"));
|
|
3751
3722
|
/**
|
|
3752
3723
|
* Finds the deepest/longest path that two paths have in common.
|
|
3753
3724
|
*/
|
|
@@ -3780,11 +3751,9 @@ const pathIsDisabled = (path, query) => {
|
|
|
3780
3751
|
}
|
|
3781
3752
|
return disabled;
|
|
3782
3753
|
};
|
|
3783
|
-
|
|
3784
3754
|
//#endregion
|
|
3785
3755
|
//#region src/utils/generateAccessibleDescription.ts
|
|
3786
3756
|
const generateAccessibleDescription = (params) => pathsAreEqual([], params.path) ? `Query builder` : `Rule group at path ${params.path.join("-")}`;
|
|
3787
|
-
|
|
3788
3757
|
//#endregion
|
|
3789
3758
|
//#region src/utils/generateID.ts
|
|
3790
3759
|
const cryptoModule = globalThis.crypto;
|
|
@@ -3819,7 +3788,6 @@ if (cryptoModule) {
|
|
|
3819
3788
|
};
|
|
3820
3789
|
}
|
|
3821
3790
|
}
|
|
3822
|
-
|
|
3823
3791
|
//#endregion
|
|
3824
3792
|
//#region src/utils/getMatchModesUtil.ts
|
|
3825
3793
|
const dummyFD$1 = {
|
|
@@ -3851,7 +3819,6 @@ const getMatchModesUtil = (fieldData, getMatchModes) => {
|
|
|
3851
3819
|
};
|
|
3852
3820
|
})) !== null && _matchModes$map !== void 0 ? _matchModes$map : [];
|
|
3853
3821
|
};
|
|
3854
|
-
|
|
3855
3822
|
//#endregion
|
|
3856
3823
|
//#region src/utils/getValidationClassNames.ts
|
|
3857
3824
|
/**
|
|
@@ -3862,7 +3829,6 @@ const getValidationClassNames = (validationResult) => {
|
|
|
3862
3829
|
const valid = typeof validationResult === "boolean" ? validationResult : typeof validationResult === "object" && validationResult !== null ? validationResult.valid : null;
|
|
3863
3830
|
return typeof valid === "boolean" ? valid ? standardClassnames.valid : standardClassnames.invalid : "";
|
|
3864
3831
|
};
|
|
3865
|
-
|
|
3866
3832
|
//#endregion
|
|
3867
3833
|
//#region src/utils/getValueSourcesUtil.ts
|
|
3868
3834
|
const defaultValueSourcesArray = [{
|
|
@@ -3899,18 +3865,19 @@ const getValueSourcesUtil = (fieldData, operator, getValueSources) => {
|
|
|
3899
3865
|
};
|
|
3900
3866
|
});
|
|
3901
3867
|
};
|
|
3902
|
-
|
|
3903
3868
|
//#endregion
|
|
3904
3869
|
//#region src/utils/mergeAnyTranslations.ts
|
|
3905
3870
|
/**
|
|
3906
3871
|
* Merges any number of partial translations into a single definition.
|
|
3907
3872
|
*/
|
|
3908
|
-
const mergeAnyTranslations = (base, ...otherTranslations) =>
|
|
3873
|
+
const mergeAnyTranslations = (base, ...otherTranslations) => {
|
|
3874
|
+
const result = _objectSpread2({}, base);
|
|
3909
3875
|
for (const translations of otherTranslations)
|
|
3910
3876
|
// istanbul ignore else
|
|
3911
|
-
if (translations) for (const
|
|
3912
|
-
else
|
|
3913
|
-
|
|
3877
|
+
if (translations) for (const key of objectKeys(translations)) if (result[key]) result[key] = _objectSpread2(_objectSpread2({}, result[key]), translations[key]);
|
|
3878
|
+
else result[key] = _objectSpread2({}, translations[key]);
|
|
3879
|
+
return result;
|
|
3880
|
+
};
|
|
3914
3881
|
const mergeAnyTranslation = (el, keyPropContextMap, defaults) => {
|
|
3915
3882
|
const finalKeys = objectEntries(keyPropContextMap).map(([key, [pT, cT]]) => {
|
|
3916
3883
|
var _ref, _defaults$el;
|
|
@@ -3923,7 +3890,6 @@ const mergeAnyTranslation = (el, keyPropContextMap, defaults) => {
|
|
|
3923
3890
|
return { [el]: finalObject };
|
|
3924
3891
|
}
|
|
3925
3892
|
};
|
|
3926
|
-
|
|
3927
3893
|
//#endregion
|
|
3928
3894
|
//#region src/utils/mergeClassnames.ts
|
|
3929
3895
|
const joinClassnamesByName = (name, args) => clsx(args.map((c) => clsx(c === null || c === void 0 ? void 0 : c[name])));
|
|
@@ -3973,7 +3939,6 @@ const mergeClassnames = (...args) => ({
|
|
|
3973
3939
|
hasSubQuery: joinClassnamesByName("hasSubQuery", args),
|
|
3974
3940
|
loading: joinClassnamesByName("loading", args)
|
|
3975
3941
|
});
|
|
3976
|
-
|
|
3977
3942
|
//#endregion
|
|
3978
3943
|
//#region src/utils/preferProp.ts
|
|
3979
3944
|
const preferPropDefaultTrue = (prop, context) => prop === false ? false : prop ? true : !(context === false);
|
|
@@ -3996,29 +3961,41 @@ const preferFlagProps = (props = {}, contextVals = {}, finalize) => objectEntrie
|
|
|
3996
3961
|
acc[key] = preferProp(def, props[key], contextVals[key], !finalize);
|
|
3997
3962
|
return acc;
|
|
3998
3963
|
}, {});
|
|
3999
|
-
|
|
4000
3964
|
//#endregion
|
|
4001
3965
|
//#region src/utils/prepareQueryObjects.ts
|
|
4002
3966
|
/**
|
|
4003
3967
|
* Ensures that a rule is valid by adding an `id` property if it does not already exist.
|
|
4004
3968
|
*/
|
|
4005
|
-
const prepareRule = (rule, { idGenerator = generateID } = {}) =>
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
3969
|
+
const prepareRule = (rule, { idGenerator = generateID } = {}) => {
|
|
3970
|
+
const needsId = !rule.id;
|
|
3971
|
+
const hasMatchMode = processMatchMode(rule);
|
|
3972
|
+
if (!needsId && !hasMatchMode) return rule;
|
|
3973
|
+
return _objectSpread2(_objectSpread2(_objectSpread2({}, rule), needsId && { id: idGenerator() }), hasMatchMode && { value: prepareRuleGroup(rule.value, { idGenerator }) });
|
|
3974
|
+
};
|
|
4009
3975
|
/**
|
|
4010
3976
|
* Ensures that a rule group is valid by recursively adding an `id` property to the group itself
|
|
4011
3977
|
* and all its rules and subgroups where one does not already exist.
|
|
4012
3978
|
*/
|
|
4013
|
-
const prepareRuleGroup = (queryObject, { idGenerator = generateID } = {}) =>
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
3979
|
+
const prepareRuleGroup = (queryObject, { idGenerator = generateID } = {}) => {
|
|
3980
|
+
const needsId = !queryObject.id;
|
|
3981
|
+
let rulesChanged = false;
|
|
3982
|
+
const newRules = [];
|
|
3983
|
+
for (let i = 0; i < queryObject.rules.length; i++) {
|
|
3984
|
+
const r = queryObject.rules[i];
|
|
3985
|
+
if (typeof r === "string") newRules.push(r);
|
|
3986
|
+
else {
|
|
3987
|
+
const prepared = isRuleGroup(r) ? prepareRuleGroup(r, { idGenerator }) : prepareRule(r, { idGenerator });
|
|
3988
|
+
newRules.push(prepared);
|
|
3989
|
+
if (prepared !== r) rulesChanged = true;
|
|
3990
|
+
}
|
|
3991
|
+
}
|
|
3992
|
+
if (!needsId && !rulesChanged) return queryObject;
|
|
3993
|
+
return _objectSpread2(_objectSpread2(_objectSpread2({}, queryObject), needsId && { id: idGenerator() }), {}, { rules: newRules });
|
|
3994
|
+
};
|
|
4017
3995
|
/**
|
|
4018
3996
|
* Ensures that a rule or group is valid. See {@link prepareRule} and {@link prepareRuleGroup}.
|
|
4019
3997
|
*/
|
|
4020
3998
|
const prepareRuleOrGroup = (rg, { idGenerator = generateID } = {}) => isRuleGroup(rg) ? prepareRuleGroup(rg, { idGenerator }) : prepareRule(rg, { idGenerator });
|
|
4021
|
-
|
|
4022
3999
|
//#endregion
|
|
4023
4000
|
//#region src/utils/regenerateIDs.ts
|
|
4024
4001
|
/**
|
|
@@ -4036,44 +4013,65 @@ const regenerateIDs = (subject, { idGenerator = generateID } = {}) => {
|
|
|
4036
4013
|
if (Array.isArray(newGroup.rules)) newGroup.rules = subject.rules.map((r) => typeof r === "string" ? r : isRuleGroup(r) ? regenerateIDs(r, { idGenerator }) : regenerateID(r, { idGenerator }));
|
|
4037
4014
|
return newGroup;
|
|
4038
4015
|
};
|
|
4039
|
-
|
|
4040
4016
|
//#endregion
|
|
4041
4017
|
//#region src/utils/queryTools.ts
|
|
4042
4018
|
/**
|
|
4043
|
-
* Adds a rule or group to a query.
|
|
4044
|
-
*
|
|
4019
|
+
* Adds a rule or group to a query without mutating the original query.
|
|
4020
|
+
*
|
|
4021
|
+
* @returns A new query with the rule or group added.
|
|
4045
4022
|
*
|
|
4046
4023
|
* @group Query Tools
|
|
4047
4024
|
*/
|
|
4048
|
-
const add = (query, ruleOrGroup, parentPathOrID,
|
|
4049
|
-
|
|
4050
|
-
|
|
4025
|
+
const add = (query, ruleOrGroup, parentPathOrID, options = {}) => produce(query, (q) => addInPlace(q, ruleOrGroup, parentPathOrID, options));
|
|
4026
|
+
/**
|
|
4027
|
+
* Adds a rule or group to a query in place.
|
|
4028
|
+
*
|
|
4029
|
+
* @returns The query (mutated in place) with the rule or group added.
|
|
4030
|
+
*
|
|
4031
|
+
* @group Query Tools
|
|
4032
|
+
*/
|
|
4033
|
+
const addInPlace = (query, ruleOrGroup, parentPathOrID, options = {}) => {
|
|
4034
|
+
const { combinators = defaultCombinators, combinatorPreceding, idGenerator = generateID } = options;
|
|
4035
|
+
const parent = Array.isArray(parentPathOrID) ? findPath(parentPathOrID, query) : findID(parentPathOrID, query);
|
|
4036
|
+
if (!parent || !isRuleGroup(parent)) return query;
|
|
4051
4037
|
if (isRuleGroupTypeIC(parent) && parent.rules.length > 0) {
|
|
4052
4038
|
const prevCombinator = parent.rules.at(-2);
|
|
4053
4039
|
parent.rules.push(combinatorPreceding !== null && combinatorPreceding !== void 0 ? combinatorPreceding : typeof prevCombinator === "string" ? prevCombinator : getFirstOption(combinators));
|
|
4054
4040
|
}
|
|
4055
4041
|
parent.rules.push(prepareRuleOrGroup(ruleOrGroup, { idGenerator }));
|
|
4056
|
-
|
|
4042
|
+
return query;
|
|
4043
|
+
};
|
|
4057
4044
|
/**
|
|
4058
|
-
* Updates a property of a rule or group within a query.
|
|
4059
|
-
*
|
|
4045
|
+
* Updates a property of a rule or group within a query without mutating the original query.
|
|
4046
|
+
*
|
|
4047
|
+
* @returns A new query with the rule or group property updated.
|
|
4048
|
+
*
|
|
4049
|
+
* @group Query Tools
|
|
4050
|
+
*/
|
|
4051
|
+
const update = (query, prop, value, pathOrID, options = {}) => produce(query, (q) => updateInPlace(q, prop, value, pathOrID, options));
|
|
4052
|
+
/**
|
|
4053
|
+
* Updates a property of a rule or group within a query in place.
|
|
4054
|
+
*
|
|
4055
|
+
* @returns The query (mutated in place) with the rule or group property updated.
|
|
4060
4056
|
*
|
|
4061
4057
|
* @group Query Tools
|
|
4062
4058
|
*/
|
|
4063
|
-
const
|
|
4064
|
-
const
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4059
|
+
const updateInPlace = (query, prop, value, pathOrID, options = {}) => {
|
|
4060
|
+
const { resetOnFieldChange: _resetOnFieldChange = true, resetOnOperatorChange = false, getRuleDefaultOperator = () => "=", getValueSources = () => ["value"], getRuleDefaultValue = () => "", getMatchModes = () => [] } = options;
|
|
4061
|
+
let resetOnFieldChange = _resetOnFieldChange;
|
|
4062
|
+
const path = Array.isArray(pathOrID) ? pathOrID : getPathOfID(pathOrID, query);
|
|
4063
|
+
if (!path) return query;
|
|
4064
|
+
if (prop === "combinator" && !isRuleGroupType(query)) {
|
|
4065
|
+
const parentRules = findPath(getParentPath(path), query).rules;
|
|
4068
4066
|
if (path.at(-1) % 2 === 1) parentRules[path.at(-1)] = value;
|
|
4069
|
-
return;
|
|
4067
|
+
return query;
|
|
4070
4068
|
}
|
|
4071
|
-
const ruleOrGroup = findPath(path,
|
|
4072
|
-
if (!ruleOrGroup) return;
|
|
4069
|
+
const ruleOrGroup = findPath(path, query);
|
|
4070
|
+
if (!ruleOrGroup) return query;
|
|
4073
4071
|
const isGroup = isRuleGroup(ruleOrGroup);
|
|
4074
|
-
if (ruleOrGroup[prop] === value) return;
|
|
4072
|
+
if (ruleOrGroup[prop] === value) return query;
|
|
4075
4073
|
if (prop !== "valueSource") ruleOrGroup[prop] = value;
|
|
4076
|
-
if (isGroup) return;
|
|
4074
|
+
if (isGroup) return query;
|
|
4077
4075
|
let resetValueSource = false;
|
|
4078
4076
|
let resetValue = false;
|
|
4079
4077
|
if (prop === "field") {
|
|
@@ -4109,25 +4107,33 @@ const update = (query, prop, value, pathOrID, { resetOnFieldChange = true, reset
|
|
|
4109
4107
|
ruleOrGroup.valueSource = resetValueSource ? defaultValueSource : value;
|
|
4110
4108
|
}
|
|
4111
4109
|
if (resetValue) ruleOrGroup.value = getRuleDefaultValue(ruleOrGroup);
|
|
4112
|
-
|
|
4110
|
+
return query;
|
|
4111
|
+
};
|
|
4112
|
+
/**
|
|
4113
|
+
* Removes a rule or group from a query without mutating the original query.
|
|
4114
|
+
*
|
|
4115
|
+
* @returns A new query with the rule or group removed.
|
|
4116
|
+
*
|
|
4117
|
+
* @group Query Tools
|
|
4118
|
+
*/
|
|
4119
|
+
const remove = (query, pathOrID) => produce(query, (q) => removeInPlace(q, pathOrID));
|
|
4113
4120
|
/**
|
|
4114
|
-
* Removes a rule or group from a query.
|
|
4115
|
-
*
|
|
4121
|
+
* Removes a rule or group from a query in place.
|
|
4122
|
+
*
|
|
4123
|
+
* @returns The query (mutated in place) with the rule or group removed.
|
|
4116
4124
|
*
|
|
4117
4125
|
* @group Query Tools
|
|
4118
4126
|
*/
|
|
4119
|
-
const
|
|
4127
|
+
const removeInPlace = (query, pathOrID) => {
|
|
4120
4128
|
const path = Array.isArray(pathOrID) ? pathOrID : getPathOfID(pathOrID, query);
|
|
4121
|
-
if (!path) return query;
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
const
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
} else parent.rules.splice(index, 1);
|
|
4130
|
-
});
|
|
4129
|
+
if (!path || path.length === 0 || !isRuleGroupType(query) && !findPath(path, query)) return query;
|
|
4130
|
+
const index = path.at(-1);
|
|
4131
|
+
const parent = findPath(getParentPath(path), query);
|
|
4132
|
+
if (parent && isRuleGroup(parent)) if (!isRuleGroupType(parent) && parent.rules.length > 1) {
|
|
4133
|
+
const idxStartDelete = index === 0 ? 0 : index - 1;
|
|
4134
|
+
parent.rules.splice(idxStartDelete, 2);
|
|
4135
|
+
} else parent.rules.splice(index, 1);
|
|
4136
|
+
return query;
|
|
4131
4137
|
};
|
|
4132
4138
|
const getNextPath = (query, currentPath, newPathOrShiftDirection) => {
|
|
4133
4139
|
if (Array.isArray(newPathOrShiftDirection)) return newPathOrShiftDirection;
|
|
@@ -4154,65 +4160,85 @@ const getNextPath = (query, currentPath, newPathOrShiftDirection) => {
|
|
|
4154
4160
|
return currentPath;
|
|
4155
4161
|
};
|
|
4156
4162
|
/**
|
|
4157
|
-
* Moves a rule or group from one path to another
|
|
4158
|
-
* `{ clone: true }` to copy instead of move.
|
|
4159
|
-
*
|
|
4163
|
+
* Moves a rule or group from one path to another without mutating the original query.
|
|
4164
|
+
* In the options parameter, pass `{ clone: true }` to copy instead of move.
|
|
4165
|
+
*
|
|
4166
|
+
* @returns A new query with the rule or group moved or cloned.
|
|
4160
4167
|
*
|
|
4161
4168
|
* @group Query Tools
|
|
4162
4169
|
*/
|
|
4163
|
-
const move = (query, oldPathOrID, newPath,
|
|
4170
|
+
const move = (query, oldPathOrID, newPath, options = {}) => produce(query, (q) => moveInPlace(q, oldPathOrID, newPath, options));
|
|
4171
|
+
/**
|
|
4172
|
+
* Moves a rule or group from one path to another in place.
|
|
4173
|
+
* In the options parameter, pass `{ clone: true }` to copy instead of move.
|
|
4174
|
+
*
|
|
4175
|
+
* @returns The query (mutated in place) with the rule or group moved or cloned.
|
|
4176
|
+
*
|
|
4177
|
+
* @group Query Tools
|
|
4178
|
+
*/
|
|
4179
|
+
const moveInPlace = (query, oldPathOrID, newPath, options = {}) => {
|
|
4180
|
+
const { clone = false, combinators = defaultCombinators, idGenerator = generateID } = options;
|
|
4164
4181
|
const oldPath = Array.isArray(oldPathOrID) ? oldPathOrID : getPathOfID(oldPathOrID, query);
|
|
4165
4182
|
if (!oldPath) return query;
|
|
4166
4183
|
const nextPath = getNextPath(query, oldPath, newPath);
|
|
4167
4184
|
if (oldPath.length === 0 || pathsAreEqual(oldPath, nextPath) || !findPath(getParentPath(nextPath), query)) return query;
|
|
4168
4185
|
const ruleOrGroupOriginal = findPath(oldPath, query);
|
|
4169
4186
|
if (!ruleOrGroupOriginal) return query;
|
|
4170
|
-
const ruleOrGroup = clone ? regenerateIDs(ruleOrGroupOriginal, { idGenerator }) : ruleOrGroupOriginal;
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
});
|
|
4187
|
+
const ruleOrGroup = clone ? regenerateIDs(isDraft(ruleOrGroupOriginal) ? current(ruleOrGroupOriginal) : ruleOrGroupOriginal, { idGenerator }) : ruleOrGroupOriginal;
|
|
4188
|
+
const independentCombinators = isRuleGroupTypeIC(query);
|
|
4189
|
+
const parentOfRuleToRemove = findPath(getParentPath(oldPath), query);
|
|
4190
|
+
const ruleToRemoveIndex = oldPath.at(-1);
|
|
4191
|
+
const oldPrevCombinator = independentCombinators && ruleToRemoveIndex > 0 ? parentOfRuleToRemove.rules[ruleToRemoveIndex - 1] : null;
|
|
4192
|
+
const oldNextCombinator = independentCombinators && ruleToRemoveIndex < parentOfRuleToRemove.rules.length - 1 ? parentOfRuleToRemove.rules[ruleToRemoveIndex + 1] : null;
|
|
4193
|
+
if (!clone) {
|
|
4194
|
+
const idxStartDelete = independentCombinators ? Math.max(0, ruleToRemoveIndex - 1) : ruleToRemoveIndex;
|
|
4195
|
+
const deleteLength = independentCombinators ? 2 : 1;
|
|
4196
|
+
parentOfRuleToRemove.rules.splice(idxStartDelete, deleteLength);
|
|
4197
|
+
}
|
|
4198
|
+
const newNewPath = [...nextPath];
|
|
4199
|
+
const commonAncestorPath = getCommonAncestorPath(oldPath, nextPath);
|
|
4200
|
+
if (!clone && oldPath.length === commonAncestorPath.length + 1 && nextPath[commonAncestorPath.length] > oldPath[commonAncestorPath.length]) newNewPath[commonAncestorPath.length] -= independentCombinators ? 2 : 1;
|
|
4201
|
+
const parentToInsertInto = findPath(getParentPath(newNewPath), query);
|
|
4202
|
+
const newIndex = newNewPath.at(-1);
|
|
4203
|
+
/**
|
|
4204
|
+
* This function 1) glosses over the need for type assertions to splice directly
|
|
4205
|
+
* into `parentToInsertInto.rules`, and 2) shortens the actual insertion code.
|
|
4206
|
+
*/
|
|
4207
|
+
const insertRuleOrGroup = (...args) => parentToInsertInto.rules.splice(newIndex, 0, ...args);
|
|
4208
|
+
if (parentToInsertInto.rules.length === 0 || !independentCombinators) insertRuleOrGroup(ruleOrGroup);
|
|
4209
|
+
else if (newIndex === 0) if (ruleToRemoveIndex === 0 && oldNextCombinator) insertRuleOrGroup(ruleOrGroup, oldNextCombinator);
|
|
4210
|
+
else {
|
|
4211
|
+
var _ref, _parentToInsertInto$r;
|
|
4212
|
+
insertRuleOrGroup(ruleOrGroup, (_ref = (_parentToInsertInto$r = parentToInsertInto.rules[1]) !== null && _parentToInsertInto$r !== void 0 ? _parentToInsertInto$r : oldPrevCombinator) !== null && _ref !== void 0 ? _ref : getFirstOption(combinators));
|
|
4213
|
+
}
|
|
4214
|
+
else if (oldPrevCombinator) insertRuleOrGroup(oldPrevCombinator, ruleOrGroup);
|
|
4215
|
+
else {
|
|
4216
|
+
var _ref2, _parentToInsertInto$r2;
|
|
4217
|
+
insertRuleOrGroup((_ref2 = (_parentToInsertInto$r2 = parentToInsertInto.rules[newIndex - 2]) !== null && _parentToInsertInto$r2 !== void 0 ? _parentToInsertInto$r2 : oldNextCombinator) !== null && _ref2 !== void 0 ? _ref2 : getFirstOption(combinators), ruleOrGroup);
|
|
4218
|
+
}
|
|
4219
|
+
return query;
|
|
4204
4220
|
};
|
|
4205
4221
|
/**
|
|
4206
|
-
* Inserts a rule or group into a query.
|
|
4207
|
-
*
|
|
4222
|
+
* Inserts a rule or group into a query without mutating the original query.
|
|
4223
|
+
*
|
|
4224
|
+
* @returns A new query with the rule or group inserted.
|
|
4208
4225
|
*
|
|
4209
4226
|
* @group Query Tools
|
|
4210
4227
|
*/
|
|
4211
|
-
const insert = (query, ruleOrGroup, path,
|
|
4212
|
-
|
|
4213
|
-
|
|
4228
|
+
const insert = (query, ruleOrGroup, path, options = {}) => produce(query, (q) => insertInPlace(q, ruleOrGroup, path, options));
|
|
4229
|
+
/**
|
|
4230
|
+
* Inserts a rule or group into a query in place.
|
|
4231
|
+
*
|
|
4232
|
+
* @returns The query (mutated in place) with the rule or group inserted.
|
|
4233
|
+
*
|
|
4234
|
+
* @group Query Tools
|
|
4235
|
+
*/
|
|
4236
|
+
const insertInPlace = (query, ruleOrGroup, path, options = {}) => {
|
|
4237
|
+
const { combinators = defaultCombinators, combinatorPreceding, combinatorSucceeding, idGenerator = generateID, replace = false } = options;
|
|
4238
|
+
const parentToInsertInto = findPath(getParentPath(path), query);
|
|
4239
|
+
if (!parentToInsertInto || !isRuleGroup(parentToInsertInto)) return query;
|
|
4214
4240
|
const rorg = regenerateIDs(ruleOrGroup, { idGenerator });
|
|
4215
|
-
const independentCombinators = isRuleGroupTypeIC(
|
|
4241
|
+
const independentCombinators = isRuleGroupTypeIC(query);
|
|
4216
4242
|
const newIndex = path.at(-1);
|
|
4217
4243
|
/**
|
|
4218
4244
|
* This function 1) glosses over the need for type assertions to splice directly
|
|
@@ -4236,17 +4262,29 @@ const insert = (query, ruleOrGroup, path, { combinators = defaultCombinators, co
|
|
|
4236
4262
|
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);
|
|
4237
4263
|
}
|
|
4238
4264
|
}
|
|
4239
|
-
|
|
4265
|
+
return query;
|
|
4266
|
+
};
|
|
4240
4267
|
/**
|
|
4241
4268
|
* Creates a new group at a target path with its `rules` array containing the current
|
|
4242
|
-
* objects at the target path and the source path
|
|
4243
|
-
* `{ clone: true }` to copy the source rule/group instead of move.
|
|
4269
|
+
* objects at the target path and the source path without mutating the original query.
|
|
4270
|
+
* In the options parameter, pass `{ clone: true }` to copy the source rule/group instead of move.
|
|
4244
4271
|
*
|
|
4245
|
-
* @returns
|
|
4272
|
+
* @returns A new query with the rules or groups grouped.
|
|
4246
4273
|
*
|
|
4247
4274
|
* @group Query Tools
|
|
4248
4275
|
*/
|
|
4249
|
-
const group = (query, sourcePathOrID, targetPathOrID,
|
|
4276
|
+
const group = (query, sourcePathOrID, targetPathOrID, options = {}) => produce(query, (q) => groupInPlace(q, sourcePathOrID, targetPathOrID, options));
|
|
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 in place.
|
|
4280
|
+
* In the options parameter, pass `{ clone: true }` to copy the source rule/group instead of move.
|
|
4281
|
+
*
|
|
4282
|
+
* @returns The query (mutated in place) with the rules or groups grouped.
|
|
4283
|
+
*
|
|
4284
|
+
* @group Query Tools
|
|
4285
|
+
*/
|
|
4286
|
+
const groupInPlace = (query, sourcePathOrID, targetPathOrID, options = {}) => {
|
|
4287
|
+
const { clone = false, combinators = defaultCombinators, idGenerator = generateID } = options;
|
|
4250
4288
|
const sourcePath = Array.isArray(sourcePathOrID) ? sourcePathOrID : getPathOfID(sourcePathOrID, query);
|
|
4251
4289
|
const targetPath = Array.isArray(targetPathOrID) ? targetPathOrID : getPathOfID(targetPathOrID, query);
|
|
4252
4290
|
if (!sourcePath || !targetPath) return query;
|
|
@@ -4255,32 +4293,31 @@ const group = (query, sourcePathOrID, targetPathOrID, { clone = false, combinato
|
|
|
4255
4293
|
const sourceRuleOrGroupOriginal = findPath(sourcePath, query);
|
|
4256
4294
|
const targetRuleOrGroup = findPath(targetPath, query);
|
|
4257
4295
|
if (!sourceRuleOrGroupOriginal || !targetRuleOrGroup) return query;
|
|
4258
|
-
const sourceRuleOrGroup = clone ? regenerateIDs(sourceRuleOrGroupOriginal, { idGenerator }) : sourceRuleOrGroupOriginal;
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
});
|
|
4296
|
+
const sourceRuleOrGroup = clone ? regenerateIDs(isDraft(sourceRuleOrGroupOriginal) ? current(sourceRuleOrGroupOriginal) : sourceRuleOrGroupOriginal, { idGenerator }) : sourceRuleOrGroupOriginal;
|
|
4297
|
+
const independentCombinators = isRuleGroupTypeIC(query);
|
|
4298
|
+
const parentOfRuleToRemove = findPath(getParentPath(sourcePath), query);
|
|
4299
|
+
const ruleToRemoveIndex = sourcePath.at(-1);
|
|
4300
|
+
if (!clone) {
|
|
4301
|
+
const idxStartDelete = independentCombinators ? Math.max(0, ruleToRemoveIndex - 1) : ruleToRemoveIndex;
|
|
4302
|
+
const deleteLength = independentCombinators ? 2 : 1;
|
|
4303
|
+
parentOfRuleToRemove.rules.splice(idxStartDelete, deleteLength);
|
|
4304
|
+
}
|
|
4305
|
+
const newNewPath = [...nextPath];
|
|
4306
|
+
const commonAncestorPath = getCommonAncestorPath(sourcePath, nextPath);
|
|
4307
|
+
if (!clone && sourcePath.length === commonAncestorPath.length + 1 && nextPath[commonAncestorPath.length] > sourcePath[commonAncestorPath.length]) newNewPath[commonAncestorPath.length] -= independentCombinators ? 2 : 1;
|
|
4308
|
+
const parentOfTargetPath = findPath(getParentPath(newNewPath), query);
|
|
4309
|
+
const targetPathIndex = newNewPath.at(-1);
|
|
4310
|
+
parentOfTargetPath.rules.splice(targetPathIndex, 1, prepareRuleOrGroup(independentCombinators ? { rules: [
|
|
4311
|
+
targetRuleOrGroup,
|
|
4312
|
+
getFirstOption(combinators),
|
|
4313
|
+
sourceRuleOrGroup
|
|
4314
|
+
] } : {
|
|
4315
|
+
combinator: getFirstOption(combinators),
|
|
4316
|
+
rules: [targetRuleOrGroup, sourceRuleOrGroup]
|
|
4317
|
+
}, { idGenerator }));
|
|
4318
|
+
return query;
|
|
4282
4319
|
};
|
|
4283
|
-
|
|
4284
4320
|
//#endregion
|
|
4285
|
-
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 };
|
|
4321
|
+
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, 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 };
|
|
4322
|
+
|
|
4286
4323
|
//# sourceMappingURL=react-querybuilder_core.legacy-esm.js.map
|