@react-querybuilder/datetime 8.19.0 → 8.20.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/react-querybuilder_datetime.cjs.development.js +21 -9
- package/dist/cjs/react-querybuilder_datetime.cjs.development.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/{getDatetimeRuleProcessorTanStackDB-LDwhMJg0.js → getDatetimeRuleProcessorTanStackDB-BL8mbdbl.js} +6 -6
- package/dist/{getDatetimeRuleProcessorTanStackDB-LDwhMJg0.js.map → getDatetimeRuleProcessorTanStackDB-BL8mbdbl.js.map} +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.date-fns.js +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.dayjs.js +2 -2
- package/dist/react-querybuilder_datetime.legacy-esm.js +43 -9
- package/dist/react-querybuilder_datetime.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.jsdate.js +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.luxon.js +1 -1
- package/dist/react-querybuilder_datetime.mjs +21 -9
- package/dist/react-querybuilder_datetime.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.production.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.mjs.map +1 -1
- package/dist/{rqbDateTimeLibraryAPI.dayjs-DvFSxPKu.js → rqbDateTimeLibraryAPI.dayjs-Da4VXvFM.js} +2 -2
- package/dist/{rqbDateTimeLibraryAPI.dayjs-DvFSxPKu.js.map → rqbDateTimeLibraryAPI.dayjs-Da4VXvFM.js.map} +1 -1
- package/package.json +7 -7
|
@@ -273,10 +273,9 @@ const toBetweenArray = (value) => Array.isArray(value) ? value : require_getDate
|
|
|
273
273
|
* selectors. Reused once per slot so between/notBetween can mix bounds (e.g. an absolute
|
|
274
274
|
* "from" and a relative "to").
|
|
275
275
|
*/
|
|
276
|
-
const RelativeDateTimeSingleValueEditor = ({ baseProps, value, onChange, absoluteOperator, config, SelectorComponent, valueListItemClassName, numericSchema }) => {
|
|
276
|
+
const RelativeDateTimeSingleValueEditor = ({ baseProps, value, onChange, absoluteOperator, config, SelectorComponent, NumericEditorComponent, valueListItemClassName, numericSchema }) => {
|
|
277
277
|
const { schema, disabled, title, testID } = baseProps;
|
|
278
278
|
const { modeController, anchors, units, toggleLabels } = config;
|
|
279
|
-
const NumericEditor = useInheritedValueEditor() ?? react_querybuilder.ValueEditor;
|
|
280
279
|
const isRelative = modeController.isRelative({
|
|
281
280
|
...baseProps,
|
|
282
281
|
value
|
|
@@ -318,7 +317,7 @@ const RelativeDateTimeSingleValueEditor = ({ baseProps, value, onChange, absolut
|
|
|
318
317
|
listsAsArrays: false,
|
|
319
318
|
path: dummyPath,
|
|
320
319
|
level: 0
|
|
321
|
-
}), /* @__PURE__ */ react.createElement(
|
|
320
|
+
}), /* @__PURE__ */ react.createElement(NumericEditorComponent, {
|
|
322
321
|
skipHook: true,
|
|
323
322
|
testID,
|
|
324
323
|
inputType: "number",
|
|
@@ -379,6 +378,7 @@ const RelativeDateTimeValueEditor = (props) => {
|
|
|
379
378
|
const { className, value, handleOnChange, schema, operator, separator } = props;
|
|
380
379
|
const { suppressStandardClassnames } = schema;
|
|
381
380
|
const SelectorComponent = props.selectorComponent ?? schema.controls.valueSelector;
|
|
381
|
+
const NumericEditorComponent = useInheritedValueEditor() ?? react_querybuilder.ValueEditor;
|
|
382
382
|
const config = useRelativeDateTimeConfig();
|
|
383
383
|
const numericSchema = (0, react.useMemo)(() => ({
|
|
384
384
|
...schema,
|
|
@@ -399,6 +399,7 @@ const RelativeDateTimeValueEditor = (props) => {
|
|
|
399
399
|
absoluteOperator: "=",
|
|
400
400
|
config,
|
|
401
401
|
SelectorComponent,
|
|
402
|
+
NumericEditorComponent,
|
|
402
403
|
valueListItemClassName,
|
|
403
404
|
numericSchema
|
|
404
405
|
}), separator, /* @__PURE__ */ react.createElement(RelativeDateTimeSingleValueEditor, {
|
|
@@ -408,6 +409,7 @@ const RelativeDateTimeValueEditor = (props) => {
|
|
|
408
409
|
absoluteOperator: "=",
|
|
409
410
|
config,
|
|
410
411
|
SelectorComponent,
|
|
412
|
+
NumericEditorComponent,
|
|
411
413
|
valueListItemClassName,
|
|
412
414
|
numericSchema
|
|
413
415
|
}));
|
|
@@ -418,6 +420,7 @@ const RelativeDateTimeValueEditor = (props) => {
|
|
|
418
420
|
absoluteOperator: operator,
|
|
419
421
|
config,
|
|
420
422
|
SelectorComponent,
|
|
423
|
+
NumericEditorComponent,
|
|
421
424
|
valueListItemClassName,
|
|
422
425
|
numericSchema
|
|
423
426
|
}));
|
|
@@ -438,13 +441,22 @@ const formatDateInputValue = (d, withTime) => {
|
|
|
438
441
|
const datePart = `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`;
|
|
439
442
|
return withTime ? `${datePart}T${pad2(d.getHours())}:${pad2(d.getMinutes())}` : datePart;
|
|
440
443
|
};
|
|
444
|
+
/**
|
|
445
|
+
* Renders the inherited (compat) editor when one is provided, otherwise the default
|
|
446
|
+
* {@link react-querybuilder!ValueEditor ValueEditor}. The editor is received as a prop (rather
|
|
447
|
+
* than read from context here) so the JSX element type stays prop-sourced and stable.
|
|
448
|
+
*/
|
|
449
|
+
const FallbackValueEditor = ({ editor: Editor, ...props }) => Editor ? /* @__PURE__ */ react.createElement(Editor, props) : /* @__PURE__ */ react.createElement(react_querybuilder.ValueEditor, {
|
|
450
|
+
...props,
|
|
451
|
+
skipHook: true
|
|
452
|
+
});
|
|
441
453
|
const DateTimeValueEditor = (props) => {
|
|
442
454
|
const uVE = (0, react_querybuilder.useValueEditor)(props);
|
|
443
455
|
const InheritedEditor = useInheritedValueEditor();
|
|
444
456
|
const { dateTimeAPI } = useRelativeDateTimeConfig();
|
|
445
|
-
const fallback = (p) =>
|
|
446
|
-
|
|
447
|
-
|
|
457
|
+
const fallback = (p) => /* @__PURE__ */ react.createElement(FallbackValueEditor, {
|
|
458
|
+
editor: InheritedEditor,
|
|
459
|
+
...p
|
|
448
460
|
});
|
|
449
461
|
if (!isDateTimeEditor(props, uVE.inputTypeCoerced)) return fallback(props);
|
|
450
462
|
if (dateTimeAPI.isValid(props.value)) {
|
|
@@ -464,9 +476,9 @@ const QueryBuilderDateTimeValueEditor = (props) => {
|
|
|
464
476
|
const uVE = (0, react_querybuilder.useValueEditor)(props);
|
|
465
477
|
const InheritedEditor = useInheritedValueEditor();
|
|
466
478
|
if (isDateTimeEditor(props, uVE.inputTypeCoerced)) return /* @__PURE__ */ react.createElement(RelativeDateTimeValueEditor, props);
|
|
467
|
-
return
|
|
468
|
-
|
|
469
|
-
|
|
479
|
+
return /* @__PURE__ */ react.createElement(FallbackValueEditor, {
|
|
480
|
+
editor: InheritedEditor,
|
|
481
|
+
...props
|
|
470
482
|
});
|
|
471
483
|
};
|
|
472
484
|
const QueryBuilderDateTimeContext = (0, react_querybuilder.getCompatContextProvider)({ controlElements: { valueEditor: QueryBuilderDateTimeValueEditor } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-querybuilder_datetime.cjs.development.js","names":["processIsDateField","resolveDatetimeOperator","isDateOnlyDatatype","isRelativeDateTimeValue","React","isRelativeDateTimeValue","defaultOperators","defaultDateTimeAPI","isRelativeDateTimeValue","ValueEditor","React","standardClassnames","ValueEditor","QueryBuilderContext"],"sources":["../../src/datetimeRuleProcessorJsonLogic.ts","../../src/InheritedValueEditorContext.ts","../../src/relativeDateTimeConstants.ts","../../src/relativeDateTimeModeControllers.tsx","../../src/RelativeDateTimeConfigContext.tsx","../../src/RelativeDateTimeValueEditor.tsx","../../src/QueryBuilderDateTime.tsx"],"sourcesContent":["import type { DefaultOperatorName, JsonLogicVar, RuleProcessor } from 'react-querybuilder';\nimport { defaultRuleProcessorJsonLogic, toArray } from 'react-querybuilder';\nimport type { RQBJsonLogicDateRelative, RQBDateTimeJsonLogic } from './types';\nimport {\n isDateOnlyDatatype,\n isRelativeDateTimeValue,\n processIsDateField,\n resolveDatetimeOperator,\n} from './utils';\n\nconst dateOperationMap = {\n '!=': 'dateNotOn',\n '<': 'dateBefore',\n '<=': 'dateOnOrBefore',\n '=': 'dateOn',\n '>': 'dateAfter',\n '>=': 'dateOnOrAfter',\n between: 'dateBetween',\n in: 'dateIn',\n notBetween: 'dateNotBetween',\n notIn: 'dateNotIn',\n} as const satisfies Partial<Record<DefaultOperatorName, string>>;\n\n/**\n * Date/time rule processor for use by {@link @react-querybuilder/core!formatQuery formatQuery}\n * with the \"jsonlogic\" format.\n *\n * Note: Unlike other date/time rule processors from this library, this function does\n * not require a date/time library API. Instead, the date/time library API is used by\n * {@link getDatetimeJsonLogicOperations} during the evaluation process.\n */\nexport const datetimeRuleProcessorJsonLogic: RuleProcessor = (\n rule,\n options\n): RQBDateTimeJsonLogic => {\n const opts = options ?? /* v8 ignore start -- @preserve */ {} /* v8 ignore stop -- @preserve */;\n\n if (!processIsDateField(opts.context?.isDateField, rule, opts)) {\n return defaultRuleProcessorJsonLogic(rule, opts);\n }\n\n const { field, value, valueSource } = rule;\n const operator = resolveDatetimeOperator(rule, opts);\n const valueIsField = valueSource === 'field';\n const fieldObject: JsonLogicVar = { var: field };\n const dateOnly = isDateOnlyDatatype(opts?.fieldData?.datatype);\n // Relative values stay \"live\": emit a `dateRelative` op resolved at evaluation time.\n // Field-source values are field names and render as `var` references.\n const renderValue = (v: unknown) => {\n if (valueIsField) return { var: `${v}` };\n if (isRelativeDateTimeValue(v)) {\n return {\n dateRelative: [v.anchor, v.offset, v.unit, dateOnly],\n } as RQBJsonLogicDateRelative;\n }\n return v as string;\n };\n\n switch (operator) {\n case '<':\n case '<=':\n case '=':\n case '!=':\n case '>':\n case '>=':\n return {\n [dateOperationMap[operator]]: [fieldObject, renderValue(value)],\n } as RQBDateTimeJsonLogic;\n\n case 'in':\n case 'notIn': {\n const valueAsArray = (Array.isArray(value) ? value : toArray(value)).map(renderValue);\n return { [dateOperationMap[operator]]: [fieldObject, valueAsArray] } as RQBDateTimeJsonLogic;\n }\n\n case 'between':\n case 'notBetween': {\n const valueAsArray = (Array.isArray(value) ? value : toArray(value)).map(renderValue);\n\n if (valueAsArray.length < 2) return false;\n\n return {\n [dateOperationMap[operator]]: [valueAsArray[0], fieldObject, valueAsArray[1]],\n } as RQBDateTimeJsonLogic;\n }\n }\n\n return defaultRuleProcessorJsonLogic(rule, options);\n};\n","import type { Context } from 'react';\nimport { createContext, useContext } from 'react';\nimport type { ValueEditorProps } from 'react-querybuilder';\n\n/**\n * Holds the value editor inherited from an outer (compat package) context provider,\n * captured _before_ {@link QueryBuilderDateTime} overrides it. Lets the date/time value\n * editor delegate non-date fields (and absolute date inputs) to the compat editor instead\n * of the bare default {@link react-querybuilder!ValueEditor ValueEditor}. `null` = none\n * inherited (fall back to default).\n */\nexport const InheritedValueEditorContext: Context<React.ComponentType<ValueEditorProps> | null> =\n createContext<React.ComponentType<ValueEditorProps> | null>(null);\n\n/** Inherited (compat) value editor, or `null` if none. See {@link InheritedValueEditorContext}. */\nexport const useInheritedValueEditor = (): React.ComponentType<ValueEditorProps> | null =>\n useContext(InheritedValueEditorContext);\n","import type { FullOption } from 'react-querybuilder';\nimport type {\n RelativeDateTimeAnchor,\n RelativeDateTimeToggleLabels,\n RelativeDateTimeUnit,\n RelativeDateTimeValue,\n} from './types';\n\n/**\n * Class name applied to the absolute/relative mode toggle button. Package-local (not part\n * of the core `standardClassnames`) to avoid coupling core to this extension.\n */\nexport const relativeDateTimeToggleClassName = 'rule-value-dateTimeRelative-toggle';\n\n/** Default value applied when switching a rule to relative mode. */\nexport const defaultRelativeDateTimeValue: RelativeDateTimeValue = {\n mode: 'relative',\n anchor: 'now',\n offset: 0,\n unit: 'day',\n};\n\n/** Default anchor (reference-point) options for the relative date/time editor. */\nexport const defaultRelativeDateTimeAnchors: FullOption<RelativeDateTimeAnchor>[] = [\n { name: 'now', value: 'now', label: 'now' },\n { name: 'startOfDay', value: 'startOfDay', label: 'start of day' },\n { name: 'endOfDay', value: 'endOfDay', label: 'end of day' },\n { name: 'startOfWeek', value: 'startOfWeek', label: 'start of week' },\n { name: 'endOfWeek', value: 'endOfWeek', label: 'end of week' },\n { name: 'startOfMonth', value: 'startOfMonth', label: 'start of month' },\n { name: 'endOfMonth', value: 'endOfMonth', label: 'end of month' },\n { name: 'startOfYear', value: 'startOfYear', label: 'start of year' },\n { name: 'endOfYear', value: 'endOfYear', label: 'end of year' },\n];\n\n/** Default unit options for the relative date/time editor. */\nexport const defaultRelativeDateTimeUnits: FullOption<RelativeDateTimeUnit>[] = [\n { name: 'minute', value: 'minute', label: 'minute(s)' },\n { name: 'hour', value: 'hour', label: 'hour(s)' },\n { name: 'day', value: 'day', label: 'day(s)' },\n { name: 'week', value: 'week', label: 'week(s)' },\n { name: 'month', value: 'month', label: 'month(s)' },\n { name: 'year', value: 'year', label: 'year(s)' },\n];\n\n/** Default labels/content for the absolute/relative mode toggle. */\nexport const defaultRelativeDateTimeToggleLabels: Required<RelativeDateTimeToggleLabels> = {\n label: 'Toggle relative date/time',\n absoluteTitle: 'Absolute date/time (click for relative)',\n relativeTitle: 'Relative date/time (click for absolute)',\n // Empty by default; the CSS pseudo-element renders the glyph based on `aria-checked`.\n absoluteContent: '',\n relativeContent: '',\n};\n","import * as React from 'react';\nimport type { FullOperator } from 'react-querybuilder';\nimport { clsx, defaultOperators } from 'react-querybuilder';\nimport { relativeDateTimeToggleClassName } from './relativeDateTimeConstants';\nimport type { RelativeDateTimeModeController, RelativeDateTimeModeControlProps } from './types';\nimport { isRelativeDateTimeValue } from './utils';\n\n/**\n * Compact absolute/relative toggle rendered by {@link toggleModeController}. A\n * `role=\"switch\"` button whose default glyph is supplied by CSS (keyed on\n * `aria-checked`); override via the `toggleLabels` config.\n *\n * @group Components\n */\nexport const RelativeDateTimeModeToggle = ({\n isRelative,\n setMode,\n disabled,\n className,\n labels,\n}: RelativeDateTimeModeControlProps): React.JSX.Element => {\n const onClick = React.useCallback(\n () => setMode(isRelative ? 'absolute' : 'relative'),\n [setMode, isRelative]\n );\n\n return (\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={isRelative}\n aria-label={labels.label}\n title={isRelative ? labels.relativeTitle : labels.absoluteTitle}\n disabled={disabled}\n className={clsx(relativeDateTimeToggleClassName, className)}\n onClick={onClick}>\n {isRelative ? labels.relativeContent : labels.absoluteContent}\n </button>\n );\n};\n\n/**\n * Zero-config default {@link RelativeDateTimeModeController}: derives the mode from the\n * value shape and renders a compact toggle button to switch between absolute and\n * relative entry.\n */\nexport const toggleModeController: RelativeDateTimeModeController = {\n isRelative: props => isRelativeDateTimeValue(props.value),\n ModeControl: RelativeDateTimeModeToggle,\n};\n\n/**\n * Builds an operator-driven {@link RelativeDateTimeModeController} that derives the mode\n * from the rule's operator. Pass the operator name(s) (or a predicate) that should put the\n * editor in relative mode. No toggle is rendered — the operator selector is the mode\n * affordance.\n *\n * NOTE: the chosen operators only signal _mode_; the rule's value remains a\n * {@link RelativeDateTimeValue}. For these operators to export correctly, map each one to a\n * real comparison operator via `context.relativeOperatorMap` when calling `formatQuery`\n * (e.g. `{ relativeEq: '=' }`). See the documentation.\n */\nexport const createOperatorModeController = (\n relativeOperators: string[] | ((operator: string) => boolean)\n): RelativeDateTimeModeController => ({\n isRelative: props =>\n typeof relativeOperators === 'function'\n ? relativeOperators(props.operator)\n : relativeOperators.includes(props.operator),\n});\n\ninterface FieldWithOperators {\n operators?: FullOperator[];\n [key: string]: unknown;\n}\n\n/**\n * Appends the given `operators` to each field's `operators` list, so the operator-driven\n * controller (see {@link createOperatorModeController}) has an operator to switch into\n * relative mode. Fields without an explicit `operators` list fall back to the core\n * `defaultOperators`.\n */\nexport const withRelativeOperators = <F extends FieldWithOperators>(\n fields: F[],\n operators: FullOperator[]\n): F[] =>\n fields.map(field => ({\n ...field,\n operators: [...(field.operators ?? (defaultOperators as FullOperator[])), ...operators],\n }));\n","import * as React from 'react';\nimport { createContext, useContext, useMemo } from 'react';\nimport type { FullOption } from 'react-querybuilder';\nimport {\n defaultRelativeDateTimeAnchors,\n defaultRelativeDateTimeToggleLabels,\n defaultRelativeDateTimeUnits,\n} from './relativeDateTimeConstants';\nimport { toggleModeController } from './relativeDateTimeModeControllers';\nimport { rqbDateTimeLibraryAPI as defaultDateTimeAPI } from './rqbDateTimeLibraryAPI.dayjs';\nimport type {\n RelativeDateTimeAnchor,\n RelativeDateTimeEditorConfig,\n RelativeDateTimeModeController,\n RelativeDateTimeToggleLabels,\n RelativeDateTimeUnit,\n RQBDateTimeLibraryAPI,\n} from './types';\n\n/** Fully-resolved relative date/time editor config (no optional fields). */\nexport interface ResolvedRelativeDateTimeConfig {\n modeController: RelativeDateTimeModeController;\n anchors: FullOption<RelativeDateTimeAnchor>[];\n units: FullOption<RelativeDateTimeUnit>[];\n toggleLabels: Required<RelativeDateTimeToggleLabels>;\n dateTimeAPI: RQBDateTimeLibraryAPI;\n}\n\n/**\n * Carries {@link RelativeDateTimeEditorConfig} to the {@link RelativeDateTimeValueEditor}.\n * Provided by {@link QueryBuilderDateTime}; defaults apply when no provider is present.\n */\nexport const RelativeDateTimeConfigContext: React.Context<RelativeDateTimeEditorConfig> =\n createContext<RelativeDateTimeEditorConfig>({});\n\n/** Reads the relative date/time editor config from context, merged with defaults. */\nexport const useRelativeDateTimeConfig = (): ResolvedRelativeDateTimeConfig => {\n const config = useContext(RelativeDateTimeConfigContext);\n return useMemo(\n () => ({\n modeController: config.modeController ?? toggleModeController,\n anchors: config.anchors ?? defaultRelativeDateTimeAnchors,\n units: config.units ?? defaultRelativeDateTimeUnits,\n toggleLabels: { ...defaultRelativeDateTimeToggleLabels, ...config.toggleLabels },\n dateTimeAPI: config.dateTimeAPI ?? defaultDateTimeAPI,\n }),\n [config]\n );\n};\n","import * as React from 'react';\nimport { useCallback, useMemo } from 'react';\nimport type { FullField, Path, ValueEditorProps, ValueSelectorProps } from 'react-querybuilder';\nimport {\n clsx,\n parseNumber,\n standardClassnames,\n toArray,\n useValueEditor,\n ValueEditor,\n} from 'react-querybuilder';\nimport { useInheritedValueEditor } from './InheritedValueEditorContext';\nimport { DateTimeValueEditor } from './QueryBuilderDateTime';\nimport type { ResolvedRelativeDateTimeConfig } from './RelativeDateTimeConfigContext';\nimport { useRelativeDateTimeConfig } from './RelativeDateTimeConfigContext';\nimport { defaultRelativeDateTimeValue } from './relativeDateTimeConstants';\nimport type { RelativeDateTimeAnchor, RelativeDateTimeUnit, RelativeDateTimeValue } from './types';\nimport { isRelativeDateTimeValue } from './utils';\n\nconst dummyPath: Path = [];\nconst dummyFieldData: FullField = { name: '', value: '', label: '' };\n\n/** Splits a value into the from/to pair used by between/notBetween, object-safe. */\nconst toBetweenArray = (value: unknown): unknown[] =>\n Array.isArray(value) ? value : isRelativeDateTimeValue(value) ? [value] : toArray(value);\n\ninterface RelativeDateTimeSingleValueEditorProps {\n /** The original value editor props (for mode derivation and absolute rendering). */\n baseProps: ValueEditorProps;\n /** The value for this slot (the whole value, or one element of a between pair). */\n value: unknown;\n /** Emits a new value for this slot. */\n onChange: (value: unknown) => void;\n /** Operator passed to the absolute editor (forced to `=` for between slots). */\n absoluteOperator: string;\n config: ResolvedRelativeDateTimeConfig;\n SelectorComponent: React.ComponentType<ValueSelectorProps>;\n valueListItemClassName?: string;\n numericSchema: ValueEditorProps['schema'];\n}\n\n/**\n * Renders a single absolute-or-relative date/time value: a mode affordance (per the\n * controller) plus either an absolute date input or anchor + signed offset + unit\n * selectors. Reused once per slot so between/notBetween can mix bounds (e.g. an absolute\n * \"from\" and a relative \"to\").\n */\nconst RelativeDateTimeSingleValueEditor = ({\n baseProps,\n value,\n onChange,\n absoluteOperator,\n config,\n SelectorComponent,\n valueListItemClassName,\n numericSchema,\n}: RelativeDateTimeSingleValueEditorProps): React.JSX.Element => {\n const { schema, disabled, title, testID } = baseProps;\n const { modeController, anchors, units, toggleLabels } = config;\n\n // Themed numeric offset input from the inherited (compat) editor when present.\n const NumericEditor = useInheritedValueEditor() ?? ValueEditor;\n\n const isRelative = modeController.isRelative({ ...baseProps, value });\n const relValue: RelativeDateTimeValue = isRelativeDateTimeValue(value)\n ? value\n : defaultRelativeDateTimeValue;\n\n const handleSetMode = useCallback(\n (mode: 'absolute' | 'relative') =>\n onChange(mode === 'relative' ? defaultRelativeDateTimeValue : ''),\n [onChange]\n );\n\n const handleChangeAnchor = useCallback(\n (anchor: string) => onChange({ ...relValue, anchor: anchor as RelativeDateTimeAnchor }),\n [onChange, relValue]\n );\n\n const handleChangeOffset = useCallback(\n (offset: unknown) =>\n onChange({\n ...relValue,\n offset: (parseNumber(offset, { parseNumbers: true }) as number) || 0,\n }),\n [onChange, relValue]\n );\n\n const handleChangeUnit = useCallback(\n (unit: string) => onChange({ ...relValue, unit: unit as RelativeDateTimeUnit }),\n [onChange, relValue]\n );\n\n const { ModeControl } = modeController;\n\n return (\n <React.Fragment>\n {ModeControl && (\n <ModeControl\n isRelative={isRelative}\n setMode={handleSetMode}\n schema={schema}\n disabled={disabled}\n className={valueListItemClassName}\n title={title}\n testID={testID}\n labels={toggleLabels}\n />\n )}\n {isRelative ? (\n <React.Fragment>\n <SelectorComponent\n schema={schema}\n testID={testID}\n title={title}\n className={valueListItemClassName}\n handleOnChange={handleChangeAnchor}\n disabled={disabled}\n value={relValue.anchor}\n options={anchors}\n multiple={false}\n listsAsArrays={false}\n path={dummyPath}\n level={0}\n />\n <NumericEditor\n skipHook\n testID={testID}\n inputType=\"number\"\n title={title}\n className={valueListItemClassName}\n disabled={disabled}\n handleOnChange={handleChangeOffset}\n field={''}\n operator={''}\n value={relValue.offset}\n valueSource={'value'}\n fieldData={dummyFieldData}\n schema={numericSchema}\n path={dummyPath}\n level={0}\n rule={{ field: '', operator: '=', value: relValue.offset }}\n />\n {relValue.offset !== 0 && (\n <SelectorComponent\n schema={schema}\n testID={testID}\n title={title}\n className={valueListItemClassName}\n handleOnChange={handleChangeUnit}\n disabled={disabled}\n value={relValue.unit}\n options={units}\n multiple={false}\n listsAsArrays={false}\n path={dummyPath}\n level={0}\n />\n )}\n </React.Fragment>\n ) : (\n <DateTimeValueEditor\n {...baseProps}\n operator={absoluteOperator}\n value={value}\n handleOnChange={onChange}\n className={standardClassnames.value}\n />\n )}\n </React.Fragment>\n );\n};\n\n/**\n * Value editor with support for {@link RelativeDateTimeValue relative date/time values}\n * (e.g. \"three months ago\" or \"the beginning of this year\"). How the user switches\n * between absolute and relative modes is delegated to a pluggable\n * {@link RelativeDateTimeModeController} (default: a compact toggle), supplied via\n * {@link QueryBuilderDateTime}. In relative mode it renders anchor + signed offset + unit\n * selectors; the unit selector is hidden when the offset is `0`.\n *\n * For the `between`/`notBetween` operators it renders two independent value editors (each\n * with its own mode affordance) and stores the bounds as a two-element array, so the from\n * and to bounds can independently be absolute or relative.\n *\n * @group Components\n */\nexport const RelativeDateTimeValueEditor = (props: ValueEditorProps): React.JSX.Element => {\n const { valueListItemClassName } = useValueEditor(props);\n\n const { className, value, handleOnChange, schema, operator, separator } = props;\n const { suppressStandardClassnames } = schema;\n\n const SelectorComponent = props.selectorComponent ?? schema.controls.valueSelector;\n\n const config = useRelativeDateTimeConfig();\n\n const numericSchema = useMemo(() => ({ ...schema, parseNumbers: true }), [schema]);\n\n const outerClassname = useMemo(\n () => clsx(suppressStandardClassnames || standardClassnames.valueDateTimeRelative, className),\n [suppressStandardClassnames, className]\n );\n\n const isBetween = operator === 'between' || operator === 'notBetween';\n\n // For between/notBetween, store the bounds as a two-element array. Relative values are\n // objects (which can't survive comma-joining), so the array is emitted directly,\n // regardless of `listsAsArrays`.\n const valueAsArray = useMemo(() => toBetweenArray(value), [value]);\n\n const handleChangeBound = useCallback(\n (index: number) => (boundValue: unknown) => {\n const next = [valueAsArray[0], valueAsArray[1]];\n next[index] = boundValue;\n handleOnChange(next);\n },\n [valueAsArray, handleOnChange]\n );\n\n if (isBetween) {\n return (\n <span className={outerClassname}>\n <RelativeDateTimeSingleValueEditor\n baseProps={props}\n value={valueAsArray[0]}\n onChange={handleChangeBound(0)}\n absoluteOperator=\"=\"\n config={config}\n SelectorComponent={SelectorComponent}\n valueListItemClassName={valueListItemClassName}\n numericSchema={numericSchema}\n />\n {separator}\n <RelativeDateTimeSingleValueEditor\n baseProps={props}\n value={valueAsArray[1]}\n onChange={handleChangeBound(1)}\n absoluteOperator=\"=\"\n config={config}\n SelectorComponent={SelectorComponent}\n valueListItemClassName={valueListItemClassName}\n numericSchema={numericSchema}\n />\n </span>\n );\n }\n\n return (\n <span className={outerClassname}>\n <RelativeDateTimeSingleValueEditor\n baseProps={props}\n value={value}\n onChange={handleOnChange}\n absoluteOperator={operator}\n config={config}\n SelectorComponent={SelectorComponent}\n valueListItemClassName={valueListItemClassName}\n numericSchema={numericSchema}\n />\n </span>\n );\n};\n","import * as React from 'react';\nimport { useContext, useMemo } from 'react';\nimport type { QueryBuilderContextProvider, ValueEditorProps } from 'react-querybuilder';\nimport {\n getCompatContextProvider,\n QueryBuilderContext,\n useValueEditor,\n ValueEditor,\n} from 'react-querybuilder';\nimport {\n InheritedValueEditorContext,\n useInheritedValueEditor,\n} from './InheritedValueEditorContext';\nimport {\n RelativeDateTimeConfigContext,\n useRelativeDateTimeConfig,\n} from './RelativeDateTimeConfigContext';\nimport { RelativeDateTimeValueEditor } from './RelativeDateTimeValueEditor';\nimport type { RelativeDateTimeEditorConfig } from './types';\n\n/**\n * Whether a rule should use a date/time editor, based on either the coerced input\n * type (`date`/`datetime-local`) or a date-like `datatype` (`date`/`datetime`/`timestamp`).\n */\nconst isDateTimeEditor = (props: ValueEditorProps, inputTypeCoerced: string | undefined): boolean =>\n (props.type === 'text' &&\n (inputTypeCoerced === 'date' || inputTypeCoerced === 'datetime-local')) ||\n /^(?:date|datetime|timestamp)\\b/i.test(props.fieldData?.datatype as string);\n\nconst pad2 = (n: number): string => `${n}`.padStart(2, '0');\n\n/**\n * Formats a `Date` into the local value expected by a native `date`/`datetime-local`\n * input (library-agnostic; the date library only handles parsing/validation).\n */\nconst formatDateInputValue = (d: Date, withTime: boolean): string => {\n const datePart = `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`;\n return withTime ? `${datePart}T${pad2(d.getHours())}:${pad2(d.getMinutes())}` : datePart;\n};\n\nexport const DateTimeValueEditor = (props: ValueEditorProps): React.JSX.Element => {\n const uVE = useValueEditor(props);\n const InheritedEditor = useInheritedValueEditor();\n const { dateTimeAPI } = useRelativeDateTimeConfig();\n\n // Non-date fields and unparseable values: delegate to the inherited (compat) editor when\n // present, otherwise the default editor.\n const fallback = (p: ValueEditorProps) =>\n InheritedEditor ? <InheritedEditor {...p} /> : <ValueEditor {...p} skipHook />;\n\n if (!isDateTimeEditor(props, uVE.inputTypeCoerced)) {\n return fallback(props);\n }\n\n if (dateTimeAPI.isValid(props.value)) {\n const value = formatDateInputValue(\n dateTimeAPI.toDate(props.value),\n uVE.inputTypeCoerced !== 'date'\n );\n return fallback({ ...props, value });\n }\n\n return fallback(props);\n};\n\n/**\n * Provider value editor: renders the relative-capable {@link RelativeDateTimeValueEditor}\n * for date/time fields and falls back to the inherited (compat) editor for everything else.\n */\nconst QueryBuilderDateTimeValueEditor = (props: ValueEditorProps): React.JSX.Element => {\n const uVE = useValueEditor(props);\n const InheritedEditor = useInheritedValueEditor();\n\n if (isDateTimeEditor(props, uVE.inputTypeCoerced)) {\n return <RelativeDateTimeValueEditor {...props} />;\n }\n\n return InheritedEditor ? <InheritedEditor {...props} /> : <ValueEditor {...props} skipHook />;\n};\n\nexport const QueryBuilderDateTimeContext: QueryBuilderContextProvider = getCompatContextProvider({\n controlElements: { valueEditor: QueryBuilderDateTimeValueEditor },\n});\n\n/** Props for {@link QueryBuilderDateTime}: {@link RelativeDateTimeEditorConfig} plus children. */\nexport interface QueryBuilderDateTimeProps extends RelativeDateTimeEditorConfig {\n children?: React.ReactNode;\n}\n\n/**\n * Context provider enabling date/time features for a wrapped\n * {@link react-querybuilder!QueryBuilder QueryBuilder}: renders the relative-capable\n * {@link RelativeDateTimeValueEditor} for date/time fields, and accepts optional\n * {@link RelativeDateTimeEditorConfig} props (mode controller, anchor/unit options, and\n * toggle labels). With no props it provides the zero-config toggle experience.\n *\n * @group Components\n */\nexport const QueryBuilderDateTime = ({\n children,\n modeController,\n anchors,\n units,\n toggleLabels,\n dateTimeAPI,\n}: QueryBuilderDateTimeProps): React.JSX.Element => {\n const config = useMemo(\n (): RelativeDateTimeEditorConfig => ({\n modeController,\n anchors,\n units,\n toggleLabels,\n dateTimeAPI,\n }),\n [modeController, anchors, units, toggleLabels, dateTimeAPI]\n );\n\n // Capture the value editor inherited from any outer compat provider (e.g. QueryBuilderMaterial)\n // _before_ QueryBuilderDateTimeContext overrides it, so date/time editors can delegate to it.\n const inheritedValueEditor = (useContext(QueryBuilderContext).controlElements?.valueEditor ??\n null) as React.ComponentType<ValueEditorProps> | null;\n\n return (\n <RelativeDateTimeConfigContext.Provider value={config}>\n <InheritedValueEditorContext.Provider value={inheritedValueEditor}>\n <QueryBuilderDateTimeContext>{children}</QueryBuilderDateTimeContext>\n </InheritedValueEditorContext.Provider>\n </RelativeDateTimeConfigContext.Provider>\n );\n};\n"],"mappings":";;;;;;;AAUA,MAAM,mBAAmB;CACvB,MAAM;CACN,KAAK;CACL,MAAM;CACN,KAAK;CACL,KAAK;CACL,MAAM;CACN,SAAS;CACT,IAAI;CACJ,YAAY;CACZ,OAAO;AACT;;;;;;;;;AAUA,MAAa,kCACX,MACA,YACyB;CACzB,MAAM,OAAO,gDAA8C,CAAC;CAE5D,IAAI,CAACA,2CAAAA,mBAAmB,KAAK,SAAS,aAAa,MAAM,IAAI,GAC3D,QAAA,GAAA,mBAAA,8BAAA,CAAqC,MAAM,IAAI;CAGjD,MAAM,EAAE,OAAO,OAAO,gBAAgB;CACtC,MAAM,WAAWC,2CAAAA,wBAAwB,MAAM,IAAI;CACnD,MAAM,eAAe,gBAAgB;CACrC,MAAM,cAA4B,EAAE,KAAK,MAAM;CAC/C,MAAM,WA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CAAC;CACrC;CAEA,OAAO,SAAS,KAAK;AACvB;;;;;AAMA,MAAM,mCAAmC,UAA+C;CACtF,MAAM,OAAA,GAAA,mBAAA,eAAA,CAAqB,KAAK;CAChC,MAAM,kBAAkB,wBAAwB;CAEhD,IAAI,iBAAiB,OAAO,IAAI,gBAAgB,GAC9C,OAAO,sBAAA,cAAC,6BAAgC,KAAQ;CAGlD,OAAO,kBAAkB,sBAAA,cAAC,iBAAoB,KAAQ,IAAI,sBAAA,cAACA,mBAAAA,aAAD;EAAa,GAAI;EAAO,UAAA;CAAU,CAAA;AAC9F;AAEA,MAAa,+BAAA,GAAA,mBAAA,yBAAA,CAAoF,EAC/F,iBAAiB,EAAE,aAAa,gCAAgC,EAClE,CAAC;;;;;;;;;;AAgBD,MAAa,wBAAwB,EACnC,UACA,gBACA,SACA,OACA,cACA,kBACkD;CAClD,MAAM,UAAA,GAAA,MAAA,QAAA,QACiC;EACnC;EACA;EACA;EACA;EACA;CACF,IACA;EAAC;EAAgB;EAAS;EAAO;EAAc;CAAW,CAC5D;CAIA,MAAM,wBAAA,GAAA,MAAA,WAAA,CAAmCC,mBAAAA,mBAAmB,CAAC,CAAC,iBAAiB,eAC7E;CAEF,OACE,sBAAA,cAAC,8BAA8B,UAA/B,EAAwC,OAAO,OAIP,GAHtC,sBAAA,cAAC,4BAA4B,UAA7B,EAAsC,OAAO,qBAEP,GADpC,sBAAA,cAAC,6BAAA,MAA6B,QAAsC,CAChC,CACA;AAE5C"}
|
|
1
|
+
{"version":3,"file":"react-querybuilder_datetime.cjs.development.js","names":["processIsDateField","resolveDatetimeOperator","isDateOnlyDatatype","isRelativeDateTimeValue","React","isRelativeDateTimeValue","defaultOperators","defaultDateTimeAPI","isRelativeDateTimeValue","React","standardClassnames","ValueEditor","ValueEditor","QueryBuilderContext"],"sources":["../../src/datetimeRuleProcessorJsonLogic.ts","../../src/InheritedValueEditorContext.ts","../../src/relativeDateTimeConstants.ts","../../src/relativeDateTimeModeControllers.tsx","../../src/RelativeDateTimeConfigContext.tsx","../../src/RelativeDateTimeValueEditor.tsx","../../src/QueryBuilderDateTime.tsx"],"sourcesContent":["import type { DefaultOperatorName, JsonLogicVar, RuleProcessor } from 'react-querybuilder';\nimport { defaultRuleProcessorJsonLogic, toArray } from 'react-querybuilder';\nimport type { RQBJsonLogicDateRelative, RQBDateTimeJsonLogic } from './types';\nimport {\n isDateOnlyDatatype,\n isRelativeDateTimeValue,\n processIsDateField,\n resolveDatetimeOperator,\n} from './utils';\n\nconst dateOperationMap = {\n '!=': 'dateNotOn',\n '<': 'dateBefore',\n '<=': 'dateOnOrBefore',\n '=': 'dateOn',\n '>': 'dateAfter',\n '>=': 'dateOnOrAfter',\n between: 'dateBetween',\n in: 'dateIn',\n notBetween: 'dateNotBetween',\n notIn: 'dateNotIn',\n} as const satisfies Partial<Record<DefaultOperatorName, string>>;\n\n/**\n * Date/time rule processor for use by {@link @react-querybuilder/core!formatQuery formatQuery}\n * with the \"jsonlogic\" format.\n *\n * Note: Unlike other date/time rule processors from this library, this function does\n * not require a date/time library API. Instead, the date/time library API is used by\n * {@link getDatetimeJsonLogicOperations} during the evaluation process.\n */\nexport const datetimeRuleProcessorJsonLogic: RuleProcessor = (\n rule,\n options\n): RQBDateTimeJsonLogic => {\n const opts = options ?? /* v8 ignore start -- @preserve */ {} /* v8 ignore stop -- @preserve */;\n\n if (!processIsDateField(opts.context?.isDateField, rule, opts)) {\n return defaultRuleProcessorJsonLogic(rule, opts);\n }\n\n const { field, value, valueSource } = rule;\n const operator = resolveDatetimeOperator(rule, opts);\n const valueIsField = valueSource === 'field';\n const fieldObject: JsonLogicVar = { var: field };\n const dateOnly = isDateOnlyDatatype(opts?.fieldData?.datatype);\n // Relative values stay \"live\": emit a `dateRelative` op resolved at evaluation time.\n // Field-source values are field names and render as `var` references.\n const renderValue = (v: unknown) => {\n if (valueIsField) return { var: `${v}` };\n if (isRelativeDateTimeValue(v)) {\n return {\n dateRelative: [v.anchor, v.offset, v.unit, dateOnly],\n } as RQBJsonLogicDateRelative;\n }\n return v as string;\n };\n\n switch (operator) {\n case '<':\n case '<=':\n case '=':\n case '!=':\n case '>':\n case '>=':\n return {\n [dateOperationMap[operator]]: [fieldObject, renderValue(value)],\n } as RQBDateTimeJsonLogic;\n\n case 'in':\n case 'notIn': {\n const valueAsArray = (Array.isArray(value) ? value : toArray(value)).map(renderValue);\n return { [dateOperationMap[operator]]: [fieldObject, valueAsArray] } as RQBDateTimeJsonLogic;\n }\n\n case 'between':\n case 'notBetween': {\n const valueAsArray = (Array.isArray(value) ? value : toArray(value)).map(renderValue);\n\n if (valueAsArray.length < 2) return false;\n\n return {\n [dateOperationMap[operator]]: [valueAsArray[0], fieldObject, valueAsArray[1]],\n } as RQBDateTimeJsonLogic;\n }\n }\n\n return defaultRuleProcessorJsonLogic(rule, options);\n};\n","import type { Context } from 'react';\nimport { createContext, useContext } from 'react';\nimport type { ValueEditorProps } from 'react-querybuilder';\n\n/**\n * Holds the value editor inherited from an outer (compat package) context provider,\n * captured _before_ {@link QueryBuilderDateTime} overrides it. Lets the date/time value\n * editor delegate non-date fields (and absolute date inputs) to the compat editor instead\n * of the bare default {@link react-querybuilder!ValueEditor ValueEditor}. `null` = none\n * inherited (fall back to default).\n */\nexport const InheritedValueEditorContext: Context<React.ComponentType<ValueEditorProps> | null> =\n createContext<React.ComponentType<ValueEditorProps> | null>(null);\n\n/** Inherited (compat) value editor, or `null` if none. See {@link InheritedValueEditorContext}. */\nexport const useInheritedValueEditor = (): React.ComponentType<ValueEditorProps> | null =>\n useContext(InheritedValueEditorContext);\n","import type { FullOption } from 'react-querybuilder';\nimport type {\n RelativeDateTimeAnchor,\n RelativeDateTimeToggleLabels,\n RelativeDateTimeUnit,\n RelativeDateTimeValue,\n} from './types';\n\n/**\n * Class name applied to the absolute/relative mode toggle button. Package-local (not part\n * of the core `standardClassnames`) to avoid coupling core to this extension.\n */\nexport const relativeDateTimeToggleClassName = 'rule-value-dateTimeRelative-toggle';\n\n/** Default value applied when switching a rule to relative mode. */\nexport const defaultRelativeDateTimeValue: RelativeDateTimeValue = {\n mode: 'relative',\n anchor: 'now',\n offset: 0,\n unit: 'day',\n};\n\n/** Default anchor (reference-point) options for the relative date/time editor. */\nexport const defaultRelativeDateTimeAnchors: FullOption<RelativeDateTimeAnchor>[] = [\n { name: 'now', value: 'now', label: 'now' },\n { name: 'startOfDay', value: 'startOfDay', label: 'start of day' },\n { name: 'endOfDay', value: 'endOfDay', label: 'end of day' },\n { name: 'startOfWeek', value: 'startOfWeek', label: 'start of week' },\n { name: 'endOfWeek', value: 'endOfWeek', label: 'end of week' },\n { name: 'startOfMonth', value: 'startOfMonth', label: 'start of month' },\n { name: 'endOfMonth', value: 'endOfMonth', label: 'end of month' },\n { name: 'startOfYear', value: 'startOfYear', label: 'start of year' },\n { name: 'endOfYear', value: 'endOfYear', label: 'end of year' },\n];\n\n/** Default unit options for the relative date/time editor. */\nexport const defaultRelativeDateTimeUnits: FullOption<RelativeDateTimeUnit>[] = [\n { name: 'minute', value: 'minute', label: 'minute(s)' },\n { name: 'hour', value: 'hour', label: 'hour(s)' },\n { name: 'day', value: 'day', label: 'day(s)' },\n { name: 'week', value: 'week', label: 'week(s)' },\n { name: 'month', value: 'month', label: 'month(s)' },\n { name: 'year', value: 'year', label: 'year(s)' },\n];\n\n/** Default labels/content for the absolute/relative mode toggle. */\nexport const defaultRelativeDateTimeToggleLabels: Required<RelativeDateTimeToggleLabels> = {\n label: 'Toggle relative date/time',\n absoluteTitle: 'Absolute date/time (click for relative)',\n relativeTitle: 'Relative date/time (click for absolute)',\n // Empty by default; the CSS pseudo-element renders the glyph based on `aria-checked`.\n absoluteContent: '',\n relativeContent: '',\n};\n","import * as React from 'react';\nimport type { FullOperator } from 'react-querybuilder';\nimport { clsx, defaultOperators } from 'react-querybuilder';\nimport { relativeDateTimeToggleClassName } from './relativeDateTimeConstants';\nimport type { RelativeDateTimeModeController, RelativeDateTimeModeControlProps } from './types';\nimport { isRelativeDateTimeValue } from './utils';\n\n/**\n * Compact absolute/relative toggle rendered by {@link toggleModeController}. A\n * `role=\"switch\"` button whose default glyph is supplied by CSS (keyed on\n * `aria-checked`); override via the `toggleLabels` config.\n *\n * @group Components\n */\nexport const RelativeDateTimeModeToggle = ({\n isRelative,\n setMode,\n disabled,\n className,\n labels,\n}: RelativeDateTimeModeControlProps): React.JSX.Element => {\n const onClick = React.useCallback(\n () => setMode(isRelative ? 'absolute' : 'relative'),\n [setMode, isRelative]\n );\n\n return (\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={isRelative}\n aria-label={labels.label}\n title={isRelative ? labels.relativeTitle : labels.absoluteTitle}\n disabled={disabled}\n className={clsx(relativeDateTimeToggleClassName, className)}\n onClick={onClick}>\n {isRelative ? labels.relativeContent : labels.absoluteContent}\n </button>\n );\n};\n\n/**\n * Zero-config default {@link RelativeDateTimeModeController}: derives the mode from the\n * value shape and renders a compact toggle button to switch between absolute and\n * relative entry.\n */\nexport const toggleModeController: RelativeDateTimeModeController = {\n isRelative: props => isRelativeDateTimeValue(props.value),\n ModeControl: RelativeDateTimeModeToggle,\n};\n\n/**\n * Builds an operator-driven {@link RelativeDateTimeModeController} that derives the mode\n * from the rule's operator. Pass the operator name(s) (or a predicate) that should put the\n * editor in relative mode. No toggle is rendered — the operator selector is the mode\n * affordance.\n *\n * NOTE: the chosen operators only signal _mode_; the rule's value remains a\n * {@link RelativeDateTimeValue}. For these operators to export correctly, map each one to a\n * real comparison operator via `context.relativeOperatorMap` when calling `formatQuery`\n * (e.g. `{ relativeEq: '=' }`). See the documentation.\n */\nexport const createOperatorModeController = (\n relativeOperators: string[] | ((operator: string) => boolean)\n): RelativeDateTimeModeController => ({\n isRelative: props =>\n typeof relativeOperators === 'function'\n ? relativeOperators(props.operator)\n : relativeOperators.includes(props.operator),\n});\n\ninterface FieldWithOperators {\n operators?: FullOperator[];\n [key: string]: unknown;\n}\n\n/**\n * Appends the given `operators` to each field's `operators` list, so the operator-driven\n * controller (see {@link createOperatorModeController}) has an operator to switch into\n * relative mode. Fields without an explicit `operators` list fall back to the core\n * `defaultOperators`.\n */\nexport const withRelativeOperators = <F extends FieldWithOperators>(\n fields: F[],\n operators: FullOperator[]\n): F[] =>\n fields.map(field => ({\n ...field,\n operators: [...(field.operators ?? (defaultOperators as FullOperator[])), ...operators],\n }));\n","import * as React from 'react';\nimport { createContext, useContext, useMemo } from 'react';\nimport type { FullOption } from 'react-querybuilder';\nimport {\n defaultRelativeDateTimeAnchors,\n defaultRelativeDateTimeToggleLabels,\n defaultRelativeDateTimeUnits,\n} from './relativeDateTimeConstants';\nimport { toggleModeController } from './relativeDateTimeModeControllers';\nimport { rqbDateTimeLibraryAPI as defaultDateTimeAPI } from './rqbDateTimeLibraryAPI.dayjs';\nimport type {\n RelativeDateTimeAnchor,\n RelativeDateTimeEditorConfig,\n RelativeDateTimeModeController,\n RelativeDateTimeToggleLabels,\n RelativeDateTimeUnit,\n RQBDateTimeLibraryAPI,\n} from './types';\n\n/** Fully-resolved relative date/time editor config (no optional fields). */\nexport interface ResolvedRelativeDateTimeConfig {\n modeController: RelativeDateTimeModeController;\n anchors: FullOption<RelativeDateTimeAnchor>[];\n units: FullOption<RelativeDateTimeUnit>[];\n toggleLabels: Required<RelativeDateTimeToggleLabels>;\n dateTimeAPI: RQBDateTimeLibraryAPI;\n}\n\n/**\n * Carries {@link RelativeDateTimeEditorConfig} to the {@link RelativeDateTimeValueEditor}.\n * Provided by {@link QueryBuilderDateTime}; defaults apply when no provider is present.\n */\nexport const RelativeDateTimeConfigContext: React.Context<RelativeDateTimeEditorConfig> =\n createContext<RelativeDateTimeEditorConfig>({});\n\n/** Reads the relative date/time editor config from context, merged with defaults. */\nexport const useRelativeDateTimeConfig = (): ResolvedRelativeDateTimeConfig => {\n const config = useContext(RelativeDateTimeConfigContext);\n return useMemo(\n () => ({\n modeController: config.modeController ?? toggleModeController,\n anchors: config.anchors ?? defaultRelativeDateTimeAnchors,\n units: config.units ?? defaultRelativeDateTimeUnits,\n toggleLabels: { ...defaultRelativeDateTimeToggleLabels, ...config.toggleLabels },\n dateTimeAPI: config.dateTimeAPI ?? defaultDateTimeAPI,\n }),\n [config]\n );\n};\n","import * as React from 'react';\nimport { useCallback, useMemo } from 'react';\nimport type { FullField, Path, ValueEditorProps, ValueSelectorProps } from 'react-querybuilder';\nimport {\n clsx,\n parseNumber,\n standardClassnames,\n toArray,\n useValueEditor,\n ValueEditor,\n} from 'react-querybuilder';\nimport { useInheritedValueEditor } from './InheritedValueEditorContext';\nimport { DateTimeValueEditor } from './QueryBuilderDateTime';\nimport type { ResolvedRelativeDateTimeConfig } from './RelativeDateTimeConfigContext';\nimport { useRelativeDateTimeConfig } from './RelativeDateTimeConfigContext';\nimport { defaultRelativeDateTimeValue } from './relativeDateTimeConstants';\nimport type { RelativeDateTimeAnchor, RelativeDateTimeUnit, RelativeDateTimeValue } from './types';\nimport { isRelativeDateTimeValue } from './utils';\n\nconst dummyPath: Path = [];\nconst dummyFieldData: FullField = { name: '', value: '', label: '' };\n\n/** Splits a value into the from/to pair used by between/notBetween, object-safe. */\nconst toBetweenArray = (value: unknown): unknown[] =>\n Array.isArray(value) ? value : isRelativeDateTimeValue(value) ? [value] : toArray(value);\n\ninterface RelativeDateTimeSingleValueEditorProps {\n /** The original value editor props (for mode derivation and absolute rendering). */\n baseProps: ValueEditorProps;\n /** The value for this slot (the whole value, or one element of a between pair). */\n value: unknown;\n /** Emits a new value for this slot. */\n onChange: (value: unknown) => void;\n /** Operator passed to the absolute editor (forced to `=` for between slots). */\n absoluteOperator: string;\n config: ResolvedRelativeDateTimeConfig;\n SelectorComponent: React.ComponentType<ValueSelectorProps>;\n /** Themed numeric offset input: the inherited (compat) editor when present, else the default. */\n NumericEditorComponent: React.ComponentType<ValueEditorProps>;\n valueListItemClassName?: string;\n numericSchema: ValueEditorProps['schema'];\n}\n\n/**\n * Renders a single absolute-or-relative date/time value: a mode affordance (per the\n * controller) plus either an absolute date input or anchor + signed offset + unit\n * selectors. Reused once per slot so between/notBetween can mix bounds (e.g. an absolute\n * \"from\" and a relative \"to\").\n */\nconst RelativeDateTimeSingleValueEditor = ({\n baseProps,\n value,\n onChange,\n absoluteOperator,\n config,\n SelectorComponent,\n NumericEditorComponent,\n valueListItemClassName,\n numericSchema,\n}: RelativeDateTimeSingleValueEditorProps): React.JSX.Element => {\n const { schema, disabled, title, testID } = baseProps;\n const { modeController, anchors, units, toggleLabels } = config;\n\n const isRelative = modeController.isRelative({ ...baseProps, value });\n const relValue: RelativeDateTimeValue = isRelativeDateTimeValue(value)\n ? value\n : defaultRelativeDateTimeValue;\n\n const handleSetMode = useCallback(\n (mode: 'absolute' | 'relative') =>\n onChange(mode === 'relative' ? defaultRelativeDateTimeValue : ''),\n [onChange]\n );\n\n const handleChangeAnchor = useCallback(\n (anchor: string) => onChange({ ...relValue, anchor: anchor as RelativeDateTimeAnchor }),\n [onChange, relValue]\n );\n\n const handleChangeOffset = useCallback(\n (offset: unknown) =>\n onChange({\n ...relValue,\n offset: (parseNumber(offset, { parseNumbers: true }) as number) || 0,\n }),\n [onChange, relValue]\n );\n\n const handleChangeUnit = useCallback(\n (unit: string) => onChange({ ...relValue, unit: unit as RelativeDateTimeUnit }),\n [onChange, relValue]\n );\n\n const { ModeControl } = modeController;\n\n return (\n <React.Fragment>\n {ModeControl && (\n <ModeControl\n isRelative={isRelative}\n setMode={handleSetMode}\n schema={schema}\n disabled={disabled}\n className={valueListItemClassName}\n title={title}\n testID={testID}\n labels={toggleLabels}\n />\n )}\n {isRelative ? (\n <React.Fragment>\n <SelectorComponent\n schema={schema}\n testID={testID}\n title={title}\n className={valueListItemClassName}\n handleOnChange={handleChangeAnchor}\n disabled={disabled}\n value={relValue.anchor}\n options={anchors}\n multiple={false}\n listsAsArrays={false}\n path={dummyPath}\n level={0}\n />\n <NumericEditorComponent\n skipHook\n testID={testID}\n inputType=\"number\"\n title={title}\n className={valueListItemClassName}\n disabled={disabled}\n handleOnChange={handleChangeOffset}\n field={''}\n operator={''}\n value={relValue.offset}\n valueSource={'value'}\n fieldData={dummyFieldData}\n schema={numericSchema}\n path={dummyPath}\n level={0}\n rule={{ field: '', operator: '=', value: relValue.offset }}\n />\n {relValue.offset !== 0 && (\n <SelectorComponent\n schema={schema}\n testID={testID}\n title={title}\n className={valueListItemClassName}\n handleOnChange={handleChangeUnit}\n disabled={disabled}\n value={relValue.unit}\n options={units}\n multiple={false}\n listsAsArrays={false}\n path={dummyPath}\n level={0}\n />\n )}\n </React.Fragment>\n ) : (\n <DateTimeValueEditor\n {...baseProps}\n operator={absoluteOperator}\n value={value}\n handleOnChange={onChange}\n className={standardClassnames.value}\n />\n )}\n </React.Fragment>\n );\n};\n\n/**\n * Value editor with support for {@link RelativeDateTimeValue relative date/time values}\n * (e.g. \"three months ago\" or \"the beginning of this year\"). How the user switches\n * between absolute and relative modes is delegated to a pluggable\n * {@link RelativeDateTimeModeController} (default: a compact toggle), supplied via\n * {@link QueryBuilderDateTime}. In relative mode it renders anchor + signed offset + unit\n * selectors; the unit selector is hidden when the offset is `0`.\n *\n * For the `between`/`notBetween` operators it renders two independent value editors (each\n * with its own mode affordance) and stores the bounds as a two-element array, so the from\n * and to bounds can independently be absolute or relative.\n *\n * @group Components\n */\nexport const RelativeDateTimeValueEditor = (props: ValueEditorProps): React.JSX.Element => {\n const { valueListItemClassName } = useValueEditor(props);\n\n const { className, value, handleOnChange, schema, operator, separator } = props;\n const { suppressStandardClassnames } = schema;\n\n const SelectorComponent = props.selectorComponent ?? schema.controls.valueSelector;\n\n // Themed numeric offset input from the inherited (compat) editor when present, else default.\n const NumericEditorComponent = useInheritedValueEditor() ?? ValueEditor;\n\n const config = useRelativeDateTimeConfig();\n\n const numericSchema = useMemo(() => ({ ...schema, parseNumbers: true }), [schema]);\n\n const outerClassname = useMemo(\n () => clsx(suppressStandardClassnames || standardClassnames.valueDateTimeRelative, className),\n [suppressStandardClassnames, className]\n );\n\n const isBetween = operator === 'between' || operator === 'notBetween';\n\n // For between/notBetween, store the bounds as a two-element array. Relative values are\n // objects (which can't survive comma-joining), so the array is emitted directly,\n // regardless of `listsAsArrays`.\n const valueAsArray = useMemo(() => toBetweenArray(value), [value]);\n\n const handleChangeBound = useCallback(\n (index: number) => (boundValue: unknown) => {\n const next = [valueAsArray[0], valueAsArray[1]];\n next[index] = boundValue;\n handleOnChange(next);\n },\n [valueAsArray, handleOnChange]\n );\n\n if (isBetween) {\n return (\n <span className={outerClassname}>\n <RelativeDateTimeSingleValueEditor\n baseProps={props}\n value={valueAsArray[0]}\n onChange={handleChangeBound(0)}\n absoluteOperator=\"=\"\n config={config}\n SelectorComponent={SelectorComponent}\n NumericEditorComponent={NumericEditorComponent}\n valueListItemClassName={valueListItemClassName}\n numericSchema={numericSchema}\n />\n {separator}\n <RelativeDateTimeSingleValueEditor\n baseProps={props}\n value={valueAsArray[1]}\n onChange={handleChangeBound(1)}\n absoluteOperator=\"=\"\n config={config}\n SelectorComponent={SelectorComponent}\n NumericEditorComponent={NumericEditorComponent}\n valueListItemClassName={valueListItemClassName}\n numericSchema={numericSchema}\n />\n </span>\n );\n }\n\n return (\n <span className={outerClassname}>\n <RelativeDateTimeSingleValueEditor\n baseProps={props}\n value={value}\n onChange={handleOnChange}\n absoluteOperator={operator}\n config={config}\n SelectorComponent={SelectorComponent}\n NumericEditorComponent={NumericEditorComponent}\n valueListItemClassName={valueListItemClassName}\n numericSchema={numericSchema}\n />\n </span>\n );\n};\n","import * as React from 'react';\nimport { useContext, useMemo } from 'react';\nimport type { QueryBuilderContextProvider, ValueEditorProps } from 'react-querybuilder';\nimport {\n getCompatContextProvider,\n QueryBuilderContext,\n useValueEditor,\n ValueEditor,\n} from 'react-querybuilder';\nimport {\n InheritedValueEditorContext,\n useInheritedValueEditor,\n} from './InheritedValueEditorContext';\nimport {\n RelativeDateTimeConfigContext,\n useRelativeDateTimeConfig,\n} from './RelativeDateTimeConfigContext';\nimport { RelativeDateTimeValueEditor } from './RelativeDateTimeValueEditor';\nimport type { RelativeDateTimeEditorConfig } from './types';\n\n/**\n * Whether a rule should use a date/time editor, based on either the coerced input\n * type (`date`/`datetime-local`) or a date-like `datatype` (`date`/`datetime`/`timestamp`).\n */\nconst isDateTimeEditor = (props: ValueEditorProps, inputTypeCoerced: string | undefined): boolean =>\n (props.type === 'text' &&\n (inputTypeCoerced === 'date' || inputTypeCoerced === 'datetime-local')) ||\n /^(?:date|datetime|timestamp)\\b/i.test(props.fieldData?.datatype as string);\n\nconst pad2 = (n: number): string => `${n}`.padStart(2, '0');\n\n/**\n * Formats a `Date` into the local value expected by a native `date`/`datetime-local`\n * input (library-agnostic; the date library only handles parsing/validation).\n */\nconst formatDateInputValue = (d: Date, withTime: boolean): string => {\n const datePart = `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`;\n return withTime ? `${datePart}T${pad2(d.getHours())}:${pad2(d.getMinutes())}` : datePart;\n};\n\n/**\n * Renders the inherited (compat) editor when one is provided, otherwise the default\n * {@link react-querybuilder!ValueEditor ValueEditor}. The editor is received as a prop (rather\n * than read from context here) so the JSX element type stays prop-sourced and stable.\n */\nconst FallbackValueEditor = ({\n editor: Editor,\n ...props\n}: ValueEditorProps & {\n editor: React.ComponentType<ValueEditorProps> | null;\n}): React.JSX.Element => (Editor ? <Editor {...props} /> : <ValueEditor {...props} skipHook />);\n\nexport const DateTimeValueEditor = (props: ValueEditorProps): React.JSX.Element => {\n const uVE = useValueEditor(props);\n const InheritedEditor = useInheritedValueEditor();\n const { dateTimeAPI } = useRelativeDateTimeConfig();\n\n // Non-date fields and unparseable values: delegate to the inherited (compat) editor when\n // present, otherwise the default editor.\n const fallback = (p: ValueEditorProps) => <FallbackValueEditor editor={InheritedEditor} {...p} />;\n\n if (!isDateTimeEditor(props, uVE.inputTypeCoerced)) {\n return fallback(props);\n }\n\n if (dateTimeAPI.isValid(props.value)) {\n const value = formatDateInputValue(\n dateTimeAPI.toDate(props.value),\n uVE.inputTypeCoerced !== 'date'\n );\n return fallback({ ...props, value });\n }\n\n return fallback(props);\n};\n\n/**\n * Provider value editor: renders the relative-capable {@link RelativeDateTimeValueEditor}\n * for date/time fields and falls back to the inherited (compat) editor for everything else.\n */\nconst QueryBuilderDateTimeValueEditor = (props: ValueEditorProps): React.JSX.Element => {\n const uVE = useValueEditor(props);\n const InheritedEditor = useInheritedValueEditor();\n\n if (isDateTimeEditor(props, uVE.inputTypeCoerced)) {\n return <RelativeDateTimeValueEditor {...props} />;\n }\n\n return <FallbackValueEditor editor={InheritedEditor} {...props} />;\n};\n\nexport const QueryBuilderDateTimeContext: QueryBuilderContextProvider = getCompatContextProvider({\n controlElements: { valueEditor: QueryBuilderDateTimeValueEditor },\n});\n\n/** Props for {@link QueryBuilderDateTime}: {@link RelativeDateTimeEditorConfig} plus children. */\nexport interface QueryBuilderDateTimeProps extends RelativeDateTimeEditorConfig {\n children?: React.ReactNode;\n}\n\n/**\n * Context provider enabling date/time features for a wrapped\n * {@link react-querybuilder!QueryBuilder QueryBuilder}: renders the relative-capable\n * {@link RelativeDateTimeValueEditor} for date/time fields, and accepts optional\n * {@link RelativeDateTimeEditorConfig} props (mode controller, anchor/unit options, and\n * toggle labels). With no props it provides the zero-config toggle experience.\n *\n * @group Components\n */\nexport const QueryBuilderDateTime = ({\n children,\n modeController,\n anchors,\n units,\n toggleLabels,\n dateTimeAPI,\n}: QueryBuilderDateTimeProps): React.JSX.Element => {\n const config = useMemo(\n (): RelativeDateTimeEditorConfig => ({\n modeController,\n anchors,\n units,\n toggleLabels,\n dateTimeAPI,\n }),\n [modeController, anchors, units, toggleLabels, dateTimeAPI]\n );\n\n // Capture the value editor inherited from any outer compat provider (e.g. QueryBuilderMaterial)\n // _before_ QueryBuilderDateTimeContext overrides it, so date/time editors can delegate to it.\n const inheritedValueEditor = (useContext(QueryBuilderContext).controlElements?.valueEditor ??\n null) as React.ComponentType<ValueEditorProps> | null;\n\n return (\n <RelativeDateTimeConfigContext.Provider value={config}>\n <InheritedValueEditorContext.Provider value={inheritedValueEditor}>\n <QueryBuilderDateTimeContext>{children}</QueryBuilderDateTimeContext>\n </InheritedValueEditorContext.Provider>\n </RelativeDateTimeConfigContext.Provider>\n );\n};\n"],"mappings":";;;;;;;AAUA,MAAM,mBAAmB;CACvB,MAAM;CACN,KAAK;CACL,MAAM;CACN,KAAK;CACL,KAAK;CACL,MAAM;CACN,SAAS;CACT,IAAI;CACJ,YAAY;CACZ,OAAO;AACT;;;;;;;;;AAUA,MAAa,kCACX,MACA,YACyB;CACzB,MAAM,OAAO,gDAA8C,CAAC;CAE5D,IAAI,CAACA,2CAAAA,mBAAmB,KAAK,SAAS,aAAa,MAAM,IAAI,GAC3D,QAAA,GAAA,mBAAA,8BAAA,CAAqC,MAAM,IAAI;CAGjD,MAAM,EAAE,OAAO,OAAO,gBAAgB;CACtC,MAAM,WAAWC,2CAAAA,wBAAwB,MAAM,IAAI;CACnD,MAAM,eAAe,gBAAgB;CACrC,MAAM,cAA4B,EAAE,KAAK,MAAM;CAC/C,MAAM,WAAWC,2CAAAA,mBAAmB,MAAM,WAAW,QAAQ;CAG7D,MAAM,eAAe,MAAe;EAClC,IAAI,cAAc,OAAO,EAAE,KAAK,GAAG,IAAI;EACvC,IAAIC,2CAAAA,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,SAAA,GAAA,mBAAA,QAAA,CAAgB,KAAK,EAAA,CAAG,IAAI,WAAW;GACpF,OAAO,GAAG,iBAAiB,YAAY,CAAC,aAAa,YAAY,EAAE;EACrE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gBACA,SACA,OACA,cACA,kBACkD;CAClD,MAAM,UAAA,GAAA,MAAA,QAAA,QACiC;EACnC;EACA;EACA;EACA;EACA;CACF,IACA;EAAC;EAAgB;EAAS;EAAO;EAAc;CAAW,CAC5D;CAIA,MAAM,wBAAA,GAAA,MAAA,WAAA,CAAmCC,mBAAAA,mBAAmB,CAAC,CAAC,iBAAiB,eAC7E;CAEF,OACE,sBAAA,cAAC,8BAA8B,UAA/B,EAAwC,OAAO,OAIP,GAHtC,sBAAA,cAAC,4BAA4B,UAA7B,EAAsC,OAAO,qBAEP,GADpC,sBAAA,cAAC,6BAAA,MAA6B,QAAsC,CAChC,CACA;AAE5C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rqbDateTimeLibraryAPI.dayjs-BfILPx88.js"),t=require("./getDatetimeRuleProcessorTanStackDB-DgUg_arY.js");let n=require("react-querybuilder"),r=require("react");r=e.n(r);const i={"!=":`dateNotOn`,"<":`dateBefore`,"<=":`dateOnOrBefore`,"=":`dateOn`,">":`dateAfter`,">=":`dateOnOrAfter`,between:`dateBetween`,in:`dateIn`,notBetween:`dateNotBetween`,notIn:`dateNotIn`},a=(e,r)=>{let a=r??{};if(!t.k(a.context?.isDateField,e,a))return(0,n.defaultRuleProcessorJsonLogic)(e,a);let{field:o,value:s,valueSource:c}=e,l=t.A(e,a),u=c===`field`,d={var:o},f=t.E(a?.fieldData?.datatype),p=e=>u?{var:`${e}`}:t.O(e)?{dateRelative:[e.anchor,e.offset,e.unit,f]}:e;switch(l){case`<`:case`<=`:case`=`:case`!=`:case`>`:case`>=`:return{[i[l]]:[d,p(s)]};case`in`:case`notIn`:{let e=(Array.isArray(s)?s:(0,n.toArray)(s)).map(p);return{[i[l]]:[d,e]}}case`between`:case`notBetween`:{let e=(Array.isArray(s)?s:(0,n.toArray)(s)).map(p);return e.length<2?!1:{[i[l]]:[e[0],d,e[1]]}}}return(0,n.defaultRuleProcessorJsonLogic)(e,r)},o=(0,r.createContext)(null),s=()=>(0,r.useContext)(o),c=`rule-value-dateTimeRelative-toggle`,l={mode:`relative`,anchor:`now`,offset:0,unit:`day`},u=[{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`}],d=[{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)`}],f={label:`Toggle relative date/time`,absoluteTitle:`Absolute date/time (click for relative)`,relativeTitle:`Relative date/time (click for absolute)`,absoluteContent:``,relativeContent:``},p=({isRelative:e,setMode:t,disabled:i,className:a,labels:o})=>{let s=r.useCallback(()=>t(e?`absolute`:`relative`),[t,e]);return r.createElement(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":o.label,title:e?o.relativeTitle:o.absoluteTitle,disabled:i,className:(0,n.clsx)(c,a),onClick:s},e?o.relativeContent:o.absoluteContent)},m={isRelative:e=>t.O(e.value),ModeControl:p},h=e=>({isRelative:t=>typeof e==`function`?e(t.operator):e.includes(t.operator)}),g=(e,t)=>e.map(e=>({...e,operators:[...e.operators??n.defaultOperators,...t]})),_=(0,r.createContext)({}),v=()=>{let t=(0,r.useContext)(_);return(0,r.useMemo)(()=>({modeController:t.modeController??m,anchors:t.anchors??u,units:t.units??d,toggleLabels:{...f,...t.toggleLabels},dateTimeAPI:t.dateTimeAPI??e.t}),[t])},y=[],b={name:``,value:``,label:``},x=e=>Array.isArray(e)?e:t.O(e)?[e]:(0,n.toArray)(e),S=({baseProps:e,value:i,onChange:a,absoluteOperator:o,config:
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rqbDateTimeLibraryAPI.dayjs-BfILPx88.js"),t=require("./getDatetimeRuleProcessorTanStackDB-DgUg_arY.js");let n=require("react-querybuilder"),r=require("react");r=e.n(r);const i={"!=":`dateNotOn`,"<":`dateBefore`,"<=":`dateOnOrBefore`,"=":`dateOn`,">":`dateAfter`,">=":`dateOnOrAfter`,between:`dateBetween`,in:`dateIn`,notBetween:`dateNotBetween`,notIn:`dateNotIn`},a=(e,r)=>{let a=r??{};if(!t.k(a.context?.isDateField,e,a))return(0,n.defaultRuleProcessorJsonLogic)(e,a);let{field:o,value:s,valueSource:c}=e,l=t.A(e,a),u=c===`field`,d={var:o},f=t.E(a?.fieldData?.datatype),p=e=>u?{var:`${e}`}:t.O(e)?{dateRelative:[e.anchor,e.offset,e.unit,f]}:e;switch(l){case`<`:case`<=`:case`=`:case`!=`:case`>`:case`>=`:return{[i[l]]:[d,p(s)]};case`in`:case`notIn`:{let e=(Array.isArray(s)?s:(0,n.toArray)(s)).map(p);return{[i[l]]:[d,e]}}case`between`:case`notBetween`:{let e=(Array.isArray(s)?s:(0,n.toArray)(s)).map(p);return e.length<2?!1:{[i[l]]:[e[0],d,e[1]]}}}return(0,n.defaultRuleProcessorJsonLogic)(e,r)},o=(0,r.createContext)(null),s=()=>(0,r.useContext)(o),c=`rule-value-dateTimeRelative-toggle`,l={mode:`relative`,anchor:`now`,offset:0,unit:`day`},u=[{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`}],d=[{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)`}],f={label:`Toggle relative date/time`,absoluteTitle:`Absolute date/time (click for relative)`,relativeTitle:`Relative date/time (click for absolute)`,absoluteContent:``,relativeContent:``},p=({isRelative:e,setMode:t,disabled:i,className:a,labels:o})=>{let s=r.useCallback(()=>t(e?`absolute`:`relative`),[t,e]);return r.createElement(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":o.label,title:e?o.relativeTitle:o.absoluteTitle,disabled:i,className:(0,n.clsx)(c,a),onClick:s},e?o.relativeContent:o.absoluteContent)},m={isRelative:e=>t.O(e.value),ModeControl:p},h=e=>({isRelative:t=>typeof e==`function`?e(t.operator):e.includes(t.operator)}),g=(e,t)=>e.map(e=>({...e,operators:[...e.operators??n.defaultOperators,...t]})),_=(0,r.createContext)({}),v=()=>{let t=(0,r.useContext)(_);return(0,r.useMemo)(()=>({modeController:t.modeController??m,anchors:t.anchors??u,units:t.units??d,toggleLabels:{...f,...t.toggleLabels},dateTimeAPI:t.dateTimeAPI??e.t}),[t])},y=[],b={name:``,value:``,label:``},x=e=>Array.isArray(e)?e:t.O(e)?[e]:(0,n.toArray)(e),S=({baseProps:e,value:i,onChange:a,absoluteOperator:o,config:s,SelectorComponent:c,NumericEditorComponent:u,valueListItemClassName:d,numericSchema:f})=>{let{schema:p,disabled:m,title:h,testID:g}=e,{modeController:_,anchors:v,units:x,toggleLabels:S}=s,C=_.isRelative({...e,value:i}),w=t.O(i)?i:l,T=(0,r.useCallback)(e=>a(e===`relative`?l:``),[a]),E=(0,r.useCallback)(e=>a({...w,anchor:e}),[a,w]),D=(0,r.useCallback)(e=>a({...w,offset:(0,n.parseNumber)(e,{parseNumbers:!0})||0}),[a,w]),k=(0,r.useCallback)(e=>a({...w,unit:e}),[a,w]),{ModeControl:A}=_;return r.createElement(r.Fragment,null,A&&r.createElement(A,{isRelative:C,setMode:T,schema:p,disabled:m,className:d,title:h,testID:g,labels:S}),C?r.createElement(r.Fragment,null,r.createElement(c,{schema:p,testID:g,title:h,className:d,handleOnChange:E,disabled:m,value:w.anchor,options:v,multiple:!1,listsAsArrays:!1,path:y,level:0}),r.createElement(u,{skipHook:!0,testID:g,inputType:`number`,title:h,className:d,disabled:m,handleOnChange:D,field:``,operator:``,value:w.offset,valueSource:`value`,fieldData:b,schema:f,path:y,level:0,rule:{field:``,operator:`=`,value:w.offset}}),w.offset!==0&&r.createElement(c,{schema:p,testID:g,title:h,className:d,handleOnChange:k,disabled:m,value:w.unit,options:x,multiple:!1,listsAsArrays:!1,path:y,level:0})):r.createElement(O,{...e,operator:o,value:i,handleOnChange:a,className:n.standardClassnames.value}))},C=e=>{let{valueListItemClassName:t}=(0,n.useValueEditor)(e),{className:i,value:a,handleOnChange:o,schema:c,operator:l,separator:u}=e,{suppressStandardClassnames:d}=c,f=e.selectorComponent??c.controls.valueSelector,p=s()??n.ValueEditor,m=v(),h=(0,r.useMemo)(()=>({...c,parseNumbers:!0}),[c]),g=(0,r.useMemo)(()=>(0,n.clsx)(d||n.standardClassnames.valueDateTimeRelative,i),[d,i]),_=l===`between`||l===`notBetween`,y=(0,r.useMemo)(()=>x(a),[a]),b=(0,r.useCallback)(e=>t=>{let n=[y[0],y[1]];n[e]=t,o(n)},[y,o]);return _?r.createElement(`span`,{className:g},r.createElement(S,{baseProps:e,value:y[0],onChange:b(0),absoluteOperator:`=`,config:m,SelectorComponent:f,NumericEditorComponent:p,valueListItemClassName:t,numericSchema:h}),u,r.createElement(S,{baseProps:e,value:y[1],onChange:b(1),absoluteOperator:`=`,config:m,SelectorComponent:f,NumericEditorComponent:p,valueListItemClassName:t,numericSchema:h})):r.createElement(`span`,{className:g},r.createElement(S,{baseProps:e,value:a,onChange:o,absoluteOperator:l,config:m,SelectorComponent:f,NumericEditorComponent:p,valueListItemClassName:t,numericSchema:h}))},w=(e,t)=>e.type===`text`&&(t===`date`||t===`datetime-local`)||/^(?:date|datetime|timestamp)\b/i.test(e.fieldData?.datatype),T=e=>`${e}`.padStart(2,`0`),E=(e,t)=>{let n=`${e.getFullYear()}-${T(e.getMonth()+1)}-${T(e.getDate())}`;return t?`${n}T${T(e.getHours())}:${T(e.getMinutes())}`:n},D=({editor:e,...t})=>e?r.createElement(e,t):r.createElement(n.ValueEditor,{...t,skipHook:!0}),O=e=>{let t=(0,n.useValueEditor)(e),i=s(),{dateTimeAPI:a}=v(),o=e=>r.createElement(D,{editor:i,...e});if(!w(e,t.inputTypeCoerced))return o(e);if(a.isValid(e.value)){let n=E(a.toDate(e.value),t.inputTypeCoerced!==`date`);return o({...e,value:n})}return o(e)},k=(0,n.getCompatContextProvider)({controlElements:{valueEditor:e=>{let t=(0,n.useValueEditor)(e),i=s();return w(e,t.inputTypeCoerced)?r.createElement(C,e):r.createElement(D,{editor:i,...e})}}}),A=({children:e,modeController:t,anchors:i,units:a,toggleLabels:s,dateTimeAPI:c})=>{let l=(0,r.useMemo)(()=>({modeController:t,anchors:i,units:a,toggleLabels:s,dateTimeAPI:c}),[t,i,a,s,c]),u=(0,r.useContext)(n.QueryBuilderContext).controlElements?.valueEditor??null;return r.createElement(_.Provider,{value:l},r.createElement(o.Provider,{value:u},r.createElement(k,null,e)))};exports.DateTimeValueEditor=O,exports.QueryBuilderDateTime=A,exports.QueryBuilderDateTimeContext=k,exports.RelativeDateTimeConfigContext=_,exports.RelativeDateTimeModeToggle=p,exports.RelativeDateTimeValueEditor=C,exports.createOperatorModeController=h,exports.datetimeRuleProcessorJsonLogic=a,exports.datetimeValueProcessorNL=t.p,exports.defaultDateTimeNLOperatorMap=t.m,exports.defaultRelativeDateTimeAnchors=u,exports.defaultRelativeDateTimeToggleLabels=f,exports.defaultRelativeDateTimeUnits=d,exports.defaultRelativeDateTimeValue=l,exports.getDatetimeJsonLogicOperations=t.T,exports.getDatetimeRuleProcessorCEL=t.w,exports.getDatetimeRuleProcessorCypher=t.C,exports.getDatetimeRuleProcessorDrizzle=t.S,exports.getDatetimeRuleProcessorElasticSearch=t.x,exports.getDatetimeRuleProcessorGremlin=t.b,exports.getDatetimeRuleProcessorJSONata=t.y,exports.getDatetimeRuleProcessorLDAP=t.v,exports.getDatetimeRuleProcessorMongoDB=t.g,exports.getDatetimeRuleProcessorMongoDBQuery=t._,exports.getDatetimeRuleProcessorNL=t.h,exports.getDatetimeRuleProcessorParameterized=t.f,exports.getDatetimeRuleProcessorPrisma=t.d,exports.getDatetimeRuleProcessorSPARQL=t.l,exports.getDatetimeRuleProcessorSQL=t.n,exports.getDatetimeRuleProcessorSequelize=t.u,exports.getDatetimeRuleProcessorSpEL=t.c,exports.getDatetimeRuleProcessorTanStackDB=t.t,exports.getDatetimeValueProcessorANSI=t.r,exports.getDatetimeValueProcessorMSSQL=t.i,exports.getDatetimeValueProcessorMySQL=t.a,exports.getDatetimeValueProcessorOracle=t.o,exports.getDatetimeValueProcessorPostgreSQL=t.s,exports.relativeDateTimeToggleClassName=c,exports.toggleModeController=m,exports.useRelativeDateTimeConfig=v,exports.withRelativeOperators=g;
|
|
2
2
|
//# sourceMappingURL=react-querybuilder_datetime.cjs.production.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-querybuilder_datetime.cjs.production.js","names":["processIsDateField","resolveDatetimeOperator","isDateOnlyDatatype","isRelativeDateTimeValue","React","isRelativeDateTimeValue","defaultOperators","defaultDateTimeAPI","isRelativeDateTimeValue","ValueEditor","React","standardClassnames","ValueEditor","QueryBuilderContext"],"sources":["../../src/datetimeRuleProcessorJsonLogic.ts","../../src/InheritedValueEditorContext.ts","../../src/relativeDateTimeConstants.ts","../../src/relativeDateTimeModeControllers.tsx","../../src/RelativeDateTimeConfigContext.tsx","../../src/RelativeDateTimeValueEditor.tsx","../../src/QueryBuilderDateTime.tsx"],"sourcesContent":["import type { DefaultOperatorName, JsonLogicVar, RuleProcessor } from 'react-querybuilder';\nimport { defaultRuleProcessorJsonLogic, toArray } from 'react-querybuilder';\nimport type { RQBJsonLogicDateRelative, RQBDateTimeJsonLogic } from './types';\nimport {\n isDateOnlyDatatype,\n isRelativeDateTimeValue,\n processIsDateField,\n resolveDatetimeOperator,\n} from './utils';\n\nconst dateOperationMap = {\n '!=': 'dateNotOn',\n '<': 'dateBefore',\n '<=': 'dateOnOrBefore',\n '=': 'dateOn',\n '>': 'dateAfter',\n '>=': 'dateOnOrAfter',\n between: 'dateBetween',\n in: 'dateIn',\n notBetween: 'dateNotBetween',\n notIn: 'dateNotIn',\n} as const satisfies Partial<Record<DefaultOperatorName, string>>;\n\n/**\n * Date/time rule processor for use by {@link @react-querybuilder/core!formatQuery formatQuery}\n * with the \"jsonlogic\" format.\n *\n * Note: Unlike other date/time rule processors from this library, this function does\n * not require a date/time library API. Instead, the date/time library API is used by\n * {@link getDatetimeJsonLogicOperations} during the evaluation process.\n */\nexport const datetimeRuleProcessorJsonLogic: RuleProcessor = (\n rule,\n options\n): RQBDateTimeJsonLogic => {\n const opts = options ?? /* v8 ignore start -- @preserve */ {} /* v8 ignore stop -- @preserve */;\n\n if (!processIsDateField(opts.context?.isDateField, rule, opts)) {\n return defaultRuleProcessorJsonLogic(rule, opts);\n }\n\n const { field, value, valueSource } = rule;\n const operator = resolveDatetimeOperator(rule, opts);\n const valueIsField = valueSource === 'field';\n const fieldObject: JsonLogicVar = { var: field };\n const dateOnly = isDateOnlyDatatype(opts?.fieldData?.datatype);\n // Relative values stay \"live\": emit a `dateRelative` op resolved at evaluation time.\n // Field-source values are field names and render as `var` references.\n const renderValue = (v: unknown) => {\n if (valueIsField) return { var: `${v}` };\n if (isRelativeDateTimeValue(v)) {\n return {\n dateRelative: [v.anchor, v.offset, v.unit, dateOnly],\n } as RQBJsonLogicDateRelative;\n }\n return v as string;\n };\n\n switch (operator) {\n case '<':\n case '<=':\n case '=':\n case '!=':\n case '>':\n case '>=':\n return {\n [dateOperationMap[operator]]: [fieldObject, renderValue(value)],\n } as RQBDateTimeJsonLogic;\n\n case 'in':\n case 'notIn': {\n const valueAsArray = (Array.isArray(value) ? value : toArray(value)).map(renderValue);\n return { [dateOperationMap[operator]]: [fieldObject, valueAsArray] } as RQBDateTimeJsonLogic;\n }\n\n case 'between':\n case 'notBetween': {\n const valueAsArray = (Array.isArray(value) ? value : toArray(value)).map(renderValue);\n\n if (valueAsArray.length < 2) return false;\n\n return {\n [dateOperationMap[operator]]: [valueAsArray[0], fieldObject, valueAsArray[1]],\n } as RQBDateTimeJsonLogic;\n }\n }\n\n return defaultRuleProcessorJsonLogic(rule, options);\n};\n","import type { Context } from 'react';\nimport { createContext, useContext } from 'react';\nimport type { ValueEditorProps } from 'react-querybuilder';\n\n/**\n * Holds the value editor inherited from an outer (compat package) context provider,\n * captured _before_ {@link QueryBuilderDateTime} overrides it. Lets the date/time value\n * editor delegate non-date fields (and absolute date inputs) to the compat editor instead\n * of the bare default {@link react-querybuilder!ValueEditor ValueEditor}. `null` = none\n * inherited (fall back to default).\n */\nexport const InheritedValueEditorContext: Context<React.ComponentType<ValueEditorProps> | null> =\n createContext<React.ComponentType<ValueEditorProps> | null>(null);\n\n/** Inherited (compat) value editor, or `null` if none. See {@link InheritedValueEditorContext}. */\nexport const useInheritedValueEditor = (): React.ComponentType<ValueEditorProps> | null =>\n useContext(InheritedValueEditorContext);\n","import type { FullOption } from 'react-querybuilder';\nimport type {\n RelativeDateTimeAnchor,\n RelativeDateTimeToggleLabels,\n RelativeDateTimeUnit,\n RelativeDateTimeValue,\n} from './types';\n\n/**\n * Class name applied to the absolute/relative mode toggle button. Package-local (not part\n * of the core `standardClassnames`) to avoid coupling core to this extension.\n */\nexport const relativeDateTimeToggleClassName = 'rule-value-dateTimeRelative-toggle';\n\n/** Default value applied when switching a rule to relative mode. */\nexport const defaultRelativeDateTimeValue: RelativeDateTimeValue = {\n mode: 'relative',\n anchor: 'now',\n offset: 0,\n unit: 'day',\n};\n\n/** Default anchor (reference-point) options for the relative date/time editor. */\nexport const defaultRelativeDateTimeAnchors: FullOption<RelativeDateTimeAnchor>[] = [\n { name: 'now', value: 'now', label: 'now' },\n { name: 'startOfDay', value: 'startOfDay', label: 'start of day' },\n { name: 'endOfDay', value: 'endOfDay', label: 'end of day' },\n { name: 'startOfWeek', value: 'startOfWeek', label: 'start of week' },\n { name: 'endOfWeek', value: 'endOfWeek', label: 'end of week' },\n { name: 'startOfMonth', value: 'startOfMonth', label: 'start of month' },\n { name: 'endOfMonth', value: 'endOfMonth', label: 'end of month' },\n { name: 'startOfYear', value: 'startOfYear', label: 'start of year' },\n { name: 'endOfYear', value: 'endOfYear', label: 'end of year' },\n];\n\n/** Default unit options for the relative date/time editor. */\nexport const defaultRelativeDateTimeUnits: FullOption<RelativeDateTimeUnit>[] = [\n { name: 'minute', value: 'minute', label: 'minute(s)' },\n { name: 'hour', value: 'hour', label: 'hour(s)' },\n { name: 'day', value: 'day', label: 'day(s)' },\n { name: 'week', value: 'week', label: 'week(s)' },\n { name: 'month', value: 'month', label: 'month(s)' },\n { name: 'year', value: 'year', label: 'year(s)' },\n];\n\n/** Default labels/content for the absolute/relative mode toggle. */\nexport const defaultRelativeDateTimeToggleLabels: Required<RelativeDateTimeToggleLabels> = {\n label: 'Toggle relative date/time',\n absoluteTitle: 'Absolute date/time (click for relative)',\n relativeTitle: 'Relative date/time (click for absolute)',\n // Empty by default; the CSS pseudo-element renders the glyph based on `aria-checked`.\n absoluteContent: '',\n relativeContent: '',\n};\n","import * as React from 'react';\nimport type { FullOperator } from 'react-querybuilder';\nimport { clsx, defaultOperators } from 'react-querybuilder';\nimport { relativeDateTimeToggleClassName } from './relativeDateTimeConstants';\nimport type { RelativeDateTimeModeController, RelativeDateTimeModeControlProps } from './types';\nimport { isRelativeDateTimeValue } from './utils';\n\n/**\n * Compact absolute/relative toggle rendered by {@link toggleModeController}. A\n * `role=\"switch\"` button whose default glyph is supplied by CSS (keyed on\n * `aria-checked`); override via the `toggleLabels` config.\n *\n * @group Components\n */\nexport const RelativeDateTimeModeToggle = ({\n isRelative,\n setMode,\n disabled,\n className,\n labels,\n}: RelativeDateTimeModeControlProps): React.JSX.Element => {\n const onClick = React.useCallback(\n () => setMode(isRelative ? 'absolute' : 'relative'),\n [setMode, isRelative]\n );\n\n return (\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={isRelative}\n aria-label={labels.label}\n title={isRelative ? labels.relativeTitle : labels.absoluteTitle}\n disabled={disabled}\n className={clsx(relativeDateTimeToggleClassName, className)}\n onClick={onClick}>\n {isRelative ? labels.relativeContent : labels.absoluteContent}\n </button>\n );\n};\n\n/**\n * Zero-config default {@link RelativeDateTimeModeController}: derives the mode from the\n * value shape and renders a compact toggle button to switch between absolute and\n * relative entry.\n */\nexport const toggleModeController: RelativeDateTimeModeController = {\n isRelative: props => isRelativeDateTimeValue(props.value),\n ModeControl: RelativeDateTimeModeToggle,\n};\n\n/**\n * Builds an operator-driven {@link RelativeDateTimeModeController} that derives the mode\n * from the rule's operator. Pass the operator name(s) (or a predicate) that should put the\n * editor in relative mode. No toggle is rendered — the operator selector is the mode\n * affordance.\n *\n * NOTE: the chosen operators only signal _mode_; the rule's value remains a\n * {@link RelativeDateTimeValue}. For these operators to export correctly, map each one to a\n * real comparison operator via `context.relativeOperatorMap` when calling `formatQuery`\n * (e.g. `{ relativeEq: '=' }`). See the documentation.\n */\nexport const createOperatorModeController = (\n relativeOperators: string[] | ((operator: string) => boolean)\n): RelativeDateTimeModeController => ({\n isRelative: props =>\n typeof relativeOperators === 'function'\n ? relativeOperators(props.operator)\n : relativeOperators.includes(props.operator),\n});\n\ninterface FieldWithOperators {\n operators?: FullOperator[];\n [key: string]: unknown;\n}\n\n/**\n * Appends the given `operators` to each field's `operators` list, so the operator-driven\n * controller (see {@link createOperatorModeController}) has an operator to switch into\n * relative mode. Fields without an explicit `operators` list fall back to the core\n * `defaultOperators`.\n */\nexport const withRelativeOperators = <F extends FieldWithOperators>(\n fields: F[],\n operators: FullOperator[]\n): F[] =>\n fields.map(field => ({\n ...field,\n operators: [...(field.operators ?? (defaultOperators as FullOperator[])), ...operators],\n }));\n","import * as React from 'react';\nimport { createContext, useContext, useMemo } from 'react';\nimport type { FullOption } from 'react-querybuilder';\nimport {\n defaultRelativeDateTimeAnchors,\n defaultRelativeDateTimeToggleLabels,\n defaultRelativeDateTimeUnits,\n} from './relativeDateTimeConstants';\nimport { toggleModeController } from './relativeDateTimeModeControllers';\nimport { rqbDateTimeLibraryAPI as defaultDateTimeAPI } from './rqbDateTimeLibraryAPI.dayjs';\nimport type {\n RelativeDateTimeAnchor,\n RelativeDateTimeEditorConfig,\n RelativeDateTimeModeController,\n RelativeDateTimeToggleLabels,\n RelativeDateTimeUnit,\n RQBDateTimeLibraryAPI,\n} from './types';\n\n/** Fully-resolved relative date/time editor config (no optional fields). */\nexport interface ResolvedRelativeDateTimeConfig {\n modeController: RelativeDateTimeModeController;\n anchors: FullOption<RelativeDateTimeAnchor>[];\n units: FullOption<RelativeDateTimeUnit>[];\n toggleLabels: Required<RelativeDateTimeToggleLabels>;\n dateTimeAPI: RQBDateTimeLibraryAPI;\n}\n\n/**\n * Carries {@link RelativeDateTimeEditorConfig} to the {@link RelativeDateTimeValueEditor}.\n * Provided by {@link QueryBuilderDateTime}; defaults apply when no provider is present.\n */\nexport const RelativeDateTimeConfigContext: React.Context<RelativeDateTimeEditorConfig> =\n createContext<RelativeDateTimeEditorConfig>({});\n\n/** Reads the relative date/time editor config from context, merged with defaults. */\nexport const useRelativeDateTimeConfig = (): ResolvedRelativeDateTimeConfig => {\n const config = useContext(RelativeDateTimeConfigContext);\n return useMemo(\n () => ({\n modeController: config.modeController ?? toggleModeController,\n anchors: config.anchors ?? defaultRelativeDateTimeAnchors,\n units: config.units ?? defaultRelativeDateTimeUnits,\n toggleLabels: { ...defaultRelativeDateTimeToggleLabels, ...config.toggleLabels },\n dateTimeAPI: config.dateTimeAPI ?? defaultDateTimeAPI,\n }),\n [config]\n );\n};\n","import * as React from 'react';\nimport { useCallback, useMemo } from 'react';\nimport type { FullField, Path, ValueEditorProps, ValueSelectorProps } from 'react-querybuilder';\nimport {\n clsx,\n parseNumber,\n standardClassnames,\n toArray,\n useValueEditor,\n ValueEditor,\n} from 'react-querybuilder';\nimport { useInheritedValueEditor } from './InheritedValueEditorContext';\nimport { DateTimeValueEditor } from './QueryBuilderDateTime';\nimport type { ResolvedRelativeDateTimeConfig } from './RelativeDateTimeConfigContext';\nimport { useRelativeDateTimeConfig } from './RelativeDateTimeConfigContext';\nimport { defaultRelativeDateTimeValue } from './relativeDateTimeConstants';\nimport type { RelativeDateTimeAnchor, RelativeDateTimeUnit, RelativeDateTimeValue } from './types';\nimport { isRelativeDateTimeValue } from './utils';\n\nconst dummyPath: Path = [];\nconst dummyFieldData: FullField = { name: '', value: '', label: '' };\n\n/** Splits a value into the from/to pair used by between/notBetween, object-safe. */\nconst toBetweenArray = (value: unknown): unknown[] =>\n Array.isArray(value) ? value : isRelativeDateTimeValue(value) ? [value] : toArray(value);\n\ninterface RelativeDateTimeSingleValueEditorProps {\n /** The original value editor props (for mode derivation and absolute rendering). */\n baseProps: ValueEditorProps;\n /** The value for this slot (the whole value, or one element of a between pair). */\n value: unknown;\n /** Emits a new value for this slot. */\n onChange: (value: unknown) => void;\n /** Operator passed to the absolute editor (forced to `=` for between slots). */\n absoluteOperator: string;\n config: ResolvedRelativeDateTimeConfig;\n SelectorComponent: React.ComponentType<ValueSelectorProps>;\n valueListItemClassName?: string;\n numericSchema: ValueEditorProps['schema'];\n}\n\n/**\n * Renders a single absolute-or-relative date/time value: a mode affordance (per the\n * controller) plus either an absolute date input or anchor + signed offset + unit\n * selectors. Reused once per slot so between/notBetween can mix bounds (e.g. an absolute\n * \"from\" and a relative \"to\").\n */\nconst RelativeDateTimeSingleValueEditor = ({\n baseProps,\n value,\n onChange,\n absoluteOperator,\n config,\n SelectorComponent,\n valueListItemClassName,\n numericSchema,\n}: RelativeDateTimeSingleValueEditorProps): React.JSX.Element => {\n const { schema, disabled, title, testID } = baseProps;\n const { modeController, anchors, units, toggleLabels } = config;\n\n // Themed numeric offset input from the inherited (compat) editor when present.\n const NumericEditor = useInheritedValueEditor() ?? ValueEditor;\n\n const isRelative = modeController.isRelative({ ...baseProps, value });\n const relValue: RelativeDateTimeValue = isRelativeDateTimeValue(value)\n ? value\n : defaultRelativeDateTimeValue;\n\n const handleSetMode = useCallback(\n (mode: 'absolute' | 'relative') =>\n onChange(mode === 'relative' ? defaultRelativeDateTimeValue : ''),\n [onChange]\n );\n\n const handleChangeAnchor = useCallback(\n (anchor: string) => onChange({ ...relValue, anchor: anchor as RelativeDateTimeAnchor }),\n [onChange, relValue]\n );\n\n const handleChangeOffset = useCallback(\n (offset: unknown) =>\n onChange({\n ...relValue,\n offset: (parseNumber(offset, { parseNumbers: true }) as number) || 0,\n }),\n [onChange, relValue]\n );\n\n const handleChangeUnit = useCallback(\n (unit: string) => onChange({ ...relValue, unit: unit as RelativeDateTimeUnit }),\n [onChange, relValue]\n );\n\n const { ModeControl } = modeController;\n\n return (\n <React.Fragment>\n {ModeControl && (\n <ModeControl\n isRelative={isRelative}\n setMode={handleSetMode}\n schema={schema}\n disabled={disabled}\n className={valueListItemClassName}\n title={title}\n testID={testID}\n labels={toggleLabels}\n />\n )}\n {isRelative ? (\n <React.Fragment>\n <SelectorComponent\n schema={schema}\n testID={testID}\n title={title}\n className={valueListItemClassName}\n handleOnChange={handleChangeAnchor}\n disabled={disabled}\n value={relValue.anchor}\n options={anchors}\n multiple={false}\n listsAsArrays={false}\n path={dummyPath}\n level={0}\n />\n <NumericEditor\n skipHook\n testID={testID}\n inputType=\"number\"\n title={title}\n className={valueListItemClassName}\n disabled={disabled}\n handleOnChange={handleChangeOffset}\n field={''}\n operator={''}\n value={relValue.offset}\n valueSource={'value'}\n fieldData={dummyFieldData}\n schema={numericSchema}\n path={dummyPath}\n level={0}\n rule={{ field: '', operator: '=', value: relValue.offset }}\n />\n {relValue.offset !== 0 && (\n <SelectorComponent\n schema={schema}\n testID={testID}\n title={title}\n className={valueListItemClassName}\n handleOnChange={handleChangeUnit}\n disabled={disabled}\n value={relValue.unit}\n options={units}\n multiple={false}\n listsAsArrays={false}\n path={dummyPath}\n level={0}\n />\n )}\n </React.Fragment>\n ) : (\n <DateTimeValueEditor\n {...baseProps}\n operator={absoluteOperator}\n value={value}\n handleOnChange={onChange}\n className={standardClassnames.value}\n />\n )}\n </React.Fragment>\n );\n};\n\n/**\n * Value editor with support for {@link RelativeDateTimeValue relative date/time values}\n * (e.g. \"three months ago\" or \"the beginning of this year\"). How the user switches\n * between absolute and relative modes is delegated to a pluggable\n * {@link RelativeDateTimeModeController} (default: a compact toggle), supplied via\n * {@link QueryBuilderDateTime}. In relative mode it renders anchor + signed offset + unit\n * selectors; the unit selector is hidden when the offset is `0`.\n *\n * For the `between`/`notBetween` operators it renders two independent value editors (each\n * with its own mode affordance) and stores the bounds as a two-element array, so the from\n * and to bounds can independently be absolute or relative.\n *\n * @group Components\n */\nexport const RelativeDateTimeValueEditor = (props: ValueEditorProps): React.JSX.Element => {\n const { valueListItemClassName } = useValueEditor(props);\n\n const { className, value, handleOnChange, schema, operator, separator } = props;\n const { suppressStandardClassnames } = schema;\n\n const SelectorComponent = props.selectorComponent ?? schema.controls.valueSelector;\n\n const config = useRelativeDateTimeConfig();\n\n const numericSchema = useMemo(() => ({ ...schema, parseNumbers: true }), [schema]);\n\n const outerClassname = useMemo(\n () => clsx(suppressStandardClassnames || standardClassnames.valueDateTimeRelative, className),\n [suppressStandardClassnames, className]\n );\n\n const isBetween = operator === 'between' || operator === 'notBetween';\n\n // For between/notBetween, store the bounds as a two-element array. Relative values are\n // objects (which can't survive comma-joining), so the array is emitted directly,\n // regardless of `listsAsArrays`.\n const valueAsArray = useMemo(() => toBetweenArray(value), [value]);\n\n const handleChangeBound = useCallback(\n (index: number) => (boundValue: unknown) => {\n const next = [valueAsArray[0], valueAsArray[1]];\n next[index] = boundValue;\n handleOnChange(next);\n },\n [valueAsArray, handleOnChange]\n );\n\n if (isBetween) {\n return (\n <span className={outerClassname}>\n <RelativeDateTimeSingleValueEditor\n baseProps={props}\n value={valueAsArray[0]}\n onChange={handleChangeBound(0)}\n absoluteOperator=\"=\"\n config={config}\n SelectorComponent={SelectorComponent}\n valueListItemClassName={valueListItemClassName}\n numericSchema={numericSchema}\n />\n {separator}\n <RelativeDateTimeSingleValueEditor\n baseProps={props}\n value={valueAsArray[1]}\n onChange={handleChangeBound(1)}\n absoluteOperator=\"=\"\n config={config}\n SelectorComponent={SelectorComponent}\n valueListItemClassName={valueListItemClassName}\n numericSchema={numericSchema}\n />\n </span>\n );\n }\n\n return (\n <span className={outerClassname}>\n <RelativeDateTimeSingleValueEditor\n baseProps={props}\n value={value}\n onChange={handleOnChange}\n absoluteOperator={operator}\n config={config}\n SelectorComponent={SelectorComponent}\n valueListItemClassName={valueListItemClassName}\n numericSchema={numericSchema}\n />\n </span>\n );\n};\n","import * as React from 'react';\nimport { useContext, useMemo } from 'react';\nimport type { QueryBuilderContextProvider, ValueEditorProps } from 'react-querybuilder';\nimport {\n getCompatContextProvider,\n QueryBuilderContext,\n useValueEditor,\n ValueEditor,\n} from 'react-querybuilder';\nimport {\n InheritedValueEditorContext,\n useInheritedValueEditor,\n} from './InheritedValueEditorContext';\nimport {\n RelativeDateTimeConfigContext,\n useRelativeDateTimeConfig,\n} from './RelativeDateTimeConfigContext';\nimport { RelativeDateTimeValueEditor } from './RelativeDateTimeValueEditor';\nimport type { RelativeDateTimeEditorConfig } from './types';\n\n/**\n * Whether a rule should use a date/time editor, based on either the coerced input\n * type (`date`/`datetime-local`) or a date-like `datatype` (`date`/`datetime`/`timestamp`).\n */\nconst isDateTimeEditor = (props: ValueEditorProps, inputTypeCoerced: string | undefined): boolean =>\n (props.type === 'text' &&\n (inputTypeCoerced === 'date' || inputTypeCoerced === 'datetime-local')) ||\n /^(?:date|datetime|timestamp)\\b/i.test(props.fieldData?.datatype as string);\n\nconst pad2 = (n: number): string => `${n}`.padStart(2, '0');\n\n/**\n * Formats a `Date` into the local value expected by a native `date`/`datetime-local`\n * input (library-agnostic; the date library only handles parsing/validation).\n */\nconst formatDateInputValue = (d: Date, withTime: boolean): string => {\n const datePart = `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`;\n return withTime ? `${datePart}T${pad2(d.getHours())}:${pad2(d.getMinutes())}` : datePart;\n};\n\nexport const DateTimeValueEditor = (props: ValueEditorProps): React.JSX.Element => {\n const uVE = useValueEditor(props);\n const InheritedEditor = useInheritedValueEditor();\n const { dateTimeAPI } = useRelativeDateTimeConfig();\n\n // Non-date fields and unparseable values: delegate to the inherited (compat) editor when\n // present, otherwise the default editor.\n const fallback = (p: ValueEditorProps) =>\n InheritedEditor ? <InheritedEditor {...p} /> : <ValueEditor {...p} skipHook />;\n\n if (!isDateTimeEditor(props, uVE.inputTypeCoerced)) {\n return fallback(props);\n }\n\n if (dateTimeAPI.isValid(props.value)) {\n const value = formatDateInputValue(\n dateTimeAPI.toDate(props.value),\n uVE.inputTypeCoerced !== 'date'\n );\n return fallback({ ...props, value });\n }\n\n return fallback(props);\n};\n\n/**\n * Provider value editor: renders the relative-capable {@link RelativeDateTimeValueEditor}\n * for date/time fields and falls back to the inherited (compat) editor for everything else.\n */\nconst QueryBuilderDateTimeValueEditor = (props: ValueEditorProps): React.JSX.Element => {\n const uVE = useValueEditor(props);\n const InheritedEditor = useInheritedValueEditor();\n\n if (isDateTimeEditor(props, uVE.inputTypeCoerced)) {\n return <RelativeDateTimeValueEditor {...props} />;\n }\n\n return InheritedEditor ? <InheritedEditor {...props} /> : <ValueEditor {...props} skipHook />;\n};\n\nexport const QueryBuilderDateTimeContext: QueryBuilderContextProvider = getCompatContextProvider({\n controlElements: { valueEditor: QueryBuilderDateTimeValueEditor },\n});\n\n/** Props for {@link QueryBuilderDateTime}: {@link RelativeDateTimeEditorConfig} plus children. */\nexport interface QueryBuilderDateTimeProps extends RelativeDateTimeEditorConfig {\n children?: React.ReactNode;\n}\n\n/**\n * Context provider enabling date/time features for a wrapped\n * {@link react-querybuilder!QueryBuilder QueryBuilder}: renders the relative-capable\n * {@link RelativeDateTimeValueEditor} for date/time fields, and accepts optional\n * {@link RelativeDateTimeEditorConfig} props (mode controller, anchor/unit options, and\n * toggle labels). With no props it provides the zero-config toggle experience.\n *\n * @group Components\n */\nexport const QueryBuilderDateTime = ({\n children,\n modeController,\n anchors,\n units,\n toggleLabels,\n dateTimeAPI,\n}: QueryBuilderDateTimeProps): React.JSX.Element => {\n const config = useMemo(\n (): RelativeDateTimeEditorConfig => ({\n modeController,\n anchors,\n units,\n toggleLabels,\n dateTimeAPI,\n }),\n [modeController, anchors, units, toggleLabels, dateTimeAPI]\n );\n\n // Capture the value editor inherited from any outer compat provider (e.g. QueryBuilderMaterial)\n // _before_ QueryBuilderDateTimeContext overrides it, so date/time editors can delegate to it.\n const inheritedValueEditor = (useContext(QueryBuilderContext).controlElements?.valueEditor ??\n null) as React.ComponentType<ValueEditorProps> | null;\n\n return (\n <RelativeDateTimeConfigContext.Provider value={config}>\n <InheritedValueEditorContext.Provider value={inheritedValueEditor}>\n <QueryBuilderDateTimeContext>{children}</QueryBuilderDateTimeContext>\n </InheritedValueEditorContext.Provider>\n </RelativeDateTimeConfigContext.Provider>\n );\n};\n"],"mappings":"8PAUA,MAAM,EAAmB,CACvB,KAAM,YACN,IAAK,aACL,KAAM,iBACN,IAAK,SACL,IAAK,YACL,KAAM,gBACN,QAAS,cACT,GAAI,SACJ,WAAY,iBACZ,MAAO,WACT,EAUa,GACX,EACA,IACyB,CACzB,IAAM,EAAO,GAA8C,CAAC,EAE5D,GAAI,CAACA,EAAAA,EAAmB,EAAK,SAAS,YAAa,EAAM,CAAI,EAC3D,OAAA,EAAA,EAAA,8BAAA,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EAgBY,GAAwB,CACnC,WACA,iBACA,UACA,QACA,eACA,iBACkD,CAClD,IAAM,GAAA,EAAA,EAAA,QAAA,MACiC,CACnC,iBACA,UACA,QACA,eACA,aACF,GACA,CAAC,EAAgB,EAAS,EAAO,EAAc,CAAW,CAC5D,EAIM,GAAA,EAAA,EAAA,WAAA,CAAmCC,EAAAA,mBAAmB,CAAC,CAAC,iBAAiB,aAC7E,KAEF,OACE,EAAA,cAAC,EAA8B,SAA/B,CAAwC,MAAO,CAIP,EAHtC,EAAA,cAAC,EAA4B,SAA7B,CAAsC,MAAO,CAEP,EADpC,EAAA,cAAC,EAAA,KAA6B,CAAsC,CAChC,CACA,CAE5C"}
|
|
1
|
+
{"version":3,"file":"react-querybuilder_datetime.cjs.production.js","names":["processIsDateField","resolveDatetimeOperator","isDateOnlyDatatype","isRelativeDateTimeValue","React","isRelativeDateTimeValue","defaultOperators","defaultDateTimeAPI","isRelativeDateTimeValue","React","standardClassnames","ValueEditor","ValueEditor","QueryBuilderContext"],"sources":["../../src/datetimeRuleProcessorJsonLogic.ts","../../src/InheritedValueEditorContext.ts","../../src/relativeDateTimeConstants.ts","../../src/relativeDateTimeModeControllers.tsx","../../src/RelativeDateTimeConfigContext.tsx","../../src/RelativeDateTimeValueEditor.tsx","../../src/QueryBuilderDateTime.tsx"],"sourcesContent":["import type { DefaultOperatorName, JsonLogicVar, RuleProcessor } from 'react-querybuilder';\nimport { defaultRuleProcessorJsonLogic, toArray } from 'react-querybuilder';\nimport type { RQBJsonLogicDateRelative, RQBDateTimeJsonLogic } from './types';\nimport {\n isDateOnlyDatatype,\n isRelativeDateTimeValue,\n processIsDateField,\n resolveDatetimeOperator,\n} from './utils';\n\nconst dateOperationMap = {\n '!=': 'dateNotOn',\n '<': 'dateBefore',\n '<=': 'dateOnOrBefore',\n '=': 'dateOn',\n '>': 'dateAfter',\n '>=': 'dateOnOrAfter',\n between: 'dateBetween',\n in: 'dateIn',\n notBetween: 'dateNotBetween',\n notIn: 'dateNotIn',\n} as const satisfies Partial<Record<DefaultOperatorName, string>>;\n\n/**\n * Date/time rule processor for use by {@link @react-querybuilder/core!formatQuery formatQuery}\n * with the \"jsonlogic\" format.\n *\n * Note: Unlike other date/time rule processors from this library, this function does\n * not require a date/time library API. Instead, the date/time library API is used by\n * {@link getDatetimeJsonLogicOperations} during the evaluation process.\n */\nexport const datetimeRuleProcessorJsonLogic: RuleProcessor = (\n rule,\n options\n): RQBDateTimeJsonLogic => {\n const opts = options ?? /* v8 ignore start -- @preserve */ {} /* v8 ignore stop -- @preserve */;\n\n if (!processIsDateField(opts.context?.isDateField, rule, opts)) {\n return defaultRuleProcessorJsonLogic(rule, opts);\n }\n\n const { field, value, valueSource } = rule;\n const operator = resolveDatetimeOperator(rule, opts);\n const valueIsField = valueSource === 'field';\n const fieldObject: JsonLogicVar = { var: field };\n const dateOnly = isDateOnlyDatatype(opts?.fieldData?.datatype);\n // Relative values stay \"live\": emit a `dateRelative` op resolved at evaluation time.\n // Field-source values are field names and render as `var` references.\n const renderValue = (v: unknown) => {\n if (valueIsField) return { var: `${v}` };\n if (isRelativeDateTimeValue(v)) {\n return {\n dateRelative: [v.anchor, v.offset, v.unit, dateOnly],\n } as RQBJsonLogicDateRelative;\n }\n return v as string;\n };\n\n switch (operator) {\n case '<':\n case '<=':\n case '=':\n case '!=':\n case '>':\n case '>=':\n return {\n [dateOperationMap[operator]]: [fieldObject, renderValue(value)],\n } as RQBDateTimeJsonLogic;\n\n case 'in':\n case 'notIn': {\n const valueAsArray = (Array.isArray(value) ? value : toArray(value)).map(renderValue);\n return { [dateOperationMap[operator]]: [fieldObject, valueAsArray] } as RQBDateTimeJsonLogic;\n }\n\n case 'between':\n case 'notBetween': {\n const valueAsArray = (Array.isArray(value) ? value : toArray(value)).map(renderValue);\n\n if (valueAsArray.length < 2) return false;\n\n return {\n [dateOperationMap[operator]]: [valueAsArray[0], fieldObject, valueAsArray[1]],\n } as RQBDateTimeJsonLogic;\n }\n }\n\n return defaultRuleProcessorJsonLogic(rule, options);\n};\n","import type { Context } from 'react';\nimport { createContext, useContext } from 'react';\nimport type { ValueEditorProps } from 'react-querybuilder';\n\n/**\n * Holds the value editor inherited from an outer (compat package) context provider,\n * captured _before_ {@link QueryBuilderDateTime} overrides it. Lets the date/time value\n * editor delegate non-date fields (and absolute date inputs) to the compat editor instead\n * of the bare default {@link react-querybuilder!ValueEditor ValueEditor}. `null` = none\n * inherited (fall back to default).\n */\nexport const InheritedValueEditorContext: Context<React.ComponentType<ValueEditorProps> | null> =\n createContext<React.ComponentType<ValueEditorProps> | null>(null);\n\n/** Inherited (compat) value editor, or `null` if none. See {@link InheritedValueEditorContext}. */\nexport const useInheritedValueEditor = (): React.ComponentType<ValueEditorProps> | null =>\n useContext(InheritedValueEditorContext);\n","import type { FullOption } from 'react-querybuilder';\nimport type {\n RelativeDateTimeAnchor,\n RelativeDateTimeToggleLabels,\n RelativeDateTimeUnit,\n RelativeDateTimeValue,\n} from './types';\n\n/**\n * Class name applied to the absolute/relative mode toggle button. Package-local (not part\n * of the core `standardClassnames`) to avoid coupling core to this extension.\n */\nexport const relativeDateTimeToggleClassName = 'rule-value-dateTimeRelative-toggle';\n\n/** Default value applied when switching a rule to relative mode. */\nexport const defaultRelativeDateTimeValue: RelativeDateTimeValue = {\n mode: 'relative',\n anchor: 'now',\n offset: 0,\n unit: 'day',\n};\n\n/** Default anchor (reference-point) options for the relative date/time editor. */\nexport const defaultRelativeDateTimeAnchors: FullOption<RelativeDateTimeAnchor>[] = [\n { name: 'now', value: 'now', label: 'now' },\n { name: 'startOfDay', value: 'startOfDay', label: 'start of day' },\n { name: 'endOfDay', value: 'endOfDay', label: 'end of day' },\n { name: 'startOfWeek', value: 'startOfWeek', label: 'start of week' },\n { name: 'endOfWeek', value: 'endOfWeek', label: 'end of week' },\n { name: 'startOfMonth', value: 'startOfMonth', label: 'start of month' },\n { name: 'endOfMonth', value: 'endOfMonth', label: 'end of month' },\n { name: 'startOfYear', value: 'startOfYear', label: 'start of year' },\n { name: 'endOfYear', value: 'endOfYear', label: 'end of year' },\n];\n\n/** Default unit options for the relative date/time editor. */\nexport const defaultRelativeDateTimeUnits: FullOption<RelativeDateTimeUnit>[] = [\n { name: 'minute', value: 'minute', label: 'minute(s)' },\n { name: 'hour', value: 'hour', label: 'hour(s)' },\n { name: 'day', value: 'day', label: 'day(s)' },\n { name: 'week', value: 'week', label: 'week(s)' },\n { name: 'month', value: 'month', label: 'month(s)' },\n { name: 'year', value: 'year', label: 'year(s)' },\n];\n\n/** Default labels/content for the absolute/relative mode toggle. */\nexport const defaultRelativeDateTimeToggleLabels: Required<RelativeDateTimeToggleLabels> = {\n label: 'Toggle relative date/time',\n absoluteTitle: 'Absolute date/time (click for relative)',\n relativeTitle: 'Relative date/time (click for absolute)',\n // Empty by default; the CSS pseudo-element renders the glyph based on `aria-checked`.\n absoluteContent: '',\n relativeContent: '',\n};\n","import * as React from 'react';\nimport type { FullOperator } from 'react-querybuilder';\nimport { clsx, defaultOperators } from 'react-querybuilder';\nimport { relativeDateTimeToggleClassName } from './relativeDateTimeConstants';\nimport type { RelativeDateTimeModeController, RelativeDateTimeModeControlProps } from './types';\nimport { isRelativeDateTimeValue } from './utils';\n\n/**\n * Compact absolute/relative toggle rendered by {@link toggleModeController}. A\n * `role=\"switch\"` button whose default glyph is supplied by CSS (keyed on\n * `aria-checked`); override via the `toggleLabels` config.\n *\n * @group Components\n */\nexport const RelativeDateTimeModeToggle = ({\n isRelative,\n setMode,\n disabled,\n className,\n labels,\n}: RelativeDateTimeModeControlProps): React.JSX.Element => {\n const onClick = React.useCallback(\n () => setMode(isRelative ? 'absolute' : 'relative'),\n [setMode, isRelative]\n );\n\n return (\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={isRelative}\n aria-label={labels.label}\n title={isRelative ? labels.relativeTitle : labels.absoluteTitle}\n disabled={disabled}\n className={clsx(relativeDateTimeToggleClassName, className)}\n onClick={onClick}>\n {isRelative ? labels.relativeContent : labels.absoluteContent}\n </button>\n );\n};\n\n/**\n * Zero-config default {@link RelativeDateTimeModeController}: derives the mode from the\n * value shape and renders a compact toggle button to switch between absolute and\n * relative entry.\n */\nexport const toggleModeController: RelativeDateTimeModeController = {\n isRelative: props => isRelativeDateTimeValue(props.value),\n ModeControl: RelativeDateTimeModeToggle,\n};\n\n/**\n * Builds an operator-driven {@link RelativeDateTimeModeController} that derives the mode\n * from the rule's operator. Pass the operator name(s) (or a predicate) that should put the\n * editor in relative mode. No toggle is rendered — the operator selector is the mode\n * affordance.\n *\n * NOTE: the chosen operators only signal _mode_; the rule's value remains a\n * {@link RelativeDateTimeValue}. For these operators to export correctly, map each one to a\n * real comparison operator via `context.relativeOperatorMap` when calling `formatQuery`\n * (e.g. `{ relativeEq: '=' }`). See the documentation.\n */\nexport const createOperatorModeController = (\n relativeOperators: string[] | ((operator: string) => boolean)\n): RelativeDateTimeModeController => ({\n isRelative: props =>\n typeof relativeOperators === 'function'\n ? relativeOperators(props.operator)\n : relativeOperators.includes(props.operator),\n});\n\ninterface FieldWithOperators {\n operators?: FullOperator[];\n [key: string]: unknown;\n}\n\n/**\n * Appends the given `operators` to each field's `operators` list, so the operator-driven\n * controller (see {@link createOperatorModeController}) has an operator to switch into\n * relative mode. Fields without an explicit `operators` list fall back to the core\n * `defaultOperators`.\n */\nexport const withRelativeOperators = <F extends FieldWithOperators>(\n fields: F[],\n operators: FullOperator[]\n): F[] =>\n fields.map(field => ({\n ...field,\n operators: [...(field.operators ?? (defaultOperators as FullOperator[])), ...operators],\n }));\n","import * as React from 'react';\nimport { createContext, useContext, useMemo } from 'react';\nimport type { FullOption } from 'react-querybuilder';\nimport {\n defaultRelativeDateTimeAnchors,\n defaultRelativeDateTimeToggleLabels,\n defaultRelativeDateTimeUnits,\n} from './relativeDateTimeConstants';\nimport { toggleModeController } from './relativeDateTimeModeControllers';\nimport { rqbDateTimeLibraryAPI as defaultDateTimeAPI } from './rqbDateTimeLibraryAPI.dayjs';\nimport type {\n RelativeDateTimeAnchor,\n RelativeDateTimeEditorConfig,\n RelativeDateTimeModeController,\n RelativeDateTimeToggleLabels,\n RelativeDateTimeUnit,\n RQBDateTimeLibraryAPI,\n} from './types';\n\n/** Fully-resolved relative date/time editor config (no optional fields). */\nexport interface ResolvedRelativeDateTimeConfig {\n modeController: RelativeDateTimeModeController;\n anchors: FullOption<RelativeDateTimeAnchor>[];\n units: FullOption<RelativeDateTimeUnit>[];\n toggleLabels: Required<RelativeDateTimeToggleLabels>;\n dateTimeAPI: RQBDateTimeLibraryAPI;\n}\n\n/**\n * Carries {@link RelativeDateTimeEditorConfig} to the {@link RelativeDateTimeValueEditor}.\n * Provided by {@link QueryBuilderDateTime}; defaults apply when no provider is present.\n */\nexport const RelativeDateTimeConfigContext: React.Context<RelativeDateTimeEditorConfig> =\n createContext<RelativeDateTimeEditorConfig>({});\n\n/** Reads the relative date/time editor config from context, merged with defaults. */\nexport const useRelativeDateTimeConfig = (): ResolvedRelativeDateTimeConfig => {\n const config = useContext(RelativeDateTimeConfigContext);\n return useMemo(\n () => ({\n modeController: config.modeController ?? toggleModeController,\n anchors: config.anchors ?? defaultRelativeDateTimeAnchors,\n units: config.units ?? defaultRelativeDateTimeUnits,\n toggleLabels: { ...defaultRelativeDateTimeToggleLabels, ...config.toggleLabels },\n dateTimeAPI: config.dateTimeAPI ?? defaultDateTimeAPI,\n }),\n [config]\n );\n};\n","import * as React from 'react';\nimport { useCallback, useMemo } from 'react';\nimport type { FullField, Path, ValueEditorProps, ValueSelectorProps } from 'react-querybuilder';\nimport {\n clsx,\n parseNumber,\n standardClassnames,\n toArray,\n useValueEditor,\n ValueEditor,\n} from 'react-querybuilder';\nimport { useInheritedValueEditor } from './InheritedValueEditorContext';\nimport { DateTimeValueEditor } from './QueryBuilderDateTime';\nimport type { ResolvedRelativeDateTimeConfig } from './RelativeDateTimeConfigContext';\nimport { useRelativeDateTimeConfig } from './RelativeDateTimeConfigContext';\nimport { defaultRelativeDateTimeValue } from './relativeDateTimeConstants';\nimport type { RelativeDateTimeAnchor, RelativeDateTimeUnit, RelativeDateTimeValue } from './types';\nimport { isRelativeDateTimeValue } from './utils';\n\nconst dummyPath: Path = [];\nconst dummyFieldData: FullField = { name: '', value: '', label: '' };\n\n/** Splits a value into the from/to pair used by between/notBetween, object-safe. */\nconst toBetweenArray = (value: unknown): unknown[] =>\n Array.isArray(value) ? value : isRelativeDateTimeValue(value) ? [value] : toArray(value);\n\ninterface RelativeDateTimeSingleValueEditorProps {\n /** The original value editor props (for mode derivation and absolute rendering). */\n baseProps: ValueEditorProps;\n /** The value for this slot (the whole value, or one element of a between pair). */\n value: unknown;\n /** Emits a new value for this slot. */\n onChange: (value: unknown) => void;\n /** Operator passed to the absolute editor (forced to `=` for between slots). */\n absoluteOperator: string;\n config: ResolvedRelativeDateTimeConfig;\n SelectorComponent: React.ComponentType<ValueSelectorProps>;\n /** Themed numeric offset input: the inherited (compat) editor when present, else the default. */\n NumericEditorComponent: React.ComponentType<ValueEditorProps>;\n valueListItemClassName?: string;\n numericSchema: ValueEditorProps['schema'];\n}\n\n/**\n * Renders a single absolute-or-relative date/time value: a mode affordance (per the\n * controller) plus either an absolute date input or anchor + signed offset + unit\n * selectors. Reused once per slot so between/notBetween can mix bounds (e.g. an absolute\n * \"from\" and a relative \"to\").\n */\nconst RelativeDateTimeSingleValueEditor = ({\n baseProps,\n value,\n onChange,\n absoluteOperator,\n config,\n SelectorComponent,\n NumericEditorComponent,\n valueListItemClassName,\n numericSchema,\n}: RelativeDateTimeSingleValueEditorProps): React.JSX.Element => {\n const { schema, disabled, title, testID } = baseProps;\n const { modeController, anchors, units, toggleLabels } = config;\n\n const isRelative = modeController.isRelative({ ...baseProps, value });\n const relValue: RelativeDateTimeValue = isRelativeDateTimeValue(value)\n ? value\n : defaultRelativeDateTimeValue;\n\n const handleSetMode = useCallback(\n (mode: 'absolute' | 'relative') =>\n onChange(mode === 'relative' ? defaultRelativeDateTimeValue : ''),\n [onChange]\n );\n\n const handleChangeAnchor = useCallback(\n (anchor: string) => onChange({ ...relValue, anchor: anchor as RelativeDateTimeAnchor }),\n [onChange, relValue]\n );\n\n const handleChangeOffset = useCallback(\n (offset: unknown) =>\n onChange({\n ...relValue,\n offset: (parseNumber(offset, { parseNumbers: true }) as number) || 0,\n }),\n [onChange, relValue]\n );\n\n const handleChangeUnit = useCallback(\n (unit: string) => onChange({ ...relValue, unit: unit as RelativeDateTimeUnit }),\n [onChange, relValue]\n );\n\n const { ModeControl } = modeController;\n\n return (\n <React.Fragment>\n {ModeControl && (\n <ModeControl\n isRelative={isRelative}\n setMode={handleSetMode}\n schema={schema}\n disabled={disabled}\n className={valueListItemClassName}\n title={title}\n testID={testID}\n labels={toggleLabels}\n />\n )}\n {isRelative ? (\n <React.Fragment>\n <SelectorComponent\n schema={schema}\n testID={testID}\n title={title}\n className={valueListItemClassName}\n handleOnChange={handleChangeAnchor}\n disabled={disabled}\n value={relValue.anchor}\n options={anchors}\n multiple={false}\n listsAsArrays={false}\n path={dummyPath}\n level={0}\n />\n <NumericEditorComponent\n skipHook\n testID={testID}\n inputType=\"number\"\n title={title}\n className={valueListItemClassName}\n disabled={disabled}\n handleOnChange={handleChangeOffset}\n field={''}\n operator={''}\n value={relValue.offset}\n valueSource={'value'}\n fieldData={dummyFieldData}\n schema={numericSchema}\n path={dummyPath}\n level={0}\n rule={{ field: '', operator: '=', value: relValue.offset }}\n />\n {relValue.offset !== 0 && (\n <SelectorComponent\n schema={schema}\n testID={testID}\n title={title}\n className={valueListItemClassName}\n handleOnChange={handleChangeUnit}\n disabled={disabled}\n value={relValue.unit}\n options={units}\n multiple={false}\n listsAsArrays={false}\n path={dummyPath}\n level={0}\n />\n )}\n </React.Fragment>\n ) : (\n <DateTimeValueEditor\n {...baseProps}\n operator={absoluteOperator}\n value={value}\n handleOnChange={onChange}\n className={standardClassnames.value}\n />\n )}\n </React.Fragment>\n );\n};\n\n/**\n * Value editor with support for {@link RelativeDateTimeValue relative date/time values}\n * (e.g. \"three months ago\" or \"the beginning of this year\"). How the user switches\n * between absolute and relative modes is delegated to a pluggable\n * {@link RelativeDateTimeModeController} (default: a compact toggle), supplied via\n * {@link QueryBuilderDateTime}. In relative mode it renders anchor + signed offset + unit\n * selectors; the unit selector is hidden when the offset is `0`.\n *\n * For the `between`/`notBetween` operators it renders two independent value editors (each\n * with its own mode affordance) and stores the bounds as a two-element array, so the from\n * and to bounds can independently be absolute or relative.\n *\n * @group Components\n */\nexport const RelativeDateTimeValueEditor = (props: ValueEditorProps): React.JSX.Element => {\n const { valueListItemClassName } = useValueEditor(props);\n\n const { className, value, handleOnChange, schema, operator, separator } = props;\n const { suppressStandardClassnames } = schema;\n\n const SelectorComponent = props.selectorComponent ?? schema.controls.valueSelector;\n\n // Themed numeric offset input from the inherited (compat) editor when present, else default.\n const NumericEditorComponent = useInheritedValueEditor() ?? ValueEditor;\n\n const config = useRelativeDateTimeConfig();\n\n const numericSchema = useMemo(() => ({ ...schema, parseNumbers: true }), [schema]);\n\n const outerClassname = useMemo(\n () => clsx(suppressStandardClassnames || standardClassnames.valueDateTimeRelative, className),\n [suppressStandardClassnames, className]\n );\n\n const isBetween = operator === 'between' || operator === 'notBetween';\n\n // For between/notBetween, store the bounds as a two-element array. Relative values are\n // objects (which can't survive comma-joining), so the array is emitted directly,\n // regardless of `listsAsArrays`.\n const valueAsArray = useMemo(() => toBetweenArray(value), [value]);\n\n const handleChangeBound = useCallback(\n (index: number) => (boundValue: unknown) => {\n const next = [valueAsArray[0], valueAsArray[1]];\n next[index] = boundValue;\n handleOnChange(next);\n },\n [valueAsArray, handleOnChange]\n );\n\n if (isBetween) {\n return (\n <span className={outerClassname}>\n <RelativeDateTimeSingleValueEditor\n baseProps={props}\n value={valueAsArray[0]}\n onChange={handleChangeBound(0)}\n absoluteOperator=\"=\"\n config={config}\n SelectorComponent={SelectorComponent}\n NumericEditorComponent={NumericEditorComponent}\n valueListItemClassName={valueListItemClassName}\n numericSchema={numericSchema}\n />\n {separator}\n <RelativeDateTimeSingleValueEditor\n baseProps={props}\n value={valueAsArray[1]}\n onChange={handleChangeBound(1)}\n absoluteOperator=\"=\"\n config={config}\n SelectorComponent={SelectorComponent}\n NumericEditorComponent={NumericEditorComponent}\n valueListItemClassName={valueListItemClassName}\n numericSchema={numericSchema}\n />\n </span>\n );\n }\n\n return (\n <span className={outerClassname}>\n <RelativeDateTimeSingleValueEditor\n baseProps={props}\n value={value}\n onChange={handleOnChange}\n absoluteOperator={operator}\n config={config}\n SelectorComponent={SelectorComponent}\n NumericEditorComponent={NumericEditorComponent}\n valueListItemClassName={valueListItemClassName}\n numericSchema={numericSchema}\n />\n </span>\n );\n};\n","import * as React from 'react';\nimport { useContext, useMemo } from 'react';\nimport type { QueryBuilderContextProvider, ValueEditorProps } from 'react-querybuilder';\nimport {\n getCompatContextProvider,\n QueryBuilderContext,\n useValueEditor,\n ValueEditor,\n} from 'react-querybuilder';\nimport {\n InheritedValueEditorContext,\n useInheritedValueEditor,\n} from './InheritedValueEditorContext';\nimport {\n RelativeDateTimeConfigContext,\n useRelativeDateTimeConfig,\n} from './RelativeDateTimeConfigContext';\nimport { RelativeDateTimeValueEditor } from './RelativeDateTimeValueEditor';\nimport type { RelativeDateTimeEditorConfig } from './types';\n\n/**\n * Whether a rule should use a date/time editor, based on either the coerced input\n * type (`date`/`datetime-local`) or a date-like `datatype` (`date`/`datetime`/`timestamp`).\n */\nconst isDateTimeEditor = (props: ValueEditorProps, inputTypeCoerced: string | undefined): boolean =>\n (props.type === 'text' &&\n (inputTypeCoerced === 'date' || inputTypeCoerced === 'datetime-local')) ||\n /^(?:date|datetime|timestamp)\\b/i.test(props.fieldData?.datatype as string);\n\nconst pad2 = (n: number): string => `${n}`.padStart(2, '0');\n\n/**\n * Formats a `Date` into the local value expected by a native `date`/`datetime-local`\n * input (library-agnostic; the date library only handles parsing/validation).\n */\nconst formatDateInputValue = (d: Date, withTime: boolean): string => {\n const datePart = `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`;\n return withTime ? `${datePart}T${pad2(d.getHours())}:${pad2(d.getMinutes())}` : datePart;\n};\n\n/**\n * Renders the inherited (compat) editor when one is provided, otherwise the default\n * {@link react-querybuilder!ValueEditor ValueEditor}. The editor is received as a prop (rather\n * than read from context here) so the JSX element type stays prop-sourced and stable.\n */\nconst FallbackValueEditor = ({\n editor: Editor,\n ...props\n}: ValueEditorProps & {\n editor: React.ComponentType<ValueEditorProps> | null;\n}): React.JSX.Element => (Editor ? <Editor {...props} /> : <ValueEditor {...props} skipHook />);\n\nexport const DateTimeValueEditor = (props: ValueEditorProps): React.JSX.Element => {\n const uVE = useValueEditor(props);\n const InheritedEditor = useInheritedValueEditor();\n const { dateTimeAPI } = useRelativeDateTimeConfig();\n\n // Non-date fields and unparseable values: delegate to the inherited (compat) editor when\n // present, otherwise the default editor.\n const fallback = (p: ValueEditorProps) => <FallbackValueEditor editor={InheritedEditor} {...p} />;\n\n if (!isDateTimeEditor(props, uVE.inputTypeCoerced)) {\n return fallback(props);\n }\n\n if (dateTimeAPI.isValid(props.value)) {\n const value = formatDateInputValue(\n dateTimeAPI.toDate(props.value),\n uVE.inputTypeCoerced !== 'date'\n );\n return fallback({ ...props, value });\n }\n\n return fallback(props);\n};\n\n/**\n * Provider value editor: renders the relative-capable {@link RelativeDateTimeValueEditor}\n * for date/time fields and falls back to the inherited (compat) editor for everything else.\n */\nconst QueryBuilderDateTimeValueEditor = (props: ValueEditorProps): React.JSX.Element => {\n const uVE = useValueEditor(props);\n const InheritedEditor = useInheritedValueEditor();\n\n if (isDateTimeEditor(props, uVE.inputTypeCoerced)) {\n return <RelativeDateTimeValueEditor {...props} />;\n }\n\n return <FallbackValueEditor editor={InheritedEditor} {...props} />;\n};\n\nexport const QueryBuilderDateTimeContext: QueryBuilderContextProvider = getCompatContextProvider({\n controlElements: { valueEditor: QueryBuilderDateTimeValueEditor },\n});\n\n/** Props for {@link QueryBuilderDateTime}: {@link RelativeDateTimeEditorConfig} plus children. */\nexport interface QueryBuilderDateTimeProps extends RelativeDateTimeEditorConfig {\n children?: React.ReactNode;\n}\n\n/**\n * Context provider enabling date/time features for a wrapped\n * {@link react-querybuilder!QueryBuilder QueryBuilder}: renders the relative-capable\n * {@link RelativeDateTimeValueEditor} for date/time fields, and accepts optional\n * {@link RelativeDateTimeEditorConfig} props (mode controller, anchor/unit options, and\n * toggle labels). With no props it provides the zero-config toggle experience.\n *\n * @group Components\n */\nexport const QueryBuilderDateTime = ({\n children,\n modeController,\n anchors,\n units,\n toggleLabels,\n dateTimeAPI,\n}: QueryBuilderDateTimeProps): React.JSX.Element => {\n const config = useMemo(\n (): RelativeDateTimeEditorConfig => ({\n modeController,\n anchors,\n units,\n toggleLabels,\n dateTimeAPI,\n }),\n [modeController, anchors, units, toggleLabels, dateTimeAPI]\n );\n\n // Capture the value editor inherited from any outer compat provider (e.g. QueryBuilderMaterial)\n // _before_ QueryBuilderDateTimeContext overrides it, so date/time editors can delegate to it.\n const inheritedValueEditor = (useContext(QueryBuilderContext).controlElements?.valueEditor ??\n null) as React.ComponentType<ValueEditorProps> | null;\n\n return (\n <RelativeDateTimeConfigContext.Provider value={config}>\n <InheritedValueEditorContext.Provider value={inheritedValueEditor}>\n <QueryBuilderDateTimeContext>{children}</QueryBuilderDateTimeContext>\n </InheritedValueEditorContext.Provider>\n </RelativeDateTimeConfigContext.Provider>\n );\n};\n"],"mappings":"8PAUA,MAAM,EAAmB,CACvB,KAAM,YACN,IAAK,aACL,KAAM,iBACN,IAAK,SACL,IAAK,YACL,KAAM,gBACN,QAAS,cACT,GAAI,SACJ,WAAY,iBACZ,MAAO,WACT,EAUa,GACX,EACA,IACyB,CACzB,IAAM,EAAO,GAA8C,CAAC,EAE5D,GAAI,CAACA,EAAAA,EAAmB,EAAK,SAAS,YAAa,EAAM,CAAI,EAC3D,OAAA,EAAA,EAAA,8BAAA,CAAqC,EAAM,CAAI,EAGjD,GAAM,CAAE,QAAO,QAAO,eAAgB,EAChC,EAAWC,EA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,CAClE,CAAC,EAgBY,GAAwB,CACnC,WACA,iBACA,UACA,QACA,eACA,iBACkD,CAClD,IAAM,GAAA,EAAA,EAAA,QAAA,MACiC,CACnC,iBACA,UACA,QACA,eACA,aACF,GACA,CAAC,EAAgB,EAAS,EAAO,EAAc,CAAW,CAC5D,EAIM,GAAA,EAAA,EAAA,WAAA,CAAmCC,EAAAA,mBAAmB,CAAC,CAAC,iBAAiB,aAC7E,KAEF,OACE,EAAA,cAAC,EAA8B,SAA/B,CAAwC,MAAO,CAIP,EAHtC,EAAA,cAAC,EAA4B,SAA7B,CAAsC,MAAO,CAEP,EADpC,EAAA,cAAC,EAAA,KAA6B,CAAsC,CAChC,CACA,CAE5C"}
|
|
@@ -240,7 +240,7 @@ const getDatetimeRuleProcessorCypher = (apiFns) => (rule, options) => {
|
|
|
240
240
|
}
|
|
241
241
|
};
|
|
242
242
|
//#endregion
|
|
243
|
-
//#region \0@oxc-project+runtime@0.
|
|
243
|
+
//#region \0@oxc-project+runtime@0.135.0/helpers/esm/typeof.js
|
|
244
244
|
function _typeof(o) {
|
|
245
245
|
"@babel/helpers - typeof";
|
|
246
246
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -250,7 +250,7 @@ function _typeof(o) {
|
|
|
250
250
|
}, _typeof(o);
|
|
251
251
|
}
|
|
252
252
|
//#endregion
|
|
253
|
-
//#region \0@oxc-project+runtime@0.
|
|
253
|
+
//#region \0@oxc-project+runtime@0.135.0/helpers/esm/toPrimitive.js
|
|
254
254
|
function toPrimitive(t, r) {
|
|
255
255
|
if ("object" != _typeof(t) || !t) return t;
|
|
256
256
|
var e = t[Symbol.toPrimitive];
|
|
@@ -262,13 +262,13 @@ function toPrimitive(t, r) {
|
|
|
262
262
|
return ("string" === r ? String : Number)(t);
|
|
263
263
|
}
|
|
264
264
|
//#endregion
|
|
265
|
-
//#region \0@oxc-project+runtime@0.
|
|
265
|
+
//#region \0@oxc-project+runtime@0.135.0/helpers/esm/toPropertyKey.js
|
|
266
266
|
function toPropertyKey(t) {
|
|
267
267
|
var i = toPrimitive(t, "string");
|
|
268
268
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
269
269
|
}
|
|
270
270
|
//#endregion
|
|
271
|
-
//#region \0@oxc-project+runtime@0.
|
|
271
|
+
//#region \0@oxc-project+runtime@0.135.0/helpers/esm/defineProperty.js
|
|
272
272
|
function _defineProperty(e, r, t) {
|
|
273
273
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
274
274
|
value: t,
|
|
@@ -278,7 +278,7 @@ function _defineProperty(e, r, t) {
|
|
|
278
278
|
}) : e[r] = t, e;
|
|
279
279
|
}
|
|
280
280
|
//#endregion
|
|
281
|
-
//#region \0@oxc-project+runtime@0.
|
|
281
|
+
//#region \0@oxc-project+runtime@0.135.0/helpers/esm/objectSpread2.js
|
|
282
282
|
function ownKeys(e, r) {
|
|
283
283
|
var t = Object.keys(e);
|
|
284
284
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -1032,4 +1032,4 @@ const getDatetimeRuleProcessorTanStackDB = (apiFns) => (rule, options) => {
|
|
|
1032
1032
|
//#endregion
|
|
1033
1033
|
export { processIsDateField as A, _objectSpread2 as C, isDateOnlyDatatype as D, getDatetimeJsonLogicOperations as E, isISOStringDateOnly as O, getDatetimeRuleProcessorDrizzle as S, getDatetimeRuleProcessorCEL as T, getDatetimeRuleProcessorMongoDBQuery as _, getDatetimeValueProcessorMySQL as a, getDatetimeRuleProcessorGremlin as b, getDatetimeRuleProcessorSpEL as c, getDatetimeRuleProcessorPrisma as d, getDatetimeRuleProcessorParameterized as f, getDatetimeRuleProcessorMongoDB as g, getDatetimeRuleProcessorNL as h, getDatetimeValueProcessorMSSQL as i, resolveDatetimeOperator as j, isRelativeDateTimeValue as k, getDatetimeRuleProcessorSPARQL as l, defaultDateTimeNLOperatorMap as m, getDatetimeRuleProcessorSQL as n, getDatetimeValueProcessorOracle as o, datetimeValueProcessorNL as p, getDatetimeValueProcessorANSI as r, getDatetimeValueProcessorPostgreSQL as s, getDatetimeRuleProcessorTanStackDB as t, getDatetimeRuleProcessorSequelize as u, getDatetimeRuleProcessorLDAP as v, getDatetimeRuleProcessorCypher as w, getDatetimeRuleProcessorElasticSearch as x, getDatetimeRuleProcessorJSONata as y };
|
|
1034
1034
|
|
|
1035
|
-
//# sourceMappingURL=getDatetimeRuleProcessorTanStackDB-
|
|
1035
|
+
//# sourceMappingURL=getDatetimeRuleProcessorTanStackDB-BL8mbdbl.js.map
|