diff --git a/package.json b/package.json index ba67e73dfa..bb5158a210 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "analyze:bundle": "webpack --config ./webpack/bundle.js --progress --env.prod", "check-licence": "uber-licence --dry", "add-licence": "uber-licence", - "prepublish": "ber-licence && yarn build && yarn build:umd && yarn build:types", + "prepublish": "uber-licence && yarn build && yarn build:umd && yarn build:types", "docs": "babel-node ./scripts/documentation.js", "typedoc": "typedoc --theme markdown --out typedoc --inputFiles ./src/reducers --inputFiles ./src/actions --excludeExternals --excludeNotExported --excludePrivate", "example-version": "babel-node ./scripts/edit-version.js", @@ -286,6 +286,7 @@ "Giuseppe Macri " ], "volta": { - "node": "12.19.0" + "node": "12.19.0", + "yarn": "1.22.17" } } \ No newline at end of file diff --git a/src/components/common/icons/index.d.ts b/src/components/common/icons/index.d.ts index b7f9592ef4..7da7df421e 100644 --- a/src/components/common/icons/index.d.ts +++ b/src/components/common/icons/index.d.ts @@ -17,6 +17,7 @@ export const Checkmark: React.ElementType; export const Clipboard: React.ElementType; export const Clock: React.ElementType; export const Close: React.ElementType; +export const Copy: React.ElementType; export const Crosshairs: React.ElementType; export const Cube3d: React.ElementType; export const CursorClick: React.ElementType; @@ -73,4 +74,3 @@ export const Warning: React.ElementType; export const DrawPolygon: React.ElementType; export const Polygon: React.ElementType; export const Rectangle: React.ElementType; -export const Globe: React.ElementType; diff --git a/src/components/index.d.ts b/src/components/index.d.ts index 6f1561f1bd..292ebff4ad 100644 --- a/src/components/index.d.ts +++ b/src/components/index.d.ts @@ -22,6 +22,7 @@ export * from './common/tippy-tooltip' export * as Icons from './common/icons'; export * from './common/file-uploader/file-drop'; export * from './common/file-uploader/upload-button'; +export {default as Portaled} from './common/portaled'; export const PanelHeaderAction: (...props: any[]) => JSX.Element; export const TippyTooltip: (...props: any[]) => JSX.Element; diff --git a/src/components/modal-container.js b/src/components/modal-container.js index f7af49aba0..4dd6f02ac9 100644 --- a/src/components/modal-container.js +++ b/src/components/modal-container.js @@ -178,7 +178,8 @@ export default function ModalContainerFactory( _onExportImage = () => { if (!this.props.uiState.exportImage.processing) { - exportImage(this.props, `${this.props.appName}.png`); + // @ts-ignore TODO: fix exportImage method + exportImage(this.props.uiState.exportImage, `${this.props.appName}.png`); this.props.uiStateActions.cleanupExportImage(); this._closeModal(); } diff --git a/src/components/side-panel/globe-mananger.js b/src/components/side-panel/globe-mananger.js deleted file mode 100644 index b6558c3f62..0000000000 --- a/src/components/side-panel/globe-mananger.js +++ /dev/null @@ -1,101 +0,0 @@ -import React, {useCallback, useState} from 'react'; -import {PanelLabel} from 'components/common/styled-components'; -import MapStyleSelectorFactory from 'components/side-panel/map-style-panel/map-style-selector'; -import GlobeTogglePanelFactory from './globe-panel/globe-toggle-panel'; -import GlobeRangePanelFactory from './globe-panel/globe-range-panel'; - -GlobeManagerFactory.deps = [ - MapStyleSelectorFactory, - GlobeTogglePanelFactory, - GlobeRangePanelFactory -]; - -function GlobeManagerFactory(MapStyleSelector, GlobeTogglePanel, GlobeRangePanel) { - const GlobeManager = ({globe, mapStyle, mapStyleActions, mapStateActions}) => { - const {mapStyleChange} = mapStyleActions; - const {globeConfigChange} = mapStateActions; - const [isSelecting, setIsSelecting] = useState(false); - const toggleSelection = useCallback(() => setIsSelecting(!isSelecting), [ - isSelecting, - setIsSelecting - ]); - - const selectStyle = useCallback( - style => { - mapStyleChange(style); - toggleSelection(); - }, - [mapStyleChange, toggleSelection] - ); - - return ( - <> - -
- Atmosphere -
- - - - - - - -
- Basemap -
- - - - - - ); - }; - - return GlobeManager; -} - -export default GlobeManagerFactory; diff --git a/src/localization/locales.d.ts b/src/localization/locales.d.ts index 3b585a9482..4928c2dd73 100644 --- a/src/localization/locales.d.ts +++ b/src/localization/locales.d.ts @@ -4,6 +4,9 @@ export declare const LOCALES: { pt: string; es: string; ca: string; + ja: string; + cn: string; + ru: string; }; export declare const LOCALE_CODES: {[key: string]: string}; diff --git a/src/processors/data-processor.js b/src/processors/data-processor.js index e5bf3a9e97..ad21de4e0d 100644 --- a/src/processors/data-processor.js +++ b/src/processors/data-processor.js @@ -439,9 +439,10 @@ export function processRowObject(rawData) { return null; } else if (!rawData.length) { // data is empty - return { - fields: [], rows: [] - } + return { + fields: [], + rows: [] + }; } const keys = Object.keys(rawData[0]); diff --git a/src/reducers/vis-state-updaters.js b/src/reducers/vis-state-updaters.js index 6f3efca80f..9bf678aedf 100644 --- a/src/reducers/vis-state-updaters.js +++ b/src/reducers/vis-state-updaters.js @@ -87,7 +87,7 @@ import {pick_, merge_, swap_} from './composer-helpers'; import {processFileContent} from 'actions/vis-state-actions'; import KeplerGLSchema from 'schemas'; -import {isRGBColor} from 'utils/color-utils'; +import {isRgbColor} from 'utils/color-utils'; // type imports /** @typedef {import('./vis-state-updaters').Field} Field */ @@ -1141,7 +1141,7 @@ export const updateTableColorUpdater = (state, action) => { const {dataId, newColor} = action; const {datasets} = state; - if (isRGBColor(newColor)) { + if (isRgbColor(newColor)) { const existing = datasets[dataId]; existing.updateTableColor(newColor); diff --git a/src/utils/color-utils.d.ts b/src/utils/color-utils.d.ts index bf5411c690..1d13a8a33e 100644 --- a/src/utils/color-utils.d.ts +++ b/src/utils/color-utils.d.ts @@ -5,5 +5,5 @@ export const createLinearGradient: (string: direction, colors: number[]) => stri export const reverseColorRange: (reversed: boolean, colorRange: ColorRange) => object; export const rgbToHex: (colors: [number, number, number]) => string; - export const getColorGroupByName: (ColorRange) => ColorRange; +export function isRgbColor(color: unknown): color is RGBColor; diff --git a/src/utils/color-utils.js b/src/utils/color-utils.js index e6a2518c8e..c15a603fda 100644 --- a/src/utils/color-utils.js +++ b/src/utils/color-utils.js @@ -106,11 +106,11 @@ export function createLinearGradient(direction, colors) { } /** - * Checking if color is RGB - * @param {*} color - * @returns boolean + * Whether color is rgb + * @type {typeof import('./color-utils').isRgbColor} + * @returns */ -export function isRGBColor(color) { +export function isRgbColor(color) { if ( color && Array.isArray(color) && diff --git a/src/utils/export-utils.d.ts b/src/utils/export-utils.d.ts index 5ac704b4b4..fa4255d1d9 100644 --- a/src/utils/export-utils.d.ts +++ b/src/utils/export-utils.d.ts @@ -1,14 +1,16 @@ +import {ExportImage} from 'reducers/ui-state-updaters'; + export const downloadFile: (fileBlob: Blob, fileName: string) => void; export const exportJson: (state: any, options: object) => void; export const exportHtml: (state: any, options: object) => void; export const exportData: (state: any, options: object) => void; export const exportMap: (state: any, options?: object) => void; -export const exportImage: (props: { - mapW: number; - mapH: number; - ratio: string; - resolution: string; -}) => void; +export const exportImage: (uiStateExportImage: ExportImage, fileName?: string) => void; export const convertToPng: (sourceElem: HTMLElement, options: object) => Promise; -export const getScaleFromImageSize: (imageW: number, imageH: number, mapW: number, mapH: number) => number; +export const getScaleFromImageSize: ( + imageW: number, + imageH: number, + mapW: number, + mapH: number +) => number; export const dataURItoBlob: (dataURI: string) => Blob; diff --git a/src/utils/export-utils.js b/src/utils/export-utils.js index d0777fcbdd..010647514f 100644 --- a/src/utils/export-utils.js +++ b/src/utils/export-utils.js @@ -135,8 +135,13 @@ export function downloadFile(fileBlob, fileName) { } } -export function exportImage(state, filename = DEFAULT_IMAGE_NAME) { - const {imageDataUri} = state.uiState.exportImage; +/** + * Whether color is rgb + * @type {typeof import('./export-utils').exportImage} + * @returns + */ +export function exportImage(uiStateExportImage, filename = DEFAULT_IMAGE_NAME) { + const {imageDataUri} = uiStateExportImage; if (imageDataUri) { const file = dataURItoBlob(imageDataUri); downloadFile(file, filename); diff --git a/src/utils/table-utils/kepler-table.js b/src/utils/table-utils/kepler-table.js index beea541906..423ce2bf0a 100644 --- a/src/utils/table-utils/kepler-table.js +++ b/src/utils/table-utils/kepler-table.js @@ -445,7 +445,7 @@ export function sortDatasetByColumn(dataset, column, mode) { return dataset; } - const sortBy = SORT_ORDER[mode] || SORT_ORDER.ASCENDING; + const sortBy = SORT_ORDER[mode || ''] || SORT_ORDER.ASCENDING; if (sortBy === SORT_ORDER.UNSORT) { dataset.sortColumn = {};