Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[chore] ts refactoring (#2861)
Igor Dykhtaf1245d7e5b89
diff --git a/src/actions/src/ui-state-actions.ts b/src/actions/src/ui-state-actions.tsindex 4a7868541..1f601c9f4 100644--- a/src/actions/src/ui-state-actions.ts+++ b/src/actions/src/ui-state-actions.ts@@ -17,7 +17,7 @@ export type ToggleSidePanelUpdaterAction = {* @public*/export const toggleSidePanel: (- id: string | null+ id: ToggleSidePanelUpdaterAction['payload']) => Merge<ToggleSidePanelUpdaterAction, {type: typeof ActionTypes.TOGGLE_SIDE_PANEL}> =createAction(ActionTypes.TOGGLE_SIDE_PANEL, (id: string | null) => ({payload: id}));diff --git a/src/components/src/common/animation-control/floating-time-display.tsx b/src/components/src/common/animation-control/floating-time-display.tsxindex 55456e581..f4458d738 100644--- a/src/components/src/common/animation-control/floating-time-display.tsx+++ b/src/components/src/common/animation-control/floating-time-display.tsx@@ -144,7 +144,7 @@ export default function FloatingTimeDisplayFactory() {return accu;},- {displayDate: [], displayTime: []} as {displayDate: string[], displayTime: string[]}+ {displayDate: [], displayTime: []} as {displayDate: string[]; displayTime: string[]});}, [currentTime, timeFormat, defaultTimeFormat, timezone]);diff --git a/src/components/src/common/column-stats-chart.tsx b/src/components/src/common/column-stats-chart.tsxindex a16c4f4c0..9940ea519 100644--- a/src/components/src/common/column-stats-chart.tsx+++ b/src/components/src/common/column-stats-chart.tsx@@ -369,10 +369,10 @@ function ColumnStatsChartFactory(onChangedUpdater}) => {const fieldName = colorField?.name;- const field = useMemo(() => (fieldName ? dataset.getColumnField(fieldName) : null), [- dataset,- fieldName- ]);+ const field = useMemo(+ () => (fieldName ? dataset.getColumnField(fieldName) : null),+ [dataset, fieldName]+ );if (!isNumericColorBreaks(colorBreaks)) {// TODO: implement display for ordinal breaksdiff --git a/src/components/src/common/histogram-plot.tsx b/src/components/src/common/histogram-plot.tsxindex 8cbd87ac7..c3f3ddfab 100644--- a/src/components/src/common/histogram-plot.tsx+++ b/src/components/src/common/histogram-plot.tsx@@ -148,10 +148,7 @@ function HistogramPlotFactory() {}, [histogramsByGroup, domain, groupKeys, width, isMasked]);const x = useMemo(- () =>- scaleLinear()- .domain(domain)- .range([barWidth, width]),+ () => scaleLinear().domain(domain).range([barWidth, width]),[domain, width, barWidth]);diff --git a/src/components/src/common/range-slider-timeline.tsx b/src/components/src/common/range-slider-timeline.tsxindex 8e5d1b4ab..d875aa320 100644--- a/src/components/src/common/range-slider-timeline.tsx+++ b/src/components/src/common/range-slider-timeline.tsx@@ -2,7 +2,6 @@// Copyright contributors to the kepler.gl projectimport React, {useMemo} from 'react';-// eslint-disable-next-line no-unused-varsimport {CSSProperties} from 'react';import {ArrowDownFull, TimelineMarker} from '../common/icons';import {Tooltip} from '../common/styled-components';diff --git a/src/components/src/common/time-range-slider.tsx b/src/components/src/common/time-range-slider.tsxindex afbc4435a..58644b472 100644--- a/src/components/src/common/time-range-slider.tsx+++ b/src/components/src/common/time-range-slider.tsx@@ -117,10 +117,10 @@ export default function TimeRangeSliderFactory(} = props;const throttledOnchange = useMemo(() => throttle(onChange, 20), [onChange]);- const binsForInterval = useMemo(() => getTimeBinsForInterval(timeBins, plotType?.interval), [- timeBins,- plotType?.interval- ]);+ const binsForInterval = useMemo(+ () => getTimeBinsForInterval(timeBins, plotType?.interval),+ [timeBins, plotType?.interval]+ );const style = useMemo(() => ({diff --git a/src/components/src/modals/tilesets-modals/load-tileset.tsx b/src/components/src/modals/tilesets-modals/load-tileset.tsxindex b706e109d..b811b67bb 100644--- a/src/components/src/modals/tilesets-modals/load-tileset.tsx+++ b/src/components/src/modals/tilesets-modals/load-tileset.tsx@@ -97,7 +97,7 @@ function LoadTilesetTabFactory() {isAddingDatasets,intl}) => {- const [typeIndex/*, setTypeIndex*/] = useState<number>(0);+ const [typeIndex /* , setTypeIndex*/] = useState<number>(0);const [response, setResponse] = useState<MetaResponse>({});const error = response.error;diff --git a/src/components/src/modals/tilesets-modals/tileset-vector-form.tsx b/src/components/src/modals/tilesets-modals/tileset-vector-form.tsxindex 92c9a0430..3fc39a146 100644--- a/src/components/src/modals/tilesets-modals/tileset-vector-form.tsx+++ b/src/components/src/modals/tilesets-modals/tileset-vector-form.tsx@@ -37,7 +37,7 @@ export type VectorTilesetFormData = {metadataUrl?: string;};-const isPMTilesUrl = (url?: string | null)=> url?.includes('.pmtiles')+const isPMTilesUrl = (url?: string | null) => url?.includes('.pmtiles');export function getDatasetAttributesFromVectorTile({name,@@ -85,9 +85,7 @@ const TilesetVectorForm: React.FC<TilesetVectorFormProps> = ({setResponse}) => {event.preventDefault();const newTileUrl = event.target.value;setTileUrl(newTileUrl);- const potentialMetadataUrl = isPMTilesUrl(newTileUrl)- ? newTileUrl- : getMetaUrl(newTileUrl);+ const potentialMetadataUrl = isPMTilesUrl(newTileUrl) ? newTileUrl : getMetaUrl(newTileUrl);if (!metadataUrl && potentialMetadataUrl) {// check if URL exists before setting it as the metadata URLconst resp = await fetch(potentialMetadataUrl);diff --git a/src/components/src/side-panel/layer-panel/color-scale-selector.tsx b/src/components/src/side-panel/layer-panel/color-scale-selector.tsxindex 7abf31d6c..b1e9cc0b3 100644--- a/src/components/src/side-panel/layer-panel/color-scale-selector.tsx+++ b/src/components/src/side-panel/layer-panel/color-scale-selector.tsx@@ -300,7 +300,7 @@ function ColorScaleSelectorFactory(popperOptions={POPPER_OPTIONS}render={attrs => (<DropdownWrapper {...attrs}>- {/*@ts-ignore*/}+ {/* @ts-ignore*/}{!dropdownSelectProps.disabled && (<Typeahead{...dropdownSelectProps}@@ -317,7 +317,7 @@ function ColorScaleSelectorFactory()}><div className="dropdown-select">- {/*@ts-ignore*/}+ {/* @ts-ignore*/}<DropdownSelect{...dropdownSelectProps}displayOption={displayOption}diff --git a/src/components/src/types.ts b/src/components/src/types.tsindex ded46faed..9e93eb2b7 100644--- a/src/components/src/types.ts+++ b/src/components/src/types.ts@@ -40,7 +40,7 @@ export type SidePanelProps = {mapStateActions: typeof MapStateActions;mapStyleActions: typeof MapStyleActions;uiState: UiState;- availableProviders: {hasShare?: boolean; hasStorage?: boolean};+ availableProviders: {[k: string]: {hasShare?: boolean; hasStorage?: boolean}};mapSaved?: string | null;panels?: SidePanelItem[];onSaveMap?: () => void;diff --git a/src/constants/src/time.ts b/src/constants/src/time.tsindex d874a0a1f..5a0629dbe 100644--- a/src/constants/src/time.ts+++ b/src/constants/src/time.ts@@ -49,11 +49,6 @@ export interface Durations {milliseconds: number;}-export interface AnimatinWindow {- free: string;- interval: string;-}-export type TimeInterval = string; // TODO: TimeInterval should be an enumexport interface TickInterval {diff --git a/src/layers/src/arc-layer/arc-layer.ts b/src/layers/src/arc-layer/arc-layer.tsindex 0c4ad5e47..5095e7244 100644--- a/src/layers/src/arc-layer/arc-layer.ts+++ b/src/layers/src/arc-layer/arc-layer.ts@@ -586,9 +586,7 @@ export default class ArcLayer extends Layer {) {// for arrow format, `object` is the Arrow row object Proxy,// and index is passed in `hoverInfo`.- const index = Boolean(this.geoArrowVector0)- ? hoverInfo?.index- : (object as {index: number}).index;+ const index = this.geoArrowVector0 ? hoverInfo?.index : (object as {index: number}).index;if (index >= 0) {return dataContainer.row(index);}diff --git a/src/layers/src/base-layer.ts b/src/layers/src/base-layer.tsindex e396ae9c8..84075b15e 100644--- a/src/layers/src/base-layer.ts+++ b/src/layers/src/base-layer.ts@@ -13,7 +13,6 @@ import DefaultLayerIcon from './default-layer-icon';import {diffUpdateTriggers} from './layer-update';import {- ALL_FIELD_TYPES,CHANNEL_SCALES,CHANNEL_SCALE_SUPPORTED_FIELDS,DEFAULT_COLOR_UI,@@ -49,11 +48,12 @@ import {ColorUI,Field,Filter,- LayerTextLabel,- LayerVisConfig,+ GetVisChannelScaleReturnType,LayerVisConfigSettings,MapState,AnimationConfig,+ KeplerLayer,+ LayerBaseConfig,LayerColumns,LayerColumn,ColumnPairs,@@ -61,9 +61,11 @@ import {SupportedColumnMode,FieldPair,NestedPartial,- RGBAColor,RGBColor,- ValueOf+ ValueOf,+ VisualChannel,+ VisualChannels,+ VisualChannelDomain} from '@kepler.gl/types';import {getScaleFunction,@@ -78,48 +80,17 @@ import {getThresholdsFromQuantiles} from '@kepler.gl/utils';-export type VisualChannelDomain = number[] | string[];+export type {+ LayerBaseConfig,+ VisualChannel,+ VisualChannels,+ VisualChannelDomain,+ AggregatedBin+} from '@kepler.gl/types';+export type VisualChannelField = Field | null;export type VisualChannelScale = keyof typeof SCALE_TYPES;-export type AggregatedBin = {- i: number;- value: number;- counts: number;-};--export type LayerBaseConfig = {- dataId: string;- label: string;- color: RGBColor;-- columns: LayerColumns;- isVisible: boolean;- isConfigActive: boolean;- highlightColor: RGBColor | RGBAColor;- hidden: boolean;-- visConfig: LayerVisConfig;- textLabel: LayerTextLabel[];-- colorUI: {- color: ColorUI;- colorRange: ColorUI;- };- animation: {- enabled: boolean;- domain?: [number, number] | null;- };-- // for aggregate layer, aggregatedBins is returned for custom color scale- aggregatedBins?: AggregatedBin[];-- columnMode?: string;- heightField?: VisualChannelField;- heightDomain?: VisualChannelDomain;- heightScale?: string;-};-export type LayerBaseConfigPartial = {dataId: LayerBaseConfig['dataId']} & Partial<LayerBaseConfig>;export type LayerColorConfig = {@@ -157,33 +128,6 @@ export type LayerWeightConfig = {weightField: VisualChannelField;};-export type VisualChannels = {[key: string]: VisualChannel};--export type VisualChannelAggregation = 'colorAggregation' | 'sizeAggregation';--export type VisualChannel = {- property: string;- field: string;- scale: string;- domain: string;- range: string;- key: string;- channelScaleType: string;- nullValue?: any;- defaultMeasure?: any;- accessor?: string;- condition?: (config: any) => boolean;- defaultValue?: ((config: any) => any) | any;- getAttributeValue?: (config: any) => (d: any) => any;-- // TODO: define fixed- fixed?: any;-- supportedFieldTypes?: Array<keyof typeof ALL_FIELD_TYPES>;-- aggregation?: VisualChannelAggregation;-};-export type VisualChannelDescription = {label: string;measure: string | undefined;@@ -249,12 +193,7 @@ export type BaseLayerConstructorProps = {id?: string;} & LayerBaseConfigPartial;-export type GetVisChannelScaleReturnType = {- (z: number): any;- byZoom?: boolean;-} | null;--class Layer {+class Layer implements KeplerLayer {id: string;meta: Record<string, any>;visConfigSettings: {diff --git a/src/layers/src/index.ts b/src/layers/src/index.tsindex bf3c2d082..9d5ab2c24 100644--- a/src/layers/src/index.ts+++ b/src/layers/src/index.ts@@ -104,7 +104,7 @@ export const LayerClasses = {[LAYER_TYPES['3D']]: ScenegraphLayer,[LAYER_TYPES.trip]: TripLayer,[LAYER_TYPES.s2]: S2GeometryLayer- //[LAYER_TYPES['vectorTile']]: VectorTileLayer+ // [LAYER_TYPES['vectorTile']]: VectorTileLayer};export * from './mapbox-utils';diff --git a/src/layers/src/layer-utils.ts b/src/layers/src/layer-utils.tsindex 2f3dbe71b..46698ee4b 100644--- a/src/layers/src/layer-utils.ts+++ b/src/layers/src/layer-utils.ts@@ -77,7 +77,7 @@ function getBinaryGeometriesFromWKBArrow(options?.chunkIndex !== undefined && options?.chunkIndex >= 0? [geoColumn.data[options?.chunkIndex]]: geoColumn.data;- let globalFeatureIdOffset = options?.chunkOffset || 0;+ const globalFeatureIdOffset = options?.chunkOffset || 0;let featureIndex = globalFeatureIdOffset;let bounds: [number, number, number, number] = [Infinity, Infinity, -Infinity, -Infinity];@@ -278,7 +278,7 @@ export function getGeoArrowPointFields(fields: Field[]): Field[] {*/export function createGeoArrowPointVector(dataContainer: ArrowDataContainer,- getPosition: ({index: number}) => number[]+ getPosition: ({index}: {index: number}) => number[]): arrow.Vector {// TODO update/resize existing vector?// TODO find an easier way to create point geo columns@@ -328,7 +328,7 @@ export function getFilteredIndex(existingFilteredIndex: Uint8ClampedArray | null) {// contents are initialized with zeros by default, meaning not visible- let filteredIndex =+ const filteredIndex =existingFilteredIndex && existingFilteredIndex.length === numElements? existingFilteredIndex: new Uint8ClampedArray(numElements);@@ -354,7 +354,7 @@ export function getNeighbors(neighborsField: LayerColumn | undefined,dataContainer: DataContainerInterface,index: number,- getPosition: ({index: number}) => number[]+ getPosition: ({index}: {index: number}) => number[]): {index: number; position: number[]}[] {if (!neighborsField || neighborsField.fieldIdx < 0) return [];diff --git a/src/layers/src/point-layer/point-layer.ts b/src/layers/src/point-layer/point-layer.tsindex 309ff2d1d..4943a2b24 100644--- a/src/layers/src/point-layer/point-layer.ts+++ b/src/layers/src/point-layer/point-layer.ts@@ -619,7 +619,7 @@ export default class PointLayer extends Layer {updateTriggers,getFiltered: data.getFiltered},- Boolean(this.geoArrowVector)+ this.geoArrowVector? {...opts,data: {...opts.data, getPosition}@@ -653,9 +653,7 @@ export default class PointLayer extends Layer {) {// for arrow format, `object` is the Arrow row object Proxy,// and index is passed in `hoverInfo`.- const index = Boolean(this.geoArrowVector)- ? hoverInfo?.index- : (object as {index: number}).index;+ const index = this.geoArrowVector ? hoverInfo?.index : (object as {index: number}).index;if (index >= 0) {return dataContainer.row(index);}diff --git a/src/reducers/src/ui-state-updaters.ts b/src/reducers/src/ui-state-updaters.tsindex fd40a5ac4..c623b684d 100644--- a/src/reducers/src/ui-state-updaters.ts+++ b/src/reducers/src/ui-state-updaters.ts@@ -373,9 +373,11 @@ export const toggleMapControlUpdater = (// The effect panel and ai assistant panel can not be active at the same time// so we need to deactivate the other panel when one is activatedconst panelToDeactivate =- panelId === MAP_CONTROLS.effect ? MAP_CONTROLS.aiAssistant :- panelId === MAP_CONTROLS.aiAssistant ? MAP_CONTROLS.effect :- null;+ panelId === MAP_CONTROLS.effect+ ? MAP_CONTROLS.aiAssistant+ : panelId === MAP_CONTROLS.aiAssistant+ ? MAP_CONTROLS.effect+ : null;// If we need to deactivate a competing panel and it's currently activeif (panelToDeactivate && state.mapControls[panelToDeactivate]?.active) {diff --git a/src/reducers/src/vis-state-updaters.ts b/src/reducers/src/vis-state-updaters.tsindex a63451b99..978afa06b 100644--- a/src/reducers/src/vis-state-updaters.ts+++ b/src/reducers/src/vis-state-updaters.ts@@ -1144,7 +1144,7 @@ function _removeFilterDataIdAtValueIndex(filter, valueIndex, datasets) {};}-/***+/** ** Updates a single property of a filter*/function _updateFilterProp(state, filter, prop, value, valueIndex, datasetIds?) {diff --git a/src/types/layers.d.ts b/src/types/layers.d.tsindex a7cb47956..f248f01ce 100644--- a/src/types/layers.d.ts+++ b/src/types/layers.d.ts@@ -1,10 +1,10 @@// SPDX-License-Identifier: MIT// Copyright contributors to the kepler.gl project-import {HexColor} from './types';+import {HexColor, RGBColor, RGBAColor} from './types';export type LayerBaseConfig = {- dataId: string | null;+ dataId: string;label: string;color: RGBColor;@@ -26,7 +26,13 @@ export type LayerBaseConfig = {domain?: [number, number] | null;};+ // for aggregate layer, aggregatedBins is returned for custom color scale+ aggregatedBins?: AggregatedBin[];+columnMode?: string;+ heightField?: VisualChannelField;+ heightDomain?: VisualChannelDomain;+ heightScale?: string;};/**@@ -392,3 +398,72 @@ export type BindedLayerCallbacks = {onSetLayerDomain?: (value: any) => void;onFilteredItemsChange?: (event: {id: string; count: number}) => void;};++export type VisualChannelAggregation = 'colorAggregation' | 'sizeAggregation';++export type SupportedFieldTypes =+ | 'boolean'+ | 'date'+ | 'geojson'+ | 'integer'+ | 'real'+ | 'string'+ | 'timestamp'+ | 'point'+ | 'array'+ | 'object'+ | 'geoarrow'+ | 'h3';++export type VisualChannel = {+ property: string;+ field: string;+ scale: string;+ domain: string;+ range: string;+ key: string;+ channelScaleType: string;+ nullValue?: any;+ defaultMeasure?: any;+ accessor?: string;+ condition?: (config: any) => boolean;+ defaultValue?: ((config: any) => any) | any;+ getAttributeValue?: (config: any) => (d: any) => any;++ // TODO: define fixed+ fixed?: any;++ supportedFieldTypes?: Array<SupportedFieldTypes>;++ aggregation?: VisualChannelAggregation;+};++export type VisualChannels = {[key: string]: VisualChannel};++export interface KeplerLayer {+ id: string;+ meta: Record<string, any>;+ visConfigSettings: {+ [key: string]: ValueOf<LayerVisConfigSettings>;+ };+ config: LayerBaseConfig;++ getColorScale(+ colorScale: string,+ colorDomain: VisualChannelDomain,+ colorRange: ColorRange+ ): GetVisChannelScaleReturnType;+}++export type VisualChannelDomain = number[] | string[];++export type GetVisChannelScaleReturnType = {+ (z: number): any;+ byZoom?: boolean;+} | null;++export type AggregatedBin = {+ i: number;+ value: number;+ counts: number;+};diff --git a/src/utils/src/data-scale-utils.ts b/src/utils/src/data-scale-utils.tsindex 832e64c43..7ca9171e2 100644--- a/src/utils/src/data-scale-utils.ts+++ b/src/utils/src/data-scale-utils.ts@@ -8,7 +8,16 @@ import {notNullorUndefined} from '@kepler.gl/common-utils';import {ALL_FIELD_TYPES, SCALE_FUNC, SCALE_TYPES} from '@kepler.gl/constants';// import {AggregatedBin, Layer, VisualChannel, VisualChannelDomain} from '@kepler.gl/layers';// import {FilterProps, KeplerTable} from '@kepler.gl/layers';-import {ColorMap, ColorRange, HexColor, MapState} from '@kepler.gl/types';+import {+ AggregatedBin,+ ColorMap,+ ColorRange,+ HexColor,+ KeplerLayer as Layer,+ MapState,+ VisualChannel,+ VisualChannelDomain+} from '@kepler.gl/types';import {isRgbColor, rgbToHex} from './color-utils';import {DataContainerInterface} from './data-container-interface';@@ -30,10 +39,6 @@ export type ColorBreakOrdinal = {export type D3ScaleFunction = Record<string, any> & ((x: any) => any);// TODO isolate types - depends on @kepler.gl/layers-type Layer = any;-type VisualChannel = any;-type VisualChannelDomain = any;-type AggregatedBin = any;type FilterProps = any;type KeplerTable = any;diff --git a/src/utils/src/format.ts b/src/utils/src/format.tsindex e23dfc86d..e60128222 100644--- a/src/utils/src/format.ts+++ b/src/utils/src/format.ts@@ -28,4 +28,4 @@ export function getDefaultTimeFormat(interval?: string): string {}}-export const getFormatValue = (fmt: TimeLabelFormat): string | null => fmt[TOOLTIP_KEY];\ No newline at end of file+export const getFormatValue = (fmt: TimeLabelFormat): string | null => fmt[TOOLTIP_KEY];diff --git a/src/utils/src/index.ts b/src/utils/src/index.tsindex 4d9d0ae30..f854a9072 100644--- a/src/utils/src/index.ts+++ b/src/utils/src/index.ts@@ -24,7 +24,7 @@ export {paletteIsColorBlindSafe,updateColorRangeByMatchingPalette,updateCustomColorRangeByColorUI,- initializeCustomPalette,+ initializeCustomPalette} from './color-utils';export {errorNotification} from './notifications-utils';diff --git a/src/utils/src/plot.ts b/src/utils/src/plot.tsindex 51aaa8ca6..d048d4271 100644--- a/src/utils/src/plot.ts+++ b/src/utils/src/plot.ts@@ -656,10 +656,7 @@ export function updateRangeFilterPlotType(};}-export function getChartTitle(- yAxis: {displayName?: string},- plotType: {aggregation: string}-): string {+export function getChartTitle(yAxis: Field, plotType: PlotType): string {const yAxisName = yAxis?.displayName;const {aggregation} = plotType;diff --git a/test/browser/components/map/map-legend-test.js b/test/browser/components/map/map-legend-test.jsindex c24a4aab6..591c00d9b 100644--- a/test/browser/components/map/map-legend-test.js+++ b/test/browser/components/map/map-legend-test.js@@ -163,29 +163,18 @@ function testPointLayerLegend(t, pointLegend, onLayerVisConfigChange) {['#AAD7D9', 'driver_gps']];for (let i = 0; i < 3; i++) {- const rect = pointLegend- .find(LegendRow)- .at(i)- .find('.legend-row-color')- .at(0);+ const rect = pointLegend.find(LegendRow).at(i).find('.legend-row-color').at(0);t.equal(rect.props().style.backgroundColor,expectedLegend[i][0],'should render correct legend color');- const input = pointLegend- .find(LegendRow)- .at(i)- .find('input')- .at(0);+ const input = pointLegend.find(LegendRow).at(i).find('input').at(0);t.equal(input.props().value, expectedLegend[i][1], 'should render correct legend label');}// test change input- const firstLegendInput = pointLegend- .find(LegendRow)- .at(0)- .find('input');+ const firstLegendInput = pointLegend.find(LegendRow).at(0).find('input');const event = {target: {name: 'input-legend-label', value: 'taro'}};firstLegendInput.simulate('change', event);@@ -271,10 +260,7 @@ test('Components -> MapLegend.render -> with colorLegends', t => {t.equal(firstLegend.find(ResetColorLabel).length, 1, 'should render reset');// click reset- firstLegend- .find(ResetColorLabel)- .at(0)- .simulate('click');+ firstLegend.find(ResetColorLabel).at(0).simulate('click');t.ok(onLayerVisConfigChange.calledOnce, 'should call onLayerVisConfigChange');t.ok(onLayerVisConfigChange.args[0][0] instanceof PointLayer, 'first arg should be Layer');diff --git a/test/browser/components/map/map-popover-test.js b/test/browser/components/map/map-popover-test.jsindex 192fc04f9..42c41899e 100644--- a/test/browser/components/map/map-popover-test.js+++ b/test/browser/components/map/map-popover-test.js@@ -156,10 +156,7 @@ test('Map Popover - render with geojsonLayerHoverProp', t => {t.ok(onSetFeatures.called, 'should call onSetFeatures when click select geometry');// click pin- wrapper- .find('.popover-pin')- .at(0)- .simulate('click');+ wrapper.find('.popover-pin').at(0).simulate('click');t.ok(onClose.called, 'should call onClose when click pin');// render coordinate@@ -170,32 +167,11 @@ test('Map Popover - render with geojsonLayerHoverProp', t => {});t.equal(wrapper.find(CoordinateInfo).length, 1, 'Should render CoordinateInfo');- t.equal(- wrapper- .find('.row__value')- .at(0)- .text(),- '-31.123457,',- 'should render lat'- );+ t.equal(wrapper.find('.row__value').at(0).text(), '-31.123457,', 'should render lat');- t.equal(- wrapper- .find('.row__value')- .at(1)- .text(),- '127.123457,',- 'should render longitude'- );+ t.equal(wrapper.find('.row__value').at(1).text(), '127.123457,', 'should render longitude');- t.equal(- wrapper- .find('.row__value')- .at(2)- .text(),- '12.1z',- 'should render zoom'- );+ t.equal(wrapper.find('.row__value').at(2).text(), '12.1z', 'should render zoom');t.end();});diff --git a/test/browser/components/side-panel/channel-by-value-selctor-test.js b/test/browser/components/side-panel/channel-by-value-selctor-test.jsindex ff3fde185..ebf557ba9 100644--- a/test/browser/components/side-panel/channel-by-value-selctor-test.js+++ b/test/browser/components/side-panel/channel-by-value-selctor-test.js@@ -97,19 +97,13 @@ test('Components -> ChannelByValueSelector -> ColorScaleSelector -> disabled', tt.equal(wrapper.find(DimensionScaleSelector).length, 1, 'Should render 1 DimensionScaleSelector');t.equal(wrapper.find(ColorScaleSelector).length, 1, 'Should render 1 ColorScaleSelector');t.equal(- wrapper- .find(ColorScaleSelector)- .at(0)- .props().disabled,+ wrapper.find(ColorScaleSelector).at(0).props().disabled,true,'Should disabled color scale select if only 1 option');t.equal(- wrapper- .find(ColorScaleSelector)- .at(0)- .find(DropdownSelect).length,+ wrapper.find(ColorScaleSelector).at(0).find(DropdownSelect).length,1,'should render 1 DropdownSelect in ColorScaleSelector');@@ -129,56 +123,29 @@ test('Components -> ChannelByValueSelector -> ColorScaleSelector -> disabled', t// change color fieldconst fieldSelector = wrapper.find(FieldSelector).at(0);- fieldSelector- .find('.item-selector__dropdown')- .at(0)- .simulate('click');+ fieldSelector.find('.item-selector__dropdown').at(0).simulate('click');// dropdownSelect.simulate('click');+ t.equal(wrapper.find(FieldSelector).at(0).find(Typeahead).length, 1, 'should render Typeahead');t.equal(- wrapper- .find(FieldSelector)- .at(0)- .find(Typeahead).length,- 1,- 'should render Typeahead'- );- t.equal(- wrapper- .find(FieldSelector)- .at(0)- .find(DropdownList).length,+ wrapper.find(FieldSelector).at(0).find(DropdownList).length,1,'should render 1 DropdownList');t.equal(- wrapper- .find(FieldSelector)- .at(0)- .find('.list__item').length,+ wrapper.find(FieldSelector).at(0).find('.list__item').length,10,'should render 10 ListItem');t.equal(- wrapper- .find(FieldSelector)- .at(0)- .find('.list__item')- .at(5)- .find('.list__item__anchor')- .text(),+ wrapper.find(FieldSelector).at(0).find('.list__item').at(5).find('.list__item__anchor').text(),'uid','Should render id field at index:5');// select id field- wrapper- .find(FieldSelector)- .at(0)- .find('.list__item')- .at(5)- .simulate('click');+ wrapper.find(FieldSelector).at(0).find('.list__item').at(5).simulate('click');t.ok(updateLayerVisualChannelConfig.calledOnce, 'Should call updateLayerVisualChannelConfig');@@ -243,20 +210,14 @@ test('Components -> ChannelByValueSelector -> ColorScaleSelector -> ColorBreakDit.equal(wrapper.find(DimensionScaleSelector).length, 1, 'Should render 1 DimensionScaleSelector');t.equal(wrapper.find(ColorScaleSelector).length, 1, 'Should render 1 ColorScaleSelector');t.equal(- wrapper- .find(ColorScaleSelector)- .at(0)- .props().disabled,+ wrapper.find(ColorScaleSelector).at(0).props().disabled,false,'Should not disabled color scale select');// scale optonst.equal(- wrapper- .find(ColorScaleSelector)- .at(0)- .find('.list__item').length,+ wrapper.find(ColorScaleSelector).at(0).find('.list__item').length,3,'should render 3 scale options');@@ -280,11 +241,7 @@ test('Components -> ChannelByValueSelector -> ColorScaleSelector -> ColorBreakDi.at(i).find('div.custom-palette-hex__input__text');t.equal(- wrapper- .find(ColorPaletteItem)- .at(i)- .find(ColorSwatch)- .props().color,+ wrapper.find(ColorPaletteItem).at(i).find(ColorSwatch).props().color,expectedText[i][0],'should display correct color');@@ -293,12 +250,7 @@ test('Components -> ChannelByValueSelector -> ColorScaleSelector -> ColorBreakDi}// select custom scale- wrapper- .find(ColorScaleSelector)- .at(0)- .find('.list__item')- .at(2)- .simulate('click');+ wrapper.find(ColorScaleSelector).at(0).find('.list__item').at(2).simulate('click');t.ok(setColorUI.calledOnce, 'should call setColorUI');const expectedArgs = [@@ -370,10 +322,7 @@ test('Components -> ChannelByValueSelector -> ColorScaleSelector -> ColorBreakDit.equal(wrapper.find(ColorSwatch).length, 4, 'Should render 4 ColorSwatch');for (let i = 0; i < 4; i++) {- const inputs = wrapper- .find(EditableColorRange)- .at(i)- .find('input');+ const inputs = wrapper.find(EditableColorRange).at(i).find('input');if (i === 0 || i === 3) {t.equal(inputs.length, 1, 'should render 1 input');t.equal(@@ -405,12 +354,7 @@ test('Components -> ChannelByValueSelector -> ColorScaleSelector -> ColorBreakDi.simulate('change', {target: {value: '5000'}});t.notOk(setColorUI.calledTwice, 'should not call setColorUI');- wrapper- .find(EditableColorRange)- .at(1)- .find('input')- .at(1)- .simulate('blur');+ wrapper.find(EditableColorRange).at(1).find('input').at(1).simulate('blur');t.ok(setColorUI.calledTwice, 'should call setColorUI');const expectedCustomPalette1 = {...ExpectedCustomPalette.customPalette,@@ -432,10 +376,7 @@ test('Components -> ChannelByValueSelector -> ColorScaleSelector -> ColorBreakDi// on confirm custom breakst.equal(wrapper.find(CustomPalette).find(Button).length, 2, 'should render 2 buttons');- const confirmButton = wrapper- .find(CustomPalette)- .find(Button)- .at(0);+ const confirmButton = wrapper.find(CustomPalette).find(Button).at(0);t.equal(confirmButton.text(), 'Confirm', 'should render confirm button');confirmButton.simulate('click');@@ -493,11 +434,7 @@ test('Components -> ChannelByValueSelector -> ColorScaleSelector -> ColorBreakDichildren: <ChannelByValueSelector {...InitialProps} layer={updatedState2.visState.layers[0]} />});// set scale back to standard scale (:quantile)- const quantileOption = wrapper- .find(ColorScaleSelector)- .at(0)- .find('.list__item')- .at(1);+ const quantileOption = wrapper.find(ColorScaleSelector).at(0).find('.list__item').at(1);t.equal(quantileOption.text(), 'Quantile', '2nd scale option should be quantile');quantileOption.simulate('click');@@ -599,12 +536,7 @@ test('Components -> ChannelByValueSelector -> ColorScaleSelector -> ColumnStatsC[quantizeTestCase, quantileTestCase, customTestCase].forEach(tc => {// simulate click color scale option- wrapper- .find(ColorScaleSelector)- .at(0)- .find('.list__item')- .at(tc.optionIndex)- .simulate('click');+ wrapper.find(ColorScaleSelector).at(0).find('.list__item').at(tc.optionIndex).simulate('click');// trigger actionconst updatedState2 = coreReducer(diff --git a/test/fixtures/state-saved-v0.js b/test/fixtures/state-saved-v0.jsindex 5a1eefee9..82d1cf966 100644--- a/test/fixtures/state-saved-v0.js+++ b/test/fixtures/state-saved-v0.js@@ -922,15 +922,8 @@ export const mergedFilters = ['5-second': histogramFromThreshold(getBinThresholds('5-second', [1453770124000, 1453770810000]),[- 1453770810000,- 1453770279000,- 1453770358000,- 1453770124000,- 1453770131000,- 1453770395000,- 1453770173000,- 1453770394000,- 1453770540000+ 1453770810000, 1453770279000, 1453770358000, 1453770124000, 1453770131000,+ 1453770395000, 1453770173000, 1453770394000, 1453770540000])}diff --git a/test/fixtures/test-csv-data.js b/test/fixtures/test-csv-data.jsindex 8c79c05d2..c0da79520 100644--- a/test/fixtures/test-csv-data.js+++ b/test/fixtures/test-csv-data.js@@ -625,30 +625,10 @@ export const epochMappedValue = [];export const timeStampmappedValue = [- 1474070995000,- 1474071056000,- 1474071116000,- 1474071178000,- 1474071240000,- 1474071301000,- 1474071363000,- 1474071425000,- 1474071489000,- 1474071552000,- 1474071567000,- 1474071614000,- 1474071677000,- 1474071740000,- 1474071802000,- 1474071864000,- 1474071928000,- 1474071989000,- 1474072051000,- 1474072115000,- 1474072180000,- 1474072203000,- 1474072203000,- 1474072208000+ 1474070995000, 1474071056000, 1474071116000, 1474071178000, 1474071240000, 1474071301000,+ 1474071363000, 1474071425000, 1474071489000, 1474071552000, 1474071567000, 1474071614000,+ 1474071677000, 1474071740000, 1474071802000, 1474071864000, 1474071928000, 1474071989000,+ 1474072051000, 1474072115000, 1474072180000, 1474072203000, 1474072203000, 1474072208000];export const timeFilterProps = {@@ -796,24 +776,9 @@ export const expectedSyncedTsFilter = {}},mappedValue: [- 1474071301000,- 1474071363000,- 1474071425000,- 1474071489000,- 1474071552000,- 1474071567000,- 1474071614000,- 1474071677000,- 1474071740000,- 1474071802000,- 1474071864000,- 1474071928000,- 1474071989000,- 1474072051000,- 1474072115000,- 1474072180000,- 1474072203000,- 1474072203000,+ 1474071301000, 1474071363000, 1474071425000, 1474071489000, 1474071552000, 1474071567000,+ 1474071614000, 1474071677000, 1474071740000, 1474071802000, 1474071864000, 1474071928000,+ 1474071989000, 1474072051000, 1474072115000, 1474072180000, 1474072203000, 1474072203000,1474072208000]};diff --git a/test/node/utils/filter-utils-test.js b/test/node/utils/filter-utils-test.jsindex 551524817..3b2cc5069 100644--- a/test/node/utils/filter-utils-test.js+++ b/test/node/utils/filter-utils-test.js@@ -529,10 +529,10 @@ test('filterUtils -> scaleSourceDomainToDestination', t => {const sourceDomain = [1564174363000, 1564179109000];const destinationDomain = [1564174363000, 1564184336370];- t.deepEqual(scaleSourceDomainToDestination(sourceDomain, destinationDomain), [- 0,- 47.586723444532794- ]);+ t.deepEqual(+ scaleSourceDomainToDestination(sourceDomain, destinationDomain),+ [0, 47.586723444532794]+ );t.end();});@@ -575,15 +575,8 @@ test('filterUtils -> mergeFilterWithTimeline', t => {syncTimelineMode: 1,step: 1000,mappedValue: [- 1564176748230,- 1564177260220,- 1564178662720,- 1564178735140,- 1564182284550,- 1564183811180,- 1564184245340,- 1564184331290,- 1564184336370+ 1564176748230, 1564177260220, 1564178662720, 1564178735140, 1564182284550, 1564183811180,+ 1564184245340, 1564184331290, 1564184336370],defaultTimeFormat: 'L LTS',fieldType: 'timestamp',diff --git a/website/webpack.config.js b/website/webpack.config.jsindex b88f67e21..4ec6a917b 100644--- a/website/webpack.config.js+++ b/website/webpack.config.js@@ -108,7 +108,7 @@ const COMMON_CONFIG = {},devServer: {- historyApiFallback: true,+ historyApiFallback: true// Add new options if needed},@@ -148,7 +148,7 @@ const addProdConfig = config => {output: {path: resolve(__dirname, './dist'),filename: 'bundle.js',- publicPath: "/"+ publicPath: '/'}});};