@evergis/react 4.0.23-alpha.2 → 4.0.23-alpha.3
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
|
@@ -7501,7 +7501,10 @@ const EditGroupContainer = memo(({ type, elementConfig, renderElement }) => {
|
|
|
7501
7501
|
layerInfo,
|
|
7502
7502
|
expandedContainers,
|
|
7503
7503
|
]);
|
|
7504
|
-
|
|
7504
|
+
if (!controls?.length) {
|
|
7505
|
+
return (jsx(Fragment$1, { children: attributes.map(({ attributeName }) => renderContainer(attributeName)) }));
|
|
7506
|
+
}
|
|
7507
|
+
return (jsx(Fragment$1, { children: controls.map(({ targetAttributeName }) => renderContainer(targetAttributeName)) }));
|
|
7505
7508
|
});
|
|
7506
7509
|
|
|
7507
7510
|
const useEditControl = (type, elementConfig) => {
|
|
@@ -7510,25 +7513,26 @@ const useEditControl = (type, elementConfig) => {
|
|
|
7510
7513
|
const { controls: controlsOption } = options || {};
|
|
7511
7514
|
const valueElement = useMemo(() => children.find(({ id }) => id === "value"), [children]);
|
|
7512
7515
|
const control = useMemo(() => controlsOption?.find(item => item.targetAttributeName === valueElement.attributeName), [controlsOption, valueElement.attributeName]);
|
|
7516
|
+
const attributeName = (control?.targetAttributeName ?? valueElement?.attributeName);
|
|
7513
7517
|
const value = useMemo(() => {
|
|
7514
|
-
const currentValue = controls[
|
|
7515
|
-
? attributes.find(({ attributeName }) =>
|
|
7516
|
-
: controls[
|
|
7518
|
+
const currentValue = controls[attributeName] === undefined
|
|
7519
|
+
? attributes.find(({ attributeName: name }) => name === attributeName)?.value
|
|
7520
|
+
: controls[attributeName];
|
|
7517
7521
|
return currentValue ?? control?.defaultValue;
|
|
7518
7522
|
}, [
|
|
7519
7523
|
controls,
|
|
7520
|
-
|
|
7524
|
+
attributeName,
|
|
7521
7525
|
control?.defaultValue,
|
|
7522
7526
|
attributes,
|
|
7523
7527
|
]);
|
|
7524
|
-
const dataSource = useMemo(() => dataSources?.find(({ name }) => name === control
|
|
7528
|
+
const dataSource = useMemo(() => dataSources?.find(({ name }) => name === control?.relatedDataSource), [control?.relatedDataSource, dataSources]);
|
|
7525
7529
|
const items = useMemo(() => control?.variants?.map(v => String(v.text || v.value)) ||
|
|
7526
7530
|
dataSource?.features.map(item => item.properties[control?.attributeName] || null) || [], [control?.variants, dataSource?.features, control?.attributeName]);
|
|
7527
7531
|
const onChange = useCallback((newValue) => {
|
|
7528
7532
|
changeControls({
|
|
7529
|
-
[
|
|
7533
|
+
[attributeName]: newValue,
|
|
7530
7534
|
});
|
|
7531
|
-
}, [changeControls,
|
|
7535
|
+
}, [changeControls, attributeName]);
|
|
7532
7536
|
return useMemo(() => ({ control, value, dataSource, items, onChange }), [control, value, dataSource, items, onChange]);
|
|
7533
7537
|
};
|
|
7534
7538
|
|
|
@@ -7556,14 +7560,14 @@ const EditStringContainer = ({ type, elementConfig, renderElement, }) => {
|
|
|
7556
7560
|
const EditNumberContainer = ({ type, elementConfig, renderElement, }) => {
|
|
7557
7561
|
const { value, control, onChange } = useEditControl(type, elementConfig);
|
|
7558
7562
|
const { id, style } = elementConfig || {};
|
|
7559
|
-
return (jsxs(Container, { id: id, isColumn: true, style: { ...BASE_CONTAINER_STYLE, ...style }, children: [jsxs(ContainerAlias, { hasBottomMargin: true, children: [renderElement({ id: "alias" }), renderElement({ id: "tooltip" })] }), jsxs(ContainerValue, { column: true, children: [jsx(Input, { value: value?.toString(), width: "100%", onChange: (e) => onChange(e.target.value) }), jsx(Slider, { value: value, min: control
|
|
7563
|
+
return (jsxs(Container, { id: id, isColumn: true, style: { ...BASE_CONTAINER_STYLE, ...style }, children: [jsxs(ContainerAlias, { hasBottomMargin: true, children: [renderElement({ id: "alias" }), renderElement({ id: "tooltip" })] }), jsxs(ContainerValue, { column: true, children: [jsx(Input, { value: value?.toString(), width: "100%", onChange: (e) => onChange(e.target.value) }), jsx(Slider, { value: value, min: control?.minValue, max: control?.maxValue, step: control?.step, sliderWidth: "100%", primary: true, onChange: onChange })] })] }));
|
|
7560
7564
|
};
|
|
7561
7565
|
|
|
7562
7566
|
const EditDropdownContainer = ({ type, elementConfig, renderElement, }) => {
|
|
7563
7567
|
const { value, control, items, onChange } = useEditControl(type, elementConfig);
|
|
7564
7568
|
const { id, style } = elementConfig || {};
|
|
7565
7569
|
const optionsList = useMemo(() => items.map(item => ({ text: item, value: item })), [items]);
|
|
7566
|
-
return (jsxs(Container, { id: id, isColumn: true, style: { ...BASE_CONTAINER_STYLE, ...style }, children: [jsxs(ContainerAlias, { hasBottomMargin: true, children: [renderElement({ id: "alias" }), renderElement({ id: "tooltip" })] }), jsx(ContainerValue, { column: true, children: jsx(Dropdown, { zIndex: 1000, label: control
|
|
7570
|
+
return (jsxs(Container, { id: id, isColumn: true, style: { ...BASE_CONTAINER_STYLE, ...style }, children: [jsxs(ContainerAlias, { hasBottomMargin: true, children: [renderElement({ id: "alias" }), renderElement({ id: "tooltip" })] }), jsx(ContainerValue, { column: true, children: jsx(Dropdown, { zIndex: 1000, label: control?.label, placeholder: control?.placeholder, options: optionsList, value: value, width: `${control?.width ?? DEFAULT_DROPDOWN_WIDTH}px`, onChange: ([option]) => onChange(option.value) }) })] }));
|
|
7567
7571
|
};
|
|
7568
7572
|
|
|
7569
7573
|
const CheckboxWrapper = styled(ContainerValue) `
|