@react-querybuilder/datetime 8.20.1 → 8.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -3
- package/dist/cjs/{getDatetimeRuleProcessorTanStackDB-CL79A1_x.js → getDatetimeRuleProcessorTanStackDB-CDEB9coD.js} +88 -218
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-CDEB9coD.js.map +1 -0
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-X6tZv7yV.js +2 -0
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-X6tZv7yV.js.map +1 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.development.d.ts +124 -260
- package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.d.ts +50 -51
- package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.js +3 -2
- package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.d.ts +50 -51
- package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.js +53 -26
- package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.js +11 -467
- package/dist/cjs/react-querybuilder_datetime.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.d.ts +53 -54
- package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.js +26 -144
- package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.d.ts +50 -51
- package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.js +3 -2
- package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.ui.d.ts +214 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.development.ui.js +466 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.development.ui.js.map +1 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.production.d.ts +124 -260
- package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.d.ts +50 -51
- package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.js +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.dayjs.d.ts +50 -51
- package/dist/cjs/react-querybuilder_datetime.cjs.production.dayjs.js +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.dayjs.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.js +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.jsdate.d.ts +53 -54
- package/dist/cjs/react-querybuilder_datetime.cjs.production.jsdate.js +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.jsdate.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.d.ts +50 -51
- package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.js +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.ui.d.ts +214 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.production.ui.js +2 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.production.ui.js.map +1 -0
- package/dist/cjs/rolldown-runtime-CMqjfN_6.js +1 -0
- package/dist/cjs/rolldown-runtime-D6vf50IK.js +28 -0
- package/dist/cjs/rqbDateTimeLibraryAPI.jsdate-BuSiVdk7.js +2 -0
- package/dist/cjs/rqbDateTimeLibraryAPI.jsdate-BuSiVdk7.js.map +1 -0
- package/dist/cjs/rqbDateTimeLibraryAPI.jsdate-C3jJb6ip.js +128 -0
- package/dist/cjs/rqbDateTimeLibraryAPI.jsdate-C3jJb6ip.js.map +1 -0
- package/dist/cjs/types-BKA1aoY6.d.ts +174 -0
- package/dist/cjs/ui.d.ts +1 -0
- package/dist/cjs/ui.js +6 -0
- package/dist/cjs/utils-DdBYGWHZ.js +2 -0
- package/dist/cjs/utils-DdBYGWHZ.js.map +1 -0
- package/dist/cjs/utils-_X97pUtk.js +166 -0
- package/dist/cjs/utils-_X97pUtk.js.map +1 -0
- package/dist/getDatetimeRuleProcessorTanStackDB-6K1DsuEV.mjs +2 -0
- package/dist/getDatetimeRuleProcessorTanStackDB-6K1DsuEV.mjs.map +1 -0
- package/dist/{getDatetimeRuleProcessorTanStackDB-BL8mbdbl.js → getDatetimeRuleProcessorTanStackDB-BrSD2e9G.js} +24 -198
- package/dist/getDatetimeRuleProcessorTanStackDB-BrSD2e9G.js.map +1 -0
- package/dist/{getDatetimeRuleProcessorTanStackDB-BcOC-o2A.mjs → getDatetimeRuleProcessorTanStackDB-DR8aYrUa.mjs} +24 -124
- package/dist/getDatetimeRuleProcessorTanStackDB-DR8aYrUa.mjs.map +1 -0
- package/dist/objectSpread2-MqoZ2hSz.js +187 -0
- package/dist/objectSpread2-MqoZ2hSz.js.map +1 -0
- package/dist/react-querybuilder_datetime.d.mts +124 -260
- package/dist/react-querybuilder_datetime.date-fns.d.mts +50 -51
- package/dist/react-querybuilder_datetime.date-fns.mjs +2 -1
- package/dist/react-querybuilder_datetime.date-fns.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.dayjs.d.mts +50 -51
- package/dist/react-querybuilder_datetime.dayjs.mjs +27 -2
- package/dist/react-querybuilder_datetime.dayjs.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.jsdate.d.mts +53 -54
- package/dist/react-querybuilder_datetime.jsdate.mjs +2 -120
- package/dist/react-querybuilder_datetime.jsdate.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.d.ts +124 -260
- package/dist/react-querybuilder_datetime.legacy-esm.date-fns.d.ts +50 -51
- package/dist/react-querybuilder_datetime.legacy-esm.date-fns.js +2 -1
- package/dist/react-querybuilder_datetime.legacy-esm.date-fns.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.dayjs.d.ts +50 -51
- package/dist/react-querybuilder_datetime.legacy-esm.dayjs.js +27 -2
- package/dist/react-querybuilder_datetime.legacy-esm.dayjs.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.js +5 -449
- package/dist/react-querybuilder_datetime.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.jsdate.d.ts +53 -54
- package/dist/react-querybuilder_datetime.legacy-esm.jsdate.js +2 -120
- package/dist/react-querybuilder_datetime.legacy-esm.jsdate.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.luxon.d.ts +50 -51
- package/dist/react-querybuilder_datetime.legacy-esm.luxon.js +2 -1
- package/dist/react-querybuilder_datetime.legacy-esm.luxon.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.ui.d.ts +214 -0
- package/dist/react-querybuilder_datetime.legacy-esm.ui.js +453 -0
- package/dist/react-querybuilder_datetime.legacy-esm.ui.js.map +1 -0
- package/dist/react-querybuilder_datetime.luxon.d.mts +50 -51
- package/dist/react-querybuilder_datetime.luxon.mjs +2 -1
- package/dist/react-querybuilder_datetime.luxon.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.mjs +5 -446
- package/dist/react-querybuilder_datetime.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.production.d.mts +124 -260
- package/dist/react-querybuilder_datetime.production.date-fns.d.mts +50 -51
- package/dist/react-querybuilder_datetime.production.date-fns.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.date-fns.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.production.dayjs.d.mts +50 -51
- package/dist/react-querybuilder_datetime.production.dayjs.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.dayjs.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.production.jsdate.d.mts +53 -54
- package/dist/react-querybuilder_datetime.production.jsdate.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.jsdate.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.production.luxon.d.mts +50 -51
- package/dist/react-querybuilder_datetime.production.luxon.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.luxon.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.production.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.production.ui.d.mts +214 -0
- package/dist/react-querybuilder_datetime.production.ui.mjs +2 -0
- package/dist/react-querybuilder_datetime.production.ui.mjs.map +1 -0
- package/dist/react-querybuilder_datetime.ui.d.mts +214 -0
- package/dist/react-querybuilder_datetime.ui.mjs +450 -0
- package/dist/react-querybuilder_datetime.ui.mjs.map +1 -0
- package/dist/rqbDateTimeLibraryAPI.jsdate-COp9qTw_.js +123 -0
- package/dist/rqbDateTimeLibraryAPI.jsdate-COp9qTw_.js.map +1 -0
- package/dist/rqbDateTimeLibraryAPI.jsdate-DxBmxW2C.mjs +2 -0
- package/dist/rqbDateTimeLibraryAPI.jsdate-DxBmxW2C.mjs.map +1 -0
- package/dist/rqbDateTimeLibraryAPI.jsdate-WHnzblie.mjs +123 -0
- package/dist/rqbDateTimeLibraryAPI.jsdate-WHnzblie.mjs.map +1 -0
- package/dist/types-BKA1aoY6.d.mts +174 -0
- package/dist/types-BKA1aoY6.d.ts +174 -0
- package/dist/utils-BAgUBdyf.mjs +113 -0
- package/dist/utils-BAgUBdyf.mjs.map +1 -0
- package/dist/utils-DA8aluCt.mjs +2 -0
- package/dist/utils-DA8aluCt.mjs.map +1 -0
- package/package.json +36 -17
- package/ui/package.json +4 -0
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-CL79A1_x.js.map +0 -1
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-DgUg_arY.js +0 -2
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-DgUg_arY.js.map +0 -1
- package/dist/cjs/rqbDateTimeLibraryAPI.dayjs-BfILPx88.js +0 -2
- package/dist/cjs/rqbDateTimeLibraryAPI.dayjs-BfILPx88.js.map +0 -1
- package/dist/cjs/rqbDateTimeLibraryAPI.dayjs-CzLh_zi9.js +0 -63
- package/dist/cjs/rqbDateTimeLibraryAPI.dayjs-CzLh_zi9.js.map +0 -1
- package/dist/cjs/types-XYMw0jFT.d.ts +0 -265
- package/dist/getDatetimeRuleProcessorTanStackDB-BL8mbdbl.js.map +0 -1
- package/dist/getDatetimeRuleProcessorTanStackDB-BcOC-o2A.mjs.map +0 -1
- package/dist/getDatetimeRuleProcessorTanStackDB-Dloxv6k2.mjs +0 -2
- package/dist/getDatetimeRuleProcessorTanStackDB-Dloxv6k2.mjs.map +0 -1
- package/dist/rqbDateTimeLibraryAPI.dayjs-BW7faYFD.mjs +0 -29
- package/dist/rqbDateTimeLibraryAPI.dayjs-BW7faYFD.mjs.map +0 -1
- package/dist/rqbDateTimeLibraryAPI.dayjs-BoX90aqZ.mjs +0 -2
- package/dist/rqbDateTimeLibraryAPI.dayjs-BoX90aqZ.mjs.map +0 -1
- package/dist/rqbDateTimeLibraryAPI.dayjs-Da4VXvFM.js +0 -29
- package/dist/rqbDateTimeLibraryAPI.dayjs-Da4VXvFM.js.map +0 -1
- package/dist/types-CdjHqQ0k.d.mts +0 -265
- package/dist/types-CdjHqQ0k.d.ts +0 -265
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
2
|
+
const require_utils = require("./utils-_X97pUtk.js");
|
|
3
|
+
const require_getDatetimeRuleProcessorTanStackDB = require("./getDatetimeRuleProcessorTanStackDB-CDEB9coD.js");
|
|
3
4
|
let luxon = require("luxon");
|
|
4
5
|
//#region src/rqbDateTimeLibraryAPI.luxon.ts
|
|
5
6
|
const toDateTime = (a) => typeof a === "string" ? luxon.DateTime.fromISO(a) : luxon.DateTime.fromJSDate(a);
|
|
@@ -19,7 +20,7 @@ const rqbDateTimeLibraryAPI = {
|
|
|
19
20
|
format: (d, fmt) => toDateTime(d).toFormat(fmt.replace("YYYY-MM-DD", iso8601DateOnly)),
|
|
20
21
|
isAfter: (a, b) => toDateTime(a) > toDateTime(b),
|
|
21
22
|
isBefore: (a, b) => toDateTime(a) < toDateTime(b),
|
|
22
|
-
isSame: (a, b) =>
|
|
23
|
+
isSame: (a, b) => require_utils.isISOStringDateOnly(a) || require_utils.isISOStringDateOnly(b) ? toDateTime(a).hasSame(toDateTime(b), "day") : +toDateTime(a) === +toDateTime(b),
|
|
23
24
|
isValid: (d) => toDateTime(d).isValid,
|
|
24
25
|
toDate: (d) => toDateTime(d).toJSDate(),
|
|
25
26
|
toISOString: (d) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-querybuilder_datetime.cjs.development.luxon.js","names":["DateTime","isISOStringDateOnly","getDatetimeJsonLogicOperations","getDatetimeRuleProcessorSQL","getDatetimeValueProcessorANSI","getDatetimeValueProcessorMSSQL","getDatetimeValueProcessorMySQL","getDatetimeValueProcessorOracle","getDatetimeValueProcessorPostgreSQL","getDatetimeRuleProcessorCEL","getDatetimeRuleProcessorJSONata","getDatetimeRuleProcessorMongoDBQuery","getDatetimeRuleProcessorNL","getDatetimeRuleProcessorCypher","getDatetimeRuleProcessorSPARQL","getDatetimeRuleProcessorParameterized","getDatetimeRuleProcessorSpEL","getDatetimeRuleProcessorLDAP","getDatetimeRuleProcessorGremlin","getDatetimeRuleProcessorPrisma","getDatetimeRuleProcessorSequelize","getDatetimeRuleProcessorDrizzle","getDatetimeRuleProcessorElasticSearch","getDatetimeRuleProcessorTanStackDB","getDatetimeRuleProcessorMongoDB"],"sources":["../../src/rqbDateTimeLibraryAPI.luxon.ts","../../src/index.luxon.ts"],"sourcesContent":["import { DateTime } from 'luxon';\nimport type { RelativeDateTimeUnit, RQBDateTimeLibraryAPI } from './types';\nimport { isISOStringDateOnly } from './utils';\n\nconst toDateTime = (a: string | Date) =>\n typeof a === 'string' ? DateTime.fromISO(a) : DateTime.fromJSDate(a);\nconst iso8601DateOnly = 'yyyy-MM-dd';\n\nconst durationKeyMap: Record<RelativeDateTimeUnit, string> = {\n minute: 'minutes',\n hour: 'hours',\n day: 'days',\n week: 'weeks',\n month: 'months',\n year: 'years',\n};\n\n/**\n * {@link RQBDateTimeLibraryAPI} for Luxon\n */\nexport const rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI = {\n format: (d, fmt) => toDateTime(d).toFormat(fmt.replace('YYYY-MM-DD', iso8601DateOnly)),\n isAfter: (a, b) => toDateTime(a) > toDateTime(b),\n isBefore: (a, b) => toDateTime(a) < toDateTime(b),\n isSame: (a, b) =>\n isISOStringDateOnly(a) || isISOStringDateOnly(b)\n ? toDateTime(a).hasSame(toDateTime(b), 'day')\n : +toDateTime(a) === +toDateTime(b),\n isValid: d => toDateTime(d).isValid,\n toDate: d => toDateTime(d).toJSDate(),\n toISOString: d => {\n const dToDate = toDateTime(d);\n return dToDate.isValid ? dToDate.toJSDate().toISOString() : '';\n },\n toISOStringDateOnly: d => {\n const dToDate = toDateTime(d);\n return dToDate.isValid ? dToDate.toFormat(iso8601DateOnly) : '';\n },\n startOf: (d, unit) => toDateTime(d).startOf(unit).toJSDate(),\n endOf: (d, unit) => toDateTime(d).endOf(unit).toJSDate(),\n add: (d, amount, unit) =>\n toDateTime(d)\n .plus({ [durationKeyMap[unit]]: amount })\n .toJSDate(),\n};\n","/**\n * Import from `\"@react-querybuilder/datetime/luxon\"` for enhanced date/time support using [Luxon](https://moment.github.io/luxon/).\n *\n * @module luxon\n */\n\nimport type { RuleProcessor, ValueProcessorByRule } from 'react-querybuilder';\nimport { getDatetimeJsonLogicOperations } from './getDatetimeJsonLogicOperations';\nimport { getDatetimeRuleProcessorCEL } from './getDatetimeRuleProcessorCEL';\nimport { getDatetimeRuleProcessorCypher } from './getDatetimeRuleProcessorCypher';\nimport { getDatetimeRuleProcessorDrizzle } from './getDatetimeRuleProcessorDrizzle';\nimport { getDatetimeRuleProcessorElasticSearch } from './getDatetimeRuleProcessorElasticSearch';\nimport { getDatetimeRuleProcessorGremlin } from './getDatetimeRuleProcessorGremlin';\nimport { getDatetimeRuleProcessorJSONata } from './getDatetimeRuleProcessorJSONata';\nimport { getDatetimeRuleProcessorLDAP } from './getDatetimeRuleProcessorLDAP';\nimport { getDatetimeRuleProcessorMongoDB } from './getDatetimeRuleProcessorMongoDB';\nimport { getDatetimeRuleProcessorMongoDBQuery } from './getDatetimeRuleProcessorMongoDBQuery';\nimport { getDatetimeRuleProcessorNL } from './getDatetimeRuleProcessorNL';\nimport { getDatetimeRuleProcessorParameterized } from './getDatetimeRuleProcessorParameterized';\nimport { getDatetimeRuleProcessorPrisma } from './getDatetimeRuleProcessorPrisma';\nimport { getDatetimeRuleProcessorSequelize } from './getDatetimeRuleProcessorSequelize';\nimport { getDatetimeRuleProcessorSPARQL } from './getDatetimeRuleProcessorSPARQL';\nimport { getDatetimeRuleProcessorSpEL } from './getDatetimeRuleProcessorSpEL';\nimport {\n getDatetimeRuleProcessorSQL,\n getDatetimeValueProcessorANSI,\n getDatetimeValueProcessorMSSQL,\n getDatetimeValueProcessorMySQL,\n getDatetimeValueProcessorOracle,\n getDatetimeValueProcessorPostgreSQL,\n} from './getDatetimeRuleProcessorSQL';\nimport { getDatetimeRuleProcessorTanStackDB } from './getDatetimeRuleProcessorTanStackDB';\nimport { rqbDateTimeLibraryAPI } from './rqbDateTimeLibraryAPI.luxon';\nimport type { RQBJsonLogicDateTimeOperations } from './types';\n\n/**\n * Custom JsonLogic date/time operations using Luxon\n */\nexport const jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations =\n getDatetimeJsonLogicOperations(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sql\" format using Luxon\n */\nexport const datetimeRuleProcessorSQL: RuleProcessor =\n getDatetimeRuleProcessorSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"ansi\" preset) using Luxon\n */\nexport const datetimeValueProcessorANSI: ValueProcessorByRule =\n getDatetimeValueProcessorANSI(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"mssql\" preset) using Luxon\n */\nexport const datetimeValueProcessorMSSQL: ValueProcessorByRule =\n getDatetimeValueProcessorMSSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"mysql\" preset) using Luxon\n */\nexport const datetimeValueProcessorMySQL: ValueProcessorByRule =\n getDatetimeValueProcessorMySQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"oracle\" preset) using Luxon\n */\nexport const datetimeValueProcessorOracle: ValueProcessorByRule =\n getDatetimeValueProcessorOracle(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"postgresql\" preset) using Luxon\n */\nexport const datetimeValueProcessorPostgreSQL: ValueProcessorByRule =\n getDatetimeValueProcessorPostgreSQL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"cel\" format using Luxon\n */\nexport const datetimeRuleProcessorCEL: ValueProcessorByRule =\n getDatetimeRuleProcessorCEL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"jsonata\" format using Luxon\n */\nexport const datetimeRuleProcessorJSONata: RuleProcessor =\n getDatetimeRuleProcessorJSONata(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"mongodb_query\" format using Luxon\n */\nexport const datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule =\n getDatetimeRuleProcessorMongoDBQuery(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"natural_language\" format using Luxon\n */\nexport const datetimeRuleProcessorNL: ValueProcessorByRule =\n getDatetimeRuleProcessorNL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"cypher\"/\"gql\" format using Luxon\n */\nexport const datetimeRuleProcessorCypher: ValueProcessorByRule =\n getDatetimeRuleProcessorCypher(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sparql\" format using Luxon\n */\nexport const datetimeRuleProcessorSPARQL: ValueProcessorByRule =\n getDatetimeRuleProcessorSPARQL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"parameterized\"/\"parameterized_named\" formats\n */\nexport const datetimeRuleProcessorParameterized: RuleProcessor =\n getDatetimeRuleProcessorParameterized(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"spel\" format\n */\nexport const datetimeRuleProcessorSpEL: RuleProcessor =\n getDatetimeRuleProcessorSpEL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"ldap\" format\n */\nexport const datetimeRuleProcessorLDAP: RuleProcessor =\n getDatetimeRuleProcessorLDAP(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"gremlin\" format\n */\nexport const datetimeRuleProcessorGremlin: RuleProcessor =\n getDatetimeRuleProcessorGremlin(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"prisma\" format\n */\nexport const datetimeRuleProcessorPrisma: RuleProcessor =\n getDatetimeRuleProcessorPrisma(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sequelize\" format\n */\nexport const datetimeRuleProcessorSequelize: RuleProcessor =\n getDatetimeRuleProcessorSequelize(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"drizzle\" format\n */\nexport const datetimeRuleProcessorDrizzle: RuleProcessor =\n getDatetimeRuleProcessorDrizzle(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"elasticsearch\" format\n */\nexport const datetimeRuleProcessorElasticSearch: RuleProcessor =\n getDatetimeRuleProcessorElasticSearch(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"tanstack_db\" format\n */\nexport const datetimeRuleProcessorTanStackDB: RuleProcessor =\n getDatetimeRuleProcessorTanStackDB(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for (deprecated) \"mongodb\" format\n */\nexport const datetimeRuleProcessorMongoDB: RuleProcessor =\n getDatetimeRuleProcessorMongoDB(rqbDateTimeLibraryAPI);\n\nexport * from './rqbDateTimeLibraryAPI.luxon';\n"],"mappings":";;;;AAIA,MAAM,cAAc,MAClB,OAAO,MAAM,WAAWA,MAAAA,SAAS,QAAQ,CAAC,IAAIA,MAAAA,SAAS,WAAW,CAAC;AACrE,MAAM,kBAAkB;AAExB,MAAM,iBAAuD;CAC3D,QAAQ;CACR,MAAM;CACN,KAAK;CACL,MAAM;CACN,OAAO;CACP,MAAM;AACR;;;;AAKA,MAAa,wBAA+C;CAC1D,SAAS,GAAG,QAAQ,WAAW,CAAC,CAAC,CAAC,SAAS,IAAI,QAAQ,cAAc,eAAe,CAAC;CACrF,UAAU,GAAG,MAAM,WAAW,CAAC,IAAI,WAAW,CAAC;CAC/C,WAAW,GAAG,MAAM,WAAW,CAAC,IAAI,WAAW,CAAC;CAChD,SAAS,GAAG,MACVC,2CAAAA,oBAAoB,CAAC,KAAKA,2CAAAA,oBAAoB,CAAC,IAC3C,WAAW,CAAC,CAAC,CAAC,QAAQ,WAAW,CAAC,GAAG,KAAK,IAC1C,CAAC,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC;CACtC,UAAS,MAAK,WAAW,CAAC,CAAC,CAAC;CAC5B,SAAQ,MAAK,WAAW,CAAC,CAAC,CAAC,SAAS;CACpC,cAAa,MAAK;EAChB,MAAM,UAAU,WAAW,CAAC;EAC5B,OAAO,QAAQ,UAAU,QAAQ,SAAS,CAAC,CAAC,YAAY,IAAI;CAC9D;CACA,sBAAqB,MAAK;EACxB,MAAM,UAAU,WAAW,CAAC;EAC5B,OAAO,QAAQ,UAAU,QAAQ,SAAS,eAAe,IAAI;CAC/D;CACA,UAAU,GAAG,SAAS,WAAW,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,SAAS;CAC3D,QAAQ,GAAG,SAAS,WAAW,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,SAAS;CACvD,MAAM,GAAG,QAAQ,SACf,WAAW,CAAC,CAAC,CACV,KAAK,GAAG,eAAe,QAAQ,OAAO,CAAC,CAAC,CACxC,SAAS;AAChB;;;;;;ACNA,MAAa,8BACXC,2CAAAA,+BAA+B,qBAAqB;;;;AAKtD,MAAa,2BACXC,2CAAAA,4BAA4B,qBAAqB;;;;AAInD,MAAa,6BACXC,2CAAAA,8BAA8B,qBAAqB;;;;AAIrD,MAAa,8BACXC,2CAAAA,+BAA+B,qBAAqB;;;;AAItD,MAAa,8BACXC,2CAAAA,+BAA+B,qBAAqB;;;;AAItD,MAAa,+BACXC,2CAAAA,gCAAgC,qBAAqB;;;;AAIvD,MAAa,mCACXC,2CAAAA,oCAAoC,qBAAqB;;;;AAK3D,MAAa,2BACXC,2CAAAA,4BAA4B,qBAAqB;;;;AAKnD,MAAa,+BACXC,2CAAAA,gCAAgC,qBAAqB;;;;AAKvD,MAAa,oCACXC,2CAAAA,qCAAqC,qBAAqB;;;;AAK5D,MAAa,0BACXC,2CAAAA,2BAA2B,qBAAqB;;;;AAKlD,MAAa,8BACXC,2CAAAA,+BAA+B,qBAAqB;;;;AAKtD,MAAa,8BACXC,2CAAAA,+BAA+B,qBAAqB;;;;AAKtD,MAAa,qCACXC,2CAAAA,sCAAsC,qBAAqB;;;;AAK7D,MAAa,4BACXC,2CAAAA,6BAA6B,qBAAqB;;;;AAKpD,MAAa,4BACXC,2CAAAA,6BAA6B,qBAAqB;;;;AAKpD,MAAa,+BACXC,2CAAAA,gCAAgC,qBAAqB;;;;AAKvD,MAAa,8BACXC,2CAAAA,+BAA+B,qBAAqB;;;;AAKtD,MAAa,iCACXC,2CAAAA,kCAAkC,qBAAqB;;;;AAKzD,MAAa,+BACXC,2CAAAA,gCAAgC,qBAAqB;;;;AAKvD,MAAa,qCACXC,2CAAAA,sCAAsC,qBAAqB;;;;AAK7D,MAAa,kCACXC,2CAAAA,mCAAmC,qBAAqB;;;;AAK1D,MAAa,+BACXC,2CAAAA,gCAAgC,qBAAqB"}
|
|
1
|
+
{"version":3,"file":"react-querybuilder_datetime.cjs.development.luxon.js","names":["DateTime","isISOStringDateOnly","getDatetimeJsonLogicOperations","getDatetimeRuleProcessorSQL","getDatetimeValueProcessorANSI","getDatetimeValueProcessorMSSQL","getDatetimeValueProcessorMySQL","getDatetimeValueProcessorOracle","getDatetimeValueProcessorPostgreSQL","getDatetimeRuleProcessorCEL","getDatetimeRuleProcessorJSONata","getDatetimeRuleProcessorMongoDBQuery","getDatetimeRuleProcessorNL","getDatetimeRuleProcessorCypher","getDatetimeRuleProcessorSPARQL","getDatetimeRuleProcessorParameterized","getDatetimeRuleProcessorSpEL","getDatetimeRuleProcessorLDAP","getDatetimeRuleProcessorGremlin","getDatetimeRuleProcessorPrisma","getDatetimeRuleProcessorSequelize","getDatetimeRuleProcessorDrizzle","getDatetimeRuleProcessorElasticSearch","getDatetimeRuleProcessorTanStackDB","getDatetimeRuleProcessorMongoDB"],"sources":["../../src/rqbDateTimeLibraryAPI.luxon.ts","../../src/index.luxon.ts"],"sourcesContent":["import { DateTime } from 'luxon';\nimport type { RelativeDateTimeUnit, RQBDateTimeLibraryAPI } from './types';\nimport { isISOStringDateOnly } from './utils';\n\nconst toDateTime = (a: string | Date) =>\n typeof a === 'string' ? DateTime.fromISO(a) : DateTime.fromJSDate(a);\nconst iso8601DateOnly = 'yyyy-MM-dd';\n\nconst durationKeyMap: Record<RelativeDateTimeUnit, string> = {\n minute: 'minutes',\n hour: 'hours',\n day: 'days',\n week: 'weeks',\n month: 'months',\n year: 'years',\n};\n\n/**\n * {@link RQBDateTimeLibraryAPI} for Luxon\n */\nexport const rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI = {\n format: (d, fmt) => toDateTime(d).toFormat(fmt.replace('YYYY-MM-DD', iso8601DateOnly)),\n isAfter: (a, b) => toDateTime(a) > toDateTime(b),\n isBefore: (a, b) => toDateTime(a) < toDateTime(b),\n isSame: (a, b) =>\n isISOStringDateOnly(a) || isISOStringDateOnly(b)\n ? toDateTime(a).hasSame(toDateTime(b), 'day')\n : +toDateTime(a) === +toDateTime(b),\n isValid: d => toDateTime(d).isValid,\n toDate: d => toDateTime(d).toJSDate(),\n toISOString: d => {\n const dToDate = toDateTime(d);\n return dToDate.isValid ? dToDate.toJSDate().toISOString() : '';\n },\n toISOStringDateOnly: d => {\n const dToDate = toDateTime(d);\n return dToDate.isValid ? dToDate.toFormat(iso8601DateOnly) : '';\n },\n startOf: (d, unit) => toDateTime(d).startOf(unit).toJSDate(),\n endOf: (d, unit) => toDateTime(d).endOf(unit).toJSDate(),\n add: (d, amount, unit) =>\n toDateTime(d)\n .plus({ [durationKeyMap[unit]]: amount })\n .toJSDate(),\n};\n","/**\n * Import from `\"@react-querybuilder/datetime/luxon\"` for enhanced date/time support using [Luxon](https://moment.github.io/luxon/).\n *\n * @module luxon\n */\n\nimport type { RuleProcessor, ValueProcessorByRule } from '@react-querybuilder/core';\nimport { getDatetimeJsonLogicOperations } from './getDatetimeJsonLogicOperations';\nimport { getDatetimeRuleProcessorCEL } from './getDatetimeRuleProcessorCEL';\nimport { getDatetimeRuleProcessorCypher } from './getDatetimeRuleProcessorCypher';\nimport { getDatetimeRuleProcessorDrizzle } from './getDatetimeRuleProcessorDrizzle';\nimport { getDatetimeRuleProcessorElasticSearch } from './getDatetimeRuleProcessorElasticSearch';\nimport { getDatetimeRuleProcessorGremlin } from './getDatetimeRuleProcessorGremlin';\nimport { getDatetimeRuleProcessorJSONata } from './getDatetimeRuleProcessorJSONata';\nimport { getDatetimeRuleProcessorLDAP } from './getDatetimeRuleProcessorLDAP';\nimport { getDatetimeRuleProcessorMongoDB } from './getDatetimeRuleProcessorMongoDB';\nimport { getDatetimeRuleProcessorMongoDBQuery } from './getDatetimeRuleProcessorMongoDBQuery';\nimport { getDatetimeRuleProcessorNL } from './getDatetimeRuleProcessorNL';\nimport { getDatetimeRuleProcessorParameterized } from './getDatetimeRuleProcessorParameterized';\nimport { getDatetimeRuleProcessorPrisma } from './getDatetimeRuleProcessorPrisma';\nimport { getDatetimeRuleProcessorSequelize } from './getDatetimeRuleProcessorSequelize';\nimport { getDatetimeRuleProcessorSPARQL } from './getDatetimeRuleProcessorSPARQL';\nimport { getDatetimeRuleProcessorSpEL } from './getDatetimeRuleProcessorSpEL';\nimport {\n getDatetimeRuleProcessorSQL,\n getDatetimeValueProcessorANSI,\n getDatetimeValueProcessorMSSQL,\n getDatetimeValueProcessorMySQL,\n getDatetimeValueProcessorOracle,\n getDatetimeValueProcessorPostgreSQL,\n} from './getDatetimeRuleProcessorSQL';\nimport { getDatetimeRuleProcessorTanStackDB } from './getDatetimeRuleProcessorTanStackDB';\nimport { rqbDateTimeLibraryAPI } from './rqbDateTimeLibraryAPI.luxon';\nimport type { RQBJsonLogicDateTimeOperations } from './types';\n\n/**\n * Custom JsonLogic date/time operations using Luxon\n */\nexport const jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations =\n getDatetimeJsonLogicOperations(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sql\" format using Luxon\n */\nexport const datetimeRuleProcessorSQL: RuleProcessor =\n getDatetimeRuleProcessorSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"ansi\" preset) using Luxon\n */\nexport const datetimeValueProcessorANSI: ValueProcessorByRule =\n getDatetimeValueProcessorANSI(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"mssql\" preset) using Luxon\n */\nexport const datetimeValueProcessorMSSQL: ValueProcessorByRule =\n getDatetimeValueProcessorMSSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"mysql\" preset) using Luxon\n */\nexport const datetimeValueProcessorMySQL: ValueProcessorByRule =\n getDatetimeValueProcessorMySQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"oracle\" preset) using Luxon\n */\nexport const datetimeValueProcessorOracle: ValueProcessorByRule =\n getDatetimeValueProcessorOracle(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"postgresql\" preset) using Luxon\n */\nexport const datetimeValueProcessorPostgreSQL: ValueProcessorByRule =\n getDatetimeValueProcessorPostgreSQL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"cel\" format using Luxon\n */\nexport const datetimeRuleProcessorCEL: ValueProcessorByRule =\n getDatetimeRuleProcessorCEL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"jsonata\" format using Luxon\n */\nexport const datetimeRuleProcessorJSONata: RuleProcessor =\n getDatetimeRuleProcessorJSONata(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"mongodb_query\" format using Luxon\n */\nexport const datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule =\n getDatetimeRuleProcessorMongoDBQuery(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"natural_language\" format using Luxon\n */\nexport const datetimeRuleProcessorNL: ValueProcessorByRule =\n getDatetimeRuleProcessorNL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"cypher\"/\"gql\" format using Luxon\n */\nexport const datetimeRuleProcessorCypher: ValueProcessorByRule =\n getDatetimeRuleProcessorCypher(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sparql\" format using Luxon\n */\nexport const datetimeRuleProcessorSPARQL: ValueProcessorByRule =\n getDatetimeRuleProcessorSPARQL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"parameterized\"/\"parameterized_named\" formats\n */\nexport const datetimeRuleProcessorParameterized: RuleProcessor =\n getDatetimeRuleProcessorParameterized(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"spel\" format\n */\nexport const datetimeRuleProcessorSpEL: RuleProcessor =\n getDatetimeRuleProcessorSpEL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"ldap\" format\n */\nexport const datetimeRuleProcessorLDAP: RuleProcessor =\n getDatetimeRuleProcessorLDAP(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"gremlin\" format\n */\nexport const datetimeRuleProcessorGremlin: RuleProcessor =\n getDatetimeRuleProcessorGremlin(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"prisma\" format\n */\nexport const datetimeRuleProcessorPrisma: RuleProcessor =\n getDatetimeRuleProcessorPrisma(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sequelize\" format\n */\nexport const datetimeRuleProcessorSequelize: RuleProcessor =\n getDatetimeRuleProcessorSequelize(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"drizzle\" format\n */\nexport const datetimeRuleProcessorDrizzle: RuleProcessor =\n getDatetimeRuleProcessorDrizzle(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"elasticsearch\" format\n */\nexport const datetimeRuleProcessorElasticSearch: RuleProcessor =\n getDatetimeRuleProcessorElasticSearch(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"tanstack_db\" format\n */\nexport const datetimeRuleProcessorTanStackDB: RuleProcessor =\n getDatetimeRuleProcessorTanStackDB(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for (deprecated) \"mongodb\" format\n */\nexport const datetimeRuleProcessorMongoDB: RuleProcessor =\n getDatetimeRuleProcessorMongoDB(rqbDateTimeLibraryAPI);\n\nexport * from './rqbDateTimeLibraryAPI.luxon';\n"],"mappings":";;;;;AAIA,MAAM,cAAc,MAClB,OAAO,MAAM,WAAWA,MAAAA,SAAS,QAAQ,CAAC,IAAIA,MAAAA,SAAS,WAAW,CAAC;AACrE,MAAM,kBAAkB;AAExB,MAAM,iBAAuD;CAC3D,QAAQ;CACR,MAAM;CACN,KAAK;CACL,MAAM;CACN,OAAO;CACP,MAAM;AACR;;;;AAKA,MAAa,wBAA+C;CAC1D,SAAS,GAAG,QAAQ,WAAW,CAAC,CAAC,CAAC,SAAS,IAAI,QAAQ,cAAc,eAAe,CAAC;CACrF,UAAU,GAAG,MAAM,WAAW,CAAC,IAAI,WAAW,CAAC;CAC/C,WAAW,GAAG,MAAM,WAAW,CAAC,IAAI,WAAW,CAAC;CAChD,SAAS,GAAG,MACVC,cAAAA,oBAAoB,CAAC,KAAKA,cAAAA,oBAAoB,CAAC,IAC3C,WAAW,CAAC,CAAC,CAAC,QAAQ,WAAW,CAAC,GAAG,KAAK,IAC1C,CAAC,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC;CACtC,UAAS,MAAK,WAAW,CAAC,CAAC,CAAC;CAC5B,SAAQ,MAAK,WAAW,CAAC,CAAC,CAAC,SAAS;CACpC,cAAa,MAAK;EAChB,MAAM,UAAU,WAAW,CAAC;EAC5B,OAAO,QAAQ,UAAU,QAAQ,SAAS,CAAC,CAAC,YAAY,IAAI;CAC9D;CACA,sBAAqB,MAAK;EACxB,MAAM,UAAU,WAAW,CAAC;EAC5B,OAAO,QAAQ,UAAU,QAAQ,SAAS,eAAe,IAAI;CAC/D;CACA,UAAU,GAAG,SAAS,WAAW,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,SAAS;CAC3D,QAAQ,GAAG,SAAS,WAAW,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,SAAS;CACvD,MAAM,GAAG,QAAQ,SACf,WAAW,CAAC,CAAC,CACV,KAAK,GAAG,eAAe,QAAQ,OAAO,CAAC,CAAC,CACxC,SAAS;AAChB;;;;;;ACNA,MAAa,8BACXC,2CAAAA,+BAA+B,qBAAqB;;;;AAKtD,MAAa,2BACXC,2CAAAA,4BAA4B,qBAAqB;;;;AAInD,MAAa,6BACXC,2CAAAA,8BAA8B,qBAAqB;;;;AAIrD,MAAa,8BACXC,2CAAAA,+BAA+B,qBAAqB;;;;AAItD,MAAa,8BACXC,2CAAAA,+BAA+B,qBAAqB;;;;AAItD,MAAa,+BACXC,2CAAAA,gCAAgC,qBAAqB;;;;AAIvD,MAAa,mCACXC,2CAAAA,oCAAoC,qBAAqB;;;;AAK3D,MAAa,2BACXC,2CAAAA,4BAA4B,qBAAqB;;;;AAKnD,MAAa,+BACXC,2CAAAA,gCAAgC,qBAAqB;;;;AAKvD,MAAa,oCACXC,2CAAAA,qCAAqC,qBAAqB;;;;AAK5D,MAAa,0BACXC,2CAAAA,2BAA2B,qBAAqB;;;;AAKlD,MAAa,8BACXC,2CAAAA,+BAA+B,qBAAqB;;;;AAKtD,MAAa,8BACXC,2CAAAA,+BAA+B,qBAAqB;;;;AAKtD,MAAa,qCACXC,2CAAAA,sCAAsC,qBAAqB;;;;AAK7D,MAAa,4BACXC,2CAAAA,6BAA6B,qBAAqB;;;;AAKpD,MAAa,4BACXC,2CAAAA,6BAA6B,qBAAqB;;;;AAKpD,MAAa,+BACXC,2CAAAA,gCAAgC,qBAAqB;;;;AAKvD,MAAa,8BACXC,2CAAAA,+BAA+B,qBAAqB;;;;AAKtD,MAAa,iCACXC,2CAAAA,kCAAkC,qBAAqB;;;;AAKzD,MAAa,+BACXC,2CAAAA,gCAAgC,qBAAqB;;;;AAKvD,MAAa,qCACXC,2CAAAA,sCAAsC,qBAAqB;;;;AAK7D,MAAa,kCACXC,2CAAAA,mCAAmC,qBAAqB;;;;AAK1D,MAAa,+BACXC,2CAAAA,gCAAgC,qBAAqB"}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { _ as RelativeDateTimeAnchor, b as RelativeDateTimeValue, i as RQBDateTimeLibraryAPI, y as RelativeDateTimeUnit } from "./types-BKA1aoY6.js";
|
|
2
|
+
import { FullOption } from "@react-querybuilder/core";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { ComponentType, ReactNode } from "react";
|
|
5
|
+
import { FullOperator, FullOption as FullOption$1, QueryBuilderContextProvider, ValueEditorProps } from "react-querybuilder";
|
|
6
|
+
//#region src/ui/types.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Customizable content/labels for the absolute/relative mode toggle rendered by
|
|
9
|
+
* {@link toggleModeController}. The default glyphs come from CSS pseudo-elements, so
|
|
10
|
+
* `absoluteContent`/`relativeContent` are only needed to override them (e.g. to render
|
|
11
|
+
* an icon component or localized text).
|
|
12
|
+
*/
|
|
13
|
+
interface RelativeDateTimeToggleLabels {
|
|
14
|
+
/** Accessible label (`aria-label`) for the toggle button. */
|
|
15
|
+
label?: string;
|
|
16
|
+
/** Tooltip shown while in absolute mode (clicking switches to relative). */
|
|
17
|
+
absoluteTitle?: string;
|
|
18
|
+
/** Tooltip shown while in relative mode (clicking switches to absolute). */
|
|
19
|
+
relativeTitle?: string;
|
|
20
|
+
/** Custom content rendered while in absolute mode. Defaults to a CSS glyph. */
|
|
21
|
+
absoluteContent?: ReactNode;
|
|
22
|
+
/** Custom content rendered while in relative mode. Defaults to a CSS glyph. */
|
|
23
|
+
relativeContent?: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Props passed to a {@link RelativeDateTimeModeController}'s `ModeControl` component —
|
|
27
|
+
* the affordance (e.g. a toggle button) that switches a rule between absolute and
|
|
28
|
+
* relative date/time entry.
|
|
29
|
+
*/
|
|
30
|
+
interface RelativeDateTimeModeControlProps {
|
|
31
|
+
/** Whether the rule is currently in relative mode. */
|
|
32
|
+
isRelative: boolean;
|
|
33
|
+
/** Switches the rule between absolute and relative mode. */
|
|
34
|
+
setMode: (mode: "absolute" | "relative") => void;
|
|
35
|
+
/** The value editor's schema (for theme-aware rendering). */
|
|
36
|
+
schema: ValueEditorProps["schema"];
|
|
37
|
+
/** Whether the control is disabled. */
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
/** Class name applied to the control. */
|
|
40
|
+
className?: string;
|
|
41
|
+
/** Title/tooltip from the value editor (fallback when labels omit titles). */
|
|
42
|
+
title?: string;
|
|
43
|
+
/** Test ID from the value editor. */
|
|
44
|
+
testID?: string;
|
|
45
|
+
/** Resolved toggle labels (merged with defaults). */
|
|
46
|
+
labels: Required<RelativeDateTimeToggleLabels>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A pluggable strategy that governs how a user switches between absolute and relative
|
|
50
|
+
* date/time entry in the {@link RelativeDateTimeValueEditor}. The stored value shape is
|
|
51
|
+
* unaffected — a controller only decides the current mode and (optionally) renders an
|
|
52
|
+
* affordance to change it.
|
|
53
|
+
*
|
|
54
|
+
* Ships with {@link toggleModeController} (the zero-config default); build an
|
|
55
|
+
* operator-driven controller with {@link createOperatorModeController}, or supply a custom
|
|
56
|
+
* object to fully control the UX.
|
|
57
|
+
*/
|
|
58
|
+
interface RelativeDateTimeModeController {
|
|
59
|
+
/** Derives the current mode from the rule (its operator and/or value). */
|
|
60
|
+
isRelative: (props: ValueEditorProps) => boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Optional affordance rendered inside the editor to switch modes. Omit it (as the
|
|
63
|
+
* operator-driven controller does) when the mode is selected elsewhere, e.g. via the
|
|
64
|
+
* operator selector.
|
|
65
|
+
*/
|
|
66
|
+
ModeControl?: ComponentType<RelativeDateTimeModeControlProps>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Configuration for the {@link RelativeDateTimeValueEditor}, supplied as props to
|
|
70
|
+
* {@link QueryBuilderDateTime} (or via the relative date/time config context). Every
|
|
71
|
+
* field is optional; omitting all of them yields the zero-config toggle experience.
|
|
72
|
+
*/
|
|
73
|
+
interface RelativeDateTimeEditorConfig {
|
|
74
|
+
/** Strategy for switching between absolute and relative modes. Defaults to {@link toggleModeController}. */
|
|
75
|
+
modeController?: RelativeDateTimeModeController;
|
|
76
|
+
/** Anchor (reference-point) options. Defaults to {@link defaultRelativeDateTimeAnchors}. */
|
|
77
|
+
anchors?: FullOption$1<RelativeDateTimeAnchor>[];
|
|
78
|
+
/** Unit options. Defaults to {@link defaultRelativeDateTimeUnits}. */
|
|
79
|
+
units?: FullOption$1<RelativeDateTimeUnit>[];
|
|
80
|
+
/** Content/labels for the absolute/relative toggle. */
|
|
81
|
+
toggleLabels?: RelativeDateTimeToggleLabels;
|
|
82
|
+
/**
|
|
83
|
+
* Date/time library adapter used by the value editor to parse/validate the rule value
|
|
84
|
+
* for the native date input. Defaults to the plain JavaScript adapter. Pass the adapter
|
|
85
|
+
* matching your chosen entry point (e.g. from `@react-querybuilder/datetime/luxon`) so the
|
|
86
|
+
* editor interprets values consistently with the rule processors.
|
|
87
|
+
*/
|
|
88
|
+
dateTimeAPI?: RQBDateTimeLibraryAPI;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Maps operator names that are used only to _signal_ relative mode (see
|
|
92
|
+
* {@link createOperatorModeController}) to the real comparison operator that should be used
|
|
93
|
+
* when exporting via `formatQuery`. Supplied through `context.relativeOperatorMap`. Operators
|
|
94
|
+
* not present in the map are exported unchanged.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* formatQuery(query, {
|
|
99
|
+
* format: 'sql',
|
|
100
|
+
* ruleProcessor: datetimeRuleProcessorSQL,
|
|
101
|
+
* context: { relativeOperatorMap: { relativeEq: '=' } },
|
|
102
|
+
* });
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
type RelativeOperatorMap = Record<string, string>;
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/ui/QueryBuilderDateTime.d.ts
|
|
108
|
+
declare const DateTimeValueEditor: (props: ValueEditorProps) => React.JSX.Element;
|
|
109
|
+
declare const QueryBuilderDateTimeContext: QueryBuilderContextProvider;
|
|
110
|
+
/** Props for {@link QueryBuilderDateTime}: {@link RelativeDateTimeEditorConfig} plus children. */
|
|
111
|
+
interface QueryBuilderDateTimeProps extends RelativeDateTimeEditorConfig {
|
|
112
|
+
children?: React.ReactNode;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Context provider enabling date/time features for a wrapped
|
|
116
|
+
* {@link react-querybuilder!QueryBuilder QueryBuilder}: renders the relative-capable
|
|
117
|
+
* {@link RelativeDateTimeValueEditor} for date/time fields, and accepts optional
|
|
118
|
+
* {@link RelativeDateTimeEditorConfig} props (mode controller, anchor/unit options, and
|
|
119
|
+
* toggle labels). With no props it provides the zero-config toggle experience.
|
|
120
|
+
*
|
|
121
|
+
* @group Components
|
|
122
|
+
*/
|
|
123
|
+
declare const QueryBuilderDateTime: ({ children, modeController, anchors, units, toggleLabels, dateTimeAPI }: QueryBuilderDateTimeProps) => React.JSX.Element;
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/ui/RelativeDateTimeConfigContext.d.ts
|
|
126
|
+
/** Fully-resolved relative date/time editor config (no optional fields). */
|
|
127
|
+
interface ResolvedRelativeDateTimeConfig {
|
|
128
|
+
modeController: RelativeDateTimeModeController;
|
|
129
|
+
anchors: FullOption$1<RelativeDateTimeAnchor>[];
|
|
130
|
+
units: FullOption$1<RelativeDateTimeUnit>[];
|
|
131
|
+
toggleLabels: Required<RelativeDateTimeToggleLabels>;
|
|
132
|
+
dateTimeAPI: RQBDateTimeLibraryAPI;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Carries {@link RelativeDateTimeEditorConfig} to the {@link RelativeDateTimeValueEditor}.
|
|
136
|
+
* Provided by {@link QueryBuilderDateTime}; defaults apply when no provider is present.
|
|
137
|
+
*/
|
|
138
|
+
declare const RelativeDateTimeConfigContext: React.Context<RelativeDateTimeEditorConfig>;
|
|
139
|
+
/** Reads the relative date/time editor config from context, merged with defaults. */
|
|
140
|
+
declare const useRelativeDateTimeConfig: () => ResolvedRelativeDateTimeConfig;
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region src/ui/RelativeDateTimeValueEditor.d.ts
|
|
143
|
+
/**
|
|
144
|
+
* Value editor with support for {@link RelativeDateTimeValue relative date/time values}
|
|
145
|
+
* (e.g. "three months ago" or "the beginning of this year"). How the user switches
|
|
146
|
+
* between absolute and relative modes is delegated to a pluggable
|
|
147
|
+
* {@link RelativeDateTimeModeController} (default: a compact toggle), supplied via
|
|
148
|
+
* {@link QueryBuilderDateTime}. In relative mode it renders anchor + signed offset + unit
|
|
149
|
+
* selectors; the unit selector is hidden when the offset is `0`.
|
|
150
|
+
*
|
|
151
|
+
* For the `between`/`notBetween` operators it renders two independent value editors (each
|
|
152
|
+
* with its own mode affordance) and stores the bounds as a two-element array, so the from
|
|
153
|
+
* and to bounds can independently be absolute or relative.
|
|
154
|
+
*
|
|
155
|
+
* @group Components
|
|
156
|
+
*/
|
|
157
|
+
declare const RelativeDateTimeValueEditor: (props: ValueEditorProps) => React.JSX.Element;
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/ui/relativeDateTimeConstants.d.ts
|
|
160
|
+
/**
|
|
161
|
+
* Class name applied to the absolute/relative mode toggle button. Package-local (not part
|
|
162
|
+
* of the core `standardClassnames`) to avoid coupling core to this extension.
|
|
163
|
+
*/
|
|
164
|
+
declare const relativeDateTimeToggleClassName = "rule-value-dateTimeRelative-toggle";
|
|
165
|
+
/** Default value applied when switching a rule to relative mode. */
|
|
166
|
+
declare const defaultRelativeDateTimeValue: RelativeDateTimeValue;
|
|
167
|
+
/** Default anchor (reference-point) options for the relative date/time editor. */
|
|
168
|
+
declare const defaultRelativeDateTimeAnchors: FullOption<RelativeDateTimeAnchor>[];
|
|
169
|
+
/** Default unit options for the relative date/time editor. */
|
|
170
|
+
declare const defaultRelativeDateTimeUnits: FullOption<RelativeDateTimeUnit>[];
|
|
171
|
+
/** Default labels/content for the absolute/relative mode toggle. */
|
|
172
|
+
declare const defaultRelativeDateTimeToggleLabels: Required<RelativeDateTimeToggleLabels>;
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/ui/relativeDateTimeModeControllers.d.ts
|
|
175
|
+
/**
|
|
176
|
+
* Compact absolute/relative toggle rendered by {@link toggleModeController}. A
|
|
177
|
+
* `role="switch"` button whose default glyph is supplied by CSS (keyed on
|
|
178
|
+
* `aria-checked`); override via the `toggleLabels` config.
|
|
179
|
+
*
|
|
180
|
+
* @group Components
|
|
181
|
+
*/
|
|
182
|
+
declare const RelativeDateTimeModeToggle: ({ isRelative, setMode, disabled, className, labels }: RelativeDateTimeModeControlProps) => React.JSX.Element;
|
|
183
|
+
/**
|
|
184
|
+
* Zero-config default {@link RelativeDateTimeModeController}: derives the mode from the
|
|
185
|
+
* value shape and renders a compact toggle button to switch between absolute and
|
|
186
|
+
* relative entry.
|
|
187
|
+
*/
|
|
188
|
+
declare const toggleModeController: RelativeDateTimeModeController;
|
|
189
|
+
/**
|
|
190
|
+
* Builds an operator-driven {@link RelativeDateTimeModeController} that derives the mode
|
|
191
|
+
* from the rule's operator. Pass the operator name(s) (or a predicate) that should put the
|
|
192
|
+
* editor in relative mode. No toggle is rendered — the operator selector is the mode
|
|
193
|
+
* affordance.
|
|
194
|
+
*
|
|
195
|
+
* NOTE: the chosen operators only signal _mode_; the rule's value remains a
|
|
196
|
+
* {@link RelativeDateTimeValue}. For these operators to export correctly, map each one to a
|
|
197
|
+
* real comparison operator via `context.relativeOperatorMap` when calling `formatQuery`
|
|
198
|
+
* (e.g. `{ relativeEq: '=' }`). See the documentation.
|
|
199
|
+
*/
|
|
200
|
+
declare const createOperatorModeController: (relativeOperators: string[] | ((operator: string) => boolean)) => RelativeDateTimeModeController;
|
|
201
|
+
interface FieldWithOperators {
|
|
202
|
+
operators?: FullOperator[];
|
|
203
|
+
[key: string]: unknown;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Appends the given `operators` to each field's `operators` list, so the operator-driven
|
|
207
|
+
* controller (see {@link createOperatorModeController}) has an operator to switch into
|
|
208
|
+
* relative mode. Fields without an explicit `operators` list fall back to the core
|
|
209
|
+
* `defaultOperators`.
|
|
210
|
+
*/
|
|
211
|
+
declare const withRelativeOperators: <F extends FieldWithOperators>(fields: F[], operators: FullOperator[]) => F[];
|
|
212
|
+
//#endregion
|
|
213
|
+
export { DateTimeValueEditor, QueryBuilderDateTime, QueryBuilderDateTimeContext, QueryBuilderDateTimeProps, RelativeDateTimeConfigContext, RelativeDateTimeEditorConfig, RelativeDateTimeModeControlProps, RelativeDateTimeModeController, RelativeDateTimeModeToggle, RelativeDateTimeToggleLabels, RelativeDateTimeValueEditor, RelativeOperatorMap, ResolvedRelativeDateTimeConfig, createOperatorModeController, defaultRelativeDateTimeAnchors, defaultRelativeDateTimeToggleLabels, defaultRelativeDateTimeUnits, defaultRelativeDateTimeValue, relativeDateTimeToggleClassName, toggleModeController, useRelativeDateTimeConfig, withRelativeOperators };
|
|
214
|
+
//# sourceMappingURL=react-querybuilder_datetime.cjs.development.ui.d.ts.map
|