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