@react-querybuilder/core 8.11.1 → 8.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{basic-BeKPP0_1.d.ts → basic-DbvrfPNz.d.mts} +39 -4
- package/dist/{basic-B4vXboTG.d.mts → basic-o1-sYjK6.d.ts} +39 -4
- package/dist/chunk-BxBTb9qk.js +39 -0
- package/dist/chunk-DrjzjjTJ.mjs +23 -0
- package/dist/chunk-Dv2ph0Ay.js +23 -0
- package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +131 -53
- package/dist/cjs/react-querybuilder_core.cjs.development.js +36 -39
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +131 -53
- 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-CqX3rPvj.mjs → convertQuery-Cj4t-LT4.mjs} +2 -2
- package/dist/{convertQuery-CqX3rPvj.mjs.map → convertQuery-Cj4t-LT4.mjs.map} +1 -1
- package/dist/{convertQuery-DAqoID3O.js → convertQuery-DuY_BJHy.js} +3 -3
- package/dist/{convertQuery-DAqoID3O.js.map → convertQuery-DuY_BJHy.js.map} +1 -1
- package/dist/{export-BjRt-qrK.d.mts → export-CCULKoP4.d.mts} +2 -2
- package/dist/{export-CQB0nuvW.d.ts → export-WDHFbiPz.d.ts} +2 -2
- package/dist/formatQuery.d.mts +15 -3
- package/dist/formatQuery.d.ts +15 -3
- package/dist/formatQuery.js +172 -425
- package/dist/formatQuery.js.map +1 -1
- package/dist/formatQuery.mjs +4 -257
- package/dist/formatQuery.mjs.map +1 -1
- package/dist/{import-Dvayhrgj.d.ts → import-BSWb9Vgd.d.ts} +2 -2
- package/dist/{import-Bc_p8ls9.d.mts → import-CLyHpgk8.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/{isRuleGroup-DqAs2x4E.js → isRuleGroup-Do9KKsmt.js} +2 -40
- package/dist/{isRuleGroup-DqAs2x4E.js.map → isRuleGroup-Do9KKsmt.js.map} +1 -1
- package/dist/parseCEL.d.mts +32 -7
- package/dist/parseCEL.d.ts +32 -7
- package/dist/parseCEL.js +181 -12
- package/dist/parseCEL.js.map +1 -1
- package/dist/parseCEL.mjs +174 -8
- package/dist/parseCEL.mjs.map +1 -1
- package/dist/parseJSONata.d.mts +2 -2
- package/dist/parseJSONata.d.ts +2 -2
- package/dist/parseJSONata.js +6 -5
- package/dist/parseJSONata.js.map +1 -1
- package/dist/parseJSONata.mjs +3 -3
- package/dist/parseJsonLogic.d.mts +3 -3
- package/dist/parseJsonLogic.d.ts +3 -3
- package/dist/parseJsonLogic.js +10 -11
- 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.d.ts +2 -2
- package/dist/parseMongoDB.js +20 -21
- 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.d.ts +2 -2
- package/dist/parseSQL.js +10 -13
- 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.d.ts +2 -2
- package/dist/parseSpEL.js +7 -7
- 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-DCtJJrF5.js} +14 -13
- package/dist/prepareQueryObjects-DCtJJrF5.js.map +1 -0
- package/dist/react-querybuilder_core.d.mts +131 -53
- package/dist/react-querybuilder_core.legacy-esm.d.ts +131 -53
- package/dist/react-querybuilder_core.legacy-esm.js +43 -21
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +36 -14
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +131 -53
- package/dist/react-querybuilder_core.production.mjs +1 -1
- package/dist/react-querybuilder_core.production.mjs.map +1 -1
- package/dist/{transformQuery-DCCpjtyq.mjs → transformQuery-Bq4iyYsE.mjs} +9 -2
- package/dist/{transformQuery-DCCpjtyq.mjs.map → transformQuery-Bq4iyYsE.mjs.map} +1 -1
- package/dist/{transformQuery-CWDPogO5.js → transformQuery-DvJTAvkh.js} +10 -3
- package/dist/{transformQuery-CWDPogO5.js.map → transformQuery-DvJTAvkh.js.map} +1 -1
- package/dist/transformQuery.d.mts +1 -1
- package/dist/transformQuery.d.ts +1 -1
- package/dist/transformQuery.js +2 -2
- package/dist/transformQuery.mjs +2 -2
- package/dist/utils-CoYbYnVo.js +706 -0
- package/dist/utils-CoYbYnVo.js.map +1 -0
- package/dist/utils-DxH23QtE.mjs +514 -0
- package/dist/utils-DxH23QtE.mjs.map +1 -0
- package/package.json +15 -15
- 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
|
@@ -424,7 +424,8 @@ const standardClassnames = {
|
|
|
424
424
|
valueListItem: "rule-value-list-item",
|
|
425
425
|
branches: "queryBuilder-branches",
|
|
426
426
|
justified: "queryBuilder-justified",
|
|
427
|
-
hasSubQuery: "rule-hasSubQuery"
|
|
427
|
+
hasSubQuery: "rule-hasSubQuery",
|
|
428
|
+
loading: "queryBuilder-loading"
|
|
428
429
|
};
|
|
429
430
|
/**
|
|
430
431
|
* Default classnames for each component.
|
|
@@ -471,7 +472,8 @@ const defaultControlClassnames = {
|
|
|
471
472
|
disabled: "",
|
|
472
473
|
valueListItem: "",
|
|
473
474
|
branches: "",
|
|
474
|
-
hasSubQuery: ""
|
|
475
|
+
hasSubQuery: "",
|
|
476
|
+
loading: ""
|
|
475
477
|
};
|
|
476
478
|
/**
|
|
477
479
|
* Default reason codes for a group being invalid.
|
|
@@ -1003,7 +1005,7 @@ const prepareOptionList = (props) => {
|
|
|
1003
1005
|
label: placeholderLabel
|
|
1004
1006
|
};
|
|
1005
1007
|
const optionsProp = optionListPropOriginal ?? [defaultOption];
|
|
1006
|
-
let optionList
|
|
1008
|
+
let optionList;
|
|
1007
1009
|
const opts = Array.isArray(optionsProp) ? toFullOptionList(optionsProp, baseOption, labelMap) : objectKeys(toFullOptionMap(optionsProp, baseOption)).map((opt) => ({
|
|
1008
1010
|
...optionsProp[opt],
|
|
1009
1011
|
name: opt,
|
|
@@ -1088,6 +1090,13 @@ const parseNumber = (val, { parseNumbers, bigIntOnOverflow } = {}) => {
|
|
|
1088
1090
|
|
|
1089
1091
|
//#endregion
|
|
1090
1092
|
//#region src/utils/transformQuery.ts
|
|
1093
|
+
/**
|
|
1094
|
+
* Recursively steps through a query object ({@link index!RuleGroupType RuleGroupType} or {@link index!RuleGroupTypeIC RuleGroupTypeIC}),
|
|
1095
|
+
* passing each {@link index!RuleType RuleType} object to a provided `ruleProcessor` function and returning a
|
|
1096
|
+
* new query object if there were any referential changes.
|
|
1097
|
+
*
|
|
1098
|
+
* @module transformQuery
|
|
1099
|
+
*/
|
|
1091
1100
|
const remapProperties = (obj, propertyMap, deleteRemappedProperties) => produce(obj, (draft) => {
|
|
1092
1101
|
for (const [k, v] of Object.entries(propertyMap)) if (v === false) delete draft[k];
|
|
1093
1102
|
else if (!!v && k !== v && k in draft) {
|
|
@@ -1364,18 +1373,29 @@ const translationMatchFilter = (key, keyToTest, conditions) => keyToTest.startsW
|
|
|
1364
1373
|
* @group Export
|
|
1365
1374
|
*/
|
|
1366
1375
|
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] ?? "";
|
|
1376
|
+
/**
|
|
1377
|
+
* Transforms
|
|
1378
|
+
* - `match: { mode: "atLeast", threshold: 1 }` to `match: { mode: "some" }`
|
|
1379
|
+
* - `match: { mode: "atMost", threshold: 0 }` to `match: { mode: "none" }`.
|
|
1380
|
+
*
|
|
1381
|
+
* Returns:
|
|
1382
|
+
* - Processed `{ mode, threshold }` object for valid subqueries
|
|
1383
|
+
* - `null` if match mode is not applicable for the rule
|
|
1384
|
+
* - `false` if match mode is valid, but either
|
|
1385
|
+
* 1. `threshold` is required and invalid, or
|
|
1386
|
+
* 2. `value` is not a valid rule group.
|
|
1387
|
+
*/
|
|
1367
1388
|
const processMatchMode = (rule) => {
|
|
1368
1389
|
const { mode, threshold } = rule.match ?? {};
|
|
1369
|
-
if (mode)
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
}
|
|
1390
|
+
if (!mode) return null;
|
|
1391
|
+
if (!isRuleGroup(rule.value)) return false;
|
|
1392
|
+
const matchModeLC = lc(mode);
|
|
1393
|
+
const matchModeCoerced = matchModeLC === "atleast" && threshold === 1 ? "some" : matchModeLC === "atmost" && threshold === 0 ? "none" : matchModeLC;
|
|
1394
|
+
if ((matchModeCoerced === "atleast" || matchModeCoerced === "atmost" || matchModeCoerced === "exactly") && (typeof threshold !== "number" || threshold < 0)) return false;
|
|
1395
|
+
return {
|
|
1396
|
+
mode: matchModeCoerced,
|
|
1397
|
+
threshold
|
|
1398
|
+
};
|
|
1379
1399
|
};
|
|
1380
1400
|
/**
|
|
1381
1401
|
* "Replacer" method for JSON.stringify's second argument. Converts `bigint` values to
|
|
@@ -3877,7 +3897,8 @@ const mergeClassnames = (...args) => ({
|
|
|
3877
3897
|
matchMode: joinClassnamesByName("matchMode", args),
|
|
3878
3898
|
matchThreshold: joinClassnamesByName("matchThreshold", args),
|
|
3879
3899
|
branches: joinClassnamesByName("branches", args),
|
|
3880
|
-
hasSubQuery: joinClassnamesByName("hasSubQuery", args)
|
|
3900
|
+
hasSubQuery: joinClassnamesByName("hasSubQuery", args),
|
|
3901
|
+
loading: joinClassnamesByName("loading", args)
|
|
3881
3902
|
});
|
|
3882
3903
|
|
|
3883
3904
|
//#endregion
|
|
@@ -3910,6 +3931,7 @@ const preferFlagProps = (props = {}, contextVals = {}, finalize) => objectEntrie
|
|
|
3910
3931
|
*/
|
|
3911
3932
|
const prepareRule = (rule, { idGenerator = generateID } = {}) => produce(rule, (draft) => {
|
|
3912
3933
|
if (!draft.id) draft.id = idGenerator();
|
|
3934
|
+
if (processMatchMode(draft)) draft.value = prepareRuleGroup(draft.value, { idGenerator });
|
|
3913
3935
|
});
|
|
3914
3936
|
/**
|
|
3915
3937
|
* Ensures that a rule group is valid by recursively adding an `id` property to the group itself
|