@react-querybuilder/core 8.11.1 → 8.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{basic-BeKPP0_1.d.ts → basic-DbvrfPNz.d.mts} +39 -4
- package/dist/{basic-B4vXboTG.d.mts → basic-o1-sYjK6.d.ts} +39 -4
- package/dist/chunk-BxBTb9qk.js +39 -0
- package/dist/chunk-DrjzjjTJ.mjs +23 -0
- package/dist/chunk-Dv2ph0Ay.js +23 -0
- package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +131 -53
- package/dist/cjs/react-querybuilder_core.cjs.development.js +36 -39
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +131 -53
- package/dist/cjs/react-querybuilder_core.cjs.production.js +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.js.map +1 -1
- package/dist/{convertQuery-CqX3rPvj.mjs → convertQuery-Cj4t-LT4.mjs} +2 -2
- package/dist/{convertQuery-CqX3rPvj.mjs.map → convertQuery-Cj4t-LT4.mjs.map} +1 -1
- package/dist/{convertQuery-DAqoID3O.js → convertQuery-DuY_BJHy.js} +3 -3
- package/dist/{convertQuery-DAqoID3O.js.map → convertQuery-DuY_BJHy.js.map} +1 -1
- package/dist/{export-BjRt-qrK.d.mts → export-CCULKoP4.d.mts} +2 -2
- package/dist/{export-CQB0nuvW.d.ts → export-WDHFbiPz.d.ts} +2 -2
- package/dist/formatQuery.d.mts +15 -3
- package/dist/formatQuery.d.ts +15 -3
- package/dist/formatQuery.js +172 -425
- package/dist/formatQuery.js.map +1 -1
- package/dist/formatQuery.mjs +4 -257
- package/dist/formatQuery.mjs.map +1 -1
- package/dist/{import-Dvayhrgj.d.ts → import-BSWb9Vgd.d.ts} +2 -2
- package/dist/{import-Bc_p8ls9.d.mts → import-CLyHpgk8.d.mts} +2 -2
- package/dist/{isRuleGroup-CYcfPgbg.mjs → isRuleGroup-BcfwGaIN.mjs} +1 -1
- package/dist/{isRuleGroup-CYcfPgbg.mjs.map → isRuleGroup-BcfwGaIN.mjs.map} +1 -1
- package/dist/{isRuleGroup-DqAs2x4E.js → isRuleGroup-Do9KKsmt.js} +2 -40
- package/dist/{isRuleGroup-DqAs2x4E.js.map → isRuleGroup-Do9KKsmt.js.map} +1 -1
- package/dist/parseCEL.d.mts +32 -7
- package/dist/parseCEL.d.ts +32 -7
- package/dist/parseCEL.js +181 -12
- package/dist/parseCEL.js.map +1 -1
- package/dist/parseCEL.mjs +174 -8
- package/dist/parseCEL.mjs.map +1 -1
- package/dist/parseJSONata.d.mts +2 -2
- package/dist/parseJSONata.d.ts +2 -2
- package/dist/parseJSONata.js +6 -5
- package/dist/parseJSONata.js.map +1 -1
- package/dist/parseJSONata.mjs +3 -3
- package/dist/parseJsonLogic.d.mts +3 -3
- package/dist/parseJsonLogic.d.ts +3 -3
- package/dist/parseJsonLogic.js +10 -11
- package/dist/parseJsonLogic.js.map +1 -1
- package/dist/parseJsonLogic.mjs +4 -5
- package/dist/parseJsonLogic.mjs.map +1 -1
- package/dist/parseMongoDB.d.mts +2 -2
- package/dist/parseMongoDB.d.ts +2 -2
- package/dist/parseMongoDB.js +20 -21
- package/dist/parseMongoDB.js.map +1 -1
- package/dist/parseMongoDB.mjs +4 -5
- package/dist/parseMongoDB.mjs.map +1 -1
- package/dist/parseSQL.d.mts +2 -2
- package/dist/parseSQL.d.ts +2 -2
- package/dist/parseSQL.js +10 -13
- package/dist/parseSQL.js.map +1 -1
- package/dist/parseSQL.mjs +3 -5
- package/dist/parseSQL.mjs.map +1 -1
- package/dist/parseSpEL.d.mts +2 -2
- package/dist/parseSpEL.d.ts +2 -2
- package/dist/parseSpEL.js +7 -7
- package/dist/parseSpEL.js.map +1 -1
- package/dist/parseSpEL.mjs +3 -4
- package/dist/parseSpEL.mjs.map +1 -1
- package/dist/{prepareQueryObjects-DPCC-iHp.mjs → prepareQueryObjects-BfnyRV5t.mjs} +4 -3
- package/dist/{prepareQueryObjects-DPCC-iHp.mjs.map → prepareQueryObjects-BfnyRV5t.mjs.map} +1 -1
- package/dist/{prepareQueryObjects-BOUWfel5.js → prepareQueryObjects-DCtJJrF5.js} +14 -13
- package/dist/prepareQueryObjects-DCtJJrF5.js.map +1 -0
- package/dist/react-querybuilder_core.d.mts +131 -53
- package/dist/react-querybuilder_core.legacy-esm.d.ts +131 -53
- package/dist/react-querybuilder_core.legacy-esm.js +43 -21
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +36 -14
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +131 -53
- package/dist/react-querybuilder_core.production.mjs +1 -1
- package/dist/react-querybuilder_core.production.mjs.map +1 -1
- package/dist/{transformQuery-DCCpjtyq.mjs → transformQuery-Bq4iyYsE.mjs} +9 -2
- package/dist/{transformQuery-DCCpjtyq.mjs.map → transformQuery-Bq4iyYsE.mjs.map} +1 -1
- package/dist/{transformQuery-CWDPogO5.js → transformQuery-DvJTAvkh.js} +10 -3
- package/dist/{transformQuery-CWDPogO5.js.map → transformQuery-DvJTAvkh.js.map} +1 -1
- package/dist/transformQuery.d.mts +1 -1
- package/dist/transformQuery.d.ts +1 -1
- package/dist/transformQuery.js +2 -2
- package/dist/transformQuery.mjs +2 -2
- package/dist/utils-CoYbYnVo.js +706 -0
- package/dist/utils-CoYbYnVo.js.map +1 -0
- package/dist/utils-DxH23QtE.mjs +514 -0
- package/dist/utils-DxH23QtE.mjs.map +1 -0
- package/package.json +15 -15
- package/dist/arrayUtils-A_OXU9W1.mjs +0 -50
- package/dist/arrayUtils-A_OXU9W1.mjs.map +0 -1
- package/dist/arrayUtils-QxZOZTf6.js +0 -73
- package/dist/arrayUtils-QxZOZTf6.js.map +0 -1
- package/dist/optGroupUtils-B0hTpodo.js +0 -251
- package/dist/optGroupUtils-B0hTpodo.js.map +0 -1
- package/dist/optGroupUtils-VeZ3k7-1.mjs +0 -185
- package/dist/optGroupUtils-VeZ3k7-1.mjs.map +0 -1
- package/dist/parseNumber-CXdMVNFx.mjs +0 -24
- package/dist/parseNumber-CXdMVNFx.mjs.map +0 -1
- package/dist/parseNumber-D4iQDxK-.js +0 -31
- package/dist/parseNumber-D4iQDxK-.js.map +0 -1
- package/dist/prepareQueryObjects-BOUWfel5.js.map +0 -1
|
@@ -143,7 +143,7 @@ const anyA = get(anyObject, 'a');
|
|
|
143
143
|
@category Type Guard
|
|
144
144
|
@category Utilities
|
|
145
145
|
*/
|
|
146
|
-
type IsAny<T
|
|
146
|
+
type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
|
|
147
147
|
//#endregion
|
|
148
148
|
//#region ../../node_modules/type-fest/source/is-optional-key-of.d.ts
|
|
149
149
|
/**
|
|
@@ -186,7 +186,7 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
|
|
|
186
186
|
@category Type Guard
|
|
187
187
|
@category Utilities
|
|
188
188
|
*/
|
|
189
|
-
type IsOptionalKeyOf<Type
|
|
189
|
+
type IsOptionalKeyOf<Type extends object, Key$1 extends keyof Type> = IsAny<Type | Key$1> extends true ? never : Key$1 extends keyof Type ? Type extends Record<Key$1, Type[Key$1]> ? false : true : false;
|
|
190
190
|
//#endregion
|
|
191
191
|
//#region ../../node_modules/type-fest/source/optional-keys-of.d.ts
|
|
192
192
|
/**
|
|
@@ -222,8 +222,8 @@ const update2: UpdateOperation<User> = {
|
|
|
222
222
|
|
|
223
223
|
@category Utilities
|
|
224
224
|
*/
|
|
225
|
-
type OptionalKeysOf<Type
|
|
226
|
-
? (keyof { [Key in keyof Type
|
|
225
|
+
type OptionalKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
|
|
226
|
+
? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
|
|
227
227
|
: never;
|
|
228
228
|
//#endregion
|
|
229
229
|
//#region ../../node_modules/type-fest/source/required-keys-of.d.ts
|
|
@@ -251,8 +251,8 @@ const validator2 = createValidation<User>('surname', value => value.length < 25)
|
|
|
251
251
|
|
|
252
252
|
@category Utilities
|
|
253
253
|
*/
|
|
254
|
-
type RequiredKeysOf<Type
|
|
255
|
-
? Exclude<keyof Type
|
|
254
|
+
type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
|
|
255
|
+
? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
|
|
256
256
|
//#endregion
|
|
257
257
|
//#region ../../node_modules/type-fest/source/is-never.d.ts
|
|
258
258
|
/**
|
|
@@ -296,7 +296,7 @@ endIfEqual('abc', '123');
|
|
|
296
296
|
@category Type Guard
|
|
297
297
|
@category Utilities
|
|
298
298
|
*/
|
|
299
|
-
type IsNever<T
|
|
299
|
+
type IsNever<T> = [T] extends [never] ? true : false;
|
|
300
300
|
//#endregion
|
|
301
301
|
//#region ../../node_modules/type-fest/source/if.d.ts
|
|
302
302
|
/**
|
|
@@ -353,10 +353,45 @@ type B = IfEqual<string, number, 'equal', 'not equal'>;
|
|
|
353
353
|
//=> 'not equal'
|
|
354
354
|
```
|
|
355
355
|
|
|
356
|
+
Note: Sometimes using the `If` type can make an implementation non–tail-recursive, which can impact performance. In such cases, it’s better to use a conditional directly. Refer to the following example:
|
|
357
|
+
|
|
358
|
+
@example
|
|
359
|
+
```
|
|
360
|
+
import type {If, IsEqual, StringRepeat} from 'type-fest';
|
|
361
|
+
|
|
362
|
+
type HundredZeroes = StringRepeat<'0', 100>;
|
|
363
|
+
|
|
364
|
+
// The following implementation is not tail recursive
|
|
365
|
+
type Includes<S extends string, Char extends string> =
|
|
366
|
+
S extends `${infer First}${infer Rest}`
|
|
367
|
+
? If<IsEqual<First, Char>,
|
|
368
|
+
'found',
|
|
369
|
+
Includes<Rest, Char>>
|
|
370
|
+
: 'not found';
|
|
371
|
+
|
|
372
|
+
// Hence, instantiations with long strings will fail
|
|
373
|
+
// @ts-expect-error
|
|
374
|
+
type Fails = Includes<HundredZeroes, '1'>;
|
|
375
|
+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
376
|
+
// Error: Type instantiation is excessively deep and possibly infinite.
|
|
377
|
+
|
|
378
|
+
// However, if we use a simple conditional instead of `If`, the implementation becomes tail-recursive
|
|
379
|
+
type IncludesWithoutIf<S extends string, Char extends string> =
|
|
380
|
+
S extends `${infer First}${infer Rest}`
|
|
381
|
+
? IsEqual<First, Char> extends true
|
|
382
|
+
? 'found'
|
|
383
|
+
: IncludesWithoutIf<Rest, Char>
|
|
384
|
+
: 'not found';
|
|
385
|
+
|
|
386
|
+
// Now, instantiations with long strings will work
|
|
387
|
+
type Works = IncludesWithoutIf<HundredZeroes, '1'>;
|
|
388
|
+
//=> 'not found'
|
|
389
|
+
```
|
|
390
|
+
|
|
356
391
|
@category Type Guard
|
|
357
392
|
@category Utilities
|
|
358
393
|
*/
|
|
359
|
-
type If<Type
|
|
394
|
+
type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
|
|
360
395
|
//#endregion
|
|
361
396
|
//#region ../../node_modules/type-fest/source/unknown-array.d.ts
|
|
362
397
|
/**
|
|
@@ -398,7 +433,7 @@ Needed to handle the case of a single call signature with properties.
|
|
|
398
433
|
Multiple call signatures cannot currently be supported due to a TypeScript limitation.
|
|
399
434
|
@see https://github.com/microsoft/TypeScript/issues/29732
|
|
400
435
|
*/
|
|
401
|
-
type HasMultipleCallSignatures<T
|
|
436
|
+
type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> = T extends {
|
|
402
437
|
(...arguments_: infer A): unknown;
|
|
403
438
|
(...arguments_: infer B): unknown;
|
|
404
439
|
} ? B extends A ? A extends B ? false : true : true : false;
|
|
@@ -419,14 +454,40 @@ type B = IfNotAnyOrNever<any, 'VALID', 'IS_ANY', 'IS_NEVER'>;
|
|
|
419
454
|
type C = IfNotAnyOrNever<never, 'VALID', 'IS_ANY', 'IS_NEVER'>;
|
|
420
455
|
//=> 'IS_NEVER'
|
|
421
456
|
```
|
|
457
|
+
|
|
458
|
+
Note: Wrapping a tail-recursive type with `IfNotAnyOrNever` makes the implementation non-tail-recursive. To fix this, move the recursion into a helper type. Refer to the following example:
|
|
459
|
+
|
|
460
|
+
@example
|
|
461
|
+
```ts
|
|
462
|
+
import type {StringRepeat} from 'type-fest';
|
|
463
|
+
|
|
464
|
+
type NineHundredNinetyNineSpaces = StringRepeat<' ', 999>;
|
|
465
|
+
|
|
466
|
+
// The following implementation is not tail recursive
|
|
467
|
+
type TrimLeft<S extends string> = IfNotAnyOrNever<S, S extends ` ${infer R}` ? TrimLeft<R> : S>;
|
|
468
|
+
|
|
469
|
+
// Hence, instantiations with long strings will fail
|
|
470
|
+
// @ts-expect-error
|
|
471
|
+
type T1 = TrimLeft<NineHundredNinetyNineSpaces>;
|
|
472
|
+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
473
|
+
// Error: Type instantiation is excessively deep and possibly infinite.
|
|
474
|
+
|
|
475
|
+
// To fix this, move the recursion into a helper type
|
|
476
|
+
type TrimLeftOptimised<S extends string> = IfNotAnyOrNever<S, _TrimLeftOptimised<S>>;
|
|
477
|
+
|
|
478
|
+
type _TrimLeftOptimised<S extends string> = S extends ` ${infer R}` ? _TrimLeftOptimised<R> : S;
|
|
479
|
+
|
|
480
|
+
type T2 = TrimLeftOptimised<NineHundredNinetyNineSpaces>;
|
|
481
|
+
//=> ''
|
|
482
|
+
```
|
|
422
483
|
*/
|
|
423
|
-
type IfNotAnyOrNever<T
|
|
484
|
+
type IfNotAnyOrNever<T, IfNotAnyOrNever$1, IfAny = any, IfNever = never> = If<IsAny<T>, IfAny, If<IsNever<T>, IfNever, IfNotAnyOrNever$1>>;
|
|
424
485
|
//#endregion
|
|
425
486
|
//#region ../../node_modules/type-fest/source/internal/array.d.ts
|
|
426
487
|
/**
|
|
427
488
|
Returns whether the given array `T` is readonly.
|
|
428
489
|
*/
|
|
429
|
-
type IsArrayReadonly<T
|
|
490
|
+
type IsArrayReadonly<T extends UnknownArray> = If<IsNever<T>, false, T extends unknown[] ? false : true>;
|
|
430
491
|
//#endregion
|
|
431
492
|
//#region ../../node_modules/type-fest/source/simplify.d.ts
|
|
432
493
|
/**
|
|
@@ -483,10 +544,10 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
|
|
|
483
544
|
```
|
|
484
545
|
|
|
485
546
|
@link https://github.com/microsoft/TypeScript/issues/15300
|
|
486
|
-
@see SimplifyDeep
|
|
547
|
+
@see {@link SimplifyDeep}
|
|
487
548
|
@category Object
|
|
488
549
|
*/
|
|
489
|
-
type Simplify<T
|
|
550
|
+
type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
|
|
490
551
|
//#endregion
|
|
491
552
|
//#region ../../node_modules/type-fest/source/is-equal.d.ts
|
|
492
553
|
/**
|
|
@@ -607,7 +668,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
|
|
|
607
668
|
// => { foo: 'bar'; qux?: 'baz' | undefined; }
|
|
608
669
|
```
|
|
609
670
|
|
|
610
|
-
@see PickIndexSignature
|
|
671
|
+
@see {@link PickIndexSignature}
|
|
611
672
|
@category Object
|
|
612
673
|
*/
|
|
613
674
|
type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
|
|
@@ -655,7 +716,7 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
|
|
|
655
716
|
// }
|
|
656
717
|
```
|
|
657
718
|
|
|
658
|
-
@see OmitIndexSignature
|
|
719
|
+
@see {@link OmitIndexSignature}
|
|
659
720
|
@category Object
|
|
660
721
|
*/
|
|
661
722
|
type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
|
|
@@ -738,7 +799,7 @@ type Any = HomomorphicPick<{a: 1; b: 2} | {c: 3}, any>;
|
|
|
738
799
|
type IndexSignature = HomomorphicPick<{[k: string]: unknown}, number>;
|
|
739
800
|
//=> {}
|
|
740
801
|
*/
|
|
741
|
-
type HomomorphicPick<T
|
|
802
|
+
type HomomorphicPick<T, Keys extends KeysOfUnion<T>> = { [P in keyof T as Extract<P, Keys>]: T[P] };
|
|
742
803
|
/**
|
|
743
804
|
Merges user specified options with default options.
|
|
744
805
|
|
|
@@ -964,7 +1025,7 @@ Note that types containing overloaded functions are not made deeply required due
|
|
|
964
1025
|
@category Set
|
|
965
1026
|
@category Map
|
|
966
1027
|
*/
|
|
967
|
-
type RequiredDeep<T
|
|
1028
|
+
type RequiredDeep<T> = T extends BuiltIns ? T : T extends Map<infer KeyType, infer ValueType> ? Map<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : T extends Set<infer ItemType> ? Set<RequiredDeep<ItemType>> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? ReadonlyMap<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : T extends ReadonlySet<infer ItemType> ? ReadonlySet<RequiredDeep<ItemType>> : T extends WeakMap<infer KeyType, infer ValueType> ? WeakMap<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : T extends WeakSet<infer ItemType> ? WeakSet<RequiredDeep<ItemType>> : T extends Promise<infer ValueType> ? Promise<RequiredDeep<ValueType>> : T extends ((...arguments_: any[]) => unknown) ? IsNever<keyof T> extends true ? T : HasMultipleCallSignatures<T> extends true ? T : ((...arguments_: Parameters<T>) => ReturnType<T>) & RequiredObjectDeep<T> : T extends object ? RequiredObjectDeep<T> : unknown;
|
|
968
1029
|
type RequiredObjectDeep<ObjectType extends object> = { [KeyType in keyof ObjectType]-?: RequiredDeep<ObjectType[KeyType]> };
|
|
969
1030
|
//#endregion
|
|
970
1031
|
//#region ../../node_modules/type-fest/source/set-optional.d.ts
|
|
@@ -1062,7 +1123,7 @@ type StringUnionToFullOptionArray<Op extends string> = Array<Op extends unknown
|
|
|
1062
1123
|
*
|
|
1063
1124
|
* @group Option Lists
|
|
1064
1125
|
*/
|
|
1065
|
-
type GetOptionType<OL
|
|
1126
|
+
type GetOptionType<OL extends FlexibleOptionList<FullOption>> = OL extends FlexibleOptionList<infer Opt> ? Opt : never;
|
|
1066
1127
|
/**
|
|
1067
1128
|
* Extracts the type of the identifying property from a {@link Option},
|
|
1068
1129
|
* {@link ValueOption}, or {@link FullOption}.
|
|
@@ -1073,7 +1134,7 @@ type GetOptionIdentifierType<Opt$1 extends BaseOption> = Opt$1 extends Option<in
|
|
|
1073
1134
|
/**
|
|
1074
1135
|
* Adds an `unknown` index property to an interface.
|
|
1075
1136
|
*/
|
|
1076
|
-
type WithUnknownIndex<T
|
|
1137
|
+
type WithUnknownIndex<T> = T & {
|
|
1077
1138
|
[key: string]: unknown;
|
|
1078
1139
|
};
|
|
1079
1140
|
/**
|
|
@@ -1238,9 +1299,9 @@ interface CommonRuleAndGroupProperties {
|
|
|
1238
1299
|
* The main rule type. The `field`, `operator`, and `value` properties
|
|
1239
1300
|
* can be narrowed with generics.
|
|
1240
1301
|
*/
|
|
1241
|
-
interface RuleType<F
|
|
1242
|
-
field: F
|
|
1243
|
-
operator: O
|
|
1302
|
+
interface RuleType<F extends string = string, O extends string = string, V$1 = any, C extends string = string> extends CommonRuleAndGroupProperties {
|
|
1303
|
+
field: F;
|
|
1304
|
+
operator: O;
|
|
1244
1305
|
value: V$1;
|
|
1245
1306
|
valueSource?: ValueSource;
|
|
1246
1307
|
match?: MatchConfig;
|
|
@@ -1253,15 +1314,15 @@ interface RuleType<F$1 extends string = string, O$1 extends string = string, V$1
|
|
|
1253
1314
|
* The main rule group type. This type is used for query definitions as well as
|
|
1254
1315
|
* all sub-groups of queries.
|
|
1255
1316
|
*/
|
|
1256
|
-
interface RuleGroupType<R
|
|
1317
|
+
interface RuleGroupType<R extends RuleType = RuleType, C extends string = string> extends CommonRuleAndGroupProperties {
|
|
1257
1318
|
combinator: C;
|
|
1258
|
-
rules: RuleGroupArray<RuleGroupType<R
|
|
1319
|
+
rules: RuleGroupArray<RuleGroupType<R, C>, R>;
|
|
1259
1320
|
not?: boolean;
|
|
1260
1321
|
}
|
|
1261
1322
|
/**
|
|
1262
1323
|
* The type of the `rules` array in a {@link RuleGroupType}.
|
|
1263
1324
|
*/
|
|
1264
|
-
type RuleGroupArray<RG
|
|
1325
|
+
type RuleGroupArray<RG extends RuleGroupType = RuleGroupType, R extends RuleType = RuleType> = (R | RG)[];
|
|
1265
1326
|
/**
|
|
1266
1327
|
* All updateable properties of rules and groups (everything except
|
|
1267
1328
|
* `id`, `path`, and `rules`).
|
|
@@ -1270,18 +1331,18 @@ type UpdateableProperties = Exclude<keyof (RuleType & RuleGroupType), "id" | "pa
|
|
|
1270
1331
|
/**
|
|
1271
1332
|
* The type of the `rules` array in a {@link DefaultRuleGroupType}.
|
|
1272
1333
|
*/
|
|
1273
|
-
type DefaultRuleGroupArray<F
|
|
1334
|
+
type DefaultRuleGroupArray<F extends string = string> = RuleGroupArray<DefaultRuleGroupType, DefaultRuleType<F>>;
|
|
1274
1335
|
/**
|
|
1275
1336
|
* {@link RuleGroupType} with the `combinator` property limited to
|
|
1276
1337
|
* {@link DefaultCombinatorNameExtended} and `rules` limited to {@link DefaultRuleType}.
|
|
1277
1338
|
*/
|
|
1278
|
-
type DefaultRuleGroupType<F
|
|
1279
|
-
rules: DefaultRuleGroupArray<F
|
|
1339
|
+
type DefaultRuleGroupType<F extends string = string> = RuleGroupType<DefaultRuleType<F>, DefaultCombinatorNameExtended> & {
|
|
1340
|
+
rules: DefaultRuleGroupArray<F>;
|
|
1280
1341
|
};
|
|
1281
1342
|
/**
|
|
1282
1343
|
* {@link RuleType} with the `operator` property limited to {@link DefaultOperatorName}.
|
|
1283
1344
|
*/
|
|
1284
|
-
type DefaultRuleType<F
|
|
1345
|
+
type DefaultRuleType<F extends string = string> = RuleType<F, DefaultOperatorName>;
|
|
1285
1346
|
/**
|
|
1286
1347
|
* Default allowed values for the `combinator` property.
|
|
1287
1348
|
*
|
|
@@ -1328,9 +1389,9 @@ type MappedTuple<Tuple extends Array<unknown>, Result extends Array<unknown> = [
|
|
|
1328
1389
|
* The main rule group interface when using independent combinators. This type is used
|
|
1329
1390
|
* for query definitions as well as all sub-groups of queries.
|
|
1330
1391
|
*/
|
|
1331
|
-
interface RuleGroupTypeIC<R
|
|
1392
|
+
interface RuleGroupTypeIC<R extends RuleType = RuleType, C extends string = string> extends Except<RuleGroupType<R, C>, "combinator" | "rules"> {
|
|
1332
1393
|
combinator?: undefined;
|
|
1333
|
-
rules: RuleGroupICArray<RuleGroupTypeIC<R
|
|
1394
|
+
rules: RuleGroupICArray<RuleGroupTypeIC<R, C>, R, C>;
|
|
1334
1395
|
/**
|
|
1335
1396
|
* Only used when adding a rule to a query that uses independent combinators
|
|
1336
1397
|
*/
|
|
@@ -1339,11 +1400,11 @@ interface RuleGroupTypeIC<R$1 extends RuleType = RuleType, C extends string = st
|
|
|
1339
1400
|
/**
|
|
1340
1401
|
* Shorthand for "either {@link RuleGroupType} or {@link RuleGroupTypeIC}".
|
|
1341
1402
|
*/
|
|
1342
|
-
type RuleGroupTypeAny<R
|
|
1403
|
+
type RuleGroupTypeAny<R extends RuleType = RuleType, C extends string = string> = RuleGroupType<R, C> | RuleGroupTypeIC<R, C>;
|
|
1343
1404
|
/**
|
|
1344
1405
|
* The type of the `rules` array in a {@link RuleGroupTypeIC}.
|
|
1345
1406
|
*/
|
|
1346
|
-
type RuleGroupICArray<RG
|
|
1407
|
+
type RuleGroupICArray<RG extends RuleGroupTypeIC = RuleGroupTypeIC, R extends RuleType = RuleType, C extends string = string> = [R | RG] | [R | RG, ...MappedTuple<[C, R | RG]>] | ((R | RG)[] & {
|
|
1347
1408
|
length: 0;
|
|
1348
1409
|
});
|
|
1349
1410
|
/**
|
|
@@ -1353,27 +1414,27 @@ type RuleOrGroupArray = RuleGroupArray | RuleGroupICArray;
|
|
|
1353
1414
|
/**
|
|
1354
1415
|
* The type of the `rules` array in a {@link DefaultRuleGroupTypeIC}.
|
|
1355
1416
|
*/
|
|
1356
|
-
type DefaultRuleGroupICArray<F
|
|
1417
|
+
type DefaultRuleGroupICArray<F extends string = string> = RuleGroupICArray<DefaultRuleGroupTypeIC<F>, DefaultRuleType<F>, DefaultCombinatorName>;
|
|
1357
1418
|
/**
|
|
1358
1419
|
* Shorthand for "either {@link DefaultRuleGroupArray} or {@link DefaultRuleGroupICArray}".
|
|
1359
1420
|
*/
|
|
1360
|
-
type DefaultRuleOrGroupArray<F
|
|
1421
|
+
type DefaultRuleOrGroupArray<F extends string = string> = DefaultRuleGroupArray<F> | DefaultRuleGroupICArray<F>;
|
|
1361
1422
|
/**
|
|
1362
1423
|
* {@link RuleGroupTypeIC} with combinators limited to
|
|
1363
1424
|
* {@link DefaultCombinatorName} and rules limited to {@link DefaultRuleType}.
|
|
1364
1425
|
*/
|
|
1365
|
-
interface DefaultRuleGroupTypeIC<F
|
|
1366
|
-
rules: DefaultRuleGroupICArray<F
|
|
1426
|
+
interface DefaultRuleGroupTypeIC<F extends string = string> extends RuleGroupTypeIC<DefaultRuleType<F>> {
|
|
1427
|
+
rules: DefaultRuleGroupICArray<F>;
|
|
1367
1428
|
}
|
|
1368
1429
|
/**
|
|
1369
1430
|
* Shorthand for "either {@link DefaultRuleGroupType} or {@link DefaultRuleGroupTypeIC}".
|
|
1370
1431
|
*/
|
|
1371
|
-
type DefaultRuleGroupTypeAny<F
|
|
1432
|
+
type DefaultRuleGroupTypeAny<F extends string = string> = DefaultRuleGroupType<F> | DefaultRuleGroupTypeIC<F>;
|
|
1372
1433
|
/**
|
|
1373
1434
|
* Determines if a type extending {@link RuleGroupTypeAny} is actually
|
|
1374
1435
|
* {@link RuleGroupType} or {@link RuleGroupTypeIC}.
|
|
1375
1436
|
*/
|
|
1376
|
-
type GetRuleGroupType<RG
|
|
1437
|
+
type GetRuleGroupType<RG> = RG extends {
|
|
1377
1438
|
combinator: string;
|
|
1378
1439
|
} ? RuleGroupType : RuleGroupTypeIC;
|
|
1379
1440
|
/**
|
|
@@ -1384,11 +1445,11 @@ type GetRuleGroupType<RG$1> = RG$1 extends {
|
|
|
1384
1445
|
* the rule type has its field and operator types narrowed to the
|
|
1385
1446
|
* identifier types of the provided Field and Operator types.
|
|
1386
1447
|
*/
|
|
1387
|
-
type GetRuleTypeFromGroupWithFieldAndOperator<RG
|
|
1448
|
+
type GetRuleTypeFromGroupWithFieldAndOperator<RG extends RuleGroupTypeAny, F extends BaseOption, O extends BaseOption> = RG extends RuleGroupType<infer RT> | RuleGroupTypeIC<infer RT> ? RT extends RuleType<infer RuleFieldName, infer RuleOperatorName, infer RuleValueName, infer RuleCombinatorName> ? RuleFieldName extends GetOptionIdentifierType<F> ? RuleOperatorName extends GetOptionIdentifierType<O> ? RuleType<RuleFieldName, RuleOperatorName, RuleValueName, RuleCombinatorName> : RuleType<RuleFieldName, GetOptionIdentifierType<O>, RuleValueName, RuleCombinatorName> : RuleOperatorName extends GetOptionIdentifierType<O> ? RuleType<GetOptionIdentifierType<F>, RuleOperatorName, RuleValueName, RuleCombinatorName> : RuleType<GetOptionIdentifierType<F>, GetOptionIdentifierType<O>, RuleValueName, RuleCombinatorName> : never : never;
|
|
1388
1449
|
/**
|
|
1389
1450
|
* Converts a narrowed rule group type to its most generic form.
|
|
1390
1451
|
*/
|
|
1391
|
-
type GenericizeRuleGroupType<RG
|
|
1452
|
+
type GenericizeRuleGroupType<RG> = RG extends RuleGroupType ? RuleGroupType : RuleGroupTypeIC;
|
|
1392
1453
|
//#endregion
|
|
1393
1454
|
//#region src/types/validation.d.ts
|
|
1394
1455
|
/**
|
|
@@ -1444,7 +1505,7 @@ type ToOptionArrays<Sources extends readonly string[]> = Sources extends unknown
|
|
|
1444
1505
|
label: string;
|
|
1445
1506
|
} } : never;
|
|
1446
1507
|
type ToFlexibleOptionArrays<Sources extends readonly string[]> = Sources extends unknown ? { [K in keyof Sources]: FlexibleOption<Sources[K]> } : never;
|
|
1447
|
-
type WithOptionalClassName<T
|
|
1508
|
+
type WithOptionalClassName<T> = T & {
|
|
1448
1509
|
className?: Classname;
|
|
1449
1510
|
};
|
|
1450
1511
|
/**
|
|
@@ -1528,11 +1589,11 @@ type FieldByValue<FieldName extends string = string, OperatorName extends string
|
|
|
1528
1589
|
/**
|
|
1529
1590
|
* Utility type to make one or more properties required.
|
|
1530
1591
|
*/
|
|
1531
|
-
type WithRequired<T
|
|
1592
|
+
type WithRequired<T, K$1 extends keyof T> = T & { [P in K$1]-?: T[P] };
|
|
1532
1593
|
/**
|
|
1533
1594
|
* Utility type to make all properties non-nullable.
|
|
1534
1595
|
*/
|
|
1535
|
-
type RemoveNullability<T
|
|
1596
|
+
type RemoveNullability<T extends Record<string, unknown>> = { [k in keyof T]: NonNullable<T[k]> };
|
|
1536
1597
|
/**
|
|
1537
1598
|
* Allowed values of the {@link FullOperator} property `arity`. A value of `"unary"` or
|
|
1538
1599
|
* a number less than two will cause the default {@link react-querybuilder!ValueEditor ValueEditor} to render `null`.
|
|
@@ -2288,9 +2349,13 @@ interface Classnames {
|
|
|
2288
2349
|
*/
|
|
2289
2350
|
branches: Classname;
|
|
2290
2351
|
/**
|
|
2291
|
-
* Classname(s) rules that render a subquery.
|
|
2352
|
+
* Classname(s) applied to rules that render a subquery.
|
|
2292
2353
|
*/
|
|
2293
2354
|
hasSubQuery: Classname;
|
|
2355
|
+
/**
|
|
2356
|
+
* Classname(s) applied to async components in their "loading" state.
|
|
2357
|
+
*/
|
|
2358
|
+
loading: Classname;
|
|
2294
2359
|
}
|
|
2295
2360
|
/**
|
|
2296
2361
|
* Placeholder strings for option lists.
|
|
@@ -2653,6 +2718,7 @@ declare const standardClassnames: {
|
|
|
2653
2718
|
readonly branches: "queryBuilder-branches";
|
|
2654
2719
|
readonly justified: "queryBuilder-justified";
|
|
2655
2720
|
readonly hasSubQuery: "rule-hasSubQuery";
|
|
2721
|
+
readonly loading: "queryBuilder-loading";
|
|
2656
2722
|
};
|
|
2657
2723
|
/**
|
|
2658
2724
|
* Default classnames for each component.
|
|
@@ -3441,7 +3507,19 @@ type ProcessedMatchMode = {
|
|
|
3441
3507
|
mode: "exactly";
|
|
3442
3508
|
threshold: number;
|
|
3443
3509
|
};
|
|
3444
|
-
|
|
3510
|
+
/**
|
|
3511
|
+
* Transforms
|
|
3512
|
+
* - `match: { mode: "atLeast", threshold: 1 }` to `match: { mode: "some" }`
|
|
3513
|
+
* - `match: { mode: "atMost", threshold: 0 }` to `match: { mode: "none" }`.
|
|
3514
|
+
*
|
|
3515
|
+
* Returns:
|
|
3516
|
+
* - Processed `{ mode, threshold }` object for valid subqueries
|
|
3517
|
+
* - `null` if match mode is not applicable for the rule
|
|
3518
|
+
* - `false` if match mode is valid, but either
|
|
3519
|
+
* 1. `threshold` is required and invalid, or
|
|
3520
|
+
* 2. `value` is not a valid rule group.
|
|
3521
|
+
*/
|
|
3522
|
+
declare const processMatchMode: (rule: RuleType) => null | false | ProcessedMatchMode;
|
|
3445
3523
|
/**
|
|
3446
3524
|
* "Replacer" method for JSON.stringify's second argument. Converts `bigint` values to
|
|
3447
3525
|
* objects with a `$bigint` property having a value of a string representation of
|
|
@@ -3630,7 +3708,7 @@ declare const nullOrUndefinedOrEmpty: (value: unknown) => value is null | undefi
|
|
|
3630
3708
|
* type ObjectKeys<T extends object> = `${Exclude<keyof T, symbol>}`;
|
|
3631
3709
|
* ```
|
|
3632
3710
|
*/
|
|
3633
|
-
type ObjectKeys<T
|
|
3711
|
+
type ObjectKeys<T extends object> = Exclude<keyof T, symbol>;
|
|
3634
3712
|
/**
|
|
3635
3713
|
* A strongly-typed version of `Object.keys()`.
|
|
3636
3714
|
*
|
|
@@ -3764,14 +3842,14 @@ declare const uniqOptGroups: <T extends BaseOption>(originalArray: FlexibleOptio
|
|
|
3764
3842
|
* @group Option Lists
|
|
3765
3843
|
*/
|
|
3766
3844
|
declare const uniqOptList: <T extends BaseOption>(originalArray: FlexibleOptionList<T>) => WithUnknownIndex<BaseOption & FullOption>[] | OptionGroup<ToFullOption<T>>[];
|
|
3767
|
-
interface PreparedOptionList<O
|
|
3845
|
+
interface PreparedOptionList<O extends FullOption> {
|
|
3768
3846
|
defaultOption: FullOption;
|
|
3769
|
-
optionList:
|
|
3847
|
+
optionList: FullOptionList<O>;
|
|
3770
3848
|
optionsMap: Partial<FullOptionRecord<FullOption>>;
|
|
3771
3849
|
}
|
|
3772
|
-
interface PrepareOptionListParams<O
|
|
3850
|
+
interface PrepareOptionListParams<O extends FullOption> {
|
|
3773
3851
|
placeholder?: Placeholder;
|
|
3774
|
-
optionList?: FlexibleOptionListProp<O
|
|
3852
|
+
optionList?: FlexibleOptionListProp<O> | BaseOptionMap<O>;
|
|
3775
3853
|
baseOption?: Record<string, unknown>;
|
|
3776
3854
|
labelMap?: Record<string, string>;
|
|
3777
3855
|
autoSelectOption?: boolean;
|
|
@@ -4124,7 +4202,7 @@ declare const regenerateIDs: <RG>(subject: RG, {
|
|
|
4124
4202
|
/**
|
|
4125
4203
|
* Options object for {@link index!transformQuery transformQuery}.
|
|
4126
4204
|
*/
|
|
4127
|
-
interface TransformQueryOptions<RG
|
|
4205
|
+
interface TransformQueryOptions<RG extends RuleGroupTypeAny = RuleGroupType> {
|
|
4128
4206
|
/**
|
|
4129
4207
|
* When a rule is encountered in the hierarchy, it will be replaced
|
|
4130
4208
|
* with the result of this function.
|
|
@@ -4138,7 +4216,7 @@ interface TransformQueryOptions<RG$1 extends RuleGroupTypeAny = RuleGroupType> {
|
|
|
4138
4216
|
*
|
|
4139
4217
|
* @defaultValue `rg => rg`
|
|
4140
4218
|
*/
|
|
4141
|
-
ruleGroupProcessor?: (ruleGroup: RG
|
|
4219
|
+
ruleGroupProcessor?: (ruleGroup: RG) => Record<string, any>;
|
|
4142
4220
|
/**
|
|
4143
4221
|
* For each rule and group in the query, any properties matching a key
|
|
4144
4222
|
* in this object will be renamed to the corresponding value. To retain both
|
|
@@ -1,30 +1,5 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
-
key = keys[i];
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
-
get: ((k) => from[k]).bind(null, key),
|
|
13
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
-
value: mod,
|
|
20
|
-
enumerable: true
|
|
21
|
-
}) : target, mod));
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
1
|
let immer = require("immer");
|
|
25
|
-
immer = __toESM(immer);
|
|
26
2
|
let numeric_quantity = require("numeric-quantity");
|
|
27
|
-
numeric_quantity = __toESM(numeric_quantity);
|
|
28
3
|
|
|
29
4
|
//#region src/defaults.ts
|
|
30
5
|
/**
|
|
@@ -449,7 +424,8 @@ const standardClassnames = {
|
|
|
449
424
|
valueListItem: "rule-value-list-item",
|
|
450
425
|
branches: "queryBuilder-branches",
|
|
451
426
|
justified: "queryBuilder-justified",
|
|
452
|
-
hasSubQuery: "rule-hasSubQuery"
|
|
427
|
+
hasSubQuery: "rule-hasSubQuery",
|
|
428
|
+
loading: "queryBuilder-loading"
|
|
453
429
|
};
|
|
454
430
|
/**
|
|
455
431
|
* Default classnames for each component.
|
|
@@ -496,7 +472,8 @@ const defaultControlClassnames = {
|
|
|
496
472
|
disabled: "",
|
|
497
473
|
valueListItem: "",
|
|
498
474
|
branches: "",
|
|
499
|
-
hasSubQuery: ""
|
|
475
|
+
hasSubQuery: "",
|
|
476
|
+
loading: ""
|
|
500
477
|
};
|
|
501
478
|
/**
|
|
502
479
|
* Default reason codes for a group being invalid.
|
|
@@ -1028,7 +1005,7 @@ const prepareOptionList = (props) => {
|
|
|
1028
1005
|
label: placeholderLabel
|
|
1029
1006
|
};
|
|
1030
1007
|
const optionsProp = optionListPropOriginal ?? [defaultOption];
|
|
1031
|
-
let optionList
|
|
1008
|
+
let optionList;
|
|
1032
1009
|
const opts = Array.isArray(optionsProp) ? toFullOptionList(optionsProp, baseOption, labelMap) : objectKeys(toFullOptionMap(optionsProp, baseOption)).map((opt) => ({
|
|
1033
1010
|
...optionsProp[opt],
|
|
1034
1011
|
name: opt,
|
|
@@ -1113,6 +1090,13 @@ const parseNumber = (val, { parseNumbers, bigIntOnOverflow } = {}) => {
|
|
|
1113
1090
|
|
|
1114
1091
|
//#endregion
|
|
1115
1092
|
//#region src/utils/transformQuery.ts
|
|
1093
|
+
/**
|
|
1094
|
+
* Recursively steps through a query object ({@link index!RuleGroupType RuleGroupType} or {@link index!RuleGroupTypeIC RuleGroupTypeIC}),
|
|
1095
|
+
* passing each {@link index!RuleType RuleType} object to a provided `ruleProcessor` function and returning a
|
|
1096
|
+
* new query object if there were any referential changes.
|
|
1097
|
+
*
|
|
1098
|
+
* @module transformQuery
|
|
1099
|
+
*/
|
|
1116
1100
|
const remapProperties = (obj, propertyMap, deleteRemappedProperties) => (0, immer.produce)(obj, (draft) => {
|
|
1117
1101
|
for (const [k, v] of Object.entries(propertyMap)) if (v === false) delete draft[k];
|
|
1118
1102
|
else if (!!v && k !== v && k in draft) {
|
|
@@ -1389,18 +1373,29 @@ const translationMatchFilter = (key, keyToTest, conditions) => keyToTest.startsW
|
|
|
1389
1373
|
* @group Export
|
|
1390
1374
|
*/
|
|
1391
1375
|
const getNLTranslataion = (key, translations, conditions = []) => conditions.length === 0 ? translations[key] ?? defaultNLTranslations[key] ?? "" : Object.entries(translations).find(([keyToTest]) => translationMatchFilter(key, keyToTest, conditions))?.[1] ?? Object.entries(defaultNLTranslations).find(([keyToTest]) => translationMatchFilter(key, keyToTest, conditions))?.[1] ?? defaultNLTranslations[key] ?? "";
|
|
1376
|
+
/**
|
|
1377
|
+
* Transforms
|
|
1378
|
+
* - `match: { mode: "atLeast", threshold: 1 }` to `match: { mode: "some" }`
|
|
1379
|
+
* - `match: { mode: "atMost", threshold: 0 }` to `match: { mode: "none" }`.
|
|
1380
|
+
*
|
|
1381
|
+
* Returns:
|
|
1382
|
+
* - Processed `{ mode, threshold }` object for valid subqueries
|
|
1383
|
+
* - `null` if match mode is not applicable for the rule
|
|
1384
|
+
* - `false` if match mode is valid, but either
|
|
1385
|
+
* 1. `threshold` is required and invalid, or
|
|
1386
|
+
* 2. `value` is not a valid rule group.
|
|
1387
|
+
*/
|
|
1392
1388
|
const processMatchMode = (rule) => {
|
|
1393
1389
|
const { mode, threshold } = rule.match ?? {};
|
|
1394
|
-
if (mode)
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
}
|
|
1390
|
+
if (!mode) return null;
|
|
1391
|
+
if (!isRuleGroup(rule.value)) return false;
|
|
1392
|
+
const matchModeLC = lc(mode);
|
|
1393
|
+
const matchModeCoerced = matchModeLC === "atleast" && threshold === 1 ? "some" : matchModeLC === "atmost" && threshold === 0 ? "none" : matchModeLC;
|
|
1394
|
+
if ((matchModeCoerced === "atleast" || matchModeCoerced === "atmost" || matchModeCoerced === "exactly") && (typeof threshold !== "number" || threshold < 0)) return false;
|
|
1395
|
+
return {
|
|
1396
|
+
mode: matchModeCoerced,
|
|
1397
|
+
threshold
|
|
1398
|
+
};
|
|
1404
1399
|
};
|
|
1405
1400
|
/**
|
|
1406
1401
|
* "Replacer" method for JSON.stringify's second argument. Converts `bigint` values to
|
|
@@ -3902,7 +3897,8 @@ const mergeClassnames = (...args) => ({
|
|
|
3902
3897
|
matchMode: joinClassnamesByName("matchMode", args),
|
|
3903
3898
|
matchThreshold: joinClassnamesByName("matchThreshold", args),
|
|
3904
3899
|
branches: joinClassnamesByName("branches", args),
|
|
3905
|
-
hasSubQuery: joinClassnamesByName("hasSubQuery", args)
|
|
3900
|
+
hasSubQuery: joinClassnamesByName("hasSubQuery", args),
|
|
3901
|
+
loading: joinClassnamesByName("loading", args)
|
|
3906
3902
|
});
|
|
3907
3903
|
|
|
3908
3904
|
//#endregion
|
|
@@ -3935,6 +3931,7 @@ const preferFlagProps = (props = {}, contextVals = {}, finalize) => objectEntrie
|
|
|
3935
3931
|
*/
|
|
3936
3932
|
const prepareRule = (rule, { idGenerator = generateID } = {}) => (0, immer.produce)(rule, (draft) => {
|
|
3937
3933
|
if (!draft.id) draft.id = idGenerator();
|
|
3934
|
+
if (processMatchMode(draft)) draft.value = prepareRuleGroup(draft.value, { idGenerator });
|
|
3938
3935
|
});
|
|
3939
3936
|
/**
|
|
3940
3937
|
* Ensures that a rule group is valid by recursively adding an `id` property to the group itself
|