@evergis/react 3.1.86 → 3.1.88
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/types.d.ts +6 -1
- package/dist/index.js +12 -7
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +12 -7
- package/dist/react.esm.js.map +1 -1
- package/package.json +2 -2
|
@@ -34,6 +34,11 @@ export interface ConfigRelatedResource {
|
|
|
34
34
|
fileName?: string;
|
|
35
35
|
methodName?: string;
|
|
36
36
|
}
|
|
37
|
+
export interface ConfigControl {
|
|
38
|
+
type: "dropdown" | "checkbox";
|
|
39
|
+
targetAttributeName: string;
|
|
40
|
+
attributeAlias?: string;
|
|
41
|
+
}
|
|
37
42
|
export interface BaseMapSettings {
|
|
38
43
|
opacity?: number;
|
|
39
44
|
showBuildings?: boolean;
|
|
@@ -48,7 +53,6 @@ export interface ConfigOptions {
|
|
|
48
53
|
relatedResources?: ConfigRelatedResource[];
|
|
49
54
|
statusColors?: Record<RemoteTaskStatus, string>;
|
|
50
55
|
chartType?: "bar" | "line" | "pie" | "stack";
|
|
51
|
-
controlType?: "dropdown" | "checkbox";
|
|
52
56
|
layerNames?: string[];
|
|
53
57
|
layerName?: string;
|
|
54
58
|
geometryType?: GeometryType | EditGeometryType;
|
|
@@ -128,6 +132,7 @@ export interface ConfigOptions {
|
|
|
128
132
|
tabId?: string;
|
|
129
133
|
column?: boolean;
|
|
130
134
|
relatedDataSource?: string;
|
|
135
|
+
control?: ConfigControl;
|
|
131
136
|
filterName?: string;
|
|
132
137
|
searchFilterName?: string;
|
|
133
138
|
colorAttribute?: string;
|
package/dist/index.js
CHANGED
|
@@ -7778,20 +7778,25 @@ const ElementChips = React.memo(({ type, elementConfig }) => {
|
|
|
7778
7778
|
|
|
7779
7779
|
const ElementControl = ({ elementConfig }) => {
|
|
7780
7780
|
const { t } = useGlobalContext();
|
|
7781
|
-
const { dataSources, controls, changeControls } = useWidgetContext(exports.WidgetType.FeatureCard);
|
|
7781
|
+
const { attributes, layerInfo, dataSources, controls, changeControls } = useWidgetContext(exports.WidgetType.FeatureCard);
|
|
7782
7782
|
const [value, setValue] = React.useState();
|
|
7783
7783
|
const { options, attributeName } = elementConfig || {};
|
|
7784
|
-
const { relatedDataSource, label, width, placeholder = t("selectValue", { ns: "dashboard", defaultValue: "Выберите значение" }) } = options || {};
|
|
7784
|
+
const { relatedDataSource, label, width, control, placeholder = t("selectValue", { ns: "dashboard", defaultValue: "Выберите значение" }) } = options || {};
|
|
7785
|
+
const attribute = React.useMemo(() => attributes?.find(({ name }) => name === attributeName), [attributes, attributeName]);
|
|
7785
7786
|
const dataSource = React.useMemo(() => getDataSource(relatedDataSource, dataSources), [relatedDataSource, dataSources]);
|
|
7786
7787
|
const items = React.useMemo(() => {
|
|
7787
7788
|
if (!dataSource?.features?.length || !attributeName) {
|
|
7788
7789
|
return [];
|
|
7789
7790
|
}
|
|
7790
|
-
return dataSource.features.map(
|
|
7791
|
-
value: attributes?.[attributeName] || "",
|
|
7792
|
-
text: attributes?.[attributeName] || "",
|
|
7791
|
+
return dataSource.features.map(item => ({
|
|
7792
|
+
value: item.attributes?.[attributeName] || "",
|
|
7793
|
+
text: item.attributes?.[control?.attributeAlias || attributeName] || "",
|
|
7793
7794
|
}));
|
|
7794
|
-
}, [dataSource?.features, attributeName]);
|
|
7795
|
+
}, [control?.attributeAlias, dataSource?.features, attributeName]);
|
|
7796
|
+
const isDisabled = React.useMemo(() => {
|
|
7797
|
+
const attr = layerInfo?.configuration?.attributesConfiguration?.attributes?.find(item => item.attributeName === attributeName);
|
|
7798
|
+
return !attr?.isEditable;
|
|
7799
|
+
}, [attributeName, layerInfo?.configuration?.attributesConfiguration?.attributes]);
|
|
7795
7800
|
const handleChange = React.useCallback(([option]) => {
|
|
7796
7801
|
setValue(option?.value);
|
|
7797
7802
|
if (attributeName && changeControls) {
|
|
@@ -7800,7 +7805,7 @@ const ElementControl = ({ elementConfig }) => {
|
|
|
7800
7805
|
});
|
|
7801
7806
|
}
|
|
7802
7807
|
}, [changeControls, attributeName]);
|
|
7803
|
-
return (jsxRuntime.jsx(uilibGl.Dropdown, { zIndex: 1000, width: `${width ?? DEFAULT_DROPDOWN_WIDTH}px`, label: label, options: items, value: controls?.[attributeName] ?? value, placeholder: placeholder, onChange: handleChange }));
|
|
7808
|
+
return (jsxRuntime.jsx(uilibGl.Dropdown, { zIndex: 1000, width: `${width ?? DEFAULT_DROPDOWN_WIDTH}px`, label: label, options: items, value: controls?.[attributeName] ?? value ?? attribute?.value, placeholder: placeholder, disabled: isDisabled, onChange: handleChange }));
|
|
7804
7809
|
};
|
|
7805
7810
|
|
|
7806
7811
|
const StyledIconFontSizeMixin = styled.css `
|