@react-querybuilder/datetime 8.11.1 → 8.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/chunk-DrjzjjTJ.mjs +23 -0
  2. package/dist/chunk-Dv2ph0Ay.js +23 -0
  3. package/dist/cjs/getDatetimeRuleProcessorSQL-B0uQUU_F.js +2 -0
  4. package/dist/cjs/{getDatetimeRuleProcessorSQL-CSxxM8ce.js.map → getDatetimeRuleProcessorSQL-B0uQUU_F.js.map} +1 -1
  5. package/dist/cjs/{getDatetimeRuleProcessorSQL-COEhnVIZ.js → getDatetimeRuleProcessorSQL-Dkg4HEtH.js} +2 -31
  6. package/dist/cjs/{getDatetimeRuleProcessorSQL-COEhnVIZ.js.map → getDatetimeRuleProcessorSQL-Dkg4HEtH.js.map} +1 -1
  7. package/dist/cjs/react-querybuilder_datetime.cjs.development.d.ts +1 -1
  8. package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.d.ts +1 -1
  9. package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.js +2 -2
  10. package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.d.ts +1 -1
  11. package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.js +26 -2
  12. package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.js.map +1 -1
  13. package/dist/cjs/react-querybuilder_datetime.cjs.development.js +2 -2
  14. package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.d.ts +1 -1
  15. package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.js +1 -1
  16. package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.d.ts +1 -1
  17. package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.js +2 -2
  18. package/dist/cjs/react-querybuilder_datetime.cjs.production.d.ts +1 -1
  19. package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.d.ts +1 -1
  20. package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.js +1 -1
  21. package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.js.map +1 -1
  22. package/dist/cjs/react-querybuilder_datetime.cjs.production.dayjs.d.ts +1 -1
  23. package/dist/cjs/react-querybuilder_datetime.cjs.production.dayjs.js +1 -1
  24. package/dist/cjs/react-querybuilder_datetime.cjs.production.dayjs.js.map +1 -1
  25. package/dist/cjs/react-querybuilder_datetime.cjs.production.js +1 -1
  26. package/dist/cjs/react-querybuilder_datetime.cjs.production.js.map +1 -1
  27. package/dist/cjs/react-querybuilder_datetime.cjs.production.jsdate.d.ts +1 -1
  28. package/dist/cjs/react-querybuilder_datetime.cjs.production.jsdate.js +1 -1
  29. package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.d.ts +1 -1
  30. package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.js +1 -1
  31. package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.js.map +1 -1
  32. package/dist/cjs/{types-A60rB27l.d.ts → types-BF3ibCEu.d.ts} +39 -4
  33. package/dist/{getDatetimeRuleProcessorSQL-CSl2zGza.mjs → getDatetimeRuleProcessorSQL-Cf79Th_c.mjs} +1 -1
  34. package/dist/{getDatetimeRuleProcessorSQL-CSl2zGza.mjs.map → getDatetimeRuleProcessorSQL-Cf79Th_c.mjs.map} +1 -1
  35. package/dist/{getDatetimeRuleProcessorSQL-B8y0RI7t.js → getDatetimeRuleProcessorSQL-DfPnCZiT.js} +6 -6
  36. package/dist/{getDatetimeRuleProcessorSQL-B8y0RI7t.js.map → getDatetimeRuleProcessorSQL-DfPnCZiT.js.map} +1 -1
  37. package/dist/react-querybuilder_datetime.d.mts +1 -1
  38. package/dist/react-querybuilder_datetime.date-fns.d.mts +1 -1
  39. package/dist/react-querybuilder_datetime.date-fns.mjs +1 -1
  40. package/dist/react-querybuilder_datetime.dayjs.d.mts +1 -1
  41. package/dist/react-querybuilder_datetime.dayjs.mjs +1 -1
  42. package/dist/react-querybuilder_datetime.jsdate.d.mts +1 -1
  43. package/dist/react-querybuilder_datetime.jsdate.mjs +1 -1
  44. package/dist/react-querybuilder_datetime.legacy-esm.d.ts +1 -1
  45. package/dist/react-querybuilder_datetime.legacy-esm.date-fns.d.ts +1 -1
  46. package/dist/react-querybuilder_datetime.legacy-esm.date-fns.js +1 -1
  47. package/dist/react-querybuilder_datetime.legacy-esm.dayjs.d.ts +1 -1
  48. package/dist/react-querybuilder_datetime.legacy-esm.dayjs.js +1 -1
  49. package/dist/react-querybuilder_datetime.legacy-esm.js +1 -1
  50. package/dist/react-querybuilder_datetime.legacy-esm.jsdate.d.ts +1 -1
  51. package/dist/react-querybuilder_datetime.legacy-esm.jsdate.js +1 -1
  52. package/dist/react-querybuilder_datetime.legacy-esm.luxon.d.ts +1 -1
  53. package/dist/react-querybuilder_datetime.legacy-esm.luxon.js +1 -1
  54. package/dist/react-querybuilder_datetime.luxon.d.mts +1 -1
  55. package/dist/react-querybuilder_datetime.luxon.mjs +1 -1
  56. package/dist/react-querybuilder_datetime.mjs +1 -1
  57. package/dist/react-querybuilder_datetime.production.d.mts +1 -1
  58. package/dist/react-querybuilder_datetime.production.date-fns.d.mts +1 -1
  59. package/dist/react-querybuilder_datetime.production.date-fns.mjs +1 -1
  60. package/dist/react-querybuilder_datetime.production.dayjs.d.mts +1 -1
  61. package/dist/react-querybuilder_datetime.production.dayjs.mjs +1 -1
  62. package/dist/react-querybuilder_datetime.production.jsdate.d.mts +1 -1
  63. package/dist/react-querybuilder_datetime.production.jsdate.mjs +1 -1
  64. package/dist/react-querybuilder_datetime.production.luxon.d.mts +1 -1
  65. package/dist/react-querybuilder_datetime.production.luxon.mjs +1 -1
  66. package/dist/react-querybuilder_datetime.production.mjs +1 -1
  67. package/dist/{types-BjHLhGXX.d.mts → types-CU16s8jw.d.ts} +60 -24
  68. package/dist/{types-Dq7BlQzI.d.ts → types-DNawVAiI.d.mts} +60 -24
  69. package/package.json +10 -10
  70. package/dist/cjs/getDatetimeRuleProcessorSQL-CSxxM8ce.js +0 -2
