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