@evergis/react 3.1.19 → 3.1.21
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/index.js +16 -4
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +16 -4
- package/dist/react.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3721,17 +3721,19 @@ const formatNumberValue = (stringFormat, value, type, noUnits = false) => {
|
|
|
3721
3721
|
};
|
|
3722
3722
|
const formatAttributeValue = ({ t, type, value, stringFormat, noUnits = false }) => {
|
|
3723
3723
|
if (type === api.AttributeType.Point) {
|
|
3724
|
-
if (!
|
|
3724
|
+
if (!stringFormat?.format || !value)
|
|
3725
3725
|
return null;
|
|
3726
3726
|
const { coordinates } = value;
|
|
3727
3727
|
return formatPointValue({ t, stringFormat, value: coordinates });
|
|
3728
3728
|
}
|
|
3729
3729
|
if (type === api.AttributeType.DateTime) {
|
|
3730
|
-
if (!
|
|
3730
|
+
if (!stringFormat?.format || !value)
|
|
3731
3731
|
return null;
|
|
3732
3732
|
return formatDateValue(stringFormat, value);
|
|
3733
3733
|
}
|
|
3734
3734
|
if (numberFormatTypes.includes(type) && !isNaN(value)) {
|
|
3735
|
+
if (!stringFormat?.format)
|
|
3736
|
+
return value.toString();
|
|
3735
3737
|
return formatNumberValue(stringFormat, value, type, noUnits);
|
|
3736
3738
|
}
|
|
3737
3739
|
if (type === api.AttributeType.Json) {
|
|
@@ -6467,16 +6469,22 @@ const RoundedBackgroundContainer = React.memo(({ type, elementConfig, feature, r
|
|
|
6467
6469
|
});
|
|
6468
6470
|
const { options, style, children } = elementConfig || {};
|
|
6469
6471
|
const { maxLength, center, fontColor, innerTemplateStyle, inlineUnits, big, bigIcon, hideEmpty, colorAttribute } = options || {};
|
|
6472
|
+
const iconElement = children?.find(({ id }) => id === "icon");
|
|
6470
6473
|
const aliasElement = children?.find(({ id }) => id === "alias");
|
|
6471
6474
|
const unitsElement = children?.find(({ id }) => id === "units");
|
|
6472
6475
|
const valueElement = children?.find(({ id }) => id === "value");
|
|
6473
6476
|
const value = renderElement({ id: "value" });
|
|
6474
6477
|
const color = React.useMemo(() => attributes?.find(({ name }) => name === colorAttribute)?.value || fontColor, [attributes, colorAttribute, fontColor]);
|
|
6478
|
+
const renderIcon = React.useMemo(() => {
|
|
6479
|
+
if (!iconElement)
|
|
6480
|
+
return null;
|
|
6481
|
+
return (jsxRuntime.jsx(uilibGl.FlexSpan, { width: iconElement.options?.width || "1rem", alignItems: "center", mr: "0.5rem", children: renderElement({ id: "icon", wrap: false }) }));
|
|
6482
|
+
}, [iconElement, renderElement]);
|
|
6475
6483
|
const renderAlias = React.useMemo(() => (jsxRuntime.jsx(ContainerAlias, { style: aliasElement?.style, children: jsxRuntime.jsx(TextTrim, { maxLength: maxLength || ALIAS_DEFAULT_MAX_LENGTH, children: renderElement({ id: "alias", wrap: false }) }) })), [aliasElement?.style, maxLength, renderElement]);
|
|
6476
6484
|
const renderValue = React.useMemo(() => (jsxRuntime.jsxs(ContainerValue, { style: valueElement?.style, big: true, children: [value, !!unitsElement && (jsxRuntime.jsx(ContainerUnits, { style: unitsElement?.style, children: renderElement({ id: "units" }) }))] })), [valueElement?.style, value, unitsElement, renderElement]);
|
|
6477
6485
|
if (!value && hideEmpty)
|
|
6478
6486
|
return null;
|
|
6479
|
-
return (jsxRuntime.jsxs(RoundedBackgroundContainerWrapper, { style: innerTemplateStyle || style, "$center": center, "$color": color, "$inlineUnits": inlineUnits, "$big": big, "$bigIcon": bigIcon, children: [jsxRuntime.jsxs(ContainerIconValue, { children: [
|
|
6487
|
+
return (jsxRuntime.jsxs(RoundedBackgroundContainerWrapper, { style: innerTemplateStyle || style, "$center": center, "$color": color, "$inlineUnits": inlineUnits, "$big": big, "$bigIcon": bigIcon, children: [jsxRuntime.jsxs(ContainerIconValue, { children: [renderIcon, big ? renderAlias : renderValue] }), big ? renderValue : renderAlias] }));
|
|
6480
6488
|
});
|
|
6481
6489
|
|
|
6482
6490
|
const AddFeatureContainer = React.memo(({ elementConfig }) => {
|
|
@@ -9187,6 +9195,9 @@ const Chart = React.memo(({ config, element, elementConfig, type, renderElement
|
|
|
9187
9195
|
const formatTooltipValue = React.useCallback((value, name) => isRelated
|
|
9188
9196
|
? tooltipValueFromRelatedFeatures(t, value, relatedAttributes, data[0]?.layerInfo)
|
|
9189
9197
|
: tooltipValueFromAttributes(t, value, name, formattedAttributes), [data, formattedAttributes, isRelated, relatedAttributes]);
|
|
9198
|
+
const customYAxisLeft = React.useCallback(yAxisLeft => {
|
|
9199
|
+
yAxisLeft.tickFormat((index) => index);
|
|
9200
|
+
}, []);
|
|
9190
9201
|
const customXAxisBottom = React.useCallback((xAxisBottom, data) => {
|
|
9191
9202
|
xAxisBottom.tickFormat((index) => (showMarkers
|
|
9192
9203
|
? index % (showMarkers || 1) === 0
|
|
@@ -9240,12 +9251,13 @@ const Chart = React.memo(({ config, element, elementConfig, type, renderElement
|
|
|
9240
9251
|
bottom: markers?.length ? 20 : markersMargin,
|
|
9241
9252
|
left: markersMargin
|
|
9242
9253
|
};
|
|
9243
|
-
return (jsxRuntime.jsx(BarChartWrapper, { height: height + margin.bottom, children: jsxRuntime.jsx(BarChartContainer, { children: jsxRuntime.jsx(StyledBarChart, { data: barChartData, colors: getColorsFromFilterItems(data[0]?.items, defaultColor, formatFilterColor), minValue: getMinValueFromFilterItems(data[0]?.items), markers: markers, width: +width, height: height, barWidth: barWidth, barPadding: padding,
|
|
9254
|
+
return (jsxRuntime.jsx(BarChartWrapper, { height: height + margin.bottom, children: jsxRuntime.jsx(BarChartContainer, { children: jsxRuntime.jsx(StyledBarChart, { data: barChartData, colors: getColorsFromFilterItems(data[0]?.items, defaultColor, formatFilterColor), minValue: getMinValueFromFilterItems(data[0]?.items), markers: markers, width: +width, height: height, barWidth: barWidth, barPadding: padding, customYAxisLeft: customYAxisLeft, customXAxisBottom: xAxisBottom => customXAxisBottom(xAxisBottom, barChartData), customYAxis: axis => !showLabels && axis.remove(), customBars: ({ bars }) => {
|
|
9244
9255
|
bars.attr("rx", radius);
|
|
9245
9256
|
bars.attr("ry", radius);
|
|
9246
9257
|
}, margin: margin, xAxisPadding: 0, yAxisPadding: 0, formatTooltipValue: formatTooltipValue, formatTooltipName: formatTooltipName, hideTooltipGroupName: true, dynamicTooltipEnable: true, isBarTooltip: true, onBarClick: filterName ? item => onFilter(item.name) : undefined }) }) }));
|
|
9247
9258
|
}, [
|
|
9248
9259
|
customXAxisBottom,
|
|
9260
|
+
customYAxisLeft,
|
|
9249
9261
|
element,
|
|
9250
9262
|
isLineChart,
|
|
9251
9263
|
isStackBar,
|