@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
|
@@ -45,13 +45,15 @@ function calculateSize(maps) {
|
|
|
45
45
|
const containerHeight = maps.element.clientHeight;
|
|
46
46
|
const containerElementWidth = stringToNumber(maps.element.style.width, containerWidth);
|
|
47
47
|
const containerElementHeight = stringToNumber(maps.element.style.height, containerHeight);
|
|
48
|
+
let availableSize = new Size(0, 0);
|
|
48
49
|
if (maps.width === '0px' || maps.width === '0%' || maps.height === '0%' || maps.height === '0px') {
|
|
49
|
-
|
|
50
|
+
availableSize = new Size(0, 0);
|
|
50
51
|
}
|
|
51
52
|
else {
|
|
52
|
-
|
|
53
|
+
availableSize = new Size(stringToNumber(maps.width, containerWidth) || containerWidth || containerElementWidth || 600, stringToNumber(maps.height, containerHeight) || containerHeight || containerElementHeight || (maps.isDevice ?
|
|
53
54
|
Math.min(window.innerWidth, window.innerHeight) : 450));
|
|
54
55
|
}
|
|
56
|
+
return availableSize;
|
|
55
57
|
}
|
|
56
58
|
/**
|
|
57
59
|
* Method to create svg for maps.
|
|
@@ -61,7 +63,7 @@ function calculateSize(maps) {
|
|
|
61
63
|
*/
|
|
62
64
|
function createSvg(maps) {
|
|
63
65
|
maps.renderer = new SvgRenderer(maps.element.id);
|
|
64
|
-
calculateSize(maps);
|
|
66
|
+
maps.availableSize = calculateSize(maps);
|
|
65
67
|
maps.svgObject = maps.renderer.createSvg({
|
|
66
68
|
id: maps.element.id + '_svg',
|
|
67
69
|
width: maps.availableSize.width,
|
|
@@ -804,7 +806,7 @@ function markerShapeChoose(eventArgs, data) {
|
|
|
804
806
|
const shape = ((eventArgs.shapeValuePath.indexOf('.') > -1) ?
|
|
805
807
|
(getValueFromObject(data, eventArgs.shapeValuePath).toString()) :
|
|
806
808
|
data[eventArgs.shapeValuePath]);
|
|
807
|
-
eventArgs.shape = shape;
|
|
809
|
+
eventArgs.shape = (shape.toString() !== "") ? shape : eventArgs.shape;
|
|
808
810
|
if (data[eventArgs.shapeValuePath] === 'Image') {
|
|
809
811
|
eventArgs.imageUrl = (!isNullOrUndefined(eventArgs.imageUrlValuePath)) ?
|
|
810
812
|
((eventArgs.imageUrlValuePath.indexOf('.') > -1) ? getValueFromObject(data, eventArgs.imageUrlValuePath).toString() : (!isNullOrUndefined(data[eventArgs.imageUrlValuePath]) ?
|
|
@@ -813,7 +815,7 @@ function markerShapeChoose(eventArgs, data) {
|
|
|
813
815
|
}
|
|
814
816
|
else {
|
|
815
817
|
const shapes = (!isNullOrUndefined(eventArgs.shapeValuePath)) ? ((eventArgs.shapeValuePath.indexOf('.') > -1) ? getValueFromObject(data, eventArgs.shapeValuePath).toString() : eventArgs.shape) : eventArgs.shape;
|
|
816
|
-
eventArgs.shape = shapes;
|
|
818
|
+
eventArgs.shape = (shapes.toString() !== "") ? shapes : eventArgs.shape;
|
|
817
819
|
const shapeImage = (!isNullOrUndefined(eventArgs.imageUrlValuePath)) ?
|
|
818
820
|
((eventArgs.imageUrlValuePath.indexOf('.') > -1) ? getValueFromObject(data, eventArgs.imageUrlValuePath).toString() : (!isNullOrUndefined(data[eventArgs.imageUrlValuePath]) ?
|
|
819
821
|
data[eventArgs.imageUrlValuePath] : eventArgs.imageUrl)) : eventArgs.imageUrl;
|
|
@@ -1376,7 +1378,7 @@ function calculateShapes(maps, shape, options, size, location, markerEle) {
|
|
|
1376
1378
|
let tempGroup;
|
|
1377
1379
|
switch (shape) {
|
|
1378
1380
|
case 'Balloon':
|
|
1379
|
-
tempGroup = drawBalloon(maps, options, size, location, markerEle);
|
|
1381
|
+
tempGroup = drawBalloon(maps, options, size, location, 'Marker', markerEle);
|
|
1380
1382
|
break;
|
|
1381
1383
|
case 'Cross':
|
|
1382
1384
|
options.d = 'M ' + location.x + ' ' + (location.y - size.height / 2) + ' L ' + location.x + ' ' + (location.y + size.height
|
|
@@ -1534,9 +1536,10 @@ function drawStar(maps, options, size, location, element) {
|
|
|
1534
1536
|
* @returns {Element} - Returns the element
|
|
1535
1537
|
* @private
|
|
1536
1538
|
*/
|
|
1537
|
-
function drawBalloon(maps, options, size, location, element) {
|
|
1539
|
+
function drawBalloon(maps, options, size, location, type, element) {
|
|
1538
1540
|
const width = size.width;
|
|
1539
1541
|
const height = size.height;
|
|
1542
|
+
let pathElement;
|
|
1540
1543
|
location.x -= width / 2;
|
|
1541
1544
|
location.y -= height;
|
|
1542
1545
|
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' +
|
|
@@ -1545,9 +1548,15 @@ function drawBalloon(maps, options, size, location, element) {
|
|
|
1545
1548
|
const x = size.width / 30;
|
|
1546
1549
|
const y = size.height / 30;
|
|
1547
1550
|
balloon.setAttribute('transform', 'translate(' + location.x + ', ' + location.y + ') scale(' + x + ', ' + y + ')');
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
+
if (type === 'Marker') {
|
|
1552
|
+
const g = maps.renderer.createGroup({ id: options.id });
|
|
1553
|
+
appendShape(balloon, g);
|
|
1554
|
+
pathElement = appendShape(g, element);
|
|
1555
|
+
}
|
|
1556
|
+
else {
|
|
1557
|
+
pathElement = balloon;
|
|
1558
|
+
}
|
|
1559
|
+
return pathElement;
|
|
1551
1560
|
}
|
|
1552
1561
|
/**
|
|
1553
1562
|
* Internal rendering of Pattern
|
|
@@ -2664,6 +2673,8 @@ function renderLegendShape(location, size, shape, options, url) {
|
|
|
2664
2673
|
const shapeY = location.y;
|
|
2665
2674
|
const x = location.x + (-shapeWidth / 2);
|
|
2666
2675
|
const y = location.y + (-shapeHeight / 2);
|
|
2676
|
+
options['stroke'] = (shape === 'HorizontalLine' || shape === 'VerticalLine' || shape === 'Cross') ? options['fill'] : options['stroke'];
|
|
2677
|
+
options['stroke-width'] = (options['stroke-width'] === 0 && (shape === 'HorizontalLine' || shape === 'VerticalLine' || shape === 'Cross')) ? 1 : options['stroke-width'];
|
|
2667
2678
|
switch (shape) {
|
|
2668
2679
|
case 'Circle':
|
|
2669
2680
|
case 'Bubble':
|
|
@@ -2675,6 +2686,11 @@ function renderLegendShape(location, size, shape, options, url) {
|
|
|
2675
2686
|
+ (shapeY + (-shapeHeight / 2));
|
|
2676
2687
|
merge(options, { 'd': renderPath });
|
|
2677
2688
|
break;
|
|
2689
|
+
case 'HorizontalLine':
|
|
2690
|
+
renderPath = 'M' + ' ' + shapeX + ' ' + shapeY + ' ' + 'L' + ' ' + (shapeX + (shapeWidth / 2)) + ' '
|
|
2691
|
+
+ shapeY;
|
|
2692
|
+
merge(options, { 'd': renderPath });
|
|
2693
|
+
break;
|
|
2678
2694
|
case 'Diamond':
|
|
2679
2695
|
renderPath = 'M' + ' ' + x + ' ' + shapeY + ' ' +
|
|
2680
2696
|
'L' + ' ' + shapeX + ' ' + (shapeY + (-shapeHeight / 2)) + ' ' +
|
|
@@ -4206,6 +4222,9 @@ __decorate$1([
|
|
|
4206
4222
|
*/
|
|
4207
4223
|
class LegendSettings extends ChildProperty {
|
|
4208
4224
|
}
|
|
4225
|
+
__decorate$1([
|
|
4226
|
+
Property(false)
|
|
4227
|
+
], LegendSettings.prototype, "useMarkerShape", void 0);
|
|
4209
4228
|
__decorate$1([
|
|
4210
4229
|
Property(false)
|
|
4211
4230
|
], LegendSettings.prototype, "toggleVisibility", void 0);
|
|
@@ -7167,7 +7186,15 @@ let Maps = class Maps extends Component {
|
|
|
7167
7186
|
}
|
|
7168
7187
|
this.mapLayerPanel.measureLayerPanel();
|
|
7169
7188
|
this.element.appendChild(this.svgObject);
|
|
7189
|
+
const position = this.getExtraPosition();
|
|
7170
7190
|
for (let i = 0; i < this.layers.length; i++) {
|
|
7191
|
+
if (position.x !== 0 || position.y !== 0) {
|
|
7192
|
+
let markerTemplate$$1 = document.getElementById(this.element.id + '_LayerIndex_' + i + '_Markers_Template_Group');
|
|
7193
|
+
if (!isNullOrUndefined(markerTemplate$$1)) {
|
|
7194
|
+
markerTemplate$$1.style.top = this.mapAreaRect.y + position.y + 'px';
|
|
7195
|
+
markerTemplate$$1.style.left = this.mapAreaRect.x + position.x + 'px';
|
|
7196
|
+
}
|
|
7197
|
+
}
|
|
7171
7198
|
if (this.layers[i].selectionSettings && this.layers[i].selectionSettings.enable &&
|
|
7172
7199
|
this.layers[i].initialShapeSelection.length > 0 && this.checkInitialRender) {
|
|
7173
7200
|
const checkSelection = this.layers[i].selectionSettings.enableMultiSelect;
|
|
@@ -7992,24 +8019,26 @@ let Maps = class Maps extends Component {
|
|
|
7992
8019
|
mapsOnResize(e) {
|
|
7993
8020
|
this.isResize = this.isReset = true;
|
|
7994
8021
|
const args = {
|
|
8022
|
+
cancel: false,
|
|
7995
8023
|
name: resize,
|
|
7996
8024
|
previousSize: this.availableSize,
|
|
7997
|
-
currentSize:
|
|
8025
|
+
currentSize: calculateSize(this),
|
|
7998
8026
|
maps: this
|
|
7999
8027
|
};
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
this.
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
|
|
8012
|
-
|
|
8028
|
+
this.trigger(resize, args);
|
|
8029
|
+
if (!args.cancel) {
|
|
8030
|
+
if (this.resizeTo) {
|
|
8031
|
+
clearTimeout(this.resizeTo);
|
|
8032
|
+
}
|
|
8033
|
+
if (!isNullOrUndefined(this.element) && this.element.classList.contains('e-maps')) {
|
|
8034
|
+
this.resizeTo = setTimeout(() => {
|
|
8035
|
+
this.unWireEVents();
|
|
8036
|
+
this.createSVG();
|
|
8037
|
+
this.refreshing = true;
|
|
8038
|
+
this.wireEVents();
|
|
8039
|
+
this.render();
|
|
8040
|
+
}, 500);
|
|
8041
|
+
}
|
|
8013
8042
|
}
|
|
8014
8043
|
return false;
|
|
8015
8044
|
}
|
|
@@ -8593,6 +8622,21 @@ let Maps = class Maps extends Component {
|
|
|
8593
8622
|
});
|
|
8594
8623
|
return isVisible;
|
|
8595
8624
|
}
|
|
8625
|
+
/**
|
|
8626
|
+
* To find space between the secondary element and svg element.
|
|
8627
|
+
*/
|
|
8628
|
+
getExtraPosition() {
|
|
8629
|
+
let top;
|
|
8630
|
+
let left;
|
|
8631
|
+
const svgElement = getElement(this.element.id + '_svg');
|
|
8632
|
+
if (!isNullOrUndefined(svgElement)) {
|
|
8633
|
+
const svgClientRect = svgElement.getClientRects()[0];
|
|
8634
|
+
const mapsClientRect = (getElement(this.element.id + '_Secondary_Element')).getClientRects()[0];
|
|
8635
|
+
top = svgClientRect.top - mapsClientRect.top;
|
|
8636
|
+
left = svgClientRect.left - mapsClientRect.left;
|
|
8637
|
+
}
|
|
8638
|
+
return new Point(left, top);
|
|
8639
|
+
}
|
|
8596
8640
|
/**
|
|
8597
8641
|
* To find marker visibility
|
|
8598
8642
|
*/
|
|
@@ -10197,6 +10241,7 @@ class Legend {
|
|
|
10197
10241
|
const shapeSize = new Size(legend.shapeWidth, legend.shapeHeight);
|
|
10198
10242
|
let textOptions;
|
|
10199
10243
|
const render = map.renderer;
|
|
10244
|
+
let legendShape = legend.shape;
|
|
10200
10245
|
if (page >= 0 && page < this.totalPages.length) {
|
|
10201
10246
|
if (querySelector(this.legendGroup.id, this.maps.element.id)) {
|
|
10202
10247
|
remove(querySelector(this.legendGroup.id, this.maps.element.id));
|
|
@@ -10206,7 +10251,7 @@ class Legend {
|
|
|
10206
10251
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10207
10252
|
const collection = this.totalPages[page]['Collection'][i];
|
|
10208
10253
|
const shapeBorder = collection['shapeBorder'];
|
|
10209
|
-
|
|
10254
|
+
let legendElement = render.createGroup({ id: map.element.id + '_Legend_Index_' + collection['idIndex'] });
|
|
10210
10255
|
let legendText = collection['DisplayText'];
|
|
10211
10256
|
const shape = ((legend.type === 'Markers') ? ((isNullOrUndefined(collection['ImageSrc'])) ?
|
|
10212
10257
|
legend.shape : 'Image') : collection['legendShape']);
|
|
@@ -10232,7 +10277,17 @@ class Legend {
|
|
|
10232
10277
|
if (i === 0) {
|
|
10233
10278
|
this.renderLegendBorder();
|
|
10234
10279
|
}
|
|
10235
|
-
|
|
10280
|
+
if (legend.type === 'Markers' && legend.useMarkerShape) {
|
|
10281
|
+
const legendShapeData = this.legendCollection[collection['idIndex']].data[0];
|
|
10282
|
+
const marker$$1 = map.layers[legendShapeData['layerIndex']].markerSettings[legendShapeData['markerIndex']];
|
|
10283
|
+
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;
|
|
10284
|
+
}
|
|
10285
|
+
if (legendShape === "Balloon") {
|
|
10286
|
+
legendElement.appendChild(drawBalloon(map, renderOptions, shapeSize, { x: shapeLocation.x, y: (shapeLocation.y + 5) }, 'Legend'));
|
|
10287
|
+
}
|
|
10288
|
+
else {
|
|
10289
|
+
legendElement.appendChild(drawSymbol(shapeLocation, legendShape, shapeSize, collection['ImageSrc'], renderOptions));
|
|
10290
|
+
}
|
|
10236
10291
|
const legendRectSize = collection['Rect']['x'] + collection['Rect']['width'];
|
|
10237
10292
|
if (legendRectSize > this.legendBorderRect.width) {
|
|
10238
10293
|
const trimmedText = this.legendTextTrim(this.legendBorderRect.width, legendText, legendTextStyle, legendRectSize);
|
|
@@ -11048,7 +11103,7 @@ class Legend {
|
|
|
11048
11103
|
}
|
|
11049
11104
|
else {
|
|
11050
11105
|
newData.push({ layerIndex: layerIndex, markerIndex: markerIndex, dataIndex: dataIndex, value: legendFill, name: text,
|
|
11051
|
-
shape: !isNullOrUndefined(marker$$1.shapeValuePath) ? data[marker$$1.shapeValuePath] : marker$$1.shape });
|
|
11106
|
+
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) });
|
|
11052
11107
|
this.getOverallLegendItemsCollection(text, legendFill, newData, showLegend);
|
|
11053
11108
|
}
|
|
11054
11109
|
}
|
|
@@ -11414,7 +11469,7 @@ class Legend {
|
|
|
11414
11469
|
shape = this.legendCollection[legendIndex]['data'][i];
|
|
11415
11470
|
mapElement = this.maps.legendSettings.type === 'Bubbles' ? querySelector(this.maps.element.id + '_LayerIndex_' + shape['layerIndex'] +
|
|
11416
11471
|
'_BubbleIndex_' + j + '_dataIndex_' + shape['dataIndex'], this.maps.element.id) : querySelector(this.maps.element.id + '_LayerIndex_' + shape['layerIndex'] +
|
|
11417
|
-
'_MarkerIndex_' +
|
|
11472
|
+
'_MarkerIndex_' + shape['markerIndex'] + '_dataIndex_' + shape['dataIndex'], this.maps.element.id);
|
|
11418
11473
|
if (!isNullOrUndefined(shape['shape']) && shape['shape'] === 'Balloon') {
|
|
11419
11474
|
mapElement = mapElement.children[0];
|
|
11420
11475
|
}
|
|
@@ -11438,6 +11493,9 @@ class Legend {
|
|
|
11438
11493
|
if (targetEle !== null) {
|
|
11439
11494
|
legendShapeId = querySelector(this.maps.element.id + '_Legend_Shape_Index_' + legendIndex, this.maps.element.id);
|
|
11440
11495
|
legendShapeId.setAttribute('fill', '#E5E5E5');
|
|
11496
|
+
if (this.maps.legendSettings.shape === 'HorizontalLine' || this.maps.legendSettings.shape === 'VerticalLine' || this.maps.legendSettings.shape === 'Cross') {
|
|
11497
|
+
legendShapeId.setAttribute('stroke', '#E5E5E5');
|
|
11498
|
+
}
|
|
11441
11499
|
legendTextId = querySelector(this.maps.element.id + '_Legend_Text_Index_' + legendIndex, this.maps.element.id);
|
|
11442
11500
|
legendTextId.setAttribute('fill', '#E5E5E5');
|
|
11443
11501
|
}
|
|
@@ -11452,6 +11510,9 @@ class Legend {
|
|
|
11452
11510
|
if (targetEle !== null) {
|
|
11453
11511
|
legendShapeId = querySelector(this.maps.element.id + '_Legend_Shape_Index_' + legendIndex, this.maps.element.id);
|
|
11454
11512
|
legendShapeId.setAttribute('fill', this.legendCollection[legendIndex]['fill']);
|
|
11513
|
+
if (this.maps.legendSettings.shape === 'HorizontalLine' || this.maps.legendSettings.shape === 'VerticalLine' || this.maps.legendSettings.shape === 'Cross') {
|
|
11514
|
+
legendShapeId.setAttribute('stroke', this.legendCollection[legendIndex]['fill']);
|
|
11515
|
+
}
|
|
11455
11516
|
legendTextId = querySelector(this.maps.element.id + '_Legend_Text_Index_' + legendIndex, this.maps.element.id);
|
|
11456
11517
|
legendTextId.setAttribute('fill', '#757575');
|
|
11457
11518
|
}
|
|
@@ -11536,7 +11597,7 @@ class Legend {
|
|
|
11536
11597
|
targetEle.id.indexOf(this.maps.element.id + '_Legend_Index') !== -1) && this.maps.legendSettings.visible &&
|
|
11537
11598
|
targetEle.id.indexOf('_Text') === -1) {
|
|
11538
11599
|
let LegendInteractive;
|
|
11539
|
-
const legendIndex = parseFloat(targetEle.id.
|
|
11600
|
+
const legendIndex = parseFloat(targetEle.id.split(this.maps.element.id + '_Legend_Index_')[1]);
|
|
11540
11601
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11541
11602
|
let mapdata;
|
|
11542
11603
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|