|
@@ -36,7 +36,6 @@ import ConfigContext, { ContextValue } from '../configProvider/context';
|
|
import TagGroup from '../tag/group';
|
|
import TagGroup from '../tag/group';
|
|
import Tag, { TagProps } from '../tag/index';
|
|
import Tag, { TagProps } from '../tag/index';
|
|
import Input, { InputProps } from '../input/index';
|
|
import Input, { InputProps } from '../input/index';
|
|
-import Popover from '../popover/index';
|
|
|
|
import AutoSizer from '../tree/autoSizer';
|
|
import AutoSizer from '../tree/autoSizer';
|
|
import TreeContext from '../tree/treeContext';
|
|
import TreeContext from '../tree/treeContext';
|
|
import TreeNode from '../tree/treeNode';
|
|
import TreeNode from '../tree/treeNode';
|
|
@@ -51,6 +50,7 @@ import { OptionProps, TreeProps, TreeState, FlattenNode, TreeNodeData, TreeNodeP
|
|
import { Motion } from '../_base/base';
|
|
import { Motion } from '../_base/base';
|
|
import { IconChevronDown, IconClear, IconSearch } from '@douyinfe/semi-icons';
|
|
import { IconChevronDown, IconClear, IconSearch } from '@douyinfe/semi-icons';
|
|
import CheckboxGroup from '../checkbox/checkboxGroup';
|
|
import CheckboxGroup from '../checkbox/checkboxGroup';
|
|
|
|
+import Popover, { PopoverProps } from '../popover/index';
|
|
|
|
|
|
export type ExpandAction = false | 'click' | 'doubleClick';
|
|
export type ExpandAction = false | 'click' | 'doubleClick';
|
|
|
|
|
|
@@ -135,6 +135,7 @@ export interface TreeSelectProps extends Omit<BasicTreeSelectProps, OverrideComm
|
|
zIndex?: number;
|
|
zIndex?: number;
|
|
searchPosition?: string;
|
|
searchPosition?: string;
|
|
stopPropagation?: boolean | string;
|
|
stopPropagation?: boolean | string;
|
|
|
|
+ restTagsPopoverProps?: PopoverProps;
|
|
searchRender?: boolean | ((inputProps: InputProps) => React.ReactNode);
|
|
searchRender?: boolean | ((inputProps: InputProps) => React.ReactNode);
|
|
onSelect?: (selectedKeys: string, selected: boolean, selectedNode: TreeNodeData) => void;
|
|
onSelect?: (selectedKeys: string, selected: boolean, selectedNode: TreeNodeData) => void;
|
|
renderSelectedItem?: RenderSelectedItem;
|
|
renderSelectedItem?: RenderSelectedItem;
|
|
@@ -254,6 +255,8 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
|
|
renderSelectedItem: PropTypes.func,
|
|
renderSelectedItem: PropTypes.func,
|
|
checkRelation: PropTypes.string,
|
|
checkRelation: PropTypes.string,
|
|
'aria-label': PropTypes.string,
|
|
'aria-label': PropTypes.string,
|
|
|
|
+ showRestTagsPopover: PropTypes.bool,
|
|
|
|
+ restTagsPopoverProps: PropTypes.object,
|
|
};
|
|
};
|
|
|
|
|
|
static defaultProps: Partial<TreeSelectProps> = {
|
|
static defaultProps: Partial<TreeSelectProps> = {
|
|
@@ -282,7 +285,9 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
|
|
clickToHide: true,
|
|
clickToHide: true,
|
|
searchAutoFocus: false,
|
|
searchAutoFocus: false,
|
|
checkRelation: 'related',
|
|
checkRelation: 'related',
|
|
- 'aria-label': 'TreeSelect'
|
|
|
|
|
|
+ 'aria-label': 'TreeSelect',
|
|
|
|
+ showRestTagsPopover: false,
|
|
|
|
+ restTagsPopoverProps: {},
|
|
};
|
|
};
|
|
inputRef: React.RefObject<typeof Input>;
|
|
inputRef: React.RefObject<typeof Input>;
|
|
tagInputRef: React.RefObject<TagInput>;
|
|
tagInputRef: React.RefObject<TagInput>;
|
|
@@ -817,6 +822,8 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
|
|
maxTagCount,
|
|
maxTagCount,
|
|
searchPosition,
|
|
searchPosition,
|
|
filterTreeNode,
|
|
filterTreeNode,
|
|
|
|
+ showRestTagsPopover,
|
|
|
|
+ restTagsPopoverProps
|
|
} = this.props;
|
|
} = this.props;
|
|
const isTriggerPositionSearch = filterTreeNode && searchPosition === strings.SEARCH_POSITION_TRIGGER;
|
|
const isTriggerPositionSearch = filterTreeNode && searchPosition === strings.SEARCH_POSITION_TRIGGER;
|
|
// searchPosition = trigger
|
|
// searchPosition = trigger
|
|
@@ -840,6 +847,8 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
|
|
tagList={tagList}
|
|
tagList={tagList}
|
|
size="large"
|
|
size="large"
|
|
mode="custom"
|
|
mode="custom"
|
|
|
|
+ showPopover={showRestTagsPopover}
|
|
|
|
+ popoverProps={restTagsPopoverProps}
|
|
/>
|
|
/>
|
|
);
|
|
);
|
|
};
|
|
};
|
|
@@ -1085,6 +1094,8 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
|
|
placeholder,
|
|
placeholder,
|
|
maxTagCount,
|
|
maxTagCount,
|
|
checkRelation,
|
|
checkRelation,
|
|
|
|
+ showRestTagsPopover,
|
|
|
|
+ restTagsPopoverProps
|
|
} = this.props;
|
|
} = this.props;
|
|
const {
|
|
const {
|
|
keyEntities,
|
|
keyEntities,
|
|
@@ -1108,9 +1119,13 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
|
|
value={keyList}
|
|
value={keyList}
|
|
inputValue={inputValue}
|
|
inputValue={inputValue}
|
|
size={size}
|
|
size={size}
|
|
|
|
+ showRestTagsPopover={showRestTagsPopover}
|
|
|
|
+ restTagsPopoverProps={restTagsPopoverProps}
|
|
|
|
+ // eslint-disable-next-line jsx-a11y/no-autofocus
|
|
autoFocus={searchAutoFocus}
|
|
autoFocus={searchAutoFocus}
|
|
renderTagItem={(itemKey, index) => this.renderTagItem(itemKey, index)}
|
|
renderTagItem={(itemKey, index) => this.renderTagItem(itemKey, index)}
|
|
onRemove={itemKey => this.removeTag(itemKey)}
|
|
onRemove={itemKey => this.removeTag(itemKey)}
|
|
|
|
+ expandRestTagsOnClick={false}
|
|
/>
|
|
/>
|
|
);
|
|
);
|
|
};
|
|
};
|