@react-querybuilder/datetime 8.20.1 → 8.21.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 (150) hide show
  1. package/README.md +9 -3
  2. package/dist/cjs/{getDatetimeRuleProcessorTanStackDB-CL79A1_x.js → getDatetimeRuleProcessorTanStackDB-CDEB9coD.js} +88 -218
  3. package/dist/cjs/getDatetimeRuleProcessorTanStackDB-CDEB9coD.js.map +1 -0
  4. package/dist/cjs/getDatetimeRuleProcessorTanStackDB-X6tZv7yV.js +2 -0
  5. package/dist/cjs/getDatetimeRuleProcessorTanStackDB-X6tZv7yV.js.map +1 -0
  6. package/dist/cjs/react-querybuilder_datetime.cjs.development.d.ts +124 -260
  7. package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.d.ts +50 -51
  8. package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.js +3 -2
  9. package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.js.map +1 -1
  10. package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.d.ts +50 -51
  11. package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.js +53 -26
  12. package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.js.map +1 -1
  13. package/dist/cjs/react-querybuilder_datetime.cjs.development.js +11 -467
  14. package/dist/cjs/react-querybuilder_datetime.cjs.development.js.map +1 -1
  15. package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.d.ts +53 -54
  16. package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.js +26 -144
  17. package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.js.map +1 -1
  18. package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.d.ts +50 -51
  19. package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.js +3 -2
  20. package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.js.map +1 -1
  21. package/dist/cjs/react-querybuilder_datetime.cjs.development.ui.d.ts +214 -0
  22. package/dist/cjs/react-querybuilder_datetime.cjs.development.ui.js +466 -0
  23. package/dist/cjs/react-querybuilder_datetime.cjs.development.ui.js.map +1 -0
  24. package/dist/cjs/react-querybuilder_datetime.cjs.production.d.ts +124 -260
  25. package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.d.ts +50 -51
  26. package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.js +1 -1
  27. package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.js.map +1 -1
  28. package/dist/cjs/react-querybuilder_datetime.cjs.production.dayjs.d.ts +50 -51
  29. package/dist/cjs/react-querybuilder_datetime.cjs.production.dayjs.js +1 -1
  30. package/dist/cjs/react-querybuilder_datetime.cjs.production.dayjs.js.map +1 -1
  31. package/dist/cjs/react-querybuilder_datetime.cjs.production.js +1 -1
  32. package/dist/cjs/react-querybuilder_datetime.cjs.production.js.map +1 -1
  33. package/dist/cjs/react-querybuilder_datetime.cjs.production.jsdate.d.ts +53 -54
  34. package/dist/cjs/react-querybuilder_datetime.cjs.production.jsdate.js +1 -1
  35. package/dist/cjs/react-querybuilder_datetime.cjs.production.jsdate.js.map +1 -1
  36. package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.d.ts +50 -51
  37. package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.js +1 -1
  38. package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.js.map +1 -1
  39. package/dist/cjs/react-querybuilder_datetime.cjs.production.ui.d.ts +214 -0
  40. package/dist/cjs/react-querybuilder_datetime.cjs.production.ui.js +2 -0
  41. package/dist/cjs/react-querybuilder_datetime.cjs.production.ui.js.map +1 -0
  42. package/dist/cjs/rolldown-runtime-CMqjfN_6.js +1 -0
  43. package/dist/cjs/rolldown-runtime-D6vf50IK.js +28 -0
  44. package/dist/cjs/rqbDateTimeLibraryAPI.jsdate-BuSiVdk7.js +2 -0
  45. package/dist/cjs/rqbDateTimeLibraryAPI.jsdate-BuSiVdk7.js.map +1 -0
  46. package/dist/cjs/rqbDateTimeLibraryAPI.jsdate-C3jJb6ip.js +128 -0
  47. package/dist/cjs/rqbDateTimeLibraryAPI.jsdate-C3jJb6ip.js.map +1 -0
  48. package/dist/cjs/types-BKA1aoY6.d.ts +174 -0
  49. package/dist/cjs/ui.d.ts +1 -0
  50. package/dist/cjs/ui.js +6 -0
  51. package/dist/cjs/utils-DdBYGWHZ.js +2 -0
  52. package/dist/cjs/utils-DdBYGWHZ.js.map +1 -0
  53. package/dist/cjs/utils-_X97pUtk.js +166 -0
  54. package/dist/cjs/utils-_X97pUtk.js.map +1 -0
  55. package/dist/getDatetimeRuleProcessorTanStackDB-6K1DsuEV.mjs +2 -0
  56. package/dist/getDatetimeRuleProcessorTanStackDB-6K1DsuEV.mjs.map +1 -0
  57. package/dist/{getDatetimeRuleProcessorTanStackDB-BL8mbdbl.js → getDatetimeRuleProcessorTanStackDB-BrSD2e9G.js} +24 -198
  58. package/dist/getDatetimeRuleProcessorTanStackDB-BrSD2e9G.js.map +1 -0
  59. package/dist/{getDatetimeRuleProcessorTanStackDB-BcOC-o2A.mjs → getDatetimeRuleProcessorTanStackDB-DR8aYrUa.mjs} +24 -124
  60. package/dist/getDatetimeRuleProcessorTanStackDB-DR8aYrUa.mjs.map +1 -0
  61. package/dist/objectSpread2-MqoZ2hSz.js +187 -0
  62. package/dist/objectSpread2-MqoZ2hSz.js.map +1 -0
  63. package/dist/react-querybuilder_datetime.d.mts +124 -260
  64. package/dist/react-querybuilder_datetime.date-fns.d.mts +50 -51
  65. package/dist/react-querybuilder_datetime.date-fns.mjs +2 -1
  66. package/dist/react-querybuilder_datetime.date-fns.mjs.map +1 -1
  67. package/dist/react-querybuilder_datetime.dayjs.d.mts +50 -51
  68. package/dist/react-querybuilder_datetime.dayjs.mjs +27 -2
  69. package/dist/react-querybuilder_datetime.dayjs.mjs.map +1 -1
  70. package/dist/react-querybuilder_datetime.jsdate.d.mts +53 -54
  71. package/dist/react-querybuilder_datetime.jsdate.mjs +2 -120
  72. package/dist/react-querybuilder_datetime.jsdate.mjs.map +1 -1
  73. package/dist/react-querybuilder_datetime.legacy-esm.d.ts +124 -260
  74. package/dist/react-querybuilder_datetime.legacy-esm.date-fns.d.ts +50 -51
  75. package/dist/react-querybuilder_datetime.legacy-esm.date-fns.js +2 -1
  76. package/dist/react-querybuilder_datetime.legacy-esm.date-fns.js.map +1 -1
  77. package/dist/react-querybuilder_datetime.legacy-esm.dayjs.d.ts +50 -51
  78. package/dist/react-querybuilder_datetime.legacy-esm.dayjs.js +27 -2
  79. package/dist/react-querybuilder_datetime.legacy-esm.dayjs.js.map +1 -1
  80. package/dist/react-querybuilder_datetime.legacy-esm.js +5 -449
  81. package/dist/react-querybuilder_datetime.legacy-esm.js.map +1 -1
  82. package/dist/react-querybuilder_datetime.legacy-esm.jsdate.d.ts +53 -54
  83. package/dist/react-querybuilder_datetime.legacy-esm.jsdate.js +2 -120
  84. package/dist/react-querybuilder_datetime.legacy-esm.jsdate.js.map +1 -1
  85. package/dist/react-querybuilder_datetime.legacy-esm.luxon.d.ts +50 -51
  86. package/dist/react-querybuilder_datetime.legacy-esm.luxon.js +2 -1
  87. package/dist/react-querybuilder_datetime.legacy-esm.luxon.js.map +1 -1
  88. package/dist/react-querybuilder_datetime.legacy-esm.ui.d.ts +214 -0
  89. package/dist/react-querybuilder_datetime.legacy-esm.ui.js +453 -0
  90. package/dist/react-querybuilder_datetime.legacy-esm.ui.js.map +1 -0
  91. package/dist/react-querybuilder_datetime.luxon.d.mts +50 -51
  92. package/dist/react-querybuilder_datetime.luxon.mjs +2 -1
  93. package/dist/react-querybuilder_datetime.luxon.mjs.map +1 -1
  94. package/dist/react-querybuilder_datetime.mjs +5 -446
  95. package/dist/react-querybuilder_datetime.mjs.map +1 -1
  96. package/dist/react-querybuilder_datetime.production.d.mts +124 -260
  97. package/dist/react-querybuilder_datetime.production.date-fns.d.mts +50 -51
  98. package/dist/react-querybuilder_datetime.production.date-fns.mjs +1 -1
  99. package/dist/react-querybuilder_datetime.production.date-fns.mjs.map +1 -1
  100. package/dist/react-querybuilder_datetime.production.dayjs.d.mts +50 -51
  101. package/dist/react-querybuilder_datetime.production.dayjs.mjs +1 -1
  102. package/dist/react-querybuilder_datetime.production.dayjs.mjs.map +1 -1
  103. package/dist/react-querybuilder_datetime.production.jsdate.d.mts +53 -54
  104. package/dist/react-querybuilder_datetime.production.jsdate.mjs +1 -1
  105. package/dist/react-querybuilder_datetime.production.jsdate.mjs.map +1 -1
  106. package/dist/react-querybuilder_datetime.production.luxon.d.mts +50 -51
  107. package/dist/react-querybuilder_datetime.production.luxon.mjs +1 -1
  108. package/dist/react-querybuilder_datetime.production.luxon.mjs.map +1 -1
  109. package/dist/react-querybuilder_datetime.production.mjs +1 -1
  110. package/dist/react-querybuilder_datetime.production.mjs.map +1 -1
  111. package/dist/react-querybuilder_datetime.production.ui.d.mts +214 -0
  112. package/dist/react-querybuilder_datetime.production.ui.mjs +2 -0
  113. package/dist/react-querybuilder_datetime.production.ui.mjs.map +1 -0
  114. package/dist/react-querybuilder_datetime.ui.d.mts +214 -0
  115. package/dist/react-querybuilder_datetime.ui.mjs +450 -0
  116. package/dist/react-querybuilder_datetime.ui.mjs.map +1 -0
  117. package/dist/rqbDateTimeLibraryAPI.jsdate-COp9qTw_.js +123 -0
  118. package/dist/rqbDateTimeLibraryAPI.jsdate-COp9qTw_.js.map +1 -0
  119. package/dist/rqbDateTimeLibraryAPI.jsdate-DxBmxW2C.mjs +2 -0
  120. package/dist/rqbDateTimeLibraryAPI.jsdate-DxBmxW2C.mjs.map +1 -0
  121. package/dist/rqbDateTimeLibraryAPI.jsdate-WHnzblie.mjs +123 -0
  122. package/dist/rqbDateTimeLibraryAPI.jsdate-WHnzblie.mjs.map +1 -0
  123. package/dist/types-BKA1aoY6.d.mts +174 -0
  124. package/dist/types-BKA1aoY6.d.ts +174 -0
  125. package/dist/utils-BAgUBdyf.mjs +113 -0
  126. package/dist/utils-BAgUBdyf.mjs.map +1 -0
  127. package/dist/utils-DA8aluCt.mjs +2 -0
  128. package/dist/utils-DA8aluCt.mjs.map +1 -0
  129. package/package.json +36 -17
  130. package/ui/package.json +4 -0
  131. package/dist/cjs/getDatetimeRuleProcessorTanStackDB-CL79A1_x.js.map +0 -1
  132. package/dist/cjs/getDatetimeRuleProcessorTanStackDB-DgUg_arY.js +0 -2
  133. package/dist/cjs/getDatetimeRuleProcessorTanStackDB-DgUg_arY.js.map +0 -1
  134. package/dist/cjs/rqbDateTimeLibraryAPI.dayjs-BfILPx88.js +0 -2
  135. package/dist/cjs/rqbDateTimeLibraryAPI.dayjs-BfILPx88.js.map +0 -1
  136. package/dist/cjs/rqbDateTimeLibraryAPI.dayjs-CzLh_zi9.js +0 -63
  137. package/dist/cjs/rqbDateTimeLibraryAPI.dayjs-CzLh_zi9.js.map +0 -1
  138. package/dist/cjs/types-XYMw0jFT.d.ts +0 -265
  139. package/dist/getDatetimeRuleProcessorTanStackDB-BL8mbdbl.js.map +0 -1
  140. package/dist/getDatetimeRuleProcessorTanStackDB-BcOC-o2A.mjs.map +0 -1
  141. package/dist/getDatetimeRuleProcessorTanStackDB-Dloxv6k2.mjs +0 -2
  142. package/dist/getDatetimeRuleProcessorTanStackDB-Dloxv6k2.mjs.map +0 -1
  143. package/dist/rqbDateTimeLibraryAPI.dayjs-BW7faYFD.mjs +0 -29
  144. package/dist/rqbDateTimeLibraryAPI.dayjs-BW7faYFD.mjs.map +0 -1
  145. package/dist/rqbDateTimeLibraryAPI.dayjs-BoX90aqZ.mjs +0 -2
  146. package/dist/rqbDateTimeLibraryAPI.dayjs-BoX90aqZ.mjs.map +0 -1
  147. package/dist/rqbDateTimeLibraryAPI.dayjs-Da4VXvFM.js +0 -29
  148. package/dist/rqbDateTimeLibraryAPI.dayjs-Da4VXvFM.js.map +0 -1
  149. package/dist/types-CdjHqQ0k.d.mts +0 -265
  150. package/dist/types-CdjHqQ0k.d.ts +0 -265
@@ -1,104 +1,103 @@
1
- import { g as RQBJsonLogicDateTimeOperations, i as RQBDateTimeLibraryAPI } from "./types-CdjHqQ0k.mjs";
2
- import { RuleProcessor, ValueProcessorByRule } from "react-querybuilder";
3
-
1
+ import { g as RQBJsonLogicDateTimeOperations, i as RQBDateTimeLibraryAPI } from "./types-BKA1aoY6.mjs";
2
+ import { RuleProcessor, ValueProcessorByRule } from "@react-querybuilder/core";
4
3
  //#region src/rqbDateTimeLibraryAPI.luxon.d.ts
5
4
  /**
6
- * {@link RQBDateTimeLibraryAPI} for Luxon
7
- */
5
+ * {@link RQBDateTimeLibraryAPI} for Luxon
6
+ */
8
7
  declare const rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI;
9
8
  //#endregion
10
9
  //#region src/index.luxon.d.ts
11
10
  /**
12
- * Custom JsonLogic date/time operations using Luxon
13
- */
11
+ * Custom JsonLogic date/time operations using Luxon
12
+ */
14
13
  declare const jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations;
15
14
  /**
16
- * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "sql" format using Luxon
17
- */
15
+ * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "sql" format using Luxon
16
+ */
18
17
  declare const datetimeRuleProcessorSQL: RuleProcessor;
19
18
  /**
20
- * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("ansi" preset) using Luxon
21
- */
19
+ * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("ansi" preset) using Luxon
20
+ */
22
21
  declare const datetimeValueProcessorANSI: ValueProcessorByRule;
