Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[Enhancement] Create more factories from SourceDataCatalog, add onClickTitle (#720)
Shan He2fa5e2352b0e
diff --git a/src/components/index.js b/src/components/index.jsindex b45615668..99c3a297a 100644--- a/src/components/index.js+++ b/src/components/index.js@@ -44,7 +44,14 @@ export {default as PanelToggleFactory} from './side-panel/panel-toggle';export {AddDataButtonFactory, default as LayerManagerFactory} from './side-panel/layer-manager';export {default as LayerPanelFactory} from './side-panel/layer-panel/layer-panel';-export {default as SourceDataCatalogFactory} from './side-panel/source-data-catalog';+export {default as LayerConfiguratorFactory} from './side-panel/layer-panel/layer-configurator';++export {default as DatasetSquare} from './common/styled-components';+export {default as SourceDataCatalogFactory} from './side-panel/common/source-data-catalog';+export {default as SourceDataSelectorFactory} from './side-panel/common/source-data-selector';+export {default as DatasetTitleFactory} from './side-panel/common/dataset-title';+export {default as DatasetInfoFactory} from './side-panel/common/dataset-info';+export {default as DatasetTagFactory} from './side-panel/common/dataset-tag';export {default as FilterManagerFactory} from './side-panel/filter-manager';export {default as FilterPanelFactory} from './side-panel/filter-panel/filter-panel';diff --git a/src/components/side-panel/common/dataset-info.js b/src/components/side-panel/common/dataset-info.jsnew file mode 100644index 000000000..8eee16398--- /dev/null+++ b/src/components/side-panel/common/dataset-info.js@@ -0,0 +1,41 @@+// Copyright (c) 2019 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.++import React from 'react';+import styled from 'styled-components';+import {format} from 'd3-format';++const numFormat = format(',');++const StyledDataRowCount = styled.div`+ font-size: 11px;+ color: ${props => props.theme.subtextColor};+ padding-left: 19px;+`;++export default function DatasetInfoFactory() {+ const DatasetInfo = ({dataset}) => (+ <StyledDataRowCount className="source-data-rows">+ {`${numFormat(dataset.allData.length)} rows`}+ </StyledDataRowCount>+ );++ return DatasetInfo;+}diff --git a/src/components/side-panel/common/dataset-tag.js b/src/components/side-panel/common/dataset-tag.jsnew file mode 100644index 000000000..90aefdf2a--- /dev/null+++ b/src/components/side-panel/common/dataset-tag.js@@ -0,0 +1,53 @@+// Copyright (c) 2019 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.++import React from 'react';+import styled from 'styled-components';+import {DatasetSquare} from 'components/common/styled-components';++const DatasetTagWrapper = styled.div`+ display: flex;+ color: ${props => props.theme.textColor};+ font-size: 11px;+ letter-spacing: 0.2px;+ overflow: auto;++ .dataset-color {+ flex-shrink: 0;+ margin-top: 5px;+ }++ .dataset-name {+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+ }+`;++export default function DatasetTagFactory() {+ const DatasetTag = ({onClick, dataset}) => (+ <DatasetTagWrapper className="source-data-tag" onClick={onClick}>+ <DatasetSquare className="dataset-color" color={dataset.color} />+ <div className="dataset-name">{dataset.label}</div>+ </DatasetTagWrapper>+ );++ return DatasetTag;+}diff --git a/src/components/side-panel/common/dataset-title.js b/src/components/side-panel/common/dataset-title.jsnew file mode 100644index 000000000..8dbb63057--- /dev/null+++ b/src/components/side-panel/common/dataset-title.js@@ -0,0 +1,153 @@+// Copyright (c) 2019 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.++import React, {PureComponent} from 'react';+import styled from 'styled-components';++import {Tooltip, CenterFlexbox} from 'components/common/styled-components';+import {Table, Trash, ArrowRight} from 'components/common/icons';+import DatasetTagFactory from 'components/side-panel/common/dataset-tag';++function nop() {}++const StyledDatasetTitle = styled.div`+ color: ${props => props.theme.textColor};+ display: flex;+ align-items: flex-start;++ .source-data-arrow {+ height: 16px;+ }+ :hover {+ cursor: ${props => (props.clickable ? 'pointer' : 'auto')};++ .dataset-name {+ color: ${props =>+ props.clickable ? props.theme.textColorHl : props.theme.textColor};+ }++ .dataset-action {+ color: ${props => props.theme.textColorHl};+ opacity: 1;+ }++ .dataset-action:hover {+ color: white;+ }+ }+`;++const DataTagAction = styled.div`+ margin-left: 12px;+ height: 16px;+ opacity: 0;+`;++const ShowDataTable = ({id, showDatasetTable = nop}) => (+ <DataTagAction+ className="dataset-action show-data-table"+ data-tip+ data-for={`data-table-${id}`}+ >+ <Table+ height="16px"+ onClick={e => {+ e.stopPropagation();+ showDatasetTable(id);+ }}+ />+ <Tooltip id={`data-table-${id}`} effect="solid">+ <span>Show data table</span>+ </Tooltip>+ </DataTagAction>+);++const RemoveDataset = ({datasetKey, removeDataset = nop}) => (+ <DataTagAction+ className="dataset-action remove-dataset"+ data-tip+ data-for={`delete-${datasetKey}`}+ >+ <Trash+ height="16px"+ onClick={e => {+ e.stopPropagation();+ removeDataset(datasetKey);+ }}+ />+ <Tooltip id={`delete-${datasetKey}`} effect="solid" type="error">+ <span>Remove dataset</span>+ </Tooltip>+ </DataTagAction>+);++DatasetTitleFactory.deps = [DatasetTagFactory];++export default function DatasetTitleFactory(DatasetTag) {+ class DatasetTitle extends PureComponent {++ _onClickTitle = (e) => {+ e.stopPropagation();+ if (typeof this.props.onTitleClick === 'function') {+ this.props.onTitleClick();+ } else if (typeof this.props.showDatasetTable === 'function') {+ this.props.showDatasetTable(this.props.dataset.id);+ }+ };++ render() {+ const {+ showDatasetTable,+ showDeleteDataset,+ onTitleClick,+ removeDataset,+ dataset+ } = this.props;++ return (+ <StyledDatasetTitle+ className="source-data-title"+ clickable={Boolean(showDatasetTable || onTitleClick)}+ >+ <DatasetTag dataset={dataset} onClick={this._onClickTitle} />+ {showDatasetTable ? (+ <CenterFlexbox className="source-data-arrow">+ <ArrowRight height="12px" />+ </CenterFlexbox>+ ) : null}+ {showDatasetTable ? (+ <ShowDataTable+ id={dataset.id}+ showDatasetTable={showDatasetTable}+ />+ ) : null}+ {showDeleteDataset ? (+ <RemoveDataset+ datasetKey={dataset.id}+ removeDataset={removeDataset}+ />+ ) : null}+ </StyledDatasetTitle>+ );+ }+ }++ return DatasetTitle;+}diff --git a/src/components/side-panel/common/source-data-catalog.js b/src/components/side-panel/common/source-data-catalog.jsnew file mode 100644index 000000000..ade0b5aa8--- /dev/null+++ b/src/components/side-panel/common/source-data-catalog.js@@ -0,0 +1,61 @@+// Copyright (c) 2019 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.++import React from 'react';+import styled from 'styled-components';++import {SidePanelSection} from 'components/common/styled-components';+import DatasetTitleFactory from 'components/side-panel/common/dataset-title';+import DatasetInfoFactory from 'components/side-panel/common/dataset-info';++const SourceDataCatalogWrapper = styled.div`+ transition: ${props => props.theme.transition};+`;++SourceDataCatalogFactory.deps = [DatasetTitleFactory, DatasetInfoFactory];++function SourceDataCatalogFactory(DatasetTitle, DatasetInfo) {+ const SourceDataCatalog = ({+ datasets,+ showDatasetTable,+ removeDataset,+ onTitleClick,+ showDeleteDataset = false+ }) => (+ <SourceDataCatalogWrapper className="source-data-catalog">+ {Object.values(datasets).map((dataset, index) => (+ <SidePanelSection key={dataset.id}>+ <DatasetTitle+ showDatasetTable={showDatasetTable}+ showDeleteDataset={showDeleteDataset}+ removeDataset={removeDataset}+ dataset={dataset}+ onTitleClick={onTitleClick}+ />+ {showDatasetTable ? <DatasetInfo dataset={dataset} /> : null}+ </SidePanelSection>+ ))}+ </SourceDataCatalogWrapper>+ );++ return SourceDataCatalog;+}++export default SourceDataCatalogFactory;diff --git a/src/components/side-panel/common/source-data-selector.js b/src/components/side-panel/common/source-data-selector.jsnew file mode 100644index 000000000..3333c44bd--- /dev/null+++ b/src/components/side-panel/common/source-data-selector.js@@ -0,0 +1,87 @@+// Copyright (c) 2019 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.++import React, {Component} from 'react';+import {createSelector} from 'reselect';++import {+ PanelLabel,+ SidePanelSection+} from 'components/common/styled-components';+import ItemSelector from 'components/common/item-selector/item-selector';+import DatasetTagFactory from 'components/side-panel/common/dataset-tag';++const defaultPlaceHolder = 'Select A Data Source';++SourceDataSelectorFactory.deps = [DatasetTagFactory];++export default function SourceDataSelectorFactory(DatasetTag) {+ const DatasetItem = ({value}) => <DatasetTag dataset={value} />;++ class SourceDataSelector extends Component {+ /* selectors */+ /* eslint-disable no-invalid-this */+ datasetsSelector = props => props.datasets;+ dsOptionsSelector = createSelector(+ this.datasetsSelector,+ datasets =>+ Object.values(datasets).map(ds => ({+ label: ds.label,+ value: ds.id,+ color: ds.color+ }))+ );++ render() {+ const {+ dataId,+ disabled,+ onSelect,+ defaultValue,+ inputTheme+ } = this.props;+ const dsOptions = this.dsOptionsSelector(this.props);++ return (+ <SidePanelSection className="data-source-selector">+ <PanelLabel>Data Source</PanelLabel>+ <ItemSelector+ inputTheme={inputTheme}+ selectedItems={dataId ? this.props.datasets[dataId] : null}+ options={dsOptions}+ getOptionValue={'value'}+ filterOption={'label'}+ multiSelect={false}+ onChange={onSelect}+ placeholder={defaultValue}+ disabled={disabled}+ displayOption={'label'}+ DropDownLineItemRenderComponent={DatasetItem}+ />+ </SidePanelSection>+ );+ }+ }++ SourceDataSelector.defaultProps = {+ defaultValue: defaultPlaceHolder+ }+ return SourceDataSelector;+}diff --git a/src/components/side-panel/filter-manager.js b/src/components/side-panel/filter-manager.jsindex d4a5b08ae..9ebb80d4b 100644--- a/src/components/side-panel/filter-manager.js+++ b/src/components/side-panel/filter-manager.js@@ -27,7 +27,7 @@ import {Button} from 'components/common/styled-components';import {Add} from 'components/common/icons';-import SourceDataCatalogFactory from './source-data-catalog';+import SourceDataCatalogFactory from './common/source-data-catalog';import FilterPanelFactory from './filter-panel/filter-panel';FilterManagerFactory.deps = [diff --git a/src/components/side-panel/filter-panel/filter-panel.js b/src/components/side-panel/filter-panel/filter-panel.jsindex 5f3c8226e..52e6a551a 100644--- a/src/components/side-panel/filter-panel/filter-panel.js+++ b/src/components/side-panel/filter-panel/filter-panel.js@@ -25,7 +25,7 @@ import styled from 'styled-components';import PanelHeaderAction from 'components/side-panel/panel-header-action';import FieldSelector from 'components/common/field-selector';import {Trash, Clock} from 'components/common/icons';-import SourceDataSelector from 'components/side-panel/source-data-selector';+import SourceDataSelectorFactory from 'components/side-panel/common/source-data-selector';import {StyledPanelHeader} from 'components/common/styled-components';import * as Filters from 'components/filters';@@ -51,7 +51,9 @@ const StyledFilterContent = styled.div`padding: 12px;`;-function FilterPanelFactory() {+FilterPanelFactory.deps = [SourceDataSelectorFactory];++function FilterPanelFactory(SourceDataSelector) {return class FilterPanel extends Component {static propTypes = {idx: PropTypes.number,diff --git a/src/components/side-panel/interaction-panel/tooltip-config.js b/src/components/side-panel/interaction-panel/tooltip-config.jsindex 84bb7e469..fe09f4666 100644--- a/src/components/side-panel/interaction-panel/tooltip-config.js+++ b/src/components/side-panel/interaction-panel/tooltip-config.js@@ -19,12 +19,13 @@// THE SOFTWARE.import React from 'react';-import {DatasetTag} from '../source-data-catalog';-import {SidePanelSection} from 'components/common/styled-components';import FieldSelector from 'components/common/field-selector';+import DatasetTagFactory from 'components/side-panel/common/dataset-tag';++TooltipConfigFactory.deps = [DatasetTagFactory];-function TooltipConfigFactory() {+function TooltipConfigFactory(DatasetTag) {const TooltipConfig = ({config, datasets, onChange}) => (<div>{Object.keys(config.fieldsToShow).map(dataId => (diff --git a/src/components/side-panel/layer-manager.js b/src/components/side-panel/layer-manager.jsindex 68d418a73..db1147958 100644--- a/src/components/side-panel/layer-manager.js+++ b/src/components/side-panel/layer-manager.js@@ -26,7 +26,7 @@ import {createSelector} from 'reselect';import arrayMove from 'array-move';import LayerPanelFactory from './layer-panel/layer-panel';-import SourceDataCatalogFactory from './source-data-catalog';+import SourceDataCatalogFactory from './common/source-data-catalog';import {Add} from 'components/common/icons';import ItemSelector from 'components/common/item-selector/item-selector';import {diff --git a/src/components/side-panel/layer-panel/layer-configurator.js b/src/components/side-panel/layer-panel/layer-configurator.jsindex bc9a25ea6..59e0e906b 100644--- a/src/components/side-panel/layer-panel/layer-configurator.js+++ b/src/components/side-panel/layer-panel/layer-configurator.js@@ -36,7 +36,7 @@ import LayerColumnConfig from './layer-column-config';import LayerTypeSelector from './layer-type-selector';import DimensionScaleSelector from './dimension-scale-selector';import ColorSelector from './color-selector';-import SourceDataSelector from 'components/side-panel/source-data-selector';+import SourceDataSelectorFactory from 'components/side-panel/common/source-data-selector';import VisConfigSwitch from './vis-config-switch';import VisConfigSlider from './vis-config-slider';import LayerConfigGroup, {@@ -66,504 +66,361 @@ const StyledLayerVisualConfigurator = styled.div.attrs({margin-top: 12px;`;-export default class LayerConfigurator extends Component {- static propTypes = {- layer: PropTypes.object.isRequired,- datasets: PropTypes.object.isRequired,- layerTypeOptions: PropTypes.arrayOf(PropTypes.any).isRequired,- openModal: PropTypes.func.isRequired,- updateLayerConfig: PropTypes.func.isRequired,- updateLayerType: PropTypes.func.isRequired,- updateLayerVisConfig: PropTypes.func.isRequired,- updateLayerVisualChannelConfig: PropTypes.func.isRequired- };-- _renderPointLayerConfig(props) {- return this._renderScatterplotLayerConfig(props);- }+LayerConfiguratorFactory.deps = [SourceDataSelectorFactory];+export default function LayerConfiguratorFactory(SourceDataSelector) {+ class LayerConfigurator extends Component {+ static propTypes = {+ layer: PropTypes.object.isRequired,+ datasets: PropTypes.object.isRequired,+ layerTypeOptions: PropTypes.arrayOf(PropTypes.any).isRequired,+ openModal: PropTypes.func.isRequired,+ updateLayerConfig: PropTypes.func.isRequired,+ updateLayerType: PropTypes.func.isRequired,+ updateLayerVisConfig: PropTypes.func.isRequired,+ updateLayerVisualChannelConfig: PropTypes.func.isRequired+ };- _renderIconLayerConfig(props) {- return this._renderScatterplotLayerConfig(props);- }+ _renderPointLayerConfig(props) {+ return this._renderScatterplotLayerConfig(props);+ }- _renderScatterplotLayerConfig({- layer,- visConfiguratorProps,- layerChannelConfigProps,- layerConfiguratorProps- }) {- return (- <StyledLayerVisualConfigurator>- {/* Fill Color */}- <LayerConfigGroup- {...layer.visConfigSettings.filled}- {...visConfiguratorProps}- collapsible- >- {layer.config.colorField ? (- <ColorRangeConfig {...visConfiguratorProps} />- ) : (- <LayerColorSelector {...layerConfiguratorProps} />- )}- <ConfigGroupCollapsibleContent>- <ChannelByValueSelector- channel={layer.visualChannels.color}- {...layerChannelConfigProps}- />- <VisConfigSlider- {...LAYER_VIS_CONFIGS.opacity}- {...visConfiguratorProps}- />- </ConfigGroupCollapsibleContent>- </LayerConfigGroup>+ _renderIconLayerConfig(props) {+ return this._renderScatterplotLayerConfig(props);+ }- {/* outline color */}- {layer.type === LAYER_TYPES.point ? (+ _renderScatterplotLayerConfig({+ layer,+ visConfiguratorProps,+ layerChannelConfigProps,+ layerConfiguratorProps+ }) {+ return (+ <StyledLayerVisualConfigurator>+ {/* Fill Color */}<LayerConfigGroup- {...layer.visConfigSettings.outline}+ {...layer.visConfigSettings.filled}{...visConfiguratorProps}collapsible>- {layer.config.strokeColorField ? (- <ColorRangeConfig- {...visConfiguratorProps}- property="strokeColorRange"- />+ {layer.config.colorField ? (+ <ColorRangeConfig {...visConfiguratorProps} />) : (- <LayerColorSelector- {...visConfiguratorProps}- selectedColor={layer.config.visConfig.strokeColor}- property="strokeColor"- />+ <LayerColorSelector {...layerConfiguratorProps} />)}<ConfigGroupCollapsibleContent><ChannelByValueSelector- channel={layer.visualChannels.strokeColor}+ channel={layer.visualChannels.color}{...layerChannelConfigProps}/><VisConfigSlider- {...layer.visConfigSettings.thickness}+ {...LAYER_VIS_CONFIGS.opacity}{...visConfiguratorProps}- label={false}- disabled={!layer.config.visConfig.outline}/></ConfigGroupCollapsibleContent></LayerConfigGroup>- ) : null}- {/* Radius */}- <LayerConfigGroup label={'radius'} collapsible>- {!layer.config.sizeField ? (- <VisConfigSlider- {...LAYER_VIS_CONFIGS.radius}+ {/* outline color */}+ {layer.type === LAYER_TYPES.point ? (+ <LayerConfigGroup+ {...layer.visConfigSettings.outline}{...visConfiguratorProps}- label={false}- disabled={Boolean(layer.config.sizeField)}- />- ) : (- <VisConfigSlider- {...LAYER_VIS_CONFIGS.radiusRange}- {...visConfiguratorProps}- label={false}- disabled={- !layer.config.sizeField || layer.config.visConfig.fixedRadius- }- />- )}- <ConfigGroupCollapsibleContent>- <ChannelByValueSelector- channel={layer.visualChannels.size}- {...layerChannelConfigProps}- />- {layer.config.sizeField ? (- <VisConfigSwitch- {...LAYER_VIS_CONFIGS.fixedRadius}+ collapsible+ >+ {layer.config.strokeColorField ? (+ <ColorRangeConfig+ {...visConfiguratorProps}+ property="strokeColorRange"+ />+ ) : (+ <LayerColorSelector+ {...visConfiguratorProps}+ selectedColor={layer.config.visConfig.strokeColor}+ property="strokeColor"+ />+ )}+ <ConfigGroupCollapsibleContent>+ <ChannelByValueSelector+ channel={layer.visualChannels.strokeColor}+ {...layerChannelConfigProps}+ />+ <VisConfigSlider+ {...layer.visConfigSettings.thickness}+ {...visConfiguratorProps}+ label={false}+ disabled={!layer.config.visConfig.outline}+ />+ </ConfigGroupCollapsibleContent>+ </LayerConfigGroup>+ ) : null}++ {/* Radius */}+ <LayerConfigGroup label={'radius'} collapsible>+ {!layer.config.sizeField ? (+ <VisConfigSlider+ {...LAYER_VIS_CONFIGS.radius}{...visConfiguratorProps}+ label={false}+ disabled={Boolean(layer.config.sizeField)}/>- ) : null}- </ConfigGroupCollapsibleContent>- </LayerConfigGroup>-- {/* text label */}- <TextLabelPanel- fields={visConfiguratorProps.fields}- updateLayerTextLabel={this.props.updateLayerTextLabel}- textLabel={layer.config.textLabel}- />- </StyledLayerVisualConfigurator>- );- }-- _renderClusterLayerConfig({- layer,- visConfiguratorProps,- layerConfiguratorProps,- layerChannelConfigProps- }) {- return (- <StyledLayerVisualConfigurator>- {/* Color */}- <LayerConfigGroup label={'color'} collapsible>- <ColorRangeConfig {...visConfiguratorProps} />- <ConfigGroupCollapsibleContent>- <AggrScaleSelector- {...layerConfiguratorProps}- channel={layer.visualChannels.color}- />- <ChannelByValueSelector- channel={layer.visualChannels.color}- {...layerChannelConfigProps}- />- {layer.visConfigSettings.colorAggregation.condition(- layer.config- ) ? (- <AggregationTypeSelector- {...layer.visConfigSettings.colorAggregation}+ ) : (+ <VisConfigSlider+ {...LAYER_VIS_CONFIGS.radiusRange}+ {...visConfiguratorProps}+ label={false}+ disabled={+ !layer.config.sizeField || layer.config.visConfig.fixedRadius+ }+ />+ )}+ <ConfigGroupCollapsibleContent>+ <ChannelByValueSelector+ channel={layer.visualChannels.size}{...layerChannelConfigProps}- channel={layer.visualChannels.color}/>- ) : null}- <VisConfigSlider- {...layer.visConfigSettings.opacity}- {...visConfiguratorProps}- />- </ConfigGroupCollapsibleContent>- </LayerConfigGroup>-- {/* Cluster Radius */}- <LayerConfigGroup label={'radius'} collapsible>- <VisConfigSlider- {...layer.visConfigSettings.clusterRadius}- {...visConfiguratorProps}- />- <ConfigGroupCollapsibleContent>- <VisConfigSlider- {...layer.visConfigSettings.radiusRange}- {...visConfiguratorProps}- />- </ConfigGroupCollapsibleContent>- </LayerConfigGroup>- </StyledLayerVisualConfigurator>- );- }+ {layer.config.sizeField ? (+ <VisConfigSwitch+ {...LAYER_VIS_CONFIGS.fixedRadius}+ {...visConfiguratorProps}+ />+ ) : null}+ </ConfigGroupCollapsibleContent>+ </LayerConfigGroup>- _renderHeatmapLayerConfig({- layer,- visConfiguratorProps,- layerConfiguratorProps,- layerChannelConfigProps- }) {- return (- <StyledLayerVisualConfigurator>- {/* Color */}- <LayerConfigGroup label={'color'} collapsible>- <ColorRangeConfig {...visConfiguratorProps} />- <ConfigGroupCollapsibleContent>- <VisConfigSlider- {...layer.visConfigSettings.opacity}- {...visConfiguratorProps}- />- </ConfigGroupCollapsibleContent>- </LayerConfigGroup>- {/* Radius */}- <LayerConfigGroup label={'radius'}>- <VisConfigSlider- {...layer.visConfigSettings.radius}- {...visConfiguratorProps}- label={false}+ {/* text label */}+ <TextLabelPanel+ fields={visConfiguratorProps.fields}+ updateLayerTextLabel={this.props.updateLayerTextLabel}+ textLabel={layer.config.textLabel}/>- </LayerConfigGroup>- {/* Weight */}- <LayerConfigGroup label={'weight'}>- <ChannelByValueSelector- channel={layer.visualChannels.weight}- {...layerChannelConfigProps}- />- </LayerConfigGroup>- </StyledLayerVisualConfigurator>- );- }-- _renderGridLayerConfig(props) {- return this._renderAggregationLayerConfig(props);- }+ </StyledLayerVisualConfigurator>+ );+ }- _renderHexagonLayerConfig(props) {- return this._renderAggregationLayerConfig(props);- }-- _renderAggregationLayerConfig({- layer,- visConfiguratorProps,- layerConfiguratorProps,- layerChannelConfigProps- }) {- const {config} = layer;- const {- visConfig: {enable3d}- } = config;- const elevationByDescription =- 'When off, height is based on count of points';- const colorByDescription = 'When off, color is based on count of points';-- return (- <StyledLayerVisualConfigurator>- {/* Color */}- <LayerConfigGroup label={'color'} collapsible>- <ColorRangeConfig {...visConfiguratorProps} />- <ConfigGroupCollapsibleContent>- <AggrScaleSelector- {...layerConfiguratorProps}- channel={layer.visualChannels.color}- />- <ChannelByValueSelector- channel={layer.visualChannels.color}- {...layerChannelConfigProps}- />- {layer.visConfigSettings.colorAggregation.condition(- layer.config- ) ? (- <AggregationTypeSelector- {...layer.visConfigSettings.colorAggregation}- {...layerChannelConfigProps}- descreiption={colorByDescription}+ _renderClusterLayerConfig({+ layer,+ visConfiguratorProps,+ layerConfiguratorProps,+ layerChannelConfigProps+ }) {+ return (+ <StyledLayerVisualConfigurator>+ {/* Color */}+ <LayerConfigGroup label={'color'} collapsible>+ <ColorRangeConfig {...visConfiguratorProps} />+ <ConfigGroupCollapsibleContent>+ <AggrScaleSelector+ {...layerConfiguratorProps}channel={layer.visualChannels.color}/>- ) : null}- {layer.visConfigSettings.percentile &&- layer.visConfigSettings.percentile.condition(layer.config) ? (+ <ChannelByValueSelector+ channel={layer.visualChannels.color}+ {...layerChannelConfigProps}+ />+ {layer.visConfigSettings.colorAggregation.condition(+ layer.config+ ) ? (+ <AggregationTypeSelector+ {...layer.visConfigSettings.colorAggregation}+ {...layerChannelConfigProps}+ channel={layer.visualChannels.color}+ />+ ) : null}<VisConfigSlider- {...layer.visConfigSettings.percentile}+ {...layer.visConfigSettings.opacity}{...visConfiguratorProps}/>- ) : null}- <VisConfigSlider- {...layer.visConfigSettings.opacity}- {...visConfiguratorProps}- />- </ConfigGroupCollapsibleContent>- </LayerConfigGroup>+ </ConfigGroupCollapsibleContent>+ </LayerConfigGroup>- {/* Cell size */}- <LayerConfigGroup label={'radius'} collapsible>- <VisConfigSlider- {...layer.visConfigSettings.worldUnitSize}- {...visConfiguratorProps}- />- <ConfigGroupCollapsibleContent>+ {/* Cluster Radius */}+ <LayerConfigGroup label={'radius'} collapsible><VisConfigSlider- {...layer.visConfigSettings.coverage}+ {...layer.visConfigSettings.clusterRadius}{...visConfiguratorProps}/>- </ConfigGroupCollapsibleContent>- </LayerConfigGroup>+ <ConfigGroupCollapsibleContent>+ <VisConfigSlider+ {...layer.visConfigSettings.radiusRange}+ {...visConfiguratorProps}+ />+ </ConfigGroupCollapsibleContent>+ </LayerConfigGroup>+ </StyledLayerVisualConfigurator>+ );+ }- {/* Elevation */}- {layer.visConfigSettings.enable3d ? (- <LayerConfigGroup- {...layer.visConfigSettings.enable3d}- {...visConfiguratorProps}- collapsible- >+ _renderHeatmapLayerConfig({+ layer,+ visConfiguratorProps,+ layerConfiguratorProps,+ layerChannelConfigProps+ }) {+ return (+ <StyledLayerVisualConfigurator>+ {/* Color */}+ <LayerConfigGroup label={'color'} collapsible>+ <ColorRangeConfig {...visConfiguratorProps} />+ <ConfigGroupCollapsibleContent>+ <VisConfigSlider+ {...layer.visConfigSettings.opacity}+ {...visConfiguratorProps}+ />+ </ConfigGroupCollapsibleContent>+ </LayerConfigGroup>+ {/* Radius */}+ <LayerConfigGroup label={'radius'}><VisConfigSlider- {...layer.visConfigSettings.elevationScale}+ {...layer.visConfigSettings.radius}{...visConfiguratorProps}+ label={false}/>+ </LayerConfigGroup>+ {/* Weight */}+ <LayerConfigGroup label={'weight'}>+ <ChannelByValueSelector+ channel={layer.visualChannels.weight}+ {...layerChannelConfigProps}+ />+ </LayerConfigGroup>+ </StyledLayerVisualConfigurator>+ );+ }++ _renderGridLayerConfig(props) {+ return this._renderAggregationLayerConfig(props);+ }++ _renderHexagonLayerConfig(props) {+ return this._renderAggregationLayerConfig(props);+ }++ _renderAggregationLayerConfig({+ layer,+ visConfiguratorProps,+ layerConfiguratorProps,+ layerChannelConfigProps+ }) {+ const {config} = layer;+ const {+ visConfig: {enable3d}+ } = config;+ const elevationByDescription =+ 'When off, height is based on count of points';+ const colorByDescription = 'When off, color is based on count of points';++ return (+ <StyledLayerVisualConfigurator>+ {/* Color */}+ <LayerConfigGroup label={'color'} collapsible>+ <ColorRangeConfig {...visConfiguratorProps} /><ConfigGroupCollapsibleContent><AggrScaleSelector{...layerConfiguratorProps}- channel={layer.visualChannels.size}- />- <VisConfigSlider- {...layer.visConfigSettings.sizeRange}- {...visConfiguratorProps}+ channel={layer.visualChannels.color}/><ChannelByValueSelector+ channel={layer.visualChannels.color}{...layerChannelConfigProps}- channel={layer.visualChannels.size}- description={elevationByDescription}- disabled={!enable3d}/>- {layer.visConfigSettings.sizeAggregation.condition(+ {layer.visConfigSettings.colorAggregation.condition(layer.config) ? (<AggregationTypeSelector- {...layer.visConfigSettings.sizeAggregation}+ {...layer.visConfigSettings.colorAggregation}{...layerChannelConfigProps}- channel={layer.visualChannels.size}+ descreiption={colorByDescription}+ channel={layer.visualChannels.color}/>) : null}- {layer.visConfigSettings.elevationPercentile.condition(- layer.config- ) ? (+ {layer.visConfigSettings.percentile &&+ layer.visConfigSettings.percentile.condition(layer.config) ? (<VisConfigSlider- {...layer.visConfigSettings.elevationPercentile}+ {...layer.visConfigSettings.percentile}{...visConfiguratorProps}/>) : null}+ <VisConfigSlider+ {...layer.visConfigSettings.opacity}+ {...visConfiguratorProps}+ /></ConfigGroupCollapsibleContent></LayerConfigGroup>- ) : null}- </StyledLayerVisualConfigurator>- );- }-- // TODO: Shan move these into layer class- _renderHexagonIdLayerConfig({- layer,- visConfiguratorProps,- layerConfiguratorProps,- layerChannelConfigProps- }) {- return (- <StyledLayerVisualConfigurator>- {/* Color */}- <LayerConfigGroup label={'color'} collapsible>- {layer.config.colorField ? (- <ColorRangeConfig {...visConfiguratorProps} />- ) : (- <LayerColorSelector {...layerConfiguratorProps} />- )}- <ConfigGroupCollapsibleContent>- <ChannelByValueSelector- channel={layer.visualChannels.color}- {...layerChannelConfigProps}- />- <VisConfigSlider- {...LAYER_VIS_CONFIGS.opacity}- {...visConfiguratorProps}- />- </ConfigGroupCollapsibleContent>- </LayerConfigGroup>- {/* Coverage */}- <LayerConfigGroup label={'coverage'} collapsible>- {!layer.config.coverageField ? (- <VisConfigSlider- {...layer.visConfigSettings.coverage}- {...visConfiguratorProps}- label={false}- />- ) : (- <VisConfigSlider- {...layer.visConfigSettings.coverageRange}- {...visConfiguratorProps}- label={false}- />- )}- <ConfigGroupCollapsibleContent>- <ChannelByValueSelector- channel={layer.visualChannels.coverage}- {...layerChannelConfigProps}- />- </ConfigGroupCollapsibleContent>- </LayerConfigGroup>-- {/* height */}- <LayerConfigGroup- {...LAYER_VIS_CONFIGS.enable3d}- {...visConfiguratorProps}- collapsible- >- <VisConfigSlider- {...LAYER_VIS_CONFIGS.elevationRange}- {...visConfiguratorProps}- label={false}- />- <ConfigGroupCollapsibleContent>- <ChannelByValueSelector- channel={layer.visualChannels.size}- {...layerChannelConfigProps}- />- </ConfigGroupCollapsibleContent>- </LayerConfigGroup>- </StyledLayerVisualConfigurator>- );- }-- _renderArcLayerConfig(args) {- return this._renderLineLayerConfig(args);- }-- _renderLineLayerConfig({- layer,- visConfiguratorProps,- layerConfiguratorProps,- layerChannelConfigProps- }) {- return (- <StyledLayerVisualConfigurator>- {/* Color */}- <LayerConfigGroup label={'color'} collapsible>- {layer.config.colorField ? (- <ColorRangeConfig {...visConfiguratorProps} />- ) : (- <ArcLayerColorSelector- layer={layer}- onChangeConfig={layerConfiguratorProps.onChange}- onChangeVisConfig={visConfiguratorProps.onChange}- />- )}- <ConfigGroupCollapsibleContent>- <ChannelByValueSelector- channel={layer.visualChannels.color}- {...layerChannelConfigProps}- />+ {/* Cell size */}+ <LayerConfigGroup label={'radius'} collapsible><VisConfigSlider- {...LAYER_VIS_CONFIGS.opacity}+ {...layer.visConfigSettings.worldUnitSize}{...visConfiguratorProps}/>- </ConfigGroupCollapsibleContent>- </LayerConfigGroup>+ <ConfigGroupCollapsibleContent>+ <VisConfigSlider+ {...layer.visConfigSettings.coverage}+ {...visConfiguratorProps}+ />+ </ConfigGroupCollapsibleContent>+ </LayerConfigGroup>- {/* thickness */}- <LayerConfigGroup label={'stroke'} collapsible>- {layer.config.sizeField ? (- <VisConfigSlider- {...LAYER_VIS_CONFIGS.strokeWidthRange}- {...visConfiguratorProps}- disabled={!layer.config.sizeField}- label={false}- />- ) : (- <VisConfigSlider- {...LAYER_VIS_CONFIGS.thickness}+ {/* Elevation */}+ {layer.visConfigSettings.enable3d ? (+ <LayerConfigGroup+ {...layer.visConfigSettings.enable3d}{...visConfiguratorProps}- label={false}- />- )}- <ConfigGroupCollapsibleContent>- <ChannelByValueSelector- channel={layer.visualChannels.size}- {...layerChannelConfigProps}- />- </ConfigGroupCollapsibleContent>- </LayerConfigGroup>- </StyledLayerVisualConfigurator>- );- }-- _renderGeojsonLayerConfig({- layer,- visConfiguratorProps,- layerConfiguratorProps,- layerChannelConfigProps- }) {- const {- meta: {featureTypes = {}},- config: {visConfig}- } = layer;-- return (- <StyledLayerVisualConfigurator>- {/* Fill Color */}- {featureTypes.polygon || featureTypes.point ? (- <LayerConfigGroup- {...layer.visConfigSettings.filled}- {...visConfiguratorProps}- label="Fill Color"- collapsible- >+ collapsible+ >+ <VisConfigSlider+ {...layer.visConfigSettings.elevationScale}+ {...visConfiguratorProps}+ />+ <ConfigGroupCollapsibleContent>+ <AggrScaleSelector+ {...layerConfiguratorProps}+ channel={layer.visualChannels.size}+ />+ <VisConfigSlider+ {...layer.visConfigSettings.sizeRange}+ {...visConfiguratorProps}+ />+ <ChannelByValueSelector+ {...layerChannelConfigProps}+ channel={layer.visualChannels.size}+ description={elevationByDescription}+ disabled={!enable3d}+ />+ {layer.visConfigSettings.sizeAggregation.condition(+ layer.config+ ) ? (+ <AggregationTypeSelector+ {...layer.visConfigSettings.sizeAggregation}+ {...layerChannelConfigProps}+ channel={layer.visualChannels.size}+ />+ ) : null}+ {layer.visConfigSettings.elevationPercentile.condition(+ layer.config+ ) ? (+ <VisConfigSlider+ {...layer.visConfigSettings.elevationPercentile}+ {...visConfiguratorProps}+ />+ ) : null}+ </ConfigGroupCollapsibleContent>+ </LayerConfigGroup>+ ) : null}+ </StyledLayerVisualConfigurator>+ );+ }++ // TODO: Shan move these into layer class+ _renderHexagonIdLayerConfig({+ layer,+ visConfiguratorProps,+ layerConfiguratorProps,+ layerChannelConfigProps+ }) {+ return (+ <StyledLayerVisualConfigurator>+ {/* Color */}+ <LayerConfigGroup label={'color'} collapsible>{layer.config.colorField ? (<ColorRangeConfig {...visConfiguratorProps} />) : (@@ -580,254 +437,401 @@ export default class LayerConfigurator extends Component {/></ConfigGroupCollapsibleContent></LayerConfigGroup>- ) : null}-- {/* stroke color */}- <LayerConfigGroup- {...layer.visConfigSettings.stroked}- {...visConfiguratorProps}- label="Stroke Color"- collapsible- >- {layer.config.strokeColorField ? (- <ColorRangeConfig- {...visConfiguratorProps}- property="strokeColorRange"- />- ) : (- <LayerColorSelector- {...visConfiguratorProps}- selectedColor={layer.config.visConfig.strokeColor}- property="strokeColor"- />- )}- <ConfigGroupCollapsibleContent>- <ChannelByValueSelector- channel={layer.visualChannels.strokeColor}- {...layerChannelConfigProps}- />- </ConfigGroupCollapsibleContent>- </LayerConfigGroup>-- {/* Stroke Width */}- <LayerConfigGroup- {...visConfiguratorProps}- {...(featureTypes.polygon ? LAYER_VIS_CONFIGS.stroked : {})}- label="Stroke Width"- collapsible- >- {layer.config.sizeField ? (- <VisConfigSlider- {...LAYER_VIS_CONFIGS.strokeWidthRange}- {...visConfiguratorProps}- label={false}- />- ) : (- <VisConfigSlider- {...LAYER_VIS_CONFIGS.thickness}- {...visConfiguratorProps}- label={false}- />- )}- <ConfigGroupCollapsibleContent>- <ChannelByValueSelector- channel={layer.visualChannels.size}- {...layerChannelConfigProps}- />- </ConfigGroupCollapsibleContent>- </LayerConfigGroup>- {/* Elevation */}- {featureTypes.polygon && visConfig.filled ? (+ {/* Coverage */}+ <LayerConfigGroup label={'coverage'} collapsible>+ {!layer.config.coverageField ? (+ <VisConfigSlider+ {...layer.visConfigSettings.coverage}+ {...visConfiguratorProps}+ label={false}+ />+ ) : (+ <VisConfigSlider+ {...layer.visConfigSettings.coverageRange}+ {...visConfiguratorProps}+ label={false}+ />+ )}+ <ConfigGroupCollapsibleContent>+ <ChannelByValueSelector+ channel={layer.visualChannels.coverage}+ {...layerChannelConfigProps}+ />+ </ConfigGroupCollapsibleContent>+ </LayerConfigGroup>++ {/* height */}<LayerConfigGroup- {...visConfiguratorProps}{...LAYER_VIS_CONFIGS.enable3d}+ {...visConfiguratorProps}collapsible><VisConfigSlider- {...LAYER_VIS_CONFIGS.elevationScale}+ {...LAYER_VIS_CONFIGS.elevationRange}{...visConfiguratorProps}label={false}/><ConfigGroupCollapsibleContent><ChannelByValueSelector- channel={layer.visualChannels.height}+ channel={layer.visualChannels.size}+ {...layerChannelConfigProps}+ />+ </ConfigGroupCollapsibleContent>+ </LayerConfigGroup>+ </StyledLayerVisualConfigurator>+ );+ }++ _renderArcLayerConfig(args) {+ return this._renderLineLayerConfig(args);+ }++ _renderLineLayerConfig({+ layer,+ visConfiguratorProps,+ layerConfiguratorProps,+ layerChannelConfigProps+ }) {+ return (+ <StyledLayerVisualConfigurator>+ {/* Color */}+ <LayerConfigGroup label={'color'} collapsible>+ {layer.config.colorField ? (+ <ColorRangeConfig {...visConfiguratorProps} />+ ) : (+ <ArcLayerColorSelector+ layer={layer}+ onChangeConfig={layerConfiguratorProps.onChange}+ onChangeVisConfig={visConfiguratorProps.onChange}+ />+ )}+ <ConfigGroupCollapsibleContent>+ <ChannelByValueSelector+ channel={layer.visualChannels.color}{...layerChannelConfigProps}/>- <VisConfigSwitch+ <VisConfigSlider+ {...LAYER_VIS_CONFIGS.opacity}{...visConfiguratorProps}- {...LAYER_VIS_CONFIGS.wireframe}/></ConfigGroupCollapsibleContent></LayerConfigGroup>- ) : null}- {/* Radius */}- {featureTypes.point ? (- <LayerConfigGroup label={'radius'} collapsible>- {!layer.config.radiusField ? (+ {/* thickness */}+ <LayerConfigGroup label={'stroke'} collapsible>+ {layer.config.sizeField ? (<VisConfigSlider- {...LAYER_VIS_CONFIGS.radius}+ {...LAYER_VIS_CONFIGS.strokeWidthRange}{...visConfiguratorProps}+ disabled={!layer.config.sizeField}label={false}- disabled={Boolean(layer.config.radiusField)}/>) : (<VisConfigSlider- {...LAYER_VIS_CONFIGS.radiusRange}+ {...LAYER_VIS_CONFIGS.thickness}{...visConfiguratorProps}label={false}- disabled={!layer.config.radiusField}/>)}<ConfigGroupCollapsibleContent><ChannelByValueSelector- channel={layer.visualChannels.radius}+ channel={layer.visualChannels.size}{...layerChannelConfigProps}/></ConfigGroupCollapsibleContent></LayerConfigGroup>- ) : null}- </StyledLayerVisualConfigurator>- );- }-- _render3DLayerConfig({- layer,- visConfiguratorProps,- layerConfiguratorProps,- layerChannelConfigProps- }) {- return (- <Fragment>- <LayerConfigGroup label={'3D Model'} collapsible>- <Input- type="file"- accept=".glb,.gltf"- onChange={e => {- if (e.target.files && e.target.files[0]) {- const url = URL.createObjectURL(e.target.files[0]);- visConfiguratorProps.onChange({scenegraph: url});- }- }}- />- </LayerConfigGroup>- <LayerConfigGroup label={'3D Model Options'} collapsible>- <VisConfigSlider- {...LAYER_VIS_CONFIGS.sizeScale}- {...visConfiguratorProps}- disabled={false}- />- <VisConfigSlider- {...LAYER_VIS_CONFIGS.angle}- {...visConfiguratorProps}- label="Angle X"- property="angleX"- disabled={false}- />- <VisConfigSlider- {...LAYER_VIS_CONFIGS.angle}- {...visConfiguratorProps}- label="Angle Y"- property="angleY"- disabled={false}- />- <VisConfigSlider- {...LAYER_VIS_CONFIGS.angle}- {...visConfiguratorProps}- label="Angle Z"- property="angleZ"- disabled={false}- />- </LayerConfigGroup>- </Fragment>- );- }+ </StyledLayerVisualConfigurator>+ );+ }- render() {- const {+ _renderGeojsonLayerConfig({layer,- datasets,- updateLayerConfig,- layerTypeOptions,- updateLayerType- } = this.props;- const {fields = [], fieldPairs} = layer.config.dataId- ? datasets[layer.config.dataId]- : {};- const {config} = layer;-- const commonConfigProp = {- layer,- fields- };-- const visConfiguratorProps = {- ...commonConfigProp,- onChange: this.props.updateLayerVisConfig- };-- const layerConfiguratorProps = {- ...commonConfigProp,- onChange: updateLayerConfig- };-- const layerChannelConfigProps = {- ...commonConfigProp,- onChange: this.props.updateLayerVisualChannelConfig- };+ visConfiguratorProps,+ layerConfiguratorProps,+ layerChannelConfigProps+ }) {+ const {+ meta: {featureTypes = {}},+ config: {visConfig}+ } = layer;++ return (+ <StyledLayerVisualConfigurator>+ {/* Fill Color */}+ {featureTypes.polygon || featureTypes.point ? (+ <LayerConfigGroup+ {...layer.visConfigSettings.filled}+ {...visConfiguratorProps}+ label="Fill Color"+ collapsible+ >+ {layer.config.colorField ? (+ <ColorRangeConfig {...visConfiguratorProps} />+ ) : (+ <LayerColorSelector {...layerConfiguratorProps} />+ )}+ <ConfigGroupCollapsibleContent>+ <ChannelByValueSelector+ channel={layer.visualChannels.color}+ {...layerChannelConfigProps}+ />+ <VisConfigSlider+ {...LAYER_VIS_CONFIGS.opacity}+ {...visConfiguratorProps}+ />+ </ConfigGroupCollapsibleContent>+ </LayerConfigGroup>+ ) : null}- const renderTemplate =- layer.type && `_render${capitalizeFirstLetter(layer.type)}LayerConfig`;+ {/* stroke color */}+ <LayerConfigGroup+ {...layer.visConfigSettings.stroked}+ {...visConfiguratorProps}+ label="Stroke Color"+ collapsible+ >+ {layer.config.strokeColorField ? (+ <ColorRangeConfig+ {...visConfiguratorProps}+ property="strokeColorRange"+ />+ ) : (+ <LayerColorSelector+ {...visConfiguratorProps}+ selectedColor={layer.config.visConfig.strokeColor}+ property="strokeColor"+ />+ )}+ <ConfigGroupCollapsibleContent>+ <ChannelByValueSelector+ channel={layer.visualChannels.strokeColor}+ {...layerChannelConfigProps}+ />+ </ConfigGroupCollapsibleContent>+ </LayerConfigGroup>- return (- <StyledLayerConfigurator>- {layer.layerInfoModal ? (- <HowToButton- onClick={() => this.props.openModal(layer.layerInfoModal)}- />- ) : null}- <LayerConfigGroup- label={'basic'}- collapsible- expanded={!layer.hasAllColumns()}- >- <LayerTypeSelector- layer={layer}- layerTypeOptions={layerTypeOptions}- onSelect={updateLayerType}- />- <ConfigGroupCollapsibleContent>- {Object.keys(datasets).length > 1 && (- <SourceDataSelector- datasets={datasets}- id={layer.id}- disabled={layer.type && config.columns}- dataId={config.dataId}- onSelect={value => updateLayerConfig({dataId: value})}+ {/* Stroke Width */}+ <LayerConfigGroup+ {...visConfiguratorProps}+ {...(featureTypes.polygon ? LAYER_VIS_CONFIGS.stroked : {})}+ label="Stroke Width"+ collapsible+ >+ {layer.config.sizeField ? (+ <VisConfigSlider+ {...LAYER_VIS_CONFIGS.strokeWidthRange}+ {...visConfiguratorProps}+ label={false}+ />+ ) : (+ <VisConfigSlider+ {...LAYER_VIS_CONFIGS.thickness}+ {...visConfiguratorProps}+ label={false}/>)}- <LayerColumnConfig+ <ConfigGroupCollapsibleContent>+ <ChannelByValueSelector+ channel={layer.visualChannels.size}+ {...layerChannelConfigProps}+ />+ </ConfigGroupCollapsibleContent>+ </LayerConfigGroup>++ {/* Elevation */}+ {featureTypes.polygon && visConfig.filled ? (+ <LayerConfigGroup+ {...visConfiguratorProps}+ {...LAYER_VIS_CONFIGS.enable3d}+ collapsible+ >+ <VisConfigSlider+ {...LAYER_VIS_CONFIGS.elevationScale}+ {...visConfiguratorProps}+ label={false}+ />+ <ConfigGroupCollapsibleContent>+ <ChannelByValueSelector+ channel={layer.visualChannels.height}+ {...layerChannelConfigProps}+ />+ <VisConfigSwitch+ {...visConfiguratorProps}+ {...LAYER_VIS_CONFIGS.wireframe}+ />+ </ConfigGroupCollapsibleContent>+ </LayerConfigGroup>+ ) : null}++ {/* Radius */}+ {featureTypes.point ? (+ <LayerConfigGroup label={'radius'} collapsible>+ {!layer.config.radiusField ? (+ <VisConfigSlider+ {...LAYER_VIS_CONFIGS.radius}+ {...visConfiguratorProps}+ label={false}+ disabled={Boolean(layer.config.radiusField)}+ />+ ) : (+ <VisConfigSlider+ {...LAYER_VIS_CONFIGS.radiusRange}+ {...visConfiguratorProps}+ label={false}+ disabled={!layer.config.radiusField}+ />+ )}+ <ConfigGroupCollapsibleContent>+ <ChannelByValueSelector+ channel={layer.visualChannels.radius}+ {...layerChannelConfigProps}+ />+ </ConfigGroupCollapsibleContent>+ </LayerConfigGroup>+ ) : null}+ </StyledLayerVisualConfigurator>+ );+ }++ _render3DLayerConfig({+ layer,+ visConfiguratorProps,+ layerConfiguratorProps,+ layerChannelConfigProps+ }) {+ return (+ <Fragment>+ <LayerConfigGroup label={'3D Model'} collapsible>+ <Input+ type="file"+ accept=".glb,.gltf"+ onChange={e => {+ if (e.target.files && e.target.files[0]) {+ const url = URL.createObjectURL(e.target.files[0]);+ visConfiguratorProps.onChange({scenegraph: url});+ }+ }}+ />+ </LayerConfigGroup>+ <LayerConfigGroup label={'3D Model Options'} collapsible>+ <VisConfigSlider+ {...LAYER_VIS_CONFIGS.sizeScale}+ {...visConfiguratorProps}+ disabled={false}+ />+ <VisConfigSlider+ {...LAYER_VIS_CONFIGS.angle}+ {...visConfiguratorProps}+ label="Angle X"+ property="angleX"+ disabled={false}+ />+ <VisConfigSlider+ {...LAYER_VIS_CONFIGS.angle}+ {...visConfiguratorProps}+ label="Angle Y"+ property="angleY"+ disabled={false}+ />+ <VisConfigSlider+ {...LAYER_VIS_CONFIGS.angle}+ {...visConfiguratorProps}+ label="Angle Z"+ property="angleZ"+ disabled={false}+ />+ </LayerConfigGroup>+ </Fragment>+ );+ }++ render() {+ const {+ layer,+ datasets,+ updateLayerConfig,+ layerTypeOptions,+ updateLayerType+ } = this.props;+ const {fields = [], fieldPairs} = layer.config.dataId+ ? datasets[layer.config.dataId]+ : {};+ const {config} = layer;++ const commonConfigProp = {+ layer,+ fields+ };++ const visConfiguratorProps = {+ ...commonConfigProp,+ onChange: this.props.updateLayerVisConfig+ };++ const layerConfiguratorProps = {+ ...commonConfigProp,+ onChange: updateLayerConfig+ };++ const layerChannelConfigProps = {+ ...commonConfigProp,+ onChange: this.props.updateLayerVisualChannelConfig+ };++ const renderTemplate =+ layer.type && `_render${capitalizeFirstLetter(layer.type)}LayerConfig`;++ return (+ <StyledLayerConfigurator>+ {layer.layerInfoModal ? (+ <HowToButton+ onClick={() => this.props.openModal(layer.layerInfoModal)}+ />+ ) : null}+ <LayerConfigGroup+ label={'basic'}+ collapsible+ expanded={!layer.hasAllColumns()}+ >+ <LayerTypeSelectorlayer={layer}- fields={fields}- fieldPairs={fieldPairs}- updateLayerConfig={updateLayerConfig}- updateLayerType={this.props.updateLayerType}+ layerTypeOptions={layerTypeOptions}+ onSelect={updateLayerType}/>- </ConfigGroupCollapsibleContent>- </LayerConfigGroup>- {this[renderTemplate] &&- this[renderTemplate]({- layer,- visConfiguratorProps,- layerChannelConfigProps,- layerConfiguratorProps- })}- </StyledLayerConfigurator>- );+ <ConfigGroupCollapsibleContent>+ {Object.keys(datasets).length > 1 && (+ <SourceDataSelector+ datasets={datasets}+ id={layer.id}+ disabled={layer.type && config.columns}+ dataId={config.dataId}+ onSelect={value => updateLayerConfig({dataId: value})}+ />+ )}+ <LayerColumnConfig+ layer={layer}+ fields={fields}+ fieldPairs={fieldPairs}+ updateLayerConfig={updateLayerConfig}+ updateLayerType={this.props.updateLayerType}+ />+ </ConfigGroupCollapsibleContent>+ </LayerConfigGroup>+ {this[renderTemplate] &&+ this[renderTemplate]({+ layer,+ visConfiguratorProps,+ layerChannelConfigProps,+ layerConfiguratorProps+ })}+ </StyledLayerConfigurator>+ );+ }}-}+ return LayerConfigurator;+}/** Componentize config component into pure functional components*/diff --git a/src/components/side-panel/layer-panel/layer-panel.js b/src/components/side-panel/layer-panel/layer-panel.jsindex 5e5705b4a..c5beb0eb3 100644--- a/src/components/side-panel/layer-panel/layer-panel.js+++ b/src/components/side-panel/layer-panel/layer-panel.js@@ -22,7 +22,7 @@ import React, {Component} from 'react';import styled from 'styled-components';import PropTypes from 'prop-types';-import LayerConfigurator from './layer-configurator';+import LayerConfiguratorFactory from './layer-configurator';import LayerPanelHeader from './layer-panel-header';const PanelWrapper = styled.div`@@ -36,7 +36,9 @@ const PanelWrapper = styled.div`}`;-function LayerPanelFactory() {+LayerPanelFactory.deps = [LayerConfiguratorFactory];++function LayerPanelFactory(LayerConfigurator) {class LayerPanel extends Component {static propTypes = {diff --git a/src/components/side-panel/source-data-catalog.js b/src/components/side-panel/source-data-catalog.jsdeleted file mode 100644index 0089fd848..000000000--- a/src/components/side-panel/source-data-catalog.js+++ /dev/null@@ -1,176 +0,0 @@-// Copyright (c) 2019 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.--import React from 'react';-import styled from 'styled-components';-import {format} from 'd3-format';--import {SidePanelSection, Tooltip, DatasetSquare, CenterFlexbox} from 'components/common/styled-components';-import {Table, Trash, ArrowRight} from 'components/common/icons';--const defaultRemoveDataset = datasetKey => {};-const numFormat = format(',');--const SourceDataCatelogWrapper = styled.div`- transition: ${props => props.theme.transition};-`;--const DatasetTitle = styled.div`- color: ${props => props.theme.textColor};- display: flex;- align-items: flex-start;-- .source-data-arrow {- height: 16px;- }- :hover {- color: ${props =>- props.clickable ? props.theme.textColorHl : props.theme.textColor};- cursor: ${props => (props.clickable ? 'pointer' : 'auto')};-- .dataset-action {- color: ${props => props.theme.textColorHl};- opacity: 1;- }-- .dataset-action:hover {- color: white;- }- }-`;--const DatasetTagWrapper = styled.div`- display: flex;- color: ${props => props.theme.textColor};- font-size: 11px;- letter-spacing: 0.2px;- overflow: auto;-- .dataset-color {- flex-shrink: 0;- margin-top: 5px;- }-- .dataset-name {- white-space: nowrap;- overflow: hidden;- text-overflow: ellipsis;- }-`;--const DataTagAction = styled.div`- margin-left: 12px;- height: 16px;- opacity: 0;-`;--const DataRowCount = styled.div`- font-size: 11px;- color: ${props => props.theme.subtextColor};- padding-left: 19px;-`;--export const DatasetTag = ({onClick, dataset}) => (- <DatasetTagWrapper className="source-data-tag" onClick={onClick}>- <DatasetSquare className="dataset-color" color={dataset.color} />- <div className="dataset-name">{dataset.label}</div>- </DatasetTagWrapper>-);--const ShowDataTable = ({id, showDatasetTable}) => (- <DataTagAction- className="dataset-action show-data-table"- data-tip- data-for={`data-table-${id}`}- >- <Table height="16px" onClick={() => showDatasetTable(id)} />- <Tooltip id={`data-table-${id}`} effect="solid">- <span>Show data table</span>- </Tooltip>- </DataTagAction>-);--const RemoveDataset = ({datasetKey, removeDataset = defaultRemoveDataset}) => (- <DataTagAction- className="dataset-action remove-dataset"- data-tip- data-for={`delete-${datasetKey}`}- >- <Trash- height="16px"- onClick={e => {- e.stopPropagation();- removeDataset(datasetKey);- }}- />- <Tooltip id={`delete-${datasetKey}`} effect="solid" type="error">- <span>Remove dataset</span>- </Tooltip>- </DataTagAction>-);--function SourceDataCatalogFactory() {- const SourceDataCatalog = ({- datasets,- showDatasetTable,- removeDataset,- showDeleteDataset = false- }) => (- <SourceDataCatelogWrapper className="source-data-catalog">- {Object.values(datasets).map((dataset, index) => (- <SidePanelSection key={dataset.id}>- <DatasetTitle className="source-data-title" clickable={Boolean(showDatasetTable)}>- <DatasetTag- dataset={dataset}- onClick={- showDatasetTable ? () => showDatasetTable(dataset.id) : null- }- />- {showDatasetTable ?- <CenterFlexbox className="source-data-arrow">- <ArrowRight height="12px" />- </CenterFlexbox> : null}- {showDatasetTable ? (- <ShowDataTable- id={dataset.id}- showDatasetTable={showDatasetTable}- />- ) : null}- {showDeleteDataset ? (- <RemoveDataset- datasetKey={dataset.id}- removeDataset={removeDataset}- />- ) : null}- </DatasetTitle>- {showDatasetTable ? (- <DataRowCount className="source-data-rows">{`${numFormat(- dataset.allData.length- )} rows`}</DataRowCount>- ) : null}- </SidePanelSection>- ))}- </SourceDataCatelogWrapper>- );-- return SourceDataCatalog;-}--export default SourceDataCatalogFactory;diff --git a/src/components/side-panel/source-data-selector.js b/src/components/side-panel/source-data-selector.jsdeleted file mode 100644index 124a00bfb..000000000--- a/src/components/side-panel/source-data-selector.js+++ /dev/null@@ -1,76 +0,0 @@-// Copyright (c) 2019 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.--import React, {Component} from 'react';-import {createSelector} from 'reselect';--import {- PanelLabel,- SidePanelSection-} from 'components/common/styled-components';-import ItemSelector from 'components/common/item-selector/item-selector';-import {DatasetTag} from './source-data-catalog';--const defaultPlaceHolder = 'Select A Data Source';--const DatasetItem = ({value}) => <DatasetTag dataset={value} />;--export default class SourceDataSelector extends Component {- /* selectors */- /* eslint-disable no-invalid-this */- datasetsSelector = props => props.datasets;- dsOptionsSelector = createSelector(this.datasetsSelector, datasets =>- Object.values(datasets).map(ds => ({- label: ds.label,- value: ds.id,- color: ds.color- }))- );-- render() {- const {- dataId,- disabled,- onSelect,- defaultValue = defaultPlaceHolder,- inputTheme- } = this.props;- const dsOptions = this.dsOptionsSelector(this.props);-- return (- <SidePanelSection className="data-source-selector">- <PanelLabel>Data Source</PanelLabel>- <ItemSelector- inputTheme={inputTheme}- selectedItems={dataId ? this.props.datasets[dataId] : null}- options={dsOptions}- getOptionValue={'value'}- filterOption={'label'}- multiSelect={false}- onChange={onSelect}- placeholder={defaultValue}- disabled={disabled}- displayOption={'label'}- DropDownLineItemRenderComponent={DatasetItem}- />- </SidePanelSection>- );- }-}