@hipay/hipay-material-ui 2.0.0-beta.60 → 2.0.0-beta.61

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,63 @@
1
+ <a name="2.0.0-beta.61"></a>
2
+ # [2.0.0-beta.61](https://gitlab.hipay.org/backend/hipay-material-ui/compare/0.0.1...2.0.0-beta.61) (2019-01-24)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * **eslint:** remove eslint warrnings in components (ignore test files) ([d236c62](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d236c62))
8
+ * **HiBreadcrumb:** clean eslint warnings ([6db12fb](https://gitlab.hipay.org/backend/hipay-material-ui/commit/6db12fb))
9
+ * **HiDatePicker:** add static positions for custom overlays ([c3edf24](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c3edf24))
10
+ * **HiExpansionPanel:** Fix props type a requirement ([cbc3b48](https://gitlab.hipay.org/backend/hipay-material-ui/commit/cbc3b48))
11
+ * **HiInput:** handle focus state through prop when needed to override default comportment ([9a133cc](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9a133cc))
12
+ * **HiKpiNotice:** eslint clean warnings ([11b5552](https://gitlab.hipay.org/backend/hipay-material-ui/commit/11b5552))
13
+ * **HiSelect:** Fix build of HiSelectContent ([4b87f78](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4b87f78))
14
+ * **HiSelect:** focus on undefined item ([2d084e6](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2d084e6))
15
+ * **HiSelect:** handle staticPosition & width properly for HiDateRangeSelector usage ([7b19ffb](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7b19ffb))
16
+ * **HiSelectableListItem:** disabled item checkbox color ([9f10552](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9f10552))
17
+ * **HiSelectableListItem:** remove item width ([a913945](https://gitlab.hipay.org/backend/hipay-material-ui/commit/a913945))
18
+ * **HiSelectContent:** Remove compute of input value ([b86db83](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b86db83))
19
+ * **HiSlider:** eslint clean warnings ([08964b1](https://gitlab.hipay.org/backend/hipay-material-ui/commit/08964b1))
20
+ * **HiUploadField:** clean eslint warnings ([c76aaf1](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c76aaf1))
21
+ * **migration:** fix contrast threshold ... ([6fb3b18](https://gitlab.hipay.org/backend/hipay-material-ui/commit/6fb3b18))
22
+ * **package:** add cross-env ([7098fd6](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7098fd6))
23
+
24
+
25
+ ### Features
26
+
27
+ * **CellImage:** Handle fallbackImage ([254799d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/254799d))
28
+ * **CellSentinel:** Uniformize cell api with front CellSentinel ([4e2975b](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4e2975b))
29
+ * **CellSentinel:** Update CellSentinel to the new way (split each result in different column) ([efe2711](https://gitlab.hipay.org/backend/hipay-material-ui/commit/efe2711))
30
+ * **CellSentinelScore:** Add CellSentinelScore ([2fff04d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2fff04d))
31
+ * **CellText:** Handle active prop in CellText & column views in HiTable ([4366e60](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4366e60))
32
+ * **HiCells:** Add simple cells types (Address, Date, Icon, Image, Numeric, PinToAction, Rate, Senti ([f688517](https://gitlab.hipay.org/backend/hipay-material-ui/commit/f688517))
33
+ * **HiDatePicke:** add timezone props ([18360a5](https://gitlab.hipay.org/backend/hipay-material-ui/commit/18360a5))
34
+ * **HiDatePicker:** BREAKING CHANGE - add local prop to handle calendar translations ([b1b3743](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b1b3743))
35
+ * **HiIcon:** Add mdi-material-ui as available icons via 'mdi_' prefix ([1091d6d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/1091d6d))
36
+ * **HiMap:** unregister fetch on unmount ([0afa931](https://gitlab.hipay.org/backend/hipay-material-ui/commit/0afa931))
37
+ * **HiSelect:** Add (NEW) HiSelect, HiNestedSelect, HiDynamicSelect ([4c6447e](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4c6447e))
38
+ * **HiSelect:** Reset search input on blur & on close ([d9af584](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d9af584))
39
+ * **HiSelectableList:** Add sort props to sort item list on label ([f412ddc](https://gitlab.hipay.org/backend/hipay-material-ui/commit/f412ddc))
40
+ * **HiSelectContent:** Add new HiSelectContent & HiNestedSelectContent ([215ad8f](https://gitlab.hipay.org/backend/hipay-material-ui/commit/215ad8f))
41
+ * **HiSelectContent:** export utils functions ([7c41d87](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7c41d87))
42
+ * **HiUploadField:** rename component HiUploadField ([593f77e](https://gitlab.hipay.org/backend/hipay-material-ui/commit/593f77e))
43
+ * **notice:** Création notice KPI ([bba3f89](https://gitlab.hipay.org/backend/hipay-material-ui/commit/bba3f89))
44
+
45
+
46
+ ### Performance Improvements
47
+
48
+ * **PureFunction:** Use pure & functional components ([220c686](https://gitlab.hipay.org/backend/hipay-material-ui/commit/220c686))
49
+
50
+
51
+ ### BREAKING CHANGES
52
+
53
+ * **HiDatePicker:** Required "local" props (use polyglot, p.currentLocal)
54
+ * **HiUploadField:** Components names changes
55
+ * **HiCells:** Remove CellCountry, CellThirdParty, CellStatus & CellAccount (use generic type
56
+ CellImage & CellText)
57
+ * **HiSelect:** HiSelect API change, use HiNestedSelect or HiDynamicSelect relative to situation
58
+
59
+
60
+
1
61
  # [2.0.0-beta.60](https://gitlab.hipay.org/backend/hipay-material-ui/compare/0.0.1...2.0.0-beta.60) (2019-01-14)
2
62
 
3
63
 
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
10
12
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
11
13
 
12
14
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
@@ -29,6 +31,8 @@ var _react = _interopRequireDefault(require("react"));
29
31
 
30
32
  var _propTypes = _interopRequireDefault(require("prop-types"));
31
33
 
34
+ var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
35
+
32
36
  var _moment = _interopRequireDefault(require("react-day-picker/moment"));
33
37
 
34
38
  var _hiLocaleUtils = _interopRequireDefault(require("./hiLocaleUtils"));
@@ -65,9 +69,21 @@ function (_React$Component) {
65
69
 
66
70
  (0, _classCallCheck2.default)(this, HiDatePicker);
67
71
  _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(HiDatePicker).call(this));
72
+
73
+ _this.handleKeyDown = function (name) {
74
+ return function (event) {
75
+ if (event.key === 'Escape' && !event.shiftKey) {
76
+ _this.datePickerInput.hideDayPicker();
77
+
78
+ event.stopPropagation();
79
+ }
80
+ };
81
+ };
82
+
83
+ var today = (0, _momentTimezone.default)().tz(props.timezoneName);
68
84
  _this.state = {
69
85
  openedPanel: 'calendar',
70
- currentMonth: props.value ? props.value : new Date()
86
+ currentMonth: props.value ? props.value : new Date(today.year(), today.month(), today.date(), today.hours(), today.minutes(), today.seconds(), today.milliseconds())
71
87
  }; // this.formatDate = this.formatDate.bind(this);
72
88
 
73
89
  _this.handleCalendarClick = _this.handleCalendarClick.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
@@ -93,17 +109,18 @@ function (_React$Component) {
93
109
  value: function componentWillUnmount() {
94
110
  clearTimeout(this.timeout);
95
111
  }
96
- }, {
97
- key: "handleReset",
98
- value: function handleReset() {
99
- this.handleCurrentMonthChange(new Date());
100
- this.props.onReset();
101
- }
102
112
  }, {
103
113
  key: "handleInputChange",
104
114
  value: function handleInputChange(event) {
105
115
  this.props.onChange(event.target.value);
106
116
  }
117
+ }, {
118
+ key: "handleReset",
119
+ value: function handleReset() {
120
+ var today = (0, _momentTimezone.default)().tz(this.props.timezoneName);
121
+ this.handleCurrentMonthChange(new Date(today.year(), today.month(), today.date(), today.hours(), today.minutes(), today.seconds(), today.milliseconds()));
122
+ this.props.onReset();
123
+ }
107
124
  }, {
108
125
  key: "handleDayChange",
109
126
  value: function handleDayChange(day, modifiers) {
@@ -259,10 +276,11 @@ function (_React$Component) {
259
276
  hideOnDayClick = _this$props.hideOnDayClick,
260
277
  props = (0, _objectWithoutProperties2.default)(_this$props, ["classes", "disabledDays", "disablePastDays", "disableFutureDays", "enableTime", "format", "locale", "minimumDate", "onReset", "translations", "value", "hideOnDayClick"]);
261
278
  var currentMonth = this.state.currentMonth;
279
+ var today = (0, _momentTimezone.default)().tz(this.props.timezoneName);
262
280
  var effectiveDisabledDays = (0, _extends2.default)({}, disablePastDays && {
263
- before: new Date()
281
+ before: new Date(today.year(), today.month(), today.date(), today.hours(), today.minutes(), today.seconds(), today.milliseconds())
264
282
  }, disableFutureDays && {
265
- after: new Date()
283
+ after: new Date(today.year(), today.month(), today.date(), today.hours(), today.minutes(), today.seconds(), today.milliseconds())
266
284
  }, disabledDays);
267
285
  var modifiersStyles = {
268
286
  selected: {
@@ -287,10 +305,10 @@ function (_React$Component) {
287
305
  selectedDays: (0, _typeof2.default)(value) === 'object' ? value : undefined,
288
306
  firstDayOfWeek: 1,
289
307
  fromMonth: minimumDate,
290
- modifiers: {
308
+ modifiers: (0, _defineProperty2.default)({
291
309
  disabled: effectiveDisabledDays,
292
310
  selected: value
293
- },
311
+ }, classes.currentDay, new Date(today.year(), today.month(), today.date(), today.hours(), today.minutes(), today.seconds(), today.milliseconds())),
294
312
  modifiersStyles: modifiersStyles,
295
313
  month: currentMonth
296
314
  }, props, {
@@ -306,7 +324,8 @@ function (_React$Component) {
306
324
  }
307
325
  });
308
326
  return _react.default.createElement("div", {
309
- className: classes.root
327
+ className: classes.root,
328
+ onKeyDown: this.handleKeyDown()
310
329
  }, _react.default.createElement(_DayPickerInput.default, {
311
330
  ref: function ref(el) {
312
331
  _this2.datePickerInput = el;
@@ -338,6 +357,7 @@ HiDatePicker.defaultProps = {
338
357
  locale: 'fr-FR',
339
358
  minimumDate: new Date(2013, 4, 1),
340
359
  // by default 1 May 2013
360
+ timezoneName: 'Europe/Paris',
341
361
  translations: {
342
362
  today: 'today'
343
363
  }
@@ -406,6 +426,11 @@ HiDatePicker.propTypes = process.env.NODE_ENV !== "production" ? {
406
426
  */
407
427
  onSubmit: _propTypes.default.func,
408
428
 
429
+ /**
430
+ * Timezone de l'utilisateur
431
+ */
432
+ timezoneName: _propTypes.default.string,
433
+
409
434
  /**
410
435
  * Traductions
411
436
  */
@@ -27,6 +27,8 @@ var _react = _interopRequireDefault(require("react"));
27
27
 
28
28
  var _propTypes = _interopRequireDefault(require("prop-types"));
29
29
 
30
+ var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
31
+
30
32
  var _moment = _interopRequireDefault(require("react-day-picker/moment"));
31
33
 
32
34
  var _hiLocaleUtils = _interopRequireDefault(require("./hiLocaleUtils"));
@@ -55,8 +57,6 @@ var _HiForm = require("../HiForm");
55
57
 
56
58
  var _stylesheet = _interopRequireDefault(require("./stylesheet"));
57
59
 
58
- var _moment2 = _interopRequireDefault(require("moment"));
59
-
60
60
  var _HiFormControl = _interopRequireDefault(require("../HiForm/HiFormControl"));
61
61
 
62
62
  var HiDateRangePicker =
@@ -105,9 +105,11 @@ function (_React$Component) {
105
105
  };
106
106
 
107
107
  _this.onDayToClick = function (day) {
108
- var change = (0, _moment2.default)(day) >= (0, _moment2.default)(_this.props.from);
108
+ var change = (0, _momentTimezone.default)(day) >= (0, _momentTimezone.default)(_this.props.from);
109
+ var today = (0, _momentTimezone.default)().tz(_this.props.timezoneName);
110
+ var todayDate = new Date(today.year(), today.month(), today.date(), 23, 59, 59);
109
111
 
110
- if (change && _this.props.disableFutureDays && (0, _moment2.default)(day).utc() > (0, _moment2.default)().utc().endOf('day')) {
112
+ if (change && day > todayDate) {
111
113
  change = false;
112
114
  }
113
115
 
@@ -137,19 +139,22 @@ function (_React$Component) {
137
139
  };
138
140
 
139
141
  _this.handleChange = function (name, day) {
140
- var translations = _this.props.translations;
142
+ var _this$props = _this.props,
143
+ translations = _this$props.translations,
144
+ timezoneName = _this$props.timezoneName;
141
145
  var date;
142
146
  var error;
143
- var now = new Date();
144
- var _this$props = _this.props,
145
- minimumDate = _this$props.minimumDate,
146
- disableFutureDays = _this$props.disableFutureDays,
147
- format = _this$props.format;
147
+ var today = (0, _momentTimezone.default)().tz(timezoneName);
148
+ var now = new Date(today.year(), today.month(), today.date(), 23, 59, 59);
149
+ var _this$props2 = _this.props,
150
+ minimumDate = _this$props2.minimumDate,
151
+ disableFutureDays = _this$props2.disableFutureDays,
152
+ format = _this$props2.format;
148
153
 
149
154
  if (day instanceof Date) {
150
155
  date = day;
151
156
  } else if (day) {
152
- var parsedValue = (0, _moment2.default)(day, _this.props.format, true);
157
+ var parsedValue = (0, _momentTimezone.default)(day, _this.props.format, true);
153
158
 
154
159
  if (parsedValue.isValid()) {
155
160
  date = parsedValue.toDate();
@@ -159,14 +164,14 @@ function (_React$Component) {
159
164
  }
160
165
 
161
166
  if (date) {
162
- var comparativeDate = name === 'to' ? (0, _moment2.default)(_this.props.from) : (0, _moment2.default)(_this.props.to);
167
+ var comparativeDate = name === 'to' ? (0, _momentTimezone.default)(_this.props.from) : (0, _momentTimezone.default)(_this.props.to);
163
168
 
164
- if (name === 'to' && comparativeDate > (0, _moment2.default)(date) || name === 'from' && comparativeDate < (0, _moment2.default)(date)) {
169
+ if (name === 'to' && comparativeDate > (0, _momentTimezone.default)(date) || name === 'from' && comparativeDate < (0, _momentTimezone.default)(date)) {
165
170
  error = translations.to_superior_from;
166
- } else if ((0, _moment2.default)(date).utc() < (0, _moment2.default)(minimumDate).utc().startOf('day')) {
167
- error = translations.date_inferior_min_date.replace('%s', (0, _moment2.default)(minimumDate).format(format));
168
- } else if (disableFutureDays && (0, _moment2.default)(date).utc() > (0, _moment2.default)(now).utc().endOf('day')) {
169
- error = translations.date_superior_max_date.replace('%s', (0, _moment2.default)().format(format));
171
+ } else if ((0, _momentTimezone.default)(date).utc() < (0, _momentTimezone.default)(minimumDate).utc().startOf('day')) {
172
+ error = translations.date_inferior_min_date.replace('%s', (0, _momentTimezone.default)(minimumDate).format(format));
173
+ } else if (disableFutureDays && date > now) {
174
+ error = translations.date_superior_max_date.replace('%s', (0, _momentTimezone.default)().tz(timezoneName).format(format));
170
175
  }
171
176
 
172
177
  if (!_this.props.enableTime) {
@@ -216,13 +221,6 @@ function (_React$Component) {
216
221
 
217
222
  _this.handleReset = function (name) {
218
223
  _this.handleChange(name, undefined);
219
-
220
- _this.setState(function (prevState) {
221
- return {
222
- keyFrom: prevState.keyFrom === 1 ? 2 : 1,
223
- keyTo: prevState.keyTo === 1 ? 2 : 1
224
- };
225
- });
226
224
  };
227
225
 
228
226
  _this.handleKeyDown = function (name) {
@@ -251,6 +249,14 @@ function (_React$Component) {
251
249
  document.activeElement.blur();
252
250
  }, 1);
253
251
  }
252
+ } else if (event.key === 'Escape' && !event.shiftKey) {
253
+ if (name === 'from') {
254
+ _this.fromInput.hideDayPicker();
255
+ } else if (name === 'to') {
256
+ _this.toInput.hideDayPicker();
257
+ }
258
+
259
+ event.stopPropagation();
254
260
  }
255
261
  };
256
262
  };
@@ -347,12 +353,12 @@ function (_React$Component) {
347
353
  }, yearPickerProps, propsOverlay));
348
354
  };
349
355
 
356
+ var _today = (0, _momentTimezone.default)().tz(_this.props.timezoneName);
357
+
350
358
  _this.state = {
351
- currentMonth: new Date(),
359
+ currentMonth: new Date(_today.year(), _today.month(), _today.date()),
352
360
  focusedInput: '',
353
- openedPanel: 'calendar',
354
- keyFrom: 1,
355
- keyTo: 1
361
+ openedPanel: 'calendar'
356
362
  };
357
363
  return _this;
358
364
  }
@@ -368,35 +374,37 @@ function (_React$Component) {
368
374
  var _this2 = this,
369
375
  _classNames;
370
376
 
371
- var _this$props2 = this.props,
372
- classes = _this$props2.classes,
373
- disabled = _this$props2.disabled,
374
- disabledDays = _this$props2.disabledDays,
375
- disableFutureDays = _this$props2.disableFutureDays,
376
- enableTime = _this$props2.enableTime,
377
- labelFrom = _this$props2.labelFrom,
378
- labelTo = _this$props2.labelTo,
379
- locale = _this$props2.locale,
380
- format = _this$props2.format,
381
- from = _this$props2.from,
382
- fromError = _this$props2.fromError,
383
- minimumDate = _this$props2.minimumDate,
384
- onReset = _this$props2.onReset,
385
- to = _this$props2.to,
386
- toError = _this$props2.toError,
387
- translations = _this$props2.translations,
388
- id = _this$props2.id,
389
- staticPosition = _this$props2.staticPosition,
390
- errorText = _this$props2.errorText,
391
- hasSelector = _this$props2.hasSelector,
392
- helperIcon = _this$props2.helperIcon,
393
- helperText = _this$props2.helperText,
394
- props = (0, _objectWithoutProperties2.default)(_this$props2, ["classes", "disabled", "disabledDays", "disableFutureDays", "enableTime", "labelFrom", "labelTo", "locale", "format", "from", "fromError", "minimumDate", "onReset", "to", "toError", "translations", "id", "staticPosition", "errorText", "hasSelector", "helperIcon", "helperText"]);
395
- var now = new Date();
396
- var modifiers = {
377
+ var _this$props3 = this.props,
378
+ classes = _this$props3.classes,
379
+ disabled = _this$props3.disabled,
380
+ disabledDays = _this$props3.disabledDays,
381
+ disableFutureDays = _this$props3.disableFutureDays,
382
+ enableTime = _this$props3.enableTime,
383
+ labelFrom = _this$props3.labelFrom,
384
+ labelTo = _this$props3.labelTo,
385
+ locale = _this$props3.locale,
386
+ format = _this$props3.format,
387
+ from = _this$props3.from,
388
+ fromError = _this$props3.fromError,
389
+ minimumDate = _this$props3.minimumDate,
390
+ onReset = _this$props3.onReset,
391
+ to = _this$props3.to,
392
+ toError = _this$props3.toError,
393
+ translations = _this$props3.translations,
394
+ id = _this$props3.id,
395
+ staticPosition = _this$props3.staticPosition,
396
+ errorText = _this$props3.errorText,
397
+ hasSelector = _this$props3.hasSelector,
398
+ helperIcon = _this$props3.helperIcon,
399
+ helperText = _this$props3.helperText,
400
+ timezoneName = _this$props3.timezoneName,
401
+ props = (0, _objectWithoutProperties2.default)(_this$props3, ["classes", "disabled", "disabledDays", "disableFutureDays", "enableTime", "labelFrom", "labelTo", "locale", "format", "from", "fromError", "minimumDate", "onReset", "to", "toError", "translations", "id", "staticPosition", "errorText", "hasSelector", "helperIcon", "helperText", "timezoneName"]);
402
+ var today = (0, _momentTimezone.default)().tz(timezoneName);
403
+ var now = new Date(today.year(), today.month(), today.date(), 23, 59, 59, 999);
404
+ var modifiers = (0, _defineProperty2.default)({
397
405
  start: from,
398
406
  end: to
399
- };
407
+ }, classes.currentDay, new Date(today.year(), today.month(), today.date()));
400
408
  var modifiersStyles = {
401
409
  start: {
402
410
  borderTopLeftRadius: '50%',
@@ -514,7 +522,7 @@ function (_React$Component) {
514
522
  },
515
523
  onKeyDown: this.handleKeyDown('from')
516
524
  }, _react.default.createElement("div", null, _react.default.createElement(_DayPickerInput.default, {
517
- key: this.state.keyFrom,
525
+ key: '1',
518
526
  ref: function ref(el) {
519
527
  _this2.fromInput = el;
520
528
  },
@@ -541,7 +549,7 @@ function (_React$Component) {
541
549
  },
542
550
  onKeyDown: this.handleKeyDown('to')
543
551
  }, _react.default.createElement(_DayPickerInput.default, {
544
- key: this.state.keyTo,
552
+ key: '1',
545
553
  ref: function ref(el) {
546
554
  _this2.toInput = el;
547
555
  },
@@ -586,6 +594,7 @@ HiDateRangePicker.defaultProps = {
586
594
  locale: 'fr-FR',
587
595
  minimumDate: new Date(2013, 4, 1),
588
596
  // by default 1 May 2013
597
+ timezoneName: 'Europe/Paris',
589
598
  translations: {
590
599
  today: 'today',
591
600
  hour: 'Hour',
@@ -717,6 +726,11 @@ HiDateRangePicker.propTypes = process.env.NODE_ENV !== "production" ? {
717
726
  */
718
727
  staticPosition: _propTypes.default.bool,
719
728
 
729
+ /**
730
+ * Timezone de l'utilisateur
731
+ */
732
+ timezoneName: _propTypes.default.string,
733
+
720
734
  /**
721
735
  * Date de fin sélectionnée
722
736
  */
@@ -243,23 +243,7 @@ function (_React$Component) {
243
243
  return _ref = {}, (0, _defineProperty2.default)(_ref, name, value), (0, _defineProperty2.default)(_ref, "key", prevState.key === 1 ? 2 : 1), _ref;
244
244
  });
245
245
 
246
- var selectedOption = _this.options.find(function (option) {
247
- return option.id === value;
248
- });
249
-
250
- if (selectedOption) {
251
- _this.props.onChange('from', new Date(selectedOption.from.format('YYYY-MM-DD HH:mm:ss')));
252
-
253
- _this.props.onChange('to', new Date(selectedOption.to.format('YYYY-MM-DD HH:mm:ss')));
254
-
255
- _this.props.onChange('fromError', false);
256
-
257
- _this.props.onChange('toError', false);
258
- }
259
-
260
- if (_this.props.returnSelectValue === true) {
261
- _this.props.onChange('period', value);
262
- }
246
+ _this.updateDates(value);
263
247
  };
264
248
  };
265
249
 
@@ -282,15 +266,45 @@ function (_React$Component) {
282
266
  });
283
267
  }
284
268
  }
269
+ }, {
270
+ key: "componentDidUpdate",
271
+ value: function componentDidUpdate(prevProps) {
272
+ var _this2 = this;
273
+
274
+ if (prevProps.timezoneName !== this.props.timezoneName) {
275
+ this.options = this.props.availableOptionKeys.map(function (key) {
276
+ return buildDateRangeOptionByKey(key, _this2.props.translations, _this2.props.format, _this2.props.timezoneName);
277
+ });
278
+ this.updateDates(this.state.selectedPreset);
279
+ }
280
+ }
285
281
  }, {
286
282
  key: "componentWillUnmount",
287
283
  value: function componentWillUnmount() {
288
284
  clearTimeout(this.timeout); // TODO : supprimer ?
289
285
  }
286
+ }, {
287
+ key: "updateDates",
288
+ value: function updateDates(value) {
289
+ var selectedOption = this.options.find(function (option) {
290
+ return option.id === value;
291
+ });
292
+
293
+ if (selectedOption) {
294
+ this.props.onChange('from', new Date(selectedOption.from.format('YYYY-MM-DD HH:mm:ss')));
295
+ this.props.onChange('to', new Date(selectedOption.to.format('YYYY-MM-DD HH:mm:ss')));
296
+ this.props.onChange('fromError', false);
297
+ this.props.onChange('toError', false);
298
+ }
299
+
300
+ if (this.props.returnSelectValue === true) {
301
+ this.props.onChange('period', value);
302
+ }
303
+ }
290
304
  }, {
291
305
  key: "render",
292
306
  value: function render() {
293
- var _this2 = this;
307
+ var _this3 = this;
294
308
 
295
309
  var _this$props = this.props,
296
310
  disabled = _this$props.disabled,
@@ -329,7 +343,7 @@ function (_React$Component) {
329
343
  spacing: 8,
330
344
  className: classes.root,
331
345
  ref: function ref(container) {
332
- _this2.container = container;
346
+ _this3.container = container;
333
347
  }
334
348
  }, _react.default.createElement(_Grid.default, {
335
349
  item: true,
@@ -184,23 +184,22 @@ var _default = function _default(theme) {
184
184
 
185
185
  /* default modifiers */
186
186
  // Added to the day's cell for the current day
187
- today: {
188
- // color: theme.palette.primary.light,
189
- position: 'relative',
190
- borderRadius: '50%',
191
- color: "".concat(theme.palette.neutral.dark, " !important"),
192
- fontWeight: theme.typography.fontWeightMedium,
193
- '&:before': {
194
- content: '""',
195
- position: 'absolute',
196
- top: 0,
197
- left: 0,
198
- display: 'inline-block',
199
- width: '100%',
200
- height: '100%',
201
- borderRadius: '50%',
202
- boxShadow: "inset 0 0 0 2px ".concat(theme.palette.neutral.main)
203
- }
187
+ today: {// color: theme.palette.primary.light,
188
+ // position: 'relative',
189
+ // borderRadius: '50%',
190
+ // color: `${theme.palette.neutral.dark} !important`,
191
+ // fontWeight: theme.typography.fontWeightMedium,
192
+ // '&:before': {
193
+ // content: '""',
194
+ // position: 'absolute',
195
+ // top: 0,
196
+ // left: 0,
197
+ // display: 'inline-block',
198
+ // width: '100%',
199
+ // height: '100%',
200
+ // borderRadius: '50%',
201
+ // boxShadow: `inset 0 0 0 2px ${theme.palette.neutral.main}`,
202
+ // },
204
203
  },
205
204
  // Added to the day's cell outside the current month
206
205
  outside: {
@@ -228,6 +227,22 @@ var _default = function _default(theme) {
228
227
  color: theme.palette.primary.contrastText,
229
228
  borderRadius: '0%',
230
229
  border: 'none'
230
+ },
231
+ currentDay: {
232
+ position: 'relative',
233
+ color: "".concat(theme.palette.neutral.dark, " !important"),
234
+ fontWeight: theme.typography.fontWeightMedium,
235
+ '&:before': {
236
+ content: '""',
237
+ position: 'absolute',
238
+ top: 0,
239
+ left: 0,
240
+ display: 'inline-block',
241
+ width: '100%',
242
+ height: '100%',
243
+ borderRadius: '50%',
244
+ boxShadow: "inset 0 0 0 2px ".concat(theme.palette.neutral.main)
245
+ }
231
246
  }
232
247
  };
233
248
  };
@@ -80,7 +80,7 @@ function (_React$PureComponent) {
80
80
  return id !== item.id;
81
81
  }), item);
82
82
  } else {
83
- onChange(event, [].concat((0, _toConsumableArray2.default)(value), [item.id]), item);
83
+ onChange(event, (0, _toConsumableArray2.default)(value).concat([item.id]), item);
84
84
  }
85
85
  };
86
86
 
@@ -91,14 +91,14 @@ function (_React$PureComponent) {
91
91
  var _this$props2 = _this.props,
92
92
  nextPage = _this$props2.nextPage,
93
93
  translations = _this$props2.translations;
94
- var itemList = [].concat((0, _toConsumableArray2.default)(options.length === 0 && !loading ? [{
94
+ var itemList = (0, _toConsumableArray2.default)(options.length === 0 && !loading ? [{
95
95
  id: '_no_result',
96
96
  type: 'text',
97
97
  disabled: true,
98
98
  centered: true,
99
99
  hideCheckbox: true,
100
100
  label: translations.no_result_match
101
- }] : []), (0, _toConsumableArray2.default)(options), (0, _toConsumableArray2.default)(!loading && nextPage === 'manual' ? [{
101
+ }] : []).concat((0, _toConsumableArray2.default)(options), (0, _toConsumableArray2.default)(!loading && nextPage === 'manual' ? [{
102
102
  id: '_next_page',
103
103
  type: 'button',
104
104
  centered: true,
@@ -47,12 +47,12 @@ var _helpers = require("../utils/helpers");
47
47
  */
48
48
  function getRecursiveFinalItemIdList(itemList) {
49
49
  var finalItemIdList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
50
- return [].concat((0, _toConsumableArray2.default)(finalItemIdList), (0, _toConsumableArray2.default)(itemList.reduce(function (memo, item) {
50
+ return (0, _toConsumableArray2.default)(finalItemIdList).concat((0, _toConsumableArray2.default)(itemList.reduce(function (memo, item) {
51
51
  if (item.children) {
52
52
  return getRecursiveFinalItemIdList(item.children, memo);
53
53
  }
54
54
 
55
- return [].concat((0, _toConsumableArray2.default)(memo), [item.id]);
55
+ return (0, _toConsumableArray2.default)(memo).concat([item.id]);
56
56
  }, [])));
57
57
  }
58
58
  /**
@@ -128,7 +128,7 @@ function buildFilteredItemList(itemList) {
128
128
  }
129
129
 
130
130
  return {
131
- l: [].concat((0, _toConsumableArray2.default)(memoItemList), [(0, _extends2.default)({}, item, disabledParent && {
131
+ l: (0, _toConsumableArray2.default)(memoItemList).concat([(0, _extends2.default)({}, item, disabledParent && {
132
132
  disabled: true,
133
133
  hideCheckbox: true // don't display checkbox on disabled parent
134
134
 
@@ -147,7 +147,7 @@ function buildFilteredItemList(itemList) {
147
147
 
148
148
  var itemSelected = selectedItemIdList.includes(item.id);
149
149
  return {
150
- l: [].concat((0, _toConsumableArray2.default)(memoItemList), [(0, _extends2.default)({
150
+ l: (0, _toConsumableArray2.default)(memoItemList).concat([(0, _extends2.default)({
151
151
  displayed: itemVisible || visibleParent
152
152
  }, item)]),
153
153
  s: itemSelected && memoSelected,
@@ -266,9 +266,9 @@ function (_React$PureComponent) {
266
266
  }), item);
267
267
  } else {
268
268
  // select parent > add each selectable child without duplicates.
269
- onChange(event, [].concat((0, _toConsumableArray2.default)(value.filter(function (vid) {
269
+ onChange(event, (0, _toConsumableArray2.default)(value.filter(function (vid) {
270
270
  return !parentSelectableItemIdList.includes(vid);
271
- })), (0, _toConsumableArray2.default)(parentSelectableItemIdList)), item);
271
+ })).concat((0, _toConsumableArray2.default)(parentSelectableItemIdList)), item);
272
272
  }
273
273
  } else if (value.includes(item.id)) {
274
274
  // unselect item
@@ -276,7 +276,7 @@ function (_React$PureComponent) {
276
276
  return id !== item.id;
277
277
  }), item);
278
278
  } else {
279
- onChange(event, [].concat((0, _toConsumableArray2.default)(value), [item.id]), item);
279
+ onChange(event, (0, _toConsumableArray2.default)(value).concat([item.id]), item);
280
280
  }
281
281
  };
282
282
 
@@ -315,14 +315,14 @@ function (_React$PureComponent) {
315
315
  centered: true,
316
316
  hideCheckbox: true,
317
317
  label: translations.no_result_match
318
- }]) : [].concat((0, _toConsumableArray2.default)(loading ? [{
318
+ }]) : (0, _toConsumableArray2.default)(loading ? [{
319
319
  id: '_loading',
320
320
  type: 'loader',
321
321
  disabled: true,
322
322
  centered: true,
323
323
  hideCheckbox: true,
324
324
  label: 'loading'
325
- }] : []), (0, _toConsumableArray2.default)(hasAll ? [{
325
+ }] : []).concat((0, _toConsumableArray2.default)(hasAll ? [{
326
326
  id: '_all',
327
327
  iconAll: iconAll,
328
328
  label: translations.all,