@evergis/react 3.1.120 → 3.1.121

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
@@ -7381,14 +7381,24 @@ const EditContainer = ({ type, elementConfig, renderElement }) => {
7381
7381
  return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), jsxs(Container, { id: id, isColumn: true, style: style, children: [jsx(ContainerAlias, { hasBottomMargin: true, children: renderElement({ id: "alias" }) }), jsx(ContainerValue, { children: renderElement({ id: "value" }) })] })] }));
7382
7382
  };
7383
7383
 
7384
+ const getControlTemplateName = (type) => {
7385
+ switch (type) {
7386
+ case "dropdown":
7387
+ default: return ContainerTemplate.EditDropdown;
7388
+ }
7389
+ };
7390
+
7384
7391
  const EditGroupContainer = memo(({ type, elementConfig, renderElement }) => {
7385
7392
  const { config, attributes, layerInfo, expandedContainers } = useWidgetContext(type);
7386
7393
  const getRenderContainerItem = useRenderContainerItem(type, renderElement);
7387
7394
  const { id, options } = elementConfig || {};
7388
7395
  const { editAttributes } = options || {};
7389
7396
  const renderContainer = useCallback((attribute) => {
7397
+ const editAttribute = editAttributes?.find(({ name }) => name === attribute);
7390
7398
  const itemAttribute = attributes.find(({ name }) => name === attribute);
7391
- const templateName = getTemplateNameFromAttribute(itemAttribute);
7399
+ const templateName = editAttribute?.type
7400
+ ? getControlTemplateName(editAttribute.type)
7401
+ : getTemplateNameFromAttribute(itemAttribute);
7392
7402
  const itemConfig = {
7393
7403
  ...elementConfig,
7394
7404
  children: elementConfig.children.map(child => ({ ...child, attributeName: attribute })),
@@ -7401,7 +7411,7 @@ const EditGroupContainer = memo(({ type, elementConfig, renderElement }) => {
7401
7411
  return null;
7402
7412
  }
7403
7413
  return (jsx(ContainerTemplateValue, { id: attribute, type: type, config: config, elementConfig: itemConfig, layerInfo: layerInfo, attributes: attributes, innerComponent: getContainerComponent(templateName), isVisible: isVisibleContainer(id, expandable, expanded, expandedContainers), renderElement: render }, attribute));
7404
- }, [id, attributes, elementConfig, expandedContainers]);
7414
+ }, [id, attributes, elementConfig, expandedContainers, editAttributes]);
7405
7415
  return editAttributes?.length ? (jsx(Fragment$1, { children: editAttributes.map(attribute => renderContainer(attribute.name)) })) : (renderContainer());
7406
7416
  });
7407
7417
 
@@ -7413,7 +7423,7 @@ const useEditAttribute = (type, elementConfig) => {
7413
7423
  const valueElement = children.find(({ id }) => id === "value");
7414
7424
  return valueElement?.attributeName;
7415
7425
  }, [children]);
7416
- const editAttribute = useMemo(() => editAttributes.find(({ name }) => name === attributeName), [editAttributes, attributeName]);
7426
+ const editAttribute = useMemo(() => editAttributes?.find(({ name }) => name === attributeName), [editAttributes, attributeName]);
7417
7427
  const attributeValue = useMemo(() => {
7418
7428
  const value = controls[attributeName] === undefined
7419
7429
  ? attributes.find(({ name }) => name === attributeName)?.value
@@ -7460,12 +7470,12 @@ const EditDropdownContainer = ({ type, elementConfig, renderElement }) => {
7460
7470
  const { id, style, options } = elementConfig || {};
7461
7471
  const { placeholder, label, width } = options || {};
7462
7472
  const optionsList = useMemo(() => dataSource?.features.map(item => {
7463
- const value = item[editAttribute?.name] || null;
7473
+ const value = item.attributes[editAttribute?.name] || null;
7464
7474
  return { text: value, value };
7465
7475
  }), [dataSource?.features, editAttribute.name]);
7466
7476
  const onChange = useCallback(([option]) => {
7467
- changeControls({ [editAttribute?.name]: option });
7468
- }, [editAttribute.name, changeControls]);
7477
+ changeControls({ [editAttribute?.name]: option.value });
7478
+ }, [editAttribute?.name, changeControls]);
7469
7479
  return (jsxs(Container, { id: id, isColumn: true, style: { ...BASE_STYLE, ...style }, children: [jsxs(ContainerAlias, { hasBottomMargin: true, children: [renderElement({ id: "alias" }), renderElement({ id: "tooltip" })] }), jsx(ContainerValue, { children: jsx(Dropdown, { zIndex: 1000, label: label, placeholder: placeholder, options: optionsList, value: attributeValue ?? editAttribute.defaultValue, width: `${width ?? DEFAULT_DROPDOWN_WIDTH}px`, onChange: onChange }) })] }));
7470
7480
  };
7471
7481