@progress/kendo-charts 1.28.0-dev.202302240817 → 1.28.0-dev.202303070933

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.
@@ -92,7 +92,7 @@ var INSIDE_END = "insideEnd";
92
92
  var INSIDE_BASE = "insideBase";
93
93
  var OUTSIDE_END = "outsideEnd";
94
94
 
95
- var MOUSEWHEEL = "DOMMouseScroll mousewheel";
95
+ var MOUSEWHEEL = "wheel";
96
96
  var MOUSEWHEEL_DELAY = 150;
97
97
  var MOUSEWHEEL_ZOOM_RATE = 0.3;
98
98
 
@@ -5,16 +5,16 @@ import { DateCategoryAxis, Point } from '../core';
5
5
  import { MOUSEWHEEL_DELAY, MOUSEWHEEL, SELECT_START, SELECT, SELECT_END } from './constants';
6
6
 
7
7
  import { LEFT, RIGHT, MIN_VALUE, MAX_VALUE, X } from '../common/constants';
8
- import { addClass, Class, removeClass, deepExtend, elementStyles, eventElement, setDefaultOptions, limitValue, round, bindEvents, unbindEvents, mousewheelDelta, hasClasses } from '../common';
8
+ import { addClass, Class, removeClass, eventCoordinates, deepExtend, elementStyles, eventElement, setDefaultOptions, limitValue, round, bindEvents, unbindEvents, mousewheelDelta, hasClasses } from '../common';
9
9
  import { parseDate } from '../date-utils';
10
10
 
11
11
  var ZOOM_ACCELERATION = 3;
12
12
  var SELECTOR_HEIGHT_ADJUST = 0.1;
13
13
 
