@syncfusion/ej2-maps 22.2.12 → 23.1.38

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.
@@ -1,4 +1,4 @@
1
- import { Animation, Browser, ChildProperty, Collection, Complex, Component, Event, EventHandler, Fetch, Internationalization, L10n, NotifyPropertyChanges, Property, SanitizeHtmlHelper, compile, createElement, extend, isNullOrUndefined, merge, print, remove, setValue } from '@syncfusion/ej2-base';
1
+ import { Animation, Browser, ChildProperty, Collection, Complex, Component, Event, EventHandler, Fetch, Internationalization, L10n, NotifyPropertyChanges, Property, SanitizeHtmlHelper, animationMode, compile, createElement, extend, isNullOrUndefined, merge, print, remove, setValue } from '@syncfusion/ej2-base';
2
2
  import { SvgRenderer, Tooltip } from '@syncfusion/ej2-svg-base';
3
3
  import { DataManager, Query } from '@syncfusion/ej2-data';
4
4
  import { PdfBitmap, PdfDocument, PdfPageOrientation } from '@syncfusion/ej2-pdf-export';
@@ -1223,7 +1223,7 @@ function marker(eventArgs, markerSettings, markerData, dataIndex, location, tran
1223
1223
  markerCollection.appendChild(ele);
1224
1224
  const element = (markerData.length - 1) === dataIndex ? 'marker' : null;
1225
1225
  const markerPoint = new Point(x, y);
1226
- if (markerSettings.animationDuration > 0) {
1226
+ if (markerSettings.animationDuration > 0 || animationMode === 'Enable') {
1227
1227
  elementAnimate(ele, markerSettings.animationDelay, markerSettings.animationDuration, markerPoint, maps, element);
1228
1228
  }
1229
1229
  return markerCollection;
@@ -2578,7 +2578,7 @@ function elementAnimate(element, delay, duration, point, maps, ele, radius = 0)
2578
2578
  let height = 0;
2579
2579
  const transform = element.getAttribute('transform') || '';
2580
2580
  new Animation({}).animate(element, {
2581
- duration: duration,
2581
+ duration: (duration === 0 && animationMode === 'Enable') ? 1000 : duration,
2582
2582
  delay: delay,
2583
2583
  progress: (args) => {
2584
2584
  if (args.timeStamp > args.delay) {
@@ -3168,6 +3168,7 @@ function animate(element, delay, duration, process, end) {
3168
3168
  // eslint-disable-next-line prefer-const
3169
3169
  let clearAnimation;
3170
3170
  const markerStyle = 'visibility:visible';
3171
+ duration = animationMode === "Disable" ? 0 : duration;
3171
3172
  const startAnimation = (timestamp) => {
3172
3173
  if (!start) {
3173
3174
  start = timestamp;
@@ -4744,6 +4745,9 @@ __decorate$1([
4744
4745
  __decorate$1([
4745
4746
  Property('')
4746
4747
  ], DataLabelSettings.prototype, "template", void 0);
4748
+ __decorate$1([
4749
+ Property(0)
4750
+ ], DataLabelSettings.prototype, "animationDuration", void 0);
4747
4751
  /**
4748
4752
  * Gets or sets the options to customize the shapes in the maps.
4749
4753
  */
@@ -5048,7 +5052,7 @@ class Marker {
5048
5052
  const markerID = maps.element.id + '_LayerIndex_' + layerIndex + '_MarkerIndex_'
5049
5053
  + markerIndex + '_dataIndex_' + dataIndex;
5050
5054
  let location = (maps.isTileMap) ? convertTileLatLongToPoint(new MapLocation(lng, lat), factor, maps.tileTranslatePoint, true) : convertGeoToPoint(lat, lng, factor, currentLayer, maps);
5051
- const animate$$1 = currentLayer.animationDuration !== 0 || isNullOrUndefined(maps.zoomModule);
5055
+ const animate$$1 = (currentLayer.animationDuration !== 0 || animationMode === 'Enable') || isNullOrUndefined(maps.zoomModule);
5052
5056
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5053
5057
  const translate = (maps.isTileMap) ? (currentLayer.type === 'SubLayer' && isNullOrUndefined(maps.zoomModule)) ? location = convertTileLatLongToPoint(new MapLocation(lng, lat), maps.tileZoomLevel, maps.tileTranslatePoint, true) : new Object() :
5054
5058
  !isNullOrUndefined(maps.zoomModule) && maps.zoomSettings.zoomFactor > 1 ?
@@ -6901,7 +6905,8 @@ class LayerPanel {
6901
6905
  let childNode;
6902
6906
  this.mapObject.translateType = 'layer';
6903
6907
  if (!isNullOrUndefined(this.mapObject.baseMapRectBounds)) {
6904
- const duration = this.currentLayer.animationDuration;
6908
+ const duration = animationMode === 'Disable' ? 0 : (this.currentLayer.animationDuration === 0 && animationMode === 'Enable') ?
6909
+ 1000 : this.currentLayer.animationDuration;
6905
6910
  const animate$$1 = duration !== 0 || isNullOrUndefined(this.mapObject.zoomModule);
6906
6911
  this.mapObject.baseTranslatePoint = this.mapObject.zoomTranslatePoint;
6907
6912
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -7154,7 +7159,8 @@ class LayerPanel {
7154
7159
  let timeOut;
7155
7160
  if (!isNullOrUndefined(type) && type !== 'Pan') {
7156
7161
  this.tileAnimation(type, x, y);
7157
- timeOut = this.mapObject.layersCollection[0].animationDuration;
7162
+ timeOut = animationMode === 'Disable' ? 0 : (this.mapObject.layersCollection[0].animationDuration === 0 &&
7163
+ animationMode === 'Enable') ? 1000 : this.mapObject.layersCollection[0].animationDuration;
7158
7164
  }
7159
7165
  else {
7160
7166
  timeOut = 0;
@@ -7289,7 +7295,8 @@ class LayerPanel {
7289
7295
  scaleValue = zoomType.indexOf('ZoomOut') === 0 ? '0.5' : '0.2';
7290
7296
  }
7291
7297
  if (!isNullOrUndefined(animatedTiles)) {
7292
- animatedTiles.style.transition = this.mapObject.layersCollection[0].animationDuration + 'ms';
7298
+ animatedTiles.style.transition = animationMode === 'Disable' ? '0ms' : (this.mapObject.layersCollection[0].animationDuration === 0
7299
+ && animationMode === 'Enable') ? '1000ms' : this.mapObject.layersCollection[0].animationDuration + 'ms';
7293
7300
  animatedTiles.style.transform = 'translate(' + translateX + 'px, ' + translateY + 'px) scale(' + scaleValue + ')';
7294
7301
  }
7295
7302
  }
@@ -7843,7 +7850,18 @@ let Maps = class Maps extends Component {
7843
7850
  this.serverProcess['request']++;
7844
7851
  const fetchApiModule = new Fetch(localAjax.dataOptions, localAjax.type, localAjax.contentType);
7845
7852
  fetchApiModule.onSuccess = (args) => {
7846
- this.processResponseJsonData('Fetch', args, layer, type);
7853
+ if (!isNullOrUndefined(args.type) && args.type === 'application/octet-stream') {
7854
+ let reader = new FileReader();
7855
+ let map = this;
7856
+ reader.onload = function (data) {
7857
+ args = JSON.parse(reader.result.toString());
7858
+ map.processResponseJsonData('Fetch', args, layer, type);
7859
+ };
7860
+ reader.readAsText(args);
7861
+ }
7862
+ else {
7863
+ this.processResponseJsonData('Fetch', args, layer, type);
7864
+ }
7847
7865
  };
7848
7866
  fetchApiModule.send(localAjax.sendData);
7849
7867
  }
@@ -8833,7 +8851,7 @@ let Maps = class Maps extends Component {
8833
8851
  if (e.type.indexOf('touch') !== -1 && e.changedTouches) {
8834
8852
  this.mouseDownEvent = { x: e.changedTouches[0].pageX, y: e.changedTouches[0].pageY };
8835
8853
  }
8836
- if (this.isDevice) {
8854
+ if (this.isDevice && !isNullOrUndefined(this.mapsTooltipModule)) {
8837
8855
  this.mapsTooltipModule.renderTooltip(e);
8838
8856
  }
8839
8857
  const rect = this.element.getBoundingClientRect();
@@ -10248,7 +10266,7 @@ class Bubble {
10248
10266
  });
10249
10267
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10250
10268
  let translate;
10251
- const animate$$1 = layer.animationDuration !== 0 || isNullOrUndefined(this.maps.zoomModule);
10269
+ const animate$$1 = (layer.animationDuration !== 0 || animationMode === 'Enable') || isNullOrUndefined(this.maps.zoomModule);
10252
10270
  if (this.maps.zoomSettings.zoomFactor > 1 && !isNullOrUndefined(this.maps.zoomModule) && !this.maps.isTileMap) {
10253
10271
  translate = getZoomTranslate(this.maps, layer, animate$$1);
10254
10272
  }
@@ -10269,7 +10287,7 @@ class Bubble {
10269
10287
  else {
10270
10288
  radius = 0;
10271
10289
  }
10272
- if (bubbleSettings.animationDuration > 0) {
10290
+ if (bubbleSettings.animationDuration > 0 || animationMode === 'Enable') {
10273
10291
  elementAnimate(bubbleElement, bubbleSettings.animationDelay, bubbleSettings.animationDuration, position, this.maps, bubble, radius);
10274
10292
  }
10275
10293
  });
@@ -10440,6 +10458,7 @@ class DataLabel {
10440
10458
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10441
10459
  const shapeData = shape;
10442
10460
  let element;
10461
+ let rect;
10443
10462
  let text = '';
10444
10463
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10445
10464
  let datasrcObj;
@@ -10463,7 +10482,7 @@ class DataLabel {
10463
10482
  layer.shapePropertyPath : [layer.shapePropertyPath]);
10464
10483
  let propertyPath;
10465
10484
  const isPoint = false;
10466
- const animate$$1 = layer.animationDuration !== 0 || isNullOrUndefined(this.maps.zoomModule);
10485
+ const animate$$1 = (layer.animationDuration !== 0 || animationMode === 'Enable') || isNullOrUndefined(this.maps.zoomModule);
10467
10486
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10468
10487
  const translate = (this.maps.isTileMap) ? new Object() : ((this.maps.zoomSettings.zoomFactor > 1 &&
10469
10488
  !isNullOrUndefined(this.maps.zoomModule)) ? getZoomTranslate(this.maps, layer, animate$$1) :
@@ -10722,11 +10741,13 @@ class DataLabel {
10722
10741
  }
10723
10742
  border.opacity = isNullOrUndefined(border.opacity) ? opacity : border.opacity;
10724
10743
  const rectOptions = new RectOption(this.maps.element.id + '_LayerIndex_' + layerIndex + '_shapeIndex_' + index + '_rectIndex_' + index, fill, border, opacity, new Rect((x + labelArgs.offsetX), (y + labelArgs.offsetY), textSize['width'], textSize['height']), rx, ry);
10725
- const rect = this.maps.renderer.drawRectangle(rectOptions);
10744
+ rect = this.maps.renderer.drawRectangle(rectOptions);
10745
+ rect.setAttribute('visibility', layer.dataLabelSettings.animationDuration > 0 || animationMode === 'Enable' ? 'hidden' : 'visibile');
10726
10746
  group.appendChild(rect);
10727
10747
  }
10728
10748
  }
10729
10749
  element = renderTextElement(options, style, style.color || this.maps.themeStyle.dataLabelFontColor, group);
10750
+ element.setAttribute('visibility', layer.dataLabelSettings.animationDuration > 0 || animationMode === 'Enable' ? 'hidden' : 'visibile');
10730
10751
  if (zoomLabelsPosition && scaleZoomValue > 1 && !this.maps.zoomNotApplied) {
10731
10752
  element.setAttribute('transform', 'translate( ' + ((location['x'] + labelArgs.offsetX)) + ' '
10732
10753
  + (((location['y'] + labelArgs.offsetY))) + ' )');
@@ -10752,9 +10773,35 @@ class DataLabel {
10752
10773
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10753
10774
  this.maps.renderReactTemplates();
10754
10775
  }
10776
+ if (layer.dataLabelSettings.animationDuration > 0 || animationMode === 'Enable') {
10777
+ if (!isNullOrUndefined(element)) {
10778
+ this.datalabelAnimate(element, dataLabelSettings.animationDuration, style.opacity, false);
10779
+ if (!isNullOrUndefined(rect)) {
10780
+ this.datalabelAnimate(rect, dataLabelSettings.animationDuration, dataLabelSettings.opacity, true);
10781
+ }
10782
+ }
10783
+ }
10755
10784
  });
10756
10785
  }
10757
10786
  }
10787
+ datalabelAnimate(element, duration, opacity, isRect) {
10788
+ let height = 0;
10789
+ new Animation({}).animate(element, {
10790
+ duration: (duration === 0 && animationMode === 'Enable') ? 1000 : duration,
10791
+ delay: 0,
10792
+ progress: (args) => {
10793
+ if (args.timeStamp > args.delay) {
10794
+ height = ((args.timeStamp - args.delay) / args.duration);
10795
+ element.setAttribute('style', 'user-select: none; visibility: visible;');
10796
+ element.setAttribute(isRect ? 'fill-opacity' : 'opacity', (opacity * height).toString());
10797
+ }
10798
+ },
10799
+ end: (model) => {
10800
+ element.style.visibility = 'visible';
10801
+ element.setAttribute(isRect ? 'fill-opacity' : 'opacity', opacity.toString());
10802
+ }
10803
+ });
10804
+ }
10758
10805
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10759
10806
  getPoint(shapes, points) {
10760
10807
  if (shapes['type'] === 'MultiLineString') {
@@ -14260,7 +14307,7 @@ class Zoom {
14260
14307
  this.markerLineAnimation(map);
14261
14308
  map.mapLayerPanel.generateTiles(newZoomFactor, map.tileTranslatePoint, type + 'wheel', null, position);
14262
14309
  const element1 = document.getElementById(this.maps.element.id + '_tiles');
14263
- const animationDuration = this.maps.layersCollection[0].animationDuration;
14310
+ const animationDuration = this.maps.layersCollection[0].animationDuration === 0 && animationMode === 'Enable' ? 1000 : this.maps.layersCollection[0].animationDuration;
14264
14311
  setTimeout(() => {
14265
14312
  // if (type === 'ZoomOut') {
14266
14313
  // element1.removeChild(element1.children[element1.childElementCount - 1]);
@@ -14521,7 +14568,7 @@ class Zoom {
14521
14568
  * @returns {void}
14522
14569
  */
14523
14570
  animateTransform(element, animate$$1, x, y, scale) {
14524
- const duration = this.currentLayer.animationDuration;
14571
+ const duration = this.currentLayer.animationDuration === 0 && animationMode === 'Enable' ? 1000 : this.currentLayer.animationDuration;
14525
14572
  if (!animate$$1 || duration === 0 || this.maps.isTileMap) {
14526
14573
  element.setAttribute('transform', 'scale(' + (scale) + ') translate( ' + x + ' ' + y + ' )');
14527
14574
  return;
@@ -14585,7 +14632,7 @@ class Zoom {
14585
14632
  const layerIndex = parseInt(currentEle.childNodes[k]['id'].split('_LayerIndex_')[1].split('_')[0], 10);
14586
14633
  const dataIndex = parseInt(currentEle.childNodes[k]['id'].split('_dataIndex_')[1].split('_')[0], 10);
14587
14634
  const markerIndex = parseInt(currentEle.childNodes[k]['id'].split('_MarkerIndex_')[1].split('_')[0], 10);
14588
- markerAnimation = this.currentLayer.markerSettings[markerIndex].animationDuration > 0;
14635
+ markerAnimation = this.currentLayer.markerSettings[markerIndex].animationDuration > 0 || animationMode === 'Enable';
14589
14636
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
14590
14637
  const markerSelectionValues = this.currentLayer.markerSettings[markerIndex].dataSource[dataIndex];
14591
14638
  for (let x = 0; x < this.currentLayer.markerSettings[markerIndex].initialMarkerSelection.length; x++) {
@@ -14596,7 +14643,7 @@ class Zoom {
14596
14643
  maps.markerSelection(this.currentLayer.markerSettings[markerIndex].selectionSettings, maps, currentEle.children[k], this.currentLayer.markerSettings[markerIndex].dataSource[dataIndex]);
14597
14644
  }
14598
14645
  }
14599
- if ((this.currentLayer.animationDuration > 0 || (maps.layersCollection[0].animationDuration > 0 && this.currentLayer.type === 'SubLayer')) && !this.isPanning) {
14646
+ if (((this.currentLayer.animationDuration > 0 || animationMode === 'Enable') || ((maps.layersCollection[0].animationDuration > 0 || animationMode === 'Enable') && this.currentLayer.type === 'SubLayer')) && !this.isPanning) {
14600
14647
  if (maps.isTileMap) {
14601
14648
  const groupElement = document.querySelector('.GroupElement');
14602
14649
  if (groupElement && !(document.querySelector('.ClusterGroupElement')) && markerAnimation) {
@@ -14657,7 +14704,7 @@ class Zoom {
14657
14704
  const centerY = bubbleCollection['center']['y'];
14658
14705
  const currentX = ((centerX + x) * scale);
14659
14706
  const currentY = ((centerY + y) * scale);
14660
- const duration = this.currentLayer.animationDuration;
14707
+ const duration = this.currentLayer.animationDuration === 0 && animationMode === 'Enable' ? 1000 : this.currentLayer.animationDuration;
14661
14708
  if (!animate$$1 || duration === 0) {
14662
14709
  childElement.setAttribute('transform', 'translate( ' + currentX + ' ' + currentY + ' )');
14663
14710
  }
@@ -14854,7 +14901,7 @@ class Zoom {
14854
14901
  if (element.id.indexOf('_LabelIndex_') > -1) {
14855
14902
  labelIndex = parseFloat(element.id.split('_LabelIndex_')[1].split('_')[0]);
14856
14903
  }
14857
- const duration = this.currentLayer.animationDuration;
14904
+ const duration = this.currentLayer.animationDuration === 0 && animationMode === 'Enable' ? 1000 : this.currentLayer.animationDuration;
14858
14905
  for (let l = 0; l < labelCollection.length; l++) {
14859
14906
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
14860
14907
  const label = labelCollection[l];
@@ -14995,12 +15042,12 @@ class Zoom {
14995
15042
  const lng = (!isNullOrUndefined(marker$$1.longitudeValuePath)) ?
14996
15043
  Number(getValueFromObject(marker$$1.dataSource[dataIndex], marker$$1.longitudeValuePath)) :
14997
15044
  !isNullOrUndefined(marker$$1.dataSource[dataIndex]['longitude']) ? parseFloat(marker$$1.dataSource[dataIndex]['longitude']) :
14998
- !isNullOrUndefined(marker$$1.dataSource[dataIndex]['Latitude']) ? parseFloat(marker$$1.dataSource[dataIndex]['Latitude']) : 0;
15045
+ !isNullOrUndefined(marker$$1.dataSource[dataIndex]['Longitude']) ? parseFloat(marker$$1.dataSource[dataIndex]['Longitude']) : 0;
14999
15046
  const lat = (!isNullOrUndefined(marker$$1.latitudeValuePath)) ?
15000
15047
  Number(getValueFromObject(marker$$1.dataSource[dataIndex], marker$$1.latitudeValuePath)) :
15001
15048
  !isNullOrUndefined(marker$$1.dataSource[dataIndex]['latitude']) ? parseFloat(marker$$1.dataSource[dataIndex]['latitude']) :
15002
15049
  !isNullOrUndefined(marker$$1.dataSource[dataIndex]['Latitude']) ? parseFloat(marker$$1.dataSource[dataIndex]['Latitude']) : 0;
15003
- const duration = this.currentLayer.animationDuration;
15050
+ const duration = this.currentLayer.animationDuration === 0 && animationMode === 'Enable' ? 1000 : this.currentLayer.animationDuration;
15004
15051
  const location = (this.maps.isTileMap) ? convertTileLatLongToPoint(new Point(lng, lat), this.maps.tileZoomLevel, this.maps.tileTranslatePoint, true) : convertGeoToPoint(lat, lng, factor, layer, this.maps);
15005
15052
  if (this.maps.isTileMap) {
15006
15053
  if (type === 'Template') {
@@ -15261,7 +15308,7 @@ class Zoom {
15261
15308
  this.markerLineAnimation(map);
15262
15309
  map.mapLayerPanel.generateTiles(tileZoomFactor, map.tileTranslatePoint, type);
15263
15310
  const element1 = document.getElementById(this.maps.element.id + '_tiles');
15264
- const animationDuration = this.maps.layersCollection[0].animationDuration;
15311
+ const animationDuration = this.maps.layersCollection[0].animationDuration === 0 && animationMode === 'Enable' ? 1000 : this.maps.layersCollection[0].animationDuration;
15265
15312
  setTimeout(() => {
15266
15313
  this.applyTransform(this.maps, true);
15267
15314
  if (document.getElementById(this.maps.element.id + '_LayerIndex_1')) {