@evergis/react 3.1.82 → 3.1.84
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/constants.d.ts +2 -0
- package/dist/components/Dashboard/hooks/useWidgetContext.d.ts +2 -0
- package/dist/components/Dashboard/types.d.ts +1 -0
- package/dist/contexts/FeatureCardContext/types.d.ts +3 -1
- package/dist/index.js +16 -12
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +15 -13
- package/dist/react.esm.js.map +1 -1
- package/package.json +2 -2
|
@@ -24,3 +24,5 @@ export declare const DEFAULT_ZOOM = 10;
|
|
|
24
24
|
export declare const NUMERIC_ATTRIBUTE_TYPES: AttributeType[];
|
|
25
25
|
export declare const GEOMETRY_ATTRIBUTE = "geometry";
|
|
26
26
|
export declare const DEFAULT_ID_ATTRIBUTE_NAME = "gid";
|
|
27
|
+
export declare const DEFAULT_DROPDOWN_WIDTH = 312;
|
|
28
|
+
export declare const DEFAULT_FILTER_PADDING = 12;
|
|
@@ -13,6 +13,8 @@ export declare const useWidgetContext: (type?: WidgetType) => {
|
|
|
13
13
|
feature: import('../../..').SelectedFeature;
|
|
14
14
|
closeFeatureCard: VoidFunction;
|
|
15
15
|
containerIds: string[];
|
|
16
|
+
controls: Record<string, string>;
|
|
17
|
+
changeControls: (controls: Record<string, string>) => void;
|
|
16
18
|
components: {
|
|
17
19
|
LayerItem?: import('react').FC<import('../..').LayerItemProps>;
|
|
18
20
|
ProjectCatalogMenu?: import('react').FC;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
import { LayerReferenceConfigurationDc } from '@evergis/api';
|
|
3
|
-
import { LayerInfo, SelectedFeature } from '../../types';
|
|
4
3
|
import { ClientFeatureAttribute, ConfigContainer, SelectedFilters, WidgetDataSource } from '../../components';
|
|
4
|
+
import { LayerInfo, SelectedFeature } from '../../types';
|
|
5
5
|
export type FeatureCardContextSettings = PropsWithChildren<{
|
|
6
6
|
config?: ConfigContainer;
|
|
7
7
|
attributes?: ClientFeatureAttribute[];
|
|
@@ -20,6 +20,8 @@ export type FeatureCardContextSettings = PropsWithChildren<{
|
|
|
20
20
|
loading?: boolean;
|
|
21
21
|
filters?: SelectedFilters;
|
|
22
22
|
changeFilters?: (filters: SelectedFilters) => void;
|
|
23
|
+
controls?: Record<string, string>;
|
|
24
|
+
changeControls?: (controls: Record<string, string>) => void;
|
|
23
25
|
expandContainer?: (id: string, expanded?: boolean) => void;
|
|
24
26
|
setSelectedTabId?: (id: string) => void;
|
|
25
27
|
setHandBookReference?: (reference: LayerReferenceConfigurationDc) => void;
|
package/dist/index.js
CHANGED
|
@@ -3438,6 +3438,8 @@ const DEFAULT_ZOOM = 10;
|
|
|
3438
3438
|
const NUMERIC_ATTRIBUTE_TYPES = [api.AttributeType.Double, api.AttributeType.Int32, api.AttributeType.Int64];
|
|
3439
3439
|
const GEOMETRY_ATTRIBUTE = "geometry";
|
|
3440
3440
|
const DEFAULT_ID_ATTRIBUTE_NAME = "gid";
|
|
3441
|
+
const DEFAULT_DROPDOWN_WIDTH = 312;
|
|
3442
|
+
const DEFAULT_FILTER_PADDING = 12;
|
|
3441
3443
|
|
|
3442
3444
|
const StackBarContainer = styled(uilibGl.Flex) `
|
|
3443
3445
|
flex-wrap: nowrap;
|
|
@@ -4004,7 +4006,7 @@ const ServerNotificationsProvider = ({ url, initialized, children }) => {
|
|
|
4004
4006
|
|
|
4005
4007
|
const useWidgetContext = (type = exports.WidgetType.Dashboard) => {
|
|
4006
4008
|
const { projectInfo, updateProject, layerInfos, geometryFilter, dashboardLayers, setDashboardLayer, components: dashboardComponents, config: dashboardConfig, containerIds, pageIndex: projectPageIndex, selectedTabId: projectSelectedTabId, setSelectedTabId: setProjectSelectedTabId, dataSources: projectDataSources, loading: projectLoading, editMode: projectEditMode, filters: projectFilters, changeFilters: projectChangeFilters, expandContainer: projectExpandContainer, expandedContainers: projectExpandedContainers, nextPage: projectNextPage, prevPage: projectPrevPage, changePage: projectChangePage, } = React.useContext(DashboardContext) || {};
|
|
4007
|
-
const { layerInfo, attributes, feature, closeFeatureCard, config: featureConfig, pageIndex: featurePageIndex, selectedTabId: featureSelectedTabId, setSelectedTabId: setFeatureSelectedTabId, dataSources: featureDataSources, loading: featureLoading, editMode: featureEditMode, filters: featureFilters, changeFilters: featureChangeFilters, expandContainer: featureExpandContainer, expandedContainers: featureExpandedContainers, nextPage: featureNextPage, prevPage: featurePrevPage, changePage: featureChangePage, } = React.useContext(FeatureCardContext) || {};
|
|
4009
|
+
const { layerInfo, attributes, feature, controls, changeControls, closeFeatureCard, config: featureConfig, pageIndex: featurePageIndex, selectedTabId: featureSelectedTabId, setSelectedTabId: setFeatureSelectedTabId, dataSources: featureDataSources, loading: featureLoading, editMode: featureEditMode, filters: featureFilters, changeFilters: featureChangeFilters, expandContainer: featureExpandContainer, expandedContainers: featureExpandedContainers, nextPage: featureNextPage, prevPage: featurePrevPage, changePage: featureChangePage, } = React.useContext(FeatureCardContext) || {};
|
|
4008
4010
|
return {
|
|
4009
4011
|
projectInfo,
|
|
4010
4012
|
layerInfos,
|
|
@@ -4017,6 +4019,8 @@ const useWidgetContext = (type = exports.WidgetType.Dashboard) => {
|
|
|
4017
4019
|
feature,
|
|
4018
4020
|
closeFeatureCard,
|
|
4019
4021
|
containerIds,
|
|
4022
|
+
controls,
|
|
4023
|
+
changeControls,
|
|
4020
4024
|
components: dashboardComponents,
|
|
4021
4025
|
config: type === exports.WidgetType.Dashboard ? dashboardConfig : featureConfig,
|
|
4022
4026
|
isEditing: type === exports.WidgetType.Dashboard ? projectEditMode : featureEditMode,
|
|
@@ -6010,7 +6014,7 @@ const DEFAULT_BAR_CHART_MARGINS = {
|
|
|
6010
6014
|
|
|
6011
6015
|
const FiltersContainerWrapper = styled(uilibGl.Flex) `
|
|
6012
6016
|
flex-direction: column;
|
|
6013
|
-
padding: ${({ $padding }) => $padding ??
|
|
6017
|
+
padding: ${({ $padding }) => $padding ?? `${DEFAULT_FILTER_PADDING}px`};
|
|
6014
6018
|
background-color: ${({ $bgColor, $fontColor, theme: { palette } }) => $bgColor || ($fontColor ? transparentizeColor($fontColor, 6) : palette.element)};
|
|
6015
6019
|
border-radius: ${({ theme: { borderRadius } }) => borderRadius.medium};
|
|
6016
6020
|
|
|
@@ -7771,10 +7775,10 @@ const ElementChips = React.memo(({ type, elementConfig }) => {
|
|
|
7771
7775
|
|
|
7772
7776
|
const ElementControl = ({ elementConfig }) => {
|
|
7773
7777
|
const { t } = useGlobalContext();
|
|
7774
|
-
const { dataSources,
|
|
7778
|
+
const { dataSources, controls, changeControls } = useWidgetContext(exports.WidgetType.FeatureCard);
|
|
7775
7779
|
const [value, setValue] = React.useState();
|
|
7776
7780
|
const { options, attributeName } = elementConfig || {};
|
|
7777
|
-
const {
|
|
7781
|
+
const { relatedDataSource, controlName, label, width, placeholder = t("selectValue", { ns: "dashboard", defaultValue: "Выберите значение" }) } = options || {};
|
|
7778
7782
|
const dataSource = React.useMemo(() => getDataSource(relatedDataSource, dataSources), [relatedDataSource, dataSources]);
|
|
7779
7783
|
const items = React.useMemo(() => {
|
|
7780
7784
|
if (!dataSource?.features?.length || !attributeName) {
|
|
@@ -7787,15 +7791,13 @@ const ElementControl = ({ elementConfig }) => {
|
|
|
7787
7791
|
}, [dataSource?.features, attributeName]);
|
|
7788
7792
|
const handleChange = React.useCallback(([option]) => {
|
|
7789
7793
|
setValue(option?.value);
|
|
7790
|
-
if (
|
|
7791
|
-
|
|
7792
|
-
[
|
|
7793
|
-
value: option?.value,
|
|
7794
|
-
},
|
|
7794
|
+
if (controlName && changeControls) {
|
|
7795
|
+
changeControls({
|
|
7796
|
+
[controlName]: option?.value,
|
|
7795
7797
|
});
|
|
7796
7798
|
}
|
|
7797
|
-
}, [
|
|
7798
|
-
return (jsxRuntime.jsx(uilibGl.Dropdown, { zIndex: 1000, width:
|
|
7799
|
+
}, [changeControls, controlName]);
|
|
7800
|
+
return (jsxRuntime.jsx(uilibGl.Dropdown, { zIndex: 1000, width: `${width ?? DEFAULT_DROPDOWN_WIDTH}px`, label: label, options: items, value: controls?.[controlName] ?? value, placeholder: placeholder, onChange: handleChange }));
|
|
7799
7801
|
};
|
|
7800
7802
|
|
|
7801
7803
|
const StyledIconFontSizeMixin = styled.css `
|
|
@@ -8716,7 +8718,7 @@ const DropdownFilter = ({ type, filter, elementConfig }) => {
|
|
|
8716
8718
|
}, [changeFilters, filterName]);
|
|
8717
8719
|
if (!configFilter)
|
|
8718
8720
|
return null;
|
|
8719
|
-
return (jsxRuntime.jsx(uilibGl.Dropdown, { zIndex: 100, width: `${width ??
|
|
8721
|
+
return (jsxRuntime.jsx(uilibGl.Dropdown, { zIndex: 100, width: `${width ?? (DEFAULT_DROPDOWN_WIDTH - DEFAULT_FILTER_PADDING * 2)}px`, value: value, placeholder: placeholder, options: filterOptions, onChange: onChange }));
|
|
8720
8722
|
};
|
|
8721
8723
|
|
|
8722
8724
|
const CheckboxFilter = ({ type, filter, elementConfig }) => {
|
|
@@ -11161,8 +11163,10 @@ exports.DEFAULT_CHART_WIDTH = DEFAULT_CHART_WIDTH;
|
|
|
11161
11163
|
exports.DEFAULT_CIRCLE_PAINT = DEFAULT_CIRCLE_PAINT;
|
|
11162
11164
|
exports.DEFAULT_DASHBOARD_CONFIG = DEFAULT_DASHBOARD_CONFIG;
|
|
11163
11165
|
exports.DEFAULT_DATA_SOURCE_LIMIT = DEFAULT_DATA_SOURCE_LIMIT;
|
|
11166
|
+
exports.DEFAULT_DROPDOWN_WIDTH = DEFAULT_DROPDOWN_WIDTH;
|
|
11164
11167
|
exports.DEFAULT_FILL_EXTRUSION_PAINT = DEFAULT_FILL_EXTRUSION_PAINT;
|
|
11165
11168
|
exports.DEFAULT_FILL_PAINT = DEFAULT_FILL_PAINT;
|
|
11169
|
+
exports.DEFAULT_FILTER_PADDING = DEFAULT_FILTER_PADDING;
|
|
11166
11170
|
exports.DEFAULT_ID_ATTRIBUTE_NAME = DEFAULT_ID_ATTRIBUTE_NAME;
|
|
11167
11171
|
exports.DEFAULT_LAT = DEFAULT_LAT;
|
|
11168
11172
|
exports.DEFAULT_LINE_PAINT = DEFAULT_LINE_PAINT;
|