fix: 优化 boxSelectTree 组件,添加可以自定义配置按钮功能

This commit is contained in:
江志雄 2024-03-06 17:56:55 +08:00
parent 690fcd9e20
commit 35b99a3270
13 changed files with 82 additions and 6 deletions

View File

@ -1,5 +1,15 @@
# @zhst/biz # @zhst/biz
## 0.9.1
### Patch Changes
- 修改 boxSelectTree 类型提示
- Updated dependencies
- @zhst/hooks@0.8.2
- @zhst/func@0.7.3
- @zhst/meta@0.8.3
## 0.9.0 ## 0.9.0
### Minor Changes ### Minor Changes

View File

@ -1,6 +1,6 @@
{ {
"name": "@zhst/biz", "name": "@zhst/biz",
"version": "0.9.0", "version": "0.9.1",
"description": "业务库", "description": "业务库",
"keywords": [ "keywords": [
"business", "business",

View File

@ -18,6 +18,7 @@ export interface BoxSelectTreeProps {
treeProps?: TreeProps treeProps?: TreeProps
showOptions?: boolean showOptions?: boolean
customImport?: any customImport?: any
extraBtns?: any
} }
const BoxSelectTree: FC<BoxSelectTreeProps> = (props) => { const BoxSelectTree: FC<BoxSelectTreeProps> = (props) => {
@ -35,6 +36,7 @@ const BoxSelectTree: FC<BoxSelectTreeProps> = (props) => {
searchInputProps, searchInputProps,
treeProps, treeProps,
customImport, customImport,
extraBtns,
showOptions = true showOptions = true
} = props } = props
@ -60,6 +62,7 @@ const BoxSelectTree: FC<BoxSelectTreeProps> = (props) => {
onItemSelect={onItemSelect} onItemSelect={onItemSelect}
showOptions={showOptions} showOptions={showOptions}
customImport={customImport} customImport={customImport}
extraBtns={extraBtns}
/> />
) )
}, },
@ -80,6 +83,7 @@ const BoxSelectTree: FC<BoxSelectTreeProps> = (props) => {
onItemSelect={onItemSelect} onItemSelect={onItemSelect}
showOptions={showOptions} showOptions={showOptions}
customImport={customImport} customImport={customImport}
extraBtns={extraBtns}
/> />
) )
}, },

View File

@ -0,0 +1,29 @@
import React, { useState } from 'react';
import { BoxSelectTree } from '@zhst/biz';
import { treeData, boxDataSource } from './mock'
import { Button } from 'antd';
const demo = () => {
const [activeKey, setActiveKey] = useState('1')
const [checkedKeys, setCheckedKeys] = useState<string[]>([]);
return (
<div style={{ border: '1px solid #ccc', width: '340px', minHeight: '900px' }}>
<BoxSelectTree
data={activeKey === '1' ? treeData : boxDataSource}
boxDataSource={boxDataSource}
showOptions={false}
extraBtns={<Button type="dashed" style={{ color: 'green' }}></Button>}
tabsProps={{
activeKey,
}}
treeProps={{
checkedKeys
}}
/>
</div>
);
};
export default demo;

View File

@ -2,7 +2,7 @@
category: Components category: Components
title: BoxSelectTree 盒子树 title: BoxSelectTree 盒子树
demo: demo:
cols: 2 cols: 4
group: group:
title: 进阶组件 title: 进阶组件
order: 2 order: 2
@ -13,6 +13,7 @@ group:
## 代码演示 ## 代码演示
<code src="./demo/basic.tsx">基本用法</code> <code src="./demo/basic.tsx">基本用法</code>
<code src="./demo/extraBtns.tsx">自定义其它按钮</code>
<code src="./demo/noOptions.tsx">不显示其它按钮</code> <code src="./demo/noOptions.tsx">不显示其它按钮</code>
## API ## API

View File

@ -1,5 +1,13 @@
# @zhst/utils # @zhst/utils
## 0.7.3
### Patch Changes
- 修改 boxSelectTree 类型提示
- Updated dependencies
- @zhst/request@0.8.2
## 0.7.2 ## 0.7.2
### Patch Changes ### Patch Changes

View File

@ -1,6 +1,6 @@
{ {
"name": "@zhst/func", "name": "@zhst/func",
"version": "0.7.2", "version": "0.7.3",
"description": "函数合集", "description": "函数合集",
"keywords": [ "keywords": [
"hooks" "hooks"

View File

@ -1,5 +1,13 @@
# @zhst/hooks # @zhst/hooks
## 0.8.2
### Patch Changes
- 修改 boxSelectTree 类型提示
- Updated dependencies
- @zhst/func@0.7.3
## 0.8.1 ## 0.8.1
### Patch Changes ### Patch Changes

View File

@ -1,6 +1,6 @@
{ {
"name": "@zhst/hooks", "name": "@zhst/hooks",
"version": "0.8.1", "version": "0.8.2",
"description": "hooks合集", "description": "hooks合集",
"keywords": [ "keywords": [
"hooks" "hooks"

View File

@ -1,5 +1,15 @@
# @zhst/utils # @zhst/utils
## 0.8.3
### Patch Changes
- 修改 boxSelectTree 类型提示
- Updated dependencies
- @zhst/hooks@0.8.2
- @zhst/func@0.7.3
- @zhst/meta@0.8.3
## 0.8.2 ## 0.8.2
### Patch Changes ### Patch Changes

View File

@ -1,6 +1,6 @@
{ {
"name": "@zhst/meta", "name": "@zhst/meta",
"version": "0.8.2", "version": "0.8.3",
"description": "原子组件", "description": "原子组件",
"keywords": [ "keywords": [
"meta", "meta",

View File

@ -1,5 +1,11 @@
# @zhst/request # @zhst/request
## 0.8.2
### Patch Changes
- 修改 boxSelectTree 类型提示
## 0.8.1 ## 0.8.1
### Patch Changes ### Patch Changes

View File

@ -1,6 +1,6 @@
{ {
"name": "@zhst/request", "name": "@zhst/request",
"version": "0.8.1", "version": "0.8.2",
"description": "请求库", "description": "请求库",
"keywords": [ "keywords": [
"request", "request",