@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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ConfigContainerChild, WidgetType } from '../types';
|
|
2
2
|
export declare const useWidgetConfig: (type?: WidgetType) => {
|
|
3
|
-
config:
|
|
3
|
+
config: any;
|
|
4
4
|
pages: ConfigContainerChild[];
|
|
5
5
|
};
|
|
@@ -12,6 +12,7 @@ export declare const useWidgetContext: (type?: WidgetType) => {
|
|
|
12
12
|
attributes: import('../types').ClientFeatureAttribute[];
|
|
13
13
|
feature: import('../../..').SelectedFeature;
|
|
14
14
|
closeFeatureCard: VoidFunction;
|
|
15
|
+
containerIds: string[];
|
|
15
16
|
components: {
|
|
16
17
|
LayerItem?: import('react').FC<import('../..').LayerItemProps>;
|
|
17
18
|
ProjectCatalogMenu?: import('react').FC;
|
|
@@ -4,6 +4,7 @@ import { ConfigContainer, DashboardLayerPayload, DashboardState, LayerItemProps,
|
|
|
4
4
|
import { LayerInfo } from '../../types';
|
|
5
5
|
export type DashboardContextProps = PropsWithChildren<{
|
|
6
6
|
config?: ConfigContainer;
|
|
7
|
+
containerIds?: string[];
|
|
7
8
|
projectInfo?: ExtendedProjectInfoDc;
|
|
8
9
|
updateProject?: (projectInfo: ExtendedProjectInfoDc) => void;
|
|
9
10
|
pageIndex?: number;
|
package/dist/index.js
CHANGED
|
@@ -3920,7 +3920,7 @@ const ServerNotificationsProvider = ({ url, initialized, children }) => {
|
|
|
3920
3920
|
};
|
|
3921
3921
|
|
|
3922
3922
|
const useWidgetContext = (type = exports.WidgetType.Dashboard) => {
|
|
3923
|
-
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, } = React.useContext(DashboardContext) || {};
|
|
3923
|
+
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, } = React.useContext(DashboardContext) || {};
|
|
3924
3924
|
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, } = React.useContext(FeatureCardContext) || {};
|
|
3925
3925
|
return {
|
|
3926
3926
|
projectInfo,
|
|
@@ -3933,6 +3933,7 @@ const useWidgetContext = (type = exports.WidgetType.Dashboard) => {
|
|
|
3933
3933
|
attributes,
|
|
3934
3934
|
feature,
|
|
3935
3935
|
closeFeatureCard,
|
|
3936
|
+
containerIds,
|
|
3936
3937
|
components: dashboardComponents,
|
|
3937
3938
|
config: type === exports.WidgetType.Dashboard ? dashboardConfig : featureConfig,
|
|
3938
3939
|
isLoading: type === exports.WidgetType.Dashboard ? projectLoading : featureLoading,
|
|
@@ -9395,16 +9396,27 @@ const tooltipValueFromRelatedFeatures = (t, value, relatedAttributes, layerInfo)
|
|
|
9395
9396
|
};
|
|
9396
9397
|
|
|
9397
9398
|
const useWidgetConfig = (type = exports.WidgetType.Dashboard) => {
|
|
9398
|
-
const { config: configProp, projectInfo, layerInfo } = useWidgetContext(type);
|
|
9399
|
+
const { config: configProp, containerIds, projectInfo, layerInfo } = useWidgetContext(type);
|
|
9399
9400
|
const config = React.useMemo(() => {
|
|
9400
9401
|
if (configProp) {
|
|
9401
9402
|
return configProp;
|
|
9402
9403
|
}
|
|
9403
|
-
|
|
9404
|
-
|
|
9404
|
+
const currentConfig = type === exports.WidgetType.Dashboard
|
|
9405
|
+
? (projectInfo?.content?.dashboardConfiguration || {})
|
|
9406
|
+
: (layerInfo?.configuration?.cardConfiguration || {});
|
|
9407
|
+
if (containerIds?.length) {
|
|
9408
|
+
const elements = containerIds.map(id => findAnd.returnFound(currentConfig, { id })).filter(Boolean);
|
|
9409
|
+
if (!elements.length)
|
|
9410
|
+
return currentConfig;
|
|
9411
|
+
const newConfig = JSON.parse(JSON.stringify(currentConfig));
|
|
9412
|
+
const pages = getPagesFromConfig(newConfig);
|
|
9413
|
+
if (!pages?.[0]?.children)
|
|
9414
|
+
return currentConfig;
|
|
9415
|
+
pages[0].children = elements;
|
|
9416
|
+
return newConfig;
|
|
9405
9417
|
}
|
|
9406
|
-
return
|
|
9407
|
-
}, [configProp, layerInfo?.configuration?.cardConfiguration, projectInfo?.content?.dashboardConfiguration, type]);
|
|
9418
|
+
return currentConfig;
|
|
9419
|
+
}, [configProp, containerIds, layerInfo?.configuration?.cardConfiguration, projectInfo?.content?.dashboardConfiguration, type]);
|
|
9408
9420
|
const pages = React.useMemo(() => (getPagesFromConfig(config) || []), [config]);
|
|
9409
9421
|
return {
|
|
9410
9422
|
config,
|
|
@@ -10340,9 +10352,9 @@ const ExpandableTitle = React.memo(({ elementConfig, type, renderElement }) => {
|
|
|
10340
10352
|
const { id, options, templateName, children } = elementConfig || {};
|
|
10341
10353
|
const { expandable, fontColor, expanded, layerNames } = options || {};
|
|
10342
10354
|
const titleElement = children?.find(item => item.id === "title");
|
|
10343
|
-
const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
|
|
10344
10355
|
if (!titleElement)
|
|
10345
10356
|
return null;
|
|
10357
|
+
const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
|
|
10346
10358
|
return (jsxRuntime.jsx(TitleContainer, { containerId: id, elementConfig: titleElement, templateName: templateName, layerNames: layerNames, fontColor: fontColor, expandable: expandable, expanded: expanded, type: type, isVisible: isVisible, renderElement: renderElement }));
|
|
10347
10359
|
});
|
|
10348
10360
|
|