@vue-start/pro 0.4.11 → 0.4.12

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/CHANGELOG.md CHANGED
@@ -1,77 +1,77 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- # [0.4.0](https://github.com/zxeryu/vue-start/compare/@vue-start/pro@0.3.2...@vue-start/pro@0.4.0) (2022-09-02)
7
-
8
- ### Bug Fixes
9
-
10
- - **pro:** curd columns sign ([19ca887](https://github.com/zxeryu/vue-start/commit/19ca887b2f0826c64a0cae7b6abe093ab6d1f525))
11
- - **pro:** dispatch support fun ([9c9528c](https://github.com/zxeryu/vue-start/commit/9c9528cf305e6e3bf1daebc57afb5d5ac9d9fd21))
12
-
13
- ### Features
14
-
15
- - module render ([1e14e95](https://github.com/zxeryu/vue-start/commit/1e14e956e8712db277d2e9020b392243b454a846))
16
-
17
- ### Performance Improvements
18
-
19
- - props/slots convert ([06c9655](https://github.com/zxeryu/vue-start/commit/06c9655f0622278e18770699b1d643fe10cbbdca))
20
-
21
- ## [0.3.2](https://github.com/zxeryu/vue-start/compare/@vue-start/pro@0.3.1...@vue-start/pro@0.3.2) (2022-08-29)
22
-
23
- ### Bug Fixes
24
-
25
- - bug ([766cfc0](https://github.com/zxeryu/vue-start/commit/766cfc00c621bc4a9b30087540043a96db2df9be))
26
-
27
- ## [0.3.1](https://github.com/zxeryu/vue-start/compare/@vue-start/pro@0.3.0...@vue-start/pro@0.3.1) (2022-08-23)
28
-
29
- ### Bug Fixes
30
-
31
- - **pro:** merge bug ([1155218](https://github.com/zxeryu/vue-start/commit/115521827bc31c11091c23d16a596bd825aedcf1))
32
-
33
- # [0.3.0](https://github.com/zxeryu/vue-start/compare/@vue-start/pro@0.2.0...@vue-start/pro@0.3.0) (2022-08-22)
34
-
35
- ### Bug Fixes
36
-
37
- - **element-pro:** loading ([c512f63](https://github.com/zxeryu/vue-start/commit/c512f638f06acab64242bf85b2475b860097061e))
38
- - **element-pro:** serial number for table ([32e12aa](https://github.com/zxeryu/vue-start/commit/32e12aa6bdd494464bc2839eaaed5d8ce66330a5))
39
- - **pro:** ts error ([2daa4e9](https://github.com/zxeryu/vue-start/commit/2daa4e95031a52526860fbc863087aaedd30e3ff))
40
-
41
- ### Features
42
-
43
- - **pro:** modal/page curd ([07b696c](https://github.com/zxeryu/vue-start/commit/07b696cf2a327d4ec083ec75f3d5b73c870bfcb3))
44
-
45
- ### Performance Improvements
46
-
47
- - **pro:** columnState for table,form ([7f4431e](https://github.com/zxeryu/vue-start/commit/7f4431ebf2d426b93a24e381712d705700561ec9))
48
-
49
- # [0.2.0](https://github.com/zxeryu/vue-start/compare/@vue-start/pro@0.1.0...@vue-start/pro@0.2.0) (2022-08-17)
50
-
51
- ### Bug Fixes
52
-
53
- - **element-pro:** bug ([2e4c694](https://github.com/zxeryu/vue-start/commit/2e4c69469a3babd4d08ea13c934a71a31df5b743))
54
- - **element-pro:** grid ([6b435c7](https://github.com/zxeryu/vue-start/commit/6b435c796890dc1e253f35f7b622bb14041c01cf))
55
- - **pro:** curd sub action ([f389009](https://github.com/zxeryu/vue-start/commit/f389009b9890844d51c6ad92279ac308e7686517))
56
- - **pro:** refresh list ([d07ff48](https://github.com/zxeryu/vue-start/commit/d07ff484918271516db2aeca7727eb83dfad63ff))
57
- - **request:** support provide ([212a41b](https://github.com/zxeryu/vue-start/commit/212a41b3c056c3acf38d65c3f1e7a8e388bc9052))
58
-
59
- ### Features
60
-
61
- - **pro:** abstract form ([f848aab](https://github.com/zxeryu/vue-start/commit/f848aabe5bec62600f7eb3575c85654ed778b3c6))
62
- - **pro:** abstract table ([3c26fde](https://github.com/zxeryu/vue-start/commit/3c26fde0f72e541bf3d2176c91748c7d8105341d))
63
-
64
- # 0.1.0 (2022-08-12)
65
-
66
- ### Bug Fixes
67
-
68
- - **element-pro:** curd schema form ([175f9e7](https://github.com/zxeryu/vue-start/commit/175f9e70482009afd118573be6e716535f584043))
69
- - **pro:** curd request props ([daf2fca](https://github.com/zxeryu/vue-start/commit/daf2fca7876c2a9f4c155400edb3fdd99fa9f825))
70
-
71
- ### Features
72
-
73
- - **pro:** pro 组件抽象层重构 ([0ba27c5](https://github.com/zxeryu/vue-start/commit/0ba27c591c7a6eebce2c1986908e295194a6f326))
74
-
75
- ### Performance Improvements
76
-
77
- - **pro:** requests to operates ([9b69165](https://github.com/zxeryu/vue-start/commit/9b6916582a4c15a7012c3267126b00c065b32d23))
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ # [0.4.0](https://github.com/zxeryu/vue-start/compare/@vue-start/pro@0.3.2...@vue-start/pro@0.4.0) (2022-09-02)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **pro:** curd columns sign ([19ca887](https://github.com/zxeryu/vue-start/commit/19ca887b2f0826c64a0cae7b6abe093ab6d1f525))
11
+ - **pro:** dispatch support fun ([9c9528c](https://github.com/zxeryu/vue-start/commit/9c9528cf305e6e3bf1daebc57afb5d5ac9d9fd21))
12
+
13
+ ### Features
14
+
15
+ - module render ([1e14e95](https://github.com/zxeryu/vue-start/commit/1e14e956e8712db277d2e9020b392243b454a846))
16
+
17
+ ### Performance Improvements
18
+
19
+ - props/slots convert ([06c9655](https://github.com/zxeryu/vue-start/commit/06c9655f0622278e18770699b1d643fe10cbbdca))
20
+
21
+ ## [0.3.2](https://github.com/zxeryu/vue-start/compare/@vue-start/pro@0.3.1...@vue-start/pro@0.3.2) (2022-08-29)
22
+
23
+ ### Bug Fixes
24
+
25
+ - bug ([766cfc0](https://github.com/zxeryu/vue-start/commit/766cfc00c621bc4a9b30087540043a96db2df9be))
26
+
27
+ ## [0.3.1](https://github.com/zxeryu/vue-start/compare/@vue-start/pro@0.3.0...@vue-start/pro@0.3.1) (2022-08-23)
28
+
29
+ ### Bug Fixes
30
+
31
+ - **pro:** merge bug ([1155218](https://github.com/zxeryu/vue-start/commit/115521827bc31c11091c23d16a596bd825aedcf1))
32
+
33
+ # [0.3.0](https://github.com/zxeryu/vue-start/compare/@vue-start/pro@0.2.0...@vue-start/pro@0.3.0) (2022-08-22)
34
+
35
+ ### Bug Fixes
36
+
37
+ - **element-pro:** loading ([c512f63](https://github.com/zxeryu/vue-start/commit/c512f638f06acab64242bf85b2475b860097061e))
38
+ - **element-pro:** serial number for table ([32e12aa](https://github.com/zxeryu/vue-start/commit/32e12aa6bdd494464bc2839eaaed5d8ce66330a5))
39
+ - **pro:** ts error ([2daa4e9](https://github.com/zxeryu/vue-start/commit/2daa4e95031a52526860fbc863087aaedd30e3ff))
40
+
41
+ ### Features
42
+
43
+ - **pro:** modal/page curd ([07b696c](https://github.com/zxeryu/vue-start/commit/07b696cf2a327d4ec083ec75f3d5b73c870bfcb3))
44
+
45
+ ### Performance Improvements
46
+
47
+ - **pro:** columnState for table,form ([7f4431e](https://github.com/zxeryu/vue-start/commit/7f4431ebf2d426b93a24e381712d705700561ec9))
48
+
49
+ # [0.2.0](https://github.com/zxeryu/vue-start/compare/@vue-start/pro@0.1.0...@vue-start/pro@0.2.0) (2022-08-17)
50
+
51
+ ### Bug Fixes
52
+
53
+ - **element-pro:** bug ([2e4c694](https://github.com/zxeryu/vue-start/commit/2e4c69469a3babd4d08ea13c934a71a31df5b743))
54
+ - **element-pro:** grid ([6b435c7](https://github.com/zxeryu/vue-start/commit/6b435c796890dc1e253f35f7b622bb14041c01cf))
55
+ - **pro:** curd sub action ([f389009](https://github.com/zxeryu/vue-start/commit/f389009b9890844d51c6ad92279ac308e7686517))
56
+ - **pro:** refresh list ([d07ff48](https://github.com/zxeryu/vue-start/commit/d07ff484918271516db2aeca7727eb83dfad63ff))
57
+ - **request:** support provide ([212a41b](https://github.com/zxeryu/vue-start/commit/212a41b3c056c3acf38d65c3f1e7a8e388bc9052))
58
+
59
+ ### Features
60
+
61
+ - **pro:** abstract form ([f848aab](https://github.com/zxeryu/vue-start/commit/f848aabe5bec62600f7eb3575c85654ed778b3c6))
62
+ - **pro:** abstract table ([3c26fde](https://github.com/zxeryu/vue-start/commit/3c26fde0f72e541bf3d2176c91748c7d8105341d))
63
+
64
+ # 0.1.0 (2022-08-12)
65
+
66
+ ### Bug Fixes
67
+
68
+ - **element-pro:** curd schema form ([175f9e7](https://github.com/zxeryu/vue-start/commit/175f9e70482009afd118573be6e716535f584043))
69
+ - **pro:** curd request props ([daf2fca](https://github.com/zxeryu/vue-start/commit/daf2fca7876c2a9f4c155400edb3fdd99fa9f825))
70
+
71
+ ### Features
72
+
73
+ - **pro:** pro 组件抽象层重构 ([0ba27c5](https://github.com/zxeryu/vue-start/commit/0ba27c591c7a6eebce2c1986908e295194a6f326))
74
+
75
+ ### Performance Improvements
76
+
77
+ - **pro:** requests to operates ([9b69165](https://github.com/zxeryu/vue-start/commit/9b6916582a4c15a7012c3267126b00c065b32d23))
package/README.md CHANGED
@@ -1,149 +1,149 @@
1
- # pro 系列组件
2
-
3
- > 基于 ant-design-vue 和 element-plus 组件库,提供更高程度的抽象,提供更上层的设计规范,并且对应提供相应的组件使得开发者可以快速搭建出高质量的页面。
4
-
5
- > @vue-start/pro 是一个实现了 pro 模式的抽象库,具体 UI 组件需要从对应的实现库引用:@vue-start/element-pro @vue-start/antd-pro
6
-
7
- ## 通用配置
8
-
9
- ### column
10
-
11
- 基础 column 配置基于 ant-design-vue 中 table 的 column,扩展了部分字段。让其可以满足更多需求。
12
-
13
- | 字段名称 | 类型 | 说明 |
14
- | ---------------- | -------------------- | ------------------------------------------------------------- |
15
- | `valueType` | `string` | 对应组件,缺省值为 text,自带了一部分,也可以自定义 valueType |
16
- | `formValueType` | `string` | 同 valueType,在 form 组件中使用该类型,默认为 valueType 的值 |
17
- | `title` | `string` `VNode` | 标题的内容,在 form 中是 label |
18
- | `dataIndex` | `string` | 与实体映射的 key,在 form 中是 name |
19
- | `formItemProps` | `formItemProps` | 传递给 FormItem 的配置 |
20
- | `formFieldProps` | `fieldProps` | 传给渲染的组件的 props,自定义的时候也会传递 |
21
- | `search` | `boolean` `signName` | 为 true 时,在 SearchForm 中显示 |
22
- | `form` | `boolean` `signName` | 为 false 时,在 Form 中隐藏 |
23
- | `table` | `boolean` `signName` | 为 false 时,在 Table 中隐藏 |
24
- | `detail` | `boolean` `signName` | 为 false 时,在 Desc 中隐藏 |
25
-
26
- 注:`signName` 可以在组件中设置,上述 search、form、table、detail 都为默认值。
27
-
28
- ```typescript
29
- export type TColumn = {
30
- title?: string | VNode;
31
- dataIndex?: string | number;
32
- valueType?: TValueType; //展示组件类型
33
- formValueType?: TValueType; //录入组件类型 如不存在,默认取valueType的值
34
- showProps?: Record<string, any>; //文字展示组件的props
35
- formItemProps?: { name?: string; label?: string }; //FormItem props
36
- formFieldProps?: Record<string, any>; //录入组件 props
37
- search?: boolean; //同extra中的search
38
- //拓展属性
39
- extra?: {
40
- //DescriptionsItem props
41
- desc?: Record<string, any>;
42
- //Col props
43
- col?: Record<string, any>;
44
- /**
45
- * 自定义标记,对columns进行筛选 和 排序
46
- * 默认支持:search、form、table、detail
47
- * 比如: search:标记搜索条件;searchSort:搜索项的顺序
48
- * 在Curd组件中可使用getSignColumns方法获取标记的Columns
49
- * [sign]: boolean 标记
50
- * [`${sign}Sort`]: 标记的columns排序
51
- */
52
- } & Record<string, any>;
53
- };
54
- ```
55
-
56
- ### columnState
57
-
58
- - 对 column 进行补充。在实际使用过程中,column 通常作为静态数据配置,当需要为 column 加入动态数据时候可配置.
59
- - 若 column 为 hook 或者计算(computed 生成)值,则不需要使用 columnState
60
-
61
- ```typescript
62
- //组件会将[id]的值 merge 到对应的column中
63
- type TColumnState = {
64
- //优先使用formItemProps中的name属性
65
- //id: column.formItemProps.name || column.dataIndex
66
- [id]: object;
67
- };
68
-
69
- const columns = [
70
- {
71
- title: "select",
72
- dataIndex: "select",
73
- },
74
- ];
75
-
76
- const columnState = {
77
- select: {
78
- formFieldProps: {
79
- options: [{ value: "value-1", label: "label-1" }],
80
- },
81
- },
82
- };
83
-
84
- //比如:分别定义上述columns columnState,最终会合并成如下对象
85
-
86
- const mergeColumns = [
87
- {
88
- title: "select",
89
- dataIndex: "select",
90
- formFieldProps: {
91
- options: [{ value: "value-1", label: "label-1" }],
92
- },
93
- },
94
- ];
95
- ```
96
-
97
- ### formElementMap
98
-
99
- - 录入原子组件集合。
100
- - 在 Form 中使用。
101
- - 根据 column 中的 valueType 从 formElementMap 查找对应的组件。
102
-
103
- ```ts
104
- type TFormElementMap = {
105
- [valueType]: FormItemComponent;
106
- };
107
- ```
108
-
109
- ### elementMap
110
-
111
- - 展示原子组件集合。
112
- - 在展示的地方使用,如:Table、Desc 等
113
- - 根据 column 中的 valueType 从 elementMap 查找对应的组件。
114
-
115
- ```ts
116
- type TElementMap = {
117
- [valueType]: Component;
118
- };
119
- ```
120
-
121
- 注:formElementMap 与 elementMap 中的 valueType 应该是像对应的,即:每一类 valueType 都有相对应的录入组件与展示组件。
122
-
123
- ## 原子组件
124
-
125
- 原子信息组件,统一 ProForm、ProTable 等组件里面的字段定义。valueType 是 pro 的灵魂,会根据 valueType 来映射成不同的组件。
126
-
127
- 以下是支持的常见表单项(具体已实际注册值为准):
128
-
129
- ```typescript
130
- export type TDefaultValueType =
131
- | "text"
132
- | "textarea"
133
- | "password"
134
- | "digit" // 数字输入
135
- | "date"
136
- | "dateRange"
137
- | "time"
138
- | "timeRange"
139
- | "select"
140
- | "treeSelect"
141
- | "checkbox"
142
- | "radio"
143
- | "slider"
144
- | "switch"
145
- | "rate"
146
- | "cascader";
147
-
148
- export type TValueType = TDefaultValueType | string;
149
- ```
1
+ # pro 系列组件
2
+
3
+ > 基于 ant-design-vue 和 element-plus 组件库,提供更高程度的抽象,提供更上层的设计规范,并且对应提供相应的组件使得开发者可以快速搭建出高质量的页面。
4
+
5
+ > @vue-start/pro 是一个实现了 pro 模式的抽象库,具体 UI 组件需要从对应的实现库引用:@vue-start/element-pro @vue-start/antd-pro
6
+
7
+ ## 通用配置
8
+
9
+ ### column
10
+
11
+ 基础 column 配置基于 ant-design-vue 中 table 的 column,扩展了部分字段。让其可以满足更多需求。
12
+
13
+ | 字段名称 | 类型 | 说明 |
14
+ | ---------------- | -------------------- | ------------------------------------------------------------- |
15
+ | `valueType` | `string` | 对应组件,缺省值为 text,自带了一部分,也可以自定义 valueType |
16
+ | `formValueType` | `string` | 同 valueType,在 form 组件中使用该类型,默认为 valueType 的值 |
17
+ | `title` | `string` `VNode` | 标题的内容,在 form 中是 label |
18
+ | `dataIndex` | `string` | 与实体映射的 key,在 form 中是 name |
19
+ | `formItemProps` | `formItemProps` | 传递给 FormItem 的配置 |
20
+ | `formFieldProps` | `fieldProps` | 传给渲染的组件的 props,自定义的时候也会传递 |
21
+ | `search` | `boolean` `signName` | 为 true 时,在 SearchForm 中显示 |
22
+ | `form` | `boolean` `signName` | 为 false 时,在 Form 中隐藏 |
23
+ | `table` | `boolean` `signName` | 为 false 时,在 Table 中隐藏 |
24
+ | `detail` | `boolean` `signName` | 为 false 时,在 Desc 中隐藏 |
25
+
26
+ 注:`signName` 可以在组件中设置,上述 search、form、table、detail 都为默认值。
27
+
28
+ ```typescript
29
+ export type TColumn = {
30
+ title?: string | VNode;
31
+ dataIndex?: string | number;
32
+ valueType?: TValueType; //展示组件类型
33
+ formValueType?: TValueType; //录入组件类型 如不存在,默认取valueType的值
34
+ showProps?: Record<string, any>; //文字展示组件的props
35
+ formItemProps?: { name?: string; label?: string }; //FormItem props
36
+ formFieldProps?: Record<string, any>; //录入组件 props
37
+ search?: boolean; //同extra中的search
38
+ //拓展属性
39
+ extra?: {
40
+ //DescriptionsItem props
41
+ desc?: Record<string, any>;
42
+ //Col props
43
+ col?: Record<string, any>;
44
+ /**
45
+ * 自定义标记,对columns进行筛选 和 排序
46
+ * 默认支持:search、form、table、detail
47
+ * 比如: search:标记搜索条件;searchSort:搜索项的顺序
48
+ * 在Curd组件中可使用getSignColumns方法获取标记的Columns
49
+ * [sign]: boolean 标记
50
+ * [`${sign}Sort`]: 标记的columns排序
51
+ */
52
+ } & Record<string, any>;
53
+ };
54
+ ```
55
+
56
+ ### columnState
57
+
58
+ - 对 column 进行补充。在实际使用过程中,column 通常作为静态数据配置,当需要为 column 加入动态数据时候可配置.
59
+ - 若 column 为 hook 或者计算(computed 生成)值,则不需要使用 columnState
60
+
61
+ ```typescript
62
+ //组件会将[id]的值 merge 到对应的column中
63
+ type TColumnState = {
64
+ //优先使用formItemProps中的name属性
65
+ //id: column.formItemProps.name || column.dataIndex
66
+ [id]: object;
67
+ };
68
+
69
+ const columns = [
70
+ {
71
+ title: "select",
72
+ dataIndex: "select",
73
+ },
74
+ ];
75
+
76
+ const columnState = {
77
+ select: {
78
+ formFieldProps: {
79
+ options: [{ value: "value-1", label: "label-1" }],
80
+ },
81
+ },
82
+ };
83
+
84
+ //比如:分别定义上述columns columnState,最终会合并成如下对象
85
+
86
+ const mergeColumns = [
87
+ {
88
+ title: "select",
89
+ dataIndex: "select",
90
+ formFieldProps: {
91
+ options: [{ value: "value-1", label: "label-1" }],
92
+ },
93
+ },
94
+ ];
95
+ ```
96
+
97
+ ### formElementMap
98
+
99
+ - 录入原子组件集合。
100
+ - 在 Form 中使用。
101
+ - 根据 column 中的 valueType 从 formElementMap 查找对应的组件。
102
+
103
+ ```ts
104
+ type TFormElementMap = {
105
+ [valueType]: FormItemComponent;
106
+ };
107
+ ```
108
+
109
+ ### elementMap
110
+
111
+ - 展示原子组件集合。
112
+ - 在展示的地方使用,如:Table、Desc 等
113
+ - 根据 column 中的 valueType 从 elementMap 查找对应的组件。
114
+
115
+ ```ts
116
+ type TElementMap = {
117
+ [valueType]: Component;
118
+ };
119
+ ```
120
+
121
+ 注:formElementMap 与 elementMap 中的 valueType 应该是像对应的,即:每一类 valueType 都有相对应的录入组件与展示组件。
122
+
123
+ ## 原子组件
124
+
125
+ 原子信息组件,统一 ProForm、ProTable 等组件里面的字段定义。valueType 是 pro 的灵魂,会根据 valueType 来映射成不同的组件。
126
+
127
+ 以下是支持的常见表单项(具体已实际注册值为准):
128
+
129
+ ```typescript
130
+ export type TDefaultValueType =
131
+ | "text"
132
+ | "textarea"
133
+ | "password"
134
+ | "digit" // 数字输入
135
+ | "date"
136
+ | "dateRange"
137
+ | "time"
138
+ | "timeRange"
139
+ | "select"
140
+ | "treeSelect"
141
+ | "checkbox"
142
+ | "radio"
143
+ | "slider"
144
+ | "switch"
145
+ | "rate"
146
+ | "cascader";
147
+
148
+ export type TValueType = TDefaultValueType | string;
149
+ ```