@@ -1,4 +1,5 @@
1
1
  import { RulesLogic } from "json-logic-js";
2
+ import "react";
2
3
 
3
4
  //#region ../../node_modules/type-fest/source/union-to-intersection.d.ts
4
5
 
@@ -134,7 +135,7 @@ const anyA = get(anyObject, 'a');
134
135
  @category Type Guard
135
136
  @category Utilities
136
137
  */
137
- type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
138
+ type IsAny<T$1> = 0 extends 1 & NoInfer<T$1> ? true : false;
138
139
  //#endregion
139
140
  //#region ../../node_modules/type-fest/source/is-optional-key-of.d.ts
140
141
  /**
@@ -287,7 +288,7 @@ endIfEqual('abc', '123');
287
288
  @category Type Guard
288
289
  @category Utilities
289
290
  */
290
- type IsNever<T> = [T] extends [never] ? true : false;
291
+ type IsNever<T$1> = [T$1] extends [never] ? true : false;
291
292
  //#endregion
292
293
  //#region ../../node_modules/type-fest/source/if.d.ts
293
294
  /**
@@ -344,6 +345,41 @@ type B = IfEqual<string, number, 'equal', 'not equal'>;
344
345
  //=> 'not equal'
345
346
  ```
346
347
 
348
+ 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:
349
+
350
+ @example
351
+ ```
352
+ import type {If, IsEqual, StringRepeat} from 'type-fest';
353
+
354
+ type HundredZeroes = StringRepeat<'0', 100>;
355
+
356
+ // The following implementation is not tail recursive
357
+ type Includes<S extends string, Char extends string> =
358
+ S extends `${infer First}${infer Rest}`
359
+ ? If<IsEqual<First, Char>,
360
+ 'found',
361
+ Includes<Rest, Char>>
362
+ : 'not found';
363
+
364
+ // Hence, instantiations with long strings will fail
365
+ // @ts-expect-error
366
+ type Fails = Includes<HundredZeroes, '1'>;
367
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
368
+ // Error: Type instantiation is excessively deep and possibly infinite.
369
+
370
+ // However, if we use a simple conditional instead of `If`, the implementation becomes tail-recursive
371
+ type IncludesWithoutIf<S extends string, Char extends string> =
372
+ S extends `${infer First}${infer Rest}`
373
+ ? IsEqual<First, Char> extends true
374
+ ? 'found'
375
+ : IncludesWithoutIf<Rest, Char>
376
+ : 'not found';
377
+
378
+ // Now, instantiations with long strings will work
379
+ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
380
+ //=> 'not found'
381
+ ```
382
+
347
383
  @category Type Guard
348
384
  @category Utilities
349
385
  */
@@ -381,7 +417,7 @@ type UnknownArray = readonly unknown[];
381
417
  /**
382
418
  Returns whether the given array `T` is readonly.
383
419
  */
384
- type IsArrayReadonly<T extends UnknownArray> = If<IsNever<T>, false, T extends unknown[] ? false : true>;
420
+ type IsArrayReadonly<T$1 extends UnknownArray> = If<IsNever<T$1>, false, T$1 extends unknown[] ? false : true>;
385
421
  //#endregion
386
422
  //#region ../../node_modules/type-fest/source/simplify.d.ts
387
423
  /**
@@ -438,10 +474,10 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
438
474
  ```
439
475
 
440
476
  @link https://github.com/microsoft/TypeScript/issues/15300
441
- @see SimplifyDeep
477
+ @see {@link SimplifyDeep}
442
478
  @category Object
443
479
  */
444
- type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
480
+ type Simplify<T$1> = { [KeyType in keyof T$1]: T$1[KeyType] } & {};
445
481
  //#endregion
446
482
  //#region ../../node_modules/type-fest/source/is-equal.d.ts
447
483
  /**
@@ -562,7 +598,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
562
598
  // => { foo: 'bar'; qux?: 'baz' | undefined; }
563
599
  ```
564
600
 
565
- @see PickIndexSignature
601
+ @see {@link PickIndexSignature}
566
602
  @category Object
567
603
  */
568
604
  type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
@@ -610,7 +646,7 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
610
646
  // }
