Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[Chore] added more properties to export layer type (#1613)
Shan Hea810ee13befc
diff --git a/package.json b/package.jsonindex 0e5bb9279..884ae23b5 100644--- a/package.json+++ b/package.json@@ -232,7 +232,7 @@"tape": "^4.9.2","tape-catch": "^1.0.6","typedoc-plugin-markdown": "^3.0.11",- "typescript": "3.8.3",+ "typescript": "4.2.3","uber-licence": "^3.1.1","url-loader": "^4.1.1","watchify": "^3.6.1",diff --git a/src/components/index.js b/src/components/index.jsindex a661e3fc1..e419f6b59 100644--- a/src/components/index.js+++ b/src/components/index.js@@ -151,6 +151,8 @@ export {injector, provideRecipesToInjector, withState} from './injector';// Common Componentsexport {default as CloudTile} from './modals/cloud-tile';export {default as FileUploadFactory, FileUpload} from './common/file-uploader/file-upload';+export {default as FileDrop} from './common/file-uploader/file-drop';+export {default as UploadButton} from './common/file-uploader/upload-button';export {default as DatasetLabel} from './common/dataset-label';export {default as ItemSelector} from './common/item-selector/item-selector';export {default as Typeahead} from './common/item-selector/typeahead';@@ -174,6 +176,7 @@ export {default as CanvasHack} from './common/data-table/canvas';export {default as MapLayerSelector} from './common/map-layer-selector';export {default as VerticalToolbar} from './common/vertical-toolbar';export {default as ToolbarItem} from './common/toolbar-item';+export {SharingUrl} from './modals/share-map-modal';export {default as TippyTooltip} from './common/tippy-tooltip';// side pane componentsdiff --git a/src/connect/with-local-selector.d.ts b/src/connect/with-local-selector.d.tsindex f74a020e7..22d31a7f0 100644--- a/src/connect/with-local-selector.d.ts+++ b/src/connect/with-local-selector.d.ts@@ -1,11 +1,8 @@-import {Component} from 'react';+import {ComponentType} from 'react';import KeplerGlContext from 'components/context';-import {ConnectedComponent} from 'react-redux';interface ContextSelector {(state: any, context: any): KeplerGlContext;}-export default function withLocalSelector<P, S>(- component: ConnectedComponent<P, S>-): Component<P, S>;+export default function withLocalSelector(ParentComponent: ComponentType): ComponentType;diff --git a/src/layers/index.d.ts b/src/layers/index.d.tsindex 3827723ad..af41e1178 100644--- a/src/layers/index.d.ts+++ b/src/layers/index.d.ts@@ -1,6 +1,7 @@-import {RGBColor, RGBAColor} from '../reducers/types';-import {Field, Datasets, KeplerTable} from '../reducers/vis-state-updaters';-import {LayerTextLabel, ColorRange, ColorUI, LayerVisConfig} from './layer-factory';+import {RGBColor, RGBAColor, GpuFilter, MapState, Field, Filter, Datasets} from '../reducers';+import {LayerTextLabel, ColorRange, ColorUI, VisConfigRange} from './layer-factory';++export {LAYER_VIS_CONFIGS, LayerVisConfig} from './layer-factory';export type LayerColumns = {[key: string]: {value: string | null; fieldIdx: number; optional?: boolean};@@ -38,6 +39,10 @@ export type LayerConfig = {animation: {enabled: boolean;};++ heightField: VisualChannelField;+ heightDomain: VisualChannelDomain;+ heightScale: string;};export type VisualChannel = {@@ -48,8 +53,8 @@ export type VisualChannel = {range: string;key: string;channelScaleType: string;- nullValue: any;- defaultMeasure: any;+ nullValue?: any;+ defaultMeasure?: any;accessor?: string;condition?: (config: any) => boolean;getAttributeValue?: (config: any) => (d: any) => any;@@ -67,10 +72,11 @@ export class Layer {} & Partial<LayerConfig>);id: string;- type: string;+ get type(): string;+ get visualChannels(): {[key: string]: VisualChannel};+config: LayerConfig;visConfigSettings: any;- visualChannels: {[key: string]: VisualChannel};_oldDataUpdateTriggers: any;hasAllColumns(): boolean;updateLayerConfig(p: Partial<LayerConfig>): Layer;@@ -81,10 +87,33 @@ export class Layer {updateLayerColorUI(prop: string, newConfig: Partial<ColorUI>): Layer;isValidToSave(): boolean;validateVisualChannel(channel: string);- getVisualChannelDescription(key: string): {label: string, measure: string};static findDefaultLayerProps(dataset: KeplerTable, foundLayers?: any[]);// static findDefaultColumnField(defaultFields, allFields)+ getVisualChannelDescription(key: string): VisualChannelDescription;+ isLayerHovered(objectInfo: any): boolean;+ hasHoveredObject(objectInfo: any): any | null;+ getHoverData(object: any, allData?: KeplerTable['allData'], fields?: KeplerTable['fields']): any;+ registerVisConfig(config: LayerVisConfig): any;+ getDefaultLayerConfig(config: {[key: string]: any}): any;+ getColorScale(+ colorScale: string,+ colorDomain: VisualChannelDomain,+ colorRange: VisConfigRange+ ): () => any | null;+ getVisChannelScale(+ heightScale: string,+ heightDomain: VisualChannelDomain,+ heightRange: VisConfigRange+ ): () => any | null;+ getEncodedChannelValue(+ scale: (value) => any,+ data: any[],+ field: VisualChannelField,+ nullValue: any,+ getValue: (value) => any+ ): any;+ getDefaultDeckLayerProps(props: {idx: number; gpuFilter: GpuFilter; mapState: MapState}): any;}export type LayerClassesType = {@@ -104,5 +133,5 @@ export type LayerClassesType = {};export const LayerClasses: LayerClassesType;-export type OVERLAY_TYPE = {[key: string]: string}+export type OVERLAY_TYPE = {[key: string]: string};export const LAYER_ID_LENGTH: number;diff --git a/src/reducers/vis-state-updaters.d.ts b/src/reducers/vis-state-updaters.d.tsindex fbd3d6bf2..ef4eac7df 100644--- a/src/reducers/vis-state-updaters.d.ts+++ b/src/reducers/vis-state-updaters.d.ts@@ -536,3 +536,5 @@ export const DEFAULT_EDITOR: Editor;export function computeSplitMapLayers(layers: Array<Layer>): Array<Layer>;export function closeSpecificMapAtIndex(state: VisState, action: unknown);++export {ProtoDataset} from '../actions/actions';diff --git a/src/utils/table-utils/kepler-table.d.ts b/src/utils/table-utils/kepler-table.d.tsindex 7b9753e24..74d496aff 100644--- a/src/utils/table-utils/kepler-table.d.ts+++ b/src/utils/table-utils/kepler-table.d.ts@@ -54,7 +54,7 @@ export type FilterDatasetOpt = {ignoreDomain?: boolean;};-export function sortDatasetByColumn(dataset: Dataset, column: string, mode?: string): Dataset;+export function sortDatasetByColumn(dataset: KeplerTable, column: string, mode?: string): Dataset;export function findPointFieldPairs(fields: Field[]): FieldPair[];diff --git a/src/utils/table-utils/kepler-table.js b/src/utils/table-utils/kepler-table.jsindex 6c06b0147..beea54190 100644--- a/src/utils/table-utils/kepler-table.js+++ b/src/utils/table-utils/kepler-table.js@@ -448,11 +448,10 @@ export function sortDatasetByColumn(dataset, column, mode) {const sortBy = SORT_ORDER[mode] || SORT_ORDER.ASCENDING;if (sortBy === SORT_ORDER.UNSORT) {- return {- ...dataset,- sortColumn: {},- sortOrder: null- };+ dataset.sortColumn = {};+ dataset.sortOrder = null;++ return dataset;}const sortFunction = sortBy === SORT_ORDER.ASCENDING ? ascending : descending;@@ -462,13 +461,12 @@ export function sortDatasetByColumn(dataset, column, mode) {sortFunction(dataContainer.valueAt(a, fieldIndex), dataContainer.valueAt(b, fieldIndex)));- return {- ...dataset,- sortColumn: {- [column]: sortBy- },- sortOrder+ dataset.sortColumn = {+ [column]: sortBy};+ dataset.sortOrder = sortOrder;++ return dataset;}export function copyTable(original) {diff --git a/test/node/reducers/vis-state-test.js b/test/node/reducers/vis-state-test.jsindex c8af822fb..e33ec25c6 100644--- a/test/node/reducers/vis-state-test.js+++ b/test/node/reducers/vis-state-test.js@@ -4615,6 +4615,8 @@ test('#visStateReducer -> APPLY_CPU_FILTER has multi datasets', t => {test('#visStateReducer -> SORT_TABLE_COLUMN', t => {const initialState = CloneDeep(StateWFiles.visState);const previousDataset1 = initialState.datasets[testCsvDataId];+ const previousKeys = Object.keys(previousDataset1);+// sort with default modeconst nextState = reducer(initialState, VisStateActions.sortTableColumn());t.equal(nextState, initialState, 'state should not change when input is given');@@ -4653,7 +4655,7 @@ test('#visStateReducer -> SORT_TABLE_COLUMN', t => {21];const newKeys = Object.keys(nextState2.datasets[testCsvDataId]);- const addedKeys = newKeys.filter(k => !Object.keys(previousDataset1).includes(k));+ const addedKeys = newKeys.filter(k => !previousKeys.includes(k));t.deepEqual(addedKeys,diff --git a/yarn.lock b/yarn.lockindex 99d84d011..1a48a5c63 100644--- a/yarn.lock+++ b/yarn.lock@@ -14581,10 +14581,10 @@ typedoc@^0.19.2:shelljs "^0.8.4"typedoc-default-themes "^0.11.4"- version "3.8.3"- resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061"- integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==+ version "4.2.3"+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3"+ integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==ua-parser-js@^0.7.18:version "0.7.28"