@react-querybuilder/core 8.23.0 → 8.24.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/cjs/react-querybuilder_core.cjs.development.d.ts +507 -448
- package/dist/cjs/react-querybuilder_core.cjs.development.js +169 -6
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +507 -448
- 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/derivations.d.mts +288 -237
- package/dist/derivations.d.ts +288 -237
- package/dist/derivations.js +137 -4
- package/dist/derivations.js.map +1 -1
- package/dist/derivations.mjs +136 -5
- package/dist/derivations.mjs.map +1 -1
- package/dist/formatQuery.d.mts +1 -1
- package/dist/formatQuery.d.ts +1 -1
- package/dist/formatQuery.js +7 -4
- package/dist/formatQuery.js.map +1 -1
- package/dist/formatQuery.mjs +7 -4
- package/dist/formatQuery.mjs.map +1 -1
- package/dist/{index-OF2Q1gTp.d.mts → index-94yESPHr.d.mts} +4 -2
- package/dist/{index-XueTy_XQ.d.ts → index-D41_Ba4j.d.ts} +4 -2
- package/dist/parseCEL.d.mts +110 -110
- package/dist/parseCEL.d.ts +110 -110
- package/dist/parseCEL.js +4 -4
- package/dist/parseCEL.js.map +1 -1
- package/dist/parseCEL.mjs +4 -4
- package/dist/parseCEL.mjs.map +1 -1
- package/dist/parseCypher.d.mts +7 -7
- package/dist/parseCypher.d.ts +7 -7
- package/dist/parseGremlin.d.mts +4 -4
- package/dist/parseGremlin.d.ts +4 -4
- package/dist/parseJSONata.d.mts +37 -37
- package/dist/parseJSONata.d.ts +37 -37
- package/dist/parseJSONata.js +2 -2
- package/dist/parseJSONata.mjs +2 -2
- package/dist/parseJsonLogic.d.mts +8 -8
- package/dist/parseJsonLogic.d.ts +8 -8
- package/dist/parseJsonLogic.js +3 -3
- package/dist/parseJsonLogic.mjs +3 -3
- package/dist/parseMongoDB.d.mts +7 -7
- package/dist/parseMongoDB.d.ts +7 -7
- package/dist/parseMongoDB.js +3 -3
- package/dist/parseMongoDB.mjs +3 -3
- package/dist/parseSPARQL.d.mts +4 -4
- package/dist/parseSPARQL.d.ts +4 -4
- package/dist/parseSQL.d.mts +61 -61
- package/dist/parseSQL.d.ts +61 -61
- package/dist/parseSQL.js +4 -4
- package/dist/parseSQL.js.map +1 -1
- package/dist/parseSQL.mjs +4 -4
- package/dist/parseSQL.mjs.map +1 -1
- package/dist/parseSpEL.d.mts +55 -55
- package/dist/parseSpEL.d.ts +55 -55
- package/dist/parseSpEL.js +4 -4
- package/dist/parseSpEL.js.map +1 -1
- package/dist/parseSpEL.mjs +4 -4
- package/dist/parseSpEL.mjs.map +1 -1
- package/dist/{parserUtils-DbBXyAht.js → parserUtils-2VtG7m8L.js} +3 -3
- package/dist/{parserUtils-DbBXyAht.js.map → parserUtils-2VtG7m8L.js.map} +1 -1
- package/dist/{parserUtils-BKPstAaO.mjs → parserUtils-BlafvoFb.mjs} +3 -3
- package/dist/{parserUtils-BKPstAaO.mjs.map → parserUtils-BlafvoFb.mjs.map} +1 -1
- package/dist/{prepareQueryObjects-Dj9cTl9D.js → prepareQueryObjects-DJ_VjOLb.js} +2 -2
- package/dist/{prepareQueryObjects-Dj9cTl9D.js.map → prepareQueryObjects-DJ_VjOLb.js.map} +1 -1
- package/dist/{prepareQueryObjects-Dmyf3Wi_.mjs → prepareQueryObjects-DawsH4e3.mjs} +2 -2
- package/dist/{prepareQueryObjects-Dmyf3Wi_.mjs.map → prepareQueryObjects-DawsH4e3.mjs.map} +1 -1
- package/dist/react-querybuilder_core.d.mts +507 -448
- package/dist/react-querybuilder_core.legacy-esm.d.ts +507 -448
- package/dist/react-querybuilder_core.legacy-esm.js +172 -14
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +168 -7
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +507 -448
- package/dist/react-querybuilder_core.production.mjs +1 -1
- package/dist/react-querybuilder_core.production.mjs.map +1 -1
- package/dist/{utils-e-7KHkjV.js → utils-B4E1-ZvU.js} +12 -2
- package/dist/utils-B4E1-ZvU.js.map +1 -0
- package/dist/{utils-CP5Jqy1P.mjs → utils-DLZCoyAh.mjs} +12 -2
- package/dist/utils-DLZCoyAh.mjs.map +1 -0
- package/package.json +20 -19
- package/dist/utils-CP5Jqy1P.mjs.map +0 -1
- package/dist/utils-e-7KHkjV.js.map +0 -1
|
@@ -43,6 +43,7 @@ const controlKeys = [
|
|
|
43
43
|
"ruleGroupHeaderElements",
|
|
44
44
|
"shiftActions",
|
|
45
45
|
"undoRedoActions",
|
|
46
|
+
"ungroupAction",
|
|
46
47
|
"valueEditor",
|
|
47
48
|
"valueSelector",
|
|
48
49
|
"valueSourceSelector"
|
|
@@ -453,6 +454,7 @@ const controlPropKeys = {
|
|
|
453
454
|
"toggleLockGroup",
|
|
454
455
|
"toggleMuteGroup",
|
|
455
456
|
"translations",
|
|
457
|
+
"ungroup",
|
|
456
458
|
"validationClassName",
|
|
457
459
|
"validationResult"
|
|
458
460
|
],
|
|
@@ -500,6 +502,7 @@ const controlPropKeys = {
|
|
|
500
502
|
"toggleLockGroup",
|
|
501
503
|
"toggleMuteGroup",
|
|
502
504
|
"translations",
|
|
505
|
+
"ungroup",
|
|
503
506
|
"validationClassName",
|
|
504
507
|
"validationResult"
|
|
505
508
|
],
|
|
@@ -536,6 +539,22 @@ const controlPropKeys = {
|
|
|
536
539
|
"titles",
|
|
537
540
|
"validation"
|
|
538
541
|
],
|
|
542
|
+
ungroupAction: [
|
|
543
|
+
"className",
|
|
544
|
+
"context",
|
|
545
|
+
"disabled",
|
|
546
|
+
"disabledTranslation",
|
|
547
|
+
"handleOnClick",
|
|
548
|
+
"label",
|
|
549
|
+
"level",
|
|
550
|
+
"path",
|
|
551
|
+
"ruleOrGroup",
|
|
552
|
+
"rules",
|
|
553
|
+
"schema",
|
|
554
|
+
"testID",
|
|
555
|
+
"title",
|
|
556
|
+
"validation"
|
|
557
|
+
],
|
|
539
558
|
valueEditor: [
|
|
540
559
|
"className",
|
|
541
560
|
"context",
|
|
@@ -636,6 +655,7 @@ const controlKind = {
|
|
|
636
655
|
ruleGroupHeaderElements: null,
|
|
637
656
|
shiftActions: null,
|
|
638
657
|
undoRedoActions: null,
|
|
658
|
+
ungroupAction: "action",
|
|
639
659
|
valueEditor: null,
|
|
640
660
|
valueSelector: null,
|
|
641
661
|
valueSourceSelector: "selector"
|
|
@@ -763,6 +783,10 @@ const defaultTranslations = {
|
|
|
763
783
|
label: "⧉",
|
|
764
784
|
title: "Clone group"
|
|
765
785
|
},
|
|
786
|
+
ungroupRuleGroup: {
|
|
787
|
+
label: "⊟",
|
|
788
|
+
title: "Ungroup"
|
|
789
|
+
},
|
|
766
790
|
shiftActionUp: {
|
|
767
791
|
label: "˄",
|
|
768
792
|
title: "Shift up"
|
|
@@ -1090,6 +1114,7 @@ const standardClassnames = {
|
|
|
1090
1114
|
addGroup: "ruleGroup-addGroup",
|
|
1091
1115
|
cloneRule: "rule-cloneRule",
|
|
1092
1116
|
cloneGroup: "ruleGroup-cloneGroup",
|
|
1117
|
+
ungroup: "ruleGroup-ungroup",
|
|
1093
1118
|
removeGroup: "ruleGroup-remove",
|
|
1094
1119
|
notToggle: "ruleGroup-notToggle",
|
|
1095
1120
|
rule: "rule",
|
|
@@ -1144,6 +1169,7 @@ const defaultControlClassnames = {
|
|
|
1144
1169
|
addGroup: "",
|
|
1145
1170
|
cloneRule: "",
|
|
1146
1171
|
cloneGroup: "",
|
|
1172
|
+
ungroup: "",
|
|
1147
1173
|
removeGroup: "",
|
|
1148
1174
|
notToggle: "",
|
|
1149
1175
|
rule: "",
|
|
@@ -1205,6 +1231,7 @@ const TestID = {
|
|
|
1205
1231
|
addGroup: "add-group",
|
|
1206
1232
|
removeGroup: "remove-group",
|
|
1207
1233
|
cloneGroup: "clone-group",
|
|
1234
|
+
ungroup: "ungroup",
|
|
1208
1235
|
cloneRule: "clone-rule",
|
|
1209
1236
|
addRule: "add-rule",
|
|
1210
1237
|
removeRule: "remove-rule",
|
|
@@ -1236,11 +1263,13 @@ const LogType = {
|
|
|
1236
1263
|
onMoveRuleFalse: "onMoveRule callback returned false",
|
|
1237
1264
|
onMoveGroupFalse: "onMoveGroup callback returned false",
|
|
1238
1265
|
onRemoveFalse: "onRemove callback returned false",
|
|
1266
|
+
onUngroupFalse: "onUngroup callback returned false",
|
|
1239
1267
|
add: "rule or group added",
|
|
1240
1268
|
remove: "rule or group removed",
|
|
1241
1269
|
update: "rule or group updated",
|
|
1242
1270
|
move: "rule or group moved",
|
|
1243
|
-
group: "rule or group grouped with another"
|
|
1271
|
+
group: "rule or group grouped with another",
|
|
1272
|
+
ungroup: "group replaced by its own rules"
|
|
1244
1273
|
};
|
|
1245
1274
|
/**
|
|
1246
1275
|
* The {@link Path} of the root group.
|
|
@@ -1273,6 +1302,7 @@ const queryBuilderFlagDefaults = {
|
|
|
1273
1302
|
showNotToggle: false,
|
|
1274
1303
|
showShiftActions: false,
|
|
1275
1304
|
showUndoRedo: false,
|
|
1305
|
+
showUngroupButtons: false,
|
|
1276
1306
|
suppressStandardClassnames: false
|
|
1277
1307
|
};
|
|
1278
1308
|
/**
|
|
@@ -1304,6 +1334,7 @@ const strictAbortReasons = [
|
|
|
1304
1334
|
"target-not-found",
|
|
1305
1335
|
"parent-not-found",
|
|
1306
1336
|
"parent-not-a-group",
|
|
1337
|
+
"target-not-a-group",
|
|
1307
1338
|
"destination-not-found",
|
|
1308
1339
|
"root-not-allowed",
|
|
1309
1340
|
"not-a-combinator-slot",
|
|
@@ -1509,7 +1540,7 @@ const signatureOf = (prev, next) => signatureOfNode(prev, next, "", -1);
|
|
|
1509
1540
|
*/
|
|
1510
1541
|
const shouldCoalesce = (prevSig, nextSig, prevAt, now, coalesceMs = 500) => nextSig !== "~structural" && nextSig === prevSig && now >= prevAt && now - prevAt < coalesceMs;
|
|
1511
1542
|
//#endregion
|
|
1512
|
-
//#region \0@oxc-project+runtime@0.
|
|
1543
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
|
|
1513
1544
|
function _typeof(o) {
|
|
1514
1545
|
"@babel/helpers - typeof";
|
|
1515
1546
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -1519,7 +1550,7 @@ function _typeof(o) {
|
|
|
1519
1550
|
}, _typeof(o);
|
|
1520
1551
|
}
|
|
1521
1552
|
//#endregion
|
|
1522
|
-
//#region \0@oxc-project+runtime@0.
|
|
1553
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
|
|
1523
1554
|
function toPrimitive(t, r) {
|
|
1524
1555
|
if ("object" != _typeof(t) || !t) return t;
|
|
1525
1556
|
var e = t[Symbol.toPrimitive];
|
|
@@ -1531,13 +1562,13 @@ function toPrimitive(t, r) {
|
|
|
1531
1562
|
return ("string" === r ? String : Number)(t);
|
|
1532
1563
|
}
|
|
1533
1564
|
//#endregion
|
|
1534
|
-
//#region \0@oxc-project+runtime@0.
|
|
1565
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
|
|
1535
1566
|
function toPropertyKey(t) {
|
|
1536
1567
|
var i = toPrimitive(t, "string");
|
|
1537
1568
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
1538
1569
|
}
|
|
1539
1570
|
//#endregion
|
|
1540
|
-
//#region \0@oxc-project+runtime@0.
|
|
1571
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
|
|
1541
1572
|
function _defineProperty(e, r, t) {
|
|
1542
1573
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
1543
1574
|
value: t,
|
|
@@ -1547,7 +1578,7 @@ function _defineProperty(e, r, t) {
|
|
|
1547
1578
|
}) : e[r] = t, e;
|
|
1548
1579
|
}
|
|
1549
1580
|
//#endregion
|
|
1550
|
-
//#region \0@oxc-project+runtime@0.
|
|
1581
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/objectSpread2.js
|
|
1551
1582
|
function ownKeys(e, r) {
|
|
1552
1583
|
var t = Object.keys(e);
|
|
1553
1584
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -1570,7 +1601,7 @@ function _objectSpread2(e) {
|
|
|
1570
1601
|
return e;
|
|
1571
1602
|
}
|
|
1572
1603
|
//#endregion
|
|
1573
|
-
//#region \0@oxc-project+runtime@0.
|
|
1604
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/objectWithoutPropertiesLoose.js
|
|
1574
1605
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
1575
1606
|
if (null == r) return {};
|
|
1576
1607
|
var t = {};
|
|
@@ -1581,7 +1612,7 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
1581
1612
|
return t;
|
|
1582
1613
|
}
|
|
1583
1614
|
//#endregion
|
|
1584
|
-
//#region \0@oxc-project+runtime@0.
|
|
1615
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/objectWithoutProperties.js
|
|
1585
1616
|
function _objectWithoutProperties(e, t) {
|
|
1586
1617
|
if (null == e) return {};
|
|
1587
1618
|
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
@@ -1713,6 +1744,7 @@ const ruleGroupClassnameSources = {
|
|
|
1713
1744
|
addRule: ["actionElement", "addRule"],
|
|
1714
1745
|
addGroup: ["actionElement", "addGroup"],
|
|
1715
1746
|
cloneGroup: ["actionElement", "cloneGroup"],
|
|
1747
|
+
ungroup: ["actionElement", "ungroup"],
|
|
1716
1748
|
lockGroup: ["actionElement", "lockGroup"],
|
|
1717
1749
|
muteGroup: ["actionElement", "muteGroup"],
|
|
1718
1750
|
removeGroup: ["actionElement", "removeGroup"],
|
|
@@ -3531,7 +3563,9 @@ const defaultRuleGroupProcessorElasticSearch = (ruleGroup, options) => {
|
|
|
3531
3563
|
*
|
|
3532
3564
|
* At the top level, filter rules produce chained `.has()` steps (implicit AND).
|
|
3533
3565
|
* Nested groups use `.and()` / `.or()` / `.not()` compound traversals with
|
|
3534
|
-
* `__` anonymous traversal prefixes.
|
|
3566
|
+
* `__` anonymous traversal prefixes. Since `not()` accepts exactly one
|
|
3567
|
+
* traversal, negated groups with multiple predicates wrap them in a single
|
|
3568
|
+
* `__.and()`/`__.or()` sub-traversal.
|
|
3535
3569
|
*
|
|
3536
3570
|
* @group Export
|
|
3537
3571
|
*/
|
|
@@ -3570,9 +3604,10 @@ const defaultRuleGroupProcessorGremlin = (ruleGroup, options) => {
|
|
|
3570
3604
|
}
|
|
3571
3605
|
if (predicates.length === 0) return "";
|
|
3572
3606
|
const combinator = (_combinator = rg.combinator) !== null && _combinator !== void 0 ? _combinator : "and";
|
|
3573
|
-
const prefix = rg.not ? "not" : combinator;
|
|
3574
3607
|
if (predicates.length === 1 && !rg.not) return predicates[0];
|
|
3575
|
-
|
|
3608
|
+
const args = predicates.map((p) => p.startsWith(".") ? `__${p}` : p).join(", ");
|
|
3609
|
+
if (rg.not) return predicates.length === 1 ? `.not(${args})` : `.not(__.${combinator}(${args}))`;
|
|
3610
|
+
return `.${combinator}(${args})`;
|
|
3576
3611
|
};
|
|
3577
3612
|
if (!isRuleOrGroupValid(ruleGroup, validationMap[(_ruleGroup$id = ruleGroup.id) !== null && _ruleGroup$id !== void 0 ? _ruleGroup$id : /* v8 ignore start -- @preserve */ ""])) return fallbackExpression;
|
|
3578
3613
|
const steps = [];
|
|
@@ -6365,6 +6400,7 @@ const mergeClassnames = (...args) => ({
|
|
|
6365
6400
|
addGroup: joinClassnamesByName("addGroup", args),
|
|
6366
6401
|
cloneRule: joinClassnamesByName("cloneRule", args),
|
|
6367
6402
|
cloneGroup: joinClassnamesByName("cloneGroup", args),
|
|
6403
|
+
ungroup: joinClassnamesByName("ungroup", args),
|
|
6368
6404
|
removeGroup: joinClassnamesByName("removeGroup", args),
|
|
6369
6405
|
rule: joinClassnamesByName("rule", args),
|
|
6370
6406
|
fields: joinClassnamesByName("fields", args),
|
|
@@ -6931,6 +6967,81 @@ const removeInPlace = (query, pathOrID, options = {}) => {
|
|
|
6931
6967
|
} else parent.rules.splice(index, 1);
|
|
6932
6968
|
return query;
|
|
6933
6969
|
};
|
|
6970
|
+
/**
|
|
6971
|
+
* Replaces a group with its own rules in its parent group, without mutating the original query.
|
|
6972
|
+
*
|
|
6973
|
+
* The group's `combinator`, `not`, `id`, `muted`, and `disabled` properties are discarded; its
|
|
6974
|
+
* rules keep their `id`s since they remain in the same query. An empty group is simply removed.
|
|
6975
|
+
*
|
|
6976
|
+
* @returns A new query with the group's rules promoted into its parent group.
|
|
6977
|
+
*
|
|
6978
|
+
* @group Query Tools
|
|
6979
|
+
*/
|
|
6980
|
+
const ungroup = (query, pathOrID, options = {}) => producerFor(options.freeze)(query, (q) => ungroupInPlace(q, pathOrID, options));
|
|
6981
|
+
/**
|
|
6982
|
+
* Replaces a group with its own rules in its parent group, in place.
|
|
6983
|
+
*
|
|
6984
|
+
* @returns The query (mutated in place) with the group's rules promoted into its parent group.
|
|
6985
|
+
*
|
|
6986
|
+
* @group Query Tools
|
|
6987
|
+
*/
|
|
6988
|
+
const ungroupInPlace = (query, pathOrID, options = {}) => {
|
|
6989
|
+
const { onAbort } = options;
|
|
6990
|
+
const path = Array.isArray(pathOrID) ? pathOrID : getPathOfID(pathOrID, query);
|
|
6991
|
+
if (!path) {
|
|
6992
|
+
onAbort === null || onAbort === void 0 || onAbort({
|
|
6993
|
+
reason: "target-not-found",
|
|
6994
|
+
operation: "ungroup",
|
|
6995
|
+
pathOrID
|
|
6996
|
+
});
|
|
6997
|
+
return query;
|
|
6998
|
+
}
|
|
6999
|
+
if (path.length === 0) {
|
|
7000
|
+
onAbort === null || onAbort === void 0 || onAbort({
|
|
7001
|
+
reason: "root-not-allowed",
|
|
7002
|
+
operation: "ungroup",
|
|
7003
|
+
pathOrID
|
|
7004
|
+
});
|
|
7005
|
+
return query;
|
|
7006
|
+
}
|
|
7007
|
+
const ungroupGuardReason = getGuardAbortReason(query, path, options);
|
|
7008
|
+
if (ungroupGuardReason) {
|
|
7009
|
+
onAbort === null || onAbort === void 0 || onAbort({
|
|
7010
|
+
reason: ungroupGuardReason,
|
|
7011
|
+
operation: "ungroup",
|
|
7012
|
+
pathOrID
|
|
7013
|
+
});
|
|
7014
|
+
return query;
|
|
7015
|
+
}
|
|
7016
|
+
const target = findPath(path, query);
|
|
7017
|
+
if (!target) {
|
|
7018
|
+
onAbort === null || onAbort === void 0 || onAbort({
|
|
7019
|
+
reason: "target-not-found",
|
|
7020
|
+
operation: "ungroup",
|
|
7021
|
+
pathOrID
|
|
7022
|
+
});
|
|
7023
|
+
return query;
|
|
7024
|
+
}
|
|
7025
|
+
if (!isRuleGroup(target)) {
|
|
7026
|
+
onAbort === null || onAbort === void 0 || onAbort({
|
|
7027
|
+
reason: "target-not-a-group",
|
|
7028
|
+
operation: "ungroup",
|
|
7029
|
+
pathOrID
|
|
7030
|
+
});
|
|
7031
|
+
return query;
|
|
7032
|
+
}
|
|
7033
|
+
const index = path.at(-1);
|
|
7034
|
+
const parent = findPath(getParentPath(path), query);
|
|
7035
|
+
if (target.rules.length === 0) {
|
|
7036
|
+
if (!isRuleGroupType(parent) && parent.rules.length > 1) {
|
|
7037
|
+
const idxStartDelete = index === 0 ? 0 : index - 1;
|
|
7038
|
+
parent.rules.splice(idxStartDelete, 2);
|
|
7039
|
+
} else parent.rules.splice(index, 1);
|
|
7040
|
+
return query;
|
|
7041
|
+
}
|
|
7042
|
+
parent.rules.splice(index, 1, ...target.rules);
|
|
7043
|
+
return query;
|
|
7044
|
+
};
|
|
6934
7045
|
const getNextPath = (query, currentPath, newPathOrShiftDirection) => {
|
|
6935
7046
|
if (Array.isArray(newPathOrShiftDirection)) return newPathOrShiftDirection;
|
|
6936
7047
|
const ic = isRuleGroupTypeIC(query);
|
|
@@ -7282,7 +7393,7 @@ const groupInPlace = (query, sourcePathOrID, targetPathOrID, options = {}) => {
|
|
|
7282
7393
|
//#endregion
|
|
7283
7394
|
//#region src/utils/queryActions.ts
|
|
7284
7395
|
/**
|
|
7285
|
-
* Builds the query builder's
|
|
7396
|
+
* Builds the query builder's seven mutation handlers as pure functions of the current query.
|
|
7286
7397
|
*
|
|
7287
7398
|
* This is the framework-agnostic core of the action handlers in `useQueryBuilderSchema`. It owns
|
|
7288
7399
|
* the policy that surrounds the query tools—disabled gating, the confirmation callback protocol,
|
|
@@ -7292,7 +7403,7 @@ const groupInPlace = (query, sourcePathOrID, targetPathOrID, options = {}) => {
|
|
|
7292
7403
|
* @group Query Tools
|
|
7293
7404
|
*/
|
|
7294
7405
|
const createQueryActions = (config = {}) => {
|
|
7295
|
-
const { qbId, combinators, idGenerator, maxLevels = Infinity, queryDisabled, respectDisabled = true, disabledPaths, resetOnFieldChange, resetOnOperatorChange, getRuleDefaultOperator, getValueSources, getRuleDefaultValue, getMatchModes, freeze, onAddRule, onAddGroup, onRemove, onMoveRule, onMoveGroup, onGroupRule, onGroupGroup, onLog } = config;
|
|
7406
|
+
const { qbId, combinators, idGenerator, maxLevels = Infinity, queryDisabled, respectDisabled = true, disabledPaths, resetOnFieldChange, resetOnOperatorChange, getRuleDefaultOperator, getValueSources, getRuleDefaultValue, getMatchModes, freeze, onAddRule, onAddGroup, onRemove, onMoveRule, onMoveGroup, onGroupRule, onGroupGroup, onUngroup, onLog } = config;
|
|
7296
7407
|
const log = (payload) => onLog === null || onLog === void 0 ? void 0 : onLog(_objectSpread2({ qbId }, payload));
|
|
7297
7408
|
const guards = {
|
|
7298
7409
|
respectDisabled,
|
|
@@ -7530,6 +7641,39 @@ const createQueryActions = (config = {}) => {
|
|
|
7530
7641
|
clone
|
|
7531
7642
|
});
|
|
7532
7643
|
return newQuery;
|
|
7644
|
+
},
|
|
7645
|
+
ungroupRuleGroup: (query, path, context) => {
|
|
7646
|
+
if (blocked(query, path)) {
|
|
7647
|
+
log({
|
|
7648
|
+
type: LogType.pathDisabled,
|
|
7649
|
+
path,
|
|
7650
|
+
query
|
|
7651
|
+
});
|
|
7652
|
+
return;
|
|
7653
|
+
}
|
|
7654
|
+
const ruleGroup = findPath(path, query);
|
|
7655
|
+
if (path.length === 0 || !isRuleGroup(ruleGroup)) return void 0;
|
|
7656
|
+
const nextQuery = ungroup(query, path, { freeze });
|
|
7657
|
+
const callbackResult = onUngroup ? onUngroup(ruleGroup, path, query, nextQuery, context) : true;
|
|
7658
|
+
if (!callbackResult) {
|
|
7659
|
+
log({
|
|
7660
|
+
type: LogType.onUngroupFalse,
|
|
7661
|
+
ruleGroup,
|
|
7662
|
+
path,
|
|
7663
|
+
query,
|
|
7664
|
+
nextQuery
|
|
7665
|
+
});
|
|
7666
|
+
return;
|
|
7667
|
+
}
|
|
7668
|
+
const newQuery = isRuleGroup(callbackResult) ? callbackResult : nextQuery;
|
|
7669
|
+
log({
|
|
7670
|
+
type: LogType.ungroup,
|
|
7671
|
+
query,
|
|
7672
|
+
newQuery,
|
|
7673
|
+
path,
|
|
7674
|
+
ruleGroup
|
|
7675
|
+
});
|
|
7676
|
+
return newQuery;
|
|
7533
7677
|
}
|
|
7534
7678
|
};
|
|
7535
7679
|
};
|
|
@@ -7601,6 +7745,7 @@ const _excluded3 = ["strict", "onInvalidTarget"];
|
|
|
7601
7745
|
const _excluded4 = ["strict", "onInvalidTarget"];
|
|
7602
7746
|
const _excluded5 = ["strict", "onInvalidTarget"];
|
|
7603
7747
|
const _excluded6 = ["strict", "onInvalidTarget"];
|
|
7748
|
+
const _excluded7 = ["strict", "onInvalidTarget"];
|
|
7604
7749
|
let _Symbol$iterator;
|
|
7605
7750
|
/**
|
|
7606
7751
|
* Thrown by {@link QueryManager} methods in `strict` mode when an operation cannot be carried
|
|
@@ -8129,6 +8274,19 @@ var QueryManager = class QueryManager {
|
|
|
8129
8274
|
return this;
|
|
8130
8275
|
}
|
|
8131
8276
|
/**
|
|
8277
|
+
* Replaces the group at `pathOrID` with its own rules in the parent group. The group's
|
|
8278
|
+
* `combinator`, `not`, `id`, `muted`, and `disabled` properties are discarded; an empty group
|
|
8279
|
+
* is simply removed.
|
|
8280
|
+
*/
|
|
8281
|
+
ungroup(pathOrID, options = {}) {
|
|
8282
|
+
const { strict, onInvalidTarget } = options, toolOptions = _objectWithoutProperties(options, _excluded7);
|
|
8283
|
+
this.commit(ungroup(this.state.query, pathOrID, _objectSpread2(_objectSpread2(_objectSpread2({}, this.toolOptions()), toolOptions), {}, { onAbort: this.onAbort({
|
|
8284
|
+
strict,
|
|
8285
|
+
onInvalidTarget
|
|
8286
|
+
}) })));
|
|
8287
|
+
return this;
|
|
8288
|
+
}
|
|
8289
|
+
/**
|
|
8132
8290
|
* The options currently in effect, as a frozen shallow copy. Reflects everything applied by
|
|
8133
8291
|
* the constructor and any subsequent {@link QueryManager.reconfigure} calls, but not the
|
|
8134
8292
|
* defaults filled in for options that were never provided.
|
|
@@ -8620,6 +8778,6 @@ var QueryManager = class QueryManager {
|
|
|
8620
8778
|
}
|
|
8621
8779
|
};
|
|
8622
8780
|
//#endregion
|
|
8623
|
-
export { LogType, QueryManager, QueryManagerError, TestID, add, addInPlace, betweenOperators, bigIntJsonParseReviver, bigIntJsonStringifyReplacer, celCombinatorMap, clsx, coerceBigIntValue, coerceInputType, controlKeys, controlKind, controlPropKeys, convertFromIC, convertQuery, convertToIC, createQueryActions, createRule, createRuleGroup, cypherCombinatorMap, defaultCELValueProcessor, defaultCoalesceMs, defaultCombinatorLabelMap, defaultCombinators, defaultCombinatorsExtended, defaultControlClassnames, defaultExportOperatorMap, defaultJoinChar, defaultMatchModes, defaultMaxHistory, defaultMongoDBValueProcessor, defaultNLTranslations, defaultOperatorLabelMap, defaultOperatorNegationMap, defaultOperatorProcessorNL, defaultOperatorProcessorSQL, defaultOperators, defaultPlaceholderFieldGroupLabel, defaultPlaceholderFieldLabel, defaultPlaceholderFieldName, defaultPlaceholderLabel, defaultPlaceholderName, defaultPlaceholderOperatorGroupLabel, defaultPlaceholderOperatorLabel, defaultPlaceholderOperatorName, defaultPlaceholderValueGroupLabel, defaultPlaceholderValueLabel, defaultPlaceholderValueName, defaultRuleGroupProcessorCEL, defaultRuleGroupProcessorCypher, defaultRuleGroupProcessorDiagnostics, defaultRuleGroupProcessorDrizzle, defaultRuleGroupProcessorElasticSearch, defaultRuleGroupProcessorGremlin, defaultRuleGroupProcessorJSONata, defaultRuleGroupProcessorJsonLogic, defaultRuleGroupProcessorLDAP, defaultRuleGroupProcessorMongoDB, defaultRuleGroupProcessorMongoDBQuery, defaultRuleGroupProcessorNL, defaultRuleGroupProcessorParameterized, defaultRuleGroupProcessorPrisma, defaultRuleGroupProcessorSPARQL, defaultRuleGroupProcessorSQL, defaultRuleGroupProcessorSequelize, defaultRuleGroupProcessorSpEL, defaultRuleGroupProcessorTanStackDB, defaultRuleProcessorCEL, defaultRuleProcessorCypher, defaultRuleProcessorDrizzle, defaultRuleProcessorElasticSearch, defaultRuleProcessorGremlin, defaultRuleProcessorJSONata, defaultRuleProcessorJsonLogic, defaultRuleProcessorLDAP, defaultRuleProcessorMongoDB, defaultRuleProcessorMongoDBQuery, defaultRuleProcessorNL, defaultRuleProcessorParameterized, defaultRuleProcessorPrisma, defaultRuleProcessorSPARQL, defaultRuleProcessorSQL, defaultRuleProcessorSequelize, defaultRuleProcessorSpEL, defaultRuleProcessorTanStackDB, defaultSpELValueProcessor, defaultTranslations, defaultValidator, defaultValueProcessor, defaultValueProcessorByRule, defaultValueProcessorCELByRule, defaultValueProcessorMongoDBByRule, defaultValueProcessorNL, defaultValueProcessorSpELByRule, derivePathInfo, deriveQueryBuilderClassNames, deriveRuleClassName, deriveRuleClassNames, deriveRuleContext, deriveRuleGroupClassNames, deriveRuleGroupContext, deriveRuleGroupOuterClassName, deriveRuleOuterClassName, exceedsMaxLevels, filterFieldsByComparator, findID, findPath, formatQuery, formatQueryOptionPresets, generateAccessibleDescription, generateID, getCommonAncestorPath, getFieldData, getFirstOption, getGuardAbortReason, getLikeWildcards, getMatchModesUtil, getMultiValueUpdate, getNLTranslataion, getOption, getParametersAsList, getParentPath, getParseNumberMethod, getPathOfID, getQuoteFieldNamesWithArray, getQuotedFieldName, getRuleDefaultValue, getRuleGroupCombinator, getRuleInputType, getRuleValidationResult, getRuleValueEditorType, getRuleValueSourceOptions, getRuleValues, getSQLConcat, getSubqueryElementAlias, getValidationClassNames, getValueEditorReset, getValueSelectorUpdate, getValueSourcesUtil, group, groupInPlace, groupInvalidReasons, hideValueControlsForOperator, inOperators, insert, insertInPlace, isAncestor, isBetweenOperator, isFlexibleOptionArray, isFlexibleOptionGroupArray, isFullOptionArray, isFullOptionGroupArray, isOptionGroupArray, isPojo, isRuleGroup, isRuleGroupType, isRuleGroupTypeIC, isRuleOrGroupValid, isRuleType, isUnsafeKey, isValidValue, isValidationResult, isValueProcessorLegacy, joinWith, jsonLogicAdditionalOperators, lc, mapSQLOperator, mergeAnyTranslation, mergeAnyTranslations, mergeClassnames, mongoDbFallback, mongoOperators, move, moveInPlace, normalizeConstituentWordOrder, normalizeValueSelectorValue, nullFreeArray, nullOperators, nullOrUndefinedOrEmpty, numericRegex, numerifyValues, objectEntries, objectKeys, optionsEqual, parseNumber, pathIsDisabled, pathIsDisabledByPaths, pathsAreEqual, preferAnyProp, preferFlagProps, preferProp, prepareOptionList, prepareRule, prepareRuleGroup, prepareRuleOrGroup, prismaFallback, prismaOperators, processMatchMode, queryBuilderFlagDefaults, regenerateID, regenerateIDs, relationalOperators, remove, removeInPlace, resolveCandidateQuery, resolveDefaultOperator, resolveOperatorList, resolveValueEditorType, resolveValueList, rootPath, setAutoFreeze, shouldCoalesce, shouldRenderAsNumber, signatureOf, sparqlVar, splitBy, sqlDialectPresets, standardClassnames, strictAbortReasons, stripParamPrefix, structuralSignature, subqueryElementAliasBase, substringOperators, toArray, toFlatOptionArray, toFullOption, toFullOptionList, toFullOptionMap, transformQuery, trimIfString, unchangedSignature, uniqByIdentifier, uniqByName, uniqOptGroups, uniqOptList, update, updateInPlace, uuidV4regex, valuesEqual, withParamPrefix, wrapLikeFragment };
|
|
8781
|
+
export { LogType, QueryManager, QueryManagerError, TestID, add, addInPlace, betweenOperators, bigIntJsonParseReviver, bigIntJsonStringifyReplacer, celCombinatorMap, clsx, coerceBigIntValue, coerceInputType, controlKeys, controlKind, controlPropKeys, convertFromIC, convertQuery, convertToIC, createQueryActions, createRule, createRuleGroup, cypherCombinatorMap, defaultCELValueProcessor, defaultCoalesceMs, defaultCombinatorLabelMap, defaultCombinators, defaultCombinatorsExtended, defaultControlClassnames, defaultExportOperatorMap, defaultJoinChar, defaultMatchModes, defaultMaxHistory, defaultMongoDBValueProcessor, defaultNLTranslations, defaultOperatorLabelMap, defaultOperatorNegationMap, defaultOperatorProcessorNL, defaultOperatorProcessorSQL, defaultOperators, defaultPlaceholderFieldGroupLabel, defaultPlaceholderFieldLabel, defaultPlaceholderFieldName, defaultPlaceholderLabel, defaultPlaceholderName, defaultPlaceholderOperatorGroupLabel, defaultPlaceholderOperatorLabel, defaultPlaceholderOperatorName, defaultPlaceholderValueGroupLabel, defaultPlaceholderValueLabel, defaultPlaceholderValueName, defaultRuleGroupProcessorCEL, defaultRuleGroupProcessorCypher, defaultRuleGroupProcessorDiagnostics, defaultRuleGroupProcessorDrizzle, defaultRuleGroupProcessorElasticSearch, defaultRuleGroupProcessorGremlin, defaultRuleGroupProcessorJSONata, defaultRuleGroupProcessorJsonLogic, defaultRuleGroupProcessorLDAP, defaultRuleGroupProcessorMongoDB, defaultRuleGroupProcessorMongoDBQuery, defaultRuleGroupProcessorNL, defaultRuleGroupProcessorParameterized, defaultRuleGroupProcessorPrisma, defaultRuleGroupProcessorSPARQL, defaultRuleGroupProcessorSQL, defaultRuleGroupProcessorSequelize, defaultRuleGroupProcessorSpEL, defaultRuleGroupProcessorTanStackDB, defaultRuleProcessorCEL, defaultRuleProcessorCypher, defaultRuleProcessorDrizzle, defaultRuleProcessorElasticSearch, defaultRuleProcessorGremlin, defaultRuleProcessorJSONata, defaultRuleProcessorJsonLogic, defaultRuleProcessorLDAP, defaultRuleProcessorMongoDB, defaultRuleProcessorMongoDBQuery, defaultRuleProcessorNL, defaultRuleProcessorParameterized, defaultRuleProcessorPrisma, defaultRuleProcessorSPARQL, defaultRuleProcessorSQL, defaultRuleProcessorSequelize, defaultRuleProcessorSpEL, defaultRuleProcessorTanStackDB, defaultSpELValueProcessor, defaultTranslations, defaultValidator, defaultValueProcessor, defaultValueProcessorByRule, defaultValueProcessorCELByRule, defaultValueProcessorMongoDBByRule, defaultValueProcessorNL, defaultValueProcessorSpELByRule, derivePathInfo, deriveQueryBuilderClassNames, deriveRuleClassName, deriveRuleClassNames, deriveRuleContext, deriveRuleGroupClassNames, deriveRuleGroupContext, deriveRuleGroupOuterClassName, deriveRuleOuterClassName, exceedsMaxLevels, filterFieldsByComparator, findID, findPath, formatQuery, formatQueryOptionPresets, generateAccessibleDescription, generateID, getCommonAncestorPath, getFieldData, getFirstOption, getGuardAbortReason, getLikeWildcards, getMatchModesUtil, getMultiValueUpdate, getNLTranslataion, getOption, getParametersAsList, getParentPath, getParseNumberMethod, getPathOfID, getQuoteFieldNamesWithArray, getQuotedFieldName, getRuleDefaultValue, getRuleGroupCombinator, getRuleInputType, getRuleValidationResult, getRuleValueEditorType, getRuleValueSourceOptions, getRuleValues, getSQLConcat, getSubqueryElementAlias, getValidationClassNames, getValueEditorReset, getValueSelectorUpdate, getValueSourcesUtil, group, groupInPlace, groupInvalidReasons, hideValueControlsForOperator, inOperators, insert, insertInPlace, isAncestor, isBetweenOperator, isFlexibleOptionArray, isFlexibleOptionGroupArray, isFullOptionArray, isFullOptionGroupArray, isOptionGroupArray, isPojo, isRuleGroup, isRuleGroupType, isRuleGroupTypeIC, isRuleOrGroupValid, isRuleType, isUnsafeKey, isValidValue, isValidationResult, isValueProcessorLegacy, joinWith, jsonLogicAdditionalOperators, lc, mapSQLOperator, mergeAnyTranslation, mergeAnyTranslations, mergeClassnames, mongoDbFallback, mongoOperators, move, moveInPlace, normalizeConstituentWordOrder, normalizeValueSelectorValue, nullFreeArray, nullOperators, nullOrUndefinedOrEmpty, numericRegex, numerifyValues, objectEntries, objectKeys, optionsEqual, parseNumber, pathIsDisabled, pathIsDisabledByPaths, pathsAreEqual, preferAnyProp, preferFlagProps, preferProp, prepareOptionList, prepareRule, prepareRuleGroup, prepareRuleOrGroup, prismaFallback, prismaOperators, processMatchMode, queryBuilderFlagDefaults, regenerateID, regenerateIDs, relationalOperators, remove, removeInPlace, resolveCandidateQuery, resolveDefaultOperator, resolveOperatorList, resolveValueEditorType, resolveValueList, rootPath, setAutoFreeze, shouldCoalesce, shouldRenderAsNumber, signatureOf, sparqlVar, splitBy, sqlDialectPresets, standardClassnames, strictAbortReasons, stripParamPrefix, structuralSignature, subqueryElementAliasBase, substringOperators, toArray, toFlatOptionArray, toFullOption, toFullOptionList, toFullOptionMap, transformQuery, trimIfString, unchangedSignature, ungroup, ungroupInPlace, uniqByIdentifier, uniqByName, uniqOptGroups, uniqOptList, update, updateInPlace, uuidV4regex, valuesEqual, withParamPrefix, wrapLikeFragment };
|
|
8624
8782
|
|
|
8625
8783
|
//# sourceMappingURL=react-querybuilder_core.legacy-esm.js.map
|