611
647
  ```
612
648
 
613
- @see OmitIndexSignature
649
+ @see {@link OmitIndexSignature}
614
650
  @category Object
615
651
  */
616
652
  type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
@@ -693,7 +729,7 @@ type Any = HomomorphicPick<{a: 1; b: 2} | {c: 3}, any>;
693
729
  type IndexSignature = HomomorphicPick<{[k: string]: unknown}, number>;
694
730
  //=> {}
695
731
  */
696
- type HomomorphicPick<T, Keys extends KeysOfUnion<T>> = { [P in keyof T as Extract<P, Keys>]: T[P] };
732
+ type HomomorphicPick<T$1, Keys extends KeysOfUnion<T$1>> = { [P in keyof T$1 as Extract<P, Keys>]: T$1[P] };
697
733
  /**
698
734
  Merges user specified options with default options.
699
735
 
@@ -902,7 +938,7 @@ type RequireAtLeastOne<ObjectType, KeysType extends keyof ObjectType> = { [Key i
902
938
  /**
903
939
  * Adds an `unknown` index property to an interface.
904
940
  */
905
- type WithUnknownIndex<T> = T & {
941
+ type WithUnknownIndex<T$1> = T$1 & {
906
942
  [key: string]: unknown;
907
943
  };
908
944
  /**
@@ -1031,15 +1067,15 @@ interface RuleType<F extends string = string, O extends string = string, V$1 = a
1031
1067
  * The main rule group type. This type is used for query definitions as well as
1032
1068
  * all sub-groups of queries.
1033
1069
  */
1034
- interface RuleGroupType<R extends RuleType = RuleType, C extends string = string> extends CommonRuleAndGroupProperties {
1070
+ interface RuleGroupType<R$1 extends RuleType = RuleType, C extends string = string> extends CommonRuleAndGroupProperties {
1035
1071
  combinator: C;
1036
- rules: RuleGroupArray<RuleGroupType<R, C>, R>;
1072
+ rules: RuleGroupArray<RuleGroupType<R$1, C>, R$1>;
1037
1073
  not?: boolean;
1038
1074
  }
1039
1075
  /**
1040
1076
  * The type of the `rules` array in a {@link RuleGroupType}.
1041
1077
  */
1042
- type RuleGroupArray<RG extends RuleGroupType = RuleGroupType, R extends RuleType = RuleType> = (R | RG)[];
1078
+ type RuleGroupArray<RG extends RuleGroupType = RuleGroupType, R$1 extends RuleType = RuleType> = (R$1 | RG)[];
1043
1079
  /**
1044
1080
  * Default values for the `operator` property.
1045
1081
  *
@@ -1056,9 +1092,9 @@ type MappedTuple<Tuple extends Array<unknown>, Result extends Array<unknown> = [
1056
1092
  * The main rule group interface when using independent combinators. This type is used
1057
1093
  * for query definitions as well as all sub-groups of queries.
1058
1094
  */
1059
- interface RuleGroupTypeIC<R extends RuleType = RuleType, C extends string = string> extends Except<RuleGroupType<R, C>, "combinator" | "rules"> {
1095
+ interface RuleGroupTypeIC<R$1 extends RuleType = RuleType, C extends string = string> extends Except<RuleGroupType<R$1, C>, "combinator" | "rules"> {
1060
1096
  combinator?: undefined;
1061
- rules: RuleGroupICArray<RuleGroupTypeIC<R, C>, R, C>;
1097
+ rules: RuleGroupICArray<RuleGroupTypeIC<R$1, C>, R$1, C>;
1062
1098
  /**
1063
1099
  * Only used when adding a rule to a query that uses independent combinators
1064
1100
  */
@@ -1067,11 +1103,11 @@ interface RuleGroupTypeIC<R extends RuleType = RuleType, C extends string = stri
1067
1103
  /**
1068
1104
  * Shorthand for "either {@link RuleGroupType} or {@link RuleGroupTypeIC}".
1069
1105
  */
1070
- type RuleGroupTypeAny<R extends RuleType = RuleType, C extends string = string> = RuleGroupType<R, C> | RuleGroupTypeIC<R, C>;
1106
+ type RuleGroupTypeAny<R$1 extends RuleType = RuleType, C extends string = string> = RuleGroupType<R$1, C> | RuleGroupTypeIC<R$1, C>;
1071
1107
  /**
1072
1108
  * The type of the `rules` array in a {@link RuleGroupTypeIC}.
1073
1109
  */
1074
- type RuleGroupICArray<RG extends RuleGroupTypeIC = RuleGroupTypeIC, R extends RuleType = RuleType, C extends string = string> = [R | RG] | [R | RG, ...MappedTuple<[C, R | RG]>] | ((R | RG)[] & {
1110
+ 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)[] & {
1075
1111
  length: 0;
1076
1112
  });
1077
1113
  //#endregion
@@ -1123,7 +1159,7 @@ type ValueEditorType = "text" | "select" | "checkbox" | "radio" | "textarea" | "
1123
1159
  type ValueSources = ["value"] | ["value", "field"] | ["field", "value"] | ["field"];
1124
1160
  type ValueSourceFlexibleOptions = ToFlexibleOptionArrays<ValueSources>;
1125
1161
  type ToFlexibleOptionArrays<Sources extends readonly string[]> = Sources extends unknown ? { [K in keyof Sources]: FlexibleOption<Sources[K]> } : never;
1126
- type WithOptionalClassName<T> = T & {
1162
+ type WithOptionalClassName<T$1> = T$1 & {
1127
1163
  className?: Classname;
1128
1164
  };
1129
1165
  /**
@@ -1146,17 +1182,17 @@ type MatchMode = "all" | "some" | "none" | "atLeast" | "atMost" | "exactly";
1146
1182
  /**
1147
1183
  * Base for all Field types/interfaces.
1148
1184
  */
1149
- 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>> {
1185
+ interface BaseFullField<FieldName extends string = string, OperatorName$1 extends string = string, ValueName extends string = string, OperatorObj extends FullOption = FullOption<OperatorName$1>, ValueObj extends FullOption = FullOption<ValueName>> extends WithOptionalClassName<BaseFullOption<FieldName>> {
1150
1186
  id?: string;
1151
- operators?: FlexibleOptionList<OperatorObj> | OperatorName[] | FlexibleOption<OperatorName>[] | (OperatorName | FlexibleOption<OperatorName>)[];
1152
- valueEditorType?: ValueEditorType | ((operator: OperatorName) => ValueEditorType);
1153
- valueSources?: ValueSources | ValueSourceFlexibleOptions | ((operator: OperatorName) => ValueSources | ValueSourceFlexibleOptions);
1187
+ operators?: FlexibleOptionList<OperatorObj> | OperatorName$1[] | FlexibleOption<OperatorName$1>[] | (OperatorName$1 | FlexibleOption<OperatorName$1>)[];
1188
+ valueEditorType?: ValueEditorType | ((operator: OperatorName$1) => ValueEditorType);
1189
+ valueSources?: ValueSources | ValueSourceFlexibleOptions | ((operator: OperatorName$1) => ValueSources | ValueSourceFlexibleOptions);
1154
1190
  inputType?: InputType | null;
1155
1191
  values?: FlexibleOptionList<ValueObj>;
1156
1192
  matchModes?: boolean | MatchMode[] | FlexibleOption<MatchMode>[];
1157
1193
  /** Properties of items in the value. */
1158
1194
  subproperties?: FlexibleOptionList<FullField>;
1159
- defaultOperator?: OperatorName;
1195
+ defaultOperator?: OperatorName$1;
1160
1196
  defaultValue?: any;
1161
1197
  placeholder?: string;
1162
1198
  validator?: RuleValidator;
@@ -1174,7 +1210,7 @@ interface BaseFullField<FieldName extends string = string, OperatorName extends
1174
1210
  *
1175
1211
  * @group Option Lists
1176
1212
  */
1177
- 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>>;
1213
+ type FullField<FieldName extends string = string, OperatorName$1 extends string = string, ValueName extends string = string, OperatorObj extends FullOption = FullOption<OperatorName$1>, ValueObj extends FullOption = FullOption<ValueName>> = Simplify<FullOption<FieldName> & BaseFullField<FieldName, OperatorName$1, ValueName, OperatorObj, ValueObj>>;
1178
1214
  /**
1179
1215
  * Allowed values of the {@link FullOperator} property `arity`. A value of `"unary"` or
1180
1216
  * a number less than two will cause the default {@link react-querybuilder!ValueEditor ValueEditor} to render `null`.
@@ -1713,4 +1749,4 @@ type IsDateFieldFunction = (...[rule, opts]: Parameters<RuleProcessor>) => boole
1713
1749
  type IsDateField = IsDateFieldFunction | Record<string, unknown> | Record<string, unknown>[] | boolean | undefined;
1714
1750
  //#endregion
1715
1751
  export { RuleProcessor as _, RQBJsonLogicDateAfter as a, RQBJsonLogicDateIn as c, RQBJsonLogicDateNotOn as d, RQBJsonLogicDateOn as f, ExportOperatorMap as g, RQBJsonLogicDateTimeOperations as h, RQBDateTimeLibraryAPI as i, RQBJsonLogicDateNotBetween as l, RQBJsonLogicDateOnOrBefore as m, IsDateFieldFunction as n, RQBJsonLogicDateBefore as o, RQBJsonLogicDateOnOrAfter as p, RQBDateTimeJsonLogic as r, RQBJsonLogicDateBetween as s, IsDateField as t, RQBJsonLogicDateNotIn as u, ValueProcessorByRule as v };
1716
- //# sourceMappingURL=types-BjHLhGXX.d.mts.map
1752
+ //# sourceMappingURL=types-CU16s8jw.d.ts.map
@@ -1,4 +1,5 @@
1
1
  import { RulesLogic } from "json-logic-js";
2
+ import "react";
2
3
 
3
4
  //#region ../../node_modules/type-fest/source/union-to-intersection.d.ts
4
5
 
@@ -134,7 +135,7 @@ const anyA = get(anyObject, 'a');
134
135
  @category Type Guard
135
136
  @category Utilities
136
137
  */
137
- type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
138
+ type IsAny<T$1> = 0 extends 1 & NoInfer<T$1> ? true : false;
138
139
  //#endregion
139
140
  //#region ../../node_modules/type-fest/source/is-optional-key-of.d.ts
140
141
  /**
@@ -287,7 +288,7 @@ endIfEqual('abc', '123');
287
288
  @category Type Guard
288
289
  @category Utilities
289
290
  */
290
- type IsNever<T> = [T] extends [never] ? true : false;
291
+ type IsNever<T$1> = [T$1] extends [never] ? true : false;
291
292
  //#endregion
292
293
  //#region ../../node_modules/type-fest/source/if.d.ts
293
294
  /**
@@ -344,6 +345,41 @@ type B = IfEqual<string, number, 'equal', 'not equal'>;
344
345
  //=> 'not equal'
345
346
  ```
