@evergis/react 3.1.23 → 3.1.24

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
@@ -3796,11 +3796,6 @@ const isLayerService = (value) => isObject(value) && "name" in value;
3796
3796
 
3797
3797
  const isNumeric = (number) => !isNaN(parseFloat(number)) && isFinite(number);
3798
3798
 
3799
- const ConfigContext = createContext({});
3800
- const ConfigProvider = memo(({ children, config }) => {
3801
- return jsx(ConfigContext.Provider, { value: { config }, children: children });
3802
- });
3803
-
3804
3799
  const DashboardContext = createContext({});
3805
3800
  const DashboardProvider = memo(({ children, ...props }) => {
3806
3801
  return jsx(DashboardContext.Provider, { value: props, children: children });
@@ -3914,9 +3909,10 @@ const ServerNotificationsProvider = ({ url, initialized, children }) => {
3914
3909
  };
3915
3910
 
3916
3911
  const useWidgetContext = (type = WidgetType.Dashboard) => {
3917
- const { projectInfo, updateProject, layerInfos, geometryFilter, dashboardLayers, setDashboardLayer, components: dashboardComponents, pageIndex: projectPageIndex, selectedTabId: projectSelectedTabId, setSelectedTabId: setProjectSelectedTabId, dataSources: projectDataSources, loading: projectLoading, filters: projectFilters, changeFilters: projectChangeFilters, expandContainer: projectExpandContainer, expandedContainers: projectExpandedContainers, nextPage: projectNextPage, prevPage: projectPrevPage, changePage: projectChangePage, } = useContext(DashboardContext) || {};
3912
+ const { config, projectInfo, updateProject, layerInfos, geometryFilter, dashboardLayers, setDashboardLayer, components: dashboardComponents, pageIndex: projectPageIndex, selectedTabId: projectSelectedTabId, setSelectedTabId: setProjectSelectedTabId, dataSources: projectDataSources, loading: projectLoading, filters: projectFilters, changeFilters: projectChangeFilters, expandContainer: projectExpandContainer, expandedContainers: projectExpandedContainers, nextPage: projectNextPage, prevPage: projectPrevPage, changePage: projectChangePage, } = useContext(DashboardContext) || {};
3918
3913
  const { layerInfo, attributes, feature, closeFeatureCard, pageIndex: featurePageIndex, selectedTabId: featureSelectedTabId, setSelectedTabId: setFeatureSelectedTabId, dataSources: featureDataSources, loading: featureLoading, filters: featureFilters, changeFilters: featureChangeFilters, expandContainer: featureExpandContainer, expandedContainers: featureExpandedContainers, nextPage: featureNextPage, prevPage: featurePrevPage, changePage: featureChangePage, } = useContext(FeatureCardContext) || {};
3919
3914
  return {
3915
+ config,
3920
3916
  projectInfo,
3921
3917
  layerInfos,
3922
3918
  updateProject,
@@ -3929,7 +3925,7 @@ const useWidgetContext = (type = WidgetType.Dashboard) => {
3929
3925
  closeFeatureCard,
3930
3926
  components: dashboardComponents,
3931
3927
  isLoading: type === WidgetType.Dashboard ? projectLoading : featureLoading,
3932
- pageIndex: type === WidgetType.Dashboard ? projectPageIndex : featurePageIndex,
3928
+ pageIndex: type === WidgetType.Dashboard ? projectPageIndex || 1 : featurePageIndex || 1,
3933
3929
  filters: type === WidgetType.Dashboard ? projectFilters : featureFilters,
3934
3930
  changeFilters: type === WidgetType.Dashboard ? projectChangeFilters : featureChangeFilters,
3935
3931
  dataSources: type === WidgetType.Dashboard ? projectDataSources : featureDataSources,
@@ -5955,7 +5951,7 @@ const ChartContainer = memo(({ elementConfig, isVisible, type, renderElement })
5955
5951
  return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsxs(Container, { isColumn: true, children: [aliasElement && jsx(ContainerAlias, { hasBottomMargin: true, children: renderElement({ id: "alias" }) }), jsx(ContainerValue, { column: !twoColumns, alignItems: "center", children: hasItems ? (jsxs(Fragment$1, { children: [jsx(ContainerChart, { children: renderElement({ id: "chart" }) }), jsx(ContainerLegend, { children: renderElement({ id: "legend" }) })] })) : (jsx(Fragment$1, { children: "\u2014" })) })] }))] }));
5956
5952
  });
