@carto/kepler.gl 0.0.72-alpha.1 → 0.0.72-alpha.3
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/side-panel/layer-panel/color-range-selector.js +4 -2
- package/dist/components/side-panel/layer-panel/hex-column-config.js +7 -3
- package/dist/components/side-panel/layer-panel/layer-configurator.js +18 -8
- package/dist/constants/default-settings.js +1 -1
- package/dist/layers/base-layer.js +4 -4
- package/package.json +1 -1
- package/src/components/side-panel/layer-panel/color-range-selector.js +2 -1
- package/src/components/side-panel/layer-panel/hex-column-config.js +3 -2
- package/src/components/side-panel/layer-panel/layer-configurator.js +11 -2
- package/src/layers/base-layer.js +3 -3
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.72-alpha.
|
|
5
|
+
"version": "0.0.72-alpha.3",
|
|
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",
|
|
@@ -137,7 +137,8 @@ export default function ColorRangeSelectFactory(ColorPaletteGroup, PaletteConfig
|
|
|
137
137
|
_updateConfig = ({key, value}) => {
|
|
138
138
|
this._setColorRangeConfig({
|
|
139
139
|
[key]: value,
|
|
140
|
-
...(key === 'type' && {custom: value === 'custom', isHexColumn: value === hexColor})
|
|
140
|
+
...(key === 'type' && {custom: value === 'custom', isHexColumn: value === hexColor}),
|
|
141
|
+
...(key === 'type' && value !== hexColor && {hexColumn: null})
|
|
141
142
|
});
|
|
142
143
|
};
|
|
143
144
|
|
|
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import {PanelLabel} from 'components/common/styled-components';
|
|
4
4
|
import {FormattedMessage} from 'localization';
|
|
5
5
|
import React, {Component} from 'react';
|
|
6
|
+
import {ALL_FIELD_TYPES} from 'constants/default-settings';
|
|
6
7
|
|
|
7
8
|
export function HexColumnConfigFactory() {
|
|
8
9
|
class HexColumnConfig extends Component {
|
|
@@ -26,11 +27,11 @@ export function HexColumnConfigFactory() {
|
|
|
26
27
|
</div>
|
|
27
28
|
<div>
|
|
28
29
|
<FieldSelector
|
|
29
|
-
fields={fields}
|
|
30
|
+
fields={fields.filter(f => f.type === ALL_FIELD_TYPES.string)}
|
|
30
31
|
value={value}
|
|
31
32
|
placeholder={''}
|
|
32
33
|
onSelect={onSelectColumn}
|
|
33
|
-
erasable
|
|
34
|
+
erasable={false}
|
|
34
35
|
onFocus={() => null}
|
|
35
36
|
onBlur={() => null}
|
|
36
37
|
/>
|
|
@@ -51,7 +51,7 @@ import {injectIntl} from 'react-intl';
|
|
|
51
51
|
import ColorDimensionScaleSelectorFactory from './color-dimension-scale-selector';
|
|
52
52
|
import ColorSelectorFactory from './color-selector';
|
|
53
53
|
import LayerAggregationResolutionFactory from './layer-aggregation-resolution';
|
|
54
|
-
import {hexColorCustomPalette} from 'constants/color-ranges';
|
|
54
|
+
import {DEFAULT_COLOR_RANGE, hexColorCustomPalette} from 'constants/color-ranges';
|
|
55
55
|
|
|
56
56
|
const StyledLayerConfigurator = styled.div.attrs({
|
|
57
57
|
className: 'layer-panel__config'
|
|
@@ -1149,8 +1149,12 @@ export function LayerColorRangeSelectorFactory(ColorSelector) {
|
|
|
1149
1149
|
const colorRangeUpdated = colorMap
|
|
1150
1150
|
? layer.updateColorMap(property, colorMap, colorRange)
|
|
1151
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.
|
|
1154
|
+
layer.updateLayerConfig({[scale]: SCALE_TYPES.ordinal});
|
|
1155
|
+
layer.validateScale(channel);
|
|
1156
|
+
// ---------------------------------------
|
|
1152
1157
|
onChange({[property]: colorRangeUpdated});
|
|
1153
|
-
layer.validateScale(channel); // Validate scale to ensure that it changes from `identity` to the correct one.
|
|
1154
1158
|
}
|
|
1155
1159
|
}
|
|
1156
1160
|
]}
|
|
@@ -1246,6 +1250,11 @@ export function ChannelByValueSelectorFactory(VisConfigByFieldSelector) {
|
|
|
1246
1250
|
if (visRange?.colorMap) {
|
|
1247
1251
|
onChangeVisConfig({[range]: {...visRange, colorMap: undefined}});
|
|
1248
1252
|
}
|
|
1253
|
+
if (!val) {
|
|
1254
|
+
// Clean everything and comeback to default behaviour
|
|
1255
|
+
onChange({[field]: null}, key);
|
|
1256
|
+
onChangeVisConfig({[range]: DEFAULT_COLOR_RANGE});
|
|
1257
|
+
}
|
|
1249
1258
|
onChange(
|
|
1250
1259
|
{
|
|
1251
1260
|
[field]: val,
|
package/src/layers/base-layer.js
CHANGED
|
@@ -1064,7 +1064,7 @@ class Layer {
|
|
|
1064
1064
|
}
|
|
1065
1065
|
|
|
1066
1066
|
updateLayerLegend(settings) {
|
|
1067
|
-
this.legendSettings =
|
|
1067
|
+
this.legendSettings = settings;
|
|
1068
1068
|
}
|
|
1069
1069
|
|
|
1070
1070
|
getDataUpdateTriggers({filteredIndex, id, allData}) {
|
|
@@ -1286,7 +1286,7 @@ class Layer {
|
|
|
1286
1286
|
const channelConfig = this.config.visConfig[channel.range];
|
|
1287
1287
|
const field = this.config[channel.field];
|
|
1288
1288
|
|
|
1289
|
-
if (channelConfig?.type === hexColor) {
|
|
1289
|
+
if (channelConfig?.type === hexColor && field?.colorColumn) {
|
|
1290
1290
|
const dataSetField = dataset.fields.find(f => f.name === field.colorColumn);
|
|
1291
1291
|
const colors = dataset
|
|
1292
1292
|
.getColumnLayerDomain(dataSetField, SCALE_TYPES.ordinal)
|
|
@@ -1311,7 +1311,7 @@ class Layer {
|
|
|
1311
1311
|
const channelConfig = this.config.visConfig[range];
|
|
1312
1312
|
const field = this.config[channelField];
|
|
1313
1313
|
|
|
1314
|
-
if (channelConfig?.type === hexColor) {
|
|
1314
|
+
if (channelConfig?.type === hexColor && field?.colorColumn) {
|
|
1315
1315
|
const dataSetField = dataset.fields.find(f => f.name === field.colorColumn);
|
|
1316
1316
|
const legend = dataset.calculateLegend(field, dataSetField);
|
|
1317
1317
|
legends[channel] = legend;
|