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
## 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
### Minor Changes

View File

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

View File

@ -18,6 +18,7 @@ export interface BoxSelectTreeProps {
treeProps?: TreeProps
showOptions?: boolean
customImport?: any
extraBtns?: any
}
const BoxSelectTree: FC<BoxSelectTreeProps> = (props) => {
@ -35,6 +36,7 @@ const BoxSelectTree: FC<BoxSelectTreeProps> = (props) => {
searchInputProps,
treeProps,
customImport,
extraBtns,
showOptions = true
} = props
@ -60,6 +62,7 @@ const BoxSelectTree: FC<BoxSelectTreeProps> = (props) => {
onItemSelect={onItemSelect}
showOptions={showOptions}
customImport={customImport}
extraBtns={extraBtns}
/>
)
},
@ -80,6 +83,7 @@ const BoxSelectTree: FC<BoxSelectTreeProps> = (props) => {
onItemSelect={onItemSelect}
showOptions={showOptions}
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
title: BoxSelectTree 盒子树
demo:
cols: 2
cols: 4
group:
title: 进阶组件
order: 2
@ -13,6 +13,7 @@ group:
## 代码演示
<code src="./demo/basic.tsx">基本用法</code>
<code src="./demo/extraBtns.tsx">自定义其它按钮</code>
<code src="./demo/noOptions.tsx">不显示其它按钮</code>
## API

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,15 @@
# @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
### Patch Changes

View File

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

View File

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

View File

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