Skip to content

Commit 63060e9

Browse files
committed
feat: 上传版本1.0.0
0 parents  commit 63060e9

24 files changed

+530
-0
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false
14+
15+
[Makefile]
16+
indent_style = tab

.fatherrc.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export default {
2+
esm: 'rollup',
3+
cjs: 'rollup',
4+
};

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/npm-debug.log*
6+
/yarn-error.log
7+
/yarn.lock
8+
/package-lock.json
9+
10+
# production
11+
/dist
12+
/docs-dist
13+
14+
# misc
15+
.DS_Store
16+
17+
# umi
18+
.umi
19+
.umi-production
20+
.umi-test
21+
.env.local
22+
23+
# ide
24+
/.vscode
25+
/.idea

.prettierignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
**/*.svg
2+
**/*.ejs
3+
**/*.html
4+
package.json
5+
.umi
6+
.umi-production
7+
.umi-test

.prettierrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"printWidth": 80,
5+
"overrides": [
6+
{
7+
"files": ".prettierrc",
8+
"options": { "parser": "json" }
9+
}
10+
]
11+
}

.umirc.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { defineConfig } from 'dumi';
2+
3+
export default defineConfig({
4+
title: 'react-org-chart',
5+
favicon: '/images/logo.svg',
6+
logo: '/images/logo.svg',
7+
outputPath: 'docs-dist',
8+
base: '/react-org-chart',
9+
publicPath: '/',
10+
// more config: https://d.umijs.org/config
11+
});

CHANGELOG.md

Whitespace-only changes.

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# react-org-chart - 组织结构图
2+
3+
## 使用
4+
5+
```typescript
6+
import React from 'react';
7+
import OrgChart, { NodeDataType } from '@twp0217/react-org-chart';
8+
9+
export default () => {
10+
const data: NodeDataType = {
11+
key: 0,
12+
label: '科技有限公司',
13+
children: [
14+
{
15+
key: 1,
16+
label: '研发部',
17+
children: [
18+
{ key: 11, label: '开发-前端' },
19+
{ key: 12, label: '开发-后端' },
20+
{ key: 13, label: 'UI设计' },
21+
{ key: 14, label: '产品经理' },
22+
],
23+
},
24+
{
25+
key: 2,
26+
label: '销售部',
27+
children: [
28+
{ key: 21, label: '销售一部' },
29+
{ key: 22, label: '销售二部' },
30+
],
31+
},
32+
{ key: 3, label: '财务部' },
33+
{ key: 4, label: '人事部' },
34+
],
35+
};
36+
37+
return <OrgChart data={data} />;
38+
};
39+
```
40+
41+
## API
42+
43+
### NodeDataType
44+
45+
| 名称 | 类型 | 默认值 | 说明 |
46+
| --------- | ------------------- | ------ | ---------- |
47+
| key | string \| number | - | key |
48+
| label | number | - | label |
49+
| children | NodeDataType[] | - | 子节点集合 |
50+
| className | string | - | 类名 |
51+
| style | React.CSSProperties | - | 样式 |
52+
53+
### OrgChartProps
54+
55+
| 名称 | 类型 | 默认值 | 说明 |
56+
| ---------- | --------------------------------------------------------------------- | ------ | -------------- |
57+
| data | NodeDataType | - | 数据 |
58+
| className | string | - | 类名 |
59+
| style | React.CSSProperties | - | 样式 |
60+
| renderNode | (node: NodeDataType, originNode: React.ReactNode) => React.ReactNode; | - | 自定义渲染节点 |
61+
| onClick | (node: NodeDataType) => void | - | 点击事件 |

docs/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<embed src="../CHANGELOG.md"></embed>

docs/demo/basic.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## basic
2+
3+
<code src="../examples/basic.tsx" />

0 commit comments

Comments
 (0)