@synerise/ds-date-range-picker 0.14.0 → 0.14.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 +13 -11
- package/README.md +28 -26
- package/dist/DateRangePicker.types.d.ts +0 -6
- package/dist/Footer/Footer.d.ts +1 -1
- package/dist/Footer/Footer.js +4 -6
- package/dist/Footer/Footer.styles.d.ts +0 -11
- package/dist/Footer/Footer.styles.js +1 -16
- package/dist/Footer/Footer.types.d.ts +0 -1
- package/dist/RangePicker/RangePicker.js +15 -41
- package/dist/RangePicker/RangePicker.types.d.ts +0 -1
- package/dist/RawDateRangePicker.d.ts +1 -1
- package/dist/RawDateRangePicker.js +7 -13
- package/dist/style/index.css +1 -0
- package/dist/utils.js +2 -9
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,23 +3,25 @@
|
|
|
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
|
-
|
|
6
|
+
## [0.14.3](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@0.14.2...@synerise/ds-date-range-picker@0.14.3) (2022-08-04)
|
|
7
7
|
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-date-range-picker
|
|
8
9
|
|
|
9
|
-
### Bug Fixes
|
|
10
10
|
|
|
11
|
-
* **date-range-picker:** empty select time if ALL_TIME ([476ac41](https://github.com/Synerise/synerise-design/commit/476ac419a0ab1b1a43349e6b9c6647dceb564430))
|
|
12
|
-
* **date-range-picker:** ensure proper relative-date-range onApply value ([e5a7d3a](https://github.com/Synerise/synerise-design/commit/e5a7d3acf4994e9be1a7f382d957eed70993de0c))
|
|
13
|
-
* **date-range-picker:** fix and refactor tests, (re)add start/end of day ([413151d](https://github.com/Synerise/synerise-design/commit/413151d5f511ec5722c0576f0765ea74857b6b8d))
|
|
14
|
-
* **date-range-picker:** fix prop and tests ([2ecb365](https://github.com/Synerise/synerise-design/commit/2ecb3658019bc67c820f85e759f42ad22417b001))
|
|
15
|
-
* **date-range-picker:** fix selection of new date ([f94d822](https://github.com/Synerise/synerise-design/commit/f94d822f9fc3b78f806b96f98c4e723dac0dd075))
|
|
16
|
-
* **date-range-picker:** fix selection of new date and tests ([07f703a](https://github.com/Synerise/synerise-design/commit/07f703a24ae9d62d6bf24bdc2ee3fb0157681be2))
|
|
17
|
-
* **date-range-picker:** no relative date properties if absolute range ([e0bd9cb](https://github.com/Synerise/synerise-design/commit/e0bd9cb9c7a2a84bcbad1129b21186048482bc71))
|
|
18
11
|
|
|
19
12
|
|
|
20
|
-
### Features
|
|
21
13
|
|
|
22
|
-
|
|
14
|
+
## [0.14.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@0.13.4...@synerise/ds-date-range-picker@0.14.2) (2022-08-04)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @synerise/ds-date-range-picker
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [0.14.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@0.13.4...@synerise/ds-date-range-picker@0.14.1) (2022-08-04)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @synerise/ds-date-range-picker
|
|
23
25
|
|
|
24
26
|
|
|
25
27
|
|
package/README.md
CHANGED
|
@@ -41,34 +41,36 @@ const value = {
|
|
|
41
41
|
|
|
42
42
|
## API
|
|
43
43
|
|
|
44
|
-
| Property | Description
|
|
45
|
-
| -------------------- | -------------------------------------------------------------------
|
|
46
|
-
| disabledDate | Function to specify if particular dates are disabled or not
|
|
47
|
-
| disabledDefaultTexts | Disables the default texts translations provided by `react-intl`
|
|
48
|
-
| forceAbsolute | Force the outcome to be converted to an absolute date
|
|
49
|
-
| format | Format of the value displayed in the footer
|
|
50
|
-
| onApply | Callback executed after applying changes
|
|
51
|
-
| ranges | An array containing custom ranges which may be used as a short-hand
|
|
52
|
-
| popoverProps | Object representing props applied to the Antd Popover component
|
|
53
|
-
| rangeUnits | Units available in relative range picker
|
|
54
|
-
| relativePast | Enable relative filter for past ranges
|
|
55
|
-
| relativeFuture | Enable relative filter for future ranges
|
|
56
|
-
| showTime | Enable user to choose particular hour
|
|
57
|
-
| showFilter | Enable range filtering
|
|
58
|
-
| showCustomRange | Enable custom range form in relative range picker
|
|
59
|
-
| validate | Function to specify if particular date ranges are correct
|
|
60
|
-
| value | Value of the picker
|
|
61
|
-
|
|
|
62
|
-
| onVisibleChange | Callback executed when popover with dateRangePicker changes its visibility | (visible: boolean) => void | - |
|
|
44
|
+
| Property | Description | Type | Default |
|
|
45
|
+
| -------------------- | ------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------- |
|
|
46
|
+
| disabledDate | Function to specify if particular dates are disabled or not | (date:Date)=>boolean | - |
|
|
47
|
+
| disabledDefaultTexts | Disables the default texts translations provided by `react-intl` | boolean | `false` |
|
|
48
|
+
| forceAbsolute | Force the outcome to be converted to an absolute date | boolean | `false` |
|
|
49
|
+
| format | Format of the value displayed in the footer | string | "MMM D, YYYY" |
|
|
50
|
+
| onApply | Callback executed after applying changes | (date:Date)=>void | - |
|
|
51
|
+
| ranges | An array containing custom ranges which may be used as a short-hand | DateRange[] | [] |
|
|
52
|
+
| popoverProps | Object representing props applied to the Antd Popover component | AntdPopoverProps | {} |
|
|
53
|
+
| rangeUnits | Units available in relative range picker | RelativeUnits[] | ['SECONDS','MINUTES','HOURS','DAYS','WEEKS','MONTHS','YEARS'] |
|
|
54
|
+
| relativePast | Enable relative filter for past ranges | boolean | `false` |
|
|
55
|
+
| relativeFuture | Enable relative filter for future ranges | boolean | `false` |
|
|
56
|
+
| showTime | Enable user to choose particular hour | boolean | `false` |
|
|
57
|
+
| showFilter | Enable range filtering | boolean | `false` |
|
|
58
|
+
| showCustomRange | Enable custom range form in relative range picker | boolean | `true` |
|
|
59
|
+
| validate | Function to specify if particular date ranges are correct | (date:Date)=>boolean | - |
|
|
60
|
+
| value | Value of the picker | DateRange | new Date() |
|
|
61
|
+
| onVisibleChange | Callback executed when popover with dateRangePicker changes its visibility | (visible: boolean) => void | - |
|
|
63
62
|
|
|
63
|
+
|
|
64
64
|
### DateRange
|
|
65
65
|
|
|
66
|
-
| Property
|
|
67
|
-
|
|
|
68
|
-
| from
|
|
69
|
-
| to
|
|
70
|
-
| type
|
|
71
|
-
| duration
|
|
72
|
-
| offset
|
|
66
|
+
| Property | Description | Type | Default |
|
|
67
|
+
| -----------| ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | ------- |
|
|
68
|
+
| from | Start date | Date / string | - |
|
|
69
|
+
| to | End date | Date / string | - |
|
|
70
|
+
| type | String key for identifying the range type | 'ABSOLUTE' / 'RELATIVE' / 'SINCE' | - |
|
|
71
|
+
| duration | Duration of the relative range | {type: RelativeUnit, duration:number} | - |
|
|
72
|
+
| offset | Offset of the relative range from today's date | {type: RelativeUnit, duration:number} | - |
|
|
73
|
+
| arrowColor | Custom color arrow of popover when is footer | {['bottomLeft' | 'topLeft' | 'anyOtherPlacement']: 'white' | 'grey' | anyPaletteColorToken} | - |
|
|
74
|
+
|
|
73
75
|
|
|
74
76
|
`RelativeUnit = 'SECONDS' | 'MINUTES' | 'HOURS' | 'DAYS' | 'WEEKS' | 'MONTHS' | 'YEARS'`
|
|
@@ -4,7 +4,6 @@ import { PopoverProps } from 'antd/lib/popover';
|
|
|
4
4
|
import { DateFilter, DateRange, RelativeUnits } from './date.types';
|
|
5
5
|
import { FilterDefinition } from './RangeFilter/RangeFilter.types';
|
|
6
6
|
import { SavedFilter } from './RangeFilter/Shared/FilterDropdown/FilterDropdown.types';
|
|
7
|
-
import { Props as FooterProps } from './Footer/Footer.types';
|
|
8
7
|
export declare type CustomColorArrow = 'blue' | 'grey' | 'red' | 'green' | 'yellow' | 'pink' | 'mars' | 'orange' | 'fern' | 'cyan' | 'purple' | 'violet';
|
|
9
8
|
export declare type AdditionalMapper = {
|
|
10
9
|
topLeft: CustomColorArrow;
|
|
@@ -17,16 +16,11 @@ export declare type AdditionalMapper = {
|
|
|
17
16
|
rightBottom: CustomColorArrow;
|
|
18
17
|
};
|
|
19
18
|
export interface Props extends WrappedComponentProps {
|
|
20
|
-
/**
|
|
21
|
-
* overwrite default container's class. Default value is `ds-date-range-picker`.
|
|
22
|
-
*/
|
|
23
|
-
containerClass?: string;
|
|
24
19
|
disableDefaultTexts?: boolean;
|
|
25
20
|
disabledDate?: (date?: Date) => boolean;
|
|
26
21
|
format?: string;
|
|
27
22
|
forceAdjacentMonths?: boolean;
|
|
28
23
|
forceAbsolute?: boolean;
|
|
29
|
-
footerProps?: Partial<FooterProps>;
|
|
30
24
|
onValueChange?: (value: Partial<DateFilter> | undefined) => void;
|
|
31
25
|
onApply: (value: Partial<DateFilter> | undefined) => void;
|
|
32
26
|
onVisibleChange?: (visible: boolean) => void;
|
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" | "format" | "mode" | "value" | "message" | "onApply" | "showTime" | "dateOnly" | "canSwitchMode" | "onSwitchMode" | "canApply"
|
|
3
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "texts" | "format" | "mode" | "value" | "message" | "onApply" | "showTime" | "dateOnly" | "canSwitchMode" | "onSwitchMode" | "canApply"> & {
|
|
4
4
|
forwardedRef?: ((instance: any) => void) | React.RefObject<any> | null | undefined;
|
|
5
5
|
} & React.RefAttributes<any>> & {
|
|
6
6
|
WrappedComponent: React.ComponentType<Props>;
|
package/dist/Footer/Footer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["canApply", "onApply", "intl", "canSwitchMode", "onSwitchMode", "mode", "dateOnly", "message", "texts", "value", "format", "showTime"
|
|
1
|
+
var _excluded = ["canApply", "onApply", "intl", "canSwitchMode", "onSwitchMode", "mode", "dateOnly", "message", "texts", "value", "format", "showTime"];
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
@@ -27,8 +27,6 @@ var Footer = function Footer(_ref) {
|
|
|
27
27
|
value = _ref.value,
|
|
28
28
|
format = _ref.format,
|
|
29
29
|
showTime = _ref.showTime,
|
|
30
|
-
_ref$displayDateConta = _ref.displayDateContainerClass,
|
|
31
|
-
displayDateContainerClass = _ref$displayDateConta === void 0 ? 'ds-date-range-picker-value' : _ref$displayDateConta,
|
|
32
30
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
33
31
|
|
|
34
32
|
var footerFormat = format || (showTime ? 'MMM D, YYYY, HH:mm' : 'MMM D, YYYY');
|
|
@@ -42,11 +40,11 @@ var Footer = function Footer(_ref) {
|
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
return /*#__PURE__*/React.createElement(S.ChosenRange, {
|
|
45
|
-
className:
|
|
46
|
-
}, !!value && !!value.from ? fnsFormat(getDateFromString(value == null ? void 0 : value.from), footerFormat, intl.locale) : texts.startDatePlaceholder, /*#__PURE__*/React.createElement(
|
|
43
|
+
className: "ds-date-range-picker-value"
|
|
44
|
+
}, !!value && !!value.from ? fnsFormat(getDateFromString(value == null ? void 0 : value.from), footerFormat, intl.locale) : texts.startDatePlaceholder, /*#__PURE__*/React.createElement(Icon, {
|
|
47
45
|
component: /*#__PURE__*/React.createElement(ArrowRightS, null)
|
|
48
46
|
}), !!value && !!value.to ? fnsFormat(getDateFromString(value == null ? void 0 : value.to), footerFormat, intl.locale) : texts.endDatePlaceholder);
|
|
49
|
-
}, [value, footerFormat, intl.locale, texts
|
|
47
|
+
}, [value, footerFormat, intl.locale, texts]);
|
|
50
48
|
return /*#__PURE__*/React.createElement(S.Container, _extends({
|
|
51
49
|
className: "ds-date-range-picker-footer"
|
|
52
50
|
}, rest), ChosenRange, /*#__PURE__*/React.createElement(S.ActionsPlaceholder, null), /*#__PURE__*/React.createElement(S.Actions, null, /*#__PURE__*/React.createElement(Tooltip, {
|
|
@@ -4,14 +4,3 @@ export declare const Actions: import("styled-components").StyledComponent<"div",
|
|
|
4
4
|
export declare const Range: import("styled-components").StyledComponent<typeof Button, any, {}, never>;
|
|
5
5
|
export declare const ActionsPlaceholder: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
6
|
export declare const ChosenRange: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
|
-
/**
|
|
8
|
-
* This is mainly for unit-tests capabilitiess and WCAG compliancy, it is visible
|
|
9
|
-
* can be used for em-dashes (APA style) which will be recognized by screen-readers
|
|
10
|
-
* or in tests in `textContent` JS DOM property.
|
|
11
|
-
*
|
|
12
|
-
* Example usage:
|
|
13
|
-
*
|
|
14
|
-
* <S.InvisibleTextContent>{' – '}</S.InvisibleTextContent>
|
|
15
|
-
* <Icon component={<ArrowRightS/>}/>
|
|
16
|
-
*/
|
|
17
|
-
export declare const InvisibleTextContent: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
@@ -25,19 +25,4 @@ export var ChosenRange = styled.div.withConfig({
|
|
|
25
25
|
return props.theme.palette['grey-800'];
|
|
26
26
|
}, function (props) {
|
|
27
27
|
return props.theme.palette['grey-400'];
|
|
28
|
-
});
|
|
29
|
-
/**
|
|
30
|
-
* This is mainly for unit-tests capabilitiess and WCAG compliancy, it is visible
|
|
31
|
-
* can be used for em-dashes (APA style) which will be recognized by screen-readers
|
|
32
|
-
* or in tests in `textContent` JS DOM property.
|
|
33
|
-
*
|
|
34
|
-
* Example usage:
|
|
35
|
-
*
|
|
36
|
-
* <S.InvisibleTextContent>{' – '}</S.InvisibleTextContent>
|
|
37
|
-
* <Icon component={<ArrowRightS/>}/>
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
export var InvisibleTextContent = styled.span.withConfig({
|
|
41
|
-
displayName: "Footerstyles__InvisibleTextContent",
|
|
42
|
-
componentId: "sc-1oatjb7-5"
|
|
43
|
-
})(["display:none;"]);
|
|
28
|
+
});
|
|
@@ -34,36 +34,6 @@ var NOOP = function NOOP() {};
|
|
|
34
34
|
|
|
35
35
|
var TOOLTIP_FORMAT = 'MMM d, yyyy, HH:mm';
|
|
36
36
|
|
|
37
|
-
function replaceRange(value, day) {
|
|
38
|
-
var from = value.from,
|
|
39
|
-
to = value.to; // arguments to DateUtils functions are casted to Date because function arguments require Date
|
|
40
|
-
|
|
41
|
-
if (!from) {
|
|
42
|
-
from = day;
|
|
43
|
-
} else if (from && to && DateUtils.isSameDay(from, to) && DateUtils.isSameDay(day, from)) {
|
|
44
|
-
from = null;
|
|
45
|
-
to = null;
|
|
46
|
-
} else if (to && DateUtils.isSameDay(day, to)) {
|
|
47
|
-
from = day;
|
|
48
|
-
to = day;
|
|
49
|
-
} else if (from && to) {
|
|
50
|
-
from = day;
|
|
51
|
-
to = null;
|
|
52
|
-
} else {
|
|
53
|
-
to = day;
|
|
54
|
-
|
|
55
|
-
if (DateUtils.isDayBefore(to, from)) {
|
|
56
|
-
to = from;
|
|
57
|
-
from = day;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
from: from,
|
|
63
|
-
to: to
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
37
|
var RangePicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
68
38
|
_inheritsLoose(RangePicker, _React$PureComponent);
|
|
69
39
|
|
|
@@ -93,12 +63,21 @@ var RangePicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
93
63
|
onChange = _this$props.onChange;
|
|
94
64
|
if (modifiers.disabled) return;
|
|
95
65
|
|
|
96
|
-
var
|
|
97
|
-
from =
|
|
98
|
-
to =
|
|
66
|
+
var _DateUtils$addDayToRa = DateUtils.addDayToRange(day, value),
|
|
67
|
+
from = _DateUtils$addDayToRa.from,
|
|
68
|
+
to = _DateUtils$addDayToRa.to;
|
|
99
69
|
|
|
100
70
|
from = from ? fnsStartOfDay(from) : from;
|
|
101
71
|
to = to ? fnsEndOfDay(to) : to;
|
|
72
|
+
|
|
73
|
+
if (to) {
|
|
74
|
+
var now = new Date();
|
|
75
|
+
|
|
76
|
+
if (fnsIsSameDay(legacyParse(to), legacyParse(now))) {
|
|
77
|
+
to = now;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
102
81
|
onChange && onChange({
|
|
103
82
|
type: ABSOLUTE,
|
|
104
83
|
from: from,
|
|
@@ -403,16 +382,11 @@ var RangePicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
403
382
|
|
|
404
383
|
var _this$props8 = this.props,
|
|
405
384
|
value = _this$props8.value,
|
|
406
|
-
forceAdjacentMonths = _this$props8.forceAdjacentMonths
|
|
407
|
-
startAlwaysOnTheLeft = _this$props8.startAlwaysOnTheLeft;
|
|
385
|
+
forceAdjacentMonths = _this$props8.forceAdjacentMonths;
|
|
408
386
|
var left = this.state.left;
|
|
409
|
-
var toDateChanged = !!(value != null && value.to) && (value == null ? void 0 : value.to) !== (prevProps == null ? void 0 : (_prevProps$value = prevProps.value) == null ? void 0 : _prevProps$value.to);
|
|
410
|
-
var fromDateChanged = !!(value != null && value.from) && (value == null ? void 0 : value.from) !== (prevProps == null ? void 0 : (_prevProps$value2 = prevProps.value) == null ? void 0 : _prevProps$value2.from);
|
|
411
387
|
|
|
412
|
-
if (
|
|
413
|
-
|
|
414
|
-
this.setState(getSidesState(value, forceAdjacentMonths));
|
|
415
|
-
}
|
|
388
|
+
if (!!(value != null && value.to) && (value == null ? void 0 : value.to) !== (prevProps == null ? void 0 : (_prevProps$value = prevProps.value) == null ? void 0 : _prevProps$value.to) && !fnsIsSameMonth(legacyParse(value.to), legacyParse(left.month)) || !!(value != null && value.from) && (value == null ? void 0 : value.from) !== (prevProps == null ? void 0 : (_prevProps$value2 = prevProps.value) == null ? void 0 : _prevProps$value2.from) && !fnsIsSameMonth(legacyParse(value.from), legacyParse(left.month)) || forceAdjacentMonths !== prevProps.forceAdjacentMonths) {
|
|
389
|
+
this.setState(getSidesState(value, forceAdjacentMonths));
|
|
416
390
|
}
|
|
417
391
|
|
|
418
392
|
return null;
|
|
@@ -24,7 +24,7 @@ export declare class RawDateRangePicker extends React.PureComponent<Props, State
|
|
|
24
24
|
getAddons: () => AddonType[];
|
|
25
25
|
render(): JSX.Element;
|
|
26
26
|
}
|
|
27
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "texts" | "format" | "value" | "onVisibleChange" | "rangeUnits" | "
|
|
27
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Props, "texts" | "format" | "value" | "onVisibleChange" | "rangeUnits" | "disableDefaultTexts" | "disabledDate" | "forceAdjacentMonths" | "forceAbsolute" | "onValueChange" | "onApply" | "onFilterSave" | "popoverProps" | "popoverTrigger" | "ranges" | "relativeFuture" | "relativePast" | "relativeModes" | "savedFilters" | "showRelativePicker" | "showFilter" | "showTime" | "showCustomRange" | "validate" | "arrowColor"> & {
|
|
28
28
|
forwardedRef?: ((instance: any) => void) | React.RefObject<any> | null | undefined;
|
|
29
29
|
} & React.RefAttributes<any>> & {
|
|
30
30
|
WrappedComponent: React.ComponentType<Props>;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
4
2
|
|
|
5
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
@@ -17,7 +15,6 @@ import fnsIsValid from 'date-fns/isValid';
|
|
|
17
15
|
import { Container, Separator, Addon } from './DateRangePicker.styles';
|
|
18
16
|
import RangePicker from './RangePicker/RangePicker';
|
|
19
17
|
import { RELATIVE, ABSOLUTE, MODES, RELATIVE_PRESETS, ABSOLUTE_PRESETS } from './constants';
|
|
20
|
-
import * as CONST from './constants';
|
|
21
18
|
import relativeToAbsolute from './dateUtils/relativeToAbsolute';
|
|
22
19
|
import AddonCollapse from './AddonCollapse/AddonCollapse';
|
|
23
20
|
import RelativeRangePicker from './RelativeRangePicker/RelativeRangePicker';
|
|
@@ -67,7 +64,7 @@ export var RawDateRangePicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
67
64
|
filter: value.filter
|
|
68
65
|
}));
|
|
69
66
|
|
|
70
|
-
if (
|
|
67
|
+
if (newValue.type === 'RELATIVE' && mode === MODES.TIME) {
|
|
71
68
|
// clicked on RangeButtons and was selecting time
|
|
72
69
|
_this.setState({
|
|
73
70
|
mode: MODES.DATE
|
|
@@ -95,7 +92,7 @@ export var RawDateRangePicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
95
92
|
return;
|
|
96
93
|
}
|
|
97
94
|
|
|
98
|
-
if (value.key ===
|
|
95
|
+
if (value.key === 'ALL_TIME') {
|
|
99
96
|
onApply && onApply(omitBy(value, isUndefined));
|
|
100
97
|
return;
|
|
101
98
|
}
|
|
@@ -235,10 +232,7 @@ export var RawDateRangePicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
235
232
|
texts = _this$props3.texts,
|
|
236
233
|
savedFilters = _this$props3.savedFilters,
|
|
237
234
|
onFilterSave = _this$props3.onFilterSave,
|
|
238
|
-
intl = _this$props3.intl
|
|
239
|
-
_this$props3$containe = _this$props3.containerClass,
|
|
240
|
-
containerClass = _this$props3$containe === void 0 ? 'ds-date-range-picker' : _this$props3$containe,
|
|
241
|
-
footerProps = _this$props3.footerProps;
|
|
235
|
+
intl = _this$props3.intl;
|
|
242
236
|
var _this$state3 = this.state,
|
|
243
237
|
value = _this$state3.value,
|
|
244
238
|
mode = _this$state3.mode;
|
|
@@ -257,9 +251,9 @@ export var RawDateRangePicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
257
251
|
var validator = validate ? validate(value) : {
|
|
258
252
|
valid: true
|
|
259
253
|
};
|
|
260
|
-
var isValid =
|
|
254
|
+
var isValid = (!!(from && to) || key === 'ALL_TIME') && validator.valid;
|
|
261
255
|
return /*#__PURE__*/React.createElement(Container, {
|
|
262
|
-
className:
|
|
256
|
+
className: "ds-date-range-picker"
|
|
263
257
|
}, /*#__PURE__*/React.createElement(RangePicker, {
|
|
264
258
|
value: value,
|
|
265
259
|
onChange: this.handleRangeChange,
|
|
@@ -277,7 +271,7 @@ export var RawDateRangePicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
277
271
|
className: "addon-wrapper",
|
|
278
272
|
key: addon.key
|
|
279
273
|
}, addon.content);
|
|
280
|
-
}), /*#__PURE__*/React.createElement(Footer,
|
|
274
|
+
}), /*#__PURE__*/React.createElement(Footer, {
|
|
281
275
|
canApply: isValid,
|
|
282
276
|
onApply: this.handleApply,
|
|
283
277
|
dateOnly: !showTime,
|
|
@@ -289,7 +283,7 @@ export var RawDateRangePicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
289
283
|
value: value,
|
|
290
284
|
showTime: showTime,
|
|
291
285
|
format: format
|
|
292
|
-
}
|
|
286
|
+
}));
|
|
293
287
|
};
|
|
294
288
|
|
|
295
289
|
return RawDateRangePicker;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ant-popover.ds-date-range-popover>.ant-popover-content>.ant-popover-arrow{display:none}.ant-popover.ds-date-range-popover>.ant-popover-content{margin:-5px 0}.ant-dropdown{box-shadow:0 16px 32px 0 rgba(35,41,54,.1)}
|
package/dist/utils.js
CHANGED
|
@@ -7,7 +7,6 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
7
7
|
import fnsMin from 'date-fns/min';
|
|
8
8
|
import fnsMax from 'date-fns/max';
|
|
9
9
|
import { legacyParse } from '@date-fns/upgrade/v2';
|
|
10
|
-
import { omit } from 'lodash';
|
|
11
10
|
import { ABSOLUTE, CUSTOM_RANGE_KEY, RELATIVE } from './constants';
|
|
12
11
|
import ADD from './dateUtils/add';
|
|
13
12
|
import START_OF from './dateUtils/startOf';
|
|
@@ -55,17 +54,11 @@ export var normalizeRange = function normalizeRange(range) {
|
|
|
55
54
|
|
|
56
55
|
var from = range.from ? legacyParse(range.from) : undefined;
|
|
57
56
|
var to = range.to ? legacyParse(range.to) : undefined;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return omit(dateRange, ['offset', 'duration']);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
var absoluteRange = _objectSpread({}, dropNonAbsolute(range), {
|
|
57
|
+
return _objectSpread({}, range, {
|
|
58
|
+
type: ABSOLUTE,
|
|
64
59
|
from: from,
|
|
65
60
|
to: to
|
|
66
61
|
});
|
|
67
|
-
|
|
68
|
-
return absoluteRange;
|
|
69
62
|
};
|
|
70
63
|
|
|
71
64
|
var getIntlMessage = function getIntlMessage(textMessageId, intl, areDefaultTextsDisabled) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-date-range-picker",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.3",
|
|
4
4
|
"description": "Date-Range-Picker UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"types": "dist/index.d.ts",
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@date-fns/upgrade": "^1.0.3",
|
|
36
|
-
"@synerise/ds-button": "^0.17.
|
|
37
|
-
"@synerise/ds-date-picker": "^0.6.
|
|
38
|
-
"@synerise/ds-icon": "^0.49.
|
|
39
|
-
"@synerise/ds-manageable-list": "^0.23.
|
|
40
|
-
"@synerise/ds-time-picker": "^0.6.
|
|
41
|
-
"@synerise/ds-tooltip": "^0.11.
|
|
36
|
+
"@synerise/ds-button": "^0.17.5",
|
|
37
|
+
"@synerise/ds-date-picker": "^0.6.27",
|
|
38
|
+
"@synerise/ds-icon": "^0.49.3",
|
|
39
|
+
"@synerise/ds-manageable-list": "^0.23.22",
|
|
40
|
+
"@synerise/ds-time-picker": "^0.6.26",
|
|
41
|
+
"@synerise/ds-tooltip": "^0.11.13",
|
|
42
42
|
"@synerise/ds-utils": "^0.19.0",
|
|
43
43
|
"date-fns": "^2.16.1",
|
|
44
44
|
"dayjs": "^1.8.35",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/ramda": "^0.27.14"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "28486eab4b37b485cbe2a383e3ae9b8e9d789862"
|
|
58
58
|
}
|