@syncfusion/ej2-maps 26.2.10 → 27.1.48

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.
@@ -41,7 +41,10 @@ export { Size };
41
41
  * @private
42
42
  */
43
43
  export function stringToNumber(value, containerSize) {
44
- if (value !== null && value !== undefined) {
44
+ if (typeof value !== 'string') {
45
+ return value;
46
+ }
47
+ if (!isNullOrUndefined(value)) {
45
48
  return value.indexOf('%') !== -1 ? (containerSize / 100) * parseInt(value, 10) : parseInt(value, 10);
46
49
  }
47
50
  return null;
@@ -59,8 +62,10 @@ export function calculateSize(maps) {
59
62
  maps.element.style.setProperty('display', 'block');
60
63
  var containerWidth = maps.element.clientWidth;
61
64
  var containerHeight = maps.element.clientHeight;
62
- var containerElementWidth = stringToNumber(maps.element.style.width, containerWidth);
63
- var containerElementHeight = stringToNumber(maps.element.style.height, containerHeight);
65
+ var containerElementWidth = (typeof maps.element.style.width === 'string') ?
66
+ stringToNumber(maps.element.style.width, containerWidth) : maps.element.style.width;
67
+ var containerElementHeight = (typeof maps.element.style.height === 'string') ?
68
+ stringToNumber(maps.element.style.height, containerHeight) : maps.element.style.height;
64
69
  var availableSize = new Size(0, 0);
65
70
  if (maps.width === '0px' || maps.width === '0%' || maps.height === '0%' || maps.height === '0px') {
66
71
  availableSize = new Size(0, 0);
@@ -153,7 +158,7 @@ export function convertGeoToPoint(latitude, longitude, factor, layer, mapModel)
153
158
  var latitudeMinMax = mapModel.baseMapBounds.latitude;
154
159
  var latRadian = degreesToRadians(latitude);
155
160
  var lngRadian = degreesToRadians(longitude);
156
- var type = mapModel.projectionType;
161
+ var type = !isNullOrUndefined(mapModel.projectionType) ? mapModel.projectionType : 'Mercator';
157
162
  var size = (mapModel.isTileMap) ? Math.pow(2, 1) * 256 : (isNullOrUndefined(factor)) ?
158
163
  Math.min(mapSize.width, mapSize.height) : (Math.min(mapSize.width, mapSize.height) * factor);
159
164
  if (layer.geometryType === 'Normal') {
@@ -941,26 +946,54 @@ export function markerColorChoose(eventArgs, data) {
941
946
  */
942
947
  export function markerShapeChoose(eventArgs, data) {
943
948
  if (!isNullOrUndefined(eventArgs.shapeValuePath) && !isNullOrUndefined(data[eventArgs.shapeValuePath])) {
944
- var shape = ((eventArgs.shapeValuePath.indexOf('.') > -1) ?
945
- (getValueFromObject(data, eventArgs.shapeValuePath).toString()) :
946
- data[eventArgs.shapeValuePath]);
947
- eventArgs.shape = (shape.toString() !== '') ? shape : eventArgs.shape;
949
+ updateShape(eventArgs, data);
948
950
  if (data[eventArgs.shapeValuePath] === 'Image') {
949
- eventArgs.imageUrl = (!isNullOrUndefined(eventArgs.imageUrlValuePath)) ?
950
- ((eventArgs.imageUrlValuePath.indexOf('.') > -1) ? getValueFromObject(data, eventArgs.imageUrlValuePath).toString() : (!isNullOrUndefined(data[eventArgs.imageUrlValuePath]) ?
951
- data[eventArgs.imageUrlValuePath] : eventArgs.imageUrl)) : eventArgs.imageUrl;
951
+ updateImageUrl(eventArgs, data);
952
952
  }
953
953
  }
954
954
  else {
955
- var shapes = (!isNullOrUndefined(eventArgs.shapeValuePath)) ? ((eventArgs.shapeValuePath.indexOf('.') > -1) ? getValueFromObject(data, eventArgs.shapeValuePath).toString() : eventArgs.shape) : eventArgs.shape;
956
- eventArgs.shape = (shapes.toString() !== '') ? shapes : eventArgs.shape;
957
- var shapeImage = (!isNullOrUndefined(eventArgs.imageUrlValuePath)) ?
958
- ((eventArgs.imageUrlValuePath.indexOf('.') > -1) ? getValueFromObject(data, eventArgs.imageUrlValuePath).toString() : (!isNullOrUndefined(data[eventArgs.imageUrlValuePath]) ?
959
- data[eventArgs.imageUrlValuePath] : eventArgs.imageUrl)) : eventArgs.imageUrl;
960
- eventArgs.imageUrl = shapeImage;
955
+ updateShape(eventArgs, data);
956
+ updateImageUrl(eventArgs, data);
961
957
  }
962
958
  return eventArgs;
963
959
  }
960
+ /**
961
+ *
962
+ * @param {any} path - contains a dot, it implies that the desired property is nested within the object.
963
+ * @param {any} data - The data object from which the value is to be retrieved. This can be any object that contains the properties specified in the path.
964
+ * @returns {any} - Returns the value of the property specified in the path.
965
+ * @private
966
+ */
967
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
968
+ function getValue(path, data) {
969
+ return (path.indexOf('.') > -1) ? getValueFromObject(data, path).toString() : data[path];
970
+ }
971
+ /**
972
+ *
973
+ * @param {any} eventArgs - Specifies the event arguments
974
+ * @param {any} data - Specifies the data
975
+ * @private
976
+ */
977
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
978
+ function updateShape(eventArgs, data) {
979
+ if (!isNullOrUndefined(eventArgs.shapeValuePath)) {
980
+ var shape = getValue(eventArgs.shapeValuePath, data);
981
+ eventArgs.shape = (!isNullOrUndefined(shape) && shape.toString() !== '') ? shape : eventArgs.shape;
982
+ }
983
+ }
984
+ /**
985
+ *
986
+ * @param {any} eventArgs - Specifies the event arguments
987
+ * @param {any} data - Specifies the data
988
+ * @private
989
+ */
990
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
991
+ function updateImageUrl(eventArgs, data) {
992
+ if (!isNullOrUndefined(eventArgs.imageUrlValuePath)) {
993
+ var imageUrl = getValue(eventArgs.imageUrlValuePath, data);
994
+ eventArgs.imageUrl = (!isNullOrUndefined(imageUrl)) ? imageUrl : eventArgs.imageUrl;
995
+ }
996
+ }
964
997
  /**
965
998
  *
966
999
  * @param {LayerSettings} currentLayer - Specifies the current layer
@@ -1057,7 +1090,7 @@ export function clusterTemplate(currentLayer, markerTemplate, maps, layerIndex,
1057
1090
  var longitude = (!isNullOrUndefined(markerSetting.longitudeValuePath)) ?
1058
1091
  Number(getValueFromObject(markerData, markerSetting.longitudeValuePath)) :
1059
1092
  !isNullOrUndefined(markerData['longitude']) ? parseFloat(markerData['longitude']) :
1060
- !isNullOrUndefined(markerData['Latitude']) ? parseFloat(markerData['Latitude']) : 0;
1093
+ !isNullOrUndefined(markerData['Longitude']) ? parseFloat(markerData['Longitude']) : 0;
1061
1094
  var latitude = (!isNullOrUndefined(markerSetting.latitudeValuePath)) ?
1062
1095
  Number(getValueFromObject(markerData, markerSetting.latitudeValuePath)) :
1063
1096
  !isNullOrUndefined(markerData['latitude']) ? parseFloat(markerData['latitude']) :
@@ -1389,8 +1422,8 @@ export function marker(eventArgs, markerSettings, markerData, dataIndex, locatio
1389
1422
  };
1390
1423
  removeElement(markerID);
1391
1424
  var ele = drawSymbols(eventArgs.shape, eventArgs.imageUrl, { x: 0, y: 0 }, markerID, shapeCustom, markerCollection, maps);
1392
- var x = (maps.isTileMap ? location.x : (location.x + transPoint.x) * scale) + (!isNullOrUndefined(offset.x) ? offset.x : 0);
1393
- var y = (maps.isTileMap ? location.y : (location.y + transPoint.y) * scale) + (!isNullOrUndefined(offset.y) ? offset.y : 0);
1425
+ var x = (maps.isTileMap ? location.x : (location.x + transPoint.x) * scale) + ((!isNullOrUndefined(offset) && !isNullOrUndefined(offset.x)) ? offset.x : 0);
1426
+ var y = (maps.isTileMap ? location.y : (location.y + transPoint.y) * scale) + ((!isNullOrUndefined(offset) && !isNullOrUndefined(offset.y)) ? offset.y : 0);
1394
1427
  ele.setAttribute('transform', 'translate( ' + x + ' ' + y + ' )');
1395
1428
  maintainSelection(maps.selectedMarkerElementId, maps.markerSelectionClass, ele, 'MarkerselectionMapStyle');
1396
1429
  if (maps.legendSettings.toggleLegendSettings.enable && maps.legendSettings.type === 'Markers') {
@@ -1757,9 +1790,9 @@ export function drawVerticalLine(maps, options, size, location, element) {
1757
1790
  */
1758
1791
  export function drawStar(maps, options, size, location, element) {
1759
1792
  options.d = 'M ' + (location.x + size.width / 3) + ' ' + (location.y + size.height / 2) + ' L ' + (location.x - size.width / 2)
1760
- + ' ' + (location.y - size.height / 6) + ' L ' + (location.x + size.width / 2) + ' ' + (location.y - size.height / 6) + ' L '
1761
- + (location.x - size.width / 3) + ' ' + (location.y + size.height / 2) + ' L ' + location.x + ' ' + (location.y - size.height / 2)
1762
- + ' L ' + (location.x + size.width / 3) + ' ' + (location.y + size.height / 2) + ' Z';
1793
+ + ' ' + (location.y - size.height / 6) + ' L ' + (location.x + size.width / 2) + ' ' + (location.y - size.height / 6)
1794
+ + ' L ' + (location.x - size.width / 3) + ' ' + (location.y + size.height / 2) + ' L ' + location.x + ' ' +
1795
+ (location.y - size.height / 2) + ' L ' + (location.x + size.width / 3) + ' ' + (location.y + size.height / 2) + ' Z';
1763
1796
  return appendShape(maps.renderer.drawPath(options), element);
1764
1797
  }
1765
1798
  /**
@@ -1858,7 +1891,7 @@ export function getFieldData(dataSource, fields) {
1858
1891
  export function checkShapeDataFields(dataSource, properties, dataPath, propertyPath,
1859
1892
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1860
1893
  layer) {
1861
- if (!(isNullOrUndefined(properties)) && !isNullOrUndefined(dataSource)) {
1894
+ if (!(isNullOrUndefined(properties)) && !isNullOrUndefined(dataSource) && !isNullOrUndefined(dataPath)) {
1862
1895
  for (var i = 0; i < dataSource.length; i++) {
1863
1896
  var shapeDataPath = ((dataPath.indexOf('.') > -1) ? getValueFromObject(dataSource[i], dataPath) :
1864
1897
  dataSource[i][dataPath]);
@@ -2192,9 +2225,9 @@ export function getTranslate(mapObject, layer, animate) {
2192
2225
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2193
2226
  var max = !isNullOrUndefined(mapObject.baseMapRectBounds) ? mapObject.baseMapRectBounds['max'] : null;
2194
2227
  var zoomFactor = animate ? 1 : mapObject.mapScaleValue;
2195
- if (isNullOrUndefined(mapObject.currentShapeDataLength)) {
2228
+ if (isNullOrUndefined(mapObject.currentShapeDataLength) && !isNullOrUndefined(layer.shapeData)) {
2196
2229
  mapObject.currentShapeDataLength = !isNullOrUndefined(layer.shapeData['features'])
2197
- ? layer.shapeData['features'].length : layer.shapeData['geometries'].length;
2230
+ ? layer.shapeData['features'].length : !isNullOrUndefined(layer.shapeData['geometries']) ? layer.shapeData['geometries'].length : 0;
2198
2231
  }
2199
2232
  var size = (mapObject.totalRect && mapObject.legendSettings.visible) ? mapObject.totalRect : mapObject.mapAreaRect;
2200
2233
  var availSize = mapObject.availableSize;
@@ -2274,7 +2307,8 @@ export function getTranslate(mapObject, layer, animate) {
2274
2307
  x = size.x + ((-(min['x']))
2275
2308
  + ((size.width / 2) - (mapWidth / 2)));
2276
2309
  }
2277
- else if (mapObject.availableSize.height !== mapObject.heightBeforeRefresh || mapObject.widthBeforeRefresh !== mapObject.availableSize.width) {
2310
+ else if ((mapObject.availableSize.height !== mapObject.heightBeforeRefresh || mapObject.widthBeforeRefresh !== mapObject.availableSize.width)
2311
+ && !isNullOrUndefined(mapObject.translatePoint) && !isNullOrUndefined(mapObject.previousTranslate)) {
2278
2312
  var cscaleFactor = parseFloat(Math.min(size.width / mapWidth, size.height / mapHeight).toFixed(2));
2279
2313
  var cmapWidth = mapWidth;
2280
2314
  cmapWidth *= cscaleFactor;
@@ -2515,6 +2549,16 @@ export function getClientElement(id) {
2515
2549
  return null;
2516
2550
  }
2517
2551
  }
2552
+ /**
2553
+ * Function to return the number value for the string value.
2554
+ *
2555
+ * @param {string | number} marginValue - Specifies the margin value.
2556
+ * @returns {number} - Returns the number value.
2557
+ * @private
2558
+ */
2559
+ export function getProcessedMarginValue(marginValue) {
2560
+ return typeof marginValue === 'string' ? parseFloat(marginValue) : marginValue;
2561
+ }
2518
2562
  /**
2519
2563
  * To apply internalization.
2520
2564
  *
@@ -2703,8 +2747,8 @@ export function createStyle(id, className, eventArgs) {
2703
2747
  id: id
2704
2748
  });
2705
2749
  styleEle.innerText = '.' + className + '{fill:'
2706
- + eventArgs['fill'] + ';' + 'fill-opacity:' + (eventArgs['opacity']).toString() + ';' +
2707
- 'stroke-opacity:' + (eventArgs['border']['opacity']).toString() + ';' +
2750
+ + eventArgs['fill'] + ';' + 'fill-opacity:' + (!isNullOrUndefined(eventArgs['opacity']) ? (eventArgs['opacity']).toString() : '1') + ';' +
2751
+ 'stroke-opacity:' + (!isNullOrUndefined(eventArgs['border']['opacity']) ? (eventArgs['border']['opacity']).toString() : '1') + ';' +
2708
2752
  'stroke-width:' + (eventArgs['border']['width']).toString() + ';' +
2709
2753
  'stroke:' + eventArgs['border']['color'] + ';' + '}';
2710
2754
  return styleEle;
@@ -2723,9 +2767,9 @@ export function customizeStyle(id, className, eventArgs) {
2723
2767
  var styleEle = getElement(id);
2724
2768
  if (!isNullOrUndefined(styleEle)) {
2725
2769
  styleEle.innerText = '.' + className + '{fill:'
2726
- + eventArgs['fill'] + ';' + 'fill-opacity:' + (eventArgs['opacity']).toString() + ';' +
2770
+ + eventArgs['fill'] + ';' + 'fill-opacity:' + (!isNullOrUndefined(eventArgs['opacity']) ? (eventArgs['opacity']).toString() : '1') + ';' +
2727
2771
  'stroke-width:' + (eventArgs['border']['width']).toString() + ';' +
2728
- 'stroke-opacity:' + (eventArgs['border']['opacity']).toString() + ';' +
2772
+ 'stroke-opacity:' + (!isNullOrUndefined(eventArgs['border']['opacity']) ? (eventArgs['border']['opacity']).toString() : '1') + ';' +
2729
2773
  'stroke:' + eventArgs['border']['color'] + '}';
2730
2774
  }
2731
2775
  }
@@ -1 +0,0 @@
1
- hotfix/26.1.35_Vol2