23
22
  /**
24
- * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("mssql" preset) using Luxon
25
- */
23
+ * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("mssql" preset) using Luxon
24
+ */
26
25
  declare const datetimeValueProcessorMSSQL: ValueProcessorByRule;
27
26
  /**
28
- * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("mysql" preset) using Luxon
29
- */
27
+ * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("mysql" preset) using Luxon
28
+ */
30
29
  declare const datetimeValueProcessorMySQL: ValueProcessorByRule;
31
30
  /**
32
- * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("oracle" preset) using Luxon
33
- */
31
+ * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("oracle" preset) using Luxon
32
+ */
34
33
  declare const datetimeValueProcessorOracle: ValueProcessorByRule;
35
34
  /**
36
- * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("postgresql" preset) using Luxon
37
- */
35
+ * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for "sql" format ("postgresql" preset) using Luxon
36
+ */
38
37
  declare const datetimeValueProcessorPostgreSQL: ValueProcessorByRule;
39
38
  /**
40
- * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "cel" format using Luxon
41
- */
39
+ * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "cel" format using Luxon
40
+ */
42
41
  declare const datetimeRuleProcessorCEL: ValueProcessorByRule;
43
42
  /**
44
- * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "jsonata" format using Luxon
45
- */
43
+ * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "jsonata" format using Luxon
44
+ */
46
45
  declare const datetimeRuleProcessorJSONata: RuleProcessor;
47
46
  /**
48
- * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "mongodb_query" format using Luxon
49
- */
47
+ * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "mongodb_query" format using Luxon
48
+ */
50
49
  declare const datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule;
51
50
  /**
52
- * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "natural_language" format using Luxon
53
- */
51
+ * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "natural_language" format using Luxon
52
+ */
54
53
  declare const datetimeRuleProcessorNL: ValueProcessorByRule;
55
54
  /**
56
- * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "cypher"/"gql" format using Luxon
57
- */
55
+ * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "cypher"/"gql" format using Luxon
56
+ */
58
57
  declare const datetimeRuleProcessorCypher: ValueProcessorByRule;
59
58
  /**
60
- * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "sparql" format using Luxon
61
- */
59
+ * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "sparql" format using Luxon
60
+ */
62
61
  declare const datetimeRuleProcessorSPARQL: ValueProcessorByRule;
63
62
  /**
64
- * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "parameterized"/"parameterized_named" formats
65
- */
63
+ * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "parameterized"/"parameterized_named" formats
64
+ */
66
65
  declare const datetimeRuleProcessorParameterized: RuleProcessor;
67
66
  /**
68
- * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "spel" format
69
- */
67
+ * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "spel" format
68
+ */
70
69
  declare const datetimeRuleProcessorSpEL: RuleProcessor;
71
70
  /**
72
- * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "ldap" format
73
- */
71
+ * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "ldap" format
72
+ */
74
73
  declare const datetimeRuleProcessorLDAP: RuleProcessor;
75
74
  /**
76
- * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "gremlin" format
77
- */
75
+ * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "gremlin" format
76
+ */
78
77
  declare const datetimeRuleProcessorGremlin: RuleProcessor;
79
78
  /**
80
- * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "prisma" format
81
- */
79
+ * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "prisma" format
80
+ */
82
81
  declare const datetimeRuleProcessorPrisma: RuleProcessor;
83
82
  /**
84
- * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "sequelize" format
85
- */
83
+ * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "sequelize" format
84
+ */
86
85
  declare const datetimeRuleProcessorSequelize: RuleProcessor;
87
86
  /**
88
- * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "drizzle" format
89
- */
87
+ * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "drizzle" format
88
+ */
90
89
  declare const datetimeRuleProcessorDrizzle: RuleProcessor;
91
90
  /**
92
- * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "elasticsearch" format
93
- */
91
+ * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "elasticsearch" format
92
+ */
94
93
  declare const datetimeRuleProcessorElasticSearch: RuleProcessor;
95
94
  /**
96
- * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "tanstack_db" format
97
- */
95
+ * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "tanstack_db" format
96
+ */
98
97
  declare const datetimeRuleProcessorTanStackDB: RuleProcessor;
99
98
  /**
100
- * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for (deprecated) "mongodb" format
101
- */
99
+ * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for (deprecated) "mongodb" format
100
+ */
102
101
  declare const datetimeRuleProcessorMongoDB: RuleProcessor;
103
102
  //#endregion
104
103
  export { datetimeRuleProcessorCEL, datetimeRuleProcessorCypher, datetimeRuleProcessorDrizzle, datetimeRuleProcessorElasticSearch, datetimeRuleProcessorGremlin, datetimeRuleProcessorJSONata, datetimeRuleProcessorLDAP, datetimeRuleProcessorMongoDB, datetimeRuleProcessorMongoDBQuery, datetimeRuleProcessorNL, datetimeRuleProcessorParameterized, datetimeRuleProcessorPrisma, datetimeRuleProcessorSPARQL, datetimeRuleProcessorSQL, datetimeRuleProcessorSequelize, datetimeRuleProcessorSpEL, datetimeRuleProcessorTanStackDB, datetimeValueProcessorANSI, datetimeValueProcessorMSSQL, datetimeValueProcessorMySQL, datetimeValueProcessorOracle, datetimeValueProcessorPostgreSQL, jsonLogicDateTimeOperations, rqbDateTimeLibraryAPI };
@@ -1,2 +1,2 @@
1
- import{C as e,D as t,S as n,T as r,_ as i,a,b as o,c as s,d as c,f as l,g as u,h as d,i as f,l as p,n as m,o as h,r as g,s as _,t as v,u as y,v as b,w as x,x as S,y as C}from"./getDatetimeRuleProcessorTanStackDB-Dloxv6k2.mjs";import{DateTime as w}from"luxon";const T=e=>typeof e==`string`?w.fromISO(e):w.fromJSDate(e),E=`yyyy-MM-dd`,D={minute:`minutes`,hour:`hours`,day:`days`,week:`weeks`,month:`months`,year:`years`},O={format:(e,t)=>T(e).toFormat(t.replace(`YYYY-MM-DD`,E)),isAfter:(e,t)=>T(e)>T(t),isBefore:(e,t)=>T(e)<T(t),isSame:(e,n)=>t(e)||t(n)?T(e).hasSame(T(n),`day`):+T(e)==+T(n),isValid:e=>T(e).isValid,toDate:e=>T(e).toJSDate(),toISOString:e=>{let t=T(e);return t.isValid?t.toJSDate().toISOString():``},toISOStringDateOnly:e=>{let t=T(e);return t.isValid?t.toFormat(E):``},startOf:(e,t)=>T(e).startOf(t).toJSDate(),endOf:(e,t)=>T(e).endOf(t).toJSDate(),add:(e,t,n)=>T(e).plus({[D[n]]:t}).toJSDate()},k=r(O),A=m(O),j=g(O),M=f(O),N=a(O),P=h(O),F=_(O),I=x(O),L=C(O),R=i(O),z=d(O),B=e(O),V=p(O),H=l(O),U=s(O),W=b(O),G=o(O),K=c(O),q=y(O),J=n(O),Y=S(O),X=v(O),Z=u(O);export{I as datetimeRuleProcessorCEL,B as datetimeRuleProcessorCypher,J as datetimeRuleProcessorDrizzle,Y as datetimeRuleProcessorElasticSearch,G as datetimeRuleProcessorGremlin,L as datetimeRuleProcessorJSONata,W as datetimeRuleProcessorLDAP,Z as datetimeRuleProcessorMongoDB,R as datetimeRuleProcessorMongoDBQuery,z as datetimeRuleProcessorNL,H as datetimeRuleProcessorParameterized,K as datetimeRuleProcessorPrisma,V as datetimeRuleProcessorSPARQL,A as datetimeRuleProcessorSQL,q as datetimeRuleProcessorSequelize,U as datetimeRuleProcessorSpEL,X as datetimeRuleProcessorTanStackDB,j as datetimeValueProcessorANSI,M as datetimeValueProcessorMSSQL,N as datetimeValueProcessorMySQL,P as datetimeValueProcessorOracle,F as datetimeValueProcessorPostgreSQL,k as jsonLogicDateTimeOperations,O as rqbDateTimeLibraryAPI};
1
+ import{n as e}from"./utils-DA8aluCt.mjs";import{C as t,S as n,T as r,_ as i,a,b as o,c as s,d as c,f as l,g as u,h as d,i as f,l as p,n as m,o as h,r as g,s as _,t as v,u as y,v as b,w as x,x as S,y as C}from"./getDatetimeRuleProcessorTanStackDB-6K1DsuEV.mjs";import{DateTime as w}from"luxon";const T=e=>typeof e==`string`?w.fromISO(e):w.fromJSDate(e),E=`yyyy-MM-dd`,D={minute:`minutes`,hour:`hours`,day:`days`,week:`weeks`,month:`months`,year:`years`},O={format:(e,t)=>T(e).toFormat(t.replace(`YYYY-MM-DD`,E)),isAfter:(e,t)=>T(e)>T(t),isBefore:(e,t)=>T(e)<T(t),isSame:(t,n)=>e(t)||e(n)?T(t).hasSame(T(n),`day`):+T(t)==+T(n),isValid:e=>T(e).isValid,toDate:e=>T(e).toJSDate(),toISOString:e=>{let t=T(e);return t.isValid?t.toJSDate().toISOString():``},toISOStringDateOnly:e=>{let t=T(e);return t.isValid?t.toFormat(E):``},startOf:(e,t)=>T(e).startOf(t).toJSDate(),endOf:(e,t)=>T(e).endOf(t).toJSDate(),add:(e,t,n)=>T(e).plus({[D[n]]:t}).toJSDate()},k=r(O),A=m(O),j=g(O),M=f(O),N=a(O),P=h(O),F=_(O),I=x(O),L=C(O),R=i(O),z=d(O),B=t(O),V=p(O),H=l(O),U=s(O),W=b(O),G=o(O),K=c(O),q=y(O),J=n(O),Y=S(O),X=v(O),Z=u(O);export{I as datetimeRuleProcessorCEL,B as datetimeRuleProcessorCypher,J as datetimeRuleProcessorDrizzle,Y as datetimeRuleProcessorElasticSearch,G as datetimeRuleProcessorGremlin,L as datetimeRuleProcessorJSONata,W as datetimeRuleProcessorLDAP,Z as datetimeRuleProcessorMongoDB,R as datetimeRuleProcessorMongoDBQuery,z as datetimeRuleProcessorNL,H as datetimeRuleProcessorParameterized,K as datetimeRuleProcessorPrisma,V as datetimeRuleProcessorSPARQL,A as datetimeRuleProcessorSQL,q as datetimeRuleProcessorSequelize,U as datetimeRuleProcessorSpEL,X as datetimeRuleProcessorTanStackDB,j as datetimeValueProcessorANSI,M as datetimeValueProcessorMSSQL,N as datetimeValueProcessorMySQL,P as datetimeValueProcessorOracle,F as datetimeValueProcessorPostgreSQL,k as jsonLogicDateTimeOperations,O as rqbDateTimeLibraryAPI};
2
2
  //# sourceMappingURL=react-querybuilder_datetime.production.luxon.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"react-querybuilder_datetime.production.luxon.mjs","names":[],"sources":["../src/rqbDateTimeLibraryAPI.luxon.ts","../src/index.luxon.ts"],"sourcesContent":["import { DateTime } from 'luxon';\nimport type { RelativeDateTimeUnit, RQBDateTimeLibraryAPI } from './types';\nimport { isISOStringDateOnly } from './utils';\n\nconst toDateTime = (a: string | Date) =>\n typeof a === 'string' ? DateTime.fromISO(a) : DateTime.fromJSDate(a);\nconst iso8601DateOnly = 'yyyy-MM-dd';\n\nconst durationKeyMap: Record<RelativeDateTimeUnit, string> = {\n minute: 'minutes',\n hour: 'hours',\n day: 'days',\n week: 'weeks',\n month: 'months',\n year: 'years',\n};\n\n/**\n * {@link RQBDateTimeLibraryAPI} for Luxon\n */\nexport const rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI = {\n format: (d, fmt) => toDateTime(d).toFormat(fmt.replace('YYYY-MM-DD', iso8601DateOnly)),\n isAfter: (a, b) => toDateTime(a) > toDateTime(b),\n isBefore: (a, b) => toDateTime(a) < toDateTime(b),\n isSame: (a, b) =>\n isISOStringDateOnly(a) || isISOStringDateOnly(b)\n ? toDateTime(a).hasSame(toDateTime(b), 'day')\n : +toDateTime(a) === +toDateTime(b),\n isValid: d => toDateTime(d).isValid,\n toDate: d => toDateTime(d).toJSDate(),\n toISOString: d => {\n const dToDate = toDateTime(d);\n return dToDate.isValid ? dToDate.toJSDate().toISOString() : '';\n },\n toISOStringDateOnly: d => {\n const dToDate = toDateTime(d);\n return dToDate.isValid ? dToDate.toFormat(iso8601DateOnly) : '';\n },\n startOf: (d, unit) => toDateTime(d).startOf(unit).toJSDate(),\n endOf: (d, unit) => toDateTime(d).endOf(unit).toJSDate(),\n add: (d, amount, unit) =>\n toDateTime(d)\n .plus({ [durationKeyMap[unit]]: amount })\n .toJSDate(),\n};\n","/**\n * Import from `\"@react-querybuilder/datetime/luxon\"` for enhanced date/time support using [Luxon](https://moment.github.io/luxon/).\n *\n * @module luxon\n */\n\nimport type { RuleProcessor, ValueProcessorByRule } from 'react-querybuilder';\nimport { getDatetimeJsonLogicOperations } from './getDatetimeJsonLogicOperations';\nimport { getDatetimeRuleProcessorCEL } from './getDatetimeRuleProcessorCEL';\nimport { getDatetimeRuleProcessorCypher } from './getDatetimeRuleProcessorCypher';\nimport { getDatetimeRuleProcessorDrizzle } from './getDatetimeRuleProcessorDrizzle';\nimport { getDatetimeRuleProcessorElasticSearch } from './getDatetimeRuleProcessorElasticSearch';\nimport { getDatetimeRuleProcessorGremlin } from './getDatetimeRuleProcessorGremlin';\nimport { getDatetimeRuleProcessorJSONata } from './getDatetimeRuleProcessorJSONata';\nimport { getDatetimeRuleProcessorLDAP } from './getDatetimeRuleProcessorLDAP';\nimport { getDatetimeRuleProcessorMongoDB } from './getDatetimeRuleProcessorMongoDB';\nimport { getDatetimeRuleProcessorMongoDBQuery } from './getDatetimeRuleProcessorMongoDBQuery';\nimport { getDatetimeRuleProcessorNL } from './getDatetimeRuleProcessorNL';\nimport { getDatetimeRuleProcessorParameterized } from './getDatetimeRuleProcessorParameterized';\nimport { getDatetimeRuleProcessorPrisma } from './getDatetimeRuleProcessorPrisma';\nimport { getDatetimeRuleProcessorSequelize } from './getDatetimeRuleProcessorSequelize';\nimport { getDatetimeRuleProcessorSPARQL } from './getDatetimeRuleProcessorSPARQL';\nimport { getDatetimeRuleProcessorSpEL } from './getDatetimeRuleProcessorSpEL';\nimport {\n getDatetimeRuleProcessorSQL,\n getDatetimeValueProcessorANSI,\n getDatetimeValueProcessorMSSQL,\n getDatetimeValueProcessorMySQL,\n getDatetimeValueProcessorOracle,\n getDatetimeValueProcessorPostgreSQL,\n} from './getDatetimeRuleProcessorSQL';\nimport { getDatetimeRuleProcessorTanStackDB } from './getDatetimeRuleProcessorTanStackDB';\nimport { rqbDateTimeLibraryAPI } from './rqbDateTimeLibraryAPI.luxon';\nimport type { RQBJsonLogicDateTimeOperations } from './types';\n\n/**\n * Custom JsonLogic date/time operations using Luxon\n */\nexport const jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations =\n getDatetimeJsonLogicOperations(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sql\" format using Luxon\n */\nexport const datetimeRuleProcessorSQL: RuleProcessor =\n getDatetimeRuleProcessorSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"ansi\" preset) using Luxon\n */\nexport const datetimeValueProcessorANSI: ValueProcessorByRule =\n getDatetimeValueProcessorANSI(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"mssql\" preset) using Luxon\n */\nexport const datetimeValueProcessorMSSQL: ValueProcessorByRule =\n getDatetimeValueProcessorMSSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"mysql\" preset) using Luxon\n */\nexport const datetimeValueProcessorMySQL: ValueProcessorByRule =\n getDatetimeValueProcessorMySQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"oracle\" preset) using Luxon\n */\nexport const datetimeValueProcessorOracle: ValueProcessorByRule =\n getDatetimeValueProcessorOracle(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"postgresql\" preset) using Luxon\n */\nexport const datetimeValueProcessorPostgreSQL: ValueProcessorByRule =\n getDatetimeValueProcessorPostgreSQL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"cel\" format using Luxon\n */\nexport const datetimeRuleProcessorCEL: ValueProcessorByRule =\n getDatetimeRuleProcessorCEL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"jsonata\" format using Luxon\n */\nexport const datetimeRuleProcessorJSONata: RuleProcessor =\n getDatetimeRuleProcessorJSONata(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"mongodb_query\" format using Luxon\n */\nexport const datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule =\n getDatetimeRuleProcessorMongoDBQuery(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"natural_language\" format using Luxon\n */\nexport const datetimeRuleProcessorNL: ValueProcessorByRule =\n getDatetimeRuleProcessorNL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"cypher\"/\"gql\" format using Luxon\n */\nexport const datetimeRuleProcessorCypher: ValueProcessorByRule =\n getDatetimeRuleProcessorCypher(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sparql\" format using Luxon\n */\nexport const datetimeRuleProcessorSPARQL: ValueProcessorByRule =\n getDatetimeRuleProcessorSPARQL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"parameterized\"/\"parameterized_named\" formats\n */\nexport const datetimeRuleProcessorParameterized: RuleProcessor =\n getDatetimeRuleProcessorParameterized(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"spel\" format\n */\nexport const datetimeRuleProcessorSpEL: RuleProcessor =\n getDatetimeRuleProcessorSpEL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"ldap\" format\n */\nexport const datetimeRuleProcessorLDAP: RuleProcessor =\n getDatetimeRuleProcessorLDAP(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"gremlin\" format\n */\nexport const datetimeRuleProcessorGremlin: RuleProcessor =\n getDatetimeRuleProcessorGremlin(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"prisma\" format\n */\nexport const datetimeRuleProcessorPrisma: RuleProcessor =\n getDatetimeRuleProcessorPrisma(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sequelize\" format\n */\nexport const datetimeRuleProcessorSequelize: RuleProcessor =\n getDatetimeRuleProcessorSequelize(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"drizzle\" format\n */\nexport const datetimeRuleProcessorDrizzle: RuleProcessor =\n getDatetimeRuleProcessorDrizzle(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"elasticsearch\" format\n */\nexport const datetimeRuleProcessorElasticSearch: RuleProcessor =\n getDatetimeRuleProcessorElasticSearch(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"tanstack_db\" format\n */\nexport const datetimeRuleProcessorTanStackDB: RuleProcessor =\n getDatetimeRuleProcessorTanStackDB(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for (deprecated) \"mongodb\" format\n */\nexport const datetimeRuleProcessorMongoDB: RuleProcessor =\n getDatetimeRuleProcessorMongoDB(rqbDateTimeLibraryAPI);\n\nexport * from './rqbDateTimeLibraryAPI.luxon';\n"],"mappings":"mQAIA,MAAM,EAAc,GAClB,OAAO,GAAM,SAAW,EAAS,QAAQ,CAAC,EAAI,EAAS,WAAW,CAAC,EAC/D,EAAkB,aAElB,EAAuD,CAC3D,OAAQ,UACR,KAAM,QACN,IAAK,OACL,KAAM,QACN,MAAO,SACP,KAAM,OACR,EAKa,EAA+C,CAC1D,QAAS,EAAG,IAAQ,EAAW,CAAC,CAAC,CAAC,SAAS,EAAI,QAAQ,aAAc,CAAe,CAAC,EACrF,SAAU,EAAG,IAAM,EAAW,CAAC,EAAI,EAAW,CAAC,EAC/C,UAAW,EAAG,IAAM,EAAW,CAAC,EAAI,EAAW,CAAC,EAChD,QAAS,EAAG,IACV,EAAoB,CAAC,GAAK,EAAoB,CAAC,EAC3C,EAAW,CAAC,CAAC,CAAC,QAAQ,EAAW,CAAC,EAAG,KAAK,EAC1C,CAAC,EAAW,CAAC,GAAM,CAAC,EAAW,CAAC,EACtC,QAAS,GAAK,EAAW,CAAC,CAAC,CAAC,QAC5B,OAAQ,GAAK,EAAW,CAAC,CAAC,CAAC,SAAS,EACpC,YAAa,GAAK,CAChB,IAAM,EAAU,EAAW,CAAC,EAC5B,OAAO,EAAQ,QAAU,EAAQ,SAAS,CAAC,CAAC,YAAY,EAAI,EAC9D,EACA,oBAAqB,GAAK,CACxB,IAAM,EAAU,EAAW,CAAC,EAC5B,OAAO,EAAQ,QAAU,EAAQ,SAAS,CAAe,EAAI,EAC/D,EACA,SAAU,EAAG,IAAS,EAAW,CAAC,CAAC,CAAC,QAAQ,CAAI,CAAC,CAAC,SAAS,EAC3D,OAAQ,EAAG,IAAS,EAAW,CAAC,CAAC,CAAC,MAAM,CAAI,CAAC,CAAC,SAAS,EACvD,KAAM,EAAG,EAAQ,IACf,EAAW,CAAC,CAAC,CACV,KAAK,EAAG,EAAe,IAAQ,CAAO,CAAC,CAAC,CACxC,SAAS,CAChB,ECNa,EACX,EAA+B,CAAqB,EAKzC,EACX,EAA4B,CAAqB,EAItC,EACX,EAA8B,CAAqB,EAIxC,EACX,EAA+B,CAAqB,EAIzC,EACX,EAA+B,CAAqB,EAIzC,EACX,EAAgC,CAAqB,EAI1C,EACX,EAAoC,CAAqB,EAK9C,EACX,EAA4B,CAAqB,EAKtC,EACX,EAAgC,CAAqB,EAK1C,EACX,EAAqC,CAAqB,EAK/C,EACX,EAA2B,CAAqB,EAKrC,EACX,EAA+B,CAAqB,EAKzC,EACX,EAA+B,CAAqB,EAKzC,EACX,EAAsC,CAAqB,EAKhD,EACX,EAA6B,CAAqB,EAKvC,EACX,EAA6B,CAAqB,EAKvC,EACX,EAAgC,CAAqB,EAK1C,EACX,EAA+B,CAAqB,EAKzC,EACX,EAAkC,CAAqB,EAK5C,EACX,EAAgC,CAAqB,EAK1C,EACX,EAAsC,CAAqB,EAKhD,EACX,EAAmC,CAAqB,EAK7C,EACX,EAAgC,CAAqB"}
