@spider-analyzer/timeline 3.4.1 → 4.0.1

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 (41) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/dist/Cursor.js +51 -81
  3. package/dist/TimeLine.js +216 -404
  4. package/dist/TimeLineResizer.js +6 -28
  5. package/dist/ToolTip.js +7 -16
  6. package/dist/cursorElements/CursorIcon.js +8 -29
  7. package/dist/cursorElements/CursorSelection.js +28 -61
  8. package/dist/cursorElements/DragOverlay.js +25 -57
  9. package/dist/cursorElements/LeftHandle.js +8 -24
  10. package/dist/cursorElements/LeftToolTip.js +4 -22
  11. package/dist/cursorElements/RightHandle.js +8 -24
  12. package/dist/cursorElements/RightToolTip.js +4 -22
  13. package/dist/cursorElements/ZoomIn.js +5 -24
  14. package/dist/cursorElements/ZoomOut.js +4 -16
  15. package/dist/cursorElements/commonStyles.js +0 -3
  16. package/dist/cursorElements/handleHistoHovering.js +25 -34
  17. package/dist/cursorElements/utils.js +0 -10
  18. package/dist/index.js +0 -4
  19. package/dist/theme.js +0 -3
  20. package/dist/timeLineElements/Button.js +12 -33
  21. package/dist/timeLineElements/HistoToolTip.js +7 -18
  22. package/dist/timeLineElements/Histogram.js +14 -29
  23. package/dist/timeLineElements/Legend.js +2 -22
  24. package/dist/timeLineElements/QualityLine.js +8 -23
  25. package/dist/timeLineElements/Tools.js +10 -18
  26. package/dist/timeLineElements/XAxis.js +12 -23
  27. package/dist/timeLineElements/XGrid.js +5 -15
  28. package/dist/timeLineElements/YAxis.js +6 -15
  29. package/dist/timeLineElements/YGrid.js +4 -13
  30. package/dist/timeLineElements/axesStyles.js +0 -4
  31. package/package.json +2 -2
  32. package/src/Cursor.jsx +1 -1
  33. package/src/TimeLine.jsx +3 -2
  34. package/src/cursorElements/CursorSelection.jsx +1 -1
  35. package/src/cursorElements/DragOverlay.jsx +1 -1
  36. package/src/timeLineElements/HistoToolTip.jsx +1 -1
  37. package/src/timeLineElements/Histogram.jsx +1 -2
  38. package/src/timeLineElements/QualityLine.jsx +1 -1
  39. package/src/timeLineElements/Tools.jsx +1 -1
  40. package/src/timeLineElements/XAxis.jsx +1 -1
  41. package/src/timeLineElements/XGrid.jsx +1 -1
package/dist/TimeLine.js CHANGED
@@ -1,104 +1,57 @@
1
1
  "use strict";
2
2
 
3
3
  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = void 0;
9
-
10
8
  var _react = _interopRequireWildcard(require("react"));
11
-
12
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
-
14
- var _moment = _interopRequireDefault(require("moment"));
15
-
10
+ var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
16
11
  var _d3Scale = require("d3-scale");
17
-
18
12
  var _merge2 = _interopRequireDefault(require("lodash-es/merge"));
19
-
20
13
  var _round2 = _interopRequireDefault(require("lodash-es/round"));
21
-
22
14
  var _max2 = _interopRequireDefault(require("lodash-es/max"));
23
-
24
15
  var _floor2 = _interopRequireDefault(require("lodash-es/floor"));
25
-
26
16
  var _isEqual = _interopRequireDefault(require("lodash-es/isEqual"));
27
-
17
+ var _isFunction = _interopRequireDefault(require("lodash-es/isFunction"));
28
18
  var _Cursor = _interopRequireDefault(require("./Cursor"));
29
-
30
19
  var _Histogram = _interopRequireDefault(require("./timeLineElements/Histogram"));
31
-
32
20
  var _XAxis = _interopRequireDefault(require("./timeLineElements/XAxis"));
33
-
34
21
  var _YAxis = _interopRequireDefault(require("./timeLineElements/YAxis"));
35
-
36
22
  var _Legend = _interopRequireDefault(require("./timeLineElements/Legend"));
37
-
38
23
  var _Tools = _interopRequireDefault(require("./timeLineElements/Tools"));
39
-
40
24
  var _HistoToolTip = _interopRequireDefault(require("./timeLineElements/HistoToolTip"));
41
-
42
25
  var _theme = _interopRequireWildcard(require("./theme"));
43
-
44
26
  var _QualityLine = _interopRequireDefault(require("./timeLineElements/QualityLine"));
45
-
46
27
  var _YGrid = _interopRequireDefault(require("./timeLineElements/YGrid"));
47
-
48
28
  var _XGrid = _interopRequireDefault(require("./timeLineElements/XGrid"));
49
-
50
29
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
51
-
52
30
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
53
-
54
31
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
55
-
56
32
  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; }
57
-
58
33
  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; }
59
-
60
34
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
61
-
62
35
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
63
-
64
36
  function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
65
-
66
37
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
67
-
68
38
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
69
-
70
39
  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."); }
71
-
72
40
  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(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
73
-
74
41
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
75
-
76
42
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
77
-
78
43
  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; }
79
-
80
44
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
81
-
82
45
  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); } }
83
-
84
46
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
85
-
86
47
  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); }
87
-
88
48
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
89
-
90
49
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
91
-
92
50
  function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
93
-
94
51
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
95
-
96
52
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
97
-
98
53
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
99
-
100
54
  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; }
