@synerise/ds-date-range-picker 0.20.1 → 0.20.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 +24 -0
- package/dist/Footer/Footer.d.ts +1 -1
- package/dist/RangeFilter/Filters/new/Filters.types.d.ts +5 -0
- package/dist/RangeFilter/Filters/new/Weekly/Weekly.js +3 -2
- package/dist/RangeFilter/Shared/TimeWindow/RangeFormContainer/RangeForm/RangeForm.js +8 -5
- package/dist/RangeFilter/Shared/TimeWindow/RangeFormContainer/RangeForm/RangeForm.types.d.ts +1 -1
- package/dist/RangeFilter/Shared/TimeWindow/RangeFormContainer/RangeFormContainer.js +4 -2
- package/dist/RangeFilter/Shared/TimeWindow/RangeFormContainer/RangeFormContainer.types.d.ts +5 -0
- package/dist/RawDateRangePicker.d.ts +1 -1
- package/dist/utils.js +14 -5
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
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
|
+
## [0.20.3](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@0.20.2...@synerise/ds-date-range-picker@0.20.3) (2023-03-24)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **date-range-picker:** data format in date range picker usage fix ([0f17e68](https://github.com/Synerise/synerise-design/commit/0f17e68dbdf1d324e939e2dc45f5c5a454dc20f7))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.20.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@0.20.1...@synerise/ds-date-range-picker@0.20.2) (2023-03-22)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **date-range-picker:** display date range for relative ranges fixed ([fedcf35](https://github.com/Synerise/synerise-design/commit/fedcf356e86e5ccb4c82cd4c8bb4b85fc845de5d))
|
|
23
|
+
* **date-range-picker:** exclude date ranges with offset.type 'since' ([a73e689](https://github.com/Synerise/synerise-design/commit/a73e689be1259b4537cb882f544773be38c9a7a6))
|
|
24
|
+
* **date-range-picker:** round relative boundary to smaller unit ([2c47a26](https://github.com/Synerise/synerise-design/commit/2c47a26d528ba6f1845c13840fa3b997f8d5fda3))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## [0.20.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@0.20.0...@synerise/ds-date-range-picker@0.20.1) (2023-03-21)
|
|
7
31
|
|
|
8
32
|
**Note:** Version bump only for package @synerise/ds-date-range-picker
|
package/dist/Footer/Footer.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Props } from './Footer.types';
|
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "texts" | "
|
|
3
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "texts" | "valueFormatOptions" | "format" | "mode" | "value" | "message" | "onApply" | "showTime" | "dateOnly" | "canSwitchMode" | "onSwitchMode" | "canApply" | "displayDateContainerClass"> & {
|
|
4
4
|
forwardedRef?: ((instance: any) => void) | React.RefObject<any> | null | undefined;
|
|
5
5
|
} & React.RefAttributes<any>> & {
|
|
6
6
|
WrappedComponent: React.ComponentType<Props>;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { TimePickerProps } from '@synerise/ds-time-picker';
|
|
2
|
+
import type { DateToFormatOptions } from '@synerise/ds-data-format';
|
|
2
3
|
import { DateLimitMode } from '../../Shared/TimeWindow/RangeFormContainer/RangeForm/RangeForm.types';
|
|
3
4
|
export declare type FilterBaseProps = {
|
|
4
5
|
maxEntries?: number;
|
|
5
6
|
valueSelectionMode?: DateLimitMode[];
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated use `valueFormatOptions` instead
|
|
9
|
+
*/
|
|
6
10
|
timeFormat?: string;
|
|
7
11
|
timePickerProps?: Partial<TimePickerProps>;
|
|
12
|
+
valueFormatOptions?: DateToFormatOptions;
|
|
8
13
|
};
|
|
@@ -26,8 +26,8 @@ var Weekly = function Weekly(_ref) {
|
|
|
26
26
|
valueSelectionMode = _ref$valueSelectionMo === void 0 ? ['Hour', 'Range'] : _ref$valueSelectionMo,
|
|
27
27
|
_ref$onChange = _ref.onChange,
|
|
28
28
|
onChange = _ref$onChange === void 0 ? NOOP : _ref$onChange,
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
timeFormat = _ref.timeFormat,
|
|
30
|
+
valueFormatOptions = _ref.valueFormatOptions,
|
|
31
31
|
value = _ref.value,
|
|
32
32
|
timePickerProps = _ref.timePickerProps,
|
|
33
33
|
disabled = _ref.disabled;
|
|
@@ -291,6 +291,7 @@ var Weekly = function Weekly(_ref) {
|
|
|
291
291
|
renderSuffix: RENDER_EMPTY_NODE_FN,
|
|
292
292
|
timePickerProps: timePickerProps,
|
|
293
293
|
timeFormat: timeFormat,
|
|
294
|
+
valueFormatOptions: valueFormatOptions,
|
|
294
295
|
disabled: disabled
|
|
295
296
|
});
|
|
296
297
|
}), isAnyDaySelected && !canAddRange && /*#__PURE__*/React.createElement(SelectionHint, {
|
|
@@ -27,7 +27,8 @@ var RangeForm = function RangeForm(_ref) {
|
|
|
27
27
|
_ref$mode = _ref.mode,
|
|
28
28
|
mode = _ref$mode === void 0 ? valueSelectionModes[0] : _ref$mode,
|
|
29
29
|
timePickerProps = _ref.timePickerProps,
|
|
30
|
-
texts = _ref.texts
|
|
30
|
+
texts = _ref.texts,
|
|
31
|
+
valueFormatOptions = _ref.valueFormatOptions;
|
|
31
32
|
|
|
32
33
|
var _useDataFormat = useDataFormat(),
|
|
33
34
|
is12HoursClock = _useDataFormat.is12HoursClock;
|
|
@@ -63,9 +64,10 @@ var RangeForm = function RangeForm(_ref) {
|
|
|
63
64
|
disabledHours: [],
|
|
64
65
|
disabledMinutes: [],
|
|
65
66
|
disabledSeconds: [],
|
|
66
|
-
use12HourClock: is12HoursClock
|
|
67
|
+
use12HourClock: is12HoursClock,
|
|
68
|
+
valueFormatOptions: valueFormatOptions
|
|
67
69
|
}, timePickerProps));
|
|
68
|
-
}, [start, onExactHourSelect, getPopupContainer, texts, timePickerProps, disabled, is12HoursClock]);
|
|
70
|
+
}, [start, onExactHourSelect, getPopupContainer, texts, timePickerProps, disabled, is12HoursClock, valueFormatOptions]);
|
|
69
71
|
var renderRangePicker = React.useCallback(function () {
|
|
70
72
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TimePicker, _extends({
|
|
71
73
|
disabled: disabled,
|
|
@@ -81,7 +83,8 @@ var RangeForm = function RangeForm(_ref) {
|
|
|
81
83
|
disabledHours: getDisabledTimeOptions(start || end, 'HOURS', null, end, is12HoursClock),
|
|
82
84
|
disabledMinutes: getDisabledTimeOptions(start || end, 'MINUTES', null, end, is12HoursClock),
|
|
83
85
|
disabledSeconds: getDisabledTimeOptions(start || end, 'SECONDS', null, end, is12HoursClock),
|
|
84
|
-
use12HourClock: is12HoursClock
|
|
86
|
+
use12HourClock: is12HoursClock,
|
|
87
|
+
valueFormatOptions: valueFormatOptions
|
|
85
88
|
}, timePickerProps)), /*#__PURE__*/React.createElement(S.Separator, null, "-"), /*#__PURE__*/React.createElement(TimePicker, _extends({
|
|
86
89
|
disabled: disabled,
|
|
87
90
|
clearTooltip: texts == null ? void 0 : texts.clear,
|
|
@@ -98,7 +101,7 @@ var RangeForm = function RangeForm(_ref) {
|
|
|
98
101
|
disabledSeconds: getDisabledTimeOptions(end || start, 'SECONDS', start, null, is12HoursClock),
|
|
99
102
|
use12HourClock: is12HoursClock
|
|
100
103
|
}, timePickerProps)));
|
|
101
|
-
}, [start, end, onStartChange, onEndChange, setStart, setEnd, getPopupContainer, texts, timePickerProps, disabled, is12HoursClock]);
|
|
104
|
+
}, [start, end, onStartChange, onEndChange, setStart, setEnd, getPopupContainer, texts, timePickerProps, disabled, is12HoursClock, valueFormatOptions]);
|
|
102
105
|
var limitModeSelect = React.useMemo(function () {
|
|
103
106
|
return valueSelectionModes.length > 1 ? /*#__PURE__*/React.createElement(Select, {
|
|
104
107
|
value: mode,
|
package/dist/RangeFilter/Shared/TimeWindow/RangeFormContainer/RangeForm/RangeForm.types.d.ts
CHANGED
|
@@ -14,4 +14,4 @@ export declare type RangeFormProps = {
|
|
|
14
14
|
onExactHourSelect: (value?: Date) => void;
|
|
15
15
|
onRangeDelete?: () => void;
|
|
16
16
|
valueSelectionModes: DateLimitMode[];
|
|
17
|
-
} & WithTranslations & WithDisabledProp & Pick<RangeFormContainerProps, 'timePickerProps'>;
|
|
17
|
+
} & WithTranslations & WithDisabledProp & Pick<RangeFormContainerProps, 'timePickerProps' | 'valueFormatOptions'>;
|
|
@@ -36,7 +36,8 @@ var RangeFormContainer = function RangeFormContainer(_ref) {
|
|
|
36
36
|
onModeChange = _ref.onModeChange,
|
|
37
37
|
timePickerProps = _ref.timePickerProps,
|
|
38
38
|
renderSuffix = _ref.renderSuffix,
|
|
39
|
-
timeFormat = _ref.timeFormat
|
|
39
|
+
timeFormat = _ref.timeFormat,
|
|
40
|
+
valueFormatOptions = _ref.valueFormatOptions;
|
|
40
41
|
var dayValue = getDayValue(activeDays[0]);
|
|
41
42
|
|
|
42
43
|
var _React$useState = React.useState((dayValue == null ? void 0 : dayValue.mode) || valueSelectionModes[0] || DEFAULT_LIMIT_MODE),
|
|
@@ -103,9 +104,10 @@ var RangeFormContainer = function RangeFormContainer(_ref) {
|
|
|
103
104
|
onExactHourSelect: onExactHourSelect,
|
|
104
105
|
onRangeDelete: onRangeDelete,
|
|
105
106
|
valueSelectionModes: valueSelectionModes,
|
|
107
|
+
valueFormatOptions: valueFormatOptions,
|
|
106
108
|
timePickerProps: timePickerProps
|
|
107
109
|
});
|
|
108
|
-
}, [timeFormat, valueSelectionModes, handleModeChange, mode, disabled, dayValue, onRangeDelete, texts, timePickerProps, onStartChange, onEndChange, onExactHourSelect]);
|
|
110
|
+
}, [timeFormat, valueSelectionModes, handleModeChange, mode, disabled, dayValue, onRangeDelete, texts, timePickerProps, onStartChange, onEndChange, onExactHourSelect, valueFormatOptions]);
|
|
109
111
|
var suffix = React.useMemo(function () {
|
|
110
112
|
return renderSuffix ? renderSuffix() : /*#__PURE__*/React.createElement(RangeActions, {
|
|
111
113
|
onRangeClear: onRangeClear,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { TimePickerProps } from '@synerise/ds-time-picker';
|
|
3
|
+
import type { DateToFormatOptions } from '@synerise/ds-data-format';
|
|
3
4
|
import { DayKey, RangeActions, TimeWindowProps, TimeWindowTexts } from '../TimeWindow.types';
|
|
4
5
|
import { FilterDefinition, WithDisabledProp } from '../../../RangeFilter.types';
|
|
5
6
|
import { DateLimitMode } from './RangeForm/RangeForm.types';
|
|
@@ -15,7 +16,11 @@ export declare type RangeFormContainerProps = {
|
|
|
15
16
|
onRangeDelete?: () => void;
|
|
16
17
|
valueSelectionModes: DateLimitMode[];
|
|
17
18
|
texts: Partial<TimeWindowTexts>;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated use `valueFormatOptions` instead
|
|
21
|
+
*/
|
|
18
22
|
timeFormat?: string;
|
|
23
|
+
valueFormatOptions?: DateToFormatOptions;
|
|
19
24
|
timePickerProps?: Partial<TimePickerProps>;
|
|
20
25
|
renderSuffix?: () => React.ReactNode;
|
|
21
26
|
} & Pick<TimeWindowProps, 'monthlyFilter' | 'monthlyFilterPeriod' | 'hideHeader' | 'onChange' | 'days'> & WithDisabledProp & Partial<RangeActions>;
|
|
@@ -26,7 +26,7 @@ export declare class RawDateRangePicker extends React.PureComponent<DateRangePic
|
|
|
26
26
|
getAddons: () => AddonType[];
|
|
27
27
|
render(): JSX.Element;
|
|
28
28
|
}
|
|
29
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<DateRangePickerProps, "readOnly" | "texts" | "
|
|
29
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<DateRangePickerProps, "readOnly" | "texts" | "valueFormatOptions" | "format" | "value" | "onVisibleChange" | "rangeUnits" | "containerClass" | "disableDefaultTexts" | "disabledDate" | "forceAdjacentMonths" | "forceAbsolute" | "footerProps" | "onValueChange" | "onApply" | "onFilterSave" | "popoverProps" | "popoverTrigger" | "ranges" | "relativeFuture" | "relativePast" | "relativeModes" | "savedFilters" | "showRelativePicker" | "showFilter" | "showTime" | "showCustomRange" | "validate" | "valueTransformer" | "arrowColor" | "disableAbsoluteTimepickerInRelative" | "rangePickerInputProps" | "renderPopoverTrigger"> & {
|
|
30
30
|
forwardedRef?: ((instance: any) => void) | React.RefObject<any> | null | undefined;
|
|
31
31
|
} & React.RefAttributes<any>> & {
|
|
32
32
|
WrappedComponent: React.ComponentType<DateRangePickerProps>;
|
package/dist/utils.js
CHANGED
|
@@ -37,12 +37,21 @@ export var normalizeRange = function normalizeRange(range) {
|
|
|
37
37
|
left = ADD[duration.type](offset.value, -duration.value);
|
|
38
38
|
right = offset.value;
|
|
39
39
|
}
|
|
40
|
-
} else if (future) {
|
|
41
|
-
left = ADD[offset.type](START_OF[offset.type](now), offset.value);
|
|
42
|
-
right = ADD[duration.type](END_OF[duration.type](left), duration.value - 1);
|
|
43
40
|
} else {
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
var rightBoundaryRoundingUnit = future ? duration.type : offset.type;
|
|
42
|
+
|
|
43
|
+
if (duration.type !== offset.type) {
|
|
44
|
+
var unitGranularityOrder = ['SECONDS', 'MINUTES', 'HOURS', 'DAYS', 'WEEKS', 'MONTHS', 'YEARS'];
|
|
45
|
+
rightBoundaryRoundingUnit = unitGranularityOrder.indexOf(duration.type) < unitGranularityOrder.indexOf(offset.type) ? duration.type : offset.type;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (future) {
|
|
49
|
+
left = ADD[offset.type](START_OF[offset.type](now), offset.value);
|
|
50
|
+
right = ADD[duration.type](END_OF[duration.type](left), duration.value - 1);
|
|
51
|
+
} else {
|
|
52
|
+
right = ADD[offset.type](END_OF[rightBoundaryRoundingUnit](now), -offset.value);
|
|
53
|
+
left = ADD[duration.type](START_OF[duration.type](right), 1 - duration.value);
|
|
54
|
+
}
|
|
46
55
|
}
|
|
47
56
|
|
|
48
57
|
var _from = fnsMin([left, right]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-date-range-picker",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.3",
|
|
4
4
|
"description": "Date-Range-Picker UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@date-fns/upgrade": "^1.0.3",
|
|
36
36
|
"@synerise/ds-button": "^0.17.12",
|
|
37
|
-
"@synerise/ds-date-picker": "^0.9.
|
|
37
|
+
"@synerise/ds-date-picker": "^0.9.3",
|
|
38
38
|
"@synerise/ds-icon": "^0.54.0",
|
|
39
39
|
"@synerise/ds-manageable-list": "^0.24.10",
|
|
40
|
-
"@synerise/ds-time-picker": "^0.7.
|
|
40
|
+
"@synerise/ds-time-picker": "^0.7.2",
|
|
41
41
|
"@synerise/ds-tooltip": "^0.13.0",
|
|
42
42
|
"@synerise/ds-utils": "^0.19.0",
|
|
43
43
|
"date-fns": "^2.16.1",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/ramda": "^0.27.14"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "f6617e99a823599ee63f3d094b81cdbec3a979ea"
|
|
58
58
|
}
|