5957
5953
 
5958
- const PagesContainer = memo(({ type }) => {
5954
+ const PagesContainer = memo(({ type = WidgetType.Dashboard }) => {
5959
5955
  const { config } = useWidgetConfig(type);
5960
5956
  const { pageIndex, currentPage } = useWidgetPage(type);
5961
5957
  const { selectedTabId, setSelectedTabId, expandedContainers, attributes } = useWidgetContext(type);
@@ -8425,6 +8421,56 @@ const getFormattedAttributes = (t, data, attributes, config) => {
8425
8421
  : attributes;
8426
8422
  };
8427
8423
 
8424
+ const isCompositeLayerConfiguration = (value) => isObject(value) && "name" in value;
8425
+ const isProxyService = (value) => isLayerService(value) && ("sourceType" in value || value.type === "RemoteTileService");
8426
+ const getProxyService = (layer) => {
8427
+ if (!isProxyService(layer))
8428
+ return {
8429
+ layers: [],
8430
+ sourceType: "",
8431
+ sourceUrl: "",
8432
+ copyrightText: "",
8433
+ legend: {
8434
+ layers: [],
8435
+ },
8436
+ };
8437
+ const { layers, sourceType, sourceUrl, legend, copyrightText } = layer;
8438
+ return {
8439
+ layers: layers || [],
8440
+ copyrightText: copyrightText || "",
8441
+ sourceUrl: sourceUrl || "",
8442
+ sourceType: sourceType || "",
8443
+ legend: {
8444
+ layers: (legend && legend.layers) || [],
8445
+ },
8446
+ };
8447
+ };
8448
+ function getLayerInfo(layer) {
8449
+ const configuration = layer?.configuration ?? {};
8450
+ const attributesConfiguration = getAttributesConfiguration(layer);
8451
+ const layerDefinition = getLayerDefinition(layer);
8452
+ const configLayers = ("layers" in configuration && configuration.layers) || [];
8453
+ return {
8454
+ type: layer?.type,
8455
+ ...(layer || {}),
8456
+ name: layer?.name || "",
8457
+ configuration: {
8458
+ ...configuration,
8459
+ layers: configLayers.filter(isCompositeLayerConfiguration),
8460
+ attributesConfiguration,
8461
+ },
8462
+ acl: configuration.acl,
8463
+ condition: ("condition" in configuration && configuration.condition) || undefined,
8464
+ tableName: attributesConfiguration.tableName,
8465
+ idAttribute: attributesConfiguration.idAttribute,
8466
+ titleAttribute: layerDefinition.titleAttribute || attributesConfiguration.titleAttribute,
8467
+ geometryAttribute: attributesConfiguration.geometryAttribute,
8468
+ layerAttributes: attributesConfiguration.attributes,
8469
+ srId: layerDefinition.srId,
8470
+ proxy: getProxyService(layer),
8471
+ };
8472
+ }
8473
+
8428
8474
  const getLayerInfoFromDataSources = (layerInfos, dataSources, relatedDataSource) => layerInfos?.find(({ name }) => name === dataSources?.find(item => item.name === relatedDataSource)?.layerName);
8429
8475
 
8430
8476
  const getPagesFromConfig = (config) => config?.children?.[0]?.children;
@@ -8610,8 +8656,7 @@ const tooltipValueFromRelatedFeatures = (t, value, relatedAttributes, layerInfo)
8610
8656
  };
8611
8657
 
8612
8658
  const useWidgetConfig = (type = WidgetType.Dashboard) => {
8613
- const { config: configProp } = useContext(ConfigContext);
8614
- const { projectInfo, layerInfo } = useWidgetContext(type);
8659
+ const { config: configProp, projectInfo, layerInfo } = useWidgetContext(type);
8615
8660
  const config = useMemo(() => {
8616
8661
  if (configProp) {
8617
8662
  return configProp;
@@ -9365,13 +9410,13 @@ const DashboardLoading = memo(() => {
9365
9410
 
9366
9411
  const Dashboard = memo(({ type = WidgetType.Dashboard, config }) => {
9367
9412
  const { dataSources, isLoading } = useWidgetContext(type);
9368
- const { currentPage } = useWidgetPage();
9413
+ const { currentPage } = useWidgetPage(type);
9369
9414
  const isDiffPage = useDiffPage(type);
9370
- const dataSourceLoading = useMemo(() => currentPage?.dataSources?.length && !dataSources?.length && isLoading, [currentPage?.dataSources?.length, dataSources?.length, isLoading]);
9415
+ const dataSourceLoading = useMemo(() => !!currentPage?.dataSources?.length && !dataSources?.length && isLoading, [currentPage?.dataSources?.length, dataSources?.length, isLoading]);
9371
9416
  if (dataSourceLoading || isDiffPage) {
9372
9417
  return (jsx(DashboardLoading, {}));
9373
9418
  }
9374
- return (jsx(ConfigProvider, { config: config, children: jsx(PagesContainer, { type: type }) }));
9419
+ return (jsx(PagesContainer, { type: type }));
9375
9420
  });
9376
9421
 
9377
9422
  const CardCheckbox = styled(Checkbox) `
@@ -9843,5 +9888,5 @@ const Map$1 = ({ zIndex, lowerSiblings, upperSiblings, onError, children, ...res
9843
9888
  }, children: children }), upperSiblings] }));
9844
9889
  };
9845
9890
 
9846
- export { AddFeatureButton, AddFeatureContainer, AttributeGalleryContainer, AttributeLabel, BaseMapTheme, CONFIG_PAGES_ID, CONFIG_PAGE_ID, CameraContainer, Chart, ChartContainer, ChartLegend, ChartLoading, ConfigContext, ConfigProvider, 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_FILL_EXTRUSION_PAINT, DEFAULT_FILL_PAINT, 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, DashboardPlaceholder, DashboardPlaceholderWrap, DashboardProvider, DashboardWrapper, DataSourceContainer, DataSourceError, DataSourceErrorContainer, DataSourceInnerContainer, DataSourceProgressContainer, DateFormat, DefaultAttributesContainer, DefaultHeaderContainer, DividerContainer, EditGeometryType, ElementButton, ElementCamera, ElementChart, ElementChips, ElementIcon, ElementImage, ElementLegend, ElementLink, 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, LogoContainer, MAX_CHART_WIDTH, Map$1 as Map, MapContext, MapProvider, NO_CONTENT_VALUE, NUMERIC_ATTRIBUTE_TYPES, NoLiveSnapshotContainer, OneColumnContainer, PageNavigator, PageTitle, PagesContainer, Pagination, PresentationHeader, PresentationHeaderButtons, PresentationHeaderTools, PresentationPanelContainer, PresentationPanelWrapper, PresentationWrapper, ProgressContainer, RoundedBackgroundContainer, 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, TwoColumnsInnerContainer, WidgetType, addDataSource, addDataSources, 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, getChartFilterName, getChartMarkers, getConfigFilter, getContainerComponent, getDashboardHeader, getDataFromAttributes, getDataFromRelatedFeatures, getDataSource, getDataSourceFilterValue, getDate, getDefaultConfig, getElementValue, getFeatureAttributes, getFeatureCardHeader, getFilterComponent, getFilterSelectedItems, getFilterValue, getFormattedAttributes, getGradientColors, getLayerDefinition, getLayerInfoFromDataSources, getPagesFromConfig, getPagesFromProjectInfo, getRelatedAttribute, getRenderElement, getResourceUrl, getSelectedFilterValue, getSlideshowImages, getSvgUrl, getTotalFromAttributes, getTotalFromRelatedFeatures, hexToRgba, isEmptyElementValue, isEmptyValue, isHiddenEmptyValue, isLayerService, isNotValidSelectedTab, isNumeric, isObject, isVisibleContainer, numberOptions, parseClientStyle, pieChartTooltipFromAttributes, pieChartTooltipFromRelatedFeatures, pointOptions, removeDataSource, rgbToHex, roundTotalSum, sliceShownOtherItems, timeOptions, tooltipNameFromAttributes, tooltipValueFromAttributes, tooltipValueFromRelatedFeatures, transparentizeColor, treeNodesToProjectItems, useAppHeight, useChartChange, useChartData, useDashboardHeader, useDataSources, useDebouncedCallback, useDiffPage, useExpandableContainers, useFeatureFilters, useGetConfigLayer, useGlobalContext, useHeaderRender, useLayerParams, useMapContext, useMapDraw, useProjectDashboardInit, useRedrawLayer, useRelatedDataSourceAttributes, useRenderElement, useServerNotificationsContext, useShownOtherItems, useToggle, useUpdateDataSource, useWidgetConfig, useWidgetContext, useWidgetPage, useWindowResize, useZoomToFeatures, useZoomToPoint };
9891
+ export { AddFeatureButton, AddFeatureContainer, AttributeGalleryContainer, AttributeLabel, BaseMapTheme, CONFIG_PAGES_ID, CONFIG_PAGE_ID, CameraContainer, Chart, ChartContainer, ChartLegend, ChartLoading, 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_FILL_EXTRUSION_PAINT, DEFAULT_FILL_PAINT, 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, DashboardPlaceholder, DashboardPlaceholderWrap, DashboardProvider, DashboardWrapper, DataSourceContainer, DataSourceError, DataSourceErrorContainer, DataSourceInnerContainer, DataSourceProgressContainer, DateFormat, DefaultAttributesContainer, DefaultHeaderContainer, DividerContainer, EditGeometryType, ElementButton, ElementCamera, ElementChart, ElementChips, ElementIcon, ElementImage, ElementLegend, ElementLink, 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, LogoContainer, MAX_CHART_WIDTH, Map$1 as Map, MapContext, MapProvider, NO_CONTENT_VALUE, NUMERIC_ATTRIBUTE_TYPES, NoLiveSnapshotContainer, OneColumnContainer, PageNavigator, PageTitle, PagesContainer, Pagination, PresentationHeader, PresentationHeaderButtons, PresentationHeaderTools, PresentationPanelContainer, PresentationPanelWrapper, PresentationWrapper, ProgressContainer, RoundedBackgroundContainer, 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, TwoColumnsInnerContainer, WidgetType, addDataSource, addDataSources, 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, 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, getSelectedFilterValue, getSlideshowImages, getSvgUrl, getTotalFromAttributes, getTotalFromRelatedFeatures, hexToRgba, isCompositeLayerConfiguration, isEmptyElementValue, isEmptyValue, isHiddenEmptyValue, isLayerService, isNotValidSelectedTab, isNumeric, isObject, isProxyService, isVisibleContainer, numberOptions, parseClientStyle, pieChartTooltipFromAttributes, pieChartTooltipFromRelatedFeatures, pointOptions, removeDataSource, rgbToHex, roundTotalSum, sliceShownOtherItems, timeOptions, tooltipNameFromAttributes, tooltipValueFromAttributes, tooltipValueFromRelatedFeatures, transparentizeColor, treeNodesToProjectItems, useAppHeight, useChartChange, useChartData, useDashboardHeader, useDataSources, useDebouncedCallback, useDiffPage, useExpandableContainers, useFeatureFilters, useGetConfigLayer, useGlobalContext, useHeaderRender, useLayerParams, useMapContext, useMapDraw, useProjectDashboardInit, useRedrawLayer, useRelatedDataSourceAttributes, useRenderElement, useServerNotificationsContext, useShownOtherItems, useToggle, useUpdateDataSource, useWidgetConfig, useWidgetContext, useWidgetPage, useWindowResize, useZoomToFeatures, useZoomToPoint };
9847
9892
  //# sourceMappingURL=react.esm.js.map