@react-querybuilder/core 8.9.2 → 8.11.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.
Files changed (113) hide show
  1. package/dist/{arrayUtils-BF1P8iHS.mjs → arrayUtils-A_OXU9W1.mjs} +3 -75
  2. package/dist/arrayUtils-A_OXU9W1.mjs.map +1 -0
  3. package/dist/arrayUtils-QxZOZTf6.js +73 -0
  4. package/dist/arrayUtils-QxZOZTf6.js.map +1 -0
  5. package/dist/basic-DEc65Kng.d.mts +363 -0
  6. package/dist/basic-Dd_M2f3M.d.ts +363 -0
  7. package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +806 -1366
  8. package/dist/cjs/react-querybuilder_core.cjs.development.js +455 -116
  9. package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
  10. package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +806 -1366
  11. package/dist/cjs/react-querybuilder_core.cjs.production.js +1 -1
  12. package/dist/cjs/react-querybuilder_core.cjs.production.js.map +1 -1
  13. package/dist/{convertQuery-H7RhQiIc.mjs → convertQuery-CqX3rPvj.mjs} +3 -3
  14. package/dist/{convertQuery-H7RhQiIc.mjs.map → convertQuery-CqX3rPvj.mjs.map} +1 -1
  15. package/dist/{export-DyrnTh6K.d.ts → export-Dy4FckB-.d.ts} +7 -6
  16. package/dist/{export-r-V7bU31.d.mts → export-t1V2N8pz.d.mts} +7 -6
  17. package/dist/formatQuery.d.mts +3 -2
  18. package/dist/formatQuery.d.ts +3 -2
  19. package/dist/formatQuery.js +217 -87
  20. package/dist/formatQuery.js.map +1 -1
  21. package/dist/formatQuery.mjs +217 -87
  22. package/dist/formatQuery.mjs.map +1 -1
  23. package/dist/{import-Cksobmln.d.ts → import-Cz8canKo.d.mts} +3 -3
  24. package/dist/{import-BwbbP4oU.d.mts → import-DtS9Ocx5.d.ts} +3 -3
  25. package/dist/{isRuleGroup-CnhYpLOM.mjs → isRuleGroup-CYcfPgbg.mjs} +2 -2
  26. package/dist/{isRuleGroup-CnhYpLOM.mjs.map → isRuleGroup-CYcfPgbg.mjs.map} +1 -1
  27. package/dist/lexer-C53tqS2p.js +406 -0
  28. package/dist/lexer-C53tqS2p.js.map +1 -0
  29. package/dist/{optGroupUtils-CXLgyg2i.js → optGroupUtils-B0hTpodo.js} +114 -1
  30. package/dist/optGroupUtils-B0hTpodo.js.map +1 -0
  31. package/dist/{optGroupUtils-Duv-M8rf.mjs → optGroupUtils-VeZ3k7-1.mjs} +86 -3
  32. package/dist/optGroupUtils-VeZ3k7-1.mjs.map +1 -0
  33. package/dist/parseCEL.d.mts +292 -11
  34. package/dist/parseCEL.d.ts +292 -11
  35. package/dist/parseCEL.js +874 -1125
  36. package/dist/parseCEL.js.map +1 -1
  37. package/dist/parseCEL.mjs +828 -1126
  38. package/dist/parseCEL.mjs.map +1 -1
  39. package/dist/parseJSONata.d.mts +3 -2
  40. package/dist/parseJSONata.d.ts +3 -2
  41. package/dist/parseJSONata.js +49 -77
  42. package/dist/parseJSONata.js.map +1 -1
  43. package/dist/parseJSONata.mjs +4 -5
  44. package/dist/parseJSONata.mjs.map +1 -1
  45. package/dist/parseJsonLogic.d.mts +4 -3
  46. package/dist/parseJsonLogic.d.ts +4 -3
  47. package/dist/parseJsonLogic.js +5 -6
  48. package/dist/parseJsonLogic.js.map +1 -1
  49. package/dist/parseJsonLogic.mjs +5 -6
  50. package/dist/parseJsonLogic.mjs.map +1 -1
  51. package/dist/parseMongoDB.d.mts +3 -2
  52. package/dist/parseMongoDB.d.ts +3 -2
  53. package/dist/parseMongoDB.js +15 -16
  54. package/dist/parseMongoDB.js.map +1 -1
  55. package/dist/parseMongoDB.mjs +5 -6
  56. package/dist/parseMongoDB.mjs.map +1 -1
  57. package/dist/{parseNumber-BtGKa58z.mjs → parseNumber-CXdMVNFx.mjs} +2 -2
  58. package/dist/{parseNumber-BtGKa58z.mjs.map → parseNumber-CXdMVNFx.mjs.map} +1 -1
  59. package/dist/{parseNumber-Bcys1kOH.js → parseNumber-D4iQDxK-.js} +1 -1
  60. package/dist/{parseNumber-Bcys1kOH.js.map → parseNumber-D4iQDxK-.js.map} +1 -1
  61. package/dist/parseSQL.d.mts +3 -2
  62. package/dist/parseSQL.d.ts +3 -2
  63. package/dist/parseSQL.js +2691 -3036
  64. package/dist/parseSQL.js.map +1 -1
  65. package/dist/parseSQL.mjs +2691 -3037
  66. package/dist/parseSQL.mjs.map +1 -1
  67. package/dist/parseSpEL.d.mts +3 -2
  68. package/dist/parseSpEL.d.ts +3 -2
  69. package/dist/parseSpEL.js +7 -9
  70. package/dist/parseSpEL.js.map +1 -1
  71. package/dist/parseSpEL.mjs +5 -6
  72. package/dist/parseSpEL.mjs.map +1 -1
  73. package/dist/{prepareQueryObjects-BqFEs4eV.js → prepareQueryObjects-BOUWfel5.js} +4 -5
  74. package/dist/prepareQueryObjects-BOUWfel5.js.map +1 -0
  75. package/dist/{prepareQueryObjects-CS6Wmhmf.mjs → prepareQueryObjects-DPCC-iHp.mjs} +6 -7
  76. package/dist/prepareQueryObjects-DPCC-iHp.mjs.map +1 -0
  77. package/dist/query-builder-layout.css +1 -1
  78. package/dist/query-builder-layout.css.map +1 -1
  79. package/dist/query-builder.css +1 -1
  80. package/dist/query-builder.css.map +1 -1
  81. package/dist/react-querybuilder_core.d.mts +806 -1366
  82. package/dist/react-querybuilder_core.legacy-esm.d.ts +806 -1366
  83. package/dist/react-querybuilder_core.legacy-esm.js +455 -114
  84. package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
  85. package/dist/react-querybuilder_core.mjs +448 -117
  86. package/dist/react-querybuilder_core.mjs.map +1 -1
  87. package/dist/react-querybuilder_core.production.d.mts +806 -1366
  88. package/dist/react-querybuilder_core.production.mjs +1 -1
  89. package/dist/react-querybuilder_core.production.mjs.map +1 -1
  90. package/dist/styles/_layout.scss +61 -17
  91. package/dist/styles/_main.scss +22 -4
  92. package/dist/{transformQuery-FL_nlpp5.js → transformQuery-CWDPogO5.js} +1 -1
  93. package/dist/{transformQuery-FL_nlpp5.js.map → transformQuery-CWDPogO5.js.map} +1 -1
  94. package/dist/{transformQuery-DdMvmrCh.mjs → transformQuery-DCCpjtyq.mjs} +3 -3
  95. package/dist/{transformQuery-DdMvmrCh.mjs.map → transformQuery-DCCpjtyq.mjs.map} +1 -1
  96. package/dist/transformQuery.d.mts +1 -1
  97. package/dist/transformQuery.d.ts +1 -1
  98. package/dist/transformQuery.js +1 -1
  99. package/dist/transformQuery.mjs +2 -2
  100. package/package.json +14 -12
  101. package/dist/arrayUtils-BF1P8iHS.mjs.map +0 -1
  102. package/dist/arrayUtils-D5EoIsKP.js +0 -164
  103. package/dist/arrayUtils-D5EoIsKP.js.map +0 -1
  104. package/dist/basic-BfD-7CN3.d.mts +0 -1235
  105. package/dist/basic-C8xXKHIA.d.ts +0 -1235
  106. package/dist/objectUtils-BBZSfZJz.js +0 -17
  107. package/dist/objectUtils-BBZSfZJz.js.map +0 -1
  108. package/dist/objectUtils-BtWdcZVG.mjs +0 -11
  109. package/dist/objectUtils-BtWdcZVG.mjs.map +0 -1
  110. package/dist/optGroupUtils-CXLgyg2i.js.map +0 -1
  111. package/dist/optGroupUtils-Duv-M8rf.mjs.map +0 -1
  112. package/dist/prepareQueryObjects-BqFEs4eV.js.map +0 -1
  113. package/dist/prepareQueryObjects-CS6Wmhmf.mjs.map +0 -1
@@ -84,9 +84,13 @@
84
84
  /* #endregion */
85
85
 
86
86
  /* #region Branches */
