@kepler.gl/types 3.0.0-alpha.0 → 3.0.0-alpha.1
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/actions.d.ts +3 -2
- package/components.d.ts +30 -0
- package/effects.d.ts +29 -0
- package/index.d.ts +2 -0
- package/layers.d.ts +8 -0
- package/package.json +37 -37
- package/reducers.d.ts +136 -17
- package/schemas.d.ts +71 -14
- package/types.d.ts +2 -0
package/actions.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {SavedMap, ParsedConfig} from './schemas';
|
|
1
|
+
import {SavedMap, ParsedConfig, SavedConfigV1, MinSavedConfigV1} from './schemas';
|
|
2
2
|
|
|
3
3
|
/** EXPORT_FILE_TO_CLOUD */
|
|
4
4
|
export type MapData = {
|
|
@@ -58,6 +58,7 @@ export type AddDataToMapOptions = {
|
|
|
58
58
|
readOnly?: boolean;
|
|
59
59
|
keepExistingConfig?: boolean;
|
|
60
60
|
autoCreateLayers?: boolean;
|
|
61
|
+
autoCreateTooltips?: boolean;
|
|
61
62
|
};
|
|
62
63
|
|
|
63
64
|
export type AddDataToMapPayload = {
|
|
@@ -67,6 +68,6 @@ export type AddDataToMapPayload = {
|
|
|
67
68
|
// as the field is called `datasets`
|
|
68
69
|
datasets: ProtoDataset[] | ProtoDataset;
|
|
69
70
|
options?: AddDataToMapOptions;
|
|
70
|
-
config?: ParsedConfig;
|
|
71
|
+
config?: ParsedConfig | SavedConfigV1 | MinSavedConfigV1;
|
|
71
72
|
info?: Partial<MapInfo>;
|
|
72
73
|
};
|
package/components.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type TimeLabelFormat = {
|
|
2
|
+
id: string;
|
|
3
|
+
format: string | null;
|
|
4
|
+
type: string;
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
type TooltipFields = {
|
|
9
|
+
format?: string;
|
|
10
|
+
id?: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
fieldIdx?: number;
|
|
13
|
+
type?: string;
|
|
14
|
+
displayFormat?: string;
|
|
15
|
+
displayName: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type ColMetaProps = {
|
|
19
|
+
colIdx: number;
|
|
20
|
+
name: string;
|
|
21
|
+
displayName: string;
|
|
22
|
+
type: string;
|
|
23
|
+
format?: string;
|
|
24
|
+
columnStats?: any;
|
|
25
|
+
displayFormat?: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type ColMeta = {
|
|
29
|
+
[key: string]: ColMetaProps;
|
|
30
|
+
};
|
package/effects.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type EffectConfig = {
|
|
2
|
+
type: string;
|
|
3
|
+
name: string;
|
|
4
|
+
isEnabled: boolean;
|
|
5
|
+
isConfigActive: boolean;
|
|
6
|
+
// effect specific params for a deck.gl effect (uniforms)
|
|
7
|
+
params: {[key: string]: any};
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type EffectParams = {
|
|
11
|
+
id: string;
|
|
12
|
+
config: EffectConfig;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type EffectParamsPartial = {
|
|
16
|
+
id?: string;
|
|
17
|
+
config?: Partial<EffectConfig>
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export interface Effect {
|
|
21
|
+
id: string;
|
|
22
|
+
config: EffectConfig;
|
|
23
|
+
deckEffect: any;
|
|
24
|
+
|
|
25
|
+
getDefaultEffectConfig(config: Partial<EffectConfig>): EffectConfig;
|
|
26
|
+
updateConfig(config: Partial<EffectConfig>): void;
|
|
27
|
+
isValidToSave(): boolean;
|
|
28
|
+
get type(): string;
|
|
29
|
+
}
|
package/index.d.ts
CHANGED
package/layers.d.ts
CHANGED
|
@@ -68,6 +68,7 @@ export type Field = {
|
|
|
68
68
|
valueAccessor(v: {index: number}): any;
|
|
69
69
|
filterProps?: any;
|
|
70
70
|
metadata?: any;
|
|
71
|
+
displayFormat?: string;
|
|
71
72
|
};
|
|
72
73
|
|
|
73
74
|
export type FieldPair = {
|
|
@@ -84,10 +85,14 @@ export type FieldPair = {
|
|
|
84
85
|
export type LayerTextLabel = {
|
|
85
86
|
field: Field | null;
|
|
86
87
|
color: RGBColor;
|
|
88
|
+
background: boolean;
|
|
87
89
|
size: number;
|
|
88
90
|
offset: [number, number];
|
|
89
91
|
anchor: string;
|
|
90
92
|
alignment: string;
|
|
93
|
+
outlineWidth: number;
|
|
94
|
+
outlineColor: RGBAColor;
|
|
95
|
+
backgroundColor: RGBAColor;
|
|
91
96
|
};
|
|
92
97
|
|
|
93
98
|
export type ColorUI = {
|
|
@@ -204,6 +209,7 @@ export type LayerVisConfigSettings = {
|
|
|
204
209
|
wireframe: VisConfigBoolean;
|
|
205
210
|
weight: VisConfigNumber;
|
|
206
211
|
heatmapRadius: VisConfigNumber;
|
|
212
|
+
darkBaseMapEnabled: VisConfigBoolean;
|
|
207
213
|
};
|
|
208
214
|
|
|
209
215
|
// TODO: Move this to individual layers
|
|
@@ -244,6 +250,7 @@ export type LayerVisConfig = {
|
|
|
244
250
|
// extruded: boolean;
|
|
245
251
|
// wireframe: boolean;
|
|
246
252
|
// weight: number;
|
|
253
|
+
// scenegraph: VisConfig;
|
|
247
254
|
};
|
|
248
255
|
|
|
249
256
|
export type TextConfigSelect = {
|
|
@@ -263,6 +270,7 @@ export type TextConfigNumber = {
|
|
|
263
270
|
};
|
|
264
271
|
export type LayerTextConfig = {
|
|
265
272
|
fontSize: TextConfigNumber;
|
|
273
|
+
outlineWidth: TextConfigNumber;
|
|
266
274
|
textAnchor: TextConfigSelect;
|
|
267
275
|
textAlignment: TextConfigSelect;
|
|
268
276
|
};
|
package/package.json
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
2
|
+
"name": "@kepler.gl/types",
|
|
3
|
+
"author": "Shan He <shan@uber.com>",
|
|
4
|
+
"version": "3.0.0-alpha.1",
|
|
5
|
+
"description": "kepler.gl types used by kepler.gl components, actions and reducers",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"types": "index.d.ts",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"babel",
|
|
10
|
+
"es6",
|
|
11
|
+
"react",
|
|
12
|
+
"webgl",
|
|
13
|
+
"visualization",
|
|
14
|
+
"deck.gl"
|
|
15
|
+
],
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/keplergl/kepler.gl.git"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"prepublish": " ",
|
|
22
|
+
"stab": " "
|
|
23
|
+
},
|
|
24
|
+
"nyc": {
|
|
25
|
+
"sourceMap": false,
|
|
26
|
+
"instrument": false
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=14.21.1"
|
|
30
|
+
},
|
|
31
|
+
"maintainers": [
|
|
32
|
+
"Shan He <heshan0131@gmail.com>",
|
|
33
|
+
"Giuseppe Macri <gmacri@uber.com>"
|
|
34
|
+
],
|
|
35
|
+
"volta": {
|
|
36
|
+
"node": "14.21.1",
|
|
37
|
+
"yarn": "1.22.17"
|
|
38
|
+
}
|
|
39
39
|
}
|
package/reducers.d.ts
CHANGED
|
@@ -9,9 +9,21 @@ export type MapState = {
|
|
|
9
9
|
dragRotate: boolean;
|
|
10
10
|
width: number;
|
|
11
11
|
height: number;
|
|
12
|
-
|
|
12
|
+
minZoom?: number;
|
|
13
|
+
maxZoom?: number;
|
|
14
|
+
maxBounds?: Bounds;
|
|
13
15
|
initialState?: any;
|
|
14
16
|
scale?: number;
|
|
17
|
+
|
|
18
|
+
// the following 4 properties assist with split viewports that can optionally have (un)synced viewports and zooms
|
|
19
|
+
/** Is the application split into 2 maps? */
|
|
20
|
+
isSplit: boolean;
|
|
21
|
+
/** Are the 2 split maps having synced viewports? */
|
|
22
|
+
isViewportSynced: boolean;
|
|
23
|
+
/** If split, are the zooms locked to each other or independent? */
|
|
24
|
+
isZoomLocked: boolean;
|
|
25
|
+
/** An array of either 0 or 2 Viewport objects (index 0 for left map; index 1 for right map) */
|
|
26
|
+
splitMapViewports: Viewport[];
|
|
15
27
|
};
|
|
16
28
|
|
|
17
29
|
export type Bounds = [number, number, number, number];
|
|
@@ -61,15 +73,18 @@ export type LineChart = {
|
|
|
61
73
|
xDomain: [number, number];
|
|
62
74
|
};
|
|
63
75
|
|
|
76
|
+
type FilterViewType = 'side' | 'enlarged' | 'minified';
|
|
77
|
+
|
|
64
78
|
export type FilterBase<L extends LineChart> = {
|
|
65
79
|
dataId: string[];
|
|
66
80
|
id: string;
|
|
81
|
+
enabled: boolean;
|
|
67
82
|
|
|
68
83
|
freeze: boolean;
|
|
69
84
|
|
|
70
85
|
// time range filter specific
|
|
71
86
|
fixedDomain: boolean;
|
|
72
|
-
|
|
87
|
+
view: FilterViewType;
|
|
73
88
|
isAnimating: boolean;
|
|
74
89
|
speed: number;
|
|
75
90
|
showTimeDisplay?: boolean;
|
|
@@ -113,10 +128,11 @@ export type SelectFilter = FilterBase<LineChart> &
|
|
|
113
128
|
|
|
114
129
|
export type MultiSelectFilter = FilterBase<LineChart> &
|
|
115
130
|
MultiSelectFieldDomain & {
|
|
116
|
-
type: '
|
|
131
|
+
type: 'multiSelect';
|
|
117
132
|
fieldType: 'string' | 'date';
|
|
118
133
|
value: string[];
|
|
119
134
|
};
|
|
135
|
+
|
|
120
136
|
export type TimeRangeFilter = FilterBase<LineChart> &
|
|
121
137
|
TimeRangeFieldDomain & {
|
|
122
138
|
type: 'timeRange';
|
|
@@ -152,6 +168,12 @@ export type Feature = {
|
|
|
152
168
|
type: string;
|
|
153
169
|
coordinates: any;
|
|
154
170
|
};
|
|
171
|
+
type?: string;
|
|
172
|
+
};
|
|
173
|
+
export type FeatureSelectionContext = {
|
|
174
|
+
rightClick: boolean;
|
|
175
|
+
position: {x: number; y: number};
|
|
176
|
+
mapIndex?: number;
|
|
155
177
|
};
|
|
156
178
|
export type FeatureValue = {
|
|
157
179
|
id: string;
|
|
@@ -167,6 +189,7 @@ export type Editor = {
|
|
|
167
189
|
mode: string;
|
|
168
190
|
features: Feature[];
|
|
169
191
|
selectedFeature: any;
|
|
192
|
+
selectionContext?: FeatureSelectionContext;
|
|
170
193
|
visible: boolean;
|
|
171
194
|
};
|
|
172
195
|
|
|
@@ -174,21 +197,41 @@ export type SplitMapLayers = {[key: string]: boolean};
|
|
|
174
197
|
export type SplitMap = {
|
|
175
198
|
layers: SplitMapLayers;
|
|
176
199
|
};
|
|
200
|
+
|
|
201
|
+
/** See "Locale aware formats" at https://momentjs.com/docs/#/parsing/string-format/ */
|
|
202
|
+
export type AnimationConfigTimeFormat = 'L' | 'L LT' | 'L LTS';
|
|
203
|
+
|
|
177
204
|
export type AnimationConfig = {
|
|
178
205
|
domain: number[] | null;
|
|
179
206
|
currentTime: number | null;
|
|
180
207
|
speed: number;
|
|
208
|
+
duration?: number | null;
|
|
181
209
|
isAnimating?: boolean;
|
|
210
|
+
timeSteps?: null | number[];
|
|
182
211
|
// auto generated based on time domain
|
|
183
|
-
defaultTimeFormat
|
|
212
|
+
defaultTimeFormat: AnimationTimeFormat | null;
|
|
184
213
|
// custom ui input
|
|
185
|
-
timeFormat?:
|
|
214
|
+
timeFormat?: AnimationTimeFormat | null;
|
|
186
215
|
// custom ui input
|
|
187
216
|
timezone?: string | null;
|
|
188
217
|
// hide or show control
|
|
189
218
|
hideControl?: boolean;
|
|
190
219
|
};
|
|
191
220
|
|
|
221
|
+
export type Timeline = {
|
|
222
|
+
domain: [number, number] | null;
|
|
223
|
+
value: number | [number, number];
|
|
224
|
+
speed: number;
|
|
225
|
+
isAnimating: boolean;
|
|
226
|
+
step?: null | number;
|
|
227
|
+
timeSteps?: null | number[];
|
|
228
|
+
defaultTimeFormat?: null | string;
|
|
229
|
+
timeFormat?: null | string;
|
|
230
|
+
timezone?: null | string;
|
|
231
|
+
animationWindow?: null | Filter['animationWindow'];
|
|
232
|
+
marks?: null | number[];
|
|
233
|
+
} & Record<string, any>;
|
|
234
|
+
|
|
192
235
|
export type BaseInteraction = {
|
|
193
236
|
label: string;
|
|
194
237
|
enabled: boolean;
|
|
@@ -252,6 +295,12 @@ export type LayerGroup = {
|
|
|
252
295
|
defaultVisibility: boolean;
|
|
253
296
|
};
|
|
254
297
|
|
|
298
|
+
export type CustomStyleType =
|
|
299
|
+
| 'LOCAL'
|
|
300
|
+
| 'MANAGED'
|
|
301
|
+
// boolean for backwards compatability with previous map configs
|
|
302
|
+
| boolean;
|
|
303
|
+
|
|
255
304
|
export type BaseMapStyle = {
|
|
256
305
|
id: string;
|
|
257
306
|
label: string;
|
|
@@ -260,7 +309,9 @@ export type BaseMapStyle = {
|
|
|
260
309
|
style?: Object;
|
|
261
310
|
layerGroups: LayerGroup[];
|
|
262
311
|
accessToken?: string;
|
|
263
|
-
custom?:
|
|
312
|
+
custom?: CustomStyleType;
|
|
313
|
+
colorMode?: BASE_MAP_COLOR_MODES;
|
|
314
|
+
complimentaryStyleId?: string;
|
|
264
315
|
};
|
|
265
316
|
|
|
266
317
|
export declare type ExportImage = {
|
|
@@ -302,19 +353,20 @@ export type ExportMap = {
|
|
|
302
353
|
format: 'HTML' | 'JSON';
|
|
303
354
|
};
|
|
304
355
|
|
|
305
|
-
export type
|
|
356
|
+
export type MapControlItem = {
|
|
306
357
|
show: boolean;
|
|
307
358
|
active: boolean;
|
|
308
359
|
disableClose?: boolean;
|
|
309
360
|
activeMapIndex?: number;
|
|
310
361
|
};
|
|
311
362
|
export type MapControls = {
|
|
312
|
-
visibleLayers?:
|
|
313
|
-
mapLegend?:
|
|
314
|
-
toggle3d?:
|
|
315
|
-
splitMap?:
|
|
316
|
-
mapDraw?:
|
|
317
|
-
mapLocale?:
|
|
363
|
+
visibleLayers?: MapControlItem;
|
|
364
|
+
mapLegend?: MapControlItem;
|
|
365
|
+
toggle3d?: MapControlItem;
|
|
366
|
+
splitMap?: MapControlItem;
|
|
367
|
+
mapDraw?: MapControlItem;
|
|
368
|
+
mapLocale?: MapControlItem;
|
|
369
|
+
effect?: MapControlItem;
|
|
318
370
|
};
|
|
319
371
|
|
|
320
372
|
export type LoadFiles = {
|
|
@@ -332,11 +384,11 @@ export type Notifications = {
|
|
|
332
384
|
|
|
333
385
|
export type Locale = string;
|
|
334
386
|
|
|
335
|
-
export type
|
|
387
|
+
export type PanelListView = string;
|
|
336
388
|
|
|
337
389
|
export type UiState = {
|
|
338
390
|
readOnly: boolean;
|
|
339
|
-
activeSidePanel: string;
|
|
391
|
+
activeSidePanel: string | null;
|
|
340
392
|
currentModal: string | null;
|
|
341
393
|
datasetKeyToRemove: string | null;
|
|
342
394
|
visibleDropdown: string | null;
|
|
@@ -354,7 +406,12 @@ export type UiState = {
|
|
|
354
406
|
loadFiles: LoadFiles;
|
|
355
407
|
// Locale of the UI
|
|
356
408
|
locale: Locale;
|
|
357
|
-
|
|
409
|
+
// view layers by list or dataset
|
|
410
|
+
layerPanelListView: PanelListView;
|
|
411
|
+
// view filters by list or dataset
|
|
412
|
+
filterPanelListView: PanelListView;
|
|
413
|
+
// side panel close button visibility
|
|
414
|
+
isSidePanelCloseButtonVisible: boolean | null;
|
|
358
415
|
};
|
|
359
416
|
|
|
360
417
|
/** Width of viewport */
|
|
@@ -375,6 +432,12 @@ export type Viewport = {
|
|
|
375
432
|
longitude?: number;
|
|
376
433
|
/** Whether to enable drag and rotate map into perspective viewport */
|
|
377
434
|
dragRotate?: boolean;
|
|
435
|
+
/** Minimum allowed viewport zoom */
|
|
436
|
+
minZoom?: number;
|
|
437
|
+
/** Maximum allowed viewport zoom */
|
|
438
|
+
maxZoom?: number;
|
|
439
|
+
/** Maximum geographical bounds, pan/zoom operations are constrained within those bounds */
|
|
440
|
+
maxBounds?: Bounds;
|
|
378
441
|
};
|
|
379
442
|
|
|
380
443
|
export type MapStyles = {
|
|
@@ -386,6 +449,7 @@ export type VisibleLayerGroups = {
|
|
|
386
449
|
};
|
|
387
450
|
|
|
388
451
|
export type InputStyle = {
|
|
452
|
+
id?: string | null;
|
|
389
453
|
accessToken: string | null;
|
|
390
454
|
error: boolean;
|
|
391
455
|
isValid: boolean;
|
|
@@ -393,7 +457,8 @@ export type InputStyle = {
|
|
|
393
457
|
style: any | null;
|
|
394
458
|
url: string | null;
|
|
395
459
|
icon: string | null;
|
|
396
|
-
custom:
|
|
460
|
+
custom: CustomStyleType;
|
|
461
|
+
uploadedFile: File | null;
|
|
397
462
|
};
|
|
398
463
|
|
|
399
464
|
export type FilterRecord = {
|
|
@@ -409,3 +474,57 @@ export type FilterDatasetOpt = {
|
|
|
409
474
|
// ignore filter for domain calculation
|
|
410
475
|
ignoreDomain?: boolean;
|
|
411
476
|
};
|
|
477
|
+
|
|
478
|
+
/* DUPLICATES OF FILTER TYPES ABOVE, REMOVE ONCE TYPES ABOVE ARE FIXED */
|
|
479
|
+
|
|
480
|
+
type FilterBaseOmitRedudant = Omit<FilterBase<LineChart>, 'type' | 'domain'>;
|
|
481
|
+
|
|
482
|
+
export type TypedRangeFilter = FilterBaseOmitRedudant &
|
|
483
|
+
RangeFieldDomain & {
|
|
484
|
+
type: 'range';
|
|
485
|
+
fieldType: 'real' | 'integer';
|
|
486
|
+
value: [number, number];
|
|
487
|
+
fixedDomain: true;
|
|
488
|
+
typeOptions: ['range'];
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
export type TypedSelectFilter = FilterBaseOmitRedudant &
|
|
492
|
+
SelectFieldDomain & {
|
|
493
|
+
type: 'select';
|
|
494
|
+
fieldType: 'boolean';
|
|
495
|
+
value: boolean;
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
export type TypedMultiSelectFilter = FilterBaseOmitRedudant &
|
|
499
|
+
MultiSelectFieldDomain & {
|
|
500
|
+
type: 'multiSelect';
|
|
501
|
+
fieldType: 'string' | 'date';
|
|
502
|
+
value: string[];
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
export type TypedTimeRangeFilter = FilterBaseOmitRedudant &
|
|
506
|
+
TimeRangeFieldDomain & {
|
|
507
|
+
type: 'timeRange';
|
|
508
|
+
fieldType: 'timestamp';
|
|
509
|
+
fixedDomain: true;
|
|
510
|
+
value: [number, number];
|
|
511
|
+
bins?: Object;
|
|
512
|
+
plotType: {
|
|
513
|
+
[key: string]: any;
|
|
514
|
+
};
|
|
515
|
+
animationWindow: string;
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
export type TypedPolygonFilter = FilterBaseOmitRedudant & {
|
|
519
|
+
layerId: string[];
|
|
520
|
+
type: 'polygon';
|
|
521
|
+
fixedDomain: true;
|
|
522
|
+
value: Feature;
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
export type TypedFilter =
|
|
526
|
+
| TypedRangeFilter
|
|
527
|
+
| TypedTimeRangeFilter
|
|
528
|
+
| TypedSelectFilter
|
|
529
|
+
| TypedMultiSelectFilter
|
|
530
|
+
| TypedPolygonFilter;
|
package/schemas.d.ts
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
import {RGBColor, Merge, RGBAColor} from './types';
|
|
1
|
+
import {RGBColor, Merge, RGBAColor, RequireFrom} from './types';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
Filter,
|
|
5
|
+
TooltipInfo,
|
|
6
|
+
InteractionConfig,
|
|
7
|
+
AnimationConfig,
|
|
8
|
+
SplitMap,
|
|
9
|
+
Feature
|
|
10
|
+
} from './reducers';
|
|
4
11
|
|
|
5
12
|
import {LayerTextLabel} from './layers';
|
|
6
13
|
|
|
14
|
+
import {EffectConfig} from './effects';
|
|
15
|
+
|
|
7
16
|
export type SavedFilter = {
|
|
8
17
|
dataId: Filter['dataId'];
|
|
9
18
|
id: Filter['id'];
|
|
10
19
|
name: Filter['name'];
|
|
11
20
|
type: Filter['type'];
|
|
12
21
|
value: Filter['value'];
|
|
13
|
-
|
|
22
|
+
// deprecated
|
|
23
|
+
enlarged?: Filter['enlarged'];
|
|
24
|
+
view?: Filter['view'];
|
|
14
25
|
plotType: Filter['plotType'];
|
|
15
26
|
yAxis: {
|
|
16
27
|
name: string;
|
|
@@ -19,8 +30,8 @@ export type SavedFilter = {
|
|
|
19
30
|
speed: Filter['speed'];
|
|
20
31
|
layerId: Filter['layerId'];
|
|
21
32
|
};
|
|
22
|
-
|
|
23
|
-
export type ParsedFilter =
|
|
33
|
+
export type MinSavedFilter = RequireFrom<SavedFilter, 'dataId' | 'id' | 'name' | 'type' | 'value'>;
|
|
34
|
+
export type ParsedFilter = SavedFilter | MinSavedFilter;
|
|
24
35
|
|
|
25
36
|
export type SavedInteractionConfig = {
|
|
26
37
|
tooltip: TooltipInfo['config'] & {
|
|
@@ -54,17 +65,24 @@ export type SavedLayer = {
|
|
|
54
65
|
[key: string]: string;
|
|
55
66
|
};
|
|
56
67
|
isVisible: boolean;
|
|
57
|
-
visConfig:
|
|
68
|
+
visConfig: Record<string, any>;
|
|
58
69
|
hidden: boolean;
|
|
59
70
|
textLabel: Merge<LayerTextLabel, {field: {name: string; type: string} | null}>;
|
|
60
71
|
};
|
|
61
72
|
visualChannels: SavedVisualChannels;
|
|
62
73
|
};
|
|
74
|
+
export type MinSavedLayerConfig = RequireFrom<SavedLayer['config'], 'dataId' | 'columns'>;
|
|
75
|
+
export type MinSavedLayer = {
|
|
76
|
+
id: string;
|
|
77
|
+
type: string;
|
|
78
|
+
config: MinSavedLayerConfig;
|
|
79
|
+
visualChannels?: SavedVisualChannels;
|
|
80
|
+
};
|
|
81
|
+
export type ParsedLayer = SavedLayer | MinSavedLayer;
|
|
63
82
|
|
|
64
|
-
export type
|
|
65
|
-
id
|
|
66
|
-
|
|
67
|
-
config?: Partial<SavedLayer['config']>;
|
|
83
|
+
export type ParsedEffect = {
|
|
84
|
+
id: string;
|
|
85
|
+
config: EffectConfig;
|
|
68
86
|
};
|
|
69
87
|
|
|
70
88
|
export type SavedAnimationConfig = {
|
|
@@ -72,20 +90,41 @@ export type SavedAnimationConfig = {
|
|
|
72
90
|
speed: AnimationConfig['speed'];
|
|
73
91
|
};
|
|
74
92
|
|
|
93
|
+
export type SavedEditor = {
|
|
94
|
+
features: Feature[];
|
|
95
|
+
visible: boolean;
|
|
96
|
+
};
|
|
97
|
+
|
|
75
98
|
export type SavedVisState = {
|
|
76
99
|
filters: SavedFilter[];
|
|
77
100
|
layers: SavedLayer[];
|
|
78
101
|
interactionConfig: SavedInteractionConfig;
|
|
79
102
|
layerBlending: string;
|
|
103
|
+
overlayBlending?: string;
|
|
80
104
|
splitMaps: SplitMap[];
|
|
81
105
|
animationConfig: SavedAnimationConfig;
|
|
106
|
+
editor?: SavedEditor;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// Min saved config can be passed to addDataToMap
|
|
110
|
+
export type MinSavedVisStateV1 = {
|
|
111
|
+
filters?: MinSavedFilter[];
|
|
112
|
+
layers?: MinSavedLayer[];
|
|
113
|
+
interactionConfig?: Partial<SavedInteractionConfig>;
|
|
114
|
+
layerBlending?: string;
|
|
115
|
+
overlayBlending?: string;
|
|
116
|
+
splitMaps?: SplitMap[];
|
|
117
|
+
animationConfig?: SavedAnimationConfig;
|
|
118
|
+
editor?: SavedEditor;
|
|
82
119
|
};
|
|
83
120
|
|
|
84
121
|
export type ParsedVisState = {
|
|
85
122
|
layers?: ParsedLayer[];
|
|
123
|
+
effects?: ParsedEffect[];
|
|
86
124
|
filters?: ParsedFilter[];
|
|
87
125
|
interactionConfig?: Partial<SavedInteractionConfig>;
|
|
88
126
|
layerBlending?: string;
|
|
127
|
+
overlayBlending?: string;
|
|
89
128
|
splitMaps?: SplitMap[];
|
|
90
129
|
animationConfig?: Partial<SavedAnimationConfig>;
|
|
91
130
|
};
|
|
@@ -100,13 +139,17 @@ export type SavedMapState = {
|
|
|
100
139
|
isSplit: boolean;
|
|
101
140
|
};
|
|
102
141
|
|
|
142
|
+
export type SavedMapStateV1 = SavedMapState;
|
|
143
|
+
export type MinSavedMapStateV1 = Partial<SavedMapState>;
|
|
144
|
+
export type ParsedMapState = Partial<SavedMapState>;
|
|
145
|
+
|
|
103
146
|
export type SavedLayerGroups = {
|
|
104
147
|
[key: string]: boolean;
|
|
105
148
|
};
|
|
106
149
|
|
|
107
150
|
export type SavedCustomMapStyle = {
|
|
108
151
|
[key: string]: {
|
|
109
|
-
accessToken
|
|
152
|
+
accessToken?: string;
|
|
110
153
|
custom: boolean;
|
|
111
154
|
icon: string;
|
|
112
155
|
id: string;
|
|
@@ -123,6 +166,11 @@ export type SavedMapStyle = {
|
|
|
123
166
|
mapStyles: SavedCustomMapStyle;
|
|
124
167
|
};
|
|
125
168
|
|
|
169
|
+
export type SavedMapStyleV1 = SavedMapStyle;
|
|
170
|
+
export type MinSavedMapStyleV1 = Partial<SavedMapStyleV1>;
|
|
171
|
+
|
|
172
|
+
export type ParsedMapStyle = Partial<SavedMapStyleV1>;
|
|
173
|
+
|
|
126
174
|
/** Schema for v1 saved configuration */
|
|
127
175
|
export type SavedConfigV1 = {
|
|
128
176
|
version: 'v1';
|
|
@@ -133,12 +181,21 @@ export type SavedConfigV1 = {
|
|
|
133
181
|
};
|
|
134
182
|
};
|
|
135
183
|
|
|
184
|
+
// supported by addDataToMap
|
|
185
|
+
export type MinSavedConfigV1 = {
|
|
186
|
+
version: 'v1';
|
|
187
|
+
config: {
|
|
188
|
+
visState?: MinSavedVisStateV1;
|
|
189
|
+
mapState?: MinSavedMapStateV1;
|
|
190
|
+
mapStyle?: MinSavedMapStyleV1;
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
|
|
136
194
|
/** Schema for a parsed configuration ("normalized" across versions) */
|
|
137
195
|
export type ParsedConfig = {
|
|
138
|
-
version: string;
|
|
139
196
|
visState?: ParsedVisState;
|
|
140
|
-
mapState?:
|
|
141
|
-
mapStyle?:
|
|
197
|
+
mapState?: ParsedMapState;
|
|
198
|
+
mapStyle?: ParsedMapStyle;
|
|
142
199
|
};
|
|
143
200
|
|
|
144
201
|
export type SavedField = {
|
package/types.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export type Merge<A, B> = {[K in keyof A]: K extends keyof B ? B[K] : A[K]} & B
|
|
|
9
9
|
? {[K in keyof O]: O[K]}
|
|
10
10
|
: never;
|
|
11
11
|
|
|
12
|
+
export type RequireFrom<T, K extends keyof T> = Merge<Required<Pick<T, K>>, Partial<Omit<T, K>>>;
|
|
13
|
+
|
|
12
14
|
export type Entries<T> = {
|
|
13
15
|
[K in keyof T]: [K, T[K]];
|
|
14
16
|
}[keyof T][];
|