@carto/kepler.gl 0.0.60 → 0.0.61-count-aggregation.2
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/common/item-selector/dropdown-list.js +2 -7
- package/dist/components/common/item-selector/item-selector.js +8 -9
- package/dist/components/common/portaled.js +2 -2
- package/dist/components/map/map-popover.js +2 -2
- package/dist/components/map-container.js +2 -2
- package/dist/components/side-panel/layer-panel/custom-marker-categories-selector.js +45 -0
- package/dist/constants/default-settings.js +8 -5
- package/dist/layers/base-layer.js +13 -3
- package/package.json +7 -4
- package/src/components/common/item-selector/dropdown-list.js +1 -1
- package/src/components/common/item-selector/item-selector.js +6 -5
- package/src/components/common/portaled.js +1 -1
- package/src/components/map/map-popover.js +1 -1
- package/src/components/map-container.js +1 -1
- package/src/components/side-panel/layer-panel/custom-marker-categories-selector.js +33 -0
- package/src/constants/default-settings.js +8 -0
- package/src/layers/base-layer.js +9 -3
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carto/kepler.gl",
|
|
3
|
-
"author": "
|
|
4
|
-
"
|
|
5
|
-
"version": "0.0.60",
|
|
3
|
+
"author": "Shan He <shan@uber.com>",
|
|
4
|
+
"version": "0.0.61-count-aggregation.2",
|
|
6
5
|
"description": "kepler.gl is a webgl based application to visualize large scale location data in the browser",
|
|
7
6
|
"license": "MIT",
|
|
8
7
|
"main": "dist/index.js",
|
|
@@ -16,7 +15,7 @@
|
|
|
16
15
|
],
|
|
17
16
|
"repository": {
|
|
18
17
|
"type": "git",
|
|
19
|
-
"url": "https://github.com/
|
|
18
|
+
"url": "https://github.com/keplergl/kepler.gl.git"
|
|
20
19
|
},
|
|
21
20
|
"scripts": {
|
|
22
21
|
"install:example": "cd examples/demo-app && yarn",
|
|
@@ -270,6 +269,10 @@
|
|
|
270
269
|
"engines": {
|
|
271
270
|
"node": ">=12.0.0"
|
|
272
271
|
},
|
|
272
|
+
"maintainers": [
|
|
273
|
+
"Shan He <heshan0131@gmail.com>",
|
|
274
|
+
"Giuseppe Macri <gmacri@uber.com>"
|
|
275
|
+
],
|
|
273
276
|
"volta": {
|
|
274
277
|
"node": "12.19.0"
|
|
275
278
|
}
|
|
@@ -117,7 +117,7 @@ export default class DropdownList extends Component {
|
|
|
117
117
|
ref = createRef();
|
|
118
118
|
|
|
119
119
|
_resetState(callback) {
|
|
120
|
-
this.setState({currentOption: {}, submenuVisible: false, submenuPosition: {}}, callback);
|
|
120
|
+
// this.setState({currentOption: {}, submenuVisible: false, submenuPosition: {}}, callback);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
_onClick(option, subOption, event) {
|
|
@@ -96,13 +96,14 @@ const DropdownWrapper = styled.div`
|
|
|
96
96
|
left: 0;
|
|
97
97
|
z-index: ${props => props.theme.dropdownWrapperZ};
|
|
98
98
|
position: absolute;
|
|
99
|
-
bottom: ${props => (props.placement === 'top' ? props.theme.inputBoxHeight : 'auto')};
|
|
100
|
-
margin-top: ${props =>
|
|
101
|
-
props.placement === 'bottom' ? `${props.theme.dropdownWapperMargin}px` : 'auto'};
|
|
102
|
-
margin-bottom: ${props =>
|
|
103
|
-
props.placement === 'top' ? `${props.theme.dropdownWapperMargin}px` : 'auto'};
|
|
104
99
|
`;
|
|
105
100
|
|
|
101
|
+
// bottom: ${props => (props.placement === 'top' ? props.theme.inputBoxHeight : 'auto')};
|
|
102
|
+
// margin-top: ${props =>
|
|
103
|
+
// props.placement === 'bottom' ? `${props.theme.dropdownWapperMargin}px` : 'auto'};
|
|
104
|
+
// margin-bottom: ${props =>
|
|
105
|
+
// props.placement === 'top' ? `${props.theme.dropdownWapperMargin}px` : 'auto'};
|
|
106
|
+
|
|
106
107
|
// The item-selector component dismount all its children if you click outside of the component because of listensToClickOutside function.
|
|
107
108
|
// If you want to prevent this behaviour when you click on a child add this class to it.
|
|
108
109
|
// It is useful for example, when you add the child component on the top of tree with a Portal as dropdown-list does with item-selector-submenu
|
|
@@ -132,7 +132,7 @@ MapPopoverFactory.deps = [LayerHoverInfoFactory, CoordinateInfoFactory];
|
|
|
132
132
|
|
|
133
133
|
function zoomBetweenLimits(visibilityByZoom, zoom) {
|
|
134
134
|
if (visibilityByZoom) {
|
|
135
|
-
const roundedZoom = Math.
|
|
135
|
+
const roundedZoom = Math.round(zoom);
|
|
136
136
|
const currentZoomUnderMin = roundedZoom < visibilityByZoom?.min;
|
|
137
137
|
const currentZoomOverMax = roundedZoom > visibilityByZoom?.max;
|
|
138
138
|
if (currentZoomUnderMin || currentZoomOverMax) {
|
|
@@ -441,7 +441,7 @@ export default function MapContainerFactory(MapPopover, MapControl, Editor) {
|
|
|
441
441
|
) {
|
|
442
442
|
return true;
|
|
443
443
|
}
|
|
444
|
-
const currentZoomRange = Math.
|
|
444
|
+
const currentZoomRange = Math.round(mapState.zoom);
|
|
445
445
|
|
|
446
446
|
return (
|
|
447
447
|
layer.props.visibilityByZoom.min <= currentZoomRange &&
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright (c) 2022 Uber Technologies, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
// in the Software without restriction, including without limitation the rights
|
|
6
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
// furnished to do so, subject to the following conditions:
|
|
9
|
+
//
|
|
10
|
+
// The above copyright notice and this permission notice shall be included in
|
|
11
|
+
// all copies or substantial portions of the Software.
|
|
12
|
+
//
|
|
13
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
// THE SOFTWARE.
|
|
20
|
+
|
|
21
|
+
import React from 'react';
|
|
22
|
+
import {injectIntl} from 'react-intl';
|
|
23
|
+
|
|
24
|
+
CustomMarkerCategoriesSelectorFactory.deps = [];
|
|
25
|
+
function CustomMarkerCategoriesSelectorFactory() {
|
|
26
|
+
const CustomMarkerCategoriesSelector = () => {
|
|
27
|
+
return <div>Component replaced by cloud native</div>;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return injectIntl(CustomMarkerCategoriesSelector);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default CustomMarkerCategoriesSelectorFactory;
|
|
@@ -460,6 +460,7 @@ export const FIELD_TYPES_AGGREGATORS = {
|
|
|
460
460
|
date: null,
|
|
461
461
|
geojson: null,
|
|
462
462
|
integer: [
|
|
463
|
+
AGGREGATION_TYPES.count,
|
|
463
464
|
AGGREGATION_TYPES.average,
|
|
464
465
|
AGGREGATION_TYPES.maximum,
|
|
465
466
|
AGGREGATION_TYPES.minimum,
|
|
@@ -468,6 +469,7 @@ export const FIELD_TYPES_AGGREGATORS = {
|
|
|
468
469
|
AGGREGATION_TYPES.variance
|
|
469
470
|
],
|
|
470
471
|
real: [
|
|
472
|
+
AGGREGATION_TYPES.count,
|
|
471
473
|
AGGREGATION_TYPES.average,
|
|
472
474
|
AGGREGATION_TYPES.maximum,
|
|
473
475
|
AGGREGATION_TYPES.minimum,
|
|
@@ -481,6 +483,10 @@ export const FIELD_TYPES_AGGREGATORS = {
|
|
|
481
483
|
};
|
|
482
484
|
|
|
483
485
|
export const FIELD_AGGREGATORS = [
|
|
486
|
+
{
|
|
487
|
+
id: AGGREGATION_TYPES.count,
|
|
488
|
+
displayName: 'COUNT'
|
|
489
|
+
},
|
|
484
490
|
{
|
|
485
491
|
id: AGGREGATION_TYPES.average,
|
|
486
492
|
displayName: 'AVG'
|
|
@@ -525,6 +531,7 @@ export const linearFieldScaleFunctions = {
|
|
|
525
531
|
|
|
526
532
|
export const linearFieldAggrScaleFunctions = {
|
|
527
533
|
[CHANNEL_SCALES.colorAggr]: {
|
|
534
|
+
[AGGREGATION_TYPES.count]: [SCALE_TYPES.custom],
|
|
528
535
|
[AGGREGATION_TYPES.average]: [SCALE_TYPES.quantize, SCALE_TYPES.quantile, SCALE_TYPES.custom],
|
|
529
536
|
[AGGREGATION_TYPES.maximum]: [SCALE_TYPES.quantize, SCALE_TYPES.quantile, SCALE_TYPES.custom],
|
|
530
537
|
[AGGREGATION_TYPES.minimum]: [SCALE_TYPES.quantize, SCALE_TYPES.quantile, SCALE_TYPES.custom],
|
|
@@ -535,6 +542,7 @@ export const linearFieldAggrScaleFunctions = {
|
|
|
535
542
|
},
|
|
536
543
|
|
|
537
544
|
[CHANNEL_SCALES.sizeAggr]: {
|
|
545
|
+
[AGGREGATION_TYPES.count]: [SCALE_TYPES.linear, SCALE_TYPES.sqrt, SCALE_TYPES.log],
|
|
538
546
|
[AGGREGATION_TYPES.average]: [SCALE_TYPES.linear, SCALE_TYPES.sqrt, SCALE_TYPES.log],
|
|
539
547
|
[AGGREGATION_TYPES.maximum]: [SCALE_TYPES.linear, SCALE_TYPES.sqrt, SCALE_TYPES.log],
|
|
540
548
|
[AGGREGATION_TYPES.minimum]: [SCALE_TYPES.linear, SCALE_TYPES.sqrt, SCALE_TYPES.log],
|
package/src/layers/base-layer.js
CHANGED
|
@@ -975,10 +975,16 @@ class Layer {
|
|
|
975
975
|
.unknown(UNKNOWN_COLOR);
|
|
976
976
|
}
|
|
977
977
|
|
|
978
|
+
// for `count` aggregation, we domain is actually `[0, Infinity]` so it doesn't make sense
|
|
979
|
+
// to use it, so skip specyfying this domains
|
|
980
|
+
const domainIsInfinite = domain && (domain[0] === 0 && domain[1] === Infinity);
|
|
981
|
+
const scaleFactory = SCALE_FUNC[fixed ? 'linear' : scale];
|
|
978
982
|
// @ts-ignore d3-scale type
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
983
|
+
let result = scaleFactory();
|
|
984
|
+
if (domain && !domainIsInfinite) {
|
|
985
|
+
result = result.domain(domain);
|
|
986
|
+
}
|
|
987
|
+
return result.range(fixed ? domain : range);
|
|
982
988
|
}
|
|
983
989
|
|
|
984
990
|
/**
|