@evergis/react 3.1.109 → 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,20 +6070,9 @@ const TwoColumnContainerWrapper = styled(Flex) `
6070
6070
  }
6071
6071
  `;
6072
6072
 
6073
- const OneColumnContainer = memo(({ elementConfig, renderElement }) => {
6074
- const { id, options, style } = elementConfig || {};
6075
- const { innerTemplateStyle, hideEmpty } = options || {};
6076
- const value = renderElement({ id: "value" });
6077
- const hasUnits = elementConfig?.children?.some(({ id }) => id === "units");
6078
- if (!value && hideEmpty)
6079
- return null;
6080
- return (jsxs(Container, { id: id, isColumn: true, style: innerTemplateStyle || style, children: [jsxs(ContainerAlias, { hasBottomMargin: true, children: [renderElement({ id: "alias" }), renderElement({ id: "tooltip" })] }), jsxs(ContainerValue, { children: [value, hasUnits && jsx(ContainerUnits, { children: renderElement({ id: "units" }) })] })] }));
6081
- });
6082
-
6083
- const TwoColumnContainer = memo(({ config, elementConfig, type, renderElement }) => {
6084
- const { selectedTabId, layerInfo, attributes } = useWidgetContext(type);
6085
- const { attributes: renderAttributes } = elementConfig?.options || {};
6086
- const renderContainer = useCallback((attribute) => {
6073
+ const useRenderContainerItem = (type, renderElement) => {
6074
+ const { config, layerInfo, selectedTabId, attributes } = useWidgetContext(type);
6075
+ return useCallback((elementConfig, attribute) => {
6087
6076
  const { id, options, style, children } = elementConfig || {};
6088
6077
  const { hideEmpty, innerTemplateStyle } = options || {};
6089
6078
  const hasUnits = children?.some(({ id }) => id === "units");
@@ -6121,10 +6110,44 @@ const TwoColumnContainer = memo(({ config, elementConfig, type, renderElement })
6121
6110
  })
6122
6111
  : renderElement;
6123
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
+
6125
+ const BASE_STYLE = {
6126
+ marginBottom: "1rem",
6127
+ };
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);
6134
+ if (!value && hideEmpty)
6135
+ return null;
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());
6139
+ });
6140
+
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);
6124
6147
  if (!value && hideEmpty)
6125
6148
  return null;
6126
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));
6127
- }, [attributes, config, getRenderElement, layerInfo, renderElement, selectedTabId, type, elementConfig]);
6150
+ }, [getRenderContainerItem, elementConfig]);
6128
6151
  return renderAttributes?.length ? (jsx(Fragment$1, { children: renderAttributes.map(attribute => renderContainer(attribute)) })) : (renderContainer());
6129
6152
  });
6130
6153
 
@@ -7679,9 +7702,9 @@ var img$1 = "data:image/svg+xml,%3csvg width='32' height='32' viewBox='0 0 32 32
7679
7702
 
7680
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";
7681
7704
 
