-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 增加子节点展开相关参数expandAll、expandable、onExpand
- Loading branch information
Showing
14 changed files
with
200 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# 1.0.0 (2021-09-08) | ||
|
||
### Features | ||
|
||
- 上传版本 1.0.0 ([63060e9](https://github.com/twp0217/react-org-chart/commit/63060e98760e60fd185933b0728beb07544a74e9)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
--- | ||
order: 1 | ||
--- | ||
|
||
## basic | ||
|
||
<code src="../examples/basic.tsx" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
--- | ||
order: 9 | ||
--- | ||
|
||
## event | ||
|
||
<code src="../examples/event.tsx" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
order: 3 | ||
--- | ||
|
||
## expandAll | ||
|
||
<code src="../examples/expandAll.tsx" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
order: 2 | ||
--- | ||
|
||
## expandable | ||
|
||
<code src="../examples/expandable.tsx" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React from 'react'; | ||
import OrgChart, { NodeDataType } from '@twp0217/react-org-chart'; | ||
|
||
export default () => { | ||
const data: NodeDataType = { | ||
key: 0, | ||
label: '科技有限公司', | ||
children: [ | ||
{ | ||
key: 1, | ||
label: '研发部', | ||
children: [ | ||
{ key: 11, label: '开发-前端' }, | ||
{ key: 12, label: '开发-后端' }, | ||
{ key: 13, label: 'UI设计' }, | ||
{ key: 14, label: '产品经理' }, | ||
], | ||
}, | ||
{ | ||
key: 2, | ||
label: '销售部', | ||
children: [ | ||
{ key: 21, label: '销售一部' }, | ||
{ key: 22, label: '销售二部' }, | ||
], | ||
}, | ||
{ key: 3, label: '财务部' }, | ||
{ key: 4, label: '人事部' }, | ||
], | ||
}; | ||
|
||
const [expandAll, setExpandAll] = React.useState<boolean>(false); | ||
|
||
return ( | ||
<div> | ||
<div> | ||
<button onClick={() => setExpandAll(!expandAll)}> | ||
{expandAll ? '收起' : '展开'} | ||
</button> | ||
</div> | ||
<br /> | ||
<OrgChart expandable data={data} expandAll={expandAll} /> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import React from 'react'; | ||
import OrgChart from '@twp0217/react-org-chart'; | ||
|
||
export default () => { | ||
const data = require('./data.json'); | ||
|
||
return <OrgChart data={data} expandable />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters