@react-querybuilder/datetime 8.18.0 → 8.19.1
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/dist/cjs/getDatetimeRuleProcessorTanStackDB-CL79A1_x.js +1208 -0
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-CL79A1_x.js.map +1 -0
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-DgUg_arY.js +2 -0
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-DgUg_arY.js.map +1 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.development.d.ts +214 -8
- package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.d.ts +46 -2
- package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.js +93 -15
- 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 +46 -2
- package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.js +70 -59
- package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.js +482 -71
- package/dist/cjs/react-querybuilder_datetime.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.d.ts +46 -2
- package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.js +129 -15
- package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.d.ts +46 -2
- package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.js +81 -15
- package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.d.ts +214 -8
- package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.d.ts +46 -2
- 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 +46 -2
- 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 +46 -2
- 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 +46 -2
- 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/rqbDateTimeLibraryAPI.dayjs-BfILPx88.js +2 -0
- package/dist/cjs/rqbDateTimeLibraryAPI.dayjs-BfILPx88.js.map +1 -0
- package/dist/cjs/rqbDateTimeLibraryAPI.dayjs-CzLh_zi9.js +63 -0
- package/dist/cjs/rqbDateTimeLibraryAPI.dayjs-CzLh_zi9.js.map +1 -0
- package/dist/cjs/types-XYMw0jFT.d.ts +265 -0
- package/dist/datetime-layout.css +1 -0
- package/dist/datetime-layout.css.map +1 -0
- package/dist/datetime-layout.scss +3 -0
- package/dist/datetime.css +1 -0
- package/dist/datetime.css.map +1 -0
- package/dist/datetime.scss +1 -0
- package/dist/getDatetimeRuleProcessorTanStackDB-BcOC-o2A.mjs +1029 -0
- package/dist/getDatetimeRuleProcessorTanStackDB-BcOC-o2A.mjs.map +1 -0
- package/dist/getDatetimeRuleProcessorTanStackDB-Dloxv6k2.mjs +2 -0
- package/dist/getDatetimeRuleProcessorTanStackDB-Dloxv6k2.mjs.map +1 -0
- package/dist/getDatetimeRuleProcessorTanStackDB-LDwhMJg0.js +1035 -0
- package/dist/getDatetimeRuleProcessorTanStackDB-LDwhMJg0.js.map +1 -0
- package/dist/react-querybuilder_datetime.d.mts +214 -8
- package/dist/react-querybuilder_datetime.date-fns.d.mts +46 -2
- package/dist/react-querybuilder_datetime.date-fns.mjs +71 -4
- package/dist/react-querybuilder_datetime.date-fns.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.dayjs.d.mts +46 -2
- package/dist/react-querybuilder_datetime.dayjs.mjs +47 -24
- package/dist/react-querybuilder_datetime.dayjs.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.jsdate.d.mts +46 -2
- package/dist/react-querybuilder_datetime.jsdate.mjs +106 -3
- package/dist/react-querybuilder_datetime.jsdate.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.d.ts +214 -8
- package/dist/react-querybuilder_datetime.legacy-esm.date-fns.d.ts +46 -2
- package/dist/react-querybuilder_datetime.legacy-esm.date-fns.js +71 -4
- package/dist/react-querybuilder_datetime.legacy-esm.date-fns.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.dayjs.d.ts +46 -2
- package/dist/react-querybuilder_datetime.legacy-esm.dayjs.js +47 -24
- package/dist/react-querybuilder_datetime.legacy-esm.dayjs.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.js +425 -58
- package/dist/react-querybuilder_datetime.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.jsdate.d.ts +46 -2
- package/dist/react-querybuilder_datetime.legacy-esm.jsdate.js +106 -3
- package/dist/react-querybuilder_datetime.legacy-esm.jsdate.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.luxon.d.ts +46 -2
- package/dist/react-querybuilder_datetime.legacy-esm.luxon.js +58 -3
- package/dist/react-querybuilder_datetime.legacy-esm.luxon.js.map +1 -1
- package/dist/react-querybuilder_datetime.luxon.d.mts +46 -2
- package/dist/react-querybuilder_datetime.luxon.mjs +58 -3
- package/dist/react-querybuilder_datetime.luxon.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.mjs +443 -57
- package/dist/react-querybuilder_datetime.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.production.d.mts +214 -8
- package/dist/react-querybuilder_datetime.production.date-fns.d.mts +46 -2
- 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 +46 -2
- 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 +46 -2
- 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 +46 -2
- 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/rqbDateTimeLibraryAPI.dayjs-BW7faYFD.mjs +29 -0
- package/dist/rqbDateTimeLibraryAPI.dayjs-BW7faYFD.mjs.map +1 -0
- package/dist/rqbDateTimeLibraryAPI.dayjs-BoX90aqZ.mjs +2 -0
- package/dist/rqbDateTimeLibraryAPI.dayjs-BoX90aqZ.mjs.map +1 -0
- package/dist/rqbDateTimeLibraryAPI.dayjs-DvFSxPKu.js +29 -0
- package/dist/rqbDateTimeLibraryAPI.dayjs-DvFSxPKu.js.map +1 -0
- package/dist/styles/_layout.scss +30 -0
- package/dist/styles/_root.scss +5 -0
- package/dist/styles/_variables.scss +8 -0
- package/dist/types-CdjHqQ0k.d.mts +265 -0
- package/dist/types-CdjHqQ0k.d.ts +265 -0
- package/package.json +28 -13
- package/dist/cjs/getDatetimeRuleProcessorSQL-Cca9pzSn.js +0 -2
- package/dist/cjs/getDatetimeRuleProcessorSQL-Cca9pzSn.js.map +0 -1
- package/dist/cjs/getDatetimeRuleProcessorSQL-CrA2ZrSe.js +0 -563
- package/dist/cjs/getDatetimeRuleProcessorSQL-CrA2ZrSe.js.map +0 -1
- package/dist/cjs/types-c6_k1Tpr.d.ts +0 -105
- package/dist/getDatetimeRuleProcessorSQL-Crw01Jo-.js +0 -482
- package/dist/getDatetimeRuleProcessorSQL-Crw01Jo-.js.map +0 -1
- package/dist/getDatetimeRuleProcessorSQL-CvGKzojM.mjs +0 -2
- package/dist/getDatetimeRuleProcessorSQL-CvGKzojM.mjs.map +0 -1
- package/dist/getDatetimeRuleProcessorSQL-Nz_XjNeY.mjs +0 -468
- package/dist/getDatetimeRuleProcessorSQL-Nz_XjNeY.mjs.map +0 -1
- package/dist/types-c6_k1Tpr.d.mts +0 -105
- package/dist/types-c6_k1Tpr.d.ts +0 -105
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-querybuilder_datetime.legacy-esm.js","names":[],"sources":["../src/datetimeRuleProcessorJsonLogic.ts","../src/getDatetimeRuleProcessorJSONata.ts"],"sourcesContent":["import type { DefaultOperatorName, JsonLogicVar, RuleProcessor } from 'react-querybuilder';\nimport { defaultRuleProcessorJsonLogic, toArray } from 'react-querybuilder';\nimport type { RQBDateTimeJsonLogic } from './types';\nimport { processIsDateField } from './utils';\n\nconst dateOperationMap = {\n '!=': 'dateNotOn',\n '<': 'dateBefore',\n '<=': 'dateOnOrBefore',\n '=': 'dateOn',\n '>': 'dateAfter',\n '>=': 'dateOnOrAfter',\n between: 'dateBetween',\n in: 'dateIn',\n notBetween: 'dateNotBetween',\n notIn: 'dateNotIn',\n} as const satisfies Partial<Record<DefaultOperatorName, string>>;\n\n/**\n * Date/time rule processor for use by {@link @react-querybuilder/core!formatQuery formatQuery}\n * with the \"jsonlogic\" format.\n *\n * Note: Unlike other date/time rule processors from this library, this function does\n * not require a date/time library API. Instead, the date/time library API is used by\n * {@link getDatetimeJsonLogicOperations} during the evaluation process.\n */\nexport const datetimeRuleProcessorJsonLogic: RuleProcessor = (\n rule,\n options\n): RQBDateTimeJsonLogic => {\n const opts = options ?? /* v8 ignore start -- @preserve */ {} /* v8 ignore stop -- @preserve */;\n\n if (!processIsDateField(opts.context?.isDateField, rule, opts)) {\n return defaultRuleProcessorJsonLogic(rule, opts);\n }\n\n const { field, operator, value, valueSource } = rule;\n const valueIsField = valueSource === 'field';\n const fieldObject: JsonLogicVar = { var: field };\n const maybeFieldRenderer = (v: string) => (valueIsField ? { var: `${v}` } : v);\n\n switch (operator) {\n case '<':\n case '<=':\n case '=':\n case '!=':\n case '>':\n case '>=':\n return {\n [dateOperationMap[operator]]: [fieldObject, maybeFieldRenderer(value)],\n } as RQBDateTimeJsonLogic;\n\n case 'in':\n case 'notIn': {\n const valueAsArray = toArray(value).map(v => maybeFieldRenderer(v));\n return { [dateOperationMap[operator]]: [fieldObject, valueAsArray] } as RQBDateTimeJsonLogic;\n }\n\n case 'between':\n case 'notBetween': {\n const valueAsArray = toArray(value).map(v => maybeFieldRenderer(v));\n\n if (valueAsArray.length < 2) return false;\n\n return {\n [dateOperationMap[operator]]: [valueAsArray[0], fieldObject, valueAsArray[1]],\n } as RQBDateTimeJsonLogic;\n }\n }\n\n return defaultRuleProcessorJsonLogic(rule, options);\n};\n","import type { RuleProcessor } from 'react-querybuilder';\nimport {\n defaultRuleProcessorJSONata,\n getQuotedFieldName,\n nullOrUndefinedOrEmpty,\n toArray,\n} from 'react-querybuilder';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { processIsDateField } from './utils';\n\nconst shouldNegate = (op: string) => /^(does)?not/i.test(op);\n\nconst negate = (clause: string, neg: boolean) => (neg ? `$not(${clause})` : `${clause}`);\n\n/**\n * Generates a rule processor with date/time features for use by\n * {@link @react-querybuilder/core!formatQuery formatQuery} with the \"jsonata\" format.\n */\nexport const getDatetimeRuleProcessorJSONata =\n (apiFns: RQBDateTimeLibraryAPI): RuleProcessor =>\n (rule, options) => {\n const opts = options ?? /* v8 ignore start -- @preserve */ {} /* v8 ignore stop -- @preserve */;\n const { context = {} } = opts;\n\n // v8 ignore next\n const { quoteFieldNamesWith = ['', ''] as [string, string], fieldIdentifierSeparator = '' } =\n opts;\n const { field, operator, value, valueSource } = rule;\n\n if (!processIsDateField(context.isDateField, rule, opts)) {\n return defaultRuleProcessorJSONata(rule, opts);\n }\n\n const valueIsField = valueSource === 'field';\n\n const fldToMs = (f: string) =>\n `$toMillis(${getQuotedFieldName(f, { quoteFieldNamesWith, fieldIdentifierSeparator })})`;\n const valToMs = (v: string | Date) => `$toMillis(\"${apiFns.toISOString(v)}\")`;\n\n switch (operator) {\n case '<':\n case '<=':\n case '=':\n case '!=':\n case '>':\n case '>=':\n return `${fldToMs(field)} ${operator} ${valueIsField ? fldToMs(value) : valToMs(value)}`;\n }\n\n const valueAsArray: string[] = toArray(rule.value, { retainEmptyStrings: false });\n const valueAsDateArray = valueAsArray\n .map(v => apiFns.toDate(v))\n .filter(dateVal => apiFns.isValid(dateVal));\n\n switch (operator) {\n case 'in':\n case 'notIn': {\n if (valueIsField) {\n if (valueAsArray.length === 0) return '';\n return negate(\n `${fldToMs(field)} in [${valueAsArray.map(val => fldToMs(val)).join(', ')}]`,\n shouldNegate(operator)\n );\n }\n if (valueAsDateArray.length === 0) return '';\n return negate(\n `${fldToMs(field)} in [${valueAsDateArray.map(val => valToMs(val)).join(', ')}]`,\n shouldNegate(operator)\n );\n }\n\n case 'between':\n case 'notBetween': {\n if (\n valueAsArray.length < 2 ||\n nullOrUndefinedOrEmpty(valueAsArray[0]) ||\n nullOrUndefinedOrEmpty(valueAsArray[1]) ||\n (!valueIsField && valueAsDateArray.length < 2)\n ) {\n return '';\n }\n\n if (valueIsField) {\n const [firstValue, secondValue] = valueAsArray;\n const expression = `${fldToMs(field)} >= ${fldToMs(firstValue)} and ${fldToMs(field)} <= ${fldToMs(secondValue)}`;\n return operator === 'between' ? `(${expression})` : negate(expression, true);\n }\n\n const [first, second] = valueAsDateArray;\n const [firstDate, secondDate] = apiFns.isBefore(first, second)\n ? [first, second]\n : [second, first];\n const expression = `${fldToMs(field)} >= ${valToMs(firstDate)} and ${fldToMs(field)} <= ${valToMs(secondDate)}`;\n return operator === 'between' ? `(${expression})` : negate(expression, true);\n }\n }\n\n return defaultRuleProcessorJSONata(rule, opts);\n };\n"],"mappings":";;;AAKA,MAAM,mBAAmB;CACvB,MAAM;CACN,KAAK;CACL,MAAM;CACN,KAAK;CACL,KAAK;CACL,MAAM;CACN,SAAS;CACT,IAAI;CACJ,YAAY;CACZ,OAAO;AACT;;;;;;;;;AAUA,MAAa,kCACX,MACA,YACyB;;CACzB,MAAM,OAAO,YAAA,QAAA,YAAA,KAAA,IAAA,8CAA8C,CAAC;CAE5D,IAAI,CAAC,oBAAA,gBAAmB,KAAK,aAAA,QAAA,kBAAA,KAAA,IAAA,KAAA,IAAA,cAAS,aAAa,MAAM,IAAI,GAC3D,OAAO,8BAA8B,MAAM,IAAI;CAGjD,MAAM,EAAE,OAAO,UAAU,OAAO,gBAAgB;CAChD,MAAM,eAAe,gBAAgB;CACrC,MAAM,cAA4B,EAAE,KAAK,MAAM;CAC/C,MAAM,sBAAsB,MAAe,eAAe,EAAE,KAAK,GAAG,IAAI,IAAI;CAE5E,QAAQ,UAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,MACH,OAAO,GACJ,iBAAiB,YAAY,CAAC,aAAa,mBAAmB,KAAK,CAAC,EACvE;EAEF,KAAK;EACL,KAAK,SAAS;GACZ,MAAM,eAAe,QAAQ,KAAK,EAAE,KAAI,MAAK,mBAAmB,CAAC,CAAC;GAClE,OAAO,GAAG,iBAAiB,YAAY,CAAC,aAAa,YAAY,EAAE;EACrE;EAEA,KAAK;EACL,KAAK,cAAc;GACjB,MAAM,eAAe,QAAQ,KAAK,EAAE,KAAI,MAAK,mBAAmB,CAAC,CAAC;GAElE,IAAI,aAAa,S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KAAK,EAAE,OAAO,aAAa,KAAI,QAAO,QAAQ,GAAG,CAAC,EAAE,KAAK,IAAI,EAAE,IAC1E,aAAa,QAAQ,CACvB;GACF;GACA,IAAI,iBAAiB,WAAW,GAAG,OAAO;GAC1C,OAAO,OACL,GAAG,QAAQ,KAAK,EAAE,OAAO,iBAAiB,KAAI,QAAO,QAAQ,GAAG,CAAC,EAAE,KAAK,IAAI,EAAE,IAC9E,aAAa,QAAQ,CACvB;EAGF,KAAK;EACL,KAAK,cAAc;GACjB,IACE,aAAa,SAAS,KACtB,uBAAuB,aAAa,EAAE,KACtC,uBAAuB,aAAa,EAAE,KACrC,CAAC,gBAAgB,iBAAiB,SAAS,GAE5C,OAAO;GAGT,IAAI,cAAc;IAChB,MAAM,CAAC,YAAY,eAAe;IAClC,MAAM,aAAa,GAAG,QAAQ,KAAK,EAAE,MAAM,QAAQ,UAAU,EAAE,OAAO,QAAQ,KAAK,EAAE,MAAM,QAAQ,WAAW;IAC9G,OAAO,aAAa,YAAY,IAAI,WAAW,KAAK,OAAO,YAAY,IAAI;GAC7E;GAEA,MAAM,CAAC,OAAO,UAAU;GACxB,MAAM,CAAC,WAAW,cAAc,OAAO,SAAS,OAAO,MAAM,IACzD,CAAC,OAAO,MAAM,IACd,CAAC,QAAQ,KAAK;GAClB,MAAM,aAAa,GAAG,QAAQ,KAAK,EAAE,MAAM,QAAQ,SAAS,EAAE,OAAO,QAAQ,KAAK,EAAE,MAAM,QAAQ,UAAU;GAC5G,OAAO,aAAa,YAAY,IAAI,WAAW,KAAK,OAAO,YAAY,IAAI;EAC7E;CACF;CAEA,OAAO,4BAA4B,MAAM,IAAI;AAC/C"}
|
|
1
|
+
{"version":3,"file":"react-querybuilder_datetime.legacy-esm.js","names":["defaultDateTimeAPI"],"sources":["../src/datetimeRuleProcessorJsonLogic.ts","../src/InheritedValueEditorContext.ts","../src/relativeDateTimeConstants.ts","../src/relativeDateTimeModeControllers.tsx","../src/RelativeDateTimeConfigContext.tsx","../src/RelativeDateTimeValueEditor.tsx","../src/QueryBuilderDateTime.tsx"],"sourcesContent":["import type { DefaultOperatorName, JsonLogicVar, RuleProcessor } from 'react-querybuilder';\nimport { defaultRuleProcessorJsonLogic, toArray } from 'react-querybuilder';\nimport type { RQBJsonLogicDateRelative, RQBDateTimeJsonLogic } from './types';\nimport {\n isDateOnlyDatatype,\n isRelativeDateTimeValue,\n processIsDateField,\n resolveDatetimeOperator,\n} from './utils';\n\nconst dateOperationMap = {\n '!=': 'dateNotOn',\n '<': 'dateBefore',\n '<=': 'dateOnOrBefore',\n '=': 'dateOn',\n '>': 'dateAfter',\n '>=': 'dateOnOrAfter',\n between: 'dateBetween',\n in: 'dateIn',\n notBetween: 'dateNotBetween',\n notIn: 'dateNotIn',\n} as const satisfies Partial<Record<DefaultOperatorName, string>>;\n\n/**\n * Date/time rule processor for use by {@link @react-querybuilder/core!formatQuery formatQuery}\n * with the \"jsonlogic\" format.\n *\n * Note: Unlike other date/time rule processors from this library, this function does\n * not require a date/time library API. Instead, the date/time library API is used by\n * {@link getDatetimeJsonLogicOperations} during the evaluation process.\n */\nexport const datetimeRuleProcessorJsonLogic: RuleProcessor = (\n rule,\n options\n): RQBDateTimeJsonLogic => {\n const opts = options ?? /* v8 ignore start -- @preserve */ {} /* v8 ignore stop -- @preserve */;\n\n if (!processIsDateField(opts.context?.isDateField, rule, opts)) {\n return defaultRuleProcessorJsonLogic(rule, opts);\n }\n\n const { field, value, valueSource } = rule;\n const operator = resolveDatetimeOperator(rule, opts);\n const valueIsField = valueSource === 'field';\n const fieldObject: JsonLogicVar = { var: field };\n const dateOnly = isDateOnlyDatatype(opts?.fieldData?.datatype);\n // Relative values stay \"live\": emit a `dateRelative` op resolved at evaluation time.\n // Field-source values are field names and render as `var` references.\n const renderValue = (v: unknown) => {\n if (valueIsField) return { var: `${v}` };\n if (isRelativeDateTimeValue(v)) {\n return {\n dateRelative: [v.anchor, v.offset, v.unit, dateOnly],\n } as RQBJsonLogicDateRelative;\n }\n return v as string;\n };\n\n switch (operator) {\n case '<':\n case '<=':\n case '=':\n case '!=':\n case '>':\n case '>=':\n return {\n [dateOperationMap[operator]]: [fieldObject, renderValue(value)],\n } as RQBDateTimeJsonLogic;\n\n case 'in':\n case 'notIn': {\n const valueAsArray = (Array.isArray(value) ? value : toArray(value)).map(renderValue);\n return { [dateOperationMap[operator]]: [fieldObject, valueAsArray] } as RQBDateTimeJsonLogic;\n }\n\n case 'between':\n case 'notBetween': {\n const valueAsArray = (Array.isArray(value) ? value : toArray(value)).map(renderValue);\n\n if (valueAsArray.length < 2) return false;\n\n return {\n [dateOperationMap[operator]]: [valueAsArray[0], fieldObject, valueAsArray[1]],\n } as RQBDateTimeJsonLogic;\n }\n }\n\n return defaultRuleProcessorJsonLogic(rule, options);\n};\n","import type { Context } from 'react';\nimport { createContext, useContext } from 'react';\nimport type { ValueEditorProps } from 'react-querybuilder';\n\n/**\n * Holds the value editor inherited from an outer (compat package) context provider,\n * captured _before_ {@link QueryBuilderDateTime} overrides it. Lets the date/time value\n * editor delegate non-date fields (and absolute date inputs) to the compat editor instead\n * of the bare default {@link react-querybuilder!ValueEditor ValueEditor}. `null` = none\n * inherited (fall back to default).\n */\nexport const InheritedValueEditorContext: Context<React.ComponentType<ValueEditorProps> | null> =\n createContext<React.ComponentType<ValueEditorProps> | null>(null);\n\n/** Inherited (compat) value editor, or `null` if none. See {@link InheritedValueEditorContext}. */\nexport const useInheritedValueEditor = (): React.ComponentType<ValueEditorProps> | null =>\n useContext(InheritedValueEditorContext);\n","import type { FullOption } from 'react-querybuilder';\nimport type {\n RelativeDateTimeAnchor,\n RelativeDateTimeToggleLabels,\n RelativeDateTimeUnit,\n RelativeDateTimeValue,\n} from './types';\n\n/**\n * Class name applied to the absolute/relative mode toggle button. Package-local (not part\n * of the core `standardClassnames`) to avoid coupling core to this extension.\n */\nexport const relativeDateTimeToggleClassName = 'rule-value-dateTimeRelative-toggle';\n\n/** Default value applied when switching a rule to relative mode. */\nexport const defaultRelativeDateTimeValue: RelativeDateTimeValue = {\n mode: 'relative',\n anchor: 'now',\n offset: 0,\n unit: 'day',\n};\n\n/** Default anchor (reference-point) options for the relative date/time editor. */\nexport const defaultRelativeDateTimeAnchors: FullOption<RelativeDateTimeAnchor>[] = [\n { name: 'now', value: 'now', label: 'now' },\n { name: 'startOfDay', value: 'startOfDay', label: 'start of day' },\n { name: 'endOfDay', value: 'endOfDay', label: 'end of day' },\n { name: 'startOfWeek', value: 'startOfWeek', label: 'start of week' },\n { name: 'endOfWeek', value: 'endOfWeek', label: 'end of week' },\n { name: 'startOfMonth', value: 'startOfMonth', label: 'start of month' },\n { name: 'endOfMonth', value: 'endOfMonth', label: 'end of month' },\n { name: 'startOfYear', value: 'startOfYear', label: 'start of year' },\n { name: 'endOfYear', value: 'endOfYear', label: 'end of year' },\n];\n\n/** Default unit options for the relative date/time editor. */\nexport const defaultRelativeDateTimeUnits: FullOption<RelativeDateTimeUnit>[] = [\n { name: 'minute', value: 'minute', label: 'minute(s)' },\n { name: 'hour', value: 'hour', label: 'hour(s)' },\n { name: 'day', value: 'day', label: 'day(s)' },\n { name: 'week', value: 'week', label: 'week(s)' },\n { name: 'month', value: 'month', label: 'month(s)' },\n { name: 'year', value: 'year', label: 'year(s)' },\n];\n\n/** Default labels/content for the absolute/relative mode toggle. */\nexport const defaultRelativeDateTimeToggleLabels: Required<RelativeDateTimeToggleLabels> = {\n label: 'Toggle relative date/time',\n absoluteTitle: 'Absolute date/time (click for relative)',\n relativeTitle: 'Relative date/time (click for absolute)',\n // Empty by default; the CSS pseudo-element renders the glyph based on `aria-checked`.\n absoluteContent: '',\n relativeContent: '',\n};\n","import * as React from 'react';\nimport type { FullOperator } from 'react-querybuilder';\nimport { clsx, defaultOperators } from 'react-querybuilder';\nimport { relativeDateTimeToggleClassName } from './relativeDateTimeConstants';\nimport type { RelativeDateTimeModeController, RelativeDateTimeModeControlProps } from './types';\nimport { isRelativeDateTimeValue } from './utils';\n\n/**\n * Compact absolute/relative toggle rendered by {@link toggleModeController}. A\n * `role=\"switch\"` button whose default glyph is supplied by CSS (keyed on\n * `aria-checked`); override via the `toggleLabels` config.\n *\n * @group Components\n */\nexport const RelativeDateTimeModeToggle = ({\n isRelative,\n setMode,\n disabled,\n className,\n labels,\n}: RelativeDateTimeModeControlProps): React.JSX.Element => {\n const onClick = React.useCallback(\n () => setMode(isRelative ? 'absolute' : 'relative'),\n [setMode, isRelative]\n );\n\n return (\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={isRelative}\n aria-label={labels.label}\n title={isRelative ? labels.relativeTitle : labels.absoluteTitle}\n disabled={disabled}\n className={clsx(relativeDateTimeToggleClassName, className)}\n onClick={onClick}>\n {isRelative ? labels.relativeContent : labels.absoluteContent}\n </button>\n );\n};\n\n/**\n * Zero-config default {@link RelativeDateTimeModeController}: derives the mode from the\n * value shape and renders a compact toggle button to switch between absolute and\n * relative entry.\n */\nexport const toggleModeController: RelativeDateTimeModeController = {\n isRelative: props => isRelativeDateTimeValue(props.value),\n ModeControl: RelativeDateTimeModeToggle,\n};\n\n/**\n * Builds an operator-driven {@link RelativeDateTimeModeController} that derives the mode\n * from the rule's operator. Pass the operator name(s) (or a predicate) that should put the\n * editor in relative mode. No toggle is rendered — the operator selector is the mode\n * affordance.\n *\n * NOTE: the chosen operators only signal _mode_; the rule's value remains a\n * {@link RelativeDateTimeValue}. For these operators to export correctly, map each one to a\n * real comparison operator via `context.relativeOperatorMap` when calling `formatQuery`\n * (e.g. `{ relativeEq: '=' }`). See the documentation.\n */\nexport const createOperatorModeController = (\n relativeOperators: string[] | ((operator: string) => boolean)\n): RelativeDateTimeModeController => ({\n isRelative: props =>\n typeof relativeOperators === 'function'\n ? relativeOperators(props.operator)\n : relativeOperators.includes(props.operator),\n});\n\ninterface FieldWithOperators {\n operators?: FullOperator[];\n [key: string]: unknown;\n}\n\n/**\n * Appends the given `operators` to each field's `operators` list, so the operator-driven\n * controller (see {@link createOperatorModeController}) has an operator to switch into\n * relative mode. Fields without an explicit `operators` list fall back to the core\n * `defaultOperators`.\n */\nexport const withRelativeOperators = <F extends FieldWithOperators>(\n fields: F[],\n operators: FullOperator[]\n): F[] =>\n fields.map(field => ({\n ...field,\n operators: [...(field.operators ?? (defaultOperators as FullOperator[])), ...operators],\n }));\n","import * as React from 'react';\nimport { createContext, useContext, useMemo } from 'react';\nimport type { FullOption } from 'react-querybuilder';\nimport {\n defaultRelativeDateTimeAnchors,\n defaultRelativeDateTimeToggleLabels,\n defaultRelativeDateTimeUnits,\n} from './relativeDateTimeConstants';\nimport { toggleModeController } from './relativeDateTimeModeControllers';\nimport { rqbDateTimeLibraryAPI as defaultDateTimeAPI } from './rqbDateTimeLibraryAPI.dayjs';\nimport type {\n RelativeDateTimeAnchor,\n RelativeDateTimeEditorConfig,\n RelativeDateTimeModeController,\n RelativeDateTimeToggleLabels,\n RelativeDateTimeUnit,\n RQBDateTimeLibraryAPI,\n} from './types';\n\n/** Fully-resolved relative date/time editor config (no optional fields). */\nexport interface ResolvedRelativeDateTimeConfig {\n modeController: RelativeDateTimeModeController;\n anchors: FullOption<RelativeDateTimeAnchor>[];\n units: FullOption<RelativeDateTimeUnit>[];\n toggleLabels: Required<RelativeDateTimeToggleLabels>;\n dateTimeAPI: RQBDateTimeLibraryAPI;\n}\n\n/**\n * Carries {@link RelativeDateTimeEditorConfig} to the {@link RelativeDateTimeValueEditor}.\n * Provided by {@link QueryBuilderDateTime}; defaults apply when no provider is present.\n */\nexport const RelativeDateTimeConfigContext: React.Context<RelativeDateTimeEditorConfig> =\n createContext<RelativeDateTimeEditorConfig>({});\n\n/** Reads the relative date/time editor config from context, merged with defaults. */\nexport const useRelativeDateTimeConfig = (): ResolvedRelativeDateTimeConfig => {\n const config = useContext(RelativeDateTimeConfigContext);\n return useMemo(\n () => ({\n modeController: config.modeController ?? toggleModeController,\n anchors: config.anchors ?? defaultRelativeDateTimeAnchors,\n units: config.units ?? defaultRelativeDateTimeUnits,\n toggleLabels: { ...defaultRelativeDateTimeToggleLabels, ...config.toggleLabels },\n dateTimeAPI: config.dateTimeAPI ?? defaultDateTimeAPI,\n }),\n [config]\n );\n};\n","import * as React from 'react';\nimport { useCallback, useMemo } from 'react';\nimport type { FullField, Path, ValueEditorProps, ValueSelectorProps } from 'react-querybuilder';\nimport {\n clsx,\n parseNumber,\n standardClassnames,\n toArray,\n useValueEditor,\n ValueEditor,\n} from 'react-querybuilder';\nimport { useInheritedValueEditor } from './InheritedValueEditorContext';\nimport { DateTimeValueEditor } from './QueryBuilderDateTime';\nimport type { ResolvedRelativeDateTimeConfig } from './RelativeDateTimeConfigContext';\nimport { useRelativeDateTimeConfig } from './RelativeDateTimeConfigContext';\nimport { defaultRelativeDateTimeValue } from './relativeDateTimeConstants';\nimport type { RelativeDateTimeAnchor, RelativeDateTimeUnit, RelativeDateTimeValue } from './types';\nimport { isRelativeDateTimeValue } from './utils';\n\nconst dummyPath: Path = [];\nconst dummyFieldData: FullField = { name: '', value: '', label: '' };\n\n/** Splits a value into the from/to pair used by between/notBetween, object-safe. */\nconst toBetweenArray = (value: unknown): unknown[] =>\n Array.isArray(value) ? value : isRelativeDateTimeValue(value) ? [value] : toArray(value);\n\ninterface RelativeDateTimeSingleValueEditorProps {\n /** The original value editor props (for mode derivation and absolute rendering). */\n baseProps: ValueEditorProps;\n /** The value for this slot (the whole value, or one element of a between pair). */\n value: unknown;\n /** Emits a new value for this slot. */\n onChange: (value: unknown) => void;\n /** Operator passed to the absolute editor (forced to `=` for between slots). */\n absoluteOperator: string;\n config: ResolvedRelativeDateTimeConfig;\n SelectorComponent: React.ComponentType<ValueSelectorProps>;\n valueListItemClassName?: string;\n numericSchema: ValueEditorProps['schema'];\n}\n\n/**\n * Renders a single absolute-or-relative date/time value: a mode affordance (per the\n * controller) plus either an absolute date input or anchor + signed offset + unit\n * selectors. Reused once per slot so between/notBetween can mix bounds (e.g. an absolute\n * \"from\" and a relative \"to\").\n */\nconst RelativeDateTimeSingleValueEditor = ({\n baseProps,\n value,\n onChange,\n absoluteOperator,\n config,\n SelectorComponent,\n valueListItemClassName,\n numericSchema,\n}: RelativeDateTimeSingleValueEditorProps): React.JSX.Element => {\n const { schema, disabled, title, testID } = baseProps;\n const { modeController, anchors, units, toggleLabels } = config;\n\n // Themed numeric offset input from the inherited (compat) editor when present.\n const NumericEditor = useInheritedValueEditor() ?? ValueEditor;\n\n const isRelative = modeController.isRelative({ ...baseProps, value });\n const relValue: RelativeDateTimeValue = isRelativeDateTimeValue(value)\n ? value\n : defaultRelativeDateTimeValue;\n\n const handleSetMode = useCallback(\n (mode: 'absolute' | 'relative') =>\n onChange(mode === 'relative' ? defaultRelativeDateTimeValue : ''),\n [onChange]\n );\n\n const handleChangeAnchor = useCallback(\n (anchor: string) => onChange({ ...relValue, anchor: anchor as RelativeDateTimeAnchor }),\n [onChange, relValue]\n );\n\n const handleChangeOffset = useCallback(\n (offset: unknown) =>\n onChange({\n ...relValue,\n offset: (parseNumber(offset, { parseNumbers: true }) as number) || 0,\n }),\n [onChange, relValue]\n );\n\n const handleChangeUnit = useCallback(\n (unit: string) => onChange({ ...relValue, unit: unit as RelativeDateTimeUnit }),\n [onChange, relValue]\n );\n\n const { ModeControl } = modeController;\n\n return (\n <React.Fragment>\n {ModeControl && (\n <ModeControl\n isRelative={isRelative}\n setMode={handleSetMode}\n schema={schema}\n disabled={disabled}\n className={valueListItemClassName}\n title={title}\n testID={testID}\n labels={toggleLabels}\n />\n )}\n {isRelative ? (\n <React.Fragment>\n <SelectorComponent\n schema={schema}\n testID={testID}\n title={title}\n className={valueListItemClassName}\n handleOnChange={handleChangeAnchor}\n disabled={disabled}\n value={relValue.anchor}\n options={anchors}\n multiple={false}\n listsAsArrays={false}\n path={dummyPath}\n level={0}\n />\n <NumericEditor\n skipHook\n testID={testID}\n inputType=\"number\"\n title={title}\n className={valueListItemClassName}\n disabled={disabled}\n handleOnChange={handleChangeOffset}\n field={''}\n operator={''}\n value={relValue.offset}\n valueSource={'value'}\n fieldData={dummyFieldData}\n schema={numericSchema}\n path={dummyPath}\n level={0}\n rule={{ field: '', operator: '=', value: relValue.offset }}\n />\n {relValue.offset !== 0 && (\n <SelectorComponent\n schema={schema}\n testID={testID}\n title={title}\n className={valueListItemClassName}\n handleOnChange={handleChangeUnit}\n disabled={disabled}\n value={relValue.unit}\n options={units}\n multiple={false}\n listsAsArrays={false}\n path={dummyPath}\n level={0}\n />\n )}\n </React.Fragment>\n ) : (\n <DateTimeValueEditor\n {...baseProps}\n operator={absoluteOperator}\n value={value}\n handleOnChange={onChange}\n className={standardClassnames.value}\n />\n )}\n </React.Fragment>\n );\n};\n\n/**\n * Value editor with support for {@link RelativeDateTimeValue relative date/time values}\n * (e.g. \"three months ago\" or \"the beginning of this year\"). How the user switches\n * between absolute and relative modes is delegated to a pluggable\n * {@link RelativeDateTimeModeController} (default: a compact toggle), supplied via\n * {@link QueryBuilderDateTime}. In relative mode it renders anchor + signed offset + unit\n * selectors; the unit selector is hidden when the offset is `0`.\n *\n * For the `between`/`notBetween` operators it renders two independent value editors (each\n * with its own mode affordance) and stores the bounds as a two-element array, so the from\n * and to bounds can independently be absolute or relative.\n *\n * @group Components\n */\nexport const RelativeDateTimeValueEditor = (props: ValueEditorProps): React.JSX.Element => {\n const { valueListItemClassName } = useValueEditor(props);\n\n const { className, value, handleOnChange, schema, operator, separator } = props;\n const { suppressStandardClassnames } = schema;\n\n const SelectorComponent = props.selectorComponent ?? schema.controls.valueSelector;\n\n const config = useRelativeDateTimeConfig();\n\n const numericSchema = useMemo(() => ({ ...schema, parseNumbers: true }), [schema]);\n\n const outerClassname = useMemo(\n () => clsx(suppressStandardClassnames || standardClassnames.valueDateTimeRelative, className),\n [suppressStandardClassnames, className]\n );\n\n const isBetween = operator === 'between' || operator === 'notBetween';\n\n // For between/notBetween, store the bounds as a two-element array. Relative values are\n // objects (which can't survive comma-joining), so the array is emitted directly,\n // regardless of `listsAsArrays`.\n const valueAsArray = useMemo(() => toBetweenArray(value), [value]);\n\n const handleChangeBound = useCallback(\n (index: number) => (boundValue: unknown) => {\n const next = [valueAsArray[0], valueAsArray[1]];\n next[index] = boundValue;\n handleOnChange(next);\n },\n [valueAsArray, handleOnChange]\n );\n\n if (isBetween) {\n return (\n <span className={outerClassname}>\n <RelativeDateTimeSingleValueEditor\n baseProps={props}\n value={valueAsArray[0]}\n onChange={handleChangeBound(0)}\n absoluteOperator=\"=\"\n config={config}\n SelectorComponent={SelectorComponent}\n valueListItemClassName={valueListItemClassName}\n numericSchema={numericSchema}\n />\n {separator}\n <RelativeDateTimeSingleValueEditor\n baseProps={props}\n value={valueAsArray[1]}\n onChange={handleChangeBound(1)}\n absoluteOperator=\"=\"\n config={config}\n SelectorComponent={SelectorComponent}\n valueListItemClassName={valueListItemClassName}\n numericSchema={numericSchema}\n />\n </span>\n );\n }\n\n return (\n <span className={outerClassname}>\n <RelativeDateTimeSingleValueEditor\n baseProps={props}\n value={value}\n onChange={handleOnChange}\n absoluteOperator={operator}\n config={config}\n SelectorComponent={SelectorComponent}\n valueListItemClassName={valueListItemClassName}\n numericSchema={numericSchema}\n />\n </span>\n );\n};\n","import * as React from 'react';\nimport { useContext, useMemo } from 'react';\nimport type { QueryBuilderContextProvider, ValueEditorProps } from 'react-querybuilder';\nimport {\n getCompatContextProvider,\n QueryBuilderContext,\n useValueEditor,\n ValueEditor,\n} from 'react-querybuilder';\nimport {\n InheritedValueEditorContext,\n useInheritedValueEditor,\n} from './InheritedValueEditorContext';\nimport {\n RelativeDateTimeConfigContext,\n useRelativeDateTimeConfig,\n} from './RelativeDateTimeConfigContext';\nimport { RelativeDateTimeValueEditor } from './RelativeDateTimeValueEditor';\nimport type { RelativeDateTimeEditorConfig } from './types';\n\n/**\n * Whether a rule should use a date/time editor, based on either the coerced input\n * type (`date`/`datetime-local`) or a date-like `datatype` (`date`/`datetime`/`timestamp`).\n */\nconst isDateTimeEditor = (props: ValueEditorProps, inputTypeCoerced: string | undefined): boolean =>\n (props.type === 'text' &&\n (inputTypeCoerced === 'date' || inputTypeCoerced === 'datetime-local')) ||\n /^(?:date|datetime|timestamp)\\b/i.test(props.fieldData?.datatype as string);\n\nconst pad2 = (n: number): string => `${n}`.padStart(2, '0');\n\n/**\n * Formats a `Date` into the local value expected by a native `date`/`datetime-local`\n * input (library-agnostic; the date library only handles parsing/validation).\n */\nconst formatDateInputValue = (d: Date, withTime: boolean): string => {\n const datePart = `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`;\n return withTime ? `${datePart}T${pad2(d.getHours())}:${pad2(d.getMinutes())}` : datePart;\n};\n\nexport const DateTimeValueEditor = (props: ValueEditorProps): React.JSX.Element => {\n const uVE = useValueEditor(props);\n const InheritedEditor = useInheritedValueEditor();\n const { dateTimeAPI } = useRelativeDateTimeConfig();\n\n // Non-date fields and unparseable values: delegate to the inherited (compat) editor when\n // present, otherwise the default editor.\n const fallback = (p: ValueEditorProps) =>\n InheritedEditor ? <InheritedEditor {...p} /> : <ValueEditor {...p} skipHook />;\n\n if (!isDateTimeEditor(props, uVE.inputTypeCoerced)) {\n return fallback(props);\n }\n\n if (dateTimeAPI.isValid(props.value)) {\n const value = formatDateInputValue(\n dateTimeAPI.toDate(props.value),\n uVE.inputTypeCoerced !== 'date'\n );\n return fallback({ ...props, value });\n }\n\n return fallback(props);\n};\n\n/**\n * Provider value editor: renders the relative-capable {@link RelativeDateTimeValueEditor}\n * for date/time fields and falls back to the inherited (compat) editor for everything else.\n */\nconst QueryBuilderDateTimeValueEditor = (props: ValueEditorProps): React.JSX.Element => {\n const uVE = useValueEditor(props);\n const InheritedEditor = useInheritedValueEditor();\n\n if (isDateTimeEditor(props, uVE.inputTypeCoerced)) {\n return <RelativeDateTimeValueEditor {...props} />;\n }\n\n return InheritedEditor ? <InheritedEditor {...props} /> : <ValueEditor {...props} skipHook />;\n};\n\nexport const QueryBuilderDateTimeContext: QueryBuilderContextProvider = getCompatContextProvider({\n controlElements: { valueEditor: QueryBuilderDateTimeValueEditor },\n});\n\n/** Props for {@link QueryBuilderDateTime}: {@link RelativeDateTimeEditorConfig} plus children. */\nexport interface QueryBuilderDateTimeProps extends RelativeDateTimeEditorConfig {\n children?: React.ReactNode;\n}\n\n/**\n * Context provider enabling date/time features for a wrapped\n * {@link react-querybuilder!QueryBuilder QueryBuilder}: renders the relative-capable\n * {@link RelativeDateTimeValueEditor} for date/time fields, and accepts optional\n * {@link RelativeDateTimeEditorConfig} props (mode controller, anchor/unit options, and\n * toggle labels). With no props it provides the zero-config toggle experience.\n *\n * @group Components\n */\nexport const QueryBuilderDateTime = ({\n children,\n modeController,\n anchors,\n units,\n toggleLabels,\n dateTimeAPI,\n}: QueryBuilderDateTimeProps): React.JSX.Element => {\n const config = useMemo(\n (): RelativeDateTimeEditorConfig => ({\n modeController,\n anchors,\n units,\n toggleLabels,\n dateTimeAPI,\n }),\n [modeController, anchors, units, toggleLabels, dateTimeAPI]\n );\n\n // Capture the value editor inherited from any outer compat provider (e.g. QueryBuilderMaterial)\n // _before_ QueryBuilderDateTimeContext overrides it, so date/time editors can delegate to it.\n const inheritedValueEditor = (useContext(QueryBuilderContext).controlElements?.valueEditor ??\n null) as React.ComponentType<ValueEditorProps> | null;\n\n return (\n <RelativeDateTimeConfigContext.Provider value={config}>\n <InheritedValueEditorContext.Provider value={inheritedValueEditor}>\n <QueryBuilderDateTimeContext>{children}</QueryBuilderDateTimeContext>\n </InheritedValueEditorContext.Provider>\n </RelativeDateTimeConfigContext.Provider>\n );\n};\n"],"mappings":";;;;;;AAUA,MAAM,mBAAmB;CACvB,MAAM;CACN,KAAK;CACL,MAAM;CACN,KAAK;CACL,KAAK;CACL,MAAM;CACN,SAAS;CACT,IAAI;CACJ,YAAY;CACZ,OAAO;AACT;;;;;;;;;AAUA,MAAa,kCACX,MACA,YACyB;;CACzB,MAAM,OAAO,YAAA,QAAA,YAAA,KAAA,IAAA,8CAA8C,CAAC;CAE5D,IAAI,CAAC,oBAAA,gBAAmB,KAAK,aAAA,QAAA,kBAAA,KA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mB,CAAC,CAAC,qBAAA,QAAA,2BAAA,KAAA,IAAA,KAAA,IAAA,uBAAiB,iBAAA,QAAA,0BAAA,KAAA,IAAA,wBAC7E;CAEF,OACE,sBAAA,cAAC,8BAA8B,UAA/B,EAAwC,OAAO,OAIP,GAHtC,sBAAA,cAAC,4BAA4B,UAA7B,EAAsC,OAAO,qBAEP,GADpC,sBAAA,cAAC,6BAAA,MAA6B,QAAsC,CAChC,CACA;AAE5C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as RQBJsonLogicDateTimeOperations, i as RQBDateTimeLibraryAPI } from "./types-CdjHqQ0k.js";
|
|
2
2
|
import { RuleProcessor, ValueProcessorByRule } from "react-querybuilder";
|
|
3
3
|
|
|
4
4
|
//#region src/rqbDateTimeLibraryAPI.jsdate.d.ts
|
|
@@ -44,6 +44,10 @@ declare const datetimeValueProcessorPostgreSQL: ValueProcessorByRule;
|
|
|
44
44
|
*/
|
|
45
45
|
declare const datetimeRuleProcessorCEL: RuleProcessor;
|
|
46
46
|
/**
|
|
47
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "jsonata" format using JavaScript `Date`
|
|
48
|
+
*/
|
|
49
|
+
declare const datetimeRuleProcessorJSONata: RuleProcessor;
|
|
50
|
+
/**
|
|
47
51
|
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "mongodb_query" format using JavaScript `Date`
|
|
48
52
|
*/
|
|
49
53
|
declare const datetimeRuleProcessorMongoDBQuery: RuleProcessor;
|
|
@@ -59,6 +63,46 @@ declare const datetimeRuleProcessorCypher: RuleProcessor;
|
|
|
59
63
|
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "sparql" format using JavaScript `Date`
|
|
60
64
|
*/
|
|
61
65
|
declare const datetimeRuleProcessorSPARQL: RuleProcessor;
|
|
66
|
+
/**
|
|
67
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "parameterized"/"parameterized_named" formats
|
|
68
|
+
*/
|
|
69
|
+
declare const datetimeRuleProcessorParameterized: RuleProcessor;
|
|
70
|
+
/**
|
|
71
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "spel" format
|
|
72
|
+
*/
|
|
73
|
+
declare const datetimeRuleProcessorSpEL: RuleProcessor;
|
|
74
|
+
/**
|
|
75
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "ldap" format
|
|
76
|
+
*/
|
|
77
|
+
declare const datetimeRuleProcessorLDAP: RuleProcessor;
|
|
78
|
+
/**
|
|
79
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "gremlin" format
|
|
80
|
+
*/
|
|
81
|
+
declare const datetimeRuleProcessorGremlin: RuleProcessor;
|
|
82
|
+
/**
|
|
83
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "prisma" format
|
|
84
|
+
*/
|
|
85
|
+
declare const datetimeRuleProcessorPrisma: RuleProcessor;
|
|
86
|
+
/**
|
|
87
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "sequelize" format
|
|
88
|
+
*/
|
|
89
|
+
declare const datetimeRuleProcessorSequelize: RuleProcessor;
|
|
90
|
+
/**
|
|
91
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "drizzle" format
|
|
92
|
+
*/
|
|
93
|
+
declare const datetimeRuleProcessorDrizzle: RuleProcessor;
|
|
94
|
+
/**
|
|
95
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "elasticsearch" format
|
|
96
|
+
*/
|
|
97
|
+
declare const datetimeRuleProcessorElasticSearch: RuleProcessor;
|
|
98
|
+
/**
|
|
99
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "tanstack_db" format
|
|
100
|
+
*/
|
|
101
|
+
declare const datetimeRuleProcessorTanStackDB: RuleProcessor;
|
|
102
|
+
/**
|
|
103
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for (deprecated) "mongodb" format
|
|
104
|
+
*/
|
|
105
|
+
declare const datetimeRuleProcessorMongoDB: RuleProcessor;
|
|
62
106
|
//#endregion
|
|
63
|
-
export { datetimeRuleProcessorCEL, datetimeRuleProcessorCypher, datetimeRuleProcessorMongoDBQuery, datetimeRuleProcessorNL, datetimeRuleProcessorSPARQL, datetimeRuleProcessorSQL, datetimeValueProcessorANSI, datetimeValueProcessorMSSQL, datetimeValueProcessorMySQL, datetimeValueProcessorOracle, datetimeValueProcessorPostgreSQL, jsonLogicDateTimeOperations, rqbDateTimeLibraryAPI };
|
|
107
|
+
export { datetimeRuleProcessorCEL, datetimeRuleProcessorCypher, datetimeRuleProcessorDrizzle, datetimeRuleProcessorElasticSearch, datetimeRuleProcessorGremlin, datetimeRuleProcessorJSONata, datetimeRuleProcessorLDAP, datetimeRuleProcessorMongoDB, datetimeRuleProcessorMongoDBQuery, datetimeRuleProcessorNL, datetimeRuleProcessorParameterized, datetimeRuleProcessorPrisma, datetimeRuleProcessorSPARQL, datetimeRuleProcessorSQL, datetimeRuleProcessorSequelize, datetimeRuleProcessorSpEL, datetimeRuleProcessorTanStackDB, datetimeValueProcessorANSI, datetimeValueProcessorMSSQL, datetimeValueProcessorMySQL, datetimeValueProcessorOracle, datetimeValueProcessorPostgreSQL, jsonLogicDateTimeOperations, rqbDateTimeLibraryAPI };
|
|
64
108
|
//# sourceMappingURL=react-querybuilder_datetime.legacy-esm.jsdate.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { E as getDatetimeJsonLogicOperations, O as isISOStringDateOnly, S as getDatetimeRuleProcessorDrizzle, T as getDatetimeRuleProcessorCEL, _ as getDatetimeRuleProcessorMongoDBQuery, a as getDatetimeValueProcessorMySQL, b as getDatetimeRuleProcessorGremlin, c as getDatetimeRuleProcessorSpEL, d as getDatetimeRuleProcessorPrisma, f as getDatetimeRuleProcessorParameterized, g as getDatetimeRuleProcessorMongoDB, h as getDatetimeRuleProcessorNL, i as getDatetimeValueProcessorMSSQL, l as getDatetimeRuleProcessorSPARQL, n as getDatetimeRuleProcessorSQL, o as getDatetimeValueProcessorOracle, r as getDatetimeValueProcessorANSI, s as getDatetimeValueProcessorPostgreSQL, t as getDatetimeRuleProcessorTanStackDB, u as getDatetimeRuleProcessorSequelize, v as getDatetimeRuleProcessorLDAP, w as getDatetimeRuleProcessorCypher, x as getDatetimeRuleProcessorElasticSearch, y as getDatetimeRuleProcessorJSONata } from "./getDatetimeRuleProcessorTanStackDB-LDwhMJg0.js";
|
|
2
2
|
//#region src/rqbDateTimeLibraryAPI.jsdate.ts
|
|
3
3
|
const invalidDate = /* @__PURE__ */ new Date(NaN);
|
|
4
4
|
const dateRegExp = /^(\d{4})-(\d{2})-(\d{2})([T ](\d{2}):(\d{2}):(\d{2})(\.(\d{1,3}))?)?/;
|
|
@@ -27,6 +27,62 @@ const toISOStringDateOnly = (d) => {
|
|
|
27
27
|
const dToDate = toDate(d);
|
|
28
28
|
return isValid(dToDate) ? dToDate.toISOString().slice(0, 10) : "";
|
|
29
29
|
};
|
|
30
|
+
const startOf = (d, unit) => {
|
|
31
|
+
const r = new Date(toDate(d).getTime());
|
|
32
|
+
r.setHours(0, 0, 0, 0);
|
|
33
|
+
switch (unit) {
|
|
34
|
+
case "week":
|
|
35
|
+
r.setDate(r.getDate() - r.getDay());
|
|
36
|
+
break;
|
|
37
|
+
case "month":
|
|
38
|
+
r.setDate(1);
|
|
39
|
+
break;
|
|
40
|
+
case "year":
|
|
41
|
+
r.setMonth(0, 1);
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
return r;
|
|
45
|
+
};
|
|
46
|
+
const endOf = (d, unit) => {
|
|
47
|
+
const r = new Date(toDate(d).getTime());
|
|
48
|
+
r.setHours(23, 59, 59, 999);
|
|
49
|
+
switch (unit) {
|
|
50
|
+
case "week":
|
|
51
|
+
r.setDate(r.getDate() + (6 - r.getDay()));
|
|
52
|
+
break;
|
|
53
|
+
case "month":
|
|
54
|
+
r.setMonth(r.getMonth() + 1, 0);
|
|
55
|
+
break;
|
|
56
|
+
case "year":
|
|
57
|
+
r.setMonth(11, 31);
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
return r;
|
|
61
|
+
};
|
|
62
|
+
const add = (d, amount, unit) => {
|
|
63
|
+
const r = new Date(toDate(d).getTime());
|
|
64
|
+
switch (unit) {
|
|
65
|
+
case "minute":
|
|
66
|
+
r.setMinutes(r.getMinutes() + amount);
|
|
67
|
+
break;
|
|
68
|
+
case "hour":
|
|
69
|
+
r.setHours(r.getHours() + amount);
|
|
70
|
+
break;
|
|
71
|
+
case "day":
|
|
72
|
+
r.setDate(r.getDate() + amount);
|
|
73
|
+
break;
|
|
74
|
+
case "week":
|
|
75
|
+
r.setDate(r.getDate() + amount * 7);
|
|
76
|
+
break;
|
|
77
|
+
case "month":
|
|
78
|
+
r.setMonth(r.getMonth() + amount);
|
|
79
|
+
break;
|
|
80
|
+
case "year":
|
|
81
|
+
r.setFullYear(r.getFullYear() + amount);
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
return r;
|
|
85
|
+
};
|
|
30
86
|
/**
|
|
31
87
|
* {@link RQBDateTimeLibraryAPI} for JavaScript `Date`
|
|
32
88
|
*
|
|
@@ -56,7 +112,10 @@ const rqbDateTimeLibraryAPI = {
|
|
|
56
112
|
const dToDate = toDate(d);
|
|
57
113
|
return isValid(dToDate) ? dToDate.toISOString() : "";
|
|
58
114
|
},
|
|
59
|
-
toISOStringDateOnly
|
|
115
|
+
toISOStringDateOnly,
|
|
116
|
+
startOf,
|
|
117
|
+
endOf,
|
|
118
|
+
add
|
|
60
119
|
};
|
|
61
120
|
//#endregion
|
|
62
121
|
//#region src/index.jsdate.ts
|
|
@@ -93,6 +152,10 @@ const datetimeValueProcessorPostgreSQL = getDatetimeValueProcessorPostgreSQL(rqb
|
|
|
93
152
|
*/
|
|
94
153
|
const datetimeRuleProcessorCEL = getDatetimeRuleProcessorCEL(rqbDateTimeLibraryAPI);
|
|
95
154
|
/**
|
|
155
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "jsonata" format using JavaScript `Date`
|
|
156
|
+
*/
|
|
157
|
+
const datetimeRuleProcessorJSONata = getDatetimeRuleProcessorJSONata(rqbDateTimeLibraryAPI);
|
|
158
|
+
/**
|
|
96
159
|
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "mongodb_query" format using JavaScript `Date`
|
|
97
160
|
*/
|
|
98
161
|
const datetimeRuleProcessorMongoDBQuery = getDatetimeRuleProcessorMongoDBQuery(rqbDateTimeLibraryAPI);
|
|
@@ -108,7 +171,47 @@ const datetimeRuleProcessorCypher = getDatetimeRuleProcessorCypher(rqbDateTimeLi
|
|
|
108
171
|
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "sparql" format using JavaScript `Date`
|
|
109
172
|
*/
|
|
110
173
|
const datetimeRuleProcessorSPARQL = getDatetimeRuleProcessorSPARQL(rqbDateTimeLibraryAPI);
|
|
174
|
+
/**
|
|
175
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "parameterized"/"parameterized_named" formats
|
|
176
|
+
*/
|
|
177
|
+
const datetimeRuleProcessorParameterized = getDatetimeRuleProcessorParameterized(rqbDateTimeLibraryAPI);
|
|
178
|
+
/**
|
|
179
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "spel" format
|
|
180
|
+
*/
|
|
181
|
+
const datetimeRuleProcessorSpEL = getDatetimeRuleProcessorSpEL(rqbDateTimeLibraryAPI);
|
|
182
|
+
/**
|
|
183
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "ldap" format
|
|
184
|
+
*/
|
|
185
|
+
const datetimeRuleProcessorLDAP = getDatetimeRuleProcessorLDAP(rqbDateTimeLibraryAPI);
|
|
186
|
+
/**
|
|
187
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "gremlin" format
|
|
188
|
+
*/
|
|
189
|
+
const datetimeRuleProcessorGremlin = getDatetimeRuleProcessorGremlin(rqbDateTimeLibraryAPI);
|
|
190
|
+
/**
|
|
191
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "prisma" format
|
|
192
|
+
*/
|
|
193
|
+
const datetimeRuleProcessorPrisma = getDatetimeRuleProcessorPrisma(rqbDateTimeLibraryAPI);
|
|
194
|
+
/**
|
|
195
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "sequelize" format
|
|
196
|
+
*/
|
|
197
|
+
const datetimeRuleProcessorSequelize = getDatetimeRuleProcessorSequelize(rqbDateTimeLibraryAPI);
|
|
198
|
+
/**
|
|
199
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "drizzle" format
|
|
200
|
+
*/
|
|
201
|
+
const datetimeRuleProcessorDrizzle = getDatetimeRuleProcessorDrizzle(rqbDateTimeLibraryAPI);
|
|
202
|
+
/**
|
|
203
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "elasticsearch" format
|
|
204
|
+
*/
|
|
205
|
+
const datetimeRuleProcessorElasticSearch = getDatetimeRuleProcessorElasticSearch(rqbDateTimeLibraryAPI);
|
|
206
|
+
/**
|
|
207
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "tanstack_db" format
|
|
208
|
+
*/
|
|
209
|
+
const datetimeRuleProcessorTanStackDB = getDatetimeRuleProcessorTanStackDB(rqbDateTimeLibraryAPI);
|
|
210
|
+
/**
|
|
211
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for (deprecated) "mongodb" format
|
|
212
|
+
*/
|
|
213
|
+
const datetimeRuleProcessorMongoDB = getDatetimeRuleProcessorMongoDB(rqbDateTimeLibraryAPI);
|
|
111
214
|
//#endregion
|
|
112
|
-
export { datetimeRuleProcessorCEL, datetimeRuleProcessorCypher, datetimeRuleProcessorMongoDBQuery, datetimeRuleProcessorNL, datetimeRuleProcessorSPARQL, datetimeRuleProcessorSQL, datetimeValueProcessorANSI, datetimeValueProcessorMSSQL, datetimeValueProcessorMySQL, datetimeValueProcessorOracle, datetimeValueProcessorPostgreSQL, jsonLogicDateTimeOperations, rqbDateTimeLibraryAPI };
|
|
215
|
+
export { datetimeRuleProcessorCEL, datetimeRuleProcessorCypher, datetimeRuleProcessorDrizzle, datetimeRuleProcessorElasticSearch, datetimeRuleProcessorGremlin, datetimeRuleProcessorJSONata, datetimeRuleProcessorLDAP, datetimeRuleProcessorMongoDB, datetimeRuleProcessorMongoDBQuery, datetimeRuleProcessorNL, datetimeRuleProcessorParameterized, datetimeRuleProcessorPrisma, datetimeRuleProcessorSPARQL, datetimeRuleProcessorSQL, datetimeRuleProcessorSequelize, datetimeRuleProcessorSpEL, datetimeRuleProcessorTanStackDB, datetimeValueProcessorANSI, datetimeValueProcessorMSSQL, datetimeValueProcessorMySQL, datetimeValueProcessorOracle, datetimeValueProcessorPostgreSQL, jsonLogicDateTimeOperations, rqbDateTimeLibraryAPI };
|
|
113
216
|
|
|
114
217
|
//# sourceMappingURL=react-querybuilder_datetime.legacy-esm.jsdate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-querybuilder_datetime.legacy-esm.jsdate.js","names":[],"sources":["../src/rqbDateTimeLibraryAPI.jsdate.ts","../src/index.jsdate.ts"],"sourcesContent":["import type { RQBDateTimeLibraryAPI } from './types';\nimport { isISOStringDateOnly } from './utils';\n\nconst invalidDate = new Date(Number.NaN);\n\nconst dateRegExp = /^(\\d{4})-(\\d{2})-(\\d{2})([T ](\\d{2}):(\\d{2}):(\\d{2})(\\.(\\d{1,3}))?)?/;\n\nconst toDate = (d: string | Date) => {\n if (d instanceof Date) return d;\n\n const reMatch = dateRegExp.exec(d);\n\n if (!reMatch) return invalidDate;\n\n const [_all, yyyy, mm, dd, _time, hh, mi, ss, _decimal, sss] = reMatch;\n const [year, month, day, hours, minutes, seconds, ms] = [yyyy, mm, dd, hh, mi, ss, sss ?? '0']\n .filter(Boolean)\n .map(Number);\n\n const monthIndex = month - 1;\n\n return hh\n ? new Date(Date.UTC(year, monthIndex, day, hours, minutes, seconds, ms))\n : new Date(year, monthIndex, day);\n};\n\nconst isValid = (d: string | Date) => {\n const dToDate = toDate(d);\n return dToDate instanceof Date && !Number.isNaN(dToDate.getTime());\n};\n\nconst toISOStringDateOnly = (d: string | Date) => {\n const dToDate = toDate(d);\n return isValid(dToDate) ? dToDate.toISOString().slice(0, 10) : '';\n};\n\n/**\n * {@link RQBDateTimeLibraryAPI} for JavaScript `Date`\n *\n * @deprecated This API will not be removed, but we recommend using one of the other\n * {@link RQBDateTimeLibraryAPI}s based on a popular library instead.\n */\nexport const rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI = {\n format: d => toDate(d).toISOString(),\n isAfter: (a, b) => {\n const dateA = toDate(a).getTime();\n const dateB = toDate(b).getTime();\n return !Number.isNaN(dateA) && !Number.isNaN(dateB) && dateA > dateB;\n },\n isBefore: (a, b) => {\n const dateA = toDate(a).getTime();\n const dateB = toDate(b).getTime();\n return !Number.isNaN(dateA) && !Number.isNaN(dateB) && dateA < dateB;\n },\n isSame: (a, b) => {\n const aToDate = toDate(a);\n const bToDate = toDate(b);\n return isISOStringDateOnly(a) || isISOStringDateOnly(b)\n ? toISOStringDateOnly(a) === toISOStringDateOnly(b)\n : aToDate.getTime() === bToDate.getTime();\n },\n isValid,\n toDate,\n toISOString: d => {\n const dToDate = toDate(d);\n return isValid(dToDate) ? dToDate.toISOString() : '';\n },\n toISOStringDateOnly,\n};\n","/**\n * Import from `\"@react-querybuilder/datetime/jsdate\"` for enhanced date/time support using a custom JavaScript `Date`-based library.\n *\n * @module jsdate\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.jsdate';\nimport type { RQBJsonLogicDateTimeOperations } from './types';\n\n/**\n * Custom JsonLogic date/time operations using JavaScript `Date`.\n */\nexport const jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations =\n getDatetimeJsonLogicOperations(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sql\" format using JavaScript `Date`\n */\nexport const datetimeRuleProcessorSQL: RuleProcessor =\n getDatetimeRuleProcessorSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"ansi\" preset) using JavaScript `Date`\n */\nexport const datetimeValueProcessorANSI: ValueProcessorByRule =\n getDatetimeValueProcessorANSI(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"mssql\" preset) using JavaScript `Date`\n */\nexport const datetimeValueProcessorMSSQL: ValueProcessorByRule =\n getDatetimeValueProcessorMSSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"mysql\" preset) using JavaScript `Date`\n */\nexport const datetimeValueProcessorMySQL: ValueProcessorByRule =\n getDatetimeValueProcessorMySQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"oracle\" preset) using JavaScript `Date`\n */\nexport const datetimeValueProcessorOracle: ValueProcessorByRule =\n getDatetimeValueProcessorOracle(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"postgresql\" preset) using JavaScript `Date`\n */\nexport const datetimeValueProcessorPostgreSQL: ValueProcessorByRule =\n getDatetimeValueProcessorPostgreSQL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"cel\" format using JavaScript `Date`\n */\nexport const datetimeRuleProcessorCEL: RuleProcessor =\n getDatetimeRuleProcessorCEL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"mongodb_query\" format using JavaScript `Date`\n */\nexport const datetimeRuleProcessorMongoDBQuery: RuleProcessor =\n getDatetimeRuleProcessorMongoDBQuery(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"natural_language\" format using JavaScript `Date`\n */\nexport const datetimeRuleProcessorNL: ValueProcessorByRule =\n getDatetimeRuleProcessorNL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"cypher\"/\"gql\" format using JavaScript `Date`\n */\nexport const datetimeRuleProcessorCypher: RuleProcessor =\n getDatetimeRuleProcessorCypher(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sparql\" format using JavaScript `Date`\n */\nexport const datetimeRuleProcessorSPARQL: RuleProcessor =\n getDatetimeRuleProcessorSPARQL(rqbDateTimeLibraryAPI);\n\nexport * from './rqbDateTimeLibraryAPI.jsdate';\n"],"mappings":";;AAGA,MAAM,8BAAc,IAAI,KAAK,GAAU;AAEvC,MAAM,aAAa;AAEnB,MAAM,UAAU,MAAqB;CACnC,IAAI,aAAa,MAAM,OAAO;CAE9B,MAAM,UAAU,WAAW,KAAK,CAAC;CAE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EACxB,MAAM,UAAU,OAAO,CAAC;EACxB,OAAO,oBAAoB,CAAC,KAAK,oBAAoB,CAAC,IAClD,oBAAoB,CAAC,MAAM,oBAAoB,CAAC,IAChD,QAAQ,QAAQ,MAAM,QAAQ,QAAQ;CAC5C;CACA;CACA;CACA,cAAa,MAAK;EAChB,MAAM,UAAU,OAAO,CAAC;EACxB,OAAO,QAAQ,OAAO,IAAI,QAAQ,YAAY,IAAI;CACpD;CACA;AACF;;;;;;ACzCA,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.jsdate.js","names":[],"sources":["../src/rqbDateTimeLibraryAPI.jsdate.ts","../src/index.jsdate.ts"],"sourcesContent":["import type {\n RelativeDateTimeTruncationUnit,\n RelativeDateTimeUnit,\n RQBDateTimeLibraryAPI,\n} from './types';\nimport { isISOStringDateOnly } from './utils';\n\nconst invalidDate = new Date(Number.NaN);\n\nconst dateRegExp = /^(\\d{4})-(\\d{2})-(\\d{2})([T ](\\d{2}):(\\d{2}):(\\d{2})(\\.(\\d{1,3}))?)?/;\n\nconst toDate = (d: string | Date) => {\n if (d instanceof Date) return d;\n\n const reMatch = dateRegExp.exec(d);\n\n if (!reMatch) return invalidDate;\n\n const [_all, yyyy, mm, dd, _time, hh, mi, ss, _decimal, sss] = reMatch;\n const [year, month, day, hours, minutes, seconds, ms] = [yyyy, mm, dd, hh, mi, ss, sss ?? '0']\n .filter(Boolean)\n .map(Number);\n\n const monthIndex = month - 1;\n\n return hh\n ? new Date(Date.UTC(year, monthIndex, day, hours, minutes, seconds, ms))\n : new Date(year, monthIndex, day);\n};\n\nconst isValid = (d: string | Date) => {\n const dToDate = toDate(d);\n return dToDate instanceof Date && !Number.isNaN(dToDate.getTime());\n};\n\nconst toISOStringDateOnly = (d: string | Date) => {\n const dToDate = toDate(d);\n return isValid(dToDate) ? dToDate.toISOString().slice(0, 10) : '';\n};\n\n// Week starts on Sunday (matching Day.js/date-fns defaults).\nconst startOf = (d: string | Date, unit: RelativeDateTimeTruncationUnit): Date => {\n const r = new Date(toDate(d).getTime());\n r.setHours(0, 0, 0, 0);\n switch (unit) {\n case 'week':\n r.setDate(r.getDate() - r.getDay());\n break;\n case 'month':\n r.setDate(1);\n break;\n case 'year':\n r.setMonth(0, 1);\n break;\n }\n return r;\n};\n\nconst endOf = (d: string | Date, unit: RelativeDateTimeTruncationUnit): Date => {\n const r = new Date(toDate(d).getTime());\n r.setHours(23, 59, 59, 999);\n switch (unit) {\n case 'week':\n r.setDate(r.getDate() + (6 - r.getDay()));\n break;\n case 'month':\n r.setMonth(r.getMonth() + 1, 0);\n break;\n case 'year':\n r.setMonth(11, 31);\n break;\n }\n return r;\n};\n\nconst add = (d: string | Date, amount: number, unit: RelativeDateTimeUnit): Date => {\n const r = new Date(toDate(d).getTime());\n switch (unit) {\n case 'minute':\n r.setMinutes(r.getMinutes() + amount);\n break;\n case 'hour':\n r.setHours(r.getHours() + amount);\n break;\n case 'day':\n r.setDate(r.getDate() + amount);\n break;\n case 'week':\n r.setDate(r.getDate() + amount * 7);\n break;\n case 'month':\n r.setMonth(r.getMonth() + amount);\n break;\n case 'year':\n r.setFullYear(r.getFullYear() + amount);\n break;\n }\n return r;\n};\n\n/**\n * {@link RQBDateTimeLibraryAPI} for JavaScript `Date`\n *\n * @deprecated This API will not be removed, but we recommend using one of the other\n * {@link RQBDateTimeLibraryAPI}s based on a popular library instead.\n */\nexport const rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI = {\n format: d => toDate(d).toISOString(),\n isAfter: (a, b) => {\n const dateA = toDate(a).getTime();\n const dateB = toDate(b).getTime();\n return !Number.isNaN(dateA) && !Number.isNaN(dateB) && dateA > dateB;\n },\n isBefore: (a, b) => {\n const dateA = toDate(a).getTime();\n const dateB = toDate(b).getTime();\n return !Number.isNaN(dateA) && !Number.isNaN(dateB) && dateA < dateB;\n },\n isSame: (a, b) => {\n const aToDate = toDate(a);\n const bToDate = toDate(b);\n return isISOStringDateOnly(a) || isISOStringDateOnly(b)\n ? toISOStringDateOnly(a) === toISOStringDateOnly(b)\n : aToDate.getTime() === bToDate.getTime();\n },\n isValid,\n toDate,\n toISOString: d => {\n const dToDate = toDate(d);\n return isValid(dToDate) ? dToDate.toISOString() : '';\n },\n toISOStringDateOnly,\n startOf,\n endOf,\n add,\n};\n","/**\n * Import from `\"@react-querybuilder/datetime/jsdate\"` for enhanced date/time support using a custom JavaScript `Date`-based library.\n *\n * @module jsdate\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.jsdate';\nimport type { RQBJsonLogicDateTimeOperations } from './types';\n\n/**\n * Custom JsonLogic date/time operations using JavaScript `Date`.\n */\nexport const jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations =\n getDatetimeJsonLogicOperations(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sql\" format using JavaScript `Date`\n */\nexport const datetimeRuleProcessorSQL: RuleProcessor =\n getDatetimeRuleProcessorSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"ansi\" preset) using JavaScript `Date`\n */\nexport const datetimeValueProcessorANSI: ValueProcessorByRule =\n getDatetimeValueProcessorANSI(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"mssql\" preset) using JavaScript `Date`\n */\nexport const datetimeValueProcessorMSSQL: ValueProcessorByRule =\n getDatetimeValueProcessorMSSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"mysql\" preset) using JavaScript `Date`\n */\nexport const datetimeValueProcessorMySQL: ValueProcessorByRule =\n getDatetimeValueProcessorMySQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"oracle\" preset) using JavaScript `Date`\n */\nexport const datetimeValueProcessorOracle: ValueProcessorByRule =\n getDatetimeValueProcessorOracle(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"postgresql\" preset) using JavaScript `Date`\n */\nexport const datetimeValueProcessorPostgreSQL: ValueProcessorByRule =\n getDatetimeValueProcessorPostgreSQL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"cel\" format using JavaScript `Date`\n */\nexport const datetimeRuleProcessorCEL: RuleProcessor =\n getDatetimeRuleProcessorCEL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"jsonata\" format using JavaScript `Date`\n */\nexport const datetimeRuleProcessorJSONata: RuleProcessor =\n getDatetimeRuleProcessorJSONata(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"mongodb_query\" format using JavaScript `Date`\n */\nexport const datetimeRuleProcessorMongoDBQuery: RuleProcessor =\n getDatetimeRuleProcessorMongoDBQuery(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"natural_language\" format using JavaScript `Date`\n */\nexport const datetimeRuleProcessorNL: ValueProcessorByRule =\n getDatetimeRuleProcessorNL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"cypher\"/\"gql\" format using JavaScript `Date`\n */\nexport const datetimeRuleProcessorCypher: RuleProcessor =\n getDatetimeRuleProcessorCypher(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sparql\" format using JavaScript `Date`\n */\nexport const datetimeRuleProcessorSPARQL: RuleProcessor =\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.jsdate';\n"],"mappings":";;AAOA,MAAM,8BAAc,IAAI,KAAK,GAAU;AAEvC,MAAM,aAAa;AAEnB,MAAM,UAAU,MAAqB;CACnC,IAAI,aAAa,MAAM,OAAO;CAE9B,MAAM,UAAU,WAAW,KAAK,CAAC;CAEjC,IAAI,CAAC,SAAS,OAAO;CAErB,MAAM,CAAC,MAAM,MAAM,IAAI,IAAI,OAAO,IAAI,IAAI,IAAI,UAAU,OAAO;CAC/D,MAAM,CAAC,MAAM,OAAO,KAAK,OAAO,SAAS,SAAS,MAAM;EAAC;EAAM;EAAI;EAAI;EAAI;EAAI;EAAI,QAAA,QAAA,QAAA,KAAA,IAAA,MAAO;CAAG,CAAC,CAC3F,OAAO,OAAO,CAAC,CACf,IAAI,MAAM;CAEb,MAAM,aAAa,QAAQ;CAE3B,OAAO,KACH,IAAI,KAAK,KAAK,IAAI,MAAM,YAAY,KAAK,OAAO,SAAS,SAAS,EAAE,CAAC,IACrE,IAAI,KAAK,MAAM,YAAY,GAAG;AACpC;AAEA,MAAM,WAAW,MAAqB;CACpC,MAAM,UAAU,OAAO,CAAC;CACxB,OAAO,mBAAmB,QAAQ,CAAC,OAAO,MAAM,QAAQ,QAAQ,CAAC;AAC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AIvD,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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as RQBJsonLogicDateTimeOperations, i as RQBDateTimeLibraryAPI } from "./types-CdjHqQ0k.js";
|
|
2
2
|
import { RuleProcessor, ValueProcessorByRule } from "react-querybuilder";
|
|
3
3
|
|
|
4
4
|
//#region src/rqbDateTimeLibraryAPI.luxon.d.ts
|
|
@@ -41,6 +41,10 @@ declare const datetimeValueProcessorPostgreSQL: ValueProcessorByRule;
|
|
|
41
41
|
*/
|
|
42
42
|
declare const datetimeRuleProcessorCEL: ValueProcessorByRule;
|
|
43
43
|
/**
|
|
44
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "jsonata" format using Luxon
|
|
45
|
+
*/
|
|
46
|
+
declare const datetimeRuleProcessorJSONata: RuleProcessor;
|
|
47
|
+
/**
|
|
44
48
|
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "mongodb_query" format using Luxon
|
|
45
49
|
*/
|
|
46
50
|
declare const datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule;
|
|
@@ -56,6 +60,46 @@ declare const datetimeRuleProcessorCypher: ValueProcessorByRule;
|
|
|
56
60
|
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "sparql" format using Luxon
|
|
57
61
|
*/
|
|
58
62
|
declare const datetimeRuleProcessorSPARQL: ValueProcessorByRule;
|
|
63
|
+
/**
|
|
64
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "parameterized"/"parameterized_named" formats
|
|
65
|
+
*/
|
|
66
|
+
declare const datetimeRuleProcessorParameterized: RuleProcessor;
|
|
67
|
+
/**
|
|
68
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "spel" format
|
|
69
|
+
*/
|
|
70
|
+
declare const datetimeRuleProcessorSpEL: RuleProcessor;
|
|
71
|
+
/**
|
|
72
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "ldap" format
|
|
73
|
+
*/
|
|
74
|
+
declare const datetimeRuleProcessorLDAP: RuleProcessor;
|
|
75
|
+
/**
|
|
76
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "gremlin" format
|
|
77
|
+
*/
|
|
78
|
+
declare const datetimeRuleProcessorGremlin: RuleProcessor;
|
|
79
|
+
/**
|
|
80
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "prisma" format
|
|
81
|
+
*/
|
|
82
|
+
declare const datetimeRuleProcessorPrisma: RuleProcessor;
|
|
83
|
+
/**
|
|
84
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "sequelize" format
|
|
85
|
+
*/
|
|
86
|
+
declare const datetimeRuleProcessorSequelize: RuleProcessor;
|
|
87
|
+
/**
|
|
88
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "drizzle" format
|
|
89
|
+
*/
|
|
90
|
+
declare const datetimeRuleProcessorDrizzle: RuleProcessor;
|
|
91
|
+
/**
|
|
92
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "elasticsearch" format
|
|
93
|
+
*/
|
|
94
|
+
declare const datetimeRuleProcessorElasticSearch: RuleProcessor;
|
|
95
|
+
/**
|
|
96
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "tanstack_db" format
|
|
97
|
+
*/
|
|
98
|
+
declare const datetimeRuleProcessorTanStackDB: RuleProcessor;
|
|
99
|
+
/**
|
|
100
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for (deprecated) "mongodb" format
|
|
101
|
+
*/
|
|
102
|
+
declare const datetimeRuleProcessorMongoDB: RuleProcessor;
|
|
59
103
|
//#endregion
|
|
60
|
-
export { datetimeRuleProcessorCEL, datetimeRuleProcessorCypher, datetimeRuleProcessorMongoDBQuery, datetimeRuleProcessorNL, datetimeRuleProcessorSPARQL, datetimeRuleProcessorSQL, datetimeValueProcessorANSI, datetimeValueProcessorMSSQL, datetimeValueProcessorMySQL, datetimeValueProcessorOracle, datetimeValueProcessorPostgreSQL, jsonLogicDateTimeOperations, rqbDateTimeLibraryAPI };
|
|
104
|
+
export { datetimeRuleProcessorCEL, datetimeRuleProcessorCypher, datetimeRuleProcessorDrizzle, datetimeRuleProcessorElasticSearch, datetimeRuleProcessorGremlin, datetimeRuleProcessorJSONata, datetimeRuleProcessorLDAP, datetimeRuleProcessorMongoDB, datetimeRuleProcessorMongoDBQuery, datetimeRuleProcessorNL, datetimeRuleProcessorParameterized, datetimeRuleProcessorPrisma, datetimeRuleProcessorSPARQL, datetimeRuleProcessorSQL, datetimeRuleProcessorSequelize, datetimeRuleProcessorSpEL, datetimeRuleProcessorTanStackDB, datetimeValueProcessorANSI, datetimeValueProcessorMSSQL, datetimeValueProcessorMySQL, datetimeValueProcessorOracle, datetimeValueProcessorPostgreSQL, jsonLogicDateTimeOperations, rqbDateTimeLibraryAPI };
|
|
61
105
|
//# sourceMappingURL=react-querybuilder_datetime.legacy-esm.luxon.d.ts.map
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { E as getDatetimeJsonLogicOperations, O as isISOStringDateOnly, S as getDatetimeRuleProcessorDrizzle, T as getDatetimeRuleProcessorCEL, _ as getDatetimeRuleProcessorMongoDBQuery, a as getDatetimeValueProcessorMySQL, b as getDatetimeRuleProcessorGremlin, c as getDatetimeRuleProcessorSpEL, d as getDatetimeRuleProcessorPrisma, f as getDatetimeRuleProcessorParameterized, g as getDatetimeRuleProcessorMongoDB, h as getDatetimeRuleProcessorNL, i as getDatetimeValueProcessorMSSQL, l as getDatetimeRuleProcessorSPARQL, n as getDatetimeRuleProcessorSQL, o as getDatetimeValueProcessorOracle, r as getDatetimeValueProcessorANSI, s as getDatetimeValueProcessorPostgreSQL, t as getDatetimeRuleProcessorTanStackDB, u as getDatetimeRuleProcessorSequelize, v as getDatetimeRuleProcessorLDAP, w as getDatetimeRuleProcessorCypher, x as getDatetimeRuleProcessorElasticSearch, y as getDatetimeRuleProcessorJSONata } from "./getDatetimeRuleProcessorTanStackDB-LDwhMJg0.js";
|
|
2
2
|
import { DateTime } from "luxon";
|
|
3
3
|
//#region src/rqbDateTimeLibraryAPI.luxon.ts
|
|
4
4
|
const toDateTime = (a) => typeof a === "string" ? DateTime.fromISO(a) : DateTime.fromJSDate(a);
|
|
5
5
|
const iso8601DateOnly = "yyyy-MM-dd";
|
|
6
|
+
const durationKeyMap = {
|
|
7
|
+
minute: "minutes",
|
|
8
|
+
hour: "hours",
|
|
9
|
+
day: "days",
|
|
10
|
+
week: "weeks",
|
|
11
|
+
month: "months",
|
|
12
|
+
year: "years"
|
|
13
|
+
};
|
|
6
14
|
/**
|
|
7
15
|
* {@link RQBDateTimeLibraryAPI} for Luxon
|
|
8
16
|
*/
|
|
@@ -20,7 +28,10 @@ const rqbDateTimeLibraryAPI = {
|
|
|
20
28
|
toISOStringDateOnly: (d) => {
|
|
21
29
|
const dToDate = toDateTime(d);
|
|
22
30
|
return dToDate.isValid ? dToDate.toFormat(iso8601DateOnly) : "";
|
|
23
|
-
}
|
|
31
|
+
},
|
|
32
|
+
startOf: (d, unit) => toDateTime(d).startOf(unit).toJSDate(),
|
|
33
|
+
endOf: (d, unit) => toDateTime(d).endOf(unit).toJSDate(),
|
|
34
|
+
add: (d, amount, unit) => toDateTime(d).plus({ [durationKeyMap[unit]]: amount }).toJSDate()
|
|
24
35
|
};
|
|
25
36
|
//#endregion
|
|
26
37
|
//#region src/index.luxon.ts
|
|
@@ -57,6 +68,10 @@ const datetimeValueProcessorPostgreSQL = getDatetimeValueProcessorPostgreSQL(rqb
|
|
|
57
68
|
*/
|
|
58
69
|
const datetimeRuleProcessorCEL = getDatetimeRuleProcessorCEL(rqbDateTimeLibraryAPI);
|
|
59
70
|
/**
|
|
71
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "jsonata" format using Luxon
|
|
72
|
+
*/
|
|
73
|
+
const datetimeRuleProcessorJSONata = getDatetimeRuleProcessorJSONata(rqbDateTimeLibraryAPI);
|
|
74
|
+
/**
|
|
60
75
|
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "mongodb_query" format using Luxon
|
|
61
76
|
*/
|
|
62
77
|
const datetimeRuleProcessorMongoDBQuery = getDatetimeRuleProcessorMongoDBQuery(rqbDateTimeLibraryAPI);
|
|
@@ -72,7 +87,47 @@ const datetimeRuleProcessorCypher = getDatetimeRuleProcessorCypher(rqbDateTimeLi
|
|
|
72
87
|
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "sparql" format using Luxon
|
|
73
88
|
*/
|
|
74
89
|
const datetimeRuleProcessorSPARQL = getDatetimeRuleProcessorSPARQL(rqbDateTimeLibraryAPI);
|
|
90
|
+
/**
|
|
91
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "parameterized"/"parameterized_named" formats
|
|
92
|
+
*/
|
|
93
|
+
const datetimeRuleProcessorParameterized = getDatetimeRuleProcessorParameterized(rqbDateTimeLibraryAPI);
|
|
94
|
+
/**
|
|
95
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "spel" format
|
|
96
|
+
*/
|
|
97
|
+
const datetimeRuleProcessorSpEL = getDatetimeRuleProcessorSpEL(rqbDateTimeLibraryAPI);
|
|
98
|
+
/**
|
|
99
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "ldap" format
|
|
100
|
+
*/
|
|
101
|
+
const datetimeRuleProcessorLDAP = getDatetimeRuleProcessorLDAP(rqbDateTimeLibraryAPI);
|
|
102
|
+
/**
|
|
103
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "gremlin" format
|
|
104
|
+
*/
|
|
105
|
+
const datetimeRuleProcessorGremlin = getDatetimeRuleProcessorGremlin(rqbDateTimeLibraryAPI);
|
|
106
|
+
/**
|
|
107
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "prisma" format
|
|
108
|
+
*/
|
|
109
|
+
const datetimeRuleProcessorPrisma = getDatetimeRuleProcessorPrisma(rqbDateTimeLibraryAPI);
|
|
110
|
+
/**
|
|
111
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "sequelize" format
|
|
112
|
+
*/
|
|
113
|
+
const datetimeRuleProcessorSequelize = getDatetimeRuleProcessorSequelize(rqbDateTimeLibraryAPI);
|
|
114
|
+
/**
|
|
115
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "drizzle" format
|
|
116
|
+
*/
|
|
117
|
+
const datetimeRuleProcessorDrizzle = getDatetimeRuleProcessorDrizzle(rqbDateTimeLibraryAPI);
|
|
118
|
+
/**
|
|
119
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "elasticsearch" format
|
|
120
|
+
*/
|
|
121
|
+
const datetimeRuleProcessorElasticSearch = getDatetimeRuleProcessorElasticSearch(rqbDateTimeLibraryAPI);
|
|
122
|
+
/**
|
|
123
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for "tanstack_db" format
|
|
124
|
+
*/
|
|
125
|
+
const datetimeRuleProcessorTanStackDB = getDatetimeRuleProcessorTanStackDB(rqbDateTimeLibraryAPI);
|
|
126
|
+
/**
|
|
127
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for (deprecated) "mongodb" format
|
|
128
|
+
*/
|
|
129
|
+
const datetimeRuleProcessorMongoDB = getDatetimeRuleProcessorMongoDB(rqbDateTimeLibraryAPI);
|
|
75
130
|
//#endregion
|
|
76
|
-
export { datetimeRuleProcessorCEL, datetimeRuleProcessorCypher, datetimeRuleProcessorMongoDBQuery, datetimeRuleProcessorNL, datetimeRuleProcessorSPARQL, datetimeRuleProcessorSQL, datetimeValueProcessorANSI, datetimeValueProcessorMSSQL, datetimeValueProcessorMySQL, datetimeValueProcessorOracle, datetimeValueProcessorPostgreSQL, jsonLogicDateTimeOperations, rqbDateTimeLibraryAPI };
|
|
131
|
+
export { datetimeRuleProcessorCEL, datetimeRuleProcessorCypher, datetimeRuleProcessorDrizzle, datetimeRuleProcessorElasticSearch, datetimeRuleProcessorGremlin, datetimeRuleProcessorJSONata, datetimeRuleProcessorLDAP, datetimeRuleProcessorMongoDB, datetimeRuleProcessorMongoDBQuery, datetimeRuleProcessorNL, datetimeRuleProcessorParameterized, datetimeRuleProcessorPrisma, datetimeRuleProcessorSPARQL, datetimeRuleProcessorSQL, datetimeRuleProcessorSequelize, datetimeRuleProcessorSpEL, datetimeRuleProcessorTanStackDB, datetimeValueProcessorANSI, datetimeValueProcessorMSSQL, datetimeValueProcessorMySQL, datetimeValueProcessorOracle, datetimeValueProcessorPostgreSQL, jsonLogicDateTimeOperations, rqbDateTimeLibraryAPI };
|
|
77
132
|
|
|
78
133
|
//# sourceMappingURL=react-querybuilder_datetime.legacy-esm.luxon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-querybuilder_datetime.legacy-esm.luxon.js","names":[],"sources":["../src/rqbDateTimeLibraryAPI.luxon.ts","../src/index.luxon.ts"],"sourcesContent":["import { DateTime } from 'luxon';\nimport type { 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\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};\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 { 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.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 \"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\nexport * from './rqbDateTimeLibraryAPI.luxon';\n"],"mappings":";;;AAIA,MAAM,cAAc,MAClB,OAAO,MAAM,WAAW,SAAS,QAAQ,CAAC,IAAI,SAAS,WAAW,CAAC;AACrE,MAAM,kBAAkB;;;;AAKxB,MAAa,wBAA+C;CAC1D,SAAS,GAAG,QAAQ,WAAW,CAAC,EAAE,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,MACV,oBAAoB,CAAC,KAAK,oBAAoB,CAAC,IAC3C,WAAW,CAAC,EAAE,QAAQ,WAAW,CAAC,GAAG,KAAK,IAC1C,CAAC,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC;CACtC,UAAS,MAAK,WAAW,CAAC,EAAE;CAC5B,SAAQ,MAAK,WAAW,CAAC,EAAE,SAAS;CACpC,cAAa,MAAK;EAChB,MAAM,UAAU,WAAW,CAAC;EAC5B,OAAO,QAAQ,UAAU,QAAQ,SAAS,EAAE,YAAY,IAAI;CAC9D;CACA,sBAAqB,MAAK;EACxB,MAAM,UAAU,WAAW,CAAC;EAC5B,OAAO,QAAQ,UAAU,QAAQ,SAAS,eAAe,IAAI;CAC/D;AACF;;;;;;ACFA,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.luxon.js","names":[],"sources":["../src/rqbDateTimeLibraryAPI.luxon.ts","../src/index.luxon.ts"],"sourcesContent":["import { DateTime } from 'luxon';\nimport type { RelativeDateTimeUnit, RQBDateTimeLibraryAPI } from './types';\nimport { isISOStringDateOnly } from './utils';\n\nconst toDateTime = (a: string | Date) =>\n typeof a === 'string' ? DateTime.fromISO(a) : DateTime.fromJSDate(a);\nconst iso8601DateOnly = 'yyyy-MM-dd';\n\nconst durationKeyMap: Record<RelativeDateTimeUnit, string> = {\n minute: 'minutes',\n hour: 'hours',\n day: 'days',\n week: 'weeks',\n month: 'months',\n year: 'years',\n};\n\n/**\n * {@link RQBDateTimeLibraryAPI} for Luxon\n */\nexport const rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI = {\n format: (d, fmt) => toDateTime(d).toFormat(fmt.replace('YYYY-MM-DD', iso8601DateOnly)),\n isAfter: (a, b) => toDateTime(a) > toDateTime(b),\n isBefore: (a, b) => toDateTime(a) < toDateTime(b),\n isSame: (a, b) =>\n isISOStringDateOnly(a) || isISOStringDateOnly(b)\n ? toDateTime(a).hasSame(toDateTime(b), 'day')\n : +toDateTime(a) === +toDateTime(b),\n isValid: d => toDateTime(d).isValid,\n toDate: d => toDateTime(d).toJSDate(),\n toISOString: d => {\n const dToDate = toDateTime(d);\n return dToDate.isValid ? dToDate.toJSDate().toISOString() : '';\n },\n toISOStringDateOnly: d => {\n const dToDate = toDateTime(d);\n return dToDate.isValid ? dToDate.toFormat(iso8601DateOnly) : '';\n },\n startOf: (d, unit) => toDateTime(d).startOf(unit).toJSDate(),\n endOf: (d, unit) => toDateTime(d).endOf(unit).toJSDate(),\n add: (d, amount, unit) =>\n toDateTime(d)\n .plus({ [durationKeyMap[unit]]: amount })\n .toJSDate(),\n};\n","/**\n * Import from `\"@react-querybuilder/datetime/luxon\"` for enhanced date/time support using [Luxon](https://moment.github.io/luxon/).\n *\n * @module luxon\n */\n\nimport type { RuleProcessor, ValueProcessorByRule } from 'react-querybuilder';\nimport { getDatetimeJsonLogicOperations } from './getDatetimeJsonLogicOperations';\nimport { getDatetimeRuleProcessorCEL } from './getDatetimeRuleProcessorCEL';\nimport { getDatetimeRuleProcessorCypher } from './getDatetimeRuleProcessorCypher';\nimport { getDatetimeRuleProcessorDrizzle } from './getDatetimeRuleProcessorDrizzle';\nimport { getDatetimeRuleProcessorElasticSearch } from './getDatetimeRuleProcessorElasticSearch';\nimport { getDatetimeRuleProcessorGremlin } from './getDatetimeRuleProcessorGremlin';\nimport { getDatetimeRuleProcessorJSONata } from './getDatetimeRuleProcessorJSONata';\nimport { getDatetimeRuleProcessorLDAP } from './getDatetimeRuleProcessorLDAP';\nimport { getDatetimeRuleProcessorMongoDB } from './getDatetimeRuleProcessorMongoDB';\nimport { getDatetimeRuleProcessorMongoDBQuery } from './getDatetimeRuleProcessorMongoDBQuery';\nimport { getDatetimeRuleProcessorNL } from './getDatetimeRuleProcessorNL';\nimport { getDatetimeRuleProcessorParameterized } from './getDatetimeRuleProcessorParameterized';\nimport { getDatetimeRuleProcessorPrisma } from './getDatetimeRuleProcessorPrisma';\nimport { getDatetimeRuleProcessorSequelize } from './getDatetimeRuleProcessorSequelize';\nimport { getDatetimeRuleProcessorSPARQL } from './getDatetimeRuleProcessorSPARQL';\nimport { getDatetimeRuleProcessorSpEL } from './getDatetimeRuleProcessorSpEL';\nimport {\n getDatetimeRuleProcessorSQL,\n getDatetimeValueProcessorANSI,\n getDatetimeValueProcessorMSSQL,\n getDatetimeValueProcessorMySQL,\n getDatetimeValueProcessorOracle,\n getDatetimeValueProcessorPostgreSQL,\n} from './getDatetimeRuleProcessorSQL';\nimport { getDatetimeRuleProcessorTanStackDB } from './getDatetimeRuleProcessorTanStackDB';\nimport { rqbDateTimeLibraryAPI } from './rqbDateTimeLibraryAPI.luxon';\nimport type { RQBJsonLogicDateTimeOperations } from './types';\n\n/**\n * Custom JsonLogic date/time operations using Luxon\n */\nexport const jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations =\n getDatetimeJsonLogicOperations(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sql\" format using Luxon\n */\nexport const datetimeRuleProcessorSQL: RuleProcessor =\n getDatetimeRuleProcessorSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"ansi\" preset) using Luxon\n */\nexport const datetimeValueProcessorANSI: ValueProcessorByRule =\n getDatetimeValueProcessorANSI(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"mssql\" preset) using Luxon\n */\nexport const datetimeValueProcessorMSSQL: ValueProcessorByRule =\n getDatetimeValueProcessorMSSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"mysql\" preset) using Luxon\n */\nexport const datetimeValueProcessorMySQL: ValueProcessorByRule =\n getDatetimeValueProcessorMySQL(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"oracle\" preset) using Luxon\n */\nexport const datetimeValueProcessorOracle: ValueProcessorByRule =\n getDatetimeValueProcessorOracle(rqbDateTimeLibraryAPI);\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} value processor for \"sql\" format (\"postgresql\" preset) using Luxon\n */\nexport const datetimeValueProcessorPostgreSQL: ValueProcessorByRule =\n getDatetimeValueProcessorPostgreSQL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"cel\" format using Luxon\n */\nexport const datetimeRuleProcessorCEL: ValueProcessorByRule =\n getDatetimeRuleProcessorCEL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"jsonata\" format using Luxon\n */\nexport const datetimeRuleProcessorJSONata: RuleProcessor =\n getDatetimeRuleProcessorJSONata(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"mongodb_query\" format using Luxon\n */\nexport const datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule =\n getDatetimeRuleProcessorMongoDBQuery(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"natural_language\" format using Luxon\n */\nexport const datetimeRuleProcessorNL: ValueProcessorByRule =\n getDatetimeRuleProcessorNL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"cypher\"/\"gql\" format using Luxon\n */\nexport const datetimeRuleProcessorCypher: ValueProcessorByRule =\n getDatetimeRuleProcessorCypher(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sparql\" format using Luxon\n */\nexport const datetimeRuleProcessorSPARQL: ValueProcessorByRule =\n getDatetimeRuleProcessorSPARQL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"parameterized\"/\"parameterized_named\" formats\n */\nexport const datetimeRuleProcessorParameterized: RuleProcessor =\n getDatetimeRuleProcessorParameterized(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"spel\" format\n */\nexport const datetimeRuleProcessorSpEL: RuleProcessor =\n getDatetimeRuleProcessorSpEL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"ldap\" format\n */\nexport const datetimeRuleProcessorLDAP: RuleProcessor =\n getDatetimeRuleProcessorLDAP(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"gremlin\" format\n */\nexport const datetimeRuleProcessorGremlin: RuleProcessor =\n getDatetimeRuleProcessorGremlin(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"prisma\" format\n */\nexport const datetimeRuleProcessorPrisma: RuleProcessor =\n getDatetimeRuleProcessorPrisma(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"sequelize\" format\n */\nexport const datetimeRuleProcessorSequelize: RuleProcessor =\n getDatetimeRuleProcessorSequelize(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"drizzle\" format\n */\nexport const datetimeRuleProcessorDrizzle: RuleProcessor =\n getDatetimeRuleProcessorDrizzle(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"elasticsearch\" format\n */\nexport const datetimeRuleProcessorElasticSearch: RuleProcessor =\n getDatetimeRuleProcessorElasticSearch(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for \"tanstack_db\" format\n */\nexport const datetimeRuleProcessorTanStackDB: RuleProcessor =\n getDatetimeRuleProcessorTanStackDB(rqbDateTimeLibraryAPI);\n\n/**\n * {@link @react-querybuilder/core!formatQuery formatQuery} rule processor for (deprecated) \"mongodb\" format\n */\nexport const datetimeRuleProcessorMongoDB: RuleProcessor =\n getDatetimeRuleProcessorMongoDB(rqbDateTimeLibraryAPI);\n\nexport * from './rqbDateTimeLibraryAPI.luxon';\n"],"mappings":";;;AAIA,MAAM,cAAc,MAClB,OAAO,MAAM,WAAW,SAAS,QAAQ,CAAC,IAAI,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,MACV,oBAAoB,CAAC,KAAK,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,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