@antscorp/antsomi-ui 1.3.6-beta.39 → 1.3.6-beta.40
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/es/components/molecules/AddDynamicContent/components/DisplayFormat/DisplayFormat.d.ts +1 -0
- package/es/components/molecules/EditingListV2/EditingList.js +3 -2
- package/es/components/molecules/EditingListV2/components/List/List.js +10 -4
- package/es/components/molecules/EditingListV2/components/Popover/Popover.js +2 -1
- package/es/components/molecules/EditingListV2/types.d.ts +1 -0
- package/es/components/molecules/VirtualizedMenu/types.d.ts +1 -0
- package/es/components/template/TemplateListing/Loadable.d.ts +1 -0
- package/package.json +1 -1
|
@@ -6,12 +6,13 @@ import { Suspense } from '../../atoms';
|
|
|
6
6
|
import { ListItem, LazyComponent } from './components';
|
|
7
7
|
const { Popover } = LazyComponent;
|
|
8
8
|
export const EditingListV2 = (props) => {
|
|
9
|
-
const { isLoading = false, addButtonLabel = 'Add', options = [], selected = [], removable = true, popupPlacement = '
|
|
9
|
+
const { isLoading = false, addButtonLabel = 'Add', options = [], selected = [], removable = true, popupPlacement = 'leftBottom', className, onChange, } = props;
|
|
10
|
+
const popoverOptions = useMemo(() => options.filter(opt => !opt.errorMessage), [options]);
|
|
10
11
|
const selectedOptions = useMemo(() => options.filter(opt => selected.includes(opt.key)), [selected, options]);
|
|
11
12
|
// const isSelectAll = selectedOptions.length === options.length;
|
|
12
13
|
const handleRemove = (removedKey) => {
|
|
13
14
|
const selectedKeys = selectedOptions.filter(opt => opt.key !== removedKey).map(opt => opt.key);
|
|
14
15
|
onChange?.(selectedKeys);
|
|
15
16
|
};
|
|
16
|
-
return (_jsxs("div", { className: className, children: [_jsx(ListItem, { isLoading: isLoading, selectOptions: selectedOptions, removable: removable, onClickRemove: handleRemove }), !isLoading && (_jsx(Suspense, { children: _jsx(Popover, { placement: popupPlacement, options:
|
|
17
|
+
return (_jsxs("div", { className: className, children: [_jsx(ListItem, { isLoading: isLoading, selectOptions: selectedOptions, removable: removable, onClickRemove: handleRemove }), !isLoading && (_jsx(Suspense, { children: _jsx(Popover, { placement: popupPlacement, options: popoverOptions, selected: selected, addButtonLabel: addButtonLabel, onChange: onChange }) }))] }));
|
|
17
18
|
};
|
|
@@ -3,9 +3,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { isEmpty } from 'lodash';
|
|
5
5
|
// Components
|
|
6
|
-
import { Spin, Typography } from '../../../../atoms';
|
|
6
|
+
import { Spin, Typography, Tooltip } from '../../../../atoms';
|
|
7
7
|
import { List } from 'antd';
|
|
8
|
-
import { CloseIcon } from '@antscorp/antsomi-ui/es/components/icons';
|
|
8
|
+
import { CloseIcon, WarningIcon } from '@antscorp/antsomi-ui/es/components/icons';
|
|
9
9
|
// Utils
|
|
10
10
|
import { CLS } from '../../utils';
|
|
11
11
|
// Constants
|
|
@@ -22,6 +22,7 @@ export const ListItem = (props) => {
|
|
|
22
22
|
const items = selectOptions.map(opt => ({
|
|
23
23
|
className: CLS.ListItem.default,
|
|
24
24
|
key: opt.key,
|
|
25
|
+
errorMessage: opt.errorMessage,
|
|
25
26
|
label: renderLabel(opt.label),
|
|
26
27
|
}));
|
|
27
28
|
if (isLoading) {
|
|
@@ -33,10 +34,15 @@ export const ListItem = (props) => {
|
|
|
33
34
|
return (_jsx(List, { dataSource: items, renderItem: item => (_jsxs(List.Item, { style: {
|
|
34
35
|
display: 'flex',
|
|
35
36
|
alignItems: 'center',
|
|
36
|
-
border:
|
|
37
|
+
border: `1px solid ${item.errorMessage ? '#EF3340' : '#B8CFE6'}`,
|
|
37
38
|
borderRadius: '4px',
|
|
38
39
|
padding: '10px',
|
|
39
40
|
marginBottom: '10px',
|
|
40
41
|
minHeight: '40px',
|
|
41
|
-
}, onMouseEnter: () => setHover(item.key), onMouseLeave: () => setHover(''), children: [item.label,
|
|
42
|
+
}, onMouseEnter: () => setHover(item.key), onMouseLeave: () => setHover(''), children: [item.label, _jsxs("div", { style: {
|
|
43
|
+
flexShrink: 0,
|
|
44
|
+
display: 'flex',
|
|
45
|
+
alignItems: 'center',
|
|
46
|
+
gap: '5px',
|
|
47
|
+
}, children: [item.errorMessage && (_jsx(Tooltip, { title: item.errorMessage, children: _jsx(WarningIcon, { size: 18 }) })), hover === item.key && removable && (_jsx(CloseIcon, { size: 18, color: globalToken?.bw8, style: { cursor: 'pointer' }, onClick: onClickRemove ? () => onClickRemove(item.key) : undefined }))] })] })) }));
|
|
42
48
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* eslint-disable react/jsx-boolean-value */
|
|
2
3
|
// Components
|
|
3
4
|
import { Button } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
4
5
|
import { PopoverAddField } from '../../../SearchPopover';
|
|
@@ -6,5 +7,5 @@ import { PopoverAddField } from '../../../SearchPopover';
|
|
|
6
7
|
import { AddIcon } from '../../../../icons';
|
|
7
8
|
export const Popover = (props) => {
|
|
8
9
|
const { options, selected, addButtonLabel, onChange, placement } = props;
|
|
9
|
-
return (_jsx(PopoverAddField, { style: { margin: 0 }, fields: options, placement: placement, selected: selected, onApply: onChange, isAllowEmpty: true, children: _jsxs(Button, { type: "text", children: [_jsx(AddIcon, { size: 14 }), addButtonLabel] }) }));
|
|
10
|
+
return (_jsx(PopoverAddField, { style: { margin: 0, position: 'absolute' }, fields: options, placement: placement, selected: selected, onApply: onChange, isAllowEmpty: true, children: _jsxs(Button, { type: "text", children: [_jsx(AddIcon, { size: 14 }), addButtonLabel] }) }));
|
|
10
11
|
};
|