@syncfusion/ej2-maps 30.1.37 → 31.1.17

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 (59) hide show
  1. package/dist/ej2-maps.min.js +1 -1
  2. package/dist/ej2-maps.umd.min.js +1 -1
  3. package/dist/global/ej2-maps.min.js +1 -1
  4. package/dist/global/index.d.ts +1 -1
  5. package/dist/ts/index.d.ts +4 -0
  6. package/dist/ts/index.ts +4 -0
  7. package/dist/ts/maps/index.d.ts +28 -0
  8. package/dist/ts/maps/index.ts +28 -0
  9. package/dist/ts/maps/layers/bing-map.d.ts +21 -0
  10. package/dist/ts/maps/layers/bing-map.ts +51 -0
  11. package/dist/ts/maps/layers/bubble.d.ts +77 -0
  12. package/dist/ts/maps/layers/bubble.ts +304 -0
  13. package/dist/ts/maps/layers/color-mapping.d.ts +36 -0
  14. package/dist/ts/maps/layers/color-mapping.ts +230 -0
  15. package/dist/ts/maps/layers/data-label.d.ts +45 -0
  16. package/dist/ts/maps/layers/data-label.ts +457 -0
  17. package/dist/ts/maps/layers/layer-panel.d.ts +144 -0
  18. package/dist/ts/maps/layers/layer-panel.ts +1455 -0
  19. package/dist/ts/maps/layers/legend.d.ts +173 -0
  20. package/dist/ts/maps/layers/legend.ts +2465 -0
  21. package/dist/ts/maps/layers/marker.d.ts +105 -0
  22. package/dist/ts/maps/layers/marker.ts +632 -0
  23. package/dist/ts/maps/layers/navigation-selected-line.d.ts +33 -0
  24. package/dist/ts/maps/layers/navigation-selected-line.ts +171 -0
  25. package/dist/ts/maps/layers/polygon.d.ts +30 -0
  26. package/dist/ts/maps/layers/polygon.ts +68 -0
  27. package/dist/ts/maps/maps-model.d.ts +409 -0
  28. package/dist/ts/maps/maps.d.ts +1247 -0
  29. package/dist/ts/maps/maps.ts +3416 -0
  30. package/dist/ts/maps/model/base-model.d.ts +2107 -0
  31. package/dist/ts/maps/model/base.d.ts +1840 -0
  32. package/dist/ts/maps/model/base.ts +2257 -0
  33. package/dist/ts/maps/model/constants.d.ts +225 -0
  34. package/dist/ts/maps/model/constants.ts +226 -0
  35. package/dist/ts/maps/model/export-image.d.ts +39 -0
  36. package/dist/ts/maps/model/export-image.ts +194 -0
  37. package/dist/ts/maps/model/export-pdf.d.ts +40 -0
  38. package/dist/ts/maps/model/export-pdf.ts +183 -0
  39. package/dist/ts/maps/model/interface.d.ts +892 -0
  40. package/dist/ts/maps/model/interface.ts +929 -0
  41. package/dist/ts/maps/model/print.d.ts +45 -0
  42. package/dist/ts/maps/model/print.ts +125 -0
  43. package/dist/ts/maps/model/theme.d.ts +98 -0
  44. package/dist/ts/maps/model/theme.ts +919 -0
  45. package/dist/ts/maps/user-interaction/annotation.d.ts +27 -0
  46. package/dist/ts/maps/user-interaction/annotation.ts +133 -0
  47. package/dist/ts/maps/user-interaction/highlight.d.ts +63 -0
  48. package/dist/ts/maps/user-interaction/highlight.ts +272 -0
  49. package/dist/ts/maps/user-interaction/selection.d.ts +85 -0
  50. package/dist/ts/maps/user-interaction/selection.ts +342 -0
  51. package/dist/ts/maps/user-interaction/tooltip.d.ts +78 -0
  52. package/dist/ts/maps/user-interaction/tooltip.ts +500 -0
  53. package/dist/ts/maps/user-interaction/zoom.d.ts +334 -0
  54. package/dist/ts/maps/user-interaction/zoom.ts +2523 -0
  55. package/dist/ts/maps/utils/enum.d.ts +328 -0
  56. package/dist/ts/maps/utils/enum.ts +343 -0
  57. package/dist/ts/maps/utils/helper.d.ts +1318 -0
  58. package/dist/ts/maps/utils/helper.ts +3811 -0
  59. package/package.json +53 -18
