@syncfusion/ej2-maps 19.4.55 → 19.4.56-105067

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 (84) hide show
  1. package/.eslintrc.json +18 -3
  2. package/.github/PULL_REQUEST_TEMPLATE/Bug.md +72 -72
  3. package/.github/PULL_REQUEST_TEMPLATE/Feature.md +49 -49
  4. package/CHANGELOG.md +441 -430
  5. package/README.md +73 -73
  6. package/dist/ej2-maps.umd.min.js +1 -10
  7. package/dist/ej2-maps.umd.min.js.map +1 -1
  8. package/dist/es6/ej2-maps.es2015.js +1205 -644
  9. package/dist/es6/ej2-maps.es2015.js.map +1 -1
  10. package/dist/es6/ej2-maps.es5.js +1243 -683
  11. package/dist/es6/ej2-maps.es5.js.map +1 -1
  12. package/dist/global/ej2-maps.min.js +1 -10
  13. package/dist/global/ej2-maps.min.js.map +1 -1
  14. package/dist/global/index.d.ts +0 -9
  15. package/dist/ts/maps/layers/bing-map.ts +50 -0
  16. package/dist/ts/maps/layers/bubble.ts +290 -0
  17. package/dist/ts/maps/layers/color-mapping.ts +226 -0
  18. package/dist/ts/maps/layers/data-label.ts +418 -0
  19. package/dist/ts/maps/layers/layer-panel.ts +1480 -0
  20. package/dist/ts/maps/layers/legend.ts +2236 -0
  21. package/dist/ts/maps/layers/marker.ts +453 -0
  22. package/dist/ts/maps/layers/navigation-selected-line.ts +167 -0
  23. package/dist/ts/maps/maps.ts +2886 -0
  24. package/dist/ts/maps/model/base.ts +1843 -0
  25. package/dist/ts/maps/model/constants.ts +200 -0
  26. package/dist/ts/maps/model/export-image.ts +178 -0
  27. package/dist/ts/maps/model/export-pdf.ts +170 -0
  28. package/dist/ts/maps/model/interface.ts +823 -0
  29. package/dist/ts/maps/model/print.ts +104 -0
  30. package/dist/ts/maps/model/theme.ts +554 -0
  31. package/dist/ts/maps/user-interaction/annotation.ts +127 -0
  32. package/dist/ts/maps/user-interaction/highlight.ts +233 -0
  33. package/dist/ts/maps/user-interaction/selection.ts +321 -0
  34. package/dist/ts/maps/user-interaction/tooltip.ts +387 -0
  35. package/dist/ts/maps/user-interaction/zoom.ts +1767 -0
  36. package/dist/ts/maps/utils/enum.ts +368 -0
  37. package/dist/ts/maps/utils/helper.ts +3421 -0
  38. package/helper/e2e/index.js +3 -3
  39. package/helper/e2e/maps-helper.js +13 -13
  40. package/license +9 -9
  41. package/package.json +85 -85
  42. package/src/maps/layers/bing-map.d.ts +4 -0
  43. package/src/maps/layers/bing-map.js +16 -3
  44. package/src/maps/layers/bubble.d.ts +1 -2
  45. package/src/maps/layers/bubble.js +7 -12
  46. package/src/maps/layers/data-label.d.ts +1 -4
  47. package/src/maps/layers/data-label.js +32 -35
  48. package/src/maps/layers/layer-panel.d.ts +18 -1
  49. package/src/maps/layers/layer-panel.js +226 -72
  50. package/src/maps/layers/legend.d.ts +5 -2
  51. package/src/maps/layers/legend.js +170 -61
  52. package/src/maps/layers/marker.d.ts +2 -4
  53. package/src/maps/layers/marker.js +49 -48
  54. package/src/maps/layers/navigation-selected-line.d.ts +1 -2
  55. package/src/maps/layers/navigation-selected-line.js +7 -13
  56. package/src/maps/maps-model.d.ts +259 -251
  57. package/src/maps/maps.d.ts +24 -3
  58. package/src/maps/maps.js +164 -97
  59. package/src/maps/model/base-model.d.ts +1025 -1021
  60. package/src/maps/model/base.d.ts +5 -1
  61. package/src/maps/model/base.js +24 -24
  62. package/src/maps/model/constants.d.ts +6 -0
  63. package/src/maps/model/constants.js +6 -0
  64. package/src/maps/model/export-image.d.ts +2 -4
  65. package/src/maps/model/export-image.js +34 -33
  66. package/src/maps/model/export-pdf.d.ts +4 -6
  67. package/src/maps/model/export-pdf.js +31 -32
  68. package/src/maps/model/interface.d.ts +34 -26
  69. package/src/maps/model/print.d.ts +2 -5
  70. package/src/maps/model/print.js +32 -18
  71. package/src/maps/model/theme.js +7 -4
  72. package/src/maps/user-interaction/annotation.d.ts +1 -2
  73. package/src/maps/user-interaction/annotation.js +3 -4
  74. package/src/maps/user-interaction/highlight.d.ts +1 -2
  75. package/src/maps/user-interaction/highlight.js +11 -10
  76. package/src/maps/user-interaction/selection.d.ts +1 -2
  77. package/src/maps/user-interaction/selection.js +42 -19
  78. package/src/maps/user-interaction/tooltip.d.ts +3 -5
  79. package/src/maps/user-interaction/tooltip.js +27 -14
  80. package/src/maps/user-interaction/zoom.d.ts +3 -8
  81. package/src/maps/user-interaction/zoom.js +282 -162
  82. package/src/maps/utils/enum.d.ts +5 -1
  83. package/src/maps/utils/helper.d.ts +9 -1
  84. package/src/maps/utils/helper.js +82 -33
