@evergis/react 3.1.85 → 3.1.87
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 +1 -0
- package/dist/index.js +19 -11
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +19 -11
- package/dist/react.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/react.esm.js
CHANGED
|
@@ -5571,10 +5571,13 @@ const ChartLegendName = styled.div `
|
|
|
5571
5571
|
const ContainerAlias = styled(Flex) `
|
|
5572
5572
|
align-items: center;
|
|
5573
5573
|
flex-wrap: nowrap;
|
|
5574
|
-
margin-bottom: ${({ hasBottomMargin }) => (hasBottomMargin ? 0.25 : 0)}rem;
|
|
5575
5574
|
font-size: 0.75rem;
|
|
5576
5575
|
color: ${({ theme: { palette } }) => palette.textSecondary};
|
|
5577
5576
|
|
|
5577
|
+
&&& {
|
|
5578
|
+
margin-bottom: ${({ hasBottomMargin }) => (hasBottomMargin ? 0.25 : 0)}rem;
|
|
5579
|
+
}
|
|
5580
|
+
|
|
5578
5581
|
span[kind] {
|
|
5579
5582
|
margin-right: 0.5rem;
|
|
5580
5583
|
|
|
@@ -7773,29 +7776,34 @@ const ElementChips = memo(({ type, elementConfig }) => {
|
|
|
7773
7776
|
|
|
7774
7777
|
const ElementControl = ({ elementConfig }) => {
|
|
7775
7778
|
const { t } = useGlobalContext();
|
|
7776
|
-
const { dataSources, controls, changeControls } = useWidgetContext(WidgetType.FeatureCard);
|
|
7779
|
+
const { attributes, layerInfo, dataSources, controls, changeControls } = useWidgetContext(WidgetType.FeatureCard);
|
|
7777
7780
|
const [value, setValue] = useState();
|
|
7778
7781
|
const { options, attributeName } = elementConfig || {};
|
|
7779
|
-
const { relatedDataSource, label, width, placeholder = t("selectValue", { ns: "dashboard", defaultValue: "Выберите значение" }) } = options || {};
|
|
7782
|
+
const { relatedDataSource, label, width, controlName, placeholder = t("selectValue", { ns: "dashboard", defaultValue: "Выберите значение" }) } = options || {};
|
|
7783
|
+
const attrName = controlName || attributeName;
|
|
7780
7784
|
const dataSource = useMemo(() => getDataSource(relatedDataSource, dataSources), [relatedDataSource, dataSources]);
|
|
7781
7785
|
const items = useMemo(() => {
|
|
7782
|
-
if (!dataSource?.features?.length || !
|
|
7786
|
+
if (!dataSource?.features?.length || !attrName) {
|
|
7783
7787
|
return [];
|
|
7784
7788
|
}
|
|
7785
7789
|
return dataSource.features.map(({ attributes }) => ({
|
|
7786
|
-
value: attributes?.[
|
|
7787
|
-
text: attributes?.[
|
|
7790
|
+
value: attributes?.[attrName] || "",
|
|
7791
|
+
text: attributes?.[attrName] || "",
|
|
7788
7792
|
}));
|
|
7789
|
-
}, [dataSource?.features,
|
|
7793
|
+
}, [dataSource?.features, attrName]);
|
|
7794
|
+
const isDisabled = useMemo(() => {
|
|
7795
|
+
const attr = layerInfo?.configuration?.attributesConfiguration?.attributes?.find(({ attributeName }) => attributeName === attrName);
|
|
7796
|
+
return !attr?.isEditable;
|
|
7797
|
+
}, [attrName, layerInfo?.configuration?.attributesConfiguration?.attributes]);
|
|
7790
7798
|
const handleChange = useCallback(([option]) => {
|
|
7791
7799
|
setValue(option?.value);
|
|
7792
|
-
if (
|
|
7800
|
+
if (attrName && changeControls) {
|
|
7793
7801
|
changeControls({
|
|
7794
|
-
[
|
|
7802
|
+
[attrName]: option?.value,
|
|
7795
7803
|
});
|
|
7796
7804
|
}
|
|
7797
|
-
}, [changeControls,
|
|
7798
|
-
return (jsx(Dropdown, { zIndex: 1000, width: `${width ?? DEFAULT_DROPDOWN_WIDTH}px`, label: label, options: items, value: controls?.[
|
|
7805
|
+
}, [changeControls, attrName]);
|
|
7806
|
+
return (jsx(Dropdown, { zIndex: 1000, width: `${width ?? DEFAULT_DROPDOWN_WIDTH}px`, label: label, options: items, value: controls?.[attrName] ?? value, placeholder: placeholder, disabled: isDisabled, onChange: handleChange }));
|
|
7799
7807
|
};
|
|
7800
7808
|
|
|
7801
7809
|
const StyledIconFontSizeMixin = css `
|