diff --git a/.changeset/many-flies-greet.md b/.changeset/many-flies-greet.md new file mode 100644 index 000000000..4e8419c41 --- /dev/null +++ b/.changeset/many-flies-greet.md @@ -0,0 +1,5 @@ +--- +"@hi-ui/tree-select": minor +--- + +feat: 新增支持前置后置内容 diff --git a/.changeset/plenty-monkeys-end.md b/.changeset/plenty-monkeys-end.md new file mode 100644 index 000000000..d0c3ef253 --- /dev/null +++ b/.changeset/plenty-monkeys-end.md @@ -0,0 +1,5 @@ +--- +"@hi-ui/hiui": patch +--- + +feat(tree-select): 新增支持前置后置内容 diff --git a/packages/ui/tree-select/src/TreeSelect.tsx b/packages/ui/tree-select/src/TreeSelect.tsx index ce2359901..a5f3f7283 100644 --- a/packages/ui/tree-select/src/TreeSelect.tsx +++ b/packages/ui/tree-select/src/TreeSelect.tsx @@ -76,6 +76,8 @@ export const TreeSelect = forwardRef( height, size = 'md', customRender, + prefix, + suffix, ...rest }, ref @@ -245,29 +247,22 @@ export const TreeSelect = forwardRef( onSearch={callAllFuncs(onSearchProp, onSearch)} loading={rest.loading !== undefined ? rest.loading : loading} trigger={ - customRender ? ( - typeof customRender === 'function' ? ( - customRender(selectedItem) - ) : ( - customRender - ) - ) : ( - : } - focused={menuVisible} - value={value} - onChange={tryChangeValue} - data={mergedData} - // @ts-ignore - invalid={invalid} - appearance={appearance} - /> - ) + : , suffix]} + focused={menuVisible} + value={value} + onChange={tryChangeValue} + data={mergedData} + // @ts-ignore + invalid={invalid} + appearance={appearance} + /> } > {isArrayNonEmpty(treeProps.data) ? ( @@ -413,6 +408,14 @@ export interface TreeSelectProps * 自定义触发器 */ customRender?: React.ReactNode | ((selectedItem: TreeSelectDataItem | null) => React.ReactNode) + /* + * 选择框前置内容 + */ + prefix?: React.ReactNode + /** + * 选择框后置内容 + */ + suffix?: React.ReactNode } if (__DEV__) {