@react-querybuilder/antd 8.11.2 → 8.13.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.
@@ -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>(obj: O, key: K) {
127
- return obj[key];
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
- interface User {
124
+ type User = {
153
125
  name: string;
154
126
  surname: string;
155
127
 
156
128
  luckyNumber?: number;
157
- }
129
+ };
158
130
 
159
- interface Admin {
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
- interface User {
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<Entity extends object, Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>>(field: Key, validator: (value: Entity[Key]) => boolean): ValidatorFn;
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
- interface User {
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
- // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
266
- type AreStringsEqual<A extends string, B extends string> =
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
- endIfEqual('abc', 'abc');
284
- //=> never
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
+ ```
261
+
262
+ @example
263
+ ```
264
+ import type {IsNever} from 'type-fest';
285
265
 
286
- endIfEqual('abc', '123');
287
- //=> void
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
 
@@ -347,6 +337,41 @@ type B = IfEqual<string, number, 'equal', 'not equal'>;
347
337
  //=> 'not equal'
348
338
  ```
349
339
 
340
+ 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:
341
+
342
+ @example
343
+ ```
344
+ import type {If, IsEqual, StringRepeat} from 'type-fest';
345
+
346
+ type HundredZeroes = StringRepeat<'0', 100>;
347
+
348
+ // The following implementation is not tail recursive
349
+ type Includes<S extends string, Char extends string> =
350
+ S extends `${infer First}${infer Rest}`
351
+ ? If<IsEqual<First, Char>,
352
+ 'found',
353
+ Includes<Rest, Char>>
354
+ : 'not found';
355
+
356
+ // Hence, instantiations with long strings will fail
357
+ // @ts-expect-error
358
+ type Fails = Includes<HundredZeroes, '1'>;
359
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
360
+ // Error: Type instantiation is excessively deep and possibly infinite.
361
+
362
+ // However, if we use a simple conditional instead of `If`, the implementation becomes tail-recursive
363
+ type IncludesWithoutIf<S extends string, Char extends string> =
364
+ S extends `${infer First}${infer Rest}`
365
+ ? IsEqual<First, Char> extends true
366
+ ? 'found'
367
+ : IncludesWithoutIf<Rest, Char>
368
+ : 'not found';
369
+
370
+ // Now, instantiations with long strings will work
371
+ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
372
+ //=> 'not found'
373
+ ```
374
+
350
375
  @category Type Guard
351
376
  @category Utilities
352
377
  */
@@ -380,7 +405,6 @@ type C = IsArray<string>;
380
405
  type UnknownArray = readonly unknown[];
381
406
  //#endregion
382
407
  //#region ../../node_modules/type-fest/source/internal/array.d.ts
383
-
384
408
  /**
385
409
  Returns whether the given array `T` is readonly.
386
410
  */
@@ -432,16 +456,17 @@ const literal = {foo: 123, bar: 'hello', baz: 456};
432
456
  const someType: SomeType = literal;
433
457
  const someInterface: SomeInterface = literal;
434
458
 
435
- function fn(object: Record<string, unknown>): void {}
459
+ declare function fn(object: Record<string, unknown>): void;
436
460
 
437
461
  fn(literal); // Good: literal object type is sealed
438
462
  fn(someType); // Good: type is sealed
463
+ // @ts-expect-error
439
464
  fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
440
465
  fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
441
466
  ```
442
467
 
443
468
  @link https://github.com/microsoft/TypeScript/issues/15300
444
- @see SimplifyDeep
469
+ @see {@link SimplifyDeep}
445
470
  @category Object
446
471
  */
447
472
  type Simplify<T$1> = { [KeyType in keyof T$1]: T$1[KeyType] } & {};
@@ -473,7 +498,7 @@ type Includes<Value extends readonly any[], Item> =
473
498
  @category Type Guard
474
499
  @category Utilities
475
500
  */
476
- type IsEqual<A, B> = [A, B] extends [infer AA, infer BB] ? [AA] extends [never] ? [BB] extends [never] ? true : false : [BB] extends [never] ? false : _IsEqual<AA, BB> : false;
501
+ type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false : false;
477
502
  // This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
478
503
  type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
479
504
  //#endregion
@@ -495,6 +520,7 @@ It relies on the fact that an empty object (`{}`) is assignable to an object wit
495
520
  ```
496
521
  const indexed: Record<string, unknown> = {}; // Allowed
497
522
 
523
+ // @ts-expect-error
498
524
  const keyed: Record<'foo', unknown> = {}; // Error
499
525
  // => TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
500
526
  ```
@@ -508,16 +534,14 @@ type Indexed = {} extends Record<string, unknown>
508
534
  // => '✅ `{}` is assignable to `Record<string, unknown>`'
509
535
 
510
536
  type Keyed = {} extends Record<'foo' | 'bar', unknown>
511
- ? "✅ `{}` is assignable to `Record<'foo' | 'bar', unknown>`"
512
- : "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`";
537
+ ? '✅ `{}` is assignable to `Record<\'foo\' | \'bar\', unknown>`'
538
+ : '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`';
513
539
  // => "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`"
514
540
  ```
515
541
 
516
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`...
517
543
 
518
544
  ```
519
- import type {OmitIndexSignature} from 'type-fest';
520
-
521
545
  type OmitIndexSignature<ObjectType> = {
522
546
  [KeyType in keyof ObjectType // Map each key of `ObjectType`...
523
547
  ]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
@@ -527,14 +551,12 @@ type OmitIndexSignature<ObjectType> = {
527
551
  ...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
528
552
 
529
553
  ```
530
- import type {OmitIndexSignature} from 'type-fest';
531
-
532
554
  type OmitIndexSignature<ObjectType> = {
533
555
  [KeyType in keyof ObjectType
534
- // Is `{}` assignable to `Record<KeyType, unknown>`?
535
- as {} extends Record<KeyType, unknown>
536
- ? ... // ✅ `{}` is assignable to `Record<KeyType, unknown>`
537
- : ... // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
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>`
538
560
  ]: ObjectType[KeyType];
539
561
  };
540
562
  ```
@@ -545,27 +567,27 @@ If `{}` is assignable, it means that `KeyType` is an index signature and we want
545
567
  ```
546
568
  import type {OmitIndexSignature} from 'type-fest';
547
569
 
548
- interface Example {
570
+ type Example = {
549
571
  // These index signatures will be removed.
550
- [x: string]: any
551
- [x: number]: any
552
- [x: symbol]: any
553
- [x: `head-${string}`]: string
554
- [x: `${string}-tail`]: string
555
- [x: `head-${string}-tail`]: string
556
- [x: `${bigint}`]: string
557
- [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;
558
580
 
559
581
  // These explicitly defined keys will remain.
560
582
  foo: 'bar';
561
583
  qux?: 'baz';
562
- }
584
+ };
563
585
 
564
586
  type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
565
587
  // => { foo: 'bar'; qux?: 'baz' | undefined; }
566
588
  ```
567
589
 
568
- @see PickIndexSignature
590
+ @see {@link PickIndexSignature}
569
591
  @category Object
570
592
  */
571
593
  type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
@@ -613,7 +635,7 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
613
635
  // }
614
636
  ```
615
637
 
616
- @see OmitIndexSignature
638
+ @see {@link OmitIndexSignature}
617
639
  @category Object
618
640
  */
619
641
  type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
@@ -629,12 +651,12 @@ Merge two types into a new type. Keys of the second type overrides keys of the f
629
651
  ```
630
652
  import type {Merge} from 'type-fest';
631
653
 
632
- interface Foo {
654
+ type Foo = {
633
655
  [x: string]: unknown;
634
656
  [x: number]: unknown;
635
657
  foo: string;
636
658
  bar: symbol;
637
- }
659
+ };
638
660
 
639
661
  type Bar = {
640
662
  [x: number]: number;
@@ -813,12 +835,14 @@ type Foo = {
813
835
  type FooWithoutA = Except<Foo, 'a'>;
814
836
  //=> {b: string}
815
837
 
838
+ // @ts-expect-error
816
839
  const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
817
840
  //=> errors: 'a' does not exist in type '{ b: string; }'
818
841
 
819
842
  type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
820
843
  //=> {a: number} & Partial<Record<"b", never>>
821
844
 
845
+ // @ts-expect-error
822
846
  const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
823
847
  //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
824
848
 
@@ -835,12 +859,12 @@ type UserData = {
835
859
 
836
860
  // `Omit` clearly doesn't behave as expected in this case:
837
861
  type PostPayload = Omit<UserData, 'email'>;
838
- //=> type PostPayload = { [x: string]: string; [x: number]: string; }
862
+ //=> { [x: string]: string; [x: number]: string; }
839
863
 
840
864
  // In situations like this, `Except` works better.
841
865
  // It simply removes the `email` key while preserving all the other keys.
842
- type PostPayload = Except<UserData, 'email'>;
843
- //=> type PostPayload = { [x: string]: string; name: string; role: 'admin' | 'user'; }
866
+ type PostPayloadFixed = Except<UserData, 'email'>;
867
+ //=> { [x: string]: string; name: string; role: 'admin' | 'user'; }
844
868
  ```
845
869
 
846
870
  @category Object
@@ -862,7 +886,7 @@ type Foo = {
862
886
  a?: number;
863
887
  b: string;
864
888
  c?: boolean;
865
- }
889
+ };
866
890
 
867
891
  type SomeRequired = SetRequired<Foo, 'b' | 'c'>;
868
892
  // type SomeRequired = {
@@ -916,7 +940,7 @@ type Foo = {
916
940
  a: number | null;
917
941
  b: string | undefined;
918
942
  c?: boolean | null;
919
- }
943
+ };
920
944
 
921
945
  type SomeNonNullable = SetNonNullable<Foo, 'b' | 'c'>;
922
946
  // type SomeNonNullable = {
@@ -1119,7 +1143,7 @@ interface RuleGroupType<R$1 extends RuleType = RuleType, C extends string = stri
1119
1143
  /**
1120
1144
  * The type of the `rules` array in a {@link RuleGroupType}.
1121
1145
  */
1122
- type RuleGroupArray<RG$1 extends RuleGroupType = RuleGroupType, R$1 extends RuleType = RuleType> = (R$1 | RG$1)[];
1146
+ type RuleGroupArray<RG extends RuleGroupType = RuleGroupType, R$1 extends RuleType = RuleType> = (R$1 | RG)[];
1123
1147
  //#endregion
1124
1148
  //#region ../core/src/types/ruleGroupsIC.utils.d.ts
1125
1149
  type MAXIMUM_ALLOWED_BOUNDARY = 80;
@@ -1145,7 +1169,7 @@ type RuleGroupTypeAny<R$1 extends RuleType = RuleType, C extends string = string
1145
1169
  /**
1146
1170
  * The type of the `rules` array in a {@link RuleGroupTypeIC}.
1147
1171
  */
1148
- type RuleGroupICArray<RG$1 extends RuleGroupTypeIC = RuleGroupTypeIC, R$1 extends RuleType = RuleType, C extends string = string> = [R$1 | RG$1] | [R$1 | RG$1, ...MappedTuple<[C, R$1 | RG$1]>] | ((R$1 | RG$1)[] & {
1172
+ type RuleGroupICArray<RG extends RuleGroupTypeIC = RuleGroupTypeIC, R$1 extends RuleType = RuleType, C extends string = string> = [R$1 | RG] | [R$1 | RG, ...MappedTuple<[C, R$1 | RG]>] | ((R$1 | RG)[] & {
1149
1173
  length: 0;
1150
1174
  });
1151
1175
  /**
@@ -1155,7 +1179,7 @@ type RuleOrGroupArray = RuleGroupArray | RuleGroupICArray;
1155
1179
  /**
1156
1180
  * Converts a narrowed rule group type to its most generic form.
1157
1181
  */
1158
- type GenericizeRuleGroupType<RG$1> = RG$1 extends RuleGroupType ? RuleGroupType : RuleGroupTypeIC;
1182
+ type GenericizeRuleGroupType<RG> = RG extends RuleGroupType ? RuleGroupType : RuleGroupTypeIC;
1159
1183
  //#endregion
1160
1184
  //#region ../core/src/types/validation.d.ts
1161
1185
  /**
@@ -1493,9 +1517,13 @@ interface Classnames {
1493
1517
  */
1494
1518
  branches: Classname;
1495
1519
  /**
1496
- * Classname(s) rules that render a subquery.
1520
+ * Classname(s) applied to rules that render a subquery.
1497
1521
  */
1498
1522
  hasSubQuery: Classname;
1523
+ /**
1524
+ * Classname(s) applied to async components in their "loading" state.
1525
+ */
1526
+ loading: Classname;
1499
1527
  }
1500
1528
  /**
1501
1529
  * Placeholder strings for option lists.
@@ -2412,15 +2440,15 @@ type QueryBuilderContextProvider<ExtraProps extends object = Record<string, any>
2412
2440
  *
2413
2441
  * @group Props
2414
2442
  */
2415
- type QueryBuilderProps<RG$1 extends RuleGroupTypeAny, F extends FullField, O extends FullOperator, C extends FullCombinator> = RG$1 extends RuleGroupType<infer R> | RuleGroupTypeIC<infer R> ? QueryBuilderContextProps<F, GetOptionIdentifierType<O>> & {
2443
+ type QueryBuilderProps<RG extends RuleGroupTypeAny, F extends FullField, O extends FullOperator, C extends FullCombinator> = RG extends RuleGroupType<infer R> | RuleGroupTypeIC<infer R> ? QueryBuilderContextProps<F, GetOptionIdentifierType<O>> & {
2416
2444
  /**
2417
2445
  * Initial query object for uncontrolled components.
2418
2446
  */
2419
- defaultQuery?: RG$1;
2447
+ defaultQuery?: RG;
2420
2448
  /**
2421
2449
  * Query object for controlled components.
2422
2450
  */
2423
- query?: RG$1;
2451
+ query?: RG;
2424
2452
  /**
2425
2453
  * List of valid {@link FullField}s.
2426
2454
  *
@@ -2572,7 +2600,7 @@ type QueryBuilderProps<RG$1 extends RuleGroupTypeAny, F extends FullField, O ext
2572
2600
  */
2573
2601
  getSubQueryBuilderProps?(field: GetOptionIdentifierType<F>, misc: {
2574
2602
  fieldData: F;
2575
- }): QueryBuilderProps<GenericizeRuleGroupType<RG$1>, FullOption, FullOption, FullOption>;
2603
+ }): QueryBuilderProps<GenericizeRuleGroupType<RG>, FullOption, FullOption, FullOption>;
2576
2604
  /**
2577
2605
  * The return value of this function will be used to apply classnames to the
2578
2606
  * outer `<div>` of the given {@link Rule}.
@@ -2584,56 +2612,56 @@ type QueryBuilderProps<RG$1 extends RuleGroupTypeAny, F extends FullField, O ext
2584
2612
  * The return value of this function will be used to apply classnames to the
2585
2613
  * outer `<div>` of the given {@link RuleGroup}.
2586
2614
  */
2587
- getRuleGroupClassname?(ruleGroup: RG$1): Classname;
2615
+ getRuleGroupClassname?(ruleGroup: RG): Classname;
2588
2616
  /**
2589
2617
  * This callback is invoked before a new rule is added. The function should either manipulate
2590
2618
  * the rule and return the new object, return `true` to allow the addition to proceed as normal,
2591
2619
  * or return `false` to cancel the addition of the rule.
2592
2620
  */
2593
- onAddRule?(rule: R, parentPath: Path, query: RG$1, context?: any): RuleType | boolean;
2621
+ onAddRule?(rule: R, parentPath: Path, query: RG, context?: any): RuleType | boolean;
2594
2622
  /**
2595
2623
  * This callback is invoked before a new group is added. The function should either manipulate
2596
2624
  * the group and return the new object, return `true` to allow the addition to proceed as normal,
2597
2625
  * or return `false` to cancel the addition of the group.
2598
2626
  */
2599
- onAddGroup?(ruleGroup: RG$1, parentPath: Path, query: RG$1, context?: any): RG$1 | boolean;
2627
+ onAddGroup?(ruleGroup: RG, parentPath: Path, query: RG, context?: any): RG | boolean;
2600
2628
  /**
2601
2629
  * This callback is invoked before a rule is moved or shifted. The function should return
2602
2630
  * `true` to allow the move/shift to proceed as normal, `false` to cancel the move/shift, or
2603
2631
  * a new query object (presumably based on `query` or `nextQuery`) which will become the new
2604
2632
  * query state.
2605
2633
  */
2606
- onMoveRule?(rule: R, fromPath: Path, toPath: Path | "up" | "down", query: RG$1, nextQuery: RG$1, options: MoveOptions, context?: any): RG$1 | boolean;
2634
+ onMoveRule?(rule: R, fromPath: Path, toPath: Path | "up" | "down", query: RG, nextQuery: RG, options: MoveOptions, context?: any): RG | boolean;
2607
2635
  /**
2608
2636
  * This callback is invoked before a group is moved or shifted. The function should return
2609
2637
  * `true` to allow the move/shift to proceed as normal, `false` to cancel the move/shift, or
2610
2638
  * a new query object (presumably based on `query` or `nextQuery`) which will become the new
2611
2639
  * query state.
2612
2640
  */
2613
- onMoveGroup?(ruleGroup: RG$1, fromPath: Path, toPath: Path | "up" | "down", query: RG$1, nextQuery: RG$1, options: MoveOptions, context?: any): RG$1 | boolean;
2641
+ onMoveGroup?(ruleGroup: RG, fromPath: Path, toPath: Path | "up" | "down", query: RG, nextQuery: RG, options: MoveOptions, context?: any): RG | boolean;
2614
2642
  /**
2615
2643
  * This callback is invoked before a rule is grouped with another object. The function should
2616
2644
  * return `true` to allow the grouping to proceed as normal, `false` to cancel the grouping,
2617
2645
  * or a new query object (presumably based on `query` or `nextQuery`) which will become the new
2618
2646
  * query state.
2619
2647
  */
2620
- onGroupRule?(rule: R, fromPath: Path, toPath: Path, query: RG$1, nextQuery: RG$1, options: GroupOptions, context?: any): RG$1 | boolean;
2648
+ onGroupRule?(rule: R, fromPath: Path, toPath: Path, query: RG, nextQuery: RG, options: GroupOptions, context?: any): RG | boolean;
2621
2649
  /**
2622
2650
  * This callback is invoked before a group is grouped with another object. The function should
2623
2651
  * return `true` to allow the grouping to proceed as normal, `false` to cancel the grouping,
2624
2652
  * or a new query object (presumably based on `query` or `nextQuery`) which will become the new
2625
2653
  * query state.
2626
2654
  */
2627
- onGroupGroup?(ruleGroup: RG$1, fromPath: Path, toPath: Path, query: RG$1, nextQuery: RG$1, options: GroupOptions, context?: any): RG$1 | boolean;
2655
+ onGroupGroup?(ruleGroup: RG, fromPath: Path, toPath: Path, query: RG, nextQuery: RG, options: GroupOptions, context?: any): RG | boolean;
2628
2656
  /**
2629
2657
  * This callback is invoked before a rule or group is removed. The function should return
2630
2658
  * `true` if the rule or group should be removed or `false` if it should not be removed.
2631
2659
  */
2632
- onRemove?(ruleOrGroup: R | RG$1, path: Path, query: RG$1, context?: any): boolean;
2660
+ onRemove?(ruleOrGroup: R | RG, path: Path, query: RG, context?: any): boolean;
2633
2661
  /**
2634
2662
  * This callback is invoked anytime the query state is updated.
2635
2663
  */
2636
- onQueryChange?(query: RG$1): void;
2664
+ onQueryChange?(query: RG): void;
2637
2665
  /**
2638
2666
  * Each log object will be passed to this function when `debugMode` is `true`.
2639
2667
  *
@@ -2706,6 +2734,17 @@ type QueryBuilderProps<RG$1 extends RuleGroupTypeAny, F extends FullField, O ext
2706
2734
  context?: any;
2707
2735
  } : never;
2708
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
2709
2748
  //#region src/AntDActionElement.d.ts
2710
2749
  type RemoveDataIndexKeys<T$1> = { [K in keyof T$1 as `data-${string}` extends K ? never : K]: T$1[K] };
2711
2750
  /**
@@ -1,2 +1,2 @@
1
- import{CloseOutlined as e,CopyOutlined as t,DownOutlined as n,HolderOutlined as r,LockOutlined as i,UnlockOutlined as a,UpOutlined as o}from"@ant-design/icons";import*as s from"react";import{forwardRef as c}from"react";import{ValueEditor as l,getCompatContextProvider as u,joinWith as d,useValueEditor as f,useValueSelector as p}from"react-querybuilder";import{Button as m,Checkbox as h,Input as g,InputNumber as _,Radio as v,Select as y,Switch as b}from"antd";import x from"antd/es/date-picker/generatePicker/index.js";import S from"dayjs";import C from"dayjs/plugin/advancedFormat.js";import w from"dayjs/plugin/customParseFormat.js";import T from"dayjs/plugin/localeData.js";import E from"dayjs/plugin/weekOfYear.js";import D from"dayjs/plugin/weekYear.js";import O from"dayjs/plugin/weekday.js";var k=Object.create,A=Object.defineProperty,j=Object.getOwnPropertyDescriptor,M=Object.getOwnPropertyNames,N=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty,F=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),I=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=M(t),a=0,o=i.length,s;a<o;a++)s=i[a],!P.call(e,s)&&s!==n&&A(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=j(t,s))||r.enumerable});return e},L=(e,t,n)=>(n=e==null?{}:k(N(e)),I(t||!e||!e.__esModule?A(n,`default`,{value:e,enumerable:!0}):n,e));const R=({className:e,handleOnClick:t,label:n,title:r,disabled:i,disabledTranslation:a,testID:o,level:c,path:l,context:u,validation:d,ruleOrGroup:f,schema:p,...h})=>s.createElement(m,{type:`primary`,className:e,title:a&&i?a.title:r,onClick:e=>t(e),disabled:i&&!a,...h},a&&i?a.label:n),z=c(({className:e,title:t,testID:n,level:i,path:a,label:o,disabled:c,context:l,validation:u,schema:d,ruleOrGroup:f,...p},m)=>s.createElement(r,{className:e,title:t,...p,ref:m})),B=({className:e,handleOnChange:t,label:n,checked:r,title:i,disabled:a,path:o,context:c,validation:l,testID:u,schema:d,ruleGroup:f,...p})=>s.createElement(b,{title:i,className:e,onChange:e=>t(e),checked:!!r,disabled:a,checkedChildren:n,unCheckedChildren:`=`,...p}),V=({shiftUp:e,shiftDown:t,shiftUpDisabled:n,shiftDownDisabled:r,disabled:i,className:a,labels:o,titles:c,testID:l})=>s.createElement(`div`,{"data-testid":l,className:a},s.createElement(m,{type:`primary`,size:`small`,title:c?.shiftUp,onClick:e,disabled:i||n},o?.shiftUp),s.createElement(m,{type:`primary`,size:`small`,title:c?.shiftDown,onClick:t,disabled:i||r},o?.shiftDown));var H=L(F((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.noteOnce=l;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}))());S.extend(w),S.extend(C),S.extend(O),S.extend(T),S.extend(E),S.extend(D),S.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 U={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`},W=e=>U[e]||e.split(`_`)[0],G=()=>{(0,H.noteOnce)(!1,`Not match any format. Please help to fire a issue about this.`)},K=x({getNow:()=>S(),getFixedDate:e=>S(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=>S().locale(W(e)).localeData().firstDayOfWeek(),getWeekFirstDate:(e,t)=>t.locale(W(e)).weekday(0),getWeek:(e,t)=>t.locale(W(e)).week(),getShortWeekDays:e=>S().locale(W(e)).localeData().weekdaysMin(),getShortMonths:e=>S().locale(W(e)).localeData().monthsShort(),format:(e,t,n)=>t.locale(W(e)).format(n),parse:(e,t,n)=>{let r=W(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=S(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 G(),null}let i=S(n,e,!0).locale(r);if(i.isValid())return i}return t&&G(),null}}}),q=e=>{let{fieldData:t,operator:n,value:r,handleOnChange:i,title:a,className:o,type:c,inputType:u,values:p=[],listsAsArrays:m,separator:y,valueSource:x,disabled:C,testID:w,selectorComponent:T=e.schema.controls.valueSelector,extraProps:E,parseNumbers:D,...O}=e,{valueAsArray:k,multiValueHandler:A,bigIntValueHandler:j,valueListItemClassName:M,inputTypeCoerced:N}=f(e);if(n===`null`||n===`notNull`)return null;let P=t?.placeholder??``;if((n===`between`||n===`notBetween`)&&(c===`select`||c===`text`)&&N!==`date`&&N!==`datetime-local`){if(c===`text`){let e=[`from`,`to`].map((e,t)=>N===`time`?s.createElement(K.TimePicker,{key:e,value:k[t]?S(k[t],`HH:mm:ss`):null,className:M,disabled:C,placeholder:P,onChange:e=>A(e?.format(`HH:mm:ss`)??``,t),...E}):N===`number`?s.createElement(_,{key:e,type:N,value:k[t]??``,className:M,disabled:C,placeholder:P,onChange:e=>A(e,t),...E}):s.createElement(g,{key:e,type:N,value:k[t]??``,className:M,disabled:C,placeholder:P,onChange:e=>A(e.target.value,t),...E}));return s.createElement(`span`,{"data-testid":w,className:o,title:a},e[0],y,e[1])}return s.createElement(l,{...e,skipHook:!0})}switch(c){case`select`:case`multiselect`:return s.createElement(T,{...O,className:o,title:a,value:r,disabled:C,listsAsArrays:m,multiple:c===`multiselect`,handleOnChange:i,options:p,...E});case`textarea`:return s.createElement(g.TextArea,{value:r,title:a,className:o,disabled:C,placeholder:P,onChange:e=>i(e.target.value),...E});case`switch`:return s.createElement(b,{checked:!!r,title:a,className:o,disabled:C,onChange:e=>i(e),...E});case`checkbox`:return s.createElement(`span`,{title:a,className:o},s.createElement(h,{type:`checkbox`,disabled:C,onChange:e=>i(e.target.checked),checked:!!r,...E}));case`radio`:return s.createElement(`span`,{className:o,title:a},p.map(e=>s.createElement(v,{key:e.name,value:e.name,checked:r===e.name,disabled:C,onChange:e=>i(e.target.value),...E},e.label)))}switch(N){case`date`:case`datetime-local`:{if(n===`between`||n===`notBetween`){let e=k.slice(0,2).map(e=>S(e));return s.createElement(K.RangePicker,{value:e.every(e=>e.isValid())?e:void 0,showTime:N===`datetime-local`,className:o,disabled:C,placeholder:[P,P],onChange:e=>{let t=`YYYY-MM-DD${N===`datetime-local`?`THH:mm:ss`:``}`,n=e?.map(e=>e?.isValid()?e.format(t):void 0);i(n?m?n:d(n,`,`):e)},...E})}let e=S(r);return s.createElement(K,{value:e.isValid()?e:void 0,showTime:N===`datetime-local`,className:o,disabled:C,placeholder:P,onChange:(e,t)=>i(t),...E})}case`time`:{let e=S(r,`HH:mm:ss`);return s.createElement(K.TimePicker,{value:e.isValid()?e:void 0,className:o,disabled:C,placeholder:P,onChange:e=>i(e?.format(`HH:mm:ss`)??``),...E})}case`number`:return s.createElement(_,{type:N,value:r,title:a,className:o,disabled:C,placeholder:P,onChange:i,...E})}return u===`bigint`?s.createElement(g,{"data-testid":w,type:N,placeholder:P,value:`${r}`,title:a,className:o,disabled:C,onChange:e=>j(e.target.value),...E}):s.createElement(g,{type:N,value:r,title:a,className:o,disabled:C,placeholder:P,onChange:e=>i(e.target.value),...E})},J=({className:e,handleOnChange:t,options:n,value:r,title:i,disabled:a,multiple:o,listsAsArrays:c,testID:l,rule:u,ruleGroup:f,rules:m,level:h,path:g,context:_,validation:v,operator:b,field:x,fieldData:S,schema:C,...w})=>{let{onChange:T}=p({handleOnChange:t,listsAsArrays:!1,multiple:!1,value:r}),{onChange:E,val:D}=p({handleOnChange:t,listsAsArrays:o||c,multiple:o,value:r}),O=s.useCallback(e=>{o&&!c&&Array.isArray(e)?T(d(e)):E(e)},[c,o,T,E]);return s.createElement(y,{...o?{mode:`multiple`,allowClear:!0}:{},title:i,className:e,popupMatchSelectWidth:!1,disabled:a,value:D,onChange:O,optionFilterProp:`label`,options:n,...w})},Y={actionElement:R,dragHandle:z,notToggle:B,shiftActions:V,valueEditor:q,valueSelector:J},X={removeGroup:{label:s.createElement(e,null)},removeRule:{label:s.createElement(e,null)},cloneRule:{label:s.createElement(t,null)},cloneRuleGroup:{label:s.createElement(t,null)},lockGroup:{label:s.createElement(a,null)},lockRule:{label:s.createElement(a,null)},lockGroupDisabled:{label:s.createElement(i,null)},lockRuleDisabled:{label:s.createElement(i,null)},shiftActionUp:{label:s.createElement(o,null)},shiftActionDown:{label:s.createElement(n,null)}},Z=u({controlElements:Y,translations:X});export{R as AntDActionElement,z as AntDDragHandle,B as AntDNotToggle,V as AntDShiftActions,q as AntDValueEditor,J as AntDValueSelector,Z as QueryBuilderAntD,Y as antdControlElements,X as antdTranslations};
1
+ import{CloseOutlined as e,CopyOutlined as t,DownOutlined as n,HolderOutlined as r,LockOutlined as i,UnlockOutlined as a,UpOutlined as o}from"@ant-design/icons";import*as s from"react";import{forwardRef as c}from"react";import{ValueEditor as l,getCompatContextProvider as u,joinWith as d,useValueEditor as f,useValueSelector as p}from"react-querybuilder";import{Button as m,Checkbox as h,Input as g,InputNumber as _,Radio as v,Select as y,Switch as b}from"antd";import x from"antd/es/date-picker/generatePicker/index.js";import S from"dayjs";import C from"dayjs/plugin/advancedFormat.js";import w from"dayjs/plugin/customParseFormat.js";import T from"dayjs/plugin/localeData.js";import E from"dayjs/plugin/weekOfYear.js";import D from"dayjs/plugin/weekYear.js";import O from"dayjs/plugin/weekday.js";var k=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);const A=({className:e,handleOnClick:t,label:n,title:r,disabled:i,disabledTranslation:a,testID:o,level:c,path:l,context:u,validation:d,ruleOrGroup:f,schema:p,...h})=>s.createElement(m,{type:`primary`,className:e,title:a&&i?a.title:r,onClick:e=>t(e),disabled:i&&!a,...h},a&&i?a.label:n),j=c(({className:e,title:t,testID:n,level:i,path:a,label:o,disabled:c,context:l,validation:u,schema:d,ruleOrGroup:f,...p},m)=>s.createElement(r,{className:e,title:t,...p,ref:m})),M=({className:e,handleOnChange:t,label:n,checked:r,title:i,disabled:a,path:o,context:c,validation:l,testID:u,schema:d,ruleGroup:f,...p})=>s.createElement(b,{title:i,className:e,onChange:e=>t(e),checked:!!r,disabled:a,checkedChildren:n,unCheckedChildren:`=`,...p}),N=({shiftUp:e,shiftDown:t,shiftUpDisabled:n,shiftDownDisabled:r,disabled:i,className:a,labels:o,titles:c,testID:l})=>s.createElement(`div`,{"data-testid":l,className:a},s.createElement(m,{type:`primary`,size:`small`,title:c?.shiftUp,onClick:e,disabled:i||n},o?.shiftUp),s.createElement(m,{type:`primary`,size:`small`,title:c?.shiftDown,onClick:t,disabled:i||r},o?.shiftDown));var P=k((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}))();S.extend(w),S.extend(C),S.extend(O),S.extend(T),S.extend(E),S.extend(D),S.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 F={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`},I=e=>F[e]||e.split(`_`)[0],L=()=>{(0,P.noteOnce)(!1,`Not match any format. Please help to fire a issue about this.`)},R=x({getNow:()=>S(),getFixedDate:e=>S(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=>S().locale(I(e)).localeData().firstDayOfWeek(),getWeekFirstDate:(e,t)=>t.locale(I(e)).weekday(0),getWeek:(e,t)=>t.locale(I(e)).week(),getShortWeekDays:e=>S().locale(I(e)).localeData().weekdaysMin(),getShortMonths:e=>S().locale(I(e)).localeData().monthsShort(),format:(e,t,n)=>t.locale(I(e)).format(n),parse:(e,t,n)=>{let r=I(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=S(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 L(),null}let i=S(n,e,!0).locale(r);if(i.isValid())return i}return t&&L(),null}}}),z=e=>{let{fieldData:t,operator:n,value:r,handleOnChange:i,title:a,className:o,type:c,inputType:u,values:p=[],listsAsArrays:m,separator:y,valueSource:x,disabled:C,testID:w,selectorComponent:T=e.schema.controls.valueSelector,extraProps:E,parseNumbers:D,...O}=e,{valueAsArray:k,multiValueHandler:A,bigIntValueHandler:j,valueListItemClassName:M,inputTypeCoerced:N}=f(e);if(n===`null`||n===`notNull`)return null;let P=t?.placeholder??``;if((n===`between`||n===`notBetween`)&&(c===`select`||c===`text`)&&N!==`date`&&N!==`datetime-local`){if(c===`text`){let e=[`from`,`to`].map((e,t)=>N===`time`?s.createElement(R.TimePicker,{key:e,value:k[t]?S(k[t],`HH:mm:ss`):null,className:M,disabled:C,placeholder:P,onChange:e=>A(e?.format(`HH:mm:ss`)??``,t),...E}):N===`number`?s.createElement(_,{key:e,type:N,value:k[t]??``,className:M,disabled:C,placeholder:P,onChange:e=>A(e,t),...E}):s.createElement(g,{key:e,type:N,value:k[t]??``,className:M,disabled:C,placeholder:P,onChange:e=>A(e.target.value,t),...E}));return s.createElement(`span`,{"data-testid":w,className:o,title:a},e[0],y,e[1])}return s.createElement(l,{...e,skipHook:!0})}switch(c){case`select`:case`multiselect`:return s.createElement(T,{...O,className:o,title:a,value:r,disabled:C,listsAsArrays:m,multiple:c===`multiselect`,handleOnChange:i,options:p,...E});case`textarea`:return s.createElement(g.TextArea,{value:r,title:a,className:o,disabled:C,placeholder:P,onChange:e=>i(e.target.value),...E});case`switch`:return s.createElement(b,{checked:!!r,title:a,className:o,disabled:C,onChange:e=>i(e),...E});case`checkbox`:return s.createElement(`span`,{title:a,className:o},s.createElement(h,{type:`checkbox`,disabled:C,onChange:e=>i(e.target.checked),checked:!!r,...E}));case`radio`:return s.createElement(`span`,{className:o,title:a},p.map(e=>s.createElement(v,{key:e.name,value:e.name,checked:r===e.name,disabled:C,onChange:e=>i(e.target.value),...E},e.label)))}switch(N){case`date`:case`datetime-local`:{if(n===`between`||n===`notBetween`){let e=k.slice(0,2).map(e=>S(e));return s.createElement(R.RangePicker,{value:e.every(e=>e.isValid())?e:void 0,showTime:N===`datetime-local`,className:o,disabled:C,placeholder:[P,P],onChange:e=>{let t=`YYYY-MM-DD${N===`datetime-local`?`THH:mm:ss`:``}`,n=e?.map(e=>e?.isValid()?e.format(t):void 0);i(n?m?n:d(n,`,`):e)},...E})}let e=S(r);return s.createElement(R,{value:e.isValid()?e:void 0,showTime:N===`datetime-local`,className:o,disabled:C,placeholder:P,onChange:(e,t)=>i(t),...E})}case`time`:{let e=S(r,`HH:mm:ss`);return s.createElement(R.TimePicker,{value:e.isValid()?e:void 0,className:o,disabled:C,placeholder:P,onChange:e=>i(e?.format(`HH:mm:ss`)??``),...E})}case`number`:return s.createElement(_,{type:N,value:r,title:a,className:o,disabled:C,placeholder:P,onChange:i,...E})}return u===`bigint`?s.createElement(g,{"data-testid":w,type:N,placeholder:P,value:`${r}`,title:a,className:o,disabled:C,onChange:e=>j(e.target.value),...E}):s.createElement(g,{type:N,value:r,title:a,className:o,disabled:C,placeholder:P,onChange:e=>i(e.target.value),...E})},B=({className:e,handleOnChange:t,options:n,value:r,title:i,disabled:a,multiple:o,listsAsArrays:c,testID:l,rule:u,ruleGroup:f,rules:m,level:h,path:g,context:_,validation:v,operator:b,field:x,fieldData:S,schema:C,...w})=>{let{onChange:T}=p({handleOnChange:t,listsAsArrays:!1,multiple:!1,value:r}),{onChange:E,val:D}=p({handleOnChange:t,listsAsArrays:o||c,multiple:o,value:r}),O=s.useCallback(e=>{o&&!c&&Array.isArray(e)?T(d(e)):E(e)},[c,o,T,E]);return s.createElement(y,{...o?{mode:`multiple`,allowClear:!0}:{},title:i,className:e,popupMatchSelectWidth:!1,disabled:a,value:D,onChange:O,optionFilterProp:`label`,options:n,...w})},V={actionElement:A,dragHandle:j,notToggle:M,shiftActions:N,valueEditor:z,valueSelector:B},H={removeGroup:{label:s.createElement(e,null)},removeRule:{label:s.createElement(e,null)},cloneRule:{label:s.createElement(t,null)},cloneRuleGroup:{label:s.createElement(t,null)},lockGroup:{label:s.createElement(a,null)},lockRule:{label:s.createElement(a,null)},lockGroupDisabled:{label:s.createElement(i,null)},lockRuleDisabled:{label:s.createElement(i,null)},shiftActionUp:{label:s.createElement(o,null)},shiftActionDown:{label:s.createElement(n,null)}},U=u({controlElements:V,translations:H});export{A as AntDActionElement,j as AntDDragHandle,M as AntDNotToggle,N as AntDShiftActions,z as AntDValueEditor,B as AntDValueSelector,U as QueryBuilderAntD,V as antdControlElements,H as antdTranslations};
2
2
  //# sourceMappingURL=react-querybuilder_antd.production.mjs.map