@byteluck-fe/model-driven-upgrade 2.0.8 → 2.0.11

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
- // import { dataCleaner as dataCleanerV3_0toV3_1 } from './v3_0'
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
- // 'v3.0': dataCleanerV3_0toV3_1,
27
+ "v3.0": dataCleanerV3_0toV3_1,
28
28
  // 每次都需要预留一个下一版本的转换函数,会使用到对应的key作为当前最新的schema version
29
- "v3.0": function() {}
29
+ "v3.1": function() {}
30
30
  };
@@ -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-27 14:39:14
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, CONTROL_TYPE } from "@byteluck-fe/model-driven-shared";
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
- schema.props.headers.map(function(item) {
23
- if (item.type === CONTROL_TYPE.OPERATION_COLUMN) {
24
- var _item_props, _item_props1, _item_props2;
25
- if (item.props.width_type === "auto") {
26
- item.props.auto_width = {
27
- min_width: 120,
28
- max_width: 120,
29
- flex: 1
30
- };
31
- } else if (item.props.width_type === "px") {
32
- item.props.auto_width = {
33
- min_width: item.props.width,
34
- max_width: item.props.width,
35
- flex: 1
36
- };
37
- }
38
- item.props.width_type = "auto";
39
- item.children = [];
40
- delete item.props.custom;
41
- if (((_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.check) !== undefined) {
42
- var _item_props3, _item_props4, _item_props5, _item_props6, _item_props7, _item_props8;
43
- var optbtn = new OperationButton.Designer();
44
- optbtn.props.code = "view";
45
- optbtn.props.icon = "iconliulan1";
46
- optbtn.props.command = "view";
47
- optbtn.props.content = (_item_props3 = item.props) === null || _item_props3 === void 0 ? void 0 : _item_props3.check.content;
48
- optbtn.props.priorityProcess = (_item_props4 = item.props) === null || _item_props4 === void 0 ? void 0 : _item_props4.check.priority_process;
49
- optbtn.props.openType = (_item_props5 = item.props) === null || _item_props5 === void 0 ? void 0 : _item_props5.check.open_type;
50
- optbtn.props.formKey = (_item_props6 = item.props) === null || _item_props6 === void 0 ? void 0 : _item_props6.check.form_key;
51
- if ((_item_props7 = item.props) === null || _item_props7 === void 0 ? void 0 : _item_props7.check.is_show) {
52
- item.children.push(optbtn.toSchema());
53
- }
54
- (_item_props8 = item.props) === null || _item_props8 === void 0 ? void 0 : delete _item_props8.check;
55
- }
56
- if (((_item_props1 = item.props) === null || _item_props1 === void 0 ? void 0 : _item_props1.edit) !== undefined) {
57
- var _item_props9, _item_props10, _item_props11, _item_props12, _item_props13, _item_props14;
58
- var optbtn1 = new OperationButton.Designer();
59
- optbtn1.props.code = "edit";
60
- optbtn1.props.icon = "iconbianji1";
61
- optbtn1.props.command = "edit";
62
- optbtn1.props.content = (_item_props9 = item.props) === null || _item_props9 === void 0 ? void 0 : _item_props9.edit.content;
63
- optbtn1.props.priorityProcess = (_item_props10 = item.props) === null || _item_props10 === void 0 ? void 0 : _item_props10.edit.priority_process;
64
- optbtn1.props.openType = (_item_props11 = item.props) === null || _item_props11 === void 0 ? void 0 : _item_props11.edit.open_type;
65
- optbtn1.props.formKey = (_item_props12 = item.props) === null || _item_props12 === void 0 ? void 0 : _item_props12.edit.form_key;
66
- if ((_item_props13 = item.props) === null || _item_props13 === void 0 ? void 0 : _item_props13.edit.is_show) {
67
- item.children.push(optbtn1.toSchema());
68
- }
69
- (_item_props14 = item.props) === null || _item_props14 === void 0 ? void 0 : delete _item_props14.edit;
70
- }
71
- if (((_item_props2 = item.props) === null || _item_props2 === void 0 ? void 0 : _item_props2.delete) !== undefined) {
72
- var _item_props15, _item_props16, _item_props17, _item_props18, _item_props19, _item_props20;
73
- var optbtn2 = new OperationButton.Designer();
74
- optbtn2.props.code = "delete";
75
- optbtn2.props.icon = "iconlajitong";
76
- optbtn2.props.command = "delete";
77
- optbtn2.props.content = (_item_props15 = item.props) === null || _item_props15 === void 0 ? void 0 : _item_props15.delete.content;
78
- optbtn2.props.priorityProcess = (_item_props16 = item.props) === null || _item_props16 === void 0 ? void 0 : _item_props16.delete.priority_process;
79
- optbtn2.props.openType = (_item_props17 = item.props) === null || _item_props17 === void 0 ? void 0 : _item_props17.delete.open_type;
80
- optbtn2.props.formKey = (_item_props18 = item.props) === null || _item_props18 === void 0 ? void 0 : _item_props18.delete.form_key;
81
- optbtn2.props.needConfirm = true;
82
- optbtn2.props.confirmMessage = "确定要删除此条数据吗?";
83
- if ((_item_props19 = item.props) === null || _item_props19 === void 0 ? void 0 : _item_props19.delete.is_show) {
84
- item.children.push(optbtn2.toSchema());
85
- }
86
- (_item_props20 = item.props) === null || _item_props20 === void 0 ? void 0 : delete _item_props20.delete;
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,107 @@
1
+ /*
2
+ * @Author: qiyu qiyu@byteluck.com
3
+ * @Date: 2022-12-22 11:36:04
4
+ * @LastEditors: SuperLucky-Q
5
+ * @LastEditTime: 2022-12-30 16:21:06
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
+ Object.defineProperty(optbtn, "id", {
50
+ value: "listPageCheckBtnId"
51
+ });
52
+ optbtn.props.code = "view";
53
+ optbtn.props.icon = "iconliulan1";
54
+ optbtn.props.command = "view";
55
+ optbtn.props.content = (_item_props3 = item.props) === null || _item_props3 === void 0 ? void 0 : _item_props3.check.content;
56
+ optbtn.props.priorityProcess = (_item_props4 = item.props) === null || _item_props4 === void 0 ? void 0 : _item_props4.check.priority_process;
57
+ optbtn.props.openType = (_item_props5 = item.props) === null || _item_props5 === void 0 ? void 0 : _item_props5.check.open_type;
58
+ optbtn.props.formKey = (_item_props6 = item.props) === null || _item_props6 === void 0 ? void 0 : _item_props6.check.form_key;
59
+ if ((_item_props7 = item.props) === null || _item_props7 === void 0 ? void 0 : _item_props7.check.is_show) {
60
+ item.children.push(optbtn.toSchema());
61
+ }
62
+ (_item_props8 = item.props) === null || _item_props8 === void 0 ? void 0 : delete _item_props8.check;
63
+ }
64
+ if (((_item_props1 = item.props) === null || _item_props1 === void 0 ? void 0 : _item_props1.edit) !== undefined) {
65
+ var _item_props9, _item_props10, _item_props11, _item_props12, _item_props13, _item_props14;
66
+ var optbtn1 = new OperationButton.Designer();
67
+ Object.defineProperty(optbtn1, "id", {
68
+ value: "listPageEditBtnId"
69
+ });
70
+ optbtn1.props.code = "edit";
71
+ optbtn1.props.icon = "iconbianji1";
72
+ optbtn1.props.command = "edit";
73
+ optbtn1.props.content = (_item_props9 = item.props) === null || _item_props9 === void 0 ? void 0 : _item_props9.edit.content;
74
+ optbtn1.props.priorityProcess = (_item_props10 = item.props) === null || _item_props10 === void 0 ? void 0 : _item_props10.edit.priority_process;
75
+ optbtn1.props.openType = (_item_props11 = item.props) === null || _item_props11 === void 0 ? void 0 : _item_props11.edit.open_type;
76
+ optbtn1.props.formKey = (_item_props12 = item.props) === null || _item_props12 === void 0 ? void 0 : _item_props12.edit.form_key;
77
+ if ((_item_props13 = item.props) === null || _item_props13 === void 0 ? void 0 : _item_props13.edit.is_show) {
78
+ item.children.push(optbtn1.toSchema());
79
+ }
80
+ (_item_props14 = item.props) === null || _item_props14 === void 0 ? void 0 : delete _item_props14.edit;
81
+ }
82
+ if (((_item_props2 = item.props) === null || _item_props2 === void 0 ? void 0 : _item_props2.delete) !== undefined) {
83
+ var _item_props15, _item_props16, _item_props17, _item_props18, _item_props19, _item_props20;
84
+ var optbtn2 = new OperationButton.Designer();
85
+ Object.defineProperty(optbtn2, "id", {
86
+ value: "listPageDeleteBtnId"
87
+ });
88
+ optbtn2.props.code = "delete";
89
+ optbtn2.props.icon = "iconlajitong";
90
+ optbtn2.props.command = "delete";
91
+ optbtn2.props.content = (_item_props15 = item.props) === null || _item_props15 === void 0 ? void 0 : _item_props15.delete.content;
92
+ optbtn2.props.priorityProcess = (_item_props16 = item.props) === null || _item_props16 === void 0 ? void 0 : _item_props16.delete.priority_process;
93
+ optbtn2.props.openType = (_item_props17 = item.props) === null || _item_props17 === void 0 ? void 0 : _item_props17.delete.open_type;
94
+ optbtn2.props.formKey = (_item_props18 = item.props) === null || _item_props18 === void 0 ? void 0 : _item_props18.delete.form_key;
95
+ optbtn2.props.needConfirm = true;
96
+ optbtn2.props.confirmMessage = "确定要删除此条数据吗?";
97
+ if ((_item_props19 = item.props) === null || _item_props19 === void 0 ? void 0 : _item_props19.delete.is_show) {
98
+ item.children.push(optbtn2.toSchema());
99
+ }
100
+ (_item_props20 = item.props) === null || _item_props20 === void 0 ? void 0 : delete _item_props20.delete;
101
+ }
102
+ }
103
+ });
104
+ }
105
+ return schema;
106
+ }
107
+ export { dataCleaner };