@evergis/react 3.1.25 → 3.1.27
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/components/Dashboard/index.d.ts +1 -0
- package/dist/components/Dashboard/components/index.d.ts +1 -0
- package/dist/components/Dashboard/containers/LayersContainer/styled.d.ts +2 -6
- package/dist/components/Dashboard/containers/styled.d.ts +1 -5
- package/dist/components/Dashboard/hooks/useWidgetContext.d.ts +1 -1
- package/dist/components/Dashboard/hooks/useWidgetPage.d.ts +1 -0
- package/dist/components/Dashboard/styled.d.ts +1 -4
- package/dist/components/Dashboard/types.d.ts +1 -0
- package/dist/contexts/FeatureCardContext/index.d.ts +2 -4
- package/dist/contexts/FeatureCardContext/types.d.ts +5 -3
- package/dist/index.js +44 -11
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +44 -12
- package/dist/react.esm.js.map +1 -1
- package/package.json +2 -2
|
@@ -3,6 +3,7 @@ export * from './Chart';
|
|
|
3
3
|
export * from './ChartLegend';
|
|
4
4
|
export * from './ContainerChildren';
|
|
5
5
|
export * from './Dashboard';
|
|
6
|
+
export * from './Dashboard/components/DashboardLoading';
|
|
6
7
|
export * from './DashboardCheckbox';
|
|
7
8
|
export * from './DashboardHeader';
|
|
8
9
|
export * from './DataSourceError';
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
export declare const LayersContainerWrapper: import('styled-components').StyledComponent<
|
|
2
|
-
isTitle?: boolean;
|
|
3
|
-
isColumn?: boolean;
|
|
4
|
-
isMain?: boolean;
|
|
5
|
-
} & {
|
|
1
|
+
export declare const LayersContainerWrapper: import('styled-components').StyledComponent<any, any, {
|
|
6
2
|
isPresentationMode?: boolean;
|
|
7
|
-
},
|
|
3
|
+
}, string | number | symbol>;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
export declare const Container:
|
|
2
|
-
isTitle?: boolean;
|
|
3
|
-
isColumn?: boolean;
|
|
4
|
-
isMain?: boolean;
|
|
5
|
-
}, never>;
|
|
1
|
+
export declare const Container: any;
|
|
6
2
|
export declare const ContainerAlias: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps & {
|
|
7
3
|
hasBottomMargin?: boolean;
|
|
8
4
|
}, never>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { WidgetType } from '../types';
|
|
2
2
|
export declare const useWidgetContext: (type?: WidgetType) => {
|
|
3
|
-
config: import('../types').ConfigContainer;
|
|
4
3
|
projectInfo: import('@evergis/api').ExtendedProjectInfoDc;
|
|
5
4
|
layerInfos: import('../../..').LayerInfo[];
|
|
6
5
|
updateProject: (projectInfo: import('@evergis/api').ExtendedProjectInfoDc) => void;
|
|
@@ -19,6 +18,7 @@ export declare const useWidgetContext: (type?: WidgetType) => {
|
|
|
19
18
|
ProjectPanelMenu?: import('react').FC;
|
|
20
19
|
ProjectPagesMenu?: import('react').FC;
|
|
21
20
|
};
|
|
21
|
+
config: import('../types').ConfigContainer;
|
|
22
22
|
isLoading: boolean;
|
|
23
23
|
pageIndex: number;
|
|
24
24
|
filters: import('../types').SelectedFilters;
|
|
@@ -7,4 +7,5 @@ export declare const useWidgetPage: (type?: WidgetType) => {
|
|
|
7
7
|
addConfigPage: () => void;
|
|
8
8
|
deleteConfigPage: (index: number) => void;
|
|
9
9
|
updateConfigLayer: (name: string, newProps: Omit<ConfigLayer, "name">) => void;
|
|
10
|
+
updateConfigLayers: (props: Record<string, Omit<ConfigLayer, "name">>) => void;
|
|
10
11
|
};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { CSSProperties } from 'react';
|
|
2
1
|
export declare const ElementValueWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
3
|
-
export declare const ContainerWrapper:
|
|
4
|
-
$zIndex?: CSSProperties["zIndex"];
|
|
5
|
-
}, never>;
|
|
2
|
+
export declare const ContainerWrapper: any;
|
|
6
3
|
export declare const DashboardChip: import('styled-components').StyledComponent<any, any, any, any>;
|
|
7
4
|
export declare const DashboardPlaceholderWrap: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps, never>;
|
|
8
5
|
export declare const DashboardPlaceholder: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps & {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { FC
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { FeatureCardContextSettings } from './types';
|
|
3
3
|
export declare const FeatureCardContext: import('react').Context<FeatureCardContextSettings>;
|
|
4
|
-
export declare const FeatureCardProvider: FC<
|
|
5
|
-
settings: FeatureCardContextSettings;
|
|
6
|
-
}>>;
|
|
4
|
+
export declare const FeatureCardProvider: FC<FeatureCardContextSettings>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
1
2
|
import { LayerReferenceConfigurationDc } from '@evergis/api';
|
|
2
3
|
import { LayerInfo, SelectedFeature } from '../../types';
|
|
3
|
-
import { ClientFeatureAttribute, SelectedFilters, WidgetDataSource } from '../../components';
|
|
4
|
-
export type FeatureCardContextSettings = {
|
|
4
|
+
import { ClientFeatureAttribute, ConfigContainer, SelectedFilters, WidgetDataSource } from '../../components';
|
|
5
|
+
export type FeatureCardContextSettings = PropsWithChildren<{
|
|
6
|
+
config?: ConfigContainer;
|
|
5
7
|
attributes?: ClientFeatureAttribute[];
|
|
6
8
|
layerInfo?: LayerInfo;
|
|
7
9
|
feature?: SelectedFeature;
|
|
@@ -25,4 +27,4 @@ export type FeatureCardContextSettings = {
|
|
|
25
27
|
prevPage?: (totalPages: number) => void;
|
|
26
28
|
changePage?: (pageIndex: number) => void;
|
|
27
29
|
closeFeatureCard?: VoidFunction;
|
|
28
|
-
}
|
|
30
|
+
}>;
|
package/dist/index.js
CHANGED
|
@@ -3803,8 +3803,10 @@ const DashboardProvider = React.memo(({ children, ...props }) => {
|
|
|
3803
3803
|
return jsxRuntime.jsx(DashboardContext.Provider, { value: props, children: children });
|
|
3804
3804
|
});
|
|
3805
3805
|
|
|
3806
|
-
const FeatureCardContext = React.createContext(
|
|
3807
|
-
const FeatureCardProvider = React.memo(({
|
|
3806
|
+
const FeatureCardContext = React.createContext({});
|
|
3807
|
+
const FeatureCardProvider = React.memo(({ children, ...props }) => {
|
|
3808
|
+
return jsxRuntime.jsx(FeatureCardContext.Provider, { value: props, children: children });
|
|
3809
|
+
});
|
|
3808
3810
|
|
|
3809
3811
|
const GlobalContext = React.createContext({});
|
|
3810
3812
|
const GlobalProvider = React.memo(({ children, ...props }) => {
|
|
@@ -3911,10 +3913,9 @@ const ServerNotificationsProvider = ({ url, initialized, children }) => {
|
|
|
3911
3913
|
};
|
|
3912
3914
|
|
|
3913
3915
|
const useWidgetContext = (type = exports.WidgetType.Dashboard) => {
|
|
3914
|
-
const {
|
|
3915
|
-
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, } = React.useContext(FeatureCardContext) || {};
|
|
3916
|
+
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) || {};
|
|
3917
|
+
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) || {};
|
|
3916
3918
|
return {
|
|
3917
|
-
config,
|
|
3918
3919
|
projectInfo,
|
|
3919
3920
|
layerInfos,
|
|
3920
3921
|
updateProject,
|
|
@@ -3926,6 +3927,7 @@ const useWidgetContext = (type = exports.WidgetType.Dashboard) => {
|
|
|
3926
3927
|
feature,
|
|
3927
3928
|
closeFeatureCard,
|
|
3928
3929
|
components: dashboardComponents,
|
|
3930
|
+
config: type === exports.WidgetType.Dashboard ? dashboardConfig : featureConfig,
|
|
3929
3931
|
isLoading: type === exports.WidgetType.Dashboard ? projectLoading : featureLoading,
|
|
3930
3932
|
pageIndex: type === exports.WidgetType.Dashboard ? projectPageIndex || 1 : featurePageIndex || 1,
|
|
3931
3933
|
filters: type === exports.WidgetType.Dashboard ? projectFilters : featureFilters,
|
|
@@ -4477,6 +4479,7 @@ const ChartLegendItem = styled(uilibGl.Flex) `
|
|
|
4477
4479
|
width: auto;
|
|
4478
4480
|
margin-right: 0.375rem;
|
|
4479
4481
|
margin-bottom: 0.25rem;
|
|
4482
|
+
line-height: 0.75rem;
|
|
4480
4483
|
opacity: ${({ isFiltered, hasAnyFilter }) => (isFiltered ? 1 : hasAnyFilter ? FILTERED_VALUE_OPACITY / 100 : 1)};
|
|
4481
4484
|
`;
|
|
4482
4485
|
const ChartLegendColor = styled.div `
|
|
@@ -4521,6 +4524,14 @@ const Container = styled(uilibGl.Flex) `
|
|
|
4521
4524
|
margin-bottom: 0.75rem;
|
|
4522
4525
|
}
|
|
4523
4526
|
`}
|
|
4527
|
+
|
|
4528
|
+
${({ noBorders }) => noBorders && styled.css `
|
|
4529
|
+
${ContainerWrapper} {
|
|
4530
|
+
box-shadow: none;
|
|
4531
|
+
padding-left: 0;
|
|
4532
|
+
padding-right: 0;
|
|
4533
|
+
}
|
|
4534
|
+
`}
|
|
4524
4535
|
`;
|
|
4525
4536
|
const ContainerAlias = styled(uilibGl.Flex) `
|
|
4526
4537
|
align-items: center;
|
|
@@ -5953,7 +5964,7 @@ const ChartContainer = React.memo(({ elementConfig, isVisible, type, renderEleme
|
|
|
5953
5964
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsxRuntime.jsxs(Container, { isColumn: true, children: [aliasElement && jsxRuntime.jsx(ContainerAlias, { hasBottomMargin: true, children: renderElement({ id: "alias" }) }), jsxRuntime.jsx(ContainerValue, { column: !twoColumns, alignItems: "center", children: hasItems ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ContainerChart, { children: renderElement({ id: "chart" }) }), jsxRuntime.jsx(ContainerLegend, { children: renderElement({ id: "legend" }) })] })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: "\u2014" })) })] }))] }));
|
|
5954
5965
|
});
|
|
5955
5966
|
|
|
5956
|
-
const PagesContainer = React.memo(({ type = exports.WidgetType.Dashboard }) => {
|
|
5967
|
+
const PagesContainer = React.memo(({ type = exports.WidgetType.Dashboard, noBorders }) => {
|
|
5957
5968
|
const { config } = useWidgetConfig(type);
|
|
5958
5969
|
const { pageIndex, currentPage } = useWidgetPage(type);
|
|
5959
5970
|
const { selectedTabId, setSelectedTabId, expandedContainers, attributes } = useWidgetContext(type);
|
|
@@ -5983,7 +5994,7 @@ const PagesContainer = React.memo(({ type = exports.WidgetType.Dashboard }) => {
|
|
|
5983
5994
|
setSelectedTabId,
|
|
5984
5995
|
type,
|
|
5985
5996
|
]);
|
|
5986
|
-
return (jsxRuntime.jsxs("div", { style: { width }, children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: config, type: type, renderElement: renderElement }), jsxRuntime.jsx(Container, { isColumn: isColumn, isMain: true, children: jsxRuntime.jsx(ContainerChildren, { items: filteredChildren, isMain: true, renderElement: renderElement }) })] }));
|
|
5997
|
+
return (jsxRuntime.jsxs("div", { style: { width }, children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: config, type: type, renderElement: renderElement }), jsxRuntime.jsx(Container, { isColumn: isColumn, isMain: true, noBorders: noBorders, children: jsxRuntime.jsx(ContainerChildren, { items: filteredChildren, isMain: true, renderElement: renderElement }) })] }));
|
|
5987
5998
|
});
|
|
5988
5999
|
|
|
5989
6000
|
const TwoColumnsInnerContainer = React.memo(({ renderElement }) => {
|
|
@@ -8736,7 +8747,28 @@ const useWidgetPage = (type = exports.WidgetType.Dashboard) => {
|
|
|
8736
8747
|
page.layers[index] = { ...page.layers[index], ...newProps };
|
|
8737
8748
|
updateProject(newProjectInfo);
|
|
8738
8749
|
}, [projectInfo, pageIndex, updateProject]);
|
|
8739
|
-
|
|
8750
|
+
const updateConfigLayers = React.useCallback((props) => {
|
|
8751
|
+
const newProjectInfo = JSON.parse(JSON.stringify(projectInfo));
|
|
8752
|
+
const pages = getPagesFromProjectInfo(newProjectInfo);
|
|
8753
|
+
const page = pages?.[pageIndex - 1];
|
|
8754
|
+
if (!page?.layers?.length)
|
|
8755
|
+
return;
|
|
8756
|
+
page.layers = page.layers.map(layer => ({
|
|
8757
|
+
...layer,
|
|
8758
|
+
...(props[layer.name] || {}),
|
|
8759
|
+
}));
|
|
8760
|
+
updateProject(newProjectInfo);
|
|
8761
|
+
}, [projectInfo, pageIndex, updateProject]);
|
|
8762
|
+
return {
|
|
8763
|
+
pageIndex,
|
|
8764
|
+
currentPage,
|
|
8765
|
+
changePage,
|
|
8766
|
+
updateConfigPage,
|
|
8767
|
+
addConfigPage,
|
|
8768
|
+
deleteConfigPage,
|
|
8769
|
+
updateConfigLayer,
|
|
8770
|
+
updateConfigLayers,
|
|
8771
|
+
};
|
|
8740
8772
|
};
|
|
8741
8773
|
|
|
8742
8774
|
const useChartData = ({ element, type }) => {
|
|
@@ -9417,10 +9449,10 @@ const ContainerChildren = React.memo(({ items, isColumn, isMain, renderElement }
|
|
|
9417
9449
|
});
|
|
9418
9450
|
|
|
9419
9451
|
const DashboardLoading = React.memo(() => {
|
|
9420
|
-
return (jsxRuntime.jsx(ContainerWrapper, { children: jsxRuntime.jsx(DashboardWrapper, { children: jsxRuntime.jsx(DashboardPlaceholderWrap, { children: jsxRuntime.jsxs(DashboardPlaceholder, { isLoading: true, children: [jsxRuntime.jsx(uilibGl.Icon, { kind: "dashboard_loading" }), jsxRuntime.jsx(uilibGl.Flex, { width: "8rem", children: jsxRuntime.jsx(uilibGl.LinearProgress, {}) })] }) }) }) }));
|
|
9452
|
+
return (jsxRuntime.jsx(Container, { noBorders: true, children: jsxRuntime.jsx(ContainerWrapper, { children: jsxRuntime.jsx(DashboardWrapper, { children: jsxRuntime.jsx(DashboardPlaceholderWrap, { children: jsxRuntime.jsxs(DashboardPlaceholder, { isLoading: true, children: [jsxRuntime.jsx(uilibGl.Icon, { kind: "dashboard_loading" }), jsxRuntime.jsx(uilibGl.Flex, { width: "8rem", children: jsxRuntime.jsx(uilibGl.LinearProgress, {}) })] }) }) }) }) }));
|
|
9421
9453
|
});
|
|
9422
9454
|
|
|
9423
|
-
const Dashboard = React.memo(({ type = exports.WidgetType.Dashboard, config }) => {
|
|
9455
|
+
const Dashboard = React.memo(({ type = exports.WidgetType.Dashboard, config, noBorders }) => {
|
|
9424
9456
|
const { dataSources, isLoading } = useWidgetContext(type);
|
|
9425
9457
|
const { currentPage } = useWidgetPage(type);
|
|
9426
9458
|
const isDiffPage = useDiffPage(type);
|
|
@@ -9428,7 +9460,7 @@ const Dashboard = React.memo(({ type = exports.WidgetType.Dashboard, config }) =
|
|
|
9428
9460
|
if (dataSourceLoading || isDiffPage) {
|
|
9429
9461
|
return (jsxRuntime.jsx(DashboardLoading, {}));
|
|
9430
9462
|
}
|
|
9431
|
-
return (jsxRuntime.jsx(PagesContainer, { type: type }));
|
|
9463
|
+
return (jsxRuntime.jsx(PagesContainer, { type: type, config: config, noBorders: noBorders }));
|
|
9432
9464
|
});
|
|
9433
9465
|
|
|
9434
9466
|
const CardCheckbox = styled(uilibGl.Checkbox) `
|
|
@@ -9940,6 +9972,7 @@ exports.DashboardContent = DashboardContent;
|
|
|
9940
9972
|
exports.DashboardContext = DashboardContext;
|
|
9941
9973
|
exports.DashboardDefaultHeader = DashboardDefaultHeader;
|
|
9942
9974
|
exports.DashboardHeader = DashboardHeader;
|
|
9975
|
+
exports.DashboardLoading = DashboardLoading;
|
|
9943
9976
|
exports.DashboardPlaceholder = DashboardPlaceholder;
|
|
9944
9977
|
exports.DashboardPlaceholderWrap = DashboardPlaceholderWrap;
|
|
9945
9978
|
exports.DashboardProvider = DashboardProvider;
|