@@ -0,0 +1,230 @@
1
+ import { Maps } from '../../index';
2
+ import { ShapeSettingsModel, ColorMappingSettingsModel, ColorValue } from '../index';
3
+ import { isNullOrUndefined } from '@syncfusion/ej2-base';
4
+ import { getValueFromObject } from '../utils/helper';
5
+
6
+ /**
7
+ * ColorMapping class
8
+ */
9
+ export class ColorMapping {
10
+ /* eslint-disable @typescript-eslint/no-unused-vars */
11
+ /* eslint-disable @typescript-eslint/no-empty-function */
12
+ constructor(maps: Maps) {
13
+ }
14
+ /* eslint-enable @typescript-eslint/no-unused-vars */
15
+ /* eslint-enable @typescript-eslint/no-empty-function */
16
+ /**
17
+ * To get color based on shape settings.
18
+ *
19
+ * @param { ShapeSettingsModel } shapeSettings - Specifies the shape settings.
20
+ * @param { object } layerData - Specifies the layer data.
21
+ * @param { string } color - Specifies the color.
22
+ * @returns {object} - Returns the object.
23
+ * @private
24
+ */
25
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
+ public getShapeColorMapping(shapeSettings: ShapeSettingsModel, layerData: object, color: string): any {
27
+ const colorValuePath: string = shapeSettings.colorValuePath ? shapeSettings.colorValuePath : shapeSettings.valuePath;
28
+ const equalValue: string = (!isNullOrUndefined(colorValuePath)) ? ((colorValuePath.indexOf('.') > -1) ?
29
+ getValueFromObject(layerData, colorValuePath) : layerData[colorValuePath as string]) : layerData[colorValuePath as string];
30
+ const colorValue: number = Number(equalValue);
31
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
+ const shapeColor: any = this.getColorByValue(shapeSettings.colorMapping, colorValue, equalValue);
33
+ return !isNullOrUndefined(shapeColor) ? shapeColor : color;
34
+ }
35
+ /**
36
+ * To color by value and color mapping.
37
+ *
38
+ * @param {ColorMappingSettingsModel[]} colorMapping - Specifies the color mapping instance.
39
+ * @param {number} colorValue - Specifies the color value
40
+ * @param {string} equalValue - Specifies the equal value.
41
+ * @returns {any} - Returns the color mapping values.
42
+ * @private
43
+ */
44
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
+ public getColorByValue(colorMapping: ColorMappingSettingsModel[], colorValue: number, equalValue: string): any {
46
+ if (isNaN(colorValue) && isNullOrUndefined(equalValue)) {
47
+ return null;
48
+ }
49
+ let fill: string = ''; let opacity: number; let gradientFill: string;
50
+ for (const colorMap of colorMapping) {
51
+
52
+ if ((!isNullOrUndefined(colorMap.from) && !isNullOrUndefined(colorMap.to)
53
+ && (colorValue >= colorMap.from && colorValue <= colorMap.to)) ||
54
+ (colorMap.value === equalValue)) {
55
+ if (Object.prototype.toString.call(colorMap.color) === '[object Array]') {
56
+ if (!isNullOrUndefined(colorMap.value)) {
57
+ fill = colorMap.color[0];
58
+ } else {
59
+ gradientFill = this.getColor(colorMap, colorValue);
60
+ fill = gradientFill;
61
+ }
62
+ } else {
63
+ fill = <string>colorMap.color;
64
+ }
65
+ }
66
+ if (((colorValue >= colorMap.from && colorValue <= colorMap.to) || (colorMap.value === equalValue))
67
+ && (!isNullOrUndefined(colorMap.minOpacity) && !isNullOrUndefined(colorMap.maxOpacity) && fill)) {
68
+ opacity = this.deSaturationColor(colorMap, fill, colorValue, equalValue);
69
+ }
70
+ if ((fill === '' || isNullOrUndefined(fill)) && isNullOrUndefined(colorMap.from) && isNullOrUndefined(colorMap.to)
71
+ && isNullOrUndefined(colorMap.minOpacity) && isNullOrUndefined(colorMap.maxOpacity) && isNullOrUndefined(colorMap.value)) {
72
+ fill = Object.prototype.toString.call(colorMap.color) === '[object Array]' ? colorMap.color[0] : <string>colorMap.color;
73
+ }
74
+ }
75
+ return { fill: fill || ((!colorMapping.length) ? equalValue : null), opacity: opacity };
76
+ }
77
+
78
+ public deSaturationColor(
79
+ colorMapping: ColorMappingSettingsModel, color: string,
80
+ rangeValue: number, equalValue: string): number {
81
+ let opacity: number = 1;
82
+ if (((rangeValue >= colorMapping.from && rangeValue <= colorMapping.to) || colorMapping.value === equalValue)) {
83
+ const ratio: number = !isNaN(rangeValue) ? (rangeValue - colorMapping.from) / (colorMapping.to - colorMapping.from) :
84
+ colorMapping.from / (colorMapping.to - colorMapping.from);
85
+ opacity = (ratio * (colorMapping.maxOpacity - colorMapping.minOpacity)) + colorMapping.minOpacity;
86
+ }
87
+ return opacity;
88
+ }
89
+
90
+ public rgbToHex(r: number, g: number, b: number): string {
91
+ return '#' + this.componentToHex(r) + this.componentToHex(g) + this.componentToHex(b);
92
+ }
93
+
94
+ public componentToHex(value: number): string {
95
+ const hex: string = value.toString(16);
96
+ return hex.length === 1 ? '0' + hex : hex;
97
+ }
98
+
99
+ public getColor(colorMap: ColorMappingSettingsModel, value: number): string {
100
+ let color: string = '';
101
+ let rbg: ColorValue;
102
+ if (Number(value) === colorMap.from) {
103
+ color = colorMap.color[0];
104
+ } else if (Number(value) === colorMap.to) {
105
+ color = colorMap.color[colorMap.color.length - 1];
106
+ } else {
107
+ rbg = this.getGradientColor(Number(value), colorMap);
108
+ color = this.rgbToHex(rbg.r, rbg.g, rbg.b);
109
+ }
110
+ return color;
111
+ }
112
+
113
+ public getGradientColor(value: number, colorMap: ColorMappingSettingsModel): ColorValue {
114
+ const previousOffset: number = colorMap.from;
115
+ const nextOffset: number = colorMap.to;
116
+ let percent: number = 0;
117
+ const full: number = nextOffset - previousOffset; let midColor: string;
118
+ percent = (value - previousOffset) / full; let previousColor: string; let nextColor: string;
119
+ if (colorMap.color.length <= 2) {
120
+ previousColor = colorMap.color[0].charAt(0) === '#' ? colorMap.color[0] : this._colorNameToHex(colorMap.color[0]);
121
+ nextColor = colorMap.color[colorMap.color.length - 1].charAt(0) === '#' ?
122
+ colorMap.color[colorMap.color.length - 1] : this._colorNameToHex(colorMap.color[colorMap.color.length - 1]);
123
+ } else {
124
+ previousColor = colorMap.color[0].charAt(0) === '#' ? colorMap.color[0] : this._colorNameToHex(colorMap.color[0]);
125
+ nextColor = colorMap.color[colorMap.color.length - 1].charAt(0) === '#' ?
126
+ colorMap.color[colorMap.color.length - 1] : this._colorNameToHex(colorMap.color[colorMap.color.length - 1]);
127
+ const a: number = full / (colorMap.color.length - 1); let b: number; let c: number;
128
+
129
+ const length: number = colorMap.color.length - 1;
130
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
131
+ const splitColorValueOffset: any[] = []; let splitColor: any = {};
132
+ for (let j: number = 1; j < length; j++) {
133
+ c = j * a;
134
+ b = previousOffset + c;
135
+ splitColor = { b: b, color: colorMap.color[j as number] };
136
+ splitColorValueOffset.push(splitColor);
137
+ }
138
+ for (let i: number = 0; i < splitColorValueOffset.length; i++) {
139
+ if (previousOffset <= value && value <= splitColorValueOffset[i as number]['b'] && i === 0) {
140
+ midColor = splitColorValueOffset[i as number]['color'].charAt(0) === '#' ?
141
+ splitColorValueOffset[i as number]['color'] : this._colorNameToHex(splitColorValueOffset[i as number]['color']);
142
+ nextColor = midColor;
143
+ percent = value < splitColorValueOffset[i as number]['b'] ? 1 - Math.abs((value - splitColorValueOffset[i as number]['b']) / a)
144
+ : (value - splitColorValueOffset[i as number]['b']) / a;
145
+ } else if (splitColorValueOffset[i as number]['b'] <= value && value <= nextOffset && i === (splitColorValueOffset.length - 1)) {
146
+ midColor = splitColorValueOffset[i as number]['color'].charAt(0) === '#' ?
147
+ splitColorValueOffset[i as number]['color'] : this._colorNameToHex(splitColorValueOffset[i as number]['color']);
148
+ previousColor = midColor;
149
+ percent = value < splitColorValueOffset[i as number]['b'] ?
150
+ 1 - Math.abs((value - splitColorValueOffset[i as number]['b']) / a) : (value - splitColorValueOffset[i as number]['b']) / a;
151
+ }
152
+ if (i !== splitColorValueOffset.length - 1 && i < splitColorValueOffset.length) {
153
+ if (splitColorValueOffset[i as number]['b'] <= value && value <= splitColorValueOffset[i + 1]['b']) {
154
+ midColor = splitColorValueOffset[i as number]['color'].charAt(0) === '#' ?
155
+ splitColorValueOffset[i as number]['color'] : this._colorNameToHex(splitColorValueOffset[i as number]['color']);
156
+ previousColor = midColor;
157
+ nextColor = splitColorValueOffset[i + 1]['color'].charAt(0) === '#' ?
158
+ splitColorValueOffset[i + 1]['color'] : this._colorNameToHex(splitColorValueOffset[i + 1]['color']);
159
+ percent = Math.abs((value - splitColorValueOffset[i + 1]['b'])) / a;
160
+ }
161
+ }
162
+ }
163
+ }
164
+ return this.getPercentageColor(percent, previousColor, nextColor);
165
+ }
166
+
167
+ public getPercentageColor(percent: number, previous: string, next: string): ColorValue {
168
+ const nextColor: string = next.split('#')[1];
169
+ const prevColor: string = previous.split('#')[1];
170
+ const r: number = this.getPercentage(percent, parseInt(prevColor.substr(0, 2), 16), parseInt(nextColor.substr(0, 2), 16));
171
+ const g: number = this.getPercentage(percent, parseInt(prevColor.substr(2, 2), 16), parseInt(nextColor.substr(2, 2), 16));
172
+ const b: number = this.getPercentage(percent, parseInt(prevColor.substr(4, 2), 16), parseInt(nextColor.substr(4, 2), 16));
173
+ return new ColorValue(r, g, b);
174
+ }
175
+
176
+ public getPercentage(percent: number, previous: number, next: number): number {
177
+ const full: number = next - previous;
178
+ return Math.round((previous + (full * percent)));
179
+ }
180
+
181
+ public _colorNameToHex(color: string): string {
182
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
183
+ const colors: any = {
184
+ 'aliceblue': '#f0f8ff', 'antiquewhite': '#faebd7', 'aqua': '#00ffff', 'aquamarine': '#7fffd4', 'azure': '#f0ffff',
185
+ 'beige': '#f5f5dc', 'bisque': '#ffe4c4', 'black': '#000000', 'blanchedalmond': '#ffebcd', 'blue': '#0000ff',
186
+ 'blueviolet': '#8a2be2', 'brown': '#a52a2a', 'burlywood': '#deb887',
187
+ 'cadetblue': '#5f9ea0', 'chartreuse': '#7fff00', 'chocolate': '#d2691e', 'coral': '#ff7f50',
188
+ 'cornflowerblue': '#6495ed', 'cornsilk': '#fff8dc', 'crimson': '#dc143c', 'cyan': '#00ffff',
189
+ 'darkblue': '#00008b', 'darkcyan': '#008b8b', 'darkgoldenrod': '#b8860b', 'darkgray': '#a9a9a9', 'darkgreen': '#006400',
190
+ 'darkkhaki': '#bdb76b', 'darkmagenta': '#8b008b', 'darkolivegreen': '#556b2f',
191
+ 'darkorange': '#ff8c00', 'darkorchid': '#9932cc', 'darkred': '#8b0000', 'darksalmon': '#e9967a', 'darkseagreen': '#8fbc8f',
192
+ 'darkslateblue': '#483d8b', 'darkslategray': '#2f4f4f', 'darkturquoise': '#00ced1',
193
+ 'darkviolet': '#9400d3', 'deeppink': '#ff1493', 'deepskyblue': '#00bfff', 'dimgray': '#696969', 'dodgerblue': '#1e90ff',
194
+ 'firebrick': '#b22222', 'floralwhite': '#fffaf0', 'forestgreen': '#228b22', 'fuchsia': '#ff00ff',
195
+ 'gainsboro': '#dcdcdc', 'ghostwhite': '#f8f8ff', 'gold': '#ffd700', 'goldenrod': '#daa520', 'gray': '#808080',
196
+ 'green': '#008000', 'greenyellow': '#adff2f',
197
+ 'honeydew': '#f0fff0', 'hotpink': '#ff69b4',
198
+ 'indianred ': '#cd5c5c', 'indigo ': '#4b0082', 'ivory': '#fffff0', 'khaki': '#f0e68c',
199
+ 'lavender': '#e6e6fa', 'lavenderblush': '#fff0f5', 'lawngreen': '#7cfc00', 'lemonchiffon': '#fffacd', 'lightblue': '#add8e6',
200
+ 'lightcoral': '#f08080', 'lightcyan': '#e0ffff', 'lightgoldenrodyellow': '#fafad2',
201
+ 'lightgrey': '#d3d3d3', 'lightgreen': '#90ee90', 'lightpink': '#ffb6c1', 'lightsalmon': '#ffa07a', 'lightseagreen': '#20b2aa',
202
+ 'lightskyblue': '#87cefa', 'lightslategray': '#778899', 'lightsteelblue': '#b0c4de',
203
+ 'lightyellow': '#ffffe0', 'lime': '#00ff00', 'limegreen': '#32cd32', 'linen': '#faf0e6',
204
+ 'magenta': '#ff00ff', 'maroon': '#800000', 'mediumaquamarine': '#66cdaa', 'mediumblue': '#0000cd', 'mediumorchid': '#ba55d3',
205
+ 'mediumpurple': '#9370d8', 'mediumseagreen': '#3cb371', 'mediumslateblue': '#7b68ee',
206
+ 'mediumspringgreen': '#00fa9a', 'mediumturquoise': '#48d1cc', 'mediumvioletred': '#c71585', 'midnightblue': '#191970',
207
+ 'mintcream': '#f5fffa', 'mistyrose': '#ffe4e1', 'moccasin': '#ffe4b5',
208
+ 'navajowhite': '#ffdead', 'navy': '#000080', 'orchid': '#da70d6', 'papayawhip': '#ffefd5',
209
+ 'oldlace': '#fdf5e6', 'olive': '#808000', 'olivedrab': '#6b8e23', 'orange': '#ffa500', 'orangered': '#ff4500',
210
+ 'palegoldenrod': '#eee8aa', 'palegreen': '#98fb98', 'paleturquoise': '#afeeee', 'palevioletred': '#d87093',
211
+ 'peachpuff': '#ffdab9', 'peru': '#cd853f', 'pink': '#ffc0cb', 'plum': '#dda0dd', 'powderblue': '#b0e0e6', 'purple': '#800080',
212
+ 'red': '#ff0000', 'rosybrown': '#bc8f8f', 'royalblue': '#4169e1',
213
+ 'saddlebrown': '#8b4513', 'salmon': '#fa8072', 'sandybrown': '#f4a460', 'seagreen': '#2e8b57', 'seashell': '#fff5ee',
214
+ 'sienna': '#a0522d', 'silver': '#c0c0c0', 'skyblue': '#87ceeb', 'slateblue': '#6a5acd',
215
+ 'slategray': '#708090', 'snow': '#fffafa', 'springgreen': '#00ff7f', 'steelblue': '#4682b4',
216
+ 'tan': '#d2b48c', 'teal': '#008080', 'thistle': '#d8bfd8', 'tomato': '#ff6347', 'turquoise': '#40e0d0',
217
+ 'violet': '#ee82ee',
218
+ 'wheat': '#f5deb3', 'white': '#ffffff', 'whitesmoke': '#f5f5f5',
219
+ 'yellow': '#ffff00', 'yellowgreen': '#9acd32'
220
+ };
221
+ if (Object.prototype.toString.call(color) === '[object Array]') {
222
+ return color;
223
+ }
224
+ if (typeof colors[color.toLowerCase()] !== 'undefined') {
225
+ return colors[color.toLowerCase()];
226
+ }
227
+
228
+ return color;
229
+ }
230
+ }
@@ -0,0 +1,45 @@
1
+ import { Maps } from '../../index';
2
+ import { LayerSettings } from '../index';
3
+ /**
4
+ * DataLabel Module used to render the maps datalabel
5
+ */
6
+ export declare class DataLabel {
7
+ private maps;
8
+ /**
9
+ * Datalabel collections
10
+ *
11
+ * @private
12
+ */
13
+ dataLabelCollections: any[];
14
+ private value;
15
+ constructor(maps: Maps);
16
+ private getDataLabel;
17
+ /**
18
+ * To render label for maps.
19
+ *
20
+ * @param {LayerSettings} layer - Specifies the layer settings
21
+ * @param {number} layerIndex - Specifies the layer index.
22
+ * @param {object} shape - Specifies the shape.
23
+ * @param {any[]} layerData - Specifies the layer data.
24
+ * @param {Element} group Specifies the element.
25
+ * @param {HTMLElement} labelTemplateElement - Specifies the template element.
26
+ * @param {number} index - Specifies the index number.
27
+ * @param {any[]} intersect - Specifies the intersect.
28
+ * @returns {void}
29
+ * @private
30
+ */
31
+ renderLabel(layer: LayerSettings, layerIndex: number, shape: object, layerData: any[], group: Element, labelTemplateElement: HTMLElement, index: number, intersect: any[]): void;
32
+ private datalabelAnimate;
33
+ private getPoint;
34
+ /**
35
+ * Get module name.
36
+ *
37
+ * @returns {string} - Returns the module name.
38
+ */
39
+ protected getModuleName(): string;
40
+ /**
41
+ * @returns {void}
42
+ * @private
43
+ */
44
+ destroy(): void;
45
+ }