@syncfusion/ej2-maps 24.2.9 → 25.1.37

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 (40) hide show
  1. package/CHANGELOG.md +20 -2
  2. package/dist/ej2-maps.min.js +2 -2
  3. package/dist/ej2-maps.umd.min.js +2 -2
  4. package/dist/ej2-maps.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-maps.es2015.js +650 -333
  6. package/dist/es6/ej2-maps.es2015.js.map +1 -1
  7. package/dist/es6/ej2-maps.es5.js +664 -348
  8. package/dist/es6/ej2-maps.es5.js.map +1 -1
  9. package/dist/global/ej2-maps.min.js +2 -2
  10. package/dist/global/ej2-maps.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +13 -13
  13. package/src/maps/layers/bubble.js +2 -3
  14. package/src/maps/layers/color-mapping.d.ts +0 -1
  15. package/src/maps/layers/color-mapping.js +0 -1
  16. package/src/maps/layers/data-label.js +19 -17
  17. package/src/maps/layers/layer-panel.js +13 -7
  18. package/src/maps/layers/legend.js +11 -3
  19. package/src/maps/layers/marker.d.ts +4 -0
  20. package/src/maps/layers/marker.js +16 -13
  21. package/src/maps/layers/polygon.d.ts +0 -1
  22. package/src/maps/layers/polygon.js +1 -4
  23. package/src/maps/maps-model.d.ts +14 -0
  24. package/src/maps/maps.d.ts +14 -2
  25. package/src/maps/maps.js +118 -46
  26. package/src/maps/model/base-model.d.ts +51 -0
  27. package/src/maps/model/base.d.ts +43 -1
  28. package/src/maps/model/base.js +32 -0
  29. package/src/maps/model/constants.d.ts +12 -0
  30. package/src/maps/model/constants.js +12 -0
  31. package/src/maps/model/interface.d.ts +8 -0
  32. package/src/maps/user-interaction/tooltip.js +151 -110
  33. package/src/maps/user-interaction/zoom.d.ts +3 -5
  34. package/src/maps/user-interaction/zoom.js +202 -108
  35. package/src/maps/utils/helper.d.ts +7 -1
  36. package/src/maps/utils/helper.js +89 -37
  37. package/.eslintrc.json +0 -260
  38. package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -72
  39. package/.github/PULL_REQUEST_TEMPLATE/Feature.md +0 -49
  40. package/tslint.json +0 -111
@@ -45,6 +45,7 @@ var MapsTooltip = /** @class */ (function () {
45
45
  }
46
46
  }
47
47
  var option;
48
+ var polygonTooltipOption;
48
49
  var currentData = '';
49
50
  var targetId = target.id;
50
51
  var tooltipEle;
