@react-querybuilder/datetime 8.20.1-alpha.0 → 8.20.2

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 (147) hide show
  1. package/README.md +9 -3
  2. package/dist/cjs/getDatetimeRuleProcessorTanStackDB-BVNfYaIj.js +2 -0
  3. package/dist/cjs/getDatetimeRuleProcessorTanStackDB-BVNfYaIj.js.map +1 -0
  4. package/dist/cjs/{getDatetimeRuleProcessorTanStackDB-CL79A1_x.js → getDatetimeRuleProcessorTanStackDB-cmGqMT0Q.js} +83 -216
  5. package/dist/cjs/getDatetimeRuleProcessorTanStackDB-cmGqMT0Q.js.map +1 -0
  6. package/dist/cjs/react-querybuilder_datetime.cjs.development.d.ts +3 -123
  7. package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.d.ts +2 -2
  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 +2 -2
  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 +10 -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 +2 -2
  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 +2 -2
  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 +228 -0
  22. package/dist/cjs/react-querybuilder_datetime.cjs.development.ui.js +464 -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 +3 -123
  25. package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.d.ts +2 -2
  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 +2 -2
  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 +2 -2
  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 +2 -2
  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 +228 -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-BPEcMhhr.js +128 -0
  45. package/dist/cjs/rqbDateTimeLibraryAPI.jsdate-BPEcMhhr.js.map +1 -0
  46. package/dist/cjs/rqbDateTimeLibraryAPI.jsdate-ioz2B1zh.js +2 -0
  47. package/dist/cjs/rqbDateTimeLibraryAPI.jsdate-ioz2B1zh.js.map +1 -0
  48. package/dist/cjs/{types-XYMw0jFT.d.ts → types-Di8kFIXV.d.ts} +3 -103
  49. package/dist/cjs/ui.d.ts +1 -0
  50. package/dist/cjs/ui.js +6 -0
  51. package/dist/cjs/utils-DUePrC--.js +154 -0
  52. package/dist/cjs/utils-DUePrC--.js.map +1 -0
  53. package/dist/cjs/utils-jkW5R1AA.js +2 -0
  54. package/dist/cjs/utils-jkW5R1AA.js.map +1 -0
  55. package/dist/{getDatetimeRuleProcessorTanStackDB-BcOC-o2A.mjs → getDatetimeRuleProcessorTanStackDB-B93XaPdB.mjs} +4 -107
  56. package/dist/getDatetimeRuleProcessorTanStackDB-B93XaPdB.mjs.map +1 -0
  57. package/dist/{getDatetimeRuleProcessorTanStackDB-BL8mbdbl.js → getDatetimeRuleProcessorTanStackDB-BDFJlfJh.js} +4 -181
  58. package/dist/getDatetimeRuleProcessorTanStackDB-BDFJlfJh.js.map +1 -0
  59. package/dist/getDatetimeRuleProcessorTanStackDB-Czg9Fbb8.mjs +2 -0
  60. package/dist/getDatetimeRuleProcessorTanStackDB-Czg9Fbb8.mjs.map +1 -0
  61. package/dist/objectSpread2-73AKOozq.js +181 -0
  62. package/dist/objectSpread2-73AKOozq.js.map +1 -0
  63. package/dist/react-querybuilder_datetime.d.mts +3 -123
  64. package/dist/react-querybuilder_datetime.date-fns.d.mts +2 -2
  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 +2 -2
  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 +2 -2
  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 +3 -123
  74. package/dist/react-querybuilder_datetime.legacy-esm.date-fns.d.ts +2 -2
  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 +2 -2
  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 +4 -449
  81. package/dist/react-querybuilder_datetime.legacy-esm.js.map +1 -1
  82. package/dist/react-querybuilder_datetime.legacy-esm.jsdate.d.ts +2 -2
  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 +2 -2
  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 +228 -0
  89. package/dist/react-querybuilder_datetime.legacy-esm.ui.js +451 -0
  90. package/dist/react-querybuilder_datetime.legacy-esm.ui.js.map +1 -0
  91. package/dist/react-querybuilder_datetime.luxon.d.mts +2 -2
  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 +4 -446
  95. package/dist/react-querybuilder_datetime.mjs.map +1 -1
  96. package/dist/react-querybuilder_datetime.production.d.mts +3 -123
  97. package/dist/react-querybuilder_datetime.production.date-fns.d.mts +2 -2
  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 +2 -2
  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 +2 -2
  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 +2 -2
  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 +228 -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 +228 -0
  115. package/dist/react-querybuilder_datetime.ui.mjs +448 -0
  116. package/dist/react-querybuilder_datetime.ui.mjs.map +1 -0
  117. package/dist/rqbDateTimeLibraryAPI.jsdate-CDOtydFq.mjs +2 -0
  118. package/dist/rqbDateTimeLibraryAPI.jsdate-CDOtydFq.mjs.map +1 -0
  119. package/dist/rqbDateTimeLibraryAPI.jsdate-CpGoQAje.js +123 -0
  120. package/dist/rqbDateTimeLibraryAPI.jsdate-CpGoQAje.js.map +1 -0
  121. package/dist/rqbDateTimeLibraryAPI.jsdate-D66yJ1hK.mjs +123 -0
  122. package/dist/rqbDateTimeLibraryAPI.jsdate-D66yJ1hK.mjs.map +1 -0
  123. package/dist/{types-CdjHqQ0k.d.ts → types-Di8kFIXV.d.mts} +3 -103
  124. package/dist/{types-CdjHqQ0k.d.mts → types-Di8kFIXV.d.ts} +3 -103
  125. package/dist/utils-BC2SALFm.mjs +107 -0
  126. package/dist/utils-BC2SALFm.mjs.map +1 -0
  127. package/dist/utils-VKS8YY2D.mjs +2 -0
  128. package/dist/utils-VKS8YY2D.mjs.map +1 -0
  129. package/package.json +27 -8
  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/getDatetimeRuleProcessorTanStackDB-BL8mbdbl.js.map +0 -1
  139. package/dist/getDatetimeRuleProcessorTanStackDB-BcOC-o2A.mjs.map +0 -1
  140. package/dist/getDatetimeRuleProcessorTanStackDB-Dloxv6k2.mjs +0 -2
  141. package/dist/getDatetimeRuleProcessorTanStackDB-Dloxv6k2.mjs.map +0 -1
  142. package/dist/rqbDateTimeLibraryAPI.dayjs-BW7faYFD.mjs +0 -29
  143. package/dist/rqbDateTimeLibraryAPI.dayjs-BW7faYFD.mjs.map +0 -1
  144. package/dist/rqbDateTimeLibraryAPI.dayjs-BoX90aqZ.mjs +0 -2
  145. package/dist/rqbDateTimeLibraryAPI.dayjs-BoX90aqZ.mjs.map +0 -1
  146. package/dist/rqbDateTimeLibraryAPI.dayjs-Da4VXvFM.js +0 -29
  147. package/dist/rqbDateTimeLibraryAPI.dayjs-Da4VXvFM.js.map +0 -1
