@synerise/ds-date-range-picker 0.27.9 → 0.27.11
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 +16 -0
- package/dist/RangeFilter/Filters/MonthlyFilter/MonthlyFilter.js +17 -19
- package/dist/RangeFilter/RangeFilter.js +22 -28
- package/dist/RangeFilter/Shared/TimeWindow/TimeWindow.js +30 -31
- package/dist/RangePicker/RangePicker.js +50 -54
- package/dist/RawDateRangePicker.js +12 -14
- package/dist/RelativeRangePicker/Elements/TimestampRange/TimestampRange.js +2 -2
- package/dist/RelativeRangePicker/RelativeRangePicker.js +11 -13
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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.27.11](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@0.27.10...@synerise/ds-date-range-picker@0.27.11) (2024-04-17)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-date-range-picker
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.27.10](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@0.27.9...@synerise/ds-date-range-picker@0.27.10) (2024-04-17)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @synerise/ds-date-range-picker
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [0.27.9](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@0.27.8...@synerise/ds-date-range-picker@0.27.9) (2024-04-15)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @synerise/ds-date-range-picker
|
|
@@ -4,8 +4,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
4
4
|
|
|
5
5
|
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; }
|
|
6
6
|
|
|
7
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
8
|
-
|
|
9
7
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
|
10
8
|
|
|
11
9
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -23,8 +21,6 @@ import TimeWindow from '../../Shared/TimeWindow/TimeWindow';
|
|
|
23
21
|
import { getDefaultTexts } from '../../../utils';
|
|
24
22
|
|
|
25
23
|
var MonthlyFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
26
|
-
_inheritsLoose(MonthlyFilter, _React$PureComponent);
|
|
27
|
-
|
|
28
24
|
function MonthlyFilter() {
|
|
29
25
|
var _visible;
|
|
30
26
|
|
|
@@ -36,16 +32,16 @@ var MonthlyFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
36
32
|
|
|
37
33
|
_this = _React$PureComponent.call.apply(_React$PureComponent, [this].concat(args)) || this;
|
|
38
34
|
|
|
39
|
-
_defineProperty(
|
|
35
|
+
_defineProperty(_this, "state", {
|
|
40
36
|
visible: (_visible = {}, _visible[defaultId] = true, _visible)
|
|
41
37
|
});
|
|
42
38
|
|
|
43
|
-
_defineProperty(
|
|
39
|
+
_defineProperty(_this, "setData", function (definition) {
|
|
44
40
|
var onChange = _this.props.onChange;
|
|
45
41
|
return onChange(definition);
|
|
46
42
|
});
|
|
47
43
|
|
|
48
|
-
_defineProperty(
|
|
44
|
+
_defineProperty(_this, "handleAddRow", function () {
|
|
49
45
|
var id = uuid();
|
|
50
46
|
var _this$props = _this.props,
|
|
51
47
|
value = _this$props.value,
|
|
@@ -64,7 +60,7 @@ var MonthlyFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
64
60
|
_this.handleCollapse(id);
|
|
65
61
|
});
|
|
66
62
|
|
|
67
|
-
_defineProperty(
|
|
63
|
+
_defineProperty(_this, "handleRemoveRow", function (index) {
|
|
68
64
|
var value = _this.props.value;
|
|
69
65
|
var result = value.filter(function (item, key) {
|
|
70
66
|
return key !== index;
|
|
@@ -75,7 +71,7 @@ var MonthlyFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
75
71
|
_this.setData([].concat(result));
|
|
76
72
|
});
|
|
77
73
|
|
|
78
|
-
_defineProperty(
|
|
74
|
+
_defineProperty(_this, "handleRemoveRowCollapse", function (deletedId) {
|
|
79
75
|
var value = _this.props.value;
|
|
80
76
|
var visible = _this.state.visible;
|
|
81
77
|
var itemKey = value.findIndex(function (item) {
|
|
@@ -86,7 +82,7 @@ var MonthlyFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
86
82
|
visible[deletedId] && (next || prev) && _this.handleCollapse(next ? next.id : prev.id);
|
|
87
83
|
});
|
|
88
84
|
|
|
89
|
-
_defineProperty(
|
|
85
|
+
_defineProperty(_this, "handleTypeChange", function (val, index) {
|
|
90
86
|
var value = _this.props.value;
|
|
91
87
|
value[index] = _objectSpread({}, value[index], {
|
|
92
88
|
period: val,
|
|
@@ -96,7 +92,7 @@ var MonthlyFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
96
92
|
_this.setData(value);
|
|
97
93
|
});
|
|
98
94
|
|
|
99
|
-
_defineProperty(
|
|
95
|
+
_defineProperty(_this, "handlePeriodTypeChange", function (val, index) {
|
|
100
96
|
var value = _this.props.value;
|
|
101
97
|
var data = [].concat(value);
|
|
102
98
|
data[index] = _objectSpread({}, data[index], {
|
|
@@ -106,7 +102,7 @@ var MonthlyFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
106
102
|
_this.setData(data);
|
|
107
103
|
});
|
|
108
104
|
|
|
109
|
-
_defineProperty(
|
|
105
|
+
_defineProperty(_this, "handleDefinitionChange", function (definition, index) {
|
|
110
106
|
var value = _this.props.value;
|
|
111
107
|
var data = [].concat(value);
|
|
112
108
|
var currentDefinition = data[index];
|
|
@@ -117,7 +113,7 @@ var MonthlyFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
117
113
|
_this.setData(data);
|
|
118
114
|
});
|
|
119
115
|
|
|
120
|
-
_defineProperty(
|
|
116
|
+
_defineProperty(_this, "dayWeekFormatter", function (index, _long) {
|
|
121
117
|
var intl = _this.props.intl;
|
|
122
118
|
var weekStartIndex = Math.floor(index / 7);
|
|
123
119
|
var dayOfWeek = index - weekStartIndex * 7;
|
|
@@ -132,7 +128,7 @@ var MonthlyFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
132
128
|
});
|
|
133
129
|
});
|
|
134
130
|
|
|
135
|
-
_defineProperty(
|
|
131
|
+
_defineProperty(_this, "dayMonthFormatter", function (i, _long2) {
|
|
136
132
|
var intl = _this.props.intl;
|
|
137
133
|
var locale = intl.locale.substring(0, 2);
|
|
138
134
|
return _long2 ? intl.formatMessage({
|
|
@@ -142,7 +138,7 @@ var MonthlyFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
142
138
|
}) : MONTH_DAYS(locale)[i];
|
|
143
139
|
});
|
|
144
140
|
|
|
145
|
-
_defineProperty(
|
|
141
|
+
_defineProperty(_this, "dayTemplate", function (index) {
|
|
146
142
|
var weekStartIndex = Math.floor(index / 7);
|
|
147
143
|
return {
|
|
148
144
|
week: weekStartIndex,
|
|
@@ -150,7 +146,7 @@ var MonthlyFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
150
146
|
};
|
|
151
147
|
});
|
|
152
148
|
|
|
153
|
-
_defineProperty(
|
|
149
|
+
_defineProperty(_this, "getTimeWindowSettings", function (item) {
|
|
154
150
|
var _settings;
|
|
155
151
|
|
|
156
152
|
var intl = _this.props.intl;
|
|
@@ -180,7 +176,7 @@ var MonthlyFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
180
176
|
return settings[item.period];
|
|
181
177
|
});
|
|
182
178
|
|
|
183
|
-
_defineProperty(
|
|
179
|
+
_defineProperty(_this, "handleCollapse", function (id) {
|
|
184
180
|
var visible = _this.state.visible;
|
|
185
181
|
var updatedVisible = {};
|
|
186
182
|
var visibleKeys = visible ? Object.keys(visible) : [];
|
|
@@ -197,7 +193,7 @@ var MonthlyFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
197
193
|
});
|
|
198
194
|
});
|
|
199
195
|
|
|
200
|
-
_defineProperty(
|
|
196
|
+
_defineProperty(_this, "renderDaysOfField", function (item, key) {
|
|
201
197
|
var _this$props2 = _this.props,
|
|
202
198
|
intl = _this$props2.intl,
|
|
203
199
|
daysOfPeriods = _this$props2.daysOfPeriods,
|
|
@@ -252,7 +248,7 @@ var MonthlyFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
252
248
|
});
|
|
253
249
|
});
|
|
254
250
|
|
|
255
|
-
_defineProperty(
|
|
251
|
+
_defineProperty(_this, "renderCountedFromField", function (item, key) {
|
|
256
252
|
var _this$props3 = _this.props,
|
|
257
253
|
intl = _this$props3.intl,
|
|
258
254
|
countedFromPeriods = _this$props3.countedFromPeriods,
|
|
@@ -311,6 +307,8 @@ var MonthlyFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
311
307
|
return _this;
|
|
312
308
|
}
|
|
313
309
|
|
|
310
|
+
_inheritsLoose(MonthlyFilter, _React$PureComponent);
|
|
311
|
+
|
|
314
312
|
var _proto = MonthlyFilter.prototype;
|
|
315
313
|
|
|
316
314
|
_proto.componentDidMount = function componentDidMount() {
|
|
@@ -2,8 +2,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
2
2
|
|
|
3
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; }
|
|
4
4
|
|
|
5
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
6
|
-
|
|
7
5
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
|
8
6
|
|
|
9
7
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -22,8 +20,6 @@ import SaveFilterForm from './Shared/SaveFilterForm/SaveFilterForm';
|
|
|
22
20
|
import { getDefaultTexts } from '../utils';
|
|
23
21
|
|
|
24
22
|
var RangeFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
25
|
-
_inheritsLoose(RangeFilter, _React$PureComponent);
|
|
26
|
-
|
|
27
23
|
function RangeFilter(props) {
|
|
28
24
|
var _props$allowedFilterT, _props$value, _props$value2, _props$value3, _this$state;
|
|
29
25
|
|
|
@@ -31,10 +27,9 @@ var RangeFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
31
27
|
|
|
32
28
|
_this = _React$PureComponent.call(this, props) || this;
|
|
33
29
|
|
|
34
|
-
_defineProperty(
|
|
35
|
-
var
|
|
36
|
-
state =
|
|
37
|
-
|
|
30
|
+
_defineProperty(_this, "componentDidUpdate", function () {
|
|
31
|
+
var _this2 = _this,
|
|
32
|
+
state = _this2.state;
|
|
38
33
|
var allowedFilterTypes = _this.props.allowedFilterTypes;
|
|
39
34
|
var activeType = state.activeType;
|
|
40
35
|
|
|
@@ -43,27 +38,25 @@ var RangeFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
43
38
|
}
|
|
44
39
|
});
|
|
45
40
|
|
|
46
|
-
_defineProperty(
|
|
47
|
-
var
|
|
48
|
-
state =
|
|
49
|
-
|
|
41
|
+
_defineProperty(_this, "handleApply", function () {
|
|
42
|
+
var _this3 = _this,
|
|
43
|
+
state = _this3.state;
|
|
50
44
|
var onApply = _this.props.onApply;
|
|
51
45
|
var activeType = state.activeType;
|
|
52
46
|
var filter = state[String(activeType)];
|
|
53
47
|
onApply && onApply(normalizeValue(filter));
|
|
54
48
|
});
|
|
55
49
|
|
|
56
|
-
_defineProperty(
|
|
50
|
+
_defineProperty(_this, "handleCancel", function () {
|
|
57
51
|
var onCancel = _this.props.onCancel;
|
|
58
52
|
onCancel && onCancel();
|
|
59
53
|
});
|
|
60
54
|
|
|
61
|
-
_defineProperty(
|
|
55
|
+
_defineProperty(_this, "handleTypeChange", function (type) {
|
|
62
56
|
var _this$setState;
|
|
63
57
|
|
|
64
|
-
var
|
|
65
|
-
state =
|
|
66
|
-
|
|
58
|
+
var _this4 = _this,
|
|
59
|
+
state = _this4.state;
|
|
67
60
|
var previousValue = state[type];
|
|
68
61
|
var previousDefinition = previousValue == null ? void 0 : previousValue.definition;
|
|
69
62
|
|
|
@@ -76,16 +69,15 @@ var RangeFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
76
69
|
}), _this$setState));
|
|
77
70
|
});
|
|
78
71
|
|
|
79
|
-
_defineProperty(
|
|
72
|
+
_defineProperty(_this, "handleRangeCopy", function (range) {
|
|
80
73
|
_this.setState({
|
|
81
74
|
rangeClipboard: range
|
|
82
75
|
});
|
|
83
76
|
});
|
|
84
77
|
|
|
85
|
-
_defineProperty(
|
|
86
|
-
var
|
|
87
|
-
state =
|
|
88
|
-
|
|
78
|
+
_defineProperty(_this, "handleFilterSave", function (filterName) {
|
|
79
|
+
var _this5 = _this,
|
|
80
|
+
state = _this5.state;
|
|
89
81
|
var activeType = state.activeType;
|
|
90
82
|
var _this$props = _this.props,
|
|
91
83
|
onFilterSave = _this$props.onFilterSave,
|
|
@@ -103,7 +95,7 @@ var RangeFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
103
95
|
onFilterSave && onFilterSave([].concat(filterList, [filterWithUniqueName]));
|
|
104
96
|
});
|
|
105
97
|
|
|
106
|
-
_defineProperty(
|
|
98
|
+
_defineProperty(_this, "handleSavedFilterRemove", function (removedFilterId) {
|
|
107
99
|
var _this$props2 = _this.props,
|
|
108
100
|
savedFilters = _this$props2.savedFilters,
|
|
109
101
|
onFilterSave = _this$props2.onFilterSave;
|
|
@@ -113,7 +105,7 @@ var RangeFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
113
105
|
onFilterSave && onFilterSave(listWithoutRemovedId);
|
|
114
106
|
});
|
|
115
107
|
|
|
116
|
-
_defineProperty(
|
|
108
|
+
_defineProperty(_this, "handleSavedFilterSelect", function (selected) {
|
|
117
109
|
var _this$setState2;
|
|
118
110
|
|
|
119
111
|
_this.setState((_this$setState2 = {
|
|
@@ -123,7 +115,7 @@ var RangeFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
123
115
|
|
|
124
116
|
var _allowedFilterTypes = props != null && (_props$allowedFilterT = props.allowedFilterTypes) != null && _props$allowedFilterT.length ? props == null ? void 0 : props.allowedFilterTypes : Object.keys(TYPES);
|
|
125
117
|
|
|
126
|
-
var valueType = props != null && (_props$value = props.value) != null && _props$value.type && _allowedFilterTypes.includes(props == null
|
|
118
|
+
var valueType = props != null && (_props$value = props.value) != null && _props$value.type && _allowedFilterTypes.includes(props == null || (_props$value2 = props.value) == null ? void 0 : _props$value2.type) ? props == null || (_props$value3 = props.value) == null ? void 0 : _props$value3.type : _allowedFilterTypes[0]; // eslint-disable-next-line react/state-in-constructor
|
|
127
119
|
|
|
128
120
|
_this.state = (_this$state = {
|
|
129
121
|
activeType: valueType
|
|
@@ -131,10 +123,12 @@ var RangeFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
131
123
|
return _this;
|
|
132
124
|
}
|
|
133
125
|
|
|
126
|
+
_inheritsLoose(RangeFilter, _React$PureComponent);
|
|
127
|
+
|
|
134
128
|
var _proto = RangeFilter.prototype;
|
|
135
129
|
|
|
136
130
|
_proto.render = function render() {
|
|
137
|
-
var
|
|
131
|
+
var _this6 = this;
|
|
138
132
|
|
|
139
133
|
var state = this.state;
|
|
140
134
|
var activeType = state.activeType,
|
|
@@ -170,7 +164,7 @@ var RangeFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
170
164
|
key: key,
|
|
171
165
|
type: activeType === key ? 'primary' : undefined,
|
|
172
166
|
onClick: function onClick() {
|
|
173
|
-
return
|
|
167
|
+
return _this6.handleTypeChange(key);
|
|
174
168
|
}
|
|
175
169
|
}, allTexts[key.toLowerCase()]);
|
|
176
170
|
})), /*#__PURE__*/React.createElement(S.MainComponentWrapper, null, Component && /*#__PURE__*/React.createElement(Component, {
|
|
@@ -185,7 +179,7 @@ var RangeFilter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
185
179
|
definition: def
|
|
186
180
|
}), _updatedFilter);
|
|
187
181
|
|
|
188
|
-
|
|
182
|
+
_this6.setState(updatedFilter);
|
|
189
183
|
},
|
|
190
184
|
onRangeCopy: this.handleRangeCopy,
|
|
191
185
|
rangeClipboard: rangeClipboard,
|
|
@@ -8,8 +8,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
8
8
|
|
|
9
9
|
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; }
|
|
10
10
|
|
|
11
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
12
|
-
|
|
13
11
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
|
14
12
|
|
|
15
13
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -32,8 +30,6 @@ import { EU_NOTATION_MONTH_DAYS_INDEXES, EU_NOTATION_WEEK_DAYS_INDEXES, US_NOTAT
|
|
|
32
30
|
export var DEFAULT_LIMIT_MODE = 'Range';
|
|
33
31
|
|
|
34
32
|
var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
35
|
-
_inheritsLoose(TimeWindowBase, _PureComponent);
|
|
36
|
-
|
|
37
33
|
function TimeWindowBase() {
|
|
38
34
|
var _this;
|
|
39
35
|
|
|
@@ -43,19 +39,20 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
43
39
|
|
|
44
40
|
_this = _PureComponent.call.apply(_PureComponent, [this].concat(args)) || this;
|
|
45
41
|
|
|
46
|
-
|
|
42
|
+
// eslint-disable-next-line react/destructuring-assignment
|
|
43
|
+
_defineProperty(_this, "state", {
|
|
47
44
|
activeDays: _this.props.daily ? [0] : [],
|
|
48
45
|
controlKeyPressed: false
|
|
49
46
|
});
|
|
50
47
|
|
|
51
|
-
_defineProperty(
|
|
48
|
+
_defineProperty(_this, "wrapperRef", createRef());
|
|
52
49
|
|
|
53
|
-
_defineProperty(
|
|
50
|
+
_defineProperty(_this, "isDayRestricted", function (dayKey) {
|
|
54
51
|
var days = _this.props.days;
|
|
55
52
|
return !!days[dayKey] && days[dayKey].restricted;
|
|
56
53
|
});
|
|
57
54
|
|
|
58
|
-
_defineProperty(
|
|
55
|
+
_defineProperty(_this, "checkActiveDay", function (dayKey) {
|
|
59
56
|
var isRangeDefined = _this.state.isRangeDefined;
|
|
60
57
|
if (!_this.isDayRestricted(dayKey) && isRangeDefined && !_this.haveActiveDaysCommonRange()) _this.checkDay(dayKey);
|
|
61
58
|
var _this$state = _this.state,
|
|
@@ -79,7 +76,7 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
79
76
|
});
|
|
80
77
|
});
|
|
81
78
|
|
|
82
|
-
_defineProperty(
|
|
79
|
+
_defineProperty(_this, "uncheckActiveDay", function (dayKey) {
|
|
83
80
|
var _this$state2 = _this.state,
|
|
84
81
|
activeDays = _this$state2.activeDays,
|
|
85
82
|
controlKeyPressed = _this$state2.controlKeyPressed;
|
|
@@ -100,7 +97,7 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
100
97
|
_this.removeDaySelection(dayKey);
|
|
101
98
|
});
|
|
102
99
|
|
|
103
|
-
_defineProperty(
|
|
100
|
+
_defineProperty(_this, "handleToggleDay", function (dayKey, forcedState) {
|
|
104
101
|
var _this$state3 = _this.state,
|
|
105
102
|
activeDays = _this$state3.activeDays,
|
|
106
103
|
controlKeyPressed = _this$state3.controlKeyPressed;
|
|
@@ -117,11 +114,11 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
117
114
|
}
|
|
118
115
|
});
|
|
119
116
|
|
|
120
|
-
_defineProperty(
|
|
117
|
+
_defineProperty(_this, "handleClearDay", function (dayKey) {
|
|
121
118
|
_this.removeDaySelection(dayKey);
|
|
122
119
|
});
|
|
123
120
|
|
|
124
|
-
_defineProperty(
|
|
121
|
+
_defineProperty(_this, "handleDayChange", function (dayKey, dayChanges) {
|
|
125
122
|
var _objectSpread2;
|
|
126
123
|
|
|
127
124
|
var _this$props = _this.props,
|
|
@@ -130,7 +127,7 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
130
127
|
onChange(_objectSpread({}, days, (_objectSpread2 = {}, _objectSpread2[dayKey] = _objectSpread({}, _this.getDayValue(dayKey), {}, dayChanges), _objectSpread2)));
|
|
131
128
|
});
|
|
132
129
|
|
|
133
|
-
_defineProperty(
|
|
130
|
+
_defineProperty(_this, "removeDaySelection", function (dayKey) {
|
|
134
131
|
var _this$props2 = _this.props,
|
|
135
132
|
onChange = _this$props2.onChange,
|
|
136
133
|
days = _this$props2.days;
|
|
@@ -139,7 +136,7 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
139
136
|
onChange(updatedDays);
|
|
140
137
|
});
|
|
141
138
|
|
|
142
|
-
_defineProperty(
|
|
139
|
+
_defineProperty(_this, "checkDay", function (dayKey) {
|
|
143
140
|
var onCheckDay = _this.props.onCheckDay;
|
|
144
141
|
|
|
145
142
|
_this.handleDayChange(dayKey, {
|
|
@@ -152,7 +149,7 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
152
149
|
onCheckDay && onCheckDay(dayKey);
|
|
153
150
|
});
|
|
154
151
|
|
|
155
|
-
_defineProperty(
|
|
152
|
+
_defineProperty(_this, "handleDayTimeChange", function (value, dayKey) {
|
|
156
153
|
_this.handleDayChange(dayKey, {
|
|
157
154
|
restricted: true,
|
|
158
155
|
start: value[0] !== undefined ? dayjs(value[0]).format(TIME_FORMAT) : DEFAULT_RANGE_START,
|
|
@@ -161,7 +158,7 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
161
158
|
});
|
|
162
159
|
});
|
|
163
160
|
|
|
164
|
-
_defineProperty(
|
|
161
|
+
_defineProperty(_this, "handleMultipleDayTimeChange", function (value) {
|
|
165
162
|
var _this$props3 = _this.props,
|
|
166
163
|
onChange = _this$props3.onChange,
|
|
167
164
|
days = _this$props3.days;
|
|
@@ -179,7 +176,7 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
179
176
|
onChange(_objectSpread({}, days, {}, updatedDays));
|
|
180
177
|
});
|
|
181
178
|
|
|
182
|
-
_defineProperty(
|
|
179
|
+
_defineProperty(_this, "handleRangeDelete", function () {
|
|
183
180
|
var _this$props4 = _this.props,
|
|
184
181
|
onChange = _this$props4.onChange,
|
|
185
182
|
days = _this$props4.days;
|
|
@@ -191,14 +188,14 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
191
188
|
onChange(_objectSpread({}, updatedDays));
|
|
192
189
|
});
|
|
193
190
|
|
|
194
|
-
_defineProperty(
|
|
191
|
+
_defineProperty(_this, "handleClearSelection", function () {
|
|
195
192
|
_this.setState({
|
|
196
193
|
activeDays: [],
|
|
197
194
|
isRangeDefined: false
|
|
198
195
|
});
|
|
199
196
|
});
|
|
200
197
|
|
|
201
|
-
_defineProperty(
|
|
198
|
+
_defineProperty(_this, "handleSelectAll", function () {
|
|
202
199
|
var keys = _this.getAllKeys();
|
|
203
200
|
|
|
204
201
|
var onSelectAll = _this.props.onSelectAll;
|
|
@@ -210,7 +207,7 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
210
207
|
});
|
|
211
208
|
});
|
|
212
209
|
|
|
213
|
-
_defineProperty(
|
|
210
|
+
_defineProperty(_this, "getDayValue", function (dayKey) {
|
|
214
211
|
var _customDays$dayKey, _customDays$dayKey2;
|
|
215
212
|
|
|
216
213
|
var _this$props5 = _this.props,
|
|
@@ -233,7 +230,7 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
233
230
|
}, dayValue);
|
|
234
231
|
});
|
|
235
232
|
|
|
236
|
-
_defineProperty(
|
|
233
|
+
_defineProperty(_this, "getDayLabel", function (dayKey, _long) {
|
|
237
234
|
var _this$props6 = _this.props,
|
|
238
235
|
dayFormatter = _this$props6.dayFormatter,
|
|
239
236
|
customDays = _this$props6.customDays;
|
|
@@ -247,7 +244,7 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
247
244
|
return label;
|
|
248
245
|
});
|
|
249
246
|
|
|
250
|
-
_defineProperty(
|
|
247
|
+
_defineProperty(_this, "handleRangePaste", function (dayKeys) {
|
|
251
248
|
var rangeClipboard = _this.props.rangeClipboard;
|
|
252
249
|
var activeDays = _this.state.activeDays;
|
|
253
250
|
|
|
@@ -256,7 +253,7 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
256
253
|
}
|
|
257
254
|
});
|
|
258
255
|
|
|
259
|
-
_defineProperty(
|
|
256
|
+
_defineProperty(_this, "handleRangeCopy", function () {
|
|
260
257
|
var onRangeCopy = _this.props.onRangeCopy;
|
|
261
258
|
var activeDays = _this.state.activeDays;
|
|
262
259
|
|
|
@@ -269,7 +266,7 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
269
266
|
});
|
|
270
267
|
});
|
|
271
268
|
|
|
272
|
-
_defineProperty(
|
|
269
|
+
_defineProperty(_this, "replaceDaysIndexesForUSNotation", function (daysIndexes) {
|
|
273
270
|
var isSundayFirstWeekDay = _this.props.isSundayFirstWeekDay;
|
|
274
271
|
var stringifyDaysIndexes = JSON.stringify(daysIndexes);
|
|
275
272
|
var stringifyEUNotationWeekDaysIndexes = JSON.stringify(EU_NOTATION_WEEK_DAYS_INDEXES);
|
|
@@ -287,7 +284,7 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
287
284
|
return result;
|
|
288
285
|
});
|
|
289
286
|
|
|
290
|
-
_defineProperty(
|
|
287
|
+
_defineProperty(_this, "getAllKeys", function () {
|
|
291
288
|
var _this$props7 = _this.props,
|
|
292
289
|
numberOfDays = _this$props7.numberOfDays,
|
|
293
290
|
customDays = _this$props7.customDays;
|
|
@@ -297,7 +294,7 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
297
294
|
return keys;
|
|
298
295
|
});
|
|
299
296
|
|
|
300
|
-
_defineProperty(
|
|
297
|
+
_defineProperty(_this, "renderDay", function (dayKey) {
|
|
301
298
|
var _this$props8 = _this.props,
|
|
302
299
|
customDays = _this$props8.customDays,
|
|
303
300
|
intl = _this$props8.intl,
|
|
@@ -334,7 +331,7 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
334
331
|
});
|
|
335
332
|
});
|
|
336
333
|
|
|
337
|
-
_defineProperty(
|
|
334
|
+
_defineProperty(_this, "handleRangeAdd", function () {
|
|
338
335
|
var daily = _this.props.daily;
|
|
339
336
|
|
|
340
337
|
if (!daily && !_this.haveActiveDaysCommonRange()) {
|
|
@@ -346,7 +343,7 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
346
343
|
});
|
|
347
344
|
});
|
|
348
345
|
|
|
349
|
-
_defineProperty(
|
|
346
|
+
_defineProperty(_this, "renderRangeForm", function (dayKeys) {
|
|
350
347
|
var activeDays = _this.state.activeDays;
|
|
351
348
|
var _this$props9 = _this.props,
|
|
352
349
|
hideHeader = _this$props9.hideHeader,
|
|
@@ -390,7 +387,7 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
390
387
|
});
|
|
391
388
|
});
|
|
392
389
|
|
|
393
|
-
_defineProperty(
|
|
390
|
+
_defineProperty(_this, "haveActiveDaysCommonRange", function () {
|
|
394
391
|
var activeDays = _this.state.activeDays;
|
|
395
392
|
var days = _this.props.days;
|
|
396
393
|
var previousDay;
|
|
@@ -415,7 +412,7 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
415
412
|
return !activeDaysHaveDifferentRanges;
|
|
416
413
|
});
|
|
417
414
|
|
|
418
|
-
_defineProperty(
|
|
415
|
+
_defineProperty(_this, "handleKeyDown", function (e) {
|
|
419
416
|
if (e.key === 'Shift') {
|
|
420
417
|
_this.setState(function (state) {
|
|
421
418
|
return _objectSpread({}, state, {
|
|
@@ -435,7 +432,7 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
435
432
|
}
|
|
436
433
|
});
|
|
437
434
|
|
|
438
|
-
_defineProperty(
|
|
435
|
+
_defineProperty(_this, "handleKeyUp", function (e) {
|
|
439
436
|
if (e.key === 'Control' || e.key === 'Meta') {
|
|
440
437
|
_this.setState(function (state) {
|
|
441
438
|
return _objectSpread({}, state, {
|
|
@@ -456,6 +453,8 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
456
453
|
return _this;
|
|
457
454
|
}
|
|
458
455
|
|
|
456
|
+
_inheritsLoose(TimeWindowBase, _PureComponent);
|
|
457
|
+
|
|
459
458
|
var _proto = TimeWindowBase.prototype;
|
|
460
459
|
|
|
461
460
|
_proto.componentDidMount = function componentDidMount() {
|
|
@@ -2,8 +2,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
2
2
|
|
|
3
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; }
|
|
4
4
|
|
|
5
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
6
|
-
|
|
7
5
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
|
8
6
|
|
|
9
7
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -74,28 +72,26 @@ function replaceRange(value, day) {
|
|
|
74
72
|
}
|
|
75
73
|
|
|
76
74
|
var RangePicker = /*#__PURE__*/function (_PureComponent) {
|
|
77
|
-
_inheritsLoose(RangePicker, _PureComponent);
|
|
78
|
-
|
|
79
75
|
function RangePicker(props) {
|
|
80
76
|
var _this;
|
|
81
77
|
|
|
82
78
|
_this = _PureComponent.call(this, props) || this; // eslint-disable-next-line react/state-in-constructor
|
|
83
79
|
|
|
84
|
-
_defineProperty(
|
|
80
|
+
_defineProperty(_this, "componentDidUpdate", NOOP);
|
|
85
81
|
|
|
86
|
-
_defineProperty(
|
|
82
|
+
_defineProperty(_this, "handleDayMouseEnter", function (day) {
|
|
87
83
|
_this.setState({
|
|
88
84
|
enteredTo: day
|
|
89
85
|
});
|
|
90
86
|
});
|
|
91
87
|
|
|
92
|
-
_defineProperty(
|
|
88
|
+
_defineProperty(_this, "handleDayMouseLeave", function () {
|
|
93
89
|
_this.setState({
|
|
94
90
|
enteredTo: null
|
|
95
91
|
});
|
|
96
92
|
});
|
|
97
93
|
|
|
98
|
-
_defineProperty(
|
|
94
|
+
_defineProperty(_this, "handleDayClick", function (day, modifiers, e) {
|
|
99
95
|
e.preventDefault();
|
|
100
96
|
var _this$props = _this.props,
|
|
101
97
|
value = _this$props.value,
|
|
@@ -115,7 +111,7 @@ var RangePicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
115
111
|
});
|
|
116
112
|
});
|
|
117
113
|
|
|
118
|
-
_defineProperty(
|
|
114
|
+
_defineProperty(_this, "handleFromTimeChange", function (from) {
|
|
119
115
|
var _this$props2 = _this.props,
|
|
120
116
|
onChange = _this$props2.onChange,
|
|
121
117
|
value = _this$props2.value;
|
|
@@ -126,7 +122,7 @@ var RangePicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
126
122
|
});
|
|
127
123
|
});
|
|
128
124
|
|
|
129
|
-
_defineProperty(
|
|
125
|
+
_defineProperty(_this, "handleToTimeChange", function (to) {
|
|
130
126
|
var _this$props3 = _this.props,
|
|
131
127
|
onChange = _this$props3.onChange,
|
|
132
128
|
value = _this$props3.value;
|
|
@@ -137,11 +133,11 @@ var RangePicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
137
133
|
});
|
|
138
134
|
});
|
|
139
135
|
|
|
140
|
-
_defineProperty(
|
|
136
|
+
_defineProperty(_this, "handleAddDay", function (numberOfDays, side) {
|
|
141
137
|
if (side === COLUMNS.LEFT) {
|
|
142
|
-
var _this$
|
|
143
|
-
onChange = _this$
|
|
144
|
-
value = _this$
|
|
138
|
+
var _this$props5 = _this.props,
|
|
139
|
+
onChange = _this$props5.onChange,
|
|
140
|
+
value = _this$props5.value;
|
|
145
141
|
onChange(_objectSpread({}, value, {
|
|
146
142
|
type: ABSOLUTE,
|
|
147
143
|
from: fnsAddDays(legacyParse(value.from), numberOfDays)
|
|
@@ -149,9 +145,9 @@ var RangePicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
149
145
|
}
|
|
150
146
|
|
|
151
147
|
if (side === COLUMNS.RIGHT) {
|
|
152
|
-
var _this$
|
|
153
|
-
_onChange = _this$
|
|
154
|
-
_value = _this$
|
|
148
|
+
var _this$props7 = _this.props,
|
|
149
|
+
_onChange = _this$props7.onChange,
|
|
150
|
+
_value = _this$props7.value;
|
|
155
151
|
|
|
156
152
|
_onChange(_objectSpread({}, _value, {
|
|
157
153
|
type: ABSOLUTE,
|
|
@@ -160,12 +156,10 @@ var RangePicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
160
156
|
}
|
|
161
157
|
});
|
|
162
158
|
|
|
163
|
-
_defineProperty(
|
|
159
|
+
_defineProperty(_this, "handleSideMonthChange", function (side, month, mode) {
|
|
164
160
|
var opposite = side === COLUMNS.LEFT ? COLUMNS.RIGHT : COLUMNS.LEFT;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
state = _assertThisInitialize.state;
|
|
168
|
-
|
|
161
|
+
var _this2 = _this,
|
|
162
|
+
state = _this2.state;
|
|
169
163
|
var forceAdjacentMonths = _this.props.forceAdjacentMonths;
|
|
170
164
|
|
|
171
165
|
if (fnsIsSameMonth(month, state[opposite])) {
|
|
@@ -211,7 +205,7 @@ var RangePicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
211
205
|
});
|
|
212
206
|
});
|
|
213
207
|
|
|
214
|
-
_defineProperty(
|
|
208
|
+
_defineProperty(_this, "handleSideModeChange", function (side, mode) {
|
|
215
209
|
_this.setState(function (prevState) {
|
|
216
210
|
var _objectSpread5;
|
|
217
211
|
|
|
@@ -221,12 +215,12 @@ var RangePicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
221
215
|
});
|
|
222
216
|
});
|
|
223
217
|
|
|
224
|
-
_defineProperty(
|
|
218
|
+
_defineProperty(_this, "renderDay", function (day) {
|
|
225
219
|
var text = day.getDate();
|
|
226
|
-
var _this$
|
|
227
|
-
value = _this$
|
|
228
|
-
intl = _this$
|
|
229
|
-
formatValue = _this$
|
|
220
|
+
var _this$props8 = _this.props,
|
|
221
|
+
value = _this$props8.value,
|
|
222
|
+
intl = _this$props8.intl,
|
|
223
|
+
formatValue = _this$props8.formatValue;
|
|
230
224
|
|
|
231
225
|
var formatDate = function formatDate(date) {
|
|
232
226
|
if (typeof date === 'string') {
|
|
@@ -246,7 +240,7 @@ var RangePicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
246
240
|
}));
|
|
247
241
|
});
|
|
248
242
|
|
|
249
|
-
_defineProperty(
|
|
243
|
+
_defineProperty(_this, "renderYearPicker", function (side) {
|
|
250
244
|
var currentSide = _this.state[side];
|
|
251
245
|
var month = currentSide.month;
|
|
252
246
|
return /*#__PURE__*/React.createElement(YearPicker, {
|
|
@@ -258,7 +252,7 @@ var RangePicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
258
252
|
});
|
|
259
253
|
});
|
|
260
254
|
|
|
261
|
-
_defineProperty(
|
|
255
|
+
_defineProperty(_this, "renderMonthPicker", function (side) {
|
|
262
256
|
var opposite = side === COLUMNS.LEFT ? COLUMNS.RIGHT : COLUMNS.LEFT;
|
|
263
257
|
var _this$state = _this.state,
|
|
264
258
|
currentSide = _this$state[side],
|
|
@@ -275,11 +269,11 @@ var RangePicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
275
269
|
});
|
|
276
270
|
});
|
|
277
271
|
|
|
278
|
-
_defineProperty(
|
|
279
|
-
var _this$
|
|
280
|
-
value = _this$
|
|
281
|
-
disabledDate = _this$
|
|
282
|
-
forceAdjacentMonths = _this$
|
|
272
|
+
_defineProperty(_this, "renderDatePicker", function (side) {
|
|
273
|
+
var _this$props9 = _this.props,
|
|
274
|
+
value = _this$props9.value,
|
|
275
|
+
disabledDate = _this$props9.disabledDate,
|
|
276
|
+
forceAdjacentMonths = _this$props9.forceAdjacentMonths;
|
|
283
277
|
var _this$state2 = _this.state,
|
|
284
278
|
enteredTo = _this$state2.enteredTo,
|
|
285
279
|
left = _this$state2.left,
|
|
@@ -334,10 +328,10 @@ var RangePicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
334
328
|
});
|
|
335
329
|
});
|
|
336
330
|
|
|
337
|
-
_defineProperty(
|
|
338
|
-
var _this$
|
|
339
|
-
value = _this$
|
|
340
|
-
is12HoursClock = _this$
|
|
331
|
+
_defineProperty(_this, "renderTimePicker", function (side) {
|
|
332
|
+
var _this$props10 = _this.props,
|
|
333
|
+
value = _this$props10.value,
|
|
334
|
+
is12HoursClock = _this$props10.is12HoursClock;
|
|
341
335
|
var from = value.from,
|
|
342
336
|
to = value.to;
|
|
343
337
|
|
|
@@ -389,7 +383,7 @@ var RangePicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
389
383
|
}
|
|
390
384
|
});
|
|
391
385
|
|
|
392
|
-
_defineProperty(
|
|
386
|
+
_defineProperty(_this, "renderSide", function (side) {
|
|
393
387
|
var mode = _this.props.mode;
|
|
394
388
|
var sideState = _this.state[side];
|
|
395
389
|
if (mode === MODES.TIME) return _this.renderTimePicker(side);
|
|
@@ -415,22 +409,24 @@ var RangePicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
415
409
|
return _this;
|
|
416
410
|
}
|
|
417
411
|
|
|
412
|
+
_inheritsLoose(RangePicker, _PureComponent);
|
|
413
|
+
|
|
418
414
|
var _proto = RangePicker.prototype;
|
|
419
415
|
|
|
420
416
|
_proto.getSnapshotBeforeUpdate = function getSnapshotBeforeUpdate(prevProps) {
|
|
421
417
|
var _prevProps$value, _prevProps$value2;
|
|
422
418
|
|
|
423
|
-
var _this$
|
|
424
|
-
value = _this$
|
|
425
|
-
forceAdjacentMonths = _this$
|
|
426
|
-
startAlwaysOnTheLeft = _this$
|
|
419
|
+
var _this$props11 = this.props,
|
|
420
|
+
value = _this$props11.value,
|
|
421
|
+
forceAdjacentMonths = _this$props11.forceAdjacentMonths,
|
|
422
|
+
startAlwaysOnTheLeft = _this$props11.startAlwaysOnTheLeft;
|
|
427
423
|
var _this$props$jumpToSta = this.props.jumpToStartAndEnd,
|
|
428
424
|
jumpToStartAndEnd = _this$props$jumpToSta === void 0 ? true : _this$props$jumpToSta;
|
|
429
425
|
var _this$state3 = this.state,
|
|
430
426
|
left = _this$state3.left,
|
|
431
427
|
right = _this$state3.right;
|
|
432
|
-
var toDateChanged = !!(value != null && value.to) && (value == null ? void 0 : value.to) !== (prevProps == null
|
|
433
|
-
var fromDateChanged = !!(value != null && value.from) && (value == null ? void 0 : value.from) !== (prevProps == null
|
|
428
|
+
var toDateChanged = !!(value != null && value.to) && (value == null ? void 0 : value.to) !== (prevProps == null || (_prevProps$value = prevProps.value) == null ? void 0 : _prevProps$value.to);
|
|
429
|
+
var fromDateChanged = !!(value != null && value.from) && (value == null ? void 0 : value.from) !== (prevProps == null || (_prevProps$value2 = prevProps.value) == null ? void 0 : _prevProps$value2.from);
|
|
434
430
|
var startOnLeft = fnsIsSameMonth(legacyParse(value.from), legacyParse(left.month));
|
|
435
431
|
var endOnLeft = fnsIsSameMonth(legacyParse(value.to), legacyParse(left.month));
|
|
436
432
|
|
|
@@ -462,14 +458,14 @@ var RangePicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
462
458
|
};
|
|
463
459
|
|
|
464
460
|
_proto.render = function render() {
|
|
465
|
-
var _this$
|
|
466
|
-
mode = _this$
|
|
467
|
-
onChange = _this$
|
|
468
|
-
value = _this$
|
|
469
|
-
canSwitchMode = _this$
|
|
470
|
-
dateOnly = _this$
|
|
471
|
-
onSwitchMode = _this$
|
|
472
|
-
texts = _this$
|
|
461
|
+
var _this$props12 = this.props,
|
|
462
|
+
mode = _this$props12.mode,
|
|
463
|
+
onChange = _this$props12.onChange,
|
|
464
|
+
value = _this$props12.value,
|
|
465
|
+
canSwitchMode = _this$props12.canSwitchMode,
|
|
466
|
+
dateOnly = _this$props12.dateOnly,
|
|
467
|
+
onSwitchMode = _this$props12.onSwitchMode,
|
|
468
|
+
texts = _this$props12.texts;
|
|
473
469
|
var _this$props$showNowBu = this.props.showNowButton,
|
|
474
470
|
showNowButton = _this$props$showNowBu === void 0 ? true : _this$props$showNowBu;
|
|
475
471
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.Sides, null, /*#__PURE__*/React.createElement(S.Side, {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
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
2
|
|
|
3
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
4
|
-
|
|
5
3
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
|
6
4
|
|
|
7
5
|
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; }
|
|
@@ -76,20 +74,18 @@ export function defaultValueTransformer(value) {
|
|
|
76
74
|
return value;
|
|
77
75
|
}
|
|
78
76
|
export var RawDateRangePicker = /*#__PURE__*/function (_PureComponent) {
|
|
79
|
-
_inheritsLoose(RawDateRangePicker, _PureComponent);
|
|
80
|
-
|
|
81
77
|
function RawDateRangePicker(props) {
|
|
82
78
|
var _this;
|
|
83
79
|
|
|
84
80
|
_this = _PureComponent.call(this, props) || this; // eslint-disable-next-line react/state-in-constructor
|
|
85
81
|
|
|
86
|
-
_defineProperty(
|
|
82
|
+
_defineProperty(_this, "handleFilterCancel", function () {
|
|
87
83
|
_this.setState({
|
|
88
84
|
mode: MODES.DATE
|
|
89
85
|
});
|
|
90
86
|
});
|
|
91
87
|
|
|
92
|
-
_defineProperty(
|
|
88
|
+
_defineProperty(_this, "handleFilterApply", function (filter) {
|
|
93
89
|
var value = _this.state.value;
|
|
94
90
|
|
|
95
91
|
_this.setState({
|
|
@@ -100,14 +96,14 @@ export var RawDateRangePicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
100
96
|
});
|
|
101
97
|
});
|
|
102
98
|
|
|
103
|
-
_defineProperty(
|
|
99
|
+
_defineProperty(_this, "allTexts", function () {
|
|
104
100
|
var _this$props = _this.props,
|
|
105
101
|
texts = _this$props.texts,
|
|
106
102
|
intl = _this$props.intl;
|
|
107
103
|
return getDefaultTexts(intl, false, texts);
|
|
108
104
|
});
|
|
109
105
|
|
|
110
|
-
_defineProperty(
|
|
106
|
+
_defineProperty(_this, "handleRangeChange", function (range) {
|
|
111
107
|
var _valueTransformer;
|
|
112
108
|
|
|
113
109
|
if (!range) {
|
|
@@ -161,7 +157,7 @@ export var RawDateRangePicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
161
157
|
onValueChange && onValueChange(legacyValue);
|
|
162
158
|
});
|
|
163
159
|
|
|
164
|
-
_defineProperty(
|
|
160
|
+
_defineProperty(_this, "handleApply", function () {
|
|
165
161
|
var intl = _this.props.intl;
|
|
166
162
|
var value = _this.state.value;
|
|
167
163
|
var _this$props3 = _this.props,
|
|
@@ -189,17 +185,17 @@ export var RawDateRangePicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
189
185
|
}
|
|
190
186
|
});
|
|
191
187
|
|
|
192
|
-
_defineProperty(
|
|
188
|
+
_defineProperty(_this, "handleModalOpenClick", function () {
|
|
193
189
|
_this.setState({
|
|
194
190
|
mode: MODES.FILTER
|
|
195
191
|
});
|
|
196
192
|
});
|
|
197
193
|
|
|
198
|
-
_defineProperty(
|
|
194
|
+
_defineProperty(_this, "handleRemoveFilterClick", function () {
|
|
199
195
|
_this.handleFilterApply(undefined);
|
|
200
196
|
});
|
|
201
197
|
|
|
202
|
-
_defineProperty(
|
|
198
|
+
_defineProperty(_this, "handleSwitchMode", function () {
|
|
203
199
|
var mode = _this.state.mode;
|
|
204
200
|
var updatedMode = mode === MODES.TIME ? MODES.DATE : MODES.TIME;
|
|
205
201
|
|
|
@@ -208,7 +204,7 @@ export var RawDateRangePicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
208
204
|
});
|
|
209
205
|
});
|
|
210
206
|
|
|
211
|
-
_defineProperty(
|
|
207
|
+
_defineProperty(_this, "handleAddonCollapse", function (addonKey, expanded) {
|
|
212
208
|
_this.setState(function (state) {
|
|
213
209
|
return _objectSpread({}, state, {
|
|
214
210
|
visibleAddonKey: expanded ? addonKey : undefined
|
|
@@ -216,7 +212,7 @@ export var RawDateRangePicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
216
212
|
});
|
|
217
213
|
});
|
|
218
214
|
|
|
219
|
-
_defineProperty(
|
|
215
|
+
_defineProperty(_this, "getAddons", function () {
|
|
220
216
|
var _this$props4 = _this.props,
|
|
221
217
|
showRelativePicker = _this$props4.showRelativePicker,
|
|
222
218
|
showFilter = _this$props4.showFilter,
|
|
@@ -291,6 +287,8 @@ export var RawDateRangePicker = /*#__PURE__*/function (_PureComponent) {
|
|
|
291
287
|
return _this;
|
|
292
288
|
}
|
|
293
289
|
|
|
290
|
+
_inheritsLoose(RawDateRangePicker, _PureComponent);
|
|
291
|
+
|
|
294
292
|
var _proto = RawDateRangePicker.prototype;
|
|
295
293
|
|
|
296
294
|
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
|
@@ -40,11 +40,11 @@ var TimestampRange = function TimestampRange(_ref) {
|
|
|
40
40
|
durationModifier = _React$useState[0],
|
|
41
41
|
setDurationModifier = _React$useState[1];
|
|
42
42
|
|
|
43
|
-
var _React$useState2 = React.useState(currentRange == null
|
|
43
|
+
var _React$useState2 = React.useState(currentRange == null || (_currentRange$duratio = currentRange.duration) == null ? void 0 : _currentRange$duratio.value),
|
|
44
44
|
durationValue = _React$useState2[0],
|
|
45
45
|
setDurationValue = _React$useState2[1];
|
|
46
46
|
|
|
47
|
-
var _React$useState3 = React.useState(currentRange == null
|
|
47
|
+
var _React$useState3 = React.useState(currentRange == null || (_currentRange$duratio2 = currentRange.duration) == null ? void 0 : _currentRange$duratio2.type),
|
|
48
48
|
durationUnit = _React$useState3[0],
|
|
49
49
|
setDurationUnit = _React$useState3[1];
|
|
50
50
|
|
|
@@ -2,8 +2,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
2
2
|
|
|
3
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; }
|
|
4
4
|
|
|
5
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
6
|
-
|
|
7
5
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
|
8
6
|
|
|
9
7
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -22,15 +20,13 @@ import { DEFAULT_RANGE, normalizeRange } from '../utils';
|
|
|
22
20
|
import { CUSTOM_RANGE_KEY, RANGES_MODE } from '../constants';
|
|
23
21
|
|
|
24
22
|
var RelativeRangePicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
25
|
-
_inheritsLoose(RelativeRangePicker, _React$PureComponent);
|
|
26
|
-
|
|
27
23
|
function RelativeRangePicker(props) {
|
|
28
24
|
var _this;
|
|
29
25
|
|
|
30
26
|
_this = _React$PureComponent.call(this, props) || this; // @ts-ignore
|
|
31
27
|
// eslint-disable-next-line
|
|
32
28
|
|
|
33
|
-
_defineProperty(
|
|
29
|
+
_defineProperty(_this, "onModeChange", function (mode) {
|
|
34
30
|
var currentGroup = _this.state.currentGroup;
|
|
35
31
|
|
|
36
32
|
if (mode !== currentGroup) {
|
|
@@ -45,7 +41,7 @@ var RelativeRangePicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
45
41
|
}
|
|
46
42
|
});
|
|
47
43
|
|
|
48
|
-
_defineProperty(
|
|
44
|
+
_defineProperty(_this, "onTimestampChange", function (timestamp) {
|
|
49
45
|
_this.setState({
|
|
50
46
|
sinceTimestamp: timestamp
|
|
51
47
|
});
|
|
@@ -60,7 +56,7 @@ var RelativeRangePicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
60
56
|
}
|
|
61
57
|
});
|
|
62
58
|
|
|
63
|
-
_defineProperty(
|
|
59
|
+
_defineProperty(_this, "handleCustomClick", function () {
|
|
64
60
|
var onChange = _this.props.onChange;
|
|
65
61
|
var _this$state = _this.state,
|
|
66
62
|
lastCustomRange = _this$state.lastCustomRange,
|
|
@@ -79,7 +75,7 @@ var RelativeRangePicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
79
75
|
}
|
|
80
76
|
});
|
|
81
77
|
|
|
82
|
-
_defineProperty(
|
|
78
|
+
_defineProperty(_this, "onChange", function (value) {
|
|
83
79
|
var currentGroup = _this.state.currentGroup;
|
|
84
80
|
var onChange = _this.props.onChange;
|
|
85
81
|
var isSince = currentGroup === RANGES_MODE.SINCE;
|
|
@@ -101,7 +97,7 @@ var RelativeRangePicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
101
97
|
onChange(resultRange);
|
|
102
98
|
});
|
|
103
99
|
|
|
104
|
-
_defineProperty(
|
|
100
|
+
_defineProperty(_this, "renderRanges", function (ranges) {
|
|
105
101
|
if (!ranges || ranges.length === 0) return null;
|
|
106
102
|
var currentRange = _this.state.currentRange;
|
|
107
103
|
var _this$props = _this.props,
|
|
@@ -117,7 +113,7 @@ var RelativeRangePicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
117
113
|
});
|
|
118
114
|
});
|
|
119
115
|
|
|
120
|
-
_defineProperty(
|
|
116
|
+
_defineProperty(_this, "renderRangesDropdown", function (ranges) {
|
|
121
117
|
var currentRange = _this.state.currentRange;
|
|
122
118
|
var _this$props2 = _this.props,
|
|
123
119
|
onChange = _this$props2.onChange,
|
|
@@ -132,7 +128,7 @@ var RelativeRangePicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
132
128
|
});
|
|
133
129
|
});
|
|
134
130
|
|
|
135
|
-
_defineProperty(
|
|
131
|
+
_defineProperty(_this, "onOffsetValueChange", function (value) {
|
|
136
132
|
var currentRange = _this.state.currentRange;
|
|
137
133
|
|
|
138
134
|
if (typeof value === 'number' && value >= 0 && currentRange) {
|
|
@@ -142,7 +138,7 @@ var RelativeRangePicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
142
138
|
}
|
|
143
139
|
});
|
|
144
140
|
|
|
145
|
-
_defineProperty(
|
|
141
|
+
_defineProperty(_this, "onDurationValueChange", function (value) {
|
|
146
142
|
var currentRange = _this.state.currentRange;
|
|
147
143
|
|
|
148
144
|
if (value && currentRange) {
|
|
@@ -152,7 +148,7 @@ var RelativeRangePicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
152
148
|
}
|
|
153
149
|
});
|
|
154
150
|
|
|
155
|
-
_defineProperty(
|
|
151
|
+
_defineProperty(_this, "renderCustomRangeForm", function () {
|
|
156
152
|
var _this$state2 = _this.state,
|
|
157
153
|
currentRange = _this$state2.currentRange,
|
|
158
154
|
currentGroup = _this$state2.currentGroup,
|
|
@@ -187,6 +183,8 @@ var RelativeRangePicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
187
183
|
return _this;
|
|
188
184
|
}
|
|
189
185
|
|
|
186
|
+
_inheritsLoose(RelativeRangePicker, _React$PureComponent);
|
|
187
|
+
|
|
190
188
|
RelativeRangePicker.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, prevState) {
|
|
191
189
|
var ranges = nextProps.ranges,
|
|
192
190
|
value = nextProps.value,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-date-range-picker",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.11",
|
|
4
4
|
"description": "Date-Range-Picker UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"@synerise/ds-date-picker": "^0.10.44",
|
|
42
42
|
"@synerise/ds-dropdown": "^0.17.105",
|
|
43
43
|
"@synerise/ds-icon": "^0.60.7",
|
|
44
|
-
"@synerise/ds-inline-edit": "^0.
|
|
44
|
+
"@synerise/ds-inline-edit": "^0.7.0",
|
|
45
45
|
"@synerise/ds-input": "^0.20.6",
|
|
46
46
|
"@synerise/ds-input-number": "^0.9.12",
|
|
47
|
-
"@synerise/ds-manageable-list": "^0.26.
|
|
47
|
+
"@synerise/ds-manageable-list": "^0.26.41",
|
|
48
48
|
"@synerise/ds-menu": "^0.18.20",
|
|
49
49
|
"@synerise/ds-scrollbar": "^0.10.2",
|
|
50
50
|
"@synerise/ds-select": "^0.15.45",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"@testing-library/user-event": "^10.3.1",
|
|
75
75
|
"@types/ramda": "^0.28.23"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "2b3ed7503dacc36c207049a5a3e81bfe190de0be"
|
|
78
78
|
}
|