@synerise/ds-date-range-picker 0.31.1 → 0.31.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/AddonCollapse/AddonCollapse.js +4 -8
  3. package/dist/DateRangePicker.js +31 -48
  4. package/dist/DateRangePicker.styles.js +0 -13
  5. package/dist/DateRangePicker.types.js +5 -1
  6. package/dist/Footer/Footer.js +16 -31
  7. package/dist/Footer/Footer.styles.js +0 -1
  8. package/dist/RangeFilter/Filters/DailyFilter/DailyFilter.js +9 -11
  9. package/dist/RangeFilter/Filters/MonthlyFilter/MonthlyFilter.js +36 -83
  10. package/dist/RangeFilter/Filters/WeeklyFilter/WeeklyFilter.js +11 -12
  11. package/dist/RangeFilter/Filters/new/Daily/Daily.js +15 -24
  12. package/dist/RangeFilter/Filters/new/Monthly/Monthly.js +27 -60
  13. package/dist/RangeFilter/Filters/new/Monthly/utils.js +0 -7
  14. package/dist/RangeFilter/Filters/new/Weekly/Weekly.js +23 -49
  15. package/dist/RangeFilter/Filters/new/Weekly/utils.js +0 -7
  16. package/dist/RangeFilter/Filters/new/constants.js +2 -2
  17. package/dist/RangeFilter/Filters/new/hooks/useShiftAndControlKeys.js +4 -10
  18. package/dist/RangeFilter/RangeFilter.js +19 -55
  19. package/dist/RangeFilter/Shared/AddButton/AddButton.js +1 -7
  20. package/dist/RangeFilter/Shared/FilterDropdown/FilterDropdown.js +4 -6
  21. package/dist/RangeFilter/Shared/RangeFilterStatus/RangeFilterStatus.js +5 -8
  22. package/dist/RangeFilter/Shared/RangeFilterStatus/RangeFilterStatus.styles.d.ts +11 -10
  23. package/dist/RangeFilter/Shared/SaveFilterForm/SaveFilterForm.js +5 -10
  24. package/dist/RangeFilter/Shared/SelectionCount/SelectionCount.js +1 -3
  25. package/dist/RangeFilter/Shared/SelectionHint/SelectionHint.js +1 -3
  26. package/dist/RangeFilter/Shared/TimeWindow/Day/Day.js +15 -22
  27. package/dist/RangeFilter/Shared/TimeWindow/Grid/Grid.js +13 -17
  28. package/dist/RangeFilter/Shared/TimeWindow/Header/Header.js +2 -4
  29. package/dist/RangeFilter/Shared/TimeWindow/RangeActions/RangeActions.js +3 -5
  30. package/dist/RangeFilter/Shared/TimeWindow/RangeFormContainer/RangeForm/RangeForm.js +29 -53
  31. package/dist/RangeFilter/Shared/TimeWindow/RangeFormContainer/RangeForm/RangeForm.utils.js +0 -1
  32. package/dist/RangeFilter/Shared/TimeWindow/RangeFormContainer/RangeFormContainer.js +35 -48
  33. package/dist/RangeFilter/Shared/TimeWindow/RangeSummary/RangeSummary.js +4 -7
  34. package/dist/RangeFilter/Shared/TimeWindow/TimeWindow.js +50 -136
  35. package/dist/RangeFilter/Shared/TimeWindow/utils.js +0 -3
  36. package/dist/RangeFilter/constants.js +0 -4
  37. package/dist/RangeFilter/utils.js +27 -50
  38. package/dist/RangePicker/RangePicker.js +53 -123
  39. package/dist/RangePicker/utils.js +0 -22
  40. package/dist/RangePickerInput/RangePickerInput.js +23 -35
  41. package/dist/RangePickerInput/RangePickerInput.styles.js +0 -4
  42. package/dist/RawDateRangePicker.js +57 -114
  43. package/dist/RelativeRangePicker/Elements/CustomRangeForm/CustomRangeForm.js +11 -17
  44. package/dist/RelativeRangePicker/Elements/CustomRangeForm/DurationField/DurationField.js +5 -7
  45. package/dist/RelativeRangePicker/Elements/CustomRangeForm/OffsetField/OffsetField.js +5 -7
  46. package/dist/RelativeRangePicker/Elements/ModeDropdown/ModeDropdown.js +5 -9
  47. package/dist/RelativeRangePicker/Elements/RangeButtons/RangeButtons.js +3 -5
  48. package/dist/RelativeRangePicker/Elements/RangeDropdown/RangeDropdown.js +12 -18
  49. package/dist/RelativeRangePicker/Elements/TimestampRange/TimestampDuration/TimestampDuration.js +6 -8
  50. package/dist/RelativeRangePicker/Elements/TimestampRange/TimestampRange.js +29 -45
  51. package/dist/RelativeRangePicker/RelativeRangePicker.js +28 -69
  52. package/dist/RelativeRangePicker/RelativeRangePicker.styles.js +4 -8
  53. package/dist/RelativeRangePicker/utils/findMatchingPreset.utils.js +2 -9
  54. package/dist/RelativeRangePicker/utils/getCurrentGroupFromProps.utils.js +0 -2
  55. package/dist/RelativeRangePicker/utils/updatePresetKey.utils.js +0 -7
  56. package/dist/constants.js +0 -1
  57. package/dist/dateUtils/Date.js +0 -2
  58. package/dist/dateUtils/format.js +0 -4
  59. package/dist/dateUtils/getDateFromString.js +0 -1
  60. package/dist/dateUtils/getRelativePresetForRange.js +0 -4
  61. package/dist/dateUtils/relativeToAbsolute.js +2 -6
  62. package/dist/utils.js +63 -86
  63. package/package.json +22 -22