346
347
 
348
+ 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:
349
+
350
+ @example
351
+ ```
352
+ import type {If, IsEqual, StringRepeat} from 'type-fest';
353
+
354
+ type HundredZeroes = StringRepeat<'0', 100>;
355
+
356
+ // The following implementation is not tail recursive
357
+ type Includes<S extends string, Char extends string> =
358
+ S extends `${infer First}${infer Rest}`
359
+ ? If<IsEqual<First, Char>,
360
+ 'found',
361
+ Includes<Rest, Char>>
362
+ : 'not found';
363
+
364
+ // Hence, instantiations with long strings will fail
365
+ // @ts-expect-error
366
+ type Fails = Includes<HundredZeroes, '1'>;
367
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
368
+ // Error: Type instantiation is excessively deep and possibly infinite.
369
+
370
+ // However, if we use a simple conditional instead of `If`, the implementation becomes tail-recursive
371
+ type IncludesWithoutIf<S extends string, Char extends string> =
372
+ S extends `${infer First}${infer Rest}`
373
+ ? IsEqual<First, Char> extends true
374
+ ? 'found'
375
+ : IncludesWithoutIf<Rest, Char>
376
+ : 'not found';
377
+
378
+ // Now, instantiations with long strings will work
379
+ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
380
+ //=> 'not found'
381
+ ```
382
+
347
383
  @category Type Guard
348
384
  @category Utilities
349
385
  */
@@ -381,7 +417,7 @@ type UnknownArray = readonly unknown[];
381
417
  /**
382
418
  Returns whether the given array `T` is readonly.
383
419
  */
384
- type IsArrayReadonly<T extends UnknownArray> = If<IsNever<T>, false, T extends unknown[] ? false : true>;
420
+ type IsArrayReadonly<T$1 extends UnknownArray> = If<IsNever<T$1>, false, T$1 extends unknown[] ? false : true>;
385
421
  //#endregion
386
422
  //#region ../../node_modules/type-fest/source/simplify.d.ts
