@longline/aqua-ui 1.0.69 → 1.0.71

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.
@@ -51,6 +51,16 @@ interface IProps {
51
51
  * @default false
52
52
  */
53
53
  clickZoom?: boolean;
54
+ /**
55
+ * Minimum zoom level at which to show markers.
56
+ * @default 0
57
+ */
58
+ minZoom?: number;
59
+ /**
60
+ * Maximum zoom level at which to show markers.
61
+ * @default 99
62
+ */
63
+ maxZoom?: number;
54
64
  }
55
65
  /**
56
66
  * A `ClusterLayer` manages its own `Source`. It does not takes GeoJSON, but a list of objects which must at least have
@@ -75,5 +85,5 @@ interface IProps {
75
85
  * </Map>
76
86
  * ```
77
87
  */
78
- declare const ClusterLayer: ({ relativeSize, radius, clusterRadius, clusterMaxZoom, ringFields, clickZoom, ...props }: IProps) => React.JSX.Element;
88
+ declare const ClusterLayer: ({ relativeSize, radius, clusterRadius, clusterMaxZoom, minZoom, maxZoom, ringFields, clickZoom, ...props }: IProps) => React.JSX.Element;
79
89
  export { ClusterLayer };
@@ -78,7 +78,7 @@ var ClusterLayerBase = function (_a) {
78
78
  });
79
79
  };
80
80
  return (React.createElement(Source, { id: sourceId, type: 'geojson', data: itemsToFeatures, cluster: true, clusterRadius: clusterRadius, clusterMaxZoom: clusterMaxZoom, clusterProperties: __assign({}, clusterProperties) },
81
- React.createElement(HtmlMarkerLayer, { sourceId: sourceId, idField: "cluster_id" }, function (markerProps) {
81
+ React.createElement(HtmlMarkerLayer, { sourceId: sourceId, idField: "cluster_id", minZoom: props.minZoom, maxZoom: props.maxZoom }, function (markerProps) {
82
82
  return React.createElement(ClusterMarker, __assign({ relativeSize: relativeSize, radius: radius, value: props.aggregation ? markerProps['sum'] : markerProps['point_count'], ringValues: ringFields.map(function (f) { return markerProps[f]; }), onClick: clickZoom ? function () { return handleClick(markerProps.longitude, markerProps.latitude, markerProps.cluster_id); } : null }, markerProps));
83
83
  })));
84
84
  };
@@ -106,13 +106,13 @@ var ClusterLayerBase = function (_a) {
106
106
  * ```
107
107
  */
108
108
  var ClusterLayer = function (_a) {
109
- var _b = _a.relativeSize, relativeSize = _b === void 0 ? 0 : _b, _c = _a.radius, radius = _c === void 0 ? 24 : _c, _d = _a.clusterRadius, clusterRadius = _d === void 0 ? 80 : _d, _e = _a.clusterMaxZoom, clusterMaxZoom = _e === void 0 ? 18 : _e, ringFields = _a.ringFields, _f = _a.clickZoom, clickZoom = _f === void 0 ? false : _f, props = __rest(_a, ["relativeSize", "radius", "clusterRadius", "clusterMaxZoom", "ringFields", "clickZoom"]);
110
- var _g = React.useState(0), key = _g[0], setKey = _g[1];
109
+ var _b = _a.relativeSize, relativeSize = _b === void 0 ? 0 : _b, _c = _a.radius, radius = _c === void 0 ? 24 : _c, _d = _a.clusterRadius, clusterRadius = _d === void 0 ? 80 : _d, _e = _a.clusterMaxZoom, clusterMaxZoom = _e === void 0 ? 18 : _e, _f = _a.minZoom, minZoom = _f === void 0 ? 0 : _f, _g = _a.maxZoom, maxZoom = _g === void 0 ? 99 : _g, ringFields = _a.ringFields, _h = _a.clickZoom, clickZoom = _h === void 0 ? false : _h, props = __rest(_a, ["relativeSize", "radius", "clusterRadius", "clusterMaxZoom", "minZoom", "maxZoom", "ringFields", "clickZoom"]);
110
+ var _j = React.useState(0), key = _j[0], setKey = _j[1];
111
111
  // When aggregation changes, we mount a whole new component. Mapbox does not
112
112
  // appear to deal with changes to clusterProperties well.
113
113
  React.useEffect(function () {
114
114
  setKey(Date.now());
115
115
  }, [props.aggregation, ringFields]);
116
- return React.createElement(ClusterLayerBase, __assign({ key: key, relativeSize: relativeSize, radius: radius, clusterRadius: clusterRadius, clusterMaxZoom: clusterMaxZoom, ringFields: ringFields, clickZoom: clickZoom }, props));
116
+ return React.createElement(ClusterLayerBase, __assign({ key: key, relativeSize: relativeSize, radius: radius, clusterRadius: clusterRadius, clusterMaxZoom: clusterMaxZoom, minZoom: minZoom, maxZoom: maxZoom, ringFields: ringFields, clickZoom: clickZoom }, props));
117
117
  };
118
118
  export { ClusterLayer };
@@ -0,0 +1 @@
1
+ export * from './ClusterLayer';
@@ -0,0 +1 @@
1
+ export * from './ClusterLayer';
@@ -44,6 +44,9 @@ import { Marker } from 'mapbox-gl';
44
44
  * a `props` object, which will be the properties from each GeoJSON feature for which
45
45
  * a marker is rendered.
46
46
  *
47
+ * The `minZoom` and `maxZoom` properties can be used to make markers appear only
48
+ * within a range of zoom levels.
49
+ *
47
50
  * ```tsx
48
51
  * // featureCollection has a property "id" with unique values
49
52
  * <Source id="mysource" type="geojson" data={featureCollection}>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longline/aqua-ui",
3
- "version": "1.0.69",
3
+ "version": "1.0.71",
4
4
  "description": "AquaUI",
5
5
  "author": "Alexander van Oostenrijk / Longline Environment",
6
6
  "license": "Commercial",