@quansitech/antd-admin 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Column/Cascader.tsx +78 -78
- package/components/Column/File.tsx +165 -167
- package/components/Column/Image.tsx +76 -76
- package/components/{Table/Option → Column/Readonly/Action}/Link.tsx +77 -67
- package/components/{Table/Option → Column/Readonly/Action}/types.d.ts +5 -4
- package/components/Column/Readonly/Action.tsx +80 -0
- package/components/Column/Readonly/Cascader.tsx +50 -50
- package/components/Column/Readonly/File.tsx +52 -53
- package/components/Column/Readonly/Image.tsx +38 -77
- package/components/Column/Readonly/Ueditor.tsx +18 -0
- package/components/Column/Readonly/types.d.ts +9 -8
- package/components/Column/Ueditor.tsx +313 -313
- package/components/Column/types.d.ts +29 -28
- package/components/Form/Action/Button.tsx +128 -124
- package/components/Form/Action/types.d.ts +5 -4
- package/components/Form/Actions.tsx +38 -34
- package/components/Form.tsx +176 -170
- package/components/FormContext.ts +8 -7
- package/components/Layout/New.tsx +252 -0
- package/components/Layout.tsx +52 -237
- package/components/LayoutContext.ts +25 -25
- package/components/ModalContext.ts +15 -15
- package/components/Table/Action/Button.tsx +88 -88
- package/components/Table/Action/StartEditable.tsx +58 -58
- package/components/Table/Action/types.d.ts +7 -6
- package/components/Table/ToolbarActions.tsx +43 -38
- package/components/Table.scss +4 -7
- package/components/Table.tsx +280 -279
- package/components/TableContext.ts +14 -13
- package/components/Tabs.tsx +71 -71
- package/lib/container.ts +83 -81
- package/lib/customRule.ts +9 -9
- package/lib/global.ts +10 -10
- package/lib/helpers.tsx +145 -149
- package/lib/http.ts +73 -73
- package/lib/schemaHandler.ts +121 -121
- package/lib/upload.ts +177 -177
- package/lib/writeExtra.js +31 -0
- package/package.json +2 -6
- package/readme.md +151 -128
- package/components/Column/Readonly/Option.tsx +0 -58
package/readme.md
CHANGED
|
@@ -1,128 +1,151 @@
|
|
|
1
|
-
# Qs-antd-admin
|
|
2
|
-
|
|
3
|
-
该项目作为qs-cmf的后台前端组件库,基于[ant-design-pro](https://procomponents.ant.design/components)
|
|
4
|
-
|
|
5
|
-
## 安装
|
|
6
|
-
|
|
7
|
-
```shell
|
|
8
|
-
npm install @quansitech/antd-admin
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## 使用参考
|
|
12
|
-
|
|
13
|
-
### valueType列表
|
|
14
|
-
|
|
15
|
-
参考 [ant-design-pro#valueType](https://procomponents.ant.design/components/schema#valuetype-%E5%88%97%E8%A1%A8)
|
|
16
|
-
|
|
17
|
-
## 自定义组件
|
|
18
|
-
|
|
19
|
-
对外暴露 [container](./lib/container.ts) 供外部调用
|
|
20
|
-
|
|
21
|
-
```ts
|
|
22
|
-
import container from "@quansitech/antd-admin/lib/container";
|
|
23
|
-
|
|
24
|
-
container.register('[组件名]', () => import('[组件路径]'));
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### 通用
|
|
28
|
-
|
|
29
|
-
#### 通用Column Schema
|
|
30
|
-
|
|
31
|
-
- 组件名前缀:``` Column. ```
|
|
32
|
-
- 用途:表单项组件(非只读模式)、表格列编辑组件、表格搜索项组件
|
|
33
|
-
- 示例:
|
|
34
|
-
|
|
35
|
-
```tsx
|
|
36
|
-
// [组件.tsx]
|
|
37
|
-
import {ColumnProps} from "@quansitech/antd-admin/compontents/Column/types";
|
|
38
|
-
|
|
39
|
-
export default function (props: ColumnProps) {
|
|
40
|
-
|
|
41
|
-
return <>
|
|
42
|
-
组件内容
|
|
43
|
-
</>
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// [app.tsx]
|
|
47
|
-
import container from "@quansitech/antd-admin/lib/container";
|
|
48
|
-
|
|
49
|
-
container.register('Column.组件名', () => import('[组件路径]'));
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
- 若要补充组件库,请把组件放``` compontents/Column/ ``` 目录下
|
|
53
|
-
|
|
54
|
-
#### 只读Column Schema
|
|
55
|
-
|
|
56
|
-
- 组件名前缀:``` Column.Readonly. ```
|
|
57
|
-
- 用途:表单项组件(只读模式)、表格列组件
|
|
58
|
-
- 示例:
|
|
59
|
-
|
|
60
|
-
```tsx
|
|
61
|
-
// [组件.tsx]
|
|
62
|
-
import {ColumnProps} from "@quansitech/antd-admin/compontents/Column/Readonly/types";
|
|
63
|
-
|
|
64
|
-
export default function (props: ColumnProps) {
|
|
65
|
-
|
|
66
|
-
return <>
|
|
67
|
-
组件内容
|
|
68
|
-
</>
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// [app.tsx]
|
|
72
|
-
import container from "@quansitech/antd-admin/lib/container";
|
|
73
|
-
|
|
74
|
-
container.register('Column.Readonly.组件名', () => import('[组件路径]'));
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
- 若要补充组件库,请把组件放``` compontents/Column/Readonly/ ``` 目录下
|
|
78
|
-
|
|
79
|
-
### 表格Table
|
|
80
|
-
|
|
81
|
-
#### 工具栏操作组件
|
|
82
|
-
|
|
83
|
-
- 组件名前缀:``` Table.Column.Action. ```
|
|
84
|
-
- 示例:
|
|
85
|
-
|
|
86
|
-
```tsx
|
|
87
|
-
// [组件.tsx]
|
|
88
|
-
|
|
89
|
-
import {TableActionProps} from "@quansitech/antd-admin/compontents/Table/Action/types";
|
|
90
|
-
|
|
91
|
-
export default function (props: TableActionProps) {
|
|
92
|
-
return <Button>{props.title}</Button>
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// [app.tsx]
|
|
96
|
-
|
|
97
|
-
import container from "@quansitech/antd-admin/lib/container";
|
|
98
|
-
|
|
99
|
-
container.register('Table.Column.Action.组件名', () => import('[组件路径]'));
|
|
100
|
-
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
- 若要补充组件库,请把组件放``` compontents/Table/Action/ ``` 目录下
|
|
104
|
-
|
|
105
|
-
#### 行操作组件
|
|
106
|
-
|
|
107
|
-
- 组件名前缀:``` Table.Column.Option ```
|
|
108
|
-
- 示例:
|
|
109
|
-
|
|
110
|
-
```tsx
|
|
111
|
-
// [组件.tsx]
|
|
112
|
-
|
|
113
|
-
import {TableColumnOptionProps} from "@quansitech/antd-admin/compontents/
|
|
114
|
-
|
|
115
|
-
export default function (props: TableColumnOptionProps) {
|
|
116
|
-
<a onClick={onClick}>{props.title}</a>
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// [app.tsx]
|
|
120
|
-
|
|
121
|
-
import container from "@quansitech/antd-admin/lib/container";
|
|
122
|
-
|
|
123
|
-
container.register('
|
|
124
|
-
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
- 若要补充组件库,请把组件放``` compontents/
|
|
128
|
-
|
|
1
|
+
# Qs-antd-admin
|
|
2
|
+
|
|
3
|
+
该项目作为qs-cmf的后台前端组件库,基于[ant-design-pro](https://procomponents.ant.design/components)
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```shell
|
|
8
|
+
npm install @quansitech/antd-admin
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 使用参考
|
|
12
|
+
|
|
13
|
+
### valueType列表
|
|
14
|
+
|
|
15
|
+
参考 [ant-design-pro#valueType](https://procomponents.ant.design/components/schema#valuetype-%E5%88%97%E8%A1%A8)
|
|
16
|
+
|
|
17
|
+
## 自定义组件
|
|
18
|
+
|
|
19
|
+
对外暴露 [container](./lib/container.ts) 供外部调用
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import container from "@quansitech/antd-admin/lib/container";
|
|
23
|
+
|
|
24
|
+
container.register('[组件名]', () => import('[组件路径]'));
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 通用
|
|
28
|
+
|
|
29
|
+
#### 通用Column Schema
|
|
30
|
+
|
|
31
|
+
- 组件名前缀:``` Column. ```
|
|
32
|
+
- 用途:表单项组件(非只读模式)、表格列编辑组件、表格搜索项组件
|
|
33
|
+
- 示例:
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
// [组件.tsx]
|
|
37
|
+
import {ColumnProps} from "@quansitech/antd-admin/compontents/Column/types";
|
|
38
|
+
|
|
39
|
+
export default function (props: ColumnProps) {
|
|
40
|
+
|
|
41
|
+
return <>
|
|
42
|
+
组件内容
|
|
43
|
+
</>
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// [app.tsx]
|
|
47
|
+
import container from "@quansitech/antd-admin/lib/container";
|
|
48
|
+
|
|
49
|
+
container.register('Column.组件名', () => import('[组件路径]'));
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
- 若要补充组件库,请把组件放``` compontents/Column/ ``` 目录下
|
|
53
|
+
|
|
54
|
+
#### 只读Column Schema
|
|
55
|
+
|
|
56
|
+
- 组件名前缀:``` Column.Readonly. ```
|
|
57
|
+
- 用途:表单项组件(只读模式)、表格列组件
|
|
58
|
+
- 示例:
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
// [组件.tsx]
|
|
62
|
+
import {ColumnProps} from "@quansitech/antd-admin/compontents/Column/Readonly/types";
|
|
63
|
+
|
|
64
|
+
export default function (props: ColumnProps) {
|
|
65
|
+
|
|
66
|
+
return <>
|
|
67
|
+
组件内容
|
|
68
|
+
</>
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// [app.tsx]
|
|
72
|
+
import container from "@quansitech/antd-admin/lib/container";
|
|
73
|
+
|
|
74
|
+
container.register('Column.Readonly.组件名', () => import('[组件路径]'));
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
- 若要补充组件库,请把组件放``` compontents/Column/Readonly/ ``` 目录下
|
|
78
|
+
|
|
79
|
+
### 表格Table
|
|
80
|
+
|
|
81
|
+
#### 工具栏操作组件
|
|
82
|
+
|
|
83
|
+
- 组件名前缀:``` Table.Column.Action. ```
|
|
84
|
+
- 示例:
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
// [组件.tsx]
|
|
88
|
+
|
|
89
|
+
import {TableActionProps} from "@quansitech/antd-admin/compontents/Table/Action/types";
|
|
90
|
+
|
|
91
|
+
export default function (props: TableActionProps) {
|
|
92
|
+
return <Button>{props.title}</Button>
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// [app.tsx]
|
|
96
|
+
|
|
97
|
+
import container from "@quansitech/antd-admin/lib/container";
|
|
98
|
+
|
|
99
|
+
container.register('Table.Column.Action.组件名', () => import('[组件路径]'));
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
- 若要补充组件库,请把组件放``` compontents/Table/Action/ ``` 目录下
|
|
104
|
+
|
|
105
|
+
#### 行操作组件
|
|
106
|
+
|
|
107
|
+
- 组件名前缀:``` Table.Column.Option ```
|
|
108
|
+
- 示例:
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
// [组件.tsx]
|
|
112
|
+
|
|
113
|
+
import {TableColumnOptionProps} from "@quansitech/antd-admin/compontents/Column/Readonly/Action/types";
|
|
114
|
+
|
|
115
|
+
export default function (props: TableColumnOptionProps) {
|
|
116
|
+
<a onClick={onClick}>{props.title}</a>
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// [app.tsx]
|
|
120
|
+
|
|
121
|
+
import container from "@quansitech/antd-admin/lib/container";
|
|
122
|
+
|
|
123
|
+
container.register('Column.Readonly.Action.组件名', () => import('[组件路径]'));
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
- 若要补充组件库,请把组件放``` compontents/Column/Readonly/Action/ ``` 目录下
|
|
128
|
+
|
|
129
|
+
## 更新日志
|
|
130
|
+
|
|
131
|
+
### 1.1.0
|
|
132
|
+
|
|
133
|
+
#### 1.增加composer包注册组件机制
|
|
134
|
+
|
|
135
|
+
在包的composer.json中添加如下配置
|
|
136
|
+
|
|
137
|
+
```json5
|
|
138
|
+
{
|
|
139
|
+
// 省略其它配置
|
|
140
|
+
"extra": {
|
|
141
|
+
"qscmf": {
|
|
142
|
+
"antd-admin": {
|
|
143
|
+
"component": {
|
|
144
|
+
"【container注册位置】": "【目标组件路径】",
|
|
145
|
+
"Column.Extra": "resourses/js/Component/Extra.tsx"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import {Component, lazy, useEffect, useState} from "react";
|
|
2
|
-
import {ReactComponentLike} from "prop-types";
|
|
3
|
-
import container from "../../../lib/container";
|
|
4
|
-
import {Flex} from "antd";
|
|
5
|
-
import {ColumnReadonlyProps} from "./types";
|
|
6
|
-
import {asyncFilter, handleRules} from "../../../lib/helpers";
|
|
7
|
-
import {Rules} from "@rc-component/async-validator/lib/interface";
|
|
8
|
-
import upperFirst from "lodash/upperFirst";
|
|
9
|
-
|
|
10
|
-
type ComponentType = {
|
|
11
|
-
component: ReactComponentLike,
|
|
12
|
-
props: any,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default ({options, record}: ColumnReadonlyProps & {
|
|
16
|
-
options?: {
|
|
17
|
-
type: string,
|
|
18
|
-
title: string,
|
|
19
|
-
showRules?: Rules,
|
|
20
|
-
}[],
|
|
21
|
-
}) => {
|
|
22
|
-
|
|
23
|
-
const [Components, setComponents] = useState<ComponentType[]>([]);
|
|
24
|
-
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
if (options) {
|
|
27
|
-
asyncFilter(options, async (Component) => {
|
|
28
|
-
if (!Component.showRules) {
|
|
29
|
-
return true
|
|
30
|
-
}
|
|
31
|
-
return await handleRules(Component.showRules, record)
|
|
32
|
-
}).then((Components: { type: string }[]) => setComponents(Components.map(a => {
|
|
33
|
-
const c = `Table.Option.${upperFirst(a.type)}`
|
|
34
|
-
return {
|
|
35
|
-
props: {
|
|
36
|
-
...a,
|
|
37
|
-
record,
|
|
38
|
-
},
|
|
39
|
-
component: lazy(container.get(c)),
|
|
40
|
-
}
|
|
41
|
-
})))
|
|
42
|
-
}
|
|
43
|
-
}, []);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return <>
|
|
47
|
-
{
|
|
48
|
-
<Flex wrap={true}>
|
|
49
|
-
{
|
|
50
|
-
Components.map(Component => {
|
|
51
|
-
return <Component.component
|
|
52
|
-
key={Component.props.title} {...Component.props}></Component.component>
|
|
53
|
-
})
|
|
54
|
-
}
|
|
55
|
-
</Flex>
|
|
56
|
-
}
|
|
57
|
-
</>
|
|
58
|
-
}
|