@evergis/react 3.1.87 → 3.1.89
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 +7 -2
- package/dist/index.js +14 -14
- package/dist/react.esm.js +14 -14
- 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,7 +132,7 @@ export interface ConfigOptions {
|
|
|
128
132
|
tabId?: string;
|
|
129
133
|
column?: boolean;
|
|
130
134
|
relatedDataSource?: string;
|
|
131
|
-
|
|
135
|
+
control?: ConfigControl;
|
|
132
136
|
filterName?: string;
|
|
133
137
|
searchFilterName?: string;
|
|
134
138
|
colorAttribute?: string;
|
|
@@ -156,6 +160,7 @@ export interface ConfigDataSource {
|
|
|
156
160
|
resourceId?: string;
|
|
157
161
|
url?: string;
|
|
158
162
|
type?: string;
|
|
163
|
+
autoSyncLayer?: boolean;
|
|
159
164
|
}
|
|
160
165
|
export interface EqlDataSource {
|
|
161
166
|
items: FeatureDc[];
|
package/dist/index.js
CHANGED
|
@@ -7780,32 +7780,32 @@ const ElementControl = ({ elementConfig }) => {
|
|
|
7780
7780
|
const { t } = useGlobalContext();
|
|
7781
7781
|
const { attributes, layerInfo, dataSources, controls, changeControls } = useWidgetContext(exports.WidgetType.FeatureCard);
|
|
7782
7782
|
const [value, setValue] = React.useState();
|
|
7783
|
-
const { options, attributeName } = elementConfig || {};
|
|
7784
|
-
const { relatedDataSource, label, width,
|
|
7785
|
-
const
|
|
7783
|
+
const { options, attributeName, defaultValue } = elementConfig || {};
|
|
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]);
|
|
7786
7786
|
const dataSource = React.useMemo(() => getDataSource(relatedDataSource, dataSources), [relatedDataSource, dataSources]);
|
|
7787
7787
|
const items = React.useMemo(() => {
|
|
7788
|
-
if (!dataSource?.features?.length || !
|
|
7788
|
+
if (!dataSource?.features?.length || !attributeName) {
|
|
7789
7789
|
return [];
|
|
7790
7790
|
}
|
|
7791
|
-
return dataSource.features.map(
|
|
7792
|
-
value: attributes?.[
|
|
7793
|
-
text: attributes?.[
|
|
7791
|
+
return dataSource.features.map(item => ({
|
|
7792
|
+
value: item.attributes?.[attributeName] || "",
|
|
7793
|
+
text: item.attributes?.[control?.attributeAlias || attributeName] || "",
|
|
7794
7794
|
}));
|
|
7795
|
-
}, [dataSource?.features,
|
|
7795
|
+
}, [control?.attributeAlias, dataSource?.features, attributeName]);
|
|
7796
7796
|
const isDisabled = React.useMemo(() => {
|
|
7797
|
-
const attr = layerInfo?.configuration?.attributesConfiguration?.attributes?.find(
|
|
7797
|
+
const attr = layerInfo?.configuration?.attributesConfiguration?.attributes?.find(item => item.attributeName === control?.targetAttributeName);
|
|
7798
7798
|
return !attr?.isEditable;
|
|
7799
|
-
}, [
|
|
7799
|
+
}, [control?.targetAttributeName, layerInfo?.configuration?.attributesConfiguration?.attributes]);
|
|
7800
7800
|
const handleChange = React.useCallback(([option]) => {
|
|
7801
7801
|
setValue(option?.value);
|
|
7802
|
-
if (
|
|
7802
|
+
if (attributeName && changeControls) {
|
|
7803
7803
|
changeControls({
|
|
7804
|
-
[
|
|
7804
|
+
[attributeName]: option?.value,
|
|
7805
7805
|
});
|
|
7806
7806
|
}
|
|
7807
|
-
}, [changeControls,
|
|
7808
|
-
return (jsxRuntime.jsx(uilibGl.Dropdown, { zIndex: 1000, width: `${width ?? DEFAULT_DROPDOWN_WIDTH}px`, label: label, options: items, value: controls?.[
|
|
7807
|
+
}, [changeControls, attributeName]);
|
|
7808
|
+
return (jsxRuntime.jsx(uilibGl.Dropdown, { zIndex: 1000, width: `${width ?? DEFAULT_DROPDOWN_WIDTH}px`, label: label, options: items, value: controls?.[attributeName] ?? value ?? attribute?.value ?? defaultValue, placeholder: placeholder, disabled: isDisabled, onChange: handleChange }));
|
|
7809
7809
|
};
|
|
7810
7810
|
|
|
7811
7811
|
const StyledIconFontSizeMixin = styled.css `
|
package/dist/react.esm.js
CHANGED
|
@@ -7778,32 +7778,32 @@ const ElementControl = ({ elementConfig }) => {
|
|
|
7778
7778
|
const { t } = useGlobalContext();
|
|
7779
7779
|
const { attributes, layerInfo, dataSources, controls, changeControls } = useWidgetContext(WidgetType.FeatureCard);
|
|
7780
7780
|
const [value, setValue] = useState();
|
|
7781
|
-
const { options, attributeName } = elementConfig || {};
|
|
7782
|
-
const { relatedDataSource, label, width,
|
|
7783
|
-
const
|
|
7781
|
+
const { options, attributeName, defaultValue } = elementConfig || {};
|
|
7782
|
+
const { relatedDataSource, label, width, control, placeholder = t("selectValue", { ns: "dashboard", defaultValue: "Выберите значение" }) } = options || {};
|
|
7783
|
+
const attribute = useMemo(() => attributes?.find(({ name }) => name === attributeName), [attributes, attributeName]);
|
|
7784
7784
|
const dataSource = useMemo(() => getDataSource(relatedDataSource, dataSources), [relatedDataSource, dataSources]);
|
|
7785
7785
|
const items = useMemo(() => {
|
|
7786
|
-
if (!dataSource?.features?.length || !
|
|
7786
|
+
if (!dataSource?.features?.length || !attributeName) {
|
|
7787
7787
|
return [];
|
|
7788
7788
|
}
|
|
7789
|
-
return dataSource.features.map(
|
|
7790
|
-
value: attributes?.[
|
|
7791
|
-
text: attributes?.[
|
|
7789
|
+
return dataSource.features.map(item => ({
|
|
7790
|
+
value: item.attributes?.[attributeName] || "",
|
|
7791
|
+
text: item.attributes?.[control?.attributeAlias || attributeName] || "",
|
|
7792
7792
|
}));
|
|
7793
|
-
}, [dataSource?.features,
|
|
7793
|
+
}, [control?.attributeAlias, dataSource?.features, attributeName]);
|
|
7794
7794
|
const isDisabled = useMemo(() => {
|
|
7795
|
-
const attr = layerInfo?.configuration?.attributesConfiguration?.attributes?.find(
|
|
7795
|
+
const attr = layerInfo?.configuration?.attributesConfiguration?.attributes?.find(item => item.attributeName === control?.targetAttributeName);
|
|
7796
7796
|
return !attr?.isEditable;
|
|
7797
|
-
}, [
|
|
7797
|
+
}, [control?.targetAttributeName, layerInfo?.configuration?.attributesConfiguration?.attributes]);
|
|
7798
7798
|
const handleChange = useCallback(([option]) => {
|
|
7799
7799
|
setValue(option?.value);
|
|
7800
|
-
if (
|
|
7800
|
+
if (attributeName && changeControls) {
|
|
7801
7801
|
changeControls({
|
|
7802
|
-
[
|
|
7802
|
+
[attributeName]: option?.value,
|
|
7803
7803
|
});
|
|
7804
7804
|
}
|
|
7805
|
-
}, [changeControls,
|
|
7806
|
-
return (jsx(Dropdown, { zIndex: 1000, width: `${width ?? DEFAULT_DROPDOWN_WIDTH}px`, label: label, options: items, value: controls?.[
|
|
7805
|
+
}, [changeControls, attributeName]);
|
|
7806
|
+
return (jsx(Dropdown, { zIndex: 1000, width: `${width ?? DEFAULT_DROPDOWN_WIDTH}px`, label: label, options: items, value: controls?.[attributeName] ?? value ?? attribute?.value ?? defaultValue, placeholder: placeholder, disabled: isDisabled, onChange: handleChange }));
|
|
7807
7807
|
};
|
|
7808
7808
|
|
|
7809
7809
|
const StyledIconFontSizeMixin = css `
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.1.
|
|
2
|
+
"version": "3.1.89",
|
|
3
3
|
"name": "@evergis/react",
|
|
4
4
|
"author": "Everpoint",
|
|
5
5
|
"license": "MIT",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"swiper": "^8.3.2",
|
|
84
84
|
"wkt": "^0.1.1"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "2badfc31f3825666f28477a501eb7a76d34667e8"
|
|
87
87
|
}
|