7682
- const LayerIcon = ({ layerInfo }) => {
7705
+ const LayerIcon = ({ layerInfo, error }) => {
7683
7706
  const renderSymbol = useMemo(() => {
7684
- if (!layerInfo.geometryType) {
7707
+ if (!layerInfo.geometryType || error) {
7685
7708
  return (jsx(AlertIconContainer, { children: jsx(Icon, { kind: "warning" }) }));
7686
7709
  }
7687
7710
  switch (layerInfo.geometryType) {
@@ -10761,6 +10784,75 @@ const useUpdateDataSource = ({ dataSource, config, filters, attributes, layerPar
10761
10784
  }, [dataSource, getDataSourcePromises, getUpdatedDataSources, dataSources]);
10762
10785
  };
10763
10786
 
10787
+ const useMultipleAttributesRender = (config, elementConfig, type, renderElement) => {
10788
+ const { selectedTabId, layerInfo, attributes } = useWidgetContext(type);
10789
+ const { attributes: renderAttributes, attributesExclude } = elementConfig?.options || {};
10790
+ const getAttributesToRender = useCallback(() => {
10791
+ if (renderAttributes) {
10792
+ return renderAttributes;
10793
+ }
10794
+ if (attributesExclude) {
10795
+ const allAttributes = attributes?.map(attr => attr.name) || [];
10796
+ return allAttributes.filter(attr => !attributesExclude.includes(attr));
10797
+ }
10798
+ return null;
10799
+ }, [renderAttributes, attributesExclude, attributes]);
10800
+ const renderContainer = useCallback((attribute) => {
10801
+ const { id, options, style, children } = elementConfig || {};
10802
+ const { hideEmpty, innerTemplateStyle } = options || {};
10803
+ const hasUnits = children?.some(({ id }) => id === "units");
10804
+ const iconIndex = children?.findIndex(({ id }) => id === "icon");
10805
+ const icon = children?.[iconIndex];
10806
+ const hasIcon = !!icon;
10807
+ const elementChildren = elementConfig?.children?.map(child => ({
10808
+ type: "attributeValue",
10809
+ ...child,
10810
+ attributeName: attribute,
10811
+ options: { noUnits: hasUnits, ...child.options },
10812
+ }));
10813
+ const attr = attribute
10814
+ ? layerInfo?.layerAttributes?.find(({ attributeName }) => attributeName === attribute)
10815
+ : null;
10816
+ if (hasIcon) {
10817
+ elementChildren[iconIndex] = {
10818
+ ...elementChildren[iconIndex],
10819
+ type: attr?.icon?.type?.toLowerCase(),
10820
+ value: attr?.icon?.resourceId || attr?.icon?.url || attr?.icon?.iconName,
10821
+ attributeName: null,
10822
+ };
10823
+ }
10824
+ const render = attribute
10825
+ ? getRenderElement({
10826
+ config,
10827
+ elementConfig: {
10828
+ ...elementConfig,
10829
+ children: elementChildren,
10830
+ },
10831
+ selectedTabId,
10832
+ attributes,
10833
+ layerInfo,
10834
+ type,
10835
+ })
10836
+ : renderElement;
10837
+ const value = render({ id: "value" });
10838
+ if (!value && hideEmpty)
10839
+ return null;
10840
+ return {
10841
+ render,
10842
+ value,
10843
+ hasUnits,
10844
+ id,
10845
+ style: innerTemplateStyle || style,
10846
+ hasIcon,
10847
+ attr,
10848
+ };
10849
+ }, [attributes, config, getRenderElement, layerInfo, renderElement, selectedTabId, type, elementConfig]);
10850
+ return {
10851
+ getAttributesToRender,
10852
+ renderContainer,
10853
+ };
10854
+ };
10855
+
10764
10856
  const StackBar = ({ data, filterName, type, alias, options, renderElement, renderTooltip }) => {
10765
10857
  const { height, showTotal, cornerRadius, groupTooltip } = options || {};
10766
10858
  const { t } = useGlobalContext();
@@ -11631,5 +11723,5 @@ const Map$1 = ({ zIndex, lowerSiblings, upperSiblings, onError, children, ...res
11631
11723
  }, children: children }), upperSiblings] }));
11632
11724
  };
11633
11725
 