@@ -1,23 +1,13 @@
1
1
  var _excluded = ["days", "numberOfDays", "daily", "intl", "texts", "disabled"];
2
-
3
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
-
5
3
  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; }
6
-
7
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
8
-
9
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
10
-
11
6
  function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
12
-
13
7
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
14
-
15
8
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
-
17
9
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
18
-
19
10
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
20
-
21
11
  import React, { PureComponent, createRef } from 'react';
22
12
  import { range } from 'lodash';
23
13
  import { FormattedMessage, injectIntl } from 'react-intl';
@@ -34,39 +24,31 @@ import Day from './Day/Day';
34
24
  import SelectionHint from '../SelectionHint/SelectionHint';
35
25
  import { EU_NOTATION_MONTH_DAYS_INDEXES, EU_NOTATION_WEEK_DAYS_INDEXES, US_NOTATION_MONTH_DAYS_INDEXES, US_NOTATION_WEEK_DAYS_INDEXES } from './constants/timeWindow.constants';
36
26
  export var DEFAULT_LIMIT_MODE = 'Range';
37
-
38
27
  var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
39
28
  function TimeWindowBase() {
40
29
  var _this;
41
-
42
30
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
43
31
  args[_key] = arguments[_key];
44
32
  }
45
-
46
33
  _this = _PureComponent.call.apply(_PureComponent, [this].concat(args)) || this;
47
-
48
34
  // eslint-disable-next-line react/destructuring-assignment
49
35
  _defineProperty(_this, "state", {
50
36
  activeDays: _this.props.daily ? [0] : [],
51
37
  controlKeyPressed: false
52
38
  });
53
-
54
39
  _defineProperty(_this, "wrapperRef", createRef());
55
-
56
40
  _defineProperty(_this, "isDayRestricted", function (dayKey) {
57
41
  var days = _this.props.days;
58
42
  return !!days[dayKey] && days[dayKey].restricted;
59
43
  });
60
-
61
44
  _defineProperty(_this, "checkActiveDay", function (dayKey) {
62
45
  var isRangeDefined = _this.state.isRangeDefined;
63
46
  if (!_this.isDayRestricted(dayKey) && isRangeDefined && !_this.haveActiveDaysCommonRange()) _this.checkDay(dayKey);
64
47
  var _this$state = _this.state,
65
- activeDays = _this$state.activeDays,
66
- controlKeyPressed = _this$state.controlKeyPressed,
67
- shiftKeyPressed = _this$state.shiftKeyPressed;
48
+ activeDays = _this$state.activeDays,
49
+ controlKeyPressed = _this$state.controlKeyPressed,
50
+ shiftKeyPressed = _this$state.shiftKeyPressed;
68
51
  var updatedActiveDay = [];
69
-
70
52
  if (controlKeyPressed) {
71
53
  updatedActiveDay = activeDays.includes(dayKey) ? activeDays : [].concat(activeDays, [dayKey]);
72
54
  } else if (activeDays.length > 0 && shiftKeyPressed) {
@@ -74,87 +56,71 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
74
56
  } else {
75
57
  updatedActiveDay = [dayKey];
76
58
  }
77
-
78
59
  _this.setState(function (state) {
79
60
  return _objectSpread({}, state, {
80
61
  activeDays: updatedActiveDay
81
62
  });
82
63
  });
83
64
  });
