@react-querybuilder/datetime 8.17.0 → 8.19.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 (121) hide show
  1. package/dist/cjs/getDatetimeRuleProcessorTanStackDB-CL79A1_x.js +1208 -0
  2. package/dist/cjs/getDatetimeRuleProcessorTanStackDB-CL79A1_x.js.map +1 -0
  3. package/dist/cjs/getDatetimeRuleProcessorTanStackDB-DgUg_arY.js +2 -0
  4. package/dist/cjs/getDatetimeRuleProcessorTanStackDB-DgUg_arY.js.map +1 -0
  5. package/dist/cjs/react-querybuilder_datetime.cjs.development.d.ts +214 -8
  6. package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.d.ts +46 -2
  7. package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.js +93 -15
  8. package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.js.map +1 -1
  9. package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.d.ts +46 -2
  10. package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.js +70 -59
  11. package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.js.map +1 -1
  12. package/dist/cjs/react-querybuilder_datetime.cjs.development.js +482 -71
  13. package/dist/cjs/react-querybuilder_datetime.cjs.development.js.map +1 -1
  14. package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.d.ts +46 -2
  15. package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.js +129 -15
  16. package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.js.map +1 -1
  17. package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.d.ts +46 -2
  18. package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.js +81 -15
  19. package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.js.map +1 -1
  20. package/dist/cjs/react-querybuilder_datetime.cjs.production.d.ts +214 -8
  21. package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.d.ts +46 -2
  22. package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.js +1 -1
  23. package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.js.map +1 -1
  24. package/dist/cjs/react-querybuilder_datetime.cjs.production.dayjs.d.ts +46 -2
  25. package/dist/cjs/react-querybuilder_datetime.cjs.production.dayjs.js +1 -1
  26. package/dist/cjs/react-querybuilder_datetime.cjs.production.dayjs.js.map +1 -1
  27. package/dist/cjs/react-querybuilder_datetime.cjs.production.js +1 -1
  28. package/dist/cjs/react-querybuilder_datetime.cjs.production.js.map +1 -1
  29. package/dist/cjs/react-querybuilder_datetime.cjs.production.jsdate.d.ts +46 -2
  30. package/dist/cjs/react-querybuilder_datetime.cjs.production.jsdate.js +1 -1
  31. package/dist/cjs/react-querybuilder_datetime.cjs.production.jsdate.js.map +1 -1
  32. package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.d.ts +46 -2
  33. package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.js +1 -1
  34. package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.js.map +1 -1
  35. package/dist/cjs/rqbDateTimeLibraryAPI.dayjs-BfILPx88.js +2 -0
  36. package/dist/cjs/rqbDateTimeLibraryAPI.dayjs-BfILPx88.js.map +1 -0
  37. package/dist/cjs/rqbDateTimeLibraryAPI.dayjs-CzLh_zi9.js +63 -0
  38. package/dist/cjs/rqbDateTimeLibraryAPI.dayjs-CzLh_zi9.js.map +1 -0
  39. package/dist/cjs/types-XYMw0jFT.d.ts +265 -0
  40. package/dist/datetime-layout.css +1 -0
  41. package/dist/datetime-layout.css.map +1 -0
  42. package/dist/datetime-layout.scss +3 -0
  43. package/dist/datetime.css +1 -0
  44. package/dist/datetime.css.map +1 -0
  45. package/dist/datetime.scss +1 -0
  46. package/dist/getDatetimeRuleProcessorTanStackDB-BcOC-o2A.mjs +1029 -0
  47. package/dist/getDatetimeRuleProcessorTanStackDB-BcOC-o2A.mjs.map +1 -0
  48. package/dist/getDatetimeRuleProcessorTanStackDB-Dloxv6k2.mjs +2 -0
  49. package/dist/getDatetimeRuleProcessorTanStackDB-Dloxv6k2.mjs.map +1 -0
  50. package/dist/getDatetimeRuleProcessorTanStackDB-LDwhMJg0.js +1035 -0
  51. package/dist/getDatetimeRuleProcessorTanStackDB-LDwhMJg0.js.map +1 -0
  52. package/dist/react-querybuilder_datetime.d.mts +214 -8
  53. package/dist/react-querybuilder_datetime.date-fns.d.mts +46 -2
  54. package/dist/react-querybuilder_datetime.date-fns.mjs +71 -4
  55. package/dist/react-querybuilder_datetime.date-fns.mjs.map +1 -1
  56. package/dist/react-querybuilder_datetime.dayjs.d.mts +46 -2
  57. package/dist/react-querybuilder_datetime.dayjs.mjs +47 -24
  58. package/dist/react-querybuilder_datetime.dayjs.mjs.map +1 -1
  59. package/dist/react-querybuilder_datetime.jsdate.d.mts +46 -2
  60. package/dist/react-querybuilder_datetime.jsdate.mjs +106 -3
  61. package/dist/react-querybuilder_datetime.jsdate.mjs.map +1 -1
  62. package/dist/react-querybuilder_datetime.legacy-esm.d.ts +214 -8
  63. package/dist/react-querybuilder_datetime.legacy-esm.date-fns.d.ts +46 -2
  64. package/dist/react-querybuilder_datetime.legacy-esm.date-fns.js +71 -4
  65. package/dist/react-querybuilder_datetime.legacy-esm.date-fns.js.map +1 -1
  66. package/dist/react-querybuilder_datetime.legacy-esm.dayjs.d.ts +46 -2
  67. package/dist/react-querybuilder_datetime.legacy-esm.dayjs.js +47 -24
  68. package/dist/react-querybuilder_datetime.legacy-esm.dayjs.js.map +1 -1
  69. package/dist/react-querybuilder_datetime.legacy-esm.js +425 -58
  70. package/dist/react-querybuilder_datetime.legacy-esm.js.map +1 -1
  71. package/dist/react-querybuilder_datetime.legacy-esm.jsdate.d.ts +46 -2
  72. package/dist/react-querybuilder_datetime.legacy-esm.jsdate.js +106 -3
  73. package/dist/react-querybuilder_datetime.legacy-esm.jsdate.js.map +1 -1
  74. package/dist/react-querybuilder_datetime.legacy-esm.luxon.d.ts +46 -2
  75. package/dist/react-querybuilder_datetime.legacy-esm.luxon.js +58 -3
  76. package/dist/react-querybuilder_datetime.legacy-esm.luxon.js.map +1 -1
  77. package/dist/react-querybuilder_datetime.luxon.d.mts +46 -2
  78. package/dist/react-querybuilder_datetime.luxon.mjs +58 -3
  79. package/dist/react-querybuilder_datetime.luxon.mjs.map +1 -1
  80. package/dist/react-querybuilder_datetime.mjs +443 -57
  81. package/dist/react-querybuilder_datetime.mjs.map +1 -1
  82. package/dist/react-querybuilder_datetime.production.d.mts +214 -8
  83. package/dist/react-querybuilder_datetime.production.date-fns.d.mts +46 -2
  84. package/dist/react-querybuilder_datetime.production.date-fns.mjs +1 -1
  85. package/dist/react-querybuilder_datetime.production.date-fns.mjs.map +1 -1
  86. package/dist/react-querybuilder_datetime.production.dayjs.d.mts +46 -2
  87. package/dist/react-querybuilder_datetime.production.dayjs.mjs +1 -1
  88. package/dist/react-querybuilder_datetime.production.dayjs.mjs.map +1 -1
  89. package/dist/react-querybuilder_datetime.production.jsdate.d.mts +46 -2
  90. package/dist/react-querybuilder_datetime.production.jsdate.mjs +1 -1
  91. package/dist/react-querybuilder_datetime.production.jsdate.mjs.map +1 -1
  92. package/dist/react-querybuilder_datetime.production.luxon.d.mts +46 -2
  93. package/dist/react-querybuilder_datetime.production.luxon.mjs +1 -1
  94. package/dist/react-querybuilder_datetime.production.luxon.mjs.map +1 -1
  95. package/dist/react-querybuilder_datetime.production.mjs +1 -1
  96. package/dist/react-querybuilder_datetime.production.mjs.map +1 -1
  97. package/dist/rqbDateTimeLibraryAPI.dayjs-BW7faYFD.mjs +29 -0
  98. package/dist/rqbDateTimeLibraryAPI.dayjs-BW7faYFD.mjs.map +1 -0
  99. package/dist/rqbDateTimeLibraryAPI.dayjs-BoX90aqZ.mjs +2 -0
  100. package/dist/rqbDateTimeLibraryAPI.dayjs-BoX90aqZ.mjs.map +1 -0
  101. package/dist/rqbDateTimeLibraryAPI.dayjs-DvFSxPKu.js +29 -0
  102. package/dist/rqbDateTimeLibraryAPI.dayjs-DvFSxPKu.js.map +1 -0
  103. package/dist/styles/_layout.scss +30 -0
  104. package/dist/styles/_root.scss +5 -0
  105. package/dist/styles/_variables.scss +8 -0
  106. package/dist/types-CdjHqQ0k.d.mts +265 -0
  107. package/dist/types-CdjHqQ0k.d.ts +265 -0
  108. package/package.json +30 -15
  109. package/dist/cjs/getDatetimeRuleProcessorSQL-Cca9pzSn.js +0 -2
  110. package/dist/cjs/getDatetimeRuleProcessorSQL-Cca9pzSn.js.map +0 -1
  111. package/dist/cjs/getDatetimeRuleProcessorSQL-CrA2ZrSe.js +0 -563
  112. package/dist/cjs/getDatetimeRuleProcessorSQL-CrA2ZrSe.js.map +0 -1
  113. package/dist/cjs/types-c6_k1Tpr.d.ts +0 -105
  114. package/dist/getDatetimeRuleProcessorSQL-Crw01Jo-.js +0 -482
  115. package/dist/getDatetimeRuleProcessorSQL-Crw01Jo-.js.map +0 -1
  116. package/dist/getDatetimeRuleProcessorSQL-CvGKzojM.mjs +0 -2
  117. package/dist/getDatetimeRuleProcessorSQL-CvGKzojM.mjs.map +0 -1
  118. package/dist/getDatetimeRuleProcessorSQL-Nz_XjNeY.mjs +0 -468
  119. package/dist/getDatetimeRuleProcessorSQL-Nz_XjNeY.mjs.map +0 -1
  120. package/dist/types-c6_k1Tpr.d.mts +0 -105
  121. package/dist/types-c6_k1Tpr.d.ts +0 -105
