@kepler.gl/actions 3.3.0-alpha.2 → 3.3.0-alpha.21

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 (57) hide show
  1. package/dist/action-types.d.ts +103 -1
  2. package/dist/action-wrapper.d.ts +22 -17
  3. package/dist/actions.d.ts +13 -0
  4. package/dist/cjs/action-types.js +266 -0
  5. package/dist/cjs/action-types.js.map +1 -0
  6. package/dist/cjs/action-wrapper.js +177 -0
  7. package/dist/cjs/action-wrapper.js.map +1 -0
  8. package/dist/cjs/actions.js +193 -0
  9. package/dist/cjs/actions.js.map +1 -0
  10. package/dist/cjs/identity-actions.js +86 -0
  11. package/dist/cjs/identity-actions.js.map +1 -0
  12. package/dist/cjs/index.js +182 -0
  13. package/dist/cjs/index.js.map +1 -0
  14. package/dist/cjs/map-state-actions.js +174 -0
  15. package/dist/cjs/map-state-actions.js.map +1 -0
  16. package/dist/cjs/map-style-actions.js +211 -0
  17. package/dist/cjs/map-style-actions.js.map +1 -0
  18. package/dist/cjs/provider-actions.js +99 -0
  19. package/dist/cjs/provider-actions.js.map +1 -0
  20. package/dist/cjs/ui-state-actions.js +463 -0
  21. package/dist/cjs/ui-state-actions.js.map +1 -0
  22. package/dist/cjs/vis-state-actions.js +1859 -0
  23. package/dist/cjs/vis-state-actions.js.map +1 -0
  24. package/dist/esm/action-types.js +260 -0
  25. package/dist/esm/action-types.js.map +1 -0
  26. package/dist/esm/action-wrapper.js +171 -0
  27. package/dist/esm/action-wrapper.js.map +1 -0
  28. package/dist/esm/actions.js +186 -0
  29. package/dist/esm/actions.js.map +1 -0
  30. package/dist/esm/identity-actions.js +79 -0
  31. package/dist/esm/identity-actions.js.map +1 -0
  32. package/dist/esm/index.js +27 -0
  33. package/dist/esm/index.js.map +1 -0
  34. package/dist/esm/map-state-actions.js +167 -0
  35. package/dist/esm/map-state-actions.js.map +1 -0
  36. package/dist/esm/map-style-actions.js +204 -0
  37. package/dist/esm/map-style-actions.js.map +1 -0
  38. package/dist/esm/provider-actions.js +93 -0
  39. package/dist/esm/provider-actions.js.map +1 -0
  40. package/dist/esm/ui-state-actions.js +456 -0
  41. package/dist/esm/ui-state-actions.js.map +1 -0
  42. package/dist/esm/vis-state-actions.js +1728 -0
  43. package/dist/esm/vis-state-actions.js.map +1 -0
  44. package/dist/map-state-actions.d.ts +51 -3
  45. package/dist/ui-state-actions.d.ts +77 -2
  46. package/dist/vis-state-actions.d.ts +573 -21
  47. package/package.json +25 -22
  48. package/dist/action-types.js +0 -213
  49. package/dist/action-wrapper.js +0 -174
  50. package/dist/actions.js +0 -187
  51. package/dist/identity-actions.js +0 -86
  52. package/dist/index.js +0 -183
  53. package/dist/map-state-actions.js +0 -129
  54. package/dist/map-style-actions.js +0 -211
  55. package/dist/provider-actions.js +0 -99
  56. package/dist/ui-state-actions.js +0 -388
  57. package/dist/vis-state-actions.js +0 -1299
