@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
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.3.3](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@2.3.2...@synerise/ds-date-range-picker@2.3.3) (2026-11-05)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-date-range-picker
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [2.3.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@2.3.1...@synerise/ds-date-range-picker@2.3.2) (2026-11-03)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @synerise/ds-date-range-picker
|
package/CLAUDE.md
CHANGED
|
@@ -10,7 +10,7 @@ src/
|
|
|
10
10
|
DateRangePicker.types.ts — DateRangePickerProps, Texts, RelativeMode, AddonType
|
|
11
11
|
DateRangePicker.styles.ts — top-level styled-components
|
|
12
12
|
RawDateRangePicker.tsx — core picker logic without popover
|
|
13
|
-
date.types.ts — DateRange,
|
|
13
|
+
date.types.ts — DateRange (Absolute | Relative | Since), RelativeUnit, RangeKey, deprecated DateFilter (DateRange.filter is RangeFilter's RangeFilterValue)
|
|
14
14
|
constants.tsx — MODES, COLUMNS, presets, POPOVER_*_CONFIG
|
|
15
15
|
utils.ts — normalizeRange, getDefaultTexts, DEFAULT_RANGE (toIsoString is re-exported from ds-core)
|
|
16
16
|
fns.ts — re-exports / wrappers around date-fns
|
|
@@ -31,15 +31,15 @@ Popover-wrapped picker. Uses `forwardRef<HTMLDivElement>` — the ref points to
|
|
|
31
31
|
|
|
32
32
|
| Prop | Type | Default | Description |
|
|
33
33
|
|------|------|---------|-------------|
|
|
34
|
-
| `value` | `DateRange` |
|
|
35
|
-
| `onApply` | `(value:
|
|
34
|
+
| `value` | `DateRange` | `undefined` | Controlled value |
|
|
35
|
+
| `onApply` | `(value: DateRange \| undefined) => void` | — | **Required.** Fires on Apply, and with `undefined` (or `defaultValue`) when the trigger input is cleared |
|
|
36
36
|
| `defaultValue` | `DateRange` | `undefined` | Fallback when value is undefined or user clears |
|
|
37
37
|
| `placement` | `LegacyPlacement` | `'top'` | Popover placement |
|
|
38
38
|
| `showTime` | `boolean` | `false` | Enable time selection |
|
|
39
|
-
| `showRelativePicker` | `boolean` | `
|
|
40
|
-
| `relativePast` | `boolean` | `
|
|
41
|
-
| `relativeFuture` | `boolean` | `
|
|
42
|
-
| `relativeModes` | `RelativeMode[]` | `undefined` |
|
|
39
|
+
| `showRelativePicker` | `boolean` | `true` | Show relative range addon — it also needs a non-empty `relativeModes` |
|
|
40
|
+
| `relativePast` | `boolean` | `true` | **Deprecated** — no effect on the modes offered |
|
|
41
|
+
| `relativeFuture` | `boolean` | `undefined` | **Deprecated** — no effect on the modes offered |
|
|
42
|
+
| `relativeModes` | `RelativeMode[]` | `undefined` | Modes of the relative picker; it renders only when this is non-empty. Pass `['PAST']` — `'FUTURE'` and `'SINCE'` are unscoped and not supported |
|
|
43
43
|
| `showFilter` | `boolean` | `false` | Show recurring schedule filter addon |
|
|
44
44
|
| `showCustomRange` | `boolean` | `true` | Show custom range form in relative picker |
|
|
45
45
|
| `showNowButton` | `boolean` | `true` | Show "Now" button in time picker |
|
|
@@ -47,35 +47,35 @@ Popover-wrapped picker. Uses `forwardRef<HTMLDivElement>` — the ref points to
|
|
|
47
47
|
| `forceAdjacentMonths` | `boolean` | `false` | Force left/right calendars to always show adjacent months |
|
|
48
48
|
| `disabledDate` | `(date?: Date) => boolean` | `undefined` | Disable individual dates |
|
|
49
49
|
| `validate` | `(value: DateRange) => { valid: boolean; message?: string }` | `undefined` | Validate selected range before apply |
|
|
50
|
-
| `ranges` | `DateRangePreset[]` | `[]` |
|
|
51
|
-
| `rangeUnits` | `
|
|
50
|
+
| `ranges` | `DateRangePreset[]` | `[...RELATIVE_PRESETS, ...ABSOLUTE_PRESETS]` | Preset ranges |
|
|
51
|
+
| `rangeUnits` | `RelativeUnit[]` | all units | Units available in relative picker |
|
|
52
52
|
| `texts` | `Partial<Texts>` | `undefined` | Translations override — all keys optional |
|
|
53
53
|
| `disableDefaultTexts` | `boolean` | `false` | Disable built-in i18n fallbacks (for testing completeness) |
|
|
54
54
|
| `valueFormatOptions` | `DateToFormatOptions` | `undefined` | Format options for displayed value |
|
|
55
|
-
| `onValueChange` | `(value:
|
|
55
|
+
| `onValueChange` | `(value: DateRange) => void` | `undefined` | Fires on every change (before Apply) |
|
|
56
56
|
| `onVisibleChange` | `(visible: boolean) => void` | `undefined` | Fires when popover opens/closes |
|
|
57
57
|
| `onFilterSave` | `(filters: SavedFilter[]) => void` | `undefined` | Fires when a filter is saved |
|
|
58
58
|
| `disabled` | `boolean` | `false` | Disables picker (no popover, input non-interactive) |
|
|
59
59
|
| `readOnly` | `boolean` | `false` | Read-only (no popover, value displayed) |
|
|
60
60
|
| `popoverTrigger` | `ReactNode` | `undefined` | Replace default `RangePickerInput` trigger |
|
|
61
|
-
| `renderPopoverTrigger` | `(
|
|
61
|
+
| `renderPopoverTrigger` | `({ setPopupVisible }) => ReactNode` | `() => undefined` | Render-prop alternative for custom trigger |
|
|
62
|
+
| `timeZone` | `boolean \| string` | `undefined` | Opt into timezone-aware values — see *Implementation notes* |
|
|
62
63
|
| `popoverProps` | `Partial<Omit<PopoverProps, 'placement'>>` | `{}` | Pass-through to `@synerise/ds-popover` |
|
|
63
|
-
| `rangePickerInputProps` | `
|
|
64
|
-
| `footerProps` | `Partial<FooterProps>` | `undefined` |
|
|
64
|
+
| `rangePickerInputProps` | `RangePickerInputProps` | `{}` | Pass-through to trigger input; its `disabled` / `readOnly` are deprecated and have no effect |
|
|
65
|
+
| `footerProps` | `Partial<FooterProps>` without `onApply`, `onSwitchMode`, `mode`, `value`, `timeZone` | `undefined` | Overrides of the footer's state and texts |
|
|
65
66
|
| `allowedFilterTypes` | `RangeFilterType[]` | `undefined` | Restrict schedule filter types (DAILY/WEEKLY/MONTHLY) |
|
|
66
67
|
| `filterValueSelectionModes` | `DateLimitMode[]` | `["Range", "Hour"]` | Allowed modes in filter form |
|
|
67
68
|
| `filterRangeDisplayMode` | `RangeDisplayMode` | `undefined` | How the time window is rendered |
|
|
68
69
|
| `savedFilters` | `SavedFilter[]` | `undefined` | Pre-loaded saved filters |
|
|
69
70
|
| `valueTransformer` | `(value: DateRange) => DateRange` | omits ALL_TIME props | Transform applied to value before emitting |
|
|
70
|
-
| `isTruncateMs` | `boolean` | `
|
|
71
|
+
| `isTruncateMs` | `boolean` | `true` | Truncate milliseconds from times |
|
|
71
72
|
| `containerClass` | `string` | `'ds-date-range-picker'` | CSS class on the root wrapper |
|
|
72
73
|
| `getPopupContainer` | `(node: HTMLElement) => HTMLElement` | `() => document.body` | Popover mount container |
|
|
73
74
|
| `intl` | `IntlShape` | — | **Deprecated** — use `valueFormatOptions` |
|
|
74
|
-
| `format` | `string` | — | **Deprecated** — use `valueFormatOptions` |
|
|
75
75
|
|
|
76
76
|
### `RawDateRangePicker`
|
|
77
77
|
|
|
78
|
-
Same API as `DateRangePicker` but renders the picker panel directly (no popover, no input trigger). Use when embedding the panel in a custom container.
|
|
78
|
+
Same API as `DateRangePicker` (`RawDateRangePickerProps`) but renders the picker panel directly (no popover, no input trigger). Use when embedding the panel in a custom container.
|
|
79
79
|
|
|
80
80
|
### `DailyDateFilter`
|
|
81
81
|
|
|
@@ -87,14 +87,19 @@ Standalone weekly schedule filter component.
|
|
|
87
87
|
|
|
88
88
|
| Prop | Type | Description |
|
|
89
89
|
|------|------|-------------|
|
|
90
|
-
| `value` | `WeeklySchedule` | Controlled value |
|
|
90
|
+
| `value` | `WeeklySchedule` | Controlled value: `{ [guid]: { [dayIndex]?: WeeklyScheduleDayValue } }`, one entry per time range, days 0–6 |
|
|
91
91
|
| `onChange` | `(v: WeeklySchedule) => void` | Change callback |
|
|
92
|
+
| `errorTexts` | `{ [guid]: { [dayIndex]?: FilterErrorType } }` | Errors of one day's time inputs, shown when only that day is selected |
|
|
92
93
|
| `texts` | `Partial<Texts>` | Translations |
|
|
93
94
|
| …and more — see `WeeklyProps` | | |
|
|
94
95
|
|
|
96
|
+
A day value's `start` / `stop` are `undefined` once the time is cleared in the form. The new monthly scheduler has the same shape, with `DayOfMonthIndex` days: 0–30 by day of the month, 0–34 (week × 7 + weekday) with the WEEK period.
|
|
97
|
+
|
|
95
98
|
### `MonthlyDateFilter`
|
|
96
99
|
|
|
97
|
-
Standalone monthly schedule filter component.
|
|
100
|
+
Standalone monthly schedule filter — the legacy component the picker's filter addon uses, one rule list (`Month[]`). Props: `MonthlyFilterProps`.
|
|
101
|
+
|
|
102
|
+
The multi-range monthly scheduler (`MonthlySchedule`, props `MonthlyProps`) is not exported from the root yet: it replaces this component under the `MonthlyDateFilter` name when the duplicated schedulers are collapsed. Until then it is imported from `dist/RangeFilter/Filters/new/Monthly/Monthly`; its types come from the root.
|
|
98
103
|
|
|
99
104
|
### `TimeWindow`
|
|
100
105
|
|
|
@@ -103,10 +108,16 @@ Visualises a time window range (used inside `RangeFilter`). Exported for standal
|
|
|
103
108
|
### `getDisabledTimeOptions`
|
|
104
109
|
|
|
105
110
|
```ts
|
|
106
|
-
getDisabledTimeOptions(
|
|
111
|
+
getDisabledTimeOptions(
|
|
112
|
+
day: string | Date | undefined,
|
|
113
|
+
granularity: string,
|
|
114
|
+
lowerLimit?: NullableDateLimit,
|
|
115
|
+
upperLimit?: NullableDateLimit,
|
|
116
|
+
is12HoursClock?: boolean,
|
|
117
|
+
): number[]
|
|
107
118
|
```
|
|
108
119
|
|
|
109
|
-
Returns
|
|
120
|
+
Returns the hours, minutes or seconds (by `granularity`) to disable on `day` when a range is constrained.
|
|
110
121
|
|
|
111
122
|
### `fnsFormat`
|
|
112
123
|
|
|
@@ -122,9 +133,18 @@ Namespace export: `normalizeRange`, `toIsoString` (re-exported from `@synerise/d
|
|
|
122
133
|
|
|
123
134
|
Namespace export: all constants (`MODES`, `COLUMNS`, `RELATIVE_PRESETS`, `ABSOLUTE_PRESETS`, `TIME_OPTIONS`, mode strings, etc.).
|
|
124
135
|
|
|
136
|
+
### Other value exports
|
|
137
|
+
|
|
138
|
+
`isSinceRange` (narrows a `DateRange` to `SinceDateRange`), `DEFAULT_RANGE_START`, `DEFAULT_RANGE_END`, `COUNTED_FROM_ENUM`, `DAYS_OF_PERIOD_ENUM`, `MONTH_DAYS`, `FORM_MODES`, `RANGE_DISPLAY_MODES`, `EU_NOTATION_WEEK_DAYS_INDEXES`, `US_NOTATION_WEEK_DAYS_INDEXES`.
|
|
139
|
+
|
|
125
140
|
### Type exports
|
|
126
141
|
|
|
127
|
-
`AbsoluteDateRange`, `RelativeDateRange`, `DateRange
|
|
142
|
+
- Values: `DateRange`, `AbsoluteDateRange`, `RelativeDateRange`, `SinceDateRange` (deprecated), `DateFilter` (deprecated — use `DateRange`), `DateRangePreset`, `RelativeDateRangePreset`, `AbsoluteDateRangePreset`, `Duration`, `NullableDateLimit`, `DateLimit`, `RangeKey`, `RelativeUnit`, `RelativeUnits` (deprecated), `RelativeMode`
|
|
143
|
+
- Props: `DateRangePickerProps`, `RawDateRangePickerProps`, `DateRangePickerTexts`, `FooterProps`, `RangePickerInputProps`
|
|
144
|
+
- Filter payload (`DateRange.filter`): `RangeFilterValue` = `RangeFilterDaily` | `RangeFilterWeekly` | `RangeFilterMonthly`, with `RangeFilterDay`, `RangeFilterMonthRule`, `RangeFilterWeekRule`
|
|
145
|
+
- Schedule filter: `RangeFilterType`, `DateLimitMode`, `RangeDisplayMode`, `SavedFilter`, `DenormalizedFilter`, `Month`, `MonthlyFilterProps`, `DailyProps`, `DailySchedule`, `WeeklyProps`, `WeeklySchedule`, `WeeklyScheduleDayValue`, `DayOfWeekIndex`, `MonthlyProps`, `MonthlySchedule`, `MonthlyScheduleDayValue`, `DayOfMonthIndex`
|
|
146
|
+
|
|
147
|
+
Everything consumers used to deep-import from `dist/` is on the root; import from there. Two exceptions: the multi-range monthly scheduler component (see `MonthlyDateFilter` above) and the `PickerWrapper` styled component, which stays internal.
|
|
128
148
|
|
|
129
149
|
## Core data types
|
|
130
150
|
|
|
@@ -133,14 +153,24 @@ Namespace export: all constants (`MODES`, `COLUMNS`, `RELATIVE_PRESETS`, `ABSOLU
|
|
|
133
153
|
{ type: 'ABSOLUTE', from?: Date | string | null, to?: Date | string | null, key?: RangeKey }
|
|
134
154
|
|
|
135
155
|
// Relative range (last N units)
|
|
136
|
-
{ type: 'RELATIVE', duration: { type:
|
|
156
|
+
{ type: 'RELATIVE', future: false, duration: { type: RelativeUnit, value: number }, offset: { type: RelativeUnit, value: number } }
|
|
137
157
|
|
|
138
|
-
// Since a timestamp
|
|
139
|
-
|
|
158
|
+
// Since a timestamp (SinceDateRange) — deprecated: SINCE is unscoped and not supported. `type` stays
|
|
159
|
+
// 'RELATIVE' and the anchor Date sits in `offset.value`; narrow it with `isSinceRange`
|
|
160
|
+
{ type: 'RELATIVE', future: boolean, duration: { type: RelativeUnit, value: number }, offset: { type: 'SINCE', value: Date } }
|
|
140
161
|
|
|
141
|
-
type
|
|
162
|
+
type RelativeUnit = 'SECONDS' | 'MINUTES' | 'HOURS' | 'DAYS' | 'WEEKS' | 'MONTHS' | 'YEARS'
|
|
142
163
|
|
|
143
164
|
type RangeKey = 'TODAY' | 'YESTERDAY' | 'LAST_7_DAYS' | 'ALL_TIME' | … (17 presets)
|
|
165
|
+
|
|
166
|
+
// `filter` — set by the filter addon (`showFilter`), the stored schedule (RangeFilterValue).
|
|
167
|
+
// Days are 1-based; `inverted` on a monthly rule means counted from the end of the month.
|
|
168
|
+
{ type: 'DAILY', nestingType: 'IN_PLACE', from: 'HH:mm:ss.SSS', to: 'HH:mm:ss.SSS', inverted?: boolean, mode?: DateLimitMode }
|
|
169
|
+
{ type: 'WEEKLY', nestingType: 'IN_PLACE', days: { day: 1–7, from, to, inverted?, mode? }[] }
|
|
170
|
+
{ type: 'MONTHLY', nestingType: 'IN_PLACE', rules: (
|
|
171
|
+
| { type: 'MONTH', inverted: boolean, days: { day: 1–31, from, to, inverted?, mode? }[] }
|
|
172
|
+
| { type: 'WEEK', inverted: boolean, weeks: { week: 1–5, days: { day: 1–7, from, to, type: 'MONTHLY', … }[] }[] }
|
|
173
|
+
)[] }
|
|
144
174
|
```
|
|
145
175
|
|
|
146
176
|
## Usage patterns
|
|
@@ -150,21 +180,20 @@ import DateRangePicker from '@synerise/ds-date-range-picker';
|
|
|
150
180
|
import type { DateRange } from '@synerise/ds-date-range-picker';
|
|
151
181
|
|
|
152
182
|
// Minimal absolute
|
|
153
|
-
const [value, setValue] = useState<DateRange>(
|
|
183
|
+
const [value, setValue] = useState<DateRange>();
|
|
154
184
|
|
|
155
185
|
<DateRangePicker
|
|
156
186
|
value={value}
|
|
157
|
-
onApply={
|
|
187
|
+
onApply={setValue}
|
|
158
188
|
/>
|
|
159
189
|
|
|
160
|
-
// With relative picker and time
|
|
190
|
+
// With relative picker and time — the relative picker renders only with a non-empty relativeModes
|
|
161
191
|
<DateRangePicker
|
|
162
192
|
value={value}
|
|
163
|
-
onApply={
|
|
193
|
+
onApply={setValue}
|
|
164
194
|
showTime
|
|
165
195
|
showRelativePicker
|
|
166
|
-
|
|
167
|
-
relativeFuture
|
|
196
|
+
relativeModes={['PAST']}
|
|
168
197
|
/>
|
|
169
198
|
|
|
170
199
|
// Embed panel directly (no popover)
|
|
@@ -218,12 +247,12 @@ Addons (relative picker, filter) appear below the calendar and are toggled via `
|
|
|
218
247
|
- `RangePicker` (absolute calendar) is a class-based `PureComponent` — avoid passing new function references on every render to prevent unnecessary re-renders.
|
|
219
248
|
- `getModifiers()` in `RangePicker/utils.ts` returns react-day-picker `Matcher`s keyed by modifier name; each key becomes a `DayPicker-Day--<key>` class. It normalises the `Date | string | null` range bounds to `Date`, which the v7 code did with casts.
|
|
220
249
|
- `RelativeRangePicker` is also a class-based `PureComponent`.
|
|
221
|
-
- The `SINCE` mode is a variant of relative dating anchored to a specific timestamp rather than "now".
|
|
250
|
+
- The `SINCE` mode is a variant of relative dating anchored to a specific timestamp rather than "now". It and `FUTURE` are deprecated — unscoped, not supported, and reachable only through `relativeModes`.
|
|
222
251
|
- **`timeZone` prop — the only switch for timezone behaviour.** Set it and the panel decodes incoming bounds by their own offset, works in the resolved zone, and emits `from` / `to` as **`TZDate`**s carrying that zone instead of offset-carrying ISO strings. `true` uses the provider's `timeZone`; a string names an IANA zone directly. Same contract as `ds-date-picker` and `ds-time-picker`. `TZDate.toISOString()` gives the offset form; use `new Date(bound.getTime()).toISOString()` for a `Z` instant.
|
|
223
252
|
- **Without the prop nothing is timezone-aware, including a `timeZone` on the provider.** A zone on the `IntlProvider` must not switch any of this on: every unmigrated consumer already has one, so reading it re-bases all of them at once. Opted out, bounds are decoded by `rmvTZOffset` (strip `±hh:mm`, read the rest as a browser wall clock — the offset is *discarded*, which is the bug the prop fixes), the panel renders on the browser clock, and `onApply` emits ISO strings whose offset comes from the provider zone. That last half was always zone-aware; `encodeTimeZone` in `RawDateRangePicker` is what keeps it so, and dropping its `?? intl.timeZone` would emit `+00:00` and move every saved instant.
|
|
224
253
|
- **The resolved zone is passed down as a prop, never read from `useIntl` in a child.** `Footer`, `RangePickerInput`, `RangePicker`, `RelativeRangePicker`, `CustomRangeForm` and `TimestampRange` all take `timeZone?: string`, which is `undefined` when the prop is absent. `dateUtils/getNow` takes the same value rather than an `IntlShape`. A `useIntl().timeZone` read in any of them silently re-introduces the ungated behaviour, and the `without the timeZone prop` block in `DateRangePicker.timezones.spec.tsx` is what catches it.
|
|
225
254
|
- **Internal date convention:** inside the panel a `Date` holds the *wall clock of the provider timezone* in its local fields — `toIsoString` (ds-core) is the encoder of that convention, `getValueAsLocalDate` / `getLocalDateInTimeZone` the decoders. Conversion happens only at the boundaries: values coming in (`normalizeRange(value, timeZone)`, and the time panel's ISO strings in `handleRangeChange`) and values going out (`toEmittedLimit` in `handleApply` / `onValueChange`). Display sites re-anchor to a real instant via `getDateToDisplay` and force `applyTimeZoneOffset: true` through `getFormatOptionsToDisplay` (`dateUtils/displayDate.ts`), because `formatValue` only projects an instant into the provider timezone when that flag is set and it defaults to `false` in `DataFormatConfig`. Mixing the two representations shifts values by the browser-to-provider timezone delta.
|
|
226
255
|
- **`value` accepts a `Date` as a true instant**, an ISO string as offset-carrying. A day selected in the calendar is `00:00:00`–`23:59:59` in the *provider* timezone, so consumers must read the calendar day back in that timezone rather than from browser-local fields.
|
|
227
|
-
- **Everything that means "now" goes through `dateUtils/getNow.ts`** — `getNow(
|
|
256
|
+
- **Everything that means "now" goes through `dateUtils/getNow.ts`** — `getNow(timeZone)` returns the zone's clock as a wall-clock date (the browser clock when `timeZone` is `undefined`). It backs the relative presets (`TODAY`/`YESTERDAY`/`LAST_MONTH` resolve on the provider's day, which across the date line is not the browser's), the circled `today` calendar modifier, the month the calendars open on, the "Now" button and the SINCE anchor. Nothing in the package may capture `new Date()` at module load — the one remaining case, `RangeFilter/Shared/TimeWindow/utils.tsx`, is a deliberate date carrier for time-of-day strings and is commented as such.
|
|
228
257
|
- `normalizeRange(range, timeZone?)` from `utils` converts relative ranges to absolute `Date` objects and optionally adjusts for timezone — used internally and safe to call from consuming code. The `timeZone` argument means two different things by branch: for a **relative** range it is the clock "now" is read from; for an **absolute** one it decodes incoming bounds (a `Date` there is read as a real instant). Internal call sites therefore use `normalizeLocalRange(range, timeZone)`, which passes the timezone only on the relative branch — handing it to the absolute branch would re-decode bounds that are already wall clock and shift them by the timezone delta.
|
|
229
258
|
- **`utils.toIsoString` is a re-export of ds-core's**, not a local implementation. Do not reintroduce a copy here: the one that used to live in `src/utils.ts` dropped the minutes of every non-whole-hour offset and read the offset off the wrong clock.
|
package/README.md
CHANGED
|
@@ -31,6 +31,7 @@ const value = {
|
|
|
31
31
|
onApply={console.log}
|
|
32
32
|
showFilter={false}
|
|
33
33
|
showRelativePicker
|
|
34
|
+
relativeModes={['PAST']}
|
|
34
35
|
value={value}
|
|
35
36
|
forceAbsolute={false}
|
|
36
37
|
/>
|
|
@@ -46,27 +47,28 @@ const value = {
|
|
|
46
47
|
| Property | Description | Type | Default |
|
|
47
48
|
| ------------------------- | -------------------------------------------------------------------------------- | -------------------------- | ------------------------------------------------------------- |
|
|
48
49
|
| disabledDate | Function to specify if particular dates are disabled or not | (date:Date)=>boolean | - |
|
|
49
|
-
| disabledDefaultTexts | Disables the default texts translations provided by `react-intl` | boolean | `false` |
|
|
50
50
|
| forceAbsolute | Force the outcome to be converted to an absolute date | boolean | `false` |
|
|
51
|
-
| onApply | Callback executed after applying changes
|
|
52
|
-
| ranges | An array containing custom ranges which may be used as a short-hand | DateRangePreset[] |
|
|
51
|
+
| onApply | Callback executed after applying changes, and with `undefined` (or `defaultValue`) when the input is cleared | (value: DateRange \| undefined) => void | - |
|
|
52
|
+
| ranges | An array containing custom ranges which may be used as a short-hand | DateRangePreset[] | relative and absolute presets |
|
|
53
53
|
| popoverProps | Object representing props applied to the ds-popover component | Partial<PopoverProps> | {} |
|
|
54
|
-
| rangeUnits | Units available in relative range picker |
|
|
54
|
+
| rangeUnits | Units available in relative range picker | RelativeUnit[] | ['SECONDS','MINUTES','HOURS','DAYS','WEEKS','MONTHS','YEARS'] |
|
|
55
55
|
| readOnly | Makes picker readonly | boolean | `false` |
|
|
56
56
|
| disabled | Makes picker disabled | boolean | `false` |
|
|
57
|
-
| relativePast |
|
|
58
|
-
| relativeFuture |
|
|
57
|
+
| relativePast | **Deprecated** — no effect on the modes offered; use `relativeModes` | boolean | `true` |
|
|
58
|
+
| relativeFuture | **Deprecated** — no effect on the modes offered; use `relativeModes` | boolean | - |
|
|
59
59
|
| showTime | Enable user to choose particular hour | boolean | `false` |
|
|
60
60
|
| showNowButton | Include "now" button to select current time (last minue) | boolean | `true` |
|
|
61
61
|
| showFilter | Enable range filtering | boolean | `false` |
|
|
62
62
|
| showCustomRange | Enable custom range form in relative range picker | boolean | `true` |
|
|
63
63
|
| validate | Function to specify if particular date ranges are correct | (value: DateRange) => { valid: boolean; message?: string } | - |
|
|
64
|
-
| value | Value of the picker | DateRange
|
|
64
|
+
| value | Value of the picker | DateRange \| undefined | |
|
|
65
65
|
| defaultValue | Default value of the picker (when value is undefined and when user clears input) | DateRange | |
|
|
66
|
-
| showRelativePicker | Show collapsible relative range picker addon
|
|
67
|
-
| relativeModes |
|
|
66
|
+
| showRelativePicker | Show collapsible relative range picker addon (needs a non-empty `relativeModes`) | boolean | `true` |
|
|
67
|
+
| relativeModes | Relative modes; the addon renders only when non-empty. Use `['PAST']` — `FUTURE` and `SINCE` are unscoped and not supported | RelativeMode[] | - |
|
|
68
|
+
| timeZone | Opt into timezone-aware values: `true` uses the provider zone, a string names an IANA zone | boolean \| string | - |
|
|
69
|
+
| isTruncateMs | Truncate milliseconds from times | boolean | `true` |
|
|
68
70
|
| valueFormatOptions | Format options for the displayed value | DateToFormatOptions | - |
|
|
69
|
-
| onValueChange | Callback executed on every value change (before Apply) | (value:
|
|
71
|
+
| onValueChange | Callback executed on every value change (before Apply) | (value: DateRange) => void | - |
|
|
70
72
|
| onVisibleChange | Callback executed when popover with dateRangePicker changes its visibility | (visible: boolean) => void | - |
|
|
71
73
|
| filterValueSelectionModes | Allowed modes to display in filter | DateLimitMode[] | ["Range", "Hour"] |
|
|
72
74
|
| getPopupContainer | Function used to set the container of the date range picker. | Function(triggerNode) | `() => document.body` |
|
|
@@ -79,12 +81,16 @@ const value = {
|
|
|
79
81
|
| -------- | ---------------------------------------------- | ------------------------------------- | ------- |
|
|
80
82
|
| from | Start date | Date / string | - |
|
|
81
83
|
| to | End date | Date / string | - |
|
|
82
|
-
| type | String key for identifying the range type | 'ABSOLUTE' / 'RELATIVE'
|
|
83
|
-
| duration | Duration of the relative range | {type: RelativeUnit,
|
|
84
|
-
| offset | Offset of the relative range from today's date | {type: RelativeUnit,
|
|
84
|
+
| type | String key for identifying the range type | 'ABSOLUTE' / 'RELATIVE' | - |
|
|
85
|
+
| duration | Duration of the relative range | {type: RelativeUnit, value: number} | - |
|
|
86
|
+
| offset | Offset of the relative range from today's date | {type: RelativeUnit, value: number} | - |
|
|
85
87
|
|
|
86
88
|
`RelativeUnit = 'SECONDS' | 'MINUTES' | 'HOURS' | 'DAYS' | 'WEEKS' | 'MONTHS' | 'YEARS'`
|
|
87
89
|
|
|
90
|
+
A SINCE range (`SinceDateRange`, deprecated — unscoped, not supported) keeps `type: 'RELATIVE'` and carries its anchor `Date` in `offset: { type: 'SINCE', value }`. `type` cannot tell it from a relative range; `isSinceRange(range)` does.
|
|
91
|
+
|
|
92
|
+
`DateRange` is `AbsoluteDateRange | RelativeDateRange | SinceDateRange`. `DateFilter` is deprecated: `onApply` and `onValueChange` emit a `DateRange`, and `DateRange.filter` is a `RangeFilterValue`.
|
|
93
|
+
|
|
88
94
|
### Texts
|
|
89
95
|
|
|
90
96
|
- `texts` prop is now optional
|
|
@@ -181,6 +187,13 @@ const value = {
|
|
|
181
187
|
|
|
182
188
|
- min in `MonthlyFilter` - controls minimal amount of entires in monthly filter, disable with `undefined`, default is `1`
|
|
183
189
|
|
|
190
|
+
### Filter payload
|
|
191
|
+
|
|
192
|
+
With `showFilter`, the applied schedule is stored in `value.filter` as a `RangeFilterValue` (exported from the
|
|
193
|
+
package root): `RangeFilterDaily`, `RangeFilterWeekly` (`days`) or `RangeFilterMonthly` (`rules`, each a
|
|
194
|
+
`RangeFilterMonthRule` by day of the month or a `RangeFilterWeekRule` by weekday of a week). Days are 1-based and
|
|
195
|
+
times are `HH:mm:ss.SSS` strings.
|
|
196
|
+
|
|
184
197
|
## Timezone support
|
|
185
198
|
|
|
186
199
|
Timezone handling is **opt-in, behind the `timeZone` prop**. Set it and the picker:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
export type Props = {
|
|
3
|
-
content:
|
|
4
|
-
title:
|
|
3
|
+
content: ReactNode;
|
|
4
|
+
title: ReactNode;
|
|
5
5
|
expanded?: boolean;
|
|
6
6
|
onCollapseChange?: (collapsed: boolean) => void;
|
|
7
|
-
collapsedSummary?:
|
|
7
|
+
collapsedSummary?: ReactNode;
|
|
8
8
|
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { Dispatch, ReactNode, SetStateAction } from 'react';
|
|
2
2
|
import { IntlShape } from 'react-intl';
|
|
3
3
|
import { DateToFormatOptions } from '@synerise/ds-core';
|
|
4
4
|
import { LegacyPlacement, PopoverProps } from '@synerise/ds-popover';
|
|
5
|
-
import {
|
|
5
|
+
import { DateRange, DateRangePreset, RelativeUnit } from './date.types';
|
|
6
6
|
import { Props as FooterProps } from './Footer/Footer.types';
|
|
7
7
|
import { RangeFilterType } from './RangeFilter/constants';
|
|
8
|
-
import { FilterDefinition } from './RangeFilter/RangeFilter.types';
|
|
9
8
|
import { SavedFilter } from './RangeFilter/Shared/FilterDropdown/FilterDropdown.types';
|
|
10
9
|
import { DateLimitMode, RangeDisplayMode } from './RangeFilter/Shared/TimeWindow/RangeFormContainer/RangeForm/RangeForm.types';
|
|
11
10
|
import { RangePickerInputProps } from './RangePickerInput/RangePickerInput.types';
|
|
@@ -25,8 +24,13 @@ export type DateRangePickerProps = {
|
|
|
25
24
|
valueFormatOptions?: DateToFormatOptions;
|
|
26
25
|
forceAdjacentMonths?: boolean;
|
|
27
26
|
forceAbsolute?: boolean;
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
/** Overrides of the footer's state and texts; its handlers and value belong to the panel. */
|
|
28
|
+
footerProps?: Partial<Omit<FooterProps, 'onApply' | 'onSwitchMode' | 'mode' | 'value' | 'timeZone'>>;
|
|
29
|
+
/**
|
|
30
|
+
* Fires on every change in the panel, before Apply. With the `timeZone` prop the bounds are
|
|
31
|
+
* emitted as on `onApply`; without it they are the panel's local dates.
|
|
32
|
+
*/
|
|
33
|
+
onValueChange?: (value: DateRange) => void;
|
|
30
34
|
/**
|
|
31
35
|
* Opts into timezone-aware values: the emitted `from` / `to` become `TZDate`s carrying the
|
|
32
36
|
* resolved zone instead of offset-carrying ISO strings, and the panel works in that zone.
|
|
@@ -34,16 +38,31 @@ export type DateRangePickerProps = {
|
|
|
34
38
|
* component behaves exactly as before — provider zone, ISO strings out.
|
|
35
39
|
*/
|
|
36
40
|
timeZone?: boolean | string;
|
|
37
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Fires on Apply, and with `undefined` (or `defaultValue`, when set) when the trigger input is
|
|
43
|
+
* cleared. Absolute bounds are offset-carrying ISO strings, or `TZDate`s with the `timeZone`
|
|
44
|
+
* prop; a relative range carries no bounds unless `forceAbsolute` resolves it.
|
|
45
|
+
*/
|
|
46
|
+
onApply: (value: DateRange | undefined) => void;
|
|
38
47
|
onVisibleChange?: (visible: boolean) => void;
|
|
39
48
|
onFilterSave?: (filters: SavedFilter[]) => void;
|
|
40
49
|
popoverProps?: Partial<Omit<PopoverProps, 'placement'>>;
|
|
41
50
|
popoverTrigger?: ReactNode;
|
|
42
51
|
placement?: LegacyPlacement;
|
|
43
52
|
ranges?: DateRangePreset[];
|
|
44
|
-
rangeUnits?:
|
|
53
|
+
rangeUnits?: RelativeUnit[];
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated has no effect on the modes offered — they come from `relativeModes` only
|
|
56
|
+
*/
|
|
45
57
|
relativeFuture?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated has no effect on the modes offered — they come from `relativeModes` only
|
|
60
|
+
*/
|
|
46
61
|
relativePast?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Modes of the relative picker, which renders only when this is non-empty. Pass `['PAST']`:
|
|
64
|
+
* `'FUTURE'` and `'SINCE'` are unscoped and not supported.
|
|
65
|
+
*/
|
|
47
66
|
relativeModes?: RelativeMode[];
|
|
48
67
|
savedFilters?: SavedFilter[];
|
|
49
68
|
showRelativePicker?: boolean;
|
|
@@ -56,7 +75,7 @@ export type DateRangePickerProps = {
|
|
|
56
75
|
valid: boolean;
|
|
57
76
|
message?: string;
|
|
58
77
|
};
|
|
59
|
-
value
|
|
78
|
+
value?: DateRange;
|
|
60
79
|
defaultValue?: DateRange;
|
|
61
80
|
/**
|
|
62
81
|
* transforms value, by default omits ALL_TIME props
|
|
@@ -65,16 +84,19 @@ export type DateRangePickerProps = {
|
|
|
65
84
|
disableAbsoluteTimepickerInRelative?: boolean;
|
|
66
85
|
rangePickerInputProps?: Omit<RangePickerInputProps, 'disabled' | 'readOnly'> & {
|
|
67
86
|
/**
|
|
68
|
-
* @deprecated
|
|
87
|
+
* @deprecated has no effect — pass `disabled` to DateRangePicker
|
|
69
88
|
*/
|
|
70
89
|
disabled?: RangePickerInputProps['disabled'];
|
|
71
90
|
/**
|
|
72
|
-
* @deprecated
|
|
91
|
+
* @deprecated has no effect — pass `readOnly` to DateRangePicker
|
|
73
92
|
*/
|
|
74
93
|
readOnly?: RangePickerInputProps['readOnly'];
|
|
75
94
|
};
|
|
76
95
|
allowedFilterTypes?: RangeFilterType[];
|
|
77
|
-
|
|
96
|
+
/** Renders a custom trigger; return nothing to fall back to `popoverTrigger` or the input. */
|
|
97
|
+
renderPopoverTrigger?: (args: {
|
|
98
|
+
setPopupVisible: Dispatch<SetStateAction<boolean>>;
|
|
99
|
+
}) => ReactNode;
|
|
78
100
|
isTruncateMs?: boolean;
|
|
79
101
|
filterValueSelectionModes?: DateLimitMode[];
|
|
80
102
|
filterRangeDisplayMode?: RangeDisplayMode;
|
|
@@ -84,16 +106,14 @@ export type DateRangePickerProps = {
|
|
|
84
106
|
* @deprecated use `DateRangePickerProps`
|
|
85
107
|
*/
|
|
86
108
|
export type Props = DateRangePickerProps;
|
|
109
|
+
export type RawDateRangePickerProps = Omit<DateRangePickerProps, 'placement'>;
|
|
110
|
+
/**
|
|
111
|
+
* Only `'PAST'` is supported. `'FUTURE'` and `'SINCE'` are unscoped and not supported, and will
|
|
112
|
+
* be removed.
|
|
113
|
+
*/
|
|
87
114
|
export type RelativeMode = 'PAST' | 'FUTURE' | 'SINCE';
|
|
88
|
-
export interface State {
|
|
89
|
-
mode: string;
|
|
90
|
-
value: DateRange;
|
|
91
|
-
filter?: FilterDefinition;
|
|
92
|
-
visibleAddonKey?: string | undefined;
|
|
93
|
-
alignContentToTop?: boolean;
|
|
94
|
-
}
|
|
95
115
|
export type Texts = {
|
|
96
|
-
[k in Translations]:
|
|
116
|
+
[k in Translations]: ReactNode;
|
|
97
117
|
} & {
|
|
98
118
|
[k in TranslationsPlaceholders]: string;
|
|
99
119
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
import { DateToFormatOptions } from '@synerise/ds-core';
|
|
2
3
|
import { Texts } from '../DateRangePicker.types';
|
|
3
4
|
import { DateRange } from '../date.types';
|
|
@@ -13,9 +14,9 @@ export type Props = {
|
|
|
13
14
|
value?: DateRange;
|
|
14
15
|
canApply?: boolean;
|
|
15
16
|
canSwitchMode?: boolean;
|
|
16
|
-
onApply?: (
|
|
17
|
+
onApply?: (value?: DateRange) => void;
|
|
17
18
|
onSwitchMode?: () => void;
|
|
18
|
-
message?:
|
|
19
|
+
message?: ReactNode;
|
|
19
20
|
texts: Texts;
|
|
20
21
|
valueFormatOptions?: DateToFormatOptions;
|
|
21
22
|
showTime?: boolean;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { WrappedComponentProps } from 'react-intl';
|
|
3
3
|
import { WithTranslations } from '../../../DateRangePicker.types';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { RangeActions as RangeActionsMethods } from '../../Shared/TimeWindow/TimeWindow.types';
|
|
4
|
+
import { WithDisabledProp } from '../../RangeFilter.types';
|
|
5
|
+
import { DateLimitMode, RangeDisplayMode } from '../../Shared/TimeWindow/RangeFormContainer/RangeForm/RangeForm.types';
|
|
6
|
+
import { DayOptions, RangeActions as RangeActionsMethods } from '../../Shared/TimeWindow/TimeWindow.types';
|
|
8
7
|
export interface Props extends WrappedComponentProps, Partial<RangeActionsMethods>, WithTranslations, WithDisabledProp {
|
|
9
8
|
value: string;
|
|
10
|
-
onChange: (v:
|
|
9
|
+
onChange: (v: DayOptions) => void;
|
|
11
10
|
rangeDisplayMode?: RangeDisplayMode;
|
|
12
|
-
valueSelectionModes:
|
|
11
|
+
valueSelectionModes: DateLimitMode[];
|
|
13
12
|
}
|
|
14
13
|
declare const _default: React.FC<import('react-intl').WithIntlProps<Props>> & {
|
|
15
14
|
WrappedComponent: React.ComponentType<Props>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
import { IntlShape } from 'react-intl';
|
|
2
3
|
import { TimePickerProps } from '@synerise/ds-time-picker';
|
|
3
4
|
import { WithTranslations } from '../../../DateRangePicker.types';
|
|
@@ -10,7 +11,7 @@ export type MonthlyFilterProps = {
|
|
|
10
11
|
value: Month[];
|
|
11
12
|
onChange: (definition: Month[]) => void;
|
|
12
13
|
intl: IntlShape;
|
|
13
|
-
renderRangeFormSuffix?: () =>
|
|
14
|
+
renderRangeFormSuffix?: () => ReactNode;
|
|
14
15
|
daysOfPeriods?: MonthlySelectValue<DAYS_OF_PERIOD_ENUM>[];
|
|
15
16
|
countedFromPeriods?: MonthlySelectValue<COUNTED_FROM_ENUM>[];
|
|
16
17
|
timePickerProps?: Partial<TimePickerProps>;
|
|
@@ -20,7 +21,7 @@ export type MonthlyFilterProps = {
|
|
|
20
21
|
} & WithDisabledProp & Partial<RangeActions> & Partial<WithTranslations>;
|
|
21
22
|
export type Month<T = DenormalizedFilter> = {
|
|
22
23
|
id: string | number;
|
|
23
|
-
period: DAYS_OF_PERIOD_ENUM
|
|
24
|
+
period: DAYS_OF_PERIOD_ENUM;
|
|
24
25
|
periodType?: string;
|
|
25
26
|
definition: {
|
|
26
27
|
[day: number]: T;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
1
2
|
import { WeeklyFilterProps } from './WeeklyFilter.types';
|
|
2
|
-
declare const WeeklyFilter: ({ value, onChange, onRangeClear, onRangePaste, onRangeCopy, rangeClipboard, intl, valueSelectionModes, rangeDisplayMode, texts, }: WeeklyFilterProps) =>
|
|
3
|
+
declare const WeeklyFilter: ({ value, onChange, onRangeClear, onRangePaste, onRangeCopy, rangeClipboard, intl, valueSelectionModes, rangeDisplayMode, texts, }: WeeklyFilterProps) => ReactElement;
|
|
3
4
|
export default WeeklyFilter;
|
|
@@ -2,7 +2,7 @@ import { IntlShape } from 'react-intl';
|
|
|
2
2
|
import { WithTranslations } from '../../../DateRangePicker.types';
|
|
3
3
|
import { FilterDefinition } from '../../RangeFilter.types';
|
|
4
4
|
import { DateLimitMode, RangeDisplayMode } from '../../Shared/TimeWindow/RangeFormContainer/RangeForm/RangeForm.types';
|
|
5
|
-
import {
|
|
5
|
+
import { Days, RangeActions } from '../../Shared/TimeWindow/TimeWindow.types';
|
|
6
6
|
export type WeeklyFilterProps = {
|
|
7
7
|
value: Days;
|
|
8
8
|
onChange: (days: Days) => void;
|
|
@@ -11,7 +11,3 @@ export type WeeklyFilterProps = {
|
|
|
11
11
|
valueSelectionModes: DateLimitMode[];
|
|
12
12
|
rangeDisplayMode?: RangeDisplayMode;
|
|
13
13
|
} & WithTranslations & Partial<RangeActions>;
|
|
14
|
-
export type DayKey = number | string;
|
|
15
|
-
export type Days = {
|
|
16
|
-
[key in DayKey]: DayOptions;
|
|
17
|
-
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { DateToFormatOptions } from '@synerise/ds-core';
|
|
2
2
|
import { TimePickerProps } from '@synerise/ds-time-picker';
|
|
3
3
|
import { DateLimitMode } from '../../Shared/TimeWindow/RangeFormContainer/RangeForm/RangeForm.types';
|
|
4
|
+
import { DayKey } from '../../Shared/TimeWindow/TimeWindow.types';
|
|
5
|
+
export type ScheduleRows<T> = Record<string, Record<DayKey, T>>;
|
|
4
6
|
export type FilterBaseProps = {
|
|
5
7
|
maxEntries?: number;
|
|
6
8
|
valueSelectionMode?: DateLimitMode[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { MonthlyProps } from './Monthly.types';
|
|
3
|
-
declare const Monthly: ({ maxEntries, valueSelectionMode, onChange, timeFormat, valueFormatOptions, value, timePickerProps, disabled, texts, periodType, countedFrom, errorTexts, }: MonthlyProps) => React.JSX.Element;
|
|
3
|
+
declare const Monthly: ({ maxEntries, valueSelectionMode, onChange, timeFormat, valueFormatOptions, value: schedule, timePickerProps, disabled, texts, periodType, countedFrom, errorTexts: scheduleErrors, }: MonthlyProps) => React.JSX.Element;
|
|
4
4
|
export default Monthly;
|