@react-querybuilder/datetime 8.20.1 → 8.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -3
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-BVNfYaIj.js +2 -0
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-BVNfYaIj.js.map +1 -0
- package/dist/cjs/{getDatetimeRuleProcessorTanStackDB-CL79A1_x.js → getDatetimeRuleProcessorTanStackDB-cmGqMT0Q.js} +83 -216
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-cmGqMT0Q.js.map +1 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.development.d.ts +3 -123
- package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.d.ts +2 -2
- package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.js +3 -2
- package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.d.ts +2 -2
- package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.js +53 -26
- package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.js +10 -467
- package/dist/cjs/react-querybuilder_datetime.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.d.ts +2 -2
- package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.js +26 -144
- package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.d.ts +2 -2
- package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.js +3 -2
- package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.ui.d.ts +228 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.development.ui.js +464 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.development.ui.js.map +1 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.production.d.ts +3 -123
- package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.d.ts +2 -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 +2 -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 +2 -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 +2 -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/react-querybuilder_datetime.cjs.production.ui.d.ts +228 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.production.ui.js +2 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.production.ui.js.map +1 -0
- package/dist/cjs/rolldown-runtime-CMqjfN_6.js +1 -0
- package/dist/cjs/rolldown-runtime-D6vf50IK.js +28 -0
- package/dist/cjs/rqbDateTimeLibraryAPI.jsdate-BPEcMhhr.js +128 -0
- package/dist/cjs/rqbDateTimeLibraryAPI.jsdate-BPEcMhhr.js.map +1 -0
- package/dist/cjs/rqbDateTimeLibraryAPI.jsdate-ioz2B1zh.js +2 -0
- package/dist/cjs/rqbDateTimeLibraryAPI.jsdate-ioz2B1zh.js.map +1 -0
- package/dist/cjs/{types-XYMw0jFT.d.ts → types-Di8kFIXV.d.ts} +3 -103
- package/dist/cjs/ui.d.ts +1 -0
- package/dist/cjs/ui.js +6 -0
- package/dist/cjs/utils-DUePrC--.js +154 -0
- package/dist/cjs/utils-DUePrC--.js.map +1 -0
- package/dist/cjs/utils-jkW5R1AA.js +2 -0
- package/dist/cjs/utils-jkW5R1AA.js.map +1 -0
- package/dist/{getDatetimeRuleProcessorTanStackDB-BcOC-o2A.mjs → getDatetimeRuleProcessorTanStackDB-B93XaPdB.mjs} +4 -107
- package/dist/getDatetimeRuleProcessorTanStackDB-B93XaPdB.mjs.map +1 -0
- package/dist/{getDatetimeRuleProcessorTanStackDB-BL8mbdbl.js → getDatetimeRuleProcessorTanStackDB-BDFJlfJh.js} +4 -181
- package/dist/getDatetimeRuleProcessorTanStackDB-BDFJlfJh.js.map +1 -0
- package/dist/getDatetimeRuleProcessorTanStackDB-Czg9Fbb8.mjs +2 -0
- package/dist/getDatetimeRuleProcessorTanStackDB-Czg9Fbb8.mjs.map +1 -0
- package/dist/objectSpread2-73AKOozq.js +181 -0
- package/dist/objectSpread2-73AKOozq.js.map +1 -0
- package/dist/react-querybuilder_datetime.d.mts +3 -123
- package/dist/react-querybuilder_datetime.date-fns.d.mts +2 -2
- package/dist/react-querybuilder_datetime.date-fns.mjs +2 -1
- package/dist/react-querybuilder_datetime.date-fns.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.dayjs.d.mts +2 -2
- package/dist/react-querybuilder_datetime.dayjs.mjs +27 -2
- package/dist/react-querybuilder_datetime.dayjs.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.jsdate.d.mts +2 -2
- package/dist/react-querybuilder_datetime.jsdate.mjs +2 -120
- package/dist/react-querybuilder_datetime.jsdate.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.d.ts +3 -123
- package/dist/react-querybuilder_datetime.legacy-esm.date-fns.d.ts +2 -2
- package/dist/react-querybuilder_datetime.legacy-esm.date-fns.js +2 -1
- package/dist/react-querybuilder_datetime.legacy-esm.date-fns.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.dayjs.d.ts +2 -2
- package/dist/react-querybuilder_datetime.legacy-esm.dayjs.js +27 -2
- package/dist/react-querybuilder_datetime.legacy-esm.dayjs.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.js +4 -449
- package/dist/react-querybuilder_datetime.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.jsdate.d.ts +2 -2
- package/dist/react-querybuilder_datetime.legacy-esm.jsdate.js +2 -120
- package/dist/react-querybuilder_datetime.legacy-esm.jsdate.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.luxon.d.ts +2 -2
- package/dist/react-querybuilder_datetime.legacy-esm.luxon.js +2 -1
- package/dist/react-querybuilder_datetime.legacy-esm.luxon.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.ui.d.ts +228 -0
- package/dist/react-querybuilder_datetime.legacy-esm.ui.js +451 -0
- package/dist/react-querybuilder_datetime.legacy-esm.ui.js.map +1 -0
- package/dist/react-querybuilder_datetime.luxon.d.mts +2 -2
- package/dist/react-querybuilder_datetime.luxon.mjs +2 -1
- package/dist/react-querybuilder_datetime.luxon.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.mjs +4 -446
- package/dist/react-querybuilder_datetime.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.production.d.mts +3 -123
- package/dist/react-querybuilder_datetime.production.date-fns.d.mts +2 -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 +2 -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 +2 -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 +2 -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/react-querybuilder_datetime.production.ui.d.mts +228 -0
- package/dist/react-querybuilder_datetime.production.ui.mjs +2 -0
- package/dist/react-querybuilder_datetime.production.ui.mjs.map +1 -0
- package/dist/react-querybuilder_datetime.ui.d.mts +228 -0
- package/dist/react-querybuilder_datetime.ui.mjs +448 -0
- package/dist/react-querybuilder_datetime.ui.mjs.map +1 -0
- package/dist/rqbDateTimeLibraryAPI.jsdate-CDOtydFq.mjs +2 -0
- package/dist/rqbDateTimeLibraryAPI.jsdate-CDOtydFq.mjs.map +1 -0
- package/dist/rqbDateTimeLibraryAPI.jsdate-CpGoQAje.js +123 -0
- package/dist/rqbDateTimeLibraryAPI.jsdate-CpGoQAje.js.map +1 -0
- package/dist/rqbDateTimeLibraryAPI.jsdate-D66yJ1hK.mjs +123 -0
- package/dist/rqbDateTimeLibraryAPI.jsdate-D66yJ1hK.mjs.map +1 -0
- package/dist/{types-CdjHqQ0k.d.ts → types-Di8kFIXV.d.mts} +3 -103
- package/dist/{types-CdjHqQ0k.d.mts → types-Di8kFIXV.d.ts} +3 -103
- package/dist/utils-BC2SALFm.mjs +107 -0
- package/dist/utils-BC2SALFm.mjs.map +1 -0
- package/dist/utils-VKS8YY2D.mjs +2 -0
- package/dist/utils-VKS8YY2D.mjs.map +1 -0
- package/package.json +27 -8
- package/ui/package.json +4 -0
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-CL79A1_x.js.map +0 -1
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-DgUg_arY.js +0 -2
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-DgUg_arY.js.map +0 -1
- package/dist/cjs/rqbDateTimeLibraryAPI.dayjs-BfILPx88.js +0 -2
- package/dist/cjs/rqbDateTimeLibraryAPI.dayjs-BfILPx88.js.map +0 -1
- package/dist/cjs/rqbDateTimeLibraryAPI.dayjs-CzLh_zi9.js +0 -63
- package/dist/cjs/rqbDateTimeLibraryAPI.dayjs-CzLh_zi9.js.map +0 -1
- package/dist/getDatetimeRuleProcessorTanStackDB-BL8mbdbl.js.map +0 -1
- package/dist/getDatetimeRuleProcessorTanStackDB-BcOC-o2A.mjs.map +0 -1
- package/dist/getDatetimeRuleProcessorTanStackDB-Dloxv6k2.mjs +0 -2
- package/dist/getDatetimeRuleProcessorTanStackDB-Dloxv6k2.mjs.map +0 -1
- package/dist/rqbDateTimeLibraryAPI.dayjs-BW7faYFD.mjs +0 -29
- package/dist/rqbDateTimeLibraryAPI.dayjs-BW7faYFD.mjs.map +0 -1
- package/dist/rqbDateTimeLibraryAPI.dayjs-BoX90aqZ.mjs +0 -2
- package/dist/rqbDateTimeLibraryAPI.dayjs-BoX90aqZ.mjs.map +0 -1
- package/dist/rqbDateTimeLibraryAPI.dayjs-Da4VXvFM.js +0 -29
- package/dist/rqbDateTimeLibraryAPI.dayjs-Da4VXvFM.js.map +0 -1
|
@@ -1,108 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const isISOStringDateOnly = (date) => typeof date === "string" && /^\d{4}-\d{2}-\d{2}$/.test(date);
|
|
4
|
-
/**
|
|
5
|
-
* Type guard for {@link RelativeDateTimeValue}. Relative values are stored as objects
|
|
6
|
-
* (distinguishing them from the ISO 8601 strings used for absolute date/time values).
|
|
7
|
-
*/
|
|
8
|
-
const isRelativeDateTimeValue = (value) => typeof value === "object" && value !== null && value.mode === "relative" && typeof value.anchor === "string";
|
|
9
|
-
const anchorRegExp = /^(start|end)Of(Day|Week|Month|Year)$/;
|
|
10
|
-
/**
|
|
11
|
-
* Resolves a {@link RelativeDateTimeValue} into a concrete `Date` using the given
|
|
12
|
-
* date library API. The anchor is applied relative to `base` (defaulting to now),
|
|
13
|
-
* then the signed offset is added.
|
|
14
|
-
*/
|
|
15
|
-
const resolveRelativeDateTime = (apiFns, value, base = /* @__PURE__ */ new Date()) => {
|
|
16
|
-
let result = base;
|
|
17
|
-
if (value.anchor !== "now") {
|
|
18
|
-
const match = anchorRegExp.exec(value.anchor);
|
|
19
|
-
// v8 ignore next -- guarded by the RelativeDateTimeAnchor type
|
|
20
|
-
if (match) {
|
|
21
|
-
const unit = match[2].toLowerCase();
|
|
22
|
-
result = match[1] === "start" ? apiFns.startOf(result, unit) : apiFns.endOf(result, unit);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (value.offset) result = apiFns.add(result, value.offset, value.unit);
|
|
26
|
-
return result;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Whether a `datatype` represents a date-only (no time component) type, e.g. `date`
|
|
30
|
-
* but not `datetime`/`datetimeoffset`/`timestamp`. Used to choose the precision when
|
|
31
|
-
* materializing a relative value to an ISO 8601 string.
|
|
32
|
-
*/
|
|
33
|
-
const isDateOnlyDatatype = (datatype) => /^date\b/i.test(datatype);
|
|
34
|
-
/**
|
|
35
|
-
* Replaces any {@link RelativeDateTimeValue} in `value` (or in each element, if `value`
|
|
36
|
-
* is an array) with a concrete ISO 8601 string, resolved via
|
|
37
|
-
* {@link resolveRelativeDateTime}. The "now" reference can be pinned with
|
|
38
|
-
* `opts.context.relativeDateTimeBase` for deterministic output; precision (date-only vs
|
|
39
|
-
* full) follows the field's `datatype`. Non-relative values pass through unchanged.
|
|
40
|
-
*/
|
|
41
|
-
const materializeRelativeValues = (apiFns, value, opts) => {
|
|
42
|
-
const base = opts?.context?.relativeDateTimeBase;
|
|
43
|
-
const dateOnly = isDateOnlyDatatype(opts?.fieldData?.datatype);
|
|
44
|
-
const conv = (v) => {
|
|
45
|
-
if (!isRelativeDateTimeValue(v)) return v;
|
|
46
|
-
const resolved = resolveRelativeDateTime(apiFns, v, base);
|
|
47
|
-
return dateOnly ? apiFns.toISOStringDateOnly(resolved) : apiFns.toISOString(resolved);
|
|
48
|
-
};
|
|
49
|
-
return Array.isArray(value) ? value.map(conv) : conv(value);
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Resolves a rule's operator for export, applying any `context.relativeOperatorMap`
|
|
53
|
-
* entry. Operator-driven mode controllers (see `createOperatorModeController`) use
|
|
54
|
-
* dedicated operator names to signal relative mode; this maps those names to the real
|
|
55
|
-
* comparison operator at format time. Operators absent from the map pass through unchanged.
|
|
56
|
-
*/
|
|
57
|
-
const resolveDatetimeOperator = (...[rule, opts]) => (opts?.context?.relativeOperatorMap)?.[rule.operator] ?? rule.operator;
|
|
58
|
-
/**
|
|
59
|
-
* Prepares a date/time rule for delegation to a non-symbolic default rule processor
|
|
60
|
-
* (e.g. "parameterized", "spel", "ldap", "gremlin", "prisma", "sequelize", "drizzle",
|
|
61
|
-
* "tanstack_db"). Relative values are materialized to concrete dates (these formats have
|
|
62
|
-
* no symbolic relative form), and `between`/`notBetween` operands are ordered
|
|
63
|
-
* chronologically (defaults can't reorder non-numeric date operands). When `asDate` is
|
|
64
|
-
* set, each valid value is converted to a `Date` (for object-based formats); otherwise
|
|
65
|
-
* the materialized ISO 8601 strings are passed through. The resolved `operator` (after
|
|
66
|
-
* any `relativeOperatorMap` mapping) is returned alongside the prepared `value`.
|
|
67
|
-
*/
|
|
68
|
-
const materializeForExport = (apiFns, rule, opts, asDate = false) => {
|
|
69
|
-
const operator = resolveDatetimeOperator(rule, opts);
|
|
70
|
-
const materialized = materializeRelativeValues(apiFns, rule.value, opts);
|
|
71
|
-
let prepared = materialized;
|
|
72
|
-
if (Array.isArray(materialized) && materialized.length >= 2) {
|
|
73
|
-
const opLC = operator.toLowerCase();
|
|
74
|
-
if (opLC === "between" || opLC === "notbetween") {
|
|
75
|
-
const first = apiFns.toDate(materialized[0]);
|
|
76
|
-
const second = apiFns.toDate(materialized[1]);
|
|
77
|
-
if (apiFns.isValid(first) && apiFns.isValid(second) && !apiFns.isBefore(first, second)) prepared = [
|
|
78
|
-
materialized[1],
|
|
79
|
-
materialized[0],
|
|
80
|
-
...materialized.slice(2)
|
|
81
|
-
];
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
if (!asDate) return {
|
|
85
|
-
operator,
|
|
86
|
-
value: prepared
|
|
87
|
-
};
|
|
88
|
-
const toDateVal = (v) => {
|
|
89
|
-
const d = apiFns.toDate(v);
|
|
90
|
-
return apiFns.isValid(d) ? d : v;
|
|
91
|
-
};
|
|
92
|
-
return {
|
|
93
|
-
operator,
|
|
94
|
-
value: Array.isArray(prepared) ? prepared.map(toDateVal) : toDateVal(prepared)
|
|
95
|
-
};
|
|
96
|
-
};
|
|
97
|
-
const defaultIsDateField = (...[rule, opts]) => rule.operator !== "contains" && rule.operator !== "beginsWith" && rule.operator !== "endsWith" && rule.operator !== "doesNotContain" && rule.operator !== "doesNotBeginWith" && rule.operator !== "doesNotEndWith" && rule.operator !== "null" && rule.operator !== "notNull" && /^(?:date|datetime|datetimeoffset|timestamp)\b/i.test(opts?.fieldData?.datatype);
|
|
98
|
-
const processIsDateField = (isDateField, ...[rule, opts]) => {
|
|
99
|
-
if (typeof isDateField === "boolean") return isDateField;
|
|
100
|
-
if (typeof isDateField === "function") return isDateField(rule, opts);
|
|
101
|
-
if (Array.isArray(isDateField)) return isDateField.some((condition) => Object.entries(condition).every(([key, value]) => opts?.fieldData?.[key] === value));
|
|
102
|
-
if (typeof isDateField === "object") return Object.entries(isDateField).every(([key, value]) => opts?.fieldData?.[key] === value);
|
|
103
|
-
return defaultIsDateField(rule, opts);
|
|
104
|
-
};
|
|
105
|
-
//#endregion
|
|
1
|
+
const require_utils = require("./utils-DUePrC--.js");
|
|
2
|
+
let _react_querybuilder_core = require("@react-querybuilder/core");
|
|
106
3
|
//#region src/getDatetimeJsonLogicOperations.ts
|
|
107
4
|
/**
|
|
108
5
|
* Custom operations for use with JsonLogic objects generated by
|
|
@@ -122,7 +19,7 @@ const getDatetimeJsonLogicOperations = (apiFns) => {
|
|
|
122
19
|
dateOnOrAfter: (a, b) => isAfter(a, b) || isSame(a, b),
|
|
123
20
|
dateOnOrBefore: (a, b) => isBefore(a, b) || isSame(a, b),
|
|
124
21
|
dateRelative: (anchor, offset, unit, dateOnly) => {
|
|
125
|
-
const resolved = resolveRelativeDateTime(apiFns, {
|
|
22
|
+
const resolved = require_utils.resolveRelativeDateTime(apiFns, {
|
|
126
23
|
mode: "relative",
|
|
127
24
|
anchor,
|
|
128
25
|
offset,
|
|
@@ -142,10 +39,10 @@ const shouldNegate$3 = (op) => /^(does)?not/i.test(op);
|
|
|
142
39
|
const getDatetimeRuleProcessorCEL = (apiFns) => (rule, options) => {
|
|
143
40
|
const opts = options ?? ( /* v8 ignore start -- @preserve */ {});
|
|
144
41
|
const { context = {} } = opts;
|
|
145
|
-
if (rule.valueSource === "field" || !processIsDateField(context.isDateField, rule, opts)) return (0,
|
|
42
|
+
if (rule.valueSource === "field" || !require_utils.processIsDateField(context.isDateField, rule, opts)) return (0, _react_querybuilder_core.defaultRuleProcessorCEL)(rule, opts);
|
|
146
43
|
const ts = (d) => `timestamp("${apiFns.toISOString(d)}")`;
|
|
147
|
-
const value = materializeRelativeValues(apiFns, rule.value, opts);
|
|
148
|
-
const operatorTL = (0,
|
|
44
|
+
const value = require_utils.materializeRelativeValues(apiFns, rule.value, opts);
|
|
45
|
+
const operatorTL = (0, _react_querybuilder_core.lc)(require_utils.resolveDatetimeOperator(rule, opts).replace(/^=$/, "=="));
|
|
149
46
|
switch (operatorTL) {
|
|
150
47
|
case "<":
|
|
151
48
|
case "<=":
|
|
@@ -154,7 +51,7 @@ const getDatetimeRuleProcessorCEL = (apiFns) => (rule, options) => {
|
|
|
154
51
|
case ">":
|
|
155
52
|
case ">=": return `${rule.field} ${operatorTL} ${ts(value)}`;
|
|
156
53
|
}
|
|
157
|
-
const valueAsDateArray = (0,
|
|
54
|
+
const valueAsDateArray = (0, _react_querybuilder_core.toArray)(value, { retainEmptyStrings: false }).map((v) => apiFns.toDate(v)).filter((dateVal) => apiFns.isValid(dateVal));
|
|
158
55
|
switch (operatorTL) {
|
|
159
56
|
case "in":
|
|
160
57
|
case "notin": {
|
|
@@ -170,7 +67,7 @@ const getDatetimeRuleProcessorCEL = (apiFns) => (rule, options) => {
|
|
|
170
67
|
return operatorTL === "between" ? `(${rule.field} >= ${ts(firstDate)} && ${rule.field} <= ${ts(secondDate)})` : `(${rule.field} < ${ts(firstDate)} || ${rule.field} > ${ts(secondDate)})`;
|
|
171
68
|
}
|
|
172
69
|
}
|
|
173
|
-
return (0,
|
|
70
|
+
return (0, _react_querybuilder_core.defaultRuleProcessorCEL)(rule, opts);
|
|
174
71
|
};
|
|
175
72
|
//#endregion
|
|
176
73
|
//#region src/getDatetimeRuleProcessorCypher.ts
|
|
@@ -194,14 +91,14 @@ const cypherTemporal = (iso, dateOnly) => dateOnly ? `date('${iso}')` : `datetim
|
|
|
194
91
|
const getDatetimeRuleProcessorCypher = (apiFns) => (rule, options) => {
|
|
195
92
|
const opts = options ?? ( /* v8 ignore start -- @preserve */ {});
|
|
196
93
|
const { context = {} } = opts;
|
|
197
|
-
if (rule.valueSource === "field" || !processIsDateField(context.isDateField, rule, opts)) return (0,
|
|
94
|
+
if (rule.valueSource === "field" || !require_utils.processIsDateField(context.isDateField, rule, opts)) return (0, _react_querybuilder_core.defaultRuleProcessorCypher)(rule, opts);
|
|
198
95
|
const { field } = rule;
|
|
199
|
-
const operatorTL = (0,
|
|
96
|
+
const operatorTL = (0, _react_querybuilder_core.lc)(require_utils.resolveDatetimeOperator(rule, opts));
|
|
200
97
|
if (operatorTL === "olderthanduration") return `datetime() - ${field} > duration('${rule.value}')`;
|
|
201
98
|
if (operatorTL === "withinduration") return `datetime() - ${field} <= duration('${rule.value}')`;
|
|
202
|
-
const valueAsDateArray = (0,
|
|
99
|
+
const valueAsDateArray = (0, _react_querybuilder_core.toArray)(require_utils.materializeRelativeValues(apiFns, rule.value, opts), { retainEmptyStrings: false }).map((v) => [v, apiFns.toDate(v)]).filter(([, d]) => apiFns.isValid(d));
|
|
203
100
|
const fmtDate = (originalValue) => {
|
|
204
|
-
const dateOnly = isISOStringDateOnly(originalValue);
|
|
101
|
+
const dateOnly = require_utils.isISOStringDateOnly(originalValue);
|
|
205
102
|
return cypherTemporal(dateOnly ? apiFns.toISOStringDateOnly(originalValue) : apiFns.toISOString(originalValue), dateOnly);
|
|
206
103
|
};
|
|
207
104
|
switch (operatorTL) {
|
|
@@ -237,9 +134,9 @@ const getDatetimeRuleProcessorCypher = (apiFns) => (rule, options) => {
|
|
|
237
134
|
const getDatetimeRuleProcessorDrizzle = (apiFns) => (rule, options) => {
|
|
238
135
|
const opts = options ?? ( /* v8 ignore start -- @preserve */ {});
|
|
239
136
|
const { context = {} } = opts;
|
|
240
|
-
if (rule.valueSource === "field" || !processIsDateField(context.isDateField, rule, opts)) return (0,
|
|
241
|
-
const { operator, value } = materializeForExport(apiFns, rule, opts, true);
|
|
242
|
-
return (0,
|
|
137
|
+
if (rule.valueSource === "field" || !require_utils.processIsDateField(context.isDateField, rule, opts)) return (0, _react_querybuilder_core.defaultRuleProcessorDrizzle)(rule, opts);
|
|
138
|
+
const { operator, value } = require_utils.materializeForExport(apiFns, rule, opts, true);
|
|
139
|
+
return (0, _react_querybuilder_core.defaultRuleProcessorDrizzle)({
|
|
243
140
|
...rule,
|
|
244
141
|
operator,
|
|
245
142
|
value
|
|
@@ -256,9 +153,9 @@ const getDatetimeRuleProcessorDrizzle = (apiFns) => (rule, options) => {
|
|
|
256
153
|
const getDatetimeRuleProcessorElasticSearch = (apiFns) => (rule, options) => {
|
|
257
154
|
const opts = options ?? ( /* v8 ignore start -- @preserve */ {});
|
|
258
155
|
const { context = {} } = opts;
|
|
259
|
-
if (rule.valueSource === "field" || !processIsDateField(context.isDateField, rule, opts)) return (0,
|
|
260
|
-
const { operator, value } = materializeForExport(apiFns, rule, opts);
|
|
261
|
-
return (0,
|
|
156
|
+
if (rule.valueSource === "field" || !require_utils.processIsDateField(context.isDateField, rule, opts)) return (0, _react_querybuilder_core.defaultRuleProcessorElasticSearch)(rule, opts);
|
|
157
|
+
const { operator, value } = require_utils.materializeForExport(apiFns, rule, opts);
|
|
158
|
+
return (0, _react_querybuilder_core.defaultRuleProcessorElasticSearch)({
|
|
262
159
|
...rule,
|
|
263
160
|
operator,
|
|
264
161
|
value
|
|
@@ -275,9 +172,9 @@ const getDatetimeRuleProcessorElasticSearch = (apiFns) => (rule, options) => {
|
|
|
275
172
|
const getDatetimeRuleProcessorGremlin = (apiFns) => (rule, options) => {
|
|
276
173
|
const opts = options ?? ( /* v8 ignore start -- @preserve */ {});
|
|
277
174
|
const { context = {} } = opts;
|
|
278
|
-
if (rule.valueSource === "field" || !processIsDateField(context.isDateField, rule, opts)) return (0,
|
|
279
|
-
const { operator, value } = materializeForExport(apiFns, rule, opts);
|
|
280
|
-
return (0,
|
|
175
|
+
if (rule.valueSource === "field" || !require_utils.processIsDateField(context.isDateField, rule, opts)) return (0, _react_querybuilder_core.defaultRuleProcessorGremlin)(rule, opts);
|
|
176
|
+
const { operator, value } = require_utils.materializeForExport(apiFns, rule, opts);
|
|
177
|
+
return (0, _react_querybuilder_core.defaultRuleProcessorGremlin)({
|
|
281
178
|
...rule,
|
|
282
179
|
operator,
|
|
283
180
|
value
|
|
@@ -297,11 +194,11 @@ const getDatetimeRuleProcessorJSONata = (apiFns) => (rule, options) => {
|
|
|
297
194
|
// v8 ignore next
|
|
298
195
|
const { quoteFieldNamesWith = ["", ""], fieldIdentifierSeparator = "" } = opts;
|
|
299
196
|
const { field, valueSource } = rule;
|
|
300
|
-
const operator = resolveDatetimeOperator(rule, opts);
|
|
301
|
-
if (!processIsDateField(context.isDateField, rule, opts)) return (0,
|
|
197
|
+
const operator = require_utils.resolveDatetimeOperator(rule, opts);
|
|
198
|
+
if (!require_utils.processIsDateField(context.isDateField, rule, opts)) return (0, _react_querybuilder_core.defaultRuleProcessorJSONata)(rule, opts);
|
|
302
199
|
const valueIsField = valueSource === "field";
|
|
303
|
-
const value = valueIsField ? rule.value : materializeRelativeValues(apiFns, rule.value, opts);
|
|
304
|
-
const fldToMs = (f) => `$toMillis(${(0,
|
|
200
|
+
const value = valueIsField ? rule.value : require_utils.materializeRelativeValues(apiFns, rule.value, opts);
|
|
201
|
+
const fldToMs = (f) => `$toMillis(${(0, _react_querybuilder_core.getQuotedFieldName)(f, {
|
|
305
202
|
quoteFieldNamesWith,
|
|
306
203
|
fieldIdentifierSeparator
|
|
307
204
|
})})`;
|
|
@@ -314,7 +211,7 @@ const getDatetimeRuleProcessorJSONata = (apiFns) => (rule, options) => {
|
|
|
314
211
|
case ">":
|
|
315
212
|
case ">=": return `${fldToMs(field)} ${operator} ${valueIsField ? fldToMs(value) : valToMs(value)}`;
|
|
316
213
|
}
|
|
317
|
-
const valueAsArray = (0,
|
|
214
|
+
const valueAsArray = (0, _react_querybuilder_core.toArray)(value, { retainEmptyStrings: false });
|
|
318
215
|
const valueAsDateArray = valueAsArray.map((v) => apiFns.toDate(v)).filter((dateVal) => apiFns.isValid(dateVal));
|
|
319
216
|
switch (operator) {
|
|
320
217
|
case "in":
|
|
@@ -327,7 +224,7 @@ const getDatetimeRuleProcessorJSONata = (apiFns) => (rule, options) => {
|
|
|
327
224
|
return negate(`${fldToMs(field)} in [${valueAsDateArray.map((val) => valToMs(val)).join(", ")}]`, shouldNegate$1(operator));
|
|
328
225
|
case "between":
|
|
329
226
|
case "notBetween": {
|
|
330
|
-
if (valueAsArray.length < 2 || (0,
|
|
227
|
+
if (valueAsArray.length < 2 || (0, _react_querybuilder_core.nullOrUndefinedOrEmpty)(valueAsArray[0]) || (0, _react_querybuilder_core.nullOrUndefinedOrEmpty)(valueAsArray[1]) || !valueIsField && valueAsDateArray.length < 2) return "";
|
|
331
228
|
if (valueIsField) {
|
|
332
229
|
const [firstValue, secondValue] = valueAsArray;
|
|
333
230
|
const expression = `${fldToMs(field)} >= ${fldToMs(firstValue)} and ${fldToMs(field)} <= ${fldToMs(secondValue)}`;
|
|
@@ -339,7 +236,7 @@ const getDatetimeRuleProcessorJSONata = (apiFns) => (rule, options) => {
|
|
|
339
236
|
return operator === "between" ? `(${expression})` : negate(expression, true);
|
|
340
237
|
}
|
|
341
238
|
}
|
|
342
|
-
return (0,
|
|
239
|
+
return (0, _react_querybuilder_core.defaultRuleProcessorJSONata)(rule, opts);
|
|
343
240
|
};
|
|
344
241
|
//#endregion
|
|
345
242
|
//#region src/getDatetimeRuleProcessorLDAP.ts
|
|
@@ -352,9 +249,9 @@ const getDatetimeRuleProcessorJSONata = (apiFns) => (rule, options) => {
|
|
|
352
249
|
const getDatetimeRuleProcessorLDAP = (apiFns) => (rule, options) => {
|
|
353
250
|
const opts = options ?? ( /* v8 ignore start -- @preserve */ {});
|
|
354
251
|
const { context = {} } = opts;
|
|
355
|
-
if (rule.valueSource === "field" || !processIsDateField(context.isDateField, rule, opts)) return (0,
|
|
356
|
-
const { operator, value } = materializeForExport(apiFns, rule, opts);
|
|
357
|
-
return (0,
|
|
252
|
+
if (rule.valueSource === "field" || !require_utils.processIsDateField(context.isDateField, rule, opts)) return (0, _react_querybuilder_core.defaultRuleProcessorLDAP)(rule, opts);
|
|
253
|
+
const { operator, value } = require_utils.materializeForExport(apiFns, rule, opts);
|
|
254
|
+
return (0, _react_querybuilder_core.defaultRuleProcessorLDAP)({
|
|
358
255
|
...rule,
|
|
359
256
|
operator,
|
|
360
257
|
value
|
|
@@ -369,21 +266,21 @@ const getDatetimeRuleProcessorLDAP = (apiFns) => (rule, options) => {
|
|
|
369
266
|
const getDatetimeRuleProcessorMongoDBQuery = (apiFns) => (rule, options) => {
|
|
370
267
|
const opts = options ?? ( /* v8 ignore start -- @preserve */ {});
|
|
371
268
|
const { field, valueSource } = rule;
|
|
372
|
-
const operator = resolveDatetimeOperator(rule, opts);
|
|
373
|
-
if (valueSource === "field" || !processIsDateField(opts.context?.isDateField, rule, opts)) return (0,
|
|
374
|
-
const value = materializeRelativeValues(apiFns, rule.value, opts);
|
|
269
|
+
const operator = require_utils.resolveDatetimeOperator(rule, opts);
|
|
270
|
+
if (valueSource === "field" || !require_utils.processIsDateField(opts.context?.isDateField, rule, opts)) return (0, _react_querybuilder_core.defaultRuleProcessorMongoDBQuery)(rule, opts);
|
|
271
|
+
const value = require_utils.materializeRelativeValues(apiFns, rule.value, opts);
|
|
375
272
|
if (operator === "=") return { [field]: apiFns.toDate(value) };
|
|
376
273
|
switch (operator) {
|
|
377
274
|
case "<":
|
|
378
275
|
case "<=":
|
|
379
276
|
case "!=":
|
|
380
277
|
case ">":
|
|
381
|
-
case ">=": return { [field]: { [
|
|
278
|
+
case ">=": return { [field]: { [_react_querybuilder_core.mongoOperators[operator]]: apiFns.toDate(value) } };
|
|
382
279
|
}
|
|
383
|
-
const valueAsDateArray = (0,
|
|
280
|
+
const valueAsDateArray = (0, _react_querybuilder_core.toArray)(value, { retainEmptyStrings: false }).map((v) => apiFns.toDate(v)).filter((dateVal) => apiFns.isValid(dateVal));
|
|
384
281
|
switch (operator) {
|
|
385
282
|
case "in":
|
|
386
|
-
case "notIn": return { [field]: { [
|
|
283
|
+
case "notIn": return { [field]: { [_react_querybuilder_core.mongoOperators[operator]]: valueAsDateArray } };
|
|
387
284
|
case "between":
|
|
388
285
|
case "notBetween": {
|
|
389
286
|
if (valueAsDateArray.length < 2) return "";
|
|
@@ -395,7 +292,7 @@ const getDatetimeRuleProcessorMongoDBQuery = (apiFns) => (rule, options) => {
|
|
|
395
292
|
} } : { $or: [{ [field]: { $lt: orderedArray[0] } }, { [field]: { $gt: orderedArray[1] } }] };
|
|
396
293
|
}
|
|
397
294
|
}
|
|
398
|
-
return (0,
|
|
295
|
+
return (0, _react_querybuilder_core.defaultRuleProcessorMongoDBQuery)(rule, opts);
|
|
399
296
|
};
|
|
400
297
|
//#endregion
|
|
401
298
|
//#region src/getDatetimeRuleProcessorMongoDB.ts
|
|
@@ -429,7 +326,7 @@ const defaultDateTimeNLOperatorMap = {
|
|
|
429
326
|
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "natural_language" format.
|
|
430
327
|
*/
|
|
431
328
|
const datetimeValueProcessorNL = (rule, opts) => {
|
|
432
|
-
if (isISOStringDateOnly(opts?.context?.originalValue)) return new Intl.DateTimeFormat(opts?.context?.locales, {
|
|
329
|
+
if (require_utils.isISOStringDateOnly(opts?.context?.originalValue)) return new Intl.DateTimeFormat(opts?.context?.locales, {
|
|
433
330
|
dateStyle: "full",
|
|
434
331
|
...opts?.context?.dateFormat
|
|
435
332
|
}).format(rule.value);
|
|
@@ -445,18 +342,18 @@ const datetimeValueProcessorNL = (rule, opts) => {
|
|
|
445
342
|
*/
|
|
446
343
|
const getDatetimeRuleProcessorNL = (apiFns) => (rule, options) => {
|
|
447
344
|
const opts = options ?? ( /* v8 ignore start -- @preserve */ {});
|
|
448
|
-
const operator = resolveDatetimeOperator(rule, opts);
|
|
449
|
-
const operatorLowerCase = (0,
|
|
345
|
+
const operator = require_utils.resolveDatetimeOperator(rule, opts);
|
|
346
|
+
const operatorLowerCase = (0, _react_querybuilder_core.lc)(operator);
|
|
450
347
|
let finalValue = "";
|
|
451
348
|
// v8 ignore next
|
|
452
|
-
const { fieldData, quoteFieldNamesWith = ["", ""], fieldIdentifierSeparator = "", operatorProcessor =
|
|
453
|
-
if (!processIsDateField(context.isDateField, rule, opts)) return (0,
|
|
454
|
-
if (rule.valueSource === "field") return (0,
|
|
349
|
+
const { fieldData, quoteFieldNamesWith = ["", ""], fieldIdentifierSeparator = "", operatorProcessor = _react_querybuilder_core.defaultOperatorProcessorNL, wordOrder = "SVO", context = {}, operatorMap = defaultDateTimeNLOperatorMap } = opts;
|
|
350
|
+
if (!require_utils.processIsDateField(context.isDateField, rule, opts)) return (0, _react_querybuilder_core.defaultRuleProcessorNL)(rule, opts);
|
|
351
|
+
if (rule.valueSource === "field") return (0, _react_querybuilder_core.defaultRuleProcessorNL)(rule, {
|
|
455
352
|
...opts,
|
|
456
353
|
operatorMap: defaultDateTimeNLOperatorMap
|
|
457
354
|
});
|
|
458
355
|
if ((operatorLowerCase === "in" || operatorLowerCase === "notin" || operatorLowerCase === "between" || operatorLowerCase === "notbetween") && !rule.value) return "";
|
|
459
|
-
const valueAsDateArray = (0,
|
|
356
|
+
const valueAsDateArray = (0, _react_querybuilder_core.toArray)(require_utils.materializeRelativeValues(apiFns, rule.value, opts), { retainEmptyStrings: false }).map((v) => [v, apiFns.toDate(v)]).filter((v) => apiFns.isValid(v[1]));
|
|
460
357
|
switch (operatorLowerCase) {
|
|
461
358
|
case "in":
|
|
462
359
|
case "notin":
|
|
@@ -507,7 +404,7 @@ const getDatetimeRuleProcessorNL = (apiFns) => (rule, options) => {
|
|
|
507
404
|
}
|
|
508
405
|
}
|
|
509
406
|
const wordOrderMap = {
|
|
510
|
-
S: (0,
|
|
407
|
+
S: (0, _react_querybuilder_core.getQuotedFieldName)(fieldData?.label ?? rule.field, {
|
|
511
408
|
quoteFieldNamesWith,
|
|
512
409
|
fieldIdentifierSeparator
|
|
513
410
|
}),
|
|
@@ -523,7 +420,7 @@ const getDatetimeRuleProcessorNL = (apiFns) => (rule, options) => {
|
|
|
523
420
|
}),
|
|
524
421
|
O: finalValue
|
|
525
422
|
};
|
|
526
|
-
return (0,
|
|
423
|
+
return (0, _react_querybuilder_core.normalizeConstituentWordOrder)(wordOrder).map((term) => `${wordOrderMap[term]}`).join(" ").trim();
|
|
527
424
|
};
|
|
528
425
|
//#endregion
|
|
529
426
|
//#region src/getDatetimeRuleProcessorParameterized.ts
|
|
@@ -536,9 +433,9 @@ const getDatetimeRuleProcessorNL = (apiFns) => (rule, options) => {
|
|
|
536
433
|
const getDatetimeRuleProcessorParameterized = (apiFns) => (rule, options, meta) => {
|
|
537
434
|
const opts = options ?? ( /* v8 ignore start -- @preserve */ {});
|
|
538
435
|
const { context = {} } = opts;
|
|
539
|
-
if (rule.valueSource === "field" || !processIsDateField(context.isDateField, rule, opts)) return (0,
|
|
540
|
-
const { operator, value } = materializeForExport(apiFns, rule, opts);
|
|
541
|
-
return (0,
|
|
436
|
+
if (rule.valueSource === "field" || !require_utils.processIsDateField(context.isDateField, rule, opts)) return (0, _react_querybuilder_core.defaultRuleProcessorParameterized)(rule, opts, meta);
|
|
437
|
+
const { operator, value } = require_utils.materializeForExport(apiFns, rule, opts);
|
|
438
|
+
return (0, _react_querybuilder_core.defaultRuleProcessorParameterized)({
|
|
542
439
|
...rule,
|
|
543
440
|
operator,
|
|
544
441
|
value
|
|
@@ -555,9 +452,9 @@ const getDatetimeRuleProcessorParameterized = (apiFns) => (rule, options, meta)
|
|
|
555
452
|
const getDatetimeRuleProcessorPrisma = (apiFns) => (rule, options) => {
|
|
556
453
|
const opts = options ?? ( /* v8 ignore start -- @preserve */ {});
|
|
557
454
|
const { context = {} } = opts;
|
|
558
|
-
if (rule.valueSource === "field" || !processIsDateField(context.isDateField, rule, opts)) return (0,
|
|
559
|
-
const { operator, value } = materializeForExport(apiFns, rule, opts, true);
|
|
560
|
-
return (0,
|
|
455
|
+
if (rule.valueSource === "field" || !require_utils.processIsDateField(context.isDateField, rule, opts)) return (0, _react_querybuilder_core.defaultRuleProcessorPrisma)(rule, opts);
|
|
456
|
+
const { operator, value } = require_utils.materializeForExport(apiFns, rule, opts, true);
|
|
457
|
+
return (0, _react_querybuilder_core.defaultRuleProcessorPrisma)({
|
|
561
458
|
...rule,
|
|
562
459
|
operator,
|
|
563
460
|
value
|
|
@@ -574,9 +471,9 @@ const getDatetimeRuleProcessorPrisma = (apiFns) => (rule, options) => {
|
|
|
574
471
|
const getDatetimeRuleProcessorSequelize = (apiFns) => (rule, options) => {
|
|
575
472
|
const opts = options ?? ( /* v8 ignore start -- @preserve */ {});
|
|
576
473
|
const { context = {} } = opts;
|
|
577
|
-
if (rule.valueSource === "field" || !processIsDateField(context.isDateField, rule, opts)) return (0,
|
|
578
|
-
const { operator, value } = materializeForExport(apiFns, rule, opts, true);
|
|
579
|
-
return (0,
|
|
474
|
+
if (rule.valueSource === "field" || !require_utils.processIsDateField(context.isDateField, rule, opts)) return (0, _react_querybuilder_core.defaultRuleProcessorSequelize)(rule, opts);
|
|
475
|
+
const { operator, value } = require_utils.materializeForExport(apiFns, rule, opts, true);
|
|
476
|
+
return (0, _react_querybuilder_core.defaultRuleProcessorSequelize)({
|
|
580
477
|
...rule,
|
|
581
478
|
operator,
|
|
582
479
|
value
|
|
@@ -604,16 +501,16 @@ const sparqlTemporal = (iso, dateOnly) => dateOnly ? `"${iso}"^^xsd:date` : `"${
|
|
|
604
501
|
const getDatetimeRuleProcessorSPARQL = (apiFns) => (rule, options) => {
|
|
605
502
|
const opts = options ?? ( /* v8 ignore start -- @preserve */ {});
|
|
606
503
|
const { context = {} } = opts;
|
|
607
|
-
if (rule.valueSource === "field" || !processIsDateField(context.isDateField, rule, opts)) return (0,
|
|
504
|
+
if (rule.valueSource === "field" || !require_utils.processIsDateField(context.isDateField, rule, opts)) return (0, _react_querybuilder_core.defaultRuleProcessorSPARQL)(rule, opts);
|
|
608
505
|
const { field: rawField, value } = rule;
|
|
609
|
-
const operator = resolveDatetimeOperator(rule, opts);
|
|
610
|
-
const field = (0,
|
|
611
|
-
const operatorTL = (0,
|
|
506
|
+
const operator = require_utils.resolveDatetimeOperator(rule, opts);
|
|
507
|
+
const field = (0, _react_querybuilder_core.sparqlVar)(rawField);
|
|
508
|
+
const operatorTL = (0, _react_querybuilder_core.lc)(operator);
|
|
612
509
|
if (operatorTL === "olderthanduration") return `NOW() - ${field} > "${value}"^^xsd:duration`;
|
|
613
510
|
if (operatorTL === "withinduration") return `NOW() - ${field} <= "${value}"^^xsd:duration`;
|
|
614
|
-
const valueAsDateArray = (0,
|
|
511
|
+
const valueAsDateArray = (0, _react_querybuilder_core.toArray)(require_utils.materializeRelativeValues(apiFns, value, opts), { retainEmptyStrings: false }).map((v) => [v, apiFns.toDate(v)]).filter(([, d]) => apiFns.isValid(d));
|
|
615
512
|
const fmtDate = (originalValue) => {
|
|
616
|
-
const dateOnly = isISOStringDateOnly(originalValue);
|
|
513
|
+
const dateOnly = require_utils.isISOStringDateOnly(originalValue);
|
|
617
514
|
return sparqlTemporal(dateOnly ? apiFns.toISOStringDateOnly(originalValue) : apiFns.toISOString(originalValue), dateOnly);
|
|
618
515
|
};
|
|
619
516
|
switch (operatorTL) {
|
|
@@ -649,9 +546,9 @@ const getDatetimeRuleProcessorSPARQL = (apiFns) => (rule, options) => {
|
|
|
649
546
|
const getDatetimeRuleProcessorSpEL = (apiFns) => (rule, options) => {
|
|
650
547
|
const opts = options ?? ( /* v8 ignore start -- @preserve */ {});
|
|
651
548
|
const { context = {} } = opts;
|
|
652
|
-
if (rule.valueSource === "field" || !processIsDateField(context.isDateField, rule, opts)) return (0,
|
|
653
|
-
const { operator, value } = materializeForExport(apiFns, rule, opts);
|
|
654
|
-
return (0,
|
|
549
|
+
if (rule.valueSource === "field" || !require_utils.processIsDateField(context.isDateField, rule, opts)) return (0, _react_querybuilder_core.defaultRuleProcessorSpEL)(rule, opts);
|
|
550
|
+
const { operator, value } = require_utils.materializeForExport(apiFns, rule, opts);
|
|
551
|
+
return (0, _react_querybuilder_core.defaultRuleProcessorSpEL)({
|
|
655
552
|
...rule,
|
|
656
553
|
operator,
|
|
657
554
|
value
|
|
@@ -825,11 +722,11 @@ const getRelativeDateTimeSQL = (value, preset, datatype) => presetToRelativeBuil
|
|
|
825
722
|
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "sql" format and "ansi" preset.
|
|
826
723
|
*/
|
|
827
724
|
const getDatetimeValueProcessorANSI = ({ toISOStringDateOnly, toISOString }) => (rule, opts) => {
|
|
828
|
-
if (isISOStringDateOnly(opts?.context?.originalValue)) return (0,
|
|
725
|
+
if (require_utils.isISOStringDateOnly(opts?.context?.originalValue)) return (0, _react_querybuilder_core.defaultValueProcessorByRule)({
|
|
829
726
|
...rule,
|
|
830
727
|
value: toISOStringDateOnly(rule.value)
|
|
831
728
|
}, opts);
|
|
832
|
-
return (0,
|
|
729
|
+
return (0, _react_querybuilder_core.defaultValueProcessorByRule)({
|
|
833
730
|
...rule,
|
|
834
731
|
value: toISOString(rule.value)
|
|
835
732
|
}, opts);
|
|
@@ -841,7 +738,7 @@ const getDatetimeValueProcessorANSI = ({ toISOStringDateOnly, toISOString }) =>
|
|
|
841
738
|
const getDatetimeValueProcessorMSSQL = ({ toISOStringDateOnly, toISOString }) => (rule, opts) => {
|
|
842
739
|
const datatype = /^(?:small)?datetime/i.test(opts?.fieldData?.datatype) ? "datetimeoffset" : "date";
|
|
843
740
|
const value = datatype === "datetimeoffset" ? toISOString(rule.value) : toISOStringDateOnly(rule.value);
|
|
844
|
-
return (0,
|
|
741
|
+
return (0, _react_querybuilder_core.defaultValueProcessorByRule)({
|
|
845
742
|
...rule,
|
|
846
743
|
value
|
|
847
744
|
}, {
|
|
@@ -856,7 +753,7 @@ const getDatetimeValueProcessorMSSQL = ({ toISOStringDateOnly, toISOString }) =>
|
|
|
856
753
|
const getDatetimeValueProcessorMySQL = ({ toISOStringDateOnly, toISOString }) => (rule, opts) => {
|
|
857
754
|
const datatype = /^(?:datetime|timestamp)/i.test(opts?.fieldData?.datatype) ? "datetime" : "date";
|
|
858
755
|
const value = datatype === "datetime" ? toISOString(rule.value) : toISOStringDateOnly(rule.value);
|
|
859
|
-
return (0,
|
|
756
|
+
return (0, _react_querybuilder_core.defaultValueProcessorByRule)({
|
|
860
757
|
...rule,
|
|
861
758
|
value
|
|
862
759
|
}, {
|
|
@@ -871,7 +768,7 @@ const getDatetimeValueProcessorMySQL = ({ toISOStringDateOnly, toISOString }) =>
|
|
|
871
768
|
const getDatetimeValueProcessorOracle = ({ toISOStringDateOnly, toISOString }) => (rule, opts) => {
|
|
872
769
|
const datatype = /^timestamp/i.test(opts?.fieldData?.datatype) ? "timestamp" : "date";
|
|
873
770
|
const value = datatype === "timestamp" ? toISOString(rule.value).replaceAll("T", " ").replace("Z", " UTC") : toISOStringDateOnly(rule.value);
|
|
874
|
-
return (0,
|
|
771
|
+
return (0, _react_querybuilder_core.defaultValueProcessorByRule)({
|
|
875
772
|
...rule,
|
|
876
773
|
value
|
|
877
774
|
}, {
|
|
@@ -886,7 +783,7 @@ const getDatetimeValueProcessorOracle = ({ toISOStringDateOnly, toISOString }) =
|
|
|
886
783
|
const getDatetimeValueProcessorPostgreSQL = ({ toISOStringDateOnly, toISOString }) => (rule, opts) => {
|
|
887
784
|
const datatype = /^timestamp/i.test(opts?.fieldData?.datatype) ? "timestamp" : "date";
|
|
888
785
|
const value = datatype === "timestamp" ? toISOString(rule.value) : toISOStringDateOnly(rule.value);
|
|
889
|
-
return (0,
|
|
786
|
+
return (0, _react_querybuilder_core.defaultValueProcessorByRule)({
|
|
890
787
|
...rule,
|
|
891
788
|
value
|
|
892
789
|
}, {
|
|
@@ -908,22 +805,22 @@ const presetToValueProcessorMap = {
|
|
|
908
805
|
*/
|
|
909
806
|
const getDatetimeRuleProcessorSQL = (apiFns) => (rule, options) => {
|
|
910
807
|
const opts = options ?? ( /* v8 ignore start -- @preserve */ {});
|
|
911
|
-
const operator = (0,
|
|
912
|
-
const operatorLowerCase = (0,
|
|
808
|
+
const operator = (0, _react_querybuilder_core.mapSQLOperator)(require_utils.resolveDatetimeOperator(rule, opts));
|
|
809
|
+
const operatorLowerCase = (0, _react_querybuilder_core.lc)(operator);
|
|
913
810
|
// v8 ignore next
|
|
914
811
|
const { quoteFieldNamesWith = ["", ""], fieldIdentifierSeparator = "", context = {} } = opts;
|
|
915
812
|
let finalValue = "";
|
|
916
|
-
if (rule.valueSource === "field" || !processIsDateField(context.isDateField, rule, opts)) return (0,
|
|
813
|
+
if (rule.valueSource === "field" || !require_utils.processIsDateField(context.isDateField, rule, opts)) return (0, _react_querybuilder_core.defaultRuleProcessorSQL)(rule, opts);
|
|
917
814
|
const valueProcessor = presetToValueProcessorMap[opts.preset](apiFns);
|
|
918
|
-
const quotedField = (0,
|
|
815
|
+
const quotedField = (0, _react_querybuilder_core.getQuotedFieldName)(rule.field, {
|
|
919
816
|
quoteFieldNamesWith,
|
|
920
817
|
fieldIdentifierSeparator
|
|
921
818
|
});
|
|
922
|
-
const ruleValue = context.materializeRelativeDateTime ? materializeRelativeValues(apiFns, rule.value, opts) : rule.value;
|
|
819
|
+
const ruleValue = context.materializeRelativeDateTime ? require_utils.materializeRelativeValues(apiFns, rule.value, opts) : rule.value;
|
|
923
820
|
const rawValues = Array.isArray(ruleValue) ? ruleValue : [ruleValue];
|
|
924
|
-
if (rawValues.some(isRelativeDateTimeValue)) {
|
|
821
|
+
if (rawValues.some(require_utils.isRelativeDateTimeValue)) {
|
|
925
822
|
const exprFor = (v) => {
|
|
926
|
-
if (isRelativeDateTimeValue(v)) return getRelativeDateTimeSQL(v, opts.preset, opts.fieldData?.datatype);
|
|
823
|
+
if (require_utils.isRelativeDateTimeValue(v)) return getRelativeDateTimeSQL(v, opts.preset, opts.fieldData?.datatype);
|
|
927
824
|
const dateVal = apiFns.toDate(v);
|
|
928
825
|
if (!apiFns.isValid(dateVal)) return void 0;
|
|
929
826
|
return valueProcessor({
|
|
@@ -961,7 +858,7 @@ const getDatetimeRuleProcessorSQL = (apiFns) => (rule, options) => {
|
|
|
961
858
|
}
|
|
962
859
|
return `${quotedField} ${operator} ${finalValue}`.trim();
|
|
963
860
|
}
|
|
964
|
-
const valueAsDateArray = (0,
|
|
861
|
+
const valueAsDateArray = (0, _react_querybuilder_core.toArray)(ruleValue, { retainEmptyStrings: false }).map((v) => [v, apiFns.toDate(v)]).filter((v) => apiFns.isValid(v[1]));
|
|
965
862
|
switch (operatorLowerCase) {
|
|
966
863
|
case "in":
|
|
967
864
|
case "not in":
|
|
@@ -1015,9 +912,9 @@ const getDatetimeRuleProcessorSQL = (apiFns) => (rule, options) => {
|
|
|
1015
912
|
const getDatetimeRuleProcessorTanStackDB = (apiFns) => (rule, options) => {
|
|
1016
913
|
const opts = options ?? ( /* v8 ignore start -- @preserve */ {});
|
|
1017
914
|
const { context = {} } = opts;
|
|
1018
|
-
if (rule.valueSource === "field" || !processIsDateField(context.isDateField, rule, opts)) return (0,
|
|
1019
|
-
const { operator, value } = materializeForExport(apiFns, rule, opts, true);
|
|
1020
|
-
return (0,
|
|
915
|
+
if (rule.valueSource === "field" || !require_utils.processIsDateField(context.isDateField, rule, opts)) return (0, _react_querybuilder_core.defaultRuleProcessorTanStackDB)(rule, opts);
|
|
916
|
+
const { operator, value } = require_utils.materializeForExport(apiFns, rule, opts, true);
|
|
917
|
+
return (0, _react_querybuilder_core.defaultRuleProcessorTanStackDB)({
|
|
1021
918
|
...rule,
|
|
1022
919
|
operator,
|
|
1023
920
|
value
|
|
@@ -1174,35 +1071,5 @@ Object.defineProperty(exports, "getDatetimeValueProcessorPostgreSQL", {
|
|
|
1174
1071
|
return getDatetimeValueProcessorPostgreSQL;
|
|
1175
1072
|
}
|
|
1176
1073
|
});
|
|
1177
|
-
Object.defineProperty(exports, "isDateOnlyDatatype", {
|
|
1178
|
-
enumerable: true,
|
|
1179
|
-
get: function() {
|
|
1180
|
-
return isDateOnlyDatatype;
|
|
1181
|
-
}
|
|
1182
|
-
});
|
|
1183
|
-
Object.defineProperty(exports, "isISOStringDateOnly", {
|
|
1184
|
-
enumerable: true,
|
|
1185
|
-
get: function() {
|
|
1186
|
-
return isISOStringDateOnly;
|
|
1187
|
-
}
|
|
1188
|
-
});
|
|
1189
|
-
Object.defineProperty(exports, "isRelativeDateTimeValue", {
|
|
1190
|
-
enumerable: true,
|
|
1191
|
-
get: function() {
|
|
1192
|
-
return isRelativeDateTimeValue;
|
|
1193
|
-
}
|
|
1194
|
-
});
|
|
1195
|
-
Object.defineProperty(exports, "processIsDateField", {
|
|
1196
|
-
enumerable: true,
|
|
1197
|
-
get: function() {
|
|
1198
|
-
return processIsDateField;
|
|
1199
|
-
}
|
|
1200
|
-
});
|
|
1201
|
-
Object.defineProperty(exports, "resolveDatetimeOperator", {
|
|
1202
|
-
enumerable: true,
|
|
1203
|
-
get: function() {
|
|
1204
|
-
return resolveDatetimeOperator;
|
|
1205
|
-
}
|
|
1206
|
-
});
|
|
1207
1074
|
|
|
1208
|
-
//# sourceMappingURL=getDatetimeRuleProcessorTanStackDB-
|
|
1075
|
+
//# sourceMappingURL=getDatetimeRuleProcessorTanStackDB-cmGqMT0Q.js.map
|