101
-
102
55
  var marginDefault = {
103
56
  left: 50,
104
57
  right: 45,
@@ -111,55 +64,46 @@ var xAxisDefault = {
111
64
  barsBetweenTicks: 8
112
65
  };
113
66
  var defaultZoomOutFactor = 1.25;
114
-
115
67
  var TimeLine = /*#__PURE__*/function (_Component) {
116
68
  _inherits(TimeLine, _Component);
117
-
118
69
  var _super = _createSuper(TimeLine);
119
-
120
70
  function TimeLine(props) {
121
71
  var _this;
122
-
123
72
  _classCallCheck(this, TimeLine);
124
-
125
73
  _this = _super.call(this, props);
126
-
127
74
  _defineProperty(_assertThisInitialized(_this), "shiftDomains", function (domains, _ref) {
128
75
  var min = _ref.min,
129
- max = _ref.max;
76
+ max = _ref.max;
130
77
  //update domains if selection is outside domains
131
78
  var toUpdate = false;
132
79
  var biggestVisibleDomain = _this.props.biggestVisibleDomain;
133
80
  var newDomains = domains.map(function (domain, index) {
134
81
  if (min && min.isBefore(domain.min) || max && max.isAfter(domain.max)) {
135
82
  toUpdate = true;
136
-
137
83
  if (index === domains.length - 1) {
138
84
  //if last domain, increase domain
139
85
  var newDomain = {
140
86
  min: min && min.isBefore(domain.min) ? min : domain.min,
141
87
  max: max && max.isAfter(domain.max) ? max : domain.max
142
88
  };
143
-
144
- if (biggestVisibleDomain && (0, _moment["default"])(newDomain.min).add(biggestVisibleDomain).isSameOrBefore(newDomain.max)) {
89
+ if (biggestVisibleDomain && (0, _momentTimezone["default"])(newDomain.min).add(biggestVisibleDomain).isSameOrBefore(newDomain.max)) {
145
90
  if (min.isBefore(domain.min)) {
146
- newDomain.max = (0, _moment["default"])(min).add(biggestVisibleDomain);
91
+ newDomain.max = (0, _momentTimezone["default"])(min).add(biggestVisibleDomain);
147
92
  } else {
148
- newDomain.min = (0, _moment["default"])(max).subtract(biggestVisibleDomain);
93
+ newDomain.min = (0, _momentTimezone["default"])(max).subtract(biggestVisibleDomain);
149
94
  }
150
95
  }
151
-
152
96
  return newDomain;
153
97
  } else {
154
98
  //if not last domain, shift domain
155
99
  if (min && min.isBefore(domain.min)) {
156
100
  return {
157
101
  min: min,
158
- max: (0, _moment["default"])(domain.max).subtract(domain.min.diff(min))
102
+ max: (0, _momentTimezone["default"])(domain.max).subtract(domain.min.diff(min))
159
103
  };
160
104
  } else {
161
105
  return {
162
- min: (0, _moment["default"])(domain.min).add(max.diff(domain.max)),
106
+ min: (0, _momentTimezone["default"])(domain.min).add(max.diff(domain.max)),
163
107
  max: max
164
108
  };
165
109
  }
@@ -170,27 +114,21 @@ var TimeLine = /*#__PURE__*/function (_Component) {
170
114
  });
171
115
  return toUpdate ? newDomains : domains;
172
116
  });
173
-
174
117
  _defineProperty(_assertThisInitialized(_this), "onResizeLeftCursor", function (delta, mouse) {
175
- var newStart = (0, _moment["default"])(_this.xAxis.invert(_this.xAxis(_this.state.start) + delta));
118
+ var newStart = (0, _momentTimezone["default"])(_this.xAxis.invert(_this.xAxis(_this.state.start) + delta));
176
119
  var newStop = _this.state.stop;
177
120
  var maxTimespan = false;
178
-
179
121
  if (newStart.isSameOrAfter(newStop)) {
180
- newStop = (0, _moment["default"])(_this.xAxis.invert(_this.xAxis(newStop) + delta));
122
+ newStop = (0, _momentTimezone["default"])(_this.xAxis.invert(_this.xAxis(newStop) + delta));
181
123
  }
182
-
183
124
  if (_this.props.biggestTimeSpan) {
184
- var min = (0, _moment["default"])(newStop).subtract(_this.props.biggestTimeSpan);
185
-
125
+ var min = (0, _momentTimezone["default"])(newStop).subtract(_this.props.biggestTimeSpan);
186
126
  if (min.isSameOrAfter(newStart)) {
187
127
  newStart = min;
188
128
  maxTimespan = true;
189
129
  }
190
130
  }
191
-
192
131
  _this.handleAutoSliding(mouse, _this.onResizeLeftCursor);
193
-
194
132
  if (newStop !== _this.state.stop && newStop.isSameOrBefore(_this.state.domain.max) || newStart.isSameOrAfter(_this.state.domain.min)) {
195
133
  _this.setState({
196
134
  start: newStart,
@@ -199,27 +137,21 @@ var TimeLine = /*#__PURE__*/function (_Component) {
199
137
  });
200
138
  }
201
139
  });
202
-
203
140
  _defineProperty(_assertThisInitialized(_this), "onResizeRightCursor", function (delta, mouse) {
204
- var newStop = (0, _moment["default"])(_this.xAxis.invert(_this.xAxis(_this.state.stop) + delta));
141
+ var newStop = (0, _momentTimezone["default"])(_this.xAxis.invert(_this.xAxis(_this.state.stop) + delta));
205
142
  var newStart = _this.state.start;
206
143
  var maxTimespan = false;
207
-
208
144
  if (newStop.isSameOrBefore(newStart)) {
209
- newStart = (0, _moment["default"])(_this.xAxis.invert(_this.xAxis(newStart) + delta));
145
+ newStart = (0, _momentTimezone["default"])(_this.xAxis.invert(_this.xAxis(newStart) + delta));
210
146
  }
211
-
212
147
  if (_this.props.biggestTimeSpan) {
213
- var max = (0, _moment["default"])(newStart).add(_this.props.biggestTimeSpan);
214
-
148
+ var max = (0, _momentTimezone["default"])(newStart).add(_this.props.biggestTimeSpan);
215
149
  if (max.isSameOrBefore(newStop)) {
216
150
  newStop = max;
217
151
  maxTimespan = true;
218
152
  }
219
153
  }
220
-
221
154
  _this.handleAutoSliding(mouse, _this.onResizeRightCursor);
222
-
223
155
  if (newStop.isSameOrBefore(_this.state.domain.max) && newStart.isSameOrAfter(_this.state.domain.min)) {
224
156
  _this.setState({
225
157
  start: newStart,
@@ -228,63 +160,47 @@ var TimeLine = /*#__PURE__*/function (_Component) {
228
160
  });
229
161
  }
230
162
  });
231
-
232
163
  _defineProperty(_assertThisInitialized(_this), "onDragCursor", function (delta, mouse) {
233
164
  _this.xAxis.clamp(false);
234
-
235
165
  var duration = _this.state.stop.diff(_this.state.start);
236
-
237
- var newStart = (0, _moment["default"])(_this.xAxis.invert(_this.xAxis(_this.state.start) + delta));
238
- var newStop = (0, _moment["default"])(newStart).add(duration, 'MILLISECONDS');
239
-
166
+ var newStart = (0, _momentTimezone["default"])(_this.xAxis.invert(_this.xAxis(_this.state.start) + delta));
167
+ var newStop = (0, _momentTimezone["default"])(newStart).add(duration, 'MILLISECONDS');
240
168
  _this.xAxis.clamp(true);
241
-
242
169
  var maxDomain = _this.props.maxDomain;
243
-
244
170
  if (maxDomain.min && newStart.isBefore(maxDomain.min)) {
245
- newStart = (0, _moment["default"])(maxDomain.min);
171
+ newStart = (0, _momentTimezone["default"])(maxDomain.min);
246
172
  }
247
-
248
173
  if (maxDomain.max && newStop.isAfter(maxDomain.max)) {
249
- newStop = (0, _moment["default"])(maxDomain.max);
174
+ newStop = (0, _momentTimezone["default"])(maxDomain.max);
250
175
  }
251
-
252
176
  _this.handleAutoSliding(mouse, _this.onDragCursor);
253
-
254
177
  _this.setState({
255
178
  start: newStart,
256
179
  stop: newStop
257
180
  });
258
181
  });
259
-
260
182
  _defineProperty(_assertThisInitialized(_this), "onStartDrawCursor", function (pos) {
261
183
  _this.setState({
262
- start: (0, _moment["default"])(_this.xAxis.invert(pos)),
263
- stop: (0, _moment["default"])(_this.xAxis.invert(pos + 1)),
184
+ start: (0, _momentTimezone["default"])(_this.xAxis.invert(pos)),
185
+ stop: (0, _momentTimezone["default"])(_this.xAxis.invert(pos + 1)),
264
186
  maxTimespan: false
265
187
  });
266
188
  });
267
-
268
189
  _defineProperty(_assertThisInitialized(_this), "onDrawCursor", function (delta, mouse) {
269
- var newStop = (0, _moment["default"])(_this.xAxis.invert(_this.xAxis(_this.state.stop) + delta));
190
+ var newStop = (0, _momentTimezone["default"])(_this.xAxis.invert(_this.xAxis(_this.state.stop) + delta));
270
191
  var newStart = _this.state.start;
271
192
  var maxTimespan = false;
272
-
273
193
  if (newStop.isSameOrBefore(newStart)) {
274
- newStart = (0, _moment["default"])(_this.xAxis.invert(_this.xAxis(newStart) + delta));
194
+ newStart = (0, _momentTimezone["default"])(_this.xAxis.invert(_this.xAxis(newStart) + delta));
275
195
  }
276
-
277
196
  if (_this.props.biggestTimeSpan) {
278
- var max = (0, _moment["default"])(newStart).add(_this.props.biggestTimeSpan);
279
-
197
+ var max = (0, _momentTimezone["default"])(newStart).add(_this.props.biggestTimeSpan);
280
198
  if (max.isSameOrBefore(newStop)) {
281
199
  newStop = max;
282
200
  maxTimespan = true;
283
201
  }
284
202
  }
285
-
286
203
  _this.handleAutoSliding(mouse, _this.onDrawCursor);
287
-
288
204
  if (newStop.isSameOrBefore(_this.state.domain.max) && newStart.isSameOrAfter(_this.state.domain.min)) {
289
205
  _this.setState({
290
206
  start: newStart,
@@ -293,62 +209,49 @@ var TimeLine = /*#__PURE__*/function (_Component) {
293
209
  });
294
210
  }
295
211
  });
296
-
297
212
  _defineProperty(_assertThisInitialized(_this), "stopAutoMove", function () {
298
213
  if (_this.autoMove) {
299
214
  _this.setAutoMove(false);
300
215
  }
301
-
302
216
  if (_this.isAutoMoving) {
303
217
  _this.isAutoMoving = false;
304
-
305
218
  _this.movedTimeLine();
306
219
  }
307
220
  });
308
-
309
221
  _defineProperty(_assertThisInitialized(_this), "onEndDrawCursor", function () {
310
222
  _this.stopAutoMove();
311
-
312
223
  var _this$props = _this.props,
313
- onCustomRange = _this$props.onCustomRange,
314
- selectBarOnClick = _this$props.selectBarOnClick;
224
+ onCustomRange = _this$props.onCustomRange,
225
+ selectBarOnClick = _this$props.selectBarOnClick;
315
226
  var _this$state = _this.state,
316
- start = _this$state.start,
317
- stop = _this$state.stop,
318
- barHovered = _this$state.barHovered;
319
-
227
+ start = _this$state.start,
228
+ stop = _this$state.stop,
229
+ barHovered = _this$state.barHovered;
320
230
  if (selectBarOnClick && _this.items && barHovered > -1) {
321
231
  var item = _this.items[barHovered];
322
-
323
232
  if (start.isSameOrAfter(item.start) && stop.isSameOrBefore(item.end)) {
324
- start = (0, _moment["default"])(item.start);
325
- stop = (0, _moment["default"])(item.end);
326
-
233
+ start = (0, _momentTimezone["default"])(item.start);
234
+ stop = (0, _momentTimezone["default"])(item.end);
327
235
  _this.setState({
328
236
  start: start,
329
237
  stop: stop
330
238
  });
331
239
  }
332
240
  }
333
-
334
241
  onCustomRange(start, stop);
335
242
  });
336
-
337
243
  _defineProperty(_assertThisInitialized(_this), "onEndChangeCursor", function () {
338
244
  _this.stopAutoMove();
339
-
340
245
  var onCustomRange = _this.props.onCustomRange;
341
246
  var _this$state2 = _this.state,
342
- start = _this$state2.start,
343
- stop = _this$state2.stop;
247
+ start = _this$state2.start,
248
+ stop = _this$state2.stop;
344
249
  onCustomRange(start, stop);
345
250
  });
346
-
347
251
  _defineProperty(_assertThisInitialized(_this), "handleAutoSliding", function (mouse, action) {
348
252
  //slide domain when dragging and mouse out of histo
349
253
  if (mouse) {
350
254
  var posX = mouse[0];
351
-
352
255
  if (posX < 0) {
353
256
  _this.setAutoMove(true, action, posX);
354
257
  } else if (posX >= 0 && posX <= _this.state.histoWidth) {
@@ -358,7 +261,6 @@ var TimeLine = /*#__PURE__*/function (_Component) {
358
261
  }
359
262
  }
360
263
  });
361
-
362
264
  _defineProperty(_assertThisInitialized(_this), "setAutoMove", function (active, action, delta) {
363
265
  if (active) {
364
266
  //prevent creating timer to often if mouse did not move so much
@@ -366,9 +268,7 @@ var TimeLine = /*#__PURE__*/function (_Component) {
366
268
  clearInterval(_this.autoMove);
367
269
  _this.autoMove = setInterval(function () {
368
270
  action(delta);
369
-
370
271
  _this.moveTimeLine(-delta);
371
-
372
272
  _this.isAutoMoving = true;
373
273
  _this.lastAutoMovingDelta = delta;
374
274
  }, 30);
@@ -378,21 +278,17 @@ var TimeLine = /*#__PURE__*/function (_Component) {
378
278
  _this.autoMove = null;
379
279
  }
380
280
  });
381
-
382
281
  _defineProperty(_assertThisInitialized(_this), "onWheel", function (event) {
383
282
  var _this$state3 = _this.state,
384
- waitForLoad = _this$state3.waitForLoad,
385
- maxZoom = _this$state3.maxZoom,
386
- minZoom = _this$state3.minZoom;
283
+ waitForLoad = _this$state3.waitForLoad,
284
+ maxZoom = _this$state3.maxZoom,
285
+ minZoom = _this$state3.minZoom;
387
286
  var _this$props2 = _this.props,
388
- onShowMessage = _this$props2.onShowMessage,
389
- domains = _this$props2.domains;
287
+ onShowMessage = _this$props2.onShowMessage,
288
+ domains = _this$props2.domains;
390
289
  event.stopPropagation();
391
-
392
290
  var baseX = _this.timelineElement.current.getBoundingClientRect().left;
393
-
394
291
  var x = event.clientX - baseX - _this.state.margin.left;
395
-
396
292
  if (!waitForLoad) {
397
293
  if (event.deltaY < -50) {
398
294
  if (maxZoom) {
@@ -411,74 +307,56 @@ var TimeLine = /*#__PURE__*/function (_Component) {
411
307
  }
412
308
  }
413
309
  });
414
-
415
310
  _defineProperty(_assertThisInitialized(_this), "onGotoCursor", function () {
416
- var middle = (0, _moment["default"])(_this.state.start).add(_this.state.stop.diff(_this.state.start) / 2);
417
-
311
+ var middle = (0, _momentTimezone["default"])(_this.state.start).add(_this.state.stop.diff(_this.state.start) / 2);
418
312
  _this.xAxis.clamp(false);
419
-
420
313
  var currentX = _this.state.histoWidth / 2;
421
-
422
314
  var newX = _this.xAxis(middle);
423
-
424
315
  var newDomain = _this.moveTimeLineCore(currentX - newX);
316
+ var domains = _toConsumableArray(_this.props.domains);
317
+ //Replace current domain
318
+ domains.splice(0, 1, newDomain);
425
319
 
426
- var domains = _toConsumableArray(_this.props.domains); //Replace current domain
427
-
428
-
429
- domains.splice(0, 1, newDomain); //Check if other domains should shift
430
-
320
+ //Check if other domains should shift
431
321
  var newDomains = _this.shiftDomains(domains, newDomain);
432
-
433
322
  _this.props.onUpdateDomains(newDomains);
434
-
435
323
  _this.xAxis.clamp(true);
436
324
  });
437
-
438
325
  _defineProperty(_assertThisInitialized(_this), "onGoto", function (d) {
439
326
  var halfTimeAgg = _this.state.stop.diff(_this.state.start) / 2;
440
- var when = d || (0, _moment["default"])();
441
- var newStop = (0, _moment["default"])(when).add(halfTimeAgg);
442
- var newStart = (0, _moment["default"])(when).subtract(halfTimeAgg);
443
-
327
+ var when = d || (0, _momentTimezone["default"])();
328
+ var newStop = (0, _momentTimezone["default"])(when).add(halfTimeAgg);
329
+ var newStart = (0, _momentTimezone["default"])(when).subtract(halfTimeAgg);
444
330
  _this.props.onCustomRange(newStart, newStop);
445
331
  });
446
-
447
332
  _defineProperty(_assertThisInitialized(_this), "zoomOnTarget", function (x) {
448
333
  var _this$xAxis$domain = _this.xAxis.domain(),
449
- _this$xAxis$domain2 = _slicedToArray(_this$xAxis$domain, 2),
450
- minOrigin = _this$xAxis$domain2[0],
451
- maxOrigin = _this$xAxis$domain2[1];
452
-
453
- var target = (0, _moment["default"])(_this.xAxis.invert(x));
454
- var min = (0, _moment["default"])(target).subtract(0.25 * target.diff((0, _moment["default"])(minOrigin)));
455
- var max = (0, _moment["default"])(target).add(0.25 * (0, _moment["default"])(maxOrigin).diff(target));
456
-
334
+ _this$xAxis$domain2 = _slicedToArray(_this$xAxis$domain, 2),
335
+ minOrigin = _this$xAxis$domain2[0],
336
+ maxOrigin = _this$xAxis$domain2[1];
337
+ var target = (0, _momentTimezone["default"])(_this.xAxis.invert(x));
338
+ var min = (0, _momentTimezone["default"])(target).subtract(0.25 * target.diff((0, _momentTimezone["default"])(minOrigin)));
339
+ var max = (0, _momentTimezone["default"])(target).add(0.25 * (0, _momentTimezone["default"])(maxOrigin).diff(target));
457
340
  _this.zoomOnDomain({
458
341
  min: min,
459
342
  max: max
460
343
  });
461
344
  });
462
-
463
345
  _defineProperty(_assertThisInitialized(_this), "zoomOutOfTarget", function (x) {
464
346
  var _this$xAxis$domain3 = _this.xAxis.domain(),
465
- _this$xAxis$domain4 = _slicedToArray(_this$xAxis$domain3, 2),
466
- minOrigin = _this$xAxis$domain4[0],
467
- maxOrigin = _this$xAxis$domain4[1];
468
-
469
- var target = (0, _moment["default"])(_this.xAxis.invert(x));
470
- var min = (0, _moment["default"])(target).subtract(1.25 * target.diff((0, _moment["default"])(minOrigin)));
471
- var max = (0, _moment["default"])(target).add(1.25 * (0, _moment["default"])(maxOrigin).diff(target));
472
-
347
+ _this$xAxis$domain4 = _slicedToArray(_this$xAxis$domain3, 2),
348
+ minOrigin = _this$xAxis$domain4[0],
349
+ maxOrigin = _this$xAxis$domain4[1];
350
+ var target = (0, _momentTimezone["default"])(_this.xAxis.invert(x));
351
+ var min = (0, _momentTimezone["default"])(target).subtract(1.25 * target.diff((0, _momentTimezone["default"])(minOrigin)));
352
+ var max = (0, _momentTimezone["default"])(target).add(1.25 * (0, _momentTimezone["default"])(maxOrigin).diff(target));
473
353
  _this.zoomOutTo([{
474
354
  min: min,
475
355
  max: max
476
356
  }]);
477
357
  });
478
-
479
358
  _defineProperty(_assertThisInitialized(_this), "checkAndCorrectDomain", function (_ref2) {
480
359
  var domain = _ref2.domain;
481
-
482
360
  if (!domain) {
483
361
  return {
484
362
  domain: domain,
@@ -487,50 +365,43 @@ var TimeLine = /*#__PURE__*/function (_Component) {
487
365
  domainHasChanged: false
488
366
  };
489
367
  }
490
-
491
368
  var newDomain = _objectSpread({}, domain);
492
-
493
369
  var _this$props3 = _this.props,
494
- biggestVisibleDomain = _this$props3.biggestVisibleDomain,
495
- maxDomain = _this$props3.maxDomain,
496
- smallestResolution = _this$props3.smallestResolution;
370
+ biggestVisibleDomain = _this$props3.biggestVisibleDomain,
371
+ maxDomain = _this$props3.maxDomain,
372
+ smallestResolution = _this$props3.smallestResolution;
497
373
  var histoWidth = _this.state.histoWidth;
498
- var domainHasChanged = false; //Maximum zoom?
374
+ var domainHasChanged = false;
499
375
 
376
+ //Maximum zoom?
500
377
  var duration = newDomain.max.diff(newDomain.min);
501
- var maxZoom = false; //We stop/recap zoom in when 15px = 1min
378
+ var maxZoom = false;
502
379
 
380
+ //We stop/recap zoom in when 15px = 1min
503
381
  var minRes = smallestResolution.asMilliseconds();
504
-
505
382
  if (duration <= histoWidth * minRes / 15) {
506
383
  maxZoom = true;
507
- newDomain.max = (0, _moment["default"])(newDomain.min).add(histoWidth * minRes / 15, 'ms');
508
- } //Minimum zoom?
509
-
384
+ newDomain.max = (0, _momentTimezone["default"])(newDomain.min).add(histoWidth * minRes / 15, 'ms');
385
+ }
510
386
 
387
+ //Minimum zoom?
511
388
  var minTime, maxTime;
512
-
513
389
  if (maxDomain.min && newDomain.min.isBefore(maxDomain.min)) {
514
- newDomain.min = (0, _moment["default"])(maxDomain.min);
390
+ newDomain.min = (0, _momentTimezone["default"])(maxDomain.min);
515
391
  minTime = true;
516
392
  }
517
-
518
393
  if (maxDomain.max && newDomain.max.isAfter(maxDomain.max)) {
519
- newDomain.max = (0, _moment["default"])(maxDomain.max);
394
+ newDomain.max = (0, _momentTimezone["default"])(maxDomain.max);
520
395
  maxTime = true;
521
396
  }
522
-
523
397
  var minZoom = false;
524
-
525
- if (biggestVisibleDomain && newDomain.max.isSameOrAfter((0, _moment["default"])(newDomain.min).add(biggestVisibleDomain))) {
398
+ if (biggestVisibleDomain && newDomain.max.isSameOrAfter((0, _momentTimezone["default"])(newDomain.min).add(biggestVisibleDomain))) {
526
399
  minZoom = true;
527
- newDomain.min = (0, _moment["default"])(newDomain.max).subtract(biggestVisibleDomain);
400
+ newDomain.min = (0, _momentTimezone["default"])(newDomain.max).subtract(biggestVisibleDomain);
528
401
  }
529
-
530
402
  if (!(newDomain.min.isSame(domain.min) && newDomain.max.isSame(domain.max))) {
531
403
  domainHasChanged = true;
532
404
  }
533
-
534
405
  return {
535
406
  domain: domainHasChanged ? newDomain : domain,
536
407
  maxZoom: maxZoom,
@@ -540,85 +411,68 @@ var TimeLine = /*#__PURE__*/function (_Component) {
540
411
  domainHasChanged: domainHasChanged
541
412
  };
542
413
  });
543
-
544
414
  _defineProperty(_assertThisInitialized(_this), "zoomOnDomain", function (targetDomain) {
545
415
  var _this$props4 = _this.props,
546
- onShowMessage = _this$props4.onShowMessage,
547
- onUpdateDomains = _this$props4.onUpdateDomains;
548
-
416
+ onShowMessage = _this$props4.onShowMessage,
417
+ onUpdateDomains = _this$props4.onUpdateDomains;
549
418
  if (!_this.state.waitForLoad) {
550
419
  if (!(targetDomain.min.isSame(_this.state.domain.min) && targetDomain.max.isSame(_this.state.domain.max))) {
551
420
  var _this$checkAndCorrect = _this.checkAndCorrectDomain({
552
- domain: targetDomain
553
- }),
554
- maxZoom = _this$checkAndCorrect.maxZoom,
555
- domain = _this$checkAndCorrect.domain;
556
-
421
+ domain: targetDomain
422
+ }),
423
+ maxZoom = _this$checkAndCorrect.maxZoom,
424
+ domain = _this$checkAndCorrect.domain;
557
425
  var currentMaxZoom = _this.state.maxZoom;
558
-
559
426
  if (maxZoom && maxZoom !== currentMaxZoom) {
560
427
  onShowMessage(_this.labels.zoomSelectionResolutionExtended);
561
428
  }
562
-
563
429
  var domains = [domain].concat(_toConsumableArray(_this.props.domains));
564
-
565
430
  _this.setState({
566
431
  maxZoom: maxZoom,
567
432
  minZoom: false,
568
433
  domain: domain
569
434
  });
570
-
571
435
  onUpdateDomains(domains);
572
436
  } else {
573
437
  onShowMessage(_this.labels.zoomInWithoutChangingSelectionMsg);
574
438
  }
575
439
  }
576
440
  });
577
-
578
441
  _defineProperty(_assertThisInitialized(_this), "zoomOutTo", function (domains) {
579
442
  var _this$checkAndCorrect2 = _this.checkAndCorrectDomain({
580
- domain: domains[0]
581
- }),
582
- minZoom = _this$checkAndCorrect2.minZoom,
583
- domain = _this$checkAndCorrect2.domain,
584
- domainHasChanged = _this$checkAndCorrect2.domainHasChanged,
585
- maxTime = _this$checkAndCorrect2.maxTime,
586
- minTime = _this$checkAndCorrect2.minTime;
587
-
443
+ domain: domains[0]
444
+ }),
445
+ minZoom = _this$checkAndCorrect2.minZoom,
446
+ domain = _this$checkAndCorrect2.domain,
447
+ domainHasChanged = _this$checkAndCorrect2.domainHasChanged,
448
+ maxTime = _this$checkAndCorrect2.maxTime,
449
+ minTime = _this$checkAndCorrect2.minTime;
588
450
  var _this$props5 = _this.props,
589
- onShowMessage = _this$props5.onShowMessage,
590
- onUpdateDomains = _this$props5.onUpdateDomains;
591
-
451
+ onShowMessage = _this$props5.onShowMessage,
452
+ onUpdateDomains = _this$props5.onUpdateDomains;
592
453
  if (minZoom) {
593
454
  onShowMessage(_this.labels.minZoomMsg);
594
455
  }
595
-
596
456
  if (minTime) {
597
457
  onShowMessage(_this.labels.minDomainMsg);
598
458
  }
599
-
600
459
  if (maxTime) {
601
460
  onShowMessage(_this.labels.maxDomainMsg);
602
461
  }
603
-
604
462
  var newDomains = domainHasChanged ? [domain].concat(_toConsumableArray(_this.props.domains.slice(1))) : domains;
605
-
606
463
  _this.setState({
607
464
  maxZoom: false,
608
465
  minZoom: minZoom,
609
466
  domain: domain
610
467
  });
611
-
612
468
  onUpdateDomains(newDomains);
613
469
  });
614
-
615
470
  _defineProperty(_assertThisInitialized(_this), "zoomIn", function () {
616
471
  var _this$state4 = _this.state,
617
- maxZoom = _this$state4.maxZoom,
618
- start = _this$state4.start,
619
- stop = _this$state4.stop;
472
+ maxZoom = _this$state4.maxZoom,
473
+ start = _this$state4.start,
474
+ stop = _this$state4.stop;
620
475
  var onShowMessage = _this.props.onShowMessage;
621
-
622
476
  if (!maxZoom) {
623
477
  _this.zoomOnDomain({
624
478
  min: start,
@@ -628,47 +482,40 @@ var TimeLine = /*#__PURE__*/function (_Component) {
628
482
  onShowMessage(_this.labels.doubleClickMaxZoomMsg);
629
483
  }
630
484
  });
631
-
632
485
  _defineProperty(_assertThisInitialized(_this), "zoomOut", function () {
633
486
  if (!_this.state.waitForLoad && !_this.state.minZoom) {
634
487
  var domains = _toConsumableArray(_this.props.domains);
635
-
636
488
  var zoomOutFactor = _this.props.zoomOutFactor;
637
-
638
489
  if (domains.length > 1) {
639
490
  domains.shift();
640
491
  } else {
641
492
  var _this$xAxis$domain5 = _this.xAxis.domain(),
642
- _this$xAxis$domain6 = _slicedToArray(_this$xAxis$domain5, 2),
643
- minOrigin = _this$xAxis$domain6[0],
644
- maxOrigin = _this$xAxis$domain6[1];
645
-
646
- var halfDuration = (0, _moment["default"])(maxOrigin).diff((0, _moment["default"])(minOrigin)) / 2;
647
- var target = (0, _moment["default"])(minOrigin).add(halfDuration);
648
- var min = (0, _moment["default"])(target).subtract(zoomOutFactor * halfDuration);
649
- var max = (0, _moment["default"])(target).add(zoomOutFactor * halfDuration);
493
+ _this$xAxis$domain6 = _slicedToArray(_this$xAxis$domain5, 2),
494
+ minOrigin = _this$xAxis$domain6[0],
495
+ maxOrigin = _this$xAxis$domain6[1];
496
+ var halfDuration = (0, _momentTimezone["default"])(maxOrigin).diff((0, _momentTimezone["default"])(minOrigin)) / 2;
497
+ var target = (0, _momentTimezone["default"])(minOrigin).add(halfDuration);
498
+ var min = (0, _momentTimezone["default"])(target).subtract(zoomOutFactor * halfDuration);
499
+ var max = (0, _momentTimezone["default"])(target).add(zoomOutFactor * halfDuration);
650
500
  domains[0] = {
651
501
  min: min,
652
502
  max: max
653
503
  };
654
504
  }
655
-
656
505
  _this.zoomOutTo(domains);
657
506
  }
658
507
  });
659
-
660
508
  _defineProperty(_assertThisInitialized(_this), "moveTimeLineCore", function (delta) {
661
509
  var _this$props6 = _this.props,
662
- maxDomain = _this$props6.maxDomain,
663
- onShowMessage = _this$props6.onShowMessage;
510
+ maxDomain = _this$props6.maxDomain,
511
+ onShowMessage = _this$props6.onShowMessage;
664
512
  var _this$state5 = _this.state,
665
- currentDomain = _this$state5.domain,
666
- _this$state5$minTime = _this$state5.minTime,
667
- minTime = _this$state5$minTime === void 0 ? false : _this$state5$minTime,
668
- _this$state5$maxTime = _this$state5.maxTime,
669
- maxTime = _this$state5$maxTime === void 0 ? false : _this$state5$maxTime;
513
+ currentDomain = _this$state5.domain,
514
+ _this$state5$minTime = _this$state5.minTime,
515
+ minTime = _this$state5$minTime === void 0 ? false : _this$state5$minTime,
516
+ _this$state5$maxTime = _this$state5.maxTime,
517
+ maxTime = _this$state5$maxTime === void 0 ? false : _this$state5$maxTime;
670
518
  var currentSpan = currentDomain.max.diff(currentDomain.min);
671
-
672
519
  if (minTime && delta > 0 || maxTime && delta < 0) {
673
520
  return _objectSpread(_objectSpread({}, currentDomain), {}, {
674
521
  moved: 0,
@@ -676,26 +523,23 @@ var TimeLine = /*#__PURE__*/function (_Component) {
676
523
  maxTime: maxTime
677
524
  });
678
525
  } else {
679
- var min = (0, _moment["default"])(_this.xAxis.invert(-delta));
680
- var max = (0, _moment["default"])(_this.xAxis.invert(_this.state.histoWidth - delta));
526
+ var min = (0, _momentTimezone["default"])(_this.xAxis.invert(-delta));
527
+ var max = (0, _momentTimezone["default"])(_this.xAxis.invert(_this.state.histoWidth - delta));
681
528
  var moved = delta;
682
-
683
529
  if (maxDomain.min && min.isBefore(maxDomain.min)) {
684
530
  moved = _this.xAxis(maxDomain.min);
685
- min = (0, _moment["default"])(maxDomain.min);
686
- max = (0, _moment["default"])(min).add(currentSpan);
531
+ min = (0, _momentTimezone["default"])(maxDomain.min);
532
+ max = (0, _momentTimezone["default"])(min).add(currentSpan);
687
533
  minTime = true;
688
534
  onShowMessage(_this.labels.minDomainMsg);
689
535
  }
690
-
691
536
  if (maxDomain.max && max.isAfter(maxDomain.max)) {
692
537
  moved = _this.xAxis(maxDomain.max);
693
- max = (0, _moment["default"])(maxDomain.max);
694
- min = (0, _moment["default"])(max).subtract(currentSpan);
538
+ max = (0, _momentTimezone["default"])(maxDomain.max);
539
+ min = (0, _momentTimezone["default"])(max).subtract(currentSpan);
695
540
  maxTime = true;
696
541
  onShowMessage(_this.labels.maxDomainMsg);
697
542
  }
698
-
699
543
  return {
700
544
  min: min,
701
545
  max: max,
@@ -705,35 +549,26 @@ var TimeLine = /*#__PURE__*/function (_Component) {
705
549
  };
706
550
  }
707
551
  });
708
-
709
552
  _defineProperty(_assertThisInitialized(_this), "moveTimeLine", function (delta) {
710
553
  _this.xAxis.clamp(false);
711
-
712
554
  var _this$moveTimeLineCor = _this.moveTimeLineCore(delta),
713
- min = _this$moveTimeLineCor.min,
714
- max = _this$moveTimeLineCor.max,
715
- moved = _this$moveTimeLineCor.moved,
716
- minTime = _this$moveTimeLineCor.minTime,
717
- maxTime = _this$moveTimeLineCor.maxTime;
718
-
555
+ min = _this$moveTimeLineCor.min,
556
+ max = _this$moveTimeLineCor.max,
557
+ moved = _this$moveTimeLineCor.moved,
558
+ minTime = _this$moveTimeLineCor.minTime,
559
+ maxTime = _this$moveTimeLineCor.maxTime;
719
560
  if (moved !== 0) {
720
561
  _this.xAxis.domain([min, max]);
721
-
722
562
  _this.xAxis.clamp(true);
723
-
724
563
  var ticks = _this.xAxis.ticks((0, _floor2["default"])(_this.state.histoWidth / _this.props.xAxis.spaceBetweenTicks));
725
-
726
564
  _this.movedSinceLastFetched += moved;
727
-
728
565
  if (Math.abs(_this.movedSinceLastFetched) > 75 && _this.props.fetchWhileSliding) {
729
566
  _this.movedSinceLastFetched = 0;
730
-
731
567
  _this.getItems(_this.props, {
732
568
  min: min,
733
569
  max: max
734
570
  });
735
571
  }
736
-
737
572
  _this.setState({
738
573
  domain: {
739
574
  min: min,
@@ -745,39 +580,34 @@ var TimeLine = /*#__PURE__*/function (_Component) {
745
580
  });
746
581
  }
747
582
  });
748
-
749
583
  _defineProperty(_assertThisInitialized(_this), "movedTimeLine", function () {
750
584
  _this.movedSinceLastFetched = 0;
751
585
  var domain = _this.state.domain;
752
586
  var _this$props7 = _this.props,
753
- originalDomains = _this$props7.domains,
754
- onUpdateDomains = _this$props7.onUpdateDomains; //Replace current domain
587
+ originalDomains = _this$props7.domains,
588
+ onUpdateDomains = _this$props7.onUpdateDomains;
755
589
 
756
- var domains = [domain].concat(_toConsumableArray(originalDomains.slice(1))); //Check if other domains should shift
590
+ //Replace current domain
591
+ var domains = [domain].concat(_toConsumableArray(originalDomains.slice(1)));
757
592
 
593
+ //Check if other domains should shift
758
594
  var newDomains = _this.shiftDomains(domains, domain);
759
-
760
595
  onUpdateDomains(newDomains);
761
596
  });
762
-
763
597
  _defineProperty(_assertThisInitialized(_this), "shiftTimeLine", function (delta) {
764
598
  var incr = delta / Math.abs(delta) * 8;
765
599
  var i = 0;
766
-
767
600
  function step() {
768
601
  this.moveTimeLine(incr);
769
602
  i += 8;
770
-
771
603
  if (i < Math.abs(delta)) {
772
604
  setTimeout(step.bind(this), 10);
773
605
  } else {
774
606
  this.movedTimeLine();
775
607
  }
776
608
  }
777
-
778
609
  step.bind(_assertThisInitialized(_this))();
779
610
  });
780
-
781
611
  _this.labels = (0, _merge2["default"])(_theme.defaultLabels, props.labels);
782
612
  _this.xAxis = null; //time axis computation function
783
613
 
@@ -797,15 +627,15 @@ var TimeLine = /*#__PURE__*/function (_Component) {
797
627
  domain: props.domains[0]
798
628
  }));
799
629
  _this.widthOfLastUpdate = null;
800
- _this.timelineElement = /*#__PURE__*/_react["default"].createRef(); //manage auto sliding
630
+ _this.timelineElement = /*#__PURE__*/_react["default"].createRef();
801
631
 
632
+ //manage auto sliding
802
633
  _this.autoMove = null;
803
634
  _this.isAutoMoving = false;
804
635
  _this.lastAutoMovingDelta = 0;
805
636
  _this.movedSinceLastFetched = 0;
806
637
  return _this;
807
638
  }
808
-
809
639
  _createClass(TimeLine, [{
810
640
  key: "componentDidMount",
811
641
  value: function componentDidMount() {
@@ -814,7 +644,6 @@ var TimeLine = /*#__PURE__*/function (_Component) {
814
644
  } else {
815
645
  this.props.onLoadDefaultDomain();
816
646
  }
817
-
818
647
  this.computeMarginAndWidth(this.props);
819
648
  }
820
649
  }, {
@@ -823,9 +652,9 @@ var TimeLine = /*#__PURE__*/function (_Component) {
823
652
  //reached max selection
824
653
  if (!prevState.maxTimespan && this.state.maxTimespan) {
825
654
  this.props.onShowMessage(this.labels.maxSelectionMsg);
826
- } //Change of width (big): update item
827
-
655
+ }
828
656
 
657
+ //Change of width (big): update item
829
658
  if (prevProps.width !== this.props.width || !(0, _isEqual["default"])(prevProps.margin, this.props.margin)) {
830
659
  if (this.state.isActive) {
831
660
  this.getItems(this.props, this.state.domain, this.widthOfLastUpdate && Math.abs(this.props.width - this.widthOfLastUpdate) > 30);
@@ -833,18 +662,16 @@ var TimeLine = /*#__PURE__*/function (_Component) {
833
662
  } else {
834
663
  this.setState(this.computeMarginAndWidth(this.props));
835
664
  }
836
-
837
665
  if (this.state.domain) {
838
666
  var _this$checkAndCorrect3 = this.checkAndCorrectDomain({
839
- domain: this.state.domain
840
- }),
841
- maxZoom = _this$checkAndCorrect3.maxZoom,
842
- minZoom = _this$checkAndCorrect3.minZoom,
843
- domain = _this$checkAndCorrect3.domain,
844
- domainHasChanged = _this$checkAndCorrect3.domainHasChanged,
845
- minTime = _this$checkAndCorrect3.minTime,
846
- maxTime = _this$checkAndCorrect3.maxTime;
847
-
667
+ domain: this.state.domain
668
+ }),
669
+ maxZoom = _this$checkAndCorrect3.maxZoom,
670
+ minZoom = _this$checkAndCorrect3.minZoom,
671
+ domain = _this$checkAndCorrect3.domain,
672
+ domainHasChanged = _this$checkAndCorrect3.domainHasChanged,
673
+ minTime = _this$checkAndCorrect3.minTime,
674
+ maxTime = _this$checkAndCorrect3.maxTime;
848
675
  if (maxZoom !== this.state.maxZoom || minZoom !== this.state.minZoom) {
849
676
  this.setState({
850
677
  maxZoom: maxZoom,
@@ -853,72 +680,69 @@ var TimeLine = /*#__PURE__*/function (_Component) {
853
680
  maxTime: maxTime,
854
681
  domain: domainHasChanged ? domain : this.state.domain
855
682
  });
856
-
857
683
  if (domainHasChanged) {
858
684
  var domains = [domain].concat(_toConsumableArray(this.props.domains.slice(1)));
859
685
  this.props.onUpdateDomains(domains);
860
686
  }
861
687
  }
862
688
  }
863
- } //If selection changed
864
-
689
+ }
865
690
 
691
+ //If selection changed
866
692
  if (!prevProps.timeSpan.start.isSame(this.props.timeSpan.start) || !prevProps.timeSpan.stop.isSame(this.props.timeSpan.stop)) {
867
693
  var newDomains = this.shiftDomains(this.props.domains, {
868
694
  min: this.props.timeSpan.start,
869
695
  max: this.props.timeSpan.stop
870
696
  });
871
-
872
697
  if (newDomains !== this.props.domains) {
873
698
  this.props.onUpdateDomains(newDomains);
874
- } //Update cursor
875
-
699
+ }
876
700
 
701
+ //Update cursor
877
702
  this.setState({
878
703
  start: this.props.timeSpan.start,
879
704
  stop: this.props.timeSpan.stop
880
705
  });
881
- } //If change in current domain, update items and state
882
-
706
+ }
883
707
 
708
+ //If change in current domain, update items and state
884
709
  if (!prevProps.domains[0] && this.props.domains[0] || prevProps.domains[0] && (!prevProps.domains[0].min.isSame(this.props.domains[0].min) || !prevProps.domains[0].max.isSame(this.props.domains[0].max))) {
885
710
  //If current zoom changes and is changing min/max zoom attribute
886
711
  //then update min/maxZoom and crop domain
887
712
  var _this$checkAndCorrect4 = this.checkAndCorrectDomain({
888
- domain: this.props.domains[0]
889
- }),
890
- _maxZoom = _this$checkAndCorrect4.maxZoom,
891
- _minZoom = _this$checkAndCorrect4.minZoom,
892
- _domain = _this$checkAndCorrect4.domain,
893
- _domainHasChanged = _this$checkAndCorrect4.domainHasChanged,
894
- _minTime = _this$checkAndCorrect4.minTime,
895
- _maxTime = _this$checkAndCorrect4.maxTime;
896
-
713
+ domain: this.props.domains[0]
714
+ }),
715
+ _maxZoom = _this$checkAndCorrect4.maxZoom,
716
+ _minZoom = _this$checkAndCorrect4.minZoom,
717
+ _domain = _this$checkAndCorrect4.domain,
718
+ _domainHasChanged = _this$checkAndCorrect4.domainHasChanged,
719
+ _minTime = _this$checkAndCorrect4.minTime,
720
+ _maxTime = _this$checkAndCorrect4.maxTime;
897
721
  this.setState({
898
722
  maxZoom: _maxZoom,
899
723
  minZoom: _minZoom,
900
724
  minTime: _minTime,
901
725
  maxTime: _maxTime,
902
726
  domain: _domain
903
- }); //if domain changed, update domain, and getItems will be done later
727
+ });
904
728
 
729
+ //if domain changed, update domain, and getItems will be done later
905
730
  if (_domainHasChanged) {
906
731
  var _domains = [_domain].concat(_toConsumableArray(this.props.domains.slice(1)));
907
-
908
732
  this.props.onUpdateDomains(_domains);
909
733
  } else {
910
734
  this.getItems(this.props, _domain);
911
735
  }
912
- } //If we got new histo change indicator
913
-
736
+ }
914
737
 
738
+ //If we got new histo change indicator
915
739
  if (prevProps.histo !== this.props.histo) {
916
740
  this.setState({
917
741
  waitForLoad: false
918
742
  });
919
- } //Recompute margin on legend change
920
-
743
+ }
921
744
 
745
+ //Recompute margin on legend change
922
746
  if (prevProps.metricsDefinition.legends !== this.props.metricsDefinition.legends) {
923
747
  this.computeMarginAndWidth(this.props);
924
748
  }
@@ -927,20 +751,17 @@ var TimeLine = /*#__PURE__*/function (_Component) {
927
751
  key: "computeMarginAndWidth",
928
752
  value: function computeMarginAndWidth(props) {
929
753
  var _this$props8 = this.props,
930
- margin = _this$props8.margin,
931
- showLegend = _this$props8.showLegend,
932
- metricsDefinition = _this$props8.metricsDefinition,
933
- width = _this$props8.width;
934
-
754
+ margin = _this$props8.margin,
755
+ showLegend = _this$props8.showLegend,
756
+ metricsDefinition = _this$props8.metricsDefinition,
757
+ width = _this$props8.width;
935
758
  var localMargin = _objectSpread(_objectSpread({}, marginDefault), margin);
936
-
937
759
  if (showLegend) {
938
760
  var maxLength = (0, _max2["default"])(metricsDefinition.legends.map(function (s) {
939
761
  return s.length;
940
762
  }));
941
763
  localMargin.left = (0, _max2["default"])([5 + maxLength * 9, localMargin.left]);
942
764
  }
943
-
944
765
  return {
945
766
  margin: localMargin,
946
767
  histoWidth: width - localMargin.left - localMargin.right
@@ -954,13 +775,12 @@ var TimeLine = /*#__PURE__*/function (_Component) {
954
775
  this.xAxis = (0, _d3Scale.scaleTime)().domain([domain.min, domain.max]).range([0, histoWidth]);
955
776
  this.xAxis.clamp(true);
956
777
  var ticks = this.xAxis.ticks((0, _floor2["default"])(histoWidth / props.xAxis.spaceBetweenTicks));
957
- var intervalMs = (0, _max2["default"])([(0, _round2["default"])((0, _moment["default"])(ticks[1]).diff((0, _moment["default"])(ticks[0])) / props.xAxis.barsBetweenTicks), this.props.smallestResolution.asMilliseconds()]);
778
+ var intervalMs = (0, _max2["default"])([(0, _round2["default"])((0, _momentTimezone["default"])(ticks[1]).diff((0, _momentTimezone["default"])(ticks[0])) / props.xAxis.barsBetweenTicks), this.props.smallestResolution.asMilliseconds()]);
958
779
  this.setState({
959
780
  histoWidth: histoWidth,
960
781
  isActive: true,
961
782
  ticks: ticks
962
783
  });
963
-
964
784
  if (shouldReload && intervalMs) {
965
785
  this.widthOfLastUpdate = props.width;
966
786
  this.setState({
@@ -973,13 +793,14 @@ var TimeLine = /*#__PURE__*/function (_Component) {
973
793
  key: "prepareVerticalScale",
974
794
  value: function prepareVerticalScale(_ref3) {
975
795
  var yAxis = _ref3.yAxis,
976
- xAxis = _ref3.xAxis,
977
- height = _ref3.height,
978
- histo = _ref3.histo,
979
- margin = _ref3.margin;
796
+ xAxis = _ref3.xAxis,
797
+ height = _ref3.height,
798
+ histo = _ref3.histo,
799
+ margin = _ref3.margin;
980
800
  var items = histo && histo.items;
981
- var maxHeight = height - margin.bottom - margin.top - (xAxis.height || xAxisDefault.height); //Y Axis computation
801
+ var maxHeight = height - margin.bottom - margin.top - (xAxis.height || xAxisDefault.height);
982
802
 
803
+ //Y Axis computation
983
804
  var maxScale = items ? (0, _max2["default"])(items.map(function (i) {
984
805
  return i.total;
985
806
  })) || 0 : 0;
@@ -995,19 +816,17 @@ var TimeLine = /*#__PURE__*/function (_Component) {
995
816
  key: "prepareHistogram",
996
817
  value: function prepareHistogram(_ref4) {
997
818
  var _this2 = this;
998
-
999
819
  var histo = _ref4.histo,
1000
- domain = _ref4.domain,
1001
- verticalScale = _ref4.verticalScale;
1002
-
820
+ domain = _ref4.domain,
821
+ verticalScale = _ref4.verticalScale;
1003
822
  if (histo && histo.items && domain) {
1004
823
  var min = domain.min,
1005
- max = domain.max;
824
+ max = domain.max;
1006
825
  return histo.items.filter(function (item) {
1007
826
  return item.total > 0 && item.time.isSameOrAfter(min) && item.time.isBefore(max);
1008
827
  }).map(function (item) {
1009
- var start = (0, _moment["default"])(item.time);
1010
- var end = (0, _moment["default"])(item.time).add(histo.intervalMs);
828
+ var start = (0, _momentTimezone["default"])(item.time);
829
+ var end = (0, _momentTimezone["default"])(item.time).add(histo.intervalMs);
1011
830
  return {
1012
831
  x1: _this2.xAxis(start),
1013
832
  x2: _this2.xAxis(end),
@@ -1026,40 +845,39 @@ var TimeLine = /*#__PURE__*/function (_Component) {
1026
845
  key: "render",
1027
846
  value: function render() {
1028
847
  var _this3 = this;
1029
-
1030
848
  var _this$props9 = this.props,
1031
- width = _this$props9.width,
1032
- height = _this$props9.height,
1033
- histo = _this$props9.histo,
1034
- tools = _this$props9.tools,
1035
- quality = _this$props9.quality,
1036
- qualityScale = _this$props9.qualityScale,
1037
- metricsDefinition = _this$props9.metricsDefinition,
1038
- classes = _this$props9.classes,
1039
- rcToolTipPrefixCls = _this$props9.rcToolTipPrefixCls,
1040
- showLegend = _this$props9.showLegend,
1041
- onFormatTimeLegend = _this$props9.onFormatTimeLegend,
1042
- onFormatMetricLegend = _this$props9.onFormatMetricLegend,
1043
- onResetTime = _this$props9.onResetTime,
1044
- onFormatTimeToolTips = _this$props9.onFormatTimeToolTips,
1045
- xAxis = _this$props9.xAxis,
1046
- yAxis = _this$props9.yAxis,
1047
- showHistoToolTip = _this$props9.showHistoToolTip,
1048
- HistoToolTip = _this$props9.HistoToolTip;
849
+ width = _this$props9.width,
850
+ height = _this$props9.height,
851
+ histo = _this$props9.histo,
852
+ tools = _this$props9.tools,
853
+ quality = _this$props9.quality,
854
+ qualityScale = _this$props9.qualityScale,
855
+ metricsDefinition = _this$props9.metricsDefinition,
856
+ classes = _this$props9.classes,
857
+ rcToolTipPrefixCls = _this$props9.rcToolTipPrefixCls,
858
+ showLegend = _this$props9.showLegend,
859
+ onFormatTimeLegend = _this$props9.onFormatTimeLegend,
860
+ onFormatMetricLegend = _this$props9.onFormatMetricLegend,
861
+ onResetTime = _this$props9.onResetTime,
862
+ onFormatTimeToolTips = _this$props9.onFormatTimeToolTips,
863
+ xAxis = _this$props9.xAxis,
864
+ yAxis = _this$props9.yAxis,
865
+ showHistoToolTip = _this$props9.showHistoToolTip,
866
+ HistoToolTip = _this$props9.HistoToolTip;
1049
867
  var _this$state6 = this.state,
1050
- isActive = _this$state6.isActive,
1051
- domain = _this$state6.domain,
1052
- histoWidth = _this$state6.histoWidth,
1053
- margin = _this$state6.margin,
1054
- start = _this$state6.start,
1055
- stop = _this$state6.stop,
1056
- maxZoom = _this$state6.maxZoom,
1057
- minZoom = _this$state6.minZoom,
1058
- maxTimespan = _this$state6.maxTimespan,
1059
- barHovered = _this$state6.barHovered,
1060
- tooltipVisible = _this$state6.tooltipVisible,
1061
- ticks = _this$state6.ticks,
1062
- dragging = _this$state6.dragging;
868
+ isActive = _this$state6.isActive,
869
+ domain = _this$state6.domain,
870
+ histoWidth = _this$state6.histoWidth,
871
+ margin = _this$state6.margin,
872
+ start = _this$state6.start,
873
+ stop = _this$state6.stop,
874
+ maxZoom = _this$state6.maxZoom,
875
+ minZoom = _this$state6.minZoom,
876
+ maxTimespan = _this$state6.maxTimespan,
877
+ barHovered = _this$state6.barHovered,
878
+ tooltipVisible = _this$state6.tooltipVisible,
879
+ ticks = _this$state6.ticks,
880
+ dragging = _this$state6.dragging;
1063
881
  var xAxisHeight = xAxis.height || xAxisDefault.height;
1064
882
  var pointZero = {
1065
883
  x: 0,
@@ -1069,25 +887,23 @@ var TimeLine = /*#__PURE__*/function (_Component) {
1069
887
  x: 0,
1070
888
  y: margin.top - 5
1071
889
  };
1072
-
1073
890
  var _this$prepareVertical = this.prepareVerticalScale({
1074
- yAxis: yAxis,
1075
- xAxis: xAxis,
1076
- height: height,
1077
- histo: histo,
1078
- margin: margin
1079
- }),
1080
- verticalScale = _this$prepareVertical.verticalScale,
1081
- verticalMarks = _this$prepareVertical.verticalMarks,
1082
- maxHeight = _this$prepareVertical.maxHeight;
1083
-
891
+ yAxis: yAxis,
892
+ xAxis: xAxis,
893
+ height: height,
894
+ histo: histo,
895
+ margin: margin
896
+ }),
897
+ verticalScale = _this$prepareVertical.verticalScale,
898
+ verticalMarks = _this$prepareVertical.verticalMarks,
899
+ maxHeight = _this$prepareVertical.maxHeight;
1084
900
  var items = this.prepareHistogram({
1085
901
  histo: histo,
1086
902
  domain: domain,
1087
903
  verticalScale: verticalScale
1088
904
  });
1089
905
  this.items = items;
1090
- return /*#__PURE__*/_react["default"].createElement("svg", {
906
+ return (0, _isFunction["default"])(this.xAxis) && /*#__PURE__*/_react["default"].createElement("svg", {
1091
907
  ref: this.timelineElement,
1092
908
  width: width,
1093
909
  height: height,
@@ -1225,34 +1041,31 @@ var TimeLine = /*#__PURE__*/function (_Component) {
1225
1041
  })));
1226
1042
  }
1227
1043
  }]);
1228
-
1229
1044
  return TimeLine;
1230
1045
  }(_react.Component);
1231
-
1232
1046
  exports["default"] = TimeLine;
1233
-
1234
1047
  _defineProperty(TimeLine, "propTypes", {
1235
1048
  className: _propTypes["default"].string,
1236
1049
  classes: _propTypes["default"].object,
1237
1050
  rcToolTipPrefixCls: _propTypes["default"].string,
1238
1051
  timeSpan: _propTypes["default"].shape({
1239
- start: _propTypes["default"].instanceOf(_moment["default"]).isRequired,
1240
- stop: _propTypes["default"].instanceOf(_moment["default"]).isRequired
1052
+ start: _propTypes["default"].instanceOf(_momentTimezone["default"]).isRequired,
1053
+ stop: _propTypes["default"].instanceOf(_momentTimezone["default"]).isRequired
1241
1054
  }).isRequired,
1242
1055
  domains: _propTypes["default"].arrayOf(_propTypes["default"].shape({
1243
- min: _propTypes["default"].instanceOf(_moment["default"]).isRequired,
1244
- max: _propTypes["default"].instanceOf(_moment["default"]).isRequired
1056
+ min: _propTypes["default"].instanceOf(_momentTimezone["default"]).isRequired,
1057
+ max: _propTypes["default"].instanceOf(_momentTimezone["default"]).isRequired
1245
1058
  })).isRequired,
1246
1059
  maxDomain: _propTypes["default"].shape({
1247
- min: _propTypes["default"].instanceOf(_moment["default"]),
1248
- max: _propTypes["default"].instanceOf(_moment["default"])
1060
+ min: _propTypes["default"].instanceOf(_momentTimezone["default"]),
1061
+ max: _propTypes["default"].instanceOf(_momentTimezone["default"])
1249
1062
  }),
1250
1063
  biggestVisibleDomain: _propTypes["default"].object,
1251
1064
  smallestResolution: _propTypes["default"].object.isRequired,
1252
1065
  biggestTimeSpan: _propTypes["default"].object,
1253
1066
  histo: _propTypes["default"].shape({
1254
1067
  items: _propTypes["default"].arrayOf(_propTypes["default"].shape({
1255
- time: _propTypes["default"].instanceOf(_moment["default"]).isRequired,
1068
+ time: _propTypes["default"].instanceOf(_momentTimezone["default"]).isRequired,
1256
1069
  metrics: _propTypes["default"].arrayOf(_propTypes["default"].number).isRequired,
1257
1070
  total: _propTypes["default"].number.isRequired
1258
1071
  })),
@@ -1262,7 +1075,7 @@ _defineProperty(TimeLine, "propTypes", {
1262
1075
  HistoToolTip: _propTypes["default"].elementType,
1263
1076
  quality: _propTypes["default"].shape({
1264
1077
  items: _propTypes["default"].arrayOf(_propTypes["default"].shape({
1265
- time: _propTypes["default"].instanceOf(_moment["default"]).isRequired,
1078
+ time: _propTypes["default"].instanceOf(_momentTimezone["default"]).isRequired,
1266
1079
  quality: _propTypes["default"].number.isRequired,
1267
1080
  tip: _propTypes["default"].node
1268
1081
  })),
@@ -1338,7 +1151,6 @@ _defineProperty(TimeLine, "propTypes", {
1338
1151
  onFormatTimeLegend: _propTypes["default"].func.isRequired,
1339
1152
  onFormatMetricLegend: _propTypes["default"].func.isRequired
1340
1153
  });
1341
-
1342
1154
  _defineProperty(TimeLine, "defaultProps", {
1343
1155
  classes: {},
1344
1156
  rcToolTipPrefixCls: _theme["default"].rcToolTipPrefixCls,