@progress/kendo-charts 2.4.0-dev.202405211537 → 2.4.0-dev.202406100726

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 (52) hide show
  1. package/dist/cdn/js/kendo-charts.js +1 -1
  2. package/dist/cdn/main.js +1 -1
  3. package/dist/es/chart/legend/legend-layout.js +4 -2
  4. package/dist/es/common/event-map.js +17 -0
  5. package/dist/es/common/event-utils.js +61 -0
  6. package/dist/es/common/get-supported-features.js +55 -0
  7. package/dist/es/common/noop.js +1 -0
  8. package/dist/es/common/now.js +3 -0
  9. package/dist/es/common/observable.js +1 -3
  10. package/dist/es/{map/scroller → common}/user-events.js +43 -131
  11. package/dist/es/common.js +7 -0
  12. package/dist/es/map/layers/layer.js +2 -5
  13. package/dist/es/map/layers/marker.js +3 -3
  14. package/dist/es/map/map.js +6 -6
  15. package/dist/es/map/navigator.js +3 -3
  16. package/dist/es/map/scroller/draggable.js +6 -11
  17. package/dist/es/map/scroller/fx.js +2 -2
  18. package/dist/es/map/scroller/scroller.js +7 -12
  19. package/dist/es/map/utils.js +9 -339
  20. package/dist/es/map/zoom.js +3 -3
  21. package/dist/es/sankey/label.js +21 -7
  22. package/dist/es/sankey/legend.js +16 -4
  23. package/dist/es/sankey/link.js +11 -4
  24. package/dist/es/sankey/sankey.js +67 -15
  25. package/dist/es/services/dom-events-builder.js +2 -4
  26. package/dist/es2015/chart/legend/legend-layout.js +4 -2
  27. package/dist/es2015/common/event-map.js +17 -0
  28. package/dist/es2015/common/event-utils.js +61 -0
  29. package/dist/es2015/common/get-supported-features.js +55 -0
  30. package/dist/es2015/common/noop.js +1 -0
  31. package/dist/es2015/common/now.js +3 -0
  32. package/dist/es2015/common/observable.js +1 -3
  33. package/dist/es2015/{map/scroller → common}/user-events.js +39 -131
  34. package/dist/es2015/common.js +7 -0
  35. package/dist/es2015/map/layers/layer.js +2 -5
  36. package/dist/es2015/map/layers/marker.js +3 -3
  37. package/dist/es2015/map/map.js +6 -6
  38. package/dist/es2015/map/navigator.js +3 -3
  39. package/dist/es2015/map/scroller/draggable.js +6 -11
  40. package/dist/es2015/map/scroller/fx.js +2 -2
  41. package/dist/es2015/map/scroller/scroller.js +7 -12
  42. package/dist/es2015/map/utils.js +8 -339
  43. package/dist/es2015/map/zoom.js +3 -3
  44. package/dist/es2015/sankey/label.js +19 -6
  45. package/dist/es2015/sankey/legend.js +15 -5
  46. package/dist/es2015/sankey/link.js +9 -4
  47. package/dist/es2015/sankey/sankey.js +66 -17
  48. package/dist/es2015/services/dom-events-builder.js +2 -4
  49. package/dist/npm/main.js +2795 -2975
  50. package/dist/npm/sankey.d.ts +4 -0
  51. package/dist/systemjs/kendo-charts.js +1 -1
  52. package/package.json +1 -1
@@ -1,19 +1,11 @@
1
- import {
2
- Class,
3
- Observable,
4
- grep
5
- } from '../../common';
6
-
7
- import {
8
- proxy,
9
- noop,
10
- applyEventMap,
11
- getEventMap,
12
- on,
13
- off,
14
- now,
15
- getSupportedFeatures
16
- } from '../utils';
1
+ import { Class } from '../drawing-utils';
2
+ import { applyEventMap, eventMap } from './event-map';
3
+ import { on, off } from './event-utils';
4
+ import getSupportedFeatures from './get-supported-features';
5
+ import noop from './noop';
6
+ import now from './now';
7
+ import grep from './grep';
8
+ import Observable from './observable';
17
9
 
18
10
  const extend = Object.assign;
19
11
 
