@byteluck-fe/model-driven-upgrade 2.8.0-alpha.7 → 2.8.1-alpha.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/dist/esm/upgrade/v3_1.js +100 -41
- package/dist/index.umd.js +1 -1
- package/package.json +4 -4
package/dist/esm/upgrade/v3_1.js
CHANGED
|
@@ -2,9 +2,22 @@
|
|
|
2
2
|
* @Description: subtable-column 数据转换
|
|
3
3
|
* @Autor: SuperLucky-Q
|
|
4
4
|
* @Date: 2023-02-16 14:45:22
|
|
5
|
-
* @LastEditors:
|
|
6
|
-
* @LastEditTime: 2023-
|
|
7
|
-
*/
|
|
5
|
+
* @LastEditors: SuperLuckyqi
|
|
6
|
+
* @LastEditTime: 2023-11-10 15:03:55
|
|
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";
|
|
8
21
|
import { MetaAutoWidth } from "@byteluck-fe/model-driven-core";
|
|
9
22
|
var dataCleaner = function(schemaItems, payload) {
|
|
10
23
|
var isArray = Array.isArray(schemaItems);
|
|
@@ -28,46 +41,89 @@ function conversion(schema, payload) {
|
|
|
28
41
|
delete item.props.width;
|
|
29
42
|
delete item.props.width_type;
|
|
30
43
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
// if (schema.props.page_index === undefined) {
|
|
45
|
+
// schema.props.page_index = 1
|
|
46
|
+
// }
|
|
47
|
+
// if (schema.props.page_size === undefined) {
|
|
48
|
+
// schema.props.page_size = 10
|
|
49
|
+
// }
|
|
50
|
+
// if (schema.props.page_size_options === undefined) {
|
|
51
|
+
// schema.props.page_size_options = [10, 20, 50, 100]
|
|
52
|
+
// }
|
|
53
|
+
// if (schema.props.total_count === undefined) {
|
|
54
|
+
// schema.props.total_count = 0
|
|
55
|
+
// }
|
|
56
|
+
}
|
|
57
|
+
var _obj;
|
|
58
|
+
var addKeysDefaultValueMapping = (_obj = {}, _define_property(_obj, CONTROL_TYPE.SUBTABLE, [
|
|
59
|
+
{
|
|
60
|
+
key: "page_index",
|
|
61
|
+
value: 1
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
key: "page_size",
|
|
65
|
+
value: 10
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
key: "page_size_options",
|
|
69
|
+
value: [
|
|
39
70
|
10,
|
|
40
71
|
20,
|
|
41
72
|
50,
|
|
42
73
|
100
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
if (schema.type === CONTROL_TYPE.GRID_TABLE) {
|
|
50
|
-
if (schema.props.page_index === undefined) {
|
|
51
|
-
schema.props.page_index = 1;
|
|
52
|
-
}
|
|
53
|
-
if (schema.props.page_size === undefined) {
|
|
54
|
-
schema.props.page_size = 20;
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
key: "total_count",
|
|
78
|
+
value: 0
|
|
55
79
|
}
|
|
56
|
-
|
|
57
|
-
|
|
80
|
+
]), _define_property(_obj, CONTROL_TYPE.GRID_TABLE, [
|
|
81
|
+
{
|
|
82
|
+
key: "page_index",
|
|
83
|
+
value: 1
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
key: "page_size",
|
|
87
|
+
value: 20
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
key: "page_size_options",
|
|
91
|
+
value: [
|
|
58
92
|
10,
|
|
59
93
|
20,
|
|
60
94
|
50,
|
|
61
|
-
100
|
|
62
|
-
|
|
63
|
-
|
|
95
|
+
100
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
key: "total_count",
|
|
100
|
+
value: 0
|
|
64
101
|
}
|
|
65
|
-
|
|
66
|
-
|
|
102
|
+
]), _define_property(_obj, CONTROL_TYPE.LIST_VIEW, [
|
|
103
|
+
{
|
|
104
|
+
key: "selection_type",
|
|
105
|
+
value: "multiple"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
key: "row_style_type",
|
|
109
|
+
value: "none"
|
|
67
110
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
111
|
+
]), _define_property(_obj, CONTROL_TYPE.SIMPLE_SEARCH, [
|
|
112
|
+
{
|
|
113
|
+
key: "col-gap",
|
|
114
|
+
value: 24
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
key: "child-min-width",
|
|
118
|
+
value: 230
|
|
119
|
+
}
|
|
120
|
+
]), _obj);
|
|
121
|
+
if (schema.type in addKeysDefaultValueMapping) {
|
|
122
|
+
addKeysDefaultValueMapping[schema.type].forEach(function(item) {
|
|
123
|
+
if (schema.props[item.key] === undefined) {
|
|
124
|
+
schema.props[item.key] = item.value;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
71
127
|
}
|
|
72
128
|
//将操作项按钮的完成时事件转成点击时事件
|
|
73
129
|
conversionListener(payload);
|
|
@@ -82,7 +138,8 @@ function conversionListener(payload) {
|
|
|
82
138
|
var onClickFinish;
|
|
83
139
|
var onClickFinishIndex;
|
|
84
140
|
payload.listeners[controlId].forEach(function(event, index) {
|
|
85
|
-
|
|
141
|
+
var eventKey = event.event_key || event.eventKey;
|
|
142
|
+
switch(eventKey){
|
|
86
143
|
case "on_click_finish":
|
|
87
144
|
onClickFinish = event;
|
|
88
145
|
onClickFinishIndex = index;
|
|
@@ -116,14 +173,16 @@ function conversionListener(payload) {
|
|
|
116
173
|
}
|
|
117
174
|
];
|
|
118
175
|
} else if (payload.listeners.form_submit) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
176
|
+
if (payload.listeners.form_submit && payload.listeners.form_submit[0] && payload.listeners.form_submit[0].cases && payload.listeners.form_submit[0].cases[0] && payload.listeners.form_submit[0].cases[0].handlers) {
|
|
177
|
+
var hasActionOperateHandler = false;
|
|
178
|
+
payload.listeners.form_submit[0].cases[0].handlers.forEach(function(handler) {
|
|
179
|
+
if (handler.method === "actionOperate") {
|
|
180
|
+
hasActionOperateHandler = true;
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
if (!hasActionOperateHandler) {
|
|
184
|
+
payload.listeners.form_submit[0].cases[0].handlers.push(getDefaultActionOperateHandler());
|
|
123
185
|
}
|
|
124
|
-
});
|
|
125
|
-
if (!hasActionOperateHandler) {
|
|
126
|
-
payload.listeners.form_submit[0].cases[0].handlers.push(getDefaultActionOperateHandler());
|
|
127
186
|
}
|
|
128
187
|
}
|
|
129
188
|
}
|