@@ -0,0 +1,1728 @@
1
+ import _typeof from "@babel/runtime/helpers/esm/typeof";
2
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ // SPDX-License-Identifier: MIT
6
+ // Copyright contributors to the kepler.gl project
7
+
8
+ // vis-state-reducer
9
+ import { default as ActionTypes } from './action-types';
10
+ import { createAction } from '@reduxjs/toolkit';
11
+
12
+ // TODO - import LoaderObject type from @loaders.gl/core when supported
13
+ // TODO - import LoadOptions type from @loaders.gl/core when supported
14
+
15
+ /**
16
+ * Update layer base config: dataId, label, column, isVisible
17
+ * @param oldLayerId - layer id to be updated
18
+ * @param newLayerConfig - new layer config
19
+ * @param layerIndex - (Optional) Index of the layer to be updated (can be useful in some cases, because
20
+ * the layer id might change during update, e.g. when the type of the layer changes)
21
+ * @returns action
22
+ * @public
23
+ */
24
+ export function applyLayerConfig(oldLayerId, newLayerConfig, layerIndex) {
25
+ return {
26
+ type: ActionTypes.APPLY_LAYER_CONFIG,
27
+ oldLayerId: oldLayerId,
28
+ newLayerConfig: newLayerConfig,
29
+ layerIndex: layerIndex
30
+ };
31
+ }
32
+ /**
33
+ * Update layer base config: dataId, label, column, isVisible
34
+ * @param oldLayer - layer to be updated
35
+ * @param newConfig - new config to be merged with old config
36
+ * @returns action
37
+ * @public
38
+ */
39
+ export function layerConfigChange(oldLayer, newConfig) {
40
+ return {
41
+ type: ActionTypes.LAYER_CONFIG_CHANGE,
42
+ oldLayer: oldLayer,
43
+ newConfig: newConfig
44
+ };
45
+ }
46
+ /**
47
+ * Update layer visibility depends on splitMap single or dual
48
+ * @param layerId - layerId to be updated
49
+ * @param isVisible - whether this layer is visible globally
50
+ * @param splitMapId - id for this splitMap
51
+ * @returns action
52
+ * @public
53
+ */
54
+ export function layerToggleVisibility(layerId, isVisible, splitMapId) {
55
+ return {
56
+ type: ActionTypes.LAYER_TOGGLE_VISIBILITY,
57
+ layerId: layerId,
58
+ isVisible: isVisible,
59
+ splitMapId: splitMapId
60
+ };
61
+ }
62
+ /**
63
+ * Update layer text label
64
+ * @param oldLayer - layer to be updated
65
+ * @param idx -`idx` of text label to be updated
66
+ * @param prop - `prop` of text label, e,g, `anchor`, `alignment`, `color`, `size`, `field`, `outlineWidth`, `outlineColor`
67
+ * @param value - new value
68
+ * @returns action
69
+ * @public
70
+ */
71
+ export function layerTextLabelChange(oldLayer, idx, prop, value) {
72
+ return {
73
+ type: ActionTypes.LAYER_TEXT_LABEL_CHANGE,
74
+ oldLayer: oldLayer,
75
+ idx: idx,
76
+ prop: prop,
77
+ value: value
78
+ };
79
+ }
80
+ /**
81
+ * Changes value of isValid flag for a layer.
82
+ * The action also updates visibility of the layer based on isValid.
83
+ * @param oldLayer - layer to be updated
84
+ * @param isValid - new value for isValid flag
85
+ * @returns action
86
+ * @public
87
+ */
88
+ export function layerSetIsValid(oldLayer, isValid) {
89
+ return {
90
+ type: ActionTypes.LAYER_SET_IS_VALID,
91
+ oldLayer: oldLayer,
92
+ isValid: isValid
93
+ };
94
+ }
95
+ /**
96
+ * Update layer type. Previews layer config will be copied if applicable.
97
+ * @param oldLayer - layer to be updated
98
+ * @param newType - new type
99
+ * @param options.fitBounds fit the map when the layer type dropdown gives an empty layer its first type
100
+ * @returns action
101
+ * @public
102
+ */
103
+ export function layerTypeChange(oldLayer, newType, options) {
104
+ return _objectSpread({
105
+ type: ActionTypes.LAYER_TYPE_CHANGE,
106
+ oldLayer: oldLayer,
107
+ newType: newType
108
+ }, options !== null && options !== void 0 && options.fitBounds ? {
109
+ fitBounds: true
110
+ } : {});
111
+ }
112
+ /**
113
+ * Update layer visual channel
114
+ * @memberof visStateActions
115
+ * @param oldLayer - layer to be updated
116
+ * @param newConfig - new visual channel config
117
+ * @param channel - channel to be updated
118
+ * @returns action
119
+ * @public
120
+ */
121
+ export function layerVisualChannelConfigChange(oldLayer, newConfig, channel, newVisConfig) {
122
+ return {
123
+ type: ActionTypes.LAYER_VISUAL_CHANNEL_CHANGE,
124
+ oldLayer: oldLayer,
125
+ newConfig: newConfig,
126
+ channel: channel,
127
+ newVisConfig: newVisConfig
128
+ };
129
+ }
130
+ /**
131
+ * Update layer `visConfig`
132
+ * @memberof visStateActions
133
+ * @param oldLayer - layer to be updated
134
+ * @param newVisConfig - new visConfig as a key value map: e.g. `{opacity: 0.8}`
135
+ * @returns action
136
+ * @public
137
+ */
138
+ export function layerVisConfigChange(oldLayer, newVisConfig) {
139
+ return {
140
+ type: ActionTypes.LAYER_VIS_CONFIG_CHANGE,
141
+ oldLayer: oldLayer,
142
+ newVisConfig: newVisConfig
143
+ };
144
+ }
145
+ /**
146
+ * Set the color palette ui for layer color
147
+ * @memberof visStateActions
148
+ * @param oldLayer - layer to be updated
149
+ * @param prop - which color prop
150
+ * @param newConfig - to be merged
151
+ * @returns action
152
+ * @public
153
+ */
154
+ export function layerColorUIChange(oldLayer, prop, newConfig) {
155
+ return {
156
+ type: ActionTypes.LAYER_COLOR_UI_CHANGE,
157
+ oldLayer: oldLayer,
158
+ prop: prop,
159
+ newConfig: newConfig
160
+ };
161
+ }
162
+ /**
163
+ * Update layer blending mode
164
+ * @memberof visStateActions
165
+ * @param mode one of `additive`, `normal` and `subtractive`
166
+ * @returns action
167
+ * @public
168
+ */
169
+ export function updateLayerBlending(mode) {
170
+ return {
171
+ type: ActionTypes.UPDATE_LAYER_BLENDING,
172
+ mode: mode
173
+ };
174
+ }
175
+ /**
176
+ * Update overlay blending mode
177
+ * @memberof visStateActions
178
+ * @param mode one of `screen`, `normal` and `darken`
179
+ * @returns action
180
+ * @public
181
+ */
182
+ export function updateOverlayBlending(mode) {
183
+ return {
184
+ type: ActionTypes.UPDATE_OVERLAY_BLENDING,
185
+ mode: mode
186
+ };
187
+ }
188
+ /**
189
+ * Update `interactionConfig`
190
+ * @memberof visStateActions
191
+ * @param config - new config as key value map: `{tooltip: {enabled: true}}`
192
+ * @returns action
193
+ * @public
194
+ */
195
+ export function interactionConfigChange(config) {
196
+ return {
197
+ type: ActionTypes.INTERACTION_CONFIG_CHANGE,
198
+ config: config
199
+ };
200
+ }
201
+ /**
202
+ * Update filter config
203
+ * @param filterId - id of the filter to be updated
204
+ * @param newFilter - new filter config
205
+ * @returns action
206
+ * @public
207
+ */
208
+ export function applyFilterConfig(filterId, newFilter) {
209
+ return {
210
+ type: ActionTypes.APPLY_FILTER_CONFIG,
211
+ filterId: filterId,
212
+ newFilter: newFilter
213
+ };
214
+ }
215
+ /**
216
+ * Update filter property
217
+ * @memberof visStateActions
218
+ * @param idx -`idx` of filter to be updated
219
+ * @param prop - `prop` of filter, e,g, `dataId`, `name`, `value`
220
+ * or an array e.g. ['idx', 'name']. in that case the value
221
+ * should also be an array of the corresponding values (by index)
222
+ * @param value - new value
223
+ * @param valueIndex - dataId index
224
+ * @returns action
225
+ * @public
226
+ */
227
+ export function setFilter(idx, prop, value, valueIndex) {
228
+ return {
229
+ type: ActionTypes.SET_FILTER,
230
+ idx: idx,
231
+ prop: prop,
232
+ value: value,
233
+ valueIndex: valueIndex
234
+ };
235
+ }
236
+ /**
237
+ * Same as Update filter
238
+ * @memberof visStateActions
239
+ * @param idx -`idx` of filter to be updated
240
+ * @param prop - `prop` of filter, e,g, `dataId`, `name`, `value`
241
+ * @param value - new value
242
+ * @param valueIndex - dataId index
243
+ * @returns action
244
+ * @public
245
+ */
246
+ export function setFilterAnimationTime(idx, prop, value, valueIndex) {
247
+ return {
248
+ type: ActionTypes.SET_FILTER_ANIMATION_TIME,
249
+ idx: idx,
250
+ prop: prop,
251
+ value: value,
252
+ valueIndex: valueIndex
253
+ };
254
+ }
255
+ /**
256
+ * Same as Update filter
257
+ * @memberof visStateActions
258
+ * @public
259
+ */
260
+ export function setFilterAnimationWindow(_ref) {
261
+ var id = _ref.id,
262
+ animationWindow = _ref.animationWindow;
263
+ return {
264
+ type: ActionTypes.SET_FILTER_ANIMATION_WINDOW,
265
+ id: id,
266
+ animationWindow: animationWindow
267
+ };
268
+ }
269
+ /**
270
+ * Add a new filter
271
+ * @memberof visStateActions
272
+ * @param dataId - dataset `id` this new filter is associated with
273
+ * @param id - `id` for the new filter
274
+ * @returns action
275
+ * @public
276
+ */
277
+ export function addFilter(dataId, id) {
278
+ return {
279
+ type: ActionTypes.ADD_FILTER,
280
+ dataId: dataId,
281
+ id: id
282
+ };
283
+ }
284
+ /**
285
+ * Create or updates a filter
286
+ * @memberof visStateActions
287
+ * @param dataId - dataset `id` this new filter is associated with
288
+ * @returns action
289
+ * @public
290
+ */
291
+ export function createOrUpdateFilter(id, dataId, field, value) {
292
+ return {
293
+ type: ActionTypes.CREATE_OR_UPDATE_FILTER,
294
+ id: id,
295
+ dataId: dataId,
296
+ field: field,
297
+ value: value
298
+ };
299
+ }
300
+ /**
301
+ * Add a new layer
302
+ * @memberof visStateActions
303
+ * @param config - new layer config
304
+ * @param datasetId - dataset id used for creating an empty layer
305
+ * @returns action
306
+ * @public
307
+ */
308
+ export function addLayer(config, datasetId) {
309
+ return {
310
+ type: ActionTypes.ADD_LAYER,
311
+ config: config,
312
+ datasetId: datasetId
313
+ };
314
+ }
315
+ /**
316
+ * Reorder layer, order is an array of layer indexes, index 0 will be the one at the bottom
317
+ * @memberof visStateActions
318
+ * @param order an array of layer indexes
319
+ * @returns action
320
+ * @public
321
+ * @example
322
+ *
323
+ * 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`.
324
+ * `layers[1]` will be at the bottom, `layers[13]` will be at the top.
325
+ * this.props.dispatch(reorderLayer([`layers[1].id`, `layers[0].id`, `layers[2].id`, `layers[3].id`]));
326
+ */
327
+ export function reorderLayer(order) {
328
+ return {
329
+ type: ActionTypes.REORDER_LAYER,
330
+ order: order
331
+ };
332
+ }
333
+ export function addLayerGroup(payload) {
334
+ return _objectSpread({
335
+ type: ActionTypes.ADD_LAYER_GROUP
336
+ }, payload);
337
+ }
338
+ export function removeLayerGroup(payload) {
339
+ return _objectSpread({
340
+ type: ActionTypes.REMOVE_LAYER_GROUP
341
+ }, payload);
342
+ }
343
+ export function updateLayerGroup(payload) {
344
+ return _objectSpread({
345
+ type: ActionTypes.UPDATE_LAYER_GROUP
346
+ }, payload);
347
+ }
348
+ export function addLayerToLayerGroup(payload) {
349
+ return _objectSpread({
350
+ type: ActionTypes.ADD_LAYER_TO_LAYER_GROUP
351
+ }, payload);
352
+ }
353
+ export function removeLayerFromLayerGroup(payload) {
354
+ return _objectSpread({
355
+ type: ActionTypes.REMOVE_LAYER_FROM_LAYER_GROUP
356
+ }, payload);
357
+ }
358
+ export function swapLayerOrderEntries(payload) {
359
+ return _objectSpread({
360
+ type: ActionTypes.SWAP_LAYER_ORDER_ENTRIES
361
+ }, payload);
362
+ }
363
+ /**
364
+ * Remove a filter from `visState.filters`, once a filter is removed, data will be re-filtered and layer will be updated
365
+ * @memberof visStateActions
366
+ * @param idx idx of filter to be removed
367
+ * @returns action
368
+ * @public
369
+ */
370
+ export function removeFilter(idx) {
371
+ return {
372
+ type: ActionTypes.REMOVE_FILTER,
373
+ idx: idx
374
+ };
375
+ }
376
+ /**
377
+ * Remove a layer
378
+ * @memberof visStateActions
379
+ * @param id idx of layer to be removed
380
+ * @returns action
381
+ * @public
382
+ */
383
+ export function removeLayer(id) {
384
+ return {
385
+ type: ActionTypes.REMOVE_LAYER,
386
+ id: id
387
+ };
388
+ }
389
+ /**
390
+ * Duplicate a layer
391
+ * @memberof visStateActions
392
+ * @param id id of layer to be duplicated
393
+ * @returns action
394
+ * @public
395
+ */
396
+ export function duplicateLayer(id) {
397
+ return {
398
+ type: ActionTypes.DUPLICATE_LAYER,
399
+ id: id
400
+ };
401
+ }
402
+ /**
403
+ * Add a new effect
404
+ * @memberof visStateActions
405
+ * @param config - new effect config
406
+ * @returns action
407
+ * @public
408
+ */
409
+ export function addEffect(config) {
410
+ return {
411
+ type: ActionTypes.ADD_EFFECT,
412
+ config: config
413
+ };
414
+ }
415
+ /**
416
+ * Reorder effects
417
+ * @memberof visStateActions
418
+ * @param order an array of effect ids
419
+ * @returns action
420
+ * @public
421
+ */
422
+ export function reorderEffect(order) {
423
+ return {
424
+ type: ActionTypes.REORDER_EFFECT,
425
+ order: order
426
+ };
427
+ }
428
+ /**
429
+ * Remove an effect
430
+ * @memberof visStateActions
431
+ * @param id idx of the effect to be removed
432
+ * @returns action
433
+ * @public
434
+ */
435
+ export function removeEffect(id) {
436
+ return {
437
+ type: ActionTypes.REMOVE_EFFECT,
438
+ id: id
439
+ };
440
+ }
441
+ /**
442
+ * Update an effect
443
+ * @memberof visStateActions
444
+ * @param props idx of the effect to be updated with specified props
445
+ * @returns action
446
+ * @public
447
+ */
448
+ export function updateEffect(id, props) {
449
+ return {
450
+ type: ActionTypes.UPDATE_EFFECT,
451
+ id: id,
452
+ props: props
453
+ };
454
+ }
455
+
456
+ // Chart Actions
457
+
458
+ /**
459
+ * Add a chart to the charts panel
460
+ * @memberof visStateActions
461
+ * @param chart - chart config
462
+ * @returns action
463
+ * @public
464
+ */
465
+ export function addChart(chart) {
466
+ return {
467
+ type: ActionTypes.ADD_CHART,
468
+ chart: chart
469
+ };
470
+ }
471
+ /**
472
+ * Update a chart
473
+ * @memberof visStateActions
474
+ * @param id - chart id
475
+ * @param props - partial chart config
476
+ * @returns action
477
+ * @public
478
+ */
479
+ export function updateChart(id, props) {
480
+ return {
481
+ type: ActionTypes.UPDATE_CHART,
482
+ id: id,
483
+ props: props
484
+ };
485
+ }
486
+ /**
487
+ * Remove a chart
488
+ * @memberof visStateActions
489
+ * @param id - chart id
490
+ * @returns action
491
+ * @public
492
+ */
493
+ export function removeChart(id) {
494
+ return {
495
+ type: ActionTypes.REMOVE_CHART,
496
+ id: id
497
+ };
498
+ }
499
+
500
+ /** Replace the ordered collection of saved camera bookmarks. */
501
+ export var setCameraBookmarks = createAction(ActionTypes.SET_CAMERA_BOOKMARKS);
502
+
503
+ /** Replace the single authored camera tour; null removes it. */
504
+ export var setCameraTour = createAction(ActionTypes.SET_CAMERA_TOUR);
505
+
506
+ // Annotation Actions
507
+
508
+ /**
509
+ * Add a new annotation
510
+ * @memberof visStateActions
511
+ * @param config - new annotation config
512
+ * @returns action
513
+ * @public
514
+ */
515
+ export function addAnnotation(config) {
516
+ return {
517
+ type: ActionTypes.ADD_ANNOTATION,
518
+ config: config
519
+ };
520
+ }
521
+ /**
522
+ * Remove an annotation
523
+ * @memberof visStateActions
524
+ * @param id id of the annotation to be removed
525
+ * @returns action
526
+ * @public
527
+ */
528
+ export function removeAnnotation(id) {
529
+ return {
530
+ type: ActionTypes.REMOVE_ANNOTATION,
531
+ id: id
532
+ };
533
+ }
534
+ /**
535
+ * Update an annotation
536
+ * @memberof visStateActions
537
+ * @param id id of the annotation to be updated
538
+ * @param config partial annotation config to merge
539
+ * @returns action
540
+ * @public
541
+ */
542
+ export function updateAnnotation(id, config) {
543
+ return {
544
+ type: ActionTypes.UPDATE_ANNOTATION,
545
+ id: id,
546
+ config: config
547
+ };
548
+ }
549
+ /**
550
+ * Duplicate an annotation
551
+ * @memberof visStateActions
552
+ * @param id id of the annotation to be duplicated
553
+ * @returns action
554
+ * @public
555
+ */
556
+ export function duplicateAnnotation(id) {
557
+ return {
558
+ type: ActionTypes.DUPLICATE_ANNOTATION,
559
+ id: id
560
+ };
561
+ }
562
+ /**
563
+ * Set the selected annotation
564
+ * @memberof visStateActions
565
+ * @param id id of annotation to select, or null to deselect
566
+ * @param isEditingText whether the text of the annotation is being edited
567
+ * @returns action
568
+ * @public
569
+ */
570
+ export function setSelectedAnnotation(id, isEditingText) {
571
+ return {
572
+ type: ActionTypes.SET_SELECTED_ANNOTATION,
573
+ id: id,
574
+ isEditingText: isEditingText
575
+ };
576
+ }
577
+ /**
578
+ * Remove a dataset and all layers, filters, tooltip configs that based on it
579
+ * @memberof visStateActions
580
+ * @param dataId dataset id
581
+ * @returns action
582
+ * @public
583
+ */
584
+ export function removeDataset(dataId) {
585
+ return {
586
+ type: ActionTypes.REMOVE_DATASET,
587
+ dataId: dataId
588
+ };
589
+ }
590
+ /**
591
+ * Display dataset table in a modal
592
+ * @memberof visStateActions
593
+ * @param dataId dataset id to show in table
594
+ * @returns action
595
+ * @public
596
+ */
597
+ export function showDatasetTable(dataId) {
598
+ return {
599
+ type: ActionTypes.SHOW_DATASET_TABLE,
600
+ dataId: dataId
601
+ };
602
+ }
603
+ /**
604
+ * Update dataset color to custom by means of color picker
605
+ * @memberof visStateActions
606
+ * @param dataId dataset `id` this custom color is associated with
607
+ * @param newColor custom color in RGBformat
608
+ * @returns action
609
+ * @public
610
+ */
611
+ export function updateTableColor(dataId, newColor) {
612
+ return {
613
+ type: ActionTypes.UPDATE_TABLE_COLOR,
614
+ dataId: dataId,
615
+ newColor: newColor
616
+ };
617
+ }
618
+ /**
619
+ * Re-fetch an externally hosted dataset from its source URL.
620
+ * @memberof visStateActions
621
+ * @param dataId dataset id
622
+ * @returns action
623
+ * @public
624
+ */
625
+ export function refreshDataset(dataId) {
626
+ return {
627
+ type: ActionTypes.REFRESH_DATASET,
628
+ dataId: dataId
629
+ };
630
+ }
631
+ /**
632
+ * Apply a successful remote dataset refresh.
633
+ * @memberof visStateActions
634
+ * @returns action
635
+ */
636
+ export function refreshDatasetSuccess(dataId, result) {
637
+ return {
638
+ type: ActionTypes.REFRESH_DATASET_SUCCESS,
639
+ dataId: dataId,
640
+ result: result
641
+ };
642
+ }
643
+ /**
644
+ * Record a failed remote dataset refresh.
645
+ * @memberof visStateActions
646
+ * @returns action
647
+ */
648
+ export function refreshDatasetError(dataId, error) {
649
+ return {
650
+ type: ActionTypes.REFRESH_DATASET_ERROR,
651
+ dataId: dataId,
652
+ error: error
653
+ };
654
+ }
655
+ /**
656
+ * Update download progress for an in-flight remote dataset refresh (0–100).
657
+ * @memberof visStateActions
658
+ * @returns action
659
+ */
660
+ export function refreshDatasetProgress(dataId, percent) {
661
+ return {
662
+ type: ActionTypes.REFRESH_DATASET_PROGRESS,
663
+ dataId: dataId,
664
+ percent: percent
665
+ };
666
+ }
667
+
668
+ /**
669
+ * One dataset row: a column-ordered array (same as `ProtoDataset.data.rows`)
670
+ * or a field-name record. Missing keys become `null`.
671
+ */
672
+
673
+ /**
674
+ * Append rows to an existing in-memory row or Arrow dataset without `addDataToMap`.
675
+ * Keeps layer identity and style. Pass `options.upsertBy` to replace rows that
676
+ * share that key and append the rest.
677
+ *
678
+ * DuckDB tables (no INSERT yet) warn and leave the table unchanged. Arrow
679
+ * tables concat primitive columns in place; nested, binary, and geoarrow
680
+ * columns are rejected. Use `addDataToMap` with `keepExistingConfig` for a
681
+ * full replace.
682
+ * @memberof visStateActions
683
+ * @param dataId dataset id
684
+ * @param rows one row or an array of rows (arrays in field order, or objects keyed by field name)
685
+ * @param options optional `{upsertBy}` field name
686
+ * @returns action
687
+ * @public
688
+ */
689
+ export function addToDataset(dataId, rows, options) {
690
+ return {
691
+ type: ActionTypes.ADD_TO_DATASET,
692
+ dataId: dataId,
693
+ rows: rows,
694
+ options: options
695
+ };
696
+ }
697
+ /**
698
+ * Delete rows from an existing in-memory row or Arrow dataset without restyling layers.
699
+ * The second argument is either row indexes or `{field, values}` to match a
700
+ * column (e.g. an id). Out-of-range indexes are a no-op for the whole action.
701
+ *
702
+ * DuckDB tables warn and leave the table unchanged. Arrow tables concat the
703
+ * kept slices in place. For a full table replace use `addDataToMap` with
704
+ * `keepExistingConfig`.
705
+ * @memberof visStateActions
706
+ * @param dataId dataset id
707
+ * @param rowIndexesOrMatcher one index, an array of indexes, or `{field, values}`
708
+ * @returns action
709
+ * @public
710
+ */
711
+ export function removeFromDataset(dataId, rowIndexesOrMatcher) {
712
+ if (rowIndexesOrMatcher && _typeof(rowIndexesOrMatcher) === 'object' && !Array.isArray(rowIndexesOrMatcher) && 'field' in rowIndexesOrMatcher) {
713
+ return {
714
+ type: ActionTypes.REMOVE_FROM_DATASET,
715
+ dataId: dataId,
716
+ byField: rowIndexesOrMatcher
717
+ };
718
+ }
719
+ return {
720
+ type: ActionTypes.REMOVE_FROM_DATASET,
721
+ dataId: dataId,
722
+ rowIndexes: rowIndexesOrMatcher
723
+ };
724
+ }
725
+ /**
726
+ * Sort dataset column, for table display
727
+ * @memberof visStateActions
728
+ * @param dataId
729
+ * @param column
730
+ * @param mode
731
+ * @returns action
732
+ * @public
733
+ */
734
+ export function sortTableColumn(dataId, column, mode) {
735
+ return {
736
+ type: ActionTypes.SORT_TABLE_COLUMN,
737
+ dataId: dataId,
738
+ column: column,
739
+ mode: mode
740
+ };
741
+ }
742
+ /**
743
+ * Pin dataset column, for table display
744
+ * @param dataId
745
+ * @param column
746
+ * @returns action
747
+ * @public
748
+ */
749
+ export function pinTableColumn(dataId, column) {
750
+ return {
751
+ type: ActionTypes.PIN_TABLE_COLUMN,
752
+ dataId: dataId,
753
+ column: column
754
+ };
755
+ }
756
+ /**
757
+ * Hide or show a dataset column in the attribute table and in data export.
758
+ * @param dataId
759
+ * @param column
760
+ * @returns action
761
+ * @public
762
+ */
763
+ export function toggleTableColumnHidden(dataId, column) {
764
+ return {
765
+ type: ActionTypes.TOGGLE_TABLE_COLUMN_HIDDEN,
766
+ dataId: dataId,
767
+ column: column
768
+ };
769
+ }
770
+ /**
771
+ * Show every attribute-table column that was hidden.
772
+ * @param dataId
773
+ * @returns action
774
+ * @public
775
+ */
776
+ export function showAllTableColumns(dataId) {
777
+ return {
778
+ type: ActionTypes.SHOW_ALL_TABLE_COLUMNS,
779
+ dataId: dataId
780
+ };
781
+ }
782
+ /**
783
+ * Copy column, for table display
784
+ * @param dataId
785
+ * @param column
786
+ * @returns action
787
+ * @public
788
+ */
789
+ export function copyTableColumn(dataId, column) {
790
+ return {
791
+ type: ActionTypes.COPY_TABLE_COLUMN,
792
+ dataId: dataId,
793
+ column: column
794
+ };
795
+ }
796
+ /**
797
+ * Set column display format
798
+ * @param dataId
799
+ * @param formats
800
+ * @returns action
801
+ * @public
802
+ */
803
+ export function setColumnDisplayFormat(dataId, formats) {
804
+ return {
805
+ type: ActionTypes.SET_COLUMN_DISPLAY_FORMAT,
806
+ dataId: dataId,
807
+ formats: formats
808
+ };
809
+ }
810
+ /**
811
+ * Lazily compute column statistics for the data table header.
812
+ * @param dataId
813
+ * @param fieldName one or more field names
814
+ * @returns action
815
+ * @public
816
+ */
817
+ export function loadColumnStats(dataId, fieldName) {
818
+ return {
819
+ type: ActionTypes.LOAD_COLUMN_STATS,
820
+ dataId: dataId,
821
+ fieldName: fieldName
822
+ };
823
+ }
824
+ /**
825
+ * Column statistics finished loading
826
+ * @returns action
827
+ * @public
828
+ */
829
+ export function loadColumnStatsSuccess(dataId, fieldName, result, filterProps, request) {
830
+ return _objectSpread({
831
+ type: ActionTypes.LOAD_COLUMN_STATS_SUCCESS,
832
+ dataId: dataId,
833
+ fieldName: fieldName,
834
+ result: result,
835
+ filterProps: filterProps
836
+ }, request);
837
+ }
838
+ /**
839
+ * Column statistics failed to load
840
+ * @returns action
841
+ * @public
842
+ */
843
+ export function loadColumnStatsError(dataId, fieldName, error, request) {
844
+ return _objectSpread({
845
+ type: ActionTypes.LOAD_COLUMN_STATS_ERROR,
846
+ dataId: dataId,
847
+ fieldName: fieldName,
848
+ error: error
849
+ }, request);
850
+ }
851
+ // * @param dataset.info -info of a dataset
852
+ // * @param dataset.info.id - id of this dataset. If config is defined, `id` should matches the `dataId` in config.
853
+ // * @param dataset.info.label - A display name of this dataset
854
+ // * @param dataset.data - ***required** The data object, in a tabular format with 2 properties `fields` and `rows`
855
+ // * @param dataset.data.fields - ***required** Array of fields,
856
+ // * @param dataset.data.fields.name - ***required** Name of the field,
857
+ // * @param dataset.data.rows - ***required** Array of rows, in a tabular format with `fields` and `rows`
858
+ /**
859
+ * Add new dataset to `visState`, with option to load a map config along with the datasets
860
+ * @memberof visStateActions
861
+ * @param datasets - ***required** datasets can be a dataset or an array of datasets
862
+ * Each dataset object needs to have `info` and `data` property.
863
+ * @param {object} options
864
+ * @param options.centerMap `default: true` if `centerMap` is set to `true` kepler.gl will
865
+ * place the map view within the data points boundaries
866
+ * @param options.padding padding in pixels applied when `centerMap` is true so data is not hidden
867
+ * under the side panel or other UI. Can be a number or `{top, bottom, left, right}`.
868
+ * @param options.readOnly `default: false` if `readOnly` is set to `true`
869
+ * the left setting panel will be hidden
870
+ * @param config this object will contain the full kepler.gl instance configuration {mapState, mapStyle, visState}
871
+ * @returns action
872
+ * @public
873
+ */
874
+ export function updateVisData(datasets, options, config) {
875
+ return {
876
+ type: ActionTypes.UPDATE_VIS_DATA,
877
+ datasets: datasets,
878
+ options: options,
879
+ config: config
880
+ };
881
+ }
882
+ /**
883
+ * Rename an existing dataset in `visState`
884
+ * @memberof visStateActions
885
+ * @param dataId - ***required** Id of the dataset to update
886
+ * @param label - ***required** New name for the dataset
887
+ * @returns action
888
+ * @public
889
+ */
890
+ export function renameDataset(dataId, label) {
891
+ return {
892
+ type: ActionTypes.RENAME_DATASET,
893
+ dataId: dataId,
894
+ label: label
895
+ };
896
+ }
897
+ /**
898
+ * Update an existing dataset props in `visState`
899
+ * @param dataId - ***required** Id of the dataset to update
900
+ * @param props - ***required** New props to update
901
+ * @returns action
902
+ */
903
+ export function updateDatasetProps(dataId, props) {
904
+ return {
905
+ type: ActionTypes.UPDATE_DATASET_PROPS,
906
+ dataId: dataId,
907
+ props: props
908
+ };
909
+ }
910
+ /**
911
+ * Update an existing dataset's schema (columns + fields) in place.
912
+ * Unlike `addDataToMap`, this keeps the dataset `id`/`label`/`color`/`metadata`
913
+ * and reconciles layers, filters and tooltip config that referenced the old
914
+ * columns. Used by the AI assistant's `map.add-column` command.
915
+ * @param dataId - ***required** Id of the dataset to update
916
+ * @param data - ***required** New column data + field descriptors
917
+ * @param renames - (Optional) old column name → new column name, so layers/filters follow a rename
918
+ * @returns action
919
+ */
920
+ export function updateDataset(dataId, data, renames) {
921
+ return {
922
+ type: ActionTypes.UPDATE_DATASET,
923
+ dataId: dataId,
924
+ data: data,
925
+ renames: renames
926
+ };
927
+ }
928
+ /**
929
+ * Rename a dataset column. The new name becomes the field identity stored in
930
+ * layers, filters, charts, dataset operations, and saved maps.
931
+ * @param dataId - dataset id
932
+ * @param fieldName - current column name
933
+ * @param newName - next column name
934
+ * @returns action
935
+ * @public
936
+ */
937
+ export function renameTableColumn(dataId, fieldName, newName) {
938
+ return {
939
+ type: ActionTypes.RENAME_TABLE_COLUMN,
940
+ dataId: dataId,
941
+ fieldName: fieldName,
942
+ newName: newName
943
+ };
944
+ }
945
+ /**
946
+ * Convert every value in a dataset column and update its field type atomically.
947
+ * Invalid values leave the dataset unchanged and produce an error notification.
948
+ * @param dataId - dataset id
949
+ * @param fieldName - column name
950
+ * @param newType - target kepler.gl field type
951
+ * @returns action
952
+ * @public
953
+ */
954
+ export function changeTableColumnType(dataId, fieldName, newType) {
955
+ return {
956
+ type: ActionTypes.CHANGE_TABLE_COLUMN_TYPE,
957
+ dataId: dataId,
958
+ fieldName: fieldName,
959
+ newType: newType
960
+ };
961
+ }
962
+ /**
963
+ * Delete a dataset column and drop references that required it.
964
+ * @param dataId - dataset id
965
+ * @param fieldName - column name
966
+ * @returns action
967
+ * @public
968
+ */
969
+ export function deleteTableColumn(dataId, fieldName) {
970
+ return {
971
+ type: ActionTypes.DELETE_TABLE_COLUMN,
972
+ dataId: dataId,
973
+ fieldName: fieldName
974
+ };
975
+ }
976
+ /**
977
+ * Start and end filter animation
978
+ * @memberof visStateActions
979
+ * @param {Number} idx of filter
980
+ * @returns action
981
+ * @public
982
+ */
983
+ export function toggleFilterAnimation(idx) {
984
+ return {
985
+ type: ActionTypes.TOGGLE_FILTER_ANIMATION,
986
+ idx: idx
987
+ };
988
+ }
989
+ /**
990
+ * Change filter animation speed
991
+ * @memberof visStateActions
992
+ * @param idx - `idx` of filter
993
+ * @param speed - `speed` to change it to. `speed` is a multiplier
994
+ * @returns action
995
+ * @public
996
+ */
997
+ export function updateFilterAnimationSpeed(idx, speed) {
998
+ return {
999
+ type: ActionTypes.UPDATE_FILTER_ANIMATION_SPEED,
1000
+ idx: idx,
1001
+ speed: speed
1002
+ };
1003
+ }
1004
+ /**
1005
+ * Set animation config: works with both layer animation and filter animation
1006
+ * @param config
1007
+ * @returns action
1008
+ */
1009
+ export function setAnimationConfig(config) {
1010
+ return {
1011
+ type: ActionTypes.SET_ANIMATION_CONFIG,
1012
+ config: config
1013
+ };
1014
+ }
1015
+ /**
1016
+ * Reset animation
1017
+ * @memberof visStateActions
1018
+ * @param value - Current value of the slider
1019
+ * @returns action
1020
+ * @public
1021
+ */
1022
+ export function setLayerAnimationTime(value) {
1023
+ return {
1024
+ type: ActionTypes.SET_LAYER_ANIMATION_TIME,
1025
+ value: value
1026
+ };
1027
+ }
1028
+ /**
1029
+ * update trip layer animation speed
1030
+ * @memberof visStateActions
1031
+ * @param speed - `speed` to change it to. `speed` is a multiplier
1032
+ * @returns action
1033
+ * @public
1034
+ */
1035
+ export function updateLayerAnimationSpeed(speed) {
1036
+ return {
1037
+ type: ActionTypes.UPDATE_LAYER_ANIMATION_SPEED,
1038
+ speed: speed
1039
+ };
1040
+ }
1041
+ /**
1042
+ * start end end layer animation
1043
+ * @memberof visStateActions
1044
+ * @returns action
1045
+ * @public
1046
+ */
1047
+ export function toggleLayerAnimation() {
1048
+ return {
1049
+ type: ActionTypes.TOGGLE_LAYER_ANIMATION
1050
+ };
1051
+ }
1052
+ /**
1053
+ * hide and show layer animation control
1054
+ * @memberof visStateActions
1055
+ * @returns action
1056
+ * @public
1057
+ */
1058
+ export function toggleLayerAnimationControl() {
1059
+ return {
1060
+ type: ActionTypes.TOGGLE_LAYER_ANIMATION_CONTROL
1061
+ };
1062
+ }
1063
+ /**
1064
+ * Show larger time filter at bottom for time playback (apply to time filter only)
1065
+ * @memberof visStateActions
1066
+ * @param idx - index of filter to enlarge
1067
+ * @param view - type of filter view
1068
+ * @returns action
1069
+ * @public
1070
+ */
1071
+ export function setFilterView(idx, view) {
1072
+ return {
1073
+ type: ActionTypes.SET_FILTER_VIEW,
1074
+ idx: idx,
1075
+ view: view
1076
+ };
1077
+ }
1078
+ /**
1079
+ * Show/hide filter feature on map
1080
+ * @memberof visStateActions
1081
+ * @param idx - index of filter feature to show/hide
1082
+ * @return action
1083
+ */
1084
+ export function toggleFilterFeature(idx) {
1085
+ return {
1086
+ type: ActionTypes.TOGGLE_FILTER_FEATURE,
1087
+ idx: idx
1088
+ };
1089
+ }
1090
+ /**
1091
+ * Trigger layer hover event with hovered object
1092
+ * @memberof visStateActions
1093
+ * @param info - Object hovered, returned by deck.gl.
1094
+ * @param mapIndex - Optional property for limiting the display of the `<MapPopover>` to the `<MapContainer>` the user is interacting with.
1095
+ * @returns action
1096
+ * @public
1097
+ */
1098
+ export function onLayerHover(info, mapIndex) {
1099
+ return {
1100
+ type: ActionTypes.LAYER_HOVER,
1101
+ info: info,
1102
+ mapIndex: mapIndex
1103
+ };
1104
+ }
1105
+ /**
1106
+ * Trigger layer click event with clicked object
1107
+ * @memberof visStateActions
1108
+ * @param info - Object clicked, returned by deck.gl
1109
+ * @returns action
1110
+ * @public
1111
+ */
1112
+ export function onLayerClick(info) {
1113
+ return {
1114
+ type: ActionTypes.LAYER_CLICK,
1115
+ info: info
1116
+ };
1117
+ }
1118
+ /**
1119
+ * Trigger map click event, unselect clicked object
1120
+ * @memberof visStateActions
1121
+ * @returns action
1122
+ * @public
1123
+ */
1124
+ export function onMapClick() {
1125
+ return {
1126
+ type: ActionTypes.MAP_CLICK
1127
+ };
1128
+ }
1129
+ /**
1130
+ * Trigger map mouse moveevent, payload would be
1131
+ * React-map-gl MapLayerMouseEvent
1132
+ * https://visgl.github.io/react-map-gl/docs/api-reference/types#maplayermouseevent
1133
+ *
1134
+ * @memberof visStateActions
1135
+ * @param evt - MapLayerMouseEvent
1136
+ * @returns action
1137
+ * @public
1138
+ */
1139
+ export function onMouseMove(evt) {
1140
+ return {
1141
+ type: ActionTypes.MOUSE_MOVE,
1142
+ evt: evt
1143
+ };
1144
+ }
1145
+ /**
1146
+ * Toggle visibility of a layer in a split map
1147
+ * @memberof visStateActions
1148
+ * @param mapIndex - index of the split map
1149
+ * @param layerId - id of the layer
1150
+ * @returns action
1151
+ * @public
1152
+ */
1153
+ export function toggleLayerForMap(mapIndex, layerId) {
1154
+ return {
1155
+ type: ActionTypes.TOGGLE_LAYER_FOR_MAP,
1156
+ mapIndex: mapIndex,
1157
+ layerId: layerId
1158
+ };
1159
+ }
1160
+ /**
1161
+ * Set the property of a filter plot
1162
+ * @memberof visStateActions
1163
+ * @param idx
1164
+ * @param newProp key value mapping of new prop `{yAxis: 'histogram'}`
1165
+ * @param valueIndex dataId index
1166
+ * @returns action
1167
+ * @public
1168
+ */
1169
+ export function setFilterPlot(idx, newProp, valueIndex) {
1170
+ return {
1171
+ type: ActionTypes.SET_FILTER_PLOT,
1172
+ idx: idx,
1173
+ newProp: newProp,
1174
+ valueIndex: valueIndex
1175
+ };
1176
+ }
1177
+ /**
1178
+ * Set the property of a filter plot
1179
+ * @memberof visStateActions
1180
+ * @param info
1181
+ * @returns action
1182
+ * @public
1183
+ */
1184
+ export function setMapInfo(info) {
1185
+ return {
1186
+ type: ActionTypes.SET_MAP_INFO,
1187
+ info: info
1188
+ };
1189
+ }
1190
+ /**
1191
+ * Trigger file loading dispatch `addDataToMap` if succeed, or `loadFilesErr` if failed
1192
+ * @memberof visStateActions
1193
+ * @param files array of fileblob
1194
+ * @param onFinish called with the processed file cache. Defaults to `loadFilesSuccess`
1195
+ * @param options forwarded to `addDataToMap`. `autoCreateLayers` defaults to true when omitted
1196
+ * @returns action
1197
+ * @public
1198
+ */
1199
+ export function loadFiles(files, onFinish, options) {
1200
+ return _objectSpread({
1201
+ type: ActionTypes.LOAD_FILES,
1202
+ files: files,
1203
+ onFinish: onFinish
1204
+ }, options ? {
1205
+ options: options
1206
+ } : {});
1207
+ }
1208
+
1209
+ /**
1210
+ * Called with next file to load
1211
+ * @memberof visStateActions
1212
+ * @returns action
1213
+ * @public
1214
+ */
1215
+ export function loadNextFile(loadId) {
1216
+ return _objectSpread({
1217
+ type: ActionTypes.LOAD_NEXT_FILE
1218
+ }, loadId == null ? {} : {
1219
+ loadId: loadId
1220
+ });
1221
+ }
1222
+ /**
1223
+ * A zip in the load queue has been unpacked. The updater either parses a
1224
+ * single shapefile archive or enqueues one dataset per supported member.
1225
+ * @memberof visStateActions
1226
+ */
1227
+ export function expandZipArchiveSuccess(payload) {
1228
+ return _objectSpread({
1229
+ type: ActionTypes.EXPAND_ZIP_ARCHIVE_SUCCESS
1230
+ }, payload);
1231
+ }
1232
+ /**
1233
+ * called when all files are processed and loaded
1234
+ * @memberof visStateActions
1235
+ * @param result
1236
+ * @param options forwarded to `addDataToMap`
1237
+ * @returns action
1238
+ */
1239
+ export function loadFilesSuccess(result, options) {
1240
+ return _objectSpread({
1241
+ type: ActionTypes.LOAD_FILES_SUCCESS,
1242
+ result: result
1243
+ }, options ? {
1244
+ options: options
1245
+ } : {});
1246
+ }
1247
+ /**
1248
+ * Confirm a staged upload as a replacement for one dataset.
1249
+ * The first dataset remaps that dataset's layers and filters. Further datasets are added.
1250
+ * @memberof visStateActions
1251
+ * @param payload.result staged file cache the user left checked
1252
+ * @param payload.datasetToReplaceId dataset the menu action selected
1253
+ * @param payload.deleteOriginalDataset drop the original table. Defaults to true
1254
+ * @public
1255
+ */
1256
+ export function confirmReplaceDataset(payload) {
1257
+ return {
1258
+ type: ActionTypes.CONFIRM_REPLACE_DATASET,
1259
+ result: payload.result,
1260
+ datasetToReplaceId: payload.datasetToReplaceId,
1261
+ deleteOriginalDataset: payload.deleteOriginalDataset
1262
+ };
1263
+ }
1264
+ /**
1265
+ * Store processed files without adding them to the map or closing the modal.
1266
+ * @memberof visStateActions
1267
+ * @param result processed file cache
1268
+ * @returns action
1269
+ * @public
1270
+ */
1271
+ export function stageLoadedFiles(result) {
1272
+ return {
1273
+ type: ActionTypes.STAGE_LOADED_FILES,
1274
+ result: result
1275
+ };
1276
+ }
1277
+
1278
+ /**
1279
+ * Add already-parsed or remote datasets to the Add Data list without starting a file load.
1280
+ * @memberof visStateActions
1281
+ * @param result datasets to keep until Add Data
1282
+ * @returns action
1283
+ * @public
1284
+ */
1285
+ export function appendStagedLoadedFiles(result) {
1286
+ return {
1287
+ type: ActionTypes.APPEND_STAGED_LOADED_FILES,
1288
+ result: result
1289
+ };
1290
+ }
1291
+
1292
+ /**
1293
+ * Drop files staged for the Add Data button and stop an in-progress modal load.
1294
+ * @memberof visStateActions
1295
+ * @returns action
1296
+ * @public
1297
+ */
1298
+ export function clearStagedLoadedFiles() {
1299
+ return {
1300
+ type: ActionTypes.CLEAR_STAGED_LOADED_FILES
1301
+ };
1302
+ }
1303
+ /**
1304
+ * called when successfully loaded one file, ready to move on to the next one
1305
+ * @memberof visStateActions
1306
+ * @param result
1307
+ * @returns action
1308
+ */
1309
+ export function loadFileStepSuccess(_ref2) {
1310
+ var fileName = _ref2.fileName,
1311
+ fileCache = _ref2.fileCache;
1312
+ return {
1313
+ type: ActionTypes.LOAD_FILE_STEP_SUCCESS,
1314
+ fileName: fileName,
1315
+ fileCache: fileCache
1316
+ };
1317
+ }
1318
+ /**
1319
+ * Trigger loading file error
1320
+ * @memberof visStateActions
1321
+ * @param error
1322
+ * @returns action
1323
+ * @public
1324
+ */
1325
+
1326
+ export function loadFilesErr(fileName, error, loadId) {
1327
+ return _objectSpread({
1328
+ type: ActionTypes.LOAD_FILES_ERR,
1329
+ fileName: fileName,
1330
+ error: error
1331
+ }, loadId == null ? {} : {
1332
+ loadId: loadId
1333
+ });
1334
+ }
1335
+ /**
1336
+ * Set user-facing GeoJSON properties on a Draw on Map sketch.
1337
+ * Editor-only keys such as `filterId` and `isClosed` are preserved.
1338
+ * @memberof visStateActions
1339
+ * @param feature
1340
+ * @param properties
1341
+ * @returns action
1342
+ */
1343
+ export function setEditorFeatureProperties(feature, properties) {
1344
+ return {
1345
+ type: ActionTypes.SET_EDITOR_FEATURE_PROPERTIES,
1346
+ feature: feature,
1347
+ properties: properties
1348
+ };
1349
+ }
1350
+ /**
1351
+ * Store features to state
1352
+ * @memberof visStateActions
1353
+ * @param features
1354
+ * @returns action
1355
+ */
1356
+ export function setFeatures(features) {
1357
+ return {
1358
+ type: ActionTypes.SET_FEATURES,
1359
+ features: features
1360
+ };
1361
+ }
1362
+ /**
1363
+ * It will apply the provide feature as filter to the given layer.
1364
+ * If the given feature is already applied as filter to the layer, it will remove the layer from the filter
1365
+ * @memberof visStateActions
1366
+ * @param layer
1367
+ * @param feature
1368
+ * @returns action
1369
+ */
1370
+ export function setPolygonFilterLayer(layer, feature) {
1371
+ return {
1372
+ type: ActionTypes.SET_POLYGON_FILTER_LAYER,
1373
+ layer: layer,
1374
+ feature: feature
1375
+ };
1376
+ }
1377
+ /**
1378
+ * Apply the provided feature as a polygon filter to all layers.
1379
+ * @memberof visStateActions
1380
+ * @param feature
1381
+ * @returns action
1382
+ */
1383
+ export function setPolygonFilterAllLayers(feature) {
1384
+ return {
1385
+ type: ActionTypes.SET_POLYGON_FILTER_ALL_LAYERS,
1386
+ feature: feature
1387
+ };
1388
+ }
1389
+ /**
1390
+ * Set the current feature to be edited/deleted,
1391
+ * and the context of how the feature was selected.
1392
+ * @memberof visStateActions
1393
+ * @param feature
1394
+ * @param selectionContext
1395
+ * @returns action
1396
+ */
1397
+ export function setSelectedFeature(feature, selectionContext) {
1398
+ return {
1399
+ type: ActionTypes.SET_SELECTED_FEATURE,
1400
+ feature: feature,
1401
+ selectionContext: selectionContext
1402
+ };
1403
+ }
1404
+ /**
1405
+ * Delete the given feature
1406
+ * @memberof visStateActions
1407
+ * @param feature
1408
+ * @returns action
1409
+ */
1410
+ export function deleteFeature(feature) {
1411
+ return {
1412
+ type: ActionTypes.DELETE_FEATURE,
1413
+ feature: feature
1414
+ };
1415
+ }
1416
+ /** Set the Draw on Map editor mode.
1417
+ * @memberof visStateActions
1418
+ * @param mode one of `EDITOR_MODES`: `EDIT`, `DRAW_POINT`, `DRAW_LINESTRING`, `DRAW_POLYGON`, `DRAW_RECTANGLE`, `DRAW_CIRCLE`
1419
+ * @returns action
1420
+ * @public
1421
+ * @example
1422
+ * import {setEditorMode} from '@kepler.gl/actions';
1423
+ * import {EDITOR_MODES} from '@kepler.gl/constants';
1424
+ *
1425
+ * this.props.dispatch(setEditorMode(EDITOR_MODES.DRAW_LINESTRING));
1426
+ */
1427
+ export function setEditorMode(mode) {
1428
+ return {
1429
+ type: ActionTypes.SET_EDITOR_MODE,
1430
+ mode: mode
1431
+ };
1432
+ }
1433
+ /**
1434
+ * Trigger CPU filter of selected dataset
1435
+ * @memberof visStateActions
1436
+ * @param dataId - single dataId or an array of dataIds
1437
+ * @returns action
1438
+ * @public
1439
+ */
1440
+ export function applyCPUFilter(dataId) {
1441
+ return {
1442
+ type: ActionTypes.APPLY_CPU_FILTER,
1443
+ dataId: dataId
1444
+ };
1445
+ }
1446
+ /**
1447
+ * Toggle editor layer visibility
1448
+ * @memberof visStateActions
1449
+ * @return action
1450
+ */
1451
+ export function toggleEditorVisibility() {
1452
+ return {
1453
+ type: ActionTypes.TOGGLE_EDITOR_VISIBILITY
1454
+ };
1455
+ }
1456
+ /**
1457
+ * Convert editor sketch features into a GeoJSON dataset and layer, then clear the sketches.
1458
+ * The new dataset/layer is labeled `Drawn Geometry` plus a two-digit number.
1459
+ * No-ops when `enableDrawOnMapSketches` is false in application config.
1460
+ * @memberof visStateActions
1461
+ * @return action
1462
+ * @public
1463
+ * @example
1464
+ * import {convertEditorFeaturesToLayer} from '@kepler.gl/actions';
1465
+ *
1466
+ * this.props.dispatch(convertEditorFeaturesToLayer());
1467
+ */
1468
+ export function convertEditorFeaturesToLayer() {
1469
+ return {
1470
+ type: ActionTypes.CONVERT_EDITOR_FEATURES_TO_LAYER
1471
+ };
1472
+ }
1473
+ /**
1474
+ * Copy in-memory rows that fall inside the currently selected Draw on Map polygon
1475
+ * into a new local dataset. Vector tile layers extract a snapshot of features
1476
+ * already loaded in the current view. Raster tile layers download a PNG clip and
1477
+ * a GeoJSON file with the export rectangle and zonal stats. No-ops for WMS/3D/bitmap tiles, unsupported layer types,
1478
+ * and non-polygon drawings.
1479
+ * @memberof visStateActions
1480
+ * @param layerId Layer whose dataset should be extracted
1481
+ * @return action
1482
+ * @public
1483
+ * @example
1484
+ * import {extractDataFromFeature} from '@kepler.gl/actions';
1485
+ *
1486
+ * this.props.dispatch(extractDataFromFeature({layerId: 'point-layer-id'}));
1487
+ */
1488
+ export function extractDataFromFeature(_ref3) {
1489
+ var layerId = _ref3.layerId;
1490
+ return {
1491
+ type: ActionTypes.EXTRACT_DATA_FROM_FEATURE,
1492
+ layerId: layerId
1493
+ };
1494
+ }
1495
+ /**
1496
+ * Process the next file batch
1497
+ * @memberof visStateActions
1498
+ * @param payload - batch payload
1499
+ * @return action
1500
+ */
1501
+ export function nextFileBatch(payload) {
1502
+ return {
1503
+ type: ActionTypes.NEXT_FILE_BATCH,
1504
+ payload: payload
1505
+ };
1506
+ }
1507
+ /**
1508
+ * Process the file content
1509
+ * @memberof visStateActions
1510
+ * @param payload - the file content
1511
+ * @return action
1512
+ */
1513
+ export function processFileContent(payload) {
1514
+ return {
1515
+ type: ActionTypes.PROCESS_FILE_CONTENT,
1516
+ payload: payload
1517
+ };
1518
+ }
1519
+ /**
1520
+ * Set layer animation time format and timezone
1521
+ * @memberof visStateActions
1522
+ * @param config - {timeFormat: string, timezone: string}
1523
+ * @return action
1524
+ */
1525
+ export function setLayerAnimationTimeConfig(config) {
1526
+ return {
1527
+ type: ActionTypes.SET_LAYER_ANIMATION_TIME_CONFIG,
1528
+ config: config
1529
+ };
1530
+ }
1531
+ /**
1532
+ * Set Filter animation time format and timezone
1533
+ * @memberof visStateActions
1534
+ * @param idx
1535
+ * @param config
1536
+ * @return action
1537
+ */
1538
+ export function setFilterAnimationTimeConfig(idx, config) {
1539
+ return {
1540
+ type: ActionTypes.SET_FILTER_ANIMATION_TIME_CONFIG,
1541
+ idx: idx,
1542
+ config: config
1543
+ };
1544
+ }
1545
+ /**
1546
+ * deck.gl layer gpu filter callback
1547
+ * @memberof visStateActions
1548
+ * @param layer
1549
+ * @param event
1550
+ * @return action
1551
+ */
1552
+ export function layerFilteredItemsChange(layer, event) {
1553
+ return {
1554
+ type: ActionTypes.LAYER_FILTERED_ITEMS_CHANGE,
1555
+ layer: layer,
1556
+ event: event
1557
+ };
1558
+ }
1559
+ /**
1560
+ * WMS layer feature info callback
1561
+ * @memberof visStateActions
1562
+ * @param layer
1563
+ * @param featureInfo
1564
+ * @param coordinate
1565
+ * @return action
1566
+ */
1567
+ export function wmsFeatureInfo(layer, featureInfo, coordinate) {
1568
+ return {
1569
+ type: ActionTypes.WMS_FEATURE_INFO,
1570
+ layer: layer,
1571
+ featureInfo: featureInfo,
1572
+ coordinate: coordinate
1573
+ };
1574
+ }
1575
+ /**
1576
+ * Sync time filter with layer timeline
1577
+ * @memberof visStateActions
1578
+ * @param idx
1579
+ * @param enable
1580
+ * @return action
1581
+ */
1582
+ export function syncTimeFilterWithLayerTimeline(idx, enable) {
1583
+ return {
1584
+ type: ActionTypes.SYNC_TIME_FILTER_WITH_LAYER_TIMELINE,
1585
+ idx: idx,
1586
+ enable: enable
1587
+ };
1588
+ }
1589
+ /**
1590
+ * Set time filter sync timeline mode
1591
+ * @memberof visStateActions
1592
+ * @param id
1593
+ * @param mode
1594
+ * @return action
1595
+ */
1596
+ export function setTimeFilterSyncTimelineMode(_ref4) {
1597
+ var id = _ref4.id,
1598
+ mode = _ref4.mode;
1599
+ return {
1600
+ type: ActionTypes.SYNC_TIME_FILTER_TIMELINE_MODE,
1601
+ id: id,
1602
+ mode: mode
1603
+ };
1604
+ }
1605
+ export function addGroupBy(dataId) {
1606
+ return {
1607
+ type: ActionTypes.ADD_GROUP_BY,
1608
+ dataId: dataId
1609
+ };
1610
+ }
1611
+ export function setGroupByConfig(id, config) {
1612
+ return {
1613
+ type: ActionTypes.SET_GROUP_BY_CONFIG,
1614
+ id: id,
1615
+ config: config
1616
+ };
1617
+ }
1618
+ export function runGroupBy(id) {
1619
+ return {
1620
+ type: ActionTypes.RUN_GROUP_BY,
1621
+ id: id
1622
+ };
1623
+ }
1624
+ export function addJoin(dataId) {
1625
+ var implementation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'simple';
1626
+ return {
1627
+ type: ActionTypes.ADD_JOIN,
1628
+ dataId: dataId,
1629
+ implementation: implementation
1630
+ };
1631
+ }
1632
+ export function setJoinConfig(id, config) {
1633
+ return {
1634
+ type: ActionTypes.SET_JOIN_CONFIG,
1635
+ id: id,
1636
+ config: config
1637
+ };
1638
+ }
1639
+ export function runJoin(id) {
1640
+ return {
1641
+ type: ActionTypes.RUN_JOIN,
1642
+ id: id
1643
+ };
1644
+ }
1645
+ export function addSpatialJoin(dataId) {
1646
+ return {
1647
+ type: ActionTypes.ADD_SPATIAL_JOIN,
1648
+ dataId: dataId
1649
+ };
1650
+ }
1651
+ export function setSpatialJoinConfig(id, config) {
1652
+ return {
1653
+ type: ActionTypes.SET_SPATIAL_JOIN_CONFIG,
1654
+ id: id,
1655
+ config: config
1656
+ };
1657
+ }
1658
+ export function runSpatialJoin(id) {
1659
+ return {
1660
+ type: ActionTypes.RUN_SPATIAL_JOIN,
1661
+ id: id
1662
+ };
1663
+ }
1664
+ export function addSuitability(dataId) {
1665
+ return {
1666
+ type: ActionTypes.ADD_SUITABILITY,
1667
+ dataId: dataId
1668
+ };
1669
+ }
1670
+ export function setSuitabilityConfig(id, config) {
1671
+ return {
1672
+ type: ActionTypes.SET_SUITABILITY_CONFIG,
1673
+ id: id,
1674
+ config: config
1675
+ };
1676
+ }
1677
+ export function runSuitability(id) {
1678
+ return {
1679
+ type: ActionTypes.RUN_SUITABILITY,
1680
+ id: id
1681
+ };
1682
+ }
1683
+ export function removeDatasetOp(id) {
1684
+ return {
1685
+ type: ActionTypes.REMOVE_DATASET_OP,
1686
+ id: id
1687
+ };
1688
+ }
1689
+ export var createNewDatasetSuccess = createAction(ActionTypes.CREATE_NEW_DATASET_SUCCESS);
1690
+ /**
1691
+ * Change of number of active loading items, used to render loading indicator.
1692
+ * @memberof visStateActions
1693
+ * @param payload
1694
+ * @param payload.change Change of number of active loading actions.
1695
+ * @public
1696
+ */
1697
+ export var setLoadingIndicator = createAction(ActionTypes.SET_LOADING_INDICATOR);
1698
+ /**
1699
+ * Update download progress for an in-flight dataset load shown on the map
1700
+ * loading indicator (0–100).
1701
+ * @memberof visStateActions
1702
+ * @returns action
1703
+ */
1704
+ export function setLoadingProgress(id, percent, phase) {
1705
+ return _objectSpread({
1706
+ type: ActionTypes.SET_LOADING_PROGRESS,
1707
+ id: id,
1708
+ percent: percent
1709
+ }, phase ? {
1710
+ phase: phase
1711
+ } : {});
1712
+ }
1713
+
1714
+ /**
1715
+ * This declaration is needed to group actions in docs
1716
+ */
1717
+ /**
1718
+ * Actions handled mostly by `visState` reducer.
1719
+ * They manage how data is processed, filtered and displayed on the map by operates on layers,
1720
+ * filters and interaction settings.
1721
+ *
1722
+ * @public
1723
+ */
1724
+ /* eslint-disable @typescript-eslint/no-unused-vars */
1725
+ // @ts-ignore
1726
+ var visStateActions = null;
1727
+ /* eslint-enable @typescript-eslint/no-unused-vars */
1728
+ //# sourceMappingURL=vis-state-actions.js.map