@byteluck-fe/model-driven-upgrade 2.0.8 → 2.0.9
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.
|
@@ -9,7 +9,7 @@ import { dataCleaner as dataCleanerV2_6toV2_7 } from "./v2_6";
|
|
|
9
9
|
import { dataCleaner as dataCleanerV2_7toV2_8 } from "./v2_7";
|
|
10
10
|
import { dataCleaner as dataCleanerV2_8toV2_9 } from "./v2_8";
|
|
11
11
|
import { dataCleaner as dataCleanerV2_9toV3_0 } from "./v2_9";
|
|
12
|
-
|
|
12
|
+
import { dataCleaner as dataCleanerV3_0toV3_1 } from "./v3_0";
|
|
13
13
|
// TODO 切记复制粘贴的时候改一下from后边的路径,不然会出事儿
|
|
14
14
|
// TODO 注意从2.5版本开始,没有进行驼峰转下划线了,写的时候要注意
|
|
15
15
|
export default {
|
|
@@ -24,7 +24,7 @@ export default {
|
|
|
24
24
|
"v2.7": dataCleanerV2_7toV2_8,
|
|
25
25
|
"v2.8": dataCleanerV2_8toV2_9,
|
|
26
26
|
"v2.9": dataCleanerV2_9toV3_0,
|
|
27
|
-
|
|
27
|
+
"v3.0": dataCleanerV3_0toV3_1,
|
|
28
28
|
// 每次都需要预留一个下一版本的转换函数,会使用到对应的key作为当前最新的schema version
|
|
29
|
-
"v3.
|
|
29
|
+
"v3.1": function() {}
|
|
30
30
|
};
|
package/dist/esm/upgrade/v2_9.js
CHANGED
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
* @Author: qiyu qiyu@byteluck.com
|
|
3
3
|
* @Date: 2022-12-22 11:36:04
|
|
4
4
|
* @LastEditors: SuperLucky-Q
|
|
5
|
-
* @LastEditTime: 2022-12-
|
|
5
|
+
* @LastEditTime: 2022-12-30 14:36:45
|
|
6
6
|
* @FilePath: /model-driven/packages/upgrade/src/upgrade/v2_10.ts
|
|
7
7
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
8
|
-
*/ import { loop
|
|
9
|
-
import { OperationButton } from "@byteluck-fe/model-driven-controls";
|
|
8
|
+
*/ import { loop } from "@byteluck-fe/model-driven-shared";
|
|
10
9
|
var dataCleaner = function(schemaItems, payload) {
|
|
11
10
|
var isArray = Array.isArray(schemaItems);
|
|
12
11
|
var schemaArray = isArray ? schemaItems : [
|
|
@@ -18,76 +17,77 @@ var dataCleaner = function(schemaItems, payload) {
|
|
|
18
17
|
return isArray ? new_schema : new_schema[0];
|
|
19
18
|
};
|
|
20
19
|
function conversion(schema, payload) {
|
|
21
|
-
if (schema.type === CONTROL_TYPE.GRID_TABLE) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
20
|
+
// if (schema.type === CONTROL_TYPE.GRID_TABLE) {
|
|
21
|
+
// schema.props.headers.map((item: any) => {
|
|
22
|
+
// if (item.type === CONTROL_TYPE.OPERATION_COLUMN) {
|
|
23
|
+
// if (item.props.width_type === 'auto') {
|
|
24
|
+
// item.props.auto_width = {
|
|
25
|
+
// min_width: 120,
|
|
26
|
+
// max_width: 120,
|
|
27
|
+
// flex: 1,
|
|
28
|
+
// }
|
|
29
|
+
// } else if (item.props.width_type === 'px') {
|
|
30
|
+
// item.props.auto_width = {
|
|
31
|
+
// min_width: item.props.width,
|
|
32
|
+
// max_width: item.props.width,
|
|
33
|
+
// flex: 1,
|
|
34
|
+
// }
|
|
35
|
+
// }
|
|
36
|
+
// item.props.width_type = 'auto'
|
|
37
|
+
// item.children = []
|
|
38
|
+
// delete item.props.custom
|
|
39
|
+
// if (item.props?.check !== undefined) {
|
|
40
|
+
// const optbtn = new OperationButton.Designer()
|
|
41
|
+
// optbtn.props.code = 'view'
|
|
42
|
+
// optbtn.props.icon = 'iconliulan1'
|
|
43
|
+
// optbtn.props.command = 'view'
|
|
44
|
+
// optbtn.props.content = item.props?.check.content
|
|
45
|
+
// optbtn.props.priorityProcess = item.props?.check.priority_process
|
|
46
|
+
// optbtn.props.openType = item.props?.check.open_type
|
|
47
|
+
// optbtn.props.formKey = item.props?.check.form_key
|
|
48
|
+
// if (item.props?.check.is_show) {
|
|
49
|
+
// item.children.push(optbtn.toSchema())
|
|
50
|
+
// }
|
|
51
|
+
// delete item.props?.check
|
|
52
|
+
// }
|
|
53
|
+
// if (item.props?.edit !== undefined) {
|
|
54
|
+
// const optbtn = new OperationButton.Designer()
|
|
55
|
+
// optbtn.props.code = 'edit'
|
|
56
|
+
// optbtn.props.icon = 'iconbianji1'
|
|
57
|
+
// optbtn.props.command = 'edit'
|
|
58
|
+
// optbtn.props.content = item.props?.edit.content
|
|
59
|
+
// optbtn.props.priorityProcess = item.props?.edit.priority_process
|
|
60
|
+
// optbtn.props.openType = item.props?.edit.open_type
|
|
61
|
+
// optbtn.props.formKey = item.props?.edit.form_key
|
|
62
|
+
// if (item.props?.edit.is_show) {
|
|
63
|
+
// item.children.push(optbtn.toSchema())
|
|
64
|
+
// }
|
|
65
|
+
// delete item.props?.edit
|
|
66
|
+
// }
|
|
67
|
+
// if (item.props?.delete !== undefined) {
|
|
68
|
+
// const optbtn = new OperationButton.Designer()
|
|
69
|
+
// optbtn.props.code = 'delete'
|
|
70
|
+
// optbtn.props.icon = 'iconlajitong'
|
|
71
|
+
// optbtn.props.command = 'delete'
|
|
72
|
+
// optbtn.props.content = item.props?.delete.content
|
|
73
|
+
// optbtn.props.priorityProcess = item.props?.delete.priority_process
|
|
74
|
+
// optbtn.props.openType = item.props?.delete.open_type
|
|
75
|
+
// optbtn.props.formKey = item.props?.delete.form_key
|
|
76
|
+
// optbtn.props.needConfirm = true
|
|
77
|
+
// optbtn.props.confirmMessage = '确定要删除此条数据吗?'
|
|
78
|
+
// if (item.props?.delete.is_show) {
|
|
79
|
+
// item.children.push(optbtn.toSchema())
|
|
80
|
+
// }
|
|
81
|
+
// delete item.props?.delete
|
|
82
|
+
// }
|
|
83
|
+
// }
|
|
84
|
+
// })
|
|
85
|
+
// }
|
|
86
|
+
// //标题组件控件兼容老数据 config 默认展示标题
|
|
87
|
+
// if (schema.type === CONTROL_TYPE.TITLE) {
|
|
88
|
+
// schema.props.config.push(TitleConfigEnum.ShowTitle)
|
|
89
|
+
// }
|
|
90
|
+
//
|
|
91
91
|
return schema;
|
|
92
92
|
}
|
|
93
93
|
export { dataCleaner };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: qiyu qiyu@byteluck.com
|
|
3
|
+
* @Date: 2022-12-22 11:36:04
|
|
4
|
+
* @LastEditors: SuperLucky-Q
|
|
5
|
+
* @LastEditTime: 2022-12-30 14:36:45
|
|
6
|
+
* @FilePath: /model-driven/packages/upgrade/src/upgrade/v2_10.ts
|
|
7
|
+
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
8
|
+
*/ import { loop, CONTROL_TYPE } from "@byteluck-fe/model-driven-shared";
|
|
9
|
+
import { OperationButton } from "@byteluck-fe/model-driven-controls";
|
|
10
|
+
import { TitleConfigEnum } from "@byteluck-fe/model-driven-controls";
|
|
11
|
+
var dataCleaner = function(schemaItems, payload) {
|
|
12
|
+
var isArray = Array.isArray(schemaItems);
|
|
13
|
+
var schemaArray = isArray ? schemaItems : [
|
|
14
|
+
schemaItems
|
|
15
|
+
];
|
|
16
|
+
var new_schema = loop(schemaArray, function(item) {
|
|
17
|
+
return conversion(item, payload);
|
|
18
|
+
});
|
|
19
|
+
return isArray ? new_schema : new_schema[0];
|
|
20
|
+
};
|
|
21
|
+
function conversion(schema, payload) {
|
|
22
|
+
//标题组件控件兼容老数据 config 默认展示标题
|
|
23
|
+
if (schema.type === CONTROL_TYPE.TITLE) {
|
|
24
|
+
schema.props.config.push(TitleConfigEnum.ShowTitle);
|
|
25
|
+
}
|
|
26
|
+
if (schema.type === CONTROL_TYPE.GRID_TABLE) {
|
|
27
|
+
schema.props.headers.map(function(item) {
|
|
28
|
+
if (item.type === CONTROL_TYPE.OPERATION_COLUMN) {
|
|
29
|
+
var _item_props, _item_props1, _item_props2;
|
|
30
|
+
if (item.props.width_type === "auto") {
|
|
31
|
+
item.props.auto_width = {
|
|
32
|
+
min_width: 120,
|
|
33
|
+
max_width: 120,
|
|
34
|
+
flex: 1
|
|
35
|
+
};
|
|
36
|
+
} else if (item.props.width_type === "px") {
|
|
37
|
+
item.props.auto_width = {
|
|
38
|
+
min_width: item.props.width,
|
|
39
|
+
max_width: item.props.width,
|
|
40
|
+
flex: 1
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
item.props.width_type = "auto";
|
|
44
|
+
item.children = [];
|
|
45
|
+
delete item.props.custom;
|
|
46
|
+
if (((_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.check) !== undefined) {
|
|
47
|
+
var _item_props3, _item_props4, _item_props5, _item_props6, _item_props7, _item_props8;
|
|
48
|
+
var optbtn = new OperationButton.Designer();
|
|
49
|
+
optbtn.props.code = "view";
|
|
50
|
+
optbtn.props.icon = "iconliulan1";
|
|
51
|
+
optbtn.props.command = "view";
|
|
52
|
+
optbtn.props.content = (_item_props3 = item.props) === null || _item_props3 === void 0 ? void 0 : _item_props3.check.content;
|
|
53
|
+
optbtn.props.priorityProcess = (_item_props4 = item.props) === null || _item_props4 === void 0 ? void 0 : _item_props4.check.priority_process;
|
|
54
|
+
optbtn.props.openType = (_item_props5 = item.props) === null || _item_props5 === void 0 ? void 0 : _item_props5.check.open_type;
|
|
55
|
+
optbtn.props.formKey = (_item_props6 = item.props) === null || _item_props6 === void 0 ? void 0 : _item_props6.check.form_key;
|
|
56
|
+
if ((_item_props7 = item.props) === null || _item_props7 === void 0 ? void 0 : _item_props7.check.is_show) {
|
|
57
|
+
item.children.push(optbtn.toSchema());
|
|
58
|
+
}
|
|
59
|
+
(_item_props8 = item.props) === null || _item_props8 === void 0 ? void 0 : delete _item_props8.check;
|
|
60
|
+
}
|
|
61
|
+
if (((_item_props1 = item.props) === null || _item_props1 === void 0 ? void 0 : _item_props1.edit) !== undefined) {
|
|
62
|
+
var _item_props9, _item_props10, _item_props11, _item_props12, _item_props13, _item_props14;
|
|
63
|
+
var optbtn1 = new OperationButton.Designer();
|
|
64
|
+
optbtn1.props.code = "edit";
|
|
65
|
+
optbtn1.props.icon = "iconbianji1";
|
|
66
|
+
optbtn1.props.command = "edit";
|
|
67
|
+
optbtn1.props.content = (_item_props9 = item.props) === null || _item_props9 === void 0 ? void 0 : _item_props9.edit.content;
|
|
68
|
+
optbtn1.props.priorityProcess = (_item_props10 = item.props) === null || _item_props10 === void 0 ? void 0 : _item_props10.edit.priority_process;
|
|
69
|
+
optbtn1.props.openType = (_item_props11 = item.props) === null || _item_props11 === void 0 ? void 0 : _item_props11.edit.open_type;
|
|
70
|
+
optbtn1.props.formKey = (_item_props12 = item.props) === null || _item_props12 === void 0 ? void 0 : _item_props12.edit.form_key;
|
|
71
|
+
if ((_item_props13 = item.props) === null || _item_props13 === void 0 ? void 0 : _item_props13.edit.is_show) {
|
|
72
|
+
item.children.push(optbtn1.toSchema());
|
|
73
|
+
}
|
|
74
|
+
(_item_props14 = item.props) === null || _item_props14 === void 0 ? void 0 : delete _item_props14.edit;
|
|
75
|
+
}
|
|
76
|
+
if (((_item_props2 = item.props) === null || _item_props2 === void 0 ? void 0 : _item_props2.delete) !== undefined) {
|
|
77
|
+
var _item_props15, _item_props16, _item_props17, _item_props18, _item_props19, _item_props20;
|
|
78
|
+
var optbtn2 = new OperationButton.Designer();
|
|
79
|
+
optbtn2.props.code = "delete";
|
|
80
|
+
optbtn2.props.icon = "iconlajitong";
|
|
81
|
+
optbtn2.props.command = "delete";
|
|
82
|
+
optbtn2.props.content = (_item_props15 = item.props) === null || _item_props15 === void 0 ? void 0 : _item_props15.delete.content;
|
|
83
|
+
optbtn2.props.priorityProcess = (_item_props16 = item.props) === null || _item_props16 === void 0 ? void 0 : _item_props16.delete.priority_process;
|
|
84
|
+
optbtn2.props.openType = (_item_props17 = item.props) === null || _item_props17 === void 0 ? void 0 : _item_props17.delete.open_type;
|
|
85
|
+
optbtn2.props.formKey = (_item_props18 = item.props) === null || _item_props18 === void 0 ? void 0 : _item_props18.delete.form_key;
|
|
86
|
+
optbtn2.props.needConfirm = true;
|
|
87
|
+
optbtn2.props.confirmMessage = "确定要删除此条数据吗?";
|
|
88
|
+
if ((_item_props19 = item.props) === null || _item_props19 === void 0 ? void 0 : _item_props19.delete.is_show) {
|
|
89
|
+
item.children.push(optbtn2.toSchema());
|
|
90
|
+
}
|
|
91
|
+
(_item_props20 = item.props) === null || _item_props20 === void 0 ? void 0 : delete _item_props20.delete;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
return schema;
|
|
97
|
+
}
|
|
98
|
+
export { dataCleaner };
|