84
-
85
65
  _defineProperty(_this, "uncheckActiveDay", function (dayKey) {
86
66
  var _this$state2 = _this.state,
87
- activeDays = _this$state2.activeDays,
88
- controlKeyPressed = _this$state2.controlKeyPressed;
67
+ activeDays = _this$state2.activeDays,
68
+ controlKeyPressed = _this$state2.controlKeyPressed;
89
69
  var updatedActiveDay = [];
90
-
91
70
  if (controlKeyPressed) {
92
71
  updatedActiveDay = activeDays.filter(function (day) {
93
72
  return day !== dayKey;
94
73
  });
95
74
  }
96
-
97
75
  _this.setState(function (state) {
98
76
  return _objectSpread({}, state, {
99
77
  activeDays: updatedActiveDay
100
78
  });
101
79
  });
102
-
103
80
  _this.removeDaySelection(dayKey);
104
81
  });
105
-
106
82
  _defineProperty(_this, "handleToggleDay", function (dayKey, forcedState) {
107
83
  var _this$state3 = _this.state,
108
- activeDays = _this$state3.activeDays,
109
- controlKeyPressed = _this$state3.controlKeyPressed;
110
-
84
+ activeDays = _this$state3.activeDays,
85
+ controlKeyPressed = _this$state3.controlKeyPressed;
111
86
  if (typeof forcedState !== 'undefined') {
112
87
  if (controlKeyPressed && forcedState) {
113
88
  activeDays.includes(dayKey) ? _this.uncheckActiveDay(dayKey) : _this.checkActiveDay(dayKey);
114
89
  return;
115
90
  }
116
-
117
91
  forcedState ? _this.checkActiveDay(dayKey) : _this.uncheckActiveDay(dayKey);
118
92
  } else {
119
93
  activeDays.includes(dayKey) ? _this.uncheckActiveDay(dayKey) : _this.checkActiveDay(dayKey);
120
94
  }
121
95
  });
122
-
123
96
  _defineProperty(_this, "handleClearDay", function (dayKey) {
124
97
  _this.removeDaySelection(dayKey);
125
98
  });
126
-
127
99
  _defineProperty(_this, "handleDayChange", function (dayKey, dayChanges) {
128
100
  var _objectSpread2;
129
-
130
101
  var _this$props = _this.props,
131
- onChange = _this$props.onChange,
132
- days = _this$props.days;
102
+ onChange = _this$props.onChange,
103
+ days = _this$props.days;
133
104
  onChange(_objectSpread({}, days, (_objectSpread2 = {}, _objectSpread2[dayKey] = _objectSpread({}, _this.getDayValue(dayKey), {}, dayChanges), _objectSpread2)));
134
105
  });
135
-
136
106
  _defineProperty(_this, "removeDaySelection", function (dayKey) {
137
107
  var _this$props2 = _this.props,
138
- onChange = _this$props2.onChange,
139
- days = _this$props2.days;
108
+ onChange = _this$props2.onChange,
109
+ days = _this$props2.days;
140
110
  var updatedDays = days;
141
111
  delete updatedDays[dayKey];
142
112
  onChange(updatedDays);
143
113
  });
144
-
145
114
  _defineProperty(_this, "checkDay", function (dayKey) {
146
115
  var onCheckDay = _this.props.onCheckDay;
147
-
148
116
  _this.handleDayChange(dayKey, {
149
117
  start: DEFAULT_RANGE_START,
150
118
  stop: DEFAULT_RANGE_END,
151
119
  restricted: true,
152
120
  display: true
153
121
  });
154
-
155
122
  onCheckDay && onCheckDay(dayKey);
156
123
  });
157
-
158
124
  _defineProperty(_this, "handleDayTimeChange", function (value, dayKey) {
159
125
  _this.handleDayChange(dayKey, {
160
126
  restricted: true,
@@ -163,11 +129,10 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
163
129
  inverted: Boolean(value[2])
164
130
  });
165
131
  });
