@react-querybuilder/datetime 8.21.2 → 8.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-C19ZXjxX.js +2 -0
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-C19ZXjxX.js.map +1 -0
- package/dist/cjs/{getDatetimeRuleProcessorTanStackDB-CDEB9coD.js → getDatetimeRuleProcessorTanStackDB-CA8J6O17.js} +24 -23
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-CA8J6O17.js.map +1 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.js +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.js +2 -2
- package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.js +2 -2
- package/dist/cjs/react-querybuilder_datetime.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.js +2 -2
- package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.js +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.ui.js +2 -2
- package/dist/cjs/react-querybuilder_datetime.cjs.development.ui.js.map +1 -1
- 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.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.js +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.js +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.ui.js +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.ui.js.map +1 -1
- package/dist/cjs/{rolldown-runtime-CMqjfN_6.js → rolldown-runtime-BocRIvOZ.js} +1 -1
- package/dist/cjs/{rolldown-runtime-D6vf50IK.js → rolldown-runtime-VH7oDXx4.js} +1 -1
- package/dist/cjs/{rqbDateTimeLibraryAPI.jsdate-C3jJb6ip.js → rqbDateTimeLibraryAPI.jsdate-BJlr4suG.js} +4 -10
- package/dist/cjs/{rqbDateTimeLibraryAPI.jsdate-C3jJb6ip.js.map → rqbDateTimeLibraryAPI.jsdate-BJlr4suG.js.map} +1 -1
- package/dist/cjs/{rqbDateTimeLibraryAPI.jsdate-BuSiVdk7.js → rqbDateTimeLibraryAPI.jsdate-sJb39vcq.js} +2 -2
- package/dist/cjs/{rqbDateTimeLibraryAPI.jsdate-BuSiVdk7.js.map → rqbDateTimeLibraryAPI.jsdate-sJb39vcq.js.map} +1 -1
- package/dist/{getDatetimeRuleProcessorTanStackDB-BrSD2e9G.js → getDatetimeRuleProcessorTanStackDB-B11NLbcy.js} +25 -24
- package/dist/{getDatetimeRuleProcessorTanStackDB-BrSD2e9G.js.map → getDatetimeRuleProcessorTanStackDB-B11NLbcy.js.map} +1 -1
- package/dist/{getDatetimeRuleProcessorTanStackDB-DR8aYrUa.mjs → getDatetimeRuleProcessorTanStackDB-BQVZbqVl.mjs} +24 -23
- package/dist/{getDatetimeRuleProcessorTanStackDB-DR8aYrUa.mjs.map → getDatetimeRuleProcessorTanStackDB-BQVZbqVl.mjs.map} +1 -1
- package/dist/getDatetimeRuleProcessorTanStackDB-_IkEsA5o.mjs +2 -0
- package/dist/{getDatetimeRuleProcessorTanStackDB-6K1DsuEV.mjs.map → getDatetimeRuleProcessorTanStackDB-_IkEsA5o.mjs.map} +1 -1
- package/dist/{objectSpread2-MqoZ2hSz.js → objectSpread2-InboGdQK.js} +6 -6
- package/dist/{objectSpread2-MqoZ2hSz.js.map → objectSpread2-InboGdQK.js.map} +1 -1
- package/dist/react-querybuilder_datetime.date-fns.mjs +1 -1
- package/dist/react-querybuilder_datetime.dayjs.mjs +1 -1
- package/dist/react-querybuilder_datetime.jsdate.mjs +2 -2
- package/dist/react-querybuilder_datetime.legacy-esm.date-fns.js +2 -2
- package/dist/react-querybuilder_datetime.legacy-esm.dayjs.js +2 -2
- package/dist/react-querybuilder_datetime.legacy-esm.js +3 -3
- package/dist/react-querybuilder_datetime.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.jsdate.js +2 -2
- package/dist/react-querybuilder_datetime.legacy-esm.luxon.js +2 -2
- package/dist/react-querybuilder_datetime.legacy-esm.ui.js +4 -4
- package/dist/react-querybuilder_datetime.luxon.mjs +1 -1
- package/dist/react-querybuilder_datetime.mjs +2 -2
- package/dist/react-querybuilder_datetime.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.production.date-fns.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.dayjs.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.jsdate.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.luxon.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.ui.mjs +1 -1
- package/dist/react-querybuilder_datetime.ui.mjs +1 -1
- package/dist/{rqbDateTimeLibraryAPI.jsdate-WHnzblie.mjs → rqbDateTimeLibraryAPI.jsdate-BhZI19z1.mjs} +4 -10
- package/dist/{rqbDateTimeLibraryAPI.jsdate-WHnzblie.mjs.map → rqbDateTimeLibraryAPI.jsdate-BhZI19z1.mjs.map} +1 -1
- package/dist/{rqbDateTimeLibraryAPI.jsdate-DxBmxW2C.mjs → rqbDateTimeLibraryAPI.jsdate-Bpo2F8gW.mjs} +2 -2
- package/dist/{rqbDateTimeLibraryAPI.jsdate-DxBmxW2C.mjs.map → rqbDateTimeLibraryAPI.jsdate-Bpo2F8gW.mjs.map} +1 -1
- package/dist/{rqbDateTimeLibraryAPI.jsdate-COp9qTw_.js → rqbDateTimeLibraryAPI.jsdate-CJA5ZhY8.js} +5 -11
- package/dist/{rqbDateTimeLibraryAPI.jsdate-COp9qTw_.js.map → rqbDateTimeLibraryAPI.jsdate-CJA5ZhY8.js.map} +1 -1
- package/package.json +13 -13
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-CDEB9coD.js.map +0 -1
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-X6tZv7yV.js +0 -2
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-X6tZv7yV.js.map +0 -1
- package/dist/getDatetimeRuleProcessorTanStackDB-6K1DsuEV.mjs +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-querybuilder_datetime.legacy-esm.js","names":[],"sources":["../src/datetimeRuleProcessorJsonLogic.ts"],"sourcesContent":["import type { DefaultOperatorName, JsonLogicVar, RuleProcessor } from '@react-querybuilder/core';\nimport { defaultRuleProcessorJsonLogic, toArray } from '@react-querybuilder/core';\nimport type { 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 // Parameter references are named placeholders (not dates); delegate to the core default,\n // which emits the name as a literal (paradigm B).\n if (rule.valueSource === 'parameter') {\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 };\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"],"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,
|
|
1
|
+
{"version":3,"file":"react-querybuilder_datetime.legacy-esm.js","names":[],"sources":["../src/datetimeRuleProcessorJsonLogic.ts"],"sourcesContent":["import type { DefaultOperatorName, JsonLogicVar, RuleProcessor } from '@react-querybuilder/core';\nimport { defaultRuleProcessorJsonLogic, toArray } from '@react-querybuilder/core';\nimport type { 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 // Parameter references are named placeholders (not dates); delegate to the core default,\n // which emits the name as a literal (paradigm B).\n if (rule.valueSource === 'parameter') {\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 };\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"],"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,6CAA8C,CAAC;CAE5D,IAAI,CAAC,oBAAA,gBAAmB,KAAK,aAAA,QAAA,kBAAA,KAAA,IAAA,KAAA,IAAA,cAAS,aAAa,MAAM,IAAI,GAC3D,OAAO,8BAA8B,MAAM,IAAI;CAKjD,IAAI,KAAK,gBAAgB,aACvB,OAAO,8BAA8B,MAAM,IAAI;CAGjD,MAAM,EAAE,OAAO,OAAO,gBAAgB;CACtC,MAAM,WAAW,wBAAwB,MAAM,IAAI;CACnD,MAAM,eAAe,gBAAgB;CACrC,MAAM,cAA4B,EAAE,KAAK,MAAM;CAC/C,MAAM,WAAW,mBAAA,SAAA,QAAA,SAAA,KAAA,MAAA,kBAAmB,KAAM,eAAA,QAAA,oBAAA,KAAA,IAAA,KAAA,IAAA,gBAAW,QAAQ;CAG7D,MAAM,eAAe,MAAe;EAClC,IAAI,cAAc,OAAO,EAAE,KAAK,GAAG,IAAI;EACvC,IAAI,wBAAwB,CAAC,GAC3B,OAAO,EACL,cAAc;GAAC,EAAE;GAAQ,EAAE;GAAQ,EAAE;GAAM;EAAQ,EACrD;EAEF,OAAO;CACT;CAEA,QAAQ,UAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,MACH,OAAO,GACJ,iBAAiB,YAAY,CAAC,aAAa,YAAY,KAAK,CAAC,EAChE;EAEF,KAAK;EACL,KAAK,SAAS;GACZ,MAAM,gBAAgB,MAAM,QAAQ,KAAK,IAAI,QAAQ,QAAQ,KAAK,EAAA,CAAG,IAAI,WAAW;GACpF,OAAO,GAAG,iBAAiB,YAAY,CAAC,aAAa,YAAY,EAAE;EACrE;EAEA,KAAK;EACL,KAAK,cAAc;GACjB,MAAM,gBAAgB,MAAM,QAAQ,KAAK,IAAI,QAAQ,QAAQ,KAAK,EAAA,CAAG,IAAI,WAAW;GAEpF,IAAI,aAAa,SAAS,GAAG,OAAO;GAEpC,OAAO,GACJ,iBAAiB,YAAY;IAAC,aAAa;IAAI;IAAa,aAAa;GAAE,EAC9E;EACF;CACF;CAEA,OAAO,8BAA8B,MAAM,OAAO;AACpD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as getDatetimeRuleProcessorCypher, S as getDatetimeRuleProcessorDrizzle, T as getDatetimeJsonLogicOperations, _ as getDatetimeRuleProcessorMongoDBQuery, a as getDatetimeValueProcessorMySQL, b as getDatetimeRuleProcessorGremlin, c as getDatetimeRuleProcessorSpEL, d as getDatetimeRuleProcessorPrisma, f as getDatetimeRuleProcessorParameterized, g as getDatetimeRuleProcessorMongoDB, h as getDatetimeRuleProcessorNL, i as getDatetimeValueProcessorMSSQL, l as getDatetimeRuleProcessorSPARQL, n as getDatetimeRuleProcessorSQL, o as getDatetimeValueProcessorOracle, r as getDatetimeValueProcessorANSI, s as getDatetimeValueProcessorPostgreSQL, t as getDatetimeRuleProcessorTanStackDB, u as getDatetimeRuleProcessorSequelize, v as getDatetimeRuleProcessorLDAP, w as getDatetimeRuleProcessorCEL, x as getDatetimeRuleProcessorElasticSearch, y as getDatetimeRuleProcessorJSONata } from "./getDatetimeRuleProcessorTanStackDB-
|
|
2
|
-
import { t as rqbDateTimeLibraryAPI } from "./rqbDateTimeLibraryAPI.jsdate-
|
|
1
|
+
import { C as getDatetimeRuleProcessorCypher, S as getDatetimeRuleProcessorDrizzle, T as getDatetimeJsonLogicOperations, _ as getDatetimeRuleProcessorMongoDBQuery, a as getDatetimeValueProcessorMySQL, b as getDatetimeRuleProcessorGremlin, c as getDatetimeRuleProcessorSpEL, d as getDatetimeRuleProcessorPrisma, f as getDatetimeRuleProcessorParameterized, g as getDatetimeRuleProcessorMongoDB, h as getDatetimeRuleProcessorNL, i as getDatetimeValueProcessorMSSQL, l as getDatetimeRuleProcessorSPARQL, n as getDatetimeRuleProcessorSQL, o as getDatetimeValueProcessorOracle, r as getDatetimeValueProcessorANSI, s as getDatetimeValueProcessorPostgreSQL, t as getDatetimeRuleProcessorTanStackDB, u as getDatetimeRuleProcessorSequelize, v as getDatetimeRuleProcessorLDAP, w as getDatetimeRuleProcessorCEL, x as getDatetimeRuleProcessorElasticSearch, y as getDatetimeRuleProcessorJSONata } from "./getDatetimeRuleProcessorTanStackDB-B11NLbcy.js";
|
|
2
|
+
import { t as rqbDateTimeLibraryAPI } from "./rqbDateTimeLibraryAPI.jsdate-CJA5ZhY8.js";
|
|
3
3
|
//#region src/index.jsdate.ts
|
|
4
4
|
/**
|
|
5
5
|
* Custom JsonLogic date/time operations using JavaScript `Date`.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as isISOStringDateOnly } from "./objectSpread2-
|
|
2
|
-
import { C as getDatetimeRuleProcessorCypher, S as getDatetimeRuleProcessorDrizzle, T as getDatetimeJsonLogicOperations, _ as getDatetimeRuleProcessorMongoDBQuery, a as getDatetimeValueProcessorMySQL, b as getDatetimeRuleProcessorGremlin, c as getDatetimeRuleProcessorSpEL, d as getDatetimeRuleProcessorPrisma, f as getDatetimeRuleProcessorParameterized, g as getDatetimeRuleProcessorMongoDB, h as getDatetimeRuleProcessorNL, i as getDatetimeValueProcessorMSSQL, l as getDatetimeRuleProcessorSPARQL, n as getDatetimeRuleProcessorSQL, o as getDatetimeValueProcessorOracle, r as getDatetimeValueProcessorANSI, s as getDatetimeValueProcessorPostgreSQL, t as getDatetimeRuleProcessorTanStackDB, u as getDatetimeRuleProcessorSequelize, v as getDatetimeRuleProcessorLDAP, w as getDatetimeRuleProcessorCEL, x as getDatetimeRuleProcessorElasticSearch, y as getDatetimeRuleProcessorJSONata } from "./getDatetimeRuleProcessorTanStackDB-
|
|
1
|
+
import { r as isISOStringDateOnly } from "./objectSpread2-InboGdQK.js";
|
|
2
|
+
import { C as getDatetimeRuleProcessorCypher, S as getDatetimeRuleProcessorDrizzle, T as getDatetimeJsonLogicOperations, _ as getDatetimeRuleProcessorMongoDBQuery, a as getDatetimeValueProcessorMySQL, b as getDatetimeRuleProcessorGremlin, c as getDatetimeRuleProcessorSpEL, d as getDatetimeRuleProcessorPrisma, f as getDatetimeRuleProcessorParameterized, g as getDatetimeRuleProcessorMongoDB, h as getDatetimeRuleProcessorNL, i as getDatetimeValueProcessorMSSQL, l as getDatetimeRuleProcessorSPARQL, n as getDatetimeRuleProcessorSQL, o as getDatetimeValueProcessorOracle, r as getDatetimeValueProcessorANSI, s as getDatetimeValueProcessorPostgreSQL, t as getDatetimeRuleProcessorTanStackDB, u as getDatetimeRuleProcessorSequelize, v as getDatetimeRuleProcessorLDAP, w as getDatetimeRuleProcessorCEL, x as getDatetimeRuleProcessorElasticSearch, y as getDatetimeRuleProcessorJSONata } from "./getDatetimeRuleProcessorTanStackDB-B11NLbcy.js";
|
|
3
3
|
import { DateTime } from "luxon";
|
|
4
4
|
//#region src/rqbDateTimeLibraryAPI.luxon.ts
|
|
5
5
|
const toDateTime = (a) => typeof a === "string" ? DateTime.fromISO(a) : DateTime.fromJSDate(a);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as isRelativeDateTimeValue, i as isNonDateValueSource, t as _objectSpread2 } from "./objectSpread2-
|
|
2
|
-
import { t as rqbDateTimeLibraryAPI } from "./rqbDateTimeLibraryAPI.jsdate-
|
|
1
|
+
import { a as isRelativeDateTimeValue, i as isNonDateValueSource, t as _objectSpread2 } from "./objectSpread2-InboGdQK.js";
|
|
2
|
+
import { t as rqbDateTimeLibraryAPI } from "./rqbDateTimeLibraryAPI.jsdate-CJA5ZhY8.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { createContext, useCallback, useContext, useMemo } from "react";
|
|
5
5
|
import { QueryBuilderContext, ValueEditor, clsx, defaultOperators, getCompatContextProvider, parseNumber, standardClassnames, toArray, useValueEditor } from "react-querybuilder";
|
|
@@ -345,7 +345,7 @@ const RelativeDateTimeValueEditor = (props) => {
|
|
|
345
345
|
}));
|
|
346
346
|
};
|
|
347
347
|
//#endregion
|
|
348
|
-
//#region \0@oxc-project+runtime@0.
|
|
348
|
+
//#region \0@oxc-project+runtime@0.142.0/helpers/esm/objectWithoutPropertiesLoose.js
|
|
349
349
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
350
350
|
if (null == r) return {};
|
|
351
351
|
var t = {};
|
|
@@ -356,7 +356,7 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
356
356
|
return t;
|
|
357
357
|
}
|
|
358
358
|
//#endregion
|
|
359
|
-
//#region \0@oxc-project+runtime@0.
|
|
359
|
+
//#region \0@oxc-project+runtime@0.142.0/helpers/esm/objectWithoutProperties.js
|
|
360
360
|
function _objectWithoutProperties(e, t) {
|
|
361
361
|
if (null == e) return {};
|
|
362
362
|
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as isISOStringDateOnly } from "./utils-BAgUBdyf.mjs";
|
|
2
|
-
import { C as getDatetimeRuleProcessorCypher, S as getDatetimeRuleProcessorDrizzle, T as getDatetimeJsonLogicOperations, _ as getDatetimeRuleProcessorMongoDBQuery, a as getDatetimeValueProcessorMySQL, b as getDatetimeRuleProcessorGremlin, c as getDatetimeRuleProcessorSpEL, d as getDatetimeRuleProcessorPrisma, f as getDatetimeRuleProcessorParameterized, g as getDatetimeRuleProcessorMongoDB, h as getDatetimeRuleProcessorNL, i as getDatetimeValueProcessorMSSQL, l as getDatetimeRuleProcessorSPARQL, n as getDatetimeRuleProcessorSQL, o as getDatetimeValueProcessorOracle, r as getDatetimeValueProcessorANSI, s as getDatetimeValueProcessorPostgreSQL, t as getDatetimeRuleProcessorTanStackDB, u as getDatetimeRuleProcessorSequelize, v as getDatetimeRuleProcessorLDAP, w as getDatetimeRuleProcessorCEL, x as getDatetimeRuleProcessorElasticSearch, y as getDatetimeRuleProcessorJSONata } from "./getDatetimeRuleProcessorTanStackDB-
|
|
2
|
+
import { C as getDatetimeRuleProcessorCypher, S as getDatetimeRuleProcessorDrizzle, T as getDatetimeJsonLogicOperations, _ as getDatetimeRuleProcessorMongoDBQuery, a as getDatetimeValueProcessorMySQL, b as getDatetimeRuleProcessorGremlin, c as getDatetimeRuleProcessorSpEL, d as getDatetimeRuleProcessorPrisma, f as getDatetimeRuleProcessorParameterized, g as getDatetimeRuleProcessorMongoDB, h as getDatetimeRuleProcessorNL, i as getDatetimeValueProcessorMSSQL, l as getDatetimeRuleProcessorSPARQL, n as getDatetimeRuleProcessorSQL, o as getDatetimeValueProcessorOracle, r as getDatetimeValueProcessorANSI, s as getDatetimeValueProcessorPostgreSQL, t as getDatetimeRuleProcessorTanStackDB, u as getDatetimeRuleProcessorSequelize, v as getDatetimeRuleProcessorLDAP, w as getDatetimeRuleProcessorCEL, x as getDatetimeRuleProcessorElasticSearch, y as getDatetimeRuleProcessorJSONata } from "./getDatetimeRuleProcessorTanStackDB-BQVZbqVl.mjs";
|
|
3
3
|
import { DateTime } from "luxon";
|
|
4
4
|
//#region src/rqbDateTimeLibraryAPI.luxon.ts
|
|
5
5
|
const toDateTime = (a) => typeof a === "string" ? DateTime.fromISO(a) : DateTime.fromJSDate(a);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as resolveDatetimeOperator, i as isRelativeDateTimeValue, s as processIsDateField, t as isDateOnlyDatatype } from "./utils-BAgUBdyf.mjs";
|
|
2
|
-
import { C as getDatetimeRuleProcessorCypher, S as getDatetimeRuleProcessorDrizzle, T as getDatetimeJsonLogicOperations, _ as getDatetimeRuleProcessorMongoDBQuery, a as getDatetimeValueProcessorMySQL, b as getDatetimeRuleProcessorGremlin, c as getDatetimeRuleProcessorSpEL, d as getDatetimeRuleProcessorPrisma, f as getDatetimeRuleProcessorParameterized, g as getDatetimeRuleProcessorMongoDB, h as getDatetimeRuleProcessorNL, i as getDatetimeValueProcessorMSSQL, l as getDatetimeRuleProcessorSPARQL, m as defaultDateTimeNLOperatorMap, n as getDatetimeRuleProcessorSQL, o as getDatetimeValueProcessorOracle, p as datetimeValueProcessorNL, r as getDatetimeValueProcessorANSI, s as getDatetimeValueProcessorPostgreSQL, t as getDatetimeRuleProcessorTanStackDB, u as getDatetimeRuleProcessorSequelize, v as getDatetimeRuleProcessorLDAP, w as getDatetimeRuleProcessorCEL, x as getDatetimeRuleProcessorElasticSearch, y as getDatetimeRuleProcessorJSONata } from "./getDatetimeRuleProcessorTanStackDB-
|
|
2
|
+
import { C as getDatetimeRuleProcessorCypher, S as getDatetimeRuleProcessorDrizzle, T as getDatetimeJsonLogicOperations, _ as getDatetimeRuleProcessorMongoDBQuery, a as getDatetimeValueProcessorMySQL, b as getDatetimeRuleProcessorGremlin, c as getDatetimeRuleProcessorSpEL, d as getDatetimeRuleProcessorPrisma, f as getDatetimeRuleProcessorParameterized, g as getDatetimeRuleProcessorMongoDB, h as getDatetimeRuleProcessorNL, i as getDatetimeValueProcessorMSSQL, l as getDatetimeRuleProcessorSPARQL, m as defaultDateTimeNLOperatorMap, n as getDatetimeRuleProcessorSQL, o as getDatetimeValueProcessorOracle, p as datetimeValueProcessorNL, r as getDatetimeValueProcessorANSI, s as getDatetimeValueProcessorPostgreSQL, t as getDatetimeRuleProcessorTanStackDB, u as getDatetimeRuleProcessorSequelize, v as getDatetimeRuleProcessorLDAP, w as getDatetimeRuleProcessorCEL, x as getDatetimeRuleProcessorElasticSearch, y as getDatetimeRuleProcessorJSONata } from "./getDatetimeRuleProcessorTanStackDB-BQVZbqVl.mjs";
|
|
3
3
|
import { defaultRuleProcessorJsonLogic, toArray } from "@react-querybuilder/core";
|
|
4
4
|
//#region src/datetimeRuleProcessorJsonLogic.ts
|
|
5
5
|
const dateOperationMap = {
|
|
@@ -23,7 +23,7 @@ const dateOperationMap = {
|
|
|
23
23
|
* {@link getDatetimeJsonLogicOperations} during the evaluation process.
|
|
24
24
|
*/
|
|
25
25
|
const datetimeRuleProcessorJsonLogic = (rule, options) => {
|
|
26
|
-
const opts = options ??
|
|
26
|
+
const opts = options ?? /* v8 ignore start -- @preserve */ {};
|
|
27
27
|
if (!processIsDateField(opts.context?.isDateField, rule, opts)) return defaultRuleProcessorJsonLogic(rule, opts);
|
|
28
28
|
if (rule.valueSource === "parameter") return defaultRuleProcessorJsonLogic(rule, opts);
|
|
29
29
|
const { field, value, valueSource } = rule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-querybuilder_datetime.mjs","names":[],"sources":["../src/datetimeRuleProcessorJsonLogic.ts"],"sourcesContent":["import type { DefaultOperatorName, JsonLogicVar, RuleProcessor } from '@react-querybuilder/core';\nimport { defaultRuleProcessorJsonLogic, toArray } from '@react-querybuilder/core';\nimport type { 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 // Parameter references are named placeholders (not dates); delegate to the core default,\n // which emits the name as a literal (paradigm B).\n if (rule.valueSource === 'parameter') {\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 };\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"],"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,
|
|
1
|
+
{"version":3,"file":"react-querybuilder_datetime.mjs","names":[],"sources":["../src/datetimeRuleProcessorJsonLogic.ts"],"sourcesContent":["import type { DefaultOperatorName, JsonLogicVar, RuleProcessor } from '@react-querybuilder/core';\nimport { defaultRuleProcessorJsonLogic, toArray } from '@react-querybuilder/core';\nimport type { 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 // Parameter references are named placeholders (not dates); delegate to the core default,\n // which emits the name as a literal (paradigm B).\n if (rule.valueSource === 'parameter') {\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 };\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"],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AS,GAAG,OAAO;GAEpC,OAAO,GACJ,iBAAiB,YAAY;IAAC,aAAa;IAAI;IAAa,aAAa;GAAE,EAC9E;EACF;CACF;CAEA,OAAO,8BAA8B,MAAM,OAAO;AACpD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./utils-DA8aluCt.mjs";import{C as t,S as n,T as r,_ as i,a,b as o,c as s,d as c,f as l,g as ee,h as u,i as d,l as f,n as p,o as m,r as h,s as g,t as _,u as v,v as y,w as b,x,y as S}from"./getDatetimeRuleProcessorTanStackDB-
|
|
1
|
+
import{n as e}from"./utils-DA8aluCt.mjs";import{C as t,S as n,T as r,_ as i,a,b as o,c as s,d as c,f as l,g as ee,h as u,i as d,l as f,n as p,o as m,r as h,s as g,t as _,u as v,v as y,w as b,x,y as S}from"./getDatetimeRuleProcessorTanStackDB-_IkEsA5o.mjs";import{add as C,endOfDay as w,endOfMonth as T,endOfWeek as E,endOfYear as D,format as O,isAfter as k,isBefore as A,isSameDay as j,isValid as M,parseISO as N,startOfDay as P,startOfMonth as F,startOfWeek as I,startOfYear as L,toDate as te}from"date-fns";const R=e=>typeof e==`string`?N(e):te(e),z=`yyyy-MM-dd`,B={day:P,week:I,month:F,year:L},V={day:w,week:E,month:T,year:D},H={minute:`minutes`,hour:`hours`,day:`days`,week:`weeks`,month:`months`,year:`years`},U={format:(e,t)=>O(R(e),t.replace(`YYYY-MM-DD`,z)),isAfter:k,isBefore:A,isSame:(t,n)=>{let r=R(t),i=R(n);return e(t)||e(n)?j(r,i):r.getTime()===i.getTime()},isValid:e=>M(R(e)),toDate:R,toISOString:e=>{let t=R(e);return M(t)?t.toISOString():``},toISOStringDateOnly:e=>{let t=R(e);return M(t)?O(t,z):``},startOf:(e,t)=>B[t](R(e)),endOf:(e,t)=>V[t](R(e)),add:(e,t,n)=>C(R(e),{[H[n]]:t})},W=r(U),G=p(U),K=h(U),q=d(U),J=a(U),Y=m(U),X=g(U),Z=b(U),Q=S(U),ne=i(U),re=u(U),ie=t(U),ae=f(U),oe=l(U),$=s(U),se=y(U),ce=o(U),le=c(U),ue=v(U),de=n(U),fe=x(U),pe=_(U),me=ee(U);export{Z as datetimeRuleProcessorCEL,ie as datetimeRuleProcessorCypher,de as datetimeRuleProcessorDrizzle,fe as datetimeRuleProcessorElasticSearch,ce as datetimeRuleProcessorGremlin,Q as datetimeRuleProcessorJSONata,se as datetimeRuleProcessorLDAP,me as datetimeRuleProcessorMongoDB,ne as datetimeRuleProcessorMongoDBQuery,re as datetimeRuleProcessorNL,oe as datetimeRuleProcessorParameterized,le as datetimeRuleProcessorPrisma,ae as datetimeRuleProcessorSPARQL,G as datetimeRuleProcessorSQL,ue as datetimeRuleProcessorSequelize,$ as datetimeRuleProcessorSpEL,pe as datetimeRuleProcessorTanStackDB,K as datetimeValueProcessorANSI,q as datetimeValueProcessorMSSQL,J as datetimeValueProcessorMySQL,Y as datetimeValueProcessorOracle,X as datetimeValueProcessorPostgreSQL,W as jsonLogicDateTimeOperations,U as rqbDateTimeLibraryAPI};
|
|
2
2
|
//# sourceMappingURL=react-querybuilder_datetime.production.date-fns.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./utils-DA8aluCt.mjs";import{C as t,S as n,T as r,_ as i,a,b as o,c as s,d as c,f as l,g as u,h as d,i as f,l as p,n as m,o as h,r as g,s as _,t as v,u as y,v as b,w as x,x as S,y as C}from"./getDatetimeRuleProcessorTanStackDB-
|
|
1
|
+
import{n as e}from"./utils-DA8aluCt.mjs";import{C as t,S as n,T as r,_ as i,a,b as o,c as s,d as c,f as l,g as u,h as d,i as f,l as p,n as m,o as h,r as g,s as _,t as v,u as y,v as b,w as x,x as S,y as C}from"./getDatetimeRuleProcessorTanStackDB-_IkEsA5o.mjs";import w from"dayjs";const T={format:(e,t)=>w(e).format(t),isAfter:(e,t)=>w(e).isAfter(t),isBefore:(e,t)=>w(e).isBefore(t),isSame:(t,n)=>w(t).isSame(n,e(t)||e(n)?`d`:`ms`),isValid:e=>w(e).isValid(),toDate:e=>w(e).toDate(),toISOString:e=>{let t=w(e);return t.isValid()?t.toISOString():``},toISOStringDateOnly:e=>{let t=w(e);return t.isValid()?t.format(`YYYY-MM-DD`):``},startOf:(e,t)=>w(e).startOf(t).toDate(),endOf:(e,t)=>w(e).endOf(t).toDate(),add:(e,t,n)=>w(e).add(t,n).toDate()},E=r(T),D=m(T),O=g(T),k=f(T),A=a(T),j=h(T),M=_(T),N=x(T),P=C(T),F=i(T),I=d(T),L=t(T),R=p(T),z=l(T),B=s(T),V=b(T),H=o(T),U=c(T),W=y(T),G=n(T),K=S(T),q=v(T),J=u(T);export{N as datetimeRuleProcessorCEL,L as datetimeRuleProcessorCypher,G as datetimeRuleProcessorDrizzle,K as datetimeRuleProcessorElasticSearch,H as datetimeRuleProcessorGremlin,P as datetimeRuleProcessorJSONata,V as datetimeRuleProcessorLDAP,J as datetimeRuleProcessorMongoDB,F as datetimeRuleProcessorMongoDBQuery,I as datetimeRuleProcessorNL,z as datetimeRuleProcessorParameterized,U as datetimeRuleProcessorPrisma,R as datetimeRuleProcessorSPARQL,D as datetimeRuleProcessorSQL,W as datetimeRuleProcessorSequelize,B as datetimeRuleProcessorSpEL,q as datetimeRuleProcessorTanStackDB,O as datetimeValueProcessorANSI,k as datetimeValueProcessorMSSQL,A as datetimeValueProcessorMySQL,j as datetimeValueProcessorOracle,M as datetimeValueProcessorPostgreSQL,E as jsonLogicDateTimeOperations,T as rqbDateTimeLibraryAPI};
|
|
2
2
|
//# sourceMappingURL=react-querybuilder_datetime.production.dayjs.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{C as e,S as t,T as n,_ as r,a as i,b as a,c as o,d as s,f as c,g as l,h as u,i as d,l as f,n as p,o as m,r as h,s as g,t as _,u as v,v as y,w as b,x,y as S}from"./getDatetimeRuleProcessorTanStackDB-
|
|
1
|
+
import{C as e,S as t,T as n,_ as r,a as i,b as a,c as o,d as s,f as c,g as l,h as u,i as d,l as f,n as p,o as m,r as h,s as g,t as _,u as v,v as y,w as b,x,y as S}from"./getDatetimeRuleProcessorTanStackDB-_IkEsA5o.mjs";import{t as C}from"./rqbDateTimeLibraryAPI.jsdate-Bpo2F8gW.mjs";const w=n(C),T=p(C),E=h(C),D=d(C),O=i(C),k=m(C),A=g(C),j=b(C),M=S(C),N=r(C),P=u(C),F=e(C),I=f(C),L=c(C),R=o(C),z=y(C),B=a(C),V=s(C),H=v(C),U=t(C),W=x(C),G=_(C),K=l(C);export{j as datetimeRuleProcessorCEL,F as datetimeRuleProcessorCypher,U as datetimeRuleProcessorDrizzle,W as datetimeRuleProcessorElasticSearch,B as datetimeRuleProcessorGremlin,M as datetimeRuleProcessorJSONata,z as datetimeRuleProcessorLDAP,K as datetimeRuleProcessorMongoDB,N as datetimeRuleProcessorMongoDBQuery,P as datetimeRuleProcessorNL,L as datetimeRuleProcessorParameterized,V as datetimeRuleProcessorPrisma,I as datetimeRuleProcessorSPARQL,T as datetimeRuleProcessorSQL,H as datetimeRuleProcessorSequelize,R as datetimeRuleProcessorSpEL,G as datetimeRuleProcessorTanStackDB,E as datetimeValueProcessorANSI,D as datetimeValueProcessorMSSQL,O as datetimeValueProcessorMySQL,k as datetimeValueProcessorOracle,A as datetimeValueProcessorPostgreSQL,w as jsonLogicDateTimeOperations,C as rqbDateTimeLibraryAPI};
|
|
2
2
|
//# sourceMappingURL=react-querybuilder_datetime.production.jsdate.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./utils-DA8aluCt.mjs";import{C as t,S as n,T as r,_ as i,a,b as o,c as s,d as c,f as l,g as u,h as d,i as f,l as p,n as m,o as h,r as g,s as _,t as v,u as y,v as b,w as x,x as S,y as C}from"./getDatetimeRuleProcessorTanStackDB-
|
|
1
|
+
import{n as e}from"./utils-DA8aluCt.mjs";import{C as t,S as n,T as r,_ as i,a,b as o,c as s,d as c,f as l,g as u,h as d,i as f,l as p,n as m,o as h,r as g,s as _,t as v,u as y,v as b,w as x,x as S,y as C}from"./getDatetimeRuleProcessorTanStackDB-_IkEsA5o.mjs";import{DateTime as w}from"luxon";const T=e=>typeof e==`string`?w.fromISO(e):w.fromJSDate(e),E=`yyyy-MM-dd`,D={minute:`minutes`,hour:`hours`,day:`days`,week:`weeks`,month:`months`,year:`years`},O={format:(e,t)=>T(e).toFormat(t.replace(`YYYY-MM-DD`,E)),isAfter:(e,t)=>T(e)>T(t),isBefore:(e,t)=>T(e)<T(t),isSame:(t,n)=>e(t)||e(n)?T(t).hasSame(T(n),`day`):+T(t)==+T(n),isValid:e=>T(e).isValid,toDate:e=>T(e).toJSDate(),toISOString:e=>{let t=T(e);return t.isValid?t.toJSDate().toISOString():``},toISOStringDateOnly:e=>{let t=T(e);return t.isValid?t.toFormat(E):``},startOf:(e,t)=>T(e).startOf(t).toJSDate(),endOf:(e,t)=>T(e).endOf(t).toJSDate(),add:(e,t,n)=>T(e).plus({[D[n]]:t}).toJSDate()},k=r(O),A=m(O),j=g(O),M=f(O),N=a(O),P=h(O),F=_(O),I=x(O),L=C(O),R=i(O),z=d(O),B=t(O),V=p(O),H=l(O),U=s(O),W=b(O),G=o(O),K=c(O),q=y(O),J=n(O),Y=S(O),X=v(O),Z=u(O);export{I as datetimeRuleProcessorCEL,B as datetimeRuleProcessorCypher,J as datetimeRuleProcessorDrizzle,Y as datetimeRuleProcessorElasticSearch,G as datetimeRuleProcessorGremlin,L as datetimeRuleProcessorJSONata,W as datetimeRuleProcessorLDAP,Z as datetimeRuleProcessorMongoDB,R as datetimeRuleProcessorMongoDBQuery,z as datetimeRuleProcessorNL,H as datetimeRuleProcessorParameterized,K as datetimeRuleProcessorPrisma,V as datetimeRuleProcessorSPARQL,A as datetimeRuleProcessorSQL,q as datetimeRuleProcessorSequelize,U as datetimeRuleProcessorSpEL,X as datetimeRuleProcessorTanStackDB,j as datetimeValueProcessorANSI,M as datetimeValueProcessorMSSQL,N as datetimeValueProcessorMySQL,P as datetimeValueProcessorOracle,F as datetimeValueProcessorPostgreSQL,k as jsonLogicDateTimeOperations,O as rqbDateTimeLibraryAPI};
|
|
2
2
|
//# sourceMappingURL=react-querybuilder_datetime.production.luxon.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as e,i as t,s as n,t as r}from"./utils-DA8aluCt.mjs";import{C as i,S as a,T as o,_ as s,a as c,b as l,c as u,d,f,g as p,h as m,i as h,l as g,m as _,n as v,o as y,p as b,r as x,s as S,t as C,u as w,v as T,w as E,x as D,y as O}from"./getDatetimeRuleProcessorTanStackDB-
|
|
1
|
+
import{c as e,i as t,s as n,t as r}from"./utils-DA8aluCt.mjs";import{C as i,S as a,T as o,_ as s,a as c,b as l,c as u,d,f,g as p,h as m,i as h,l as g,m as _,n as v,o as y,p as b,r as x,s as S,t as C,u as w,v as T,w as E,x as D,y as O}from"./getDatetimeRuleProcessorTanStackDB-_IkEsA5o.mjs";import{defaultRuleProcessorJsonLogic as k,toArray as A}from"@react-querybuilder/core";const j={"!=":`dateNotOn`,"<":`dateBefore`,"<=":`dateOnOrBefore`,"=":`dateOn`,">":`dateAfter`,">=":`dateOnOrAfter`,between:`dateBetween`,in:`dateIn`,notBetween:`dateNotBetween`,notIn:`dateNotIn`},M=(i,a)=>{let o=a??{};if(!n(o.context?.isDateField,i,o)||i.valueSource===`parameter`)return k(i,o);let{field:s,value:c,valueSource:l}=i,u=e(i,o),d=l===`field`,f={var:s},p=r(o?.fieldData?.datatype),m=e=>d?{var:`${e}`}:t(e)?{dateRelative:[e.anchor,e.offset,e.unit,p]}:e;switch(u){case`<`:case`<=`:case`=`:case`!=`:case`>`:case`>=`:return{[j[u]]:[f,m(c)]};case`in`:case`notIn`:{let e=(Array.isArray(c)?c:A(c)).map(m);return{[j[u]]:[f,e]}}case`between`:case`notBetween`:{let e=(Array.isArray(c)?c:A(c)).map(m);return e.length<2?!1:{[j[u]]:[e[0],f,e[1]]}}}return k(i,a)};export{M as datetimeRuleProcessorJsonLogic,b as datetimeValueProcessorNL,_ as defaultDateTimeNLOperatorMap,o as getDatetimeJsonLogicOperations,E as getDatetimeRuleProcessorCEL,i as getDatetimeRuleProcessorCypher,a as getDatetimeRuleProcessorDrizzle,D as getDatetimeRuleProcessorElasticSearch,l as getDatetimeRuleProcessorGremlin,O as getDatetimeRuleProcessorJSONata,T as getDatetimeRuleProcessorLDAP,p as getDatetimeRuleProcessorMongoDB,s as getDatetimeRuleProcessorMongoDBQuery,m as getDatetimeRuleProcessorNL,f as getDatetimeRuleProcessorParameterized,d as getDatetimeRuleProcessorPrisma,g as getDatetimeRuleProcessorSPARQL,v as getDatetimeRuleProcessorSQL,w as getDatetimeRuleProcessorSequelize,u as getDatetimeRuleProcessorSpEL,C as getDatetimeRuleProcessorTanStackDB,x as getDatetimeValueProcessorANSI,h as getDatetimeValueProcessorMSSQL,c as getDatetimeValueProcessorMySQL,y as getDatetimeValueProcessorOracle,S as getDatetimeValueProcessorPostgreSQL};
|
|
2
2
|
//# sourceMappingURL=react-querybuilder_datetime.production.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e,r as t}from"./utils-DA8aluCt.mjs";import{t as n}from"./rqbDateTimeLibraryAPI.jsdate-
|
|
1
|
+
import{i as e,r as t}from"./utils-DA8aluCt.mjs";import{t as n}from"./rqbDateTimeLibraryAPI.jsdate-Bpo2F8gW.mjs";import*as r from"react";import{createContext as i,useCallback as a,useContext as o,useMemo as s}from"react";import{QueryBuilderContext as c,ValueEditor as l,clsx as u,defaultOperators as d,getCompatContextProvider as f,parseNumber as p,standardClassnames as m,toArray as h,useValueEditor as g}from"react-querybuilder";const _=i(null),v=()=>o(_),y=`rule-value-dateTimeRelative-toggle`,b={mode:`relative`,anchor:`now`,offset:0,unit:`day`},x=[{name:`now`,value:`now`,label:`now`},{name:`startOfDay`,value:`startOfDay`,label:`start of day`},{name:`endOfDay`,value:`endOfDay`,label:`end of day`},{name:`startOfWeek`,value:`startOfWeek`,label:`start of week`},{name:`endOfWeek`,value:`endOfWeek`,label:`end of week`},{name:`startOfMonth`,value:`startOfMonth`,label:`start of month`},{name:`endOfMonth`,value:`endOfMonth`,label:`end of month`},{name:`startOfYear`,value:`startOfYear`,label:`start of year`},{name:`endOfYear`,value:`endOfYear`,label:`end of year`}],S=[{name:`minute`,value:`minute`,label:`minute(s)`},{name:`hour`,value:`hour`,label:`hour(s)`},{name:`day`,value:`day`,label:`day(s)`},{name:`week`,value:`week`,label:`week(s)`},{name:`month`,value:`month`,label:`month(s)`},{name:`year`,value:`year`,label:`year(s)`}],C={label:`Toggle relative date/time`,absoluteTitle:`Absolute date/time (click for relative)`,relativeTitle:`Relative date/time (click for absolute)`,absoluteContent:``,relativeContent:``},w=({isRelative:e,setMode:t,disabled:n,className:i,labels:a})=>{let o=r.useCallback(()=>t(e?`absolute`:`relative`),[t,e]);return r.createElement(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":a.label,title:e?a.relativeTitle:a.absoluteTitle,disabled:n,className:u(y,i),onClick:o},e?a.relativeContent:a.absoluteContent)},T={isRelative:t=>e(t.value),ModeControl:w},E=e=>({isRelative:t=>typeof e==`function`?e(t.operator):e.includes(t.operator)}),D=(e,t)=>e.map(e=>({...e,operators:[...e.operators??d,...t]})),O=i({}),k=()=>{let e=o(O);return s(()=>({modeController:e.modeController??T,anchors:e.anchors??x,units:e.units??S,toggleLabels:{...C,...e.toggleLabels},dateTimeAPI:e.dateTimeAPI??n}),[e])},A=[],j={name:``,value:``,label:``},M=t=>Array.isArray(t)?t:e(t)?[t]:h(t),N=({baseProps:t,value:n,onChange:i,absoluteOperator:o,config:s,SelectorComponent:c,NumericEditorComponent:l,valueListItemClassName:u,numericSchema:d})=>{let{schema:f,disabled:h,title:g,testID:_}=t,{modeController:v,anchors:y,units:x,toggleLabels:S}=s,C=v.isRelative({...t,value:n}),w=e(n)?n:b,T=a(e=>i(e===`relative`?b:``),[i]),E=a(e=>i({...w,anchor:e}),[i,w]),D=a(e=>i({...w,offset:p(e,{parseNumbers:!0})||0}),[i,w]),O=a(e=>i({...w,unit:e}),[i,w]),{ModeControl:k}=v;return r.createElement(r.Fragment,null,k&&r.createElement(k,{isRelative:C,setMode:T,schema:f,disabled:h,className:u,title:g,testID:_,labels:S}),C?r.createElement(r.Fragment,null,r.createElement(c,{schema:f,testID:_,title:g,className:u,handleOnChange:E,disabled:h,value:w.anchor,options:y,multiple:!1,listsAsArrays:!1,path:A,level:0}),r.createElement(l,{skipHook:!0,testID:_,inputType:`number`,title:g,className:u,disabled:h,handleOnChange:D,field:``,operator:``,value:w.offset,valueSource:`value`,fieldData:j,schema:d,path:A,level:0,rule:{field:``,operator:`=`,value:w.offset}}),w.offset!==0&&r.createElement(c,{schema:f,testID:_,title:g,className:u,handleOnChange:O,disabled:h,value:w.unit,options:x,multiple:!1,listsAsArrays:!1,path:A,level:0})):r.createElement(z,{...t,operator:o,value:n,handleOnChange:i,className:m.value}))},P=e=>{let{valueListItemClassName:t}=g(e),{className:n,value:i,handleOnChange:o,schema:c,operator:d,separator:f}=e,{suppressStandardClassnames:p}=c,h=e.selectorComponent??c.controls.valueSelector,_=v()??l,y=k(),b=s(()=>({...c,parseNumbers:!0}),[c]),x=s(()=>u(p||m.valueDateTimeRelative,n),[p,n]),S=d===`between`||d===`notBetween`,C=s(()=>M(i),[i]),w=a(e=>t=>{let n=[C[0],C[1]];n[e]=t,o(n)},[C,o]);return S?r.createElement(`span`,{className:x},r.createElement(N,{baseProps:e,value:C[0],onChange:w(0),absoluteOperator:`=`,config:y,SelectorComponent:h,NumericEditorComponent:_,valueListItemClassName:t,numericSchema:b}),f,r.createElement(N,{baseProps:e,value:C[1],onChange:w(1),absoluteOperator:`=`,config:y,SelectorComponent:h,NumericEditorComponent:_,valueListItemClassName:t,numericSchema:b})):r.createElement(`span`,{className:x},r.createElement(N,{baseProps:e,value:i,onChange:o,absoluteOperator:d,config:y,SelectorComponent:h,NumericEditorComponent:_,valueListItemClassName:t,numericSchema:b}))},F=(e,n)=>!t(e.valueSource)&&(e.type===`text`&&(n===`date`||n===`datetime-local`)||/^(?:date|datetime|timestamp)\b/i.test(e.fieldData?.datatype)),I=e=>`${e}`.padStart(2,`0`),L=(e,t)=>{let n=`${e.getFullYear()}-${I(e.getMonth()+1)}-${I(e.getDate())}`;return t?`${n}T${I(e.getHours())}:${I(e.getMinutes())}`:n},R=({editor:e,...t})=>e?r.createElement(e,t):r.createElement(l,{...t,skipHook:!0}),z=e=>{let t=g(e),n=v(),{dateTimeAPI:i}=k(),a=e=>r.createElement(R,{editor:n,...e});if(!F(e,t.inputTypeCoerced))return a(e);if(i.isValid(e.value)){let n=L(i.toDate(e.value),t.inputTypeCoerced!==`date`);return a({...e,value:n})}return a(e)},B=f({controlElements:{valueEditor:e=>{let t=g(e),n=v();return F(e,t.inputTypeCoerced)?r.createElement(P,e):r.createElement(R,{editor:n,...e})}}}),V=({children:e,modeController:t,anchors:n,units:i,toggleLabels:a,dateTimeAPI:l})=>{let u=s(()=>({modeController:t,anchors:n,units:i,toggleLabels:a,dateTimeAPI:l}),[t,n,i,a,l]),d=o(c).controlElements?.valueEditor??null;return r.createElement(O.Provider,{value:u},r.createElement(_.Provider,{value:d},r.createElement(B,null,e)))};export{z as DateTimeValueEditor,V as QueryBuilderDateTime,B as QueryBuilderDateTimeContext,O as RelativeDateTimeConfigContext,w as RelativeDateTimeModeToggle,P as RelativeDateTimeValueEditor,E as createOperatorModeController,x as defaultRelativeDateTimeAnchors,C as defaultRelativeDateTimeToggleLabels,S as defaultRelativeDateTimeUnits,b as defaultRelativeDateTimeValue,y as relativeDateTimeToggleClassName,T as toggleModeController,k as useRelativeDateTimeConfig,D as withRelativeOperators};
|
|
2
2
|
//# sourceMappingURL=react-querybuilder_datetime.production.ui.mjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as isRelativeDateTimeValue, r as isNonDateValueSource } from "./utils-BAgUBdyf.mjs";
|
|
2
|
-
import { t as rqbDateTimeLibraryAPI } from "./rqbDateTimeLibraryAPI.jsdate-
|
|
2
|
+
import { t as rqbDateTimeLibraryAPI } from "./rqbDateTimeLibraryAPI.jsdate-BhZI19z1.mjs";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { createContext, useCallback, useContext, useMemo } from "react";
|
|
5
5
|
import { QueryBuilderContext, ValueEditor, clsx, defaultOperators, getCompatContextProvider, parseNumber, standardClassnames, toArray, useValueEditor } from "react-querybuilder";
|
package/dist/{rqbDateTimeLibraryAPI.jsdate-WHnzblie.mjs → rqbDateTimeLibraryAPI.jsdate-BhZI19z1.mjs}
RENAMED
|
@@ -37,9 +37,7 @@ const startOf = (d, unit) => {
|
|
|
37
37
|
case "month":
|
|
38
38
|
r.setDate(1);
|
|
39
39
|
break;
|
|
40
|
-
case "year":
|
|
41
|
-
r.setMonth(0, 1);
|
|
42
|
-
break;
|
|
40
|
+
case "year": r.setMonth(0, 1);
|
|
43
41
|
}
|
|
44
42
|
return r;
|
|
45
43
|
};
|
|
@@ -53,9 +51,7 @@ const endOf = (d, unit) => {
|
|
|
53
51
|
case "month":
|
|
54
52
|
r.setMonth(r.getMonth() + 1, 0);
|
|
55
53
|
break;
|
|
56
|
-
case "year":
|
|
57
|
-
r.setMonth(11, 31);
|
|
58
|
-
break;
|
|
54
|
+
case "year": r.setMonth(11, 31);
|
|
59
55
|
}
|
|
60
56
|
return r;
|
|
61
57
|
};
|
|
@@ -77,9 +73,7 @@ const add = (d, amount, unit) => {
|
|
|
77
73
|
case "month":
|
|
78
74
|
r.setMonth(r.getMonth() + amount);
|
|
79
75
|
break;
|
|
80
|
-
case "year":
|
|
81
|
-
r.setFullYear(r.getFullYear() + amount);
|
|
82
|
-
break;
|
|
76
|
+
case "year": r.setFullYear(r.getFullYear() + amount);
|
|
83
77
|
}
|
|
84
78
|
return r;
|
|
85
79
|
};
|
|
@@ -120,4 +114,4 @@ const rqbDateTimeLibraryAPI = {
|
|
|
120
114
|
//#endregion
|
|
121
115
|
export { rqbDateTimeLibraryAPI as t };
|
|
122
116
|
|
|
123
|
-
//# sourceMappingURL=rqbDateTimeLibraryAPI.jsdate-
|
|
117
|
+
//# sourceMappingURL=rqbDateTimeLibraryAPI.jsdate-BhZI19z1.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rqbDateTimeLibraryAPI.jsdate-
|
|
1
|
+
{"version":3,"file":"rqbDateTimeLibraryAPI.jsdate-BhZI19z1.mjs","names":[],"sources":["../src/rqbDateTimeLibraryAPI.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 =>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GAAG,MAAM;EAClB,MAAM,QAAQ,OAAO,CAAC,CAAC,CAAC,QAAQ;EAChC,MAAM,QAAQ,OAAO,CAAC,CAAC,CAAC,QAAQ;EAChC,OAAO,CAAC,OAAO,MAAM,KAAK,KAAK,CAAC,OAAO,MAAM,KAAK,KAAK,QAAQ;CACjE;CACA,SAAS,GAAG,MAAM;EAChB,MAAM,UAAU,OAAO,CAAC;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;CACA;CACA;CACA;AACF"}
|
package/dist/{rqbDateTimeLibraryAPI.jsdate-DxBmxW2C.mjs → rqbDateTimeLibraryAPI.jsdate-Bpo2F8gW.mjs}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./utils-DA8aluCt.mjs";const t=new Date(NaN),n=/^(\d{4})-(\d{2})-(\d{2})([T ](\d{2}):(\d{2}):(\d{2})(\.(\d{1,3}))?)?/,r=e=>{if(e instanceof Date)return e;let r=n.exec(e);if(!r)return t;let[i,a,o,s,c,l,u,d,f,p]=r,[m,h,g,_,v,y,b]=[a,o,s,l,u,d,p??`0`].filter(Boolean).map(Number),x=h-1;return l?new Date(Date.UTC(m,x,g,_,v,y,b)):new Date(m,x,g)},i=e=>{let t=r(e);return t instanceof Date&&!Number.isNaN(t.getTime())},a=e=>{let t=r(e);return i(t)?t.toISOString().slice(0,10):``},o={format:e=>r(e).toISOString(),isAfter:(e,t)=>{let n=r(e).getTime(),i=r(t).getTime();return!Number.isNaN(n)&&!Number.isNaN(i)&&n>i},isBefore:(e,t)=>{let n=r(e).getTime(),i=r(t).getTime();return!Number.isNaN(n)&&!Number.isNaN(i)&&n<i},isSame:(t,n)=>{let i=r(t),o=r(n);return e(t)||e(n)?a(t)===a(n):i.getTime()===o.getTime()},isValid:i,toDate:r,toISOString:e=>{let t=r(e);return i(t)?t.toISOString():``},toISOStringDateOnly:a,startOf:(e,t)=>{let n=new Date(r(e).getTime());switch(n.setHours(0,0,0,0),t){case`week`:n.setDate(n.getDate()-n.getDay());break;case`month`:n.setDate(1);break;case`year`:n.setMonth(0,1)
|
|
2
|
-
//# sourceMappingURL=rqbDateTimeLibraryAPI.jsdate-
|
|
1
|
+
import{n as e}from"./utils-DA8aluCt.mjs";const t=new Date(NaN),n=/^(\d{4})-(\d{2})-(\d{2})([T ](\d{2}):(\d{2}):(\d{2})(\.(\d{1,3}))?)?/,r=e=>{if(e instanceof Date)return e;let r=n.exec(e);if(!r)return t;let[i,a,o,s,c,l,u,d,f,p]=r,[m,h,g,_,v,y,b]=[a,o,s,l,u,d,p??`0`].filter(Boolean).map(Number),x=h-1;return l?new Date(Date.UTC(m,x,g,_,v,y,b)):new Date(m,x,g)},i=e=>{let t=r(e);return t instanceof Date&&!Number.isNaN(t.getTime())},a=e=>{let t=r(e);return i(t)?t.toISOString().slice(0,10):``},o={format:e=>r(e).toISOString(),isAfter:(e,t)=>{let n=r(e).getTime(),i=r(t).getTime();return!Number.isNaN(n)&&!Number.isNaN(i)&&n>i},isBefore:(e,t)=>{let n=r(e).getTime(),i=r(t).getTime();return!Number.isNaN(n)&&!Number.isNaN(i)&&n<i},isSame:(t,n)=>{let i=r(t),o=r(n);return e(t)||e(n)?a(t)===a(n):i.getTime()===o.getTime()},isValid:i,toDate:r,toISOString:e=>{let t=r(e);return i(t)?t.toISOString():``},toISOStringDateOnly:a,startOf:(e,t)=>{let n=new Date(r(e).getTime());switch(n.setHours(0,0,0,0),t){case`week`:n.setDate(n.getDate()-n.getDay());break;case`month`:n.setDate(1);break;case`year`:n.setMonth(0,1)}return n},endOf:(e,t)=>{let n=new Date(r(e).getTime());switch(n.setHours(23,59,59,999),t){case`week`:n.setDate(n.getDate()+(6-n.getDay()));break;case`month`:n.setMonth(n.getMonth()+1,0);break;case`year`:n.setMonth(11,31)}return n},add:(e,t,n)=>{let i=new Date(r(e).getTime());switch(n){case`minute`:i.setMinutes(i.getMinutes()+t);break;case`hour`:i.setHours(i.getHours()+t);break;case`day`:i.setDate(i.getDate()+t);break;case`week`:i.setDate(i.getDate()+t*7);break;case`month`:i.setMonth(i.getMonth()+t);break;case`year`:i.setFullYear(i.getFullYear()+t)}return i}};export{o as t};
|
|
2
|
+
//# sourceMappingURL=rqbDateTimeLibraryAPI.jsdate-Bpo2F8gW.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rqbDateTimeLibraryAPI.jsdate-
|
|
1
|
+
{"version":3,"file":"rqbDateTimeLibraryAPI.jsdate-Bpo2F8gW.mjs","names":[],"sources":["../src/rqbDateTimeLibraryAPI.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"],"mappings":"yCAOA,MAAM,EAAc,IAAI,KAAK,GAAU,EAEjC,EAAa,uEAEb,EAAU,GAAqB,CACnC,GAAI,aAAa,KAAM,OAAO,EAE9B,IAAM,EAAU,EAAW,KAAK,CAAC,EAEjC,GAAI,CAAC,EAAS,OAAO,EAErB,GAAM,CAAC,EAAM,EAAM,EAAI,EAAI,EAAO,EAAI,EAAI,EAAI,EAAU,GAAO,EACzD,CAAC,EAAM,EAAO,EAAK,EAAO,EAAS,EAAS,GAAM,CAAC,EAAM,EAAI,EAAI,EAAI,EAAI,EAAI,GAAO,GAAG,CAAC,CAC3F,OAAO,OAAO,CAAC,CACf,IAAI,MAAM,EAEP,EAAa,EAAQ,EAE3B,OAAO,EACH,IAAI,KAAK,KAAK,IAAI,EAAM,EAAY,EAAK,EAAO,EAAS,EAAS,CAAE,CAAC,EACrE,IAAI,KAAK,EAAM,EAAY,CAAG,CACpC,EAEM,EAAW,GAAqB,CACpC,IAAM,EAAU,EAAO,CAAC,EACxB,OAAO,aAAmB,MAAQ,CAAC,OAAO,MAAM,EAAQ,QAAQ,CAAC,CACnE,EAEM,EAAuB,GAAqB,CAChD,IAAM,EAAU,EAAO,CAAC,EACxB,OAAO,EAAQ,CAAO,EAAI,EAAQ,YAAY,CAAC,CAAC,MAAM,EAAG,EAAE,EAAI,EACjE,EAoEa,EAA+C,CAC1D,OAAQ,GAAK,E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AI,GAAG,EAClB,EAAR,CACE,IAAK,OACH,EAAE,QAAQ,EAAE,QAAQ,GAAK,EAAI,EAAE,OAAO,EAAE,EACxC,MACF,IAAK,QACH,EAAE,SAAS,EAAE,SAAS,EAAI,EAAG,CAAC,EAC9B,MACF,IAAK,OACH,EAAE,SAAS,GAAI,EAAE,CAErB,CACA,OAAO,CACT,EA6DE,KA3DW,EAAkB,EAAgB,IAAqC,CAClF,IAAM,EAAI,IAAI,KAAK,EAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,EACtC,OAAQ,EAAR,CACE,IAAK,SACH,EAAE,WAAW,EAAE,WAAW,EAAI,CAAM,EACpC,MACF,IAAK,OACH,EAAE,SAAS,EAAE,SAAS,EAAI,CAAM,EAChC,MACF,IAAK,MACH,EAAE,QAAQ,EAAE,QAAQ,EAAI,CAAM,EAC9B,MACF,IAAK,OACH,EAAE,QAAQ,EAAE,QAAQ,EAAI,EAAS,CAAC,EAClC,MACF,IAAK,QACH,EAAE,SAAS,EAAE,SAAS,EAAI,CAAM,EAChC,MACF,IAAK,OACH,EAAE,YAAY,EAAE,YAAY,EAAI,CAAM,CAE1C,CACA,OAAO,CACT,CAqCA"}
|
package/dist/{rqbDateTimeLibraryAPI.jsdate-COp9qTw_.js → rqbDateTimeLibraryAPI.jsdate-CJA5ZhY8.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as isISOStringDateOnly } from "./objectSpread2-
|
|
1
|
+
import { r as isISOStringDateOnly } from "./objectSpread2-InboGdQK.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}))?)?/;
|
|
@@ -37,9 +37,7 @@ const startOf = (d, unit) => {
|
|
|
37
37
|
case "month":
|
|
38
38
|
r.setDate(1);
|
|
39
39
|
break;
|
|
40
|
-
case "year":
|
|
41
|
-
r.setMonth(0, 1);
|
|
42
|
-
break;
|
|
40
|
+
case "year": r.setMonth(0, 1);
|
|
43
41
|
}
|
|
44
42
|
return r;
|
|
45
43
|
};
|
|
@@ -53,9 +51,7 @@ const endOf = (d, unit) => {
|
|
|
53
51
|
case "month":
|
|
54
52
|
r.setMonth(r.getMonth() + 1, 0);
|
|
55
53
|
break;
|
|
56
|
-
case "year":
|
|
57
|
-
r.setMonth(11, 31);
|
|
58
|
-
break;
|
|
54
|
+
case "year": r.setMonth(11, 31);
|
|
59
55
|
}
|
|
60
56
|
return r;
|
|
61
57
|
};
|
|
@@ -77,9 +73,7 @@ const add = (d, amount, unit) => {
|
|
|
77
73
|
case "month":
|
|
78
74
|
r.setMonth(r.getMonth() + amount);
|
|
79
75
|
break;
|
|
80
|
-
case "year":
|
|
81
|
-
r.setFullYear(r.getFullYear() + amount);
|
|
82
|
-
break;
|
|
76
|
+
case "year": r.setFullYear(r.getFullYear() + amount);
|
|
83
77
|
}
|
|
84
78
|
return r;
|
|
85
79
|
};
|
|
@@ -120,4 +114,4 @@ const rqbDateTimeLibraryAPI = {
|
|
|
120
114
|
//#endregion
|
|
121
115
|
export { rqbDateTimeLibraryAPI as t };
|
|
122
116
|
|
|
123
|
-
//# sourceMappingURL=rqbDateTimeLibraryAPI.jsdate-
|
|
117
|
+
//# sourceMappingURL=rqbDateTimeLibraryAPI.jsdate-CJA5ZhY8.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rqbDateTimeLibraryAPI.jsdate-
|
|
1
|
+
{"version":3,"file":"rqbDateTimeLibraryAPI.jsdate-CJA5ZhY8.js","names":[],"sources":["../src/rqbDateTimeLibraryAPI.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"],"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;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AAa,MAAK;EAChB,MAAM,UAAU,OAAO,CAAC;EACxB,OAAO,QAAQ,OAAO,IAAI,QAAQ,YAAY,IAAI;CACpD;CACA;CACA;CACA;CACA;AACF"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-querybuilder/datetime",
|
|
3
3
|
"description": "Date/time features for react-querybuilder",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.22.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -103,8 +103,8 @@
|
|
|
103
103
|
"build": "bun run build:main && bun run build:css",
|
|
104
104
|
"build:main": "bun --bun tsdown",
|
|
105
105
|
"build:css": "mkdir -p dist/styles && cp src/*.scss dist && cp src/styles/*.scss dist/styles && bun sass --style=compressed dist:dist",
|
|
106
|
-
"typecheck": "tsc --noEmit",
|
|
107
|
-
"typecheck:watch": "tsc --noEmit --watch"
|
|
106
|
+
"typecheck": "../../node_modules/typescript/bin/tsc --noEmit",
|
|
107
|
+
"typecheck:watch": "../../node_modules/typescript/bin/tsc --noEmit --watch"
|
|
108
108
|
},
|
|
109
109
|
"devDependencies": {
|
|
110
110
|
"@electric-sql/pglite": "^0.5.3",
|
|
@@ -113,10 +113,10 @@
|
|
|
113
113
|
"@tanstack/db": "^0.6.17",
|
|
114
114
|
"@testing-library/dom": "^10.4.1",
|
|
115
115
|
"@testing-library/react": "^16.3.2",
|
|
116
|
-
"@testing-library/user-event": "14.6.
|
|
117
|
-
"@types/luxon": "^3.7.
|
|
118
|
-
"@types/react": "^19.2.
|
|
119
|
-
"@vitejs/plugin-react": "^6.0.
|
|
116
|
+
"@testing-library/user-event": "14.6.3",
|
|
117
|
+
"@types/luxon": "^3.7.3",
|
|
118
|
+
"@types/react": "^19.2.18",
|
|
119
|
+
"@vitejs/plugin-react": "^6.0.5",
|
|
120
120
|
"date-fns": "^4.4.0",
|
|
121
121
|
"dayjs": "^1.11.20",
|
|
122
122
|
"drizzle-orm": "^0.45.2",
|
|
@@ -124,28 +124,28 @@
|
|
|
124
124
|
"jsonata": "^2.2.2",
|
|
125
125
|
"luxon": "^3.7.2",
|
|
126
126
|
"mongodb-memory-server-core": "^11.2.0",
|
|
127
|
-
"mongoose": "^9.
|
|
127
|
+
"mongoose": "^9.9.1",
|
|
128
128
|
"pglite-prisma-adapter": "^0.7.2",
|
|
129
129
|
"prisma": "^7.9.1",
|
|
130
130
|
"react": "^19.2.8",
|
|
131
131
|
"react-dom": "^19.2.8",
|
|
132
|
-
"react-querybuilder": "8.
|
|
132
|
+
"react-querybuilder": "8.22.0",
|
|
133
133
|
"rollup-plugin-visualizer": "^7.0.1",
|
|
134
134
|
"sass": "^1.102.0",
|
|
135
135
|
"sequelize": "^6.37.8",
|
|
136
136
|
"sqlite3": "^6.0.1",
|
|
137
137
|
"typescript": "^7.0.2",
|
|
138
|
-
"vite": "^8.
|
|
138
|
+
"vite": "^8.2.0"
|
|
139
139
|
},
|
|
140
140
|
"dependencies": {
|
|
141
|
-
"@react-querybuilder/core": "8.
|
|
141
|
+
"@react-querybuilder/core": "8.22.0"
|
|
142
142
|
},
|
|
143
143
|
"peerDependencies": {
|
|
144
144
|
"date-fns": ">=4.1.0",
|
|
145
145
|
"dayjs": ">=1",
|
|
146
146
|
"luxon": ">=3.5.0",
|
|
147
147
|
"react": ">=18",
|
|
148
|
-
"react-querybuilder": "8.
|
|
148
|
+
"react-querybuilder": "8.22.0"
|
|
149
149
|
},
|
|
150
150
|
"peerDependenciesMeta": {
|
|
151
151
|
"date-fns": {
|
|
@@ -164,5 +164,5 @@
|
|
|
164
164
|
"optional": true
|
|
165
165
|
}
|
|
166
166
|
},
|
|
167
|
-
"gitHead": "
|
|
167
|
+
"gitHead": "d57fdb58cb1cfab01f085f2e7af69942bbc37374"
|
|
168
168
|
}
|