@@ -1,5 +1,30 @@
1
- import { E as getDatetimeJsonLogicOperations, S as getDatetimeRuleProcessorDrizzle, T as getDatetimeRuleProcessorCEL, _ as getDatetimeRuleProcessorMongoDBQuery, a as getDatetimeValueProcessorMySQL, b as getDatetimeRuleProcessorGremlin, c as getDatetimeRuleProcessorSpEL, d as getDatetimeRuleProcessorPrisma, f as getDatetimeRuleProcessorParameterized, g as getDatetimeRuleProcessorMongoDB, h as getDatetimeRuleProcessorNL, i as getDatetimeValueProcessorMSSQL, l as getDatetimeRuleProcessorSPARQL, n as getDatetimeRuleProcessorSQL, o as getDatetimeValueProcessorOracle, r as getDatetimeValueProcessorANSI, s as getDatetimeValueProcessorPostgreSQL, t as getDatetimeRuleProcessorTanStackDB, u as getDatetimeRuleProcessorSequelize, v as getDatetimeRuleProcessorLDAP, w as getDatetimeRuleProcessorCypher, x as getDatetimeRuleProcessorElasticSearch, y as getDatetimeRuleProcessorJSONata } from "./getDatetimeRuleProcessorTanStackDB-BL8mbdbl.js";
2
- import { t as rqbDateTimeLibraryAPI } from "./rqbDateTimeLibraryAPI.dayjs-Da4VXvFM.js";
1
+ import { r as isISOStringDateOnly } from "./objectSpread2-73AKOozq.js";
2
+ import { C as getDatetimeRuleProcessorCypher, S as getDatetimeRuleProcessorDrizzle, T as getDatetimeJsonLogicOperations, _ as getDatetimeRuleProcessorMongoDBQuery, a as getDatetimeValueProcessorMySQL, b as getDatetimeRuleProcessorGremlin, c as getDatetimeRuleProcessorSpEL, d as getDatetimeRuleProcessorPrisma, f as getDatetimeRuleProcessorParameterized, g as getDatetimeRuleProcessorMongoDB, h as getDatetimeRuleProcessorNL, i as getDatetimeValueProcessorMSSQL, l as getDatetimeRuleProcessorSPARQL, n as getDatetimeRuleProcessorSQL, o as getDatetimeValueProcessorOracle, r as getDatetimeValueProcessorANSI, s as getDatetimeValueProcessorPostgreSQL, t as getDatetimeRuleProcessorTanStackDB, u as getDatetimeRuleProcessorSequelize, v as getDatetimeRuleProcessorLDAP, w as getDatetimeRuleProcessorCEL, x as getDatetimeRuleProcessorElasticSearch, y as getDatetimeRuleProcessorJSONata } from "./getDatetimeRuleProcessorTanStackDB-BDFJlfJh.js";
3
+ import dayjs from "dayjs";
4
+ //#region src/rqbDateTimeLibraryAPI.dayjs.ts
5
+ /**
6
+ * {@link RQBDateTimeLibraryAPI} for Day.js
7
+ */
8
+ const rqbDateTimeLibraryAPI = {
9
+ format: (d, fmt) => dayjs(d).format(fmt),
10
+ isAfter: (a, b) => dayjs(a).isAfter(b),
11
+ isBefore: (a, b) => dayjs(a).isBefore(b),
12
+ isSame: (a, b) => dayjs(a).isSame(b, isISOStringDateOnly(a) || isISOStringDateOnly(b) ? "d" : "ms"),
13
+ isValid: (d) => dayjs(d).isValid(),
14
+ toDate: (d) => dayjs(d).toDate(),
15
+ toISOString: (d) => {
16
+ const dToDate = dayjs(d);
17
+ return dToDate.isValid() ? dToDate.toISOString() : "";
18
+ },
19
+ toISOStringDateOnly: (d) => {
20
+ const dToDate = dayjs(d);
21
+ return dToDate.isValid() ? dToDate.format("YYYY-MM-DD") : "";
22
+ },
23
+ startOf: (d, unit) => dayjs(d).startOf(unit).toDate(),
24
+ endOf: (d, unit) => dayjs(d).endOf(unit).toDate(),
25
+ add: (d, amount, unit) => dayjs(d).add(amount, unit).toDate()
26
+ };
27
+ //#endregion
3
28
  //#region src/index.dayjs.ts