166
-
167
132
  _defineProperty(_this, "handleMultipleDayTimeChange", function (value) {
168
133
  var _this$props3 = _this.props,
169
- onChange = _this$props3.onChange,
170
- days = _this$props3.days;
134
+ onChange = _this$props3.onChange,
135
+ days = _this$props3.days;
171
136
  var activeDays = _this.state.activeDays;
172
137
  var updatedDays = {};
173
138
  activeDays.forEach(function (k) {
@@ -181,11 +146,10 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
181
146
  });
182
147
  onChange(_objectSpread({}, days, {}, updatedDays));
183
148
  });
184
-
185
149
  _defineProperty(_this, "handleRangeDelete", function () {
186
150
  var _this$props4 = _this.props,
187
- onChange = _this$props4.onChange,
188
- days = _this$props4.days;
151
+ onChange = _this$props4.onChange,
152
+ days = _this$props4.days;
189
153
  var activeDays = _this.state.activeDays;
190
154
  var updatedDays = days;
191
155
  activeDays.forEach(function (k) {
@@ -193,35 +157,29 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
193
157
  });
194
158
  onChange(_objectSpread({}, updatedDays));
195
159
  });
196
-
197
160
  _defineProperty(_this, "handleClearSelection", function () {
198
161
  _this.setState({
199
162
  activeDays: [],
200
163
  isRangeDefined: false
201
164
  });
202
165
  });
203
-
204
166
  _defineProperty(_this, "handleSelectAll", function () {
205
167
  var keys = _this.getAllKeys();
206
-
207
168
  var onSelectAll = _this.props.onSelectAll;
208
-
209
169
  _this.setState({
210
170
  activeDays: keys
211
171
  }, function () {
212
172
  onSelectAll && onSelectAll();
213
173
  });
214
174
  });
215
-
216
175
  _defineProperty(_this, "getDayValue", function (dayKey) {
217
176
  var _customDays$dayKey, _customDays$dayKey2;
218
-
219
177
  var _this$props5 = _this.props,
220
- days = _this$props5.days,
221
- dayTemplate = _this$props5.dayTemplate,
222
- customDays = _this$props5.customDays,
223
- daily = _this$props5.daily,
224
- valueSelectionModes = _this$props5.valueSelectionModes;
178
+ days = _this$props5.days,
179
+ dayTemplate = _this$props5.dayTemplate,
180
+ customDays = _this$props5.customDays,
181
+ daily = _this$props5.daily,
182
+ valueSelectionModes = _this$props5.valueSelectionModes;
225
183
  var dayValue = {};
226
184
  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) {
227
185
  dayValue = customDays[dayKey].template;
@@ -235,93 +193,74 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
235
193
  mode: valueSelectionModes[0] || DEFAULT_LIMIT_MODE
236
194
  }, dayValue);
237
195
  });
238
-
239
196
  _defineProperty(_this, "getDayLabel", function (dayKey, _long) {
240
197
  var _this$props6 = _this.props,
241
- dayFormatter = _this$props6.dayFormatter,
242
- customDays = _this$props6.customDays;
198
+ dayFormatter = _this$props6.dayFormatter,
199
+ customDays = _this$props6.customDays;
243
200
  var label;
244
-
245
201
  if (typeof dayKey === 'string' && customDays && customDays[dayKey]) {
246
202
  label = customDays[dayKey][_long ? 'longLabel' : 'label'] || customDays[dayKey].label;
247
203
  }
248
-
249
204
  if (!label) label = dayFormatter(dayKey, _long);
250
205
  return label;
251
206
  });
252
-
253
207
  _defineProperty(_this, "handleRangePaste", function (dayKeys) {
254
208
  var rangeClipboard = _this.props.rangeClipboard;
255
209
  var activeDays = _this.state.activeDays;
256
-
257
210
  if (rangeClipboard != null && rangeClipboard.stop && rangeClipboard != null && rangeClipboard.start) {
258
211
  activeDays.length > 1 ? _this.handleMultipleDayTimeChange([getDateFromDayValue(rangeClipboard.start), getDateFromDayValue(rangeClipboard.stop), rangeClipboard == null ? void 0 : rangeClipboard.inverted]) : _this.handleDayTimeChange([getDateFromDayValue(rangeClipboard.start), getDateFromDayValue(rangeClipboard.stop), rangeClipboard == null ? void 0 : rangeClipboard.inverted], dayKeys);
259
212
  }
260
213
  });