@@ -1 +1 @@
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};\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';\nimport { getDatetimeJsonLogicOperations } from './getDatetimeJsonLogicOperations';\nimport { getDatetimeRuleProcessorCEL } from './getDatetimeRuleProcessorCEL';\nimport { getDatetimeRuleProcessorCypher } from './getDatetimeRuleProcessorCypher';\nimport { getDatetimeRuleProcessorMongoDBQuery } from './getDatetimeRuleProcessorMongoDBQuery';\nimport { getDatetimeRuleProcessorNL } from './getDatetimeRuleProcessorNL';\nimport { getDatetimeRuleProcessorSPARQL } from './getDatetimeRuleProcessorSPARQL';\nimport {\n getDatetimeRuleProcessorSQL,\n getDatetimeValueProcessorANSI,\n getDatetimeValueProcessorMSSQL,\n getDatetimeValueProcessorMySQL,\n getDatetimeValueProcessorOracle,\n getDatetimeValueProcessorPostgreSQL,\n} from './getDatetimeRuleProcessorSQL';\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 \"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\nexport * from './rqbDateTimeLibraryAPI.dayjs';\n"],"mappings":";;;;;;AAOA,MAAa,wBAA+C;CAC1D,SAAS,GAAG,QAAQ,MAAM,CAAC,EAAE,OAAO,GAAG;CACvC,UAAU,GAAG,MAAM,MAAM,CAAC,EAAE,QAAQ,CAAC;CACrC,WAAW,GAAG,MAAM,MAAM,CAAC,EAAE,SAAS,CAAC;CACvC,SAAS,GAAG,MACV,MAAM,CAAC,EAAE,OAAO,GAAG,oBAAoB,CAAC,KAAK,oBAAoB,CAAC,IAAI,MAAM,IAAI;CAClF,UAAS,MAAK,MAAM,CAAC,EAAE,QAAQ;CAC/B,SAAQ,MAAK,MAAM,CAAC,EAAE,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;AACF;;;;;;ACIA,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,oCACX,qCAAqC,qBAAqB;;;;AAK5D,MAAa,0BACX,2BAA2B,qBAAqB;;;;AAKlD,MAAa,8BACX,+BAA+B,qBAAqB;;;;AAKtD,MAAa,8BACX,+BAA+B,qBAAqB"}
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,5 +1,8 @@
1
- import { a as getDatetimeValueProcessorOracle, c as datetimeValueProcessorNL, d as getDatetimeRuleProcessorMongoDBQuery, f as getDatetimeRuleProcessorCypher, g as processIsDateField, i as getDatetimeValueProcessorMySQL, l as defaultDateTimeNLOperatorMap, m as getDatetimeJsonLogicOperations, n as getDatetimeValueProcessorANSI, o as getDatetimeValueProcessorPostgreSQL, p as getDatetimeRuleProcessorCEL, r as getDatetimeValueProcessorMSSQL, s as getDatetimeRuleProcessorSPARQL, t as getDatetimeRuleProcessorSQL, u as getDatetimeRuleProcessorNL } from "./getDatetimeRuleProcessorSQL-Crw01Jo-.js";
2
- import { defaultRuleProcessorJSONata, defaultRuleProcessorJsonLogic, getQuotedFieldName, nullOrUndefinedOrEmpty, toArray } from "react-querybuilder";
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-LDwhMJg0.js";
2
+ import { t as rqbDateTimeLibraryAPI } from "./rqbDateTimeLibraryAPI.dayjs-DvFSxPKu.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";
3
6
  //#region src/datetimeRuleProcessorJsonLogic.ts
