@byteluck-fe/model-driven-upgrade 2.9.0-alpha.2 → 2.9.0-alpha.21

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.
@@ -13,6 +13,7 @@ import { dataCleaner as dataCleanerV2_10toV3_0 } from "./v2_10";
13
13
  import { dataCleaner as dataCleanerV3_0toV3_1 } from "./v3_0";
14
14
  import { dataCleaner as dataCleanerV3_1toV3_2 } from "./v3_1";
15
15
  import { dataCleaner as dataCleanerV3_1toV3_3 } from "./v3_2";
16
+ import { dataCleaner as dataCleanerV3_1toV3_4 } from "./v3_3";
16
17
  // TODO 切记复制粘贴的时候改一下from后边的路径,不然会出事儿
17
18
  // TODO 注意从2.5版本开始,没有进行驼峰转下划线了,写的时候要注意
18
19
  export default {
@@ -32,5 +33,6 @@ export default {
32
33
  "v3.1": dataCleanerV3_1toV3_2,
33
34
  "v3.2": dataCleanerV3_1toV3_3,
34
35
  // 每次都需要预留一个下一版本的转换函数,会使用到对应的key作为当前最新的schema version
35
- "v3.3": function() {}
36
+ "v3.3": dataCleanerV3_1toV3_4,
37
+ "v3.4": function() {}
36
38
  };
@@ -3,7 +3,7 @@
3
3
  * @Autor: SuperLucky-Q
4
4
  * @Date: 2023-02-16 14:45:22
5
5
  * @LastEditors: SuperLuckyqi
6
- * @LastEditTime: 2023-11-21 15:21:10
6
+ * @LastEditTime: 2024-01-05 15:23:17
7
7
  */ function _define_property(obj, key, value) {
8
8
  if (key in obj) {
9
9
  Object.defineProperty(obj, key, {
@@ -33,6 +33,7 @@ function conversion(schema, payload) {
33
33
  //标题组件控件兼容老数据 config 默认展示标题
34
34
  if (schema.type === CONTROL_TYPE.SUBTABLE) {
35
35
  schema.props.headers.map(function(item) {
36
+ var _item_children;
36
37
  item.props.meta_auto_width = new MetaAutoWidth();
37
38
  if (item.props.width_type === "px") {
38
39
  item.props.meta_auto_width.pc.width = item.props.width;
@@ -40,6 +41,15 @@ function conversion(schema, payload) {
40
41
  }
41
42
  delete item.props.width;
42
43
  delete item.props.width_type;
44
+ var childCtl = (_item_children = item.children) === null || _item_children === void 0 ? void 0 : _item_children[0];
45
+ if (childCtl) {
46
+ //2023-12-24 qiyu 保证低版本升级上来时,默认是开启的
47
+ if (childCtl.type === CONTROL_TYPE.CALC) {
48
+ if (childCtl.props.calc_on_mounted === undefined) {
49
+ childCtl.props.calc_on_mounted = true;
50
+ }
51
+ }
52
+ }
43
53
  });
44
54
  // if (schema.props.page_index === undefined) {
45
55
  // schema.props.page_index = 1
@@ -99,6 +109,10 @@ function conversion(schema, payload) {
99
109
  {
100
110
  key: "total_count",
101
111
  value: 0
112
+ },
113
+ {
114
+ key: "is_show_selection",
115
+ value: false
102
116
  }
103
117
  ]), _define_property(_obj, CONTROL_TYPE.LIST_VIEW, [
104
118
  {
@@ -108,6 +122,10 @@ function conversion(schema, payload) {
108
122
  {
109
123
  key: "row_style_type",
110
124
  value: "none"
125
+ },
126
+ {
127
+ key: "is_show_selection",
128
+ value: false
111
129
  }
112
130
  ]), _define_property(_obj, CONTROL_TYPE.SIMPLE_SEARCH, [
113
131
  {
@@ -118,6 +136,11 @@ function conversion(schema, payload) {
118
136
  key: "child-min-width",
119
137
  value: 230
120
138
  }
139
+ ]), _define_property(_obj, CONTROL_TYPE.IMPORT_RECORD_LIST_BUTTON, [
140
+ {
141
+ key: "template-type",
142
+ value: "system"
143
+ }
121
144
  ]), _obj);
122
145
  if (schema.type in addKeysDefaultValueMapping) {
123
146
  addKeysDefaultValueMapping[schema.type].forEach(function(item) {
@@ -126,6 +149,28 @@ function conversion(schema, payload) {
126
149
  }
127
150
  });
128
151
  }
152
+ if (schema.type === CONTROL_TYPE.GRID_TABLE) {
153
+ var gridTableInstance = schema;
154
+ schema.props.headers.forEach(function(item) {
155
+ if (item.type === CONTROL_TYPE.OPERATION_COLUMN) {
156
+ if (item.props.limit === undefined) {
157
+ item.props.limit = 3;
158
+ }
159
+ if (item.props.show_type === undefined) {
160
+ item.props.show_type = "icon";
161
+ }
162
+ }
163
+ if (item.props.flex === undefined) {
164
+ item.props.flex = 1;
165
+ }
166
+ });
167
+ }
168
+ //2023-12-24 qiyu 保证低版本升级上来时,默认是开启的
169
+ if (schema.type === CONTROL_TYPE.CALC) {
170
+ if (schema.props.calc_on_mounted === undefined) {
171
+ schema.props.calc_on_mounted = true;
172
+ }
173
+ }
129
174
  //将操作项按钮的完成时事件转成点击时事件
130
175
  conversionListener(payload);
131
176
  return schema;
@@ -3,7 +3,7 @@
3
3
  * @Autor: SuperLucky-Q
4
4
  * @Date: 2023-02-16 14:45:22
5
5
  * @LastEditors: SuperLuckyqi
6
- * @LastEditTime: 2023-11-21 15:21:23
6
+ * @LastEditTime: 2023-12-21 11:12:25
7
7
  */ import { loop, CONTROL_TYPE } from "@byteluck-fe/model-driven-shared";
8
8
  var dataCleaner = function(schemaItems, payload) {
9
9
  var isArray = Array.isArray(schemaItems);
@@ -34,6 +34,7 @@ function conversion(schema, payload) {
34
34
  });
35
35
  if (isOpenCheckbox === true) {
36
36
  schema.props.is_show_selection = true;
37
+ item.props.is_show_selection = true;
37
38
  }
38
39
  }
39
40
  });
@@ -47,6 +48,11 @@ function conversion(schema, payload) {
47
48
  schema.props.auto_size = false;
48
49
  }
49
50
  }
51
+ if (schema.type === CONTROL_TYPE.TREE) {
52
+ if (schema.props.default_display === undefined) {
53
+ schema.props.default_display = false;
54
+ }
55
+ }
50
56
  return schema;
51
57
  }
52
58
  export { dataCleaner };
@@ -0,0 +1,63 @@
1
+ /*
2
+ * @Description: subtable-column 数据转换
3
+ * @Autor: SuperLucky-Q
4
+ * @Date: 2023-02-16 14:45:22
5
+ * @LastEditors: SuperLuckyqi
6
+ * @LastEditTime: 2024-01-09 18:06:49
7
+ */ function _define_property(obj, key, value) {
8
+ if (key in obj) {
9
+ Object.defineProperty(obj, key, {
10
+ value: value,
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true
14
+ });
15
+ } else {
16
+ obj[key] = value;
17
+ }
18
+ return obj;
19
+ }
20
+ import { loop, CONTROL_TYPE } from "@byteluck-fe/model-driven-shared";
21
+ var dataCleaner = function(schemaItems, payload) {
22
+ var isArray = Array.isArray(schemaItems);
23
+ var schemaArray = isArray ? schemaItems : [
24
+ schemaItems
25
+ ];
26
+ var new_schema = loop(schemaArray, function(item) {
27
+ return conversion(item, payload);
28
+ });
29
+ return isArray ? new_schema : new_schema[0];
30
+ };
31
+ function conversion(schema, payload) {
32
+ //默认值 赋值
33
+ var addKeysDefaultValueMapping = _define_property({}, CONTROL_TYPE.SUBTABLE, [
34
+ {
35
+ key: "import_config",
36
+ value: {
37
+ template_type: "system",
38
+ template_list: []
39
+ }
40
+ },
41
+ {
42
+ key: "export_config",
43
+ value: {
44
+ template_type: "system",
45
+ template_list: []
46
+ }
47
+ }
48
+ ]);
49
+ if (schema.type in addKeysDefaultValueMapping) {
50
+ addKeysDefaultValueMapping[schema.type].forEach(function(item) {
51
+ if (schema.props[item.key] === undefined) {
52
+ schema.props[item.key] = item.value;
53
+ }
54
+ });
55
+ }
56
+ if (schema.type === "card-group") {
57
+ if (schema.props.isHideCaption === undefined) {
58
+ schema.props.isHideCaption = false;
59
+ }
60
+ }
61
+ return schema;
62
+ }
63
+ export { dataCleaner };