@evergis/react 3.1.59 → 3.1.60
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/components/Dashboard/hooks/useWidgetConfig.d.ts +2 -2
- package/dist/components/Dashboard/hooks/useWidgetContext.d.ts +1 -0
- package/dist/contexts/DashboardContext/types.d.ts +1 -0
- package/dist/index.js +19 -7
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +19 -7
- package/dist/react.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/react.esm.js
CHANGED
|
@@ -3918,7 +3918,7 @@ const ServerNotificationsProvider = ({ url, initialized, children }) => {
|
|
|
3918
3918
|
};
|
|
3919
3919
|
|
|
3920
3920
|
const useWidgetContext = (type = WidgetType.Dashboard) => {
|
|
3921
|
-
const { projectInfo, updateProject, layerInfos, geometryFilter, dashboardLayers, setDashboardLayer, components: dashboardComponents, config: dashboardConfig, 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) || {};
|
|
3921
|
+
const { projectInfo, updateProject, layerInfos, geometryFilter, dashboardLayers, setDashboardLayer, components: dashboardComponents, config: dashboardConfig, containerIds, 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) || {};
|
|
3922
3922
|
const { layerInfo, attributes, feature, closeFeatureCard, config: featureConfig, 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) || {};
|
|
3923
3923
|
return {
|
|
3924
3924
|
projectInfo,
|
|
@@ -3931,6 +3931,7 @@ const useWidgetContext = (type = WidgetType.Dashboard) => {
|
|
|
3931
3931
|
attributes,
|
|
3932
3932
|
feature,
|
|
3933
3933
|
closeFeatureCard,
|
|
3934
|
+
containerIds,
|
|
3934
3935
|
components: dashboardComponents,
|
|
3935
3936
|
config: type === WidgetType.Dashboard ? dashboardConfig : featureConfig,
|
|
3936
3937
|
isLoading: type === WidgetType.Dashboard ? projectLoading : featureLoading,
|
|
@@ -9393,16 +9394,27 @@ const tooltipValueFromRelatedFeatures = (t, value, relatedAttributes, layerInfo)
|
|
|
9393
9394
|
};
|
|
9394
9395
|
|
|
9395
9396
|
const useWidgetConfig = (type = WidgetType.Dashboard) => {
|
|
9396
|
-
const { config: configProp, projectInfo, layerInfo } = useWidgetContext(type);
|
|
9397
|
+
const { config: configProp, containerIds, projectInfo, layerInfo } = useWidgetContext(type);
|
|
9397
9398
|
const config = useMemo(() => {
|
|
9398
9399
|
if (configProp) {
|
|
9399
9400
|
return configProp;
|
|
9400
9401
|
}
|
|
9401
|
-
|
|
9402
|
-
|
|
9402
|
+
const currentConfig = type === WidgetType.Dashboard
|
|
9403
|
+
? (projectInfo?.content?.dashboardConfiguration || {})
|
|
9404
|
+
: (layerInfo?.configuration?.cardConfiguration || {});
|
|
9405
|
+
if (containerIds?.length) {
|
|
9406
|
+
const elements = containerIds.map(id => returnFound(currentConfig, { id })).filter(Boolean);
|
|
9407
|
+
if (!elements.length)
|
|
9408
|
+
return currentConfig;
|
|
9409
|
+
const newConfig = JSON.parse(JSON.stringify(currentConfig));
|
|
9410
|
+
const pages = getPagesFromConfig(newConfig);
|
|
9411
|
+
if (!pages?.[0]?.children)
|
|
9412
|
+
return currentConfig;
|
|
9413
|
+
pages[0].children = elements;
|
|
9414
|
+
return newConfig;
|
|
9403
9415
|
}
|
|
9404
|
-
return
|
|
9405
|
-
}, [configProp, layerInfo?.configuration?.cardConfiguration, projectInfo?.content?.dashboardConfiguration, type]);
|
|
9416
|
+
return currentConfig;
|
|
9417
|
+
}, [configProp, containerIds, layerInfo?.configuration?.cardConfiguration, projectInfo?.content?.dashboardConfiguration, type]);
|
|
9406
9418
|
const pages = useMemo(() => (getPagesFromConfig(config) || []), [config]);
|
|
9407
9419
|
return {
|
|
9408
9420
|
config,
|
|
@@ -10338,9 +10350,9 @@ const ExpandableTitle = memo(({ elementConfig, type, renderElement }) => {
|
|
|
10338
10350
|
const { id, options, templateName, children } = elementConfig || {};
|
|
10339
10351
|
const { expandable, fontColor, expanded, layerNames } = options || {};
|
|
10340
10352
|
const titleElement = children?.find(item => item.id === "title");
|
|
10341
|
-
const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
|
|
10342
10353
|
if (!titleElement)
|
|
10343
10354
|
return null;
|
|
10355
|
+
const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
|
|
10344
10356
|
return (jsx(TitleContainer, { containerId: id, elementConfig: titleElement, templateName: templateName, layerNames: layerNames, fontColor: fontColor, expandable: expandable, expanded: expanded, type: type, isVisible: isVisible, renderElement: renderElement }));
|
|
10345
10357
|
});
|
|
10346
10358
|
|