261
-
262
214
  _defineProperty(_this, "handleRangeCopy", function () {
263
215
  var onRangeCopy = _this.props.onRangeCopy;
264
216
  var activeDays = _this.state.activeDays;
265
-
266
217
  var dayValue = _this.getDayValue(activeDays[0]);
267
-
268
218
  onRangeCopy && onRangeCopy({
269
219
  start: dayValue.start,
270
220
  stop: dayValue.stop,
271
221
  inverted: dayValue.inverted
272
222
  });
273
223
  });
274
-
275
224
  _defineProperty(_this, "replaceDaysIndexesForUSNotation", function (daysIndexes) {
276
225
  var isSundayFirstWeekDay = _this.props.isSundayFirstWeekDay;
277
226
  var stringifyDaysIndexes = JSON.stringify(daysIndexes);
278
227
  var stringifyEUNotationWeekDaysIndexes = JSON.stringify(EU_NOTATION_WEEK_DAYS_INDEXES);
279
228
  var stringifyEUNotationMonthDaysIndexes = JSON.stringify(EU_NOTATION_MONTH_DAYS_INDEXES);
280
229
  var result = daysIndexes;
281
-
282
230
  if (stringifyDaysIndexes === stringifyEUNotationWeekDaysIndexes && isSundayFirstWeekDay) {
283
231
  result = US_NOTATION_WEEK_DAYS_INDEXES;
284
232
  }
285
-
286
233
  if (stringifyDaysIndexes === stringifyEUNotationMonthDaysIndexes && isSundayFirstWeekDay) {
287
234
  result = US_NOTATION_MONTH_DAYS_INDEXES;
288
235
  }
289
-
290
236
  return result;
291
237
  });
292
-
293
238
  _defineProperty(_this, "getAllKeys", function () {
294
239
  var _this$props7 = _this.props,
295
- numberOfDays = _this$props7.numberOfDays,
296
- customDays = _this$props7.customDays;
240
+ numberOfDays = _this$props7.numberOfDays,
241
+ customDays = _this$props7.customDays;
297
242
  var keys = range(numberOfDays);
298
243
  keys = _this.replaceDaysIndexesForUSNotation(keys).slice();
299
244
  if (customDays) keys = [].concat(keys, Object.keys(customDays));
300
245
  return keys;
301
246
  });
302
-
303
247
  _defineProperty(_this, "renderDay", function (dayKey) {
304
248
  var _this$props8 = _this.props,
305
- customDays = _this$props8.customDays,
306
- intl = _this$props8.intl,
307
- readOnly = _this$props8.readOnly,
308
- texts = _this$props8.texts;
249
+ customDays = _this$props8.customDays,
250
+ intl = _this$props8.intl,
251
+ readOnly = _this$props8.readOnly,
252
+ texts = _this$props8.texts;
309
253
  var activeDays = _this.state.activeDays;
310
-
311
254
  var isRestricted = _this.isDayRestricted(dayKey);
312
-
313
255
  var isActive = activeDays.includes(dayKey);
314
256
  var Component;
315
-
316
257
  if (typeof dayKey === 'string' && customDays && customDays[dayKey]) {
317
258
  var CustomComponent = customDays[dayKey].component;
318
259
  if (CustomComponent) Component = CustomComponent;
319
260
  }
320
-
321
261
  if (!Component) {
322
262
  Component = Day;
323
263
  }
324
-
325
264
  return /*#__PURE__*/React.createElement(Component, {
326
265
  key: dayKey,
327
266
  dayKey: dayKey,
@@ -336,35 +275,31 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
336
275
  texts: texts
337
276
  });
338
277
  });
339
-
340
278
  _defineProperty(_this, "handleRangeAdd", function () {
341
279
  var daily = _this.props.daily;
342
-
343
280
  if (!daily && !_this.haveActiveDaysCommonRange()) {
344
281
  _this.handleMultipleDayTimeChange([getDateFromDayValue(DEFAULT_RANGE_START), getDateFromDayValue(DEFAULT_RANGE_END), false]);
345
282
  }
346
-
347
283
  _this.setState({
348
284
  isRangeDefined: true
349
285
  });
350
286
  });
