@semcore/date-picker 16.2.4 → 17.0.0-prerelease.18
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/CHANGELOG.md +6 -0
- package/lib/cjs/DatePicker.js +116 -139
- package/lib/cjs/DatePicker.js.map +1 -1
- package/lib/cjs/DateRangeComparator.js +144 -149
- package/lib/cjs/DateRangeComparator.js.map +1 -1
- package/lib/cjs/DateRangePicker.js +86 -101
- package/lib/cjs/DateRangePicker.js.map +1 -1
- package/lib/cjs/MonthDateRangeComparator.js +173 -180
- package/lib/cjs/MonthDateRangeComparator.js.map +1 -1
- package/lib/cjs/MonthPicker.js +70 -87
- package/lib/cjs/MonthPicker.js.map +1 -1
- package/lib/cjs/MonthRangePicker.js +96 -111
- package/lib/cjs/MonthRangePicker.js.map +1 -1
- package/lib/cjs/components/ButtonTrigger.js +12 -11
- package/lib/cjs/components/ButtonTrigger.js.map +1 -1
- package/lib/cjs/components/Calendar.js +409 -466
- package/lib/cjs/components/Calendar.js.map +1 -1
- package/lib/cjs/components/DateRangeComparatorAbstract.js +574 -626
- package/lib/cjs/components/DateRangeComparatorAbstract.js.map +1 -1
- package/lib/cjs/components/InputTrigger.js +585 -677
- package/lib/cjs/components/InputTrigger.js.map +1 -1
- package/lib/cjs/components/PickerAbstract.js +254 -273
- package/lib/cjs/components/PickerAbstract.js.map +1 -1
- package/lib/cjs/components/RangePickerAbstract.js +407 -439
- package/lib/cjs/components/RangePickerAbstract.js.map +1 -1
- package/lib/cjs/components/index.js +92 -102
- package/lib/cjs/components/index.js.map +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/index.js +15 -15
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +17 -17
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/cjs/utils/cronTabScheduler.js +13 -22
- package/lib/cjs/utils/cronTabScheduler.js.map +1 -1
- package/lib/cjs/utils/datesIntersects.js +12 -19
- package/lib/cjs/utils/datesIntersects.js.map +1 -1
- package/lib/cjs/utils/formatDate.js +11 -9
- package/lib/cjs/utils/formatDate.js.map +1 -1
- package/lib/cjs/utils/includesDate.js +11 -16
- package/lib/cjs/utils/includesDate.js.map +1 -1
- package/lib/cjs/utils/isBetweenPlugin.js +6 -6
- package/lib/cjs/utils/isBetweenPlugin.js.map +1 -1
- package/lib/cjs/utils/shortDateRangeFormat.js +29 -33
- package/lib/cjs/utils/shortDateRangeFormat.js.map +1 -1
- package/lib/es6/DatePicker.js +117 -141
- package/lib/es6/DatePicker.js.map +1 -1
- package/lib/es6/DateRangeComparator.js +130 -135
- package/lib/es6/DateRangeComparator.js.map +1 -1
- package/lib/es6/DateRangePicker.js +87 -102
- package/lib/es6/DateRangePicker.js.map +1 -1
- package/lib/es6/MonthDateRangeComparator.js +159 -166
- package/lib/es6/MonthDateRangeComparator.js.map +1 -1
- package/lib/es6/MonthPicker.js +72 -89
- package/lib/es6/MonthPicker.js.map +1 -1
- package/lib/es6/MonthRangePicker.js +97 -112
- package/lib/es6/MonthRangePicker.js.map +1 -1
- package/lib/es6/components/ButtonTrigger.js +4 -3
- package/lib/es6/components/ButtonTrigger.js.map +1 -1
- package/lib/es6/components/Calendar.js +400 -457
- package/lib/es6/components/Calendar.js.map +1 -1
- package/lib/es6/components/DateRangeComparatorAbstract.js +552 -604
- package/lib/es6/components/DateRangeComparatorAbstract.js.map +1 -1
- package/lib/es6/components/InputTrigger.js +568 -660
- package/lib/es6/components/InputTrigger.js.map +1 -1
- package/lib/es6/components/PickerAbstract.js +246 -265
- package/lib/es6/components/PickerAbstract.js.map +1 -1
- package/lib/es6/components/RangePickerAbstract.js +397 -429
- package/lib/es6/components/RangePickerAbstract.js.map +1 -1
- package/lib/es6/components/index.js +74 -85
- package/lib/es6/components/index.js.map +1 -1
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +16 -16
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/utils/cronTabScheduler.js +13 -21
- package/lib/es6/utils/cronTabScheduler.js.map +1 -1
- package/lib/es6/utils/datesIntersects.js +10 -18
- package/lib/es6/utils/datesIntersects.js.map +1 -1
- package/lib/es6/utils/formatDate.js +6 -6
- package/lib/es6/utils/formatDate.js.map +1 -1
- package/lib/es6/utils/includesDate.js +10 -15
- package/lib/es6/utils/includesDate.js.map +1 -1
- package/lib/es6/utils/isBetweenPlugin.js +4 -4
- package/lib/es6/utils/isBetweenPlugin.js.map +1 -1
- package/lib/es6/utils/shortDateRangeFormat.js +27 -31
- package/lib/es6/utils/shortDateRangeFormat.js.map +1 -1
- package/lib/esm/DatePicker.mjs +109 -114
- package/lib/esm/DateRangeComparator.mjs +112 -105
- package/lib/esm/DateRangePicker.mjs +76 -80
- package/lib/esm/MonthDateRangeComparator.mjs +141 -134
- package/lib/esm/MonthPicker.mjs +65 -70
- package/lib/esm/MonthRangePicker.mjs +86 -88
- package/lib/esm/components/ButtonTrigger.mjs +4 -3
- package/lib/esm/components/Calendar.mjs +397 -423
- package/lib/esm/components/DateRangeComparatorAbstract.mjs +559 -516
- package/lib/esm/components/InputTrigger.mjs +550 -557
- package/lib/esm/components/PickerAbstract.mjs +249 -244
- package/lib/esm/components/RangePickerAbstract.mjs +400 -384
- package/lib/esm/components/index.mjs +73 -69
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +1 -1
- package/lib/esm/utils/cronTabScheduler.mjs +13 -18
- package/lib/esm/utils/datesIntersects.mjs +10 -14
- package/lib/esm/utils/formatDate.mjs +6 -6
- package/lib/esm/utils/includesDate.mjs +10 -13
- package/lib/esm/utils/isBetweenPlugin.mjs +4 -4
- package/lib/esm/utils/shortDateRangeFormat.mjs +27 -27
- package/lib/types/index.d.ts +2 -44
- package/package.json +16 -17
package/lib/cjs/index.d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import type { BaseTriggerProps } from '@semcore/base-trigger';\nimport type BaseTrigger from '@semcore/base-trigger';\nimport type { ButtonProps } from '@semcore/button';\nimport type Button from '@semcore/button';\nimport type Checkbox from '@semcore/checkbox';\nimport type { UnknownProperties, Intergalactic, PropGetterFn } from '@semcore/core';\nimport type { WithI18nEnhanceProps } from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport type Divider from '@semcore/divider';\nimport type { DropdownProps, DropdownTriggerProps } from '@semcore/dropdown';\nimport type { Flex, Box, BoxProps } from '@semcore/flex-box';\nimport type { InputProps, InputValueProps } from '@semcore/input';\nimport type Input from '@semcore/input';\nimport type { InputMaskValueProps } from '@semcore/input-mask';\nimport type Popper from '@semcore/popper';\nimport type { TooltipProps } from '@semcore/tooltip';\nimport type dayjs from 'dayjs';\nimport type { ChangeEvent } from 'react';\nimport type React from 'react';\n\nexport type DateConstructorParams = string | number | Date;\n\n/**\n * Array of dates blocked for selection\n * Accepts the date or the range of dates for specifying infinity ([Date | false, Date | false]), crontab(6,7)\n * */\nexport type DisabledDates = (DateConstructorParams | (DateConstructorParams | false)[] | string)[];\n\n/** @deprecated */\nexport interface ICalendarProps extends CalendarProps, UnknownProperties {}\nexport type CalendarProps = BoxProps & {\n /**\n * Locale for displaying the days of a week and months, to be transferred to `Intl`\n * @default en\n * */\n locale?: NavigatorLanguage['language'];\n /**\n * Array of dates blocked for selection\n */\n disabled?: DisabledDates;\n /** Internal */\n highlighted?: DateConstructorParams[];\n /** Internal */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n value?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onChange?: (date: Date[]) => void;\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: Date;\n /** Controls whether to render dates from previous/next months */\n renderOutdated?: boolean;\n};\n\n/** @deprecated */\nexport interface ICalendarDaysContext extends CalendarDaysContext, UnknownProperties {}\nexport type CalendarDaysContext = {\n days: CalendarUnitProps[];\n};\n\n/** @deprecated */\nexport interface ICalendarMonthsContext extends CalendarMonthsContext, UnknownProperties {}\nexport type CalendarMonthsContext = {\n months: CalendarUnitProps[];\n};\n\n/** @deprecated */\nexport interface ICalendarUnitProps extends CalendarUnitProps, UnknownProperties {}\nexport type CalendarUnitProps = BoxProps & {\n /** Indicates if the calendar unit is part of a selected date range */\n selected?: boolean;\n /** Marks units from previous/next months that appear in the current month view */\n outdated?: boolean;\n /** Prevents interaction with the unit */\n disabled?: boolean;\n /** Highlights the current date */\n today?: boolean;\n /** Marks the beginning of a selected date range */\n startSelected?: boolean;\n /** Marks the end of a selected date range */\n endSelected?: boolean;\n /** Shows preview highlighting during range selection */\n highlighted?: boolean;\n /** Marks the start of a highlighted range */\n startHighlighted?: boolean;\n /** Marks the end of a highlighted range */\n endHighlighted?: boolean;\n /** The actual Date object this unit represents */\n date?: Date;\n /** Content to display within the unit (typically the day number) */\n children?: React.ReactNode;\n};\n\n/** @deprecated */\nexport interface ICalendarContext extends CalendarContext, UnknownProperties {}\nexport type CalendarContext = {\n getUnitProps: PropGetterFn;\n};\n\ndeclare const Calendar: Intergalactic.Component<\n 'div',\n CalendarProps,\n CalendarContext & CalendarDaysContext,\n [handlers: AbstractDatePickerHandlers]\n> & {\n Unit: Intergalactic.Component<'div', CalendarUnitProps>;\n};\n\n/** @deprecated */\nexport interface IDatePickerProps extends DatePickerProps, UnknownProperties {}\nexport type DatePickerProps = Intergalactic.InternalTypings.EfficientOmit<\n DropdownProps,\n 'disabled'\n> &\nWithI18nEnhanceProps & {\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n value?: DateConstructorParams;\n /**\n * To be activated upon selecting the date\n * */\n onChange?: (date: Date) => void;\n /**\n * Array of dates blocked for selection\n * */\n disabled?: (DateConstructorParams | (DateConstructorParams | false)[] | string)[];\n /**\n * Error message when user attempts to input a disabled date\n * */\n disabledErrorText?: ((attemptedDate: Date) => string) | string | null;\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: DateConstructorParams;\n /**\n * To be activated upon changing the current shown month\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * Component size\n * @default m\n */\n size?: 'm' | 'l';\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n highlighted?: DateConstructorParams[];\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultValue?: DateConstructorParams;\n /**\n * Default value date for showing the necessary month\n * */\n defaultDisplayedPeriod?: DateConstructorParams;\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultHighlighted?: DateConstructorParams[];\n};\n\n/** @deprecated */\nexport interface IDateRangePickerProps extends DateRangePickerProps, UnknownProperties {}\nexport type DateRangePickerProps = Intergalactic.InternalTypings.EfficientOmit<\n DropdownProps,\n 'disabled'\n> &\nWithI18nEnhanceProps & {\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n value?: DateConstructorParams[];\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultValue?: DateConstructorParams[];\n /**\n * Default value date for showing the necessary month\n * */\n defaultDisplayedPeriod?: DateConstructorParams;\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultHighlighted?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onChange?: (date: Date[]) => void;\n /**\n * Array of dates blocked for selection\n * */\n disabled?: (DateConstructorParams | (DateConstructorParams | false)[] | string)[];\n /**\n * Error message when user attempts to input a disabled date\n * */\n disabledErrorText?: ((attemptedDate: Date) => string) | string | null;\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: DateConstructorParams;\n /**\n * To be activated upon changing the current shown month\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n highlighted?: DateConstructorParams[];\n /**\n * Remove the 'Reset' button\n * */\n unclearable?: boolean;\n /**\n * To be activated upon selecting the date\n * */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * Intermediate value between `highlighted` and `value` that user see before explicitly applying it.\n */\n preselectedValue?: DateConstructorParams[];\n /**\n * Normally called when user preselects a date range and when user applies this range.\n */\n onPreselectedValueChange?: (date: Date[]) => void;\n /**\n * Array of periods\n * [{value: [new Date(), new Date()], children: \"Today\"}]\n * @default Past 2 days / Past week / Past 2 week / Past month / Past 2 month\n * */\n periods?: (ButtonProps & { value: Date[] })[];\n};\n\n/** @deprecated */\nexport interface IDateRangePickerPeriodProps\n extends DateRangePickerPeriodProps,\n UnknownProperties {}\nexport type DateRangePickerPeriodProps = BoxProps & {\n /**\n * Current selected period\n * */\n value?: DateConstructorParams[];\n /**\n * To be activated by clicking the button for switching the selected period.\n * */\n onChange?: (date: Date[]) => void;\n /**\n * To be activated by hovering a cursor over the button for changing the current displayed month.\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * To be activated by hovering a cursor over the button for selecting the dates.\n * */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * Array of periods\n * [{value: [new Date(), new Date()], children: \"Today\"}]\n * @default Past 2 days / Past week / Past 2 week / Past month / Past 2 month\n * */\n periods?: (ButtonProps & { value: Date[] })[];\n};\n\n/** @deprecated */\nexport interface IDatePickerContext extends DatePickerContext, UnknownProperties {}\nexport type DatePickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getTodayProps: PropGetterFn;\n};\n\n/** @deprecated */\nexport interface IAbstractDatePickerHandlers\n extends AbstractDatePickerHandlers,\n UnknownProperties {}\nexport type AbstractDatePickerHandlers = {\n displayedPeriod: (value: DateConstructorParams) => void;\n visible: (index: boolean) => void;\n highlighted: (list: DateConstructorParams[]) => void;\n value: (index: DateConstructorParams) => void;\n};\n\n/** @deprecated */\nexport interface IDatePickerHandlers extends DatePickerHandlers, UnknownProperties {}\nexport type DatePickerHandlers = {\n visible: (index: boolean) => void;\n};\n\n/** @deprecated */\nexport interface IInputTriggerProps extends InputTriggerProps, UnknownProperties {}\nexport type BaseInputTriggerProps = InputProps &\n TooltipProps & {\n /**\n * Date input placeholder characters\n * @default { year: 'Y'; month: 'M'; day: 'D' }\n */\n placeholders?: { year: string; month: string; day: string };\n locale?: string;\n onDisplayedPeriodChange?: (date: Date) => void;\n };\nexport type InputTriggerProps = BaseInputTriggerProps & {\n value?: Date;\n onChange?: (date: Date, event: ChangeEvent) => void;\n /** @deprecated Set `disabledErrorText={null}` on the picker Root instead */\n showError?: boolean;\n};\n\nexport type RangeInputTriggerProps = BaseInputTriggerProps & {\n value?: Date[];\n onChange?: (date: Date[], event: ChangeEvent) => void;\n};\n\n/** @deprecated */\nexport interface ISingleDateInputProps extends SingleDateInputProps, UnknownProperties {}\nexport type SingleDateInputProps = InputTriggerProps & {};\n\n/** @deprecated */\nexport interface IDateRangeProps extends DateRangeProps, UnknownProperties {}\nexport type DateRangeProps = RangeInputTriggerProps & {};\n\n/** @deprecated */\nexport interface IDatePickerMaskedInputProps\n extends DatePickerMaskedInputProps,\n UnknownProperties {}\nexport type DatePickerMaskedInputProps = {\n date?: Date;\n onDateChange?: (date: Date, event: ChangeEvent) => void;\n onDisplayedPeriodChange?: (date: Date) => void;\n locale?: string;\n parts?: { year: boolean; month: boolean; day: boolean };\n disabledDates?: (Date | (Date | false)[] | string)[];\n};\n\ndeclare const InputTrigger: Intergalactic.Component<\n 'div',\n DropdownTriggerProps & InputTriggerProps\n> & {\n Addon: typeof Input.Addon;\n Value: typeof Input.Value;\n SingleDateInput: Intergalactic.Component<'div', InputProps & SingleDateInputProps> & {\n Indicator: typeof Input.Addon;\n MaskedInput: Intergalactic.Component<'input', InputMaskValueProps & DatePickerMaskedInputProps>;\n };\n};\n\ndeclare const RangeInputTrigger: Intergalactic.Component<\n 'div',\n DropdownTriggerProps & RangeInputTriggerProps\n> & {\n Addon: typeof Input.Addon;\n Value: typeof Input.Value;\n DateRange: Intergalactic.Component<'div', InputValueProps & DateRangeProps> & {\n Indicator: typeof Input.Addon;\n RangeSep: typeof Input.Addon;\n FromMaskedInput: Intergalactic.Component<\n 'input',\n InputMaskValueProps & DatePickerMaskedInputProps\n >;\n ToMaskedInput: Intergalactic.Component<\n 'input',\n InputMaskValueProps & DatePickerMaskedInputProps\n >;\n };\n};\n\ndeclare const DatePicker: Intergalactic.Component<\n 'div',\n DatePickerProps,\n DatePickerContext & CalendarDaysContext\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof InputTrigger;\n Popper: typeof Popper.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DatePickerProps, DatePickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Today: typeof Box;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\n/** @deprecated */\nexport interface IDateRangePickerContext extends DateRangePickerContext, UnknownProperties {}\nexport type DateRangePickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getPeriodProps: PropGetterFn;\n};\n\ndeclare const DateRangePicker: Intergalactic.Component<\n 'div',\n DateRangePickerProps,\n DateRangePickerContext & CalendarDaysContext,\n [handlers: DatePickerHandlers]\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof RangeInputTrigger;\n Popper: typeof Popper.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DateRangePickerProps, DateRangePickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Period: Intergalactic.Component<'div', DateRangePickerPeriodProps>;\n Apply: typeof Button;\n Reset: typeof Button;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\n/** @deprecated */\nexport interface IMonthPickerContext extends MonthPickerContext, UnknownProperties {}\nexport type MonthPickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n};\n\ndeclare const MonthPicker: Intergalactic.Component<\n 'div',\n DatePickerProps,\n MonthPickerContext & CalendarMonthsContext,\n [handlers: DatePickerHandlers]\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof InputTrigger;\n Popper: typeof Popper.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DatePickerProps, MonthPickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\n/** @deprecated */\nexport interface IMonthRangePickerContext extends MonthRangePickerContext, UnknownProperties {}\nexport type MonthRangePickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getPeriodProps: PropGetterFn;\n};\n\ndeclare const MonthRangePicker: Intergalactic.Component<\n 'div',\n DateRangePickerProps,\n MonthRangePickerContext & CalendarMonthsContext,\n [handlers: DatePickerHandlers]\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof RangeInputTrigger;\n Popper: typeof Popper.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DateRangePickerProps, MonthRangePickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Period: Intergalactic.Component<'div', DateRangePickerPeriodProps>;\n Apply: typeof Button;\n Reset: typeof Button;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\nexport type DateRangeComparatorFocusRange = 'value' | 'compare';\nexport type DateRangeComparatorValue = {\n value?: DateConstructorParams[];\n compare?: DateConstructorParams[];\n};\n\nexport type DateRangeComparatorProps = Intergalactic.InternalTypings.EfficientOmit<\n DropdownProps,\n 'disabled'\n> &\nWithI18nEnhanceProps & {\n /**\n * Selected date ranges\n * */\n value?: DateRangeComparatorValue;\n /**\n * Default value for selected date ranges\n * */\n defaultValue?: DateRangeComparatorValue;\n /**\n * Default value date for showing the necessary month\n * */\n defaultDisplayedPeriod?: DateConstructorParams;\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultHighlighted?: DateConstructorParams[];\n /**\n * Called with selected date when user clicks `Apply` button.\n * */\n onChange?: (ranges: {\n value?: DateConstructorParams[];\n compare?: DateConstructorParams[];\n }) => void;\n /**\n * Array of dates blocked for selection\n * */\n disabled?: (DateConstructorParams | (DateConstructorParams | false)[] | string)[];\n /**\n * Error message when user attempts to input a disabled date\n * */\n disabledErrorText?: ((attemptedDate: Date) => string) | string | null;\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: DateConstructorParams;\n /**\n * To be activated upon changing the current shown month\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n highlighted?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n compareHighlighted?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onCompareHighlightedChange?: (date: Date[]) => void;\n /**\n * Intermediate value between `highlighted` and `value` that user see before explicitly applying it.\n */\n preselectedValue?: DateConstructorParams[];\n /**\n * Normally called when user preselects a date range and when user applies this range.\n */\n onPreselectedValueChange?: (date: Date[]) => void;\n /**\n * Intermediate value between `compareHighlighted` and `compare` that user see before explicitly applying it.\n */\n preselectedCompare?: DateConstructorParams[];\n /**\n * Normally called when user preselects a compare range and when user applies ranges.\n */\n onPreselectedCompareChange?: (date: Date[]) => void;\n /**\n * Controls that compare range input is enabled.\n */\n compareToggle?: boolean;\n /**\n * Toggles when compare range input enables or disables.\n */\n onCompareToggleChange?: (compareToggle: boolean) => void;\n /**\n * Controls which date range is focused.\n */\n focusedRange?: DateRangeComparatorFocusRange;\n /**\n * Called when user focuses or is focused on some of the date ranges.\n */\n onFocusedRangeChange?: (focusedRange: DateRangeComparatorFocusRange) => void;\n /**\n * Remove the 'Reset' button\n * */\n unclearable?: boolean;\n /**\n * Array of periods\n * [{value: [new Date(), new Date()], children: \"Today\"}]\n * @default Past 2 days / Past week / Past 2 week / Past month / Past 2 month\n * */\n periods?: (ButtonProps & { value: Date[] })[];\n};\n\nexport type DateRangeComparatorContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getPeriodProps: PropGetterFn;\n};\n\nexport type DateRangeComparatorTriggerProps = DropdownTriggerProps &\n BaseTriggerProps & {\n /**\n * Text between the selected date range and the compared date range when both are selected.\n * @default 'vs.'\n */\n separator?: string;\n /**\n * Trigger text when no ranges are selected.\n */\n placeholder?: string;\n };\n\ndeclare const DateRangeComparator: Intergalactic.Component<\n 'div',\n DateRangeComparatorProps,\n DateRangeComparatorContext & CalendarDaysContext\n> & {\n Popper: typeof Popper.Popper;\n Header: typeof Flex;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Apply: typeof Button;\n Reset: typeof Button;\n\n CalendarHeader: typeof Box;\n Title: typeof Box;\n\n Trigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n ValueDateRange: Intergalactic.Component<'div', InputTriggerProps>;\n CompareToggle: typeof Checkbox;\n CompareDateRange: Intergalactic.Component<'div', InputTriggerProps>;\n Body: typeof Flex;\n RangeCalendar: typeof Flex;\n Periods: typeof Flex & {\n Divider: typeof Divider;\n Column: typeof Flex;\n Options: typeof Flex;\n Controls: typeof Flex;\n };\n Footer: typeof Flex;\n};\n\ndeclare const MonthDateRangeComparator: typeof DateRangeComparator;\n\nexport {\n DatePicker,\n DateRangePicker,\n MonthPicker,\n MonthRangePicker,\n DateRangeComparator,\n MonthDateRangeComparator,\n};\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import type { Flex, Box, BoxProps } from '@semcore/base-components';\nimport type Popper from '@semcore/base-components';\nimport type { BaseTriggerProps } from '@semcore/base-trigger';\nimport type BaseTrigger from '@semcore/base-trigger';\nimport type { ButtonProps } from '@semcore/button';\nimport type Button from '@semcore/button';\nimport type Checkbox from '@semcore/checkbox';\nimport type { UnknownProperties, Intergalactic, PropGetterFn } from '@semcore/core';\nimport type { WithI18nEnhanceProps } from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport type Divider from '@semcore/divider';\nimport type { DropdownProps, DropdownTriggerProps } from '@semcore/dropdown';\nimport type { InputProps, InputValueProps } from '@semcore/input';\nimport type Input from '@semcore/input';\nimport type { InputMaskValueProps } from '@semcore/input-mask';\nimport type { TooltipProps } from '@semcore/tooltip';\nimport type dayjs from 'dayjs';\nimport type { ChangeEvent } from 'react';\nimport type React from 'react';\n\nexport type DateConstructorParams = string | number | Date;\n\n/**\n * Array of dates blocked for selection\n * Accepts the date or the range of dates for specifying infinity ([Date | false, Date | false]), crontab(6,7)\n * */\nexport type DisabledDates = (DateConstructorParams | (DateConstructorParams | false)[] | string)[];\n\nexport type CalendarProps = BoxProps & {\n /**\n * Locale for displaying the days of a week and months, to be transferred to `Intl`\n * @default en\n * */\n locale?: NavigatorLanguage['language'];\n /**\n * Array of dates blocked for selection\n */\n disabled?: DisabledDates;\n /** Internal */\n highlighted?: DateConstructorParams[];\n /** Internal */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n value?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onChange?: (date: Date[]) => void;\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: Date;\n /** Controls whether to render dates from previous/next months */\n renderOutdated?: boolean;\n};\n\nexport type CalendarDaysContext = {\n days: CalendarUnitProps[];\n};\n\nexport type CalendarMonthsContext = {\n months: CalendarUnitProps[];\n};\n\nexport type CalendarUnitProps = BoxProps & {\n /** Indicates if the calendar unit is part of a selected date range */\n selected?: boolean;\n /** Marks units from previous/next months that appear in the current month view */\n outdated?: boolean;\n /** Prevents interaction with the unit */\n disabled?: boolean;\n /** Highlights the current date */\n today?: boolean;\n /** Marks the beginning of a selected date range */\n startSelected?: boolean;\n /** Marks the end of a selected date range */\n endSelected?: boolean;\n /** Shows preview highlighting during range selection */\n highlighted?: boolean;\n /** Marks the start of a highlighted range */\n startHighlighted?: boolean;\n /** Marks the end of a highlighted range */\n endHighlighted?: boolean;\n /** The actual Date object this unit represents */\n date?: Date;\n /** Content to display within the unit (typically the day number) */\n children?: React.ReactNode;\n};\n\nexport type CalendarContext = {\n getUnitProps: PropGetterFn;\n};\n\ndeclare const Calendar: Intergalactic.Component<\n 'div',\n CalendarProps,\n CalendarContext & CalendarDaysContext,\n [handlers: AbstractDatePickerHandlers]\n> & {\n Unit: Intergalactic.Component<'div', CalendarUnitProps>;\n};\n\nexport type DatePickerProps = Intergalactic.InternalTypings.EfficientOmit<\n DropdownProps,\n 'disabled'\n> &\nWithI18nEnhanceProps & {\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n value?: DateConstructorParams;\n /**\n * To be activated upon selecting the date\n * */\n onChange?: (date: Date) => void;\n /**\n * Array of dates blocked for selection\n * */\n disabled?: (DateConstructorParams | (DateConstructorParams | false)[] | string)[];\n /**\n * Error message when user attempts to input a disabled date\n * */\n disabledErrorText?: ((attemptedDate: Date) => string) | string | null;\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: DateConstructorParams;\n /**\n * To be activated upon changing the current shown month\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * Component size\n * @default m\n */\n size?: 'm' | 'l';\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n highlighted?: DateConstructorParams[];\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultValue?: DateConstructorParams;\n /**\n * Default value date for showing the necessary month\n * */\n defaultDisplayedPeriod?: DateConstructorParams;\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultHighlighted?: DateConstructorParams[];\n};\n\nexport type DateRangePickerProps = Intergalactic.InternalTypings.EfficientOmit<\n DropdownProps,\n 'disabled'\n> &\nWithI18nEnhanceProps & {\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n value?: DateConstructorParams[];\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultValue?: DateConstructorParams[];\n /**\n * Default value date for showing the necessary month\n * */\n defaultDisplayedPeriod?: DateConstructorParams;\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultHighlighted?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onChange?: (date: Date[]) => void;\n /**\n * Array of dates blocked for selection\n * */\n disabled?: (DateConstructorParams | (DateConstructorParams | false)[] | string)[];\n /**\n * Error message when user attempts to input a disabled date\n * */\n disabledErrorText?: ((attemptedDate: Date) => string) | string | null;\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: DateConstructorParams;\n /**\n * To be activated upon changing the current shown month\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n highlighted?: DateConstructorParams[];\n /**\n * Remove the 'Reset' button\n * */\n unclearable?: boolean;\n /**\n * To be activated upon selecting the date\n * */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * Intermediate value between `highlighted` and `value` that user see before explicitly applying it.\n */\n preselectedValue?: DateConstructorParams[];\n /**\n * Normally called when user preselects a date range and when user applies this range.\n */\n onPreselectedValueChange?: (date: Date[]) => void;\n /**\n * Array of periods\n * [{value: [new Date(), new Date()], children: \"Today\"}]\n * @default Past 2 days / Past week / Past 2 week / Past month / Past 2 month\n * */\n periods?: (ButtonProps & { value: Date[] })[];\n};\n\nexport type DateRangePickerPeriodProps = BoxProps & {\n /**\n * Current selected period\n * */\n value?: DateConstructorParams[];\n /**\n * To be activated by clicking the button for switching the selected period.\n * */\n onChange?: (date: Date[]) => void;\n /**\n * To be activated by hovering a cursor over the button for changing the current displayed month.\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * To be activated by hovering a cursor over the button for selecting the dates.\n * */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * Array of periods\n * [{value: [new Date(), new Date()], children: \"Today\"}]\n * @default Past 2 days / Past week / Past 2 week / Past month / Past 2 month\n * */\n periods?: (ButtonProps & { value: Date[] })[];\n};\n\nexport type DatePickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getTodayProps: PropGetterFn;\n};\n\nexport type AbstractDatePickerHandlers = {\n displayedPeriod: (value: DateConstructorParams) => void;\n visible: (index: boolean) => void;\n highlighted: (list: DateConstructorParams[]) => void;\n value: (index: DateConstructorParams) => void;\n};\n\nexport type DatePickerHandlers = {\n visible: (index: boolean) => void;\n};\n\nexport type BaseInputTriggerProps = InputProps &\n TooltipProps & {\n /**\n * Date input placeholder characters\n * @default { year: 'Y'; month: 'M'; day: 'D' }\n */\n placeholders?: { year: string; month: string; day: string };\n locale?: string;\n onDisplayedPeriodChange?: (date: Date) => void;\n };\nexport type InputTriggerProps = BaseInputTriggerProps & {\n value?: Date;\n onChange?: (date: Date, event: ChangeEvent) => void;\n /** @deprecated Set `disabledErrorText={null}` on the picker Root instead */\n showError?: boolean;\n};\n\nexport type RangeInputTriggerProps = BaseInputTriggerProps & {\n value?: Date[];\n onChange?: (date: Date[], event: ChangeEvent) => void;\n};\n\nexport type SingleDateInputProps = InputTriggerProps & {};\n\nexport type DateRangeProps = RangeInputTriggerProps & {};\n\nexport type DatePickerMaskedInputProps = {\n date?: Date;\n onDateChange?: (date: Date, event: ChangeEvent) => void;\n onDisplayedPeriodChange?: (date: Date) => void;\n locale?: string;\n parts?: { year: boolean; month: boolean; day: boolean };\n disabledDates?: (Date | (Date | false)[] | string)[];\n};\n\ndeclare const InputTrigger: Intergalactic.Component<\n 'div',\n DropdownTriggerProps & InputTriggerProps\n> & {\n Addon: typeof Input.Addon;\n Value: typeof Input.Value;\n SingleDateInput: Intergalactic.Component<'div', InputProps & SingleDateInputProps> & {\n Indicator: typeof Input.Addon;\n MaskedInput: Intergalactic.Component<'input', InputMaskValueProps & DatePickerMaskedInputProps>;\n };\n};\n\ndeclare const RangeInputTrigger: Intergalactic.Component<\n 'div',\n DropdownTriggerProps & RangeInputTriggerProps\n> & {\n Addon: typeof Input.Addon;\n Value: typeof Input.Value;\n DateRange: Intergalactic.Component<'div', InputValueProps & DateRangeProps> & {\n Indicator: typeof Input.Addon;\n RangeSep: typeof Input.Addon;\n FromMaskedInput: Intergalactic.Component<\n 'input',\n InputMaskValueProps & DatePickerMaskedInputProps\n >;\n ToMaskedInput: Intergalactic.Component<\n 'input',\n InputMaskValueProps & DatePickerMaskedInputProps\n >;\n };\n};\n\ndeclare const DatePicker: Intergalactic.Component<\n 'div',\n DatePickerProps,\n DatePickerContext & CalendarDaysContext\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof InputTrigger;\n Popper: typeof Popper.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DatePickerProps, DatePickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Today: typeof Box;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\nexport type DateRangePickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getPeriodProps: PropGetterFn;\n};\n\ndeclare const DateRangePicker: Intergalactic.Component<\n 'div',\n DateRangePickerProps,\n DateRangePickerContext & CalendarDaysContext,\n [handlers: DatePickerHandlers]\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof RangeInputTrigger;\n Popper: typeof Popper.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DateRangePickerProps, DateRangePickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Period: Intergalactic.Component<'div', DateRangePickerPeriodProps>;\n Apply: typeof Button;\n Reset: typeof Button;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\nexport type MonthPickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n};\n\ndeclare const MonthPicker: Intergalactic.Component<\n 'div',\n DatePickerProps,\n MonthPickerContext & CalendarMonthsContext,\n [handlers: DatePickerHandlers]\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof InputTrigger;\n Popper: typeof Popper.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DatePickerProps, MonthPickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\nexport type MonthRangePickerContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getPeriodProps: PropGetterFn;\n};\n\ndeclare const MonthRangePicker: Intergalactic.Component<\n 'div',\n DateRangePickerProps,\n MonthRangePickerContext & CalendarMonthsContext,\n [handlers: DatePickerHandlers]\n> & {\n /** @deprecated `DatePicker.ButtonTrigger` is deprecated, consider migrating to `DatePicker.Trigger` instead */\n ButtonTrigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n Trigger: typeof RangeInputTrigger;\n Popper: typeof Popper.Popper;\n Header: typeof Box;\n Title: Intergalactic.Component<'div', DateRangePickerProps, MonthRangePickerContext>;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Period: Intergalactic.Component<'div', DateRangePickerPeriodProps>;\n Apply: typeof Button;\n Reset: typeof Button;\n add: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;\n};\n\nexport type DateRangeComparatorFocusRange = 'value' | 'compare';\nexport type DateRangeComparatorValue = {\n value?: DateConstructorParams[];\n compare?: DateConstructorParams[];\n};\n\nexport type DateRangeComparatorProps = Intergalactic.InternalTypings.EfficientOmit<\n DropdownProps,\n 'disabled'\n> &\nWithI18nEnhanceProps & {\n /**\n * Selected date ranges\n * */\n value?: DateRangeComparatorValue;\n /**\n * Default value for selected date ranges\n * */\n defaultValue?: DateRangeComparatorValue;\n /**\n * Default value date for showing the necessary month\n * */\n defaultDisplayedPeriod?: DateConstructorParams;\n /**\n * Default value selected date, accepts everything which is accepted by `new Date()`\n * */\n defaultHighlighted?: DateConstructorParams[];\n /**\n * Called with selected date when user clicks `Apply` button.\n * */\n onChange?: (ranges: {\n value?: DateConstructorParams[];\n compare?: DateConstructorParams[];\n }) => void;\n /**\n * Array of dates blocked for selection\n * */\n disabled?: (DateConstructorParams | (DateConstructorParams | false)[] | string)[];\n /**\n * Error message when user attempts to input a disabled date\n * */\n disabledErrorText?: ((attemptedDate: Date) => string) | string | null;\n /**\n * Date for showing the necessary month\n * @default new Date()\n * */\n displayedPeriod?: DateConstructorParams;\n /**\n * To be activated upon changing the current shown month\n * */\n onDisplayedPeriodChange?: (date: Date) => void;\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n highlighted?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onHighlightedChange?: (date: Date[]) => void;\n /**\n * The selected date, accepts everything which is accepted by `new Date()`\n * */\n compareHighlighted?: DateConstructorParams[];\n /**\n * To be activated upon selecting the date\n * */\n onCompareHighlightedChange?: (date: Date[]) => void;\n /**\n * Intermediate value between `highlighted` and `value` that user see before explicitly applying it.\n */\n preselectedValue?: DateConstructorParams[];\n /**\n * Normally called when user preselects a date range and when user applies this range.\n */\n onPreselectedValueChange?: (date: Date[]) => void;\n /**\n * Intermediate value between `compareHighlighted` and `compare` that user see before explicitly applying it.\n */\n preselectedCompare?: DateConstructorParams[];\n /**\n * Normally called when user preselects a compare range and when user applies ranges.\n */\n onPreselectedCompareChange?: (date: Date[]) => void;\n /**\n * Controls that compare range input is enabled.\n */\n compareToggle?: boolean;\n /**\n * Toggles when compare range input enables or disables.\n */\n onCompareToggleChange?: (compareToggle: boolean) => void;\n /**\n * Controls which date range is focused.\n */\n focusedRange?: DateRangeComparatorFocusRange;\n /**\n * Called when user focuses or is focused on some of the date ranges.\n */\n onFocusedRangeChange?: (focusedRange: DateRangeComparatorFocusRange) => void;\n /**\n * Remove the 'Reset' button\n * */\n unclearable?: boolean;\n /**\n * Array of periods\n * [{value: [new Date(), new Date()], children: \"Today\"}]\n * @default Past 2 days / Past week / Past 2 week / Past month / Past 2 month\n * */\n periods?: (ButtonProps & { value: Date[] })[];\n};\n\nexport type DateRangeComparatorContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n getHeaderProps: PropGetterFn;\n getTitleProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getCalendarProps: PropGetterFn;\n getPeriodProps: PropGetterFn;\n};\n\nexport type DateRangeComparatorTriggerProps = DropdownTriggerProps &\n BaseTriggerProps & {\n /**\n * Text between the selected date range and the compared date range when both are selected.\n * @default 'vs.'\n */\n separator?: string;\n /**\n * Trigger text when no ranges are selected.\n */\n placeholder?: string;\n };\n\ndeclare const DateRangeComparator: Intergalactic.Component<\n 'div',\n DateRangeComparatorProps,\n DateRangeComparatorContext & CalendarDaysContext\n> & {\n Popper: typeof Popper.Popper;\n Header: typeof Flex;\n Prev: typeof Button;\n Next: typeof Button;\n Calendar: typeof Calendar;\n Apply: typeof Button;\n Reset: typeof Button;\n\n CalendarHeader: typeof Box;\n Title: typeof Box;\n\n Trigger: Intergalactic.Component<'div', DropdownTriggerProps & BaseTriggerProps> & {\n Addon: typeof BaseTrigger.Addon;\n Text: typeof BaseTrigger.Text;\n };\n ValueDateRange: Intergalactic.Component<'div', InputTriggerProps>;\n CompareToggle: typeof Checkbox;\n CompareDateRange: Intergalactic.Component<'div', InputTriggerProps>;\n Body: typeof Flex;\n RangeCalendar: typeof Flex;\n Periods: typeof Flex & {\n Divider: typeof Divider;\n Column: typeof Flex;\n Options: typeof Flex;\n Controls: typeof Flex;\n };\n Footer: typeof Flex;\n};\n\ndeclare const MonthDateRangeComparator: typeof DateRangeComparator;\n\nexport {\n DatePicker,\n DateRangePicker,\n MonthPicker,\n MonthRangePicker,\n DateRangeComparator,\n MonthDateRangeComparator,\n};\n"],"mappings":"","ignoreList":[]}
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
@@ -15,38 +15,38 @@ var _exportNames = {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "DatePicker", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function
|
|
19
|
-
return _DatePicker
|
|
18
|
+
get: function () {
|
|
19
|
+
return _DatePicker.default;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports, "DateRangeComparator", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function
|
|
25
|
-
return _DateRangeComparator
|
|
24
|
+
get: function () {
|
|
25
|
+
return _DateRangeComparator.default;
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "DateRangePicker", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function
|
|
31
|
-
return _DateRangePicker
|
|
30
|
+
get: function () {
|
|
31
|
+
return _DateRangePicker.default;
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
Object.defineProperty(exports, "MonthDateRangeComparator", {
|
|
35
35
|
enumerable: true,
|
|
36
|
-
get: function
|
|
37
|
-
return _MonthDateRangeComparator
|
|
36
|
+
get: function () {
|
|
37
|
+
return _MonthDateRangeComparator.default;
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
Object.defineProperty(exports, "MonthPicker", {
|
|
41
41
|
enumerable: true,
|
|
42
|
-
get: function
|
|
43
|
-
return _MonthPicker
|
|
42
|
+
get: function () {
|
|
43
|
+
return _MonthPicker.default;
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
Object.defineProperty(exports, "MonthRangePicker", {
|
|
47
47
|
enumerable: true,
|
|
48
|
-
get: function
|
|
49
|
-
return _MonthRangePicker
|
|
48
|
+
get: function () {
|
|
49
|
+
return _MonthRangePicker.default;
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
var _DatePicker = _interopRequireWildcard(require("./DatePicker"));
|
|
@@ -56,7 +56,7 @@ Object.keys(_DatePicker).forEach(function (key) {
|
|
|
56
56
|
if (key in exports && exports[key] === _DatePicker[key]) return;
|
|
57
57
|
Object.defineProperty(exports, key, {
|
|
58
58
|
enumerable: true,
|
|
59
|
-
get: function
|
|
59
|
+
get: function () {
|
|
60
60
|
return _DatePicker[key];
|
|
61
61
|
}
|
|
62
62
|
});
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_DatePicker","_interopRequireWildcard","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_DateRangePicker","_interopRequireDefault","_DateRangeComparator","_MonthPicker","_MonthRangePicker","_MonthDateRangeComparator"],"sources":["../../src/index.js"],"sourcesContent":["export { default as DatePicker } from './DatePicker';\nexport * from './DatePicker';\n\nexport { default as DateRangePicker } from './DateRangePicker';\n\nexport { default as DateRangeComparator } from './DateRangeComparator';\n\nexport { default as MonthPicker } from './MonthPicker';\n\nexport { default as MonthRangePicker } from './MonthRangePicker';\n\nexport { default as MonthDateRangeComparator } from './MonthDateRangeComparator';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,uBAAA,CAAAC,OAAA;AACAC,MAAA,CAAAC,IAAA,CAAAJ,WAAA,EAAAK,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAN,WAAA,CAAAM,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["_DatePicker","_interopRequireWildcard","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_DateRangePicker","_interopRequireDefault","_DateRangeComparator","_MonthPicker","_MonthRangePicker","_MonthDateRangeComparator"],"sources":["../../src/index.js"],"sourcesContent":["export { default as DatePicker } from './DatePicker';\nexport * from './DatePicker';\n\nexport { default as DateRangePicker } from './DateRangePicker';\n\nexport { default as DateRangeComparator } from './DateRangeComparator';\n\nexport { default as MonthPicker } from './MonthPicker';\n\nexport { default as MonthRangePicker } from './MonthRangePicker';\n\nexport { default as MonthDateRangeComparator } from './MonthDateRangeComparator';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,uBAAA,CAAAC,OAAA;AACAC,MAAA,CAAAC,IAAA,CAAAJ,WAAA,EAAAK,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAN,WAAA,CAAAM,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAd,WAAA,CAAAM,GAAA;IAAA;EAAA;AAAA;AAEA,IAAAS,gBAAA,GAAAC,sBAAA,CAAAd,OAAA;AAEA,IAAAe,oBAAA,GAAAD,sBAAA,CAAAd,OAAA;AAEA,IAAAgB,YAAA,GAAAF,sBAAA,CAAAd,OAAA;AAEA,IAAAiB,iBAAA,GAAAH,sBAAA,CAAAd,OAAA;AAEA,IAAAkB,yBAAA,GAAAJ,sBAAA,CAAAd,OAAA","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -20,21 +20,21 @@ var _sv = _interopRequireDefault(require("./sv.json"));
|
|
|
20
20
|
var _tr = _interopRequireDefault(require("./tr.json"));
|
|
21
21
|
var _vi = _interopRequireDefault(require("./vi.json"));
|
|
22
22
|
var _zh = _interopRequireDefault(require("./zh.json"));
|
|
23
|
-
|
|
24
|
-
de: _de
|
|
25
|
-
en: _en
|
|
26
|
-
es: _es
|
|
27
|
-
fr: _fr
|
|
28
|
-
it: _it
|
|
29
|
-
ja: _ja
|
|
30
|
-
ko: _ko
|
|
31
|
-
nl: _nl
|
|
32
|
-
pt: _pt
|
|
33
|
-
ru: _ru
|
|
34
|
-
tr: _tr
|
|
35
|
-
vi: _vi
|
|
36
|
-
zh: _zh
|
|
37
|
-
pl: _pl
|
|
38
|
-
sv: _sv
|
|
23
|
+
const localizedMessages = exports.localizedMessages = {
|
|
24
|
+
de: _de.default,
|
|
25
|
+
en: _en.default,
|
|
26
|
+
es: _es.default,
|
|
27
|
+
fr: _fr.default,
|
|
28
|
+
it: _it.default,
|
|
29
|
+
ja: _ja.default,
|
|
30
|
+
ko: _ko.default,
|
|
31
|
+
nl: _nl.default,
|
|
32
|
+
pt: _pt.default,
|
|
33
|
+
ru: _ru.default,
|
|
34
|
+
tr: _tr.default,
|
|
35
|
+
vi: _vi.default,
|
|
36
|
+
zh: _zh.default,
|
|
37
|
+
pl: _pl.default,
|
|
38
|
+
sv: _sv.default
|
|
39
39
|
};
|
|
40
40
|
//# sourceMappingURL=__intergalactic-dynamic-locales.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"__intergalactic-dynamic-locales.js","names":["_de","_interopRequireDefault","require","_en","_es","_fr","_it","_ja","_ko","_nl","_pl","_pt","_ru","_sv","_tr","_vi","_zh","localizedMessages","exports","de","en","es","fr","it","ja","ko","nl","pt","ru","tr","vi","zh","pl","sv"],"sources":["../../../src/translations/__intergalactic-dynamic-locales.ts"],"sourcesContent":["import de from './de.json';\nimport en from './en.json';\nimport es from './es.json';\nimport fr from './fr.json';\nimport it from './it.json';\nimport ja from './ja.json';\nimport ko from './ko.json';\nimport nl from './nl.json';\nimport pl from './pl.json';\nimport pt from './pt.json';\nimport ru from './ru.json';\nimport sv from './sv.json';\nimport tr from './tr.json';\nimport vi from './vi.json';\nimport zh from './zh.json';\n\nexport const localizedMessages = {\n de,\n en,\n es,\n fr,\n it,\n ja,\n ko,\n nl,\n pt,\n ru,\n tr,\n vi,\n zh,\n pl,\n sv,\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,GAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,GAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,GAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,GAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,GAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,GAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,GAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,GAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,GAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,GAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,GAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,GAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,GAAA,GAAAf,sBAAA,CAAAC,OAAA;AAEO,
|
|
1
|
+
{"version":3,"file":"__intergalactic-dynamic-locales.js","names":["_de","_interopRequireDefault","require","_en","_es","_fr","_it","_ja","_ko","_nl","_pl","_pt","_ru","_sv","_tr","_vi","_zh","localizedMessages","exports","de","en","es","fr","it","ja","ko","nl","pt","ru","tr","vi","zh","pl","sv"],"sources":["../../../src/translations/__intergalactic-dynamic-locales.ts"],"sourcesContent":["import de from './de.json';\nimport en from './en.json';\nimport es from './es.json';\nimport fr from './fr.json';\nimport it from './it.json';\nimport ja from './ja.json';\nimport ko from './ko.json';\nimport nl from './nl.json';\nimport pl from './pl.json';\nimport pt from './pt.json';\nimport ru from './ru.json';\nimport sv from './sv.json';\nimport tr from './tr.json';\nimport vi from './vi.json';\nimport zh from './zh.json';\n\nexport const localizedMessages = {\n de,\n en,\n es,\n fr,\n it,\n ja,\n ko,\n nl,\n pt,\n ru,\n tr,\n vi,\n zh,\n pl,\n sv,\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,GAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,GAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,GAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,GAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,GAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,GAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,GAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,GAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,GAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,GAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,GAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,GAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,GAAA,GAAAf,sBAAA,CAAAC,OAAA;AAEO,MAAMe,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG;EAC/BE,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA,WAAE;EACFC,EAAE,EAAFA;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.isInPeriod = isInPeriod;
|
|
8
7
|
exports.isValidSchedule = isValidSchedule;
|
|
9
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
8
|
function cronUnitToArray(unit) {
|
|
11
9
|
if (unit.includes('-')) {
|
|
12
|
-
|
|
13
|
-
_unit$split2 = (0, _slicedToArray2["default"])(_unit$split, 2),
|
|
14
|
-
start = _unit$split2[0],
|
|
15
|
-
end = _unit$split2[1];
|
|
10
|
+
const [start, end] = unit.split('-');
|
|
16
11
|
return Array.from({
|
|
17
12
|
length: Number.parseInt(end, 10) - Number.parseInt(start, 10) + 1
|
|
18
|
-
},
|
|
19
|
-
return Number.parseInt(start, 10) + idx;
|
|
20
|
-
});
|
|
13
|
+
}, (_, idx) => Number.parseInt(start, 10) + idx);
|
|
21
14
|
}
|
|
22
15
|
// eslint-disable-next-line no-useless-escape
|
|
23
16
|
return unit.split(/[,\/]/);
|
|
@@ -25,10 +18,10 @@ function cronUnitToArray(unit) {
|
|
|
25
18
|
function isValidSchedule(pattern) {
|
|
26
19
|
if (typeof pattern !== 'string') return false;
|
|
27
20
|
function isValidUnit(unit, min, max) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return unitValues.every(
|
|
31
|
-
|
|
21
|
+
const unitValues = cronUnitToArray(unit);
|
|
22
|
+
const CRON_REG = /^\d+$|^\*$|^\*\/\d+$/;
|
|
23
|
+
return unitValues.every(item => {
|
|
24
|
+
const intItem = Number.parseInt(item, 10);
|
|
32
25
|
return !(intItem < min || intItem > max || !CRON_REG.test(item));
|
|
33
26
|
});
|
|
34
27
|
}
|
|
@@ -45,12 +38,12 @@ function isValidSchedule(pattern) {
|
|
|
45
38
|
if (validateFn(pattern)) return true;
|
|
46
39
|
|
|
47
40
|
// eslint-disable-next-line no-console
|
|
48
|
-
console.warn(
|
|
41
|
+
console.warn(`DatePicker disabledSchedule: ${msg} format is invalid`);
|
|
49
42
|
return false;
|
|
50
43
|
}
|
|
51
|
-
|
|
44
|
+
const patternArr = pattern.split(' ');
|
|
52
45
|
if (patternArr.length < 3) return false;
|
|
53
|
-
return patternArr.every(
|
|
46
|
+
return patternArr.every((pattern, idx) => {
|
|
54
47
|
switch (idx) {
|
|
55
48
|
case 0:
|
|
56
49
|
return validate(pattern, isValidMonthDay, 'day of month');
|
|
@@ -64,7 +57,7 @@ function isValidSchedule(pattern) {
|
|
|
64
57
|
});
|
|
65
58
|
}
|
|
66
59
|
function isInPeriod(pattern, date) {
|
|
67
|
-
|
|
60
|
+
const patternArr = pattern.split(' ');
|
|
68
61
|
function isInPeriod(date, period, dateMethod) {
|
|
69
62
|
if (period === '*') return true;
|
|
70
63
|
return date[dateMethod]() === Number.parseInt(period, 10);
|
|
@@ -80,12 +73,10 @@ function isInPeriod(pattern, date) {
|
|
|
80
73
|
return isInPeriod(date, period, 'getDay');
|
|
81
74
|
}
|
|
82
75
|
function test(units, date, testFn) {
|
|
83
|
-
return units.some(
|
|
84
|
-
return testFn(date, unit);
|
|
85
|
-
});
|
|
76
|
+
return units.some(unit => testFn(date, unit));
|
|
86
77
|
}
|
|
87
|
-
return patternArr.every(
|
|
88
|
-
|
|
78
|
+
return patternArr.every((unit, idx) => {
|
|
79
|
+
const unitValues = cronUnitToArray(unit);
|
|
89
80
|
switch (idx) {
|
|
90
81
|
case 0:
|
|
91
82
|
return test(unitValues, date, monthDayInPeriod);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cronTabScheduler.js","names":["cronUnitToArray","unit","includes","
|
|
1
|
+
{"version":3,"file":"cronTabScheduler.js","names":["cronUnitToArray","unit","includes","start","end","split","Array","from","length","Number","parseInt","_","idx","isValidSchedule","pattern","isValidUnit","min","max","unitValues","CRON_REG","every","item","intItem","test","isValidMonth","month","isValidWeekDay","weekDay","isValidMonthDay","monthDay","validate","validateFn","msg","console","warn","patternArr","isInPeriod","date","period","dateMethod","monthInPeriod","monthDayInPeriod","weekDayInPeriod","units","testFn","some"],"sources":["../../../src/utils/cronTabScheduler.js"],"sourcesContent":["function cronUnitToArray(unit) {\n if (unit.includes('-')) {\n const [start, end] = unit.split('-');\n return Array.from(\n { length: Number.parseInt(end, 10) - Number.parseInt(start, 10) + 1 },\n (_, idx) => Number.parseInt(start, 10) + idx,\n );\n }\n // eslint-disable-next-line no-useless-escape\n return unit.split(/[,\\/]/);\n}\n\nexport function isValidSchedule(pattern) {\n if (typeof pattern !== 'string') return false;\n\n function isValidUnit(unit, min, max) {\n const unitValues = cronUnitToArray(unit);\n const CRON_REG = /^\\d+$|^\\*$|^\\*\\/\\d+$/;\n return unitValues.every((item) => {\n const intItem = Number.parseInt(item, 10);\n return !(intItem < min || intItem > max || !CRON_REG.test(item));\n });\n }\n\n function isValidMonth(month) {\n return isValidUnit(month, 1, 12);\n }\n\n function isValidWeekDay(weekDay) {\n return isValidUnit(weekDay, 1, 7);\n }\n\n function isValidMonthDay(monthDay) {\n return isValidUnit(monthDay, 1, 31);\n }\n\n function validate(pattern, validateFn, msg) {\n if (validateFn(pattern)) return true;\n\n // eslint-disable-next-line no-console\n console.warn(`DatePicker disabledSchedule: ${msg} format is invalid`);\n return false;\n }\n\n const patternArr = pattern.split(' ');\n\n if (patternArr.length < 3) return false;\n\n return patternArr.every((pattern, idx) => {\n switch (idx) {\n case 0:\n return validate(pattern, isValidMonthDay, 'day of month');\n case 1:\n return validate(pattern, isValidMonth, 'month');\n case 2:\n return validate(pattern, isValidWeekDay, 'day of week');\n default:\n return false;\n }\n });\n}\n\nexport function isInPeriod(pattern, date) {\n const patternArr = pattern.split(' ');\n\n function isInPeriod(date, period, dateMethod) {\n if (period === '*') return true;\n return date[dateMethod]() === Number.parseInt(period, 10);\n }\n\n function monthInPeriod(date, period) {\n return isInPeriod(date, period, 'getMonth');\n }\n\n function monthDayInPeriod(date, period) {\n return isInPeriod(date, period, 'getDate');\n }\n\n function weekDayInPeriod(date, period) {\n if (period === 7) period = 0;\n return isInPeriod(date, period, 'getDay');\n }\n\n function test(units, date, testFn) {\n return units.some((unit) => testFn(date, unit));\n }\n\n return patternArr.every((unit, idx) => {\n const unitValues = cronUnitToArray(unit);\n switch (idx) {\n case 0:\n return test(unitValues, date, monthDayInPeriod);\n case 1:\n return test(unitValues, date, monthInPeriod);\n case 2:\n return test(unitValues, date, weekDayInPeriod);\n default:\n return false;\n }\n });\n}\n"],"mappings":";;;;;;;AAAA,SAASA,eAAeA,CAACC,IAAI,EAAE;EAC7B,IAAIA,IAAI,CAACC,QAAQ,CAAC,GAAG,CAAC,EAAE;IACtB,MAAM,CAACC,KAAK,EAAEC,GAAG,CAAC,GAAGH,IAAI,CAACI,KAAK,CAAC,GAAG,CAAC;IACpC,OAAOC,KAAK,CAACC,IAAI,CACf;MAAEC,MAAM,EAAEC,MAAM,CAACC,QAAQ,CAACN,GAAG,EAAE,EAAE,CAAC,GAAGK,MAAM,CAACC,QAAQ,CAACP,KAAK,EAAE,EAAE,CAAC,GAAG;IAAE,CAAC,EACrE,CAACQ,CAAC,EAAEC,GAAG,KAAKH,MAAM,CAACC,QAAQ,CAACP,KAAK,EAAE,EAAE,CAAC,GAAGS,GAC3C,CAAC;EACH;EACA;EACA,OAAOX,IAAI,CAACI,KAAK,CAAC,OAAO,CAAC;AAC5B;AAEO,SAASQ,eAAeA,CAACC,OAAO,EAAE;EACvC,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE,OAAO,KAAK;EAE7C,SAASC,WAAWA,CAACd,IAAI,EAAEe,GAAG,EAAEC,GAAG,EAAE;IACnC,MAAMC,UAAU,GAAGlB,eAAe,CAACC,IAAI,CAAC;IACxC,MAAMkB,QAAQ,GAAG,sBAAsB;IACvC,OAAOD,UAAU,CAACE,KAAK,CAAEC,IAAI,IAAK;MAChC,MAAMC,OAAO,GAAGb,MAAM,CAACC,QAAQ,CAACW,IAAI,EAAE,EAAE,CAAC;MACzC,OAAO,EAAEC,OAAO,GAAGN,GAAG,IAAIM,OAAO,GAAGL,GAAG,IAAI,CAACE,QAAQ,CAACI,IAAI,CAACF,IAAI,CAAC,CAAC;IAClE,CAAC,CAAC;EACJ;EAEA,SAASG,YAAYA,CAACC,KAAK,EAAE;IAC3B,OAAOV,WAAW,CAACU,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;EAClC;EAEA,SAASC,cAAcA,CAACC,OAAO,EAAE;IAC/B,OAAOZ,WAAW,CAACY,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;EACnC;EAEA,SAASC,eAAeA,CAACC,QAAQ,EAAE;IACjC,OAAOd,WAAW,CAACc,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;EACrC;EAEA,SAASC,QAAQA,CAAChB,OAAO,EAAEiB,UAAU,EAAEC,GAAG,EAAE;IAC1C,IAAID,UAAU,CAACjB,OAAO,CAAC,EAAE,OAAO,IAAI;;IAEpC;IACAmB,OAAO,CAACC,IAAI,CAAC,gCAAgCF,GAAG,oBAAoB,CAAC;IACrE,OAAO,KAAK;EACd;EAEA,MAAMG,UAAU,GAAGrB,OAAO,CAACT,KAAK,CAAC,GAAG,CAAC;EAErC,IAAI8B,UAAU,CAAC3B,MAAM,GAAG,CAAC,EAAE,OAAO,KAAK;EAEvC,OAAO2B,UAAU,CAACf,KAAK,CAAC,CAACN,OAAO,EAAEF,GAAG,KAAK;IACxC,QAAQA,GAAG;MACT,KAAK,CAAC;QACJ,OAAOkB,QAAQ,CAAChB,OAAO,EAAEc,eAAe,EAAE,cAAc,CAAC;MAC3D,KAAK,CAAC;QACJ,OAAOE,QAAQ,CAAChB,OAAO,EAAEU,YAAY,EAAE,OAAO,CAAC;MACjD,KAAK,CAAC;QACJ,OAAOM,QAAQ,CAAChB,OAAO,EAAEY,cAAc,EAAE,aAAa,CAAC;MACzD;QACE,OAAO,KAAK;IAChB;EACF,CAAC,CAAC;AACJ;AAEO,SAASU,UAAUA,CAACtB,OAAO,EAAEuB,IAAI,EAAE;EACxC,MAAMF,UAAU,GAAGrB,OAAO,CAACT,KAAK,CAAC,GAAG,CAAC;EAErC,SAAS+B,UAAUA,CAACC,IAAI,EAAEC,MAAM,EAAEC,UAAU,EAAE;IAC5C,IAAID,MAAM,KAAK,GAAG,EAAE,OAAO,IAAI;IAC/B,OAAOD,IAAI,CAACE,UAAU,CAAC,CAAC,CAAC,KAAK9B,MAAM,CAACC,QAAQ,CAAC4B,MAAM,EAAE,EAAE,CAAC;EAC3D;EAEA,SAASE,aAAaA,CAACH,IAAI,EAAEC,MAAM,EAAE;IACnC,OAAOF,UAAU,CAACC,IAAI,EAAEC,MAAM,EAAE,UAAU,CAAC;EAC7C;EAEA,SAASG,gBAAgBA,CAACJ,IAAI,EAAEC,MAAM,EAAE;IACtC,OAAOF,UAAU,CAACC,IAAI,EAAEC,MAAM,EAAE,SAAS,CAAC;EAC5C;EAEA,SAASI,eAAeA,CAACL,IAAI,EAAEC,MAAM,EAAE;IACrC,IAAIA,MAAM,KAAK,CAAC,EAAEA,MAAM,GAAG,CAAC;IAC5B,OAAOF,UAAU,CAACC,IAAI,EAAEC,MAAM,EAAE,QAAQ,CAAC;EAC3C;EAEA,SAASf,IAAIA,CAACoB,KAAK,EAAEN,IAAI,EAAEO,MAAM,EAAE;IACjC,OAAOD,KAAK,CAACE,IAAI,CAAE5C,IAAI,IAAK2C,MAAM,CAACP,IAAI,EAAEpC,IAAI,CAAC,CAAC;EACjD;EAEA,OAAOkC,UAAU,CAACf,KAAK,CAAC,CAACnB,IAAI,EAAEW,GAAG,KAAK;IACrC,MAAMM,UAAU,GAAGlB,eAAe,CAACC,IAAI,CAAC;IACxC,QAAQW,GAAG;MACT,KAAK,CAAC;QACJ,OAAOW,IAAI,CAACL,UAAU,EAAEmB,IAAI,EAAEI,gBAAgB,CAAC;MACjD,KAAK,CAAC;QACJ,OAAOlB,IAAI,CAACL,UAAU,EAAEmB,IAAI,EAAEG,aAAa,CAAC;MAC9C,KAAK,CAAC;QACJ,OAAOjB,IAAI,CAACL,UAAU,EAAEmB,IAAI,EAAEK,eAAe,CAAC;MAChD;QACE,OAAO,KAAK;IAChB;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1,29 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.datesIntersects = void 0;
|
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
8
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
10
9
|
var _cronTabScheduler = require("./cronTabScheduler");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
dateTo
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return dateFrom && (0, _dayjs["default"])(dateFrom).isBetween(start || -MAX_DATE_TIMESTAMP, end || MAX_DATE_TIMESTAMP, unit, '[]') || dateTo && (0, _dayjs["default"])(dateTo).isBetween(start || -MAX_DATE_TIMESTAMP, end || MAX_DATE_TIMESTAMP, unit, '[]') || dateFrom && dateTo && (0, _dayjs["default"])(start).isBetween((0, _dayjs["default"])(dateFrom), (0, _dayjs["default"])(dateTo), unit, '[]') || dateFrom && dateTo && (0, _dayjs["default"])(end).isBetween((0, _dayjs["default"])(dateFrom), (0, _dayjs["default"])(dateTo), unit, '[]');
|
|
22
|
-
}
|
|
23
|
-
if ((0, _cronTabScheduler.isValidSchedule)(disabled_day)) {
|
|
24
|
-
return (0, _cronTabScheduler.isInPeriod)(disabled_day, dateFrom) || (0, _cronTabScheduler.isInPeriod)(disabled_day, dateTo);
|
|
25
|
-
}
|
|
26
|
-
return dateFrom && dateTo && (0, _dayjs["default"])(disabled_day).isBetween((0, _dayjs["default"])(dateFrom), (0, _dayjs["default"])(dateTo), unit, '[]');
|
|
27
|
-
};
|
|
10
|
+
const MAX_DATE_TIMESTAMP = 8640000000000000;
|
|
11
|
+
const datesIntersects = ([dateFrom, dateTo], unit) => disabled_day => {
|
|
12
|
+
if (Array.isArray(disabled_day)) {
|
|
13
|
+
const [start, end] = disabled_day;
|
|
14
|
+
return dateFrom && (0, _dayjs.default)(dateFrom).isBetween(start || -MAX_DATE_TIMESTAMP, end || MAX_DATE_TIMESTAMP, unit, '[]') || dateTo && (0, _dayjs.default)(dateTo).isBetween(start || -MAX_DATE_TIMESTAMP, end || MAX_DATE_TIMESTAMP, unit, '[]') || dateFrom && dateTo && (0, _dayjs.default)(start).isBetween((0, _dayjs.default)(dateFrom), (0, _dayjs.default)(dateTo), unit, '[]') || dateFrom && dateTo && (0, _dayjs.default)(end).isBetween((0, _dayjs.default)(dateFrom), (0, _dayjs.default)(dateTo), unit, '[]');
|
|
15
|
+
}
|
|
16
|
+
if ((0, _cronTabScheduler.isValidSchedule)(disabled_day)) {
|
|
17
|
+
return (0, _cronTabScheduler.isInPeriod)(disabled_day, dateFrom) || (0, _cronTabScheduler.isInPeriod)(disabled_day, dateTo);
|
|
18
|
+
}
|
|
19
|
+
return dateFrom && dateTo && (0, _dayjs.default)(disabled_day).isBetween((0, _dayjs.default)(dateFrom), (0, _dayjs.default)(dateTo), unit, '[]');
|
|
28
20
|
};
|
|
21
|
+
exports.datesIntersects = datesIntersects;
|
|
29
22
|
//# sourceMappingURL=datesIntersects.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datesIntersects.js","names":["_dayjs","_interopRequireDefault","require","_cronTabScheduler","MAX_DATE_TIMESTAMP","datesIntersects","
|
|
1
|
+
{"version":3,"file":"datesIntersects.js","names":["_dayjs","_interopRequireDefault","require","_cronTabScheduler","MAX_DATE_TIMESTAMP","datesIntersects","dateFrom","dateTo","unit","disabled_day","Array","isArray","start","end","dayjs","isBetween","isValidSchedule","isInPeriod","exports"],"sources":["../../../src/utils/datesIntersects.js"],"sourcesContent":["import dayjs from 'dayjs';\n\nimport { isInPeriod, isValidSchedule } from './cronTabScheduler';\n\nconst MAX_DATE_TIMESTAMP = 8640000000000000;\n\nexport const datesIntersects =\n ([dateFrom, dateTo], unit) =>\n (disabled_day) => {\n if (Array.isArray(disabled_day)) {\n const [start, end] = disabled_day;\n\n return (\n (dateFrom &&\n dayjs(dateFrom).isBetween(\n start || -MAX_DATE_TIMESTAMP,\n end || MAX_DATE_TIMESTAMP,\n unit,\n '[]',\n )) ||\n (dateTo &&\n dayjs(dateTo).isBetween(\n start || -MAX_DATE_TIMESTAMP,\n end || MAX_DATE_TIMESTAMP,\n unit,\n '[]',\n )) ||\n (dateFrom &&\n dateTo &&\n dayjs(start).isBetween(dayjs(dateFrom), dayjs(dateTo), unit, '[]')) ||\n (dateFrom && dateTo && dayjs(end).isBetween(dayjs(dateFrom), dayjs(dateTo), unit, '[]'))\n );\n }\n if (isValidSchedule(disabled_day)) {\n return isInPeriod(disabled_day, dateFrom) || isInPeriod(disabled_day, dateTo);\n }\n return (\n dateFrom &&\n dateTo &&\n dayjs(disabled_day).isBetween(dayjs(dateFrom), dayjs(dateTo), unit, '[]')\n );\n };\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAD,OAAA;AAEA,MAAME,kBAAkB,GAAG,gBAAgB;AAEpC,MAAMC,eAAe,GAC1BA,CAAC,CAACC,QAAQ,EAAEC,MAAM,CAAC,EAAEC,IAAI,KACtBC,YAAY,IAAK;EAChB,IAAIC,KAAK,CAACC,OAAO,CAACF,YAAY,CAAC,EAAE;IAC/B,MAAM,CAACG,KAAK,EAAEC,GAAG,CAAC,GAAGJ,YAAY;IAEjC,OACGH,QAAQ,IACP,IAAAQ,cAAK,EAACR,QAAQ,CAAC,CAACS,SAAS,CACvBH,KAAK,IAAI,CAACR,kBAAkB,EAC5BS,GAAG,IAAIT,kBAAkB,EACzBI,IAAI,EACJ,IACF,CAAC,IACAD,MAAM,IACL,IAAAO,cAAK,EAACP,MAAM,CAAC,CAACQ,SAAS,CACrBH,KAAK,IAAI,CAACR,kBAAkB,EAC5BS,GAAG,IAAIT,kBAAkB,EACzBI,IAAI,EACJ,IACF,CAAE,IACDF,QAAQ,IACPC,MAAM,IACN,IAAAO,cAAK,EAACF,KAAK,CAAC,CAACG,SAAS,CAAC,IAAAD,cAAK,EAACR,QAAQ,CAAC,EAAE,IAAAQ,cAAK,EAACP,MAAM,CAAC,EAAEC,IAAI,EAAE,IAAI,CAAE,IAClEF,QAAQ,IAAIC,MAAM,IAAI,IAAAO,cAAK,EAACD,GAAG,CAAC,CAACE,SAAS,CAAC,IAAAD,cAAK,EAACR,QAAQ,CAAC,EAAE,IAAAQ,cAAK,EAACP,MAAM,CAAC,EAAEC,IAAI,EAAE,IAAI,CAAE;EAElG;EACA,IAAI,IAAAQ,iCAAe,EAACP,YAAY,CAAC,EAAE;IACjC,OAAO,IAAAQ,4BAAU,EAACR,YAAY,EAAEH,QAAQ,CAAC,IAAI,IAAAW,4BAAU,EAACR,YAAY,EAAEF,MAAM,CAAC;EAC/E;EACA,OACED,QAAQ,IACRC,MAAM,IACN,IAAAO,cAAK,EAACL,YAAY,CAAC,CAACM,SAAS,CAAC,IAAAD,cAAK,EAACR,QAAQ,CAAC,EAAE,IAAAQ,cAAK,EAACP,MAAM,CAAC,EAAEC,IAAI,EAAE,IAAI,CAAC;AAE7E,CAAC;AAACU,OAAA,CAAAb,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.formatMMYY = exports.formatDDMMYY = void 0;
|
|
8
8
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const DDMMYYFormattersCache = {};
|
|
10
|
+
const formatDDMMYY = (date, locale) => {
|
|
11
11
|
if (DDMMYYFormattersCache[locale] === undefined) {
|
|
12
12
|
DDMMYYFormattersCache[locale] = new Intl.DateTimeFormat(locale, {
|
|
13
13
|
day: 'numeric',
|
|
@@ -15,18 +15,20 @@ var formatDDMMYY = exports.formatDDMMYY = function formatDDMMYY(date, locale) {
|
|
|
15
15
|
year: 'numeric'
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
return formatter.format((0, _dayjs
|
|
18
|
+
const formatter = DDMMYYFormattersCache[locale];
|
|
19
|
+
return formatter.format((0, _dayjs.default)(date).toDate());
|
|
20
20
|
};
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
exports.formatDDMMYY = formatDDMMYY;
|
|
22
|
+
const MMYYYYFormattersCache = {};
|
|
23
|
+
const formatMMYY = (date, locale) => {
|
|
23
24
|
if (MMYYYYFormattersCache[locale] === undefined) {
|
|
24
25
|
MMYYYYFormattersCache[locale] = new Intl.DateTimeFormat(locale, {
|
|
25
26
|
month: 'long',
|
|
26
27
|
year: 'numeric'
|
|
27
28
|
});
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
-
return formatter.format((0, _dayjs
|
|
30
|
+
const formatter = MMYYYYFormattersCache[locale];
|
|
31
|
+
return formatter.format((0, _dayjs.default)(date).toDate());
|
|
31
32
|
};
|
|
33
|
+
exports.formatMMYY = formatMMYY;
|
|
32
34
|
//# sourceMappingURL=formatDate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatDate.js","names":["_dayjs","_interopRequireDefault","require","DDMMYYFormattersCache","formatDDMMYY","
|
|
1
|
+
{"version":3,"file":"formatDate.js","names":["_dayjs","_interopRequireDefault","require","DDMMYYFormattersCache","formatDDMMYY","date","locale","undefined","Intl","DateTimeFormat","day","month","year","formatter","format","dayjs","toDate","exports","MMYYYYFormattersCache","formatMMYY"],"sources":["../../../src/utils/formatDate.js"],"sourcesContent":["import dayjs from 'dayjs';\n\nconst DDMMYYFormattersCache = {};\n\nexport const formatDDMMYY = (date, locale) => {\n if (DDMMYYFormattersCache[locale] === undefined) {\n DDMMYYFormattersCache[locale] = new Intl.DateTimeFormat(locale, {\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n });\n }\n\n const formatter = DDMMYYFormattersCache[locale];\n\n return formatter.format(dayjs(date).toDate());\n};\n\nconst MMYYYYFormattersCache = {};\n\nexport const formatMMYY = (date, locale) => {\n if (MMYYYYFormattersCache[locale] === undefined) {\n MMYYYYFormattersCache[locale] = new Intl.DateTimeFormat(locale, {\n month: 'long',\n year: 'numeric',\n });\n }\n\n const formatter = MMYYYYFormattersCache[locale];\n\n return formatter.format(dayjs(date).toDate());\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,MAAMC,qBAAqB,GAAG,CAAC,CAAC;AAEzB,MAAMC,YAAY,GAAGA,CAACC,IAAI,EAAEC,MAAM,KAAK;EAC5C,IAAIH,qBAAqB,CAACG,MAAM,CAAC,KAAKC,SAAS,EAAE;IAC/CJ,qBAAqB,CAACG,MAAM,CAAC,GAAG,IAAIE,IAAI,CAACC,cAAc,CAACH,MAAM,EAAE;MAC9DI,GAAG,EAAE,SAAS;MACdC,KAAK,EAAE,OAAO;MACdC,IAAI,EAAE;IACR,CAAC,CAAC;EACJ;EAEA,MAAMC,SAAS,GAAGV,qBAAqB,CAACG,MAAM,CAAC;EAE/C,OAAOO,SAAS,CAACC,MAAM,CAAC,IAAAC,cAAK,EAACV,IAAI,CAAC,CAACW,MAAM,CAAC,CAAC,CAAC;AAC/C,CAAC;AAACC,OAAA,CAAAb,YAAA,GAAAA,YAAA;AAEF,MAAMc,qBAAqB,GAAG,CAAC,CAAC;AAEzB,MAAMC,UAAU,GAAGA,CAACd,IAAI,EAAEC,MAAM,KAAK;EAC1C,IAAIY,qBAAqB,CAACZ,MAAM,CAAC,KAAKC,SAAS,EAAE;IAC/CW,qBAAqB,CAACZ,MAAM,CAAC,GAAG,IAAIE,IAAI,CAACC,cAAc,CAACH,MAAM,EAAE;MAC9DK,KAAK,EAAE,MAAM;MACbC,IAAI,EAAE;IACR,CAAC,CAAC;EACJ;EAEA,MAAMC,SAAS,GAAGK,qBAAqB,CAACZ,MAAM,CAAC;EAE/C,OAAOO,SAAS,CAACC,MAAM,CAAC,IAAAC,cAAK,EAACV,IAAI,CAAC,CAACW,MAAM,CAAC,CAAC,CAAC;AAC/C,CAAC;AAACC,OAAA,CAAAE,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.includesDate = void 0;
|
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
7
|
var _cronTabScheduler = require("./cronTabScheduler");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return (0, _cronTabScheduler.isInPeriod)(disabled_day, date.toDate());
|
|
21
|
-
}
|
|
22
|
-
return date.isSame(disabled_day, 'date');
|
|
23
|
-
};
|
|
8
|
+
const includesDate = (date, unit) => disabled_day => {
|
|
9
|
+
if (Array.isArray(disabled_day)) {
|
|
10
|
+
const MAX_DATE_TIMESTAMP = 8640000000000000;
|
|
11
|
+
const [start, end] = disabled_day;
|
|
12
|
+
return date.isBetween(start || -MAX_DATE_TIMESTAMP, end || MAX_DATE_TIMESTAMP, unit, '[]');
|
|
13
|
+
}
|
|
14
|
+
if ((0, _cronTabScheduler.isValidSchedule)(disabled_day)) {
|
|
15
|
+
return (0, _cronTabScheduler.isInPeriod)(disabled_day, date.toDate());
|
|
16
|
+
}
|
|
17
|
+
return date.isSame(disabled_day, 'date');
|
|
24
18
|
};
|
|
19
|
+
exports.includesDate = includesDate;
|
|
25
20
|
//# sourceMappingURL=includesDate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"includesDate.js","names":["_cronTabScheduler","require","includesDate","
|
|
1
|
+
{"version":3,"file":"includesDate.js","names":["_cronTabScheduler","require","includesDate","date","unit","disabled_day","Array","isArray","MAX_DATE_TIMESTAMP","start","end","isBetween","isValidSchedule","isInPeriod","toDate","isSame","exports"],"sources":["../../../src/utils/includesDate.js"],"sourcesContent":["import { isInPeriod, isValidSchedule } from './cronTabScheduler';\n\nexport const includesDate = (date, unit) => (disabled_day) => {\n if (Array.isArray(disabled_day)) {\n const MAX_DATE_TIMESTAMP = 8640000000000000;\n const [start, end] = disabled_day;\n return date.isBetween(start || -MAX_DATE_TIMESTAMP, end || MAX_DATE_TIMESTAMP, unit, '[]');\n }\n if (isValidSchedule(disabled_day)) {\n return isInPeriod(disabled_day, date.toDate());\n }\n return date.isSame(disabled_day, 'date');\n};\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEO,MAAMC,YAAY,GAAGA,CAACC,IAAI,EAAEC,IAAI,KAAMC,YAAY,IAAK;EAC5D,IAAIC,KAAK,CAACC,OAAO,CAACF,YAAY,CAAC,EAAE;IAC/B,MAAMG,kBAAkB,GAAG,gBAAgB;IAC3C,MAAM,CAACC,KAAK,EAAEC,GAAG,CAAC,GAAGL,YAAY;IACjC,OAAOF,IAAI,CAACQ,SAAS,CAACF,KAAK,IAAI,CAACD,kBAAkB,EAAEE,GAAG,IAAIF,kBAAkB,EAAEJ,IAAI,EAAE,IAAI,CAAC;EAC5F;EACA,IAAI,IAAAQ,iCAAe,EAACP,YAAY,CAAC,EAAE;IACjC,OAAO,IAAAQ,4BAAU,EAACR,YAAY,EAAEF,IAAI,CAACW,MAAM,CAAC,CAAC,CAAC;EAChD;EACA,OAAOX,IAAI,CAACY,MAAM,CAACV,YAAY,EAAE,MAAM,CAAC;AAC1C,CAAC;AAACW,OAAA,CAAAd,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
/**
|
|
8
8
|
* Plugin is copied from dayjs plugins because of build in both esm and commonjs.
|
|
9
9
|
* See https://github.com/iamkun/dayjs/tree/dev/src/plugin/isBetween
|
|
10
10
|
*/
|
|
11
|
-
var _default = exports
|
|
11
|
+
var _default = exports.default = function _default(_o, c, d) {
|
|
12
12
|
c.prototype.isBetween = function (a, b, u, i) {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const dA = d(a);
|
|
14
|
+
const dB = d(b);
|
|
15
15
|
i = i || '()';
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const dAi = i[0] === '(';
|
|
17
|
+
const dBi = i[1] === ')';
|
|
18
18
|
return (dAi ? this.isAfter(dA, u) : !this.isBefore(dA, u)) && (dBi ? this.isBefore(dB, u) : !this.isAfter(dB, u)) || (dAi ? this.isBefore(dA, u) : !this.isAfter(dA, u)) && (dBi ? this.isAfter(dB, u) : !this.isBefore(dB, u));
|
|
19
19
|
};
|
|
20
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isBetweenPlugin.js","names":["_default","exports","_o","c","d","prototype","isBetween","a","b","u","i","dA","dB","dAi","dBi","isAfter","isBefore"],"sources":["../../../src/utils/isBetweenPlugin.js"],"sourcesContent":["/**\n * Plugin is copied from dayjs plugins because of build in both esm and commonjs.\n * See https://github.com/iamkun/dayjs/tree/dev/src/plugin/isBetween\n */\n\nexport default (function (_o, c, d) {\n c.prototype.isBetween = function (a, b, u, i) {\n const dA = d(a);\n const dB = d(b);\n i = i || '()';\n const dAi = i[0] === '(';\n const dBi = i[1] === ')';\n return (\n ((dAi ? this.isAfter(dA, u) : !this.isBefore(dA, u)) &&\n (dBi ? this.isBefore(dB, u) : !this.isAfter(dB, u))) ||\n ((dAi ? this.isBefore(dA, u) : !this.isAfter(dA, u)) &&\n (dBi ? this.isAfter(dB, u) : !this.isBefore(dB, u)))\n );\n };\n});\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAHA,IAAAA,QAAA,GAAAC,OAAA,
|
|
1
|
+
{"version":3,"file":"isBetweenPlugin.js","names":["_default","exports","default","_o","c","d","prototype","isBetween","a","b","u","i","dA","dB","dAi","dBi","isAfter","isBefore"],"sources":["../../../src/utils/isBetweenPlugin.js"],"sourcesContent":["/**\n * Plugin is copied from dayjs plugins because of build in both esm and commonjs.\n * See https://github.com/iamkun/dayjs/tree/dev/src/plugin/isBetween\n */\n\nexport default (function (_o, c, d) {\n c.prototype.isBetween = function (a, b, u, i) {\n const dA = d(a);\n const dB = d(b);\n i = i || '()';\n const dAi = i[0] === '(';\n const dBi = i[1] === ')';\n return (\n ((dAi ? this.isAfter(dA, u) : !this.isBefore(dA, u)) &&\n (dBi ? this.isBefore(dB, u) : !this.isAfter(dB, u))) ||\n ((dAi ? this.isBefore(dA, u) : !this.isAfter(dA, u)) &&\n (dBi ? this.isAfter(dB, u) : !this.isBefore(dB, u)))\n );\n };\n});\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAHA,IAAAA,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAKgB,SAAAF,SAAUG,EAAE,EAAEC,CAAC,EAAEC,CAAC,EAAE;EAClCD,CAAC,CAACE,SAAS,CAACC,SAAS,GAAG,UAAUC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAE;IAC5C,MAAMC,EAAE,GAAGP,CAAC,CAACG,CAAC,CAAC;IACf,MAAMK,EAAE,GAAGR,CAAC,CAACI,CAAC,CAAC;IACfE,CAAC,GAAGA,CAAC,IAAI,IAAI;IACb,MAAMG,GAAG,GAAGH,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG;IACxB,MAAMI,GAAG,GAAGJ,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG;IACxB,OACG,CAACG,GAAG,GAAG,IAAI,CAACE,OAAO,CAACJ,EAAE,EAAEF,CAAC,CAAC,GAAG,CAAC,IAAI,CAACO,QAAQ,CAACL,EAAE,EAAEF,CAAC,CAAC,MAChDK,GAAG,GAAG,IAAI,CAACE,QAAQ,CAACJ,EAAE,EAAEH,CAAC,CAAC,GAAG,CAAC,IAAI,CAACM,OAAO,CAACH,EAAE,EAAEH,CAAC,CAAC,CAAC,IAClD,CAACI,GAAG,GAAG,IAAI,CAACG,QAAQ,CAACL,EAAE,EAAEF,CAAC,CAAC,GAAG,CAAC,IAAI,CAACM,OAAO,CAACJ,EAAE,EAAEF,CAAC,CAAC,MAChDK,GAAG,GAAG,IAAI,CAACC,OAAO,CAACH,EAAE,EAAEH,CAAC,CAAC,GAAG,CAAC,IAAI,CAACO,QAAQ,CAACJ,EAAE,EAAEH,CAAC,CAAC,CAAE;EAE5D,CAAC;AACH,CAAC","ignoreList":[]}
|