4
29
  /**
5
30
  * Custom JsonLogic date/time operations using Day.js
@@ -1 +1 @@
1
- {"version":3,"file":"react-querybuilder_datetime.legacy-esm.dayjs.js","names":[],"sources":["../src/index.dayjs.ts"],"sourcesContent":["/**\n * Import from `\"@react-querybuilder/datetime/dayjs\"` for enhanced date/time support using [Day.js](https://day.js.org/).\n *\n * @module dayjs\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.dayjs';\nimport type { RQBJsonLogicDateTimeOperations } from './types';\n\n/**\n * Custom JsonLogic date/time operations using Day.js\n */\nexport const jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations =\n getDatetimeJsonLogicOperations(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sql\" format using Day.js\n */\nexport const datetimeRuleProcessorSQL: RuleProcessor =\n getDatetimeRuleProcessorSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"ansi\" preset) using Day.js\n */\nexport const datetimeValueProcessorANSI: ValueProcessorByRule =\n getDatetimeValueProcessorANSI(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"mssql\" preset) using Day.js\n */\nexport const datetimeValueProcessorMSSQL: ValueProcessorByRule =\n getDatetimeValueProcessorMSSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"mysql\" preset) using Day.js\n */\nexport const datetimeValueProcessorMySQL: ValueProcessorByRule =\n getDatetimeValueProcessorMySQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"oracle\" preset) using Day.js\n */\nexport const datetimeValueProcessorOracle: ValueProcessorByRule =\n getDatetimeValueProcessorOracle(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"postgresql\" preset) using Day.js\n */\nexport const datetimeValueProcessorPostgreSQL: ValueProcessorByRule =\n getDatetimeValueProcessorPostgreSQL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"cel\" format using Day.js\n */\nexport const datetimeRuleProcessorCEL: ValueProcessorByRule =\n getDatetimeRuleProcessorCEL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"jsonata\" format using Day.js\n */\nexport const datetimeRuleProcessorJSONata: RuleProcessor =\n getDatetimeRuleProcessorJSONata(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"mongodb_query\" format using Day.js\n */\nexport const datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule =\n getDatetimeRuleProcessorMongoDBQuery(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"natural_language\" format using Day.js\n */\nexport const datetimeRuleProcessorNL: ValueProcessorByRule =\n getDatetimeRuleProcessorNL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"cypher\"/\"gql\" format using Day.js\n */\nexport const datetimeRuleProcessorCypher: ValueProcessorByRule =\n getDatetimeRuleProcessorCypher(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sparql\" format using Day.js\n */\nexport const datetimeRuleProcessorSPARQL: ValueProcessorByRule =\n getDatetimeRuleProcessorSPARQL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"parameterized\"/\"parameterized_named\" formats using Day.js\n */\nexport const datetimeRuleProcessorParameterized: RuleProcessor =\n getDatetimeRuleProcessorParameterized(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"spel\" format using Day.js\n */\nexport const datetimeRuleProcessorSpEL: RuleProcessor =\n getDatetimeRuleProcessorSpEL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"ldap\" format using Day.js\n */\nexport const datetimeRuleProcessorLDAP: RuleProcessor =\n getDatetimeRuleProcessorLDAP(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"gremlin\" format using Day.js\n */\nexport const datetimeRuleProcessorGremlin: RuleProcessor =\n getDatetimeRuleProcessorGremlin(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"prisma\" format using Day.js\n */\nexport const datetimeRuleProcessorPrisma: RuleProcessor =\n getDatetimeRuleProcessorPrisma(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sequelize\" format using Day.js\n */\nexport const datetimeRuleProcessorSequelize: RuleProcessor =\n getDatetimeRuleProcessorSequelize(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"drizzle\" format using Day.js\n */\nexport const datetimeRuleProcessorDrizzle: RuleProcessor =\n getDatetimeRuleProcessorDrizzle(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"elasticsearch\" format using Day.js\n */\nexport const datetimeRuleProcessorElasticSearch: RuleProcessor =\n getDatetimeRuleProcessorElasticSearch(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"tanstack_db\" format using Day.js\n */\nexport const datetimeRuleProcessorTanStackDB: RuleProcessor =\n getDatetimeRuleProcessorTanStackDB(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for (deprecated) \"mongodb\" format using Day.js\n */\nexport const datetimeRuleProcessorMongoDB: RuleProcessor =\n getDatetimeRuleProcessorMongoDB(rqbDateTimeLibraryAPI);\n\nexport * from './rqbDateTimeLibraryAPI.dayjs';\n"],"mappings":";;;;;;AAsCA,MAAa,8BACX,+BAA+B,qBAAqB;;;;AAKtD,MAAa,2BACX,4BAA4B,qBAAqB;;;;AAInD,MAAa,6BACX,8BAA8B,qBAAqB;;;;AAIrD,MAAa,8BACX,+BAA+B,qBAAqB;;;;AAItD,MAAa,8BACX,+BAA+B,qBAAqB;;;;AAItD,MAAa,+BACX,gCAAgC,qBAAqB;;;;AAIvD,MAAa,mCACX,oCAAoC,qBAAqB;;;;AAK3D,MAAa,2BACX,4BAA4B,qBAAqB;;;;AAKnD,MAAa,+BACX,gCAAgC,qBAAqB;;;;AAKvD,MAAa,oCACX,qCAAqC,qBAAqB;;;;AAK5D,MAAa,0BACX,2BAA2B,qBAAqB;;;;AAKlD,MAAa,8BACX,+BAA+B,qBAAqB;;;;AAKtD,MAAa,8BACX,+BAA+B,qBAAqB;;;;AAKtD,MAAa,qCACX,sCAAsC,qBAAqB;;;;AAK7D,MAAa,4BACX,6BAA6B,qBAAqB;;;;AAKpD,MAAa,4BACX,6BAA6B,qBAAqB;;;;AAKpD,MAAa,+BACX,gCAAgC,qBAAqB;;;;AAKvD,MAAa,8BACX,+BAA+B,qBAAqB;;;;AAKtD,MAAa,iCACX,kCAAkC,qBAAqB;;;;AAKzD,MAAa,+BACX,gCAAgC,qBAAqB;;;;AAKvD,MAAa,qCACX,sCAAsC,qBAAqB;;;;AAK7D,MAAa,kCACX,mCAAmC,qBAAqB;;;;AAK1D,MAAa,+BACX,gCAAgC,qBAAqB"}
1
+ {"version":3,"file":"react-querybuilder_datetime.legacy-esm.dayjs.js","names":[],"sources":["../src/rqbDateTimeLibraryAPI.dayjs.ts","../src/index.dayjs.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { isISOStringDateOnly } from './utils';\n\n/**\n * {@link RQBDateTimeLibraryAPI} for Day.js\n */\nexport const rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI = {\n format: (d, fmt) => dayjs(d).format(fmt),\n isAfter: (a, b) => dayjs(a).isAfter(b),\n isBefore: (a, b) => dayjs(a).isBefore(b),\n isSame: (a, b) =>\n dayjs(a).isSame(b, isISOStringDateOnly(a) || isISOStringDateOnly(b) ? 'd' : 'ms'),\n isValid: d => dayjs(d).isValid(),\n toDate: d => dayjs(d).toDate(),\n toISOString: d => {\n const dToDate = dayjs(d);\n return dToDate.isValid() ? dToDate.toISOString() : '';\n },\n toISOStringDateOnly: d => {\n const dToDate = dayjs(d);\n return dToDate.isValid() ? dToDate.format('YYYY-MM-DD') : '';\n },\n startOf: (d, unit) => dayjs(d).startOf(unit).toDate(),\n endOf: (d, unit) => dayjs(d).endOf(unit).toDate(),\n add: (d, amount, unit) => dayjs(d).add(amount, unit).toDate(),\n};\n","/**\n * Import from `\"@react-querybuilder/datetime/dayjs\"` for enhanced date/time support using [Day.js](https://day.js.org/).\n *\n * @module dayjs\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.dayjs';\nimport type { RQBJsonLogicDateTimeOperations } from './types';\n\n/**\n * Custom JsonLogic date/time operations using Day.js\n */\nexport const jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations =\n getDatetimeJsonLogicOperations(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sql\" format using Day.js\n */\nexport const datetimeRuleProcessorSQL: RuleProcessor =\n getDatetimeRuleProcessorSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"ansi\" preset) using Day.js\n */\nexport const datetimeValueProcessorANSI: ValueProcessorByRule =\n getDatetimeValueProcessorANSI(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"mssql\" preset) using Day.js\n */\nexport const datetimeValueProcessorMSSQL: ValueProcessorByRule =\n getDatetimeValueProcessorMSSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"mysql\" preset) using Day.js\n */\nexport const datetimeValueProcessorMySQL: ValueProcessorByRule =\n getDatetimeValueProcessorMySQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"oracle\" preset) using Day.js\n */\nexport const datetimeValueProcessorOracle: ValueProcessorByRule =\n getDatetimeValueProcessorOracle(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"postgresql\" preset) using Day.js\n */\nexport const datetimeValueProcessorPostgreSQL: ValueProcessorByRule =\n getDatetimeValueProcessorPostgreSQL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"cel\" format using Day.js\n */\nexport const datetimeRuleProcessorCEL: ValueProcessorByRule =\n getDatetimeRuleProcessorCEL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"jsonata\" format using Day.js\n */\nexport const datetimeRuleProcessorJSONata: RuleProcessor =\n getDatetimeRuleProcessorJSONata(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"mongodb_query\" format using Day.js\n */\nexport const datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule =\n getDatetimeRuleProcessorMongoDBQuery(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"natural_language\" format using Day.js\n */\nexport const datetimeRuleProcessorNL: ValueProcessorByRule =\n getDatetimeRuleProcessorNL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"cypher\"/\"gql\" format using Day.js\n */\nexport const datetimeRuleProcessorCypher: ValueProcessorByRule =\n getDatetimeRuleProcessorCypher(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sparql\" format using Day.js\n */\nexport const datetimeRuleProcessorSPARQL: ValueProcessorByRule =\n getDatetimeRuleProcessorSPARQL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"parameterized\"/\"parameterized_named\" formats using Day.js\n */\nexport const datetimeRuleProcessorParameterized: RuleProcessor =\n getDatetimeRuleProcessorParameterized(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"spel\" format using Day.js\n */\nexport const datetimeRuleProcessorSpEL: RuleProcessor =\n getDatetimeRuleProcessorSpEL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"ldap\" format using Day.js\n */\nexport const datetimeRuleProcessorLDAP: RuleProcessor =\n getDatetimeRuleProcessorLDAP(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"gremlin\" format using Day.js\n */\nexport const datetimeRuleProcessorGremlin: RuleProcessor =\n getDatetimeRuleProcessorGremlin(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"prisma\" format using Day.js\n */\nexport const datetimeRuleProcessorPrisma: RuleProcessor =\n getDatetimeRuleProcessorPrisma(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sequelize\" format using Day.js\n */\nexport const datetimeRuleProcessorSequelize: RuleProcessor =\n getDatetimeRuleProcessorSequelize(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"drizzle\" format using Day.js\n */\nexport const datetimeRuleProcessorDrizzle: RuleProcessor =\n getDatetimeRuleProcessorDrizzle(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"elasticsearch\" format using Day.js\n */\nexport const datetimeRuleProcessorElasticSearch: RuleProcessor =\n getDatetimeRuleProcessorElasticSearch(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"tanstack_db\" format using Day.js\n */\nexport const datetimeRuleProcessorTanStackDB: RuleProcessor =\n getDatetimeRuleProcessorTanStackDB(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for (deprecated) \"mongodb\" format using Day.js\n */\nexport const datetimeRuleProcessorMongoDB: RuleProcessor =\n getDatetimeRuleProcessorMongoDB(rqbDateTimeLibraryAPI);\n\nexport * from './rqbDateTimeLibraryAPI.dayjs';\n"],"mappings":";;;;;;;AAOA,MAAa,wBAA+C;CAC1D,SAAS,GAAG,QAAQ,MAAM,CAAC,CAAC,CAAC,OAAO,GAAG;CACvC,UAAU,GAAG,MAAM,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;CACrC,WAAW,GAAG,MAAM,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;CACvC,SAAS,GAAG,MACV,MAAM,CAAC,CAAC,CAAC,OAAO,GAAG,oBAAoB,CAAC,KAAK,oBAAoB,CAAC,IAAI,MAAM,IAAI;CAClF,UAAS,MAAK,MAAM,CAAC,CAAC,CAAC,QAAQ;CAC/B,SAAQ,MAAK,MAAM,CAAC,CAAC,CAAC,OAAO;CAC7B,cAAa,MAAK;EAChB,MAAM,UAAU,MAAM,CAAC;EACvB,OAAO,QAAQ,QAAQ,IAAI,QAAQ,YAAY,IAAI;CACrD;CACA,sBAAqB,MAAK;EACxB,MAAM,UAAU,MAAM,CAAC;EACvB,OAAO,QAAQ,QAAQ,IAAI,QAAQ,OAAO,YAAY,IAAI;CAC5D;CACA,UAAU,GAAG,SAAS,MAAM,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,OAAO;CACpD,QAAQ,GAAG,SAAS,MAAM,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,OAAO;CAChD,MAAM,GAAG,QAAQ,SAAS,MAAM,CAAC,CAAC,CAAC,IAAI,QAAQ,IAAI,CAAC,CAAC,OAAO;AAC9D;;;;;;ACYA,MAAa,8BACX,+BAA+B,qBAAqB;;;;AAKtD,MAAa,2BACX,4BAA4B,qBAAqB;;;;AAInD,MAAa,6BACX,8BAA8B,qBAAqB;;;;AAIrD,MAAa,8BACX,+BAA+B,qBAAqB;;;;AAItD,MAAa,8BACX,+BAA+B,qBAAqB;;;;AAItD,MAAa,+BACX,gCAAgC,qBAAqB;;;;AAIvD,MAAa,mCACX,oCAAoC,qBAAqB;;;;AAK3D,MAAa,2BACX,4BAA4B,qBAAqB;;;;AAKnD,MAAa,+BACX,gCAAgC,qBAAqB;;;;AAKvD,MAAa,oCACX,qCAAqC,qBAAqB;;;;AAK5D,MAAa,0BACX,2BAA2B,qBAAqB;;;;AAKlD,MAAa,8BACX,+BAA+B,qBAAqB;;;;AAKtD,MAAa,8BACX,+BAA+B,qBAAqB;;;;AAKtD,MAAa,qCACX,sCAAsC,qBAAqB;;;;AAK7D,MAAa,4BACX,6BAA6B,qBAAqB;;;;AAKpD,MAAa,4BACX,6BAA6B,qBAAqB;;;;AAKpD,MAAa,+BACX,gCAAgC,qBAAqB;;;;AAKvD,MAAa,8BACX,+BAA+B,qBAAqB;;;;AAKtD,MAAa,iCACX,kCAAkC,qBAAqB;;;;AAKzD,MAAa,+BACX,gCAAgC,qBAAqB;;;;AAKvD,MAAa,qCACX,sCAAsC,qBAAqB;;;;AAK7D,MAAa,kCACX,mCAAmC,qBAAqB;;;;AAK1D,MAAa,+BACX,gCAAgC,qBAAqB"}
@@ -1,8 +1,6 @@
1
- import { A as processIsDateField, C as _objectSpread2, D as isDateOnlyDatatype, E as getDatetimeJsonLogicOperations, S as getDatetimeRuleProcessorDrizzle, T as getDatetimeRuleProcessorCEL, _ as getDatetimeRuleProcessorMongoDBQuery, a as getDatetimeValueProcessorMySQL, b as getDatetimeRuleProcessorGremlin, c as getDatetimeRuleProcessorSpEL, d as getDatetimeRuleProcessorPrisma, f as getDatetimeRuleProcessorParameterized, g as getDatetimeRuleProcessorMongoDB, h as getDatetimeRuleProcessorNL, i as getDatetimeValueProcessorMSSQL, j as resolveDatetimeOperator, k as isRelativeDateTimeValue, l as getDatetimeRuleProcessorSPARQL, m as defaultDateTimeNLOperatorMap, n as getDatetimeRuleProcessorSQL, o as getDatetimeValueProcessorOracle, p as datetimeValueProcessorNL, r as getDatetimeValueProcessorANSI, s as getDatetimeValueProcessorPostgreSQL, t as getDatetimeRuleProcessorTanStackDB, u as getDatetimeRuleProcessorSequelize, v as getDatetimeRuleProcessorLDAP, w as getDatetimeRuleProcessorCypher, x as getDatetimeRuleProcessorElasticSearch, y as getDatetimeRuleProcessorJSONata } from "./getDatetimeRuleProcessorTanStackDB-BL8mbdbl.js";
2
- import { t as rqbDateTimeLibraryAPI } from "./rqbDateTimeLibraryAPI.dayjs-Da4VXvFM.js";
3
- import { QueryBuilderContext, ValueEditor, clsx, defaultOperators, defaultRuleProcessorJsonLogic, getCompatContextProvider, parseNumber, standardClassnames, toArray, useValueEditor } from "react-querybuilder";
4
- import * as React from "react";
5
- import { createContext, useCallback, useContext, useMemo } from "react";
1
+ import { c as resolveDatetimeOperator, i as isRelativeDateTimeValue, n as isDateOnlyDatatype, s as processIsDateField } from "./objectSpread2-73AKOozq.js";
2
+ import { C as getDatetimeRuleProcessorCypher, S as getDatetimeRuleProcessorDrizzle, T as getDatetimeJsonLogicOperations, _ as getDatetimeRuleProcessorMongoDBQuery, a as getDatetimeValueProcessorMySQL, b as getDatetimeRuleProcessorGremlin, c as getDatetimeRuleProcessorSpEL, d as getDatetimeRuleProcessorPrisma, f as getDatetimeRuleProcessorParameterized, g as getDatetimeRuleProcessorMongoDB, h as getDatetimeRuleProcessorNL, i as getDatetimeValueProcessorMSSQL, l as getDatetimeRuleProcessorSPARQL, m as defaultDateTimeNLOperatorMap, n as getDatetimeRuleProcessorSQL, o as getDatetimeValueProcessorOracle, p as datetimeValueProcessorNL, r as getDatetimeValueProcessorANSI, s as getDatetimeValueProcessorPostgreSQL, t as getDatetimeRuleProcessorTanStackDB, u as getDatetimeRuleProcessorSequelize, v as getDatetimeRuleProcessorLDAP, w as getDatetimeRuleProcessorCEL, x as getDatetimeRuleProcessorElasticSearch, y as getDatetimeRuleProcessorJSONata } from "./getDatetimeRuleProcessorTanStackDB-BDFJlfJh.js";
3
+ import { defaultRuleProcessorJsonLogic, toArray } from "@react-querybuilder/core";
6
4
  //#region src/datetimeRuleProcessorJsonLogic.ts
