@synerise/ds-date-range-picker 0.10.1 → 0.11.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 +32 -0
- package/dist/AddonCollapse/AddonCollapse.js +4 -4
- package/dist/AddonCollapse/AddonCollapse.types.js +1 -0
- package/dist/DateRangePicker.js +11 -26
- package/dist/DateRangePicker.styles.js +1 -1
- package/dist/DateRangePicker.types.js +1 -0
- package/dist/Footer/Footer.js +11 -12
- package/dist/Footer/Footer.types.js +1 -0
- package/dist/RangeFilter/Filters/DailyFilter/DailyFilter.js +1 -1
- package/dist/RangeFilter/Filters/MonthlyFilter/MonthlyFilter.js +166 -204
- package/dist/RangeFilter/Filters/MonthlyFilter/MonthlyFilter.types.js +1 -0
- package/dist/RangeFilter/Filters/WeeklyFilter/WeeklyFilter.js +2 -2
- package/dist/RangeFilter/Filters/WeeklyFilter/WeeklyFilter.types.js +1 -0
- package/dist/RangeFilter/Filters/new/Daily/Daily.js +5 -17
- package/dist/RangeFilter/Filters/new/Daily/Daily.types.js +1 -0
- package/dist/RangeFilter/Filters/new/Filters.types.js +1 -0
- package/dist/RangeFilter/Filters/new/Weekly/Weekly.js +21 -42
- package/dist/RangeFilter/Filters/new/Weekly/Weekly.types.js +1 -0
- package/dist/RangeFilter/Filters/new/Weekly/utils.js +6 -3
- package/dist/RangeFilter/Filters/new/hooks/useShiftAndControlKeys.js +6 -20
- package/dist/RangeFilter/RangeFilter.js +107 -135
- package/dist/RangeFilter/RangeFilter.types.js +1 -0
- package/dist/RangeFilter/Shared/AddButton/AddButton.js +7 -8
- package/dist/RangeFilter/Shared/AddButton/AddButton.types.js +1 -0
- package/dist/RangeFilter/Shared/FilterDropdown/FilterDropdown.js +14 -15
- package/dist/RangeFilter/Shared/FilterDropdown/FilterDropdown.types.js +1 -0
- package/dist/RangeFilter/Shared/RangeFilterStatus/RangeFilterStatus.js +11 -12
- package/dist/RangeFilter/Shared/RangeFilterStatus/RangeFilterStatus.types.js +1 -0
- package/dist/RangeFilter/Shared/SaveFilterForm/SaveFilterForm.js +14 -29
- package/dist/RangeFilter/Shared/SaveFilterForm/SaveFilterForm.types.js +1 -0
- package/dist/RangeFilter/Shared/SelectionCount/SelectionCount.js +1 -1
- package/dist/RangeFilter/Shared/SelectionCount/SelectionCount.types.js +1 -0
- package/dist/RangeFilter/Shared/SelectionHint/SelectionHint.js +3 -4
- package/dist/RangeFilter/Shared/TimeWindow/Day/Day.js +14 -28
- package/dist/RangeFilter/Shared/TimeWindow/Day/Day.types.js +1 -0
- package/dist/RangeFilter/Shared/TimeWindow/Grid/Grid.js +7 -7
- package/dist/RangeFilter/Shared/TimeWindow/Grid/Grid.types.js +1 -0
- package/dist/RangeFilter/Shared/TimeWindow/Header/Header.js +6 -4
- package/dist/RangeFilter/Shared/TimeWindow/RangeActions/RangeActions.js +14 -15
- package/dist/RangeFilter/Shared/TimeWindow/RangeActions/RangeActions.types.js +1 -0
- package/dist/RangeFilter/Shared/TimeWindow/RangeFormContainer/RangeForm/RangeForm.js +18 -33
- package/dist/RangeFilter/Shared/TimeWindow/RangeFormContainer/RangeForm/RangeForm.types.js +1 -0
- package/dist/RangeFilter/Shared/TimeWindow/RangeFormContainer/RangeFormContainer.js +10 -23
- package/dist/RangeFilter/Shared/TimeWindow/RangeFormContainer/RangeFormContainer.types.js +1 -0
- package/dist/RangeFilter/Shared/TimeWindow/RangeSummary/RangeSummary.js +4 -4
- package/dist/RangeFilter/Shared/TimeWindow/RangeSummary/RangeSummary.types.js +1 -0
- package/dist/RangeFilter/Shared/TimeWindow/TimeWindow.js +144 -176
- package/dist/RangeFilter/Shared/TimeWindow/TimeWindow.types.js +1 -0
- package/dist/RangeFilter/Shared/TimeWindow/utils.js +2 -2
- package/dist/RangeFilter/constants.js +1 -1
- package/dist/RangeFilter/utils.js +41 -54
- package/dist/RangePicker/RangePicker.js +106 -125
- package/dist/RangePicker/RangePicker.types.js +1 -0
- package/dist/RangePicker/utils.js +8 -3
- package/dist/RangePickerInput/RangePickerInput.js +19 -33
- package/dist/RangePickerInput/RangePickerInput.styles.js +1 -1
- package/dist/RangePickerInput/RangePickerInput.types.js +1 -0
- package/dist/RawDateRangePicker.js +113 -136
- package/dist/RelativeRangePicker/Elements/CustomRangeForm/CustomRangeForm.js +4 -4
- package/dist/RelativeRangePicker/Elements/CustomRangeForm/CustomRangeForm.types.js +1 -0
- package/dist/RelativeRangePicker/Elements/CustomRangeForm/DurationField/DurationField.js +5 -5
- package/dist/RelativeRangePicker/Elements/CustomRangeForm/DurationField/DurationField.types.js +1 -0
- package/dist/RelativeRangePicker/Elements/CustomRangeForm/OffsetField/OffsetField.js +5 -5
- package/dist/RelativeRangePicker/Elements/CustomRangeForm/OffsetField/OffsetField.types.js +1 -0
- package/dist/RelativeRangePicker/Elements/ModeDropdown/ModeDropdown.js +12 -26
- package/dist/RelativeRangePicker/Elements/ModeDropdown/ModeDropdown.types.js +1 -0
- package/dist/RelativeRangePicker/Elements/RangeButtons/RangeButtons.js +3 -3
- package/dist/RelativeRangePicker/Elements/RangeButtons/RangeButtons.types.js +1 -0
- package/dist/RelativeRangePicker/Elements/RangeDropdown/RangeDropdown.js +12 -26
- package/dist/RelativeRangePicker/Elements/RangeDropdown/RangeDropdown.types.js +1 -0
- package/dist/RelativeRangePicker/Elements/TimestampRange/TimestampDuration/TimestampDuration.js +6 -6
- package/dist/RelativeRangePicker/Elements/TimestampRange/TimestampDuration/TimestampDuration.types.js +1 -0
- package/dist/RelativeRangePicker/Elements/TimestampRange/TimestampRange.js +14 -30
- package/dist/RelativeRangePicker/Elements/TimestampRange/TimestampRange.types.js +1 -0
- package/dist/RelativeRangePicker/RelativeRangePicker.js +79 -114
- package/dist/RelativeRangePicker/RelativeRangePicker.styles.js +12 -7
- package/dist/RelativeRangePicker/RelativeRangePicker.types.js +1 -0
- package/dist/RelativeRangePicker/utils.js +5 -5
- package/dist/constants.js +1 -13
- package/dist/date.types.js +1 -0
- package/dist/dateUtils/Date.js +2 -2
- package/dist/dateUtils/format.js +5 -2
- package/dist/dateUtils/getRelativePresetForRange.js +1 -1
- package/dist/utils.js +52 -52
- package/package.json +8 -8
|
@@ -1,48 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
var _excluded = ["days", "numberOfDays", "daily", "intl", "texts", "disabled"];
|
|
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
|
|
|
5
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
6
|
-
|
|
7
5
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
8
6
|
|
|
9
7
|
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; }
|
|
10
8
|
|
|
11
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; }
|
|
12
10
|
|
|
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; }
|
|
14
|
-
|
|
15
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
16
|
-
|
|
17
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
18
|
-
|
|
19
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
20
|
-
|
|
21
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
22
|
-
|
|
23
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
24
|
-
|
|
25
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
26
|
-
|
|
27
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
28
|
-
|
|
29
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
30
|
-
|
|
31
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
32
|
-
|
|
33
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
34
|
-
|
|
35
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
36
|
-
|
|
37
|
-
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
38
|
-
|
|
39
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
40
|
-
|
|
41
11
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
42
12
|
|
|
43
|
-
function
|
|
13
|
+
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
|
44
14
|
|
|
45
|
-
function
|
|
15
|
+
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; }
|
|
46
16
|
|
|
47
17
|
import * as React from 'react';
|
|
48
18
|
import { range } from 'lodash';
|
|
@@ -62,32 +32,30 @@ import SelectionHint from '../SelectionHint/SelectionHint';
|
|
|
62
32
|
export var DEFAULT_LIMIT_MODE = 'Range';
|
|
63
33
|
|
|
64
34
|
var TimeWindowBase = /*#__PURE__*/function (_React$PureComponent) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
var _super = _createSuper(TimeWindowBase);
|
|
35
|
+
_inheritsLoose(TimeWindowBase, _React$PureComponent);
|
|
68
36
|
|
|
69
37
|
function TimeWindowBase() {
|
|
70
38
|
var _this;
|
|
71
39
|
|
|
72
|
-
_classCallCheck(this, TimeWindowBase);
|
|
73
|
-
|
|
74
40
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
75
41
|
args[_key] = arguments[_key];
|
|
76
42
|
}
|
|
77
43
|
|
|
78
|
-
_this =
|
|
79
|
-
|
|
44
|
+
_this = _React$PureComponent.call.apply(_React$PureComponent, [this].concat(args)) || this;
|
|
45
|
+
|
|
46
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
80
47
|
activeDays: _this.props.daily ? [0] : [],
|
|
81
48
|
controlKeyPressed: false
|
|
82
|
-
};
|
|
83
|
-
_this.wrapperRef = React.createRef();
|
|
49
|
+
});
|
|
84
50
|
|
|
85
|
-
_this
|
|
51
|
+
_defineProperty(_assertThisInitialized(_this), "wrapperRef", React.createRef());
|
|
52
|
+
|
|
53
|
+
_defineProperty(_assertThisInitialized(_this), "isDayRestricted", function (dayKey) {
|
|
86
54
|
var days = _this.props.days;
|
|
87
55
|
return !!days[dayKey] && days[dayKey].restricted;
|
|
88
|
-
};
|
|
56
|
+
});
|
|
89
57
|
|
|
90
|
-
_this
|
|
58
|
+
_defineProperty(_assertThisInitialized(_this), "checkActiveDay", function (dayKey) {
|
|
91
59
|
var isRangeDefined = _this.state.isRangeDefined;
|
|
92
60
|
if (!_this.isDayRestricted(dayKey) && isRangeDefined && !_this.haveActiveDaysCommonRange()) _this.checkDay(dayKey);
|
|
93
61
|
var _this$state = _this.state,
|
|
@@ -97,7 +65,7 @@ var TimeWindowBase = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
97
65
|
var updatedActiveDay = [];
|
|
98
66
|
|
|
99
67
|
if (controlKeyPressed) {
|
|
100
|
-
updatedActiveDay = activeDays.includes(dayKey) ? activeDays : [].concat(
|
|
68
|
+
updatedActiveDay = activeDays.includes(dayKey) ? activeDays : [].concat(activeDays, [dayKey]);
|
|
101
69
|
} else if (activeDays.length > 0 && shiftKeyPressed) {
|
|
102
70
|
updatedActiveDay = activeDays[0] < dayKey ? range(+activeDays[0], +dayKey + 1) : range(+dayKey, +activeDays[0] + 1);
|
|
103
71
|
} else {
|
|
@@ -109,9 +77,9 @@ var TimeWindowBase = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
109
77
|
activeDays: updatedActiveDay
|
|
110
78
|
});
|
|
111
79
|
});
|
|
112
|
-
};
|
|
80
|
+
});
|
|
113
81
|
|
|
114
|
-
_this
|
|
82
|
+
_defineProperty(_assertThisInitialized(_this), "uncheckActiveDay", function (dayKey) {
|
|
115
83
|
var _this$state2 = _this.state,
|
|
116
84
|
activeDays = _this$state2.activeDays,
|
|
117
85
|
controlKeyPressed = _this$state2.controlKeyPressed;
|
|
@@ -130,9 +98,9 @@ var TimeWindowBase = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
130
98
|
});
|
|
131
99
|
|
|
132
100
|
_this.removeDaySelection(dayKey);
|
|
133
|
-
};
|
|
101
|
+
});
|
|
134
102
|
|
|
135
|
-
_this
|
|
103
|
+
_defineProperty(_assertThisInitialized(_this), "handleToggleDay", function (dayKey, forcedState) {
|
|
136
104
|
var _this$state3 = _this.state,
|
|
137
105
|
activeDays = _this$state3.activeDays,
|
|
138
106
|
controlKeyPressed = _this$state3.controlKeyPressed;
|
|
@@ -147,25 +115,27 @@ var TimeWindowBase = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
147
115
|
} else {
|
|
148
116
|
activeDays.includes(dayKey) ? _this.uncheckActiveDay(dayKey) : _this.checkActiveDay(dayKey);
|
|
149
117
|
}
|
|
150
|
-
};
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
_defineProperty(_assertThisInitialized(_this), "handleDayChange", function (dayKey, dayChanges) {
|
|
121
|
+
var _objectSpread2;
|
|
151
122
|
|
|
152
|
-
_this.handleDayChange = function (dayKey, dayChanges) {
|
|
153
123
|
var _this$props = _this.props,
|
|
154
124
|
onChange = _this$props.onChange,
|
|
155
125
|
days = _this$props.days;
|
|
156
|
-
onChange(_objectSpread({}, days,
|
|
157
|
-
};
|
|
126
|
+
onChange(_objectSpread({}, days, (_objectSpread2 = {}, _objectSpread2[dayKey] = _objectSpread({}, _this.getDayValue(dayKey), {}, dayChanges), _objectSpread2)));
|
|
127
|
+
});
|
|
158
128
|
|
|
159
|
-
_this
|
|
129
|
+
_defineProperty(_assertThisInitialized(_this), "removeDaySelection", function (dayKey) {
|
|
160
130
|
var _this$props2 = _this.props,
|
|
161
131
|
onChange = _this$props2.onChange,
|
|
162
132
|
days = _this$props2.days;
|
|
163
133
|
var updatedDays = days;
|
|
164
134
|
delete updatedDays[dayKey];
|
|
165
135
|
onChange(updatedDays);
|
|
166
|
-
};
|
|
136
|
+
});
|
|
167
137
|
|
|
168
|
-
_this
|
|
138
|
+
_defineProperty(_assertThisInitialized(_this), "checkDay", function (dayKey) {
|
|
169
139
|
var onCheckDay = _this.props.onCheckDay;
|
|
170
140
|
|
|
171
141
|
_this.handleDayChange(dayKey, {
|
|
@@ -176,17 +146,17 @@ var TimeWindowBase = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
176
146
|
});
|
|
177
147
|
|
|
178
148
|
onCheckDay && onCheckDay(dayKey);
|
|
179
|
-
};
|
|
149
|
+
});
|
|
180
150
|
|
|
181
|
-
_this
|
|
151
|
+
_defineProperty(_assertThisInitialized(_this), "handleDayTimeChange", function (value, dayKey) {
|
|
182
152
|
_this.handleDayChange(dayKey, {
|
|
183
153
|
restricted: true,
|
|
184
154
|
start: dayjs(value[0]).format(TIME_FORMAT),
|
|
185
155
|
stop: dayjs(value[1]).format(TIME_FORMAT)
|
|
186
156
|
});
|
|
187
|
-
};
|
|
157
|
+
});
|
|
188
158
|
|
|
189
|
-
_this
|
|
159
|
+
_defineProperty(_assertThisInitialized(_this), "handleMultipleDayTimeChange", function (value) {
|
|
190
160
|
var _this$props3 = _this.props,
|
|
191
161
|
onChange = _this$props3.onChange,
|
|
192
162
|
days = _this$props3.days;
|
|
@@ -201,9 +171,9 @@ var TimeWindowBase = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
201
171
|
};
|
|
202
172
|
});
|
|
203
173
|
onChange(_objectSpread({}, days, {}, updatedDays));
|
|
204
|
-
};
|
|
174
|
+
});
|
|
205
175
|
|
|
206
|
-
_this
|
|
176
|
+
_defineProperty(_assertThisInitialized(_this), "handleRangeDelete", function () {
|
|
207
177
|
var _this$props4 = _this.props,
|
|
208
178
|
onChange = _this$props4.onChange,
|
|
209
179
|
days = _this$props4.days;
|
|
@@ -213,15 +183,15 @@ var TimeWindowBase = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
213
183
|
delete updatedDays[k];
|
|
214
184
|
});
|
|
215
185
|
onChange(_objectSpread({}, updatedDays));
|
|
216
|
-
};
|
|
186
|
+
});
|
|
217
187
|
|
|
218
|
-
_this
|
|
188
|
+
_defineProperty(_assertThisInitialized(_this), "handleClearSelection", function () {
|
|
219
189
|
_this.setState({
|
|
220
190
|
activeDays: []
|
|
221
191
|
});
|
|
222
|
-
};
|
|
192
|
+
});
|
|
223
193
|
|
|
224
|
-
_this
|
|
194
|
+
_defineProperty(_assertThisInitialized(_this), "handleSelectAll", function () {
|
|
225
195
|
var keys = _this.getAllKeys();
|
|
226
196
|
|
|
227
197
|
var onSelectAll = _this.props.onSelectAll;
|
|
@@ -231,9 +201,9 @@ var TimeWindowBase = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
231
201
|
}, function () {
|
|
232
202
|
onSelectAll && onSelectAll();
|
|
233
203
|
});
|
|
234
|
-
};
|
|
204
|
+
});
|
|
235
205
|
|
|
236
|
-
_this
|
|
206
|
+
_defineProperty(_assertThisInitialized(_this), "getDayValue", function (dayKey) {
|
|
237
207
|
var _customDays$dayKey, _customDays$dayKey2;
|
|
238
208
|
|
|
239
209
|
var _this$props5 = _this.props,
|
|
@@ -243,7 +213,7 @@ var TimeWindowBase = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
243
213
|
daily = _this$props5.daily,
|
|
244
214
|
valueSelectionModes = _this$props5.valueSelectionModes;
|
|
245
215
|
var dayValue = {};
|
|
246
|
-
if (daily) dayValue = days;else if (days[dayKey]) dayValue = days[dayKey];else if (typeof dayKey === 'number') dayValue = dayTemplate(dayKey);else if (customDays && (
|
|
216
|
+
if (daily) dayValue = days;else if (days[dayKey]) dayValue = days[dayKey];else if (typeof dayKey === 'number') dayValue = dayTemplate(dayKey);else if (customDays && (_customDays$dayKey = customDays[dayKey]) != null && _customDays$dayKey.template && ((_customDays$dayKey2 = customDays[dayKey]) == null ? void 0 : _customDays$dayKey2.template) !== null) {
|
|
247
217
|
dayValue = customDays[dayKey].template;
|
|
248
218
|
}
|
|
249
219
|
return _objectSpread({
|
|
@@ -254,9 +224,9 @@ var TimeWindowBase = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
254
224
|
inverted: false,
|
|
255
225
|
mode: valueSelectionModes[0] || DEFAULT_LIMIT_MODE
|
|
256
226
|
}, dayValue);
|
|
257
|
-
};
|
|
227
|
+
});
|
|
258
228
|
|
|
259
|
-
_this
|
|
229
|
+
_defineProperty(_assertThisInitialized(_this), "getDayLabel", function (dayKey, _long) {
|
|
260
230
|
var _this$props6 = _this.props,
|
|
261
231
|
dayFormatter = _this$props6.dayFormatter,
|
|
262
232
|
customDays = _this$props6.customDays;
|
|
@@ -268,18 +238,18 @@ var TimeWindowBase = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
268
238
|
|
|
269
239
|
if (!label) label = dayFormatter(dayKey, _long);
|
|
270
240
|
return label;
|
|
271
|
-
};
|
|
241
|
+
});
|
|
272
242
|
|
|
273
|
-
_this
|
|
243
|
+
_defineProperty(_assertThisInitialized(_this), "handleRangePaste", function (dayKeys) {
|
|
274
244
|
var rangeClipboard = _this.props.rangeClipboard;
|
|
275
245
|
var activeDays = _this.state.activeDays;
|
|
276
246
|
|
|
277
|
-
if (
|
|
247
|
+
if (rangeClipboard != null && rangeClipboard.stop && rangeClipboard != null && rangeClipboard.start) {
|
|
278
248
|
activeDays.length > 1 ? _this.handleMultipleDayTimeChange([getDateFromDayValue(rangeClipboard.start), getDateFromDayValue(rangeClipboard.stop)]) : _this.handleDayTimeChange([getDateFromDayValue(rangeClipboard.start), getDateFromDayValue(rangeClipboard.stop)], dayKeys);
|
|
279
249
|
}
|
|
280
|
-
};
|
|
250
|
+
});
|
|
281
251
|
|
|
282
|
-
_this
|
|
252
|
+
_defineProperty(_assertThisInitialized(_this), "handleRangeCopy", function () {
|
|
283
253
|
var onRangeCopy = _this.props.onRangeCopy;
|
|
284
254
|
var activeDays = _this.state.activeDays;
|
|
285
255
|
|
|
@@ -289,18 +259,18 @@ var TimeWindowBase = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
289
259
|
start: dayValue.start,
|
|
290
260
|
stop: dayValue.stop
|
|
291
261
|
});
|
|
292
|
-
};
|
|
262
|
+
});
|
|
293
263
|
|
|
294
|
-
_this
|
|
264
|
+
_defineProperty(_assertThisInitialized(_this), "getAllKeys", function () {
|
|
295
265
|
var _this$props7 = _this.props,
|
|
296
266
|
numberOfDays = _this$props7.numberOfDays,
|
|
297
267
|
customDays = _this$props7.customDays;
|
|
298
268
|
var keys = range(numberOfDays);
|
|
299
|
-
if (customDays) keys = [].concat(
|
|
269
|
+
if (customDays) keys = [].concat(keys, Object.keys(customDays));
|
|
300
270
|
return keys;
|
|
301
|
-
};
|
|
271
|
+
});
|
|
302
272
|
|
|
303
|
-
_this
|
|
273
|
+
_defineProperty(_assertThisInitialized(_this), "renderDay", function (dayKey) {
|
|
304
274
|
var _this$props8 = _this.props,
|
|
305
275
|
customDays = _this$props8.customDays,
|
|
306
276
|
intl = _this$props8.intl,
|
|
@@ -322,7 +292,7 @@ var TimeWindowBase = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
322
292
|
Component = Day;
|
|
323
293
|
}
|
|
324
294
|
|
|
325
|
-
return React.createElement(Component, {
|
|
295
|
+
return /*#__PURE__*/React.createElement(Component, {
|
|
326
296
|
key: dayKey,
|
|
327
297
|
dayKey: dayKey,
|
|
328
298
|
"data-attr": dayKey,
|
|
@@ -334,9 +304,9 @@ var TimeWindowBase = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
334
304
|
onToggle: _this.handleToggleDay,
|
|
335
305
|
texts: texts
|
|
336
306
|
});
|
|
337
|
-
};
|
|
307
|
+
});
|
|
338
308
|
|
|
339
|
-
_this
|
|
309
|
+
_defineProperty(_assertThisInitialized(_this), "handleRangeAdd", function () {
|
|
340
310
|
var daily = _this.props.daily;
|
|
341
311
|
|
|
342
312
|
if (!daily && !_this.haveActiveDaysCommonRange()) {
|
|
@@ -346,9 +316,9 @@ var TimeWindowBase = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
346
316
|
_this.setState({
|
|
347
317
|
isRangeDefined: true
|
|
348
318
|
});
|
|
349
|
-
};
|
|
319
|
+
});
|
|
350
320
|
|
|
351
|
-
_this
|
|
321
|
+
_defineProperty(_assertThisInitialized(_this), "renderRangeForm", function (dayKeys) {
|
|
352
322
|
var activeDays = _this.state.activeDays;
|
|
353
323
|
var _this$props9 = _this.props,
|
|
354
324
|
hideHeader = _this$props9.hideHeader,
|
|
@@ -362,7 +332,7 @@ var TimeWindowBase = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
362
332
|
renderRangeFormSuffix = _this$props9.renderRangeFormSuffix,
|
|
363
333
|
timePickerProps = _this$props9.timePickerProps,
|
|
364
334
|
disabled = _this$props9.disabled;
|
|
365
|
-
return React.createElement(RangeFormContainer, {
|
|
335
|
+
return /*#__PURE__*/React.createElement(RangeFormContainer, {
|
|
366
336
|
disabled: disabled,
|
|
367
337
|
onChange: onChange,
|
|
368
338
|
days: days,
|
|
@@ -386,9 +356,9 @@ var TimeWindowBase = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
386
356
|
timePickerProps: timePickerProps,
|
|
387
357
|
valueSelectionModes: valueSelectionModes
|
|
388
358
|
});
|
|
389
|
-
};
|
|
359
|
+
});
|
|
390
360
|
|
|
391
|
-
_this
|
|
361
|
+
_defineProperty(_assertThisInitialized(_this), "haveActiveDaysCommonRange", function () {
|
|
392
362
|
var activeDays = _this.state.activeDays;
|
|
393
363
|
var days = _this.props.days;
|
|
394
364
|
var previousDay;
|
|
@@ -406,14 +376,14 @@ var TimeWindowBase = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
406
376
|
return false;
|
|
407
377
|
}
|
|
408
378
|
|
|
409
|
-
var areRangeDifferent = (currentDay
|
|
379
|
+
var areRangeDifferent = (currentDay == null ? void 0 : currentDay.start) !== ((_previousDay = previousDay) == null ? void 0 : _previousDay.start) || (currentDay == null ? void 0 : currentDay.stop) !== ((_previousDay2 = previousDay) == null ? void 0 : _previousDay2.stop);
|
|
410
380
|
previousDay = currentDay;
|
|
411
381
|
return areRangeDifferent;
|
|
412
382
|
});
|
|
413
383
|
return !activeDaysHaveDifferentRanges;
|
|
414
|
-
};
|
|
384
|
+
});
|
|
415
385
|
|
|
416
|
-
_this
|
|
386
|
+
_defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (e) {
|
|
417
387
|
if (e.key === 'Shift') {
|
|
418
388
|
_this.setState(function (state) {
|
|
419
389
|
return _objectSpread({}, state, {
|
|
@@ -431,9 +401,9 @@ var TimeWindowBase = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
431
401
|
});
|
|
432
402
|
});
|
|
433
403
|
}
|
|
434
|
-
};
|
|
404
|
+
});
|
|
435
405
|
|
|
436
|
-
_this
|
|
406
|
+
_defineProperty(_assertThisInitialized(_this), "handleKeyUp", function (e) {
|
|
437
407
|
if (e.key === 'Control' || e.key === 'Meta') {
|
|
438
408
|
_this.setState(function (state) {
|
|
439
409
|
return _objectSpread({}, state, {
|
|
@@ -449,97 +419,94 @@ var TimeWindowBase = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
449
419
|
});
|
|
450
420
|
});
|
|
451
421
|
}
|
|
452
|
-
};
|
|
422
|
+
});
|
|
453
423
|
|
|
454
424
|
return _this;
|
|
455
425
|
}
|
|
456
426
|
|
|
457
|
-
|
|
458
|
-
key: "componentDidMount",
|
|
459
|
-
value: function componentDidMount() {
|
|
460
|
-
var wrapper = this.wrapperRef;
|
|
427
|
+
var _proto = TimeWindowBase.prototype;
|
|
461
428
|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
429
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
430
|
+
var wrapper = this.wrapperRef;
|
|
431
|
+
|
|
432
|
+
if (wrapper != null && wrapper.current && wrapper.current !== null) {
|
|
433
|
+
// focus on wrapper to enable listening for keydown without having to click on wrapper
|
|
434
|
+
wrapper.current.focus();
|
|
466
435
|
}
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
});
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
|
|
439
|
+
var hasCommonRange = this.haveActiveDaysCommonRange();
|
|
440
|
+
|
|
441
|
+
if (prevState.isRangeDefined !== hasCommonRange) {
|
|
442
|
+
// eslint-disable-next-line react/no-did-update-set-state
|
|
443
|
+
this.setState(function (state) {
|
|
444
|
+
return _objectSpread({}, state, {
|
|
445
|
+
isRangeDefined: hasCommonRange
|
|
478
446
|
});
|
|
479
|
-
}
|
|
447
|
+
});
|
|
480
448
|
}
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
label: intl.formatMessage({
|
|
521
|
-
id: 'DS.DATE-RANGE-PICKER.SELECTED',
|
|
522
|
-
defaultMessage: 'Selected: '
|
|
523
|
-
})
|
|
524
|
-
})
|
|
525
|
-
})), shouldRenderRangeForm && this.renderRangeForm(rangeFormKey), shouldRenderSelectionHint && React.createElement(SelectionHint, {
|
|
526
|
-
message: intl.formatMessage({
|
|
527
|
-
id: 'DS.DATE-RANGE-PICKER.SELECT-DAYS-DESCRIPTION'
|
|
528
|
-
})
|
|
529
|
-
}), shouldRenderAddButton && React.createElement(S.AddButtonWrapper, null, React.createElement(AddButton, {
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
_proto.render = function render() {
|
|
452
|
+
var _this$props10 = this.props,
|
|
453
|
+
days = _this$props10.days,
|
|
454
|
+
numberOfDays = _this$props10.numberOfDays,
|
|
455
|
+
daily = _this$props10.daily,
|
|
456
|
+
intl = _this$props10.intl,
|
|
457
|
+
texts = _this$props10.texts,
|
|
458
|
+
disabled = _this$props10.disabled,
|
|
459
|
+
rest = _objectWithoutPropertiesLoose(_this$props10, _excluded);
|
|
460
|
+
|
|
461
|
+
var _this$state4 = this.state,
|
|
462
|
+
activeDays = _this$state4.activeDays,
|
|
463
|
+
isRangeDefined = _this$state4.isRangeDefined;
|
|
464
|
+
var keys = this.getAllKeys();
|
|
465
|
+
var singleMode = keys.length === 1;
|
|
466
|
+
var rangeFormKey = singleMode ? keys[0] : activeDays;
|
|
467
|
+
var shouldRenderRangeForm = !!activeDays.length && isRangeDefined || !!daily;
|
|
468
|
+
var shouldRenderSelectionHint = !activeDays.length && !disabled;
|
|
469
|
+
var shouldRenderAddButton = !!activeDays.length && !daily && !isRangeDefined && !disabled;
|
|
470
|
+
return /*#__PURE__*/React.createElement(S.TimeWindowContainer, {
|
|
471
|
+
tabIndex: 0,
|
|
472
|
+
ref: this.wrapperRef,
|
|
473
|
+
onKeyDown: this.handleKeyDown,
|
|
474
|
+
onKeyUp: this.handleKeyUp
|
|
475
|
+
}, !singleMode && /*#__PURE__*/React.createElement(Grid, _extends({
|
|
476
|
+
onUnselectAll: this.handleClearSelection,
|
|
477
|
+
onSelectAll: this.handleSelectAll,
|
|
478
|
+
showUnselectAll: (activeDays == null ? void 0 : activeDays.length) > 0,
|
|
479
|
+
renderDay: this.renderDay,
|
|
480
|
+
keys: keys,
|
|
481
|
+
days: days,
|
|
482
|
+
intl: intl,
|
|
483
|
+
numberOfDays: numberOfDays,
|
|
484
|
+
texts: texts
|
|
485
|
+
}, rest, {
|
|
486
|
+
title: /*#__PURE__*/React.createElement(SelectionCount, {
|
|
487
|
+
selectedDayCount: activeDays.length,
|
|
530
488
|
label: intl.formatMessage({
|
|
531
|
-
id: 'DS.DATE-RANGE-PICKER.
|
|
532
|
-
defaultMessage: '
|
|
533
|
-
})
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
489
|
+
id: 'DS.DATE-RANGE-PICKER.SELECTED',
|
|
490
|
+
defaultMessage: 'Selected: '
|
|
491
|
+
})
|
|
492
|
+
})
|
|
493
|
+
})), shouldRenderRangeForm && this.renderRangeForm(rangeFormKey), shouldRenderSelectionHint && /*#__PURE__*/React.createElement(SelectionHint, {
|
|
494
|
+
message: intl.formatMessage({
|
|
495
|
+
id: 'DS.DATE-RANGE-PICKER.SELECT-DAYS-DESCRIPTION'
|
|
496
|
+
})
|
|
497
|
+
}), shouldRenderAddButton && /*#__PURE__*/React.createElement(S.AddButtonWrapper, null, /*#__PURE__*/React.createElement(AddButton, {
|
|
498
|
+
label: intl.formatMessage({
|
|
499
|
+
id: 'DS.DATE-RANGE-PICKER.ADD-TIME',
|
|
500
|
+
defaultMessage: 'Add time'
|
|
501
|
+
}),
|
|
502
|
+
onClick: this.handleRangeAdd
|
|
503
|
+
})));
|
|
504
|
+
};
|
|
538
505
|
|
|
539
506
|
return TimeWindowBase;
|
|
540
507
|
}(React.PureComponent);
|
|
541
508
|
|
|
542
|
-
TimeWindowBase
|
|
509
|
+
_defineProperty(TimeWindowBase, "defaultProps", {
|
|
543
510
|
days: {},
|
|
544
511
|
numberOfDays: 1,
|
|
545
512
|
showSelectAll: false,
|
|
@@ -550,9 +517,10 @@ TimeWindowBase.defaultProps = {
|
|
|
550
517
|
};
|
|
551
518
|
},
|
|
552
519
|
dayFormatter: function dayFormatter(dayKey) {
|
|
553
|
-
return React.createElement(FormattedMessage, {
|
|
554
|
-
id: "DS.DATE-RANGE-PICKER.WEEKDAYS-SHORT-"
|
|
520
|
+
return /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
521
|
+
id: "DS.DATE-RANGE-PICKER.WEEKDAYS-SHORT-" + dayKey
|
|
555
522
|
});
|
|
556
523
|
}
|
|
557
|
-
};
|
|
524
|
+
});
|
|
525
|
+
|
|
558
526
|
export default injectIntl(TimeWindowBase);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -7,9 +7,9 @@ var TODAY = new Date();
|
|
|
7
7
|
export var getDateFromDayValue = function getDateFromDayValue(dayValue, hourTimeFormat) {
|
|
8
8
|
var DAY_FORMAT = "YYYY-MM-DD";
|
|
9
9
|
var todayToString = dayjs(TODAY).format(DAY_FORMAT);
|
|
10
|
-
var input =
|
|
10
|
+
var input = todayToString + "-" + dayValue;
|
|
11
11
|
var hourFormat = hourTimeFormat || DEFAULT_TIME_FORMAT;
|
|
12
|
-
return dayjs(input,
|
|
12
|
+
return dayjs(input, DAY_FORMAT + "-" + hourFormat).toDate();
|
|
13
13
|
};
|
|
14
14
|
export var reverseRange = function reverseRange(inputRange, groupItem) {
|
|
15
15
|
var grouping = function grouping(item) {
|
|
@@ -10,7 +10,7 @@ export var DEFAULT_RANGE_START = '00:00:00.000';
|
|
|
10
10
|
export var DEFAULT_RANGE_END = '23:59:59.999';
|
|
11
11
|
export var MONTH_DAYS = function MONTH_DAYS(locale) {
|
|
12
12
|
return range(0, 31).map(function (i) {
|
|
13
|
-
return locale === 'pl' ?
|
|
13
|
+
return locale === 'pl' ? i + 1 + "." : fnsFormat(fnsAddDays(LONG_MONTH, i), 'Do');
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
export var DAYS_OF_PERIOD_ENUM;
|