@@ -24,7 +16,6 @@ const preventDefault = (e) => {
24
16
  let
25
17
  DEFAULT_MIN_HOLD = 800,
26
18
  CLICK_DELAY = 300,
27
- // DEFAULT_THRESHOLD = support.browser.msie ? 5 : 0,
28
19
  DEFAULT_THRESHOLD = 0,
29
20
  PRESS = 'press',
30
21
  HOLD = 'hold',
@@ -66,37 +57,20 @@ function touchDelta(touch1, touch2) {
66
57
  }
67
58
 
68
59
  function getTouches(e) {
69
- const support = getSupportedFeatures();
70
60
  let touches = [],
71
61
  originalEvent = e.originalEvent || e,
72
- currentTarget = e.currentTarget,
73
- idx = 0,
74
- length, changedTouches, touch;
62
+ currentTarget = e.currentTarget;
75
63
 
76
64
  if (e.api) {
77
65
  touches.push({
78
- id: 2,
66
+ id: 2, // hardcoded ID for API call
79
67
  event: e,
80
68
  target: e.target,
81
69
  currentTarget: e.target,
82
70
  location: e,
83
71
  type: 'api'
84
72
  });
85
- } else if (e.type.match(/touch/)) {
86
- changedTouches = originalEvent ? originalEvent.changedTouches : [];
87
-
88
- for (length = changedTouches.length; idx < length; idx++) {
89
- touch = changedTouches[idx];
90
- touches.push({
91
- location: touch,
92
- event: e,
93
- target: touch.target,
94
- currentTarget: currentTarget,
95
- id: touch.identifier,
96
- type: 'touch'
97
- });
98
- }
99
- } else if (support.pointers || support.msPointers) {
73
+ } else {
100
74
  touches.push({
101
75
  location: originalEvent,
102
76
  event: e,
@@ -105,20 +79,11 @@ function getTouches(e) {
105
79
  id: originalEvent.pointerId,
106
80
  type: 'pointer'
107
81
  });
108
- } else {
109
- touches.push({
110
- id: 1,
111
- event: e,
112
- target: e.target,
113
- currentTarget: currentTarget,
114
- location: e,
115
- type: 'mouse'
116
- });
117
82
  }
118
83
 
119
84
  return touches;
120
85
  }
121
- export class TouchAxis extends Class {
86
+ class TouchAxis extends Class {
122
87
  constructor(axis, location) {
123
88
  super();
124
89
  let that = this;
@@ -159,7 +124,7 @@ export class TouchAxis extends Class {
159
124
  }
160
125
  }
161
126
 
162
- export class Touch extends Class {
127
+ class Touch extends Class {
163
128
  constructor(userEvents, target, touchInfo) {
164
129
  super();
165
130
 
@@ -167,7 +132,6 @@ export class Touch extends Class {
167
132
  x: new TouchAxis('X', touchInfo.location),
168
133
  y: new TouchAxis('Y', touchInfo.location),
169
134
  type: touchInfo.type,
170
- useClickAsTap: userEvents.useClickAsTap,
171
135
  threshold: userEvents.threshold || THRESHOLD[touchInfo.type],
172
136
  userEvents: userEvents,
173
137
  target: target,
@@ -183,8 +147,7 @@ export class Touch extends Class {
183
147
  }
184
148
 
185
149
  press() {
186
- // this._holdTimeout = setTimeout($.proxy(this, '_hold'), this.userEvents.minHold);
187
- this._holdTimeout = setTimeout(proxy(this._hold, this), this.userEvents.minHold);
150
+ this._holdTimeout = setTimeout(() => this._hold(), this.userEvents.minHold);
188
151
  this._trigger(PRESS, this.pressEvent);
189
152
  }
190
153
 
@@ -253,12 +216,10 @@ export class Touch extends Class {
253
216
  if (this._moved) {
254
217
  this._trigger(END, touchInfo);
255
218
  } else {
256
- if (!this.useClickAsTap) {
257
- if (this.supportDoubleTap) {
258
- this._tap(touchInfo);
259
- } else {
260
- this._trigger(TAP, touchInfo);
261
- }
219
+ if (this.supportDoubleTap) {
220
+ this._tap(touchInfo);
221
+ } else {
222
+ this._trigger(TAP, touchInfo);
262
223
  }
263
224
  }
264
225
 
@@ -299,17 +260,17 @@ export class Touch extends Class {
299
260
  }
300
261
 
301
262
  _trigger(name, touchInfo) {
302
- let that = this,
303
- jQueryEvent = touchInfo.event,
304
- data = {
305
- touch: that,
306
- x: that.x,
307
- y: that.y,
308
- target: that.target,
309
- event: jQueryEvent
310
- };
311
- if (that.userEvents.notify(name, data)) {
312
- jQueryEvent.preventDefault();
263
+ const e = touchInfo.event;
264
+ const data = {
265
+ touch: this,
266
+ x: this.x,
267
+ y: this.y,
268
+ target: this.target,
269
+ event: e
270
+ };
271
+
272
+ if (this.userEvents.notify(name, data)) {
273
+ e.preventDefault();
313
274
  }
314
275
  }
315
276
 
@@ -321,7 +282,6 @@ export class Touch extends Class {
321
282
  }
322
283
 
323
284
  function withEachUpEvent(callback) {
324
- const eventMap = getEventMap(navigator.userAgent);
325
285
  let downEvents = eventMap.up.split(' '),
326
286
  idx = 0,
327
287
  length = downEvents.length;
@@ -331,7 +291,7 @@ function withEachUpEvent(callback) {
331
291
  }
332
292
  }
333
293
 
334
- export class UserEvents extends Observable {
294
+ export default class UserEvents extends Observable {
335
295
  constructor(element, options) {
336
296
  super();
337
297
  let that = this;
@@ -352,48 +312,27 @@ export class UserEvents extends Observable {
352
312
  that._maxTouches = options.multiTouch ? 2 : 1;
353
313
  that.allowSelection = options.allowSelection;
354
314
  that.captureUpIfMoved = options.captureUpIfMoved;
355
- that.useClickAsTap = !options.fastTap && !support.delayedClick();
356
315
  that._clicks = 0;
357
316
  that.supportDoubleTap = options.supportDoubleTap;
358
317
 
359
- const enableGlobalSurface = !support.touch || support.mouseAndTouchPresent;
360
-
361
318
  extend(that, {
362
319
  element: element,
363
- surface: options.global && enableGlobalSurface ?
364
- element.ownerDocument.documentElement :
365
- options.surface || element,
320
+ surface: options.surface || element,
366
321
  stopPropagation: options.stopPropagation,
367
322
  pressed: false
368
323
  });
369
324
 
370
- this._surfaceMoveHandler = proxy(this._move, this);
325
+ this._surfaceMoveHandler = this._move.bind(this);
371
326
  on(that.surface, applyEventMap('move'), this._surfaceMoveHandler);
372
327
 
373
- this._surfaceEndHandler = proxy(this._end, this);
328
+ this._surfaceEndHandler = this._end.bind(this);
374
329
  on(that.surface, applyEventMap('up cancel'), this._surfaceEndHandler);
375
330
 
376
- this._elementStartHandler = proxy(this._start, this);
331
+ this._elementStartHandler = this._start.bind(this);
377
332
  on(element, applyEventMap('down'), filter, this._elementStartHandler);
378
333
 
379
- if (that.useClickAsTap) {
380
- this._elementClickHandler = proxy(this._click, this);
381
- on(element, applyEventMap('click'), filter, this._elementClickHandler);
382
- }
383
-
384
- if (support.pointers || support.msPointers) {
385
- if (support.browser.version < 11) {
386
- let defaultAction = 'pinch-zoom double-tap-zoom';
334
+ element.style['touch-action'] = options.touchAction || 'none';
387
335
 
388
- element.style['-ms-touch-action'] =
389
- options.touchAction && options.touchAction !== 'none' ?
390
- defaultAction + ' ' + options.touchAction :
391
- defaultAction;
392
-
393
- } else {
394
- element.style['touch-action'] = options.touchAction || 'none';
395
- }
396
- }
397
336
  if (options.preventDragEvent) {
398
337
  this._elementDragStartHandler = preventDefault;
399
338
  on(element, applyEventMap('dragstart'), this._elementDragStartHandler);
@@ -404,12 +343,12 @@ export class UserEvents extends Observable {
404
343
  // } '_select');
405
344
 
406
345
  // todo: use root
407
- this._elementSelectHandler = proxy(this._select, this);
346
+ this._elementSelectHandler = this._select.bind(this);
408
347
  on(element, applyEventMap('mousedown'), filter, this._elementSelectHandler);
409
348
 
410
- if (that.captureUpIfMoved && support.eventCapture) {
349
+ if (that.captureUpIfMoved) {
411
350
  let surfaceElement = that.surface,
412
- preventIfMovingProxy = proxy(that.preventIfMoving, that);
351
+ preventIfMovingProxy = that.preventIfMoving.bind(that);
413
352
 
414
353
  withEachUpEvent(function(eventName) {
415
354
  surfaceElement.addEventListener(eventName, preventIfMovingProxy, true);
@@ -451,7 +390,7 @@ export class UserEvents extends Observable {
451
390
 
452
391
  that._destroyed = true;
453
392
 
454
- if (that.captureUpIfMoved && this.support.eventCapture) {
393
+ if (that.captureUpIfMoved) {
455
394
  let surfaceElement = that.surface;
456
395
  withEachUpEvent(function(eventName) {
457
396
  surfaceElement.removeEventListener(eventName, that.preventIfMoving);
@@ -463,10 +402,6 @@ export class UserEvents extends Observable {
463
402
 
464
403
  off(element, applyEventMap('down'), this._elementStartHandler);
465
404
 
466
- if (that.useClickAsTap) {
467
- off(element, applyEventMap('click'), this._elementClickHandler);
468
- }
469
-
470
405
  if (options.preventDragEvent) {
471
406
  off(element, applyEventMap('dragstart'), this._elementDragStartHandler);
472
407
  }
@@ -615,33 +550,6 @@ export class UserEvents extends Observable {
615
550
  this._eachTouch('end', e);
616
551
  }
617
552
 
618
- _click(e) {
619
- let data = {
620
- touch: {
621
- initialTouch: e.target,
622
- target: e.currentTarget,
623
- endTime: now(),
624
- x: {
625
- location: e.pageX,
626
- client: e.clientX
627
- },
628
- y: {
629
- location: e.pageY,
630
- client: e.clientY
631
- }
632
- },
633
- x: e.pageX,
634
- y: e.pageY,
635
- target: e.currentTarget,
636
- event: e,
637
- type: 'tap'
638
- };
639
-
640
- if (this.trigger('tap', data)) {
641
- e.preventDefault();
642
- }
643
- }
644
-
645
553
  _eachTouch(methodName, e) {
646
554
  let that = this,
647
555
  dict = {},
@@ -40,5 +40,12 @@ export { default as keys } from './common/keys';
40
40
  export { default as hasOwnProperty } from './common/has-own-property';
41
41
  export { default as Matrix } from './common/matrix';
42
42
 
43
+ export { default as UserEvents } from './common/user-events';
44
+ export { default as noop } from './common/noop';
45
+ export { default as now } from './common/now';
46
+ export { default as getSupportedFeatures } from './common/get-supported-features';
47
+ export * from './common/event-map';
48
+ export * from './common/event-utils';
49
+
43
50
  export * from './drawing-utils';
44
51
  export { default as Observable } from './common/observable';
@@ -2,17 +2,14 @@ import {
2
2
  Class,
3
3
  addClass,
4
4
  deepExtend,
5
- defined
5
+ defined,
6
+ getSupportedFeatures
6
7
  } from '../../common';
7
8
 
8
9
  import {
9
10
  Extent
10
11
  } from './../extent';
11
12
 
12
- import {
13
- getSupportedFeatures
14
- } from '../utils';
15
-
16
13
  export class Layer extends Class {
17
14
  constructor(map, options) {
18
15
  super();
@@ -5,15 +5,15 @@ import {
5
5
  getter,
6
6
  deepExtend,
7
7
  setDefaultOptions,
8
- renderIcon
8
+ renderIcon,
9
+ on,
10
+ off,
9
11
  } from '../../common';
10
12
 
11
13
  import { Layer } from './layer';
12
14
  import { Location } from '../location';
13
15
  import {
14
16
  proxy,
15
- on,
16
- off,
17
17
  toHyphens,
18
18
  toPixels,
19
19
  convertToHtml
@@ -14,7 +14,11 @@ import {
14
14
  deepExtend,
15
15
  elementOffset,
16
16
  isArray,
17
- round
17
+ round,
18
+ now,
19
+ on,
20
+ off,
21
+ getSupportedFeatures,
18
22
  } from '../common';
19
23
 
20
24
  import {
@@ -61,12 +65,8 @@ import {
61
65
 
62
66
  import {
63
67
  removeChildren,
64
- setDefaultEvents,
65
68
  proxy,
66
- now,
67
- on,
68
- off,
69
- getSupportedFeatures,
69
+ setDefaultEvents,
70
70
  convertToHtml,
71
71
  renderPos
72
72
  } from './utils';
@@ -4,13 +4,13 @@ import {
4
4
  Observable,
5
5
  keys,
6
6
  setDefaultOptions,
7
- renderIcon
7
+ renderIcon,
8
+ on,
9
+ off,
8
10
  } from '../common';
9
11
 
10
12
  import {
11
13
  proxy,
12
- on,
13
- off,
14
14
  setDefaultEvents,
15
15
  convertToHtml
16
16
  } from './utils';
@@ -1,13 +1,12 @@
1
1
  import {
2
2
  Class,
3
3
  Observable,
4
- elementOffset
4
+ elementOffset,
5
+ eventMap
5
6
  } from '../../common';
6
7
 
7
8
  import {
8
- getEventMap,
9
- proxy,
10
- getSupportedFeatures
9
+ proxy
11
10
  } from '../utils';
12
11
 
13
12
  const extend = Object.assign;
@@ -22,8 +21,6 @@ export class TapCapture extends Observable {
22
21
 
23
22
  that.capture = false;
24
23
 
25
- const eventMap = getEventMap(navigator.userAgent);
26
-
27
24
  if (domElement.addEventListener) {
28
25
  eventMap.down.split(' ').forEach(function(event) {
29
26
  domElement.addEventListener(event, proxy(that._press, that), true);
@@ -343,16 +340,14 @@ export class Movable extends Observable {
343
340
 
344
341
  let that = this;
345
342
 
346
- that.support = getSupportedFeatures();
347
- this.transformStyle = this.support.transitions.prefix + 'Transform';
348
343
  that.element = element;
349
- that.element.style.webkitTransformOrigin = 'left top';
344
+ that.element.style.transformOrigin = 'left top';
350
345
  that.x = 0;
351
346
  that.y = 0;
352
347
  that.scale = 1;
353
348
 
354
349
  const coordinates = translate(that.x, that.y, that.scale);
355
- that.element.style[this.transformStyle] = coordinates;
350
+ that.element.style.transform = coordinates;
356
351
 
357
352
  that._saveCoordinates(coordinates);
358
353
  }
@@ -402,7 +397,7 @@ export class Movable extends Observable {
402
397
  newCoordinates = translate(x, y, that.scale);
403
398
 
404
399
  if (newCoordinates !== that.coordinates) {
405
- that.element.style[this.transformStyle] = newCoordinates;
400
+ that.element.style.transform = newCoordinates;
406
401
 
407
402
  that._saveCoordinates(newCoordinates);
408
403
  that.trigger(CHANGE);
@@ -1,10 +1,10 @@
1
1
  import {
2
- Class
2
+ Class,
3
+ now
3
4
  } from '../../common';
4
5
 
5
6
  import {
6
7
  proxy,
7
- now
8
8
  } from '../utils';
9
9
 
10
10
  const extend = Object.assign;
@@ -6,19 +6,19 @@ import {
6
6
  addClass,
7
7
  Observable,
8
8
  isFunction,
9
- setDefaultOptions
9
+ setDefaultOptions,
10
+ on,
11
+ off,
12
+ UserEvents
10
13
  } from '../../common';
11
14
 
12
15
  import {
13
16
  convertToHtml,
14
17
  prepend,
15
18
  wrapInner,
16
- contains,
17
19
  hasNativeScrolling,
18
- on,
19
- off,
20
- proxy,
21
20
  wheelDeltaY,
21
+ proxy,
22
22
  setDefaultEvents
23
23
  } from '../utils';
24
24
 
@@ -34,10 +34,6 @@ import {
34
34
  TapCapture
35
35
  } from './draggable';
36
36
 
37
- import {
38
- UserEvents
39
- } from './user-events';
40
-
41
37
  let
42
38
  extend = Object.assign,
43
39
  abs = Math.abs,
@@ -358,8 +354,7 @@ export class Scroller extends Observable {
358
354
  avoidScrolling = this.options.avoidScrolling,
359
355
 
360
356
  userEvents = new UserEvents(element, {
361
- touchAction: 'pan-y',
362
- fastTap: true,
357
+ touchAction: 'none',
363
358
  allowSelection: true,
364
359
  preventDragEvent: true,
365
360
  captureUpIfMoved: true,
@@ -370,7 +365,7 @@ export class Scroller extends Observable {
370
365
  let velocityX = abs(e.x.velocity),
371
366
  velocityY = abs(e.y.velocity),
372
367
  horizontalSwipe = velocityX * 2 >= velocityY,
373
- originatedFromFixedContainer = contains(that.fixedContainer, e.event.target),
368
+ originatedFromFixedContainer = that.fixedContainer.contains(e.event.target),
374
369
  verticalSwipe = velocityY * 2 >= velocityX;
375
370
  if (!originatedFromFixedContainer && !avoidScrolling(e) && that.enabled && (dimensions.x.enabled && horizontalSwipe || dimensions.y.enabled && verticalSwipe)) {
376
371
  userEvents.capture();