351
-
352
287
  _defineProperty(_this, "renderRangeForm", function (dayKeys) {
353
288
  var activeDays = _this.state.activeDays;
354
289
  var _this$props9 = _this.props,
355
- hideHeader = _this$props9.hideHeader,
356
- headerOptions = _this$props9.headerOptions,
357
- monthlyFilterPeriod = _this$props9.monthlyFilterPeriod,
358
- monthlyFilter = _this$props9.monthlyFilter,
359
- daily = _this$props9.daily,
360
- days = _this$props9.days,
361
- onChange = _this$props9.onChange,
362
- texts = _this$props9.texts,
363
- valueSelectionModes = _this$props9.valueSelectionModes,
364
- renderRangeFormSuffix = _this$props9.renderRangeFormSuffix,
365
- timePickerProps = _this$props9.timePickerProps,
366
- disabled = _this$props9.disabled,
367
- rangeDisplayMode = _this$props9.rangeDisplayMode;
290
+ hideHeader = _this$props9.hideHeader,
291
+ headerOptions = _this$props9.headerOptions,
292
+ monthlyFilterPeriod = _this$props9.monthlyFilterPeriod,
293
+ monthlyFilter = _this$props9.monthlyFilter,
294
+ daily = _this$props9.daily,
295
+ days = _this$props9.days,
296
+ onChange = _this$props9.onChange,
297
+ texts = _this$props9.texts,
298
+ valueSelectionModes = _this$props9.valueSelectionModes,
299
+ renderRangeFormSuffix = _this$props9.renderRangeFormSuffix,
300
+ timePickerProps = _this$props9.timePickerProps,
301
+ disabled = _this$props9.disabled,
302
+ rangeDisplayMode = _this$props9.rangeDisplayMode;
368
303
  return /*#__PURE__*/React.createElement(RangeFormContainer, {
369
304
  disabled: disabled,
370
305
  onChange: onChange,
@@ -392,32 +327,26 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
392
327
  rangeDisplayMode: rangeDisplayMode
393
328
  });
394
329
  });
395
-
396
330
  _defineProperty(_this, "haveActiveDaysCommonRange", function () {
397
331
  var activeDays = _this.state.activeDays;
398
332
  var days = _this.props.days;
399
333
  var previousDay;
400
334
  var activeDaysHaveDifferentRanges = activeDays.some(function (dayIndex) {
401
335
  var _previousDay, _previousDay2;
402
-
403
336
  var currentDay = days[dayIndex];
404
-
405
337
  if (!currentDay) {
406
338
  return true;
407
339
  }
408
-
409
340
  if (!previousDay) {
410
341
  previousDay = currentDay;
411
342
  return false;
412
343
  }
413
-
414
344
  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);
415
345
  previousDay = currentDay;
416
346
  return areRangeDifferent;
417
347
  });
418
348
  return !activeDaysHaveDifferentRanges;
419
349
  });
420
-
421
350
  _defineProperty(_this, "handleKeyDown", function (e) {
422
351
  if (e.key === 'Shift') {
423
352
  _this.setState(function (state) {
@@ -427,7 +356,6 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
427
356
  });
428
357
  });
429
358
  }
430
-
431
359
  if (e.key === 'Control' || e.key === 'Meta') {
432
360
  _this.setState(function (state) {
433
361
  return _objectSpread({}, state, {
@@ -437,7 +365,6 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
437
365
  });
438
366
  }
439
367
  });
440
-
441
368
  _defineProperty(_this, "handleKeyUp", function (e) {
442
369
  if (e.key === 'Control' || e.key === 'Meta') {
443
370
  _this.setState(function (state) {
@@ -446,7 +373,6 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
446
373
  });
447
374
  });
448
375
  }
449
-
450
376
  if (e.key === 'Shift') {
451
377
  _this.setState(function (state) {
452
378
  return _objectSpread({}, state, {
@@ -455,27 +381,20 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
455
381
  });
456
382
  }
457
383
  });
458
-
459
384
  return _this;
460
385
  }
461
-
462
386
  _inheritsLoose(TimeWindowBase, _PureComponent);
463
-
464
387
  var _proto = TimeWindowBase.prototype;
465
-
466
388
  _proto.componentDidMount = function componentDidMount() {
467
389
  var wrapper = this.wrapperRef;
468
-
469
390
  if (wrapper != null && wrapper.current && wrapper.current !== null) {
470
391
  // focus on wrapper to enable listening for keydown without having to click on wrapper
471
392
  wrapper.current.focus();
472
393
  }
473
394
  };
474
-
475
395
  _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
476
396
  var activeDays = this.state.activeDays;
477
397
  var hasCommonRange = this.haveActiveDaysCommonRange();
