ts-maps 0.2.5 → 0.2.7
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/dist/components/base.d.ts +5 -7
- package/dist/components/concerns/interactable.d.ts +0 -6
- package/dist/components/line.d.ts +11 -11
- package/dist/components/marker.d.ts +24 -5
- package/dist/components/region.d.ts +28 -3
- package/dist/components/tooltip.d.ts +18 -76
- package/dist/core/apply-transform.d.ts +7 -47
- package/dist/core/coords-to-point.d.ts +9 -25
- package/dist/core/create-lines.d.ts +2 -39
- package/dist/core/create-markers.d.ts +2 -50
- package/dist/core/create-regions.d.ts +2 -22
- package/dist/core/create-series.d.ts +2 -19
- package/dist/core/get-inset-for-point.d.ts +3 -30
- package/dist/core/get-marker-position.d.ts +3 -12
- package/dist/core/index.d.ts +0 -23
- package/dist/core/reposition-labels.d.ts +2 -23
- package/dist/core/reposition-lines.d.ts +2 -32
- package/dist/core/reposition-markers.d.ts +2 -23
- package/dist/core/resize.d.ts +0 -2
- package/dist/core/set-focus.d.ts +2 -58
- package/dist/core/set-scale.d.ts +2 -80
- package/dist/core/setup-container-events.d.ts +2 -49
- package/dist/core/setup-container-touch-events.d.ts +2 -68
- package/dist/core/setup-element-events.d.ts +1 -131
- package/dist/core/setup-zoom-buttons.d.ts +2 -21
- package/dist/core/update-size.d.ts +2 -7
- package/dist/data-visualization.d.ts +14 -96
- package/dist/defaults/events.d.ts +0 -13
- package/dist/defaults/options.d.ts +0 -4
- package/dist/event-handler.d.ts +0 -11
- package/dist/index.d.ts +2 -10
- package/dist/legend.d.ts +8 -5
- package/dist/map.d.ts +78 -425
- package/dist/maps/brasil.d.ts +1 -0
- package/dist/maps/canada.d.ts +1 -0
- package/dist/maps/iraq.d.ts +0 -3
- package/dist/maps/italy.d.ts +1 -0
- package/dist/maps/russia.d.ts +0 -3
- package/dist/maps/spain.d.ts +1 -0
- package/dist/maps/us-aea-en.d.ts +0 -3
- package/dist/maps/us-lcc-en.d.ts +0 -3
- package/dist/maps/us-merc-en.d.ts +0 -3
- package/dist/maps/us-mill-en.d.ts +0 -3
- package/dist/maps/world-merc.d.ts +1 -0
- package/dist/maps/world.d.ts +1 -0
- package/dist/projection.d.ts +0 -17
- package/dist/scales/ordinal-scale.d.ts +4 -24
- package/dist/series.d.ts +13 -3
- package/dist/svg/base-element.d.ts +16 -2
- package/dist/svg/canvas-element.d.ts +20 -7
- package/dist/svg/image-element.d.ts +10 -5
- package/dist/svg/shape-element.d.ts +11 -2
- package/dist/svg/text-element.d.ts +6 -0
- package/dist/types.d.ts +32 -17
- package/dist/util/deep-merge.d.ts +1 -43
- package/dist/util/index.d.ts +6 -13
- package/dist/utils.d.ts +67 -3
- package/dist/vector-map.d.ts +2 -12
- package/package.json +2 -3
package/dist/map.d.ts
CHANGED
|
@@ -1,428 +1,81 @@
|
|
|
1
|
-
|
|
1
|
+
import { } from './util';
|
|
2
|
+
import DataVisualization from './data-visualization';
|
|
3
|
+
import SVGCanvasElement from './svg/canvas-element';
|
|
4
|
+
import Tooltip from './components/tooltip';
|
|
5
|
+
import type { FocusOnOptions, Line, LineConfig, MapData, MapInterface, MapOptions, Marker, MarkerConfig, Region, } from './types';
|
|
6
|
+
import type SVGElement from './svg/base-element';
|
|
2
7
|
export declare class Map implements MapInterface {
|
|
3
|
-
static maps: { [key: string]: MapData & { [key: string]: any } }
|
|
4
|
-
static defaults: MapOptions
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (options.lines?.elements) {
|
|
76
|
-
const group = this._canvasImpl.createGroup(LINES_GROUP_ID)
|
|
77
|
-
if (!group) {
|
|
78
|
-
throw new TypeError('Failed to create lines group')
|
|
79
|
-
}
|
|
80
|
-
this._linesGroup = group
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (options.markers) {
|
|
84
|
-
const markersGroup = this._canvasImpl.createGroup(MARKERS_GROUP_ID)
|
|
85
|
-
const labelsGroup = this._canvasImpl.createGroup(MARKERS_LABELS_GROUP_ID)
|
|
86
|
-
if (!markersGroup || !labelsGroup) {
|
|
87
|
-
throw new TypeError('Failed to create markers groups')
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
this._markersGroup = markersGroup
|
|
91
|
-
this._markerLabelsGroup = labelsGroup
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
this._createMarkers(options.markers || [])
|
|
95
|
-
|
|
96
|
-
this._createLines(options.lines?.elements || [])
|
|
97
|
-
|
|
98
|
-
this._repositionLabels()
|
|
99
|
-
|
|
100
|
-
this._setupContainerEvents()
|
|
101
|
-
|
|
102
|
-
this._setupElementEvents()
|
|
103
|
-
|
|
104
|
-
if (options.zoomButtons) {
|
|
105
|
-
this._setupZoomButtons()
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (options.showTooltip) {
|
|
109
|
-
this._tooltip = new Tooltip(this)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (options.selectedRegions) {
|
|
113
|
-
this._setSelected('regions', options.selectedRegions)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (options.selectedMarkers) {
|
|
117
|
-
this._setSelected('_markers', options.selectedMarkers)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (options.focusOn) {
|
|
121
|
-
this.setFocus(options.focusOn)
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (options.visualizeData) {
|
|
125
|
-
this.dataVisualization = new DataVisualization(options.visualizeData, this)
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (options.bindTouchEvents) {
|
|
129
|
-
if ('ontouchstart' in window) {
|
|
130
|
-
this._setupContainerTouchEvents()
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (options.series) {
|
|
135
|
-
this.container.appendChild(this.legendHorizontal = createElement(
|
|
136
|
-
'div',
|
|
137
|
-
SERIES_CONTAINER_H_CLASS,
|
|
138
|
-
))
|
|
139
|
-
|
|
140
|
-
this.container.appendChild(this.legendVertical = createElement(
|
|
141
|
-
'div',
|
|
142
|
-
SERIES_CONTAINER_V_CLASS,
|
|
143
|
-
))
|
|
144
|
-
|
|
145
|
-
this._createSeries()
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
this._emit(Events.onLoaded, [this])
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
setBackgroundColor(color: string): void {
|
|
153
|
-
this.container.style.backgroundColor = color
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
getSelectedRegions(): string[] {
|
|
158
|
-
return this._getSelected('regions')
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
clearSelectedRegions(regions?: string[]): void {
|
|
162
|
-
const regionsToProcess = this._normalizeRegions(regions) || this._getSelected('regions')
|
|
163
|
-
regionsToProcess.forEach((key) => {
|
|
164
|
-
this.regions[key].element.select(false)
|
|
165
|
-
})
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
setSelectedRegions(regions: string | string[]): void {
|
|
169
|
-
this.clearSelectedRegions()
|
|
170
|
-
const normalizedRegions = this._normalizeRegions(regions)
|
|
171
|
-
if (normalizedRegions) {
|
|
172
|
-
this._setSelected('regions', normalizedRegions)
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
getSelectedMarkers(): string[] {
|
|
178
|
-
return this._getSelected('_markers')
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
clearSelectedMarkers(): void {
|
|
182
|
-
this._clearSelected('_markers')
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
setSelectedMarkers(markers: string | string[]): void {
|
|
186
|
-
const normalizedMarkers = this._normalizeRegions(markers)
|
|
187
|
-
if (normalizedMarkers) {
|
|
188
|
-
this._setSelected('_markers', normalizedMarkers)
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
addMarkers(config: MarkerConfig | MarkerConfig[]): void {
|
|
193
|
-
const configs = Array.isArray(config) ? config : [config]
|
|
194
|
-
this._createMarkers(configs, true)
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
removeMarkers(markers?: string[]): void {
|
|
198
|
-
const toRemove = markers || Object.keys(this._markers)
|
|
199
|
-
toRemove.forEach((index) => {
|
|
200
|
-
const marker = this._markers[index] as any
|
|
201
|
-
if (marker) {
|
|
202
|
-
if (typeof marker.remove === 'function') {
|
|
203
|
-
marker.remove()
|
|
204
|
-
}
|
|
205
|
-
else if (marker.shape) {
|
|
206
|
-
marker.shape.remove()
|
|
207
|
-
if (marker.label) {
|
|
208
|
-
marker.label.remove()
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
delete this._markers[index]
|
|
212
|
-
}
|
|
213
|
-
})
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
addLine(from: string, to: string, style: Record<string, any> = {}): void {
|
|
218
|
-
console.warn('`addLine` method is deprecated, please use `addLines` instead.')
|
|
219
|
-
this._createLines([{ from, to, style }])
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
addLines(config: LineConfig | LineConfig[]): void {
|
|
223
|
-
const uids = this._getLinesAsUids()
|
|
224
|
-
const configs = Array.isArray(config) ? config : [config]
|
|
225
|
-
|
|
226
|
-
this._createLines(configs.filter((line) => {
|
|
227
|
-
return !(uids.includes(getLineUid(line.from, line.to)))
|
|
228
|
-
}))
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
removeLines(lines: LineConfig[] | string[]): void {
|
|
232
|
-
if (Array.isArray(lines) && typeof lines[0] !== 'string') {
|
|
233
|
-
lines = (lines as LineConfig[]).map(line => getLineUid(line.from, line.to))
|
|
234
|
-
}
|
|
235
|
-
else if (!Array.isArray(lines)) {
|
|
236
|
-
lines = this._getLinesAsUids()
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
(lines as string[]).forEach((uid) => {
|
|
240
|
-
this._lines[uid].dispose()
|
|
241
|
-
delete this._lines[uid]
|
|
242
|
-
})
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
removeLine(from: string, to: string): void {
|
|
246
|
-
console.warn('`removeLine` method is deprecated, please use `removeLines` instead.')
|
|
247
|
-
const uid = getLineUid(from, to)
|
|
248
|
-
|
|
249
|
-
if (Object.prototype.hasOwnProperty.call(this._lines, uid)) {
|
|
250
|
-
this._lines[uid].element.remove()
|
|
251
|
-
delete this._lines[uid]
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
reset(): void {
|
|
256
|
-
for (const key in this.series || {}) {
|
|
257
|
-
for (let i = 0; i < (this.series?.[key]?.length || 0); i++) {
|
|
258
|
-
this.series?.[key][i]?.clear()
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
if (this.legendHorizontal) {
|
|
263
|
-
removeElement(this.legendHorizontal)
|
|
264
|
-
this.legendHorizontal = undefined
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
if (this.legendVertical) {
|
|
268
|
-
removeElement(this.legendVertical)
|
|
269
|
-
this.legendVertical = undefined
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
this.scale = this._baseScale
|
|
273
|
-
this.transX = this._baseTransX
|
|
274
|
-
this.transY = this._baseTransY
|
|
275
|
-
|
|
276
|
-
this._applyTransform()
|
|
277
|
-
this.clearSelectedMarkers()
|
|
278
|
-
this.clearSelectedRegions()
|
|
279
|
-
this.removeMarkers()
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
destroy(destroyInstance = true): void {
|
|
283
|
-
EventHandler.flush()
|
|
284
|
-
|
|
285
|
-
this._tooltip?.dispose()
|
|
286
|
-
|
|
287
|
-
this._emit(Events.onDestroyed, [])
|
|
288
|
-
|
|
289
|
-
if (destroyInstance) {
|
|
290
|
-
Object.keys(this).forEach((key) => {
|
|
291
|
-
try {
|
|
292
|
-
delete (this as any)[key]
|
|
293
|
-
}
|
|
294
|
-
catch {
|
|
295
|
-
}
|
|
296
|
-
})
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
extend(name: string, callback: (...args: any[]) => void): void {
|
|
301
|
-
if (typeof (this as any)[name] === 'function') {
|
|
302
|
-
throw new TypeError(`The method [${name}] does already exist, please use another name.`)
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
(Map.prototype as any)[name] = callback
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
mercator = {
|
|
309
|
-
convert: (lat: number, lng: number): false | { x: number, y: number } => {
|
|
310
|
-
const centralMeridian = this._mapData.projection?.centralMeridian || 0
|
|
311
|
-
const result = Projection.merc(lat, lng, centralMeridian)
|
|
312
|
-
return result
|
|
313
|
-
},
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
miller = {
|
|
317
|
-
convert: (lat: number, lng: number): false | { x: number, y: number } => {
|
|
318
|
-
const centralMeridian = this._mapData.projection?.centralMeridian || 0
|
|
319
|
-
const result = Projection.mill(lat, lng, centralMeridian)
|
|
320
|
-
return result
|
|
321
|
-
},
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
getInsetForPoint(_x: number, _y: number): boolean {
|
|
325
|
-
return false
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
getMarkerPosition(_config: MarkerConfig): false | { x: number, y: number } {
|
|
329
|
-
return { x: 0, y: 0 }
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
coordsToPoint(_lat: number, _lng: number): false | { x: number, y: number } {
|
|
333
|
-
return { x: 0, y: 0 }
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
_repositionMarkers(): void {
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
_repositionLines(): void {
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
_setScale(_scale: number): void {
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
_emit(eventName: string, args: any[]): void {
|
|
347
|
-
for (const event in Events) {
|
|
348
|
-
if (Events[event as keyof typeof Events] === eventName && typeof this.params[event as keyof MapOptions] === 'function') {
|
|
349
|
-
this.params[event as keyof MapOptions]?.apply(this, args)
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
_getSelected(type: string): string[] {
|
|
355
|
-
const selected: string[] = []
|
|
356
|
-
|
|
357
|
-
for (const key in (this as any)[type]) {
|
|
358
|
-
if ((this as any)[type][key].element.isSelected) {
|
|
359
|
-
selected.push(key)
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
return selected
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
_setSelected(type: string, keys: string[]): void {
|
|
367
|
-
keys.forEach((key) => {
|
|
368
|
-
if ((this as any)[type][key]) {
|
|
369
|
-
(this as any)[type][key].element.select(true)
|
|
370
|
-
}
|
|
371
|
-
})
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
_clearSelected(type: string): void {
|
|
375
|
-
this._getSelected(type).forEach((key) => {
|
|
376
|
-
(this as any)[type][key].element.select(false)
|
|
377
|
-
})
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
_getLinesAsUids(): string[] {
|
|
381
|
-
return Object.keys(this._lines)
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
_normalizeRegions(regions: string | string[] | undefined): string[] | undefined {
|
|
385
|
-
if (!regions)
|
|
386
|
-
return undefined
|
|
387
|
-
return typeof regions === 'string' ? [regions] : regions
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
_createRegions(): void {
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
_createMarkers(_markers: MarkerConfig[], _isRecentlyCreated: boolean = false): void {
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
_createLines(_lines: LineConfig[]): void {
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
_createSeries(): void {
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
_repositionLabels(): void {
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
_setupContainerEvents(): void {
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
_setupElementEvents(): void {
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
_setupZoomButtons(): void {
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
_setupContainerTouchEvents(): void {
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
_applyTransform(): void {
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
updateSize(): void {
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
setFocus(_config: FocusOnOptions): void {
|
|
425
|
-
}
|
|
8
|
+
static maps: { [key: string]: MapData & { [key: string]: any } };
|
|
9
|
+
static defaults: MapOptions;
|
|
10
|
+
params: MapOptions;
|
|
11
|
+
regions: Record<string, Region>;
|
|
12
|
+
scale: number;
|
|
13
|
+
transX: number;
|
|
14
|
+
transY: number;
|
|
15
|
+
container: HTMLElement;
|
|
16
|
+
canvas: SVGCanvasElementInterface;
|
|
17
|
+
dataVisualization?: DataVisualization;
|
|
18
|
+
legendHorizontal?: HTMLElement;
|
|
19
|
+
legendVertical?: HTMLElement;
|
|
20
|
+
series: { markers: any[], regions: any[], [key: string]: any[] };
|
|
21
|
+
_mapData: MapData;
|
|
22
|
+
_markers: Record<string, Marker>;
|
|
23
|
+
_lines: Record<string, Line>;
|
|
24
|
+
_defaultWidth: number;
|
|
25
|
+
_defaultHeight: number;
|
|
26
|
+
_height: number;
|
|
27
|
+
_width: number;
|
|
28
|
+
_baseScale: number;
|
|
29
|
+
_baseTransX: number;
|
|
30
|
+
_baseTransY: number;
|
|
31
|
+
_tooltip?: Tooltip;
|
|
32
|
+
_linesGroup?: SVGElement;
|
|
33
|
+
_markersGroup?: SVGElement;
|
|
34
|
+
_markerLabelsGroup?: SVGElement;
|
|
35
|
+
_canvasImpl: SVGCanvasElement;
|
|
36
|
+
constructor(options?: MapOptions);
|
|
37
|
+
_init(): void;
|
|
38
|
+
setBackgroundColor(color: string): void;
|
|
39
|
+
getSelectedRegions(): string[];
|
|
40
|
+
clearSelectedRegions(regions?: string[]): void;
|
|
41
|
+
setSelectedRegions(regions: string | string[]): void;
|
|
42
|
+
getSelectedMarkers(): string[];
|
|
43
|
+
clearSelectedMarkers(): void;
|
|
44
|
+
setSelectedMarkers(markers: string | string[]): void;
|
|
45
|
+
addMarkers(config: MarkerConfig | MarkerConfig[]): void;
|
|
46
|
+
removeMarkers(markers?: string[]): void;
|
|
47
|
+
addLine(from: string, to: string, style?: Record<string, any>): void;
|
|
48
|
+
addLines(config: LineConfig | LineConfig[]): void;
|
|
49
|
+
removeLines(lines: LineConfig[] | string[]): void;
|
|
50
|
+
removeLine(from: string, to: string): void;
|
|
51
|
+
reset(): void;
|
|
52
|
+
destroy(destroyInstance?: any): void;
|
|
53
|
+
extend(name: string, callback: (...args: any[]) => void): void;
|
|
54
|
+
mercator: any;
|
|
55
|
+
miller: any;
|
|
56
|
+
getInsetForPoint(_x: number, _y: number): boolean;
|
|
57
|
+
getMarkerPosition(_config: MarkerConfig): false | { x: number, y: number };
|
|
58
|
+
coordsToPoint(_lat: number, _lng: number): false | { x: number, y: number };
|
|
59
|
+
_repositionMarkers(): void;
|
|
60
|
+
_repositionLines(): void;
|
|
61
|
+
_setScale(_scale: number): void;
|
|
62
|
+
_emit(eventName: string, args: any[]): void;
|
|
63
|
+
_getSelected(type: string): string[];
|
|
64
|
+
_setSelected(type: string, keys: string[]): void;
|
|
65
|
+
_clearSelected(type: string): void;
|
|
66
|
+
_getLinesAsUids(): string[];
|
|
67
|
+
_normalizeRegions(regions: string | string[] | undefined): string[] | undefined;
|
|
68
|
+
_createRegions(): void;
|
|
69
|
+
_createMarkers(_markers: MarkerConfig[], _isRecentlyCreated?: boolean): void;
|
|
70
|
+
_createLines(_lines: LineConfig[]): void;
|
|
71
|
+
_createSeries(): void;
|
|
72
|
+
_repositionLabels(): void;
|
|
73
|
+
_setupContainerEvents(): void;
|
|
74
|
+
_setupElementEvents(): void;
|
|
75
|
+
_setupZoomButtons(): void;
|
|
76
|
+
_setupContainerTouchEvents(): void;
|
|
77
|
+
_applyTransform(): void;
|
|
78
|
+
updateSize(): void;
|
|
79
|
+
setFocus(_config: FocusOnOptions): void;
|
|
426
80
|
}
|
|
427
|
-
|
|
428
81
|
export default Map;
|
package/dist/maps/brasil.d.ts
CHANGED
package/dist/maps/canada.d.ts
CHANGED
package/dist/maps/iraq.d.ts
CHANGED
package/dist/maps/italy.d.ts
CHANGED
package/dist/maps/russia.d.ts
CHANGED
package/dist/maps/spain.d.ts
CHANGED
package/dist/maps/us-aea-en.d.ts
CHANGED
package/dist/maps/us-lcc-en.d.ts
CHANGED
package/dist/maps/world.d.ts
CHANGED
package/dist/projection.d.ts
CHANGED
|
@@ -1,18 +1 @@
|
|
|
1
|
-
declare interface Point {
|
|
2
|
-
x: number
|
|
3
|
-
y: number
|
|
4
|
-
}
|
|
5
|
-
declare interface Projection {
|
|
6
|
-
mill: (lat: number, lng: number, c: number) => Point
|
|
7
|
-
merc: (lat: number, lng: number, c: number) => Point
|
|
8
|
-
aea: (lat: number, lng: number, c: number) => Point
|
|
9
|
-
lcc: (lat: number, lng: number, c: number) => Point
|
|
10
|
-
degRad: number
|
|
11
|
-
radDeg: number
|
|
12
|
-
radius: number
|
|
13
|
-
}
|
|
14
|
-
declare const Proj: Projection;
|
|
15
|
-
declare const fi0: unknown;
|
|
16
|
-
declare const fi0: unknown;
|
|
17
|
-
|
|
18
1
|
export default Proj;
|
|
@@ -1,32 +1,12 @@
|
|
|
1
1
|
import type { ScaleOptions } from '../types';
|
|
2
|
-
|
|
3
2
|
declare interface Tick {
|
|
4
3
|
value: string
|
|
5
4
|
label: string
|
|
6
5
|
}
|
|
7
6
|
export declare class OrdinalScale {
|
|
8
|
-
private _scale: Record<string, string
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
getValue(value: string | number): string {
|
|
15
|
-
return this._scale[String(value)]
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
getTicks(): Tick[] {
|
|
19
|
-
const ticks: Tick[] = []
|
|
20
|
-
|
|
21
|
-
for (const key in this._scale) {
|
|
22
|
-
ticks.push({
|
|
23
|
-
value: this._scale[key],
|
|
24
|
-
label: key,
|
|
25
|
-
})
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return ticks
|
|
29
|
-
}
|
|
7
|
+
private _scale: Record<string, string>;
|
|
8
|
+
constructor(options: ScaleOptions);
|
|
9
|
+
getValue(value: string | number): string;
|
|
10
|
+
getTicks(): Tick[];
|
|
30
11
|
}
|
|
31
|
-
|
|
32
12
|
export default OrdinalScale;
|
package/dist/series.d.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
declare
|
|
3
|
-
|
|
1
|
+
import type { MapInterface, SeriesOptions } from './types';
|
|
2
|
+
declare class Series {
|
|
3
|
+
private _map: MapInterface;
|
|
4
|
+
private _elements: Record<string, any>;
|
|
5
|
+
private _values: Record<string, number | string>;
|
|
6
|
+
config: SeriesOptions;
|
|
7
|
+
scale: any;
|
|
8
|
+
legend?: any;
|
|
9
|
+
constructor(config: SeriesOptions, elements: Record<string, any>, map: MapInterface);
|
|
10
|
+
setValues(values: Record<string, number | string>): void;
|
|
11
|
+
setAttributes(attrs: Record<string, string>): void;
|
|
12
|
+
clear(): void;
|
|
13
|
+
}
|
|
4
14
|
export default Series;
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
+
import { } from '../util/index';
|
|
1
2
|
declare interface SVGConfig {
|
|
2
|
-
[key: string]: string | number
|
|
3
|
-
}
|
|
4
3
|
|
|
4
|
+
}
|
|
5
|
+
declare class SVGElement {
|
|
6
|
+
node: SVGGraphicsElement;
|
|
7
|
+
protected style: {
|
|
8
|
+
initial: Record<string, string | number>
|
|
9
|
+
};
|
|
10
|
+
constructor(name: string, config?: SVGConfig);
|
|
11
|
+
protected _createElement(tagName: string): SVGGraphicsElement;
|
|
12
|
+
addClass(className: string): void;
|
|
13
|
+
getBBox(): DOMRect;
|
|
14
|
+
set(property: SVGConfig | string, value?: string | number): void;
|
|
15
|
+
get(property: string): string | number;
|
|
16
|
+
applyAttr(property: string, value: string | number): void;
|
|
17
|
+
remove(): void;
|
|
18
|
+
}
|
|
5
19
|
export default SVGElement;
|