@evergis/react 4.0.32 → 4.0.34
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.
|
@@ -13,6 +13,7 @@ export declare const DEFAULT_CHART_WIDTH = 154;
|
|
|
13
13
|
export declare const MAX_CHART_WIDTH = 300;
|
|
14
14
|
export declare const DEFAULT_CHART_ANGLE = 4;
|
|
15
15
|
export declare const DEFAULT_CHART_HEIGHT = 90;
|
|
16
|
+
export declare const STACK_BAR_TOTAL_HEIGHT = 20;
|
|
16
17
|
export declare const FILTER_PREFIX = "%";
|
|
17
18
|
export declare const PROVIDER_PREFIX = "$";
|
|
18
19
|
export declare enum ProviderPrefix {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dispatch, MutableRefObject, PropsWithChildren, SetStateAction } from 'react';
|
|
2
|
-
import { Map as MaplibreGLMap } from 'maplibre-gl';
|
|
2
|
+
import { Map as MaplibreGLMap, StyleSpecification } from 'maplibre-gl';
|
|
3
3
|
import { default as MapboxDraw } from '@mapbox/mapbox-gl-draw';
|
|
4
4
|
export declare enum BaseMapTheme {
|
|
5
5
|
Light = "light",
|
|
@@ -7,10 +7,9 @@ export declare enum BaseMapTheme {
|
|
|
7
7
|
}
|
|
8
8
|
export interface BaseMapItem {
|
|
9
9
|
name: string;
|
|
10
|
-
source: string;
|
|
11
|
-
preview?: string;
|
|
12
|
-
imgSrc?: string;
|
|
10
|
+
source: string | StyleSpecification;
|
|
13
11
|
title: string;
|
|
12
|
+
preview?: string;
|
|
14
13
|
theme?: BaseMapTheme;
|
|
15
14
|
opacity?: number;
|
|
16
15
|
color?: string;
|
package/dist/index.js
CHANGED
|
@@ -3436,6 +3436,7 @@ const DEFAULT_CHART_WIDTH = 154;
|
|
|
3436
3436
|
const MAX_CHART_WIDTH = 300;
|
|
3437
3437
|
const DEFAULT_CHART_ANGLE = 4;
|
|
3438
3438
|
const DEFAULT_CHART_HEIGHT = 90;
|
|
3439
|
+
const STACK_BAR_TOTAL_HEIGHT = 20;
|
|
3439
3440
|
const FILTER_PREFIX = "%";
|
|
3440
3441
|
const PROVIDER_PREFIX = "$";
|
|
3441
3442
|
exports.ProviderPrefix = void 0;
|
|
@@ -11396,16 +11397,22 @@ const StackBar = ({ data, filterName, type, alias, options, renderElement, rende
|
|
|
11396
11397
|
const { t } = useGlobalContext();
|
|
11397
11398
|
const { hasAnyFilter, isFiltered, onFilter } = useWidgetFilters(type, filterName, data?.[0]?.items);
|
|
11398
11399
|
const { items, layerInfo, attributeName } = data?.[0] || {};
|
|
11399
|
-
const attribute = layerInfo?.configuration?.attributesConfiguration?.attributes[attributeName]
|
|
11400
|
+
const attribute = layerInfo?.configuration?.attributesConfiguration?.attributes[attributeName]
|
|
11401
|
+
?? layerInfo?.configuration
|
|
11402
|
+
?.attributesConfiguration
|
|
11403
|
+
?.attributes
|
|
11404
|
+
?.find(({ attributeName: name }) => name === attributeName);
|
|
11400
11405
|
const units = attribute?.stringFormat?.unitsLabel;
|
|
11401
11406
|
const total = React.useMemo(() => items?.reduce((result, { value }) => result + Number(value), 0) || 0, [items]);
|
|
11402
11407
|
const getWidth = React.useCallback(value => ((Number(value) / total) * 100).toFixed(2), [total]);
|
|
11403
11408
|
const renderGroupTooltip = React.useMemo(() => (jsxRuntime.jsx(uilibGl.ThemeProvider, { children: jsxRuntime.jsx(ChartTooltipTable, { cellPadding: 0, cellSpacing: 0, children: items?.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))) }) })), [items]);
|
|
11404
11409
|
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]);
|
|
11405
11410
|
const renderItems = React.useMemo(() => (jsxRuntime.jsx(jsxRuntime.Fragment, { children: items?.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, items, renderItem, renderTooltip]);
|
|
11406
|
-
if (!total
|
|
11411
|
+
if (!total)
|
|
11407
11412
|
return null;
|
|
11408
|
-
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:
|
|
11413
|
+
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
|
|
11414
|
+
? formatAttributeValue({ t, type: attribute.type, value: total, stringFormat: attribute.stringFormat, noUnits: true })
|
|
11415
|
+
: total }), !!units && jsxRuntime.jsx(StackBarUnits, { children: units })] }))] })), groupTooltip ? (jsxRuntime.jsx(uilibGl.Tooltip, { placement: "top", arrow: true, content: renderGroupTooltip, children: ref => jsxRuntime.jsx(StackBarContainer, { ref: ref, children: renderItems }) })) : (jsxRuntime.jsx(StackBarContainer, { children: renderItems }))] }));
|
|
11409
11416
|
};
|
|
11410
11417
|
|
|
11411
11418
|
const Chart = React.memo(({ config, element, elementConfig, type, renderElement }) => {
|
|
@@ -11548,7 +11555,8 @@ const Chart = React.memo(({ config, element, elementConfig, type, renderElement
|
|
|
11548
11555
|
}, customYAxis: yAxis => yAxis.ticks(4), renderTooltip: renderLineChartTooltip, customize: customize, dotSnapping: dotSnapping, dynamicTooltipEnable: true, stackedTooltip: true, tooltipClassName: "dashboardLineChartTooltip", drawGridX: !isHidedY, margin: margin })] }));
|
|
11549
11556
|
}
|
|
11550
11557
|
if (isStackBar) {
|
|
11551
|
-
|
|
11558
|
+
const stackBarHeight = showTotal ? height + STACK_BAR_TOTAL_HEIGHT : height;
|
|
11559
|
+
return (jsxRuntime.jsx(AnyChartWrapper, { height: stackBarHeight, children: jsxRuntime.jsx(StackBar, { data: data, filterName: filterName, type: type, alias: elementConfig?.children?.find(child => child.id === "alias"), options: options, renderTooltip: renderPieChartTooltip, renderElement: renderElement }) }));
|
|
11552
11560
|
}
|
|
11553
11561
|
if (isPieChart) {
|
|
11554
11562
|
return (jsxRuntime.jsx(AnyChartWrapper, { height: height, children: jsxRuntime.jsx(charts.PieChart, { data: (data[0]?.items
|
|
@@ -11566,6 +11574,7 @@ const Chart = React.memo(({ config, element, elementConfig, type, renderElement
|
|
|
11566
11574
|
}, [
|
|
11567
11575
|
customXAxisBottom,
|
|
11568
11576
|
customYAxisLeft,
|
|
11577
|
+
dotSnapping,
|
|
11569
11578
|
element,
|
|
11570
11579
|
isLineChart,
|
|
11571
11580
|
isStackBar,
|
|
@@ -11578,7 +11587,6 @@ const Chart = React.memo(({ config, element, elementConfig, type, renderElement
|
|
|
11578
11587
|
width,
|
|
11579
11588
|
barWidth,
|
|
11580
11589
|
showLabels,
|
|
11581
|
-
showMarkers,
|
|
11582
11590
|
padding,
|
|
11583
11591
|
formatTooltipValue,
|
|
11584
11592
|
formatTooltipName,
|
|
@@ -12460,6 +12468,7 @@ exports.PresentationWrapper = PresentationWrapper;
|
|
|
12460
12468
|
exports.ProgressContainer = ProgressContainer;
|
|
12461
12469
|
exports.RoundedBackgroundContainer = RoundedBackgroundContainer;
|
|
12462
12470
|
exports.SERVER_NOTIFICATION_EVENT = SERVER_NOTIFICATION_EVENT;
|
|
12471
|
+
exports.STACK_BAR_TOTAL_HEIGHT = STACK_BAR_TOTAL_HEIGHT;
|
|
12463
12472
|
exports.ServerNotificationsContext = ServerNotificationsContext;
|
|
12464
12473
|
exports.ServerNotificationsProvider = ServerNotificationsProvider;
|
|
12465
12474
|
exports.SlideshowContainer = SlideshowContainer;
|