387
423
  /**
@@ -438,10 +474,10 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
438
474
  ```
439
475
 
440
476
  @link https://github.com/microsoft/TypeScript/issues/15300
441
- @see SimplifyDeep
477
+ @see {@link SimplifyDeep}
442
478
  @category Object
443
479
  */
444
- type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
480
+ type Simplify<T$1> = { [KeyType in keyof T$1]: T$1[KeyType] } & {};
445
481
  //#endregion
446
482
  //#region ../../node_modules/type-fest/source/is-equal.d.ts
447
483
  /**
@@ -562,7 +598,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
562
598
  // => { foo: 'bar'; qux?: 'baz' | undefined; }
563
599
  ```
564
600
 
565
- @see PickIndexSignature
601
+ @see {@link PickIndexSignature}
566
602
  @category Object
567
603
  */
568
604
  type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
@@ -610,7 +646,7 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
610
646
  // }
611
647
  ```
612
648
 
613
- @see OmitIndexSignature
649
+ @see {@link OmitIndexSignature}
614
650
  @category Object
615
651
  */
616
652
  type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
@@ -693,7 +729,7 @@ type Any = HomomorphicPick<{a: 1; b: 2} | {c: 3}, any>;
693
729
  type IndexSignature = HomomorphicPick<{[k: string]: unknown}, number>;
694
730
  //=> {}
695
731
  */
696
- type HomomorphicPick<T, Keys extends KeysOfUnion<T>> = { [P in keyof T as Extract<P, Keys>]: T[P] };
732
+ type HomomorphicPick<T$1, Keys extends KeysOfUnion<T$1>> = { [P in keyof T$1 as Extract<P, Keys>]: T$1[P] };
697
733
  /**
698
734
  Merges user specified options with default options.
699
735
 
@@ -902,7 +938,7 @@ type RequireAtLeastOne<ObjectType, KeysType extends keyof ObjectType> = { [Key i
902
938
  /**
903
939
  * Adds an `unknown` index property to an interface.
904
940
  */
905
- type WithUnknownIndex<T> = T & {
941
+ type WithUnknownIndex<T$1> = T$1 & {
906
942
  [key: string]: unknown;
907
943
  };
908
944
  /**
@@ -1031,15 +1067,15 @@ interface RuleType<F extends string = string, O extends string = string, V$1 = a
1031
1067
  * The main rule group type. This type is used for query definitions as well as
1032
1068
  * all sub-groups of queries.
1033
1069
  */
1034
- interface RuleGroupType<R extends RuleType = RuleType, C extends string = string> extends CommonRuleAndGroupProperties {
1070
+ interface RuleGroupType<R$1 extends RuleType = RuleType, C extends string = string> extends CommonRuleAndGroupProperties {
1035
1071
  combinator: C;
1036
- rules: RuleGroupArray<RuleGroupType<R, C>, R>;
1072
+ rules: RuleGroupArray<RuleGroupType<R$1, C>, R$1>;
1037
1073
  not?: boolean;
1038
1074
  }
1039
1075
  /**
1040
1076
  * The type of the `rules` array in a {@link RuleGroupType}.
1041
1077
  */
1042
- type RuleGroupArray<RG extends RuleGroupType = RuleGroupType, R extends RuleType = RuleType> = (R | RG)[];
1078
+ type RuleGroupArray<RG extends RuleGroupType = RuleGroupType, R$1 extends RuleType = RuleType> = (R$1 | RG)[];
1043
1079
  /**
1044
1080
  * Default values for the `operator` property.
1045
1081
  *
@@ -1056,9 +1092,9 @@ type MappedTuple<Tuple extends Array<unknown>, Result extends Array<unknown> = [
1056
1092
  * The main rule group interface when using independent combinators. This type is used
1057
1093
  * for query definitions as well as all sub-groups of queries.
1058
1094
  */
1059
- interface RuleGroupTypeIC<R extends RuleType = RuleType, C extends string = string> extends Except<RuleGroupType<R, C>, "combinator" | "rules"> {
1095
+ interface RuleGroupTypeIC<R$1 extends RuleType = RuleType, C extends string = string> extends Except<RuleGroupType<R$1, C>, "combinator" | "rules"> {
1060
1096
  combinator?: undefined;
1061
- rules: RuleGroupICArray<RuleGroupTypeIC<R, C>, R, C>;
1097
+ rules: RuleGroupICArray<RuleGroupTypeIC<R$1, C>, R$1, C>;
1062
1098
  /**
1063
1099
  * Only used when adding a rule to a query that uses independent combinators
1064
1100
  */
@@ -1067,11 +1103,11 @@ interface RuleGroupTypeIC<R extends RuleType = RuleType, C extends string = stri
1067
1103
  /**
1068
1104
  * Shorthand for "either {@link RuleGroupType} or {@link RuleGroupTypeIC}".
1069
1105
  */
1070
- type RuleGroupTypeAny<R extends RuleType = RuleType, C extends string = string> = RuleGroupType<R, C> | RuleGroupTypeIC<R, C>;
1106
+ type RuleGroupTypeAny<R$1 extends RuleType = RuleType, C extends string = string> = RuleGroupType<R$1, C> | RuleGroupTypeIC<R$1, C>;
1071
1107
  /**
1072
1108
  * The type of the `rules` array in a {@link RuleGroupTypeIC}.
1073
1109
  */
1074
- type RuleGroupICArray<RG extends RuleGroupTypeIC = RuleGroupTypeIC, R extends RuleType = RuleType, C extends string = string> = [R | RG] | [R | RG, ...MappedTuple<[C, R | RG]>] | ((R | RG)[] & {
1110
+ 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)[] & {
1075
1111
  length: 0;
1076
1112
  });
1077
1113
  //#endregion
@@ -1123,7 +1159,7 @@ type ValueEditorType = "text" | "select" | "checkbox" | "radio" | "textarea" | "
1123
1159
  type ValueSources = ["value"] | ["value", "field"] | ["field", "value"] | ["field"];
1124
1160
  type ValueSourceFlexibleOptions = ToFlexibleOptionArrays<ValueSources>;
1125
1161
  type ToFlexibleOptionArrays<Sources extends readonly string[]> = Sources extends unknown ? { [K in keyof Sources]: FlexibleOption<Sources[K]> } : never;
1126
- type WithOptionalClassName<T> = T & {
1162
+ type WithOptionalClassName<T$1> = T$1 & {
1127
1163
  className?: Classname;
1128
1164
  };
1129
1165
  /**
@@ -1146,17 +1182,17 @@ type MatchMode = "all" | "some" | "none" | "atLeast" | "atMost" | "exactly";
1146
1182
  /**
1147
1183
  * Base for all Field types/interfaces.
1148
1184
  */
1149
- 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>> {
1185
+ interface BaseFullField<FieldName extends string = string, OperatorName$1 extends string = string, ValueName extends string = string, OperatorObj extends FullOption = FullOption<OperatorName$1>, ValueObj extends FullOption = FullOption<ValueName>> extends WithOptionalClassName<BaseFullOption<FieldName>> {
1150
1186
  id?: string;
1151
- operators?: FlexibleOptionList<OperatorObj> | OperatorName[] | FlexibleOption<OperatorName>[] | (OperatorName | FlexibleOption<OperatorName>)[];
1152
- valueEditorType?: ValueEditorType | ((operator: OperatorName) => ValueEditorType);
1153
- valueSources?: ValueSources | ValueSourceFlexibleOptions | ((operator: OperatorName) => ValueSources | ValueSourceFlexibleOptions);
1187
+ operators?: FlexibleOptionList<OperatorObj> | OperatorName$1[] | FlexibleOption<OperatorName$1>[] | (OperatorName$1 | FlexibleOption<OperatorName$1>)[];
1188
+ valueEditorType?: ValueEditorType | ((operator: OperatorName$1) => ValueEditorType);
1189
+ valueSources?: ValueSources | ValueSourceFlexibleOptions | ((operator: OperatorName$1) => ValueSources | ValueSourceFlexibleOptions);
1154
1190
  inputType?: InputType | null;
1155
1191
  values?: FlexibleOptionList<ValueObj>;
1156
1192
  matchModes?: boolean | MatchMode[] | FlexibleOption<MatchMode>[];
1157
1193
  /** Properties of items in the value. */
1158
1194
  subproperties?: FlexibleOptionList<FullField>;
1159
- defaultOperator?: OperatorName;
1195
+ defaultOperator?: OperatorName$1;
1160
1196
  defaultValue?: any;
1161
1197
  placeholder?: string;
1162
1198
  validator?: RuleValidator;
@@ -1174,7 +1210,7 @@ interface BaseFullField<FieldName extends string = string, OperatorName extends
1174
1210
  *
1175
1211
  * @group Option Lists
1176
1212
  */
1177
- 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>>;
1213
+ type FullField<FieldName extends string = string, OperatorName$1 extends string = string, ValueName extends string = string, OperatorObj extends FullOption = FullOption<OperatorName$1>, ValueObj extends FullOption = FullOption<ValueName>> = Simplify<FullOption<FieldName> & BaseFullField<FieldName, OperatorName$1, ValueName, OperatorObj, ValueObj>>;
1178
1214
  /**
1179
1215
  * Allowed values of the {@link FullOperator} property `arity`. A value of `"unary"` or
1180
1216
  * a number less than two will cause the default {@link react-querybuilder!ValueEditor ValueEditor} to render `null`.
@@ -1713,4 +1749,4 @@ type IsDateFieldFunction = (...[rule, opts]: Parameters<RuleProcessor>) => boole
1713
1749
  type IsDateField = IsDateFieldFunction | Record<string, unknown> | Record<string, unknown>[] | boolean | undefined;
1714
1750
  //#endregion
1715
1751
  export { RuleProcessor as _, RQBJsonLogicDateAfter as a, RQBJsonLogicDateIn as c, RQBJsonLogicDateNotOn as d, RQBJsonLogicDateOn as f, ExportOperatorMap as g, RQBJsonLogicDateTimeOperations as h, RQBDateTimeLibraryAPI as i, RQBJsonLogicDateNotBetween as l, RQBJsonLogicDateOnOrBefore as m, IsDateFieldFunction as n, RQBJsonLogicDateBefore as o, RQBJsonLogicDateOnOrAfter as p, RQBDateTimeJsonLogic as r, RQBJsonLogicDateBetween as s, IsDateField as t, RQBJsonLogicDateNotIn as u, ValueProcessorByRule as v };
1716
- //# sourceMappingURL=types-Dq7BlQzI.d.ts.map
1752
+ //# sourceMappingURL=types-DNawVAiI.d.mts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-querybuilder/datetime",
3
3
  "description": "Date/time features for react-querybuilder",
4
- "version": "8.11.1",
4
+ "version": "8.12.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -87,33 +87,33 @@
87
87
  },
88
88
  "devDependencies": {
89
89
  "@date-fns/tz": "^1.4.1",
90
- "@electric-sql/pglite": "^0.3.11",
90
+ "@electric-sql/pglite": "^0.3.14",
91
91
  "@testing-library/dom": "^10.4.1",
92
92
  "@testing-library/react": "^16.3.0",
93
93
  "@testing-library/user-event": "14.5.2",
94
94
  "@types/luxon": "^3.7.1",
95
95
  "@types/react": "^19.2.2",
96
- "@vitejs/plugin-react": "^5.0.4",
96
+ "@vitejs/plugin-react": "^5.1.0",
97
97
  "date-fns": "^4.1.0",
98
- "dayjs": "^1.11.18",
98
+ "dayjs": "^1.11.19",
99
99
  "json-logic-js": "^2.0.5",
100
100
  "jsonata": "^2.1.0",
101
101
  "luxon": "^3.7.2",
102
- "mongodb-memory-server-core": "^10.2.3",
103
- "mongoose": "^8.19.2",
102
+ "mongodb-memory-server-core": "^10.3.0",
103
+ "mongoose": "^8.19.3",
104
104
  "react": "^19.2.0",
105
105
  "react-dom": "^19.2.0",
106
- "react-querybuilder": "8.11.1",
106
+ "react-querybuilder": "8.12.0",
107
107
  "rollup-plugin-visualizer": "^6.0.5",
108
108
  "typescript": "^5.9.3",
109
- "vite": "^7.1.11"
109
+ "vite": "^7.2.1"
110
110
  },
111
111
  "peerDependencies": {
112
112
  "date-fns": "^4.1.0",
113
113
  "dayjs": "^1.11.13",
114
114
  "luxon": "^3.5.0",
115
115
  "react": ">=18",
116
- "react-querybuilder": "8.11.1"
116
+ "react-querybuilder": "8.12.0"
117
117
  },
118
118
  "peerDependenciesMeta": {
119
119
  "date-fns": {
@@ -126,5 +126,5 @@
126
126
  "optional": true
127
127
  }
128
128
  },
129
- "gitHead": "0510575ca34fc6665c238a31312f73152f2ad625"
129
+ "gitHead": "8166380d6819d94bb852126be60dff0852e481a3"
130
130
  }
@@ -1,2 +0,0 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(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},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`react-querybuilder`);c=s(c);const l=e=>typeof e==`string`&&/^\d{4}-\d{2}-\d{2}$/.test(e),u=(...[e,t])=>e.operator!==`contains`&&e.operator!==`beginsWith`&&e.operator!==`endsWith`&&e.operator!==`doesNotContain`&&e.operator!==`doesNotBeginWith`&&e.operator!==`doesNotEndWith`&&e.operator!==`null`&&e.operator!==`notNull`&&/^(?:date|datetime|datetimeoffset|timestamp)\b/i.test(t?.fieldData?.datatype),d=(e,...[t,n])=>typeof e==`boolean`?e:typeof e==`function`?e(t,n):Array.isArray(e)?e.some(e=>Object.entries(e).every(([e,t])=>n?.fieldData?.[e]===t)):typeof e==`object`?Object.entries(e).every(([e,t])=>n?.fieldData?.[e]===t):u(t,n),f=({isAfter:e,isBefore:t,isSame:n})=>({dateAfter:(t,n)=>e(t,n),dateBefore:(e,n)=>t(e,n),dateBetween:(r,i,a)=>n(i,r)||n(i,a)||e(i,r)&&t(i,a)||e(i,a)&&t(i,r),dateNotBetween:(r,i,a)=>!n(i,r)&&!n(i,a)&&(t(r,a)&&(t(i,r)||e(i,a))||e(r,a)&&(t(i,a)||e(i,r))),dateIn:(e,t)=>t.some(t=>n(e,t)),dateNotIn:(e,t)=>t.every(t=>!n(e,t)),dateNotOn:(e,t)=>!n(e,t),dateOn:(e,t)=>n(e,t),dateOnOrAfter:(t,r)=>e(t,r)||n(t,r),dateOnOrBefore:(e,r)=>t(e,r)||n(e,r)}),p=e=>/^(does)?not/i.test(e),m=e=>(t,n)=>{let r=n??{},{context:i={}}=r;if(t.valueSource===`field`||!d(i.isDateField,t,r))return(0,c.defaultRuleProcessorCEL)(t,r);let a=t=>`timestamp("${e.toISOString(t)}")`,o=(0,c.lc)(t.operator.replace(/^=$/,`==`));switch(o){case`<`:case`<=`:case`==`:case`!=`:case`>`:case`>=`:return`${t.field} ${o} ${a(t.value)}`}let s=(0,c.toArray)(t.value,{retainEmptyStrings:!1}).map(t=>e.toDate(t)).filter(t=>e.isValid(t));switch(o){case`in`:case`notin`:{if(s.length===0)return``;let[e,n]=p(o)?[`!(`,`)`]:[``,``];return`${e}${t.field} in [${s.map(e=>a(e)).join(`, `)}]${n}`}case`between`:case`notbetween`:{if(s.length<2)return``;let[n,r]=s,[i,c]=e.isBefore(n,r)?[n,r]:[r,n];return o===`between`?`(${t.field} >= ${a(i)} && ${t.field} <= ${a(c)})`:`(${t.field} < ${a(i)} || ${t.field} > ${a(c)})`}}return(0,c.defaultRuleProcessorCEL)(t,r)},h=e=>(t,n)=>{let r=n??{},{field:i,operator:a,value:o,valueSource:s}=t;if(s===`field`||!d(r.context?.isDateField,t,r))return(0,c.defaultRuleProcessorMongoDBQuery)(t,r);if(a===`=`)return{[i]:e.toDate(o)};switch(a){case`<`:case`<=`:case`!=`:case`>`:case`>=`:return{[i]:{[c.mongoOperators[a]]:e.toDate(o)}}}let l=(0,c.toArray)(t.value,{retainEmptyStrings:!1}).map(t=>e.toDate(t)).filter(t=>e.isValid(t));switch(a){case`in`:case`notIn`:return{[i]:{[c.mongoOperators[a]]:l}};case`between`:case`notBetween`:{if(l.length<2)return``;let[t,n]=l,r=e.isBefore(t,n)?[t,n]:[n,t];return a===`between`?{[i]:{$gte:r[0],$lte:r[1]}}:{$or:[{[i]:{$lt:r[0]}},{[i]:{$gt:r[1]}}]}}}return(0,c.defaultRuleProcessorMongoDBQuery)(t,r)},g={"<":`is before`,">":`is after`,"<=":`is on or before`,">=":`is on or after`,in:[`is one of the dates`,`is the same as a date in`],notin:[`is not one of the dates`,`is not the same as any date in`],between:[`is between`,`is between the dates in`],notbetween:[`is not between`,`is not between the dates in`]},_=(e,t)=>l(t?.context?.originalValue)?new Intl.DateTimeFormat(t?.context?.locales,{dateStyle:`full`,...t?.context?.dateFormat}).format(e.value):new Intl.DateTimeFormat(t?.context?.locales,{dateStyle:`full`,timeStyle:`long`,...t?.context?.dateTimeFormat}).format(e.value),v=e=>(t,n)=>{let r=n??{},i=(0,c.lc)(t.operator),a=``,{fieldData:o,quoteFieldNamesWith:s=[``,``],fieldIdentifierSeparator:l=``,operatorProcessor:u=c.defaultOperatorProcessorNL,wordOrder:f=`SVO`,context:p={},operatorMap:m=g}=r;if(!d(p.isDateField,t,r))return(0,c.defaultRuleProcessorNL)(t,r);if(t.valueSource===`field`)return(0,c.defaultRuleProcessorNL)(t,{...r,operatorMap:g});if((i===`in`||i===`notin`||i===`between`||i===`notbetween`)&&!t.value)return``;let h=(0,c.toArray)(t.value,{retainEmptyStrings:!1}).map(t=>[t,e.toDate(t)]).filter(t=>e.isValid(t[1]));switch(i){case`in`:case`notin`:if(h.length===0)return``;a=`(${h.map(e=>_({field:t.field,operator:`=`,value:e[1]},{...r,context:{...p,originalValue:e[0]}})).join(`, `)})`;break;case`between`:case`notbetween`:{if(h.length<2)return``;let[n,i]=h;a=(e.isBefore(n[1],i[1])?[n,i]:[i,n]).map(([e,n])=>_({field:t.field,operator:`=`,value:n},{...r,context:{...p,originalValue:e}})).join(` ${r.translations?.and??`and`} `)}break;default:{let[e,n]=h[0]??[``,``];a=e?_({field:t.field,operator:`=`,value:n},{...r,context:{...p,originalValue:e}}):``}}let v={S:(0,c.getQuotedFieldName)(o?.label??t.field,{quoteFieldNamesWith:s,fieldIdentifierSeparator:l}),V:u(t,{...r,operatorMap:{...g,...m}}),O:a};return(0,c.normalizeConstituentWordOrder)(f).map(e=>`${v[e]}`).join(` `).trim()},y=({toISOStringDateOnly:e,toISOString:t})=>(n,r)=>l(r?.context?.originalValue)?(0,c.defaultValueProcessorByRule)({...n,value:e(n.value)},r):(0,c.defaultValueProcessorByRule)({...n,value:t(n.value)},r),b=({toISOStringDateOnly:e,toISOString:t})=>(n,r)=>{let i=/^(?:small)?datetime/i.test(r?.fieldData?.datatype)?`datetimeoffset`:`date`,a=i===`datetimeoffset`?t(n.value):e(n.value);return(0,c.defaultValueProcessorByRule)({...n,value:a},{...r,wrapValueWith:[`cast(`,` as ${i})`]})},x=({toISOStringDateOnly:e,toISOString:t})=>(n,r)=>{let i=/^(?:datetime|timestamp)/i.test(r?.fieldData?.datatype)?`datetime`:`date`,a=i===`datetime`?t(n.value):e(n.value);return(0,c.defaultValueProcessorByRule)({...n,value:a},{...r,wrapValueWith:[`cast(`,` as ${i})`]})},S=({toISOStringDateOnly:e,toISOString:t})=>(n,r)=>{let i=/^timestamp/i.test(r?.fieldData?.datatype)?`timestamp`:`date`,a=i===`timestamp`?t(n.value).replaceAll(`T`,` `).replace(`Z`,` UTC`):e(n.value);return(0,c.defaultValueProcessorByRule)({...n,value:a},{...r,wrapValueWith:[i,``]})},C=({toISOStringDateOnly:e,toISOString:t})=>(n,r)=>{let i=/^timestamp/i.test(r?.fieldData?.datatype)?`timestamp`:`date`,a=i===`timestamp`?t(n.value):e(n.value);return(0,c.defaultValueProcessorByRule)({...n,value:a},{...r,wrapValueWith:[i,``]})},w={ansi:y,mssql:b,mysql:x,oracle:S,postgresql:C,sqlite:y},T=e=>(t,n)=>{let r=n??{},i=(0,c.mapSQLOperator)(t.operator),a=(0,c.lc)(i),{quoteFieldNamesWith:o=[``,``],fieldIdentifierSeparator:s=``,context:l={}}=r,u=``;if(t.valueSource===`field`||!d(l.isDateField,t,r))return(0,c.defaultRuleProcessorSQL)(t,r);let f=w[r.preset](e),p=(0,c.toArray)(t.value,{retainEmptyStrings:!1}).map(t=>[t,e.toDate(t)]).filter(t=>e.isValid(t[1]));switch(a){case`in`:case`not in`:if(p.length===0)return``;u=`(${p.map(e=>f({field:t.field,operator:`=`,value:e[1]},{...r,context:{originalValue:e[0]}})).join(`, `)})`;break;case`between`:case`not between`:{if(p.length<2)return``;let[n,i]=p;u=(e.isBefore(n[1],i[1])?[n,i]:[i,n]).map(([e,n])=>f({field:t.field,operator:`=`,value:n},{...r,context:{originalValue:e}})).join(` and `)}break;default:{let[e,n]=p[0]??[``,``];u=f({field:t.field,operator:`=`,value:n},{...r,context:{originalValue:e}})}}return`${(0,c.getQuotedFieldName)(t.field,{quoteFieldNamesWith:o,fieldIdentifierSeparator:s})} ${i} ${u}`.trim()};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return h}});
2
- //# sourceMappingURL=getDatetimeRuleProcessorSQL-CSxxM8ce.js.map