14
- function createDiv(className) {
14
+ function createDiv(classNames) {
15
15
  var element = document.createElement("div");
16
- if (className) {
17
- element.className = className;
16
+ if (classNames) {
17
+ element.className = classNames;
18
18
  }
19
19
 
20
20
  return element;
@@ -65,7 +65,7 @@ var Selection = (function (Class) {
65
65
 
66
66
  Selection.prototype.createElements = function createElements () {
67
67
  var options = this.options;
68
- var wrapper = this.wrapper = createDiv("k-selector");
68
+ var wrapper = this.wrapper = createDiv("k-selector k-pointer-events-none");
69
69
  elementStyles(wrapper, {
70
70
  top: options.offset.top,
71
71
  left: options.offset.left,
@@ -73,18 +73,21 @@ var Selection = (function (Class) {
73
73
  height: options.height,
74
74
  direction: 'ltr'
75
75
  });
76
- var selection = this.selection = createDiv("k-selection");
77
- this.leftMask = createDiv("k-mask");
78
- this.rightMask = createDiv("k-mask");
76
+
77
+ var selection = this.selection = createDiv("k-selection k-pointer-events-none");
78
+
79
+ this.leftMask = createDiv("k-mask k-pointer-events-none");
80
+ this.rightMask = createDiv("k-mask k-pointer-events-none");
79
81
 
80
82
  wrapper.appendChild(this.leftMask);
81
83
  wrapper.appendChild(this.rightMask);
82
84
  wrapper.appendChild(selection);
83
85
 
84
- selection.appendChild(createDiv("k-selection-bg"));
86
+ var body = this.body = createDiv("k-selection-bg k-pointer-events-none");
87
+ selection.appendChild(body);
85
88
 
86
- var leftHandle = this.leftHandle = createDiv("k-handle k-left-handle");
87
- var rightHandle = this.rightHandle = createDiv("k-handle k-right-handle");
89
+ var leftHandle = this.leftHandle = createDiv("k-handle k-left-handle k-pointer-events-auto");
90
+ var rightHandle = this.rightHandle = createDiv("k-handle k-right-handle k-pointer-events-auto");
88
91
  leftHandle.appendChild(createDiv());
89
92
  rightHandle.appendChild(createDiv());
90
93
 
@@ -119,10 +122,10 @@ var Selection = (function (Class) {
119
122
 
120
123
  if (this.options.mousewheel !== false) {
121
124
  this._mousewheelHandler = this._mousewheel.bind(this);
122
- bindEvents(this.wrapper, ( obj = {}, obj[ MOUSEWHEEL ] = this._mousewheelHandler, obj ));
125
+ bindEvents(this.chartElement, ( obj = {}, obj[ MOUSEWHEEL ] = this._mousewheelHandler, obj ));
123
126
  }
124
127
 
125
- this._domEvents = DomEventsBuilder.create(this.wrapper, {
128
+ this._domEvents = DomEventsBuilder.create(this.chartElement, {
126
129
  stopPropagation: true, // applicable for the jQuery UserEvents
127
130
  start: this._start.bind(this),
128
131
  move: this._move.bind(this),
@@ -184,9 +187,10 @@ var Selection = (function (Class) {
184
187
 
185
188
  if (this.wrapper) {
186
189
  if (this._mousewheelHandler) {
187
- unbindEvents(this.wrapper, ( obj = {}, obj[ MOUSEWHEEL ] = this._mousewheelHandler, obj ));
190
+ unbindEvents(this.chartElement, ( obj = {}, obj[ MOUSEWHEEL ] = this._mousewheelHandler, obj ));
188
191
  this._mousewheelHandler = null;
189
192
  }
193
+
190
194
  this.chartElement.removeChild(this.wrapper);
191
195
  this.wrapper = null;
192
196
  }
@@ -201,18 +205,35 @@ var Selection = (function (Class) {
201
205
  };
202
206
  };
203
207
 
208
+ Selection.prototype._pointInPane = function _pointInPane (x, y) {
209
+ var paneBox = this.categoryAxis.pane.box;
210
+ var modelCoords = this.chart._toModelCoordinates(x, y);
211
+ return paneBox.containsPoint(modelCoords);
212
+ };
213
+
204
214
  Selection.prototype._start = function _start (e) {
205
215
  var options = this.options;
206
216
  var target = eventElement(e);
207
-
208
217
  if (this._state || !target) {
209
218
  return;
210
219
  }
211
220
 
221
+ var coords = eventCoordinates(e);
222
+ var inPane = this._pointInPane(coords.x, coords.y);
223
+ if (!inPane) {
224
+ return;
225
+ }
226
+
227
+ var handle = closestHandle(target);
228
+ var bodyRect = this.body.getBoundingClientRect();
229
+ var inBody = !handle && coords.x >= bodyRect.x && coords.x <= bodyRect.x + bodyRect.width &&
230
+ coords.y >= bodyRect.y && coords.y <= bodyRect.y + bodyRect.height;
231
+
212
232
  this.chart._unsetActivePoint();
213
233
  this._state = {
214
- moveTarget: closestHandle(target) || target,
234
+ moveTarget: handle,
215
235
  startLocation: e.x ? e.x.location : 0,
236
+ inBody: inBody,
216
237
  range: {
217
238
  from: this._index(options.from),
218
239
  to: this._index(options.to)
@@ -263,14 +284,14 @@ var Selection = (function (Class) {
263
284
  var scale = elementStyles(this.wrapper, "width").width / (categoryAxis.categoriesCount() - 1);
264
285
  var offset = Math.round(delta / scale) * (reverse ? -1 : 1);
265
286
 
266
- if (!target) {
287
+ if (!target && !state.inBody) {
267
288
  return;
268
289
  }
269
290
 
270
- var leftHandle = hasClasses(target, "k-left-handle");
271
- var rightHandle = hasClasses(target, "k-right-handle");
291
+ var leftHandle = target && hasClasses(target, "k-left-handle");
292
+ var rightHandle = target && hasClasses(target, "k-right-handle");
272
293
 
273
- if (hasClasses(target, "k-selection k-selection-bg")) {
294
+ if (state.inBody) {
274
295
  range.from = Math.min(
275
296
  Math.max(min, from - offset),
276
297
  max - span
@@ -349,6 +370,7 @@ var Selection = (function (Class) {
349
370
  range.to = Math.min(range.from + span, max);
350
371
 
351
372
  this._start(e);
373
+
352
374
  if (this._state) {
353
375
  this._state.range = range;
354
376
  this.trigger(SELECT, this._rangeEventArgs(range));
@@ -361,7 +383,7 @@ var Selection = (function (Class) {
361
383
 
362
384
  var delta = mousewheelDelta(e);
363
385
 
364
- this._start({ target: this.selection });
386
+ this._start(e);
365
387
 
366
388
  if (this._state) {
367
389
  var range = this._state.range;
@@ -399,6 +421,12 @@ var Selection = (function (Class) {
399
421
 
400
422
  Selection.prototype._gesturestart = function _gesturestart (e) {
401
423
  var options = this.options;
424
+ var touch = e.touches[0];
425
+ var inPane = this._pointInPane(touch.pageX, touch.pageY);
426
+
427
+ if (!inPane) {
428
+ return;
429
+ }
402
430
 
403
431
  this._state = {
404
432
  range: {
@@ -423,6 +451,10 @@ var Selection = (function (Class) {
423
451
  };
424
452
 
425
453
  Selection.prototype._gesturechange = function _gesturechange (e) {
454
+ if (!this._state) {
455
+ return;
456
+ }
457
+
426
458
  var ref = this;
427
459
  var chart = ref.chart;
428
460
  var state = ref._state;
@@ -2,9 +2,9 @@ export default function hasClasses(element, classNames) {
2
2
  if (element.className) {
3
3
  var names = classNames.split(" ");
4
4
  for (var idx = 0; idx < names.length; idx++) {
5
- if (element.className.indexOf(names[idx]) !== -1) {
5
+ if (element.className.indexOf && element.className.indexOf(names[idx]) !== -1) {
6
6
  return true;
7
7
  }
8
8
  }
9
9
  }
10
- }
10
+ }
@@ -189,7 +189,10 @@ setDefaultOptions(StockChart, {
189
189
  visible: false
190
190
  },
191
191
  tooltip: {
192
- visible: true
192
+ visible: false
193
+ },
194
+ highlight: {
195
+ visible: false
193
196
  },
194
197
  line: {
195
198
  width: 2
@@ -206,4 +209,4 @@ setDefaultOptions(StockChart, {
206
209
  }
207
210
  });
208
211
 
209
- export default StockChart;
212
+ export default StockChart;
@@ -92,7 +92,7 @@ const INSIDE_END = "insideEnd";
92
92
  const INSIDE_BASE = "insideBase";
93
93
  const OUTSIDE_END = "outsideEnd";
94
94
 
95
- const MOUSEWHEEL = "DOMMouseScroll mousewheel";
95
+ const MOUSEWHEEL = "wheel";
96
96
  const MOUSEWHEEL_DELAY = 150;
97
97
  const MOUSEWHEEL_ZOOM_RATE = 0.3;
98
98
 
@@ -5,16 +5,16 @@ import { DateCategoryAxis, Point } from '../core';
5
5
  import { MOUSEWHEEL_DELAY, MOUSEWHEEL, SELECT_START, SELECT, SELECT_END } from './constants';
6
6
 
7
7
  import { LEFT, RIGHT, MIN_VALUE, MAX_VALUE, X } from '../common/constants';
8
- import { addClass, Class, removeClass, deepExtend, elementStyles, eventElement, setDefaultOptions, limitValue, round, bindEvents, unbindEvents, mousewheelDelta, hasClasses } from '../common';
8
+ import { addClass, Class, removeClass, eventCoordinates, deepExtend, elementStyles, eventElement, setDefaultOptions, limitValue, round, bindEvents, unbindEvents, mousewheelDelta, hasClasses } from '../common';
9
9
  import { parseDate } from '../date-utils';
10
10
 
11
11
  const ZOOM_ACCELERATION = 3;
12
12
  const SELECTOR_HEIGHT_ADJUST = 0.1;
13
13
 
14
- function createDiv(className) {
14
+ function createDiv(classNames) {
15
15
  const element = document.createElement("div");
16
- if (className) {
17
- element.className = className;
16
+ if (classNames) {
17
+ element.className = classNames;
18
18
  }
19
19
 
20
20
  return element;
@@ -61,7 +61,7 @@ class Selection extends Class {
61
61
 
62
62
  createElements() {
63
63
  const options = this.options;
64
- const wrapper = this.wrapper = createDiv("k-selector");
64
+ const wrapper = this.wrapper = createDiv("k-selector k-pointer-events-none");
65
65
  elementStyles(wrapper, {
66
66
  top: options.offset.top,
67
67
  left: options.offset.left,
@@ -69,18 +69,21 @@ class Selection extends Class {
69
69
  height: options.height,
70
70
  direction: 'ltr'
71
71
  });
72
- const selection = this.selection = createDiv("k-selection");
73
- this.leftMask = createDiv("k-mask");
74
- this.rightMask = createDiv("k-mask");
72
+
73
+ const selection = this.selection = createDiv("k-selection k-pointer-events-none");
74
+
75
+ this.leftMask = createDiv("k-mask k-pointer-events-none");
76
+ this.rightMask = createDiv("k-mask k-pointer-events-none");
75
77
 
76
78
  wrapper.appendChild(this.leftMask);
77
79
  wrapper.appendChild(this.rightMask);
78
80
  wrapper.appendChild(selection);
79
81
 
80
- selection.appendChild(createDiv("k-selection-bg"));
82
+ const body = this.body = createDiv("k-selection-bg k-pointer-events-none");
83
+ selection.appendChild(body);
81
84
 
82
- const leftHandle = this.leftHandle = createDiv("k-handle k-left-handle");
83
- const rightHandle = this.rightHandle = createDiv("k-handle k-right-handle");
85
+ const leftHandle = this.leftHandle = createDiv("k-handle k-left-handle k-pointer-events-auto");
86
+ const rightHandle = this.rightHandle = createDiv("k-handle k-right-handle k-pointer-events-auto");
84
87
  leftHandle.appendChild(createDiv());
85
88
  rightHandle.appendChild(createDiv());
86
89
 
@@ -113,12 +116,12 @@ class Selection extends Class {
113
116
  bindEvents() {
114
117
  if (this.options.mousewheel !== false) {
115
118
  this._mousewheelHandler = this._mousewheel.bind(this);
116
- bindEvents(this.wrapper, {
119
+ bindEvents(this.chartElement, {
117
120
  [ MOUSEWHEEL ]: this._mousewheelHandler
118
121
  });
119
122
  }
120
123
 
121
- this._domEvents = DomEventsBuilder.create(this.wrapper, {
124
+ this._domEvents = DomEventsBuilder.create(this.chartElement, {
122
125
  stopPropagation: true, // applicable for the jQuery UserEvents
123
126
  start: this._start.bind(this),
124
127
  move: this._move.bind(this),
@@ -174,11 +177,12 @@ class Selection extends Class {
174
177
 
175
178
  if (this.wrapper) {
176
179
  if (this._mousewheelHandler) {
177
- unbindEvents(this.wrapper, {
180
+ unbindEvents(this.chartElement, {
178
181
  [ MOUSEWHEEL ]: this._mousewheelHandler
179
182
  });
180
183
  this._mousewheelHandler = null;
181
184
  }
185
+
182
186
  this.chartElement.removeChild(this.wrapper);
183
187
  this.wrapper = null;
184
188
  }
@@ -193,18 +197,35 @@ class Selection extends Class {
193
197
  };
194
198
  }
195
199
 
200
+ _pointInPane(x, y) {
201
+ const paneBox = this.categoryAxis.pane.box;
202
+ const modelCoords = this.chart._toModelCoordinates(x, y);
203
+ return paneBox.containsPoint(modelCoords);
204
+ }
205
+
196
206
  _start(e) {
197
207
  const options = this.options;
198
208
  const target = eventElement(e);
199
-
200
209
  if (this._state || !target) {
201
210
  return;
202
211
  }
203
212
 
213
+ const coords = eventCoordinates(e);
214
+ const inPane = this._pointInPane(coords.x, coords.y);
215
+ if (!inPane) {
216
+ return;
217
+ }
218
+
219
+ const handle = closestHandle(target);
220
+ const bodyRect = this.body.getBoundingClientRect();
221
+ const inBody = !handle && coords.x >= bodyRect.x && coords.x <= bodyRect.x + bodyRect.width &&
222
+ coords.y >= bodyRect.y && coords.y <= bodyRect.y + bodyRect.height;
223
+
204
224
  this.chart._unsetActivePoint();
205
225
  this._state = {
206
- moveTarget: closestHandle(target) || target,
226
+ moveTarget: handle,
207
227
  startLocation: e.x ? e.x.location : 0,
228
+ inBody,
208
229
  range: {
209
230
  from: this._index(options.from),
210
231
  to: this._index(options.to)
@@ -251,14 +272,14 @@ class Selection extends Class {
251
272
  const scale = elementStyles(this.wrapper, "width").width / (categoryAxis.categoriesCount() - 1);
252
273
  const offset = Math.round(delta / scale) * (reverse ? -1 : 1);
253
274
 
254
- if (!target) {
275
+ if (!target && !state.inBody) {
255
276
  return;
256
277
  }
257
278
 
258
- const leftHandle = hasClasses(target, "k-left-handle");
259
- const rightHandle = hasClasses(target, "k-right-handle");
279
+ const leftHandle = target && hasClasses(target, "k-left-handle");
280
+ const rightHandle = target && hasClasses(target, "k-right-handle");
260
281
 
261
- if (hasClasses(target, "k-selection k-selection-bg")) {
282
+ if (state.inBody) {
262
283
  range.from = Math.min(
263
284
  Math.max(min, from - offset),
264
285
  max - span
@@ -335,6 +356,7 @@ class Selection extends Class {
335
356
  range.to = Math.min(range.from + span, max);
336
357
 
337
358
  this._start(e);
359
+
338
360
  if (this._state) {
339
361
  this._state.range = range;
340
362
  this.trigger(SELECT, this._rangeEventArgs(range));
@@ -345,7 +367,7 @@ class Selection extends Class {
345
367
  _mousewheel(e) {
346
368
  let delta = mousewheelDelta(e);
347
369
 
348
- this._start({ target: this.selection });
370
+ this._start(e);
349
371
 
350
372
  if (this._state) {
351
373
  const range = this._state.range;
@@ -383,6 +405,12 @@ class Selection extends Class {
383
405
 
384
406
  _gesturestart(e) {
385
407
  const options = this.options;
408
+ const touch = e.touches[0];
409
+ const inPane = this._pointInPane(touch.pageX, touch.pageY);
410
+
411
+ if (!inPane) {
412
+ return;
413
+ }
386
414
 
387
415
  this._state = {
388
416
  range: {
@@ -407,6 +435,10 @@ class Selection extends Class {
407
435
  }
408
436
 
409
437
  _gesturechange(e) {
438
+ if (!this._state) {
439
+ return;
440
+ }
441
+
410
442
  const { chart, _state: state, options, categoryAxis } = this;
411
443
  const range = state.range;
412
444
  const p0 = chart._toModelCoordinates(e.touches[0].x.location).x;
@@ -2,9 +2,9 @@ export default function hasClasses(element, classNames) {
2
2
  if (element.className) {
3
3
  const names = classNames.split(" ");
4
4
  for (let idx = 0; idx < names.length; idx++) {
5
- if (element.className.indexOf(names[idx]) !== -1) {
5
+ if (element.className.indexOf && element.className.indexOf(names[idx]) !== -1) {
6
6
  return true;
7
7
  }
8
8
  }
9
9
  }
10
- }
10
+ }
@@ -180,7 +180,10 @@ setDefaultOptions(StockChart, {
180
180
  visible: false
181
181
  },
182
182
  tooltip: {
183
- visible: true
183
+ visible: false
184
+ },
185
+ highlight: {
186
+ visible: false
184
187
  },
185
188
  line: {
186
189
  width: 2
@@ -197,4 +200,4 @@ setDefaultOptions(StockChart, {
197
200
  }
198
201
  });
199
202
 
200
- export default StockChart;
203
+ export default StockChart;