@react-querybuilder/core 8.11.1 → 8.11.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-B4vXboTG.d.mts → basic-CLG_Bmom.d.mts} +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +14 -2
- package/dist/cjs/react-querybuilder_core.cjs.development.js +23 -11
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +14 -2
- 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-DAqoID3O.js → convertQuery-C7NvB0XA.js} +1 -1
- package/dist/{convertQuery-DAqoID3O.js.map → convertQuery-C7NvB0XA.js.map} +1 -1
- package/dist/{convertQuery-CqX3rPvj.mjs → convertQuery-Cj4t-LT4.mjs} +2 -2
- package/dist/{convertQuery-CqX3rPvj.mjs.map → convertQuery-Cj4t-LT4.mjs.map} +1 -1
- package/dist/{export-BjRt-qrK.d.mts → export-B2Yw5gak.d.mts} +2 -2
- package/dist/formatQuery.d.mts +15 -3
- package/dist/formatQuery.d.ts +13 -1
- package/dist/formatQuery.js +170 -423
- package/dist/formatQuery.js.map +1 -1
- package/dist/formatQuery.mjs +4 -257
- package/dist/formatQuery.mjs.map +1 -1
- package/dist/{import-Bc_p8ls9.d.mts → import-BtpySRSy.d.mts} +2 -2
- package/dist/{isRuleGroup-CYcfPgbg.mjs → isRuleGroup-BcfwGaIN.mjs} +1 -1
- package/dist/{isRuleGroup-CYcfPgbg.mjs.map → isRuleGroup-BcfwGaIN.mjs.map} +1 -1
- package/dist/parseCEL.d.mts +32 -7
- package/dist/parseCEL.d.ts +30 -5
- package/dist/parseCEL.js +168 -9
- package/dist/parseCEL.js.map +1 -1
- package/dist/parseCEL.mjs +163 -8
- package/dist/parseCEL.mjs.map +1 -1
- package/dist/parseJSONata.d.mts +2 -2
- package/dist/parseJSONata.js +2 -2
- package/dist/parseJSONata.mjs +3 -3
- package/dist/parseJsonLogic.d.mts +3 -3
- package/dist/parseJsonLogic.js +9 -10
- package/dist/parseJsonLogic.js.map +1 -1
- package/dist/parseJsonLogic.mjs +4 -5
- package/dist/parseJsonLogic.mjs.map +1 -1
- package/dist/parseMongoDB.d.mts +2 -2
- package/dist/parseMongoDB.js +19 -20
- package/dist/parseMongoDB.js.map +1 -1
- package/dist/parseMongoDB.mjs +4 -5
- package/dist/parseMongoDB.mjs.map +1 -1
- package/dist/parseSQL.d.mts +2 -2
- package/dist/parseSQL.js +8 -10
- package/dist/parseSQL.js.map +1 -1
- package/dist/parseSQL.mjs +3 -5
- package/dist/parseSQL.mjs.map +1 -1
- package/dist/parseSpEL.d.mts +2 -2
- package/dist/parseSpEL.js +3 -4
- package/dist/parseSpEL.js.map +1 -1
- package/dist/parseSpEL.mjs +3 -4
- package/dist/parseSpEL.mjs.map +1 -1
- package/dist/{prepareQueryObjects-DPCC-iHp.mjs → prepareQueryObjects-BfnyRV5t.mjs} +4 -3
- package/dist/{prepareQueryObjects-DPCC-iHp.mjs.map → prepareQueryObjects-BfnyRV5t.mjs.map} +1 -1
- package/dist/{prepareQueryObjects-BOUWfel5.js → prepareQueryObjects-Cz_28zYz.js} +12 -11
- package/dist/prepareQueryObjects-Cz_28zYz.js.map +1 -0
- package/dist/react-querybuilder_core.d.mts +14 -2
- package/dist/react-querybuilder_core.legacy-esm.d.ts +14 -2
- package/dist/react-querybuilder_core.legacy-esm.js +23 -11
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +23 -11
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +14 -2
- package/dist/react-querybuilder_core.production.mjs +1 -1
- package/dist/react-querybuilder_core.production.mjs.map +1 -1
- package/dist/{transformQuery-CWDPogO5.js → transformQuery-B4SaTTO-.js} +1 -1
- package/dist/{transformQuery-CWDPogO5.js.map → transformQuery-B4SaTTO-.js.map} +1 -1
- package/dist/{transformQuery-DCCpjtyq.mjs → transformQuery-C85j__7e.mjs} +2 -2
- package/dist/{transformQuery-DCCpjtyq.mjs.map → transformQuery-C85j__7e.mjs.map} +1 -1
- package/dist/transformQuery.d.mts +1 -1
- package/dist/transformQuery.js +1 -1
- package/dist/transformQuery.mjs +2 -2
- package/dist/utils-Dkz3Xn2D.js +707 -0
- package/dist/utils-Dkz3Xn2D.js.map +1 -0
- package/dist/utils-DxH23QtE.mjs +514 -0
- package/dist/utils-DxH23QtE.mjs.map +1 -0
- package/package.json +8 -8
- package/dist/arrayUtils-A_OXU9W1.mjs +0 -50
- package/dist/arrayUtils-A_OXU9W1.mjs.map +0 -1
- package/dist/arrayUtils-QxZOZTf6.js +0 -73
- package/dist/arrayUtils-QxZOZTf6.js.map +0 -1
- package/dist/optGroupUtils-B0hTpodo.js +0 -251
- package/dist/optGroupUtils-B0hTpodo.js.map +0 -1
- package/dist/optGroupUtils-VeZ3k7-1.mjs +0 -185
- package/dist/optGroupUtils-VeZ3k7-1.mjs.map +0 -1
- package/dist/parseNumber-CXdMVNFx.mjs +0 -24
- package/dist/parseNumber-CXdMVNFx.mjs.map +0 -1
- package/dist/parseNumber-D4iQDxK-.js +0 -31
- package/dist/parseNumber-D4iQDxK-.js.map +0 -1
- package/dist/prepareQueryObjects-BOUWfel5.js.map +0 -1
|
@@ -1254,4 +1254,4 @@ type ParseNumbersModerationLevel = "-limited" | "";
|
|
|
1254
1254
|
type ParseNumbersPropConfig = boolean | `${ParseNumberMethodName}${ParseNumbersModerationLevel}`;
|
|
1255
1255
|
//#endregion
|
|
1256
1256
|
export { Except as C, SetRequired as S, RuleGroupType as _, ValueSource as a, FullOptionList as b, RuleValidator as c, DefaultRuleGroupTypeIC as d, RuleGroupTypeAny as f, DefaultRuleGroupType as g, DefaultOperatorName as h, ParseNumbersPropConfig as i, ValidationMap as l, DefaultCombinatorName as m, FullOperator as n, ValueSources as o, RuleGroupTypeIC as p, InputType as r, QueryValidator as s, FullField as t, ValidationResult as u, RuleType as v, OptionList as x, FlexibleOptionList as y };
|
|
1257
|
-
//# sourceMappingURL=basic-
|
|
1257
|
+
//# sourceMappingURL=basic-CLG_Bmom.d.mts.map
|
|
@@ -3441,7 +3441,19 @@ type ProcessedMatchMode = {
|
|
|
3441
3441
|
mode: "exactly";
|
|
3442
3442
|
threshold: number;
|
|
3443
3443
|
};
|
|
3444
|
-
|
|
3444
|
+
/**
|
|
3445
|
+
* Transforms
|
|
3446
|
+
* - `match: { mode: "atLeast", threshold: 1 }` to `match: { mode: "some" }`
|
|
3447
|
+
* - `match: { mode: "atMost", threshold: 0 }` to `match: { mode: "none" }`.
|
|
3448
|
+
*
|
|
3449
|
+
* Returns:
|
|
3450
|
+
* - Processed `{ mode, threshold }` object for valid subqueries
|
|
3451
|
+
* - `null` if match mode is not applicable for the rule
|
|
3452
|
+
* - `false` if match mode is valid, but either
|
|
3453
|
+
* 1. `threshold` is required and invalid, or
|
|
3454
|
+
* 2. `value` is not a valid rule group.
|
|
3455
|
+
*/
|
|
3456
|
+
declare const processMatchMode: (rule: RuleType) => null | false | ProcessedMatchMode;
|
|
3445
3457
|
/**
|
|
3446
3458
|
* "Replacer" method for JSON.stringify's second argument. Converts `bigint` values to
|
|
3447
3459
|
* objects with a `$bigint` property having a value of a string representation of
|
|
@@ -3766,7 +3778,7 @@ declare const uniqOptGroups: <T extends BaseOption>(originalArray: FlexibleOptio
|
|
|
3766
3778
|
declare const uniqOptList: <T extends BaseOption>(originalArray: FlexibleOptionList<T>) => WithUnknownIndex<BaseOption & FullOption>[] | OptionGroup<ToFullOption<T>>[];
|
|
3767
3779
|
interface PreparedOptionList<O$1 extends FullOption> {
|
|
3768
3780
|
defaultOption: FullOption;
|
|
3769
|
-
optionList:
|
|
3781
|
+
optionList: FullOptionList<O$1>;
|
|
3770
3782
|
optionsMap: Partial<FullOptionRecord<FullOption>>;
|
|
3771
3783
|
}
|
|
3772
3784
|
interface PrepareOptionListParams<O$1 extends FullOption> {
|
|
@@ -1028,7 +1028,7 @@ const prepareOptionList = (props) => {
|
|
|
1028
1028
|
label: placeholderLabel
|
|
1029
1029
|
};
|
|
1030
1030
|
const optionsProp = optionListPropOriginal ?? [defaultOption];
|
|
1031
|
-
let optionList
|
|
1031
|
+
let optionList;
|
|
1032
1032
|
const opts = Array.isArray(optionsProp) ? toFullOptionList(optionsProp, baseOption, labelMap) : objectKeys(toFullOptionMap(optionsProp, baseOption)).map((opt) => ({
|
|
1033
1033
|
...optionsProp[opt],
|
|
1034
1034
|
name: opt,
|
|
@@ -1389,18 +1389,29 @@ const translationMatchFilter = (key, keyToTest, conditions) => keyToTest.startsW
|
|
|
1389
1389
|
* @group Export
|
|
1390
1390
|
*/
|
|
1391
1391
|
const getNLTranslataion = (key, translations, conditions = []) => conditions.length === 0 ? translations[key] ?? defaultNLTranslations[key] ?? "" : Object.entries(translations).find(([keyToTest]) => translationMatchFilter(key, keyToTest, conditions))?.[1] ?? Object.entries(defaultNLTranslations).find(([keyToTest]) => translationMatchFilter(key, keyToTest, conditions))?.[1] ?? defaultNLTranslations[key] ?? "";
|
|
1392
|
+
/**
|
|
1393
|
+
* Transforms
|
|
1394
|
+
* - `match: { mode: "atLeast", threshold: 1 }` to `match: { mode: "some" }`
|
|
1395
|
+
* - `match: { mode: "atMost", threshold: 0 }` to `match: { mode: "none" }`.
|
|
1396
|
+
*
|
|
1397
|
+
* Returns:
|
|
1398
|
+
* - Processed `{ mode, threshold }` object for valid subqueries
|
|
1399
|
+
* - `null` if match mode is not applicable for the rule
|
|
1400
|
+
* - `false` if match mode is valid, but either
|
|
1401
|
+
* 1. `threshold` is required and invalid, or
|
|
1402
|
+
* 2. `value` is not a valid rule group.
|
|
1403
|
+
*/
|
|
1392
1404
|
const processMatchMode = (rule) => {
|
|
1393
1405
|
const { mode, threshold } = rule.match ?? {};
|
|
1394
|
-
if (mode)
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
}
|
|
1406
|
+
if (!mode) return null;
|
|
1407
|
+
if (!isRuleGroup(rule.value)) return false;
|
|
1408
|
+
const matchModeLC = lc(mode);
|
|
1409
|
+
const matchModeCoerced = matchModeLC === "atleast" && threshold === 1 ? "some" : matchModeLC === "atmost" && threshold === 0 ? "none" : matchModeLC;
|
|
1410
|
+
if ((matchModeCoerced === "atleast" || matchModeCoerced === "atmost" || matchModeCoerced === "exactly") && (typeof threshold !== "number" || threshold < 0)) return false;
|
|
1411
|
+
return {
|
|
1412
|
+
mode: matchModeCoerced,
|
|
1413
|
+
threshold
|
|
1414
|
+
};
|
|
1404
1415
|
};
|
|
1405
1416
|
/**
|
|
1406
1417
|
* "Replacer" method for JSON.stringify's second argument. Converts `bigint` values to
|
|
@@ -3935,6 +3946,7 @@ const preferFlagProps = (props = {}, contextVals = {}, finalize) => objectEntrie
|
|
|
3935
3946
|
*/
|
|
3936
3947
|
const prepareRule = (rule, { idGenerator = generateID } = {}) => (0, immer.produce)(rule, (draft) => {
|
|
3937
3948
|
if (!draft.id) draft.id = idGenerator();
|
|
3949
|
+
if (processMatchMode(draft)) draft.value = prepareRuleGroup(draft.value, { idGenerator });
|
|
3938
3950
|
});
|
|
3939
3951
|
/**
|
|
3940
3952
|
* Ensures that a rule group is valid by recursively adding an `id` property to the group itself
|