478
-
479
398
  if (prevState.isRangeDefined !== hasCommonRange && activeDays.length) {
480
399
  // eslint-disable-next-line react/no-did-update-set-state
481
400
  this.setState(function (state) {
@@ -485,20 +404,18 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
485
404
  });
486
405
  }
487
406
  };
488
-
489
407
  _proto.render = function render() {
490
408
  var _this$props10 = this.props,
491
- days = _this$props10.days,
492
- numberOfDays = _this$props10.numberOfDays,
493
- daily = _this$props10.daily,
494
- intl = _this$props10.intl,
495
- texts = _this$props10.texts,
496
- disabled = _this$props10.disabled,
497
- rest = _objectWithoutPropertiesLoose(_this$props10, _excluded);
498
-
409
+ days = _this$props10.days,
410
+ numberOfDays = _this$props10.numberOfDays,
411
+ daily = _this$props10.daily,
412
+ intl = _this$props10.intl,
413
+ texts = _this$props10.texts,
414
+ disabled = _this$props10.disabled,
415
+ rest = _objectWithoutPropertiesLoose(_this$props10, _excluded);
499
416
  var _this$state4 = this.state,
500
- activeDays = _this$state4.activeDays,
501
- isRangeDefined = _this$state4.isRangeDefined;
417
+ activeDays = _this$state4.activeDays,
418
+ isRangeDefined = _this$state4.isRangeDefined;
502
419
  var keys = this.getAllKeys();
503
420
  var singleMode = keys.length === 1;
504
421
  var rangeFormKey = singleMode ? keys[0] : activeDays;
@@ -533,10 +450,8 @@ var TimeWindowBase = /*#__PURE__*/function (_PureComponent) {
533
450
  onClick: this.handleRangeAdd
534
451
  })));
535
452
  };
536
-
537
453
  return TimeWindowBase;
538
454
  }(PureComponent);
539
-
540
455
  _defineProperty(TimeWindowBase, "defaultProps", {
541
456
  days: {},
542
457
  numberOfDays: 1,
@@ -553,5 +468,4 @@ _defineProperty(TimeWindowBase, "defaultProps", {
553
468
  });
554
469
  }
555
470
  });
556
-
557
471
  export default withDataFormat(injectIntl(TimeWindowBase));
@@ -14,7 +14,6 @@ export var reverseRange = function reverseRange(inputRange, groupItem) {
14
14
  var grouping = function grouping(item) {
15
15
  return Math.floor(item / groupItem);
16
16
  };
17
-
18
17
  return flatten(reverse(values(groupBy(inputRange, grouping))));
19
18
  };
20
19
  export var getDefaultFilterForLimitMode = function getDefaultFilterForLimitMode(mode) {
@@ -24,13 +23,11 @@ export var getDefaultFilterForLimitMode = function getDefaultFilterForLimitMode(
24
23
  start: DEFAULT_RANGE_START,
25
24
  stop: DEFAULT_RANGE_START
26
25
  };
27
-
28
26
  case 'Range':
29
27
  return {
30
28
  start: DEFAULT_RANGE_START,
31
29
  stop: DEFAULT_RANGE_END
32
30
  };
33
-
34
31
  default:
35
32
  return {};
36
33
  }
@@ -14,19 +14,15 @@ export var MONTH_DAYS = function MONTH_DAYS(locale) {
14
14
  });
15
15
  };
16
16
  export var DAYS_OF_PERIOD_ENUM;
17
-
18
17
  (function (DAYS_OF_PERIOD_ENUM) {
19
18
  DAYS_OF_PERIOD_ENUM["DAY_OF_MONTH"] = "MONTH";
20
19
  DAYS_OF_PERIOD_ENUM["DAY_OF_WEEK"] = "WEEK";
21
20
  })(DAYS_OF_PERIOD_ENUM || (DAYS_OF_PERIOD_ENUM = {}));
22
-
23
21
  export var COUNTED_FROM_ENUM;
24
-
25
22
  (function (COUNTED_FROM_ENUM) {
26
23
  COUNTED_FROM_ENUM["BEGINNING"] = "BEGINNING";
27
24
  COUNTED_FROM_ENUM["ENDING"] = "ENDING";
28
25
  })(COUNTED_FROM_ENUM || (COUNTED_FROM_ENUM = {}));
29
-
30
26
  export var TYPES = {
31
27
  DAILY: 'DAILY',
32
28
  WEEKLY: 'WEEKLY',