@react-querybuilder/datetime 8.20.2 → 8.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{getDatetimeRuleProcessorTanStackDB-cmGqMT0Q.js → getDatetimeRuleProcessorTanStackDB-CDEB9coD.js} +22 -19
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-CDEB9coD.js.map +1 -0
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-X6tZv7yV.js +2 -0
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-X6tZv7yV.js.map +1 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.development.d.ts +122 -138
- package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.d.ts +49 -50
- package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.js +2 -2
- package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.d.ts +49 -50
- package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.js +2 -2
- package/dist/cjs/react-querybuilder_datetime.cjs.development.js +3 -2
- package/dist/cjs/react-querybuilder_datetime.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.d.ts +52 -53
- package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.js +2 -2
- package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.d.ts +49 -50
- package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.js +2 -2
- package/dist/cjs/react-querybuilder_datetime.cjs.development.ui.d.ts +100 -114
- package/dist/cjs/react-querybuilder_datetime.cjs.development.ui.js +5 -3
- package/dist/cjs/react-querybuilder_datetime.cjs.development.ui.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.d.ts +122 -138
- package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.d.ts +49 -50
- package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.js +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.dayjs.d.ts +49 -50
- package/dist/cjs/react-querybuilder_datetime.cjs.production.dayjs.js +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.js +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.jsdate.d.ts +52 -53
- package/dist/cjs/react-querybuilder_datetime.cjs.production.jsdate.js +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.d.ts +49 -50
- package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.js +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.ui.d.ts +100 -114
- package/dist/cjs/react-querybuilder_datetime.cjs.production.ui.js +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.ui.js.map +1 -1
- package/dist/cjs/{rqbDateTimeLibraryAPI.jsdate-ioz2B1zh.js → rqbDateTimeLibraryAPI.jsdate-BuSiVdk7.js} +2 -2
- package/dist/cjs/{rqbDateTimeLibraryAPI.jsdate-ioz2B1zh.js.map → rqbDateTimeLibraryAPI.jsdate-BuSiVdk7.js.map} +1 -1
- package/dist/cjs/{rqbDateTimeLibraryAPI.jsdate-BPEcMhhr.js → rqbDateTimeLibraryAPI.jsdate-C3jJb6ip.js} +2 -2
- package/dist/cjs/{rqbDateTimeLibraryAPI.jsdate-BPEcMhhr.js.map → rqbDateTimeLibraryAPI.jsdate-C3jJb6ip.js.map} +1 -1
- package/dist/cjs/{types-Di8kFIXV.d.ts → types-BKA1aoY6.d.ts} +82 -73
- package/dist/cjs/utils-DdBYGWHZ.js +2 -0
- package/dist/cjs/utils-DdBYGWHZ.js.map +1 -0
- package/dist/cjs/{utils-DUePrC--.js → utils-_X97pUtk.js} +13 -1
- package/dist/cjs/utils-_X97pUtk.js.map +1 -0
- package/dist/getDatetimeRuleProcessorTanStackDB-6K1DsuEV.mjs +2 -0
- package/dist/getDatetimeRuleProcessorTanStackDB-6K1DsuEV.mjs.map +1 -0
- package/dist/{getDatetimeRuleProcessorTanStackDB-BDFJlfJh.js → getDatetimeRuleProcessorTanStackDB-BrSD2e9G.js} +22 -19
- package/dist/getDatetimeRuleProcessorTanStackDB-BrSD2e9G.js.map +1 -0
- package/dist/{getDatetimeRuleProcessorTanStackDB-B93XaPdB.mjs → getDatetimeRuleProcessorTanStackDB-DR8aYrUa.mjs} +22 -19
- package/dist/getDatetimeRuleProcessorTanStackDB-DR8aYrUa.mjs.map +1 -0
- package/dist/{objectSpread2-73AKOozq.js → objectSpread2-MqoZ2hSz.js} +13 -7
- package/dist/objectSpread2-MqoZ2hSz.js.map +1 -0
- package/dist/react-querybuilder_datetime.d.mts +122 -138
- package/dist/react-querybuilder_datetime.date-fns.d.mts +49 -50
- package/dist/react-querybuilder_datetime.date-fns.mjs +2 -2
- package/dist/react-querybuilder_datetime.dayjs.d.mts +49 -50
- package/dist/react-querybuilder_datetime.dayjs.mjs +2 -2
- package/dist/react-querybuilder_datetime.jsdate.d.mts +52 -53
- package/dist/react-querybuilder_datetime.jsdate.mjs +2 -2
- package/dist/react-querybuilder_datetime.legacy-esm.d.ts +122 -138
- package/dist/react-querybuilder_datetime.legacy-esm.date-fns.d.ts +49 -50
- package/dist/react-querybuilder_datetime.legacy-esm.date-fns.js +2 -2
- package/dist/react-querybuilder_datetime.legacy-esm.dayjs.d.ts +49 -50
- package/dist/react-querybuilder_datetime.legacy-esm.dayjs.js +2 -2
- package/dist/react-querybuilder_datetime.legacy-esm.js +3 -2
- package/dist/react-querybuilder_datetime.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.jsdate.d.ts +52 -53
- package/dist/react-querybuilder_datetime.legacy-esm.jsdate.js +2 -2
- package/dist/react-querybuilder_datetime.legacy-esm.luxon.d.ts +49 -50
- package/dist/react-querybuilder_datetime.legacy-esm.luxon.js +2 -2
- package/dist/react-querybuilder_datetime.legacy-esm.ui.d.ts +100 -114
- package/dist/react-querybuilder_datetime.legacy-esm.ui.js +7 -5
- package/dist/react-querybuilder_datetime.legacy-esm.ui.js.map +1 -1
- package/dist/react-querybuilder_datetime.luxon.d.mts +49 -50
- package/dist/react-querybuilder_datetime.luxon.mjs +2 -2
- package/dist/react-querybuilder_datetime.mjs +3 -2
- package/dist/react-querybuilder_datetime.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.production.d.mts +122 -138
- package/dist/react-querybuilder_datetime.production.date-fns.d.mts +49 -50
- package/dist/react-querybuilder_datetime.production.date-fns.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.dayjs.d.mts +49 -50
- package/dist/react-querybuilder_datetime.production.dayjs.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.jsdate.d.mts +52 -53
- package/dist/react-querybuilder_datetime.production.jsdate.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.luxon.d.mts +49 -50
- package/dist/react-querybuilder_datetime.production.luxon.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.production.ui.d.mts +100 -114
- package/dist/react-querybuilder_datetime.production.ui.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.ui.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.ui.d.mts +100 -114
- package/dist/react-querybuilder_datetime.ui.mjs +5 -3
- package/dist/react-querybuilder_datetime.ui.mjs.map +1 -1
- package/dist/{rqbDateTimeLibraryAPI.jsdate-CpGoQAje.js → rqbDateTimeLibraryAPI.jsdate-COp9qTw_.js} +2 -2
- package/dist/{rqbDateTimeLibraryAPI.jsdate-CpGoQAje.js.map → rqbDateTimeLibraryAPI.jsdate-COp9qTw_.js.map} +1 -1
- package/dist/{rqbDateTimeLibraryAPI.jsdate-CDOtydFq.mjs → rqbDateTimeLibraryAPI.jsdate-DxBmxW2C.mjs} +2 -2
- package/dist/{rqbDateTimeLibraryAPI.jsdate-CDOtydFq.mjs.map → rqbDateTimeLibraryAPI.jsdate-DxBmxW2C.mjs.map} +1 -1
- package/dist/{rqbDateTimeLibraryAPI.jsdate-D66yJ1hK.mjs → rqbDateTimeLibraryAPI.jsdate-WHnzblie.mjs} +2 -2
- package/dist/{rqbDateTimeLibraryAPI.jsdate-D66yJ1hK.mjs.map → rqbDateTimeLibraryAPI.jsdate-WHnzblie.mjs.map} +1 -1
- package/dist/{types-Di8kFIXV.d.mts → types-BKA1aoY6.d.mts} +82 -73
- package/dist/{types-Di8kFIXV.d.ts → types-BKA1aoY6.d.ts} +82 -73
- package/dist/{utils-BC2SALFm.mjs → utils-BAgUBdyf.mjs} +8 -2
- package/dist/utils-BAgUBdyf.mjs.map +1 -0
- package/dist/utils-DA8aluCt.mjs +2 -0
- package/dist/utils-DA8aluCt.mjs.map +1 -0
- package/package.json +16 -16
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-BVNfYaIj.js +0 -2
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-BVNfYaIj.js.map +0 -1
- package/dist/cjs/getDatetimeRuleProcessorTanStackDB-cmGqMT0Q.js.map +0 -1
- package/dist/cjs/utils-DUePrC--.js.map +0 -1
- package/dist/cjs/utils-jkW5R1AA.js +0 -2
- package/dist/cjs/utils-jkW5R1AA.js.map +0 -1
- package/dist/getDatetimeRuleProcessorTanStackDB-B93XaPdB.mjs.map +0 -1
- package/dist/getDatetimeRuleProcessorTanStackDB-BDFJlfJh.js.map +0 -1
- package/dist/getDatetimeRuleProcessorTanStackDB-Czg9Fbb8.mjs +0 -2
- package/dist/getDatetimeRuleProcessorTanStackDB-Czg9Fbb8.mjs.map +0 -1
- package/dist/objectSpread2-73AKOozq.js.map +0 -1
- package/dist/utils-BC2SALFm.mjs.map +0 -1
- package/dist/utils-VKS8YY2D.mjs +0 -2
- package/dist/utils-VKS8YY2D.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-querybuilder_datetime.cjs.development.ui.js","names":["React","isRelativeDateTimeValue","defaultOperators","defaultDateTimeAPI","isRelativeDateTimeValue","React","standardClassnames","ValueEditor","ValueEditor","QueryBuilderContext"],"sources":["../../src/ui/InheritedValueEditorContext.ts","../../src/ui/relativeDateTimeConstants.ts","../../src/ui/relativeDateTimeModeControllers.tsx","../../src/ui/RelativeDateTimeConfigContext.tsx","../../src/ui/RelativeDateTimeValueEditor.tsx","../../src/ui/QueryBuilderDateTime.tsx"],"sourcesContent":["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/core';\nimport type { RelativeDateTimeAnchor, RelativeDateTimeUnit, RelativeDateTimeValue } from '../types';\nimport type { RelativeDateTimeToggleLabels } 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 { isRelativeDateTimeValue } from '../utils';\nimport { relativeDateTimeToggleClassName } from './relativeDateTimeConstants';\nimport type { RelativeDateTimeModeController, RelativeDateTimeModeControlProps } from './types';\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 { rqbDateTimeLibraryAPI as defaultDateTimeAPI } from '../rqbDateTimeLibraryAPI.jsdate';\nimport type { RelativeDateTimeAnchor, RelativeDateTimeUnit, RQBDateTimeLibraryAPI } from '../types';\nimport {\n defaultRelativeDateTimeAnchors,\n defaultRelativeDateTimeToggleLabels,\n defaultRelativeDateTimeUnits,\n} from './relativeDateTimeConstants';\nimport { toggleModeController } from './relativeDateTimeModeControllers';\nimport type {\n RelativeDateTimeEditorConfig,\n RelativeDateTimeModeController,\n RelativeDateTimeToggleLabels,\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 type { RelativeDateTimeAnchor, RelativeDateTimeUnit, RelativeDateTimeValue } from '../types';\nimport { isRelativeDateTimeValue } from '../utils';\nimport { useInheritedValueEditor } from './InheritedValueEditorContext';\nimport { DateTimeValueEditor } from './QueryBuilderDateTime';\nimport type { ResolvedRelativeDateTimeConfig } from './RelativeDateTimeConfigContext';\nimport { useRelativeDateTimeConfig } from './RelativeDateTimeConfigContext';\nimport { defaultRelativeDateTimeValue } from './relativeDateTimeConstants';\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":";;;;;;;;;;;;;;;AAWA,MAAa,+BAAA,GAAA,MAAA,cAAA,CACiD,IAAI;;AAGlE,MAAa,iCAAA,GAAA,MAAA,WAAA,CACA,2BAA2B;;;;;;;ACRxC,MAAa,kCAAk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.js","names":["React","isRelativeDateTimeValue","defaultOperators","defaultDateTimeAPI","isRelativeDateTimeValue","React","standardClassnames","ValueEditor","isNonDateValueSource","ValueEditor","QueryBuilderContext"],"sources":["../../src/ui/InheritedValueEditorContext.ts","../../src/ui/relativeDateTimeConstants.ts","../../src/ui/relativeDateTimeModeControllers.tsx","../../src/ui/RelativeDateTimeConfigContext.tsx","../../src/ui/RelativeDateTimeValueEditor.tsx","../../src/ui/QueryBuilderDateTime.tsx"],"sourcesContent":["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/core';\nimport type { RelativeDateTimeAnchor, RelativeDateTimeUnit, RelativeDateTimeValue } from '../types';\nimport type { RelativeDateTimeToggleLabels } 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 { isRelativeDateTimeValue } from '../utils';\nimport { relativeDateTimeToggleClassName } from './relativeDateTimeConstants';\nimport type { RelativeDateTimeModeController, RelativeDateTimeModeControlProps } from './types';\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 { rqbDateTimeLibraryAPI as defaultDateTimeAPI } from '../rqbDateTimeLibraryAPI.jsdate';\nimport type { RelativeDateTimeAnchor, RelativeDateTimeUnit, RQBDateTimeLibraryAPI } from '../types';\nimport {\n defaultRelativeDateTimeAnchors,\n defaultRelativeDateTimeToggleLabels,\n defaultRelativeDateTimeUnits,\n} from './relativeDateTimeConstants';\nimport { toggleModeController } from './relativeDateTimeModeControllers';\nimport type {\n RelativeDateTimeEditorConfig,\n RelativeDateTimeModeController,\n RelativeDateTimeToggleLabels,\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 type { RelativeDateTimeAnchor, RelativeDateTimeUnit, RelativeDateTimeValue } from '../types';\nimport { isRelativeDateTimeValue } from '../utils';\nimport { useInheritedValueEditor } from './InheritedValueEditorContext';\nimport { DateTimeValueEditor } from './QueryBuilderDateTime';\nimport type { ResolvedRelativeDateTimeConfig } from './RelativeDateTimeConfigContext';\nimport { useRelativeDateTimeConfig } from './RelativeDateTimeConfigContext';\nimport { defaultRelativeDateTimeValue } from './relativeDateTimeConstants';\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 { isNonDateValueSource } from '../utils';\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 * Non-`value` sources (`field`/`parameter`) are excluded so they render the standard\n * field/parameter selector instead of the date UI.\n */\nconst isDateTimeEditor = (props: ValueEditorProps, inputTypeCoerced: string | undefined): boolean =>\n !isNonDateValueSource(props.valueSource) &&\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 </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C7E;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,219 +1,203 @@
|
|
|
1
|
-
import { _ as RelativeDateTimeAnchor, a as RQBJsonLogicDateAfter, b as RelativeDateTimeValue, c as RQBJsonLogicDateIn, d as RQBJsonLogicDateNotOn, f as RQBJsonLogicDateOn, g as RQBJsonLogicDateTimeOperations, h as RQBJsonLogicDateRelative, i as RQBDateTimeLibraryAPI, l as RQBJsonLogicDateNotBetween, m as RQBJsonLogicDateOnOrBefore, n as IsDateFieldFunction, o as RQBJsonLogicDateBefore, p as RQBJsonLogicDateOnOrAfter, r as RQBDateTimeJsonLogic, s as RQBJsonLogicDateBetween, t as IsDateField, u as RQBJsonLogicDateNotIn, v as RelativeDateTimeTruncationUnit, y as RelativeDateTimeUnit } from "./types-
|
|
1
|
+
import { _ as RelativeDateTimeAnchor, a as RQBJsonLogicDateAfter, b as RelativeDateTimeValue, c as RQBJsonLogicDateIn, d as RQBJsonLogicDateNotOn, f as RQBJsonLogicDateOn, g as RQBJsonLogicDateTimeOperations, h as RQBJsonLogicDateRelative, i as RQBDateTimeLibraryAPI, l as RQBJsonLogicDateNotBetween, m as RQBJsonLogicDateOnOrBefore, n as IsDateFieldFunction, o as RQBJsonLogicDateBefore, p as RQBJsonLogicDateOnOrAfter, r as RQBDateTimeJsonLogic, s as RQBJsonLogicDateBetween, t as IsDateField, u as RQBJsonLogicDateNotIn, v as RelativeDateTimeTruncationUnit, y as RelativeDateTimeUnit } from "./types-BKA1aoY6.js";
|
|
2
2
|
import { ExportOperatorMap, RuleProcessor, ValueProcessorByRule } from "@react-querybuilder/core";
|
|
3
|
-
|
|
4
3
|
//#region src/datetimeRuleProcessorJsonLogic.d.ts
|
|
5
4
|
/**
|
|
6
|
-
* Date/time rule processor for use by {@link @react-querybuilder/core!formatQuery formatQuery}
|
|
7
|
-
* with the "jsonlogic" format.
|
|
8
|
-
*
|
|
9
|
-
* Note: Unlike other date/time rule processors from this library, this function does
|
|
10
|
-
* not require a date/time library API. Instead, the date/time library API is used by
|
|
11
|
-
* {@link getDatetimeJsonLogicOperations} during the evaluation process.
|
|
12
|
-
*/
|
|
5
|
+
* Date/time rule processor for use by {@link @react-querybuilder/core!formatQuery formatQuery}
|
|
6
|
+
* with the "jsonlogic" format.
|
|
7
|
+
*
|
|
8
|
+
* Note: Unlike other date/time rule processors from this library, this function does
|
|
9
|
+
* not require a date/time library API. Instead, the date/time library API is used by
|
|
10
|
+
* {@link getDatetimeJsonLogicOperations} during the evaluation process.
|
|
11
|
+
*/
|
|
13
12
|
declare const datetimeRuleProcessorJsonLogic: RuleProcessor;
|
|
14
13
|
//#endregion
|
|
15
14
|
//#region src/getDatetimeJsonLogicOperations.d.ts
|
|
16
15
|
/**
|
|
17
|
-
* Custom operations for use with JsonLogic objects generated by
|
|
18
|
-
* {@link datetimeRuleProcessorJsonLogic}.
|
|
19
|
-
*/
|
|
16
|
+
* Custom operations for use with JsonLogic objects generated by
|
|
17
|
+
* {@link datetimeRuleProcessorJsonLogic}.
|
|
18
|
+
*/
|
|
20
19
|
declare const getDatetimeJsonLogicOperations: (apiFns: RQBDateTimeLibraryAPI) => RQBJsonLogicDateTimeOperations;
|
|
21
20
|
//#endregion
|
|
22
21
|
//#region src/getDatetimeRuleProcessorCEL.d.ts
|
|
23
22
|
/**
|
|
24
|
-
* Generates a rule processor with date/time features for use by
|
|
25
|
-
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "cel" format.
|
|
26
|
-
*/
|
|
23
|
+
* Generates a rule processor with date/time features for use by
|
|
24
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "cel" format.
|
|
25
|
+
*/
|
|
27
26
|
declare const getDatetimeRuleProcessorCEL: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
|
|
28
27
|
//#endregion
|
|
29
28
|
//#region src/getDatetimeRuleProcessorCypher.d.ts
|
|
30
29
|
/**
|
|
31
|
-
* Generates a rule processor with date/time features for use by
|
|
32
|
-
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "cypher" or "gql" format.
|
|
33
|
-
*
|
|
34
|
-
* Supports:
|
|
35
|
-
* - Standard comparison operators (`=`, `!=`, `<`, `>`, `<=`, `>=`)
|
|
36
|
-
* - Range operators (between, notBetween, in, notIn)
|
|
37
|
-
* - Duration math via custom operators: `olderThanDuration` and `withinDuration`
|
|
38
|
-
* (e.g., value `"P30D"` → `datetime() - field > duration('P30D')`)
|
|
39
|
-
*/
|
|
30
|
+
* Generates a rule processor with date/time features for use by
|
|
31
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "cypher" or "gql" format.
|
|
32
|
+
*
|
|
33
|
+
* Supports:
|
|
34
|
+
* - Standard comparison operators (`=`, `!=`, `<`, `>`, `<=`, `>=`)
|
|
35
|
+
* - Range operators (between, notBetween, in, notIn)
|
|
36
|
+
* - Duration math via custom operators: `olderThanDuration` and `withinDuration`
|
|
37
|
+
* (e.g., value `"P30D"` → `datetime() - field > duration('P30D')`)
|
|
38
|
+
*/
|
|
40
39
|
declare const getDatetimeRuleProcessorCypher: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
|
|
41
40
|
//#endregion
|
|
42
41
|
//#region src/getDatetimeRuleProcessorDrizzle.d.ts
|
|
43
42
|
/**
|
|
44
|
-
* Generates a rule processor with date/time features for use by
|
|
45
|
-
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "drizzle" format.
|
|
46
|
-
* Relative values are materialized and all date/time values are converted to `Date`
|
|
47
|
-
* objects (Drizzle column operators compare against native `Date` values).
|
|
48
|
-
*/
|
|
43
|
+
* Generates a rule processor with date/time features for use by
|
|
44
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "drizzle" format.
|
|
45
|
+
* Relative values are materialized and all date/time values are converted to `Date`
|
|
46
|
+
* objects (Drizzle column operators compare against native `Date` values).
|
|
47
|
+
*/
|
|
49
48
|
declare const getDatetimeRuleProcessorDrizzle: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
|
|
50
49
|
//#endregion
|
|
51
50
|
//#region src/getDatetimeRuleProcessorElasticSearch.d.ts
|
|
52
51
|
/**
|
|
53
|
-
* Generates a rule processor with date/time features for use by
|
|
54
|
-
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "elasticsearch" format.
|
|
55
|
-
* Relative values are materialized to concrete ISO 8601 strings (ElasticSearch has no
|
|
56
|
-
* symbolic relative form); absolute values pass through.
|
|
57
|
-
*/
|
|
52
|
+
* Generates a rule processor with date/time features for use by
|
|
53
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "elasticsearch" format.
|
|
54
|
+
* Relative values are materialized to concrete ISO 8601 strings (ElasticSearch has no
|
|
55
|
+
* symbolic relative form); absolute values pass through.
|
|
56
|
+
*/
|
|
58
57
|
declare const getDatetimeRuleProcessorElasticSearch: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
|
|
59
58
|
//#endregion
|
|
60
59
|
//#region src/getDatetimeRuleProcessorGremlin.d.ts
|
|
61
60
|
/**
|
|
62
|
-
* Generates a rule processor with date/time features for use by
|
|
63
|
-
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "gremlin" format.
|
|
64
|
-
* Relative values are materialized to concrete ISO 8601 strings (Gremlin has no symbolic
|
|
65
|
-
* relative form); absolute values pass through.
|
|
66
|
-
*/
|
|
61
|
+
* Generates a rule processor with date/time features for use by
|
|
62
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "gremlin" format.
|
|
63
|
+
* Relative values are materialized to concrete ISO 8601 strings (Gremlin has no symbolic
|
|
64
|
+
* relative form); absolute values pass through.
|
|
65
|
+
*/
|
|
67
66
|
declare const getDatetimeRuleProcessorGremlin: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
|
|
68
67
|
//#endregion
|
|
69
68
|
//#region src/getDatetimeRuleProcessorJSONata.d.ts
|
|
70
69
|
/**
|
|
71
|
-
* Generates a rule processor with date/time features for use by
|
|
72
|
-
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "jsonata" format.
|
|
73
|
-
*/
|
|
70
|
+
* Generates a rule processor with date/time features for use by
|
|
71
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "jsonata" format.
|
|
72
|
+
*/
|
|
74
73
|
declare const getDatetimeRuleProcessorJSONata: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
|
|
75
74
|
//#endregion
|
|
76
75
|
//#region src/getDatetimeRuleProcessorLDAP.d.ts
|
|
77
76
|
/**
|
|
78
|
-
* Generates a rule processor with date/time features for use by
|
|
79
|
-
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "ldap" format.
|
|
80
|
-
* Relative values are materialized to concrete ISO 8601 strings (LDAP has no symbolic
|
|
81
|
-
* relative form); absolute values pass through.
|
|
82
|
-
*/
|
|
77
|
+
* Generates a rule processor with date/time features for use by
|
|
78
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "ldap" format.
|
|
79
|
+
* Relative values are materialized to concrete ISO 8601 strings (LDAP has no symbolic
|
|
80
|
+
* relative form); absolute values pass through.
|
|
81
|
+
*/
|
|
83
82
|
declare const getDatetimeRuleProcessorLDAP: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
|
|
84
83
|
//#endregion
|
|
85
84
|
//#region src/getDatetimeRuleProcessorMongoDB.d.ts
|
|
86
85
|
/**
|
|
87
|
-
* Generates a rule processor with date/time features for use by
|
|
88
|
-
* {@link @react-querybuilder/core!formatQuery formatQuery} with the (deprecated) "mongodb"
|
|
89
|
-
* format. Delegates to the "mongodb_query" date/time processor and serializes the result;
|
|
90
|
-
* `Date` values serialize to ISO 8601 strings.
|
|
91
|
-
*/
|
|
86
|
+
* Generates a rule processor with date/time features for use by
|
|
87
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the (deprecated) "mongodb"
|
|
88
|
+
* format. Delegates to the "mongodb_query" date/time processor and serializes the result;
|
|
89
|
+
* `Date` values serialize to ISO 8601 strings.
|
|
90
|
+
*/
|
|
92
91
|
declare const getDatetimeRuleProcessorMongoDB: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
|
|
93
92
|
//#endregion
|
|
94
93
|
//#region src/getDatetimeRuleProcessorMongoDBQuery.d.ts
|
|
95
94
|
/**
|
|
96
|
-
* Generates a rule processor with date/time features for use by
|
|
97
|
-
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "mongodb_query" format.
|
|
98
|
-
*/
|
|
95
|
+
* Generates a rule processor with date/time features for use by
|
|
96
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "mongodb_query" format.
|
|
97
|
+
*/
|
|
99
98
|
declare const getDatetimeRuleProcessorMongoDBQuery: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
|
|
100
99
|
//#endregion
|
|
101
100
|
//#region src/getDatetimeRuleProcessorNL.d.ts
|
|
102
101
|
declare const defaultDateTimeNLOperatorMap: ExportOperatorMap;
|
|
103
102
|
/**
|
|
104
|
-
* Generates a value processor with date/time features for use by
|
|
105
|
-
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "natural_language" format.
|
|
106
|
-
*/
|
|
103
|
+
* Generates a value processor with date/time features for use by
|
|
104
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "natural_language" format.
|
|
105
|
+
*/
|
|
107
106
|
declare const datetimeValueProcessorNL: ValueProcessorByRule;
|
|
108
107
|
/**
|
|
109
|
-
* Generates a rule processor with date/time features for use by {@link @react-querybuilder/core!formatQuery formatQuery} with
|
|
110
|
-
* the "natural_language" format.
|
|
111
|
-
*/
|
|
108
|
+
* Generates a rule processor with date/time features for use by {@link @react-querybuilder/core!formatQuery formatQuery} with
|
|
109
|
+
* the "natural_language" format.
|
|
110
|
+
*/
|
|
112
111
|
declare const getDatetimeRuleProcessorNL: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
|
|
113
112
|
//#endregion
|
|
114
113
|
//#region src/getDatetimeRuleProcessorParameterized.d.ts
|
|
115
114
|
/**
|
|
116
|
-
* Generates a rule processor with date/time features for use by
|
|
117
|
-
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "parameterized" and
|
|
118
|
-
* "parameterized_named" formats. Relative values are materialized to concrete ISO 8601
|
|
119
|
-
* strings (these formats have no symbolic relative form); absolute values pass through.
|
|
120
|
-
*/
|
|
115
|
+
* Generates a rule processor with date/time features for use by
|
|
116
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "parameterized" and
|
|
117
|
+
* "parameterized_named" formats. Relative values are materialized to concrete ISO 8601
|
|
118
|
+
* strings (these formats have no symbolic relative form); absolute values pass through.
|
|
119
|
+
*/
|
|
121
120
|
declare const getDatetimeRuleProcessorParameterized: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
|
|
122
121
|
//#endregion
|
|
123
122
|
//#region src/getDatetimeRuleProcessorPrisma.d.ts
|
|
124
123
|
/**
|
|
125
|
-
* Generates a rule processor with date/time features for use by
|
|
126
|
-
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "prisma" format.
|
|
127
|
-
* Relative values are materialized and all date/time values are converted to `Date`
|
|
128
|
-
* objects (Prisma's `where` clauses use native `Date` values for date columns).
|
|
129
|
-
*/
|
|
124
|
+
* Generates a rule processor with date/time features for use by
|
|
125
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "prisma" format.
|
|
126
|
+
* Relative values are materialized and all date/time values are converted to `Date`
|
|
127
|
+
* objects (Prisma's `where` clauses use native `Date` values for date columns).
|
|
128
|
+
*/
|
|
130
129
|
declare const getDatetimeRuleProcessorPrisma: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
|
|
131
130
|
//#endregion
|
|
132
131
|
//#region src/getDatetimeRuleProcessorSequelize.d.ts
|
|
133
132
|
/**
|
|
134
|
-
* Generates a rule processor with date/time features for use by
|
|
135
|
-
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "sequelize" format.
|
|
136
|
-
* Relative values are materialized and all date/time values are converted to `Date`
|
|
137
|
-
* objects (Sequelize `where` clauses use native `Date` values for date columns).
|
|
138
|
-
*/
|
|
133
|
+
* Generates a rule processor with date/time features for use by
|
|
134
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "sequelize" format.
|
|
135
|
+
* Relative values are materialized and all date/time values are converted to `Date`
|
|
136
|
+
* objects (Sequelize `where` clauses use native `Date` values for date columns).
|
|
137
|
+
*/
|
|
139
138
|
declare const getDatetimeRuleProcessorSequelize: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
|
|
140
139
|
//#endregion
|
|
141
140
|
//#region src/getDatetimeRuleProcessorSPARQL.d.ts
|
|
142
141
|
/**
|
|
143
|
-
* Generates a rule processor with date/time features for use by
|
|
144
|
-
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "sparql" format.
|
|
145
|
-
*
|
|
146
|
-
* Supports:
|
|
147
|
-
* - Standard comparison operators (`=`, `!=`, `<`, `>`, `<=`, `>=`)
|
|
148
|
-
* - Range operators (between, notBetween, in, notIn)
|
|
149
|
-
* - Duration math via custom operators: `olderThanDuration` and `withinDuration`
|
|
150
|
-
* (e.g., value `"P30D"` → `NOW() - ?field > "P30D"^^xsd:duration`)
|
|
151
|
-
*/
|
|
142
|
+
* Generates a rule processor with date/time features for use by
|
|
143
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "sparql" format.
|
|
144
|
+
*
|
|
145
|
+
* Supports:
|
|
146
|
+
* - Standard comparison operators (`=`, `!=`, `<`, `>`, `<=`, `>=`)
|
|
147
|
+
* - Range operators (between, notBetween, in, notIn)
|
|
148
|
+
* - Duration math via custom operators: `olderThanDuration` and `withinDuration`
|
|
149
|
+
* (e.g., value `"P30D"` → `NOW() - ?field > "P30D"^^xsd:duration`)
|
|
150
|
+
*/
|
|
152
151
|
declare const getDatetimeRuleProcessorSPARQL: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
|
|
153
152
|
//#endregion
|
|
154
153
|
//#region src/getDatetimeRuleProcessorSpEL.d.ts
|
|
155
154
|
/**
|
|
156
|
-
* Generates a rule processor with date/time features for use by
|
|
157
|
-
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "spel" format.
|
|
158
|
-
* Relative values are materialized to concrete ISO 8601 strings (SpEL has no symbolic
|
|
159
|
-
* relative form); absolute values pass through.
|
|
160
|
-
*/
|
|
155
|
+
* Generates a rule processor with date/time features for use by
|
|
156
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "spel" format.
|
|
157
|
+
* Relative values are materialized to concrete ISO 8601 strings (SpEL has no symbolic
|
|
158
|
+
* relative form); absolute values pass through.
|
|
159
|
+
*/
|
|
161
160
|
declare const getDatetimeRuleProcessorSpEL: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
|
|
162
161
|
//#endregion
|
|
163
162
|
//#region src/getDatetimeRuleProcessorSQL.d.ts
|
|
164
163
|
/**
|
|
165
|
-
* Generates a value processor with date/time features for use by
|
|
166
|
-
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "sql" format and "ansi" preset.
|
|
167
|
-
*/
|
|
168
|
-
declare const getDatetimeValueProcessorANSI: ({
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
*
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
*
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
toISOStringDateOnly,
|
|
194
|
-
toISOString
|
|
195
|
-
}: RQBDateTimeLibraryAPI) => ValueProcessorByRule;
|
|
196
|
-
/**
|
|
197
|
-
* Generates a value processor with date/time features for use by {@link @react-querybuilder/core!formatQuery formatQuery} with
|
|
198
|
-
* the "sql" format and "postgresql" preset.
|
|
199
|
-
*/
|
|
200
|
-
declare const getDatetimeValueProcessorPostgreSQL: ({
|
|
201
|
-
toISOStringDateOnly,
|
|
202
|
-
toISOString
|
|
203
|
-
}: RQBDateTimeLibraryAPI) => ValueProcessorByRule;
|
|
204
|
-
/**
|
|
205
|
-
* Generates a rule processor with date/time features for use by {@link @react-querybuilder/core!formatQuery formatQuery} with
|
|
206
|
-
* the "sql" format.
|
|
207
|
-
*/
|
|
164
|
+
* Generates a value processor with date/time features for use by
|
|
165
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "sql" format and "ansi" preset.
|
|
166
|
+
*/
|
|
167
|
+
declare const getDatetimeValueProcessorANSI: ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI) => ValueProcessorByRule;
|
|
168
|
+
/**
|
|
169
|
+
* Generates a value processor with date/time features for use by {@link @react-querybuilder/core!formatQuery formatQuery} with
|
|
170
|
+
* the "sql" format and "mssql" preset.
|
|
171
|
+
*/
|
|
172
|
+
declare const getDatetimeValueProcessorMSSQL: ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI) => ValueProcessorByRule;
|
|
173
|
+
/**
|
|
174
|
+
* Generates a value processor with date/time features for use by {@link @react-querybuilder/core!formatQuery formatQuery} with
|
|
175
|
+
* the "sql" format and "mysql" preset.
|
|
176
|
+
*/
|
|
177
|
+
declare const getDatetimeValueProcessorMySQL: ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI) => ValueProcessorByRule;
|
|
178
|
+
/**
|
|
179
|
+
* Generates a value processor with date/time features for use by {@link @react-querybuilder/core!formatQuery formatQuery} with
|
|
180
|
+
* the "sql" format and "oracle" preset.
|
|
181
|
+
*/
|
|
182
|
+
declare const getDatetimeValueProcessorOracle: ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI) => ValueProcessorByRule;
|
|
183
|
+
/**
|
|
184
|
+
* Generates a value processor with date/time features for use by {@link @react-querybuilder/core!formatQuery formatQuery} with
|
|
185
|
+
* the "sql" format and "postgresql" preset.
|
|
186
|
+
*/
|
|
187
|
+
declare const getDatetimeValueProcessorPostgreSQL: ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI) => ValueProcessorByRule;
|
|
188
|
+
/**
|
|
189
|
+
* Generates a rule processor with date/time features for use by {@link @react-querybuilder/core!formatQuery formatQuery} with
|
|
190
|
+
* the "sql" format.
|
|
191
|
+
*/
|
|
208
192
|
declare const getDatetimeRuleProcessorSQL: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
|
|
209
193
|
//#endregion
|
|
210
194
|
//#region src/getDatetimeRuleProcessorTanStackDB.d.ts
|
|
211
195
|
/**
|
|
212
|
-
* Generates a rule processor with date/time features for use by
|
|
213
|
-
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "tanstack_db" format.
|
|
214
|
-
* Relative values are materialized and all date/time values are converted to `Date`
|
|
215
|
-
* objects (TanStack DB collection filters compare against native `Date` values).
|
|
216
|
-
*/
|
|
196
|
+
* Generates a rule processor with date/time features for use by
|
|
197
|
+
* {@link @react-querybuilder/core!formatQuery formatQuery} with the "tanstack_db" format.
|
|
198
|
+
* Relative values are materialized and all date/time values are converted to `Date`
|
|
199
|
+
* objects (TanStack DB collection filters compare against native `Date` values).
|
|
200
|
+
*/
|
|
217
201
|
declare const getDatetimeRuleProcessorTanStackDB: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
|
|
218
202
|
//#endregion
|
|
219
203
|
export { IsDateField, IsDateFieldFunction, RQBDateTimeJsonLogic, RQBDateTimeLibraryAPI, RQBJsonLogicDateAfter, RQBJsonLogicDateBefore, RQBJsonLogicDateBetween, RQBJsonLogicDateIn, RQBJsonLogicDateNotBetween, RQBJsonLogicDateNotIn, RQBJsonLogicDateNotOn, RQBJsonLogicDateOn, RQBJsonLogicDateOnOrAfter, RQBJsonLogicDateOnOrBefore, RQBJsonLogicDateRelative, RQBJsonLogicDateTimeOperations, RelativeDateTimeAnchor, RelativeDateTimeTruncationUnit, RelativeDateTimeUnit, RelativeDateTimeValue, datetimeRuleProcessorJsonLogic, datetimeValueProcessorNL, defaultDateTimeNLOperatorMap, getDatetimeJsonLogicOperations, getDatetimeRuleProcessorCEL, getDatetimeRuleProcessorCypher, getDatetimeRuleProcessorDrizzle, getDatetimeRuleProcessorElasticSearch, getDatetimeRuleProcessorGremlin, getDatetimeRuleProcessorJSONata, getDatetimeRuleProcessorLDAP, getDatetimeRuleProcessorMongoDB, getDatetimeRuleProcessorMongoDBQuery, getDatetimeRuleProcessorNL, getDatetimeRuleProcessorParameterized, getDatetimeRuleProcessorPrisma, getDatetimeRuleProcessorSPARQL, getDatetimeRuleProcessorSQL, getDatetimeRuleProcessorSequelize, getDatetimeRuleProcessorSpEL, getDatetimeRuleProcessorTanStackDB, getDatetimeValueProcessorANSI, getDatetimeValueProcessorMSSQL, getDatetimeValueProcessorMySQL, getDatetimeValueProcessorOracle, getDatetimeValueProcessorPostgreSQL };
|