4
7
  const dateOperationMap = {
5
8
  "!=": "dateNotOn",
@@ -22,28 +25,39 @@ const dateOperationMap = {
22
25
  * {@link getDatetimeJsonLogicOperations} during the evaluation process.
23
26
  */
24
27
  const datetimeRuleProcessorJsonLogic = (rule, options) => {
25
- var _opts$context;
28
+ var _opts$context, _opts$fieldData;
26
29
  const opts = options !== null && options !== void 0 ? options : /* v8 ignore start -- @preserve */ {};
27
30
  if (!processIsDateField((_opts$context = opts.context) === null || _opts$context === void 0 ? void 0 : _opts$context.isDateField, rule, opts)) return defaultRuleProcessorJsonLogic(rule, opts);
28
- const { field, operator, value, valueSource } = rule;
31
+ const { field, value, valueSource } = rule;
32
+ const operator = resolveDatetimeOperator(rule, opts);
29
33
  const valueIsField = valueSource === "field";
30
34
  const fieldObject = { var: field };
31
- const maybeFieldRenderer = (v) => valueIsField ? { var: `${v}` } : v;
35
+ const dateOnly = isDateOnlyDatatype(opts === null || opts === void 0 || (_opts$fieldData = opts.fieldData) === null || _opts$fieldData === void 0 ? void 0 : _opts$fieldData.datatype);
36
+ const renderValue = (v) => {
37
+ if (valueIsField) return { var: `${v}` };
38
+ if (isRelativeDateTimeValue(v)) return { dateRelative: [
39
+ v.anchor,
40
+ v.offset,
41
+ v.unit,
42
+ dateOnly
43
+ ] };
44
+ return v;
45
+ };
32
46
  switch (operator) {
33
47
  case "<":
34
48
  case "<=":
35
49
  case "=":
36
50
  case "!=":
37
51
  case ">":
38
- case ">=": return { [dateOperationMap[operator]]: [fieldObject, maybeFieldRenderer(value)] };
52
+ case ">=": return { [dateOperationMap[operator]]: [fieldObject, renderValue(value)] };
39
53
  case "in":
40
54
  case "notIn": {
41
- const valueAsArray = toArray(value).map((v) => maybeFieldRenderer(v));
55
+ const valueAsArray = (Array.isArray(value) ? value : toArray(value)).map(renderValue);
42
56
  return { [dateOperationMap[operator]]: [fieldObject, valueAsArray] };
43
57
  }
44
58
  case "between":
45
59
  case "notBetween": {
46
- const valueAsArray = toArray(value).map((v) => maybeFieldRenderer(v));
60
+ const valueAsArray = (Array.isArray(value) ? value : toArray(value)).map(renderValue);
47
61
  if (valueAsArray.length < 2) return false;
48
62
  return { [dateOperationMap[operator]]: [
49
63
  valueAsArray[0],
@@ -55,62 +69,415 @@ const datetimeRuleProcessorJsonLogic = (rule, options) => {
55
69
  return defaultRuleProcessorJsonLogic(rule, options);
56
70
  };
57
71
  //#endregion
58
- //#region src/getDatetimeRuleProcessorJSONata.ts
59
- const shouldNegate = (op) => /^(does)?not/i.test(op);
60
- const negate = (clause, neg) => neg ? `$not(${clause})` : `${clause}`;
72
+ //#region src/InheritedValueEditorContext.ts
61
73
  /**
62
- * Generates a rule processor with date/time features for use by
63
- * {@link @react-querybuilder/core!formatQuery formatQuery} with the "jsonata" format.
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).
64
79
  */
65
- const getDatetimeRuleProcessorJSONata = (apiFns) => (rule, options) => {
66
- const opts = options !== null && options !== void 0 ? options : /* v8 ignore start -- @preserve */ {};
67
- const { context = {} } = opts;
68
- // v8 ignore next
69
- const { quoteFieldNamesWith = ["", ""], fieldIdentifierSeparator = "" } = opts;
70
- const { field, operator, value, valueSource } = rule;
71
- if (!processIsDateField(context.isDateField, rule, opts)) return defaultRuleProcessorJSONata(rule, opts);
72
- const valueIsField = valueSource === "field";
73
- const fldToMs = (f) => `$toMillis(${getQuotedFieldName(f, {
74
- quoteFieldNamesWith,
75
- fieldIdentifierSeparator
76
- })})`;
77
- const valToMs = (v) => `$toMillis("${apiFns.toISOString(v)}")`;
78
- switch (operator) {
79
- case "<":
80
- case "<=":
81
- case "=":
82
- case "!=":
83
- case ">":
84
- case ">=": return `${fldToMs(field)} ${operator} ${valueIsField ? fldToMs(value) : valToMs(value)}`;
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"
85
143
  }
86
- const valueAsArray = toArray(rule.value, { retainEmptyStrings: false });
87
- const valueAsDateArray = valueAsArray.map((v) => apiFns.toDate(v)).filter((dateVal) => apiFns.isValid(dateVal));
88
- switch (operator) {
89
- case "in":
90
- case "notIn":
91
- if (valueIsField) {
92
- if (valueAsArray.length === 0) return "";
93
- return negate(`${fldToMs(field)} in [${valueAsArray.map((val) => fldToMs(val)).join(", ")}]`, shouldNegate(operator));
94
- }
95
- if (valueAsDateArray.length === 0) return "";
96
- return negate(`${fldToMs(field)} in [${valueAsDateArray.map((val) => valToMs(val)).join(", ")}]`, shouldNegate(operator));
97
- case "between":
98
- case "notBetween": {
99
- if (valueAsArray.length < 2 || nullOrUndefinedOrEmpty(valueAsArray[0]) || nullOrUndefinedOrEmpty(valueAsArray[1]) || !valueIsField && valueAsDateArray.length < 2) return "";
100
- if (valueIsField) {
101
- const [firstValue, secondValue] = valueAsArray;
102
- const expression = `${fldToMs(field)} >= ${fldToMs(firstValue)} and ${fldToMs(field)} <= ${fldToMs(secondValue)}`;
103
- return operator === "between" ? `(${expression})` : negate(expression, true);
104
- }
105
- const [first, second] = valueAsDateArray;
106
- const [firstDate, secondDate] = apiFns.isBefore(first, second) ? [first, second] : [second, first];
107
- const expression = `${fldToMs(field)} >= ${valToMs(firstDate)} and ${fldToMs(field)} <= ${valToMs(secondDate)}`;
108
- return operator === "between" ? `(${expression})` : negate(expression, true);
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, valueListItemClassName, numericSchema }) => {
277
+ var _useInheritedValueEdi;
278
+ const { schema, disabled, title, testID } = baseProps;
279
+ const { modeController, anchors, units, toggleLabels } = config;
280
+ const NumericEditor = (_useInheritedValueEdi = useInheritedValueEditor()) !== null && _useInheritedValueEdi !== void 0 ? _useInheritedValueEdi : ValueEditor;
281
+ const isRelative = modeController.isRelative(_objectSpread2(_objectSpread2({}, baseProps), {}, { value }));
282
+ const relValue = isRelativeDateTimeValue(value) ? value : defaultRelativeDateTimeValue;
283
+ const handleSetMode = useCallback((mode) => onChange(mode === "relative" ? defaultRelativeDateTimeValue : ""), [onChange]);
284
+ const handleChangeAnchor = useCallback((anchor) => onChange(_objectSpread2(_objectSpread2({}, relValue), {}, { anchor })), [onChange, relValue]);
285
+ const handleChangeOffset = useCallback((offset) => onChange(_objectSpread2(_objectSpread2({}, relValue), {}, { offset: parseNumber(offset, { parseNumbers: true }) || 0 })), [onChange, relValue]);
286
+ const handleChangeUnit = useCallback((unit) => onChange(_objectSpread2(_objectSpread2({}, relValue), {}, { unit })), [onChange, relValue]);
287
+ const { ModeControl } = modeController;
288
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, ModeControl && /* @__PURE__ */ React.createElement(ModeControl, {
289
+ isRelative,
290
+ setMode: handleSetMode,
291
+ schema,
292
+ disabled,
293
+ className: valueListItemClassName,
294
+ title,
295
+ testID,
296
+ labels: toggleLabels
297
+ }), isRelative ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SelectorComponent, {
298
+ schema,
299
+ testID,
300
+ title,
301
+ className: valueListItemClassName,
302
+ handleOnChange: handleChangeAnchor,
303
+ disabled,
304
+ value: relValue.anchor,
305
+ options: anchors,
306
+ multiple: false,
307
+ listsAsArrays: false,
308
+ path: dummyPath,
309
+ level: 0
310
+ }), /* @__PURE__ */ React.createElement(NumericEditor, {
311
+ skipHook: true,
312
+ testID,
313
+ inputType: "number",
314
+ title,
315
+ className: valueListItemClassName,
316
+ disabled,
317
+ handleOnChange: handleChangeOffset,
318
+ field: "",
319
+ operator: "",
320
+ value: relValue.offset,
321
+ valueSource: "value",
322
+ fieldData: dummyFieldData,
323
+ schema: numericSchema,
324
+ path: dummyPath,
325
+ level: 0,
326
+ rule: {
327
+ field: "",
328
+ operator: "=",
329
+ value: relValue.offset
109
330
  }
331
+ }), relValue.offset !== 0 && /* @__PURE__ */ React.createElement(SelectorComponent, {
332
+ schema,
333
+ testID,
334
+ title,
335
+ className: valueListItemClassName,
336
+ handleOnChange: handleChangeUnit,
337
+ disabled,
338
+ value: relValue.unit,
339
+ options: units,
340
+ multiple: false,
341
+ listsAsArrays: false,
342
+ path: dummyPath,
343
+ level: 0
344
+ })) : /* @__PURE__ */ React.createElement(DateTimeValueEditor, _objectSpread2(_objectSpread2({}, baseProps), {}, {
345
+ operator: absoluteOperator,
346
+ value,
347
+ handleOnChange: onChange,
348
+ className: standardClassnames.value
349
+ })));
350
+ };
351
+ /**
352
+ * Value editor with support for {@link RelativeDateTimeValue relative date/time values}
353
+ * (e.g. "three months ago" or "the beginning of this year"). How the user switches
354
+ * between absolute and relative modes is delegated to a pluggable
355
+ * {@link RelativeDateTimeModeController} (default: a compact toggle), supplied via
356
+ * {@link QueryBuilderDateTime}. In relative mode it renders anchor + signed offset + unit
357
+ * selectors; the unit selector is hidden when the offset is `0`.
358
+ *
359
+ * For the `between`/`notBetween` operators it renders two independent value editors (each
360
+ * with its own mode affordance) and stores the bounds as a two-element array, so the from
361
+ * and to bounds can independently be absolute or relative.
362
+ *
363
+ * @group Components
364
+ */
365
+ const RelativeDateTimeValueEditor = (props) => {
366
+ var _props$selectorCompon;
367
+ const { valueListItemClassName } = useValueEditor(props);
368
+ const { className, value, handleOnChange, schema, operator, separator } = props;
369
+ const { suppressStandardClassnames } = schema;
370
+ const SelectorComponent = (_props$selectorCompon = props.selectorComponent) !== null && _props$selectorCompon !== void 0 ? _props$selectorCompon : schema.controls.valueSelector;
371
+ const config = useRelativeDateTimeConfig();
372
+ const numericSchema = useMemo(() => _objectSpread2(_objectSpread2({}, schema), {}, { parseNumbers: true }), [schema]);
373
+ const outerClassname = useMemo(() => clsx(suppressStandardClassnames || standardClassnames.valueDateTimeRelative, className), [suppressStandardClassnames, className]);
374
+ const isBetween = operator === "between" || operator === "notBetween";
375
+ const valueAsArray = useMemo(() => toBetweenArray(value), [value]);
376
+ const handleChangeBound = useCallback((index) => (boundValue) => {
377
+ const next = [valueAsArray[0], valueAsArray[1]];
378
+ next[index] = boundValue;
379
+ handleOnChange(next);
380
+ }, [valueAsArray, handleOnChange]);
381
+ if (isBetween) return /* @__PURE__ */ React.createElement("span", { className: outerClassname }, /* @__PURE__ */ React.createElement(RelativeDateTimeSingleValueEditor, {
382
+ baseProps: props,
383
+ value: valueAsArray[0],
384
+ onChange: handleChangeBound(0),
385
+ absoluteOperator: "=",
386
+ config,
387
+ SelectorComponent,
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
+ valueListItemClassName,
398
+ numericSchema
399
+ }));
400
+ return /* @__PURE__ */ React.createElement("span", { className: outerClassname }, /* @__PURE__ */ React.createElement(RelativeDateTimeSingleValueEditor, {
401
+ baseProps: props,
402
+ value,
403
+ onChange: handleOnChange,
404
+ absoluteOperator: operator,
405
+ config,
406
+ SelectorComponent,
407
+ valueListItemClassName,
408
+ numericSchema
409
+ }));
410
+ };
411
+ //#endregion
412
+ //#region src/QueryBuilderDateTime.tsx
413
+ /**
414
+ * Whether a rule should use a date/time editor, based on either the coerced input
415
+ * type (`date`/`datetime-local`) or a date-like `datatype` (`date`/`datetime`/`timestamp`).
416
+ */
417
+ const isDateTimeEditor = (props, inputTypeCoerced) => {
418
+ var _props$fieldData;
419
+ 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);
420
+ };
421
+ const pad2 = (n) => `${n}`.padStart(2, "0");
422
+ /**
423
+ * Formats a `Date` into the local value expected by a native `date`/`datetime-local`
424
+ * input (library-agnostic; the date library only handles parsing/validation).
425
+ */
426
+ const formatDateInputValue = (d, withTime) => {
427
+ const datePart = `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`;
428
+ return withTime ? `${datePart}T${pad2(d.getHours())}:${pad2(d.getMinutes())}` : datePart;
429
+ };
430
+ const DateTimeValueEditor = (props) => {
431
+ const uVE = useValueEditor(props);
432
+ const InheritedEditor = useInheritedValueEditor();
433
+ const { dateTimeAPI } = useRelativeDateTimeConfig();
434
+ const fallback = (p) => InheritedEditor ? /* @__PURE__ */ React.createElement(InheritedEditor, p) : /* @__PURE__ */ React.createElement(ValueEditor, _objectSpread2(_objectSpread2({}, p), {}, { skipHook: true }));
435
+ if (!isDateTimeEditor(props, uVE.inputTypeCoerced)) return fallback(props);
436
+ if (dateTimeAPI.isValid(props.value)) {
437
+ const value = formatDateInputValue(dateTimeAPI.toDate(props.value), uVE.inputTypeCoerced !== "date");
438
+ return fallback(_objectSpread2(_objectSpread2({}, props), {}, { value }));
110
439
  }
111
- return defaultRuleProcessorJSONata(rule, opts);
440
+ return fallback(props);
441
+ };
442
+ /**
443
+ * Provider value editor: renders the relative-capable {@link RelativeDateTimeValueEditor}
444
+ * for date/time fields and falls back to the inherited (compat) editor for everything else.
445
+ */
446
+ const QueryBuilderDateTimeValueEditor = (props) => {
447
+ const uVE = useValueEditor(props);
448
+ const InheritedEditor = useInheritedValueEditor();
449
+ if (isDateTimeEditor(props, uVE.inputTypeCoerced)) return /* @__PURE__ */ React.createElement(RelativeDateTimeValueEditor, props);
450
+ return InheritedEditor ? /* @__PURE__ */ React.createElement(InheritedEditor, props) : /* @__PURE__ */ React.createElement(ValueEditor, _objectSpread2(_objectSpread2({}, props), {}, { skipHook: true }));
451
+ };
452
+ const QueryBuilderDateTimeContext = getCompatContextProvider({ controlElements: { valueEditor: QueryBuilderDateTimeValueEditor } });
453
+ /**
454
+ * Context provider enabling date/time features for a wrapped
455
+ * {@link react-querybuilder!QueryBuilder QueryBuilder}: renders the relative-capable
456
+ * {@link RelativeDateTimeValueEditor} for date/time fields, and accepts optional
457
+ * {@link RelativeDateTimeEditorConfig} props (mode controller, anchor/unit options, and
458
+ * toggle labels). With no props it provides the zero-config toggle experience.
459
+ *
460
+ * @group Components
461
+ */
462
+ const QueryBuilderDateTime = ({ children, modeController, anchors, units, toggleLabels, dateTimeAPI }) => {
463
+ var _useContext$controlEl, _useContext$controlEl2;
464
+ const config = useMemo(() => ({
465
+ modeController,
466
+ anchors,
467
+ units,
468
+ toggleLabels,
469
+ dateTimeAPI
470
+ }), [
471
+ modeController,
472
+ anchors,
473
+ units,
474
+ toggleLabels,
475
+ dateTimeAPI
476
+ ]);
477
+ 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;
478
+ return /* @__PURE__ */ React.createElement(RelativeDateTimeConfigContext.Provider, { value: config }, /* @__PURE__ */ React.createElement(InheritedValueEditorContext.Provider, { value: inheritedValueEditor }, /* @__PURE__ */ React.createElement(QueryBuilderDateTimeContext, null, children)));
112
479
  };
113
480
  //#endregion
114
- export { datetimeRuleProcessorJsonLogic, datetimeValueProcessorNL, defaultDateTimeNLOperatorMap, getDatetimeJsonLogicOperations, getDatetimeRuleProcessorCEL, getDatetimeRuleProcessorCypher, getDatetimeRuleProcessorJSONata, getDatetimeRuleProcessorMongoDBQuery, getDatetimeRuleProcessorNL, getDatetimeRuleProcessorSPARQL, getDatetimeRuleProcessorSQL, getDatetimeValueProcessorANSI, getDatetimeValueProcessorMSSQL, getDatetimeValueProcessorMySQL, getDatetimeValueProcessorOracle, getDatetimeValueProcessorPostgreSQL };
481
+ 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 };
115
482
 
116
483
  //# sourceMappingURL=react-querybuilder_datetime.legacy-esm.js.map