@evergis/react 4.0.34 → 4.0.36
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/Dashboard/containers/TaskContainer/utils/buildEmptyFiltersFromResponse.d.ts +2 -0
- package/dist/components/Dashboard/types.d.ts +2 -0
- package/dist/hooks/map/useZoomToFeatures.d.ts +2 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +5 -4
- package/dist/react.esm.js.map +1 -1
- package/package.json +4 -4
|
@@ -167,6 +167,7 @@ export interface ConfigOptions {
|
|
|
167
167
|
expandedLayers?: boolean;
|
|
168
168
|
modalId?: string;
|
|
169
169
|
url?: string;
|
|
170
|
+
maxZoomTo?: number;
|
|
170
171
|
customFeatureSelect?: CustomFeatureSelect;
|
|
171
172
|
}
|
|
172
173
|
export interface ConfigDataSource {
|
|
@@ -233,6 +234,7 @@ export interface ConfigLayer {
|
|
|
233
234
|
searchFields?: string[];
|
|
234
235
|
minScale?: number;
|
|
235
236
|
maxScale?: number;
|
|
237
|
+
maxZoomTo?: number;
|
|
236
238
|
hiddenAttributes?: string[];
|
|
237
239
|
customFeatureSelect?: CustomFeatureSelect;
|
|
238
240
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { FeatureDc } from '@evergis/api';
|
|
2
|
-
|
|
2
|
+
import { FitBoundsOptions } from 'maplibre-gl';
|
|
3
|
+
export declare const useZoomToFeatures: () => (features?: FeatureDc[], options?: FitBoundsOptions) => void;
|
package/dist/index.js
CHANGED
|
@@ -5342,7 +5342,7 @@ const useRedrawLayer = () => {
|
|
|
5342
5342
|
|
|
5343
5343
|
const useZoomToFeatures = () => {
|
|
5344
5344
|
const { map } = useMapContext();
|
|
5345
|
-
return React.useCallback((features,
|
|
5345
|
+
return React.useCallback((features, options) => {
|
|
5346
5346
|
if (!features) {
|
|
5347
5347
|
return;
|
|
5348
5348
|
}
|
|
@@ -5350,7 +5350,7 @@ const useZoomToFeatures = () => {
|
|
|
5350
5350
|
type: "FeatureCollection",
|
|
5351
5351
|
features: features,
|
|
5352
5352
|
});
|
|
5353
|
-
map.current.fitBounds(currentFeatureCenter, { padding: padding ?? 150 });
|
|
5353
|
+
map.current.fitBounds(currentFeatureCenter, { ...options, padding: options?.padding ?? 150 });
|
|
5354
5354
|
}, [map]);
|
|
5355
5355
|
};
|
|
5356
5356
|
|
|
@@ -11404,10 +11404,11 @@ const StackBar = ({ data, filterName, type, alias, options, renderElement, rende
|
|
|
11404
11404
|
?.find(({ attributeName: name }) => name === attributeName);
|
|
11405
11405
|
const units = attribute?.stringFormat?.unitsLabel;
|
|
11406
11406
|
const total = React.useMemo(() => items?.reduce((result, { value }) => result + Number(value), 0) || 0, [items]);
|
|
11407
|
+
const visibleItems = React.useMemo(() => items?.filter(({ value }) => Number(value) > 0), [items]);
|
|
11407
11408
|
const getWidth = React.useCallback(value => ((Number(value) / total) * 100).toFixed(2), [total]);
|
|
11408
|
-
const renderGroupTooltip = React.useMemo(() => (jsxRuntime.jsx(uilibGl.ThemeProvider, { children: jsxRuntime.jsx(ChartTooltipTable, { cellPadding: 0, cellSpacing: 0, children:
|
|
11409
|
+
const renderGroupTooltip = React.useMemo(() => (jsxRuntime.jsx(uilibGl.ThemeProvider, { children: jsxRuntime.jsx(ChartTooltipTable, { cellPadding: 0, cellSpacing: 0, children: visibleItems?.map(({ name, value, color }, index) => (jsxRuntime.jsxs("tr", { children: [jsxRuntime.jsx("td", { children: jsxRuntime.jsxs(ChartTooltip, { alignItems: "center", children: [jsxRuntime.jsx(ChartTooltipColor, { "$color": color }), jsxRuntime.jsx(ChartTooltipName, { children: name })] }) }), jsxRuntime.jsx("td", { children: value })] }, index))) }) })), [visibleItems]);
|
|
11409
11410
|
const renderItem = React.useCallback(({ name, value, color }, ref) => (jsxRuntime.jsx(StackBarSection, { ref: ref, "$width": getWidth(value), "$height": height, "$color": color, cornerRadius: cornerRadius, hasAnyFilter: hasAnyFilter, isFiltered: isFiltered(name), onClick: filterName ? () => onFilter(name) : undefined })), [cornerRadius, filterName, getWidth, hasAnyFilter, height, isFiltered, onFilter]);
|
|
11410
|
-
const renderItems = React.useMemo(() => (jsxRuntime.jsx(jsxRuntime.Fragment, { children:
|
|
11411
|
+
const renderItems = React.useMemo(() => (jsxRuntime.jsx(jsxRuntime.Fragment, { children: visibleItems?.map((item, index) => (jsxRuntime.jsx(React.Fragment, { children: groupTooltip ? (renderItem(item)) : (jsxRuntime.jsx(uilibGl.ThemeProvider, { children: jsxRuntime.jsx(uilibGl.Tooltip, { placement: "top", arrow: true, content: renderTooltip([item]), children: ref => renderItem(item, ref) }) })) }, index))) })), [groupTooltip, visibleItems, renderItem, renderTooltip]);
|
|
11411
11412
|
if (!total)
|
|
11412
11413
|
return null;
|
|
11413
11414
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [(alias || showTotal) && (jsxRuntime.jsxs(StackBarHeader, { children: [jsxRuntime.jsx(StackBarAlias, { children: renderElement({ id: "alias" }) }), showTotal && (jsxRuntime.jsxs(StackBarTotal, { children: [jsxRuntime.jsx(StackBarValue, { children: attribute
|