@synerise/ds-date-range-picker 2.3.2 → 2.3.3
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 +8 -0
- package/CLAUDE.md +62 -33
- package/README.md +26 -13
- package/dist/AddonCollapse/AddonCollapse.types.d.ts +4 -4
- package/dist/DateRangePicker.types.d.ts +39 -19
- package/dist/Footer/Footer.types.d.ts +3 -2
- package/dist/RangeFilter/Filters/DailyFilter/DailyFilter.d.ts +5 -6
- package/dist/RangeFilter/Filters/MonthlyFilter/MonthlyFilter.types.d.ts +3 -2
- package/dist/RangeFilter/Filters/WeeklyFilter/WeeklyFilter.d.ts +2 -1
- package/dist/RangeFilter/Filters/WeeklyFilter/WeeklyFilter.types.d.ts +1 -5
- package/dist/RangeFilter/Filters/new/Filters.types.d.ts +2 -0
- package/dist/RangeFilter/Filters/new/Monthly/Monthly.d.ts +1 -1
- package/dist/RangeFilter/Filters/new/Monthly/Monthly.js +10 -45
- package/dist/RangeFilter/Filters/new/Monthly/Monthly.types.d.ts +9 -4
- package/dist/RangeFilter/Filters/new/Monthly/utils.d.ts +1 -1
- package/dist/RangeFilter/Filters/new/Weekly/Weekly.d.ts +1 -1
- package/dist/RangeFilter/Filters/new/Weekly/Weekly.js +10 -44
- package/dist/RangeFilter/Filters/new/Weekly/Weekly.types.d.ts +7 -3
- package/dist/RangeFilter/Filters/new/Weekly/utils.d.ts +1 -1
- package/dist/RangeFilter/Filters/new/filters.spec.constants.d.ts +15 -15
- package/dist/RangeFilter/Filters/new/hooks/useShiftAndControlKeys.js +9 -4
- package/dist/RangeFilter/RangeFilter.js +30 -47
- package/dist/RangeFilter/RangeFilter.types.d.ts +82 -42
- package/dist/RangeFilter/Shared/AddButton/AddButton.types.d.ts +2 -2
- package/dist/RangeFilter/Shared/FilterDropdown/FilterDropdown.types.d.ts +3 -3
- package/dist/RangeFilter/Shared/RangeFilterStatus/RangeFilterStatus.js +1 -1
- package/dist/RangeFilter/Shared/RangeFilterStatus/RangeFilterStatus.types.d.ts +2 -2
- package/dist/RangeFilter/Shared/SelectionCount/SelectionCount.types.d.ts +2 -2
- package/dist/RangeFilter/Shared/SelectionHint/SelectionHint.d.ts +3 -3
- package/dist/RangeFilter/Shared/TimeWindow/Day/Day.types.d.ts +2 -2
- package/dist/RangeFilter/Shared/TimeWindow/Grid/Grid.types.d.ts +3 -3
- package/dist/RangeFilter/Shared/TimeWindow/Header/Header.d.ts +4 -4
- package/dist/RangeFilter/Shared/TimeWindow/RangeActions/RangeActions.types.d.ts +4 -4
- package/dist/RangeFilter/Shared/TimeWindow/RangeFormContainer/RangeForm/RangeForm.types.d.ts +2 -2
- package/dist/RangeFilter/Shared/TimeWindow/TimeWindow.js +2 -1
- package/dist/RangeFilter/Shared/TimeWindow/TimeWindow.types.d.ts +4 -4
- package/dist/RangeFilter/constants.d.ts +19 -17
- package/dist/RangeFilter/constants.js +14 -21
- package/dist/RangeFilter/utils.d.ts +27 -24
- package/dist/RangeFilter/utils.js +124 -131
- package/dist/RangePickerInput/RangePickerInput.types.d.ts +3 -2
- package/dist/RawDateRangePicker.d.ts +2 -2
- package/dist/RawDateRangePicker.js +2 -1
- package/dist/RelativeRangePicker/Elements/CustomRangeForm/CustomRangeForm.d.ts +1 -1
- package/dist/RelativeRangePicker/Elements/CustomRangeForm/CustomRangeForm.js +1 -2
- package/dist/RelativeRangePicker/Elements/CustomRangeForm/CustomRangeForm.types.d.ts +0 -1
- package/dist/RelativeRangePicker/Elements/ModeDropdown/ModeDropdown.types.d.ts +0 -3
- package/dist/RelativeRangePicker/Elements/RangeButtons/RangeButtons.types.d.ts +2 -3
- package/dist/RelativeRangePicker/Elements/RangeDropdown/RangeDropdown.js +1 -1
- package/dist/RelativeRangePicker/Elements/RangeDropdown/RangeDropdown.types.d.ts +1 -1
- package/dist/RelativeRangePicker/Elements/TimestampRange/TimestampDuration/TimestampDuration.types.d.ts +7 -5
- package/dist/RelativeRangePicker/Elements/TimestampRange/TimestampRange.js +19 -15
- package/dist/RelativeRangePicker/Elements/TimestampRange/TimestampRange.types.d.ts +2 -2
- package/dist/RelativeRangePicker/RelativeRangePicker.js +9 -9
- package/dist/RelativeRangePicker/RelativeRangePicker.types.d.ts +1 -2
- package/dist/RelativeRangePicker/utils/findMatchingPreset.utils.d.ts +8 -11
- package/dist/RelativeRangePicker/utils/index.d.ts +0 -1
- package/dist/RelativeRangePicker/utils/index.js +0 -2
- package/dist/constants.d.ts +14 -14
- package/dist/constants.js +2 -4
- package/dist/date.types.d.ts +52 -25
- package/dist/dateUtils/isSinceRange.d.ts +3 -0
- package/dist/dateUtils/isSinceRange.js +4 -0
- package/dist/dateUtils/relativeToAbsolute.d.ts +2 -2
- package/dist/index.d.ts +14 -3
- package/dist/index.js +13 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +11 -11
- package/dist/RelativeRangePicker/utils/isAbsolute.utils.d.ts +0 -2
- package/dist/RelativeRangePicker/utils/isAbsolute.utils.js +0 -5
|
@@ -1,17 +1,87 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
1
|
import { IntlShape } from 'react-intl';
|
|
3
|
-
import {
|
|
2
|
+
import { Texts } from '../DateRangePicker.types';
|
|
4
3
|
import { COUNTED_FROM_ENUM, DAYS_OF_PERIOD_ENUM, RangeFilterType } from './constants';
|
|
4
|
+
import { Month } from './Filters/MonthlyFilter/MonthlyFilter.types';
|
|
5
5
|
import { SavedFilter } from './Shared/FilterDropdown/FilterDropdown.types';
|
|
6
6
|
import { DateLimitMode, RangeDisplayMode } from './Shared/TimeWindow/RangeFormContainer/RangeForm/RangeForm.types';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
/** One day of a stored schedule. `day` is 1-based. */
|
|
8
|
+
export type RangeFilterDay = {
|
|
9
|
+
day: number;
|
|
10
|
+
from: string;
|
|
11
|
+
to: string;
|
|
12
|
+
inverted?: boolean;
|
|
13
|
+
mode?: DateLimitMode;
|
|
14
|
+
};
|
|
15
|
+
export type RangeFilterDaily = {
|
|
16
|
+
type: 'DAILY';
|
|
17
|
+
nestingType: 'IN_PLACE';
|
|
18
|
+
from: string;
|
|
19
|
+
to: string;
|
|
20
|
+
day?: number;
|
|
21
|
+
inverted?: boolean;
|
|
22
|
+
mode?: DateLimitMode;
|
|
23
|
+
restricted?: boolean;
|
|
24
|
+
display?: boolean;
|
|
25
|
+
};
|
|
26
|
+
export type RangeFilterWeekly = {
|
|
27
|
+
type: 'WEEKLY';
|
|
28
|
+
nestingType: 'IN_PLACE';
|
|
29
|
+
days: RangeFilterDay[];
|
|
30
|
+
};
|
|
31
|
+
/** A monthly rule by day of the month (`day` 1–31). */
|
|
32
|
+
export type RangeFilterMonthRule = {
|
|
33
|
+
type: 'MONTH';
|
|
34
|
+
days: RangeFilterDay[];
|
|
35
|
+
inverted: boolean;
|
|
36
|
+
};
|
|
37
|
+
/** A monthly rule by weekday (`day` 1–7) in a week of the month (`week` 1–5). */
|
|
38
|
+
export type RangeFilterWeekRule = {
|
|
39
|
+
type: 'WEEK';
|
|
40
|
+
weeks: {
|
|
41
|
+
week: number;
|
|
42
|
+
days: (RangeFilterDay & {
|
|
43
|
+
type: 'MONTHLY';
|
|
44
|
+
})[];
|
|
45
|
+
}[];
|
|
46
|
+
inverted: boolean;
|
|
47
|
+
};
|
|
48
|
+
export type RangeFilterMonthly = {
|
|
49
|
+
type: 'MONTHLY';
|
|
50
|
+
nestingType: 'IN_PLACE';
|
|
51
|
+
rules: (RangeFilterMonthRule | RangeFilterWeekRule)[];
|
|
52
|
+
};
|
|
53
|
+
/** The schedule the filter addon emits and stores in `DateRange.filter`. */
|
|
54
|
+
export type RangeFilterValue = RangeFilterDaily | RangeFilterWeekly | RangeFilterMonthly;
|
|
55
|
+
/** A day as the filter editors hold it: 0-based `day`, `start`/`stop` times. */
|
|
56
|
+
export type DenormalizedFilter = {
|
|
57
|
+
start: string;
|
|
58
|
+
stop: string;
|
|
59
|
+
day?: string | number;
|
|
60
|
+
restricted?: boolean;
|
|
61
|
+
};
|
|
62
|
+
export type FilterDay = DenormalizedFilter & {
|
|
63
|
+
display?: boolean;
|
|
64
|
+
inverted?: boolean;
|
|
65
|
+
mode?: DateLimitMode;
|
|
66
|
+
week?: number;
|
|
10
67
|
};
|
|
68
|
+
export type DailyFilterValue = {
|
|
69
|
+
type: 'DAILY';
|
|
70
|
+
definition: FilterDay;
|
|
71
|
+
};
|
|
72
|
+
export type WeeklyFilterValue = {
|
|
73
|
+
type: 'WEEKLY';
|
|
74
|
+
definition: Record<string, FilterDay>;
|
|
75
|
+
};
|
|
76
|
+
export type MonthlyFilterValue = {
|
|
77
|
+
type: 'MONTHLY';
|
|
78
|
+
definition: Month<FilterDay>[];
|
|
79
|
+
};
|
|
80
|
+
/** The editor state of one filter type; saved filters store this shape. */
|
|
81
|
+
export type FilterValue = DailyFilterValue | WeeklyFilterValue | MonthlyFilterValue;
|
|
11
82
|
export type RangeFilterProps = {
|
|
12
|
-
value
|
|
13
|
-
onApply?: (filter:
|
|
14
|
-
onChange?: (filter: FilterValue) => void;
|
|
83
|
+
value?: RangeFilterValue;
|
|
84
|
+
onApply?: (filter: RangeFilterValue) => void;
|
|
15
85
|
hideFooter?: boolean;
|
|
16
86
|
onCancel: () => void;
|
|
17
87
|
intl: IntlShape;
|
|
@@ -21,13 +91,13 @@ export type RangeFilterProps = {
|
|
|
21
91
|
allowedFilterTypes?: RangeFilterType[];
|
|
22
92
|
valueSelectionModes?: DateLimitMode[];
|
|
23
93
|
rangeDisplayMode?: RangeDisplayMode;
|
|
24
|
-
rangeUnits?: Pick<DateRangePickerProps, 'rangeUnits'>;
|
|
25
94
|
};
|
|
26
95
|
export type RangeFilterState = {
|
|
27
|
-
previousFilter?: FilterValue;
|
|
28
|
-
[filterType: string]: FilterValue | Partial<FilterDefinition> | string | undefined;
|
|
29
96
|
activeType: RangeFilterType;
|
|
30
97
|
rangeClipboard?: Partial<FilterDefinition>;
|
|
98
|
+
DAILY?: DailyFilterValue;
|
|
99
|
+
WEEKLY?: WeeklyFilterValue;
|
|
100
|
+
MONTHLY?: MonthlyFilterValue;
|
|
31
101
|
};
|
|
32
102
|
export type FilterDefinition = {
|
|
33
103
|
start?: string;
|
|
@@ -44,37 +114,7 @@ export type MonthlySelectValue<T> = {
|
|
|
44
114
|
translationKey?: string;
|
|
45
115
|
value: T;
|
|
46
116
|
};
|
|
47
|
-
export type DenormalizedFilter = {
|
|
48
|
-
start: string;
|
|
49
|
-
stop: string;
|
|
50
|
-
day?: React.ReactText;
|
|
51
|
-
restricted?: boolean;
|
|
52
|
-
};
|
|
53
|
-
export type NormalizedFilter = NormalizedFilterBase & {
|
|
54
|
-
from: string;
|
|
55
|
-
to: string;
|
|
56
|
-
day?: React.ReactText;
|
|
57
|
-
week?: React.ReactText;
|
|
58
|
-
};
|
|
59
|
-
export type NormalizedFilterBase = {
|
|
60
|
-
type?: string;
|
|
61
|
-
nestingType?: string;
|
|
62
|
-
};
|
|
63
|
-
export type WeekFilter = {
|
|
64
|
-
week: number;
|
|
65
|
-
};
|
|
66
117
|
export type WithDisabledProp = {
|
|
67
118
|
disabled?: boolean;
|
|
68
119
|
};
|
|
69
|
-
export type
|
|
70
|
-
[key: string]: FilterDefinition;
|
|
71
|
-
};
|
|
72
|
-
export type MonthlyFilterDefinition = {
|
|
73
|
-
definition: {
|
|
74
|
-
[key: string]: FilterDefinition;
|
|
75
|
-
};
|
|
76
|
-
id: number;
|
|
77
|
-
period: DAYS_OF_PERIOD_ENUM;
|
|
78
|
-
periodType: COUNTED_FROM_ENUM;
|
|
79
|
-
};
|
|
80
|
-
export type ValueSelectionModes = ['Range', 'Hour'];
|
|
120
|
+
export type MonthlyDayRange = Month<FilterDay>['definition'];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { FilterValue } from '../../RangeFilter.types';
|
|
3
3
|
export type FilterDropdownProps = {
|
|
4
4
|
filters: SavedFilter[];
|
|
5
5
|
onFilterSelect: (filter: SavedFilter) => void;
|
|
6
6
|
onFilterRemove: (filterId: string) => void;
|
|
7
|
-
label:
|
|
8
|
-
removeTooltip:
|
|
7
|
+
label: ReactNode;
|
|
8
|
+
removeTooltip: ReactNode;
|
|
9
9
|
};
|
|
10
10
|
export type SavedFilter = FilterValue & {
|
|
11
11
|
id: string;
|
|
@@ -26,7 +26,7 @@ const RangeFilterStatus = ({
|
|
|
26
26
|
}, component: /* @__PURE__ */ jsx(CloseS, {}), color: "var(--ds-color-icon-danger-default)" }) })
|
|
27
27
|
] }), item: {
|
|
28
28
|
id: "filter-trigger",
|
|
29
|
-
// @ts-expect-error
|
|
29
|
+
// @ts-expect-error ds-manageable-list types `name` as a string, texts are ReactNode
|
|
30
30
|
name: texts[filter.type.toLocaleLowerCase()] || intl.formatMessage({
|
|
31
31
|
id: `DS.DATE-RANGE-PICKER.${filter.type}`,
|
|
32
32
|
defaultMessage: "Filter"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { Texts } from '../../../DateRangePicker.types';
|
|
3
|
-
import {
|
|
3
|
+
import { RangeFilterValue } from '../../RangeFilter.types';
|
|
4
4
|
export type RangeFilterStatusProps = {
|
|
5
|
-
filter:
|
|
5
|
+
filter: RangeFilterValue | undefined;
|
|
6
6
|
disabled: boolean;
|
|
7
7
|
label: ReactNode;
|
|
8
8
|
texts: Texts;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
2
|
export type SelectionHintProps = {
|
|
3
|
-
message:
|
|
3
|
+
message: ReactNode;
|
|
4
4
|
};
|
|
5
|
-
declare const SelectionHint: ({ message }: SelectionHintProps) =>
|
|
5
|
+
declare const SelectionHint: ({ message }: SelectionHintProps) => ReactElement;
|
|
6
6
|
export default SelectionHint;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { IntlShape, WrappedComponentProps } from 'react-intl';
|
|
3
3
|
import { GridTexts } from '../Grid/Grid.types';
|
|
4
4
|
import { DayKey } from '../TimeWindow.types';
|
|
5
5
|
export type DayProps = {
|
|
6
6
|
dayKey: DayKey;
|
|
7
|
-
label:
|
|
7
|
+
label: ReactNode | ((hovered: boolean) => ReactNode);
|
|
8
8
|
restricted: boolean;
|
|
9
9
|
active: boolean;
|
|
10
10
|
onToggle: (dayKey: DayKey, forceState?: boolean) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { IntlShape } from 'react-intl';
|
|
3
3
|
import { Texts } from '../../../../DateRangePicker.types';
|
|
4
4
|
import { DayKey, Days } from '../TimeWindow.types';
|
|
@@ -7,7 +7,7 @@ export type GridProps = {
|
|
|
7
7
|
days: Days;
|
|
8
8
|
showSelectAll: boolean;
|
|
9
9
|
showUnselectAll: boolean;
|
|
10
|
-
title:
|
|
10
|
+
title: ReactNode;
|
|
11
11
|
numberOfDays: number;
|
|
12
12
|
numberOfDaysPerRow?: number;
|
|
13
13
|
rowLabelFormatter?: (rowIndex: number) => string;
|
|
@@ -19,7 +19,7 @@ export type GridProps = {
|
|
|
19
19
|
intl: IntlShape;
|
|
20
20
|
onSelectAll: () => void;
|
|
21
21
|
onUnselectAll: () => void;
|
|
22
|
-
renderDay: (day: DayKey) =>
|
|
22
|
+
renderDay: (day: DayKey) => ReactNode;
|
|
23
23
|
texts: GridTexts;
|
|
24
24
|
};
|
|
25
25
|
export type GridTexts = Pick<Texts, 'clear' | 'selectAll' | 'unselectAll' | 'clickToSelect'>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
1
|
+
import { default as React, ReactElement, ReactNode } from 'react';
|
|
2
2
|
export type Action = {
|
|
3
|
-
label:
|
|
3
|
+
label: ReactElement;
|
|
4
4
|
key: string;
|
|
5
5
|
onClick: () => void;
|
|
6
6
|
};
|
|
7
7
|
type HeaderProps = {
|
|
8
|
-
title:
|
|
8
|
+
title: ReactNode;
|
|
9
9
|
actions?: Action[];
|
|
10
|
-
suffix?:
|
|
10
|
+
suffix?: ReactNode;
|
|
11
11
|
};
|
|
12
12
|
export declare const Header: React.MemoExoticComponent<({ title, actions, suffix }: HeaderProps) => React.JSX.Element>;
|
|
13
13
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { RangeActions } from '../TimeWindow.types';
|
|
3
3
|
export type RangeActionsProps = {
|
|
4
4
|
texts: ActionsTexts;
|
|
5
5
|
} & Partial<RangeActions>;
|
|
6
6
|
export type ActionsTexts = {
|
|
7
|
-
copyRange:
|
|
8
|
-
clearRange:
|
|
9
|
-
pasteRange:
|
|
7
|
+
copyRange: ReactNode;
|
|
8
|
+
clearRange: ReactNode;
|
|
9
|
+
pasteRange: ReactNode;
|
|
10
10
|
};
|
package/dist/RangeFilter/Shared/TimeWindow/RangeFormContainer/RangeForm/RangeForm.types.d.ts
CHANGED
|
@@ -20,6 +20,6 @@ export type RangeFormProps = {
|
|
|
20
20
|
texts: TimeWindowTexts;
|
|
21
21
|
} & WithDisabledProp & Pick<RangeFormContainerProps, 'timePickerProps' | 'valueFormatOptions' | 'errorTexts'>;
|
|
22
22
|
export type RangeFormTexts = {
|
|
23
|
-
range: ReactNode
|
|
24
|
-
hour: ReactNode
|
|
23
|
+
range: ReactNode;
|
|
24
|
+
hour: ReactNode;
|
|
25
25
|
};
|
|
@@ -4,7 +4,7 @@ import range from "lodash.range";
|
|
|
4
4
|
import { PureComponent, createRef } from "react";
|
|
5
5
|
import { FormattedMessage, injectIntl } from "react-intl";
|
|
6
6
|
import { withDataFormat } from "@synerise/ds-core";
|
|
7
|
-
import {
|
|
7
|
+
import { TIME_FORMAT } from "../../constants.js";
|
|
8
8
|
import AddButton from "../AddButton/AddButton.js";
|
|
9
9
|
import SelectionCount from "../SelectionCount/SelectionCount.js";
|
|
10
10
|
import SelectionHint from "../SelectionHint/SelectionHint.js";
|
|
@@ -14,6 +14,7 @@ import Grid from "./Grid/Grid.js";
|
|
|
14
14
|
import RangeFormContainer from "./RangeFormContainer/RangeFormContainer.js";
|
|
15
15
|
import { TimeWindowContainer, AddButtonWrapper } from "./TimeWindow.styles.js";
|
|
16
16
|
import { getDateFromDayValue } from "./utils.js";
|
|
17
|
+
import { DEFAULT_RANGE_END, DEFAULT_RANGE_START } from "../../Filters/new/constants.js";
|
|
17
18
|
const DEFAULT_LIMIT_MODE = "Range";
|
|
18
19
|
const _TimeWindowBase = class _TimeWindowBase extends PureComponent {
|
|
19
20
|
constructor() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
2
|
import { WrappedComponentProps } from 'react-intl';
|
|
3
3
|
import { WithDataFormatProps } from '@synerise/ds-core';
|
|
4
4
|
import { TimePickerProps } from '@synerise/ds-time-picker';
|
|
@@ -19,7 +19,7 @@ export type Days = {
|
|
|
19
19
|
[key in DayKey]: DayOptions;
|
|
20
20
|
};
|
|
21
21
|
export type CustomDayConfig = {
|
|
22
|
-
component?:
|
|
22
|
+
component?: ComponentType<DayProps>;
|
|
23
23
|
template?: object;
|
|
24
24
|
tooltip?: string;
|
|
25
25
|
label?: string;
|
|
@@ -40,7 +40,7 @@ export type TimeWindowProps = {
|
|
|
40
40
|
numberOfDaysPerRow?: number;
|
|
41
41
|
rowLabelFormatter?: (rowIndex: number) => string;
|
|
42
42
|
dayTemplate: (day: DayKey) => object;
|
|
43
|
-
dayFormatter: (day: DayKey, long?: boolean) =>
|
|
43
|
+
dayFormatter: (day: DayKey, long?: boolean) => ReactNode;
|
|
44
44
|
hideHeader?: boolean;
|
|
45
45
|
headerOptions?: {
|
|
46
46
|
includeSummary?: boolean;
|
|
@@ -58,7 +58,7 @@ export type TimeWindowProps = {
|
|
|
58
58
|
valueSelectionModes: DateLimitMode[];
|
|
59
59
|
rangeDisplayMode?: RangeDisplayMode;
|
|
60
60
|
texts: TimeWindowTexts & GridTexts;
|
|
61
|
-
renderRangeFormSuffix?: () =>
|
|
61
|
+
renderRangeFormSuffix?: () => ReactNode;
|
|
62
62
|
timePickerProps?: Partial<TimePickerProps>;
|
|
63
63
|
} & Partial<RangeActions> & WithDataFormatProps & WithDisabledProp & WrappedComponentProps;
|
|
64
64
|
export type State = {
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
+
import { DEFAULT_RANGE_END, DEFAULT_RANGE_START } from './Filters/new/constants';
|
|
1
2
|
import { MonthlySelectValue } from './RangeFilter.types';
|
|
2
3
|
export declare const TIME_FORMAT = "HH:mm:ss.SSS";
|
|
3
|
-
export declare const DEFAULT_RANGE_START = "00:00:00.000";
|
|
4
|
-
export declare const DEFAULT_RANGE_END = "23:59:59.999";
|
|
5
4
|
export declare const MONTH_DAYS: (locale: string) => string[];
|
|
6
|
-
export declare
|
|
7
|
-
DAY_OF_MONTH
|
|
8
|
-
DAY_OF_WEEK
|
|
9
|
-
}
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
export declare const DAYS_OF_PERIOD_ENUM: {
|
|
6
|
+
readonly DAY_OF_MONTH: "MONTH";
|
|
7
|
+
readonly DAY_OF_WEEK: "WEEK";
|
|
8
|
+
};
|
|
9
|
+
export type DAYS_OF_PERIOD_ENUM = (typeof DAYS_OF_PERIOD_ENUM)[keyof typeof DAYS_OF_PERIOD_ENUM];
|
|
10
|
+
export declare const COUNTED_FROM_ENUM: {
|
|
11
|
+
readonly BEGINNING: "BEGINNING";
|
|
12
|
+
readonly ENDING: "ENDING";
|
|
13
|
+
};
|
|
14
|
+
export type COUNTED_FROM_ENUM = (typeof COUNTED_FROM_ENUM)[keyof typeof COUNTED_FROM_ENUM];
|
|
14
15
|
export declare const TYPES: {
|
|
15
|
-
DAILY:
|
|
16
|
-
WEEKLY:
|
|
17
|
-
MONTHLY:
|
|
16
|
+
readonly DAILY: "DAILY";
|
|
17
|
+
readonly WEEKLY: "WEEKLY";
|
|
18
|
+
readonly MONTHLY: "MONTHLY";
|
|
18
19
|
};
|
|
19
20
|
export type RangeFilterType = keyof typeof TYPES;
|
|
20
21
|
export declare const DEFAULT_DAYS_OF_PERIODS: MonthlySelectValue<DAYS_OF_PERIOD_ENUM>[];
|
|
@@ -24,11 +25,11 @@ export declare const TYPES_DATA: {
|
|
|
24
25
|
MONTHLY: {
|
|
25
26
|
labelTranslationKey: string;
|
|
26
27
|
defaultLabel: string;
|
|
27
|
-
component: import('react').FC<import('react-intl').WithIntlProps<import('
|
|
28
|
-
WrappedComponent: import('react').ComponentType<import('
|
|
28
|
+
component: import('react').FC<import('react-intl').WithIntlProps<import('..').MonthlyFilterProps>> & {
|
|
29
|
+
WrappedComponent: import('react').ComponentType<import('..').MonthlyFilterProps>;
|
|
29
30
|
};
|
|
30
31
|
definition: {
|
|
31
|
-
period:
|
|
32
|
+
period: "MONTH";
|
|
32
33
|
periodType: COUNTED_FROM_ENUM;
|
|
33
34
|
definition: {};
|
|
34
35
|
id: string;
|
|
@@ -37,7 +38,7 @@ export declare const TYPES_DATA: {
|
|
|
37
38
|
WEEKLY: {
|
|
38
39
|
labelTranslationKey: string;
|
|
39
40
|
defaultLabel: string;
|
|
40
|
-
component: ({ value, onChange, onRangeClear, onRangePaste, onRangeCopy, rangeClipboard, intl, valueSelectionModes, rangeDisplayMode, texts, }: import('./Filters/WeeklyFilter/WeeklyFilter.types').WeeklyFilterProps) =>
|
|
41
|
+
component: ({ value, onChange, onRangeClear, onRangePaste, onRangeCopy, rangeClipboard, intl, valueSelectionModes, rangeDisplayMode, texts, }: import('./Filters/WeeklyFilter/WeeklyFilter.types').WeeklyFilterProps) => import('react').ReactElement;
|
|
41
42
|
definition: {};
|
|
42
43
|
};
|
|
43
44
|
DAILY: {
|
|
@@ -53,6 +54,7 @@ export declare const TYPES_DATA: {
|
|
|
53
54
|
};
|
|
54
55
|
};
|
|
55
56
|
};
|
|
57
|
+
export { DEFAULT_RANGE_END, DEFAULT_RANGE_START };
|
|
56
58
|
export declare const SPACE_UNICODE = "\u00A0";
|
|
57
59
|
export declare const MONTHLY_SCHEDULER_INTL_KEYS_NTH_WEEK: {
|
|
58
60
|
id: string;
|
|
@@ -3,22 +3,19 @@ import { generateUuid } from "@synerise/ds-utils";
|
|
|
3
3
|
import { format, addDays } from "date-fns";
|
|
4
4
|
import DailyFilter from "./Filters/DailyFilter/DailyFilter.js";
|
|
5
5
|
import MonthlyFilter from "./Filters/MonthlyFilter/MonthlyFilter.js";
|
|
6
|
+
import { DEFAULT_RANGE_END, DEFAULT_RANGE_START } from "./Filters/new/constants.js";
|
|
6
7
|
import WeeklyFilter from "./Filters/WeeklyFilter/WeeklyFilter.js";
|
|
7
8
|
const LONG_MONTH = new Date(0, 0, 1);
|
|
8
9
|
const TIME_FORMAT = "HH:mm:ss.SSS";
|
|
9
|
-
const DEFAULT_RANGE_START = "00:00:00.000";
|
|
10
|
-
const DEFAULT_RANGE_END = "23:59:59.999";
|
|
11
10
|
const MONTH_DAYS = (locale) => range(0, 31).map((i) => locale === "pl" ? `${i + 1}.` : format(addDays(LONG_MONTH, i), "Do"));
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return COUNTED_FROM_ENUM2;
|
|
21
|
-
})(COUNTED_FROM_ENUM || {});
|
|
11
|
+
const DAYS_OF_PERIOD_ENUM = {
|
|
12
|
+
DAY_OF_MONTH: "MONTH",
|
|
13
|
+
DAY_OF_WEEK: "WEEK"
|
|
14
|
+
};
|
|
15
|
+
const COUNTED_FROM_ENUM = {
|
|
16
|
+
BEGINNING: "BEGINNING",
|
|
17
|
+
ENDING: "ENDING"
|
|
18
|
+
};
|
|
22
19
|
const TYPES = {
|
|
23
20
|
DAILY: "DAILY",
|
|
24
21
|
WEEKLY: "WEEKLY",
|
|
@@ -26,21 +23,17 @@ const TYPES = {
|
|
|
26
23
|
};
|
|
27
24
|
const DEFAULT_DAYS_OF_PERIODS = [{
|
|
28
25
|
translationKey: "DS.DATE-RANGE-PICKER.IN-MONTH",
|
|
29
|
-
value:
|
|
30
|
-
/* DAY_OF_MONTH */
|
|
26
|
+
value: DAYS_OF_PERIOD_ENUM.DAY_OF_MONTH
|
|
31
27
|
}, {
|
|
32
28
|
translationKey: "DS.DATE-RANGE-PICKER.IN-WEEK",
|
|
33
|
-
value:
|
|
34
|
-
/* DAY_OF_WEEK */
|
|
29
|
+
value: DAYS_OF_PERIOD_ENUM.DAY_OF_WEEK
|
|
35
30
|
}];
|
|
36
31
|
const DEFAULT_COUNTED_FROM = [{
|
|
37
32
|
translationKey: "DS.DATE-RANGE-PICKER.BEGINNING",
|
|
38
|
-
value:
|
|
39
|
-
/* BEGINNING */
|
|
33
|
+
value: COUNTED_FROM_ENUM.BEGINNING
|
|
40
34
|
}, {
|
|
41
35
|
translationKey: "DS.DATE-RANGE-PICKER.END",
|
|
42
|
-
value:
|
|
43
|
-
/* ENDING */
|
|
36
|
+
value: COUNTED_FROM_ENUM.ENDING
|
|
44
37
|
}];
|
|
45
38
|
const defaultId = generateUuid();
|
|
46
39
|
const TYPES_DATA = {
|
|
@@ -49,7 +42,7 @@ const TYPES_DATA = {
|
|
|
49
42
|
defaultLabel: "Monthly",
|
|
50
43
|
component: MonthlyFilter,
|
|
51
44
|
definition: [{
|
|
52
|
-
period:
|
|
45
|
+
period: DAYS_OF_PERIOD_ENUM.DAY_OF_MONTH,
|
|
53
46
|
periodType: DEFAULT_COUNTED_FROM[0].value,
|
|
54
47
|
definition: {},
|
|
55
48
|
id: defaultId
|
|
@@ -1,30 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RangeFilterType } from './constants';
|
|
2
|
+
import { DailyFilterValue, DenormalizedFilter, FilterDay, FilterValue, MonthlyDayRange, MonthlyFilterValue, RangeFilterDay, RangeFilterMonthRule, RangeFilterValue, RangeFilterWeekRule, WeeklyFilterValue } from './RangeFilter.types';
|
|
2
3
|
import { SavedFilter } from './Shared/FilterDropdown/FilterDropdown.types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
export declare const createWeeklyRange: (days: NormalizedFilter[]) => {};
|
|
9
|
-
export declare const createMonthlyWeekDayRange: (rules: {
|
|
10
|
-
weeks?: (NormalizedFilter & WeekFilter)[];
|
|
11
|
-
}) => MonthlyDayRange;
|
|
12
|
-
export type MonthlyDayRange = {
|
|
13
|
-
[key: string]: DenormalizedFilter & {
|
|
14
|
-
restricted: boolean;
|
|
15
|
-
display: boolean;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export declare const createMonthlyDayRange: (rules: {
|
|
19
|
-
days?: NormalizedFilter[];
|
|
20
|
-
}) => MonthlyDayRange;
|
|
21
|
-
export declare const denormalizers: {
|
|
22
|
-
[key: string]: Function;
|
|
4
|
+
type NormalizedTimes = {
|
|
5
|
+
from: string;
|
|
6
|
+
to: string;
|
|
7
|
+
day?: string | number;
|
|
23
8
|
};
|
|
9
|
+
export declare const mapTimeSchema: <T extends DenormalizedFilter>(item: T) => {
|
|
10
|
+
from: string;
|
|
11
|
+
to: string;
|
|
12
|
+
day: number | undefined;
|
|
13
|
+
} & Omit<T, "day" | "stop" | "start">;
|
|
14
|
+
export declare const denormMapTimeSchema: <T extends NormalizedTimes>(item: T) => {
|
|
15
|
+
start: string;
|
|
16
|
+
stop: string;
|
|
17
|
+
day: number | undefined;
|
|
18
|
+
} & Omit<T, "day" | "from" | "to">;
|
|
19
|
+
export declare const normalizeValue: (value: FilterValue) => RangeFilterValue;
|
|
20
|
+
export declare const createWeeklyRange: (days: RangeFilterDay[]) => Record<string, FilterDay>;
|
|
21
|
+
export declare const createMonthlyWeekDayRange: (rule: RangeFilterWeekRule) => MonthlyDayRange;
|
|
22
|
+
export declare const createMonthlyDayRange: (rule: RangeFilterMonthRule) => MonthlyDayRange;
|
|
23
|
+
export declare const denormalizeValue: (value: RangeFilterValue) => FilterValue;
|
|
24
|
+
export declare const defaultFilterValue: (type: RangeFilterType) => FilterValue;
|
|
24
25
|
export declare const validators: {
|
|
25
|
-
|
|
26
|
+
DAILY: (value: DailyFilterValue) => boolean;
|
|
27
|
+
WEEKLY: (value: WeeklyFilterValue) => boolean;
|
|
28
|
+
MONTHLY: (value: MonthlyFilterValue) => boolean;
|
|
26
29
|
};
|
|
27
|
-
export declare const
|
|
28
|
-
export declare const isValidValue: (value: FilterValue<FilterDefinition>) => boolean;
|
|
30
|
+
export declare const isValidValue: (value?: FilterValue) => boolean;
|
|
29
31
|
export declare const isDuplicate: (itemsList: SavedFilter[], item: SavedFilter) => boolean;
|
|
30
32
|
export declare const addSuffixToDuplicate: (itemsList: SavedFilter[], editedItem: SavedFilter) => SavedFilter;
|
|
33
|
+
export {};
|