@carto/kepler.gl 0.0.41 → 0.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.js +36 -14
- package/dist/components/side-panel/layer-panel/color-range-selector.js +1 -1
- package/dist/components/side-panel/layer-panel/color-selector.js +144 -141
- package/dist/components/side-panel/layer-panel/layer-configurator.js +171 -109
- package/dist/components/side-panel/layer-panel/single-color-palette.js +75 -35
- package/dist/components/side-panel/layer-panel/text-label-panel.js +6 -6
- package/dist/constants/default-settings.js +1 -1
- package/package.json +1 -1
- package/src/components/index.js +14 -8
- package/src/components/side-panel/layer-panel/color-range-selector.js +0 -1
- package/src/components/side-panel/layer-panel/color-selector.js +130 -125
- package/src/components/side-panel/layer-panel/layer-configurator.js +101 -80
- package/src/components/side-panel/layer-panel/single-color-palette.js +41 -32
- package/src/components/side-panel/layer-panel/text-label-panel.js +8 -3
- package/CHANGELOG.md +0 -711
|
@@ -32,7 +32,6 @@ import LayerColumnConfigFactory from './layer-column-config';
|
|
|
32
32
|
import LayerTypeSelectorFactory from './layer-type-selector';
|
|
33
33
|
import LayerVisibilityByZoomFactory from './layer-visibility-by-zoom';
|
|
34
34
|
import DimensionScaleSelector from './dimension-scale-selector';
|
|
35
|
-
import ColorSelector from './color-selector';
|
|
36
35
|
import SourceDataSelectorFactory from 'components/side-panel/common/source-data-selector';
|
|
37
36
|
import VisConfigSwitchFactory from './vis-config-switch';
|
|
38
37
|
import VisConfigSliderFactory from './vis-config-slider';
|
|
@@ -45,6 +44,7 @@ import {CHANNEL_SCALES, CHANNEL_SCALE_SUPPORTED_FIELDS} from 'constants/default-
|
|
|
45
44
|
import {LAYER_TYPES} from 'layers/types';
|
|
46
45
|
import {injectIntl} from 'react-intl';
|
|
47
46
|
import ColorDimensionScaleSelectorFactory from './color-dimension-scale-selector';
|
|
47
|
+
import ColorSelectorFactory from './color-selector';
|
|
48
48
|
|
|
49
49
|
const StyledLayerConfigurator = styled.div.attrs({
|
|
50
50
|
className: 'layer-panel__config'
|
|
@@ -99,7 +99,10 @@ LayerConfiguratorFactory.deps = [
|
|
|
99
99
|
LayerTypeSelectorFactory,
|
|
100
100
|
VisConfigSwitchFactory,
|
|
101
101
|
AggrScaleSelectorFactory,
|
|
102
|
-
LayerVisibilityByZoomFactory
|
|
102
|
+
LayerVisibilityByZoomFactory,
|
|
103
|
+
LayerColorSelectorFactory,
|
|
104
|
+
LayerColorRangeSelectorFactory,
|
|
105
|
+
ArcLayerColorSelectorFactory
|
|
103
106
|
];
|
|
104
107
|
|
|
105
108
|
export default function LayerConfiguratorFactory(
|
|
@@ -112,7 +115,10 @@ export default function LayerConfiguratorFactory(
|
|
|
112
115
|
LayerTypeSelector,
|
|
113
116
|
VisConfigSwitch,
|
|
114
117
|
AggrScaleSelector,
|
|
115
|
-
LayerVisibilityByZoom
|
|
118
|
+
LayerVisibilityByZoom,
|
|
119
|
+
LayerColorSelector,
|
|
120
|
+
LayerColorRangeSelector,
|
|
121
|
+
ArcLayerColorSelector
|
|
116
122
|
) {
|
|
117
123
|
class LayerConfigurator extends Component {
|
|
118
124
|
static propTypes = {
|
|
@@ -1020,85 +1026,100 @@ export const HowToButton = ({onClick}) => (
|
|
|
1020
1026
|
</StyledHowToButton>
|
|
1021
1027
|
);
|
|
1022
1028
|
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1029
|
+
LayerColorSelectorFactory.deps = [ColorSelectorFactory];
|
|
1030
|
+
export function LayerColorSelectorFactory(ColorSelector) {
|
|
1031
|
+
class LayerColorSelector extends Component {
|
|
1032
|
+
render() {
|
|
1033
|
+
const {layer, onChange, selectedColor, property = 'color', setColorUI} = this.props;
|
|
1034
|
+
return (
|
|
1035
|
+
<SidePanelSection>
|
|
1036
|
+
<PanelLabel>
|
|
1037
|
+
<FormattedMessage id="layer.color" />
|
|
1038
|
+
</PanelLabel>
|
|
1039
|
+
<ColorSelector
|
|
1040
|
+
colorSets={[
|
|
1041
|
+
{
|
|
1042
|
+
selectedColor: selectedColor || layer.config.color,
|
|
1043
|
+
setColor: rgbValue => onChange({[property]: rgbValue})
|
|
1044
|
+
}
|
|
1045
|
+
]}
|
|
1046
|
+
colorUI={layer.config.colorUI[property]}
|
|
1047
|
+
setColorUI={newConfig => setColorUI(property, newConfig)}
|
|
1048
|
+
/>
|
|
1049
|
+
</SidePanelSection>
|
|
1050
|
+
);
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1047
1053
|
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
onChangeConfig,
|
|
1051
|
-
onChangeVisConfig,
|
|
1052
|
-
property = 'color',
|
|
1053
|
-
setColorUI
|
|
1054
|
-
}) => (
|
|
1055
|
-
<SidePanelSection>
|
|
1056
|
-
<PanelLabel>
|
|
1057
|
-
<FormattedMessage id="layer.colorRange" />
|
|
1058
|
-
</PanelLabel>
|
|
1059
|
-
<ColorSelector
|
|
1060
|
-
colorSets={[
|
|
1061
|
-
{
|
|
1062
|
-
selectedColor: layer.config.color,
|
|
1063
|
-
setColor: rgbValue => onChangeConfig({color: rgbValue}),
|
|
1064
|
-
label: 'Source'
|
|
1065
|
-
},
|
|
1066
|
-
{
|
|
1067
|
-
selectedColor: layer.config.visConfig.targetColor || layer.config.color,
|
|
1068
|
-
setColor: rgbValue => onChangeVisConfig({targetColor: rgbValue}),
|
|
1069
|
-
label: 'Target'
|
|
1070
|
-
}
|
|
1071
|
-
]}
|
|
1072
|
-
colorUI={layer.config.colorUI[property]}
|
|
1073
|
-
setColorUI={newConfig => setColorUI(property, newConfig)}
|
|
1074
|
-
/>
|
|
1075
|
-
</SidePanelSection>
|
|
1076
|
-
);
|
|
1054
|
+
return LayerColorSelector;
|
|
1055
|
+
}
|
|
1077
1056
|
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1057
|
+
ArcLayerColorSelectorFactory.deps = [ColorSelectorFactory];
|
|
1058
|
+
export function ArcLayerColorSelectorFactory(ColorSelector) {
|
|
1059
|
+
class ArcLayerColorSelector extends Component {
|
|
1060
|
+
render() {
|
|
1061
|
+
const {layer, onChangeConfig, onChangeVisConfig, property = 'color', setColorUI} = this.props;
|
|
1062
|
+
return (
|
|
1063
|
+
<SidePanelSection>
|
|
1064
|
+
<PanelLabel>
|
|
1065
|
+
<FormattedMessage id="layer.colorRange" />
|
|
1066
|
+
</PanelLabel>
|
|
1067
|
+
<ColorSelector
|
|
1068
|
+
colorSets={[
|
|
1069
|
+
{
|
|
1070
|
+
selectedColor: layer.config.color,
|
|
1071
|
+
setColor: rgbValue => onChangeConfig({color: rgbValue}),
|
|
1072
|
+
label: 'Source'
|
|
1073
|
+
},
|
|
1074
|
+
{
|
|
1075
|
+
selectedColor: layer.config.visConfig.targetColor || layer.config.color,
|
|
1076
|
+
setColor: rgbValue => onChangeVisConfig({targetColor: rgbValue}),
|
|
1077
|
+
label: 'Target'
|
|
1078
|
+
}
|
|
1079
|
+
]}
|
|
1080
|
+
colorUI={layer.config.colorUI[property]}
|
|
1081
|
+
setColorUI={newConfig => setColorUI(property, newConfig)}
|
|
1082
|
+
/>
|
|
1083
|
+
</SidePanelSection>
|
|
1084
|
+
);
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
return ArcLayerColorSelector;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
LayerColorRangeSelectorFactory.deps = [ColorSelectorFactory];
|
|
1091
|
+
export function LayerColorRangeSelectorFactory(ColorSelector) {
|
|
1092
|
+
class LayerColorRangeSelector extends Component {
|
|
1093
|
+
render() {
|
|
1094
|
+
const {layer, onChange, property = 'colorRange', setColorUI} = this.props;
|
|
1095
|
+
return (
|
|
1096
|
+
<SidePanelSection>
|
|
1097
|
+
<PanelLabel>
|
|
1098
|
+
<FormattedMessage id="layer.colorRange" />
|
|
1099
|
+
</PanelLabel>
|
|
1100
|
+
<ColorSelector
|
|
1101
|
+
colorSets={[
|
|
1102
|
+
{
|
|
1103
|
+
selectedColor: layer.config.visConfig[property],
|
|
1104
|
+
isRange: true,
|
|
1105
|
+
setColor: colorRange => {
|
|
1106
|
+
const {colorMap} = layer.config.visConfig[property];
|
|
1107
|
+
const colorRangeUpdated = colorMap
|
|
1108
|
+
? layer.updateColorMap(property, colorMap, colorRange)
|
|
1109
|
+
: colorRange;
|
|
1110
|
+
onChange({[property]: colorRangeUpdated});
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
]}
|
|
1114
|
+
colorUI={layer.config.colorUI[property]}
|
|
1115
|
+
setColorUI={newConfig => setColorUI(property, newConfig)}
|
|
1116
|
+
/>
|
|
1117
|
+
</SidePanelSection>
|
|
1118
|
+
);
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
return LayerColorRangeSelector;
|
|
1122
|
+
}
|
|
1102
1123
|
|
|
1103
1124
|
ChannelByValueSelectorFactory.deps = [VisConfigByFieldSelectorFactory];
|
|
1104
1125
|
export function ChannelByValueSelectorFactory(VisConfigByFieldSelector) {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
19
|
// THE SOFTWARE.
|
|
20
20
|
|
|
21
|
-
import React from 'react';
|
|
21
|
+
import React, {Component} from 'react';
|
|
22
22
|
import PropTypes from 'prop-types';
|
|
23
23
|
import {range} from 'd3-array';
|
|
24
24
|
import styled from 'styled-components';
|
|
@@ -26,12 +26,6 @@ import {hexToRgb} from 'utils/color-utils';
|
|
|
26
26
|
|
|
27
27
|
import {ColorsByTheme, Themes} from 'constants/color-palette';
|
|
28
28
|
|
|
29
|
-
const propTypes = {
|
|
30
|
-
onSelectColor: PropTypes.func.isRequired,
|
|
31
|
-
// hex value
|
|
32
|
-
selectedColor: PropTypes.string.isRequired
|
|
33
|
-
};
|
|
34
|
-
|
|
35
29
|
const PALETTE_HEIGHT = '8px';
|
|
36
30
|
const ROWS = 22;
|
|
37
31
|
|
|
@@ -59,31 +53,46 @@ const StyledColorBlock = styled.div`
|
|
|
59
53
|
border-width: 1px;
|
|
60
54
|
border-style: solid;
|
|
61
55
|
`;
|
|
56
|
+
SingleColorPaletteFactory.deps = [];
|
|
57
|
+
|
|
58
|
+
function SingleColorPaletteFactory() {
|
|
59
|
+
class SingleColorPalette extends Component {
|
|
60
|
+
static propTypes = {
|
|
61
|
+
onSelectColor: PropTypes.func.isRequired,
|
|
62
|
+
// hex value
|
|
63
|
+
selectedColor: PropTypes.string.isRequired
|
|
64
|
+
};
|
|
62
65
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
)
|
|
66
|
+
render() {
|
|
67
|
+
const {selectedColor, onSelectColor} = this.props;
|
|
68
|
+
return (
|
|
69
|
+
<StyledColorPalette className="single-color-palette">
|
|
70
|
+
{Themes.map((theme, col) => (
|
|
71
|
+
<StyledColorColumn key={theme} className="single-color-palette__column">
|
|
72
|
+
{range(1, ROWS + 1, 1).map((key, i) => (
|
|
73
|
+
<StyledColorBlock
|
|
74
|
+
className="single-color-palette__block"
|
|
75
|
+
style={{
|
|
76
|
+
backgroundColor: ColorsByTheme[theme][key],
|
|
77
|
+
borderColor:
|
|
78
|
+
selectedColor === ColorsByTheme[theme][key].toUpperCase()
|
|
79
|
+
? 'white'
|
|
80
|
+
: ColorsByTheme[theme][key]
|
|
81
|
+
}}
|
|
82
|
+
key={`${theme}_${key}`}
|
|
83
|
+
selected={selectedColor === ColorsByTheme[theme][key].toUpperCase()}
|
|
84
|
+
onClick={e => onSelectColor(hexToRgb(ColorsByTheme[theme][key]), e)}
|
|
85
|
+
/>
|
|
86
|
+
))}
|
|
87
|
+
</StyledColorColumn>
|
|
88
|
+
))}
|
|
89
|
+
</StyledColorPalette>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return SingleColorPalette;
|
|
94
|
+
}
|
|
86
95
|
|
|
87
|
-
SingleColorPalette.propTypes = propTypes;
|
|
96
|
+
// SingleColorPalette.propTypes = propTypes;
|
|
88
97
|
|
|
89
|
-
export default
|
|
98
|
+
export default SingleColorPaletteFactory;
|
|
@@ -30,7 +30,6 @@ import {
|
|
|
30
30
|
SpaceBetweenFlexbox
|
|
31
31
|
} from 'components/common/styled-components';
|
|
32
32
|
import {Add} from 'components/common/icons';
|
|
33
|
-
import ColorSelector from './color-selector';
|
|
34
33
|
import ItemSelector from 'components/common/item-selector/item-selector';
|
|
35
34
|
import LayerConfigGroupFactory, {
|
|
36
35
|
ConfigGroupCollapsibleContent,
|
|
@@ -40,9 +39,15 @@ import RangeSliderFactory from 'components/common/range-slider';
|
|
|
40
39
|
|
|
41
40
|
import {LAYER_TEXT_CONFIGS} from 'layers/layer-factory';
|
|
42
41
|
import FieldSelectorFactory from '../../common/field-selector';
|
|
42
|
+
import ColorSelectorFactory from './color-selector';
|
|
43
43
|
|
|
44
|
-
TextLabelPanelFactory.deps = [
|
|
45
|
-
|
|
44
|
+
TextLabelPanelFactory.deps = [
|
|
45
|
+
RangeSliderFactory,
|
|
46
|
+
LayerConfigGroupFactory,
|
|
47
|
+
FieldSelectorFactory,
|
|
48
|
+
ColorSelectorFactory
|
|
49
|
+
];
|
|
50
|
+
function TextLabelPanelFactory(RangeSlider, LayerConfigGroup, FieldSelector, ColorSelector) {
|
|
46
51
|
class TextLabelPanel extends Component {
|
|
47
52
|
static propTypes = {
|
|
48
53
|
fields: PropTypes.arrayOf(PropTypes.object),
|