-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
vis-state-actions.d.ts
471 lines (413 loc) · 13.5 KB
/
vis-state-actions.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
// Copyright (c) 2020 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// vis-state-reducer
import ActionTypes, {ActionType} from 'constants/action-types';
import {ProtoDataset, AddDataToMapPayload} from '../actions/actions';
import {ParsedConfig} from '../schemas';
import {FileCacheItem} from '../processors/file-handler';
import {Layer, LayerConfig, LayerVisConfig} from 'layers';
import {Feature, InteractionConfig} from 'reducers/vis-state-updaters';
import {ValueOf, Merge} from '../reducers/types';
// TODO - import LoaderObject type from @loaders.gl/core when supported
// TODO - import LoadOptions type from @loaders.gl/core when supported
import {LoaderObject} from '@loaders.gl/loader-utils';
export type LayerConfigChangeUpdaterAction = {
oldLayer: Layer;
newConfig: Partial<LayerConfig>;
};
export function layerConfigChange(
oldLayer: Layer,
newConfig: Partial<LayerConfig>
): Merge<LayerConfigChangeUpdaterAction, {type: ActionTypes.LAYER_CONFIG_CHANGE}>;
export type LayerTextLabelChangeUpdaterAction = {
oldLayer: Layer;
idx: number | 'all';
prop: string;
value: any;
};
export function layerTextLabelChange(
oldLayer: Layer,
idx: number | 'all',
prop: string,
value: any
): Merge<LayerTextLabelChangeUpdaterAction, {type: ActionTypes.LAYER_TEXT_LABEL_CHANGE}>;
export type LayerTypeChangeUpdaterAction = {
oldLayer: Layer;
newType: string;
};
export function layerTypeChange(
oldLayer: Layer,
newType: string
): Merge<LayerTypeChangeUpdaterAction, {type: ActionTypes.LAYER_TYPE_CHANGE}>;
export type LayerVisualChannelConfigChangeUpdaterAction = {
oldLayer: Layer;
newConfig: Partial<LayerConfig>;
channel: string;
};
export function layerVisualChannelConfigChange(
oldLayer: Layer,
newConfig: Partial<LayerConfig>,
channel: string
): Merge<
LayerVisualChannelConfigChangeUpdaterAction,
{type: ActionTypes.LAYER_VISUAL_CHANNEL_CHANGE}
>;
export type LayerVisConfigChangeUpdaterAction = {
oldLayer: Layer;
newVisConfig: Partial<LayerVisConfig>;
};
export function layerVisConfigChange(
oldLayer: Layer,
newVisConfig: Partial<LayerVisConfig>
): Merge<LayerVisConfigChangeUpdaterAction, {type: ActionTypes.LAYER_VIS_CONFIG_CHANGE}>;
export type LayerColorUIChangeUpdaterAction = {
oldLayer: Layer;
prop: string;
newConfig: object;
};
export function layerColorUIChange(
oldLayer: Layer,
prop: string,
newConfig: object
): Merge<LayerColorUIChangeUpdaterAction, {type: ActionTypes.LAYER_COLOR_UI_CHANGE}>;
export type UpdateLayerBlendingUpdaterAction = {
mode: string;
};
export function updateLayerBlending(
mode: 'additive' | 'normal' | 'subtractive'
): Merge<UpdateLayerBlendingUpdaterAction, {type: ActionTypes.UPDATE_LAYER_BLENDING}>;
export type InteractionConfigChangeUpdaterAction = {
config: ValueOf<InteractionConfig>;
};
export function interactionConfigChange(
config: ValueOf<InteractionConfig>
): Merge<InteractionConfigChangeUpdaterAction, {type: ActionTypes.INTERACTION_CONFIG_CHANGE}>;
export type SetFilterUpdaterAction = {
idx: number;
prop: string;
value: any;
valueIndex?: number;
};
export function setFilter(
idx: number,
prop: string,
value: any,
valueIndex: number
): Merge<SetFilterUpdaterAction, {type: ActionTypes.SET_FILTER}>;
export type SetFilterAnimationTimeUpdaterAction = {
idx: number;
prop: string;
value: any;
valueIndex?: number;
};
export function setFilterAnimationTime(
idx: number,
prop: string,
value: any,
valueIndex?: number
): Merge<SetFilterAnimationTimeUpdaterAction, {type: ActionTypes.SET_FILTER_ANIMATION_TIME}>;
export type SetFilterAnimationWindowUpdaterAction = {
id: string;
animationWindow: string;
};
export function setFilterAnimationWindow({
id: string,
animationWindow: string,
}): Merge<SetFilterAnimationWindowUpdaterAction, {type: ActionTypes.SET_FILTER_ANIMATION_WINDOW}>;
export type AddFilterUpdaterAction = {
dataId: string;
};
export function addFilter(
dataId: string
): Merge<AddFilterUpdaterAction, {type: ActionTypes.ADD_FILTER}>;
export type AddLayerUpdaterAction = {
props: object;
};
export function addLayer(
props: object
): Merge<AddLayerUpdaterAction, {type: ActionTypes.ADD_LAYER}>;
export type ReorderLayerUpdaterAction = {
order: number[];
};
export function reorderLayer(
order: number[]
): Merge<ReorderLayerUpdaterAction, {type: ActionTypes.REORDER_LAYER}>;
export type RemoveFilterUpdaterAction = {
idx: number;
};
export function removeFilter(
idx: number
): Merge<RemoveFilterUpdaterAction, {type: ActionTypes.REMOVE_FILTER}>;
export type RemoveLayerUpdaterAction = {
idx: number;
};
export function removeLayer(
idx: number
): Merge<RemoveLayerUpdaterAction, {type: ActionTypes.REMOVE_LAYER}>;
export type RemoveDatasetUpdaterAction = {
dataId: string;
};
export function removeDataset(
dataId: string
): Merge<RemoveDatasetUpdaterAction, {type: ActionTypes.REMOVE_DATASET}>;
export type ShowDatasetTableUpdaterAction = {
dataId: string;
};
export function showDatasetTable(
dataId: string
): Merge<ShowDatasetTableUpdaterAction, {type: ActionTypes.SHOW_DATASET_TABLE}>;
export type SortTableColumnUpdaterAction = {
dataId: string;
column: string;
mode: string;
};
export function sortTableColumn(
dataId: string,
column: string,
mode: string
): Merge<SortTableColumnUpdaterAction, {type: ActionTypes.SORT_TABLE_COLUMN}>;
export type PinTableColumnUpdaterAction = {
dataId: string;
column: string;
};
export function pinTableColumn(
dataId: string,
column: string
): Merge<PinTableColumnUpdaterAction, {type: ActionTypes.PIN_TABLE_COLUMN}>;
export type CopyTableColumnUpdaterAction = {
dataId: string;
column: string;
};
export function copyTableColumn(
dataId: string,
column: string
): Merge<CopyTableColumnUpdaterAction, {type: ActionTypes.COPY_TABLE_COLUMN}>;
export type AddDataToMapUpdaterOptions = {
centrMap?: boolean;
readOnly?: boolean;
keepExistingConfig?: boolean;
};
export type UpdateVisDataUpdaterAction = {
datasets: AddDataToMapPayload['datasets'];
options: AddDataToMapPayload['options'];
config: AddDataToMapPayload['config'];
} & AddDataToMapPayload;
export function updateVisData(
datasets: AddDataToMapPayload['datasets'],
options: AddDataToMapPayload['options'],
config: AddDataToMapPayload['config']
): Merge<UpdateVisDataUpdaterAction, {type: ActionTypes.UPDATE_VIS_DATA}>;
export type RenameDatasetUpdaterAction = {
dataId: string;
label: string;
};
export function renameDataset(
dataId: string,
label: string
): Merge<RenameDatasetUpdaterAction, {type: ActionTypes.RENAME_DATASET}>;
export type ToggleFilterAnimationUpdaterAction = {
idx;
};
export function toggleFilterAnimation(
idx: number
): Merge<ToggleFilterAnimationUpdaterAction, {type: ActionTypes.TOGGLE_FILTER_ANIMATION}>;
export type UpdateFilterAnimationSpeedUpdaterAction = {
idx: number;
speed: number;
};
export function updateFilterAnimationSpeed(
idx: number,
speed: number
): Merge<
UpdateFilterAnimationSpeedUpdaterAction,
{type: ActionTypes.UPDATE_FILTER_ANIMATION_SPEED}
>;
export type SetLayerAnimationTimeUpdaterAction = {
value: number;
};
export function setLayerAnimationTime(
value: number
): Merge<SetLayerAnimationTimeUpdaterAction, {type: ActionTypes.SET_LAYER_ANIMATION_TIME}>;
export type UpdateLayerAnimationSpeedUpdaterAction = {
speed: number;
};
export function updateLayerAnimationSpeed(
speed: number
): Merge<UpdateLayerAnimationSpeedUpdaterAction, {type: ActionTypes.UPDATE_LAYER_ANIMATION_SPEED}>;
export type ToggleLayerAnimationUpdaterAction = {
idx;
};
export function toggleLayerAnimation(
idx: number
): Merge<ToggleLayerAnimationUpdaterAction, {type: ActionTypes.TOGGLE_LAYER_ANIMATION}>;
export type EnlargeFilterUpdaterAction = {
idx: number;
};
export function enlargeFilter(
idx: number
): Merge<EnlargeFilterUpdaterAction, {type: ActionTypes.ENLARGE_FILTER}>;
export type ToggleFilterFeatureUpdaterAction = {
idx: number;
};
export function toggleFilterFeature(
idx: number
): Merge<ToggleFilterFeatureUpdaterAction, {type: ActionTypes.TOGGLE_FILTER_FEATURE}>;
export type OnLayerHoverUpdaterAction = {
info: {picked?: boolean} | null;
};
export function onLayerHover(
info: {picked?: boolean} | null
): Merge<OnLayerHoverUpdaterAction, {type: ActionTypes.LAYER_HOVER}>;
export type OnLayerClickUpdaterAction = {
info: {picked?: boolean} | null;
};
export function onLayerClick(
info: {picked?: boolean} | null
): Merge<OnLayerClickUpdaterAction, {type: ActionTypes.LAYER_CLICK}>;
export type OnMapClickUpdaterAction = {};
export function onMapClick(): Merge<OnMapClickUpdaterAction, {type: ActionTypes.MAP_CLICK}>;
export type OnMouseMoveUpdaterAction = {
evt;
};
export function onMouseMove(evt): Merge<OnMouseMoveUpdaterAction, {type: ActionTypes.MOUSE_MOVE}>;
export type ToggleLayerForMapUpdaterAction = {
mapIndex: number;
layerId: string;
};
export function toggleLayerForMap(
mapIndex: number,
layerId: string
): Merge<ToggleLayerForMapUpdaterAction, {type: ActionTypes.TOGGLE_LAYER_FOR_MAP}>;
export type SetFilterPlotUpdaterAction = {
idx: number;
newProp: object;
valueIndex?: number;
};
export function setFilterPlot(
idx: number,
newProp: object,
valueIndex?: number
): Merge<SetFilterPlotUpdaterAction, {type: ActionTypes.SET_FILTER_PLOT}>;
export type SetMapInfoUpdaterAction = {
info: any;
};
export function setMapInfo(
info: any
): Merge<SetMapInfoUpdaterAction, {type: ActionTypes.SET_MAP_INFO}>;
export type LoadFilesUpdaterAction = {
files: File[];
onFinish?(result: any): any;
};
export function loadFiles(
files: File[],
onFinish?: (result: any) => any
): Merge<LoadFilesUpdaterAction, {type: ActionTypes.LOAD_FILES}>;
export type SetFeaturesUpdaterAction = {
features: Feature[];
};
export function setFeatures(
features: Feature[]
): Merge<SetFeaturesUpdaterAction, {type: ActionTypes.SET_FEATURES}>;
export type SetPolygonFilterLayerUpdaterAction = {
layer: Layer;
feature: Feature;
};
export function setPolygonFilterLayer(
layer: Layer,
feature: Feature
): Merge<SetPolygonFilterLayerUpdaterAction, {type: ActionTypes.SET_POLYGON_FILTER_LAYER}>;
export type SetSelectedFeatureUpdaterAction = {
feature: Feature;
};
export function setSelectedFeature(
feature: Feature
): Merge<SetSelectedFeatureUpdaterAction, {type: ActionTypes.SET_SELECTED_FEATURE}>;
export type DeleteFeatureUpdaterAction = {
feature: Feature;
};
export function deleteFeature(
feature: Feature
): Merge<DeleteFeatureUpdaterAction, {type: ActionTypes.DELETE_FEATURE}>;
export type SetEditorModeUpdaterAction = {
mode: string;
};
export function setEditorMode(
mode: string
): Merge<SetEditorModeUpdaterAction, {type: ActionTypes.SET_EDITOR_MODE}>;
export type ApplyCPUFilterUpdaterAction = {
dataId: string | string[];
};
export function applyCPUFilter(
dataId: string | string[]
): Merge<ApplyCPUFilterUpdaterAction, {type: ActionTypes.APPLY_CPU_FILTER}>;
export type ToggleEditorVisibilityUpdaterAction = {};
export function toggleEditorVisibility(): Merge<
ToggleEditorVisibilityUpdaterAction,
{type: ActionTypes.TOGGLE_EDITOR_VISIBILITY}
>;
export function loadNextFile(): Merge<{type: ActionTypes.LOAD_NEXT_FILE}>;
export type loadFilesSuccessUpdaterAction = {
result: FileCacheItem[];
};
export function loadFilesSuccess(
result: FileCacheItem[]
): Merge<loadFilesSuccessUpdaterAction, {type: ActionTypes.LOAD_FILES_SUCCESS}>;
export type loadFilesErrUpdaterAction = {
fileName: string;
error: any;
};
export function loadFilesErr(
fileName: string,
error: any
): Merge<loadFilesErrUpdaterAction, {type: ActionTypes.LOAD_FILES_ERR}>;
export type LoadFileStepSuccessAction = {
fileName: string;
fileCache: FileCacheItem[];
};
export function loadFileStepSuccess(payload: {
fileName: string;
fileCache: FileCacheItem[];
}): Merge<LoadFileStepSuccessAction, {type: ActionTypes.LOAD_FILE_STEP_SUCCESS}>;
type FileContent = {
fileName: string;
header: string[];
data: any;
};
export type NextFileBatchUpdaterAction = {
payload: {
gen: AsyncGenerator<FileContent>;
fileName: string;
progress?: any;
accumulated?: any;
onFinish: (result: any) => any;
};
};
export function nextFileBatch(
payload: NextFileBatchAction['payload']
): Merge<NextFileBatchUpdaterAction, {type: ActionTypes.NEXT_FILE_BATCH}>;
export type ProcessFileContentUpdaterAction = {
payload: {
content: FileContent;
fileCache: FileCacheItem[];
};
};
export function processFileContent(
payload: ProcessFileContentUpdaterAction['payload']
): Merge<ProcessFileContentUpdaterAction, {type: ActionTypes.PROCESS_FILE_CONTENT}>;