@kepler.gl/actions 3.3.0-alpha.14 → 3.3.0-alpha.16

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.
@@ -129,6 +129,20 @@ export type OpenDeleteModalUpdaterAction = {
129
129
  export declare const openDeleteModal: (datasetId: OpenDeleteModalUpdaterAction['payload']) => Merge<OpenDeleteModalUpdaterAction, {
130
130
  type: typeof ActionTypes.OPEN_DELETE_MODAL;
131
131
  }>;
132
+ /** OPEN_REPLACE_DATASET_MODAL */
133
+ export type OpenReplaceDatasetModalUpdaterAction = {
134
+ payload: string;
135
+ };
136
+ /**
137
+ * Open the add-data modal so the next confirmed upload replaces one dataset.
138
+ * Layers and filters are remapped onto the new table.
139
+ * @memberof uiStateActions
140
+ * @param datasetId - id of the dataset to replace
141
+ * @public
142
+ */
143
+ export declare const openReplaceDatasetModal: (datasetId: OpenReplaceDatasetModalUpdaterAction['payload']) => Merge<OpenReplaceDatasetModalUpdaterAction, {
144
+ type: typeof ActionTypes.OPEN_REPLACE_DATASET_MODAL;
145
+ }>;
132
146
  /** ADD_NOTIFICATION */
133
147
  export type AddNotificationUpdaterAction = {
134
148
  payload: object;
@@ -313,6 +327,32 @@ export type SetExportHTMLMapModeUpdaterAction = {
313
327
  export declare const setExportHTMLMapMode: (mode: SetExportHTMLMapModeUpdaterAction['payload']) => Merge<SetExportHTMLMapModeUpdaterAction, {
314
328
  type: typeof ActionTypes.SET_EXPORT_MAP_HTML_MODE;
315
329
  }>;
330
+ /** SET_EXPORT_MAP_FILE_NAME */
331
+ export type SetExportMapFileNameUpdaterAction = {
332
+ payload: string;
333
+ };
334
+ /**
335
+ * Set the filename used when exporting an HTML or JSON map
336
+ * @memberof uiStateActions
337
+ * @param fileName - download name without extension
338
+ * @public
339
+ */
340
+ export declare const setExportMapFileName: (fileName: SetExportMapFileNameUpdaterAction['payload']) => Merge<SetExportMapFileNameUpdaterAction, {
341
+ type: typeof ActionTypes.SET_EXPORT_MAP_FILE_NAME;
342
+ }>;
343
+ /** SET_EXPORT_INCLUDE_LAYER_API_KEYS */
344
+ export type SetExportIncludeLayerApiKeysUpdaterAction = {
345
+ payload: boolean;
346
+ };
347
+ /**
348
+ * Whether exported HTML and JSON maps keep access tokens stored on layers.
349
+ * @memberof uiStateActions
350
+ * @param includeLayerApiKeys - include layer API keys in the export
351
+ * @public
352
+ */
353
+ export declare const setExportIncludeLayerApiKeys: (includeLayerApiKeys: SetExportIncludeLayerApiKeysUpdaterAction['payload']) => Merge<SetExportIncludeLayerApiKeysUpdaterAction, {
354
+ type: typeof ActionTypes.SET_EXPORT_INCLUDE_LAYER_API_KEYS;
355
+ }>;
316
356
  /** SET_LOCALE */
317
357
  export type SetLocaleUpdaterAction = {
318
358
  payload: {
@@ -335,7 +375,7 @@ export type SetThemeUpdaterAction = {
335
375
  };
336
376
  };
337
377
  /**
338
- * Set UI `theme` value (`light` or `dark`)
378
+ * Set UI `theme` value (`light`, `dark`, or `space`)
339
379
  * @memberof uiStateActions
340
380
  * @param theme - theme of the UI
341
381
  * @public
@@ -1,8 +1,8 @@
1
1
  import { default as ActionTypes } from './action-types';
2
- import { FileCacheItem } from '@kepler.gl/processors';
2
+ import { FileCacheItem, ZipArchiveExpansion } from '@kepler.gl/processors';
3
3
  import { Layer, LayerBaseConfig } from '@kepler.gl/layers';
4
- import { KeplerTable } from '@kepler.gl/table';
5
- import { AddDataToMapPayload, ViewportPadding, ValueOf, Merge, PickInfo, RGBColor, NestedPartial, LayerVisConfig, ColorUI, Feature, FeatureSelectionContext, InteractionConfig, Filter, ParsedConfig, ParsedLayer, EffectPropsPartial, AnnotationPropsPartial, SyncTimelineMode, AnimationConfig, FilterAnimationConfig, LayerOrder, LayerOrderGroup, ProtoDataset, ChartConfig } from '@kepler.gl/types';
4
+ import { GroupByOp, JoinOp, KeplerTable } from '@kepler.gl/table';
5
+ import { AddDataToMapOptions, AddDataToMapPayload, ViewportPadding, ValueOf, Merge, PickInfo, RGBColor, NestedPartial, LayerVisConfig, ColorUI, Feature, FeatureSelectionContext, InteractionConfig, Filter, ParsedConfig, ParsedLayer, EffectPropsPartial, AnnotationPropsPartial, SyncTimelineMode, AnimationConfig, FilterAnimationConfig, LayerOrder, LayerOrderGroup, ProtoDataset, ChartConfig } from '@kepler.gl/types';
6
6
  export type ApplyLayerConfigUpdaterAction = {
7
7
  oldLayerId: string;
8
8
  newLayerConfig: ParsedLayer;
@@ -86,15 +86,23 @@ export declare function layerSetIsValid(oldLayer: Layer, isValid: boolean): Merg
86
86
  export type LayerTypeChangeUpdaterAction = {
87
87
  oldLayer: Layer;
88
88
  newType: string;
89
+ /**
90
+ * Fit the map when this is the layer type dropdown assigning a type to an
91
+ * empty layer. Omitted for programmatic calls and saved-config applies.
92
+ */
93
+ fitBounds?: boolean;
89
94
  };
90
95
  /**
91
96
  * Update layer type. Previews layer config will be copied if applicable.
92
97
  * @param oldLayer - layer to be updated
93
98
  * @param newType - new type
99
+ * @param options.fitBounds fit the map when the layer type dropdown gives an empty layer its first type
94
100
  * @returns action
95
101
  * @public
96
102
  */
97
- export declare function layerTypeChange(oldLayer: Layer, newType: string): Merge<LayerTypeChangeUpdaterAction, {
103
+ export declare function layerTypeChange(oldLayer: Layer, newType: string, options?: {
104
+ fitBounds?: boolean;
105
+ }): Merge<LayerTypeChangeUpdaterAction, {
98
106
  type: typeof ActionTypes.LAYER_TYPE_CHANGE;
99
107
  }>;
100
108
  export type LayerVisualChannelConfigChangeUpdaterAction = {
@@ -1098,7 +1106,8 @@ export declare function toggleLayerForMap(mapIndex: number, layerId: string): Me
1098
1106
  type FilterPlotNewProp = {
1099
1107
  yAxis?: null | Record<string, any>;
1100
1108
  plotType?: {
1101
- type: string;
1109
+ type?: string;
1110
+ [key: string]: any;
1102
1111
  };
1103
1112
  };
1104
1113
  export type SetFilterPlotUpdaterAction = {
@@ -1131,18 +1140,26 @@ export type SetMapInfoUpdaterAction = {
1131
1140
  export declare function setMapInfo(info: any): Merge<SetMapInfoUpdaterAction, {
1132
1141
  type: typeof ActionTypes.SET_MAP_INFO;
1133
1142
  }>;
1143
+ export type LoadFilesOptions = AddDataToMapOptions & {
1144
+ /** Parse the files, then wait for an explicit add instead of calling `addDataToMap`. */
1145
+ deferAddToMap?: boolean;
1146
+ };
1134
1147
  export type LoadFilesUpdaterAction = {
1135
1148
  files: File[];
1136
- onFinish?(result: any): any;
1149
+ onFinish?(result: any, options?: LoadFilesOptions): any;
1150
+ /** Forwarded to `addDataToMap` when loading finishes. Omitted options keep their defaults. */
1151
+ options?: LoadFilesOptions;
1137
1152
  };
1138
1153
  /**
1139
1154
  * Trigger file loading dispatch `addDataToMap` if succeed, or `loadFilesErr` if failed
1140
1155
  * @memberof visStateActions
1141
1156
  * @param files array of fileblob
1157
+ * @param onFinish called with the processed file cache. Defaults to `loadFilesSuccess`
1158
+ * @param options forwarded to `addDataToMap`. `autoCreateLayers` defaults to true when omitted
1142
1159
  * @returns action
1143
1160
  * @public
1144
1161
  */
1145
- export declare function loadFiles(files: File[], onFinish?: (result: any) => any): Merge<LoadFilesUpdaterAction, {
1162
+ export declare function loadFiles(files: File[], onFinish?: (result: any, options?: LoadFilesOptions) => any, options?: LoadFilesOptions): Merge<LoadFilesUpdaterAction, {
1146
1163
  type: typeof ActionTypes.LOAD_FILES;
1147
1164
  }>;
1148
1165
  /**
@@ -1151,21 +1168,94 @@ export declare function loadFiles(files: File[], onFinish?: (result: any) => any
1151
1168
  * @returns action
1152
1169
  * @public
1153
1170
  */
1154
- export declare function loadNextFile(): {
1171
+ export declare function loadNextFile(loadId?: number): {
1155
1172
  type: typeof ActionTypes.LOAD_NEXT_FILE;
1173
+ loadId?: number;
1156
1174
  };
1175
+ export type ExpandZipArchiveSuccessAction = {
1176
+ loadId: number;
1177
+ archiveName: string;
1178
+ expansion: ZipArchiveExpansion;
1179
+ };
1180
+ /**
1181
+ * A zip in the load queue has been unpacked. The updater either parses a
1182
+ * single shapefile archive or enqueues one dataset per supported member.
1183
+ * @memberof visStateActions
1184
+ */
1185
+ export declare function expandZipArchiveSuccess(payload: ExpandZipArchiveSuccessAction): Merge<ExpandZipArchiveSuccessAction, {
1186
+ type: typeof ActionTypes.EXPAND_ZIP_ARCHIVE_SUCCESS;
1187
+ }>;
1157
1188
  export type loadFilesSuccessUpdaterAction = {
1158
1189
  result: FileCacheItem[];
1190
+ options?: AddDataToMapOptions;
1191
+ /** Set when a file-load pause finishes, so a canceled load can be ignored. */
1192
+ loadId?: number;
1159
1193
  };
1160
1194
  /**
1161
1195
  * called when all files are processed and loaded
1162
1196
  * @memberof visStateActions
1163
1197
  * @param result
1198
+ * @param options forwarded to `addDataToMap`
1164
1199
  * @returns action
1165
1200
  */
1166
- export declare function loadFilesSuccess(result: FileCacheItem[]): Merge<loadFilesSuccessUpdaterAction, {
1201
+ export declare function loadFilesSuccess(result: FileCacheItem[], options?: AddDataToMapOptions): Merge<loadFilesSuccessUpdaterAction, {
1167
1202
  type: typeof ActionTypes.LOAD_FILES_SUCCESS;
1168
1203
  }>;
1204
+ export type ConfirmReplaceDatasetUpdaterAction = {
1205
+ result: FileCacheItem[];
1206
+ datasetToReplaceId: string;
1207
+ deleteOriginalDataset?: boolean;
1208
+ };
1209
+ /**
1210
+ * Confirm a staged upload as a replacement for one dataset.
1211
+ * The first dataset remaps that dataset's layers and filters. Further datasets are added.
1212
+ * @memberof visStateActions
1213
+ * @param payload.result staged file cache the user left checked
1214
+ * @param payload.datasetToReplaceId dataset the menu action selected
1215
+ * @param payload.deleteOriginalDataset drop the original table. Defaults to true
1216
+ * @public
1217
+ */
1218
+ export declare function confirmReplaceDataset(payload: {
1219
+ result: FileCacheItem[];
1220
+ datasetToReplaceId: string;
1221
+ deleteOriginalDataset?: boolean;
1222
+ }): Merge<ConfirmReplaceDatasetUpdaterAction, {
1223
+ type: typeof ActionTypes.CONFIRM_REPLACE_DATASET;
1224
+ }>;
1225
+ export type StageLoadedFilesUpdaterAction = {
1226
+ result: FileCacheItem[];
1227
+ /** Set when a file-load pause finishes, so a canceled load can be ignored. */
1228
+ loadId?: number;
1229
+ };
1230
+ /**
1231
+ * Store processed files without adding them to the map or closing the modal.
1232
+ * @memberof visStateActions
1233
+ * @param result processed file cache
1234
+ * @returns action
1235
+ * @public
1236
+ */
1237
+ export declare function stageLoadedFiles(result: FileCacheItem[]): Merge<StageLoadedFilesUpdaterAction, {
1238
+ type: typeof ActionTypes.STAGE_LOADED_FILES;
1239
+ }>;
1240
+ /**
1241
+ * Add already-parsed or remote datasets to the Add Data list without starting a file load.
1242
+ * @memberof visStateActions
1243
+ * @param result datasets to keep until Add Data
1244
+ * @returns action
1245
+ * @public
1246
+ */
1247
+ export declare function appendStagedLoadedFiles(result: FileCacheItem[]): Merge<StageLoadedFilesUpdaterAction, {
1248
+ type: typeof ActionTypes.APPEND_STAGED_LOADED_FILES;
1249
+ }>;
1250
+ /**
1251
+ * Drop files staged for the Add Data button and stop an in-progress modal load.
1252
+ * @memberof visStateActions
1253
+ * @returns action
1254
+ * @public
1255
+ */
1256
+ export declare function clearStagedLoadedFiles(): {
1257
+ type: typeof ActionTypes.CLEAR_STAGED_LOADED_FILES;
1258
+ };
1169
1259
  export type LoadFileStepSuccessAction = {
1170
1260
  fileName: string;
1171
1261
  fileCache: FileCacheItem[];
@@ -1185,6 +1275,8 @@ export declare function loadFileStepSuccess({ fileName, fileCache }: {
1185
1275
  export type LoadFilesErrUpdaterAction = {
1186
1276
  fileName: string;
1187
1277
  error: any;
1278
+ /** Set when the failure belongs to one load, so a newer load can ignore it. */
1279
+ loadId?: number;
1188
1280
  };
1189
1281
  /**
1190
1282
  * Trigger loading file error
@@ -1193,7 +1285,7 @@ export type LoadFilesErrUpdaterAction = {
1193
1285
  * @returns action
1194
1286
  * @public
1195
1287
  */
1196
- export declare function loadFilesErr(fileName: string, error: any): Merge<LoadFilesErrUpdaterAction, {
1288
+ export declare function loadFilesErr(fileName: string, error: any, loadId?: number): Merge<LoadFilesErrUpdaterAction, {
1197
1289
  type: typeof ActionTypes.LOAD_FILES_ERR;
1198
1290
  }>;
1199
1291
  export type SetFeaturesUpdaterAction = {
@@ -1338,8 +1430,9 @@ export type ExtractDataFromFeatureUpdaterAction = {
1338
1430
  /**
1339
1431
  * Copy in-memory rows that fall inside the currently selected Draw on Map polygon
1340
1432
  * into a new local dataset. Vector tile layers extract a snapshot of features
1341
- * already loaded in the current view. No-ops for raster/WMS/3D/bitmap tiles,
1342
- * unsupported layer types, and non-polygon drawings.
1433
+ * already loaded in the current view. Raster tile layers download a PNG clip and
1434
+ * a GeoJSON file with the export rectangle and zonal stats. No-ops for WMS/3D/bitmap tiles, unsupported layer types,
1435
+ * and non-polygon drawings.
1343
1436
  * @memberof visStateActions
1344
1437
  * @param layerId Layer whose dataset should be extracted
1345
1438
  * @return action
@@ -1364,6 +1457,8 @@ export type NextFileBatchUpdaterAction = {
1364
1457
  progress?: any;
1365
1458
  accumulated?: any;
1366
1459
  onFinish: (result: any) => any;
1460
+ /** Carried across batches so progressive loads keep the original add-data options. */
1461
+ options?: LoadFilesOptions;
1367
1462
  };
1368
1463
  };
1369
1464
  /**
@@ -1489,14 +1584,73 @@ export declare function setTimeFilterSyncTimelineMode({ id, mode }: setTimeFilte
1489
1584
  export type CreateNewDatasetSuccessPayload = {
1490
1585
  results: (PromiseFulfilledResult<KeplerTable> | PromiseRejectedResult)[];
1491
1586
  addToMapOptions: AddDataToMapPayload['options'];
1587
+ /** Dataset ids whose hydrate download progress should be cleared. */
1588
+ progressIds?: string[];
1492
1589
  };
1493
- /**
1494
- * Called when a new dataset is created successfully via async table methods
1495
- * @memberof visStateActions
1496
- * @param payload
1497
- * @param payload.results - results of promises.allSettlted
1498
- * @returns
1499
- */
1590
+ export type AddGroupByUpdaterAction = {
1591
+ dataId: string;
1592
+ };
1593
+ export declare function addGroupBy(dataId: string): Merge<AddGroupByUpdaterAction, {
1594
+ type: typeof ActionTypes.ADD_GROUP_BY;
1595
+ }>;
1596
+ export type SetGroupByConfigUpdaterAction = {
1597
+ id: string;
1598
+ config: Partial<GroupByOp>;
1599
+ };
1600
+ export declare function setGroupByConfig(id: string, config: Partial<GroupByOp>): Merge<SetGroupByConfigUpdaterAction, {
1601
+ type: typeof ActionTypes.SET_GROUP_BY_CONFIG;
1602
+ }>;
1603
+ export type RunGroupByUpdaterAction = {
1604
+ id: string;
1605
+ };
1606
+ export declare function runGroupBy(id: string): Merge<RunGroupByUpdaterAction, {
1607
+ type: typeof ActionTypes.RUN_GROUP_BY;
1608
+ }>;
1609
+ export type AddJoinUpdaterAction = {
1610
+ dataId: string;
1611
+ implementation?: JoinOp['implementation'];
1612
+ };
1613
+ export declare function addJoin(dataId: string, implementation?: JoinOp['implementation']): Merge<AddJoinUpdaterAction, {
1614
+ type: typeof ActionTypes.ADD_JOIN;
1615
+ }>;
1616
+ export type SetJoinConfigUpdaterAction = {
1617
+ id: string;
1618
+ config: Partial<JoinOp>;
1619
+ };
1620
+ export declare function setJoinConfig(id: string, config: Partial<JoinOp>): Merge<SetJoinConfigUpdaterAction, {
1621
+ type: typeof ActionTypes.SET_JOIN_CONFIG;
1622
+ }>;
1623
+ export type RunJoinUpdaterAction = {
1624
+ id: string;
1625
+ };
1626
+ export declare function runJoin(id: string): Merge<RunJoinUpdaterAction, {
1627
+ type: typeof ActionTypes.RUN_JOIN;
1628
+ }>;
1629
+ export type AddSpatialJoinUpdaterAction = {
1630
+ dataId: string;
1631
+ };
1632
+ export declare function addSpatialJoin(dataId: string): Merge<AddSpatialJoinUpdaterAction, {
1633
+ type: typeof ActionTypes.ADD_SPATIAL_JOIN;
1634
+ }>;
1635
+ export type SetSpatialJoinConfigUpdaterAction = {
1636
+ id: string;
1637
+ config: Partial<JoinOp>;
1638
+ };
1639
+ export declare function setSpatialJoinConfig(id: string, config: Partial<JoinOp>): Merge<SetSpatialJoinConfigUpdaterAction, {
1640
+ type: typeof ActionTypes.SET_SPATIAL_JOIN_CONFIG;
1641
+ }>;
1642
+ export type RunSpatialJoinUpdaterAction = {
1643
+ id: string;
1644
+ };
1645
+ export declare function runSpatialJoin(id: string): Merge<RunSpatialJoinUpdaterAction, {
1646
+ type: typeof ActionTypes.RUN_SPATIAL_JOIN;
1647
+ }>;
1648
+ export type RemoveDatasetOpUpdaterAction = {
1649
+ id: string;
1650
+ };
1651
+ export declare function removeDatasetOp(id: string): Merge<RemoveDatasetOpUpdaterAction, {
1652
+ type: typeof ActionTypes.REMOVE_DATASET_OP;
1653
+ }>;
1500
1654
  export declare const createNewDatasetSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<CreateNewDatasetSuccessPayload, string>;
1501
1655
  export type SetLoadingIndicatorPayload = {
1502
1656
  change: number;
@@ -1509,4 +1663,19 @@ export type SetLoadingIndicatorPayload = {
1509
1663
  * @public
1510
1664
  */
1511
1665
  export declare const setLoadingIndicator: import("@reduxjs/toolkit").ActionCreatorWithPayload<SetLoadingIndicatorPayload, string>;
1666
+ export type SetLoadingProgressUpdaterAction = {
1667
+ id: string;
1668
+ percent: number;
1669
+ /** Download is finished and the file is being parsed into a dataset. */
1670
+ phase?: 'processing';
1671
+ };
1672
+ /**
1673
+ * Update download progress for an in-flight dataset load shown on the map
1674
+ * loading indicator (0–100).
1675
+ * @memberof visStateActions
1676
+ * @returns action
1677
+ */
1678
+ export declare function setLoadingProgress(id: string, percent: number, phase?: 'processing'): Merge<SetLoadingProgressUpdaterAction, {
1679
+ type: typeof ActionTypes.SET_LOADING_PROGRESS;
1680
+ }>;
1512
1681
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kepler.gl/actions",
3
3
  "author": "Shan He <shan@uber.com>",
4
- "version": "3.3.0-alpha.14",
4
+ "version": "3.3.0-alpha.16",
5
5
  "description": "kepler.gl constants used by kepler.gl components, actions and reducers",
6
6
  "license": "MIT",
7
7
  "main": "dist/cjs/index.js",
@@ -29,13 +29,13 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@deck.gl/core": "^9.3.1",
32
- "@kepler.gl/cloud-providers": "3.3.0-alpha.14",
33
- "@kepler.gl/constants": "3.3.0-alpha.14",
34
- "@kepler.gl/layers": "3.3.0-alpha.14",
35
- "@kepler.gl/processors": "3.3.0-alpha.14",
36
- "@kepler.gl/table": "3.3.0-alpha.14",
37
- "@kepler.gl/types": "3.3.0-alpha.14",
38
- "@kepler.gl/utils": "3.3.0-alpha.14",
32
+ "@kepler.gl/cloud-providers": "3.3.0-alpha.16",
33
+ "@kepler.gl/constants": "3.3.0-alpha.16",
34
+ "@kepler.gl/layers": "3.3.0-alpha.16",
35
+ "@kepler.gl/processors": "3.3.0-alpha.16",
36
+ "@kepler.gl/table": "3.3.0-alpha.16",
37
+ "@kepler.gl/types": "3.3.0-alpha.16",
38
+ "@kepler.gl/utils": "3.3.0-alpha.16",
39
39
  "@reduxjs/toolkit": "^1.7.2",
40
40
  "@types/react-redux": "^7.1.23",
41
41
  "@types/redux-actions": "^2.6.2",