@syncfusion/ej2-maps 19.4.38 → 19.4.42
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.
- package/CHANGELOG.md +13 -1
- package/README.md +1 -1
- package/dist/ej2-maps.umd.min.js +2 -2
- package/dist/ej2-maps.umd.min.js.map +1 -1
- package/dist/es6/ej2-maps.es2015.js +90 -29
- package/dist/es6/ej2-maps.es2015.js.map +1 -1
- package/dist/es6/ej2-maps.es5.js +89 -28
- package/dist/es6/ej2-maps.es5.js.map +1 -1
- package/dist/global/ej2-maps.min.js +2 -2
- package/dist/global/ej2-maps.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +10 -10
- package/src/maps/layers/legend.js +22 -5
- package/src/maps/maps-model.d.ts +1 -1
- package/src/maps/maps.d.ts +4 -0
- package/src/maps/maps.js +40 -15
- package/src/maps/model/base-model.d.ts +7 -0
- package/src/maps/model/base.d.ts +6 -0
- package/src/maps/model/base.js +3 -0
- package/src/maps/model/interface.d.ts +1 -3
- package/src/maps/utils/enum.d.ts +3 -1
- package/src/maps/utils/helper.d.ts +2 -2
- package/src/maps/utils/helper.js +26 -10
package/dist/es6/ej2-maps.es5.js
CHANGED
|
@@ -59,13 +59,15 @@ function calculateSize(maps) {
|
|
|
59
59
|
var containerHeight = maps.element.clientHeight;
|
|
60
60
|
var containerElementWidth = stringToNumber(maps.element.style.width, containerWidth);
|
|
61
61
|
var containerElementHeight = stringToNumber(maps.element.style.height, containerHeight);
|
|
62
|
+
var availableSize = new Size(0, 0);
|
|
62
63
|
if (maps.width === '0px' || maps.width === '0%' || maps.height === '0%' || maps.height === '0px') {
|
|
63
|
-
|
|
64
|
+
availableSize = new Size(0, 0);
|
|
64
65
|
}
|
|
65
66
|
else {
|
|
66
|
-
|
|
67
|
+
availableSize = new Size(stringToNumber(maps.width, containerWidth) || containerWidth || containerElementWidth || 600, stringToNumber(maps.height, containerHeight) || containerHeight || containerElementHeight || (maps.isDevice ?
|
|
67
68
|
Math.min(window.innerWidth, window.innerHeight) : 450));
|
|
68
69
|
}
|
|
70
|
+
return availableSize;
|
|
69
71
|
}
|
|
70
72
|
/**
|
|
71
73
|
* Method to create svg for maps.
|
|
@@ -75,7 +77,7 @@ function calculateSize(maps) {
|
|
|
75
77
|
*/
|
|
76
78
|
function createSvg(maps) {
|
|
77
79
|
maps.renderer = new SvgRenderer(maps.element.id);
|
|
78
|
-
calculateSize(maps);
|
|
80
|
+
maps.availableSize = calculateSize(maps);
|
|
79
81
|
maps.svgObject = maps.renderer.createSvg({
|
|
80
82
|
id: maps.element.id + '_svg',
|
|
81
83
|
width: maps.availableSize.width,
|
|
@@ -857,7 +859,7 @@ function markerShapeChoose(eventArgs, data) {
|
|
|
857
859
|
var shape = ((eventArgs.shapeValuePath.indexOf('.') > -1) ?
|
|
858
860
|
(getValueFromObject(data, eventArgs.shapeValuePath).toString()) :
|
|
859
861
|
data[eventArgs.shapeValuePath]);
|
|
860
|
-
eventArgs.shape = shape;
|
|
862
|
+
eventArgs.shape = (shape.toString() !== "") ? shape : eventArgs.shape;
|
|
861
863
|
if (data[eventArgs.shapeValuePath] === 'Image') {
|
|
862
864
|
eventArgs.imageUrl = (!isNullOrUndefined(eventArgs.imageUrlValuePath)) ?
|
|
863
865
|
((eventArgs.imageUrlValuePath.indexOf('.') > -1) ? getValueFromObject(data, eventArgs.imageUrlValuePath).toString() : (!isNullOrUndefined(data[eventArgs.imageUrlValuePath]) ?
|
|
@@ -866,7 +868,7 @@ function markerShapeChoose(eventArgs, data) {
|
|
|
866
868
|
}
|
|
867
869
|
else {
|
|
868
870
|
var shapes = (!isNullOrUndefined(eventArgs.shapeValuePath)) ? ((eventArgs.shapeValuePath.indexOf('.') > -1) ? getValueFromObject(data, eventArgs.shapeValuePath).toString() : eventArgs.shape) : eventArgs.shape;
|
|
869
|
-
eventArgs.shape = shapes;
|
|
871
|
+
eventArgs.shape = (shapes.toString() !== "") ? shapes : eventArgs.shape;
|
|
870
872
|
var shapeImage = (!isNullOrUndefined(eventArgs.imageUrlValuePath)) ?
|
|
871
873
|
((eventArgs.imageUrlValuePath.indexOf('.') > -1) ? getValueFromObject(data, eventArgs.imageUrlValuePath).toString() : (!isNullOrUndefined(data[eventArgs.imageUrlValuePath]) ?
|
|
872
874
|
data[eventArgs.imageUrlValuePath] : eventArgs.imageUrl)) : eventArgs.imageUrl;
|
|
@@ -1429,7 +1431,7 @@ function calculateShapes(maps, shape, options, size, location, markerEle) {
|
|
|
1429
1431
|
var tempGroup;
|
|
1430
1432
|
switch (shape) {
|
|
1431
1433
|
case 'Balloon':
|
|
1432
|
-
tempGroup = drawBalloon(maps, options, size, location, markerEle);
|
|
1434
|
+
tempGroup = drawBalloon(maps, options, size, location, 'Marker', markerEle);
|
|
1433
1435
|
break;
|
|
1434
1436
|
case 'Cross':
|
|
1435
1437
|
options.d = 'M ' + location.x + ' ' + (location.y - size.height / 2) + ' L ' + location.x + ' ' + (location.y + size.height
|
|
@@ -1587,9 +1589,10 @@ function drawStar(maps, options, size, location, element) {
|
|
|
1587
1589
|
* @returns {Element} - Returns the element
|
|
1588
1590
|
* @private
|
|
1589
1591
|
*/
|
|
1590
|
-
function drawBalloon(maps, options, size, location, element) {
|
|
1592
|
+
function drawBalloon(maps, options, size, location, type, element) {
|
|
1591
1593
|
var width = size.width;
|
|
1592
1594
|
var height = size.height;
|
|
1595
|
+
var pathElement;
|
|
1593
1596
|
location.x -= width / 2;
|
|
1594
1597
|
location.y -= height;
|
|
1595
1598
|
options.d = 'M15,0C8.8,0,3.8,5,3.8,11.2C3.8,17.5,9.4,24.4,15,30c5.6-5.6,11.2-12.5,11.2-18.8C26.2,5,21.2,0,15,0z M15,16' +
|
|
@@ -1598,9 +1601,15 @@ function drawBalloon(maps, options, size, location, element) {
|
|
|
1598
1601
|
var x = size.width / 30;
|
|
1599
1602
|
var y = size.height / 30;
|
|
1600
1603
|
balloon.setAttribute('transform', 'translate(' + location.x + ', ' + location.y + ') scale(' + x + ', ' + y + ')');
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
+
if (type === 'Marker') {
|
|
1605
|
+
var g = maps.renderer.createGroup({ id: options.id });
|
|
1606
|
+
appendShape(balloon, g);
|
|
1607
|
+
pathElement = appendShape(g, element);
|
|
1608
|
+
}
|
|
1609
|
+
else {
|
|
1610
|
+
pathElement = balloon;
|
|
1611
|
+
}
|
|
1612
|
+
return pathElement;
|
|
1604
1613
|
}
|
|
1605
1614
|
/**
|
|
1606
1615
|
* Internal rendering of Pattern
|
|
@@ -2721,6 +2730,8 @@ function renderLegendShape(location, size, shape, options, url) {
|
|
|
2721
2730
|
var shapeY = location.y;
|
|
2722
2731
|
var x = location.x + (-shapeWidth / 2);
|
|
2723
2732
|
var y = location.y + (-shapeHeight / 2);
|
|
2733
|
+
options['stroke'] = (shape === 'HorizontalLine' || shape === 'VerticalLine' || shape === 'Cross') ? options['fill'] : options['stroke'];
|
|
2734
|
+
options['stroke-width'] = (options['stroke-width'] === 0 && (shape === 'HorizontalLine' || shape === 'VerticalLine' || shape === 'Cross')) ? 1 : options['stroke-width'];
|
|
2724
2735
|
switch (shape) {
|
|
2725
2736
|
case 'Circle':
|
|
2726
2737
|
case 'Bubble':
|
|
@@ -2732,6 +2743,11 @@ function renderLegendShape(location, size, shape, options, url) {
|
|
|
2732
2743
|
+ (shapeY + (-shapeHeight / 2));
|
|
2733
2744
|
merge(options, { 'd': renderPath });
|
|
2734
2745
|
break;
|
|
2746
|
+
case 'HorizontalLine':
|
|
2747
|
+
renderPath = 'M' + ' ' + shapeX + ' ' + shapeY + ' ' + 'L' + ' ' + (shapeX + (shapeWidth / 2)) + ' '
|
|
2748
|
+
+ shapeY;
|
|
2749
|
+
merge(options, { 'd': renderPath });
|
|
2750
|
+
break;
|
|
2735
2751
|
case 'Diamond':
|
|
2736
2752
|
renderPath = 'M' + ' ' + x + ' ' + shapeY + ' ' +
|
|
2737
2753
|
'L' + ' ' + shapeX + ' ' + (shapeY + (-shapeHeight / 2)) + ' ' +
|
|
@@ -4391,6 +4407,9 @@ var LegendSettings = /** @__PURE__ @class */ (function (_super) {
|
|
|
4391
4407
|
function LegendSettings() {
|
|
4392
4408
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
4393
4409
|
}
|
|
4410
|
+
__decorate$1([
|
|
4411
|
+
Property(false)
|
|
4412
|
+
], LegendSettings.prototype, "useMarkerShape", void 0);
|
|
4394
4413
|
__decorate$1([
|
|
4395
4414
|
Property(false)
|
|
4396
4415
|
], LegendSettings.prototype, "toggleVisibility", void 0);
|
|
@@ -7446,7 +7465,15 @@ var Maps = /** @__PURE__ @class */ (function (_super) {
|
|
|
7446
7465
|
}
|
|
7447
7466
|
this.mapLayerPanel.measureLayerPanel();
|
|
7448
7467
|
this.element.appendChild(this.svgObject);
|
|
7468
|
+
var position = this.getExtraPosition();
|
|
7449
7469
|
for (var i = 0; i < this.layers.length; i++) {
|
|
7470
|
+
if (position.x !== 0 || position.y !== 0) {
|
|
7471
|
+
var markerTemplate$$1 = document.getElementById(this.element.id + '_LayerIndex_' + i + '_Markers_Template_Group');
|
|
7472
|
+
if (!isNullOrUndefined(markerTemplate$$1)) {
|
|
7473
|
+
markerTemplate$$1.style.top = this.mapAreaRect.y + position.y + 'px';
|
|
7474
|
+
markerTemplate$$1.style.left = this.mapAreaRect.x + position.x + 'px';
|
|
7475
|
+
}
|
|
7476
|
+
}
|
|
7450
7477
|
if (this.layers[i].selectionSettings && this.layers[i].selectionSettings.enable &&
|
|
7451
7478
|
this.layers[i].initialShapeSelection.length > 0 && this.checkInitialRender) {
|
|
7452
7479
|
var checkSelection = this.layers[i].selectionSettings.enableMultiSelect;
|
|
@@ -8274,24 +8301,26 @@ var Maps = /** @__PURE__ @class */ (function (_super) {
|
|
|
8274
8301
|
var _this = this;
|
|
8275
8302
|
this.isResize = this.isReset = true;
|
|
8276
8303
|
var args = {
|
|
8304
|
+
cancel: false,
|
|
8277
8305
|
name: resize,
|
|
8278
8306
|
previousSize: this.availableSize,
|
|
8279
|
-
currentSize:
|
|
8307
|
+
currentSize: calculateSize(this),
|
|
8280
8308
|
maps: this
|
|
8281
8309
|
};
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
|
|
8286
|
-
|
|
8287
|
-
|
|
8288
|
-
|
|
8289
|
-
|
|
8290
|
-
|
|
8291
|
-
|
|
8292
|
-
|
|
8293
|
-
|
|
8294
|
-
|
|
8310
|
+
this.trigger(resize, args);
|
|
8311
|
+
if (!args.cancel) {
|
|
8312
|
+
if (this.resizeTo) {
|
|
8313
|
+
clearTimeout(this.resizeTo);
|
|
8314
|
+
}
|
|
8315
|
+
if (!isNullOrUndefined(this.element) && this.element.classList.contains('e-maps')) {
|
|
8316
|
+
this.resizeTo = setTimeout(function () {
|
|
8317
|
+
_this.unWireEVents();
|
|
8318
|
+
_this.createSVG();
|
|
8319
|
+
_this.refreshing = true;
|
|
8320
|
+
_this.wireEVents();
|
|
8321
|
+
_this.render();
|
|
8322
|
+
}, 500);
|
|
8323
|
+
}
|
|
8295
8324
|
}
|
|
8296
8325
|
return false;
|
|
8297
8326
|
};
|
|
@@ -8879,6 +8908,21 @@ var Maps = /** @__PURE__ @class */ (function (_super) {
|
|
|
8879
8908
|
});
|
|
8880
8909
|
return isVisible;
|
|
8881
8910
|
};
|
|
8911
|
+
/**
|
|
8912
|
+
* To find space between the secondary element and svg element.
|
|
8913
|
+
*/
|
|
8914
|
+
Maps.prototype.getExtraPosition = function () {
|
|
8915
|
+
var top;
|
|
8916
|
+
var left;
|
|
8917
|
+
var svgElement = getElement(this.element.id + '_svg');
|
|
8918
|
+
if (!isNullOrUndefined(svgElement)) {
|
|
8919
|
+
var svgClientRect = svgElement.getClientRects()[0];
|
|
8920
|
+
var mapsClientRect = (getElement(this.element.id + '_Secondary_Element')).getClientRects()[0];
|
|
8921
|
+
top = svgClientRect.top - mapsClientRect.top;
|
|
8922
|
+
left = svgClientRect.left - mapsClientRect.left;
|
|
8923
|
+
}
|
|
8924
|
+
return new Point(left, top);
|
|
8925
|
+
};
|
|
8882
8926
|
/**
|
|
8883
8927
|
* To find marker visibility
|
|
8884
8928
|
*/
|
|
@@ -10503,6 +10547,7 @@ var Legend = /** @__PURE__ @class */ (function () {
|
|
|
10503
10547
|
var shapeSize = new Size(legend.shapeWidth, legend.shapeHeight);
|
|
10504
10548
|
var textOptions;
|
|
10505
10549
|
var render = map.renderer;
|
|
10550
|
+
var legendShape = legend.shape;
|
|
10506
10551
|
if (page >= 0 && page < this.totalPages.length) {
|
|
10507
10552
|
if (querySelector(this.legendGroup.id, this.maps.element.id)) {
|
|
10508
10553
|
remove(querySelector(this.legendGroup.id, this.maps.element.id));
|
|
@@ -10538,7 +10583,17 @@ var Legend = /** @__PURE__ @class */ (function () {
|
|
|
10538
10583
|
if (i === 0) {
|
|
10539
10584
|
this.renderLegendBorder();
|
|
10540
10585
|
}
|
|
10541
|
-
|
|
10586
|
+
if (legend.type === 'Markers' && legend.useMarkerShape) {
|
|
10587
|
+
var legendShapeData = this.legendCollection[collection['idIndex']].data[0];
|
|
10588
|
+
var marker$$1 = map.layers[legendShapeData['layerIndex']].markerSettings[legendShapeData['markerIndex']];
|
|
10589
|
+
legendShape = !isNullOrUndefined(marker$$1.dataSource[legendShapeData['dataIndex']][marker$$1['shapeValuePath']]) && marker$$1.dataSource[legendShapeData['dataIndex']][marker$$1['shapeValuePath']] !== '' ? marker$$1.dataSource[legendShapeData['dataIndex']][marker$$1['shapeValuePath']] : marker$$1.shape;
|
|
10590
|
+
}
|
|
10591
|
+
if (legendShape === "Balloon") {
|
|
10592
|
+
legendElement.appendChild(drawBalloon(map, renderOptions_1, shapeSize, { x: shapeLocation.x, y: (shapeLocation.y + 5) }, 'Legend'));
|
|
10593
|
+
}
|
|
10594
|
+
else {
|
|
10595
|
+
legendElement.appendChild(drawSymbol(shapeLocation, legendShape, shapeSize, collection['ImageSrc'], renderOptions_1));
|
|
10596
|
+
}
|
|
10542
10597
|
var legendRectSize = collection['Rect']['x'] + collection['Rect']['width'];
|
|
10543
10598
|
if (legendRectSize > this.legendBorderRect.width) {
|
|
10544
10599
|
var trimmedText = this.legendTextTrim(this.legendBorderRect.width, legendText, legendTextStyle, legendRectSize);
|
|
@@ -11355,7 +11410,7 @@ var Legend = /** @__PURE__ @class */ (function () {
|
|
|
11355
11410
|
}
|
|
11356
11411
|
else {
|
|
11357
11412
|
newData.push({ layerIndex: layerIndex, markerIndex: markerIndex, dataIndex: dataIndex, value: legendFill, name: text,
|
|
11358
|
-
shape: !isNullOrUndefined(marker$$1.shapeValuePath) ? data[marker$$1.shapeValuePath] : marker$$1.shape });
|
|
11413
|
+
shape: (!isNullOrUndefined(marker$$1.shapeValuePath) && !isNullOrUndefined(data[marker$$1.shapeValuePath]) && data[marker$$1.shapeValuePath] !== '') ? data[marker$$1.shapeValuePath] : (_this.maps.legendSettings.useMarkerShape ? marker$$1.shape : _this.maps.legendSettings.shape) });
|
|
11359
11414
|
_this.getOverallLegendItemsCollection(text, legendFill, newData, showLegend);
|
|
11360
11415
|
}
|
|
11361
11416
|
}
|
|
@@ -11735,7 +11790,7 @@ var Legend = /** @__PURE__ @class */ (function () {
|
|
|
11735
11790
|
shape = this.legendCollection[legendIndex]['data'][i];
|
|
11736
11791
|
mapElement = this.maps.legendSettings.type === 'Bubbles' ? querySelector(this.maps.element.id + '_LayerIndex_' + shape['layerIndex'] +
|
|
11737
11792
|
'_BubbleIndex_' + j + '_dataIndex_' + shape['dataIndex'], this.maps.element.id) : querySelector(this.maps.element.id + '_LayerIndex_' + shape['layerIndex'] +
|
|
11738
|
-
'_MarkerIndex_' +
|
|
11793
|
+
'_MarkerIndex_' + shape['markerIndex'] + '_dataIndex_' + shape['dataIndex'], this.maps.element.id);
|
|
11739
11794
|
if (!isNullOrUndefined(shape['shape']) && shape['shape'] === 'Balloon') {
|
|
11740
11795
|
mapElement = mapElement.children[0];
|
|
11741
11796
|
}
|
|
@@ -11759,6 +11814,9 @@ var Legend = /** @__PURE__ @class */ (function () {
|
|
|
11759
11814
|
if (targetEle !== null) {
|
|
11760
11815
|
legendShapeId = querySelector(this.maps.element.id + '_Legend_Shape_Index_' + legendIndex, this.maps.element.id);
|
|
11761
11816
|
legendShapeId.setAttribute('fill', '#E5E5E5');
|
|
11817
|
+
if (this.maps.legendSettings.shape === 'HorizontalLine' || this.maps.legendSettings.shape === 'VerticalLine' || this.maps.legendSettings.shape === 'Cross') {
|
|
11818
|
+
legendShapeId.setAttribute('stroke', '#E5E5E5');
|
|
11819
|
+
}
|
|
11762
11820
|
legendTextId = querySelector(this.maps.element.id + '_Legend_Text_Index_' + legendIndex, this.maps.element.id);
|
|
11763
11821
|
legendTextId.setAttribute('fill', '#E5E5E5');
|
|
11764
11822
|
}
|
|
@@ -11773,6 +11831,9 @@ var Legend = /** @__PURE__ @class */ (function () {
|
|
|
11773
11831
|
if (targetEle !== null) {
|
|
11774
11832
|
legendShapeId = querySelector(this.maps.element.id + '_Legend_Shape_Index_' + legendIndex, this.maps.element.id);
|
|
11775
11833
|
legendShapeId.setAttribute('fill', this.legendCollection[legendIndex]['fill']);
|
|
11834
|
+
if (this.maps.legendSettings.shape === 'HorizontalLine' || this.maps.legendSettings.shape === 'VerticalLine' || this.maps.legendSettings.shape === 'Cross') {
|
|
11835
|
+
legendShapeId.setAttribute('stroke', this.legendCollection[legendIndex]['fill']);
|
|
11836
|
+
}
|
|
11776
11837
|
legendTextId = querySelector(this.maps.element.id + '_Legend_Text_Index_' + legendIndex, this.maps.element.id);
|
|
11777
11838
|
legendTextId.setAttribute('fill', '#757575');
|
|
11778
11839
|
}
|
|
@@ -11857,7 +11918,7 @@ var Legend = /** @__PURE__ @class */ (function () {
|
|
|
11857
11918
|
targetEle.id.indexOf(this.maps.element.id + '_Legend_Index') !== -1) && this.maps.legendSettings.visible &&
|
|
11858
11919
|
targetEle.id.indexOf('_Text') === -1) {
|
|
11859
11920
|
var LegendInteractive = void 0;
|
|
11860
|
-
var legendIndex = parseFloat(targetEle.id.
|
|
11921
|
+
var legendIndex = parseFloat(targetEle.id.split(this.maps.element.id + '_Legend_Index_')[1]);
|
|
11861
11922
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11862
11923
|
var mapdata = void 0;
|
|
11863
11924
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|