@evergis/react 3.1.110 → 3.1.111
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/react.esm.js
CHANGED
|
@@ -6070,40 +6070,85 @@ const TwoColumnContainerWrapper = styled(Flex) `
|
|
|
6070
6070
|
}
|
|
6071
6071
|
`;
|
|
6072
6072
|
|
|
6073
|
+
const useRenderContainerItem = (type, renderElement) => {
|
|
6074
|
+
const { config, layerInfo, selectedTabId, attributes } = useWidgetContext(type);
|
|
6075
|
+
return useCallback((elementConfig, attribute) => {
|
|
6076
|
+
const { id, options, style, children } = elementConfig || {};
|
|
6077
|
+
const { hideEmpty, innerTemplateStyle } = options || {};
|
|
6078
|
+
const hasUnits = children?.some(({ id }) => id === "units");
|
|
6079
|
+
const iconIndex = children?.findIndex(({ id }) => id === "icon");
|
|
6080
|
+
const icon = children?.[iconIndex];
|
|
6081
|
+
const hasIcon = !!icon;
|
|
6082
|
+
const elementChildren = elementConfig?.children?.map(child => ({
|
|
6083
|
+
type: "attributeValue",
|
|
6084
|
+
...child,
|
|
6085
|
+
attributeName: attribute,
|
|
6086
|
+
options: { noUnits: hasUnits, ...child.options },
|
|
6087
|
+
}));
|
|
6088
|
+
const attr = attribute
|
|
6089
|
+
? layerInfo?.layerAttributes?.find(({ attributeName }) => attributeName === attribute)
|
|
6090
|
+
: null;
|
|
6091
|
+
if (hasIcon) {
|
|
6092
|
+
elementChildren[iconIndex] = {
|
|
6093
|
+
...elementChildren[iconIndex],
|
|
6094
|
+
type: attr?.icon?.type?.toLowerCase(),
|
|
6095
|
+
value: attr?.icon?.resourceId || attr?.icon?.url || attr?.icon?.iconName,
|
|
6096
|
+
attributeName: null,
|
|
6097
|
+
};
|
|
6098
|
+
}
|
|
6099
|
+
const render = attribute
|
|
6100
|
+
? getRenderElement({
|
|
6101
|
+
config,
|
|
6102
|
+
elementConfig: {
|
|
6103
|
+
...elementConfig,
|
|
6104
|
+
children: elementChildren,
|
|
6105
|
+
},
|
|
6106
|
+
selectedTabId,
|
|
6107
|
+
attributes,
|
|
6108
|
+
layerInfo,
|
|
6109
|
+
type,
|
|
6110
|
+
})
|
|
6111
|
+
: renderElement;
|
|
6112
|
+
const value = render({ id: "value" });
|
|
6113
|
+
return {
|
|
6114
|
+
id,
|
|
6115
|
+
value,
|
|
6116
|
+
hideEmpty,
|
|
6117
|
+
style: innerTemplateStyle || style,
|
|
6118
|
+
hasIcon,
|
|
6119
|
+
hasUnits,
|
|
6120
|
+
render,
|
|
6121
|
+
};
|
|
6122
|
+
}, []);
|
|
6123
|
+
};
|
|
6124
|
+
|
|
6073
6125
|
const BASE_STYLE = {
|
|
6074
6126
|
marginBottom: "1rem",
|
|
6075
6127
|
};
|
|
6076
|
-
const OneColumnContainer = memo(({
|
|
6077
|
-
const
|
|
6078
|
-
const
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
const {
|
|
6082
|
-
const value = renderElement({ id: "value" });
|
|
6083
|
-
const hasUnits = elementConfig?.children?.some(({ id }) => id === "units");
|
|
6128
|
+
const OneColumnContainer = memo(({ type, elementConfig, renderElement }) => {
|
|
6129
|
+
const getRenderContainerItem = useRenderContainerItem(type, renderElement);
|
|
6130
|
+
const { options } = elementConfig || {};
|
|
6131
|
+
const { attributes: renderAttributes, innerTemplateStyle } = options || {};
|
|
6132
|
+
const renderContainer = useCallback((attribute) => {
|
|
6133
|
+
const { id, value, hideEmpty, style, hasUnits, render } = getRenderContainerItem(elementConfig, attribute);
|
|
6084
6134
|
if (!value && hideEmpty)
|
|
6085
6135
|
return null;
|
|
6086
|
-
return (jsxs(Container, { id: id, isColumn: true, style: { ...BASE_STYLE, ...(innerTemplateStyle || style) }, children: [jsxs(ContainerAlias, { hasBottomMargin: true, children: [
|
|
6087
|
-
}
|
|
6088
|
-
return (jsx(Fragment$1, { children:
|
|
6089
|
-
const containerData = renderContainer(attribute);
|
|
6090
|
-
if (!containerData)
|
|
6091
|
-
return null;
|
|
6092
|
-
const { render, hasUnits, id, style } = containerData;
|
|
6093
|
-
return (jsxs(Container, { id: id, isColumn: true, style: { ...BASE_STYLE, ...(elementConfig?.options?.innerTemplateStyle || style) }, children: [jsxs(ContainerAlias, { hasBottomMargin: true, children: [render({ id: "alias" }), render({ id: "tooltip" })] }), jsxs(ContainerValue, { children: [render({ id: "value" }), hasUnits && jsx(ContainerUnits, { children: render({ id: "units" }) })] })] }, attribute));
|
|
6094
|
-
}) }));
|
|
6136
|
+
return (jsxs(Container, { id: id, isColumn: true, style: { ...BASE_STYLE, ...(innerTemplateStyle || style) }, children: [jsxs(ContainerAlias, { hasBottomMargin: true, children: [render({ id: "alias" }), render({ id: "tooltip" })] }), jsxs(ContainerValue, { children: [value, hasUnits && jsx(ContainerUnits, { children: render({ id: "units" }) })] })] }));
|
|
6137
|
+
}, [getRenderContainerItem, elementConfig, innerTemplateStyle]);
|
|
6138
|
+
return renderAttributes?.length ? (jsx(Fragment$1, { children: renderAttributes.map(attribute => renderContainer(attribute)) })) : (renderContainer());
|
|
6095
6139
|
});
|
|
6096
6140
|
|
|
6097
|
-
const TwoColumnContainer = memo(({
|
|
6098
|
-
const
|
|
6099
|
-
const
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6141
|
+
const TwoColumnContainer = memo(({ elementConfig, type, renderElement }) => {
|
|
6142
|
+
const getRenderContainerItem = useRenderContainerItem(type, renderElement);
|
|
6143
|
+
const { options } = elementConfig || {};
|
|
6144
|
+
const { attributes: renderAttributes, innerTemplateStyle } = options || {};
|
|
6145
|
+
const renderContainer = useCallback((attribute) => {
|
|
6146
|
+
const { id, value, hideEmpty, style, hasIcon, hasUnits, render } = getRenderContainerItem(elementConfig, attribute);
|
|
6147
|
+
if (!value && hideEmpty)
|
|
6148
|
+
return null;
|
|
6149
|
+
return (jsxs(TwoColumnContainerWrapper, { id: id, style: innerTemplateStyle || style, children: [jsxs(ContainerAlias, { children: [hasIcon && jsx(ContainerAliasIcon, { children: render({ id: "icon" }) }), render({ id: "alias" }), render({ id: "tooltip" })] }), jsxs(ContainerValue, { big: true, children: [value, hasUnits && jsx(ContainerUnits, { children: render({ id: "units" }) })] })] }, attribute));
|
|
6150
|
+
}, [getRenderContainerItem, elementConfig]);
|
|
6151
|
+
return renderAttributes?.length ? (jsx(Fragment$1, { children: renderAttributes.map(attribute => renderContainer(attribute)) })) : (renderContainer());
|
|
6107
6152
|
});
|
|
6108
6153
|
|
|
6109
6154
|
const InnerContainerWrapper = styled.div `
|
|
@@ -6610,7 +6655,6 @@ const PagesContainer = memo(({ type = WidgetType.Dashboard, noBorders }) => {
|
|
|
6610
6655
|
setSelectedTabId,
|
|
6611
6656
|
type,
|
|
6612
6657
|
]);
|
|
6613
|
-
console.info("PagesContainer", config, filteredChildren);
|
|
6614
6658
|
return (jsx(Container, { id: getRootElementId(type), style: { width }, isMain: true, isColumn: isColumn, noBorders: noBorders, children: jsx(ContainerChildren, { type: type, items: filteredChildren, isMain: true, renderElement: renderElement }) }));
|
|
6615
6659
|
});
|
|
6616
6660
|
|
|
@@ -7658,9 +7702,9 @@ var img$1 = "data:image/svg+xml,%3csvg width='32' height='32' viewBox='0 0 32 32
|
|
|
7658
7702
|
|
|
7659
7703
|
var img = "data:image/svg+xml,%3csvg width='32' height='32' viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3crect width='32' height='32' fill='transparent'/%3e %3crect x='8' y='8' width='16' height='16' rx='2' fill='url(%23paint0_linear_6459_10399)'/%3e %3cdefs%3e %3clinearGradient id='paint0_linear_6459_10399' x1='8' y1='8' x2='24' y2='24' gradientUnits='userSpaceOnUse'%3e %3cstop stop-color='%230084D6'/%3e %3cstop offset='0.489583' stop-color='%230084D6'/%3e %3cstop offset='0.489683' stop-color='%2305A9FF'/%3e %3cstop offset='0.921875' stop-color='%2305A9FF'/%3e %3c/linearGradient%3e %3c/defs%3e%3c/svg%3e";
|
|
7660
7704
|
|
|
7661
|
-
const LayerIcon = ({ layerInfo }) => {
|
|
7705
|
+
const LayerIcon = ({ layerInfo, error }) => {
|
|
7662
7706
|
const renderSymbol = useMemo(() => {
|
|
7663
|
-
if (!layerInfo.geometryType) {
|
|
7707
|
+
if (!layerInfo.geometryType || error) {
|
|
7664
7708
|
return (jsx(AlertIconContainer, { children: jsx(Icon, { kind: "warning" }) }));
|
|
7665
7709
|
}
|
|
7666
7710
|
switch (layerInfo.geometryType) {
|
|
@@ -10744,14 +10788,14 @@ const useMultipleAttributesRender = (config, elementConfig, type, renderElement)
|
|
|
10744
10788
|
const { selectedTabId, layerInfo, attributes } = useWidgetContext(type);
|
|
10745
10789
|
const { attributes: renderAttributes, attributesExclude } = elementConfig?.options || {};
|
|
10746
10790
|
const getAttributesToRender = useCallback(() => {
|
|
10747
|
-
if (renderAttributes
|
|
10791
|
+
if (renderAttributes) {
|
|
10748
10792
|
return renderAttributes;
|
|
10749
10793
|
}
|
|
10750
|
-
|
|
10751
|
-
|
|
10794
|
+
if (attributesExclude) {
|
|
10795
|
+
const allAttributes = attributes?.map(attr => attr.name) || [];
|
|
10752
10796
|
return allAttributes.filter(attr => !attributesExclude.includes(attr));
|
|
10753
10797
|
}
|
|
10754
|
-
return
|
|
10798
|
+
return null;
|
|
10755
10799
|
}, [renderAttributes, attributesExclude, attributes]);
|
|
10756
10800
|
const renderContainer = useCallback((attribute) => {
|
|
10757
10801
|
const { id, options, style, children } = elementConfig || {};
|