@evergis/react 3.1.90 → 3.1.91
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/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +2 -4
- package/dist/react.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -7779,10 +7779,9 @@ const ElementChips = React.memo(({ type, elementConfig }) => {
|
|
|
7779
7779
|
const ElementControl = ({ elementConfig }) => {
|
|
7780
7780
|
const { t } = useGlobalContext();
|
|
7781
7781
|
const { attributes, layerInfo, dataSources, controls, changeControls } = useWidgetContext(exports.WidgetType.FeatureCard);
|
|
7782
|
-
const [value, setValue] = React.useState();
|
|
7783
7782
|
const { options, attributeName, defaultValue } = elementConfig || {};
|
|
7784
7783
|
const { relatedDataSource, label, width, control, placeholder = t("selectValue", { ns: "dashboard", defaultValue: "Выберите значение" }) } = options || {};
|
|
7785
|
-
const attribute = React.useMemo(() => attributes?.find(({ name }) => name ===
|
|
7784
|
+
const attribute = React.useMemo(() => attributes?.find(({ name }) => name === control?.targetAttributeName), [attributes, control?.targetAttributeName]);
|
|
7786
7785
|
const dataSource = React.useMemo(() => getDataSource(relatedDataSource, dataSources), [relatedDataSource, dataSources]);
|
|
7787
7786
|
const items = React.useMemo(() => {
|
|
7788
7787
|
if (!dataSource?.features?.length || !attributeName) {
|
|
@@ -7798,14 +7797,13 @@ const ElementControl = ({ elementConfig }) => {
|
|
|
7798
7797
|
return !attr?.isEditable;
|
|
7799
7798
|
}, [control?.targetAttributeName, layerInfo?.configuration?.attributesConfiguration?.attributes]);
|
|
7800
7799
|
const handleChange = React.useCallback(([option]) => {
|
|
7801
|
-
setValue(option?.value);
|
|
7802
7800
|
if (control?.targetAttributeName && changeControls) {
|
|
7803
7801
|
changeControls({
|
|
7804
7802
|
[control.targetAttributeName]: option?.value,
|
|
7805
7803
|
});
|
|
7806
7804
|
}
|
|
7807
7805
|
}, [changeControls, control?.targetAttributeName]);
|
|
7808
|
-
return (jsxRuntime.jsx(uilibGl.Dropdown, { zIndex: 1000, width: `${width ?? DEFAULT_DROPDOWN_WIDTH}px`, label: label, options: items, value: controls?.[control?.targetAttributeName] ??
|
|
7806
|
+
return (jsxRuntime.jsx(uilibGl.Dropdown, { zIndex: 1000, width: `${width ?? DEFAULT_DROPDOWN_WIDTH}px`, label: label, options: items, value: controls?.[control?.targetAttributeName] ?? attribute?.value ?? defaultValue, placeholder: placeholder, disabled: isDisabled, onChange: handleChange }));
|
|
7809
7807
|
};
|
|
7810
7808
|
|
|
7811
7809
|
const StyledIconFontSizeMixin = styled.css `
|