@carto/kepler.gl 0.0.72 → 0.0.74
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/CHANGELOG.md +8 -0
- package/dist/components/side-panel/layer-panel/layer-configurator.js +69 -29
- package/dist/constants/default-settings.js +1 -1
- package/dist/layers/base-layer.js +7 -3
- package/package.json +1 -1
- package/src/components/side-panel/layer-panel/layer-configurator.js +77 -39
- package/src/layers/base-layer.js +2 -2
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@carto/kepler.gl",
|
|
3
3
|
"author": "CARTO",
|
|
4
4
|
"homepage": "https://github.com/CartoDB/carto-kepler#readme",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.74",
|
|
6
6
|
"description": "kepler.gl is a webgl based application to visualize large scale location data in the browser",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "dist/index.js",
|
|
@@ -1123,7 +1123,30 @@ export function ArcLayerColorSelectorFactory(ColorSelector) {
|
|
|
1123
1123
|
LayerColorRangeSelectorFactory.deps = [ColorSelectorFactory];
|
|
1124
1124
|
export function LayerColorRangeSelectorFactory(ColorSelector) {
|
|
1125
1125
|
class LayerColorRangeSelector extends Component {
|
|
1126
|
-
|
|
1126
|
+
__renderHeatmapColorSelectorComponent() {
|
|
1127
|
+
const property = 'colorRange';
|
|
1128
|
+
const {layer, onChange, setColorUI} = this.props;
|
|
1129
|
+
return (
|
|
1130
|
+
<ColorSelector
|
|
1131
|
+
colorSets={[
|
|
1132
|
+
{
|
|
1133
|
+
selectedColor: layer.config.visConfig[property],
|
|
1134
|
+
isRange: true,
|
|
1135
|
+
setColor: colorRange => {
|
|
1136
|
+
const {colorMap} = layer.config.visConfig[property];
|
|
1137
|
+
const colorRangeUpdated = colorMap
|
|
1138
|
+
? layer.updateColorMap(property, colorMap, colorRange)
|
|
1139
|
+
: colorRange;
|
|
1140
|
+
onChange({[property]: colorRangeUpdated});
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
]}
|
|
1144
|
+
colorUI={layer.config.colorUI[property]}
|
|
1145
|
+
setColorUI={newConfig => setColorUI(property, newConfig)}
|
|
1146
|
+
/>
|
|
1147
|
+
);
|
|
1148
|
+
}
|
|
1149
|
+
__renderDefaultColorSelectorComponent() {
|
|
1127
1150
|
const {
|
|
1128
1151
|
layer,
|
|
1129
1152
|
onChange,
|
|
@@ -1134,23 +1157,20 @@ export function LayerColorRangeSelectorFactory(ColorSelector) {
|
|
|
1134
1157
|
} = this.props;
|
|
1135
1158
|
const {range: property, field, scale} = layer.visualChannels[channel];
|
|
1136
1159
|
return (
|
|
1137
|
-
<
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
: colorRange;
|
|
1152
|
-
// Ensure that scale changes from identity to ordinal
|
|
1153
|
-
// Validate scale to ensure that it changes from `identity` to the correct one.
|
|
1160
|
+
<ColorSelector
|
|
1161
|
+
fields={fields}
|
|
1162
|
+
colorSets={[
|
|
1163
|
+
{
|
|
1164
|
+
selectedColor: layer.config.visConfig[property],
|
|
1165
|
+
isRange: true,
|
|
1166
|
+
setColor: colorRange => {
|
|
1167
|
+
const {colorMap} = layer.config.visConfig[property];
|
|
1168
|
+
const colorRangeUpdated = colorMap
|
|
1169
|
+
? layer.updateColorMap(property, colorMap, colorRange)
|
|
1170
|
+
: colorRange;
|
|
1171
|
+
// Ensure that scale changes from identity to ordinal
|
|
1172
|
+
// Validate scale to ensure that it changes from `identity` to the correct one.
|
|
1173
|
+
if (layer.isColoredByColorColumn(property)) {
|
|
1154
1174
|
layer.updateLayerConfig({
|
|
1155
1175
|
[field]: {
|
|
1156
1176
|
...layer.config[field],
|
|
@@ -1160,29 +1180,47 @@ export function LayerColorRangeSelectorFactory(ColorSelector) {
|
|
|
1160
1180
|
[scale]: SCALE_TYPES.ordinal
|
|
1161
1181
|
});
|
|
1162
1182
|
layer.validateScale(channel);
|
|
1163
|
-
// ---------------------------------------
|
|
1164
|
-
onChange({[property]: colorRangeUpdated});
|
|
1165
1183
|
}
|
|
1184
|
+
// ---------------------------------------
|
|
1185
|
+
onChange({[property]: colorRangeUpdated});
|
|
1166
1186
|
}
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1187
|
+
}
|
|
1188
|
+
]}
|
|
1189
|
+
colorUI={layer.config.colorUI[property]}
|
|
1190
|
+
setColorUI={newConfig => setColorUI(property, newConfig)}
|
|
1191
|
+
onSelectHexColorColumn={colorColumn => {
|
|
1192
|
+
// It's defined in CN: see workspace-www/src/features/builder/ui/KeplerGl/SidePanel/LayerPanel/LayerColorRangeSelector.tsx
|
|
1193
|
+
handleCustomOnSelectHexColumn(layer, colorColumn);
|
|
1194
|
+
|
|
1195
|
+
layer.updateLayerConfig({
|
|
1196
|
+
[field]: {
|
|
1197
|
+
...layer.config[field],
|
|
1198
|
+
colorColumn: colorColumn?.name,
|
|
1199
|
+
colorColumnIdx: colorColumn?.fieldIdx
|
|
1200
|
+
},
|
|
1201
|
+
[scale]: SCALE_TYPES.identity
|
|
1202
|
+
});
|
|
1203
|
+
|
|
1204
|
+
onChange({[property]: hexColorCustomPalette});
|
|
1205
|
+
}}
|
|
1206
|
+
/>
|
|
1207
|
+
);
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
render() {
|
|
1211
|
+
const {layer} = this.props;
|
|
1212
|
+
let renderColorSelectorComponent = this.__renderDefaultColorSelectorComponent.bind(this);
|
|
1213
|
+
|
|
1214
|
+
if (layer.type === LAYER_TYPES.heatmap) {
|
|
1215
|
+
renderColorSelectorComponent = this.__renderHeatmapColorSelectorComponent.bind(this);
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
return (
|
|
1219
|
+
<SidePanelSection>
|
|
1220
|
+
<PanelLabel>
|
|
1221
|
+
<FormattedMessage id="layer.colorRange" />
|
|
1222
|
+
</PanelLabel>
|
|
1223
|
+
{renderColorSelectorComponent()}
|
|
1186
1224
|
</SidePanelSection>
|
|
1187
1225
|
);
|
|
1188
1226
|
}
|
package/src/layers/base-layer.js
CHANGED
|
@@ -1119,7 +1119,7 @@ class Layer {
|
|
|
1119
1119
|
updateVisualChannelFields(dataset) {
|
|
1120
1120
|
for (const {field, range} of Object.values(this.visualChannels)) {
|
|
1121
1121
|
const oldField = this.config[field];
|
|
1122
|
-
const isUsingHexColorCode = this.config.visConfig[range]
|
|
1122
|
+
const isUsingHexColorCode = this.config.visConfig[range]?.hexColor;
|
|
1123
1123
|
if (!oldField) {
|
|
1124
1124
|
return;
|
|
1125
1125
|
}
|
|
@@ -1533,7 +1533,7 @@ class Layer {
|
|
|
1533
1533
|
getHexColumn(range) {
|
|
1534
1534
|
const field = Object.values(this.visualChannels)?.find(value => value.range === range)?.field;
|
|
1535
1535
|
if (field) {
|
|
1536
|
-
return this.config[field]
|
|
1536
|
+
return this.config[field]?.colorColumn;
|
|
1537
1537
|
}
|
|
1538
1538
|
}
|
|
1539
1539
|
|