@@ -1333,18 +1333,21 @@ export declare class LayerSettings extends ChildProperty<LayerSettings> {
1333
1333
  * Sets and gets the Bing map type for the layer. If you use shape data with BingMapType without using layer type as Bing,
1334
1334
  * then the map will render based on shape data since default layer type will be set as Geometry.
1335
1335
  *
1336
+ * @deprecated
1336
1337
  * @default Aerial
1337
1338
  */
1338
1339
  bingMapType: BingMapType;
1339
1340
  /**
1340
1341
  * Sets and gets the type of the static maps.
1341
1342
  *
1343
+ * @deprecated
1342
1344
  * @default RoadMap
1343
1345
  */
1344
1346
  staticMapType: StaticMapType;
1345
1347
  /**
1346
1348
  * Sets and gets the key for the tile map layer in maps.
1347
1349
  *
1350
+ * @deprecated
1348
1351
  * @default ''
1349
1352
  */
1350
1353
  key: string;
@@ -1352,13 +1355,14 @@ export declare class LayerSettings extends ChildProperty<LayerSettings> {
1352
1355
  * Sets and gets the type of the layer in maps. If we use layer type with shape data property in layer of the maps
1353
1356
  * then map will render based on the provided layer type.
1354
1357
  *
1358
+ * @deprecated
1355
1359
  * @default Geometry
1356
1360
  */
1357
1361
  layerType: ShapeLayerType;
1358
1362
  /**
1359
1363
  * Sets and gets the template for the map using the url.
1360
1364
  *
1361
- * @default 'https://a.tile.openstreetmap.org/level/tileX/tileY.png'
1365
+ * @default ''
1362
1366
  */
1363
1367
  urlTemplate: string;
1364
1368
  /**
@@ -1,22 +1,22 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- extendStatics(d, b);
10
- function __() { this.constructor = d; }
11
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
- };
13
- })();
14
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
15
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
17
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
18
- return c > 3 && r && Object.defineProperty(target, key, r), r;
19
- };
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ extendStatics(d, b);
10
+ function __() { this.constructor = d; }
11
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
+ };
13
+ })();
14
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
15
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
17
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
18
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
19
+ };
20
20
  /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
21
21
  /**
22
22
  * Maps base document
@@ -525,7 +525,7 @@ var SubTitleSettings = /** @class */ (function (_super) {
525
525
  return _super !== null && _super.apply(this, arguments) || this;
526
526
  }
527
527
  __decorate([
528
- Complex({ size: Theme.mapsSubTitleFont.size, fontWeight: null }, Font)
528
+ Complex({ size: null, fontWeight: null, fontFamily: null }, Font)
529
529
  ], SubTitleSettings.prototype, "textStyle", void 0);
530
530
  __decorate([
531
531
  Property('Center')
@@ -542,7 +542,7 @@ var TitleSettings = /** @class */ (function (_super) {
542
542
  return _super !== null && _super.apply(this, arguments) || this;
543
543
  }
544
544
  __decorate([
545
- Complex({ size: Theme.mapsTitleFont.size, fontWeight: null }, Font)
545
+ Complex({ size: null, fontWeight: null, fontFamily: null }, Font)
546
546
  ], TitleSettings.prototype, "textStyle", void 0);
547
547
  __decorate([
548
548
  Property('Center')
@@ -689,7 +689,7 @@ var LegendSettings = /** @class */ (function (_super) {
689
689
  Property('')
690
690
  ], LegendSettings.prototype, "height", void 0);
691
691
  __decorate([
692
- Complex({}, Font)
692
+ Complex({ fontFamily: null }, Font)
693
693
  ], LegendSettings.prototype, "textStyle", void 0);
694
694
  __decorate([
695
695
  Property(15)
@@ -710,7 +710,7 @@ var LegendSettings = /** @class */ (function (_super) {
710
710
  Complex({}, CommonTitleSettings)
711
711
  ], LegendSettings.prototype, "title", void 0);
712
712
  __decorate([
713
- Complex(Theme.legendTitleFont, Font)
713
+ Complex({ size: Theme.legendTitleFont.size, color: Theme.legendTitleFont.color, fontStyle: Theme.legendTitleFont.fontStyle, fontWeight: Theme.legendTitleFont.fontWeight, fontFamily: null }, Font)
714
714
  ], LegendSettings.prototype, "titleStyle", void 0);
715
715
  __decorate([
716
716
  Property('Bottom')
@@ -978,7 +978,7 @@ var LayerSettings = /** @class */ (function (_super) {
978
978
  Property('Geometry')
979
979
  ], LayerSettings.prototype, "layerType", void 0);
980
980
  __decorate([
981
- Property('https://a.tile.openstreetmap.org/level/tileX/tileY.png')
981
+ Property('')
982
982
  ], LayerSettings.prototype, "urlTemplate", void 0);
983
983
  __decorate([
984
984
  Property(true)
@@ -19,6 +19,12 @@ export declare const loaded: string;
19
19
  * @private
20
20
  */
21
21
  export declare const click: string;
22
+ /**
23
+ * Specifies the maps onclick event name.
24
+ *
25
+ * @private
26
+ */
27
+ export declare const onclick: string;
22
28
  /**
23
29
  * Specifies the maps right click event name.
24
30
  *
@@ -19,6 +19,12 @@ export var loaded = 'loaded';
19
19
  * @private
20
20
  */
21
21
  export var click = 'click';
22
+ /**
23
+ * Specifies the maps onclick event name.
24
+ *
25
+ * @private
26
+ */
27
+ export var onclick = 'onclick';
22
28
  /**
23
29
  * Specifies the maps right click event name.
24
30
  *
@@ -6,7 +6,6 @@ import { ExportType } from '../utils/enum';
6
6
  * @hidden
7
7
  */
8
8
  export declare class ImageExport {
9
- private control;
10
9
  /**
11
10
  * Constructor for Maps
12
11
  *
@@ -22,7 +21,7 @@ export declare class ImageExport {
22
21
  * @returns {Promise<string>} - Returns the promise string.
23
22
  * @private
24
23
  */
25
- export(type: ExportType, fileName: string, allowDownload?: boolean): Promise<string>;
24
+ export(maps: Maps, type: ExportType, fileName: string, allowDownload?: boolean): Promise<string>;
26
25
  /**
27
26
  * Get module name.
28
27
  *
@@ -32,9 +31,8 @@ export declare class ImageExport {
32
31
  /**
33
32
  * To destroy the ImageExport.
34
33
  *
35
- * @param {Maps} maps - Specifies the instance of the maps.
36
34
  * @returns {void}
37
35
  * @private
38
36
  */
39
- destroy(maps: Maps): void;
37
+ destroy(): void;
40
38
  }
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
- import { createElement, Browser } from '@syncfusion/ej2-base';
3
- import { triggerDownload } from '../utils/helper';
2
+ import { createElement, Browser, isNullOrUndefined } from '@syncfusion/ej2-base';
3
+ import { triggerDownload, getElementByID } from '../utils/helper';
4
4
  /**
5
5
  * This module enables the export to Image functionality in Maps control.
6
6
  *
@@ -13,7 +13,6 @@ var ImageExport = /** @class */ (function () {
13
13
  * @param {Maps} control - Specifies the instance of the map
14
14
  */
15
15
  function ImageExport(control) {
16
- this.control = control;
17
16
  }
18
17
  /**
19
18
  * To export the file as image/svg format
@@ -24,32 +23,33 @@ var ImageExport = /** @class */ (function () {
24
23
  * @returns {Promise<string>} - Returns the promise string.
25
24
  * @private
26
25
  */
27
- ImageExport.prototype.export = function (type, fileName, allowDownload) {
28
- var _this = this;
26
+ ImageExport.prototype.export = function (maps, type, fileName, allowDownload) {
29
27
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
28
  var promise = new Promise(function (resolve, reject) {
31
29
  var imageCanvasElement = createElement('canvas', {
32
30
  id: 'ej2-canvas',
33
31
  attrs: {
34
- 'width': _this.control.availableSize.width.toString(),
35
- 'height': _this.control.availableSize.height.toString()
32
+ 'width': maps.availableSize.width.toString(),
33
+ 'height': maps.availableSize.height.toString()
36
34
  }
37
35
  });
38
36
  var isDownload = !(Browser.userAgent.toString().indexOf('HeadlessChrome') > -1);
39
- var toolbarEle = document.getElementById(_this.control.element.id + '_ToolBar');
40
- var svgParent = document.getElementById(_this.control.element.id + '_Tile_SVG_Parent');
37
+ var toolbarEle = document.getElementById(maps.element.id + '_ToolBar');
38
+ var svgParent = document.getElementById(maps.element.id + '_Tile_SVG_Parent');
41
39
  var svgDataElement;
42
- if (!_this.control.isTileMap) {
40
+ var tileSvg;
41
+ var svgObject = getElementByID(maps.element.id + '_svg').cloneNode(true);
42
+ if (!maps.isTileMap) {
43
43
  svgDataElement = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' +
44
- _this.control.svgObject.outerHTML + '</svg>';
44
+ maps.svgObject.outerHTML + '</svg>';
45
45
  }
46
46
  else {
47
- var tileSvg = document.getElementById(_this.control.element.id + '_Tile_SVG');
47
+ tileSvg = getElementByID(maps.element.id + '_Tile_SVG').cloneNode(true);
48
48
  svgDataElement = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' +
49
- _this.control.svgObject.outerHTML + tileSvg.outerHTML + '</svg>';
49
+ svgObject.outerHTML + tileSvg.outerHTML + '</svg>';
50
50
  }
51
51
  var url = window.URL.createObjectURL(new Blob(type === 'SVG' ? [svgDataElement] :
52
- [(new XMLSerializer()).serializeToString(_this.control.svgObject)], { type: 'image/svg+xml' }));
52
+ [(new XMLSerializer()).serializeToString(svgObject)], { type: 'image/svg+xml' }));
53
53
  if (type === 'SVG') {
54
54
  if (allowDownload) {
55
55
  triggerDownload(fileName, type, url, isDownload);
@@ -61,7 +61,7 @@ var ImageExport = /** @class */ (function () {
61
61
  else {
62
62
  var image_1 = new Image();
63
63
  var ctxt_1 = imageCanvasElement.getContext('2d');
64
- if (!_this.control.isTileMap) {
64
+ if (!maps.isTileMap) {
65
65
  image_1.onload = (function () {
66
66
  ctxt_1.drawImage(image_1, 0, 0);
67
67
  window.URL.revokeObjectURL(url);
@@ -80,31 +80,37 @@ var ImageExport = /** @class */ (function () {
80
80
  image_1.src = url;
81
81
  }
82
82
  else {
83
+ var svgParentElement = document.getElementById(maps.element.id + '_MapAreaBorder');
84
+ var top_1 = parseFloat(svgParentElement.getAttribute('y'));
85
+ var left_1 = parseFloat(svgParentElement.getAttribute('x'));
83
86
  var imgxHttp = new XMLHttpRequest();
84
- var imgTileLength_1 = _this.control.mapLayerPanel.tiles.length;
87
+ var imgTileLength_1 = maps.mapLayerPanel.tiles.length;
85
88
  var _loop_1 = function (i) {
86
- var tile = document.getElementById(_this.control.element.id + '_tile_' + (i - 1));
89
+ var tile = document.getElementById(maps.element.id + '_tile_' + (i - 1));
87
90
  var exportTileImg = new Image();
88
91
  exportTileImg.crossOrigin = 'Anonymous';
89
- ctxt_1.fillStyle = _this.control.background ? _this.control.background : '#FFFFFF';
90
- ctxt_1.fillRect(0, 0, _this.control.availableSize.width, _this.control.availableSize.height);
91
- ctxt_1.font = _this.control.titleSettings.textStyle.size + ' Arial';
92
- ctxt_1.fillStyle = document.getElementById(_this.control.element.id + '_Map_title').getAttribute('fill');
93
- ctxt_1.fillText(_this.control.titleSettings.text, parseFloat(document.getElementById(_this.control.element.id + '_Map_title').getAttribute('x')), parseFloat(document.getElementById(_this.control.element.id + '_Map_title').getAttribute('y')));
92
+ ctxt_1.fillStyle = maps.background ? maps.background : '#FFFFFF';
93
+ ctxt_1.fillRect(0, 0, maps.availableSize.width, maps.availableSize.height);
94
+ ctxt_1.font = maps.titleSettings.textStyle.size + ' Arial';
95
+ var titleElement = document.getElementById(maps.element.id + '_Map_title');
96
+ if (!isNullOrUndefined(titleElement)) {
97
+ ctxt_1.fillStyle = titleElement.getAttribute('fill');
98
+ ctxt_1.fillText(maps.titleSettings.text, parseFloat(titleElement.getAttribute('x')), parseFloat(titleElement.getAttribute('y')));
99
+ }
94
100
  exportTileImg.onload = (function () {
95
101
  if (i === 0 || i === imgTileLength_1 + 1) {
96
102
  if (i === 0) {
97
103
  ctxt_1.setTransform(1, 0, 0, 1, 0, 0);
98
- ctxt_1.rect(0, parseFloat(svgParent.style.top), parseFloat(svgParent.style.width), parseFloat(svgParent.style.height));
104
+ ctxt_1.rect(0, top_1, parseFloat(svgParent.style.width), parseFloat(svgParent.style.height));
99
105
  ctxt_1.clip();
100
106
  }
101
107
  else {
102
- ctxt_1.setTransform(1, 0, 0, 1, parseFloat(svgParent.style.left), parseFloat(svgParent.style.top));
108
+ ctxt_1.setTransform(1, 0, 0, 1, left_1, top_1);
103
109
  }
104
110
  }
105
111
  else {
106
- ctxt_1.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) + 10, parseFloat(tile.style.top) +
107
- (parseFloat(document.getElementById(_this.control.element.id + '_tile_parent').style.top)));
112
+ ctxt_1.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) + left_1, parseFloat(tile.style.top) +
113
+ top_1);
108
114
  }
109
115
  ctxt_1.drawImage(exportTileImg, 0, 0);
110
116
  if (i === imgTileLength_1 + 1) {
@@ -130,7 +136,7 @@ var ImageExport = /** @class */ (function () {
130
136
  }
131
137
  else {
132
138
  setTimeout(function () {
133
- exportTileImg.src = window.URL.createObjectURL(new Blob([(new XMLSerializer()).serializeToString(document.getElementById(_this.control.element.id + '_Tile_SVG'))], { type: 'image/svg+xml' }));
139
+ exportTileImg.src = window.URL.createObjectURL(new Blob([(new XMLSerializer()).serializeToString(tileSvg)], { type: 'image/svg+xml' }));
134
140
  }, 300);
135
141
  }
136
142
  }
@@ -159,15 +165,10 @@ var ImageExport = /** @class */ (function () {
159
165
  /**
160
166
  * To destroy the ImageExport.
161
167
  *
162
- * @param {Maps} maps - Specifies the instance of the maps.
163
168
  * @returns {void}
164
169
  * @private
165
170
  */
166
- ImageExport.prototype.destroy = function (maps) {
167
- /**
168
- * Destroy method performed here
169
- */
170
- };
171
+ ImageExport.prototype.destroy = function () { };
171
172
  return ImageExport;
172
173
  }());
173
174
  export { ImageExport };
@@ -7,13 +7,12 @@ import { PdfPageOrientation } from '@syncfusion/ej2-pdf-export';
7
7
  * @hidden
8
8
  */
9
9
  export declare class PdfExport {
10
- private control;
11
10
  /**
12
11
  * Constructor for Maps
13
12
  *
14
13
  * @param {Maps} control Specifies the instance of the map
15
14
  */
16
- constructor(control: Maps);
15
+ constructor();
17
16
  /**
18
17
  * To export the file as image/svg format
19
18
  *
@@ -24,7 +23,7 @@ export declare class PdfExport {
24
23
  * @returns {Promise<string>} - Returns the promise string
25
24
  * @private
26
25
  */
27
- export(type: ExportType, fileName: string, allowDownload?: boolean, orientation?: PdfPageOrientation): Promise<string>;
26
+ export(maps: Maps, type: ExportType, fileName: string, allowDownload?: boolean, orientation?: PdfPageOrientation): Promise<string>;
28
27
  /**
29
28
  * Get module name.
30
29
  *
@@ -32,11 +31,10 @@ export declare class PdfExport {
32
31
  */
33
32
  protected getModuleName(): string;
34
33
  /**
35
- * To destroy the PdfExports.
34
+ * To destroy the PdfExport.
36
35
  *
37
- * @param {Maps} maps - Specifies the instance of the maps.
38
36
  * @returns {void}
39
37
  * @private
40
38
  */
41
- destroy(maps: Maps): void;
39
+ destroy(): void;
42
40
  }
@@ -12,8 +12,7 @@ var PdfExport = /** @class */ (function () {
12
12
  *
13
13
  * @param {Maps} control Specifies the instance of the map
14
14
  */
15
- function PdfExport(control) {
16
- this.control = control;
15
+ function PdfExport() {
17
16
  }
18
17
  /**
19
18
  * To export the file as image/svg format
@@ -25,25 +24,24 @@ var PdfExport = /** @class */ (function () {
25
24
  * @returns {Promise<string>} - Returns the promise string
26
25
  * @private
27
26
  */
28
- PdfExport.prototype.export = function (type, fileName, allowDownload, orientation) {
29
- var _this = this;
27
+ PdfExport.prototype.export = function (maps, type, fileName, allowDownload, orientation) {
30
28
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
29
  var promise = new Promise(function (resolve, reject) {
32
30
  var canvasElement = createElement('canvas', {
33
31
  id: 'ej2-canvas',
34
32
  attrs: {
35
- 'width': _this.control.availableSize.width.toString(),
36
- 'height': _this.control.availableSize.height.toString()
33
+ 'width': maps.availableSize.width.toString(),
34
+ 'height': maps.availableSize.height.toString()
37
35
  }
38
36
  });
39
37
  orientation = isNullOrUndefined(orientation) ? PdfPageOrientation.Landscape : orientation;
40
- var svgParent = document.getElementById(_this.control.element.id + '_Tile_SVG_Parent');
38
+ var svgParent = document.getElementById(maps.element.id + '_Tile_SVG_Parent');
41
39
  var svgData;
42
- var exportElement = _this.control.svgObject.cloneNode(true);
40
+ var exportElement = maps.svgObject.cloneNode(true);
43
41
  var backgroundElement = exportElement.childNodes[0];
44
42
  var backgroundColor = backgroundElement.getAttribute('fill');
45
- if ((_this.control.theme === 'Tailwind' || _this.control.theme === 'TailwindDark' || _this.control.theme === 'Bootstrap5' || _this.control.theme === 'Bootstrap5Dark')
46
- && (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
43
+ if ((maps.theme === 'Tailwind' || maps.theme === 'TailwindDark' || maps.theme === 'Bootstrap5' || maps.theme === 'Bootstrap5Dark'
44
+ || maps.theme === 'Fluent' || maps.theme === 'FluentDark') && (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
47
45
  exportElement.childNodes[0].setAttribute('fill', 'rgba(255,255,255, 1)');
48
46
  }
49
47
  var url = window.URL.createObjectURL(new Blob(type === 'SVG' ? [svgData] :
@@ -51,7 +49,7 @@ var PdfExport = /** @class */ (function () {
51
49
  var pdfDocument = new PdfDocument();
52
50
  var image = new Image();
53
51
  var ctx = canvasElement.getContext('2d');
54
- if (!_this.control.isTileMap) {
52
+ if (!maps.isTileMap) {
55
53
  image.onload = (function () {
56
54
  ctx.drawImage(image, 0, 0);
57
55
  window.URL.revokeObjectURL(url);
@@ -59,7 +57,7 @@ var PdfExport = /** @class */ (function () {
59
57
  var imageString = canvasElement.toDataURL('image/jpeg').replace('image/jpeg', 'image/octet-stream');
60
58
  pdfDocument.pageSettings.orientation = orientation;
61
59
  imageString = imageString.slice(imageString.indexOf(',') + 1);
62
- pdfDocument.pages.add().graphics.drawImage(new PdfBitmap(imageString), 0, 0, (_this.control.availableSize.width - 60), _this.control.availableSize.height);
60
+ pdfDocument.pages.add().graphics.drawImage(new PdfBitmap(imageString), 0, 0, (maps.availableSize.width - 60), maps.availableSize.height);
63
61
  if (allowDownload) {
64
62
  pdfDocument.save(fileName + '.pdf');
65
63
  pdfDocument.destroy();
@@ -72,31 +70,36 @@ var PdfExport = /** @class */ (function () {
72
70
  image.src = url;
73
71
  }
74
72
  else {
73
+ var svgParentElement = document.getElementById(maps.element.id + '_MapAreaBorder');
74
+ var top_1 = parseFloat(svgParentElement.getAttribute('y'));
75
+ var left_1 = parseFloat(svgParentElement.getAttribute('x'));
75
76
  var xHttp = new XMLHttpRequest();
76
- var tileLength_1 = _this.control.mapLayerPanel.tiles.length;
77
+ var tileLength_1 = maps.mapLayerPanel.tiles.length;
77
78
  var _loop_1 = function (i) {
78
- var tile = document.getElementById(_this.control.element.id + '_tile_' + (i - 1));
79
+ var tile = document.getElementById(maps.element.id + '_tile_' + (i - 1));
79
80
  var tileImg = new Image();
80
81
  tileImg.crossOrigin = 'Anonymous';
81
- ctx.fillStyle = _this.control.background ? _this.control.background : '#FFFFFF';
82
- ctx.fillRect(0, 0, _this.control.availableSize.width, _this.control.availableSize.height);
83
- ctx.font = _this.control.titleSettings.textStyle.size + ' Arial';
84
- ctx.fillStyle = document.getElementById(_this.control.element.id + '_Map_title').getAttribute('fill');
85
- ctx.fillText(_this.control.titleSettings.text, parseFloat(document.getElementById(_this.control.element.id + '_Map_title').getAttribute('x')), parseFloat(document.getElementById(_this.control.element.id + '_Map_title').getAttribute('y')));
82
+ ctx.fillStyle = maps.background ? maps.background : '#FFFFFF';
83
+ ctx.fillRect(0, 0, maps.availableSize.width, maps.availableSize.height);
84
+ ctx.font = maps.titleSettings.textStyle.size + ' Arial';
85
+ var titleElement = document.getElementById(maps.element.id + '_Map_title');
86
+ if (!isNullOrUndefined(titleElement)) {
87
+ ctx.fillStyle = titleElement.getAttribute('fill');
88
+ ctx.fillText(maps.titleSettings.text, parseFloat(titleElement.getAttribute('x')), parseFloat(titleElement.getAttribute('y')));
89
+ }
86
90
  tileImg.onload = (function () {
87
91
  if (i === 0 || i === tileLength_1 + 1) {
88
92
  if (i === 0) {
89
93
  ctx.setTransform(1, 0, 0, 1, 0, 0);
90
- ctx.rect(0, parseFloat(svgParent.style.top), parseFloat(svgParent.style.width), parseFloat(svgParent.style.height));
94
+ ctx.rect(0, top_1, parseFloat(svgParent.style.width), parseFloat(svgParent.style.height));
91
95
  ctx.clip();
92
96
  }
93
97
  else {
94
- ctx.setTransform(1, 0, 0, 1, parseFloat(svgParent.style.left), parseFloat(svgParent.style.top));
98
+ ctx.setTransform(1, 0, 0, 1, left_1, top_1);
95
99
  }
96
100
  }
97
101
  else {
98
- ctx.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) + 10, parseFloat(tile.style.top) +
99
- (parseFloat(document.getElementById(_this.control.element.id + '_tile_parent').style.top)));
102
+ ctx.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) + left_1, parseFloat(tile.style.top) + top_1);
100
103
  }
101
104
  ctx.drawImage(tileImg, 0, 0);
102
105
  if (i === tileLength_1 + 1) {
@@ -105,7 +108,7 @@ var PdfExport = /** @class */ (function () {
105
108
  var x = localStorage.getItem('saved-image-example');
106
109
  pdfDocument.pageSettings.orientation = orientation;
107
110
  x = x.slice(x.indexOf(',') + 1);
108
- pdfDocument.pages.add().graphics.drawImage(new PdfBitmap(x), 0, 0, (_this.control.availableSize.width - 60), _this.control.availableSize.height);
111
+ pdfDocument.pages.add().graphics.drawImage(new PdfBitmap(x), 0, 0, (maps.availableSize.width - 60), maps.availableSize.height);
109
112
  if (allowDownload) {
110
113
  pdfDocument.save(fileName + '.pdf');
111
114
  pdfDocument.destroy();
@@ -122,7 +125,8 @@ var PdfExport = /** @class */ (function () {
122
125
  }
123
126
  else {
124
127
  setTimeout(function () {
125
- tileImg.src = window.URL.createObjectURL(new Blob([(new XMLSerializer()).serializeToString(document.getElementById(_this.control.element.id + '_Tile_SVG'))], { type: 'image/svg+xml' }));
128
+ var tileSvg = document.getElementById(maps.element.id + '_Tile_SVG');
129
+ tileImg.src = window.URL.createObjectURL(new Blob([(new XMLSerializer()).serializeToString(tileSvg)], { type: 'image/svg+xml' }));
126
130
  }, 300);
127
131
  }
128
132
  }
@@ -148,17 +152,12 @@ var PdfExport = /** @class */ (function () {
148
152
  return 'PdfExport';
149
153
  };
150
154
  /**
151
- * To destroy the PdfExports.
155
+ * To destroy the PdfExport.
152
156
  *
153
- * @param {Maps} maps - Specifies the instance of the maps.
154
157
  * @returns {void}
155
158
  * @private
156
159
  */
157
- PdfExport.prototype.destroy = function (maps) {
158
- /**
159
- * Destroy method performed here
160
- */
161
- };
160
+ PdfExport.prototype.destroy = function () { };
162
161
  return PdfExport;
163
162
  }());
164
163
  export { PdfExport };