@antscorp/antsomi-ui 1.3.5-beta.964 → 1.3.5-beta.966
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.
|
@@ -8,8 +8,8 @@ import SelectTag from './SelectTag';
|
|
|
8
8
|
import { defaultProps } from './constants';
|
|
9
9
|
export const SelectAssociatedTag = (props) => {
|
|
10
10
|
// Props
|
|
11
|
-
const { tagConfigs, style, selected, options, children, onSelect } = props;
|
|
11
|
+
const { tagConfigs, style, selected, disabled, options, children, onSelect } = props;
|
|
12
12
|
const { tag, value } = selected || {};
|
|
13
|
-
return (_jsxs(StyledSpace, { className: "select-associated-tag", style: style, children: [_jsx(SelectTag, { ...tagConfigs, selectedTag: tag }), _jsx(Divider, { type: "vertical", style: { margin: '0px 1px 0px 6px' } }), children ?? (_jsx(Select, { style: { width: '100%', height: '100%' }, value: value, options: options, onChange: onSelect }))] }));
|
|
13
|
+
return (_jsxs(StyledSpace, { className: "select-associated-tag", style: style, children: [_jsx(SelectTag, { ...tagConfigs, selectedTag: tag }), _jsx(Divider, { type: "vertical", style: { margin: '0px 1px 0px 6px' }, className: "antsomi-divider-between-select" }), children ?? (_jsx(Select, { style: { width: '100%', height: '100%' }, value: value, disabled: disabled, options: options, onChange: onSelect }))] }));
|
|
14
14
|
};
|
|
15
15
|
SelectAssociatedTag.defaultProps = defaultProps;
|
|
@@ -8,7 +8,7 @@ import { Popover } from '../Popover';
|
|
|
8
8
|
import { SelectedTag } from './styled';
|
|
9
9
|
const SelectTag = (props) => {
|
|
10
10
|
// Props
|
|
11
|
-
const { selectedTag, title, options, onSelect } = props;
|
|
11
|
+
const { selectedTag, disabled, title, options, onSelect } = props;
|
|
12
12
|
// State
|
|
13
13
|
const [open, setOpen] = useState(false);
|
|
14
14
|
// Memoized
|
|
@@ -21,6 +21,6 @@ const SelectTag = (props) => {
|
|
|
21
21
|
setOpen(false);
|
|
22
22
|
onSelect(item);
|
|
23
23
|
};
|
|
24
|
-
return (_jsx(Popover, { open: open, title: _jsx(Typography.Text, { style: { fontWeight: '400', maxWidth: 130 }, ellipsis: { tooltip: title }, children: title }), content: _jsx(Flex, { wrap: "wrap", gap: 6, style: { padding: '10px 0px' }, children: options?.map(item => (_jsx(SelectedTag, { "$color": item.color, "$background": item.background, ellipsis: { tooltip: item.label }, onClick: () => handleClick(item), children: item.label }, item.value))) }), placement: "bottomLeft", trigger: "click", overlayInnerStyle: { padding: 10, maxWidth: 150 }, onOpenChange: handleOpenChange, children: _jsx(SelectedTag, { "$color": selectedItem?.color, "$background": selectedItem?.background, ellipsis: { tooltip: selectedItem?.label }, children: selectedItem?.label }) }));
|
|
24
|
+
return (_jsx(Popover, { open: open && !disabled, title: _jsx(Typography.Text, { style: { fontWeight: '400', maxWidth: 130 }, ellipsis: { tooltip: title }, children: title }), content: _jsx(Flex, { wrap: "wrap", gap: 6, style: { padding: '10px 0px' }, children: options?.map(item => (_jsx(SelectedTag, { "$color": item.color, "$background": item.background, ellipsis: { tooltip: item.label }, onClick: () => handleClick(item), children: item.label }, item.value))) }), placement: "bottomLeft", trigger: "click", overlayInnerStyle: { padding: 10, maxWidth: 150 }, onOpenChange: handleOpenChange, children: _jsx(SelectedTag, { "$color": selectedItem?.color, "$background": selectedItem?.background, ellipsis: { tooltip: selectedItem?.label }, children: selectedItem?.label }) }));
|
|
25
25
|
};
|
|
26
26
|
export default memo(SelectTag);
|
|
@@ -9,6 +9,7 @@ export type TagItem = {
|
|
|
9
9
|
export interface TagConfigProps {
|
|
10
10
|
selectedTag: TagItem['value'];
|
|
11
11
|
title?: string;
|
|
12
|
+
disabled?: boolean;
|
|
12
13
|
options: TagItem[];
|
|
13
14
|
onSelect: (newItem: TagItem) => void;
|
|
14
15
|
}
|
|
@@ -41,6 +42,11 @@ export interface SelectAssociatedTagProps {
|
|
|
41
42
|
*/
|
|
42
43
|
value: Dictionary<SelectOption>;
|
|
43
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* Whether the SelectAssociatedTag is disabled.
|
|
47
|
+
* @type {boolean}
|
|
48
|
+
*/
|
|
49
|
+
disabled?: boolean;
|
|
44
50
|
/**
|
|
45
51
|
* A list of selectable options.
|
|
46
52
|
* @type {SelectOption[]}
|