@react-querybuilder/antd 8.12.0 → 8.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/react-querybuilder_antd.cjs.development.d.ts +113 -112
- package/dist/cjs/react-querybuilder_antd.cjs.development.js +34 -32
- package/dist/cjs/react-querybuilder_antd.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_antd.cjs.production.d.ts +113 -112
- package/dist/cjs/react-querybuilder_antd.cjs.production.js +1 -1
- package/dist/cjs/react-querybuilder_antd.cjs.production.js.map +1 -1
- package/dist/react-querybuilder_antd.d.mts +113 -112
- package/dist/react-querybuilder_antd.legacy-esm.d.ts +113 -112
- package/dist/react-querybuilder_antd.legacy-esm.js +15 -37
- package/dist/react-querybuilder_antd.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_antd.mjs +13 -35
- package/dist/react-querybuilder_antd.mjs.map +1 -1
- package/dist/react-querybuilder_antd.production.d.mts +113 -112
- package/dist/react-querybuilder_antd.production.mjs +1 -1
- package/dist/react-querybuilder_antd.production.mjs.map +1 -1
- package/package.json +12 -12
|
@@ -20,34 +20,6 @@ type Intersection = UnionToIntersection<Union>;
|
|
|
20
20
|
//=> {the(): void; great(arg: string): void; escape: boolean};
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
A more applicable example which could make its way into your library code follows.
|
|
24
|
-
|
|
25
|
-
@example
|
|
26
|
-
```
|
|
27
|
-
import type {UnionToIntersection} from 'type-fest';
|
|
28
|
-
|
|
29
|
-
class CommandOne {
|
|
30
|
-
commands: {
|
|
31
|
-
a1: () => undefined,
|
|
32
|
-
b1: () => undefined,
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
class CommandTwo {
|
|
37
|
-
commands: {
|
|
38
|
-
a2: (argA: string) => undefined,
|
|
39
|
-
b2: (argB: string) => undefined,
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const union = [new CommandOne(), new CommandTwo()].map(instance => instance.commands);
|
|
44
|
-
type Union = typeof union;
|
|
45
|
-
//=> {a1(): void; b1(): void} | {a2(argA: string): void; b2(argB: string): void}
|
|
46
|
-
|
|
47
|
-
type Intersection = UnionToIntersection<Union>;
|
|
48
|
-
//=> {a1(): void; b1(): void; a2(argA: string): void; b2(argB: string): void}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
23
|
@category Type
|
|
52
24
|
*/
|
|
53
25
|
type UnionToIntersection<Union> = (
|
|
@@ -123,8 +95,8 @@ import type {IsAny} from 'type-fest';
|
|
|
123
95
|
const typedObject = {a: 1, b: 2} as const;
|
|
124
96
|
const anyObject: any = {a: 1, b: 2};
|
|
125
97
|
|
|
126
|
-
function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(
|
|
127
|
-
return
|
|
98
|
+
function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(object: O, key: K) {
|
|
99
|
+
return object[key];
|
|
128
100
|
}
|
|
129
101
|
|
|
130
102
|
const typedA = get(typedObject, 'a');
|
|
@@ -149,17 +121,17 @@ This is useful when writing utility types or schema validators that need to diff
|
|
|
149
121
|
```
|
|
150
122
|
import type {IsOptionalKeyOf} from 'type-fest';
|
|
151
123
|
|
|
152
|
-
|
|
124
|
+
type User = {
|
|
153
125
|
name: string;
|
|
154
126
|
surname: string;
|
|
155
127
|
|
|
156
128
|
luckyNumber?: number;
|
|
157
|
-
}
|
|
129
|
+
};
|
|
158
130
|
|
|
159
|
-
|
|
131
|
+
type Admin = {
|
|
160
132
|
name: string;
|
|
161
133
|
surname?: string;
|
|
162
|
-
}
|
|
134
|
+
};
|
|
163
135
|
|
|
164
136
|
type T1 = IsOptionalKeyOf<User, 'luckyNumber'>;
|
|
165
137
|
//=> true
|
|
@@ -192,12 +164,12 @@ This is useful when you want to create a new type that contains different type v
|
|
|
192
164
|
```
|
|
193
165
|
import type {OptionalKeysOf, Except} from 'type-fest';
|
|
194
166
|
|
|
195
|
-
|
|
167
|
+
type User = {
|
|
196
168
|
name: string;
|
|
197
169
|
surname: string;
|
|
198
170
|
|
|
199
171
|
luckyNumber?: number;
|
|
200
|
-
}
|
|
172
|
+
};
|
|
201
173
|
|
|
202
174
|
const REMOVE_FIELD = Symbol('remove field symbol');
|
|
203
175
|
type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKeysOf<Entity>> & {
|
|
@@ -205,12 +177,12 @@ type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKe
|
|
|
205
177
|
};
|
|
206
178
|
|
|
207
179
|
const update1: UpdateOperation<User> = {
|
|
208
|
-
name: 'Alice'
|
|
180
|
+
name: 'Alice',
|
|
209
181
|
};
|
|
210
182
|
|
|
211
183
|
const update2: UpdateOperation<User> = {
|
|
212
184
|
name: 'Bob',
|
|
213
|
-
luckyNumber: REMOVE_FIELD
|
|
185
|
+
luckyNumber: REMOVE_FIELD,
|
|
214
186
|
};
|
|
215
187
|
```
|
|
216
188
|
|
|
@@ -230,17 +202,23 @@ This is useful when you want to create a new type that contains different type v
|
|
|
230
202
|
```
|
|
231
203
|
import type {RequiredKeysOf} from 'type-fest';
|
|
232
204
|
|
|
233
|
-
declare function createValidation<
|
|
205
|
+
declare function createValidation<
|
|
206
|
+
Entity extends object,
|
|
207
|
+
Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>,
|
|
208
|
+
>(field: Key, validator: (value: Entity[Key]) => boolean): (entity: Entity) => boolean;
|
|
234
209
|
|
|
235
|
-
|
|
210
|
+
type User = {
|
|
236
211
|
name: string;
|
|
237
212
|
surname: string;
|
|
238
|
-
|
|
239
213
|
luckyNumber?: number;
|
|
240
|
-
}
|
|
214
|
+
};
|
|
241
215
|
|
|
242
216
|
const validator1 = createValidation<User>('name', value => value.length < 25);
|
|
243
217
|
const validator2 = createValidation<User>('surname', value => value.length < 25);
|
|
218
|
+
|
|
219
|
+
// @ts-expect-error
|
|
220
|
+
const validator3 = createValidation<User>('luckyNumber', value => value > 0);
|
|
221
|
+
// Error: Argument of type '"luckyNumber"' is not assignable to parameter of type '"name" | "surname"'.
|
|
244
222
|
```
|
|
245
223
|
|
|
246
224
|
@category Utilities
|
|
@@ -262,29 +240,41 @@ Useful in type utilities, such as checking if something does not occur.
|
|
|
262
240
|
```
|
|
263
241
|
import type {IsNever, And} from 'type-fest';
|
|
264
242
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
And<
|
|
268
|
-
IsNever<Exclude<A, B>> extends true ? true : false,
|
|
269
|
-
IsNever<Exclude<B, A>> extends true ? true : false
|
|
270
|
-
>;
|
|
271
|
-
|
|
272
|
-
type EndIfEqual<I extends string, O extends string> =
|
|
273
|
-
AreStringsEqual<I, O> extends true
|
|
274
|
-
? never
|
|
275
|
-
: void;
|
|
276
|
-
|
|
277
|
-
function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
|
|
278
|
-
if (input === output) {
|
|
279
|
-
process.exit(0);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
243
|
+
type A = IsNever<never>;
|
|
244
|
+
//=> true
|
|
282
245
|
|
|
283
|
-
|
|
284
|
-
//=>
|
|
246
|
+
type B = IsNever<any>;
|
|
247
|
+
//=> false
|
|
248
|
+
|
|
249
|
+
type C = IsNever<unknown>;
|
|
250
|
+
//=> false
|
|
251
|
+
|
|
252
|
+
type D = IsNever<never[]>;
|
|
253
|
+
//=> false
|
|
254
|
+
|
|
255
|
+
type E = IsNever<object>;
|
|
256
|
+
//=> false
|
|
257
|
+
|
|
258
|
+
type F = IsNever<string>;
|
|
259
|
+
//=> false
|
|
260
|
+
```
|
|
285
261
|
|
|
286
|
-
|
|
287
|
-
|
|
262
|
+
@example
|
|
263
|
+
```
|
|
264
|
+
import type {IsNever} from 'type-fest';
|
|
265
|
+
|
|
266
|
+
type IsTrue<T> = T extends true ? true : false;
|
|
267
|
+
|
|
268
|
+
// When a distributive conditional is instantiated with `never`, the entire conditional results in `never`.
|
|
269
|
+
type A = IsTrue<never>;
|
|
270
|
+
// ^? type A = never
|
|
271
|
+
|
|
272
|
+
// If you don't want that behaviour, you can explicitly add an `IsNever` check before the distributive conditional.
|
|
273
|
+
type IsTrueFixed<T> =
|
|
274
|
+
IsNever<T> extends true ? false : T extends true ? true : false;
|
|
275
|
+
|
|
276
|
+
type B = IsTrueFixed<never>;
|
|
277
|
+
// ^? type B = false
|
|
288
278
|
```
|
|
289
279
|
|
|
290
280
|
@category Type Guard
|
|
@@ -305,7 +295,7 @@ Note:
|
|
|
305
295
|
|
|
306
296
|
@example
|
|
307
297
|
```
|
|
308
|
-
import {If} from 'type-fest';
|
|
298
|
+
import type {If} from 'type-fest';
|
|
309
299
|
|
|
310
300
|
type A = If<true, 'yes', 'no'>;
|
|
311
301
|
//=> 'yes'
|
|
@@ -325,7 +315,7 @@ type E = If<never, 'yes', 'no'>;
|
|
|
325
315
|
|
|
326
316
|
@example
|
|
327
317
|
```
|
|
328
|
-
import {If, IsAny, IsNever} from 'type-fest';
|
|
318
|
+
import type {If, IsAny, IsNever} from 'type-fest';
|
|
329
319
|
|
|
330
320
|
type A = If<IsAny<unknown>, 'is any', 'not any'>;
|
|
331
321
|
//=> 'not any'
|
|
@@ -336,7 +326,7 @@ type B = If<IsNever<never>, 'is never', 'not never'>;
|
|
|
336
326
|
|
|
337
327
|
@example
|
|
338
328
|
```
|
|
339
|
-
import {If, IsEqual} from 'type-fest';
|
|
329
|
+
import type {If, IsEqual} from 'type-fest';
|
|
340
330
|
|
|
341
331
|
type IfEqual<T, U, IfBranch, ElseBranch> = If<IsEqual<T, U>, IfBranch, ElseBranch>;
|
|
342
332
|
|
|
@@ -466,10 +456,11 @@ const literal = {foo: 123, bar: 'hello', baz: 456};
|
|
|
466
456
|
const someType: SomeType = literal;
|
|
467
457
|
const someInterface: SomeInterface = literal;
|
|
468
458
|
|
|
469
|
-
function fn(object: Record<string, unknown>): void
|
|
459
|
+
declare function fn(object: Record<string, unknown>): void;
|
|
470
460
|
|
|
471
461
|
fn(literal); // Good: literal object type is sealed
|
|
472
462
|
fn(someType); // Good: type is sealed
|
|
463
|
+
// @ts-expect-error
|
|
473
464
|
fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
|
|
474
465
|
fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
|
|
475
466
|
```
|
|
@@ -507,7 +498,7 @@ type Includes<Value extends readonly any[], Item> =
|
|
|
507
498
|
@category Type Guard
|
|
508
499
|
@category Utilities
|
|
509
500
|
*/
|
|
510
|
-
type IsEqual<A, B> = [A
|
|
501
|
+
type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false : false;
|
|
511
502
|
// This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
|
|
512
503
|
type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
|
|
513
504
|
//#endregion
|
|
@@ -529,6 +520,7 @@ It relies on the fact that an empty object (`{}`) is assignable to an object wit
|
|
|
529
520
|
```
|
|
530
521
|
const indexed: Record<string, unknown> = {}; // Allowed
|
|
531
522
|
|
|
523
|
+
// @ts-expect-error
|
|
532
524
|
const keyed: Record<'foo', unknown> = {}; // Error
|
|
533
525
|
// => TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
|
|
534
526
|
```
|
|
@@ -542,16 +534,14 @@ type Indexed = {} extends Record<string, unknown>
|
|
|
542
534
|
// => '✅ `{}` is assignable to `Record<string, unknown>`'
|
|
543
535
|
|
|
544
536
|
type Keyed = {} extends Record<'foo' | 'bar', unknown>
|
|
545
|
-
?
|
|
546
|
-
:
|
|
537
|
+
? '✅ `{}` is assignable to `Record<\'foo\' | \'bar\', unknown>`'
|
|
538
|
+
: '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`';
|
|
547
539
|
// => "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`"
|
|
548
540
|
```
|
|
549
541
|
|
|
550
542
|
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`...
|
|
551
543
|
|
|
552
544
|
```
|
|
553
|
-
import type {OmitIndexSignature} from 'type-fest';
|
|
554
|
-
|
|
555
545
|
type OmitIndexSignature<ObjectType> = {
|
|
556
546
|
[KeyType in keyof ObjectType // Map each key of `ObjectType`...
|
|
557
547
|
]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
|
|
@@ -561,14 +551,12 @@ type OmitIndexSignature<ObjectType> = {
|
|
|
561
551
|
...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
|
|
562
552
|
|
|
563
553
|
```
|
|
564
|
-
import type {OmitIndexSignature} from 'type-fest';
|
|
565
|
-
|
|
566
554
|
type OmitIndexSignature<ObjectType> = {
|
|
567
555
|
[KeyType in keyof ObjectType
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
556
|
+
// Is `{}` assignable to `Record<KeyType, unknown>`?
|
|
557
|
+
as {} extends Record<KeyType, unknown>
|
|
558
|
+
? never // ✅ `{}` is assignable to `Record<KeyType, unknown>`
|
|
559
|
+
: KeyType // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
|
|
572
560
|
]: ObjectType[KeyType];
|
|
573
561
|
};
|
|
574
562
|
```
|
|
@@ -579,21 +567,21 @@ If `{}` is assignable, it means that `KeyType` is an index signature and we want
|
|
|
579
567
|
```
|
|
580
568
|
import type {OmitIndexSignature} from 'type-fest';
|
|
581
569
|
|
|
582
|
-
|
|
570
|
+
type Example = {
|
|
583
571
|
// These index signatures will be removed.
|
|
584
|
-
[x: string]: any
|
|
585
|
-
[x: number]: any
|
|
586
|
-
[x: symbol]: any
|
|
587
|
-
[x: `head-${string}`]: string
|
|
588
|
-
[x: `${string}-tail`]: string
|
|
589
|
-
[x: `head-${string}-tail`]: string
|
|
590
|
-
[x: `${bigint}`]: string
|
|
591
|
-
[x: `embedded-${number}`]: string
|
|
572
|
+
[x: string]: any;
|
|
573
|
+
[x: number]: any;
|
|
574
|
+
[x: symbol]: any;
|
|
575
|
+
[x: `head-${string}`]: string;
|
|
576
|
+
[x: `${string}-tail`]: string;
|
|
577
|
+
[x: `head-${string}-tail`]: string;
|
|
578
|
+
[x: `${bigint}`]: string;
|
|
579
|
+
[x: `embedded-${number}`]: string;
|
|
592
580
|
|
|
593
581
|
// These explicitly defined keys will remain.
|
|
594
582
|
foo: 'bar';
|
|
595
583
|
qux?: 'baz';
|
|
596
|
-
}
|
|
584
|
+
};
|
|
597
585
|
|
|
598
586
|
type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
|
|
599
587
|
// => { foo: 'bar'; qux?: 'baz' | undefined; }
|
|
@@ -663,12 +651,12 @@ Merge two types into a new type. Keys of the second type overrides keys of the f
|
|
|
663
651
|
```
|
|
664
652
|
import type {Merge} from 'type-fest';
|
|
665
653
|
|
|
666
|
-
|
|
654
|
+
type Foo = {
|
|
667
655
|
[x: string]: unknown;
|
|
668
656
|
[x: number]: unknown;
|
|
669
657
|
foo: string;
|
|
670
658
|
bar: symbol;
|
|
671
|
-
}
|
|
659
|
+
};
|
|
672
660
|
|
|
673
661
|
type Bar = {
|
|
674
662
|
[x: number]: number;
|
|
@@ -847,12 +835,14 @@ type Foo = {
|
|
|
847
835
|
type FooWithoutA = Except<Foo, 'a'>;
|
|
848
836
|
//=> {b: string}
|
|
849
837
|
|
|
838
|
+
// @ts-expect-error
|
|
850
839
|
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
851
840
|
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
852
841
|
|
|
853
842
|
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
854
843
|
//=> {a: number} & Partial<Record<"b", never>>
|
|
855
844
|
|
|
845
|
+
// @ts-expect-error
|
|
856
846
|
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
857
847
|
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
858
848
|
|
|
@@ -869,12 +859,12 @@ type UserData = {
|
|
|
869
859
|
|
|
870
860
|
// `Omit` clearly doesn't behave as expected in this case:
|
|
871
861
|
type PostPayload = Omit<UserData, 'email'>;
|
|
872
|
-
//=>
|
|
862
|
+
//=> { [x: string]: string; [x: number]: string; }
|
|
873
863
|
|
|
874
864
|
// In situations like this, `Except` works better.
|
|
875
865
|
// It simply removes the `email` key while preserving all the other keys.
|
|
876
|
-
type
|
|
877
|
-
//=>
|
|
866
|
+
type PostPayloadFixed = Except<UserData, 'email'>;
|
|
867
|
+
//=> { [x: string]: string; name: string; role: 'admin' | 'user'; }
|
|
878
868
|
```
|
|
879
869
|
|
|
880
870
|
@category Object
|
|
@@ -896,7 +886,7 @@ type Foo = {
|
|
|
896
886
|
a?: number;
|
|
897
887
|
b: string;
|
|
898
888
|
c?: boolean;
|
|
899
|
-
}
|
|
889
|
+
};
|
|
900
890
|
|
|
901
891
|
type SomeRequired = SetRequired<Foo, 'b' | 'c'>;
|
|
902
892
|
// type SomeRequired = {
|
|
@@ -950,7 +940,7 @@ type Foo = {
|
|
|
950
940
|
a: number | null;
|
|
951
941
|
b: string | undefined;
|
|
952
942
|
c?: boolean | null;
|
|
953
|
-
}
|
|
943
|
+
};
|
|
954
944
|
|
|
955
945
|
type SomeNonNullable = SetNonNullable<Foo, 'b' | 'c'>;
|
|
956
946
|
// type SomeNonNullable = {
|
|
@@ -980,7 +970,7 @@ type StringUnionToFullOptionArray<Op extends string> = Array<Op extends unknown
|
|
|
980
970
|
*
|
|
981
971
|
* @group Option Lists
|
|
982
972
|
*/
|
|
983
|
-
type GetOptionIdentifierType<Opt
|
|
973
|
+
type GetOptionIdentifierType<Opt extends BaseOption> = Opt extends Option<infer NameType> | ValueOption<infer NameType> ? NameType : string;
|
|
984
974
|
/**
|
|
985
975
|
* Adds an `unknown` index property to an interface.
|
|
986
976
|
*/
|
|
@@ -1029,7 +1019,7 @@ type FlexibleOption<N extends string = string> = Simplify<WithUnknownIndex<Requi
|
|
|
1029
1019
|
*
|
|
1030
1020
|
* @group Option Lists
|
|
1031
1021
|
*/
|
|
1032
|
-
type ToFlexibleOption<Opt
|
|
1022
|
+
type ToFlexibleOption<Opt extends BaseOption | string> = WithUnknownIndex<RequireAtLeastOne<Opt extends string ? FlexibleOption<Opt> : Opt, "name" | "value">>;
|
|
1033
1023
|
/**
|
|
1034
1024
|
* A generic {@link Option} requiring both `name` _and_ `value` properties.
|
|
1035
1025
|
* Props that extend {@link OptionList} accept {@link BaseOption}, but
|
|
@@ -1057,45 +1047,45 @@ type BaseFullOption<N extends string = string> = Simplify<SetRequired<BaseOption
|
|
|
1057
1047
|
*
|
|
1058
1048
|
* @group Option Lists
|
|
1059
1049
|
*/
|
|
1060
|
-
type ToFullOption<Opt
|
|
1050
|
+
type ToFullOption<Opt extends BaseOption> = Opt extends BaseFullOption ? Opt : Opt extends BaseOption<infer IdentifierType> ? WithUnknownIndex<Opt & FullOption<IdentifierType>> : never;
|
|
1061
1051
|
/**
|
|
1062
1052
|
* A group of {@link Option}s, usually within an {@link OptionList}.
|
|
1063
1053
|
*
|
|
1064
1054
|
* @group Option Lists
|
|
1065
1055
|
*/
|
|
1066
|
-
interface OptionGroup<Opt
|
|
1056
|
+
interface OptionGroup<Opt extends BaseOption = FlexibleOption> {
|
|
1067
1057
|
label: string;
|
|
1068
|
-
options: WithUnknownIndex<Opt
|
|
1058
|
+
options: WithUnknownIndex<Opt>[];
|
|
1069
1059
|
}
|
|
1070
1060
|
/**
|
|
1071
1061
|
* A group of {@link BaseOption}s, usually within a {@link FlexibleOptionList}.
|
|
1072
1062
|
*
|
|
1073
1063
|
* @group Option Lists
|
|
1074
1064
|
*/
|
|
1075
|
-
type FlexibleOptionGroup<Opt
|
|
1065
|
+
type FlexibleOptionGroup<Opt extends BaseOption | string = BaseOption> = {
|
|
1076
1066
|
label: string;
|
|
1077
|
-
options: (Opt
|
|
1067
|
+
options: (Opt extends BaseFullOption ? Opt : ToFlexibleOption<Opt>)[];
|
|
1078
1068
|
};
|
|
1079
1069
|
/**
|
|
1080
1070
|
* Either an array of {@link Option}s or an array of {@link OptionGroup}s.
|
|
1081
1071
|
*
|
|
1082
1072
|
* @group Option Lists
|
|
1083
1073
|
*/
|
|
1084
|
-
type OptionList<Opt
|
|
1074
|
+
type OptionList<Opt extends Option = Option> = Opt[] | OptionGroup<Opt>[];
|
|
1085
1075
|
/**
|
|
1086
1076
|
* An array of options or option groups, like {@link OptionList} but the option type
|
|
1087
1077
|
* may use either `name` or `value` as the primary identifier.
|
|
1088
1078
|
*
|
|
1089
1079
|
* @group Option Lists
|
|
1090
1080
|
*/
|
|
1091
|
-
type FlexibleOptionList<Opt
|
|
1081
|
+
type FlexibleOptionList<Opt extends BaseOption> = ToFlexibleOption<Opt>[] | FlexibleOptionGroup<ToFlexibleOption<Opt>>[];
|
|
1092
1082
|
/**
|
|
1093
1083
|
* An array of options or option groups, like {@link OptionList} but the option type
|
|
1094
1084
|
* may use either `name` or `value` as the primary identifier.
|
|
1095
1085
|
*
|
|
1096
1086
|
* @group Option Lists
|
|
1097
1087
|
*/
|
|
1098
|
-
type FlexibleOptionListProp<Opt
|
|
1088
|
+
type FlexibleOptionListProp<Opt extends BaseOption> = (ToFlexibleOption<Opt> | GetOptionIdentifierType<Opt>)[] | FlexibleOptionGroup<ToFlexibleOption<Opt> | GetOptionIdentifierType<Opt>>[];
|
|
1099
1089
|
/**
|
|
1100
1090
|
* An array of options or option groups, like {@link OptionList}, but using
|
|
1101
1091
|
* {@link FullOption} instead of {@link Option}. This means that every member is
|
|
@@ -1103,7 +1093,7 @@ type FlexibleOptionListProp<Opt$1 extends BaseOption> = (ToFlexibleOption<Opt$1>
|
|
|
1103
1093
|
*
|
|
1104
1094
|
* @group Option Lists
|
|
1105
1095
|
*/
|
|
1106
|
-
type FullOptionList<Opt
|
|
1096
|
+
type FullOptionList<Opt extends BaseOption> = Opt extends BaseFullOption ? Opt[] | OptionGroup<Opt>[] : ToFullOption<Opt>[] | OptionGroup<ToFullOption<Opt>>[];
|
|
1107
1097
|
/**
|
|
1108
1098
|
* Map of option identifiers to their respective {@link Option}.
|
|
1109
1099
|
*
|
|
@@ -1271,17 +1261,17 @@ type ValueChangeEventHandler = (value?: any, context?: any) => void;
|
|
|
1271
1261
|
/**
|
|
1272
1262
|
* Base for all Field types/interfaces.
|
|
1273
1263
|
*/
|
|
1274
|
-
interface BaseFullField<FieldName extends string = string, OperatorName
|
|
1264
|
+
interface BaseFullField<FieldName extends string = string, OperatorName extends string = string, ValueName extends string = string, OperatorObj extends FullOption = FullOption<OperatorName>, ValueObj extends FullOption = FullOption<ValueName>> extends WithOptionalClassName<BaseFullOption<FieldName>> {
|
|
1275
1265
|
id?: string;
|
|
1276
|
-
operators?: FlexibleOptionList<OperatorObj> | OperatorName
|
|
1277
|
-
valueEditorType?: ValueEditorType | ((operator: OperatorName
|
|
1278
|
-
valueSources?: ValueSources | ValueSourceFlexibleOptions | ((operator: OperatorName
|
|
1266
|
+
operators?: FlexibleOptionList<OperatorObj> | OperatorName[] | FlexibleOption<OperatorName>[] | (OperatorName | FlexibleOption<OperatorName>)[];
|
|
1267
|
+
valueEditorType?: ValueEditorType | ((operator: OperatorName) => ValueEditorType);
|
|
1268
|
+
valueSources?: ValueSources | ValueSourceFlexibleOptions | ((operator: OperatorName) => ValueSources | ValueSourceFlexibleOptions);
|
|
1279
1269
|
inputType?: InputType | null;
|
|
1280
1270
|
values?: FlexibleOptionList<ValueObj>;
|
|
1281
1271
|
matchModes?: boolean | MatchMode[] | FlexibleOption<MatchMode>[];
|
|
1282
1272
|
/** Properties of items in the value. */
|
|
1283
1273
|
subproperties?: FlexibleOptionList<FullField>;
|
|
1284
|
-
defaultOperator?: OperatorName
|
|
1274
|
+
defaultOperator?: OperatorName;
|
|
1285
1275
|
defaultValue?: any;
|
|
1286
1276
|
placeholder?: string;
|
|
1287
1277
|
validator?: RuleValidator;
|
|
@@ -1299,7 +1289,7 @@ interface BaseFullField<FieldName extends string = string, OperatorName$1 extend
|
|
|
1299
1289
|
*
|
|
1300
1290
|
* @group Option Lists
|
|
1301
1291
|
*/
|
|
1302
|
-
type FullField<FieldName extends string = string, OperatorName
|
|
1292
|
+
type FullField<FieldName extends string = string, OperatorName extends string = string, ValueName extends string = string, OperatorObj extends FullOption = FullOption<OperatorName>, ValueObj extends FullOption = FullOption<ValueName>> = Simplify<FullOption<FieldName> & BaseFullField<FieldName, OperatorName, ValueName, OperatorObj, ValueObj>>;
|
|
1303
1293
|
/**
|
|
1304
1294
|
* Allowed values of the {@link FullOperator} property `arity`. A value of `"unary"` or
|
|
1305
1295
|
* a number less than two will cause the default {@link react-querybuilder!ValueEditor ValueEditor} to render `null`.
|
|
@@ -2744,6 +2734,17 @@ type QueryBuilderProps<RG extends RuleGroupTypeAny, F extends FullField, O exten
|
|
|
2744
2734
|
context?: any;
|
|
2745
2735
|
} : never;
|
|
2746
2736
|
//#endregion
|
|
2737
|
+
//#region ../react-querybuilder/src/redux/getRqbStore.d.ts
|
|
2738
|
+
declare global {
|
|
2739
|
+
var __RQB_DEVTOOLS__: boolean | undefined;
|
|
2740
|
+
}
|
|
2741
|
+
/**
|
|
2742
|
+
* Gets the singleton React Query Builder store instance.
|
|
2743
|
+
* DevTools are enabled if either:
|
|
2744
|
+
* - globalThis.__RQB_DEVTOOLS__ is truthy
|
|
2745
|
+
* - window.__RQB_DEVTOOLS__ is truthy
|
|
2746
|
+
*/
|
|
2747
|
+
//#endregion
|
|
2747
2748
|
//#region src/AntDActionElement.d.ts
|
|
2748
2749
|
type RemoveDataIndexKeys<T$1> = { [K in keyof T$1 as `data-${string}` extends K ? never : K]: T$1[K] };
|
|
2749
2750
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require(`@ant-design/icons`),u=require(`react`);u=c(u);let d=require(`react-querybuilder`),f=require(`antd`),p=require(`antd/es/date-picker/generatePicker/index.js`);p=c(p);let m=require(`dayjs`);m=c(m);let h=require(`dayjs/plugin/advancedFormat.js`);h=c(h);let g=require(`dayjs/plugin/customParseFormat.js`);g=c(g);let _=require(`dayjs/plugin/localeData.js`);_=c(_);let v=require(`dayjs/plugin/weekOfYear.js`);v=c(v);let y=require(`dayjs/plugin/weekYear.js`);y=c(y);let b=require(`dayjs/plugin/weekday.js`);b=c(b);const x=({className:e,handleOnClick:t,label:n,title:r,disabled:i,disabledTranslation:a,testID:o,level:s,path:c,context:l,validation:d,ruleOrGroup:p,schema:m,...h})=>u.createElement(f.Button,{type:`primary`,className:e,title:a&&i?a.title:r,onClick:e=>t(e),disabled:i&&!a,...h},a&&i?a.label:n),S=(0,u.forwardRef)(({className:e,title:t,testID:n,level:r,path:i,label:a,disabled:o,context:s,validation:c,schema:d,ruleOrGroup:f,...p},m)=>u.createElement(l.HolderOutlined,{className:e,title:t,...p,ref:m})),C=({className:e,handleOnChange:t,label:n,checked:r,title:i,disabled:a,path:o,context:s,validation:c,testID:l,schema:d,ruleGroup:p,...m})=>u.createElement(f.Switch,{title:i,className:e,onChange:e=>t(e),checked:!!r,disabled:a,checkedChildren:n,unCheckedChildren:`=`,...m}),w=({shiftUp:e,shiftDown:t,shiftUpDisabled:n,shiftDownDisabled:r,disabled:i,className:a,labels:o,titles:s,testID:c})=>u.createElement(`div`,{"data-testid":c,className:a},u.createElement(f.Button,{type:`primary`,size:`small`,title:s?.shiftUp,onClick:e,disabled:i||n},o?.shiftUp),u.createElement(f.Button,{type:`primary`,size:`small`,title:s?.shiftDown,onClick:t,disabled:i||r},o?.shiftDown));var T=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0,e.noteOnce=l,e.preMessage=void 0;var t={},n=[],r=e.preMessage=function(e){n.push(e)};function i(e,t){if(process.env.NODE_ENV!==`production`&&!e&&console!==void 0){var r=n.reduce(function(e,t){return t(e??``,`warning`)},t);r&&console.error(`Warning: ${r}`)}}function a(e,t){if(process.env.NODE_ENV!==`production`&&!e&&console!==void 0){var r=n.reduce(function(e,t){return t(e??``,`note`)},t);r&&console.warn(`Note: ${r}`)}}function o(){t={}}function s(e,n,r){!n&&!t[r]&&(e(!1,r),t[r]=!0)}function c(e,t){s(i,e,t)}function l(e,t){s(a,e,t)}c.preMessage=r,c.resetWarned=o,c.noteOnce=l,e.default=c})),E=
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require(`@ant-design/icons`),u=require(`react`);u=c(u);let d=require(`react-querybuilder`),f=require(`antd`),p=require(`antd/es/date-picker/generatePicker/index.js`);p=c(p);let m=require(`dayjs`);m=c(m);let h=require(`dayjs/plugin/advancedFormat.js`);h=c(h);let g=require(`dayjs/plugin/customParseFormat.js`);g=c(g);let _=require(`dayjs/plugin/localeData.js`);_=c(_);let v=require(`dayjs/plugin/weekOfYear.js`);v=c(v);let y=require(`dayjs/plugin/weekYear.js`);y=c(y);let b=require(`dayjs/plugin/weekday.js`);b=c(b);const x=({className:e,handleOnClick:t,label:n,title:r,disabled:i,disabledTranslation:a,testID:o,level:s,path:c,context:l,validation:d,ruleOrGroup:p,schema:m,...h})=>u.createElement(f.Button,{type:`primary`,className:e,title:a&&i?a.title:r,onClick:e=>t(e),disabled:i&&!a,...h},a&&i?a.label:n),S=(0,u.forwardRef)(({className:e,title:t,testID:n,level:r,path:i,label:a,disabled:o,context:s,validation:c,schema:d,ruleOrGroup:f,...p},m)=>u.createElement(l.HolderOutlined,{className:e,title:t,...p,ref:m})),C=({className:e,handleOnChange:t,label:n,checked:r,title:i,disabled:a,path:o,context:s,validation:c,testID:l,schema:d,ruleGroup:p,...m})=>u.createElement(f.Switch,{title:i,className:e,onChange:e=>t(e),checked:!!r,disabled:a,checkedChildren:n,unCheckedChildren:`=`,...m}),w=({shiftUp:e,shiftDown:t,shiftUpDisabled:n,shiftDownDisabled:r,disabled:i,className:a,labels:o,titles:s,testID:c})=>u.createElement(`div`,{"data-testid":c,className:a},u.createElement(f.Button,{type:`primary`,size:`small`,title:s?.shiftUp,onClick:e,disabled:i||n},o?.shiftUp),u.createElement(f.Button,{type:`primary`,size:`small`,title:s?.shiftDown,onClick:t,disabled:i||r},o?.shiftDown));var T=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0,e.noteOnce=l,e.preMessage=void 0;var t={},n=[],r=e.preMessage=function(e){n.push(e)};function i(e,t){if(process.env.NODE_ENV!==`production`&&!e&&console!==void 0){var r=n.reduce(function(e,t){return t(e??``,`warning`)},t);r&&console.error(`Warning: ${r}`)}}function a(e,t){if(process.env.NODE_ENV!==`production`&&!e&&console!==void 0){var r=n.reduce(function(e,t){return t(e??``,`note`)},t);r&&console.warn(`Note: ${r}`)}}function o(){t={}}function s(e,n,r){!n&&!t[r]&&(e(!1,r),t[r]=!0)}function c(e,t){s(i,e,t)}function l(e,t){s(a,e,t)}c.preMessage=r,c.resetWarned=o,c.noteOnce=l,e.default=c})),E=T();m.default.extend(g.default),m.default.extend(h.default),m.default.extend(b.default),m.default.extend(_.default),m.default.extend(v.default),m.default.extend(y.default),m.default.extend((e,t)=>{let n=t.prototype,r=n.format;n.format=function(e){let t=(e||``).replace(`Wo`,`wo`);return r.bind(this)(t)}});const D={bn_BD:`bn-bd`,by_BY:`be`,en_GB:`en-gb`,en_US:`en`,fr_BE:`fr`,fr_CA:`fr-ca`,hy_AM:`hy-am`,kmr_IQ:`ku`,nl_BE:`nl-be`,pt_BR:`pt-br`,zh_CN:`zh-cn`,zh_HK:`zh-hk`,zh_TW:`zh-tw`},O=e=>D[e]||e.split(`_`)[0],k=()=>{(0,E.noteOnce)(!1,`Not match any format. Please help to fire a issue about this.`)},A={getNow:()=>(0,m.default)(),getFixedDate:e=>(0,m.default)(e,[`YYYY-M-DD`,`YYYY-MM-DD`]),getEndDate:e=>e.endOf(`month`),getWeekDay:e=>{let t=e.locale(`en`);return t.weekday()+t.localeData().firstDayOfWeek()},getYear:e=>e.year(),getMonth:e=>e.month(),getDate:e=>e.date(),getHour:e=>e.hour(),getMinute:e=>e.minute(),getSecond:e=>e.second(),getMillisecond:e=>e.millisecond(),addYear:(e,t)=>e.add(t,`year`),addMonth:(e,t)=>e.add(t,`month`),addDate:(e,t)=>e.add(t,`day`),setYear:(e,t)=>e.year(t),setMonth:(e,t)=>e.month(t),setDate:(e,t)=>e.date(t),setHour:(e,t)=>e.hour(t),setMinute:(e,t)=>e.minute(t),setSecond:(e,t)=>e.second(t),setMillisecond:(e,t)=>e.millisecond(t),isAfter:(e,t)=>e.isAfter(t),isValidate:e=>e.isValid(),locale:{getWeekFirstDay:e=>(0,m.default)().locale(O(e)).localeData().firstDayOfWeek(),getWeekFirstDate:(e,t)=>t.locale(O(e)).weekday(0),getWeek:(e,t)=>t.locale(O(e)).week(),getShortWeekDays:e=>(0,m.default)().locale(O(e)).localeData().weekdaysMin(),getShortMonths:e=>(0,m.default)().locale(O(e)).localeData().monthsShort(),format:(e,t,n)=>t.locale(O(e)).format(n),parse:(e,t,n)=>{let r=O(e);for(let e of n){let n=t;if(e.includes(`wo`)||e.includes(`Wo`)){let e=n.split(`-`)[0],t=n.split(`-`)[1],i=(0,m.default)(e,`YYYY`).startOf(`year`).locale(r);for(let e=0;e<=52;e+=1){let n=i.add(e,`week`);if(n.format(`Wo`)===t)return n}return k(),null}let i=(0,m.default)(n,e,!0).locale(r);if(i.isValid())return i}return t&&k(),null}}};var j=A;const M=(0,p.default)(j),N=e=>{let{fieldData:t,operator:n,value:r,handleOnChange:i,title:a,className:o,type:s,inputType:c,values:l=[],listsAsArrays:p,separator:h,valueSource:g,disabled:_,testID:v,selectorComponent:y=e.schema.controls.valueSelector,extraProps:b,parseNumbers:x,...S}=e,{valueAsArray:C,multiValueHandler:w,bigIntValueHandler:T,valueListItemClassName:E,inputTypeCoerced:D}=(0,d.useValueEditor)(e);if(n===`null`||n===`notNull`)return null;let O=t?.placeholder??``;if((n===`between`||n===`notBetween`)&&(s===`select`||s===`text`)&&D!==`date`&&D!==`datetime-local`){if(s===`text`){let e=[`from`,`to`].map((e,t)=>D===`time`?u.createElement(M.TimePicker,{key:e,value:C[t]?(0,m.default)(C[t],`HH:mm:ss`):null,className:E,disabled:_,placeholder:O,onChange:e=>w(e?.format(`HH:mm:ss`)??``,t),...b}):D===`number`?u.createElement(f.InputNumber,{key:e,type:D,value:C[t]??``,className:E,disabled:_,placeholder:O,onChange:e=>w(e,t),...b}):u.createElement(f.Input,{key:e,type:D,value:C[t]??``,className:E,disabled:_,placeholder:O,onChange:e=>w(e.target.value,t),...b}));return u.createElement(`span`,{"data-testid":v,className:o,title:a},e[0],h,e[1])}return u.createElement(d.ValueEditor,{...e,skipHook:!0})}switch(s){case`select`:case`multiselect`:return u.createElement(y,{...S,className:o,title:a,value:r,disabled:_,listsAsArrays:p,multiple:s===`multiselect`,handleOnChange:i,options:l,...b});case`textarea`:return u.createElement(f.Input.TextArea,{value:r,title:a,className:o,disabled:_,placeholder:O,onChange:e=>i(e.target.value),...b});case`switch`:return u.createElement(f.Switch,{checked:!!r,title:a,className:o,disabled:_,onChange:e=>i(e),...b});case`checkbox`:return u.createElement(`span`,{title:a,className:o},u.createElement(f.Checkbox,{type:`checkbox`,disabled:_,onChange:e=>i(e.target.checked),checked:!!r,...b}));case`radio`:return u.createElement(`span`,{className:o,title:a},l.map(e=>u.createElement(f.Radio,{key:e.name,value:e.name,checked:r===e.name,disabled:_,onChange:e=>i(e.target.value),...b},e.label)))}switch(D){case`date`:case`datetime-local`:{if(n===`between`||n===`notBetween`){let e=C.slice(0,2).map(e=>(0,m.default)(e));return u.createElement(M.RangePicker,{value:e.every(e=>e.isValid())?e:void 0,showTime:D===`datetime-local`,className:o,disabled:_,placeholder:[O,O],onChange:e=>{let t=`YYYY-MM-DD${D===`datetime-local`?`THH:mm:ss`:``}`,n=e?.map(e=>e?.isValid()?e.format(t):void 0);i(n?p?n:(0,d.joinWith)(n,`,`):e)},...b})}let e=(0,m.default)(r);return u.createElement(M,{value:e.isValid()?e:void 0,showTime:D===`datetime-local`,className:o,disabled:_,placeholder:O,onChange:(e,t)=>i(t),...b})}case`time`:{let e=(0,m.default)(r,`HH:mm:ss`);return u.createElement(M.TimePicker,{value:e.isValid()?e:void 0,className:o,disabled:_,placeholder:O,onChange:e=>i(e?.format(`HH:mm:ss`)??``),...b})}case`number`:return u.createElement(f.InputNumber,{type:D,value:r,title:a,className:o,disabled:_,placeholder:O,onChange:i,...b})}return c===`bigint`?u.createElement(f.Input,{"data-testid":v,type:D,placeholder:O,value:`${r}`,title:a,className:o,disabled:_,onChange:e=>T(e.target.value),...b}):u.createElement(f.Input,{type:D,value:r,title:a,className:o,disabled:_,placeholder:O,onChange:e=>i(e.target.value),...b})},P=({className:e,handleOnChange:t,options:n,value:r,title:i,disabled:a,multiple:o,listsAsArrays:s,testID:c,rule:l,ruleGroup:p,rules:m,level:h,path:g,context:_,validation:v,operator:y,field:b,fieldData:x,schema:S,...C})=>{let{onChange:w}=(0,d.useValueSelector)({handleOnChange:t,listsAsArrays:!1,multiple:!1,value:r}),{onChange:T,val:E}=(0,d.useValueSelector)({handleOnChange:t,listsAsArrays:o||s,multiple:o,value:r}),D=u.useCallback(e=>{o&&!s&&Array.isArray(e)?w((0,d.joinWith)(e)):T(e)},[s,o,w,T]);return u.createElement(f.Select,{...o?{mode:`multiple`,allowClear:!0}:{},title:i,className:e,popupMatchSelectWidth:!1,disabled:a,value:E,onChange:D,optionFilterProp:`label`,options:n,...C})},F={actionElement:x,dragHandle:S,notToggle:C,shiftActions:w,valueEditor:N,valueSelector:P},I={removeGroup:{label:u.createElement(l.CloseOutlined,null)},removeRule:{label:u.createElement(l.CloseOutlined,null)},cloneRule:{label:u.createElement(l.CopyOutlined,null)},cloneRuleGroup:{label:u.createElement(l.CopyOutlined,null)},lockGroup:{label:u.createElement(l.UnlockOutlined,null)},lockRule:{label:u.createElement(l.UnlockOutlined,null)},lockGroupDisabled:{label:u.createElement(l.LockOutlined,null)},lockRuleDisabled:{label:u.createElement(l.LockOutlined,null)},shiftActionUp:{label:u.createElement(l.UpOutlined,null)},shiftActionDown:{label:u.createElement(l.DownOutlined,null)}},L=(0,d.getCompatContextProvider)({controlElements:F,translations:I});exports.AntDActionElement=x,exports.AntDDragHandle=S,exports.AntDNotToggle=C,exports.AntDShiftActions=w,exports.AntDValueEditor=N,exports.AntDValueSelector=P,exports.QueryBuilderAntD=L,exports.antdControlElements=F,exports.antdTranslations=I;
|
|
2
2
|
//# sourceMappingURL=react-querybuilder_antd.cjs.production.js.map
|