@kepler.gl/actions 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.
@@ -1,7 +1,25 @@
1
+ import { PickInfo } from '@deck.gl/core/lib/deck';
1
2
  import { default as ActionTypes } from './action-types';
2
3
  import { FileCacheItem } from '@kepler.gl/processors';
3
4
  import { Layer, LayerBaseConfig } from '@kepler.gl/layers';
4
- import { AddDataToMapPayload, ValueOf, Merge, RGBColor, NestedPartial, LayerVisConfig, ColorUI, Feature, InteractionConfig } from '@kepler.gl/types';
5
+ import { AddDataToMapPayload, ValueOf, Merge, RGBColor, NestedPartial, LayerVisConfig, ColorUI, Feature, FeatureSelectionContext, InteractionConfig, Filter, ParsedConfig, ParsedLayer, EffectConfig, EffectParamsPartial } from '@kepler.gl/types';
6
+ export declare type ApplyLayerConfigUpdaterAction = {
7
+ oldLayerId: string;
8
+ newLayerConfig: ParsedLayer;
9
+ layerIndex?: number;
10
+ };
11
+ /**
12
+ * Update layer base config: dataId, label, column, isVisible
13
+ * @param oldLayerId - layer id to be updated
14
+ * @param newLayerConfig - new layer config
15
+ * @param layerIndex - (Optional) Index of the layer to be updated (can be useful in some cases, because
16
+ * the layer id might change during update, e.g. when the type of the layer changes)
17
+ * @returns action
18
+ * @public
19
+ */
20
+ export declare function applyLayerConfig(oldLayerId: string, newLayerConfig: ParsedLayer, layerIndex?: number): Merge<ApplyLayerConfigUpdaterAction, {
21
+ type: typeof ActionTypes.APPLY_LAYER_CONFIG;
22
+ }>;
5
23
  export declare type LayerConfigChangeUpdaterAction = {
6
24
  oldLayer: Layer;
7
25
  newConfig: Partial<LayerBaseConfig>;
@@ -26,7 +44,7 @@ export declare type LayerTextLabelChangeUpdaterAction = {
26
44
  * Update layer text label
27
45
  * @param oldLayer - layer to be updated
28
46
  * @param idx -`idx` of text label to be updated
29
- * @param prop - `prop` of text label, e,g, `anchor`, `alignment`, `color`, `size`, `field`
47
+ * @param prop - `prop` of text label, e,g, `anchor`, `alignment`, `color`, `size`, `field`, `outlineWidth`, `outlineColor`
30
48
  * @param value - new value
31
49
  * @returns action
32
50
  * @public
@@ -34,6 +52,21 @@ export declare type LayerTextLabelChangeUpdaterAction = {
34
52
  export declare function layerTextLabelChange(oldLayer: Layer, idx: number | 'all', prop: string, value: any): Merge<LayerTextLabelChangeUpdaterAction, {
35
53
  type: typeof ActionTypes.LAYER_TEXT_LABEL_CHANGE;
36
54
  }>;
55
+ export declare type LayerSetIsValidUpdaterAction = {
56
+ oldLayer: Layer;
57
+ isValid: boolean;
58
+ };
59
+ /**
60
+ * Changes value of isValid flag for a layer.
61
+ * The action also updates visibility of the layer based on isValid.
62
+ * @param oldLayer - layer to be updated
63
+ * @param isValid - new value for isValid flag
64
+ * @returns action
65
+ * @public
66
+ */
67
+ export declare function layerSetIsValid(oldLayer: Layer, isValid: boolean): Merge<LayerSetIsValidUpdaterAction, {
68
+ type: typeof ActionTypes.LAYER_SET_IS_VALID;
69
+ }>;
37
70
  export declare type LayerTypeChangeUpdaterAction = {
38
71
  oldLayer: Layer;
39
72
  newType: string;
@@ -110,6 +143,19 @@ export declare type UpdateLayerBlendingUpdaterAction = {
110
143
  export declare function updateLayerBlending(mode: 'additive' | 'normal' | 'subtractive'): Merge<UpdateLayerBlendingUpdaterAction, {
111
144
  type: typeof ActionTypes.UPDATE_LAYER_BLENDING;
112
145
  }>;
146
+ export declare type UpdateOverlayBlendingUpdaterAction = {
147
+ mode: 'screen' | 'normal' | 'darken';
148
+ };
149
+ /**
150
+ * Update overlay blending mode
151
+ * @memberof visStateActions
152
+ * @param mode one of `screen`, `normal` and `darken`
153
+ * @returns action
154
+ * @public
155
+ */
156
+ export declare function updateOverlayBlending(mode: 'screen' | 'normal' | 'darken'): Merge<UpdateOverlayBlendingUpdaterAction, {
157
+ type: typeof ActionTypes.UPDATE_OVERLAY_BLENDING;
158
+ }>;
113
159
  export declare type InteractionConfigChangeUpdaterAction = {
114
160
  config: ValueOf<InteractionConfig>;
115
161
  };
@@ -174,16 +220,18 @@ export declare function setFilterAnimationWindow({ id, animationWindow }: SetFil
174
220
  type: typeof ActionTypes.SET_FILTER_ANIMATION_WINDOW;
175
221
  }>;
176
222
  export declare type AddFilterUpdaterAction = {
177
- dataId?: string | null;
223
+ dataId?: string | string[] | null;
224
+ id?: string;
178
225
  };
179
226
  /**
180
227
  * Add a new filter
181
228
  * @memberof visStateActions
182
229
  * @param dataId - dataset `id` this new filter is associated with
230
+ * @param id - `id` for the new filter
183
231
  * @returns action
184
232
  * @public
185
233
  */
186
- export declare function addFilter(dataId: string | null): Merge<AddFilterUpdaterAction, {
234
+ export declare function addFilter(dataId: string | null, id?: string): Merge<AddFilterUpdaterAction, {
187
235
  type: typeof ActionTypes.ADD_FILTER;
188
236
  }>;
189
237
  export declare type AddLayerUpdaterAction = {
@@ -202,7 +250,7 @@ export declare function addLayer(config?: object, datasetId?: string): Merge<Add
202
250
  type: typeof ActionTypes.ADD_LAYER;
203
251
  }>;
204
252
  export declare type ReorderLayerUpdaterAction = {
205
- order: number[];
253
+ order: string[];
206
254
  };
207
255
  /**
208
256
  * Reorder layer, order is an array of layer indexes, index 0 will be the one at the bottom
@@ -212,11 +260,11 @@ export declare type ReorderLayerUpdaterAction = {
212
260
  * @public
213
261
  * @example
214
262
  *
215
- * // bring `layers[1]` below `layers[0]`, the sequence layers will be rendered is `1`, `0`, `2`, `3`.
216
- * // `1` will be at the bottom, `3` will be at the top.
217
- * this.props.dispatch(reorderLayer([1, 0, 2, 3]));
263
+ * bring `layers[1]` below `layers[0]`, the sequence layers will be rendered is `layers[1].id`, `layers[0].id`, `layers[2].id`, `layers[3].id`.
264
+ * `layers[1]` will be at the bottom, `layers[13]` will be at the top.
265
+ * this.props.dispatch(reorderLayer([`layers[1].id`, `layers[0].id`, `layers[2].id`, `layers[3].id`]));
218
266
  */
219
- export declare function reorderLayer(order: number[]): Merge<ReorderLayerUpdaterAction, {
267
+ export declare function reorderLayer(order: string[]): Merge<ReorderLayerUpdaterAction, {
220
268
  type: typeof ActionTypes.REORDER_LAYER;
221
269
  }>;
222
270
  export declare type RemoveFilterUpdaterAction = {
@@ -233,31 +281,84 @@ export declare function removeFilter(idx: number): Merge<RemoveFilterUpdaterActi
233
281
  type: typeof ActionTypes.REMOVE_FILTER;
234
282
  }>;
235
283
  export declare type RemoveLayerUpdaterAction = {
236
- idx: number;
284
+ id: string;
237
285
  };
238
286
  /**
239
287
  * Remove a layer
240
288
  * @memberof visStateActions
241
- * @param idx idx of layer to be removed
289
+ * @param id idx of layer to be removed
242
290
  * @returns action
243
291
  * @public
244
292
  */
245
- export declare function removeLayer(idx: number): Merge<RemoveLayerUpdaterAction, {
293
+ export declare function removeLayer(id: string): Merge<RemoveLayerUpdaterAction, {
246
294
  type: typeof ActionTypes.REMOVE_LAYER;
247
295
  }>;
248
296
  export declare type DuplicateLayerUpdaterAction = {
249
- idx: number;
297
+ id: string;
250
298
  };
251
299
  /**
252
300
  * Duplicate a layer
253
301
  * @memberof visStateActions
254
- * @param idx idx of layer to be duplicated
302
+ * @param id id of layer to be duplicated
255
303
  * @returns action
256
304
  * @public
257
305
  */
258
- export declare function duplicateLayer(idx: number): Merge<DuplicateLayerUpdaterAction, {
306
+ export declare function duplicateLayer(id: string): Merge<DuplicateLayerUpdaterAction, {
259
307
  type: typeof ActionTypes.DUPLICATE_LAYER;
260
308
  }>;
309
+ export declare type AddEffectUpdaterAction = {
310
+ config: EffectParamsPartial;
311
+ };
312
+ /**
313
+ * Add a new effect
314
+ * @memberof visStateActions
315
+ * @param config - new effect config
316
+ * @returns action
317
+ * @public
318
+ */
319
+ export declare function addEffect(config: EffectParamsPartial): Merge<AddEffectUpdaterAction, {
320
+ type: typeof ActionTypes.ADD_EFFECT;
321
+ }>;
322
+ export declare type ReorderEffectUpdaterAction = {
323
+ order: string[];
324
+ };
325
+ /**
326
+ * Reorder effects
327
+ * @memberof visStateActions
328
+ * @param order an array of effect ids
329
+ * @returns action
330
+ * @public
331
+ */
332
+ export declare function reorderEffect(order: string[]): Merge<ReorderEffectUpdaterAction, {
333
+ type: typeof ActionTypes.REORDER_EFFECT;
334
+ }>;
335
+ export declare type RemoveEffectUpdaterAction = {
336
+ id: string;
337
+ };
338
+ /**
339
+ * Remove an effect
340
+ * @memberof visStateActions
341
+ * @param id idx of the effect to be removed
342
+ * @returns action
343
+ * @public
344
+ */
345
+ export declare function removeEffect(id: string): Merge<RemoveEffectUpdaterAction, {
346
+ type: typeof ActionTypes.REMOVE_EFFECT;
347
+ }>;
348
+ export declare type UpdateEffectUpdaterAction = {
349
+ id: string;
350
+ props: Partial<EffectConfig>;
351
+ };
352
+ /**
353
+ * Update an effect
354
+ * @memberof visStateActions
355
+ * @param props idx of the effect to be updated with specified props
356
+ * @returns action
357
+ * @public
358
+ */
359
+ export declare function updateEffect(id: string, props: Partial<EffectConfig>): Merge<UpdateEffectUpdaterAction, {
360
+ type: typeof ActionTypes.UPDATE_EFFECT;
361
+ }>;
261
362
  export declare type RemoveDatasetUpdaterAction = {
262
363
  dataId: string;
263
364
  };
@@ -344,6 +445,24 @@ export declare type CopyTableColumnUpdaterAction = {
344
445
  export declare function copyTableColumn(dataId: string, column: string): Merge<CopyTableColumnUpdaterAction, {
345
446
  type: typeof ActionTypes.COPY_TABLE_COLUMN;
346
447
  }>;
448
+ export declare type SetColumnDisplayFormatUpdaterAction = {
449
+ dataId: string;
450
+ formats: {
451
+ [key: string]: string;
452
+ };
453
+ };
454
+ /**
455
+ * Set column display format
456
+ * @param dataId
457
+ * @param formats
458
+ * @returns action
459
+ * @public
460
+ */
461
+ export declare function setColumnDisplayFormat(dataId: string, formats: {
462
+ [key: string]: string;
463
+ }): Merge<SetColumnDisplayFormatUpdaterAction, {
464
+ type: typeof ActionTypes.SET_COLUMN_DISPLAY_FORMAT;
465
+ }>;
347
466
  export declare type AddDataToMapUpdaterOptions = {
348
467
  centrMap?: boolean;
349
468
  readOnly?: boolean;
@@ -352,8 +471,8 @@ export declare type AddDataToMapUpdaterOptions = {
352
471
  export declare type UpdateVisDataUpdaterAction = {
353
472
  datasets: AddDataToMapPayload['datasets'];
354
473
  options: AddDataToMapPayload['options'];
355
- config?: AddDataToMapPayload['config'];
356
- } & AddDataToMapPayload;
474
+ config?: ParsedConfig;
475
+ };
357
476
  /**
358
477
  * Add new dataset to `visState`, with option to load a map config along with the datasets
359
478
  * @memberof visStateActions
@@ -368,7 +487,7 @@ export declare type UpdateVisDataUpdaterAction = {
368
487
  * @returns action
369
488
  * @public
370
489
  */
371
- export declare function updateVisData(datasets: AddDataToMapPayload['datasets'], options: AddDataToMapPayload['options'], config?: AddDataToMapPayload['config']): Merge<UpdateVisDataUpdaterAction, {
490
+ export declare function updateVisData(datasets: AddDataToMapPayload['datasets'], options: AddDataToMapPayload['options'], config?: ParsedConfig): Merge<UpdateVisDataUpdaterAction, {
372
491
  type: typeof ActionTypes.UPDATE_VIS_DATA;
373
492
  }>;
374
493
  export declare type RenameDatasetUpdaterAction = {
@@ -386,6 +505,27 @@ export declare type RenameDatasetUpdaterAction = {
386
505
  export declare function renameDataset(dataId: string, label: string): Merge<RenameDatasetUpdaterAction, {
387
506
  type: typeof ActionTypes.RENAME_DATASET;
388
507
  }>;
508
+ export declare type UpdateDatasetPropsUpdaterAction = {
509
+ dataId: string;
510
+ props: {
511
+ label?: string;
512
+ color?: RGBColor;
513
+ metadata?: Record<string, unknown>;
514
+ };
515
+ };
516
+ /**
517
+ * Update an existing dataset props in `visState`
518
+ * @param dataId - ***required** Id of the dataset to update
519
+ * @param props - ***required** New props to update
520
+ * @returns action
521
+ */
522
+ export declare function updateDatasetProps(dataId: string, props: {
523
+ label?: string;
524
+ color?: RGBColor;
525
+ metadata?: Record<string, unknown>;
526
+ }): Merge<UpdateDatasetPropsUpdaterAction, {
527
+ type: typeof ActionTypes.UPDATE_DATASET_PROPS;
528
+ }>;
389
529
  export declare type ToggleFilterAnimationUpdaterAction = {
390
530
  idx: number;
391
531
  };
@@ -460,18 +600,20 @@ export declare type ToggleLayerAnimationControlUpdaterAction = {};
460
600
  export declare function toggleLayerAnimationControl(): Merge<ToggleLayerAnimationControlUpdaterAction, {
461
601
  type: typeof ActionTypes.TOGGLE_LAYER_ANIMATION_CONTROL;
462
602
  }>;
463
- export declare type EnlargeFilterUpdaterAction = {
603
+ export declare type SetFilterViewUpdaterAction = {
464
604
  idx: number;
605
+ view: Filter['view'];
465
606
  };
466
607
  /**
467
608
  * Show larger time filter at bottom for time playback (apply to time filter only)
468
609
  * @memberof visStateActions
469
610
  * @param idx - index of filter to enlarge
611
+ * @param view - type of filter view
470
612
  * @returns action
471
613
  * @public
472
614
  */
473
- export declare function enlargeFilter(idx: number): Merge<EnlargeFilterUpdaterAction, {
474
- type: typeof ActionTypes.ENLARGE_FILTER;
615
+ export declare function setFilterView(idx: number, view: Filter['view']): Merge<SetFilterViewUpdaterAction, {
616
+ type: typeof ActionTypes.SET_FILTER_VIEW;
475
617
  }>;
476
618
  export declare type ToggleFilterFeatureUpdaterAction = {
477
619
  idx: number;
@@ -486,26 +628,24 @@ export declare function toggleFilterFeature(idx: number): Merge<ToggleFilterFeat
486
628
  type: typeof ActionTypes.TOGGLE_FILTER_FEATURE;
487
629
  }>;
488
630
  export declare type OnLayerHoverUpdaterAction = {
489
- info: {
490
- picked?: boolean;
491
- } | null;
631
+ info: (PickInfo<any> & {
632
+ mapIndex?: number;
633
+ }) | null;
492
634
  };
493
635
  /**
494
636
  * Trigger layer hover event with hovered object
495
637
  * @memberof visStateActions
496
- * @param info - Object hovered, returned by deck.gl
638
+ * @param info - Object hovered, returned by deck.gl. Includes an optional `mapIndex` property for limiting the display of the `<MapPopover>` to the `<MapContainer>` the user is interacting with.
497
639
  * @returns action
498
640
  * @public
499
641
  */
500
- export declare function onLayerHover(info: {
501
- picked?: boolean;
502
- } | null): Merge<OnLayerHoverUpdaterAction, {
642
+ export declare function onLayerHover(info: (PickInfo<any> & {
643
+ mapIndex?: number;
644
+ }) | null): Merge<OnLayerHoverUpdaterAction, {
503
645
  type: typeof ActionTypes.LAYER_HOVER;
504
646
  }>;
505
647
  export declare type OnLayerClickUpdaterAction = {
506
- info: {
507
- picked?: boolean;
508
- } | null;
648
+ info: PickInfo<any> | null;
509
649
  };
510
650
  /**
511
651
  * Trigger layer click event with clicked object
@@ -514,9 +654,7 @@ export declare type OnLayerClickUpdaterAction = {
514
654
  * @returns action
515
655
  * @public
516
656
  */
517
- export declare function onLayerClick(info: {
518
- picked?: boolean;
519
- } | null): Merge<OnLayerClickUpdaterAction, {
657
+ export declare function onLayerClick(info: PickInfo<any> | null): Merge<OnLayerClickUpdaterAction, {
520
658
  type: typeof ActionTypes.LAYER_CLICK;
521
659
  }>;
522
660
  export declare type OnMapClickUpdaterAction = {};
@@ -683,15 +821,18 @@ export declare function setPolygonFilterLayer(layer: Layer, feature: Feature): M
683
821
  type: typeof ActionTypes.SET_POLYGON_FILTER_LAYER;
684
822
  }>;
685
823
  export declare type SetSelectedFeatureUpdaterAction = {
686
- feature: Feature;
824
+ feature: Feature | null;
825
+ selectionContext?: FeatureSelectionContext;
687
826
  };
688
827
  /**
689
- * Set the current feature to be edited/deleted
828
+ * Set the current feature to be edited/deleted,
829
+ * and the context of how the feature was selected.
690
830
  * @memberof visStateActions
691
831
  * @param feature
832
+ * @param selectionContext
692
833
  * @returns action
693
834
  */
694
- export declare function setSelectedFeature(feature: Feature): Merge<SetSelectedFeatureUpdaterAction, {
835
+ export declare function setSelectedFeature(feature: Feature | null, selectionContext?: FeatureSelectionContext): Merge<SetSelectedFeatureUpdaterAction, {
695
836
  type: typeof ActionTypes.SET_SELECTED_FEATURE;
696
837
  }>;
697
838
  export declare type DeleteFeatureUpdaterAction = {