@@ -57,10 +58,30 @@ var MapsTooltip = /** @class */ (function () {
57
58
  var markerFill;
58
59
  var location = getMousePosition(pageX, pageY, this.maps.svgObject);
59
60
  this.tooltipTargetID = targetId;
61
+ var polygonTextStyle;
62
+ var polygonFill;
63
+ var polygon;
64
+ var latitude = null;
65
+ var longitude = null;
66
+ var latLongValue = this.maps.getClickLocation(targetId, e.pageX, e.pageY, target, e['layerX'], e['layerY'], 'tooltip');
67
+ if (!isNullOrUndefined(latLongValue)) {
68
+ latitude = latLongValue.latitude;
69
+ longitude = latLongValue.longitude;
70
+ }
71
+ var isPolygon = targetId.indexOf('_PolygonIndex_') > -1;
60
72
  var istooltipRender = (targetId.indexOf('_shapeIndex_') > -1)
61
- || (targetId.indexOf('_MarkerIndex_') > -1) || (targetId.indexOf('_BubbleIndex_') > -1);
73
+ || (targetId.indexOf('_MarkerIndex_') > -1) || (targetId.indexOf('_BubbleIndex_') > -1)
74
+ || (targetId.indexOf('_PolygonIndex_') > -1);
62
75
  if (istooltipRender && this.maps.markerDragArgument === null) {
63
- if (targetId.indexOf('_shapeIndex_') > -1) {
76
+ if (targetId.indexOf('_PolygonIndex_') > -1) {
77
+ var polygonIndex = parseInt(targetId.split('_PolygonIndex_')[1].split('_')[0], 10);
78
+ polygonTooltipOption = layer.polygonSettings.tooltipSettings;
79
+ polygon = layer.polygonSettings.polygons[polygonIndex];
80
+ polygonTextStyle = polygonTooltipOption.textStyle;
81
+ polygonFill = polygonTooltipOption.fill;
82
+ tooltipContent.push(polygon.tooltipText);
83
+ }
84
+ else if (targetId.indexOf('_shapeIndex_') > -1) {
64
85
  option = layer.tooltipSettings;
65
86
  var shape = parseInt(targetId.split('_shapeIndex_')[1].split('_')[0], 10);
66
87
  if (isNullOrUndefined(layer.layerData) || isNullOrUndefined(layer.layerData[shape])) {
@@ -163,116 +184,135 @@ var MapsTooltip = /** @class */ (function () {
163
184
  }
164
185
  //location.y = this.template(option, location);
165
186
  }
166
- if (document.getElementById(this.tooltipId)) {
167
- tooltipEle = document.getElementById(this.tooltipId);
168
- }
169
- else {
170
- tooltipEle = createElement('div', {
171
- id: this.maps.element.id + '_mapsTooltip',
172
- className: 'EJ2-maps-Tooltip'
173
- });
174
- if (isNullOrUndefined(option.template) || option.template === '' || this.maps.tooltipDisplayMode === 'MouseMove') {
175
- tooltipEle.style.cssText = 'position: absolute;pointer-events:none;';
187
+ if (isPolygon ? polygonTooltipOption.visible : option.visible) {
188
+ if (document.getElementById(this.tooltipId)) {
189
+ tooltipEle = document.getElementById(this.tooltipId);
176
190
  }
177
191
  else {
178
- tooltipEle.style.position = 'absolute';
179
- }
180
- document.getElementById(this.maps.element.id + '_Secondary_Element').appendChild(tooltipEle);
181
- }
182
- if (typeof option.template !== 'function' && option.template !== null && Object.keys(typeof option.template === 'object' ? option.template : {}).length === 1) {
183
- option.template = option.template[Object.keys(option.template)[0]];
184
- }
185
- templateData = this.setTooltipContent(option, templateData);
186
- var tooltipTextStyle = {
187
- color: option.textStyle.color, fontFamily: option.textStyle.fontFamily, fontStyle: option.textStyle.fontStyle,
188
- fontWeight: option.textStyle.fontWeight, opacity: option.textStyle.opacity, size: option.textStyle.size
189
- };
190
- var tooltipOption = {
191
- location: location, text: tooltipContent, data: templateData,
192
- textStyle: tooltipTextStyle,
193
- template: option.template
194
- };
195
- tooltipArgs = {
196
- cancel: false, name: tooltipRender,
197
- options: tooltipOption,
198
- fill: option.fill,
199
- maps: this.maps,
200
- element: target, eventArgs: e, content: !isNullOrUndefined(currentData) ? currentData.toString() : ''
201
- };
202
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
203
- this.maps.trigger(tooltipRender, tooltipArgs, function (args) {
204
- if (!tooltipArgs.cancel && option.visible && !isNullOrUndefined(currentData) &&
205
- (targetId.indexOf('_cluster_') === -1 && targetId.indexOf('_dataLabel_') === -1)) {
206
- _this.maps['isProtectedOnChange'] = true;
207
- tooltipArgs.options['textStyle']['size'] = tooltipArgs.options['textStyle']['size']
208
- || _this.maps.themeStyle.fontSize;
209
- tooltipArgs.options['textStyle']['color'] = tooltipArgs.options['textStyle']['color']
210
- || _this.maps.themeStyle.tooltipFontColor;
211
- tooltipArgs.options['textStyle']['fontFamily'] = tooltipArgs.options['textStyle']['fontFamily']
212
- || _this.maps.themeStyle.fontFamily;
213
- tooltipArgs.options['textStyle']['fontWeight'] = tooltipArgs.options['textStyle']['fontWeight']
214
- || _this.maps.themeStyle.fontWeight;
215
- tooltipArgs.options['textStyle']['opacity'] = tooltipArgs.options['textStyle']['opacity']
216
- || _this.maps.themeStyle.tooltipTextOpacity;
217
- if (tooltipArgs.cancel) {
218
- _this.svgTooltip = new Tooltip({
219
- enable: true,
220
- header: '',
221
- data: option['data'],
222
- template: option['template'],
223
- content: tooltipArgs.content.toString() !== currentData.toString() ? [tooltipArgs.content.toString()] :
224
- [currentData.toString()],
225
- shapes: [],
226
- location: option['location'],
227
- palette: [markerFill],
228
- areaBounds: _this.maps.mapAreaRect,
229
- textStyle: option['textStyle'],
230
- availableSize: _this.maps.availableSize,
231
- fill: option.fill || _this.maps.themeStyle.tooltipFillColor,
232
- enableShadow: true
233
- });
192
+ tooltipEle = createElement('div', {
193
+ id: this.maps.element.id + '_mapsTooltip',
194
+ className: 'EJ2-maps-Tooltip'
195
+ });
196
+ if (isNullOrUndefined(isPolygon ? polygon.tooltipTemplate : option.template) || (isPolygon ? polygon.tooltipTemplate === '' : option.template === '') || this.maps.tooltipDisplayMode === 'MouseMove') {
197
+ tooltipEle.style.cssText = 'position: absolute;pointer-events:none;';
234
198
  }
235
199
  else {
236
- _this.svgTooltip = new Tooltip({
237
- enable: true,
238
- header: '',
239
- data: tooltipArgs.options['data'],
240
- template: tooltipArgs.options['template'],
241
- content: tooltipArgs.content.toString() !== currentData.toString() ? [tooltipArgs.content.toString()] :
242
- [currentData.toString()],
243
- shapes: [],
244
- location: tooltipArgs.options['location'],
245
- palette: [markerFill],
246
- areaBounds: _this.maps.mapAreaRect,
247
- textStyle: tooltipArgs.options['textStyle'],
248
- availableSize: _this.maps.availableSize,
249
- fill: tooltipArgs.fill || _this.maps.themeStyle.tooltipFillColor,
250
- enableShadow: true
251
- });
200
+ tooltipEle.style.position = 'absolute';
252
201
  }
253
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
254
- if (_this.maps.isVue || _this.maps.isVue3) {
255
- _this.svgTooltip.controlInstance = _this.maps;
202
+ document.getElementById(this.maps.element.id + '_Secondary_Element').appendChild(tooltipEle);
203
+ }
204
+ if (typeof (isPolygon ? polygon.tooltipTemplate !== 'function' : option.template !== 'function') && (isPolygon ? polygon.tooltipTemplate !== null : option.template !== null) && Object.keys(typeof (isPolygon ? polygon.tooltipTemplate === 'object' : option.template === 'object') ? (isPolygon ? polygon.tooltipTemplate : option.template) : {}).length === 1) {
205
+ if (isPolygon) {
206
+ polygon.tooltipTemplate = polygon.tooltipTemplate[Object.keys(polygon.tooltipTemplate)[0]];
207
+ }
208
+ else {
209
+ option.template = option.template[Object.keys(option.template)[0]];
256
210
  }
257
- _this.svgTooltip.opacity = _this.maps.themeStyle.tooltipFillOpacity || _this.svgTooltip.opacity;
258
- _this.svgTooltip.appendTo(tooltipEle);
259
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
260
- _this.maps.renderReactTemplates();
211
+ }
212
+ templateData = this.setTooltipContent(option, templateData);
213
+ var tooltipTextStyle = {
214
+ // eslint-disable-next-line max-len
215
+ color: isPolygon ? polygonTextStyle.color : option.textStyle.color, fontFamily: isPolygon ? polygonTextStyle.fontFamily : option.textStyle.fontFamily, fontStyle: isPolygon ? polygonTextStyle.fontStyle : option.textStyle.fontStyle,
216
+ // eslint-disable-next-line max-len
217
+ fontWeight: isPolygon ? polygonTextStyle.fontWeight : option.textStyle.fontWeight, opacity: isPolygon ? polygonTextStyle.opacity : option.textStyle.opacity, size: isPolygon ? polygonTextStyle.size : option.textStyle.size
218
+ };
219
+ var tooltipOption = {
220
+ location: location, text: tooltipContent, data: templateData,
221
+ textStyle: tooltipTextStyle,
222
+ template: isPolygon ? polygon.tooltipTemplate : option.template
223
+ };
224
+ tooltipArgs = {
225
+ cancel: false, name: tooltipRender,
226
+ options: tooltipOption,
227
+ fill: isPolygon ? polygonFill : option.fill,
228
+ maps: this.maps, latitude: latitude, longitude: longitude,
229
+ element: target, eventArgs: e, content: isPolygon ? polygon.tooltipText : !isNullOrUndefined(currentData) ? currentData.toString() : ''
230
+ };
231
+ if (tooltipArgs.content !== '' || tooltipArgs.options['template'] !== '') {
232
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
233
+ this.maps.trigger(tooltipRender, tooltipArgs, function (args) {
234
+ if (!tooltipArgs.cancel && !isNullOrUndefined(currentData) &&
235
+ (targetId.indexOf('_cluster_') === -1 && targetId.indexOf('_dataLabel_') === -1)) {
236
+ _this.maps['isProtectedOnChange'] = true;
237
+ tooltipArgs.options['textStyle']['size'] = tooltipArgs.options['textStyle']['size']
238
+ || _this.maps.themeStyle.fontSize;
239
+ tooltipArgs.options['textStyle']['color'] = tooltipArgs.options['textStyle']['color']
240
+ || _this.maps.themeStyle.tooltipFontColor;
241
+ tooltipArgs.options['textStyle']['fontFamily'] = tooltipArgs.options['textStyle']['fontFamily']
242
+ || _this.maps.themeStyle.fontFamily;
243
+ tooltipArgs.options['textStyle']['fontWeight'] = tooltipArgs.options['textStyle']['fontWeight']
244
+ || _this.maps.themeStyle.fontWeight;
245
+ tooltipArgs.options['textStyle']['opacity'] = tooltipArgs.options['textStyle']['opacity']
246
+ || _this.maps.themeStyle.tooltipTextOpacity;
247
+ if (tooltipArgs.cancel) {
248
+ _this.svgTooltip = new Tooltip({
249
+ enable: true,
250
+ header: '',
251
+ data: option['data'],
252
+ template: option['template'],
253
+ content: tooltipArgs.content.toString() !== currentData.toString() ? [tooltipArgs.content.toString()] :
254
+ [currentData.toString()],
255
+ shapes: [],
256
+ location: option['location'],
257
+ palette: [markerFill],
258
+ areaBounds: _this.maps.mapAreaRect,
259
+ textStyle: option['textStyle'],
260
+ availableSize: _this.maps.availableSize,
261
+ fill: option.fill || _this.maps.themeStyle.tooltipFillColor,
262
+ enableShadow: true,
263
+ border: isPolygon ? polygonTooltipOption.border : option.border
264
+ });
265
+ }
266
+ else {
267
+ _this.svgTooltip = new Tooltip({
268
+ enable: true,
269
+ header: '',
270
+ data: tooltipArgs.options['data'],
271
+ template: tooltipArgs.options['template'],
272
+ content: tooltipArgs.content.toString() !== currentData.toString() ? [tooltipArgs.content.toString()] :
273
+ [currentData.toString()],
274
+ shapes: [],
275
+ location: tooltipArgs.options['location'],
276
+ palette: [markerFill],
277
+ areaBounds: _this.maps.mapAreaRect,
278
+ textStyle: tooltipArgs.options['textStyle'],
279
+ availableSize: _this.maps.availableSize,
280
+ fill: tooltipArgs.fill || _this.maps.themeStyle.tooltipFillColor,
281
+ enableShadow: true,
282
+ border: isPolygon ? polygonTooltipOption.border : option.border
283
+ });
284
+ }
285
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
286
+ if (_this.maps.isVue || _this.maps.isVue3) {
287
+ _this.svgTooltip.controlInstance = _this.maps;
288
+ }
289
+ _this.svgTooltip.opacity = _this.maps.themeStyle.tooltipFillOpacity || _this.svgTooltip.opacity;
290
+ _this.svgTooltip.appendTo(tooltipEle);
291
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
292
+ _this.maps.renderReactTemplates();
293
+ }
294
+ else {
295
+ _this.clearTooltip(e.target);
296
+ }
297
+ });
261
298
  }
262
299
  else {
263
- _this.clearTooltip(e.target);
300
+ this.clearTooltip(e.target);
301
+ }
302
+ if (this.svgTooltip) {
303
+ this.maps.trigger('tooltipRenderComplete', {
304
+ cancel: false, name: 'tooltipRenderComplete', maps: this.maps, options: tooltipOption,
305
+ element: this.svgTooltip.element
306
+ });
307
+ }
308
+ if (this.svgTooltip) {
309
+ this.maps.trigger('tooltipRenderComplete', {
310
+ cancel: false, name: 'tooltipRenderComplete', maps: this.maps, options: tooltipOption, element: this.svgTooltip.element
311
+ });
312
+ }
313
+ else {
314
+ this.clearTooltip(e.target);
264
315
  }
265
- });
266
- if (this.svgTooltip) {
267
- this.maps.trigger('tooltipRenderComplete', {
268
- cancel: false, name: 'tooltipRenderComplete', maps: this.maps, options: tooltipOption,
269
- element: this.svgTooltip.element
270
- });
271
- }
272
- if (this.svgTooltip) {
273
- this.maps.trigger('tooltipRenderComplete', {
274
- cancel: false, name: 'tooltipRenderComplete', maps: this.maps, options: tooltipOption, element: this.svgTooltip.element
275
- });
276
316
  }
277
317
  else {
278
318
  this.clearTooltip(e.target);
@@ -323,10 +363,12 @@ var MapsTooltip = /** @class */ (function () {
323
363
  * @private
324
364
  */
325
365
  MapsTooltip.prototype.mouseUpHandler = function (e) {
326
- this.renderTooltip(e);
327
- if (this.maps.tooltipDisplayMode === 'MouseMove') {
328
- clearTimeout(this.clearTimeout);
329
- this.clearTimeout = setTimeout(this.removeTooltip.bind(this), 2000);
366
+ if (!isNullOrUndefined(this.maps)) {
367
+ this.renderTooltip(e);
368
+ if (this.maps.tooltipDisplayMode === 'MouseMove') {
369
+ clearTimeout(this.clearTimeout);
370
+ this.clearTimeout = setTimeout(this.removeTooltip.bind(this), 2000);
371
+ }
330
372
  }
331
373
  };
332
374
  /**
@@ -380,7 +422,7 @@ var MapsTooltip = /** @class */ (function () {
380
422
  return;
381
423
  }
382
424
  if (this.maps.tooltipDisplayMode === 'DoubleClick') {
383
- this.maps.off('dblclick', this.removeTooltip);
425
+ this.maps.off('dblclick', this.renderTooltip);
384
426
  }
385
427
  else if (this.maps.tooltipDisplayMode === 'Click') {
386
428
  this.maps.off(Browser.touchEndEvent, this.mouseUpHandler);
@@ -411,8 +453,7 @@ var MapsTooltip = /** @class */ (function () {
411
453
  this.svgTooltip.destroy();
412
454
  }
413
455
  this.svgTooltip = null;
414
- //TODO: Calling the below code throws spec issue.
415
- //this.maps = null;
456
+ this.maps = null;
416
457
  };
417
458
  return MapsTooltip;
418
459
  }());
@@ -18,7 +18,7 @@ export declare class Zoom {
18
18
  private zoomElements;
19
19
  private panElements;
20
20
  /** @private */
21
- isPanning: boolean;
21
+ isPanModeEnabled: boolean;
22
22
  /** @private */
23
23
  mouseEnter: boolean;
24
24
  /** @private */
@@ -64,10 +64,7 @@ export declare class Zoom {
64
64
  private lastScale;
65
65
  private pinchFactor;
66
66
  private startTouches;
67
- private zoomshapewidth;
68
67
  private index;
69
- /** @private */
70
- intersect: any[];
71
68
  private templateCount;
72
69
  private distanceX;
73
70
  private distanceY;
@@ -103,6 +100,7 @@ export declare class Zoom {
103
100
  * @private
104
101
  */
105
102
  performPinchZooming(e: PointerEvent | TouchEvent): void;
103
+ private triggerZoomComplete;
106
104
  /**
107
105
  * @private
108
106
  */
@@ -121,7 +119,7 @@ export declare class Zoom {
121
119
  /**
122
120
  * @private
123
121
  */
124
- applyTransform(maps: Maps, animate?: boolean): void;
122
+ applyTransform(maps: Maps, animate?: boolean, isPanning?: boolean): void;
125
123
  private markerTranslates;
126
124
  /**
127
125
  * To translate the layer template elements