@react-querybuilder/core 8.13.0 → 8.14.1
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-Cw014pDc.d.mts → basic-BXJVfD0P.d.ts} +77 -59
- package/dist/{basic-_KlsCAyT.d.ts → basic-CNIjb6rI.d.mts} +77 -59
- package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +201 -150
- package/dist/cjs/react-querybuilder_core.cjs.development.js +323 -252
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +201 -150
- 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-DAj92cbM.mjs → convertQuery-B5Qm_6ut.mjs} +30 -22
- package/dist/convertQuery-B5Qm_6ut.mjs.map +1 -0
- package/dist/convertQuery-DfZehtnd.js +94 -0
- package/dist/convertQuery-DfZehtnd.js.map +1 -0
- package/dist/{export-CffjLxEe.d.mts → export-6x7MilFR.d.mts} +2 -3
- package/dist/{export-DRA8O1Wz.d.ts → export-CpJOQuZv.d.ts} +2 -3
- package/dist/formatQuery.d.mts +4 -3
- package/dist/formatQuery.d.ts +4 -3
- package/dist/formatQuery.js +42 -51
- package/dist/formatQuery.js.map +1 -1
- package/dist/formatQuery.mjs +41 -50
- package/dist/formatQuery.mjs.map +1 -1
- package/dist/{import-CWYJkN_w.d.ts → import-B5Iq8XmL.d.ts} +2 -3
- package/dist/{import-DjHGaGhJ.d.mts → import-Bltb2mT4.d.mts} +2 -3
- package/dist/{isRuleGroup-Cjk1Q2mj.js → isRuleGroup-BCwaLzDj.js} +38 -40
- package/dist/isRuleGroup-BCwaLzDj.js.map +1 -0
- package/dist/{isRuleGroup-DztIOOKa.mjs → isRuleGroup-LzP0HCKh.mjs} +2 -4
- package/dist/isRuleGroup-LzP0HCKh.mjs.map +1 -0
- package/dist/parseCEL.d.mts +2 -2
- package/dist/parseCEL.d.ts +2 -2
- package/dist/parseCEL.js +14 -16
- package/dist/parseCEL.js.map +1 -1
- package/dist/parseCEL.mjs +7 -10
- package/dist/parseCEL.mjs.map +1 -1
- package/dist/parseJSONata.d.mts +2 -3
- package/dist/parseJSONata.d.ts +2 -3
- package/dist/parseJSONata.js +37 -5611
- package/dist/parseJSONata.js.map +1 -1
- package/dist/parseJSONata.mjs +11 -14
- package/dist/parseJSONata.mjs.map +1 -1
- package/dist/parseJsonLogic.d.mts +3 -4
- package/dist/parseJsonLogic.d.ts +3 -4
- package/dist/parseJsonLogic.js +20 -21
- package/dist/parseJsonLogic.js.map +1 -1
- package/dist/parseJsonLogic.mjs +19 -21
- package/dist/parseJsonLogic.mjs.map +1 -1
- package/dist/parseMongoDB.d.mts +2 -3
- package/dist/parseMongoDB.d.ts +2 -3
- package/dist/parseMongoDB.js +7 -8
- package/dist/parseMongoDB.js.map +1 -1
- package/dist/parseMongoDB.mjs +6 -8
- package/dist/parseMongoDB.mjs.map +1 -1
- package/dist/parseSQL.d.mts +2 -3
- package/dist/parseSQL.d.ts +2 -3
- package/dist/parseSQL.js +14 -16
- package/dist/parseSQL.js.map +1 -1
- package/dist/parseSQL.mjs +7 -10
- package/dist/parseSQL.mjs.map +1 -1
- package/dist/parseSpEL.d.mts +2 -3
- package/dist/parseSpEL.d.ts +2 -3
- package/dist/parseSpEL.js +11 -2700
- package/dist/parseSpEL.js.map +1 -1
- package/dist/parseSpEL.mjs +7 -9
- package/dist/parseSpEL.mjs.map +1 -1
- package/dist/{prepareQueryObjects-CkN0bTKm.js → prepareQueryObjects-Dc8rqsYM.js} +50 -38
- package/dist/prepareQueryObjects-Dc8rqsYM.js.map +1 -0
- package/dist/{prepareQueryObjects-6Bxx4Bs1.mjs → prepareQueryObjects-tMukQHT9.mjs} +35 -22
- package/dist/prepareQueryObjects-tMukQHT9.mjs.map +1 -0
- package/dist/react-querybuilder_core.d.mts +201 -150
- package/dist/react-querybuilder_core.legacy-esm.d.ts +201 -150
- package/dist/react-querybuilder_core.legacy-esm.js +317 -280
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +312 -248
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +201 -150
- package/dist/react-querybuilder_core.production.mjs +1 -1
- package/dist/react-querybuilder_core.production.mjs.map +1 -1
- package/dist/transformQuery.d.mts +1 -2
- package/dist/transformQuery.d.ts +1 -2
- package/dist/transformQuery.js +44 -3
- package/dist/transformQuery.js.map +1 -0
- package/dist/transformQuery.mjs +43 -3
- package/dist/transformQuery.mjs.map +1 -0
- package/dist/{utils-nQU7WCM9.mjs → utils-DQoYnxpa.mjs} +32 -84
- package/dist/utils-DQoYnxpa.mjs.map +1 -0
- package/dist/{utils-CR1ToTMW.js → utils-EsYRkPtf.js} +182 -246
- package/dist/utils-EsYRkPtf.js.map +1 -0
- package/package.json +29 -21
- package/dist/chunk-U64pC571.js +0 -41
- package/dist/convertQuery-DAj92cbM.mjs.map +0 -1
- package/dist/convertQuery-DRldbzhZ.js +0 -87
- package/dist/convertQuery-DRldbzhZ.js.map +0 -1
- package/dist/isRuleGroup-Cjk1Q2mj.js.map +0 -1
- package/dist/isRuleGroup-DztIOOKa.mjs.map +0 -1
- package/dist/prepareQueryObjects-6Bxx4Bs1.mjs.map +0 -1
- package/dist/prepareQueryObjects-CkN0bTKm.js.map +0 -1
- package/dist/transformQuery-ClBRfnFg.js +0 -54
- package/dist/transformQuery-ClBRfnFg.js.map +0 -1
- package/dist/transformQuery-DUpbpqjX.mjs +0 -48
- package/dist/transformQuery-DUpbpqjX.mjs.map +0 -1
- package/dist/utils-CR1ToTMW.js.map +0 -1
- package/dist/utils-nQU7WCM9.mjs.map +0 -1
|
@@ -11,25 +11,20 @@ import type {UnionToIntersection} from 'type-fest';
|
|
|
11
11
|
type Union = {the(): void} | {great(arg: string): void} | {escape: boolean};
|
|
12
12
|
|
|
13
13
|
type Intersection = UnionToIntersection<Union>;
|
|
14
|
-
//=> {the(): void
|
|
14
|
+
//=> {the(): void} & {great(arg: string): void} & {escape: boolean}
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
@category Type
|
|
18
18
|
*/
|
|
19
|
-
type UnionToIntersection<Union> = (
|
|
20
|
-
// `extends unknown` is always going to be the case and is used to convert the
|
|
19
|
+
type UnionToIntersection<Union> = (// `extends unknown` is always going to be the case and is used to convert the
|
|
21
20
|
// `Union` into a [distributive conditional
|
|
22
21
|
// type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
|
|
23
|
-
Union extends unknown
|
|
24
|
-
// The union type is used as the only argument to a function since the union
|
|
22
|
+
Union extends unknown // The union type is used as the only argument to a function since the union
|
|
25
23
|
// of function arguments is an intersection.
|
|
26
|
-
? (distributedUnion: Union) => void
|
|
27
|
-
//
|
|
28
|
-
: never
|
|
29
|
-
// Infer the `Intersection` type since TypeScript represents the positional
|
|
24
|
+
? (distributedUnion: Union) => void // This won't happen.
|
|
25
|
+
: never // Infer the `Intersection` type since TypeScript represents the positional
|
|
30
26
|
// arguments of unions of functions as an intersection of the union.
|
|
31
|
-
) extends ((mergedIntersection: infer Intersection) => void)
|
|
32
|
-
// The `& Union` is to ensure result of `UnionToIntersection<A | B>` is always assignable to `A | B`
|
|
27
|
+
) extends ((mergedIntersection: infer Intersection) => void) // The `& Union` is to ensure result of `UnionToIntersection<A | B>` is always assignable to `A | B`
|
|
33
28
|
? Intersection & Union : never;
|
|
34
29
|
//#endregion
|
|
35
30
|
//#region ../../node_modules/type-fest/source/keys-of-union.d.ts
|
|
@@ -70,8 +65,7 @@ type AllKeys = KeysOfUnion<Union>;
|
|
|
70
65
|
|
|
71
66
|
@category Object
|
|
72
67
|
*/
|
|
73
|
-
type KeysOfUnion<ObjectType> =
|
|
74
|
-
// Hack to fix https://github.com/sindresorhus/type-fest/issues/1008
|
|
68
|
+
type KeysOfUnion<ObjectType> = // Hack to fix https://github.com/sindresorhus/type-fest/issues/1008
|
|
75
69
|
keyof UnionToIntersection<ObjectType extends unknown ? Record<keyof ObjectType, never> : never>;
|
|
76
70
|
//#endregion
|
|
77
71
|
//#region ../../node_modules/type-fest/source/is-any.d.ts
|
|
@@ -146,7 +140,7 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
|
|
|
146
140
|
@category Type Guard
|
|
147
141
|
@category Utilities
|
|
148
142
|
*/
|
|
149
|
-
type IsOptionalKeyOf<Type extends object, Key
|
|
143
|
+
type IsOptionalKeyOf<Type extends object, Key extends keyof Type> = IsAny<Type | Key> extends true ? never : Key extends keyof Type ? Type extends Record<Key, Type[Key]> ? false : true : false;
|
|
150
144
|
//#endregion
|
|
151
145
|
//#region ../../node_modules/type-fest/source/optional-keys-of.d.ts
|
|
152
146
|
/**
|
|
@@ -261,14 +255,14 @@ type IsTrue<T> = T extends true ? true : false;
|
|
|
261
255
|
|
|
262
256
|
// When a distributive conditional is instantiated with `never`, the entire conditional results in `never`.
|
|
263
257
|
type A = IsTrue<never>;
|
|
264
|
-
|
|
258
|
+
//=> never
|
|
265
259
|
|
|
266
260
|
// If you don't want that behaviour, you can explicitly add an `IsNever` check before the distributive conditional.
|
|
267
261
|
type IsTrueFixed<T> =
|
|
268
262
|
IsNever<T> extends true ? false : T extends true ? true : false;
|
|
269
263
|
|
|
270
264
|
type B = IsTrueFixed<never>;
|
|
271
|
-
|
|
265
|
+
//=> false
|
|
272
266
|
```
|
|
273
267
|
|
|
274
268
|
@category Type Guard
|
|
@@ -399,7 +393,6 @@ type C = IsArray<string>;
|
|
|
399
393
|
type UnknownArray = readonly unknown[];
|
|
400
394
|
//#endregion
|
|
401
395
|
//#region ../../node_modules/type-fest/source/internal/array.d.ts
|
|
402
|
-
|
|
403
396
|
/**
|
|
404
397
|
Returns whether the given array `T` is readonly.
|
|
405
398
|
*/
|
|
@@ -517,7 +510,7 @@ const indexed: Record<string, unknown> = {}; // Allowed
|
|
|
517
510
|
|
|
518
511
|
// @ts-expect-error
|
|
519
512
|
const keyed: Record<'foo', unknown> = {}; // Error
|
|
520
|
-
//
|
|
513
|
+
// TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
|
|
521
514
|
```
|
|
522
515
|
|
|
523
516
|
Instead of causing a type error like the above, you can also use a [conditional type](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) to test whether a type is assignable to another:
|
|
@@ -526,12 +519,16 @@ Instead of causing a type error like the above, you can also use a [conditional
|
|
|
526
519
|
type Indexed = {} extends Record<string, unknown>
|
|
527
520
|
? '✅ `{}` is assignable to `Record<string, unknown>`'
|
|
528
521
|
: '❌ `{}` is NOT assignable to `Record<string, unknown>`';
|
|
529
|
-
|
|
522
|
+
|
|
523
|
+
type IndexedResult = Indexed;
|
|
524
|
+
//=> '✅ `{}` is assignable to `Record<string, unknown>`'
|
|
530
525
|
|
|
531
526
|
type Keyed = {} extends Record<'foo' | 'bar', unknown>
|
|
532
527
|
? '✅ `{}` is assignable to `Record<\'foo\' | \'bar\', unknown>`'
|
|
533
528
|
: '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`';
|
|
534
|
-
|
|
529
|
+
|
|
530
|
+
type KeyedResult = Keyed;
|
|
531
|
+
//=> '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`'
|
|
535
532
|
```
|
|
536
533
|
|
|
537
534
|
Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`...
|
|
@@ -579,7 +576,7 @@ type Example = {
|
|
|
579
576
|
};
|
|
580
577
|
|
|
581
578
|
type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
|
|
582
|
-
|
|
579
|
+
//=> {foo: 'bar'; qux?: 'baz'}
|
|
583
580
|
```
|
|
584
581
|
|
|
585
582
|
@see {@link PickIndexSignature}
|
|
@@ -637,11 +634,35 @@ type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} exten
|
|
|
637
634
|
//#endregion
|
|
638
635
|
//#region ../../node_modules/type-fest/source/merge.d.ts
|
|
639
636
|
// Merges two objects without worrying about index signatures.
|
|
640
|
-
type SimpleMerge<Destination, Source> = { [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source
|
|
641
|
-
|
|
637
|
+
type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source>;
|
|
642
638
|
/**
|
|
643
639
|
Merge two types into a new type. Keys of the second type overrides keys of the first type.
|
|
644
640
|
|
|
641
|
+
This is different from the TypeScript `&` (intersection) operator. With `&`, conflicting property types are intersected, which often results in `never`. For example, `{a: string} & {a: number}` makes `a` become `string & number`, which resolves to `never`. With `Merge`, the second type's keys cleanly override the first, so `Merge<{a: string}, {a: number}>` gives `{a: number}` as expected. `Merge` also produces a flattened type (via `Simplify`), making it more readable in IDE tooltips compared to `A & B`.
|
|
642
|
+
|
|
643
|
+
@example
|
|
644
|
+
```
|
|
645
|
+
import type {Merge} from 'type-fest';
|
|
646
|
+
|
|
647
|
+
type Foo = {
|
|
648
|
+
a: string;
|
|
649
|
+
b: number;
|
|
650
|
+
};
|
|
651
|
+
|
|
652
|
+
type Bar = {
|
|
653
|
+
a: number; // Conflicts with Foo['a']
|
|
654
|
+
c: boolean;
|
|
655
|
+
};
|
|
656
|
+
|
|
657
|
+
// With `&`, `a` becomes `string & number` which is `never`. Not what you want.
|
|
658
|
+
type WithIntersection = (Foo & Bar)['a'];
|
|
659
|
+
//=> never
|
|
660
|
+
|
|
661
|
+
// With `Merge`, `a` is cleanly overridden to `number`.
|
|
662
|
+
type WithMerge = Merge<Foo, Bar>['a'];
|
|
663
|
+
//=> number
|
|
664
|
+
```
|
|
665
|
+
|
|
645
666
|
@example
|
|
646
667
|
```
|
|
647
668
|
import type {Merge} from 'type-fest';
|
|
@@ -661,7 +682,7 @@ type Bar = {
|
|
|
661
682
|
};
|
|
662
683
|
|
|
663
684
|
export type FooBar = Merge<Foo, Bar>;
|
|
664
|
-
|
|
685
|
+
//=> {
|
|
665
686
|
// [x: string]: unknown;
|
|
666
687
|
// [x: number]: number;
|
|
667
688
|
// [x: symbol]: unknown;
|
|
@@ -671,9 +692,17 @@ export type FooBar = Merge<Foo, Bar>;
|
|
|
671
692
|
// }
|
|
672
693
|
```
|
|
673
694
|
|
|
695
|
+
Note: If you want a merge type that more accurately reflects the runtime behavior of object spread or `Object.assign`, refer to the {@link ObjectMerge} type.
|
|
696
|
+
|
|
697
|
+
@see {@link ObjectMerge}
|
|
674
698
|
@category Object
|
|
675
699
|
*/
|
|
676
|
-
type Merge<Destination, Source> =
|
|
700
|
+
type Merge<Destination, Source> = Destination extends unknown // For distributing `Destination`
|
|
701
|
+
? Source extends unknown // For distributing `Source`
|
|
702
|
+
? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>> : never // Should never happen
|
|
703
|
+
: never;
|
|
704
|
+
// Should never happen
|
|
705
|
+
type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
|
|
677
706
|
//#endregion
|
|
678
707
|
//#region ../../node_modules/type-fest/source/internal/object.d.ts
|
|
679
708
|
/**
|
|
@@ -796,7 +825,7 @@ type Filtered = Filter<'bar', 'foo'>;
|
|
|
796
825
|
|
|
797
826
|
@see {Except}
|
|
798
827
|
*/
|
|
799
|
-
type Filter<KeyType
|
|
828
|
+
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
800
829
|
type ExceptOptions = {
|
|
801
830
|
/**
|
|
802
831
|
Disallow assigning non-specified properties.
|
|
@@ -808,7 +837,6 @@ type ExceptOptions = {
|
|
|
808
837
|
type DefaultExceptOptions = {
|
|
809
838
|
requireExactProps: false;
|
|
810
839
|
};
|
|
811
|
-
|
|
812
840
|
/**
|
|
813
841
|
Create a type from an object type without certain keys.
|
|
814
842
|
|
|
@@ -832,14 +860,14 @@ type FooWithoutA = Except<Foo, 'a'>;
|
|
|
832
860
|
|
|
833
861
|
// @ts-expect-error
|
|
834
862
|
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
835
|
-
|
|
863
|
+
// errors: 'a' does not exist in type '{ b: string; }'
|
|
836
864
|
|
|
837
865
|
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
838
|
-
//=> {a: number} & Partial<Record<
|
|
866
|
+
//=> {a: number} & Partial<Record<'b', never>>
|
|
839
867
|
|
|
840
868
|
// @ts-expect-error
|
|
841
869
|
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
842
|
-
|
|
870
|
+
// errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
843
871
|
|
|
844
872
|
// The `Omit` utility type doesn't work when omitting specific keys from objects containing index signatures.
|
|
845
873
|
|
|
@@ -854,12 +882,12 @@ type UserData = {
|
|
|
854
882
|
|
|
855
883
|
// `Omit` clearly doesn't behave as expected in this case:
|
|
856
884
|
type PostPayload = Omit<UserData, 'email'>;
|
|
857
|
-
//=> {
|
|
885
|
+
//=> {[x: string]: string; [x: number]: string}
|
|
858
886
|
|
|
859
887
|
// In situations like this, `Except` works better.
|
|
860
888
|
// It simply removes the `email` key while preserving all the other keys.
|
|
861
889
|
type PostPayloadFixed = Except<UserData, 'email'>;
|
|
862
|
-
//=> {
|
|
890
|
+
//=> {[x: string]: string; name: string; role: 'admin' | 'user'}
|
|
863
891
|
```
|
|
864
892
|
|
|
865
893
|
@category Object
|
|
@@ -884,11 +912,7 @@ type Foo = {
|
|
|
884
912
|
};
|
|
885
913
|
|
|
886
914
|
type SomeRequired = SetRequired<Foo, 'b' | 'c'>;
|
|
887
|
-
|
|
888
|
-
// a?: number;
|
|
889
|
-
// b: string; // Was already required and still is.
|
|
890
|
-
// c: boolean; // Is now required.
|
|
891
|
-
// }
|
|
915
|
+
//=> {a?: number; b: string; c: boolean}
|
|
892
916
|
|
|
893
917
|
// Set specific indices in an array to be required.
|
|
894
918
|
type ArrayExample = SetRequired<[number?, number?, number?], 0 | 1>;
|
|
@@ -898,23 +922,18 @@ type ArrayExample = SetRequired<[number?, number?, number?], 0 | 1>;
|
|
|
898
922
|
@category Object
|
|
899
923
|
*/
|
|
900
924
|
type SetRequired<BaseType, Keys extends keyof BaseType> = (BaseType extends ((...arguments_: never) => any) ? (...arguments_: Parameters<BaseType>) => ReturnType<BaseType> : unknown) & _SetRequired<BaseType, Keys>;
|
|
901
|
-
type _SetRequired<BaseType, Keys extends keyof BaseType> = BaseType extends UnknownArray ? SetArrayRequired<BaseType, Keys> extends infer ResultantArray ? If<IsArrayReadonly<BaseType>, Readonly<ResultantArray>, ResultantArray> : never : Simplify<
|
|
902
|
-
// Pick
|
|
903
|
-
Except<BaseType, Keys> &
|
|
904
|
-
// Pick the keys that should be required from the base type and make them required.
|
|
925
|
+
type _SetRequired<BaseType, Keys extends keyof BaseType> = BaseType extends UnknownArray ? SetArrayRequired<BaseType, Keys> extends infer ResultantArray ? If<IsArrayReadonly<BaseType>, Readonly<ResultantArray>, ResultantArray> : never : Simplify< // Pick just the keys that are optional from the base type.
|
|
926
|
+
Except<BaseType, Keys> & // Pick the keys that should be required from the base type and make them required.
|
|
905
927
|
Required<HomomorphicPick<BaseType, Keys>>>;
|
|
906
|
-
|
|
907
928
|
/**
|
|
908
929
|
Remove the optional modifier from the specified keys in an array.
|
|
909
930
|
*/
|
|
910
931
|
type SetArrayRequired<TArray extends UnknownArray, Keys, Counter extends any[] = [], Accumulator extends UnknownArray = []> = TArray extends unknown // For distributing `TArray` when it's a union
|
|
911
|
-
? keyof TArray & `${number}` extends never
|
|
912
|
-
// Exit if `TArray` is empty (e.g., []), or
|
|
932
|
+
? keyof TArray & `${number}` extends never // Exit if `TArray` is empty (e.g., []), or
|
|
913
933
|
// `TArray` contains no non-rest elements preceding the rest element (e.g., `[...string[]]` or `[...string[], string]`).
|
|
914
934
|
? [...Accumulator, ...TArray] : TArray extends readonly [(infer First)?, ...infer Rest] ? '0' extends OptionalKeysOf<TArray> // If the first element of `TArray` is optional
|
|
915
935
|
? `${Counter['length']}` extends `${Keys & (string | number)}` // If the current index needs to be required
|
|
916
|
-
? SetArrayRequired<Rest, Keys, [...Counter, any], [...Accumulator, First]>
|
|
917
|
-
// If the current element is optional, but it doesn't need to be required,
|
|
936
|
+
? SetArrayRequired<Rest, Keys, [...Counter, any], [...Accumulator, First]> // If the current element is optional, but it doesn't need to be required,
|
|
918
937
|
// then we can exit early, since no further elements can now be made required.
|
|
919
938
|
: [...Accumulator, ...TArray] : SetArrayRequired<Rest, Keys, [...Counter, any], [...Accumulator, TArray[0]]> : never // Should never happen, since `[(infer F)?, ...infer R]` is a top-type for arrays.
|
|
920
939
|
: never; // Should never happen
|
|
@@ -963,7 +982,7 @@ type FlexibleOption<N extends string = string> = Simplify<WithUnknownIndex<Requi
|
|
|
963
982
|
*
|
|
964
983
|
* @group Option Lists
|
|
965
984
|
*/
|
|
966
|
-
type ToFlexibleOption<Opt
|
|
985
|
+
type ToFlexibleOption<Opt extends BaseOption | string> = WithUnknownIndex<RequireAtLeastOne<Opt extends string ? FlexibleOption<Opt> : Opt, "name" | "value">>;
|
|
967
986
|
/**
|
|
968
987
|
* A generic {@link Option} requiring both `name` _and_ `value` properties.
|
|
969
988
|
* Props that extend {@link OptionList} accept {@link BaseOption}, but
|
|
@@ -991,38 +1010,38 @@ type BaseFullOption<N extends string = string> = Simplify<SetRequired<BaseOption
|
|
|
991
1010
|
*
|
|
992
1011
|
* @group Option Lists
|
|
993
1012
|
*/
|
|
994
|
-
type ToFullOption<Opt
|
|
1013
|
+
type ToFullOption<Opt extends BaseOption> = Opt extends BaseFullOption ? Opt : Opt extends BaseOption<infer IdentifierType> ? WithUnknownIndex<Opt & FullOption<IdentifierType>> : never;
|
|
995
1014
|
/**
|
|
996
1015
|
* A group of {@link Option}s, usually within an {@link OptionList}.
|
|
997
1016
|
*
|
|
998
1017
|
* @group Option Lists
|
|
999
1018
|
*/
|
|
1000
|
-
interface OptionGroup<Opt
|
|
1019
|
+
interface OptionGroup<Opt extends BaseOption = FlexibleOption> {
|
|
1001
1020
|
label: string;
|
|
1002
|
-
options: WithUnknownIndex<Opt
|
|
1021
|
+
options: WithUnknownIndex<Opt>[];
|
|
1003
1022
|
}
|
|
1004
1023
|
/**
|
|
1005
1024
|
* A group of {@link BaseOption}s, usually within a {@link FlexibleOptionList}.
|
|
1006
1025
|
*
|
|
1007
1026
|
* @group Option Lists
|
|
1008
1027
|
*/
|
|
1009
|
-
type FlexibleOptionGroup<Opt
|
|
1028
|
+
type FlexibleOptionGroup<Opt extends BaseOption | string = BaseOption> = {
|
|
1010
1029
|
label: string;
|
|
1011
|
-
options: (Opt
|
|
1030
|
+
options: (Opt extends BaseFullOption ? Opt : ToFlexibleOption<Opt>)[];
|
|
1012
1031
|
};
|
|
1013
1032
|
/**
|
|
1014
1033
|
* Either an array of {@link Option}s or an array of {@link OptionGroup}s.
|
|
1015
1034
|
*
|
|
1016
1035
|
* @group Option Lists
|
|
1017
1036
|
*/
|
|
1018
|
-
type OptionList<Opt
|
|
1037
|
+
type OptionList<Opt extends Option = Option> = Opt[] | OptionGroup<Opt>[];
|
|
1019
1038
|
/**
|
|
1020
1039
|
* An array of options or option groups, like {@link OptionList} but the option type
|
|
1021
1040
|
* may use either `name` or `value` as the primary identifier.
|
|
1022
1041
|
*
|
|
1023
1042
|
* @group Option Lists
|
|
1024
1043
|
*/
|
|
1025
|
-
type FlexibleOptionList<Opt
|
|
1044
|
+
type FlexibleOptionList<Opt extends BaseOption> = ToFlexibleOption<Opt>[] | FlexibleOptionGroup<ToFlexibleOption<Opt>>[];
|
|
1026
1045
|
/**
|
|
1027
1046
|
* An array of options or option groups, like {@link OptionList}, but using
|
|
1028
1047
|
* {@link FullOption} instead of {@link Option}. This means that every member is
|
|
@@ -1030,7 +1049,7 @@ type FlexibleOptionList<Opt$1 extends BaseOption> = ToFlexibleOption<Opt$1>[] |
|
|
|
1030
1049
|
*
|
|
1031
1050
|
* @group Option Lists
|
|
1032
1051
|
*/
|
|
1033
|
-
type FullOptionList<Opt
|
|
1052
|
+
type FullOptionList<Opt extends BaseOption> = Opt extends BaseFullOption ? Opt[] | OptionGroup<Opt>[] : ToFullOption<Opt>[] | OptionGroup<ToFullOption<Opt>>[];
|
|
1034
1053
|
//#endregion
|
|
1035
1054
|
//#region src/types/ruleGroups.d.ts
|
|
1036
1055
|
/**
|
|
@@ -1051,10 +1070,10 @@ interface CommonRuleAndGroupProperties {
|
|
|
1051
1070
|
* The main rule type. The `field`, `operator`, and `value` properties
|
|
1052
1071
|
* can be narrowed with generics.
|
|
1053
1072
|
*/
|
|
1054
|
-
interface RuleType<F extends string = string, O extends string = string, V
|
|
1073
|
+
interface RuleType<F extends string = string, O extends string = string, V = any, C extends string = string> extends CommonRuleAndGroupProperties {
|
|
1055
1074
|
field: F;
|
|
1056
1075
|
operator: O;
|
|
1057
|
-
value: V
|
|
1076
|
+
value: V;
|
|
1058
1077
|
valueSource?: ValueSource;
|
|
1059
1078
|
match?: MatchConfig;
|
|
1060
1079
|
/**
|
|
@@ -1271,7 +1290,6 @@ type ParseNumberMethodName = "enhanced" | "native" | "strict";
|
|
|
1271
1290
|
/**
|
|
1272
1291
|
* Parsing algorithms used by {@link parseNumber}.
|
|
1273
1292
|
*/
|
|
1274
|
-
|
|
1275
1293
|
type ParseNumbersModerationLevel = "-limited" | "";
|
|
1276
1294
|
/**
|
|
1277
1295
|
* Options for the `parseNumbers` prop of {@link react-querybuilder!QueryBuilder QueryBuilder}.
|
|
@@ -1279,4 +1297,4 @@ type ParseNumbersModerationLevel = "-limited" | "";
|
|
|
1279
1297
|
type ParseNumbersPropConfig = boolean | `${ParseNumberMethodName}${ParseNumbersModerationLevel}`;
|
|
1280
1298
|
//#endregion
|
|
1281
1299
|
export { Except as C, SetRequired as S, RuleGroupType as _, ValueSource as a, FullOptionList as b, RuleValidator as c, DefaultRuleGroupTypeIC as d, RuleGroupTypeAny as f, DefaultRuleGroupType as g, DefaultOperatorName as h, ParseNumbersPropConfig as i, ValidationMap as l, DefaultCombinatorName as m, FullOperator as n, ValueSources as o, RuleGroupTypeIC as p, InputType as r, QueryValidator as s, FullField as t, ValidationResult as u, RuleType as v, OptionList as x, FlexibleOptionList as y };
|
|
1282
|
-
//# sourceMappingURL=basic-
|
|
1300
|
+
//# sourceMappingURL=basic-BXJVfD0P.d.ts.map
|