87
- .queryBuilder-branches {
87
+ @mixin branch-layout-styles($direction) {
88
+ $ltr-after: if($direction == rtl, before, after);
89
+ $ltr-before: if($direction == rtl, after, before);
90
+ $margin-side: if($direction == rtl, right, left);
91
+
88
92
  .ruleGroup-body {
89
- margin-left: calc(2 * var(--#{$rqb-var-prefix}branch-indent));
93
+ margin-#{$margin-side}: calc(2 * var(--#{$rqb-var-prefix}branch-indent));
90
94
  }
91
95
 
92
96
  .rule,
@@ -97,26 +101,40 @@
97
101
  &::after {
98
102
  content: '';
99
103
  width: var(--#{$rqb-var-prefix}branch-indent);
100
- left: calc(
104
+ #{$margin-side}: calc(
101
105
  -1 * (var(--#{$rqb-var-prefix}branch-indent) + var(--#{$rqb-var-prefix}branch-width))
102
106
  );
103
107
  border-radius: 0;
104
108
  position: absolute;
105
109
  }
106
110
 
107
- &::before {
111
+ &::#{$ltr-before} {
108
112
  top: calc(-1 * var(--#{$rqb-var-prefix}spacing));
109
113
  height: calc(50% + var(--#{$rqb-var-prefix}spacing));
110
- border-width: 0 0 var(--#{$rqb-var-prefix}branch-width) var(--#{$rqb-var-prefix}branch-width);
114
+ @if $direction == rtl {
115
+ border-width: 0
116
+ var(--#{$rqb-var-prefix}branch-width)
117
+ var(--#{$rqb-var-prefix}branch-width)
118
+ 0;
119
+ } @else {
120
+ border-width: 0
121
+ 0
122
+ var(--#{$rqb-var-prefix}branch-width)
123
+ var(--#{$rqb-var-prefix}branch-width);
124
+ }
111
125
  }
112
126
 
113
- &::after {
127
+ &::#{$ltr-after} {
114
128
  top: 50%;
115
129
  height: 50%;
116
- border-width: 0 0 0 var(--#{$rqb-var-prefix}branch-width);
130
+ @if $direction == rtl {
131
+ border-width: 0 var(--#{$rqb-var-prefix}branch-width) 0 0;
132
+ } @else {
133
+ border-width: 0 0 0 var(--#{$rqb-var-prefix}branch-width);
134
+ }
117
135
  }
118
136
 
119
- &:last-child::after {
137
+ &:last-child::#{$ltr-after} {
120
138
  display: none;
121
139
  }
122
140
  }
@@ -125,7 +143,7 @@
125
143
  .ruleGroup .ruleGroup {
126
144
  &::before,
127
145
  &::after {
128
- left: calc(
146
+ #{$margin-side}: calc(
129
147
  -1 *
130
148
  (
131
149
  var(--#{$rqb-var-prefix}branch-indent) + var(--#{$rqb-var-prefix}branch-width) +
@@ -134,12 +152,12 @@
134
152
  );
135
153
  }
136
154
 
137
- &::before {
155
+ &::#{$ltr-before} {
138
156
  top: calc(-1 * (var(--#{$rqb-var-prefix}spacing) + var(--#{$rqb-var-prefix}border-width)));
139
157
  height: calc(50% + var(--#{$rqb-var-prefix}spacing) + var(--#{$rqb-var-prefix}border-width));
140
158
  }
141
159
 
142
- &::after {
160
+ &::#{$ltr-after} {
143
161
  height: calc(50% + var(--#{$rqb-var-prefix}border-width));
144
162
  }
145
163
  }
@@ -147,24 +165,40 @@
147
165
  .betweenRules {
148
166
  position: relative;
149
167
 
150
- &::before {
168
+ &::#{$ltr-before} {
151
169
  content: '';
152
170
  width: var(--#{$rqb-var-prefix}branch-indent);
153
- left: calc(
171
+ #{$margin-side}: calc(
154
172
  -1 * (var(--#{$rqb-var-prefix}branch-indent) + var(--#{$rqb-var-prefix}branch-width))
155
173
  );
156
174
  border-radius: 0;
157
175
  position: absolute;
158
176
  top: calc(-1 * var(--#{$rqb-var-prefix}spacing));
159
177
  height: calc(100% + var(--#{$rqb-var-prefix}spacing));
160
- border-width: 0 0 0 var(--#{$rqb-var-prefix}branch-width);
178
+ @if $direction == rtl {
179
+ border-width: 0 var(--#{$rqb-var-prefix}branch-width) 0 0;
180
+ } @else {
181
+ border-width: 0 0 0 var(--#{$rqb-var-prefix}branch-width);
182
+ }
161
183
  }
162
184
  }
163
185
  }
186
+
187
+ /* LTR */
188
+ .queryBuilder-branches:dir(ltr) {
189
+ @include branch-layout-styles(ltr);
190
+ }
191
+
192
+ /* RTL */
193
+ .queryBuilder-branches:dir(rtl) {
194
+ @include branch-layout-styles(rtl);
195
+ }
164
196
  /* #endregion */
165
197
 
166
198
  /* #region Justified */
167
- .queryBuilder-justified {
199
+ @mixin justified-auto-margin($direction) {
200
+ $margin-side: if($direction == rtl, right, left);
201
+
168
202
  .ruleGroup-combinators,
169
203
  .ruleGroup-notToggle,
170
204
  .shiftActions,
@@ -187,15 +221,25 @@
187
221
  & + .rule-cloneRule,
188
222
  & + .rule-lock,
189
223
  & + .rule-remove {
190
- margin-left: auto !important;
224
+ margin-#{$margin-side}: auto !important;
191
225
  }
192
226
  }
193
227
 
194
228
  .ruleGroup-addRule,
195
229
  .ruleGroup-addGroup {
196
230
  &:first-child {
197
- margin-left: auto !important;
231
+ margin-#{$margin-side}: auto !important;
198
232
  }
199
233
  }
200
234
  }
235
+
236
+ /* LTR */
237
+ .queryBuilder-justified:dir(ltr) {
238
+ @include justified-auto-margin(ltr);
239
+ }
240
+
241
+ /* RTL */
242
+ .queryBuilder-justified:dir(rtl) {
243
+ @include justified-auto-margin(rtl);
244
+ }
201
245
  /* #endregion */
@@ -84,11 +84,19 @@
84
84
  .queryBuilder-dragHandle {
85
85
  cursor: move;
86
86
  }
87
+
88
+ &.queryBuilder-disabled .queryBuilder-dragHandle {
89
+ cursor: not-allowed;
90
+ opacity: 0.5;
91
+ }
87
92
  }
88
93
  /* #endregion */
89
94
 
90
95
  /* #region Branch styles */
91
- .queryBuilder-branches {
96
+ @mixin branch-styles($direction) {
97
+ $before-after: if($direction == rtl, after, before);
98
+ $border-side: if($direction == rtl, right, left);
99
+
92
100
  .rule,
93
101
  .ruleGroup .ruleGroup {
94
102
  &::before,
@@ -97,18 +105,28 @@
97
105
  border-style: var(--#{$rqb-var-prefix}branch-style);
98
106
  }
99
107
 
100
- &:last-child::before {
101
- border-bottom-left-radius: var(--#{$rqb-var-prefix}branch-radius);
108
+ &:last-child::#{$before-after} {
109
+ border-bottom-#{$border-side}-radius: var(--#{$rqb-var-prefix}branch-radius);
102
110
  }
103
111
  }
104
112
 
105
113
  .betweenRules {
106
114
  position: relative;
107
115
 
108
- &::before {
116
+ &::#{$before-after} {
109
117
  border-color: var(--#{$rqb-var-prefix}branch-color);
110
118
  border-style: var(--#{$rqb-var-prefix}branch-style);
111
119
  }
112
120
  }
113
121
  }
122
+
123
+ /* LTR */
124
+ .queryBuilder-branches:dir(ltr) {
125
+ @include branch-styles(ltr);
126
+ }
127
+
128
+ /* RTL */
129
+ .queryBuilder-branches:dir(rtl) {
130
+ @include branch-styles(rtl);
131
+ }
114
132
  /* #endregion */
@@ -44,4 +44,4 @@ Object.defineProperty(exports, 'transformQuery', {
44
44
  return transformQuery;
45
45
  }
46
46
  });
47
- //# sourceMappingURL=transformQuery-FL_nlpp5.js.map
47
+ //# sourceMappingURL=transformQuery-CWDPogO5.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transformQuery-FL_nlpp5.js","names":["isRuleGroupType","isRuleGroup"],"sources":["../src/utils/transformQuery.ts"],"sourcesContent":["/**\n * Recursively steps through a query object ({@link index!RuleGroupType RuleGroupType} or {@link index!RuleGroupTypeIC RuleGroupTypeIC}),\n * passing each {@link index!RuleType RuleType} object to a provided `ruleProcessor` function and returning a\n * new query object if there were any referential changes.\n *\n * @module transformQuery\n */\n\nimport { produce } from 'immer';\nimport type { RuleGroupType, RuleGroupTypeAny, RuleGroupTypeIC, RuleType } from '../types';\nimport { isRuleGroup, isRuleGroupType } from './isRuleGroup';\n\nconst remapProperties = (\n // oxlint-disable-next-line typescript/no-explicit-any\n obj: Record<string, any>,\n propertyMap: Record<string, string | false>,\n deleteRemappedProperties: boolean\n) =>\n produce(obj, draft => {\n for (const [k, v] of Object.entries(propertyMap)) {\n if (v === false) {\n delete draft[k];\n } else if (!!v && k !== v && k in draft) {\n draft[v] = draft[k];\n if (deleteRemappedProperties) {\n delete draft[k];\n }\n }\n }\n });\n\n/**\n * Options object for {@link index!transformQuery transformQuery}.\n */\nexport interface TransformQueryOptions<RG extends RuleGroupTypeAny = RuleGroupType> {\n /**\n * When a rule is encountered in the hierarchy, it will be replaced\n * with the result of this function.\n *\n * @defaultValue `r => r`\n */\n // oxlint-disable-next-line typescript/no-explicit-any\n ruleProcessor?: (rule: RuleType) => any;\n /**\n * When a group is encountered in the hierarchy (including the root group, the\n * query itself), it will be replaced with the result of this function.\n *\n * @defaultValue `rg => rg`\n */\n // oxlint-disable-next-line typescript/no-explicit-any\n ruleGroupProcessor?: (ruleGroup: RG) => Record<string, any>;\n /**\n * For each rule and group in the query, any properties matching a key\n * in this object will be renamed to the corresponding value. To retain both\n * the new _and_ the original properties, set `deleteRemappedProperties`\n * to `false`.\n *\n * If a key has a value of `false`, the corresponding property will be removed\n * without being copied to a new property name. (Warning: `{ rules: false }`\n * will prevent recursion and only return the processed root group.)\n *\n * @defaultValue `{}`\n *\n * @example\n * ```\n * transformQuery(\n * { combinator: 'and', not: true, rules: [] },\n * { propertyMap: { combinator: 'AndOr', not: false } }\n * )\n * // Returns: { AndOr: 'and', rules: [] }\n * ```\n */\n propertyMap?: Record<string, string | false>;\n /**\n * Any combinator values (including independent combinators) will be translated\n * from the key in this object to the value.\n *\n * @defaultValue `{}`\n *\n * @example\n * ```\n * transformQuery(\n * { combinator: 'and', rules: [] },\n * { combinatorMap: { and: '&&', or: '||' } }\n * )\n * // Returns: { combinator: '&&', rules: [] }\n * ```\n */\n combinatorMap?: Record<string, string>;\n /**\n * Any operator values will be translated from the key in this object to the value.\n *\n * @defaultValue `{}`\n *\n * @example\n * ```\n * transformQuery(\n * { combinator: 'and', rules: [{ field: 'name', operator: '=', value: 'Steve Vai' }] },\n * { operatorMap: { '=': 'is' } }\n * )\n * // Returns:\n * // {\n * // combinator: 'and',\n * // rules: [{ field: 'name', operator: 'is', value: 'Steve Vai' }]\n * // }\n * ```\n */\n operatorMap?: Record<string, string>;\n /**\n * Prevents the `path` property (see {@link index!Path Path}) from being added to each\n * rule and group in the hierarchy.\n *\n * @defaultValue `false`\n */\n omitPath?: boolean;\n /**\n * Original properties remapped according to the `propertyMap` option will be removed.\n *\n * @defaultValue `true`\n *\n * @example\n * ```\n * transformQuery(\n * { combinator: 'and', rules: [] },\n * { propertyMap: { combinator: 'AndOr' }, deleteRemappedProperties: false }\n * )\n * // Returns: { combinator: 'and', AndOr: 'and', rules: [] }\n * ```\n */\n deleteRemappedProperties?: boolean;\n}\n\n/**\n * Recursively process a query heirarchy using this versatile utility function.\n *\n * [Documentation](https://react-querybuilder.js.org/docs/utils/misc#transformquery)\n */\nexport function transformQuery(\n query: RuleGroupType,\n options?: TransformQueryOptions\n // oxlint-disable-next-line typescript/no-explicit-any\n): any;\n/**\n * Recursively process a query heirarchy with independent combinators using this\n * versatile utility function.\n *\n * [Documentation](https://react-querybuilder.js.org/docs/utils/misc#transformquery)\n */\nexport function transformQuery(\n query: RuleGroupTypeIC,\n options?: TransformQueryOptions<RuleGroupTypeIC>\n // oxlint-disable-next-line typescript/no-explicit-any\n): any;\nexport function transformQuery<RG extends RuleGroupTypeAny>(\n query: RG,\n options: TransformQueryOptions<RG> = {}\n) {\n const {\n ruleProcessor = r => r,\n ruleGroupProcessor = rg => rg,\n propertyMap = {},\n combinatorMap = {},\n operatorMap = {},\n omitPath = false,\n deleteRemappedProperties = true,\n } = options;\n\n // oxlint-disable-next-line typescript/no-explicit-any\n const processGroup = (rg: RuleGroupTypeAny): any => ({\n ...ruleGroupProcessor(\n remapProperties(\n {\n ...rg,\n ...(isRuleGroupType(rg)\n ? { combinator: combinatorMap[rg.combinator] ?? rg.combinator }\n : {}),\n },\n propertyMap,\n deleteRemappedProperties\n ) as RG\n ),\n ...(propertyMap['rules'] === false\n ? null\n : {\n // oxlint-disable-next-line typescript/no-explicit-any\n [propertyMap['rules'] ?? 'rules']: rg.rules.map((r: any, idx) => {\n const pathObject = omitPath ? null : { path: [...rg.path!, idx] };\n if (typeof r === 'string') {\n // independent combinators\n return combinatorMap[r] ?? r;\n } else if (isRuleGroup(r)) {\n // sub-groups\n return processGroup({ ...r, ...pathObject });\n }\n // rules\n return ruleProcessor(\n remapProperties(\n {\n ...r,\n ...pathObject,\n ...('operator' in r ? { operator: operatorMap[r.operator] ?? r.operator } : {}),\n },\n propertyMap,\n deleteRemappedProperties\n ) as RuleType\n );\n }),\n }),\n });\n\n return processGroup({ ...query, ...(omitPath ? null : { path: [] }) });\n}\n"],"mappings":";;;;;AAYA,MAAM,mBAEJ,KACA,aACA,gDAEQ,MAAK,UAAS;AACpB,MAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,YAAY,CAC9C,KAAI,MAAM,MACR,QAAO,MAAM;UACJ,CAAC,CAAC,KAAK,MAAM,KAAK,KAAK,OAAO;AACvC,QAAM,KAAK,MAAM;AACjB,MAAI,yBACF,QAAO,MAAM;;EAInB;AA4HJ,SAAgB,eACd,OACA,UAAqC,EAAE,EACvC;CACA,MAAM,EACJ,iBAAgB,MAAK,GACrB,sBAAqB,OAAM,IAC3B,cAAc,EAAE,EAChB,gBAAgB,EAAE,EAClB,cAAc,EAAE,EAChB,WAAW,OACX,2BAA2B,SACzB;CAGJ,MAAM,gBAAgB,QAA+B;EACnD,GAAG,mBACD,gBACE;GACE,GAAG;GACH,GAAIA,oCAAgB,GAAG,GACnB,EAAE,YAAY,cAAc,GAAG,eAAe,GAAG,YAAY,GAC7D,EAAE;GACP,EACD,aACA,yBACD,CACF;EACD,GAAI,YAAY,aAAa,QACzB,OACA,GAEG,YAAY,YAAY,UAAU,GAAG,MAAM,KAAK,GAAQ,QAAQ;GAC/D,MAAM,aAAa,WAAW,OAAO,EAAE,MAAM,CAAC,GAAG,GAAG,MAAO,IAAI,EAAE;AACjE,OAAI,OAAO,MAAM,SAEf,QAAO,cAAc,MAAM;YAClBC,gCAAY,EAAE,CAEvB,QAAO,aAAa;IAAE,GAAG;IAAG,GAAG;IAAY,CAAC;AAG9C,UAAO,cACL,gBACE;IACE,GAAG;IACH,GAAG;IACH,GAAI,cAAc,IAAI,EAAE,UAAU,YAAY,EAAE,aAAa,EAAE,UAAU,GAAG,EAAE;IAC/E,EACD,aACA,yBACD,CACF;IACD,EACH;EACN;AAED,QAAO,aAAa;EAAE,GAAG;EAAO,GAAI,WAAW,OAAO,EAAE,MAAM,EAAE,EAAE;EAAG,CAAC"}
1
+ {"version":3,"file":"transformQuery-CWDPogO5.js","names":["isRuleGroupType","isRuleGroup"],"sources":["../src/utils/transformQuery.ts"],"sourcesContent":["/**\n * Recursively steps through a query object ({@link index!RuleGroupType RuleGroupType} or {@link index!RuleGroupTypeIC RuleGroupTypeIC}),\n * passing each {@link index!RuleType RuleType} object to a provided `ruleProcessor` function and returning a\n * new query object if there were any referential changes.\n *\n * @module transformQuery\n */\n\nimport { produce } from 'immer';\nimport type { RuleGroupType, RuleGroupTypeAny, RuleGroupTypeIC, RuleType } from '../types';\nimport { isRuleGroup, isRuleGroupType } from './isRuleGroup';\n\nconst remapProperties = (\n // oxlint-disable-next-line typescript/no-explicit-any\n obj: Record<string, any>,\n propertyMap: Record<string, string | false>,\n deleteRemappedProperties: boolean\n) =>\n produce(obj, draft => {\n for (const [k, v] of Object.entries(propertyMap)) {\n if (v === false) {\n delete draft[k];\n } else if (!!v && k !== v && k in draft) {\n draft[v] = draft[k];\n if (deleteRemappedProperties) {\n delete draft[k];\n }\n }\n }\n });\n\n/**\n * Options object for {@link index!transformQuery transformQuery}.\n */\nexport interface TransformQueryOptions<RG extends RuleGroupTypeAny = RuleGroupType> {\n /**\n * When a rule is encountered in the hierarchy, it will be replaced\n * with the result of this function.\n *\n * @defaultValue `r => r`\n */\n // oxlint-disable-next-line typescript/no-explicit-any\n ruleProcessor?: (rule: RuleType) => any;\n /**\n * When a group is encountered in the hierarchy (including the root group, the\n * query itself), it will be replaced with the result of this function.\n *\n * @defaultValue `rg => rg`\n */\n // oxlint-disable-next-line typescript/no-explicit-any\n ruleGroupProcessor?: (ruleGroup: RG) => Record<string, any>;\n /**\n * For each rule and group in the query, any properties matching a key\n * in this object will be renamed to the corresponding value. To retain both\n * the new _and_ the original properties, set `deleteRemappedProperties`\n * to `false`.\n *\n * If a key has a value of `false`, the corresponding property will be removed\n * without being copied to a new property name. (Warning: `{ rules: false }`\n * will prevent recursion and only return the processed root group.)\n *\n * @defaultValue `{}`\n *\n * @example\n * ```\n * transformQuery(\n * { combinator: 'and', not: true, rules: [] },\n * { propertyMap: { combinator: 'AndOr', not: false } }\n * )\n * // Returns: { AndOr: 'and', rules: [] }\n * ```\n */\n propertyMap?: Record<string, string | false>;\n /**\n * Any combinator values (including independent combinators) will be translated\n * from the key in this object to the value.\n *\n * @defaultValue `{}`\n *\n * @example\n * ```\n * transformQuery(\n * { combinator: 'and', rules: [] },\n * { combinatorMap: { and: '&&', or: '||' } }\n * )\n * // Returns: { combinator: '&&', rules: [] }\n * ```\n */\n combinatorMap?: Record<string, string>;\n /**\n * Any operator values will be translated from the key in this object to the value.\n *\n * @defaultValue `{}`\n *\n * @example\n * ```\n * transformQuery(\n * { combinator: 'and', rules: [{ field: 'name', operator: '=', value: 'Steve Vai' }] },\n * { operatorMap: { '=': 'is' } }\n * )\n * // Returns:\n * // {\n * // combinator: 'and',\n * // rules: [{ field: 'name', operator: 'is', value: 'Steve Vai' }]\n * // }\n * ```\n */\n operatorMap?: Record<string, string>;\n /**\n * Prevents the `path` property (see {@link index!Path Path}) from being added to each\n * rule and group in the hierarchy.\n *\n * @defaultValue `false`\n */\n omitPath?: boolean;\n /**\n * Original properties remapped according to the `propertyMap` option will be removed.\n *\n * @defaultValue `true`\n *\n * @example\n * ```\n * transformQuery(\n * { combinator: 'and', rules: [] },\n * { propertyMap: { combinator: 'AndOr' }, deleteRemappedProperties: false }\n * )\n * // Returns: { combinator: 'and', AndOr: 'and', rules: [] }\n * ```\n */\n deleteRemappedProperties?: boolean;\n}\n\n/**\n * Recursively process a query heirarchy using this versatile utility function.\n *\n * [Documentation](https://react-querybuilder.js.org/docs/utils/misc#transformquery)\n */\nexport function transformQuery(\n query: RuleGroupType,\n options?: TransformQueryOptions\n // oxlint-disable-next-line typescript/no-explicit-any\n): any;\n/**\n * Recursively process a query heirarchy with independent combinators using this\n * versatile utility function.\n *\n * [Documentation](https://react-querybuilder.js.org/docs/utils/misc#transformquery)\n */\nexport function transformQuery(\n query: RuleGroupTypeIC,\n options?: TransformQueryOptions<RuleGroupTypeIC>\n // oxlint-disable-next-line typescript/no-explicit-any\n): any;\nexport function transformQuery<RG extends RuleGroupTypeAny>(\n query: RG,\n options: TransformQueryOptions<RG> = {}\n) {\n const {\n ruleProcessor = r => r,\n ruleGroupProcessor = rg => rg,\n propertyMap = {},\n combinatorMap = {},\n operatorMap = {},\n omitPath = false,\n deleteRemappedProperties = true,\n } = options;\n\n // oxlint-disable-next-line typescript/no-explicit-any\n const processGroup = (rg: RuleGroupTypeAny): any => ({\n ...ruleGroupProcessor(\n remapProperties(\n {\n ...rg,\n ...(isRuleGroupType(rg)\n ? { combinator: combinatorMap[rg.combinator] ?? rg.combinator }\n : {}),\n },\n propertyMap,\n deleteRemappedProperties\n ) as RG\n ),\n ...(propertyMap['rules'] === false\n ? null\n : {\n // oxlint-disable-next-line typescript/no-explicit-any\n [propertyMap['rules'] ?? 'rules']: rg.rules.map((r: any, idx) => {\n const pathObject = omitPath ? null : { path: [...rg.path!, idx] };\n if (typeof r === 'string') {\n // independent combinators\n return combinatorMap[r] ?? r;\n } else if (isRuleGroup(r)) {\n // sub-groups\n return processGroup({ ...r, ...pathObject });\n }\n // rules\n return ruleProcessor(\n remapProperties(\n {\n ...r,\n ...pathObject,\n ...('operator' in r ? { operator: operatorMap[r.operator] ?? r.operator } : {}),\n },\n propertyMap,\n deleteRemappedProperties\n ) as RuleType\n );\n }),\n }),\n });\n\n return processGroup({ ...query, ...(omitPath ? null : { path: [] }) });\n}\n"],"mappings":";;;;;AAYA,MAAM,mBAEJ,KACA,aACA,gDAEQ,MAAK,UAAS;AACpB,MAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,YAAY,CAC9C,KAAI,MAAM,MACR,QAAO,MAAM;UACJ,CAAC,CAAC,KAAK,MAAM,KAAK,KAAK,OAAO;AACvC,QAAM,KAAK,MAAM;AACjB,MAAI,yBACF,QAAO,MAAM;;EAInB;AA4HJ,SAAgB,eACd,OACA,UAAqC,EAAE,EACvC;CACA,MAAM,EACJ,iBAAgB,MAAK,GACrB,sBAAqB,OAAM,IAC3B,cAAc,EAAE,EAChB,gBAAgB,EAAE,EAClB,cAAc,EAAE,EAChB,WAAW,OACX,2BAA2B,SACzB;CAGJ,MAAM,gBAAgB,QAA+B;EACnD,GAAG,mBACD,gBACE;GACE,GAAG;GACH,GAAIA,oCAAgB,GAAG,GACnB,EAAE,YAAY,cAAc,GAAG,eAAe,GAAG,YAAY,GAC7D,EAAE;GACP,EACD,aACA,yBACD,CACF;EACD,GAAI,YAAY,aAAa,QACzB,OACA,GAEG,YAAY,YAAY,UAAU,GAAG,MAAM,KAAK,GAAQ,QAAQ;GAC/D,MAAM,aAAa,WAAW,OAAO,EAAE,MAAM,CAAC,GAAG,GAAG,MAAO,IAAI,EAAE;AACjE,OAAI,OAAO,MAAM,SAEf,QAAO,cAAc,MAAM;YAClBC,gCAAY,EAAE,CAEvB,QAAO,aAAa;IAAE,GAAG;IAAG,GAAG;IAAY,CAAC;AAG9C,UAAO,cACL,gBACE;IACE,GAAG;IACH,GAAG;IACH,GAAI,cAAc,IAAI,EAAE,UAAU,YAAY,EAAE,aAAa,EAAE,UAAU,GAAG,EAAE;IAC/E,EACD,aACA,yBACD,CACF;IACD,EACH;EACN;AAED,QAAO,aAAa;EAAE,GAAG;EAAO,GAAI,WAAW,OAAO,EAAE,MAAM,EAAE,EAAE;EAAG,CAAC"}
@@ -1,4 +1,4 @@
1
- import { isRuleGroup, isRuleGroupType } from "./isRuleGroup-CnhYpLOM.mjs";
1
+ import { n as isRuleGroupType, t as isRuleGroup } from "./isRuleGroup-CYcfPgbg.mjs";
2
2
  import { produce } from "immer";
3
3
 
4
4
  //#region src/utils/transformQuery.ts
@@ -37,5 +37,5 @@ function transformQuery(query, options = {}) {
37
37
  }
38
38
 
39
39
  //#endregion
40
- export { transformQuery };
41
- //# sourceMappingURL=transformQuery-DdMvmrCh.mjs.map
40
+ export { transformQuery as t };
41
+ //# sourceMappingURL=transformQuery-DCCpjtyq.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"transformQuery-DdMvmrCh.mjs","names":[],"sources":["../src/utils/transformQuery.ts"],"sourcesContent":["/**\n * Recursively steps through a query object ({@link index!RuleGroupType RuleGroupType} or {@link index!RuleGroupTypeIC RuleGroupTypeIC}),\n * passing each {@link index!RuleType RuleType} object to a provided `ruleProcessor` function and returning a\n * new query object if there were any referential changes.\n *\n * @module transformQuery\n */\n\nimport { produce } from 'immer';\nimport type { RuleGroupType, RuleGroupTypeAny, RuleGroupTypeIC, RuleType } from '../types';\nimport { isRuleGroup, isRuleGroupType } from './isRuleGroup';\n\nconst remapProperties = (\n // oxlint-disable-next-line typescript/no-explicit-any\n obj: Record<string, any>,\n propertyMap: Record<string, string | false>,\n deleteRemappedProperties: boolean\n) =>\n produce(obj, draft => {\n for (const [k, v] of Object.entries(propertyMap)) {\n if (v === false) {\n delete draft[k];\n } else if (!!v && k !== v && k in draft) {\n draft[v] = draft[k];\n if (deleteRemappedProperties) {\n delete draft[k];\n }\n }\n }\n });\n\n/**\n * Options object for {@link index!transformQuery transformQuery}.\n */\nexport interface TransformQueryOptions<RG extends RuleGroupTypeAny = RuleGroupType> {\n /**\n * When a rule is encountered in the hierarchy, it will be replaced\n * with the result of this function.\n *\n * @defaultValue `r => r`\n */\n // oxlint-disable-next-line typescript/no-explicit-any\n ruleProcessor?: (rule: RuleType) => any;\n /**\n * When a group is encountered in the hierarchy (including the root group, the\n * query itself), it will be replaced with the result of this function.\n *\n * @defaultValue `rg => rg`\n */\n // oxlint-disable-next-line typescript/no-explicit-any\n ruleGroupProcessor?: (ruleGroup: RG) => Record<string, any>;\n /**\n * For each rule and group in the query, any properties matching a key\n * in this object will be renamed to the corresponding value. To retain both\n * the new _and_ the original properties, set `deleteRemappedProperties`\n * to `false`.\n *\n * If a key has a value of `false`, the corresponding property will be removed\n * without being copied to a new property name. (Warning: `{ rules: false }`\n * will prevent recursion and only return the processed root group.)\n *\n * @defaultValue `{}`\n *\n * @example\n * ```\n * transformQuery(\n * { combinator: 'and', not: true, rules: [] },\n * { propertyMap: { combinator: 'AndOr', not: false } }\n * )\n * // Returns: { AndOr: 'and', rules: [] }\n * ```\n */\n propertyMap?: Record<string, string | false>;\n /**\n * Any combinator values (including independent combinators) will be translated\n * from the key in this object to the value.\n *\n * @defaultValue `{}`\n *\n * @example\n * ```\n * transformQuery(\n * { combinator: 'and', rules: [] },\n * { combinatorMap: { and: '&&', or: '||' } }\n * )\n * // Returns: { combinator: '&&', rules: [] }\n * ```\n */\n combinatorMap?: Record<string, string>;\n /**\n * Any operator values will be translated from the key in this object to the value.\n *\n * @defaultValue `{}`\n *\n * @example\n * ```\n * transformQuery(\n * { combinator: 'and', rules: [{ field: 'name', operator: '=', value: 'Steve Vai' }] },\n * { operatorMap: { '=': 'is' } }\n * )\n * // Returns:\n * // {\n * // combinator: 'and',\n * // rules: [{ field: 'name', operator: 'is', value: 'Steve Vai' }]\n * // }\n * ```\n */\n operatorMap?: Record<string, string>;\n /**\n * Prevents the `path` property (see {@link index!Path Path}) from being added to each\n * rule and group in the hierarchy.\n *\n * @defaultValue `false`\n */\n omitPath?: boolean;\n /**\n * Original properties remapped according to the `propertyMap` option will be removed.\n *\n * @defaultValue `true`\n *\n * @example\n * ```\n * transformQuery(\n * { combinator: 'and', rules: [] },\n * { propertyMap: { combinator: 'AndOr' }, deleteRemappedProperties: false }\n * )\n * // Returns: { combinator: 'and', AndOr: 'and', rules: [] }\n * ```\n */\n deleteRemappedProperties?: boolean;\n}\n\n/**\n * Recursively process a query heirarchy using this versatile utility function.\n *\n * [Documentation](https://react-querybuilder.js.org/docs/utils/misc#transformquery)\n */\nexport function transformQuery(\n query: RuleGroupType,\n options?: TransformQueryOptions\n // oxlint-disable-next-line typescript/no-explicit-any\n): any;\n/**\n * Recursively process a query heirarchy with independent combinators using this\n * versatile utility function.\n *\n * [Documentation](https://react-querybuilder.js.org/docs/utils/misc#transformquery)\n */\nexport function transformQuery(\n query: RuleGroupTypeIC,\n options?: TransformQueryOptions<RuleGroupTypeIC>\n // oxlint-disable-next-line typescript/no-explicit-any\n): any;\nexport function transformQuery<RG extends RuleGroupTypeAny>(\n query: RG,\n options: TransformQueryOptions<RG> = {}\n) {\n const {\n ruleProcessor = r => r,\n ruleGroupProcessor = rg => rg,\n propertyMap = {},\n combinatorMap = {},\n operatorMap = {},\n omitPath = false,\n deleteRemappedProperties = true,\n } = options;\n\n // oxlint-disable-next-line typescript/no-explicit-any\n const processGroup = (rg: RuleGroupTypeAny): any => ({\n ...ruleGroupProcessor(\n remapProperties(\n {\n ...rg,\n ...(isRuleGroupType(rg)\n ? { combinator: combinatorMap[rg.combinator] ?? rg.combinator }\n : {}),\n },\n propertyMap,\n deleteRemappedProperties\n ) as RG\n ),\n ...(propertyMap['rules'] === false\n ? null\n : {\n // oxlint-disable-next-line typescript/no-explicit-any\n [propertyMap['rules'] ?? 'rules']: rg.rules.map((r: any, idx) => {\n const pathObject = omitPath ? null : { path: [...rg.path!, idx] };\n if (typeof r === 'string') {\n // independent combinators\n return combinatorMap[r] ?? r;\n } else if (isRuleGroup(r)) {\n // sub-groups\n return processGroup({ ...r, ...pathObject });\n }\n // rules\n return ruleProcessor(\n remapProperties(\n {\n ...r,\n ...pathObject,\n ...('operator' in r ? { operator: operatorMap[r.operator] ?? r.operator } : {}),\n },\n propertyMap,\n deleteRemappedProperties\n ) as RuleType\n );\n }),\n }),\n });\n\n return processGroup({ ...query, ...(omitPath ? null : { path: [] }) });\n}\n"],"mappings":";;;;AAYA,MAAM,mBAEJ,KACA,aACA,6BAEA,QAAQ,MAAK,UAAS;AACpB,MAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,YAAY,CAC9C,KAAI,MAAM,MACR,QAAO,MAAM;UACJ,CAAC,CAAC,KAAK,MAAM,KAAK,KAAK,OAAO;AACvC,QAAM,KAAK,MAAM;AACjB,MAAI,yBACF,QAAO,MAAM;;EAInB;AA4HJ,SAAgB,eACd,OACA,UAAqC,EAAE,EACvC;CACA,MAAM,EACJ,iBAAgB,MAAK,GACrB,sBAAqB,OAAM,IAC3B,cAAc,EAAE,EAChB,gBAAgB,EAAE,EAClB,cAAc,EAAE,EAChB,WAAW,OACX,2BAA2B,SACzB;CAGJ,MAAM,gBAAgB,QAA+B;EACnD,GAAG,mBACD,gBACE;GACE,GAAG;GACH,GAAI,gBAAgB,GAAG,GACnB,EAAE,YAAY,cAAc,GAAG,eAAe,GAAG,YAAY,GAC7D,EAAE;GACP,EACD,aACA,yBACD,CACF;EACD,GAAI,YAAY,aAAa,QACzB,OACA,GAEG,YAAY,YAAY,UAAU,GAAG,MAAM,KAAK,GAAQ,QAAQ;GAC/D,MAAM,aAAa,WAAW,OAAO,EAAE,MAAM,CAAC,GAAG,GAAG,MAAO,IAAI,EAAE;AACjE,OAAI,OAAO,MAAM,SAEf,QAAO,cAAc,MAAM;YAClB,YAAY,EAAE,CAEvB,QAAO,aAAa;IAAE,GAAG;IAAG,GAAG;IAAY,CAAC;AAG9C,UAAO,cACL,gBACE;IACE,GAAG;IACH,GAAG;IACH,GAAI,cAAc,IAAI,EAAE,UAAU,YAAY,EAAE,aAAa,EAAE,UAAU,GAAG,EAAE;IAC/E,EACD,aACA,yBACD,CACF;IACD,EACH;EACN;AAED,QAAO,aAAa;EAAE,GAAG;EAAO,GAAI,WAAW,OAAO,EAAE,MAAM,EAAE,EAAE;EAAG,CAAC"}
1
+ {"version":3,"file":"transformQuery-DCCpjtyq.mjs","names":[],"sources":["../src/utils/transformQuery.ts"],"sourcesContent":["/**\n * Recursively steps through a query object ({@link index!RuleGroupType RuleGroupType} or {@link index!RuleGroupTypeIC RuleGroupTypeIC}),\n * passing each {@link index!RuleType RuleType} object to a provided `ruleProcessor` function and returning a\n * new query object if there were any referential changes.\n *\n * @module transformQuery\n */\n\nimport { produce } from 'immer';\nimport type { RuleGroupType, RuleGroupTypeAny, RuleGroupTypeIC, RuleType } from '../types';\nimport { isRuleGroup, isRuleGroupType } from './isRuleGroup';\n\nconst remapProperties = (\n // oxlint-disable-next-line typescript/no-explicit-any\n obj: Record<string, any>,\n propertyMap: Record<string, string | false>,\n deleteRemappedProperties: boolean\n) =>\n produce(obj, draft => {\n for (const [k, v] of Object.entries(propertyMap)) {\n if (v === false) {\n delete draft[k];\n } else if (!!v && k !== v && k in draft) {\n draft[v] = draft[k];\n if (deleteRemappedProperties) {\n delete draft[k];\n }\n }\n }\n });\n\n/**\n * Options object for {@link index!transformQuery transformQuery}.\n */\nexport interface TransformQueryOptions<RG extends RuleGroupTypeAny = RuleGroupType> {\n /**\n * When a rule is encountered in the hierarchy, it will be replaced\n * with the result of this function.\n *\n * @defaultValue `r => r`\n */\n // oxlint-disable-next-line typescript/no-explicit-any\n ruleProcessor?: (rule: RuleType) => any;\n /**\n * When a group is encountered in the hierarchy (including the root group, the\n * query itself), it will be replaced with the result of this function.\n *\n * @defaultValue `rg => rg`\n */\n // oxlint-disable-next-line typescript/no-explicit-any\n ruleGroupProcessor?: (ruleGroup: RG) => Record<string, any>;\n /**\n * For each rule and group in the query, any properties matching a key\n * in this object will be renamed to the corresponding value. To retain both\n * the new _and_ the original properties, set `deleteRemappedProperties`\n * to `false`.\n *\n * If a key has a value of `false`, the corresponding property will be removed\n * without being copied to a new property name. (Warning: `{ rules: false }`\n * will prevent recursion and only return the processed root group.)\n *\n * @defaultValue `{}`\n *\n * @example\n * ```\n * transformQuery(\n * { combinator: 'and', not: true, rules: [] },\n * { propertyMap: { combinator: 'AndOr', not: false } }\n * )\n * // Returns: { AndOr: 'and', rules: [] }\n * ```\n */\n propertyMap?: Record<string, string | false>;\n /**\n * Any combinator values (including independent combinators) will be translated\n * from the key in this object to the value.\n *\n * @defaultValue `{}`\n *\n * @example\n * ```\n * transformQuery(\n * { combinator: 'and', rules: [] },\n * { combinatorMap: { and: '&&', or: '||' } }\n * )\n * // Returns: { combinator: '&&', rules: [] }\n * ```\n */\n combinatorMap?: Record<string, string>;\n /**\n * Any operator values will be translated from the key in this object to the value.\n *\n * @defaultValue `{}`\n *\n * @example\n * ```\n * transformQuery(\n * { combinator: 'and', rules: [{ field: 'name', operator: '=', value: 'Steve Vai' }] },\n * { operatorMap: { '=': 'is' } }\n * )\n * // Returns:\n * // {\n * // combinator: 'and',\n * // rules: [{ field: 'name', operator: 'is', value: 'Steve Vai' }]\n * // }\n * ```\n */\n operatorMap?: Record<string, string>;\n /**\n * Prevents the `path` property (see {@link index!Path Path}) from being added to each\n * rule and group in the hierarchy.\n *\n * @defaultValue `false`\n */\n omitPath?: boolean;\n /**\n * Original properties remapped according to the `propertyMap` option will be removed.\n *\n * @defaultValue `true`\n *\n * @example\n * ```\n * transformQuery(\n * { combinator: 'and', rules: [] },\n * { propertyMap: { combinator: 'AndOr' }, deleteRemappedProperties: false }\n * )\n * // Returns: { combinator: 'and', AndOr: 'and', rules: [] }\n * ```\n */\n deleteRemappedProperties?: boolean;\n}\n\n/**\n * Recursively process a query heirarchy using this versatile utility function.\n *\n * [Documentation](https://react-querybuilder.js.org/docs/utils/misc#transformquery)\n */\nexport function transformQuery(\n query: RuleGroupType,\n options?: TransformQueryOptions\n // oxlint-disable-next-line typescript/no-explicit-any\n): any;\n/**\n * Recursively process a query heirarchy with independent combinators using this\n * versatile utility function.\n *\n * [Documentation](https://react-querybuilder.js.org/docs/utils/misc#transformquery)\n */\nexport function transformQuery(\n query: RuleGroupTypeIC,\n options?: TransformQueryOptions<RuleGroupTypeIC>\n // oxlint-disable-next-line typescript/no-explicit-any\n): any;\nexport function transformQuery<RG extends RuleGroupTypeAny>(\n query: RG,\n options: TransformQueryOptions<RG> = {}\n) {\n const {\n ruleProcessor = r => r,\n ruleGroupProcessor = rg => rg,\n propertyMap = {},\n combinatorMap = {},\n operatorMap = {},\n omitPath = false,\n deleteRemappedProperties = true,\n } = options;\n\n // oxlint-disable-next-line typescript/no-explicit-any\n const processGroup = (rg: RuleGroupTypeAny): any => ({\n ...ruleGroupProcessor(\n remapProperties(\n {\n ...rg,\n ...(isRuleGroupType(rg)\n ? { combinator: combinatorMap[rg.combinator] ?? rg.combinator }\n : {}),\n },\n propertyMap,\n deleteRemappedProperties\n ) as RG\n ),\n ...(propertyMap['rules'] === false\n ? null\n : {\n // oxlint-disable-next-line typescript/no-explicit-any\n [propertyMap['rules'] ?? 'rules']: rg.rules.map((r: any, idx) => {\n const pathObject = omitPath ? null : { path: [...rg.path!, idx] };\n if (typeof r === 'string') {\n // independent combinators\n return combinatorMap[r] ?? r;\n } else if (isRuleGroup(r)) {\n // sub-groups\n return processGroup({ ...r, ...pathObject });\n }\n // rules\n return ruleProcessor(\n remapProperties(\n {\n ...r,\n ...pathObject,\n ...('operator' in r ? { operator: operatorMap[r.operator] ?? r.operator } : {}),\n },\n propertyMap,\n deleteRemappedProperties\n ) as RuleType\n );\n }),\n }),\n });\n\n return processGroup({ ...query, ...(omitPath ? null : { path: [] }) });\n}\n"],"mappings":";;;;AAYA,MAAM,mBAEJ,KACA,aACA,6BAEA,QAAQ,MAAK,UAAS;AACpB,MAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,YAAY,CAC9C,KAAI,MAAM,MACR,QAAO,MAAM;UACJ,CAAC,CAAC,KAAK,MAAM,KAAK,KAAK,OAAO;AACvC,QAAM,KAAK,MAAM;AACjB,MAAI,yBACF,QAAO,MAAM;;EAInB;AA4HJ,SAAgB,eACd,OACA,UAAqC,EAAE,EACvC;CACA,MAAM,EACJ,iBAAgB,MAAK,GACrB,sBAAqB,OAAM,IAC3B,cAAc,EAAE,EAChB,gBAAgB,EAAE,EAClB,cAAc,EAAE,EAChB,WAAW,OACX,2BAA2B,SACzB;CAGJ,MAAM,gBAAgB,QAA+B;EACnD,GAAG,mBACD,gBACE;GACE,GAAG;GACH,GAAI,gBAAgB,GAAG,GACnB,EAAE,YAAY,cAAc,GAAG,eAAe,GAAG,YAAY,GAC7D,EAAE;GACP,EACD,aACA,yBACD,CACF;EACD,GAAI,YAAY,aAAa,QACzB,OACA,GAEG,YAAY,YAAY,UAAU,GAAG,MAAM,KAAK,GAAQ,QAAQ;GAC/D,MAAM,aAAa,WAAW,OAAO,EAAE,MAAM,CAAC,GAAG,GAAG,MAAO,IAAI,EAAE;AACjE,OAAI,OAAO,MAAM,SAEf,QAAO,cAAc,MAAM;YAClB,YAAY,EAAE,CAEvB,QAAO,aAAa;IAAE,GAAG;IAAG,GAAG;IAAY,CAAC;AAG9C,UAAO,cACL,gBACE;IACE,GAAG;IACH,GAAG;IACH,GAAI,cAAc,IAAI,EAAE,UAAU,YAAY,EAAE,aAAa,EAAE,UAAU,GAAG,EAAE;IAC/E,EACD,aACA,yBACD,CACF;IACD,EACH;EACN;AAED,QAAO,aAAa;EAAE,GAAG;EAAO,GAAI,WAAW,OAAO,EAAE,MAAM,EAAE,EAAE;EAAG,CAAC"}
@@ -1,4 +1,4 @@
1
- import { RuleGroupType, RuleGroupTypeAny, RuleGroupTypeIC, RuleType } from "./basic-BfD-7CN3.mjs";
1
+ import { _ as RuleGroupType, f as RuleGroupTypeAny, p as RuleGroupTypeIC, v as RuleType } from "./basic-DEc65Kng.mjs";
2
2
 
3
3
  //#region src/utils/transformQuery.d.ts
4
4
 
@@ -1,4 +1,4 @@
1
- import { RuleGroupType, RuleGroupTypeAny, RuleGroupTypeIC, RuleType } from "./basic-C8xXKHIA.js";
1
+ import { _ as RuleGroupType, f as RuleGroupTypeAny, p as RuleGroupTypeIC, v as RuleType } from "./basic-Dd_M2f3M.js";
2
2
 
3
3
  //#region src/utils/transformQuery.d.ts
4
4
 
@@ -1,4 +1,4 @@
1
1
  require('./isRuleGroup-DqAs2x4E.js');
2
- const require_transformQuery = require('./transformQuery-FL_nlpp5.js');
2
+ const require_transformQuery = require('./transformQuery-CWDPogO5.js');
3
3
 
4
4
  exports.transformQuery = require_transformQuery.transformQuery;
@@ -1,4 +1,4 @@
1
- import "./isRuleGroup-CnhYpLOM.mjs";
2
- import { transformQuery } from "./transformQuery-DdMvmrCh.mjs";
1
+ import "./isRuleGroup-CYcfPgbg.mjs";
2
+ import { t as transformQuery } from "./transformQuery-DCCpjtyq.mjs";
3
3
 
4
4
  export { transformQuery };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-querybuilder/core",
3
- "version": "8.9.2",
3
+ "version": "8.11.0",
4
4
  "description": "React Query Builder component for constructing queries and filters, with utilities for executing them in various database and evaluation contexts",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -144,24 +144,26 @@
144
144
  "@babel/core": "^7.28.4",
145
145
  "@babel/preset-env": "^7.28.3",
146
146
  "@babel/preset-typescript": "^7.27.1",
147
- "@electric-sql/pglite": "^0.3.8",
147
+ "@electric-sql/pglite": "^0.3.11",
148
148
  "@types/json-logic-js": "^2.0.8",
149
- "@types/node": "^24.5.2",
149
+ "@types/node": "^24.9.1",
150
150
  "babel-plugin-istanbul": "^7.0.1",
151
- "drizzle-orm": "^0.44.5",
151
+ "drizzle-orm": "^0.44.6",
152
152
  "json-logic-js": "^2.0.5",
153
153
  "jsonata": "^2.1.0",
154
- "mongodb-memory-server-core": "^10.2.1",
155
- "mongoose": "^8.18.1",
154
+ "mongodb-memory-server-core": "^10.2.3",
155
+ "mongoose": "^8.19.2",
156
156
  "pglite-prisma-adapter": "^0.6.1",
157
- "prisma": "~6.14.0",
157
+ "prisma": "^6.17.1",
158
158
  "query-string": "^9.3.1",
159
159
  "regenerator-runtime": "^0.14.1",
160
- "rollup-plugin-visualizer": "^6.0.3",
161
- "sass": "^1.92.1",
160
+ "rollup-plugin-visualizer": "^6.0.5",
161
+ "sass": "^1.93.2",
162
162
  "sequelize": "^6.37.7",
163
- "spel2js": "^0.2.8",
164
- "typescript": "^5.9.2"
163
+ "spel2js": "^0.2.9",
164
+ "type-fest": "^5.1.0",
165
+ "typescript": "^5.9.3",
166
+ "vite": "^7.1.11"
165
167
  },
166
168
  "dependencies": {
167
169
  "immer": "^10.1.3",
@@ -191,5 +193,5 @@
191
193
  "typecheck": "tsc --noEmit",
192
194
  "typecheck:watch": "tsc --noEmit --watch"
193
195
  },
194
- "gitHead": "23337611f82e9ba31fa918689ed6ec9d78d3d7e6"
196
+ "gitHead": "003017832bc4197311fcefe75b60def45f458cad"
195
197
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"arrayUtils-BF1P8iHS.mjs","names":["defaultPlaceholderFieldName: typeof defaultPlaceholderName","defaultPlaceholderOperatorName: typeof defaultPlaceholderName","defaultOperatorNegationMap: Record<DefaultOperatorName, DefaultOperatorName>","defaultCombinators: DefaultCombinators","defaultCombinatorsExtended: DefaultCombinatorsExtended","v"],"sources":["../src/defaults.ts","../src/utils/arrayUtils.ts"],"sourcesContent":["import type {\n Classnames,\n DefaultCombinatorName,\n DefaultCombinatorNameExtended,\n DefaultOperatorName,\n MatchMode,\n Path,\n StringUnionToFullOptionArray,\n} from './types';\n\n// DO NOT ALTER OR REMOVE REGION NAMES. Some of them are used\n// to generate code snippets in the documentation.\n\n/**\n * @group Defaults\n */\nexport const defaultPlaceholderName = '~';\n/**\n * @group Defaults\n */\nexport const defaultPlaceholderLabel = '------';\n/**\n * Default `name` for placeholder option in the `fields` array.\n *\n * @group Defaults\n */\nexport const defaultPlaceholderFieldName: typeof defaultPlaceholderName = defaultPlaceholderName;\n/**\n * Default `label` for placeholder option in the `fields` array.\n *\n * @group Defaults\n */\nexport const defaultPlaceholderFieldLabel: typeof defaultPlaceholderLabel = defaultPlaceholderLabel;\n/**\n * Default `label` for placeholder option group in the `fields` array.\n *\n * @group Defaults\n */\nexport const defaultPlaceholderFieldGroupLabel: typeof defaultPlaceholderLabel =\n defaultPlaceholderLabel;\n/**\n * Default `name` for placeholder option in the `operators` array.\n *\n * @group Defaults\n */\nexport const defaultPlaceholderOperatorName: typeof defaultPlaceholderName = defaultPlaceholderName;\n/**\n * Default `label` for placeholder option in the `operators` array.\n *\n * @group Defaults\n */\nexport const defaultPlaceholderOperatorLabel: typeof defaultPlaceholderLabel =\n defaultPlaceholderLabel;\n/**\n * Default `label` for placeholder option group in the `operators` array.\n *\n * @group Defaults\n */\nexport const defaultPlaceholderOperatorGroupLabel: typeof defaultPlaceholderLabel =\n defaultPlaceholderLabel;\n/**\n * Default `name` for placeholder option in the `values` array.\n *\n * @group Defaults\n */\nexport const defaultPlaceholderValueName: typeof defaultPlaceholderName = defaultPlaceholderName;\n/**\n * Default `label` for placeholder option in the `values` array.\n *\n * @group Defaults\n */\nexport const defaultPlaceholderValueLabel: typeof defaultPlaceholderLabel = defaultPlaceholderLabel;\n/**\n * Default `label` for placeholder option group in the `values` array.\n *\n * @group Defaults\n */\nexport const defaultPlaceholderValueGroupLabel: typeof defaultPlaceholderLabel =\n defaultPlaceholderLabel;\n\n/**\n * Default character used to `.join` and `.split` arrays.\n *\n * @group Defaults\n */\nexport const defaultJoinChar = ',';\n\nexport type DefaultOperators = StringUnionToFullOptionArray<DefaultOperatorName>;\n\nexport const defaultOperatorLabelMap: Record<DefaultOperatorName, string> = {\n '=': '=',\n '!=': '!=',\n '<': '<',\n '>': '>',\n '<=': '<=',\n '>=': '>=',\n contains: 'contains',\n beginsWith: 'begins with',\n endsWith: 'ends with',\n doesNotContain: 'does not contain',\n doesNotBeginWith: 'does not begin with',\n doesNotEndWith: 'does not end with',\n null: 'is null',\n notNull: 'is not null',\n in: 'in',\n notIn: 'not in',\n between: 'between',\n notBetween: 'not between',\n};\n\nexport const defaultCombinatorLabelMap: Record<DefaultCombinatorNameExtended, string> = {\n and: 'AND',\n or: 'OR',\n xor: 'XOR',\n};\n\n/**\n * Default operator list.\n *\n * @group Defaults\n */\n// #region docs-operators\nexport const defaultOperators: DefaultOperators = [\n { name: '=', value: '=', label: '=' },\n { name: '!=', value: '!=', label: '!=' },\n { name: '<', value: '<', label: '<' },\n { name: '>', value: '>', label: '>' },\n { name: '<=', value: '<=', label: '<=' },\n { name: '>=', value: '>=', label: '>=' },\n { name: 'contains', value: 'contains', label: 'contains' },\n { name: 'beginsWith', value: 'beginsWith', label: 'begins with' },\n { name: 'endsWith', value: 'endsWith', label: 'ends with' },\n { name: 'doesNotContain', value: 'doesNotContain', label: 'does not contain' },\n { name: 'doesNotBeginWith', value: 'doesNotBeginWith', label: 'does not begin with' },\n { name: 'doesNotEndWith', value: 'doesNotEndWith', label: 'does not end with' },\n { name: 'null', value: 'null', label: 'is null' },\n { name: 'notNull', value: 'notNull', label: 'is not null' },\n { name: 'in', value: 'in', label: 'in' },\n { name: 'notIn', value: 'notIn', label: 'not in' },\n { name: 'between', value: 'between', label: 'between' },\n { name: 'notBetween', value: 'notBetween', label: 'not between' },\n];\n// #endregion\n\n/**\n * Map of default operators to their respective opposite/negating operators.\n *\n * @group Defaults\n */\nexport const defaultOperatorNegationMap: Record<DefaultOperatorName, DefaultOperatorName> = {\n '=': '!=',\n '!=': '=',\n '<': '>=',\n '<=': '>',\n '>': '<=',\n '>=': '<',\n beginsWith: 'doesNotBeginWith',\n doesNotBeginWith: 'beginsWith',\n endsWith: 'doesNotEndWith',\n doesNotEndWith: 'endsWith',\n contains: 'doesNotContain',\n doesNotContain: 'contains',\n between: 'notBetween',\n notBetween: 'between',\n in: 'notIn',\n notIn: 'in',\n notNull: 'null',\n null: 'notNull',\n} satisfies Record<DefaultOperatorName, DefaultOperatorName>;\n\nexport type DefaultCombinators = StringUnionToFullOptionArray<DefaultCombinatorName>;\n\n/**\n * Default combinator list.\n *\n * @group Defaults\n */\n// #region docs-combinators\nexport const defaultCombinators: DefaultCombinators = [\n { name: 'and', value: 'and', label: 'AND' } as const,\n { name: 'or', value: 'or', label: 'OR' } as const,\n];\n// #endregion\n\nexport type DefaultCombinatorsExtended =\n StringUnionToFullOptionArray<DefaultCombinatorNameExtended>;\n\n/**\n * Default combinator list, with `XOR` added.\n *\n * @group Defaults\n */\nexport const defaultCombinatorsExtended: DefaultCombinatorsExtended = [\n ...defaultCombinators,\n { name: 'xor', value: 'xor', label: 'XOR' } as const,\n];\n\nexport type DefaultMatchModes = StringUnionToFullOptionArray<MatchMode>;\n\n/**\n * Default match modes.\n *\n * @group Defaults\n */\n// #region docs-matchmodes\nexport const defaultMatchModes: DefaultMatchModes = [\n { name: 'all', value: 'all', label: 'all' },\n { name: 'some', value: 'some', label: 'some' },\n { name: 'none', value: 'none', label: 'none' },\n { name: 'atLeast', value: 'atLeast', label: 'at least' },\n { name: 'atMost', value: 'atMost', label: 'at most' },\n { name: 'exactly', value: 'exactly', label: 'exactly' },\n];\n// #endregion\n\n/**\n * Standard classnames applied to each component.\n *\n * @group Defaults\n */\n// #region docs-standardclassnames\nexport const standardClassnames = {\n queryBuilder: 'queryBuilder',\n ruleGroup: 'ruleGroup',\n header: 'ruleGroup-header',\n body: 'ruleGroup-body',\n combinators: 'ruleGroup-combinators',\n addRule: 'ruleGroup-addRule',\n addGroup: 'ruleGroup-addGroup',\n cloneRule: 'rule-cloneRule',\n cloneGroup: 'ruleGroup-cloneGroup',\n removeGroup: 'ruleGroup-remove',\n notToggle: 'ruleGroup-notToggle',\n rule: 'rule',\n fields: 'rule-fields',\n matchMode: 'rule-matchMode',\n matchThreshold: 'rule-matchThreshold',\n operators: 'rule-operators',\n value: 'rule-value',\n removeRule: 'rule-remove',\n betweenRules: 'betweenRules',\n valid: 'queryBuilder-valid',\n invalid: 'queryBuilder-invalid',\n shiftActions: 'shiftActions',\n dndDragging: 'dndDragging',\n dndOver: 'dndOver',\n dndCopy: 'dndCopy',\n dndGroup: 'dndGroup',\n dndDropNotAllowed: 'dndDropNotAllowed',\n dragHandle: 'queryBuilder-dragHandle',\n disabled: 'queryBuilder-disabled',\n lockRule: 'rule-lock',\n lockGroup: 'ruleGroup-lock',\n valueSource: 'rule-valueSource',\n valueListItem: 'rule-value-list-item',\n branches: 'queryBuilder-branches',\n justified: 'queryBuilder-justified',\n hasSubQuery: 'rule-hasSubQuery',\n} as const;\n// #endregion\n\n/**\n * Default classnames for each component.\n *\n * @group Defaults\n */\nexport const defaultControlClassnames: Classnames = {\n queryBuilder: '',\n ruleGroup: '',\n header: '',\n body: '',\n combinators: '',\n addRule: '',\n addGroup: '',\n cloneRule: '',\n cloneGroup: '',\n removeGroup: '',\n notToggle: '',\n rule: '',\n fields: '',\n matchMode: '',\n matchThreshold: '',\n operators: '',\n value: '',\n removeRule: '',\n shiftActions: '',\n dragHandle: '',\n lockRule: '',\n lockGroup: '',\n valueSource: '',\n actionElement: '',\n valueSelector: '',\n betweenRules: '',\n valid: '',\n invalid: '',\n dndDragging: '',\n dndOver: '',\n dndGroup: '',\n dndCopy: '',\n dndDropNotAllowed: '',\n disabled: '',\n valueListItem: '',\n branches: '',\n hasSubQuery: '',\n} satisfies Classnames;\n\n/**\n * Default reason codes for a group being invalid.\n *\n * @group Defaults\n */\nexport const groupInvalidReasons = {\n empty: 'empty',\n invalidCombinator: 'invalid combinator',\n invalidIndependentCombinators: 'invalid independent combinators',\n} as const;\n\n/**\n * Component identifiers for testing.\n *\n * @group Defaults\n */\nexport const TestID = {\n rule: 'rule',\n ruleGroup: 'rule-group',\n inlineCombinator: 'inline-combinator',\n addGroup: 'add-group',\n removeGroup: 'remove-group',\n cloneGroup: 'clone-group',\n cloneRule: 'clone-rule',\n addRule: 'add-rule',\n removeRule: 'remove-rule',\n combinators: 'combinators',\n fields: 'fields',\n operators: 'operators',\n valueEditor: 'value-editor',\n notToggle: 'not-toggle',\n shiftActions: 'shift-actions',\n dragHandle: 'drag-handle',\n lockRule: 'lock-rule',\n lockGroup: 'lock-group',\n valueSourceSelector: 'value-source-selector',\n matchModeEditor: 'match-mode-editor',\n} as const;\n\nexport const LogType = {\n parentPathDisabled: 'action aborted: parent path disabled',\n pathDisabled: 'action aborted: path is disabled',\n queryUpdate: 'query updated',\n onAddRuleFalse: 'onAddRule callback returned false',\n onAddGroupFalse: 'onAddGroup callback returned false',\n onGroupRuleFalse: 'onGroupRule callback returned false',\n onGroupGroupFalse: 'onGroupGroup callback returned false',\n onMoveRuleFalse: 'onMoveRule callback returned false',\n onMoveGroupFalse: 'onMoveGroup callback returned false',\n onRemoveFalse: 'onRemove callback returned false',\n add: 'rule or group added',\n remove: 'rule or group removed',\n update: 'rule or group updated',\n move: 'rule or group moved',\n group: 'rule or group grouped with another',\n} as const;\n\n/**\n * The {@link Path} of the root group.\n *\n * @group Defaults\n */\nexport const rootPath: Path = [] satisfies Path;\n","import { defaultJoinChar } from '../defaults';\n\n/**\n * Splits a string by a given character (see {@link defaultJoinChar}). Escaped characters\n * (characters preceded by a backslash) will not apply to the split, and the backslash will\n * be removed in the array element. Inverse of {@link joinWith}.\n *\n * @example\n * splitBy('this\\\\,\\\\,that,,the other,,,\\\\,')\n * // or\n * splitBy('this\\\\,\\\\,that,,the other,,,\\\\,', ',')\n * // would return\n * ['this,,that', '', 'the other', '', '', ',']\n */\nexport const splitBy = (str?: string, splitChar: string = defaultJoinChar): string[] =>\n typeof str === 'string'\n ? str\n .split(`\\\\${splitChar}`)\n .map(c => c.split(splitChar))\n .reduce((prev, curr, idx) => {\n if (idx === 0) {\n return curr;\n }\n return [...prev.slice(0, -1), `${prev.at(-1)}${splitChar}${curr[0]}`, ...curr.slice(1)];\n }, [])\n : [];\n\n/**\n * Joins an array of strings using the given character (see {@link defaultJoinChar}). When\n * the given character appears in an array element, a backslash will be added just before it\n * to distinguish it from the join character. Effectively the inverse of {@link splitBy}.\n *\n * TIP: The join character can actually be a string of any length. Only the first character\n * will be searched for in the array elements and preceded by a backslash.\n *\n * @example\n * joinWith(['this,,that', '', 'the other', '', '', ','], ', ')\n * // would return\n * 'this\\\\,\\\\,that, , the other, , , \\\\,'\n */\n// oxlint-disable-next-line typescript/no-explicit-any\nexport const joinWith = (strArr: any[], joinChar: string = defaultJoinChar): string =>\n strArr.map(str => `${str ?? ''}`.replaceAll(joinChar[0], `\\\\${joinChar[0]}`)).join(joinChar);\n\n/**\n * Trims the value if it is a string. Otherwise returns the value as is.\n */\n// oxlint-disable-next-line typescript/no-explicit-any\nexport const trimIfString = (val: any): any => (typeof val === 'string' ? val.trim() : val);\n\n/**\n * Splits a string by comma then trims each element. Arrays are returned as is except\n * any string elements are trimmed.\n */\nexport const toArray = (\n // oxlint-disable-next-line typescript/no-explicit-any\n v: any,\n { retainEmptyStrings }: { retainEmptyStrings?: boolean } = {}\n // oxlint-disable-next-line typescript/no-explicit-any\n): any[] =>\n Array.isArray(v)\n ? v.map(v => trimIfString(v))\n : typeof v === 'string'\n ? splitBy(v, defaultJoinChar)\n .filter(retainEmptyStrings ? () => true : s => !/^\\s*$/.test(s))\n .map(s => s.trim())\n : typeof v === 'number'\n ? [v]\n : [];\n\n/**\n * Determines if an array is free of `null`/`undefined`.\n */\nexport const nullFreeArray = <T>(arr: T[]): arr is Exclude<T, null>[] =>\n arr.every(el => el === false || (el ?? false) !== false);\n"],"mappings":";;;;AAgBA,MAAa,yBAAyB;;;;;;AAUtC,MAAaA,8BAA6D;;;;;;AAmB1E,MAAaC,iCAAgE;;;;;;AAwC7E,MAAa,kBAAkB;;;;;;AAgE/B,MAAaC,6BAA+E;CAC1F,KAAK;CACL,MAAM;CACN,KAAK;CACL,MAAM;CACN,KAAK;CACL,MAAM;CACN,YAAY;CACZ,kBAAkB;CAClB,UAAU;CACV,gBAAgB;CAChB,UAAU;CACV,gBAAgB;CAChB,SAAS;CACT,YAAY;CACZ,IAAI;CACJ,OAAO;CACP,SAAS;CACT,MAAM;CACP;;;;;;AAUD,MAAaC,qBAAyC,CACpD;CAAE,MAAM;CAAO,OAAO;CAAO,OAAO;CAAO,EAC3C;CAAE,MAAM;CAAM,OAAO;CAAM,OAAO;CAAM,CACzC;;;;;;AAWD,MAAaC,6BAAyD,CACpE,GAAG,oBACH;CAAE,MAAM;CAAO,OAAO;CAAO,OAAO;CAAO,CAC5C;;;;;;;;;;;;;;;;ACrLD,MAAa,WAAW,KAAc,YAAoB,oBACxD,OAAO,QAAQ,WACX,IACG,MAAM,KAAK,YAAY,CACvB,KAAI,MAAK,EAAE,MAAM,UAAU,CAAC,CAC5B,QAAQ,MAAM,MAAM,QAAQ;AAC3B,KAAI,QAAQ,EACV,QAAO;AAET,QAAO;EAAC,GAAG,KAAK,MAAM,GAAG,GAAG;EAAE,GAAG,KAAK,GAAG,GAAG,GAAG,YAAY,KAAK;EAAM,GAAG,KAAK,MAAM,EAAE;EAAC;GACtF,EAAE,CAAC,GACR,EAAE;;;;;;;;;;;;;;AAgBR,MAAa,YAAY,QAAe,WAAmB,oBACzD,OAAO,KAAI,QAAO,GAAG,OAAO,KAAK,WAAW,SAAS,IAAI,KAAK,SAAS,KAAK,CAAC,CAAC,KAAK,SAAS;;;;AAM9F,MAAa,gBAAgB,QAAmB,OAAO,QAAQ,WAAW,IAAI,MAAM,GAAG;;;;;AAMvF,MAAa,WAEX,GACA,EAAE,uBAAyD,EAAE,KAG7D,MAAM,QAAQ,EAAE,GACZ,EAAE,KAAI,QAAK,aAAaC,IAAE,CAAC,GAC3B,OAAO,MAAM,WACX,QAAQ,GAAG,gBAAgB,CACxB,OAAO,2BAA2B,QAAO,MAAK,CAAC,QAAQ,KAAK,EAAE,CAAC,CAC/D,KAAI,MAAK,EAAE,MAAM,CAAC,GACrB,OAAO,MAAM,WACX,CAAC,EAAE,GACH,EAAE"}
@@ -1,164 +0,0 @@
1
-
2
- //#region src/defaults.ts
3
- /**
4
- * @group Defaults
5
- */
6
- const defaultPlaceholderName = "~";
7
- /**
8
- * Default `name` for placeholder option in the `fields` array.
9
- *
10
- * @group Defaults
11
- */
12
- const defaultPlaceholderFieldName = defaultPlaceholderName;
13
- /**
14
- * Default `name` for placeholder option in the `operators` array.
15
- *
16
- * @group Defaults
17
- */
18
- const defaultPlaceholderOperatorName = defaultPlaceholderName;
19
- /**
20
- * Default character used to `.join` and `.split` arrays.
21
- *
22
- * @group Defaults
23
- */
24
- const defaultJoinChar = ",";
25
- /**
26
- * Map of default operators to their respective opposite/negating operators.
27
- *
28
- * @group Defaults
29
- */
30
- const defaultOperatorNegationMap = {
31
- "=": "!=",
32
- "!=": "=",
33
- "<": ">=",
34
- "<=": ">",
35
- ">": "<=",
36
- ">=": "<",
37
- beginsWith: "doesNotBeginWith",
38
- doesNotBeginWith: "beginsWith",
39
- endsWith: "doesNotEndWith",
40
- doesNotEndWith: "endsWith",
41
- contains: "doesNotContain",
42
- doesNotContain: "contains",
43
- between: "notBetween",
44
- notBetween: "between",
45
- in: "notIn",
46
- notIn: "in",
47
- notNull: "null",
48
- null: "notNull"
49
- };
50
- /**
51
- * Default combinator list.
52
- *
53
- * @group Defaults
54
- */
55
- const defaultCombinators = [{
56
- name: "and",
57
- value: "and",
58
- label: "AND"
59
- }, {
60
- name: "or",
61
- value: "or",
62
- label: "OR"
63
- }];
64
- /**
65
- * Default combinator list, with `XOR` added.
66
- *
67
- * @group Defaults
68
- */
69
- const defaultCombinatorsExtended = [...defaultCombinators, {
70
- name: "xor",
71
- value: "xor",
72
- label: "XOR"
73
- }];
74
-
75
- //#endregion
76
- //#region src/utils/arrayUtils.ts
77
- /**
78
- * Splits a string by a given character (see {@link defaultJoinChar}). Escaped characters
79
- * (characters preceded by a backslash) will not apply to the split, and the backslash will
80
- * be removed in the array element. Inverse of {@link joinWith}.
81
- *
82
- * @example
83
- * splitBy('this\\,\\,that,,the other,,,\\,')
84
- * // or
85
- * splitBy('this\\,\\,that,,the other,,,\\,', ',')
86
- * // would return
87
- * ['this,,that', '', 'the other', '', '', ',']
88
- */
89
- const splitBy = (str, splitChar = defaultJoinChar) => typeof str === "string" ? str.split(`\\${splitChar}`).map((c) => c.split(splitChar)).reduce((prev, curr, idx) => {
90
- if (idx === 0) return curr;
91
- return [
92
- ...prev.slice(0, -1),
93
- `${prev.at(-1)}${splitChar}${curr[0]}`,
94
- ...curr.slice(1)
95
- ];
96
- }, []) : [];
97
- /**
98
- * Joins an array of strings using the given character (see {@link defaultJoinChar}). When
99
- * the given character appears in an array element, a backslash will be added just before it
100
- * to distinguish it from the join character. Effectively the inverse of {@link splitBy}.
101
- *
102
- * TIP: The join character can actually be a string of any length. Only the first character
103
- * will be searched for in the array elements and preceded by a backslash.
104
- *
105
- * @example
106
- * joinWith(['this,,that', '', 'the other', '', '', ','], ', ')
107
- * // would return
108
- * 'this\\,\\,that, , the other, , , \\,'
109
- */
110
- const joinWith = (strArr, joinChar = defaultJoinChar) => strArr.map((str) => `${str ?? ""}`.replaceAll(joinChar[0], `\\${joinChar[0]}`)).join(joinChar);
111
- /**
112
- * Trims the value if it is a string. Otherwise returns the value as is.
113
- */
114
- const trimIfString = (val) => typeof val === "string" ? val.trim() : val;
115
- /**
116
- * Splits a string by comma then trims each element. Arrays are returned as is except
117
- * any string elements are trimmed.
118
- */
119
- const toArray = (v, { retainEmptyStrings } = {}) => Array.isArray(v) ? v.map((v$1) => trimIfString(v$1)) : typeof v === "string" ? splitBy(v, defaultJoinChar).filter(retainEmptyStrings ? () => true : (s) => !/^\s*$/.test(s)).map((s) => s.trim()) : typeof v === "number" ? [v] : [];
120
-
121
- //#endregion
122
- Object.defineProperty(exports, 'defaultOperatorNegationMap', {
123
- enumerable: true,
124
- get: function () {
125
- return defaultOperatorNegationMap;
126
- }
127
- });
128
- Object.defineProperty(exports, 'defaultPlaceholderFieldName', {
129
- enumerable: true,
130
- get: function () {
131
- return defaultPlaceholderFieldName;
132
- }
133
- });
134
- Object.defineProperty(exports, 'defaultPlaceholderOperatorName', {
135
- enumerable: true,
136
- get: function () {
137
- return defaultPlaceholderOperatorName;
138
- }
139
- });
140
- Object.defineProperty(exports, 'joinWith', {
141
- enumerable: true,
142
- get: function () {
143
- return joinWith;
144
- }
145
- });
146
- Object.defineProperty(exports, 'splitBy', {
147
- enumerable: true,
148
- get: function () {
149
- return splitBy;
150
- }
151
- });
152
- Object.defineProperty(exports, 'toArray', {
153
- enumerable: true,
154
- get: function () {
155
- return toArray;
156
- }
157
- });
158
- Object.defineProperty(exports, 'trimIfString', {
159
- enumerable: true,
160
- get: function () {
161
- return trimIfString;
162
- }
163
- });
164
- //# sourceMappingURL=arrayUtils-D5EoIsKP.js.map