11634
- export { AddFeatureButton, AddFeatureContainer, AttributeGalleryContainer, AttributeLabel, BaseMapTheme, CONFIG_PAGES_ID, CONFIG_PAGE_ID, CameraContainer, Chart, ChartContainer, ChartLegend, ChartLoading, Container, ContainerChildren, ContainerLoading, ContainerTemplate, ContainerWrapper, ContainersGroupContainer, DEFAULT_ATTRIBUTE_NAME, DEFAULT_BARCHART_RADIUS, DEFAULT_BASE_MAP, DEFAULT_CHART_ANGLE, DEFAULT_CHART_HEIGHT, DEFAULT_CHART_WIDTH, DEFAULT_CIRCLE_PAINT, DEFAULT_DASHBOARD_CONFIG, DEFAULT_DATA_SOURCE_LIMIT, DEFAULT_DROPDOWN_WIDTH, DEFAULT_FILL_EXTRUSION_PAINT, DEFAULT_FILL_PAINT, DEFAULT_FILTER_PADDING, DEFAULT_ID_ATTRIBUTE_NAME, DEFAULT_LAT, DEFAULT_LINE_PAINT, DEFAULT_LNG, DEFAULT_PAGES_CONFIG, DEFAULT_PIECHART_RADIUS, DEFAULT_ZOOM, Dashboard, DashboardCheckbox, DashboardChip, DashboardContent, DashboardContext, DashboardDefaultHeader, DashboardHeader, DashboardLoading, DashboardPlaceholder, DashboardPlaceholderWrap, DashboardProvider, DashboardWrapper, DataSourceContainer, DataSourceError, DataSourceErrorContainer, DataSourceInnerContainer, DataSourceProgressContainer, DateFormat, DefaultAttributesContainer, DefaultHeaderContainer, DefaultHeaderWrapper, DividerContainer, EditGeometryType, ElementButton, ElementCamera, ElementChart, ElementChips, ElementControl, ElementIcon, ElementImage, ElementLegend, ElementLink, ElementMarkdown, ElementSlideshow, ElementSvg, ElementTooltip, ElementValueWrapper, ExpandableTitle, FEATURE_CARD_DEFAULT_COLORS, FEATURE_CARD_OTHER_COLOR, FILTERED_VALUE_OPACITY, FILTER_PREFIX, FeatureCardButtons, FeatureCardContext, FeatureCardDefaultHeader, FeatureCardGradientHeader, FeatureCardHeader, FeatureCardIconHeader, FeatureCardProvider, FeatureCardSlideshowHeader, FeatureCardTitle, FeatureControls, FeatureTitleContainer, FiltersContainer, GEOMETRY_ATTRIBUTE, GlobalContext, GlobalProvider, Header, HeaderContainer, HeaderFrontView, HeaderTemplate, HeaderTitleContainer, HiddenTitleItems, IconContainer, ImageContainer, LEFT_PANEL_HEADER_HEIGHT, Layer, LayerDescription, LayerGroup, LayerGroupList, LayerIcon, LayerListContainer, LayerTree, LayersContainer, LayersListWrapper, LinearProgressContainer, LogTerminal, LogoContainer, MAX_CHART_WIDTH, Map$1 as Map, MapContext, MapProvider, NO_CONTENT_VALUE, NUMERIC_ATTRIBUTE_TYPES, NoLiveSnapshotContainer, OneColumnContainer, PageNavigator, PageTitle, PageTitleContainer, PagesContainer, Pagination, PresentationHeader, PresentationHeaderButtons, PresentationHeaderTools, PresentationPanelContainer, PresentationPanelWrapper, PresentationWrapper, ProgressContainer, RoundedBackgroundContainer, SERVER_NOTIFICATION_EVENT, ScalingFactor, ServerNotificationsContext, ServerNotificationsProvider, SlideshowContainer, SmallPreviewContainer$1 as SmallPreviewContainer, SmallPreviewControl, SmallPreviewCounter, SmallPreviewImages, SmallPreviewLeft, SmallPreviewRight, StackBar, SvgImage, TIME_ZONE_FORMAT, TabsContainer, TextTrim, ThemeName, TitleContainer, TmsType, TopContainer, TopContainerButtons, TwoColumnContainer, UploadContainer, WidgetType, addDataSource, addDataSources, adjustColor, applyFiltersToCondition, applyQueryFilters, applyVarsToCondition, checkEqualOrIncludes, checkIsLoading, convertSpToTurfFeature, createConfigLayer, createConfigPage, createNewPageId, createTreeNode, dateOptions, debounce, decimalOpacityToHex, eqlParametersToPayload, findAttributeInExpression, formatArea, formatAttributeValue, formatChartRelatedValue, formatConditionValue, formatDataSourceCondition, formatDate$1 as formatDate, formatElementValue, formatLength, formatNumber, formatPolygonMeasure, getActualExtrusionHeight, getAttributeByName, getAttributeValue, getAttributesConfiguration, getChartAxes, getChartFilterName, getChartMarkers, getConfigFilter, getContainerComponent, getDashboardHeader, getDataFromAttributes, getDataFromRelatedFeatures, getDataSource, getDataSourceFilterValue, getDate, getDefaultConfig, getElementValue, getFeatureAttributes, getFeatureCardHeader, getFilterComponent, getFilterSelectedItems, getFilterValue, getFormattedAttributes, getGradientColors, getLayerDefinition, getLayerInfo, getLayerInfoFromDataSources, getPagesFromConfig, getPagesFromProjectInfo, getProxyService, getRelatedAttribute, getRenderElement, getResourceUrl, getRootElementId, getSelectedFilterValue, getSlideshowImages, getSvgUrl, getTotalFromAttributes, getTotalFromRelatedFeatures, hexToRgba, isCompositeLayerConfiguration, isEmptyElementValue, isEmptyValue, isHiddenEmptyValue, isLayerService, isNotValidSelectedTab, isNumeric, isObject, isProxyService, isVisibleContainer, numberOptions, parseClientStyle, parseIconNames, parseIconNamesFromClientStyle, pieChartTooltipFromAttributes, pieChartTooltipFromRelatedFeatures, pointOptions, removeDataSource, rgbToHex, roundTotalSum, sliceShownOtherItems, timeOptions, tooltipNameFromAttributes, tooltipValueFromAttributes, tooltipValueFromRelatedFeatures, transparentizeColor, treeNodesToProjectItems, useAppHeight, useChartChange, useChartData, useDashboardHeader, useDataSources, useDebouncedCallback, useDiffPage, useExpandableContainers, useExportPdf, useGetConfigLayer, useGlobalContext, useHeaderRender, useHideIfEmptyDataSource, useIconsFromLayers, useLayerParams, useMapContext, useMapDraw, useMapImages, useProjectDashboardInit, usePythonTask, useRedrawLayer, useRelatedDataSourceAttributes, useRenderElement, useServerNotificationsContext, useShownOtherItems, useToggle, useUpdateDataSource, useWidgetConfig, useWidgetContext, useWidgetFilters, useWidgetPage, useWindowResize, useZoomToFeatures, useZoomToPoint };
11726
+ export { AddFeatureButton, AddFeatureContainer, AttributeGalleryContainer, AttributeLabel, BaseMapTheme, CONFIG_PAGES_ID, CONFIG_PAGE_ID, CameraContainer, Chart, ChartContainer, ChartLegend, ChartLoading, Container, ContainerChildren, ContainerLoading, ContainerTemplate, ContainerWrapper, ContainersGroupContainer, DEFAULT_ATTRIBUTE_NAME, DEFAULT_BARCHART_RADIUS, DEFAULT_BASE_MAP, DEFAULT_CHART_ANGLE, DEFAULT_CHART_HEIGHT, DEFAULT_CHART_WIDTH, DEFAULT_CIRCLE_PAINT, DEFAULT_DASHBOARD_CONFIG, DEFAULT_DATA_SOURCE_LIMIT, DEFAULT_DROPDOWN_WIDTH, DEFAULT_FILL_EXTRUSION_PAINT, DEFAULT_FILL_PAINT, DEFAULT_FILTER_PADDING, DEFAULT_ID_ATTRIBUTE_NAME, DEFAULT_LAT, DEFAULT_LINE_PAINT, DEFAULT_LNG, DEFAULT_PAGES_CONFIG, DEFAULT_PIECHART_RADIUS, DEFAULT_ZOOM, Dashboard, DashboardCheckbox, DashboardChip, DashboardContent, DashboardContext, DashboardDefaultHeader, DashboardHeader, DashboardLoading, DashboardPlaceholder, DashboardPlaceholderWrap, DashboardProvider, DashboardWrapper, DataSourceContainer, DataSourceError, DataSourceErrorContainer, DataSourceInnerContainer, DataSourceProgressContainer, DateFormat, DefaultAttributesContainer, DefaultHeaderContainer, DefaultHeaderWrapper, DividerContainer, EditGeometryType, ElementButton, ElementCamera, ElementChart, ElementChips, ElementControl, ElementIcon, ElementImage, ElementLegend, ElementLink, ElementMarkdown, ElementSlideshow, ElementSvg, ElementTooltip, ElementValueWrapper, ExpandableTitle, FEATURE_CARD_DEFAULT_COLORS, FEATURE_CARD_OTHER_COLOR, FILTERED_VALUE_OPACITY, FILTER_PREFIX, FeatureCardButtons, FeatureCardContext, FeatureCardDefaultHeader, FeatureCardGradientHeader, FeatureCardHeader, FeatureCardIconHeader, FeatureCardProvider, FeatureCardSlideshowHeader, FeatureCardTitle, FeatureControls, FeatureTitleContainer, FiltersContainer, GEOMETRY_ATTRIBUTE, GlobalContext, GlobalProvider, Header, HeaderContainer, HeaderFrontView, HeaderTemplate, HeaderTitleContainer, HiddenTitleItems, IconContainer, ImageContainer, LEFT_PANEL_HEADER_HEIGHT, Layer, LayerDescription, LayerGroup, LayerGroupList, LayerIcon, LayerListContainer, LayerTree, LayersContainer, LayersListWrapper, LinearProgressContainer, LogTerminal, LogoContainer, MAX_CHART_WIDTH, Map$1 as Map, MapContext, MapProvider, NO_CONTENT_VALUE, NUMERIC_ATTRIBUTE_TYPES, NoLiveSnapshotContainer, OneColumnContainer, PageNavigator, PageTitle, PageTitleContainer, PagesContainer, Pagination, PresentationHeader, PresentationHeaderButtons, PresentationHeaderTools, PresentationPanelContainer, PresentationPanelWrapper, PresentationWrapper, ProgressContainer, RoundedBackgroundContainer, SERVER_NOTIFICATION_EVENT, ScalingFactor, ServerNotificationsContext, ServerNotificationsProvider, SlideshowContainer, SmallPreviewContainer$1 as SmallPreviewContainer, SmallPreviewControl, SmallPreviewCounter, SmallPreviewImages, SmallPreviewLeft, SmallPreviewRight, StackBar, SvgImage, TIME_ZONE_FORMAT, TabsContainer, TextTrim, ThemeName, TitleContainer, TmsType, TopContainer, TopContainerButtons, TwoColumnContainer, UploadContainer, WidgetType, addDataSource, addDataSources, adjustColor, applyFiltersToCondition, applyQueryFilters, applyVarsToCondition, checkEqualOrIncludes, checkIsLoading, convertSpToTurfFeature, createConfigLayer, createConfigPage, createNewPageId, createTreeNode, dateOptions, debounce, decimalOpacityToHex, eqlParametersToPayload, findAttributeInExpression, formatArea, formatAttributeValue, formatChartRelatedValue, formatConditionValue, formatDataSourceCondition, formatDate$1 as formatDate, formatElementValue, formatLength, formatNumber, formatPolygonMeasure, getActualExtrusionHeight, getAttributeByName, getAttributeValue, getAttributesConfiguration, getChartAxes, getChartFilterName, getChartMarkers, getConfigFilter, getContainerComponent, getDashboardHeader, getDataFromAttributes, getDataFromRelatedFeatures, getDataSource, getDataSourceFilterValue, getDate, getDefaultConfig, getElementValue, getFeatureAttributes, getFeatureCardHeader, getFilterComponent, getFilterSelectedItems, getFilterValue, getFormattedAttributes, getGradientColors, getLayerDefinition, getLayerInfo, getLayerInfoFromDataSources, getPagesFromConfig, getPagesFromProjectInfo, getProxyService, getRelatedAttribute, getRenderElement, getResourceUrl, getRootElementId, getSelectedFilterValue, getSlideshowImages, getSvgUrl, getTotalFromAttributes, getTotalFromRelatedFeatures, hexToRgba, isCompositeLayerConfiguration, isEmptyElementValue, isEmptyValue, isHiddenEmptyValue, isLayerService, isNotValidSelectedTab, isNumeric, isObject, isProxyService, isVisibleContainer, numberOptions, parseClientStyle, parseIconNames, parseIconNamesFromClientStyle, pieChartTooltipFromAttributes, pieChartTooltipFromRelatedFeatures, pointOptions, removeDataSource, rgbToHex, roundTotalSum, sliceShownOtherItems, timeOptions, tooltipNameFromAttributes, tooltipValueFromAttributes, tooltipValueFromRelatedFeatures, transparentizeColor, treeNodesToProjectItems, useAppHeight, useChartChange, useChartData, useDashboardHeader, useDataSources, useDebouncedCallback, useDiffPage, useExpandableContainers, useExportPdf, useGetConfigLayer, useGlobalContext, useHeaderRender, useHideIfEmptyDataSource, useIconsFromLayers, useLayerParams, useMapContext, useMapDraw, useMapImages, useMultipleAttributesRender, useProjectDashboardInit, usePythonTask, useRedrawLayer, useRelatedDataSourceAttributes, useRenderElement, useServerNotificationsContext, useShownOtherItems, useToggle, useUpdateDataSource, useWidgetConfig, useWidgetContext, useWidgetFilters, useWidgetPage, useWindowResize, useZoomToFeatures, useZoomToPoint };
11635
11727
  //# sourceMappingURL=react.esm.js.map