1
+ {"version":3,"file":"react-querybuilder_datetime.production.luxon.mjs","names":[],"sources":["../src/rqbDateTimeLibraryAPI.luxon.ts","../src/index.luxon.ts"],"sourcesContent":["import { DateTime } from 'luxon';\nimport type { RelativeDateTimeUnit, RQBDateTimeLibraryAPI } from './types';\nimport { isISOStringDateOnly } from './utils';\n\nconst toDateTime = (a: string | Date) =>\n typeof a === 'string' ? DateTime.fromISO(a) : DateTime.fromJSDate(a);\nconst iso8601DateOnly = 'yyyy-MM-dd';\n\nconst durationKeyMap: Record<RelativeDateTimeUnit, string> = {\n minute: 'minutes',\n hour: 'hours',\n day: 'days',\n week: 'weeks',\n month: 'months',\n year: 'years',\n};\n\n/**\n * {@link RQBDateTimeLibraryAPI} for Luxon\n */\nexport const rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI = {\n format: (d, fmt) => toDateTime(d).toFormat(fmt.replace('YYYY-MM-DD', iso8601DateOnly)),\n isAfter: (a, b) => toDateTime(a) > toDateTime(b),\n isBefore: (a, b) => toDateTime(a) < toDateTime(b),\n isSame: (a, b) =>\n isISOStringDateOnly(a) || isISOStringDateOnly(b)\n ? toDateTime(a).hasSame(toDateTime(b), 'day')\n : +toDateTime(a) === +toDateTime(b),\n isValid: d => toDateTime(d).isValid,\n toDate: d => toDateTime(d).toJSDate(),\n toISOString: d => {\n const dToDate = toDateTime(d);\n return dToDate.isValid ? dToDate.toJSDate().toISOString() : '';\n },\n toISOStringDateOnly: d => {\n const dToDate = toDateTime(d);\n return dToDate.isValid ? dToDate.toFormat(iso8601DateOnly) : '';\n },\n startOf: (d, unit) => toDateTime(d).startOf(unit).toJSDate(),\n endOf: (d, unit) => toDateTime(d).endOf(unit).toJSDate(),\n add: (d, amount, unit) =>\n toDateTime(d)\n .plus({ [durationKeyMap[unit]]: amount })\n .toJSDate(),\n};\n","/**\n * Import from `\"@react-querybuilder/datetime/luxon\"` for enhanced date/time support using [Luxon](https://moment.github.io/luxon/).\n *\n * @module luxon\n */\n\nimport type { RuleProcessor, ValueProcessorByRule } from '@react-querybuilder/core';\nimport { getDatetimeJsonLogicOperations } from './getDatetimeJsonLogicOperations';\nimport { getDatetimeRuleProcessorCEL } from './getDatetimeRuleProcessorCEL';\nimport { getDatetimeRuleProcessorCypher } from './getDatetimeRuleProcessorCypher';\nimport { getDatetimeRuleProcessorDrizzle } from './getDatetimeRuleProcessorDrizzle';\nimport { getDatetimeRuleProcessorElasticSearch } from './getDatetimeRuleProcessorElasticSearch';\nimport { getDatetimeRuleProcessorGremlin } from './getDatetimeRuleProcessorGremlin';\nimport { getDatetimeRuleProcessorJSONata } from './getDatetimeRuleProcessorJSONata';\nimport { getDatetimeRuleProcessorLDAP } from './getDatetimeRuleProcessorLDAP';\nimport { getDatetimeRuleProcessorMongoDB } from './getDatetimeRuleProcessorMongoDB';\nimport { getDatetimeRuleProcessorMongoDBQuery } from './getDatetimeRuleProcessorMongoDBQuery';\nimport { getDatetimeRuleProcessorNL } from './getDatetimeRuleProcessorNL';\nimport { getDatetimeRuleProcessorParameterized } from './getDatetimeRuleProcessorParameterized';\nimport { getDatetimeRuleProcessorPrisma } from './getDatetimeRuleProcessorPrisma';\nimport { getDatetimeRuleProcessorSequelize } from './getDatetimeRuleProcessorSequelize';\nimport { getDatetimeRuleProcessorSPARQL } from './getDatetimeRuleProcessorSPARQL';\nimport { getDatetimeRuleProcessorSpEL } from './getDatetimeRuleProcessorSpEL';\nimport {\n getDatetimeRuleProcessorSQL,\n getDatetimeValueProcessorANSI,\n getDatetimeValueProcessorMSSQL,\n getDatetimeValueProcessorMySQL,\n getDatetimeValueProcessorOracle,\n getDatetimeValueProcessorPostgreSQL,\n} from './getDatetimeRuleProcessorSQL';\nimport { getDatetimeRuleProcessorTanStackDB } from './getDatetimeRuleProcessorTanStackDB';\nimport { rqbDateTimeLibraryAPI } from './rqbDateTimeLibraryAPI.luxon';\nimport type { RQBJsonLogicDateTimeOperations } from './types';\n\n/**\n * Custom JsonLogic date/time operations using Luxon\n */\nexport const jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations =\n getDatetimeJsonLogicOperations(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sql\" format using Luxon\n */\nexport const datetimeRuleProcessorSQL: RuleProcessor =\n getDatetimeRuleProcessorSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"ansi\" preset) using Luxon\n */\nexport const datetimeValueProcessorANSI: ValueProcessorByRule =\n getDatetimeValueProcessorANSI(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"mssql\" preset) using Luxon\n */\nexport const datetimeValueProcessorMSSQL: ValueProcessorByRule =\n getDatetimeValueProcessorMSSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"mysql\" preset) using Luxon\n */\nexport const datetimeValueProcessorMySQL: ValueProcessorByRule =\n getDatetimeValueProcessorMySQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"oracle\" preset) using Luxon\n */\nexport const datetimeValueProcessorOracle: ValueProcessorByRule =\n getDatetimeValueProcessorOracle(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"postgresql\" preset) using Luxon\n */\nexport const datetimeValueProcessorPostgreSQL: ValueProcessorByRule =\n getDatetimeValueProcessorPostgreSQL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"cel\" format using Luxon\n */\nexport const datetimeRuleProcessorCEL: ValueProcessorByRule =\n getDatetimeRuleProcessorCEL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"jsonata\" format using Luxon\n */\nexport const datetimeRuleProcessorJSONata: RuleProcessor =\n getDatetimeRuleProcessorJSONata(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"mongodb_query\" format using Luxon\n */\nexport const datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule =\n getDatetimeRuleProcessorMongoDBQuery(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"natural_language\" format using Luxon\n */\nexport const datetimeRuleProcessorNL: ValueProcessorByRule =\n getDatetimeRuleProcessorNL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"cypher\"/\"gql\" format using Luxon\n */\nexport const datetimeRuleProcessorCypher: ValueProcessorByRule =\n getDatetimeRuleProcessorCypher(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sparql\" format using Luxon\n */\nexport const datetimeRuleProcessorSPARQL: ValueProcessorByRule =\n getDatetimeRuleProcessorSPARQL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"parameterized\"/\"parameterized_named\" formats\n */\nexport const datetimeRuleProcessorParameterized: RuleProcessor =\n getDatetimeRuleProcessorParameterized(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"spel\" format\n */\nexport const datetimeRuleProcessorSpEL: RuleProcessor =\n getDatetimeRuleProcessorSpEL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"ldap\" format\n */\nexport const datetimeRuleProcessorLDAP: RuleProcessor =\n getDatetimeRuleProcessorLDAP(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"gremlin\" format\n */\nexport const datetimeRuleProcessorGremlin: RuleProcessor =\n getDatetimeRuleProcessorGremlin(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"prisma\" format\n */\nexport const datetimeRuleProcessorPrisma: RuleProcessor =\n getDatetimeRuleProcessorPrisma(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sequelize\" format\n */\nexport const datetimeRuleProcessorSequelize: RuleProcessor =\n getDatetimeRuleProcessorSequelize(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"drizzle\" format\n */\nexport const datetimeRuleProcessorDrizzle: RuleProcessor =\n getDatetimeRuleProcessorDrizzle(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"elasticsearch\" format\n */\nexport const datetimeRuleProcessorElasticSearch: RuleProcessor =\n getDatetimeRuleProcessorElasticSearch(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"tanstack_db\" format\n */\nexport const datetimeRuleProcessorTanStackDB: RuleProcessor =\n getDatetimeRuleProcessorTanStackDB(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for (deprecated) \"mongodb\" format\n */\nexport const datetimeRuleProcessorMongoDB: RuleProcessor =\n getDatetimeRuleProcessorMongoDB(rqbDateTimeLibraryAPI);\n\nexport * from './rqbDateTimeLibraryAPI.luxon';\n"],"mappings":"qSAIA,MAAM,EAAc,GAClB,OAAO,GAAM,SAAW,EAAS,QAAQ,CAAC,EAAI,EAAS,WAAW,CAAC,EAC/D,EAAkB,aAElB,EAAuD,CAC3D,OAAQ,UACR,KAAM,QACN,IAAK,OACL,KAAM,QACN,MAAO,SACP,KAAM,OACR,EAKa,EAA+C,CAC1D,QAAS,EAAG,IAAQ,EAAW,CAAC,CAAC,CAAC,SAAS,EAAI,QAAQ,aAAc,CAAe,CAAC,EACrF,SAAU,EAAG,IAAM,EAAW,CAAC,EAAI,EAAW,CAAC,EAC/C,UAAW,EAAG,IAAM,EAAW,CAAC,EAAI,EAAW,CAAC,EAChD,QAAS,EAAG,IACV,EAAoB,CAAC,GAAK,EAAoB,CAAC,EAC3C,EAAW,CAAC,CAAC,CAAC,QAAQ,EAAW,CAAC,EAAG,KAAK,EAC1C,CAAC,EAAW,CAAC,GAAM,CAAC,EAAW,CAAC,EACtC,QAAS,GAAK,EAAW,CAAC,CAAC,CAAC,QAC5B,OAAQ,GAAK,EAAW,CAAC,CAAC,CAAC,SAAS,EACpC,YAAa,GAAK,CAChB,IAAM,EAAU,EAAW,CAAC,EAC5B,OAAO,EAAQ,QAAU,EAAQ,SAAS,CAAC,CAAC,YAAY,EAAI,EAC9D,EACA,oBAAqB,GAAK,CACxB,IAAM,EAAU,EAAW,CAAC,EAC5B,OAAO,EAAQ,QAAU,EAAQ,SAAS,CAAe,EAAI,EAC/D,EACA,SAAU,EAAG,IAAS,EAAW,CAAC,CAAC,CAAC,QAAQ,CAAI,CAAC,CAAC,SAAS,EAC3D,OAAQ,EAAG,IAAS,EAAW,CAAC,CAAC,CAAC,MAAM,CAAI,CAAC,CAAC,SAAS,EACvD,KAAM,EAAG,EAAQ,IACf,EAAW,CAAC,CAAC,CACV,KAAK,EAAG,EAAe,IAAQ,CAAO,CAAC,CAAC,CACxC,SAAS,CAChB,ECNa,EACX,EAA+B,CAAqB,EAKzC,EACX,EAA4B,CAAqB,EAItC,EACX,EAA8B,CAAqB,EAIxC,EACX,EAA+B,CAAqB,EAIzC,EACX,EAA+B,CAAqB,EAIzC,EACX,EAAgC,CAAqB,EAI1C,EACX,EAAoC,CAAqB,EAK9C,EACX,EAA4B,CAAqB,EAKtC,EACX,EAAgC,CAAqB,EAK1C,EACX,EAAqC,CAAqB,EAK/C,EACX,EAA2B,CAAqB,EAKrC,EACX,EAA+B,CAAqB,EAKzC,EACX,EAA+B,CAAqB,EAKzC,EACX,EAAsC,CAAqB,EAKhD,EACX,EAA6B,CAAqB,EAKvC,EACX,EAA6B,CAAqB,EAKvC,EACX,EAAgC,CAAqB,EAK1C,EACX,EAA+B,CAAqB,EAKzC,EACX,EAAkC,CAAqB,EAK5C,EACX,EAAgC,CAAqB,EAK1C,EACX,EAAsC,CAAqB,EAKhD,EACX,EAAmC,CAAqB,EAK7C,EACX,EAAgC,CAAqB"}
@@ -1,2 +1,2 @@
1
- import{A as e,C as t,E as n,O as r,S as i,T as a,_ as o,a as s,b as c,c as l,d as u,f as d,g as f,h as p,i as m,k as h,l as g,m as _,n as v,o as y,p as b,r as x,s as S,t as C,u as w,v as ee,w as te,x as ne,y as re}from"./getDatetimeRuleProcessorTanStackDB-Dloxv6k2.mjs";import{t as ie}from"./rqbDateTimeLibraryAPI.dayjs-BoX90aqZ.mjs";import{QueryBuilderContext as ae,ValueEditor as T,clsx as E,defaultOperators as oe,defaultRuleProcessorJsonLogic as D,getCompatContextProvider as se,parseNumber as ce,standardClassnames as O,toArray as k,useValueEditor as A}from"react-querybuilder";import*as j from"react";import{createContext as M,useCallback as N,useContext as P,useMemo as F}from"react";const I={"!=":`dateNotOn`,"<":`dateBefore`,"<=":`dateOnOrBefore`,"=":`dateOn`,">":`dateAfter`,">=":`dateOnOrAfter`,between:`dateBetween`,in:`dateIn`,notBetween:`dateNotBetween`,notIn:`dateNotIn`},le=(t,i)=>{let a=i??{};if(!h(a.context?.isDateField,t,a))return D(t,a);let{field:o,value:s,valueSource:c}=t,l=e(t,a),u=c===`field`,d={var:o},f=n(a?.fieldData?.datatype),p=e=>u?{var:`${e}`}:r(e)?{dateRelative:[e.anchor,e.offset,e.unit,f]}:e;switch(l){case`<`:case`<=`:case`=`:case`!=`:case`>`:case`>=`:return{[I[l]]:[d,p(s)]};case`in`:case`notIn`:{let e=(Array.isArray(s)?s:k(s)).map(p);return{[I[l]]:[d,e]}}case`between`:case`notBetween`:{let e=(Array.isArray(s)?s:k(s)).map(p);return e.length<2?!1:{[I[l]]:[e[0],d,e[1]]}}}return D(t,i)},L=M(null),R=()=>P(L),z=`rule-value-dateTimeRelative-toggle`,B={mode:`relative`,anchor:`now`,offset:0,unit:`day`},ue=[{name:`now`,value:`now`,label:`now`},{name:`startOfDay`,value:`startOfDay`,label:`start of day`},{name:`endOfDay`,value:`endOfDay`,label:`end of day`},{name:`startOfWeek`,value:`startOfWeek`,label:`start of week`},{name:`endOfWeek`,value:`endOfWeek`,label:`end of week`},{name:`startOfMonth`,value:`startOfMonth`,label:`start of month`},{name:`endOfMonth`,value:`endOfMonth`,label:`end of month`},{name:`startOfYear`,value:`startOfYear`,label:`start of year`},{name:`endOfYear`,value:`endOfYear`,label:`end of year`}],V=[{name:`minute`,value:`minute`,label:`minute(s)`},{name:`hour`,value:`hour`,label:`hour(s)`},{name:`day`,value:`day`,label:`day(s)`},{name:`week`,value:`week`,label:`week(s)`},{name:`month`,value:`month`,label:`month(s)`},{name:`year`,value:`year`,label:`year(s)`}],H={label:`Toggle relative date/time`,absoluteTitle:`Absolute date/time (click for relative)`,relativeTitle:`Relative date/time (click for absolute)`,absoluteContent:``,relativeContent:``},U=({isRelative:e,setMode:t,disabled:n,className:r,labels:i})=>{let a=j.useCallback(()=>t(e?`absolute`:`relative`),[t,e]);return j.createElement(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":i.label,title:e?i.relativeTitle:i.absoluteTitle,disabled:n,className:E(z,r),onClick:a},e?i.relativeContent:i.absoluteContent)},W={isRelative:e=>r(e.value),ModeControl:U},de=e=>({isRelative:t=>typeof e==`function`?e(t.operator):e.includes(t.operator)}),fe=(e,t)=>e.map(e=>({...e,operators:[...e.operators??oe,...t]})),G=M({}),K=()=>{let e=P(G);return F(()=>({modeController:e.modeController??W,anchors:e.anchors??ue,units:e.units??V,toggleLabels:{...H,...e.toggleLabels},dateTimeAPI:e.dateTimeAPI??ie}),[e])},q=[],pe={name:``,value:``,label:``},me=e=>Array.isArray(e)?e:r(e)?[e]:k(e),J=({baseProps:e,value:t,onChange:n,absoluteOperator:i,config:a,SelectorComponent:o,NumericEditorComponent:s,valueListItemClassName:c,numericSchema:l})=>{let{schema:u,disabled:d,title:f,testID:p}=e,{modeController:m,anchors:h,units:g,toggleLabels:_}=a,v=m.isRelative({...e,value:t}),y=r(t)?t:B,b=N(e=>n(e===`relative`?B:``),[n]),x=N(e=>n({...y,anchor:e}),[n,y]),S=N(e=>n({...y,offset:ce(e,{parseNumbers:!0})||0}),[n,y]),C=N(e=>n({...y,unit:e}),[n,y]),{ModeControl:w}=m;return j.createElement(j.Fragment,null,w&&j.createElement(w,{isRelative:v,setMode:b,schema:u,disabled:d,className:c,title:f,testID:p,labels:_}),v?j.createElement(j.Fragment,null,j.createElement(o,{schema:u,testID:p,title:f,className:c,handleOnChange:x,disabled:d,value:y.anchor,options:h,multiple:!1,listsAsArrays:!1,path:q,level:0}),j.createElement(s,{skipHook:!0,testID:p,inputType:`number`,title:f,className:c,disabled:d,handleOnChange:S,field:``,operator:``,value:y.offset,valueSource:`value`,fieldData:pe,schema:l,path:q,level:0,rule:{field:``,operator:`=`,value:y.offset}}),y.offset!==0&&j.createElement(o,{schema:u,testID:p,title:f,className:c,handleOnChange:C,disabled:d,value:y.unit,options:g,multiple:!1,listsAsArrays:!1,path:q,level:0})):j.createElement(ge,{...e,operator:i,value:t,handleOnChange:n,className:O.value}))},Y=e=>{let{valueListItemClassName:t}=A(e),{className:n,value:r,handleOnChange:i,schema:a,operator:o,separator:s}=e,{suppressStandardClassnames:c}=a,l=e.selectorComponent??a.controls.valueSelector,u=R()??T,d=K(),f=F(()=>({...a,parseNumbers:!0}),[a]),p=F(()=>E(c||O.valueDateTimeRelative,n),[c,n]),m=o===`between`||o===`notBetween`,h=F(()=>me(r),[r]),g=N(e=>t=>{let n=[h[0],h[1]];n[e]=t,i(n)},[h,i]);return m?j.createElement(`span`,{className:p},j.createElement(J,{baseProps:e,value:h[0],onChange:g(0),absoluteOperator:`=`,config:d,SelectorComponent:l,NumericEditorComponent:u,valueListItemClassName:t,numericSchema:f}),s,j.createElement(J,{baseProps:e,value:h[1],onChange:g(1),absoluteOperator:`=`,config:d,SelectorComponent:l,NumericEditorComponent:u,valueListItemClassName:t,numericSchema:f})):j.createElement(`span`,{className:p},j.createElement(J,{baseProps:e,value:r,onChange:i,absoluteOperator:o,config:d,SelectorComponent:l,NumericEditorComponent:u,valueListItemClassName:t,numericSchema:f}))},X=(e,t)=>e.type===`text`&&(t===`date`||t===`datetime-local`)||/^(?:date|datetime|timestamp)\b/i.test(e.fieldData?.datatype),Z=e=>`${e}`.padStart(2,`0`),he=(e,t)=>{let n=`${e.getFullYear()}-${Z(e.getMonth()+1)}-${Z(e.getDate())}`;return t?`${n}T${Z(e.getHours())}:${Z(e.getMinutes())}`:n},Q=({editor:e,...t})=>e?j.createElement(e,t):j.createElement(T,{...t,skipHook:!0}),ge=e=>{let t=A(e),n=R(),{dateTimeAPI:r}=K(),i=e=>j.createElement(Q,{editor:n,...e});if(!X(e,t.inputTypeCoerced))return i(e);if(r.isValid(e.value)){let n=he(r.toDate(e.value),t.inputTypeCoerced!==`date`);return i({...e,value:n})}return i(e)},$=se({controlElements:{valueEditor:e=>{let t=A(e),n=R();return X(e,t.inputTypeCoerced)?j.createElement(Y,e):j.createElement(Q,{editor:n,...e})}}}),_e=({children:e,modeController:t,anchors:n,units:r,toggleLabels:i,dateTimeAPI:a})=>{let o=F(()=>({modeController:t,anchors:n,units:r,toggleLabels:i,dateTimeAPI:a}),[t,n,r,i,a]),s=P(ae).controlElements?.valueEditor??null;return j.createElement(G.Provider,{value:o},j.createElement(L.Provider,{value:s},j.createElement($,null,e)))};export{ge as DateTimeValueEditor,_e as QueryBuilderDateTime,$ as QueryBuilderDateTimeContext,G as RelativeDateTimeConfigContext,U as RelativeDateTimeModeToggle,Y as RelativeDateTimeValueEditor,de as createOperatorModeController,le as datetimeRuleProcessorJsonLogic,b as datetimeValueProcessorNL,_ as defaultDateTimeNLOperatorMap,ue as defaultRelativeDateTimeAnchors,H as defaultRelativeDateTimeToggleLabels,V as defaultRelativeDateTimeUnits,B as defaultRelativeDateTimeValue,a as getDatetimeJsonLogicOperations,te as getDatetimeRuleProcessorCEL,t as getDatetimeRuleProcessorCypher,i as getDatetimeRuleProcessorDrizzle,ne as getDatetimeRuleProcessorElasticSearch,c as getDatetimeRuleProcessorGremlin,re as getDatetimeRuleProcessorJSONata,ee as getDatetimeRuleProcessorLDAP,f as getDatetimeRuleProcessorMongoDB,o as getDatetimeRuleProcessorMongoDBQuery,p as getDatetimeRuleProcessorNL,d as getDatetimeRuleProcessorParameterized,u as getDatetimeRuleProcessorPrisma,g as getDatetimeRuleProcessorSPARQL,v as getDatetimeRuleProcessorSQL,w as getDatetimeRuleProcessorSequelize,l as getDatetimeRuleProcessorSpEL,C as getDatetimeRuleProcessorTanStackDB,x as getDatetimeValueProcessorANSI,m as getDatetimeValueProcessorMSSQL,s as getDatetimeValueProcessorMySQL,y as getDatetimeValueProcessorOracle,S as getDatetimeValueProcessorPostgreSQL,z as relativeDateTimeToggleClassName,W as toggleModeController,K as useRelativeDateTimeConfig,fe as withRelativeOperators};
1
+ import{c as e,i as t,s as n,t as r}from"./utils-DA8aluCt.mjs";import{C as i,S as a,T as o,_ as s,a as c,b as l,c as u,d,f,g as p,h as m,i as h,l as g,m as _,n as v,o as y,p as b,r as x,s as S,t as C,u as w,v as T,w as E,x as D,y as O}from"./getDatetimeRuleProcessorTanStackDB-6K1DsuEV.mjs";import{defaultRuleProcessorJsonLogic as k,toArray as A}from"@react-querybuilder/core";const j={"!=":`dateNotOn`,"<":`dateBefore`,"<=":`dateOnOrBefore`,"=":`dateOn`,">":`dateAfter`,">=":`dateOnOrAfter`,between:`dateBetween`,in:`dateIn`,notBetween:`dateNotBetween`,notIn:`dateNotIn`},M=(i,a)=>{let o=a??{};if(!n(o.context?.isDateField,i,o)||i.valueSource===`parameter`)return k(i,o);let{field:s,value:c,valueSource:l}=i,u=e(i,o),d=l===`field`,f={var:s},p=r(o?.fieldData?.datatype),m=e=>d?{var:`${e}`}:t(e)?{dateRelative:[e.anchor,e.offset,e.unit,p]}:e;switch(u){case`<`:case`<=`:case`=`:case`!=`:case`>`:case`>=`:return{[j[u]]:[f,m(c)]};case`in`:case`notIn`:{let e=(Array.isArray(c)?c:A(c)).map(m);return{[j[u]]:[f,e]}}case`between`:case`notBetween`:{let e=(Array.isArray(c)?c:A(c)).map(m);return e.length<2?!1:{[j[u]]:[e[0],f,e[1]]}}}return k(i,a)};export{M as datetimeRuleProcessorJsonLogic,b as datetimeValueProcessorNL,_ as defaultDateTimeNLOperatorMap,o as getDatetimeJsonLogicOperations,E as getDatetimeRuleProcessorCEL,i as getDatetimeRuleProcessorCypher,a as getDatetimeRuleProcessorDrizzle,D as getDatetimeRuleProcessorElasticSearch,l as getDatetimeRuleProcessorGremlin,O as getDatetimeRuleProcessorJSONata,T as getDatetimeRuleProcessorLDAP,p as getDatetimeRuleProcessorMongoDB,s as getDatetimeRuleProcessorMongoDBQuery,m as getDatetimeRuleProcessorNL,f as getDatetimeRuleProcessorParameterized,d as getDatetimeRuleProcessorPrisma,g as getDatetimeRuleProcessorSPARQL,v as getDatetimeRuleProcessorSQL,w as getDatetimeRuleProcessorSequelize,u as getDatetimeRuleProcessorSpEL,C as getDatetimeRuleProcessorTanStackDB,x as getDatetimeValueProcessorANSI,h as getDatetimeValueProcessorMSSQL,c as getDatetimeValueProcessorMySQL,y as getDatetimeValueProcessorOracle,S as getDatetimeValueProcessorPostgreSQL};
2
2
  //# sourceMappingURL=react-querybuilder_datetime.production.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"react-querybuilder_datetime.production.mjs","names":["defaultDateTimeAPI"],"sources":["../src/datetimeRuleProcessorJsonLogic.ts","../src/InheritedValueEditorContext.ts","../src/relativeDateTimeConstants.ts","../src/relativeDateTimeModeControllers.tsx","../src/RelativeDateTimeConfigContext.tsx","../src/RelativeDateTimeValueEditor.tsx","../src/QueryBuilderDateTime.tsx"],"sourcesContent":["import type { DefaultOperatorName, JsonLogicVar, RuleProcessor } from 'react-querybuilder';\nimport { defaultRuleProcessorJsonLogic, toArray } from 'react-querybuilder';\nimport type { RQBJsonLogicDateRelative, RQBDateTimeJsonLogic } from './types';\nimport {\n isDateOnlyDatatype,\n isRelativeDateTimeValue,\n processIsDateField,\n resolveDatetimeOperator,\n} from './utils';\n\nconst dateOperationMap = {\n '!=': 'dateNotOn',\n '<': 'dateBefore',\n '<=': 'dateOnOrBefore',\n '=': 'dateOn',\n '>': 'dateAfter',\n '>=': 'dateOnOrAfter',\n between: 'dateBetween',\n in: 'dateIn',\n notBetween: 'dateNotBetween',\n notIn: 'dateNotIn',\n} as const satisfies Partial<Record<DefaultOperatorName, string>>;\n\n/**\n * Date/time rule processor for use by {@link @react-querybuilder/core!formatQuery formatQuery}\n * with the \"jsonlogic\" format.\n *\n * Note: Unlike other date/time rule processors from this library, this function does\n * not require a date/time library API. Instead, the date/time library API is used by\n * {@link getDatetimeJsonLogicOperations} during the evaluation process.\n */\nexport const datetimeRuleProcessorJsonLogic: RuleProcessor = (\n rule,\n options\n): RQBDateTimeJsonLogic => {\n const opts = options ?? /* v8 ignore start -- @preserve */ {} /* v8 ignore stop -- @preserve */;\n\n if (!processIsDateField(opts.context?.isDateField, rule, opts)) {\n return defaultRuleProcessorJsonLogic(rule, opts);\n }\n\n const { field, value, valueSource } = rule;\n const operator = resolveDatetimeOperator(rule, opts);\n const valueIsField = valueSource === 'field';\n const fieldObject: JsonLogicVar = { var: field };\n const dateOnly = isDateOnlyDatatype(opts?.fieldData?.datatype);\n // Relative values stay \"live\": emit a `dateRelative` op resolved at evaluation time.\n // Field-source values are field names and render as `var` references.\n const renderValue = (v: unknown) => {\n if (valueIsField) return { var: `${v}` };\n if (isRelativeDateTimeValue(v)) {\n return {\n dateRelative: [v.anchor, v.offset, v.unit, dateOnly],\n } as RQBJsonLogicDateRelative;\n }\n return v as string;\n };\n\n switch (operator) {\n case '<':\n case '<=':\n case '=':\n case '!=':\n case '>':\n case '>=':\n return {\n [dateOperationMap[operator]]: [fieldObject, renderValue(value)],\n } as RQBDateTimeJsonLogic;\n\n case 'in':\n case 'notIn': {\n const valueAsArray = (Array.isArray(value) ? value : toArray(value)).map(renderValue);\n return { [dateOperationMap[operator]]: [fieldObject, valueAsArray] } as RQBDateTimeJsonLogic;\n }\n\n case 'between':\n case 'notBetween': {\n const valueAsArray = (Array.isArray(value) ? value : toArray(value)).map(renderValue);\n\n if (valueAsArray.length < 2) return false;\n\n return {\n [dateOperationMap[operator]]: [valueAsArray[0], fieldObject, valueAsArray[1]],\n } as RQBDateTimeJsonLogic;\n }\n }\n\n return defaultRuleProcessorJsonLogic(rule, options);\n};\n","import type { Context } from 'react';\nimport { createContext, useContext } from 'react';\nimport type { ValueEditorProps } from 'react-querybuilder';\n\n/**\n * Holds the value editor inherited from an outer (compat package) context provider,\n * captured _before_ {@link QueryBuilderDateTime} overrides it. Lets the date/time value\n * editor delegate non-date fields (and absolute date inputs) to the compat editor instead\n * of the bare default {@link react-querybuilder!ValueEditor ValueEditor}. `null` = none\n * inherited (fall back to default).\n */\nexport const InheritedValueEditorContext: Context<React.ComponentType<ValueEditorProps> | null> =\n createContext<React.ComponentType<ValueEditorProps> | null>(null);\n\n/** Inherited (compat) value editor, or `null` if none. See {@link InheritedValueEditorContext}. */\nexport const useInheritedValueEditor = (): React.ComponentType<ValueEditorProps> | null =>\n useContext(InheritedValueEditorContext);\n","import type { FullOption } from 'react-querybuilder';\nimport type {\n RelativeDateTimeAnchor,\n RelativeDateTimeToggleLabels,\n RelativeDateTimeUnit,\n RelativeDateTimeValue,\n} from './types';\n\n/**\n * Class name applied to the absolute/relative mode toggle button. Package-local (not part\n * of the core `standardClassnames`) to avoid coupling core to this extension.\n */\nexport const relativeDateTimeToggleClassName = 'rule-value-dateTimeRelative-toggle';\n\n/** Default value applied when switching a rule to relative mode. */\nexport const defaultRelativeDateTimeValue: RelativeDateTimeValue = {\n mode: 'relative',\n anchor: 'now',\n offset: 0,\n unit: 'day',\n};\n\n/** Default anchor (reference-point) options for the relative date/time editor. */\nexport const defaultRelativeDateTimeAnchors: FullOption<RelativeDateTimeAnchor>[] = [\n { name: 'now', value: 'now', label: 'now' },\n { name: 'startOfDay', value: 'startOfDay', label: 'start of day' },\n { name: 'endOfDay', value: 'endOfDay', label: 'end of day' },\n { name: 'startOfWeek', value: 'startOfWeek', label: 'start of week' },\n { name: 'endOfWeek', value: 'endOfWeek', label: 'end of week' },\n { name: 'startOfMonth', value: 'startOfMonth', label: 'start of month' },\n { name: 'endOfMonth', value: 'endOfMonth', label: 'end of month' },\n { name: 'startOfYear', value: 'startOfYear', label: 'start of year' },\n { name: 'endOfYear', value: 'endOfYear', label: 'end of year' },\n];\n\n/** Default unit options for the relative date/time editor. */\nexport const defaultRelativeDateTimeUnits: FullOption<RelativeDateTimeUnit>[] = [\n { name: 'minute', value: 'minute', label: 'minute(s)' },\n { name: 'hour', value: 'hour', label: 'hour(s)' },\n { name: 'day', value: 'day', label: 'day(s)' },\n { name: 'week', value: 'week', label: 'week(s)' },\n { name: 'month', value: 'month', label: 'month(s)' },\n { name: 'year', value: 'year', label: 'year(s)' },\n];\n\n/** Default labels/content for the absolute/relative mode toggle. */\nexport const defaultRelativeDateTimeToggleLabels: Required<RelativeDateTimeToggleLabels> = {\n label: 'Toggle relative date/time',\n absoluteTitle: 'Absolute date/time (click for relative)',\n relativeTitle: 'Relative date/time (click for absolute)',\n // Empty by default; the CSS pseudo-element renders the glyph based on `aria-checked`.\n absoluteContent: '',\n relativeContent: '',\n};\n","import * as React from 'react';\nimport type { FullOperator } from 'react-querybuilder';\nimport { clsx, defaultOperators } from 'react-querybuilder';\nimport { relativeDateTimeToggleClassName } from './relativeDateTimeConstants';\nimport type { RelativeDateTimeModeController, RelativeDateTimeModeControlProps } from './types';\nimport { isRelativeDateTimeValue } from './utils';\n\n/**\n * Compact absolute/relative toggle rendered by {@link toggleModeController}. A\n * `role=\"switch\"` button whose default glyph is supplied by CSS (keyed on\n * `aria-checked`); override via the `toggleLabels` config.\n *\n * @group Components\n */\nexport const RelativeDateTimeModeToggle = ({\n isRelative,\n setMode,\n disabled,\n className,\n labels,\n}: RelativeDateTimeModeControlProps): React.JSX.Element => {\n const onClick = React.useCallback(\n () => setMode(isRelative ? 'absolute' : 'relative'),\n [setMode, isRelative]\n );\n\n return (\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={isRelative}\n aria-label={labels.label}\n title={isRelative ? labels.relativeTitle : labels.absoluteTitle}\n disabled={disabled}\n className={clsx(relativeDateTimeToggleClassName, className)}\n onClick={onClick}>\n {isRelative ? labels.relativeContent : labels.absoluteContent}\n </button>\n );\n};\n\n/**\n * Zero-config default {@link RelativeDateTimeModeController}: derives the mode from the\n * value shape and renders a compact toggle button to switch between absolute and\n * relative entry.\n */\nexport const toggleModeController: RelativeDateTimeModeController = {\n isRelative: props => isRelativeDateTimeValue(props.value),\n ModeControl: RelativeDateTimeModeToggle,\n};\n\n/**\n * Builds an operator-driven {@link RelativeDateTimeModeController} that derives the mode\n * from the rule's operator. Pass the operator name(s) (or a predicate) that should put the\n * editor in relative mode. No toggle is rendered — the operator selector is the mode\n * affordance.\n *\n * NOTE: the chosen operators only signal _mode_; the rule's value remains a\n * {@link RelativeDateTimeValue}. For these operators to export correctly, map each one to a\n * real comparison operator via `context.relativeOperatorMap` when calling `formatQuery`\n * (e.g. `{ relativeEq: '=' }`). See the documentation.\n */\nexport const createOperatorModeController = (\n relativeOperators: string[] | ((operator: string) => boolean)\n): RelativeDateTimeModeController => ({\n isRelative: props =>\n typeof relativeOperators === 'function'\n ? relativeOperators(props.operator)\n : relativeOperators.includes(props.operator),\n});\n\ninterface FieldWithOperators {\n operators?: FullOperator[];\n [key: string]: unknown;\n}\n\n/**\n * Appends the given `operators` to each field's `operators` list, so the operator-driven\n * controller (see {@link createOperatorModeController}) has an operator to switch into\n * relative mode. Fields without an explicit `operators` list fall back to the core\n * `defaultOperators`.\n */\nexport const withRelativeOperators = <F extends FieldWithOperators>(\n fields: F[],\n operators: FullOperator[]\n): F[] =>\n fields.map(field => ({\n ...field,\n operators: [...(field.operators ?? (defaultOperators as FullOperator[])), ...operators],\n }));\n","import * as React from 'react';\nimport { createContext, useContext, useMemo } from 'react';\nimport type { FullOption } from 'react-querybuilder';\nimport {\n defaultRelativeDateTimeAnchors,\n defaultRelativeDateTimeToggleLabels,\n defaultRelativeDateTimeUnits,\n} from './relativeDateTimeConstants';\nimport { toggleModeController } from './relativeDateTimeModeControllers';\nimport { rqbDateTimeLibraryAPI as defaultDateTimeAPI } from './rqbDateTimeLibraryAPI.dayjs';\nimport type {\n RelativeDateTimeAnchor,\n RelativeDateTimeEditorConfig,\n RelativeDateTimeModeController,\n RelativeDateTimeToggleLabels,\n RelativeDateTimeUnit,\n RQBDateTimeLibraryAPI,\n} from './types';\n\n/** Fully-resolved relative date/time editor config (no optional fields). */\nexport interface ResolvedRelativeDateTimeConfig {\n modeController: RelativeDateTimeModeController;\n anchors: FullOption<RelativeDateTimeAnchor>[];\n units: FullOption<RelativeDateTimeUnit>[];\n toggleLabels: Required<RelativeDateTimeToggleLabels>;\n dateTimeAPI: RQBDateTimeLibraryAPI;\n}\n\n/**\n * Carries {@link RelativeDateTimeEditorConfig} to the {@link RelativeDateTimeValueEditor}.\n * Provided by {@link QueryBuilderDateTime}; defaults apply when no provider is present.\n */\nexport const RelativeDateTimeConfigContext: React.Context<RelativeDateTimeEditorConfig> =\n createContext<RelativeDateTimeEditorConfig>({});\n\n/** Reads the relative date/time editor config from context, merged with defaults. */\nexport const useRelativeDateTimeConfig = (): ResolvedRelativeDateTimeConfig => {\n const config = useContext(RelativeDateTimeConfigContext);\n return useMemo(\n () => ({\n modeController: config.modeController ?? toggleModeController,\n anchors: config.anchors ?? defaultRelativeDateTimeAnchors,\n units: config.units ?? defaultRelativeDateTimeUnits,\n toggleLabels: { ...defaultRelativeDateTimeToggleLabels, ...config.toggleLabels },\n dateTimeAPI: config.dateTimeAPI ?? defaultDateTimeAPI,\n }),\n [config]\n );\n};\n","import * as React from 'react';\nimport { useCallback, useMemo } from 'react';\nimport type { FullField, Path, ValueEditorProps, ValueSelectorProps } from 'react-querybuilder';\nimport {\n clsx,\n parseNumber,\n standardClassnames,\n toArray,\n useValueEditor,\n ValueEditor,\n} from 'react-querybuilder';\nimport { useInheritedValueEditor } from './InheritedValueEditorContext';\nimport { DateTimeValueEditor } from './QueryBuilderDateTime';\nimport type { ResolvedRelativeDateTimeConfig } from './RelativeDateTimeConfigContext';\nimport { useRelativeDateTimeConfig } from './RelativeDateTimeConfigContext';\nimport { defaultRelativeDateTimeValue } from './relativeDateTimeConstants';\nimport type { RelativeDateTimeAnchor, RelativeDateTimeUnit, RelativeDateTimeValue } from './types';\nimport { isRelativeDateTimeValue } from './utils';\n\nconst dummyPath: Path = [];\nconst dummyFieldData: FullField = { name: '', value: '', label: '' };\n\n/** Splits a value into the from/to pair used by between/notBetween, object-safe. */\nconst toBetweenArray = (value: unknown): unknown[] =>\n Array.isArray(value) ? value : isRelativeDateTimeValue(value) ? [value] : toArray(value);\n\ninterface RelativeDateTimeSingleValueEditorProps {\n /** The original value editor props (for mode derivation and absolute rendering). */\n baseProps: ValueEditorProps;\n /** The value for this slot (the whole value, or one element of a between pair). */\n value: unknown;\n /** Emits a new value for this slot. */\n onChange: (value: unknown) => void;\n /** Operator passed to the absolute editor (forced to `=` for between slots). */\n absoluteOperator: string;\n config: ResolvedRelativeDateTimeConfig;\n SelectorComponent: React.ComponentType<ValueSelectorProps>;\n /** Themed numeric offset input: the inherited (compat) editor when present, else the default. */\n NumericEditorComponent: React.ComponentType<ValueEditorProps>;\n valueListItemClassName?: string;\n numericSchema: ValueEditorProps['schema'];\n}\n\n/**\n * Renders a single absolute-or-relative date/time value: a mode affordance (per the\n * controller) plus either an absolute date input or anchor + signed offset + unit\n * selectors. Reused once per slot so between/notBetween can mix bounds (e.g. an absolute\n * \"from\" and a relative \"to\").\n */\nconst RelativeDateTimeSingleValueEditor = ({\n baseProps,\n value,\n onChange,\n absoluteOperator,\n config,\n SelectorComponent,\n NumericEditorComponent,\n valueListItemClassName,\n numericSchema,\n}: RelativeDateTimeSingleValueEditorProps): React.JSX.Element => {\n const { schema, disabled, title, testID } = baseProps;\n const { modeController, anchors, units, toggleLabels } = config;\n\n const isRelative = modeController.isRelative({ ...baseProps, value });\n const relValue: RelativeDateTimeValue = isRelativeDateTimeValue(value)\n ? value\n : defaultRelativeDateTimeValue;\n\n const handleSetMode = useCallback(\n (mode: 'absolute' | 'relative') =>\n onChange(mode === 'relative' ? defaultRelativeDateTimeValue : ''),\n [onChange]\n );\n\n const handleChangeAnchor = useCallback(\n (anchor: string) => onChange({ ...relValue, anchor: anchor as RelativeDateTimeAnchor }),\n [onChange, relValue]\n );\n\n const handleChangeOffset = useCallback(\n (offset: unknown) =>\n onChange({\n ...relValue,\n offset: (parseNumber(offset, { parseNumbers: true }) as number) || 0,\n }),\n [onChange, relValue]\n );\n\n const handleChangeUnit = useCallback(\n (unit: string) => onChange({ ...relValue, unit: unit as RelativeDateTimeUnit }),\n [onChange, relValue]\n );\n\n const { ModeControl } = modeController;\n\n return (\n <React.Fragment>\n {ModeControl && (\n <ModeControl\n isRelative={isRelative}\n setMode={handleSetMode}\n schema={schema}\n disabled={disabled}\n className={valueListItemClassName}\n title={title}\n testID={testID}\n labels={toggleLabels}\n />\n )}\n {isRelative ? (\n <React.Fragment>\n <SelectorComponent\n schema={schema}\n testID={testID}\n title={title}\n className={valueListItemClassName}\n handleOnChange={handleChangeAnchor}\n disabled={disabled}\n value={relValue.anchor}\n options={anchors}\n multiple={false}\n listsAsArrays={false}\n path={dummyPath}\n level={0}\n />\n <NumericEditorComponent\n skipHook\n testID={testID}\n inputType=\"number\"\n title={title}\n className={valueListItemClassName}\n disabled={disabled}\n handleOnChange={handleChangeOffset}\n field={''}\n operator={''}\n value={relValue.offset}\n valueSource={'value'}\n fieldData={dummyFieldData}\n schema={numericSchema}\n path={dummyPath}\n level={0}\n rule={{ field: '', operator: '=', value: relValue.offset }}\n />\n {relValue.offset !== 0 && (\n <SelectorComponent\n schema={schema}\n testID={testID}\n title={title}\n className={valueListItemClassName}\n handleOnChange={handleChangeUnit}\n disabled={disabled}\n value={relValue.unit}\n options={units}\n multiple={false}\n listsAsArrays={false}\n path={dummyPath}\n level={0}\n />\n )}\n </React.Fragment>\n ) : (\n <DateTimeValueEditor\n {...baseProps}\n operator={absoluteOperator}\n value={value}\n handleOnChange={onChange}\n className={standardClassnames.value}\n />\n )}\n </React.Fragment>\n );\n};\n\n/**\n * Value editor with support for {@link RelativeDateTimeValue relative date/time values}\n * (e.g. \"three months ago\" or \"the beginning of this year\"). How the user switches\n * between absolute and relative modes is delegated to a pluggable\n * {@link RelativeDateTimeModeController} (default: a compact toggle), supplied via\n * {@link QueryBuilderDateTime}. In relative mode it renders anchor + signed offset + unit\n * selectors; the unit selector is hidden when the offset is `0`.\n *\n * For the `between`/`notBetween` operators it renders two independent value editors (each\n * with its own mode affordance) and stores the bounds as a two-element array, so the from\n * and to bounds can independently be absolute or relative.\n *\n * @group Components\n */\nexport const RelativeDateTimeValueEditor = (props: ValueEditorProps): React.JSX.Element => {\n const { valueListItemClassName } = useValueEditor(props);\n\n const { className, value, handleOnChange, schema, operator, separator } = props;\n const { suppressStandardClassnames } = schema;\n\n const SelectorComponent = props.selectorComponent ?? schema.controls.valueSelector;\n\n // Themed numeric offset input from the inherited (compat) editor when present, else default.\n const NumericEditorComponent = useInheritedValueEditor() ?? ValueEditor;\n\n const config = useRelativeDateTimeConfig();\n\n const numericSchema = useMemo(() => ({ ...schema, parseNumbers: true }), [schema]);\n\n const outerClassname = useMemo(\n () => clsx(suppressStandardClassnames || standardClassnames.valueDateTimeRelative, className),\n [suppressStandardClassnames, className]\n );\n\n const isBetween = operator === 'between' || operator === 'notBetween';\n\n // For between/notBetween, store the bounds as a two-element array. Relative values are\n // objects (which can't survive comma-joining), so the array is emitted directly,\n // regardless of `listsAsArrays`.\n const valueAsArray = useMemo(() => toBetweenArray(value), [value]);\n\n const handleChangeBound = useCallback(\n (index: number) => (boundValue: unknown) => {\n const next = [valueAsArray[0], valueAsArray[1]];\n next[index] = boundValue;\n handleOnChange(next);\n },\n [valueAsArray, handleOnChange]\n );\n\n if (isBetween) {\n return (\n <span className={outerClassname}>\n <RelativeDateTimeSingleValueEditor\n baseProps={props}\n value={valueAsArray[0]}\n onChange={handleChangeBound(0)}\n absoluteOperator=\"=\"\n config={config}\n SelectorComponent={SelectorComponent}\n NumericEditorComponent={NumericEditorComponent}\n valueListItemClassName={valueListItemClassName}\n numericSchema={numericSchema}\n />\n {separator}\n <RelativeDateTimeSingleValueEditor\n baseProps={props}\n value={valueAsArray[1]}\n onChange={handleChangeBound(1)}\n absoluteOperator=\"=\"\n config={config}\n SelectorComponent={SelectorComponent}\n NumericEditorComponent={NumericEditorComponent}\n valueListItemClassName={valueListItemClassName}\n numericSchema={numericSchema}\n />\n </span>\n );\n }\n\n return (\n <span className={outerClassname}>\n <RelativeDateTimeSingleValueEditor\n baseProps={props}\n value={value}\n onChange={handleOnChange}\n absoluteOperator={operator}\n config={config}\n SelectorComponent={SelectorComponent}\n NumericEditorComponent={NumericEditorComponent}\n valueListItemClassName={valueListItemClassName}\n numericSchema={numericSchema}\n />\n </span>\n );\n};\n","import * as React from 'react';\nimport { useContext, useMemo } from 'react';\nimport type { QueryBuilderContextProvider, ValueEditorProps } from 'react-querybuilder';\nimport {\n getCompatContextProvider,\n QueryBuilderContext,\n useValueEditor,\n ValueEditor,\n} from 'react-querybuilder';\nimport {\n InheritedValueEditorContext,\n useInheritedValueEditor,\n} from './InheritedValueEditorContext';\nimport {\n RelativeDateTimeConfigContext,\n useRelativeDateTimeConfig,\n} from './RelativeDateTimeConfigContext';\nimport { RelativeDateTimeValueEditor } from './RelativeDateTimeValueEditor';\nimport type { RelativeDateTimeEditorConfig } from './types';\n\n/**\n * Whether a rule should use a date/time editor, based on either the coerced input\n * type (`date`/`datetime-local`) or a date-like `datatype` (`date`/`datetime`/`timestamp`).\n */\nconst isDateTimeEditor = (props: ValueEditorProps, inputTypeCoerced: string | undefined): boolean =>\n (props.type === 'text' &&\n (inputTypeCoerced === 'date' || inputTypeCoerced === 'datetime-local')) ||\n /^(?:date|datetime|timestamp)\\b/i.test(props.fieldData?.datatype as string);\n\nconst pad2 = (n: number): string => `${n}`.padStart(2, '0');\n\n/**\n * Formats a `Date` into the local value expected by a native `date`/`datetime-local`\n * input (library-agnostic; the date library only handles parsing/validation).\n */\nconst formatDateInputValue = (d: Date, withTime: boolean): string => {\n const datePart = `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`;\n return withTime ? `${datePart}T${pad2(d.getHours())}:${pad2(d.getMinutes())}` : datePart;\n};\n\n/**\n * Renders the inherited (compat) editor when one is provided, otherwise the default\n * {@link react-querybuilder!ValueEditor ValueEditor}. The editor is received as a prop (rather\n * than read from context here) so the JSX element type stays prop-sourced and stable.\n */\nconst FallbackValueEditor = ({\n editor: Editor,\n ...props\n}: ValueEditorProps & {\n editor: React.ComponentType<ValueEditorProps> | null;\n}): React.JSX.Element => (Editor ? <Editor {...props} /> : <ValueEditor {...props} skipHook />);\n\nexport const DateTimeValueEditor = (props: ValueEditorProps): React.JSX.Element => {\n const uVE = useValueEditor(props);\n const InheritedEditor = useInheritedValueEditor();\n const { dateTimeAPI } = useRelativeDateTimeConfig();\n\n // Non-date fields and unparseable values: delegate to the inherited (compat) editor when\n // present, otherwise the default editor.\n const fallback = (p: ValueEditorProps) => <FallbackValueEditor editor={InheritedEditor} {...p} />;\n\n if (!isDateTimeEditor(props, uVE.inputTypeCoerced)) {\n return fallback(props);\n }\n\n if (dateTimeAPI.isValid(props.value)) {\n const value = formatDateInputValue(\n dateTimeAPI.toDate(props.value),\n uVE.inputTypeCoerced !== 'date'\n );\n return fallback({ ...props, value });\n }\n\n return fallback(props);\n};\n\n/**\n * Provider value editor: renders the relative-capable {@link RelativeDateTimeValueEditor}\n * for date/time fields and falls back to the inherited (compat) editor for everything else.\n */\nconst QueryBuilderDateTimeValueEditor = (props: ValueEditorProps): React.JSX.Element => {\n const uVE = useValueEditor(props);\n const InheritedEditor = useInheritedValueEditor();\n\n if (isDateTimeEditor(props, uVE.inputTypeCoerced)) {\n return <RelativeDateTimeValueEditor {...props} />;\n }\n\n return <FallbackValueEditor editor={InheritedEditor} {...props} />;\n};\n\nexport const QueryBuilderDateTimeContext: QueryBuilderContextProvider = getCompatContextProvider({\n controlElements: { valueEditor: QueryBuilderDateTimeValueEditor },\n});\n\n/** Props for {@link QueryBuilderDateTime}: {@link RelativeDateTimeEditorConfig} plus children. */\nexport interface QueryBuilderDateTimeProps extends RelativeDateTimeEditorConfig {\n children?: React.ReactNode;\n}\n\n/**\n * Context provider enabling date/time features for a wrapped\n * {@link react-querybuilder!QueryBuilder QueryBuilder}: renders the relative-capable\n * {@link RelativeDateTimeValueEditor} for date/time fields, and accepts optional\n * {@link RelativeDateTimeEditorConfig} props (mode controller, anchor/unit options, and\n * toggle labels). With no props it provides the zero-config toggle experience.\n *\n * @group Components\n */\nexport const QueryBuilderDateTime = ({\n children,\n modeController,\n anchors,\n units,\n toggleLabels,\n dateTimeAPI,\n}: QueryBuilderDateTimeProps): React.JSX.Element => {\n const config = useMemo(\n (): RelativeDateTimeEditorConfig => ({\n modeController,\n anchors,\n units,\n toggleLabels,\n dateTimeAPI,\n }),\n [modeController, anchors, units, toggleLabels, dateTimeAPI]\n );\n\n // Capture the value editor inherited from any outer compat provider (e.g. QueryBuilderMaterial)\n // _before_ QueryBuilderDateTimeContext overrides it, so date/time editors can delegate to it.\n const inheritedValueEditor = (useContext(QueryBuilderContext).controlElements?.valueEditor ??\n null) as React.ComponentType<ValueEditorProps> | null;\n\n return (\n <RelativeDateTimeConfigContext.Provider value={config}>\n <InheritedValueEditorContext.Provider value={inheritedValueEditor}>\n <QueryBuilderDateTimeContext>{children}</QueryBuilderDateTimeContext>\n </InheritedValueEditorContext.Provider>\n </RelativeDateTimeConfigContext.Provider>\n );\n};\n"],"mappings":"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"}
1
+ {"version":3,"file":"react-querybuilder_datetime.production.mjs","names":[],"sources":["../src/datetimeRuleProcessorJsonLogic.ts"],"sourcesContent":["import type { DefaultOperatorName, JsonLogicVar, RuleProcessor } from '@react-querybuilder/core';\nimport { defaultRuleProcessorJsonLogic, toArray } from '@react-querybuilder/core';\nimport type { RQBDateTimeJsonLogic } from './types';\nimport {\n isDateOnlyDatatype,\n isRelativeDateTimeValue,\n processIsDateField,\n resolveDatetimeOperator,\n} from './utils';\n\nconst dateOperationMap = {\n '!=': 'dateNotOn',\n '<': 'dateBefore',\n '<=': 'dateOnOrBefore',\n '=': 'dateOn',\n '>': 'dateAfter',\n '>=': 'dateOnOrAfter',\n between: 'dateBetween',\n in: 'dateIn',\n notBetween: 'dateNotBetween',\n notIn: 'dateNotIn',\n} as const satisfies Partial<Record<DefaultOperatorName, string>>;\n\n/**\n * Date/time rule processor for use by {@link @react-querybuilder/core!formatQuery formatQuery}\n * with the \"jsonlogic\" format.\n *\n * Note: Unlike other date/time rule processors from this library, this function does\n * not require a date/time library API. Instead, the date/time library API is used by\n * {@link getDatetimeJsonLogicOperations} during the evaluation process.\n */\nexport const datetimeRuleProcessorJsonLogic: RuleProcessor = (\n rule,\n options\n): RQBDateTimeJsonLogic => {\n const opts = options ?? /* v8 ignore start -- @preserve */ {}; /* v8 ignore stop -- @preserve */\n\n if (!processIsDateField(opts.context?.isDateField, rule, opts)) {\n return defaultRuleProcessorJsonLogic(rule, opts);\n }\n\n // Parameter references are named placeholders (not dates); delegate to the core default,\n // which emits the name as a literal (paradigm B).\n if (rule.valueSource === 'parameter') {\n return defaultRuleProcessorJsonLogic(rule, opts);\n }\n\n const { field, value, valueSource } = rule;\n const operator = resolveDatetimeOperator(rule, opts);\n const valueIsField = valueSource === 'field';\n const fieldObject: JsonLogicVar = { var: field };\n const dateOnly = isDateOnlyDatatype(opts?.fieldData?.datatype);\n // Relative values stay \"live\": emit a `dateRelative` op resolved at evaluation time.\n // Field-source values are field names and render as `var` references.\n const renderValue = (v: unknown) => {\n if (valueIsField) return { var: `${v}` };\n if (isRelativeDateTimeValue(v)) {\n return {\n dateRelative: [v.anchor, v.offset, v.unit, dateOnly],\n };\n }\n return v as string;\n };\n\n switch (operator) {\n case '<':\n case '<=':\n case '=':\n case '!=':\n case '>':\n case '>=':\n return {\n [dateOperationMap[operator]]: [fieldObject, renderValue(value)],\n } as RQBDateTimeJsonLogic;\n\n case 'in':\n case 'notIn': {\n const valueAsArray = (Array.isArray(value) ? value : toArray(value)).map(renderValue);\n return { [dateOperationMap[operator]]: [fieldObject, valueAsArray] } as RQBDateTimeJsonLogic;\n }\n\n case 'between':\n case 'notBetween': {\n const valueAsArray = (Array.isArray(value) ? value : toArray(value)).map(renderValue);\n\n if (valueAsArray.length < 2) return false;\n\n return {\n [dateOperationMap[operator]]: [valueAsArray[0], fieldObject, valueAsArray[1]],\n } as RQBDateTimeJsonLogic;\n }\n }\n\n return defaultRuleProcessorJsonLogic(rule, options);\n};\n"],"mappings":"wXAUA,MAAM,EAAmB,CACvB,KAAM,YACN,IAAK,aACL,KAAM,iBACN,IAAK,SACL,IAAK,YACL,KAAM,gBACN,QAAS,cACT,GAAI,SACJ,WAAY,iBACZ,MAAO,WACT,EAUa,GACX,EACA,IACyB,CACzB,IAAM,EAAO,GAA8C,CAAC,EAQ5D,GANI,CAAC,EAAmB,EAAK,SAAS,YAAa,EAAM,CAAI,GAMzD,EAAK,cAAgB,YACvB,OAAO,EAA8B,EAAM,CAAI,EAGjD,GAAM,CAAE,QAAO,QAAO,eAAgB,EAChC,EAAW,EAAwB,EAAM,CAAI,EAC7C,EAAe,IAAgB,QAC/B,EAA4B,CAAE,IAAK,CAAM,EACzC,EAAW,EAAmB,GAAM,WAAW,QAAQ,EAGvD,EAAe,GACf,EAAqB,CAAE,IAAK,GAAG,GAAI,EACnC,EAAwB,CAAC,EACpB,CACL,aAAc,CAAC,EAAE,OAAQ,EAAE,OAAQ,EAAE,KAAM,CAAQ,CACrD,EAEK,EAGT,OAAQ,EAAR,CACE,IAAK,IACL,IAAK,KACL,IAAK,IACL,IAAK,KACL,IAAK,IACL,IAAK,KACH,MAAO,EACJ,EAAiB,IAAY,CAAC,EAAa,EAAY,CAAK,CAAC,CAChE,EAEF,IAAK,KACL,IAAK,QAAS,CACZ,IAAM,GAAgB,MAAM,QAAQ,CAAK,EAAI,EAAQ,EAAQ,CAAK,EAAA,CAAG,IAAI,CAAW,EACpF,MAAO,EAAG,EAAiB,IAAY,CAAC,EAAa,CAAY,CAAE,CACrE,CAEA,IAAK,UACL,IAAK,aAAc,CACjB,IAAM,GAAgB,MAAM,QAAQ,CAAK,EAAI,EAAQ,EAAQ,CAAK,EAAA,CAAG,IAAI,CAAW,EAIpF,OAFI,EAAa,OAAS,EAAU,GAE7B,EACJ,EAAiB,IAAY,CAAC,EAAa,GAAI,EAAa,EAAa,EAAE,CAC9E,CACF,CACF,CAEA,OAAO,EAA8B,EAAM,CAAO,CACpD"}
@@ -0,0 +1,214 @@
1
+ import { _ as RelativeDateTimeAnchor, b as RelativeDateTimeValue, i as RQBDateTimeLibraryAPI, y as RelativeDateTimeUnit } from "./types-BKA1aoY6.mjs";
2
+ import { FullOption } from "@react-querybuilder/core";
3
+ import * as React from "react";
4
+ import { ComponentType, ReactNode } from "react";
5
+ import { FullOperator, FullOption as FullOption$1, QueryBuilderContextProvider, ValueEditorProps } from "react-querybuilder";
6
+ //#region src/ui/types.d.ts
7
+ /**
8
+ * Customizable content/labels for the absolute/relative mode toggle rendered by
9
+ * {@link toggleModeController}. The default glyphs come from CSS pseudo-elements, so
10
+ * `absoluteContent`/`relativeContent` are only needed to override them (e.g. to render
11
+ * an icon component or localized text).
12
+ */
13
+ interface RelativeDateTimeToggleLabels {
14
+ /** Accessible label (`aria-label`) for the toggle button. */
15
+ label?: string;
16
+ /** Tooltip shown while in absolute mode (clicking switches to relative). */
17
+ absoluteTitle?: string;
18
+ /** Tooltip shown while in relative mode (clicking switches to absolute). */
19
+ relativeTitle?: string;
20
+ /** Custom content rendered while in absolute mode. Defaults to a CSS glyph. */
21
+ absoluteContent?: ReactNode;
22
+ /** Custom content rendered while in relative mode. Defaults to a CSS glyph. */
23
+ relativeContent?: ReactNode;
24
+ }
25
+ /**
26
+ * Props passed to a {@link RelativeDateTimeModeController}'s `ModeControl` component —
27
+ * the affordance (e.g. a toggle button) that switches a rule between absolute and
28
+ * relative date/time entry.
29
+ */
30
+ interface RelativeDateTimeModeControlProps {
31
+ /** Whether the rule is currently in relative mode. */
32
+ isRelative: boolean;
33
+ /** Switches the rule between absolute and relative mode. */
34
+ setMode: (mode: "absolute" | "relative") => void;
35
+ /** The value editor's schema (for theme-aware rendering). */
36
+ schema: ValueEditorProps["schema"];
37
+ /** Whether the control is disabled. */
38
+ disabled?: boolean;
39
+ /** Class name applied to the control. */
40
+ className?: string;
41
+ /** Title/tooltip from the value editor (fallback when labels omit titles). */
42
+ title?: string;
43
+ /** Test ID from the value editor. */
44
+ testID?: string;
45
+ /** Resolved toggle labels (merged with defaults). */
46
+ labels: Required<RelativeDateTimeToggleLabels>;
47
+ }
48
+ /**
49
+ * A pluggable strategy that governs how a user switches between absolute and relative
50
+ * date/time entry in the {@link RelativeDateTimeValueEditor}. The stored value shape is
51
+ * unaffected — a controller only decides the current mode and (optionally) renders an
52
+ * affordance to change it.
53
+ *
54
+ * Ships with {@link toggleModeController} (the zero-config default); build an
55
+ * operator-driven controller with {@link createOperatorModeController}, or supply a custom
56
+ * object to fully control the UX.
57
+ */
58
+ interface RelativeDateTimeModeController {
59
+ /** Derives the current mode from the rule (its operator and/or value). */
60
+ isRelative: (props: ValueEditorProps) => boolean;
61
+ /**
62
+ * Optional affordance rendered inside the editor to switch modes. Omit it (as the
63
+ * operator-driven controller does) when the mode is selected elsewhere, e.g. via the
64
+ * operator selector.
65
+ */
66
+ ModeControl?: ComponentType<RelativeDateTimeModeControlProps>;
67
+ }
68
+ /**
69
+ * Configuration for the {@link RelativeDateTimeValueEditor}, supplied as props to
70
+ * {@link QueryBuilderDateTime} (or via the relative date/time config context). Every
71
+ * field is optional; omitting all of them yields the zero-config toggle experience.
72
+ */
73
+ interface RelativeDateTimeEditorConfig {
74
+ /** Strategy for switching between absolute and relative modes. Defaults to {@link toggleModeController}. */
75
+ modeController?: RelativeDateTimeModeController;
76
+ /** Anchor (reference-point) options. Defaults to {@link defaultRelativeDateTimeAnchors}. */
77
+ anchors?: FullOption$1<RelativeDateTimeAnchor>[];
78
+ /** Unit options. Defaults to {@link defaultRelativeDateTimeUnits}. */
79
+ units?: FullOption$1<RelativeDateTimeUnit>[];
80
+ /** Content/labels for the absolute/relative toggle. */
81
+ toggleLabels?: RelativeDateTimeToggleLabels;
82
+ /**
83
+ * Date/time library adapter used by the value editor to parse/validate the rule value
84
+ * for the native date input. Defaults to the plain JavaScript adapter. Pass the adapter
85
+ * matching your chosen entry point (e.g. from `@react-querybuilder/datetime/luxon`) so the
86
+ * editor interprets values consistently with the rule processors.
87
+ */
88
+ dateTimeAPI?: RQBDateTimeLibraryAPI;
89
+ }
90
+ /**
91
+ * Maps operator names that are used only to _signal_ relative mode (see
92
+ * {@link createOperatorModeController}) to the real comparison operator that should be used
93
+ * when exporting via `formatQuery`. Supplied through `context.relativeOperatorMap`. Operators
94
+ * not present in the map are exported unchanged.
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * formatQuery(query, {
99
+ * format: 'sql',
100
+ * ruleProcessor: datetimeRuleProcessorSQL,
101
+ * context: { relativeOperatorMap: { relativeEq: '=' } },
102
+ * });
103
+ * ```
104
+ */
105
+ type RelativeOperatorMap = Record<string, string>;
106
+ //#endregion
107
+ //#region src/ui/QueryBuilderDateTime.d.ts
108
+ declare const DateTimeValueEditor: (props: ValueEditorProps) => React.JSX.Element;
109
+ declare const QueryBuilderDateTimeContext: QueryBuilderContextProvider;
110
+ /** Props for {@link QueryBuilderDateTime}: {@link RelativeDateTimeEditorConfig} plus children. */
111
+ interface QueryBuilderDateTimeProps extends RelativeDateTimeEditorConfig {
112
+ children?: React.ReactNode;
113
+ }
114
+ /**
115
+ * Context provider enabling date/time features for a wrapped
116
+ * {@link react-querybuilder!QueryBuilder QueryBuilder}: renders the relative-capable
117
+ * {@link RelativeDateTimeValueEditor} for date/time fields, and accepts optional
118
+ * {@link RelativeDateTimeEditorConfig} props (mode controller, anchor/unit options, and
119
+ * toggle labels). With no props it provides the zero-config toggle experience.
120
+ *
121
+ * @group Components
122
+ */
123
+ declare const QueryBuilderDateTime: ({ children, modeController, anchors, units, toggleLabels, dateTimeAPI }: QueryBuilderDateTimeProps) => React.JSX.Element;
124
+ //#endregion
125
+ //#region src/ui/RelativeDateTimeConfigContext.d.ts
126
+ /** Fully-resolved relative date/time editor config (no optional fields). */
127
+ interface ResolvedRelativeDateTimeConfig {
128
+ modeController: RelativeDateTimeModeController;
129
+ anchors: FullOption$1<RelativeDateTimeAnchor>[];
130
+ units: FullOption$1<RelativeDateTimeUnit>[];
131
+ toggleLabels: Required<RelativeDateTimeToggleLabels>;
132
+ dateTimeAPI: RQBDateTimeLibraryAPI;
133
+ }
134
+ /**
135
+ * Carries {@link RelativeDateTimeEditorConfig} to the {@link RelativeDateTimeValueEditor}.
136
+ * Provided by {@link QueryBuilderDateTime}; defaults apply when no provider is present.
137
+ */
138
+ declare const RelativeDateTimeConfigContext: React.Context<RelativeDateTimeEditorConfig>;
139
+ /** Reads the relative date/time editor config from context, merged with defaults. */
140
+ declare const useRelativeDateTimeConfig: () => ResolvedRelativeDateTimeConfig;
141
+ //#endregion
142
+ //#region src/ui/RelativeDateTimeValueEditor.d.ts
143
+ /**
144
+ * Value editor with support for {@link RelativeDateTimeValue relative date/time values}
145
+ * (e.g. "three months ago" or "the beginning of this year"). How the user switches
146
+ * between absolute and relative modes is delegated to a pluggable
147
+ * {@link RelativeDateTimeModeController} (default: a compact toggle), supplied via
148
+ * {@link QueryBuilderDateTime}. In relative mode it renders anchor + signed offset + unit
149
+ * selectors; the unit selector is hidden when the offset is `0`.
150
+ *
151
+ * For the `between`/`notBetween` operators it renders two independent value editors (each
152
+ * with its own mode affordance) and stores the bounds as a two-element array, so the from
153
+ * and to bounds can independently be absolute or relative.
154
+ *
155
+ * @group Components
156
+ */
157
+ declare const RelativeDateTimeValueEditor: (props: ValueEditorProps) => React.JSX.Element;
158
+ //#endregion
159
+ //#region src/ui/relativeDateTimeConstants.d.ts
160
+ /**
161
+ * Class name applied to the absolute/relative mode toggle button. Package-local (not part
162
+ * of the core `standardClassnames`) to avoid coupling core to this extension.
163
+ */
164
+ declare const relativeDateTimeToggleClassName = "rule-value-dateTimeRelative-toggle";
165
+ /** Default value applied when switching a rule to relative mode. */
166
+ declare const defaultRelativeDateTimeValue: RelativeDateTimeValue;
167
+ /** Default anchor (reference-point) options for the relative date/time editor. */
168
+ declare const defaultRelativeDateTimeAnchors: FullOption<RelativeDateTimeAnchor>[];
169
+ /** Default unit options for the relative date/time editor. */
170
+ declare const defaultRelativeDateTimeUnits: FullOption<RelativeDateTimeUnit>[];
171
+ /** Default labels/content for the absolute/relative mode toggle. */
172
+ declare const defaultRelativeDateTimeToggleLabels: Required<RelativeDateTimeToggleLabels>;
173
+ //#endregion
174
+ //#region src/ui/relativeDateTimeModeControllers.d.ts
175
+ /**
176
+ * Compact absolute/relative toggle rendered by {@link toggleModeController}. A
177
+ * `role="switch"` button whose default glyph is supplied by CSS (keyed on
178
+ * `aria-checked`); override via the `toggleLabels` config.
179
+ *
180
+ * @group Components
181
+ */
182
+ declare const RelativeDateTimeModeToggle: ({ isRelative, setMode, disabled, className, labels }: RelativeDateTimeModeControlProps) => React.JSX.Element;
183
+ /**
184
+ * Zero-config default {@link RelativeDateTimeModeController}: derives the mode from the
185
+ * value shape and renders a compact toggle button to switch between absolute and
186
+ * relative entry.
187
+ */
188
+ declare const toggleModeController: RelativeDateTimeModeController;
189
+ /**
190
+ * Builds an operator-driven {@link RelativeDateTimeModeController} that derives the mode
191
+ * from the rule's operator. Pass the operator name(s) (or a predicate) that should put the
192
+ * editor in relative mode. No toggle is rendered — the operator selector is the mode
193
+ * affordance.
194
+ *
195
+ * NOTE: the chosen operators only signal _mode_; the rule's value remains a
196
+ * {@link RelativeDateTimeValue}. For these operators to export correctly, map each one to a
197
+ * real comparison operator via `context.relativeOperatorMap` when calling `formatQuery`
198
+ * (e.g. `{ relativeEq: '=' }`). See the documentation.
199
+ */
200
+ declare const createOperatorModeController: (relativeOperators: string[] | ((operator: string) => boolean)) => RelativeDateTimeModeController;
201
+ interface FieldWithOperators {
202
+ operators?: FullOperator[];
203
+ [key: string]: unknown;
204
+ }
205
+ /**
206
+ * Appends the given `operators` to each field's `operators` list, so the operator-driven
207
+ * controller (see {@link createOperatorModeController}) has an operator to switch into
208
+ * relative mode. Fields without an explicit `operators` list fall back to the core
209
+ * `defaultOperators`.
210
+ */
211
+ declare const withRelativeOperators: <F extends FieldWithOperators>(fields: F[], operators: FullOperator[]) => F[];
212
+ //#endregion
213
+ export { DateTimeValueEditor, QueryBuilderDateTime, QueryBuilderDateTimeContext, QueryBuilderDateTimeProps, RelativeDateTimeConfigContext, RelativeDateTimeEditorConfig, RelativeDateTimeModeControlProps, RelativeDateTimeModeController, RelativeDateTimeModeToggle, RelativeDateTimeToggleLabels, RelativeDateTimeValueEditor, RelativeOperatorMap, ResolvedRelativeDateTimeConfig, createOperatorModeController, defaultRelativeDateTimeAnchors, defaultRelativeDateTimeToggleLabels, defaultRelativeDateTimeUnits, defaultRelativeDateTimeValue, relativeDateTimeToggleClassName, toggleModeController, useRelativeDateTimeConfig, withRelativeOperators };
214
+ //# sourceMappingURL=react-querybuilder_datetime.production.ui.d.mts.map
@@ -0,0 +1,2 @@
1
+ import{i as e,r as t}from"./utils-DA8aluCt.mjs";import{t as n}from"./rqbDateTimeLibraryAPI.jsdate-DxBmxW2C.mjs";import*as r from"react";import{createContext as i,useCallback as a,useContext as o,useMemo as s}from"react";import{QueryBuilderContext as c,ValueEditor as l,clsx as u,defaultOperators as d,getCompatContextProvider as f,parseNumber as p,standardClassnames as m,toArray as h,useValueEditor as g}from"react-querybuilder";const _=i(null),v=()=>o(_),y=`rule-value-dateTimeRelative-toggle`,b={mode:`relative`,anchor:`now`,offset:0,unit:`day`},x=[{name:`now`,value:`now`,label:`now`},{name:`startOfDay`,value:`startOfDay`,label:`start of day`},{name:`endOfDay`,value:`endOfDay`,label:`end of day`},{name:`startOfWeek`,value:`startOfWeek`,label:`start of week`},{name:`endOfWeek`,value:`endOfWeek`,label:`end of week`},{name:`startOfMonth`,value:`startOfMonth`,label:`start of month`},{name:`endOfMonth`,value:`endOfMonth`,label:`end of month`},{name:`startOfYear`,value:`startOfYear`,label:`start of year`},{name:`endOfYear`,value:`endOfYear`,label:`end of year`}],S=[{name:`minute`,value:`minute`,label:`minute(s)`},{name:`hour`,value:`hour`,label:`hour(s)`},{name:`day`,value:`day`,label:`day(s)`},{name:`week`,value:`week`,label:`week(s)`},{name:`month`,value:`month`,label:`month(s)`},{name:`year`,value:`year`,label:`year(s)`}],C={label:`Toggle relative date/time`,absoluteTitle:`Absolute date/time (click for relative)`,relativeTitle:`Relative date/time (click for absolute)`,absoluteContent:``,relativeContent:``},w=({isRelative:e,setMode:t,disabled:n,className:i,labels:a})=>{let o=r.useCallback(()=>t(e?`absolute`:`relative`),[t,e]);return r.createElement(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":a.label,title:e?a.relativeTitle:a.absoluteTitle,disabled:n,className:u(y,i),onClick:o},e?a.relativeContent:a.absoluteContent)},T={isRelative:t=>e(t.value),ModeControl:w},E=e=>({isRelative:t=>typeof e==`function`?e(t.operator):e.includes(t.operator)}),D=(e,t)=>e.map(e=>({...e,operators:[...e.operators??d,...t]})),O=i({}),k=()=>{let e=o(O);return s(()=>({modeController:e.modeController??T,anchors:e.anchors??x,units:e.units??S,toggleLabels:{...C,...e.toggleLabels},dateTimeAPI:e.dateTimeAPI??n}),[e])},A=[],j={name:``,value:``,label:``},M=t=>Array.isArray(t)?t:e(t)?[t]:h(t),N=({baseProps:t,value:n,onChange:i,absoluteOperator:o,config:s,SelectorComponent:c,NumericEditorComponent:l,valueListItemClassName:u,numericSchema:d})=>{let{schema:f,disabled:h,title:g,testID:_}=t,{modeController:v,anchors:y,units:x,toggleLabels:S}=s,C=v.isRelative({...t,value:n}),w=e(n)?n:b,T=a(e=>i(e===`relative`?b:``),[i]),E=a(e=>i({...w,anchor:e}),[i,w]),D=a(e=>i({...w,offset:p(e,{parseNumbers:!0})||0}),[i,w]),O=a(e=>i({...w,unit:e}),[i,w]),{ModeControl:k}=v;return r.createElement(r.Fragment,null,k&&r.createElement(k,{isRelative:C,setMode:T,schema:f,disabled:h,className:u,title:g,testID:_,labels:S}),C?r.createElement(r.Fragment,null,r.createElement(c,{schema:f,testID:_,title:g,className:u,handleOnChange:E,disabled:h,value:w.anchor,options:y,multiple:!1,listsAsArrays:!1,path:A,level:0}),r.createElement(l,{skipHook:!0,testID:_,inputType:`number`,title:g,className:u,disabled:h,handleOnChange:D,field:``,operator:``,value:w.offset,valueSource:`value`,fieldData:j,schema:d,path:A,level:0,rule:{field:``,operator:`=`,value:w.offset}}),w.offset!==0&&r.createElement(c,{schema:f,testID:_,title:g,className:u,handleOnChange:O,disabled:h,value:w.unit,options:x,multiple:!1,listsAsArrays:!1,path:A,level:0})):r.createElement(z,{...t,operator:o,value:n,handleOnChange:i,className:m.value}))},P=e=>{let{valueListItemClassName:t}=g(e),{className:n,value:i,handleOnChange:o,schema:c,operator:d,separator:f}=e,{suppressStandardClassnames:p}=c,h=e.selectorComponent??c.controls.valueSelector,_=v()??l,y=k(),b=s(()=>({...c,parseNumbers:!0}),[c]),x=s(()=>u(p||m.valueDateTimeRelative,n),[p,n]),S=d===`between`||d===`notBetween`,C=s(()=>M(i),[i]),w=a(e=>t=>{let n=[C[0],C[1]];n[e]=t,o(n)},[C,o]);return S?r.createElement(`span`,{className:x},r.createElement(N,{baseProps:e,value:C[0],onChange:w(0),absoluteOperator:`=`,config:y,SelectorComponent:h,NumericEditorComponent:_,valueListItemClassName:t,numericSchema:b}),f,r.createElement(N,{baseProps:e,value:C[1],onChange:w(1),absoluteOperator:`=`,config:y,SelectorComponent:h,NumericEditorComponent:_,valueListItemClassName:t,numericSchema:b})):r.createElement(`span`,{className:x},r.createElement(N,{baseProps:e,value:i,onChange:o,absoluteOperator:d,config:y,SelectorComponent:h,NumericEditorComponent:_,valueListItemClassName:t,numericSchema:b}))},F=(e,n)=>!t(e.valueSource)&&(e.type===`text`&&(n===`date`||n===`datetime-local`)||/^(?:date|datetime|timestamp)\b/i.test(e.fieldData?.datatype)),I=e=>`${e}`.padStart(2,`0`),L=(e,t)=>{let n=`${e.getFullYear()}-${I(e.getMonth()+1)}-${I(e.getDate())}`;return t?`${n}T${I(e.getHours())}:${I(e.getMinutes())}`:n},R=({editor:e,...t})=>e?r.createElement(e,t):r.createElement(l,{...t,skipHook:!0}),z=e=>{let t=g(e),n=v(),{dateTimeAPI:i}=k(),a=e=>r.createElement(R,{editor:n,...e});if(!F(e,t.inputTypeCoerced))return a(e);if(i.isValid(e.value)){let n=L(i.toDate(e.value),t.inputTypeCoerced!==`date`);return a({...e,value:n})}return a(e)},B=f({controlElements:{valueEditor:e=>{let t=g(e),n=v();return F(e,t.inputTypeCoerced)?r.createElement(P,e):r.createElement(R,{editor:n,...e})}}}),V=({children:e,modeController:t,anchors:n,units:i,toggleLabels:a,dateTimeAPI:l})=>{let u=s(()=>({modeController:t,anchors:n,units:i,toggleLabels:a,dateTimeAPI:l}),[t,n,i,a,l]),d=o(c).controlElements?.valueEditor??null;return r.createElement(O.Provider,{value:u},r.createElement(_.Provider,{value:d},r.createElement(B,null,e)))};export{z as DateTimeValueEditor,V as QueryBuilderDateTime,B as QueryBuilderDateTimeContext,O as RelativeDateTimeConfigContext,w as RelativeDateTimeModeToggle,P as RelativeDateTimeValueEditor,E as createOperatorModeController,x as defaultRelativeDateTimeAnchors,C as defaultRelativeDateTimeToggleLabels,S as defaultRelativeDateTimeUnits,b as defaultRelativeDateTimeValue,y as relativeDateTimeToggleClassName,T as toggleModeController,k as useRelativeDateTimeConfig,D as withRelativeOperators};
2
+ //# sourceMappingURL=react-querybuilder_datetime.production.ui.mjs.map