@syncfusion/ej2-maps 31.2.2 → 32.1.19
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/.gitleaksignore +8 -8
- package/README.md +11 -2
- package/aceconfig.js +17 -0
- package/dist/ej2-maps.min.js +1 -10
- package/dist/ej2-maps.umd.min.js +1 -10
- package/dist/ej2-maps.umd.min.js.map +1 -1
- package/dist/es6/ej2-maps.es2015.js +87 -50
- package/dist/es6/ej2-maps.es2015.js.map +1 -1
- package/dist/es6/ej2-maps.es5.js +90 -53
- package/dist/es6/ej2-maps.es5.js.map +1 -1
- package/dist/global/ej2-maps.min.js +1 -10
- package/dist/global/ej2-maps.min.js.map +1 -1
- package/dist/global/index.d.ts +0 -9
- package/package.json +18 -53
- package/src/maps/layers/layer-panel.js +89 -52
- package/dist/ts/index.d.ts +0 -4
- package/dist/ts/index.ts +0 -4
- package/dist/ts/maps/index.d.ts +0 -28
- package/dist/ts/maps/index.ts +0 -28
- package/dist/ts/maps/layers/bing-map.d.ts +0 -21
- package/dist/ts/maps/layers/bing-map.ts +0 -51
- package/dist/ts/maps/layers/bubble.d.ts +0 -77
- package/dist/ts/maps/layers/bubble.ts +0 -304
- package/dist/ts/maps/layers/color-mapping.d.ts +0 -36
- package/dist/ts/maps/layers/color-mapping.ts +0 -230
- package/dist/ts/maps/layers/data-label.d.ts +0 -45
- package/dist/ts/maps/layers/data-label.ts +0 -457
- package/dist/ts/maps/layers/layer-panel.d.ts +0 -144
- package/dist/ts/maps/layers/layer-panel.ts +0 -1455
- package/dist/ts/maps/layers/legend.d.ts +0 -173
- package/dist/ts/maps/layers/legend.ts +0 -2465
- package/dist/ts/maps/layers/marker.d.ts +0 -105
- package/dist/ts/maps/layers/marker.ts +0 -632
- package/dist/ts/maps/layers/navigation-selected-line.d.ts +0 -33
- package/dist/ts/maps/layers/navigation-selected-line.ts +0 -171
- package/dist/ts/maps/layers/polygon.d.ts +0 -30
- package/dist/ts/maps/layers/polygon.ts +0 -68
- package/dist/ts/maps/maps-model.d.ts +0 -409
- package/dist/ts/maps/maps.d.ts +0 -1247
- package/dist/ts/maps/maps.ts +0 -3416
- package/dist/ts/maps/model/base-model.d.ts +0 -2107
- package/dist/ts/maps/model/base.d.ts +0 -1840
- package/dist/ts/maps/model/base.ts +0 -2257
- package/dist/ts/maps/model/constants.d.ts +0 -225
- package/dist/ts/maps/model/constants.ts +0 -226
- package/dist/ts/maps/model/export-image.d.ts +0 -39
- package/dist/ts/maps/model/export-image.ts +0 -194
- package/dist/ts/maps/model/export-pdf.d.ts +0 -40
- package/dist/ts/maps/model/export-pdf.ts +0 -183
- package/dist/ts/maps/model/interface.d.ts +0 -892
- package/dist/ts/maps/model/interface.ts +0 -929
- package/dist/ts/maps/model/print.d.ts +0 -45
- package/dist/ts/maps/model/print.ts +0 -125
- package/dist/ts/maps/model/theme.d.ts +0 -98
- package/dist/ts/maps/model/theme.ts +0 -919
- package/dist/ts/maps/user-interaction/annotation.d.ts +0 -27
- package/dist/ts/maps/user-interaction/annotation.ts +0 -133
- package/dist/ts/maps/user-interaction/highlight.d.ts +0 -63
- package/dist/ts/maps/user-interaction/highlight.ts +0 -272
- package/dist/ts/maps/user-interaction/selection.d.ts +0 -85
- package/dist/ts/maps/user-interaction/selection.ts +0 -342
- package/dist/ts/maps/user-interaction/tooltip.d.ts +0 -78
- package/dist/ts/maps/user-interaction/tooltip.ts +0 -500
- package/dist/ts/maps/user-interaction/zoom.d.ts +0 -334
- package/dist/ts/maps/user-interaction/zoom.ts +0 -2523
- package/dist/ts/maps/utils/enum.d.ts +0 -328
- package/dist/ts/maps/utils/enum.ts +0 -343
- package/dist/ts/maps/utils/helper.d.ts +0 -1318
- package/dist/ts/maps/utils/helper.ts +0 -3811
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Maps } from '../../index';
|
|
2
|
-
import { ExportType } from '../utils/enum';
|
|
3
|
-
import { PdfPageOrientation } from '@syncfusion/ej2-pdf-export';
|
|
4
|
-
/**
|
|
5
|
-
* This module enables the export to PDF functionality in maps.
|
|
6
|
-
*
|
|
7
|
-
* @hidden
|
|
8
|
-
*/
|
|
9
|
-
export declare class PdfExport {
|
|
10
|
-
/**
|
|
11
|
-
* Constructor for Maps
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
|
-
constructor();
|
|
15
|
-
/**
|
|
16
|
-
* To export the file as image/svg format
|
|
17
|
-
*
|
|
18
|
-
* @param {Maps} maps - Specifies the Maps instance.
|
|
19
|
-
* @param {ExportType} type - Specifies the type of the document.
|
|
20
|
-
* @param {string} fileName - Specifies the name of the PDF document.
|
|
21
|
-
* @param {boolean} allowDownload - Specifies whether to download the document or not.
|
|
22
|
-
* @param {PdfPageOrientation} orientation - Specifies the orientation of the PDF document to export the maps.
|
|
23
|
-
* @returns {Promise<string>} - Returns "null" value when the allowDownload is set to false.
|
|
24
|
-
* @private
|
|
25
|
-
*/
|
|
26
|
-
export(maps: Maps, type: ExportType, fileName: string, allowDownload?: boolean, orientation?: PdfPageOrientation): Promise<string>;
|
|
27
|
-
/**
|
|
28
|
-
* Get module name.
|
|
29
|
-
*
|
|
30
|
-
* @returns {string} - Returns the module name
|
|
31
|
-
*/
|
|
32
|
-
protected getModuleName(): string;
|
|
33
|
-
/**
|
|
34
|
-
* To destroy the PdfExport.
|
|
35
|
-
*
|
|
36
|
-
* @returns {void}
|
|
37
|
-
* @private
|
|
38
|
-
*/
|
|
39
|
-
destroy(): void;
|
|
40
|
-
}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { createElement, isNullOrUndefined} from '@syncfusion/ej2-base';
|
|
2
|
-
import { Maps } from '../../index';
|
|
3
|
-
import { ExportType } from '../utils/enum';
|
|
4
|
-
import { PdfPageOrientation, PdfDocument, PdfBitmap } from '@syncfusion/ej2-pdf-export';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* This module enables the export to PDF functionality in maps.
|
|
9
|
-
*
|
|
10
|
-
* @hidden
|
|
11
|
-
*/
|
|
12
|
-
export class PdfExport {
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Constructor for Maps
|
|
16
|
-
*
|
|
17
|
-
*/
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
19
|
-
constructor() { }
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* To export the file as image/svg format
|
|
23
|
-
*
|
|
24
|
-
* @param {Maps} maps - Specifies the Maps instance.
|
|
25
|
-
* @param {ExportType} type - Specifies the type of the document.
|
|
26
|
-
* @param {string} fileName - Specifies the name of the PDF document.
|
|
27
|
-
* @param {boolean} allowDownload - Specifies whether to download the document or not.
|
|
28
|
-
* @param {PdfPageOrientation} orientation - Specifies the orientation of the PDF document to export the maps.
|
|
29
|
-
* @returns {Promise<string>} - Returns "null" value when the allowDownload is set to false.
|
|
30
|
-
* @private
|
|
31
|
-
*/
|
|
32
|
-
public export(maps: Maps, type: ExportType, fileName: string, allowDownload?: boolean,
|
|
33
|
-
orientation?: PdfPageOrientation): Promise<string> {
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
|
-
const promise: Promise<string> = new Promise((resolve: any) => {
|
|
36
|
-
if (maps.isTileMap) {
|
|
37
|
-
maps.isExportInitialTileMap = true;
|
|
38
|
-
}
|
|
39
|
-
const canvasElement: HTMLCanvasElement = <HTMLCanvasElement>createElement('canvas', {
|
|
40
|
-
id: 'ej2-canvas',
|
|
41
|
-
attrs: {
|
|
42
|
-
'width': maps.availableSize.width.toString(),
|
|
43
|
-
'height': maps.availableSize.height.toString()
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
orientation = isNullOrUndefined(orientation) ? PdfPageOrientation.Landscape : orientation;
|
|
47
|
-
const svgParent: HTMLElement = document.getElementById(maps.element.id + '_Tile_SVG_Parent');
|
|
48
|
-
let svgData: string;
|
|
49
|
-
const exportElement: HTMLElement = maps.svgObject.cloneNode(true) as HTMLElement;
|
|
50
|
-
const backgroundElement: HTMLElement = exportElement.childNodes[0] as HTMLElement;
|
|
51
|
-
const backgroundColor: string = backgroundElement.getAttribute('fill');
|
|
52
|
-
if ((maps.theme === 'Tailwind' || maps.theme === 'Tailwind3' || maps.theme === 'Bootstrap5' || maps.theme === 'Fluent' || maps.theme === 'Material3' ||
|
|
53
|
-
maps.theme === 'Fluent2')
|
|
54
|
-
&& (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
|
|
55
|
-
(exportElement.childNodes[0] as HTMLElement).setAttribute('fill', 'rgba(255,255,255, 1)');
|
|
56
|
-
} else if ((maps.theme === 'TailwindDark' || maps.theme === 'Tailwind3Dark' || maps.theme === 'Bootstrap5Dark' || maps.theme === 'FluentDark' || maps.theme === 'Material3Dark' ||
|
|
57
|
-
maps.theme === 'Fluent2Dark' || maps.theme === 'Fluent2HighContrast')
|
|
58
|
-
&& (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
|
|
59
|
-
(exportElement.childNodes[0] as HTMLElement).setAttribute('fill', 'rgba(0, 0, 0, 1)');
|
|
60
|
-
}
|
|
61
|
-
const url: string = window.URL.createObjectURL(
|
|
62
|
-
new Blob(
|
|
63
|
-
type === 'SVG' ? [svgData] :
|
|
64
|
-
[(new XMLSerializer()).serializeToString(exportElement)],
|
|
65
|
-
{ type: 'image/svg+xml' }
|
|
66
|
-
)
|
|
67
|
-
);
|
|
68
|
-
const pdfDocument: PdfDocument = new PdfDocument();
|
|
69
|
-
const image: HTMLImageElement = new Image();
|
|
70
|
-
const ctx: CanvasRenderingContext2D = canvasElement.getContext('2d');
|
|
71
|
-
if (!maps.isTileMap) {
|
|
72
|
-
image.onload = (() => {
|
|
73
|
-
ctx.drawImage(image, 0, 0);
|
|
74
|
-
window.URL.revokeObjectURL(url);
|
|
75
|
-
if (type === 'PDF') {
|
|
76
|
-
let imageString: string = canvasElement.toDataURL('image/jpeg').replace('image/jpeg', 'image/octet-stream');
|
|
77
|
-
pdfDocument.pageSettings.orientation = orientation;
|
|
78
|
-
imageString = imageString.slice(imageString.indexOf(',') + 1);
|
|
79
|
-
pdfDocument.pages.add().graphics.drawImage(
|
|
80
|
-
new PdfBitmap(imageString), 0, 0, (maps.availableSize.width - 60), maps.availableSize.height
|
|
81
|
-
);
|
|
82
|
-
if (allowDownload) {
|
|
83
|
-
pdfDocument.save(fileName + '.pdf');
|
|
84
|
-
pdfDocument.destroy();
|
|
85
|
-
} else {
|
|
86
|
-
resolve(null);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
image.src = url;
|
|
91
|
-
} else {
|
|
92
|
-
const svgParentElement: HTMLElement = document.getElementById(maps.element.id + '_MapAreaBorder');
|
|
93
|
-
const top: number = parseFloat(svgParentElement.getAttribute('y'));
|
|
94
|
-
const left: number = parseFloat(svgParentElement.getAttribute('x'));
|
|
95
|
-
const xHttp: XMLHttpRequest = new XMLHttpRequest();
|
|
96
|
-
const tileLength: number = maps.mapLayerPanel.tiles.length;
|
|
97
|
-
for (let i: number = 0; i <= tileLength + 1; i++) {
|
|
98
|
-
const tile: HTMLElement = document.getElementById(maps.element.id + '_tile_' + (i - 1));
|
|
99
|
-
const tileImg: HTMLImageElement = new Image();
|
|
100
|
-
tileImg.crossOrigin = 'Anonymous';
|
|
101
|
-
const background: string = maps.background ? maps.background : ((maps.theme === 'Tailwind' || maps.theme === 'Tailwind3' || maps.theme === 'Bootstrap5' || maps.theme === 'Fluent' || maps.theme === 'Material3') && (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) ? '#ffffff' :
|
|
102
|
-
(maps.theme === 'TailwindDark' || maps.theme === 'Tailwind3Dark' || maps.theme === 'Bootstrap5Dark' || maps.theme === 'FluentDark' || maps.theme === 'Material3Dark') && (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent') ? '#000000' : '#ffffff';
|
|
103
|
-
ctx.fillStyle = background;
|
|
104
|
-
ctx.fillRect(0, 0, maps.availableSize.width, maps.availableSize.height);
|
|
105
|
-
ctx.font = maps.titleSettings.textStyle.size + ' Arial';
|
|
106
|
-
const titleElement: HTMLElement = document.getElementById(maps.element.id + '_Map_title');
|
|
107
|
-
if (!isNullOrUndefined(titleElement)) {
|
|
108
|
-
ctx.fillStyle = titleElement.getAttribute('fill');
|
|
109
|
-
ctx.fillText(
|
|
110
|
-
maps.titleSettings.text, parseFloat(titleElement.getAttribute('x')),
|
|
111
|
-
parseFloat(titleElement.getAttribute('y')));
|
|
112
|
-
}
|
|
113
|
-
tileImg.onload = (() => {
|
|
114
|
-
if (i === 0 || i === tileLength + 1) {
|
|
115
|
-
if (i === 0) {
|
|
116
|
-
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
117
|
-
ctx.rect(0, top, parseFloat(svgParent.style.width), parseFloat(svgParent.style.height));
|
|
118
|
-
ctx.clip();
|
|
119
|
-
} else {
|
|
120
|
-
ctx.setTransform(1, 0, 0, 1, left, top);
|
|
121
|
-
}
|
|
122
|
-
} else {
|
|
123
|
-
ctx.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) + left, parseFloat(tile.style.top) + top);
|
|
124
|
-
}
|
|
125
|
-
ctx.drawImage(tileImg, 0, 0);
|
|
126
|
-
if (i === tileLength + 1) {
|
|
127
|
-
if (type === 'PDF') {
|
|
128
|
-
localStorage.setItem('saved-image-example', canvasElement.toDataURL('image/jpeg'));
|
|
129
|
-
let x: string = localStorage.getItem('saved-image-example');
|
|
130
|
-
pdfDocument.pageSettings.orientation = orientation;
|
|
131
|
-
x = x.slice(x.indexOf(',') + 1);
|
|
132
|
-
pdfDocument.pages.add().graphics.drawImage(
|
|
133
|
-
new PdfBitmap(x), 0, 0, (maps.availableSize.width - 60), maps.availableSize.height
|
|
134
|
-
);
|
|
135
|
-
maps.isExportInitialTileMap = false;
|
|
136
|
-
if (allowDownload) {
|
|
137
|
-
pdfDocument.save(fileName + '.pdf');
|
|
138
|
-
pdfDocument.destroy();
|
|
139
|
-
} else {
|
|
140
|
-
resolve(null);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
if (i === 0 || i === tileLength + 1) {
|
|
146
|
-
if (i === 0) {
|
|
147
|
-
tileImg.src = url;
|
|
148
|
-
} else {
|
|
149
|
-
setTimeout(() => {
|
|
150
|
-
const tileSvg: Element = document.getElementById(maps.element.id + '_Tile_SVG');
|
|
151
|
-
tileImg.src = window.URL.createObjectURL(new Blob(
|
|
152
|
-
[(new XMLSerializer()).serializeToString(tileSvg)],
|
|
153
|
-
{ type: 'image/svg+xml' }));
|
|
154
|
-
}, 300);
|
|
155
|
-
}
|
|
156
|
-
} else {
|
|
157
|
-
xHttp.open('GET', tile.children[0].getAttribute('src'), true);
|
|
158
|
-
xHttp.send();
|
|
159
|
-
tileImg.src = tile.children[0].getAttribute('src');
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
return promise;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Get module name.
|
|
168
|
-
*
|
|
169
|
-
* @returns {string} - Returns the module name
|
|
170
|
-
*/
|
|
171
|
-
protected getModuleName(): string {
|
|
172
|
-
return 'PdfExport';
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* To destroy the PdfExport.
|
|
177
|
-
*
|
|
178
|
-
* @returns {void}
|
|
179
|
-
* @private
|
|
180
|
-
*/
|
|
181
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
182
|
-
public destroy(): void { }
|
|
183
|
-
}
|