7
5
  const dateOperationMap = {
8
6
  "!=": "dateNotOn",
@@ -69,449 +67,6 @@ const datetimeRuleProcessorJsonLogic = (rule, options) => {
69
67
  return defaultRuleProcessorJsonLogic(rule, options);
70
68
  };
71
69
  //#endregion
72
- //#region src/InheritedValueEditorContext.ts
73
- /**
74
- * Holds the value editor inherited from an outer (compat package) context provider,
75
- * captured _before_ {@link QueryBuilderDateTime} overrides it. Lets the date/time value
76
- * editor delegate non-date fields (and absolute date inputs) to the compat editor instead
77
- * of the bare default {@link react-querybuilder!ValueEditor ValueEditor}. `null` = none
78
- * inherited (fall back to default).
79
- */
80
- const InheritedValueEditorContext = createContext(null);
81
- /** Inherited (compat) value editor, or `null` if none. See {@link InheritedValueEditorContext}. */
82
- const useInheritedValueEditor = () => useContext(InheritedValueEditorContext);
83
- //#endregion
84
- //#region src/relativeDateTimeConstants.ts
85
- /**
86
- * Class name applied to the absolute/relative mode toggle button. Package-local (not part
87
- * of the core `standardClassnames`) to avoid coupling core to this extension.
88
- */
89
- const relativeDateTimeToggleClassName = "rule-value-dateTimeRelative-toggle";
90
- /** Default value applied when switching a rule to relative mode. */
91
- const defaultRelativeDateTimeValue = {
92
- mode: "relative",
93
- anchor: "now",
94
- offset: 0,
95
- unit: "day"
96
- };
97
- /** Default anchor (reference-point) options for the relative date/time editor. */
98
- const defaultRelativeDateTimeAnchors = [
99
- {
100
- name: "now",
101
- value: "now",
102
- label: "now"
103
- },
104
- {
105
- name: "startOfDay",
106
- value: "startOfDay",
107
- label: "start of day"
108
- },
109
- {
110
- name: "endOfDay",
111
- value: "endOfDay",
112
- label: "end of day"
113
- },
114
- {
115
- name: "startOfWeek",
116
- value: "startOfWeek",
117
- label: "start of week"
118
- },
119
- {
120
- name: "endOfWeek",
121
- value: "endOfWeek",
122
- label: "end of week"
123
- },
124
- {
125
- name: "startOfMonth",
126
- value: "startOfMonth",
127
- label: "start of month"
128
- },
129
- {
130
- name: "endOfMonth",
131
- value: "endOfMonth",
132
- label: "end of month"
133
- },
134
- {
135
- name: "startOfYear",
136
- value: "startOfYear",
137
- label: "start of year"
138
- },
139
- {
140
- name: "endOfYear",
141
- value: "endOfYear",
142
- label: "end of year"
143
- }
144
- ];
145
- /** Default unit options for the relative date/time editor. */
146
- const defaultRelativeDateTimeUnits = [
147
- {
148
- name: "minute",
149
- value: "minute",
150
- label: "minute(s)"
151
- },
152
- {
153
- name: "hour",
154
- value: "hour",
155
- label: "hour(s)"
156
- },
157
- {
158
- name: "day",
159
- value: "day",
160
- label: "day(s)"
161
- },
162
- {
163
- name: "week",
164
- value: "week",
165
- label: "week(s)"
166
- },
167
- {
168
- name: "month",
169
- value: "month",
170
- label: "month(s)"
171
- },
172
- {
173
- name: "year",
174
- value: "year",
175
- label: "year(s)"
176
- }
177
- ];
178
- /** Default labels/content for the absolute/relative mode toggle. */
179
- const defaultRelativeDateTimeToggleLabels = {
180
- label: "Toggle relative date/time",
181
- absoluteTitle: "Absolute date/time (click for relative)",
182
- relativeTitle: "Relative date/time (click for absolute)",
183
- absoluteContent: "",
184
- relativeContent: ""
185
- };
186
- //#endregion
187
- //#region src/relativeDateTimeModeControllers.tsx
188
- /**
189
- * Compact absolute/relative toggle rendered by {@link toggleModeController}. A
190
- * `role="switch"` button whose default glyph is supplied by CSS (keyed on
191
- * `aria-checked`); override via the `toggleLabels` config.
192
- *
193
- * @group Components
194
- */
195
- const RelativeDateTimeModeToggle = ({ isRelative, setMode, disabled, className, labels }) => {
196
- const onClick = React.useCallback(() => setMode(isRelative ? "absolute" : "relative"), [setMode, isRelative]);
197
- return /* @__PURE__ */ React.createElement("button", {
198
- type: "button",
199
- role: "switch",
200
- "aria-checked": isRelative,
201
- "aria-label": labels.label,
202
- title: isRelative ? labels.relativeTitle : labels.absoluteTitle,
203
- disabled,
204
- className: clsx(relativeDateTimeToggleClassName, className),
205
- onClick
206
- }, isRelative ? labels.relativeContent : labels.absoluteContent);
207
- };
208
- /**
209
- * Zero-config default {@link RelativeDateTimeModeController}: derives the mode from the
210
- * value shape and renders a compact toggle button to switch between absolute and
211
- * relative entry.
212
- */
213
- const toggleModeController = {
214
- isRelative: (props) => isRelativeDateTimeValue(props.value),
215
- ModeControl: RelativeDateTimeModeToggle
216
- };
217
- /**
218
- * Builds an operator-driven {@link RelativeDateTimeModeController} that derives the mode
219
- * from the rule's operator. Pass the operator name(s) (or a predicate) that should put the
220
- * editor in relative mode. No toggle is rendered — the operator selector is the mode
221
- * affordance.
222
- *
223
- * NOTE: the chosen operators only signal _mode_; the rule's value remains a
224
- * {@link RelativeDateTimeValue}. For these operators to export correctly, map each one to a
225
- * real comparison operator via `context.relativeOperatorMap` when calling `formatQuery`
226
- * (e.g. `{ relativeEq: '=' }`). See the documentation.
227
- */
228
- const createOperatorModeController = (relativeOperators) => ({ isRelative: (props) => typeof relativeOperators === "function" ? relativeOperators(props.operator) : relativeOperators.includes(props.operator) });
229
- /**
230
- * Appends the given `operators` to each field's `operators` list, so the operator-driven
231
- * controller (see {@link createOperatorModeController}) has an operator to switch into
232
- * relative mode. Fields without an explicit `operators` list fall back to the core
233
- * `defaultOperators`.
234
- */
235
- const withRelativeOperators = (fields, operators) => fields.map((field) => {
236
- var _field$operators;
237
- return _objectSpread2(_objectSpread2({}, field), {}, { operators: [...(_field$operators = field.operators) !== null && _field$operators !== void 0 ? _field$operators : defaultOperators, ...operators] });
238
- });
239
- //#endregion
240
- //#region src/RelativeDateTimeConfigContext.tsx
241
- /**
242
- * Carries {@link RelativeDateTimeEditorConfig} to the {@link RelativeDateTimeValueEditor}.
243
- * Provided by {@link QueryBuilderDateTime}; defaults apply when no provider is present.
244
- */
245
- const RelativeDateTimeConfigContext = createContext({});
246
- /** Reads the relative date/time editor config from context, merged with defaults. */
247
- const useRelativeDateTimeConfig = () => {
248
- const config = useContext(RelativeDateTimeConfigContext);
249
- return useMemo(() => {
250
- var _config$modeControlle, _config$anchors, _config$units, _config$dateTimeAPI;
251
- return {
252
- modeController: (_config$modeControlle = config.modeController) !== null && _config$modeControlle !== void 0 ? _config$modeControlle : toggleModeController,
253
- anchors: (_config$anchors = config.anchors) !== null && _config$anchors !== void 0 ? _config$anchors : defaultRelativeDateTimeAnchors,
254
- units: (_config$units = config.units) !== null && _config$units !== void 0 ? _config$units : defaultRelativeDateTimeUnits,
255
- toggleLabels: _objectSpread2(_objectSpread2({}, defaultRelativeDateTimeToggleLabels), config.toggleLabels),
256
- dateTimeAPI: (_config$dateTimeAPI = config.dateTimeAPI) !== null && _config$dateTimeAPI !== void 0 ? _config$dateTimeAPI : rqbDateTimeLibraryAPI
257
- };
258
- }, [config]);
259
- };
260
- //#endregion
261
- //#region src/RelativeDateTimeValueEditor.tsx
262
- const dummyPath = [];
263
- const dummyFieldData = {
264
- name: "",
265
- value: "",
266
- label: ""
267
- };
268
- /** Splits a value into the from/to pair used by between/notBetween, object-safe. */
269
- const toBetweenArray = (value) => Array.isArray(value) ? value : isRelativeDateTimeValue(value) ? [value] : toArray(value);
270
- /**
271
- * Renders a single absolute-or-relative date/time value: a mode affordance (per the
272
- * controller) plus either an absolute date input or anchor + signed offset + unit
273
- * selectors. Reused once per slot so between/notBetween can mix bounds (e.g. an absolute
274
- * "from" and a relative "to").
275
- */
276
- const RelativeDateTimeSingleValueEditor = ({ baseProps, value, onChange, absoluteOperator, config, SelectorComponent, NumericEditorComponent, valueListItemClassName, numericSchema }) => {
277
- const { schema, disabled, title, testID } = baseProps;
278
- const { modeController, anchors, units, toggleLabels } = config;
279
- const isRelative = modeController.isRelative(_objectSpread2(_objectSpread2({}, baseProps), {}, { value }));
280
- const relValue = isRelativeDateTimeValue(value) ? value : defaultRelativeDateTimeValue;
281
- const handleSetMode = useCallback((mode) => onChange(mode === "relative" ? defaultRelativeDateTimeValue : ""), [onChange]);
282
- const handleChangeAnchor = useCallback((anchor) => onChange(_objectSpread2(_objectSpread2({}, relValue), {}, { anchor })), [onChange, relValue]);
283
- const handleChangeOffset = useCallback((offset) => onChange(_objectSpread2(_objectSpread2({}, relValue), {}, { offset: parseNumber(offset, { parseNumbers: true }) || 0 })), [onChange, relValue]);
284
- const handleChangeUnit = useCallback((unit) => onChange(_objectSpread2(_objectSpread2({}, relValue), {}, { unit })), [onChange, relValue]);
285
- const { ModeControl } = modeController;
286
- return /* @__PURE__ */ React.createElement(React.Fragment, null, ModeControl && /* @__PURE__ */ React.createElement(ModeControl, {
287
- isRelative,
288
- setMode: handleSetMode,
289
- schema,
290
- disabled,
291
- className: valueListItemClassName,
292
- title,
293
- testID,
294
- labels: toggleLabels
295
- }), isRelative ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SelectorComponent, {
296
- schema,
297
- testID,
298
- title,
299
- className: valueListItemClassName,
300
- handleOnChange: handleChangeAnchor,
301
- disabled,
302
- value: relValue.anchor,
303
- options: anchors,
304
- multiple: false,
305
- listsAsArrays: false,
306
- path: dummyPath,
307
- level: 0
308
- }), /* @__PURE__ */ React.createElement(NumericEditorComponent, {
309
- skipHook: true,
310
- testID,
311
- inputType: "number",
312
- title,
313
- className: valueListItemClassName,
314
- disabled,
315
- handleOnChange: handleChangeOffset,
316
- field: "",
317
- operator: "",
318
- value: relValue.offset,
319
- valueSource: "value",
320
- fieldData: dummyFieldData,
321
- schema: numericSchema,
322
- path: dummyPath,
323
- level: 0,
324
- rule: {
325
- field: "",
326
- operator: "=",
327
- value: relValue.offset
328
- }
329
- }), relValue.offset !== 0 && /* @__PURE__ */ React.createElement(SelectorComponent, {
330
- schema,
331
- testID,
332
- title,
333
- className: valueListItemClassName,
334
- handleOnChange: handleChangeUnit,
335
- disabled,
336
- value: relValue.unit,
337
- options: units,
338
- multiple: false,
339
- listsAsArrays: false,
340
- path: dummyPath,
341
- level: 0
342
- })) : /* @__PURE__ */ React.createElement(DateTimeValueEditor, _objectSpread2(_objectSpread2({}, baseProps), {}, {
343
- operator: absoluteOperator,
344
- value,
345
- handleOnChange: onChange,
346
- className: standardClassnames.value
347
- })));
348
- };
349
- /**
350
- * Value editor with support for {@link RelativeDateTimeValue relative date/time values}
351
- * (e.g. "three months ago" or "the beginning of this year"). How the user switches
352
- * between absolute and relative modes is delegated to a pluggable
353
- * {@link RelativeDateTimeModeController} (default: a compact toggle), supplied via
354
- * {@link QueryBuilderDateTime}. In relative mode it renders anchor + signed offset + unit
355
- * selectors; the unit selector is hidden when the offset is `0`.
356
- *
357
- * For the `between`/`notBetween` operators it renders two independent value editors (each
358
- * with its own mode affordance) and stores the bounds as a two-element array, so the from
359
- * and to bounds can independently be absolute or relative.
360
- *
361
- * @group Components
362
- */
363
- const RelativeDateTimeValueEditor = (props) => {
364
- var _props$selectorCompon, _useInheritedValueEdi;
365
- const { valueListItemClassName } = useValueEditor(props);
366
- const { className, value, handleOnChange, schema, operator, separator } = props;
367
- const { suppressStandardClassnames } = schema;
368
- const SelectorComponent = (_props$selectorCompon = props.selectorComponent) !== null && _props$selectorCompon !== void 0 ? _props$selectorCompon : schema.controls.valueSelector;
369
- const NumericEditorComponent = (_useInheritedValueEdi = useInheritedValueEditor()) !== null && _useInheritedValueEdi !== void 0 ? _useInheritedValueEdi : ValueEditor;
370
- const config = useRelativeDateTimeConfig();
371
- const numericSchema = useMemo(() => _objectSpread2(_objectSpread2({}, schema), {}, { parseNumbers: true }), [schema]);
372
- const outerClassname = useMemo(() => clsx(suppressStandardClassnames || standardClassnames.valueDateTimeRelative, className), [suppressStandardClassnames, className]);
373
- const isBetween = operator === "between" || operator === "notBetween";
374
- const valueAsArray = useMemo(() => toBetweenArray(value), [value]);
375
- const handleChangeBound = useCallback((index) => (boundValue) => {
376
- const next = [valueAsArray[0], valueAsArray[1]];
377
- next[index] = boundValue;
378
- handleOnChange(next);
379
- }, [valueAsArray, handleOnChange]);
380
- if (isBetween) return /* @__PURE__ */ React.createElement("span", { className: outerClassname }, /* @__PURE__ */ React.createElement(RelativeDateTimeSingleValueEditor, {
381
- baseProps: props,
382
- value: valueAsArray[0],
383
- onChange: handleChangeBound(0),
384
- absoluteOperator: "=",
385
- config,
386
- SelectorComponent,
387
- NumericEditorComponent,
388
- valueListItemClassName,
389
- numericSchema
390
- }), separator, /* @__PURE__ */ React.createElement(RelativeDateTimeSingleValueEditor, {
391
- baseProps: props,
392
- value: valueAsArray[1],
393
- onChange: handleChangeBound(1),
394
- absoluteOperator: "=",
395
- config,
396
- SelectorComponent,
397
- NumericEditorComponent,
398
- valueListItemClassName,
399
- numericSchema
400
- }));
401
- return /* @__PURE__ */ React.createElement("span", { className: outerClassname }, /* @__PURE__ */ React.createElement(RelativeDateTimeSingleValueEditor, {
402
- baseProps: props,
403
- value,
404
- onChange: handleOnChange,
405
- absoluteOperator: operator,
406
- config,
407
- SelectorComponent,
408
- NumericEditorComponent,
409
- valueListItemClassName,
410
- numericSchema
411
- }));
412
- };
413
- //#endregion
414
- //#region \0@oxc-project+runtime@0.135.0/helpers/esm/objectWithoutPropertiesLoose.js
415
- function _objectWithoutPropertiesLoose(r, e) {
416
- if (null == r) return {};
417
- var t = {};
418
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
419
- if (e.includes(n)) continue;
420
- t[n] = r[n];
421
- }
422
- return t;
423
- }
424
- //#endregion
425
- //#region \0@oxc-project+runtime@0.135.0/helpers/esm/objectWithoutProperties.js
426
- function _objectWithoutProperties(e, t) {
427
- if (null == e) return {};
428
- var o, r, i = _objectWithoutPropertiesLoose(e, t);
429
- if (Object.getOwnPropertySymbols) {
430
- var s = Object.getOwnPropertySymbols(e);
431
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
432
- }
433
- return i;
434
- }
435
- //#endregion
436
- //#region src/QueryBuilderDateTime.tsx
437
- const _excluded = ["editor"];
438
- /**
439
- * Whether a rule should use a date/time editor, based on either the coerced input
440
- * type (`date`/`datetime-local`) or a date-like `datatype` (`date`/`datetime`/`timestamp`).
441
- */
442
- const isDateTimeEditor = (props, inputTypeCoerced) => {
443
- var _props$fieldData;
444
- return props.type === "text" && (inputTypeCoerced === "date" || inputTypeCoerced === "datetime-local") || /^(?:date|datetime|timestamp)\b/i.test((_props$fieldData = props.fieldData) === null || _props$fieldData === void 0 ? void 0 : _props$fieldData.datatype);
445
- };
446
- const pad2 = (n) => `${n}`.padStart(2, "0");
447
- /**
448
- * Formats a `Date` into the local value expected by a native `date`/`datetime-local`
449
- * input (library-agnostic; the date library only handles parsing/validation).
450
- */
451
- const formatDateInputValue = (d, withTime) => {
452
- const datePart = `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`;
453
- return withTime ? `${datePart}T${pad2(d.getHours())}:${pad2(d.getMinutes())}` : datePart;
454
- };
455
- /**
456
- * Renders the inherited (compat) editor when one is provided, otherwise the default
457
- * {@link react-querybuilder!ValueEditor ValueEditor}. The editor is received as a prop (rather
458
- * than read from context here) so the JSX element type stays prop-sourced and stable.
459
- */
460
- const FallbackValueEditor = (_ref) => {
461
- let { editor: Editor } = _ref, props = _objectWithoutProperties(_ref, _excluded);
462
- return Editor ? /* @__PURE__ */ React.createElement(Editor, props) : /* @__PURE__ */ React.createElement(ValueEditor, _objectSpread2(_objectSpread2({}, props), {}, { skipHook: true }));
463
- };
464
- const DateTimeValueEditor = (props) => {
465
- const uVE = useValueEditor(props);
466
- const InheritedEditor = useInheritedValueEditor();
467
- const { dateTimeAPI } = useRelativeDateTimeConfig();
468
- const fallback = (p) => /* @__PURE__ */ React.createElement(FallbackValueEditor, _objectSpread2({ editor: InheritedEditor }, p));
469
- if (!isDateTimeEditor(props, uVE.inputTypeCoerced)) return fallback(props);
470
- if (dateTimeAPI.isValid(props.value)) {
471
- const value = formatDateInputValue(dateTimeAPI.toDate(props.value), uVE.inputTypeCoerced !== "date");
472
- return fallback(_objectSpread2(_objectSpread2({}, props), {}, { value }));
473
- }
474
- return fallback(props);
475
- };
476
- /**
477
- * Provider value editor: renders the relative-capable {@link RelativeDateTimeValueEditor}
478
- * for date/time fields and falls back to the inherited (compat) editor for everything else.
479
- */
480
- const QueryBuilderDateTimeValueEditor = (props) => {
481
- const uVE = useValueEditor(props);
482
- const InheritedEditor = useInheritedValueEditor();
483
- if (isDateTimeEditor(props, uVE.inputTypeCoerced)) return /* @__PURE__ */ React.createElement(RelativeDateTimeValueEditor, props);
484
- return /* @__PURE__ */ React.createElement(FallbackValueEditor, _objectSpread2({ editor: InheritedEditor }, props));
485
- };
486
- const QueryBuilderDateTimeContext = getCompatContextProvider({ controlElements: { valueEditor: QueryBuilderDateTimeValueEditor } });
487
- /**
488
- * Context provider enabling date/time features for a wrapped
489
- * {@link react-querybuilder!QueryBuilder QueryBuilder}: renders the relative-capable
490
- * {@link RelativeDateTimeValueEditor} for date/time fields, and accepts optional
491
- * {@link RelativeDateTimeEditorConfig} props (mode controller, anchor/unit options, and
492
- * toggle labels). With no props it provides the zero-config toggle experience.
493
- *
494
- * @group Components
495
- */
496
- const QueryBuilderDateTime = ({ children, modeController, anchors, units, toggleLabels, dateTimeAPI }) => {
497
- var _useContext$controlEl, _useContext$controlEl2;
498
- const config = useMemo(() => ({
499
- modeController,
500
- anchors,
501
- units,
502
- toggleLabels,
503
- dateTimeAPI
504
- }), [
505
- modeController,
506
- anchors,
507
- units,
508
- toggleLabels,
509
- dateTimeAPI
510
- ]);
511
- const inheritedValueEditor = (_useContext$controlEl = (_useContext$controlEl2 = useContext(QueryBuilderContext).controlElements) === null || _useContext$controlEl2 === void 0 ? void 0 : _useContext$controlEl2.valueEditor) !== null && _useContext$controlEl !== void 0 ? _useContext$controlEl : null;
512
- return /* @__PURE__ */ React.createElement(RelativeDateTimeConfigContext.Provider, { value: config }, /* @__PURE__ */ React.createElement(InheritedValueEditorContext.Provider, { value: inheritedValueEditor }, /* @__PURE__ */ React.createElement(QueryBuilderDateTimeContext, null, children)));
513
- };
514
- //#endregion
515
- export { DateTimeValueEditor, QueryBuilderDateTime, QueryBuilderDateTimeContext, RelativeDateTimeConfigContext, RelativeDateTimeModeToggle, RelativeDateTimeValueEditor, createOperatorModeController, datetimeRuleProcessorJsonLogic, datetimeValueProcessorNL, defaultDateTimeNLOperatorMap, defaultRelativeDateTimeAnchors, defaultRelativeDateTimeToggleLabels, defaultRelativeDateTimeUnits, defaultRelativeDateTimeValue, getDatetimeJsonLogicOperations, getDatetimeRuleProcessorCEL, getDatetimeRuleProcessorCypher, getDatetimeRuleProcessorDrizzle, getDatetimeRuleProcessorElasticSearch, getDatetimeRuleProcessorGremlin, getDatetimeRuleProcessorJSONata, getDatetimeRuleProcessorLDAP, getDatetimeRuleProcessorMongoDB, getDatetimeRuleProcessorMongoDBQuery, getDatetimeRuleProcessorNL, getDatetimeRuleProcessorParameterized, getDatetimeRuleProcessorPrisma, getDatetimeRuleProcessorSPARQL, getDatetimeRuleProcessorSQL, getDatetimeRuleProcessorSequelize, getDatetimeRuleProcessorSpEL, getDatetimeRuleProcessorTanStackDB, getDatetimeValueProcessorANSI, getDatetimeValueProcessorMSSQL, getDatetimeValueProcessorMySQL, getDatetimeValueProcessorOracle, getDatetimeValueProcessorPostgreSQL, relativeDateTimeToggleClassName, toggleModeController, useRelativeDateTimeConfig, withRelativeOperators };
70
+ export { datetimeRuleProcessorJsonLogic, datetimeValueProcessorNL, defaultDateTimeNLOperatorMap, getDatetimeJsonLogicOperations, getDatetimeRuleProcessorCEL, getDatetimeRuleProcessorCypher, getDatetimeRuleProcessorDrizzle, getDatetimeRuleProcessorElasticSearch, getDatetimeRuleProcessorGremlin, getDatetimeRuleProcessorJSONata, getDatetimeRuleProcessorLDAP, getDatetimeRuleProcessorMongoDB, getDatetimeRuleProcessorMongoDBQuery, getDatetimeRuleProcessorNL, getDatetimeRuleProcessorParameterized, getDatetimeRuleProcessorPrisma, getDatetimeRuleProcessorSPARQL, getDatetimeRuleProcessorSQL, getDatetimeRuleProcessorSequelize, getDatetimeRuleProcessorSpEL, getDatetimeRuleProcessorTanStackDB, getDatetimeValueProcessorANSI, getDatetimeValueProcessorMSSQL, getDatetimeValueProcessorMySQL, getDatetimeValueProcessorOracle, getDatetimeValueProcessorPostgreSQL };
516
71
 
517
72
  //# sourceMappingURL=react-querybuilder_datetime.legacy-esm.js.map