@progress/kendo-charts 1.23.0-dev.202201111041 → 1.23.0-dev.202202081459

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.
@@ -240,7 +240,8 @@ var NumericAxis = (function (Axis) {
240
240
 
241
241
  return {
242
242
  min: limitValue(range.min, totalMin, totalMax),
243
- max: limitValue(range.max, totalMin, totalMax)
243
+ max: limitValue(range.max, totalMin, totalMax),
244
+ narrowRange: false
244
245
  };
245
246
  };
246
247
 
@@ -1,5 +1,4 @@
1
1
  import {
2
- Class,
3
2
  addClass,
4
3
  defined,
5
4
  valueOrDefault,
@@ -14,11 +13,13 @@ import {
14
13
  removeChildren
15
14
  } from './utils';
16
15
 
16
+ import { Observable } from './scroller/observable';
17
+
17
18
  var template = TemplateService.compile;
18
19
 
19
- export var Attribution = (function (Class) {
20
+ export var Attribution = (function (Observable) {
20
21
  function Attribution(element, options) {
21
- Class.call(this);
22
+ Observable.call(this);
22
23
  this.element = element;
23
24
 
24
25
  this._initOptions(options);
@@ -27,8 +28,8 @@ export var Attribution = (function (Class) {
27
28
  addClass(this.element, 'k-widget k-attribution');
28
29
  }
29
30
 
30
- if ( Class ) Attribution.__proto__ = Class;
31
- Attribution.prototype = Object.create( Class && Class.prototype );
31
+ if ( Observable ) Attribution.__proto__ = Observable;
32
+ Attribution.prototype = Object.create( Observable && Observable.prototype );
32
33
  Attribution.prototype.constructor = Attribution;
33
34
 
34
35
  Attribution.prototype._initOptions = function _initOptions (options) {
@@ -147,7 +148,7 @@ export var Attribution = (function (Class) {
147
148
  };
148
149
 
149
150
  return Attribution;
150
- }(Class));
151
+ }(Observable));
151
152
 
152
153
  setDefaultOptions(Attribution, {
153
154
  name: 'Attribution',
@@ -201,7 +201,6 @@ export var MarkerLayer = (function (Layer) {
201
201
  setDefaultOptions(MarkerLayer, {
202
202
  zIndex: 1000,
203
203
  autoBind: true,
204
- dataSource: {},
205
204
  locationField: 'location',
206
205
  titleField: 'title'
207
206
  });
@@ -59,7 +59,6 @@ export var ShapeLayer = (function (Layer) {
59
59
  Layer.prototype.destroy.call(this);
60
60
 
61
61
  this.surface.destroy();
62
- this.dataSource.unbind('change', this._dataChange);
63
62
  };
64
63
 
65
64
  ShapeLayer.prototype._reset = function _reset () {
@@ -13,6 +13,8 @@ import {
13
13
  setDefaultOptions
14
14
  } from '../../common';
15
15
 
16
+ import { removeChildren } from '../utils';
17
+
16
18
  import { Layer } from './layer';
17
19
 
18
20
  import TemplateService from '../../services/template-service';
@@ -203,7 +205,7 @@ export var TileView = (function (Class) {
203
205
  };
204
206
 
205
207
  TileView.prototype.destroy = function destroy () {
206
- this.element.empty();
208
+ removeChildren(this.element);
207
209
  this.pool.empty();
208
210
  };
209
211
 
@@ -226,6 +228,7 @@ export var TileView = (function (Class) {
226
228
  x: firstTileIndex.x + x,
227
229
  y: firstTileIndex.y + y
228
230
  });
231
+
229
232
  if (!tile.visible) {
230
233
  tile.show();
231
234
  }
@@ -265,6 +268,7 @@ export var TileView = (function (Class) {
265
268
 
266
269
  TileView.prototype.wrapIndex = function wrapIndex (index) {
267
270
  var boundary = math.pow(2, this._zoom);
271
+
268
272
  return {
269
273
  x: this.wrapValue(index.x, boundary),
270
274
  y: limitValue(index.y, 0, boundary - 1)
@@ -302,8 +306,14 @@ export var ImageTile = (function (Class) {
302
306
  ImageTile.prototype.constructor = ImageTile;
303
307
 
304
308
  ImageTile.prototype.destroy = function destroy () {
305
- if (this.element) {
306
- this.element.remove();
309
+ var element = this.element;
310
+ var parentNode = element ? element.parentNode : null;
311
+
312
+ if (element) {
313
+ if (parentNode) {
314
+ parentNode.removeChild(element);
315
+ }
316
+
307
317
  this.element = null;
308
318
  }
309
319
  };
@@ -10,6 +10,7 @@ import {
10
10
  mousewheelDelta,
11
11
  limitValue,
12
12
  deepExtend,
13
+ elementOffset,
13
14
  isArray
14
15
  } from '../common';
15
16
 
@@ -61,7 +62,6 @@ import {
61
62
  now,
62
63
  on,
63
64
  off,
64
- elementOffset,
65
65
  getSupportedFeatures,
66
66
  convertToHtml
67
67
  } from './utils';
@@ -117,27 +117,8 @@ var Map = (function (Observable) {
117
117
 
118
118
  Observable.call(this);
119
119
 
120
- this.support = getSupportedFeatures();
121
-
122
- this.initObserver(context);
123
- this.initServices(context);
124
-
125
- this._initOptions(options);
126
- this.bind(this.events, options);
127
- this.crs = new EPSG3857();
128
-
129
- this._initElement(element);
130
120
 
131
- this._viewOrigin = this._getOrigin();
132
-
133
- this._initScroller();
134
- this._initMarkers();
135
- this._initControls();
136
- this._initLayers();
137
- this._reset();
138
-
139
- this._mousewheelHandler = this._mousewheel.bind(this);
140
- on(this.element, MOUSEWHEEL, this._mousewheelHandler);
121
+ this._init(element, options, themeOptions, context);
141
122
  }
142
123
 
143
124
  if ( Observable ) Map.__proto__ = Observable;
@@ -176,6 +157,35 @@ var Map = (function (Observable) {
176
157
  Observable.prototype.destroy.call(this);
177
158
  };
178
159
 
160
+ Map.prototype._init = function _init (element, options, themeOptions, context) {
161
+ if ( options === void 0 ) options = {};
162
+ if ( themeOptions === void 0 ) themeOptions = {};
163
+ if ( context === void 0 ) context = {};
164
+
165
+ this.support = getSupportedFeatures();
166
+ this.context = context;
167
+
168
+ this.initObserver(context);
169
+ this.initServices(context);
170
+
171
+ this._initOptions(options);
172
+ this._setEvents(options);
173
+ this.crs = new EPSG3857();
174
+
175
+ this._initElement(element);
176
+
177
+ this._viewOrigin = this._getOrigin();
178
+
179
+ this._initScroller();
180
+ this._initMarkers();
181
+ this._initControls();
182
+ this._initLayers();
183
+ this._reset();
184
+
185
+ this._mousewheelHandler = this._mousewheel.bind(this);
186
+ on(this.element, MOUSEWHEEL, this._mousewheelHandler);
187
+ };
188
+
179
189
  Map.prototype._initOptions = function _initOptions (options) {
180
190
  this.options = deepExtend({}, this.options, options);
181
191
  };
@@ -188,7 +198,6 @@ var Map = (function (Observable) {
188
198
  element.setAttribute("data-role", "map");
189
199
  removeChildren(element);
190
200
 
191
-
192
201
  var div = convertToHtml("<div />");
193
202
  this.element.appendChild(div);
194
203
  };
@@ -315,7 +324,14 @@ var Map = (function (Observable) {
315
324
  };
316
325
 
317
326
  Map.prototype.setOptions = function setOptions (options) {
318
- Observable.prototype.setOptions.call(this, options);
327
+ if ( options === void 0 ) options = {};
328
+
329
+ var element = this.element;
330
+
331
+ this.destroy();
332
+ removeChildren(element);
333
+ this._init(element, options, {}, this.context);
334
+
319
335
  this._reset();
320
336
  };
321
337
 
@@ -816,7 +832,6 @@ var Map = (function (Observable) {
816
832
 
817
833
  Map.prototype._mousewheel = function _mousewheel (e) {
818
834
  e.preventDefault();
819
- // let delta = dataviz.mwDelta(e) > 0 ? -1 : 1;
820
835
  var delta = mousewheelDelta(e) > 0 ? -1 : 1;
821
836
  var options = this.options;
822
837
  var fromZoom = this.zoom();
@@ -40,9 +40,9 @@ var directionsMap = {
40
40
 
41
41
  function createButton(direction) {
42
42
  var html =
43
- // '<button class="k-button k-navigator-' + direction + '" aria-label="move ' + direction + '">' +
44
- // '<span class="k-icon k-i-arrow-60-' + direction + '"/>' +
45
- '<button class="k-button ' + directionsMap[direction].className + '" aria-label="move ' + direction + '">' +
43
+ '<button class="k-button k-button-square k-rounded-full k-button-flat k-button-flat-base k-icon-button ' +
44
+ directionsMap[direction].className +
45
+ '" aria-label="move ' + direction + '">' +
46
46
  '<span class="k-icon ' + directionsMap[direction].iconClass + '" />' +
47
47
  '</button>';
48
48
 
@@ -75,7 +75,8 @@ export var Navigator = (function (Observable) {
75
75
  this._keyroot = parentElement ? parentElement : this.element;
76
76
  this._tabindex(this._keyroot);
77
77
 
78
- on(this._keyroot, "keydown", proxy(this._keydown, this));
78
+ this._keydownHandler = proxy(this._keydown, this);
79
+ on(this._keyroot, "keydown", this._keydownHandler);
79
80
  }
80
81
 
81
82
  if ( Observable ) Navigator.__proto__ = Observable;
@@ -88,7 +89,7 @@ export var Navigator = (function (Observable) {
88
89
 
89
90
  // originates from the kendo.jquery version
90
91
  Navigator.prototype.dispose = function dispose () {
91
- off(this._keyroot, this._keydown);
92
+ off(this._keyroot, "keydown", this._keydownHandler);
92
93
  };
93
94
 
94
95
  Navigator.prototype._tabindex = function _tabindex (target) {
@@ -1,5 +1,6 @@
1
1
  import {
2
- Class
2
+ Class,
3
+ elementOffset
3
4
  } from '../../common';
4
5
 
5
6
  import {
@@ -9,7 +10,6 @@ import {
9
10
  import {
10
11
  getEventMap,
11
12
  proxy,
12
- elementOffset,
13
13
  getSupportedFeatures
14
14
  } from '../utils';
15
15
 
@@ -23,6 +23,10 @@ export var Observable = (function (Class) {
23
23
  Observable.prototype = Object.create( Class && Class.prototype );
24
24
  Observable.prototype.constructor = Observable;
25
25
 
26
+ Observable.prototype.destroy = function destroy () {
27
+ this.unbind();
28
+ };
29
+
26
30
  Observable.prototype.bind = function bind (event, handlers, one) {
27
31
  var that = this,
28
32
  idx,
@@ -147,5 +151,25 @@ export var Observable = (function (Class) {
147
151
  return that;
148
152
  };
149
153
 
154
+ Observable.prototype._setEvents = function _setEvents (options) {
155
+ var this$1 = this;
156
+
157
+ var length = (this.events || []).length;
158
+
159
+ for (var idx = 0; idx < length; idx ++) {
160
+ var e = this$1.events[idx];
161
+
162
+ if (this$1.options[e] && options[e]) {
163
+ this$1.unbind(e, this$1.options[e]);
164
+
165
+ if (this$1._events && this$1._events[e]) {
166
+ delete this$1._events[e];
167
+ }
168
+ }
169
+ }
170
+
171
+ this.bind(this.events, options);
172
+ };
173
+
150
174
  return Observable;
151
175
  }(Class));
@@ -358,6 +358,7 @@ export var UserEvents = (function (Observable) {
358
358
  /* eslint-disable no-param-reassign */
359
359
  options = options || {};
360
360
  /* eslint-enable no-param-reassign */
361
+ this.options = options;
361
362
 
362
363
  filter = that.filter = options.filter;
363
364
  that.threshold = options.threshold || DEFAULT_THRESHOLD;
@@ -445,15 +445,6 @@ export var now = function () {
445
445
  return Number(new Date());
446
446
  };
447
447
 
448
- export var elementOffset = function (element) {
449
- var offset = {
450
- left: element.offsetLeft,
451
- top: element.offsetTop
452
- };
453
-
454
- return offset;
455
- };
456
-
457
448
  export var noop = function () {};
458
449
 
459
450
  /* eslint-enable arrow-body-style */
@@ -19,7 +19,7 @@ import {
19
19
 
20
20
  function createButton(direction, iconClass) {
21
21
  var html =
22
- '<button class="k-button k-button-icon k-zoom-' + direction +
22
+ '<button class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-icon-button k-zoom-' + direction +
23
23
  '" title="zoom-' + direction +
24
24
  '" aria-label="zoom-' + direction + '">' +
25
25
  '<span class="k-icon ' + iconClass + '">' + '</span>' +
@@ -220,7 +220,8 @@ class NumericAxis extends Axis {
220
220
 
221
221
  return {
222
222
  min: limitValue(range.min, totalMin, totalMax),
223
- max: limitValue(range.max, totalMin, totalMax)
223
+ max: limitValue(range.max, totalMin, totalMax),
224
+ narrowRange: false
224
225
  };
225
226
  }
226
227
 
@@ -1,5 +1,4 @@
1
1
  import {
2
- Class,
3
2
  addClass,
4
3
  defined,
5
4
  valueOrDefault,
@@ -14,9 +13,11 @@ import {
14
13
  removeChildren
15
14
  } from './utils';
16
15
 
16
+ import { Observable } from './scroller/observable';
17
+
17
18
  let template = TemplateService.compile;
18
19
 
19
- export class Attribution extends Class {
20
+ export class Attribution extends Observable {
20
21
  constructor(element, options) {
21
22
  super();
22
23
  this.element = element;
@@ -187,7 +187,6 @@ export class MarkerLayer extends Layer {
187
187
  setDefaultOptions(MarkerLayer, {
188
188
  zIndex: 1000,
189
189
  autoBind: true,
190
- dataSource: {},
191
190
  locationField: 'location',
192
191
  titleField: 'title'
193
192
  });
@@ -55,7 +55,6 @@ export class ShapeLayer extends Layer {
55
55
  super.destroy();
56
56
 
57
57
  this.surface.destroy();
58
- this.dataSource.unbind('change', this._dataChange);
59
58
  }
60
59
 
61
60
  _reset() {
@@ -13,6 +13,8 @@ import {
13
13
  setDefaultOptions
14
14
  } from '../../common';
15
15
 
16
+ import { removeChildren } from '../utils';
17
+
16
18
  import { Layer } from './layer';
17
19
 
18
20
  import TemplateService from '../../services/template-service';
@@ -193,7 +195,7 @@ export class TileView extends Class {
193
195
  }
194
196
 
195
197
  destroy() {
196
- this.element.empty();
198
+ removeChildren(this.element);
197
199
  this.pool.empty();
198
200
  }
199
201
 
@@ -214,6 +216,7 @@ export class TileView extends Class {
214
216
  x: firstTileIndex.x + x,
215
217
  y: firstTileIndex.y + y
216
218
  });
219
+
217
220
  if (!tile.visible) {
218
221
  tile.show();
219
222
  }
@@ -253,6 +256,7 @@ export class TileView extends Class {
253
256
 
254
257
  wrapIndex(index) {
255
258
  let boundary = math.pow(2, this._zoom);
259
+
256
260
  return {
257
261
  x: this.wrapValue(index.x, boundary),
258
262
  y: limitValue(index.y, 0, boundary - 1)
@@ -284,8 +288,14 @@ export class ImageTile extends Class {
284
288
  }
285
289
 
286
290
  destroy() {
287
- if (this.element) {
288
- this.element.remove();
291
+ const element = this.element;
292
+ const parentNode = element ? element.parentNode : null;
293
+
294
+ if (element) {
295
+ if (parentNode) {
296
+ parentNode.removeChild(element);
297
+ }
298
+
289
299
  this.element = null;
290
300
  }
291
301
  }
@@ -10,6 +10,7 @@ import {
10
10
  mousewheelDelta,
11
11
  limitValue,
12
12
  deepExtend,
13
+ elementOffset,
13
14
  isArray
14
15
  } from '../common';
15
16
 
@@ -61,7 +62,6 @@ import {
61
62
  now,
62
63
  on,
63
64
  off,
64
- elementOffset,
65
65
  getSupportedFeatures,
66
66
  convertToHtml
67
67
  } from './utils';
@@ -113,27 +113,8 @@ class Map extends Observable {
113
113
  constructor(element, options = {}, themeOptions = {}, context = {}) {
114
114
  super();
115
115
 
116
- this.support = getSupportedFeatures();
117
-
118
- this.initObserver(context);
119
- this.initServices(context);
120
-
121
- this._initOptions(options);
122
- this.bind(this.events, options);
123
- this.crs = new EPSG3857();
124
-
125
- this._initElement(element);
126
-
127
- this._viewOrigin = this._getOrigin();
128
-
129
- this._initScroller();
130
- this._initMarkers();
131
- this._initControls();
132
- this._initLayers();
133
- this._reset();
134
116
 
135
- this._mousewheelHandler = this._mousewheel.bind(this);
136
- on(this.element, MOUSEWHEEL, this._mousewheelHandler);
117
+ this._init(element, options, themeOptions, context);
137
118
  }
138
119
 
139
120
  destroy() {
@@ -166,6 +147,31 @@ class Map extends Observable {
166
147
  super.destroy();
167
148
  }
168
149
 
150
+ _init(element, options = {}, themeOptions = {}, context = {}) {
151
+ this.support = getSupportedFeatures();
152
+ this.context = context;
153
+
154
+ this.initObserver(context);
155
+ this.initServices(context);
156
+
157
+ this._initOptions(options);
158
+ this._setEvents(options);
159
+ this.crs = new EPSG3857();
160
+
161
+ this._initElement(element);
162
+
163
+ this._viewOrigin = this._getOrigin();
164
+
165
+ this._initScroller();
166
+ this._initMarkers();
167
+ this._initControls();
168
+ this._initLayers();
169
+ this._reset();
170
+
171
+ this._mousewheelHandler = this._mousewheel.bind(this);
172
+ on(this.element, MOUSEWHEEL, this._mousewheelHandler);
173
+ }
174
+
169
175
  _initOptions(options) {
170
176
  this.options = deepExtend({}, this.options, options);
171
177
  }
@@ -178,7 +184,6 @@ class Map extends Observable {
178
184
  element.setAttribute("data-role", "map");
179
185
  removeChildren(element);
180
186
 
181
-
182
187
  const div = convertToHtml("<div />");
183
188
  this.element.appendChild(div);
184
189
  }
@@ -296,8 +301,13 @@ class Map extends Observable {
296
301
  return result;
297
302
  }
298
303
 
299
- setOptions(options) {
300
- super.setOptions(options);
304
+ setOptions(options = {}) {
305
+ const element = this.element;
306
+
307
+ this.destroy();
308
+ removeChildren(element);
309
+ this._init(element, options, {}, this.context);
310
+
301
311
  this._reset();
302
312
  }
303
313
 
@@ -794,7 +804,6 @@ class Map extends Observable {
794
804
 
795
805
  _mousewheel(e) {
796
806
  e.preventDefault();
797
- // let delta = dataviz.mwDelta(e) > 0 ? -1 : 1;
798
807
  let delta = mousewheelDelta(e) > 0 ? -1 : 1;
799
808
  let options = this.options;
800
809
  let fromZoom = this.zoom();
@@ -40,9 +40,9 @@ const directionsMap = {
40
40
 
41
41
  function createButton(direction) {
42
42
  const html =
43
- // '<button class="k-button k-navigator-' + direction + '" aria-label="move ' + direction + '">' +
44
- // '<span class="k-icon k-i-arrow-60-' + direction + '"/>' +
45
- '<button class="k-button ' + directionsMap[direction].className + '" aria-label="move ' + direction + '">' +
43
+ '<button class="k-button k-button-square k-rounded-full k-button-flat k-button-flat-base k-icon-button ' +
44
+ directionsMap[direction].className +
45
+ '" aria-label="move ' + direction + '">' +
46
46
  '<span class="k-icon ' + directionsMap[direction].iconClass + '" />' +
47
47
  '</button>';
48
48
 
@@ -75,7 +75,8 @@ export class Navigator extends Observable {
75
75
  this._keyroot = parentElement ? parentElement : this.element;
76
76
  this._tabindex(this._keyroot);
77
77
 
78
- on(this._keyroot, "keydown", proxy(this._keydown, this));
78
+ this._keydownHandler = proxy(this._keydown, this);
79
+ on(this._keyroot, "keydown", this._keydownHandler);
79
80
  }
80
81
 
81
82
  destroy() {
@@ -84,7 +85,7 @@ export class Navigator extends Observable {
84
85
 
85
86
  // originates from the kendo.jquery version
86
87
  dispose() {
87
- off(this._keyroot, this._keydown);
88
+ off(this._keyroot, "keydown", this._keydownHandler);
88
89
  }
89
90
 
90
91
  _tabindex(target) {
@@ -1,5 +1,6 @@
1
1
  import {
2
- Class
2
+ Class,
3
+ elementOffset
3
4
  } from '../../common';
4
5
 
5
6
  import {
@@ -9,7 +10,6 @@ import {
9
10
  import {
10
11
  getEventMap,
11
12
  proxy,
12
- elementOffset,
13
13
  getSupportedFeatures
14
14
  } from '../utils';
15
15
 
@@ -19,6 +19,10 @@ export class Observable extends Class {
19
19
  this._events = {};
20
20
  }
21
21
 
22
+ destroy() {
23
+ this.unbind();
24
+ }
25
+
22
26
  bind(event, handlers, one) {
23
27
  let that = this,
24
28
  idx,
@@ -140,4 +144,22 @@ export class Observable extends Class {
140
144
 
141
145
  return that;
142
146
  }
147
+
148
+ _setEvents(options) {
149
+ const length = (this.events || []).length;
150
+
151
+ for (let idx = 0; idx < length; idx ++) {
152
+ let e = this.events[idx];
153
+
154
+ if (this.options[e] && options[e]) {
155
+ this.unbind(e, this.options[e]);
156
+
157
+ if (this._events && this._events[e]) {
158
+ delete this._events[e];
159
+ }
160
+ }
161
+ }
162
+
163
+ this.bind(this.events, options);
164
+ }
143
165
  }
@@ -346,6 +346,7 @@ export class UserEvents extends Observable {
346
346
  /* eslint-disable no-param-reassign */
347
347
  options = options || {};
348
348
  /* eslint-enable no-param-reassign */
349
+ this.options = options;
349
350
 
350
351
  filter = that.filter = options.filter;
351
352
  that.threshold = options.threshold || DEFAULT_THRESHOLD;
@@ -445,15 +445,6 @@ export const now = () => {
445
445
  return Number(new Date());
446
446
  };
447
447
 
448
- export const elementOffset = (element) => {
449
- const offset = {
450
- left: element.offsetLeft,
451
- top: element.offsetTop
452
- };
453
-
454
- return offset;
455
- };
456
-
457
448
  export const noop = () => {};
458
449
 
459
450
  /* eslint-enable arrow-body-style */
@@ -19,7 +19,7 @@ import {
19
19
 
20
20
  function createButton(direction, iconClass) {
21
21
  const html =
22
- '<button class="k-button k-button-icon k-zoom-' + direction +
22
+ '<button class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-icon-button k-zoom-' + direction +
23
23
  '" title="zoom-' + direction +
24
24
  '" aria-label="zoom-' + direction + '">' +
25
25
  '<span class="k-icon ' + iconClass + '">' + '</span>' +