@byteluck-fe/model-driven-upgrade 2.7.0-alpha.9 → 2.7.0-beta
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/VersionBuilder.js +37 -22
- package/dist/esm/index.js +2 -2
- package/dist/esm/upgrade/index.js +27 -27
- package/dist/esm/upgrade/v1_0.js +210 -206
- package/dist/esm/upgrade/v2_0.js +2 -2
- package/dist/esm/upgrade/v2_1.js +10 -10
- package/dist/esm/upgrade/v2_10.js +3 -3
- package/dist/esm/upgrade/v2_2.js +13 -13
- package/dist/esm/upgrade/v2_3.js +3 -3
- package/dist/esm/upgrade/v2_4.js +1 -1
- package/dist/esm/upgrade/v2_5.js +1 -1
- package/dist/esm/upgrade/v2_6.js +5 -5
- package/dist/esm/upgrade/v2_7.js +5 -5
- package/dist/esm/upgrade/v2_8.js +4 -4
- package/dist/esm/upgrade/v2_9.js +3 -3
- package/dist/esm/upgrade/v3_0.js +51 -51
- package/dist/esm/upgrade/v3_1.js +4 -4
- package/dist/index.umd.js +1 -1
- package/package.json +5 -5
package/dist/esm/upgrade/v1_0.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
2
|
if (len == null || len > arr.length) len = arr.length;
|
|
3
3
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
4
|
return arr2;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function _array_with_holes(arr) {
|
|
7
7
|
if (Array.isArray(arr)) return arr;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
if (Array.isArray(arr)) return
|
|
9
|
+
function _array_without_holes(arr) {
|
|
10
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function _iterable_to_array(iter) {
|
|
13
13
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function _iterable_to_array_limit(arr, i) {
|
|
16
16
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
17
17
|
if (_i == null) return;
|
|
18
18
|
var _arr = [];
|
|
@@ -36,35 +36,36 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
36
36
|
}
|
|
37
37
|
return _arr;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function _non_iterable_rest() {
|
|
40
40
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function _non_iterable_spread() {
|
|
43
43
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
return
|
|
45
|
+
function _sliced_to_array(arr, i) {
|
|
46
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
return
|
|
48
|
+
function _to_consumable_array(arr) {
|
|
49
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
52
52
|
if (!o) return;
|
|
53
|
-
if (typeof o === "string") return
|
|
53
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
54
54
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
55
55
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
56
56
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
57
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
57
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
58
58
|
}
|
|
59
|
-
import { loop, toNumberOrEmpty, isLanguageObject, camelizeKeys, decamelizeKeys, CONTROL_TYPE } from
|
|
60
|
-
import { DataSourceBind } from
|
|
61
|
-
import { Col, SubTableColumn, ListView, DataView } from
|
|
59
|
+
import { loop, toNumberOrEmpty, isLanguageObject, camelizeKeys, decamelizeKeys, CONTROL_TYPE } from "@byteluck-fe/model-driven-shared";
|
|
60
|
+
import { DataSourceBind } from "@byteluck-fe/model-driven-core";
|
|
61
|
+
import { Col, SubTableColumn, ListView, DataView } from "@byteluck-fe/model-driven-controls";
|
|
62
62
|
var dataCleaner = function(schemaItems, payload) {
|
|
63
|
+
var _payload;
|
|
63
64
|
var isArray = Array.isArray(schemaItems);
|
|
64
65
|
var schemaArray = isArray ? schemaItems : [
|
|
65
66
|
schemaItems
|
|
66
67
|
];
|
|
67
|
-
conversionPageEvents(payload === null ||
|
|
68
|
+
conversionPageEvents((_payload = payload) === null || _payload === void 0 ? void 0 : _payload.events);
|
|
68
69
|
conversionGroupPanel(schemaArray);
|
|
69
70
|
conversionLayoutControl(schemaArray);
|
|
70
71
|
var dataView = conversionDataViewPage(schemaArray);
|
|
@@ -80,122 +81,122 @@ var baseControlKeys = [
|
|
|
80
81
|
CONTROL_TYPE.TITLE,
|
|
81
82
|
CONTROL_TYPE.LINK,
|
|
82
83
|
CONTROL_TYPE.BUTTON,
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
"list-btn-export-list",
|
|
85
|
+
"list-btn-export-record"
|
|
85
86
|
];
|
|
86
87
|
var listControlKeys = [
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
"subtable",
|
|
89
|
+
"grid-table"
|
|
89
90
|
];
|
|
90
91
|
var searchViewControlKeys = [
|
|
91
|
-
|
|
92
|
+
"simple-search"
|
|
92
93
|
];
|
|
93
|
-
function conversion(
|
|
94
|
-
var
|
|
95
|
-
var new_item =
|
|
94
|
+
function conversion(item, payload) {
|
|
95
|
+
var _item_props, _item, _item_props1, _item1, _item_props2, _item2, _payload;
|
|
96
|
+
var new_item = item;
|
|
96
97
|
if (!new_item.controlType) {
|
|
97
98
|
if (new_item.is_layout_control === true) {
|
|
98
|
-
new_item.controlType =
|
|
99
|
+
new_item.controlType = "layout";
|
|
99
100
|
} else if (baseControlKeys.includes(new_item.type)) {
|
|
100
|
-
new_item.controlType =
|
|
101
|
+
new_item.controlType = "base";
|
|
101
102
|
} else {
|
|
102
|
-
new_item.controlType =
|
|
103
|
+
new_item.controlType = "form";
|
|
103
104
|
}
|
|
104
105
|
// 放在这个位置,而不是else if是因为原来的subtable是一个form控件
|
|
105
106
|
if (listControlKeys.includes(new_item.type)) {
|
|
106
|
-
new_item.controlType =
|
|
107
|
+
new_item.controlType = "list";
|
|
107
108
|
}
|
|
108
109
|
if (searchViewControlKeys.includes(new_item.type)) {
|
|
109
|
-
new_item.controlType =
|
|
110
|
+
new_item.controlType = "search-view";
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
delete new_item.is_layout_control;
|
|
113
|
-
if (
|
|
114
|
-
|
|
114
|
+
if (item.props.lable_position) {
|
|
115
|
+
item.props.labelPosition = item.props.lable_position;
|
|
115
116
|
}
|
|
116
117
|
// 排列方式
|
|
117
|
-
if (
|
|
118
|
-
|
|
118
|
+
if (item.props.select_mode) {
|
|
119
|
+
item.props.optionsFormat = item.props.select_mode;
|
|
119
120
|
}
|
|
120
121
|
// 默认值
|
|
121
|
-
if (
|
|
122
|
-
|
|
122
|
+
if (item.props.value) {
|
|
123
|
+
item.props.defaultValue = item.props.value;
|
|
123
124
|
}
|
|
124
125
|
//caption/placeholder/placeholder_end 的 zh 属性将被保留,国际化资源都丢弃,放到外部
|
|
125
|
-
if (isLanguageObject(
|
|
126
|
-
new_item.props.caption =
|
|
126
|
+
if (isLanguageObject((_item = item) === null || _item === void 0 ? void 0 : (_item_props = _item.props) === null || _item_props === void 0 ? void 0 : _item_props.caption)) {
|
|
127
|
+
new_item.props.caption = item.props.caption.zh;
|
|
127
128
|
}
|
|
128
|
-
if (isLanguageObject(
|
|
129
|
-
new_item.props.placeholder =
|
|
129
|
+
if (isLanguageObject((_item1 = item) === null || _item1 === void 0 ? void 0 : (_item_props1 = _item1.props) === null || _item_props1 === void 0 ? void 0 : _item_props1.placeholder)) {
|
|
130
|
+
new_item.props.placeholder = item.props.placeholder.zh;
|
|
130
131
|
}
|
|
131
|
-
if (isLanguageObject(
|
|
132
|
-
new_item.props.placeholder_end =
|
|
132
|
+
if (isLanguageObject((_item2 = item) === null || _item2 === void 0 ? void 0 : (_item_props2 = _item2.props) === null || _item_props2 === void 0 ? void 0 : _item_props2.placeholder_end)) {
|
|
133
|
+
new_item.props.placeholder_end = item.props.placeholder_end.zh;
|
|
133
134
|
}
|
|
134
135
|
// 部门组件
|
|
135
|
-
if (
|
|
136
|
-
new_item.type =
|
|
137
|
-
if (
|
|
138
|
-
new_item.props.default_value =
|
|
136
|
+
if (item.type === "department-search") {
|
|
137
|
+
new_item.type = "department";
|
|
138
|
+
if (item.props.value.length) {
|
|
139
|
+
new_item.props.default_value = item.props.value;
|
|
139
140
|
}
|
|
140
|
-
new_item.props.showType =
|
|
141
|
-
new_item.props.rangeOptions =
|
|
141
|
+
new_item.props.showType = item.props.show_tree ? "tree" : "default";
|
|
142
|
+
new_item.props.rangeOptions = item.props.department_list;
|
|
142
143
|
}
|
|
143
|
-
if (
|
|
144
|
-
new_item.type =
|
|
145
|
-
new_item.props.defaultValue =
|
|
144
|
+
if (item.type === "automatic-number") {
|
|
145
|
+
new_item.type = "auto-number";
|
|
146
|
+
new_item.props.defaultValue = item.props.value;
|
|
146
147
|
}
|
|
147
148
|
// 附件类型转换
|
|
148
|
-
if (
|
|
149
|
-
var
|
|
150
|
-
new_item.type =
|
|
151
|
-
new_item.props.attachmentAccept = (
|
|
152
|
-
new_item.props.showType =
|
|
149
|
+
if (item.type === "file") {
|
|
150
|
+
var _item_attachment_format;
|
|
151
|
+
new_item.type = "attachment";
|
|
152
|
+
new_item.props.attachmentAccept = (_item_attachment_format = item.attachment_format) === null || _item_attachment_format === void 0 ? void 0 : _item_attachment_format.split(",");
|
|
153
|
+
new_item.props.showType = item.props.show_type === "title" ? "default" : "table";
|
|
153
154
|
}
|
|
154
|
-
if (
|
|
155
|
-
var
|
|
156
|
-
new_item.props.attachmentAccept = (
|
|
155
|
+
if (item.type === "image") {
|
|
156
|
+
var _item_attachment_format1;
|
|
157
|
+
new_item.props.attachmentAccept = (_item_attachment_format1 = item.attachment_format) === null || _item_attachment_format1 === void 0 ? void 0 : _item_attachment_format1.split(",");
|
|
157
158
|
}
|
|
158
159
|
// 日期选择转换
|
|
159
|
-
if (
|
|
160
|
-
new_item.type =
|
|
160
|
+
if (item.type === "date-pick") {
|
|
161
|
+
new_item.type = "date-picker";
|
|
161
162
|
}
|
|
162
|
-
if (
|
|
163
|
-
if (isLanguageObject(
|
|
164
|
-
new_item.props.defaultValue =
|
|
163
|
+
if (item.type === "rich-text") {
|
|
164
|
+
if (isLanguageObject(item.props.value)) {
|
|
165
|
+
new_item.props.defaultValue = item.props.value.zh;
|
|
165
166
|
} else {
|
|
166
|
-
new_item.props.defaultValue =
|
|
167
|
+
new_item.props.defaultValue = item.props.value;
|
|
167
168
|
}
|
|
168
169
|
}
|
|
169
170
|
if ([
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
].includes(
|
|
174
|
-
if (isLanguageObject(
|
|
175
|
-
new_item.props.content =
|
|
171
|
+
"link",
|
|
172
|
+
"text",
|
|
173
|
+
"button"
|
|
174
|
+
].includes(item.type)) {
|
|
175
|
+
if (isLanguageObject(item.props.value)) {
|
|
176
|
+
new_item.props.content = item.props.value.zh;
|
|
176
177
|
} else {
|
|
177
|
-
new_item.props.content =
|
|
178
|
+
new_item.props.content = item.props.value;
|
|
178
179
|
}
|
|
179
180
|
}
|
|
180
|
-
if (
|
|
181
|
-
if (
|
|
182
|
-
new_item.props.showState =
|
|
181
|
+
if (item.type === "text") {
|
|
182
|
+
if (item.props.showState === "iconText") {
|
|
183
|
+
new_item.props.showState = "image";
|
|
183
184
|
}
|
|
184
185
|
}
|
|
185
|
-
if (
|
|
186
|
-
new_item.type =
|
|
187
|
-
new_item.props.defaultValue =
|
|
186
|
+
if (item.type === "user-search") {
|
|
187
|
+
new_item.type = "employee";
|
|
188
|
+
new_item.props.defaultValue = item.props.value;
|
|
188
189
|
}
|
|
189
|
-
if (
|
|
190
|
-
new_item.props.addressType =
|
|
190
|
+
if (item.type === "address") {
|
|
191
|
+
new_item.props.addressType = item.props.address_type_value;
|
|
191
192
|
}
|
|
192
193
|
//明细子表去掉 subtable-row,保留 subtable-column
|
|
193
|
-
if (new_item.type ===
|
|
194
|
-
var
|
|
194
|
+
if (new_item.type === "subtable") {
|
|
195
|
+
var _new_item_children_;
|
|
195
196
|
// 转换打开方式
|
|
196
197
|
var entryType = new_item.props.entry_type || new_item.props.entryType;
|
|
197
|
-
new_item.props.openType = entryType ===
|
|
198
|
-
if (((
|
|
198
|
+
new_item.props.openType = entryType === "subpage" ? "modal" : "default";
|
|
199
|
+
if (((_new_item_children_ = new_item.children[0]) === null || _new_item_children_ === void 0 ? void 0 : _new_item_children_.type) === "subtable-row") {
|
|
199
200
|
if (new_item.props.headers) {
|
|
200
201
|
new_item.props.headers = new_item.props.headers.map(function(item, index) {
|
|
201
202
|
var subtableColumn = new SubTableColumn.Designer();
|
|
@@ -203,7 +204,7 @@ function conversion(item1, payload) {
|
|
|
203
204
|
// item.header_width_config === '1' ? 'auto' : 'px'
|
|
204
205
|
// subtableColumn.props.width =
|
|
205
206
|
// item.header_width === '' ? 200 : Number(item.header_width)
|
|
206
|
-
subtableColumn.props.caption = isLanguageObject(item.field_name) ? item.field_name[
|
|
207
|
+
subtableColumn.props.caption = isLanguageObject(item.field_name) ? item.field_name["zh"] : item.field_name;
|
|
207
208
|
var schema = subtableColumn.toSchema();
|
|
208
209
|
schema.id = item.header_id;
|
|
209
210
|
var child = new_item.children[0].children[index].children[0];
|
|
@@ -216,25 +217,25 @@ function conversion(item1, payload) {
|
|
|
216
217
|
}
|
|
217
218
|
}
|
|
218
219
|
}
|
|
219
|
-
if (new_item.type ===
|
|
220
|
-
new_item.type =
|
|
220
|
+
if (new_item.type === "subtable-cell") {
|
|
221
|
+
new_item.type = "subtable-column";
|
|
221
222
|
}
|
|
222
223
|
var optionsControl = [
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
224
|
+
"radio",
|
|
225
|
+
"checkbox",
|
|
226
|
+
"select",
|
|
227
|
+
"select-multiple"
|
|
227
228
|
];
|
|
228
229
|
//radio / checkbox 中 options text 的 zh 属性保留 国际化资源丢弃
|
|
229
|
-
if (optionsControl.includes(
|
|
230
|
-
|
|
230
|
+
if (optionsControl.includes(item.type)) {
|
|
231
|
+
item.props.options.map(function(option) {
|
|
231
232
|
option.label = isLanguageObject(option.text) ? option.text.zh : option.text;
|
|
232
233
|
option.id = option.id || option.opt_id || option.optId || option.data_id;
|
|
233
234
|
});
|
|
234
|
-
new_item =
|
|
235
|
+
new_item = item;
|
|
235
236
|
}
|
|
236
237
|
// grid-row 更改type,并且添加col控件
|
|
237
|
-
if (
|
|
238
|
+
if (item.type === "grid-row") {
|
|
238
239
|
var span = 24 / new_item.children.length;
|
|
239
240
|
new_item.children = new_item.children.map(function(child) {
|
|
240
241
|
var newCol = new Col.Designer();
|
|
@@ -245,23 +246,24 @@ function conversion(item1, payload) {
|
|
|
245
246
|
});
|
|
246
247
|
}
|
|
247
248
|
// grid-layout-row 更改type
|
|
248
|
-
if (
|
|
249
|
-
new_item.type =
|
|
249
|
+
if (item.type === "grid-layout-row") {
|
|
250
|
+
new_item.type = "row";
|
|
250
251
|
}
|
|
251
|
-
if (
|
|
252
|
-
new_item.type =
|
|
252
|
+
if (item.type === "grid-layout-col") {
|
|
253
|
+
new_item.type = "col";
|
|
253
254
|
}
|
|
254
|
-
if (
|
|
255
|
-
new_item.type =
|
|
256
|
-
new_item.props.collapse = new_item.props.flod ===
|
|
255
|
+
if (item.type === "group-panel") {
|
|
256
|
+
new_item.type = "card-group";
|
|
257
|
+
new_item.props.collapse = new_item.props.flod === "no" ? "none" : new_item.props.flod;
|
|
257
258
|
}
|
|
258
259
|
// tabs-pane => tab-pane
|
|
259
|
-
if (
|
|
260
|
-
new_item.type =
|
|
260
|
+
if (item.type === "tabs-pane") {
|
|
261
|
+
new_item.type = "tab-pane";
|
|
261
262
|
}
|
|
262
|
-
if (
|
|
263
|
-
var
|
|
264
|
-
var
|
|
263
|
+
if (item.type === "calc") {
|
|
264
|
+
var _new_item, _new_item1;
|
|
265
|
+
var calcValue = (_new_item = new_item) === null || _new_item === void 0 ? void 0 : _new_item.children[0];
|
|
266
|
+
var calcUnit = (_new_item1 = new_item) === null || _new_item1 === void 0 ? void 0 : _new_item1.children[1];
|
|
265
267
|
var newDataBind = {};
|
|
266
268
|
if (calcValue) {
|
|
267
269
|
conversionDisplayBoListAndBehaviors(new_item, payload);
|
|
@@ -283,11 +285,12 @@ function conversion(item1, payload) {
|
|
|
283
285
|
new_item.props.dataBind = newDataBind;
|
|
284
286
|
delete new_item.children;
|
|
285
287
|
}
|
|
286
|
-
if (
|
|
287
|
-
|
|
288
|
-
new_item.
|
|
289
|
-
|
|
290
|
-
var
|
|
288
|
+
if (item.type === "amount-currency") {
|
|
289
|
+
var _new_item2, _new_item3;
|
|
290
|
+
new_item.type = "amount";
|
|
291
|
+
new_item.controlType = "form";
|
|
292
|
+
var amount = (_new_item2 = new_item) === null || _new_item2 === void 0 ? void 0 : _new_item2.children[0];
|
|
293
|
+
var currency = (_new_item3 = new_item) === null || _new_item3 === void 0 ? void 0 : _new_item3.children[1];
|
|
291
294
|
var newDataBind1 = {};
|
|
292
295
|
var defaultValue = {};
|
|
293
296
|
// new_item.
|
|
@@ -320,12 +323,13 @@ function conversion(item1, payload) {
|
|
|
320
323
|
new_item.props.defaultValue = defaultValue;
|
|
321
324
|
delete new_item.children;
|
|
322
325
|
}
|
|
323
|
-
if (
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
var
|
|
327
|
-
|
|
328
|
-
new_item.props.
|
|
326
|
+
if (item.type === "date-range") {
|
|
327
|
+
var _new_item4, _new_item5;
|
|
328
|
+
new_item.controlType = "form";
|
|
329
|
+
var min = (_new_item4 = new_item) === null || _new_item4 === void 0 ? void 0 : _new_item4.children[0];
|
|
330
|
+
var max = (_new_item5 = new_item) === null || _new_item5 === void 0 ? void 0 : _new_item5.children[1];
|
|
331
|
+
new_item.props.placeholderStart = isLanguageObject(item.props.placeholder) ? item.props.placeholder.zh : item.props.placeholder;
|
|
332
|
+
new_item.props.caption = isLanguageObject(item.props.caption) ? item.props.caption.zh : item.props.caption;
|
|
329
333
|
var newDataBind2 = {};
|
|
330
334
|
if (min) {
|
|
331
335
|
newDataBind2.min = min.props.data_bind;
|
|
@@ -336,34 +340,34 @@ function conversion(item1, payload) {
|
|
|
336
340
|
new_item.props.dataBind = newDataBind2;
|
|
337
341
|
delete new_item.children;
|
|
338
342
|
}
|
|
339
|
-
if (
|
|
343
|
+
if (item.type === "score") {
|
|
340
344
|
new_item.props.defaultValue = new_item.props.value * 1;
|
|
341
345
|
}
|
|
342
346
|
if ([
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
].includes(
|
|
346
|
-
new_item.props.defaultValue = isLanguageObject(
|
|
347
|
+
"input",
|
|
348
|
+
"textarea"
|
|
349
|
+
].includes(item.type)) {
|
|
350
|
+
new_item.props.defaultValue = isLanguageObject(item.props.value) ? item.props.value.zh : item.props.value;
|
|
347
351
|
}
|
|
348
|
-
if (
|
|
349
|
-
new_item.props.range_min = toNumberOrEmpty(
|
|
350
|
-
new_item.props.range_max = toNumberOrEmpty(
|
|
351
|
-
new_item.props.defaultValue = toNumberOrEmpty(
|
|
352
|
+
if (item.type === "number") {
|
|
353
|
+
new_item.props.range_min = toNumberOrEmpty(item.props.range_min);
|
|
354
|
+
new_item.props.range_max = toNumberOrEmpty(item.props.range_max);
|
|
355
|
+
new_item.props.defaultValue = toNumberOrEmpty(item.props.value);
|
|
352
356
|
}
|
|
353
|
-
if (
|
|
354
|
-
|
|
357
|
+
if (item.type === "list-page-btn-custom-button") {
|
|
358
|
+
item.type = "button";
|
|
355
359
|
}
|
|
356
|
-
if (
|
|
357
|
-
if (
|
|
358
|
-
new_item.props.buttonType =
|
|
360
|
+
if (item.type === "button") {
|
|
361
|
+
if (item.props.button_type === "dashed") {
|
|
362
|
+
new_item.props.buttonType = "default";
|
|
359
363
|
}
|
|
360
364
|
}
|
|
361
|
-
conversionControlEvents(new_item, payload === null ||
|
|
365
|
+
conversionControlEvents(new_item, (_payload = payload) === null || _payload === void 0 ? void 0 : _payload.control_events);
|
|
362
366
|
return new_item;
|
|
363
367
|
}
|
|
364
368
|
function conversionDisplayBoListAndBehaviors(control, payload) {
|
|
365
369
|
if (!payload) return;
|
|
366
|
-
var
|
|
370
|
+
var _payload_displayBoList = payload.displayBoList, displayBoList = _payload_displayBoList === void 0 ? [] : _payload_displayBoList, _payload_behaviors = payload.behaviors, behaviors = _payload_behaviors === void 0 ? [] : _payload_behaviors;
|
|
367
371
|
var controlId = control.id;
|
|
368
372
|
var newId = control.children[0].id;
|
|
369
373
|
displayBoList.forEach(function(item) {
|
|
@@ -394,7 +398,7 @@ function conversionDataViewPage(controlArray) {
|
|
|
394
398
|
return controlArray;
|
|
395
399
|
}
|
|
396
400
|
var grid = controlArray.find(function(item) {
|
|
397
|
-
return item.type ===
|
|
401
|
+
return item.type === "grid";
|
|
398
402
|
});
|
|
399
403
|
if (!grid) {
|
|
400
404
|
return controlArray;
|
|
@@ -419,13 +423,13 @@ function conversionLayoutControl(schemArray) {
|
|
|
419
423
|
if (!(item && item.children)) return;
|
|
420
424
|
var controlArray = item.children;
|
|
421
425
|
for(var i = 0; i < controlArray.length; i++){
|
|
422
|
-
var
|
|
426
|
+
var _controlArray_i_children, _controlArray_i;
|
|
423
427
|
var control = controlArray[i];
|
|
424
|
-
var child = (
|
|
425
|
-
if (control.type ===
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
428
|
+
var child = (_controlArray_i = controlArray[i]) === null || _controlArray_i === void 0 ? void 0 : (_controlArray_i_children = _controlArray_i.children) === null || _controlArray_i_children === void 0 ? void 0 : _controlArray_i_children[0];
|
|
429
|
+
if (control.type === "grid-row" && child && [
|
|
430
|
+
"group-panel",
|
|
431
|
+
"subtable",
|
|
432
|
+
"tab"
|
|
429
433
|
].includes(child.type)) {
|
|
430
434
|
controlArray.splice(i, 1, child);
|
|
431
435
|
}
|
|
@@ -433,31 +437,31 @@ function conversionLayoutControl(schemArray) {
|
|
|
433
437
|
});
|
|
434
438
|
}
|
|
435
439
|
function conversionListPage(controlArray, payload) {
|
|
436
|
-
var
|
|
440
|
+
var _listPageProps_source_config, _listPageProps, _listPageProps_source_config1, _listPageProps1, _payload, _listPageProps_source_config2, _listPageProps2, _listPageProps_source_config3, _listPageProps3, _listPageProps_sublist_page, _listPageProps4;
|
|
437
441
|
if (!(Array.isArray(controlArray) && controlArray.length === 1)) {
|
|
438
442
|
return controlArray;
|
|
439
443
|
}
|
|
440
444
|
var listPage = controlArray[0];
|
|
441
|
-
if (listPage.type !==
|
|
445
|
+
if (listPage.type !== "list-page") {
|
|
442
446
|
return controlArray;
|
|
443
447
|
}
|
|
444
448
|
// children = search + toolbox + table
|
|
445
449
|
var listPageProps = listPage.props, children = listPage.children;
|
|
446
|
-
var _children =
|
|
450
|
+
var _children = _sliced_to_array(children, 3), search = _children[0], toolbox = _children[1], table = _children[2];
|
|
447
451
|
conversionSearch(search);
|
|
448
|
-
table.props.is_fixed_header = listPageProps === null ||
|
|
452
|
+
table.props.is_fixed_header = (_listPageProps = listPageProps) === null || _listPageProps === void 0 ? void 0 : (_listPageProps_source_config = _listPageProps.source_config) === null || _listPageProps_source_config === void 0 ? void 0 : _listPageProps_source_config.is_fixed_header;
|
|
449
453
|
// table.props.datasource_bind = new DataSourceBind({
|
|
450
454
|
// dataCode: listPageProps?.source_config?data_code,
|
|
451
455
|
// svcCode: listPageProps?.source_config?svc_code,
|
|
452
456
|
// orders: camelizeKeys(listPageProps?.source_config?orders) as any[],
|
|
453
457
|
// })
|
|
454
458
|
conversionGridTable(table, toolbox);
|
|
455
|
-
var
|
|
456
|
-
var dataCode = (
|
|
457
|
-
var
|
|
458
|
-
var svcCode = ((
|
|
459
|
-
var
|
|
460
|
-
var orders = (
|
|
459
|
+
var _listPageProps_source_config_data_code;
|
|
460
|
+
var dataCode = (_listPageProps_source_config_data_code = (_listPageProps1 = listPageProps) === null || _listPageProps1 === void 0 ? void 0 : (_listPageProps_source_config1 = _listPageProps1.source_config) === null || _listPageProps_source_config1 === void 0 ? void 0 : _listPageProps_source_config1.data_code) !== null && _listPageProps_source_config_data_code !== void 0 ? _listPageProps_source_config_data_code : (_payload = payload) === null || _payload === void 0 ? void 0 : _payload.dataCode;
|
|
461
|
+
var _listPageProps_source_config_svc_code;
|
|
462
|
+
var svcCode = ((_listPageProps_source_config_svc_code = (_listPageProps2 = listPageProps) === null || _listPageProps2 === void 0 ? void 0 : (_listPageProps_source_config2 = _listPageProps2.source_config) === null || _listPageProps_source_config2 === void 0 ? void 0 : _listPageProps_source_config2.svc_code) !== null && _listPageProps_source_config_svc_code !== void 0 ? _listPageProps_source_config_svc_code : dataCode) ? "".concat(dataCode, "_selectMore") : undefined;
|
|
463
|
+
var _listPageProps_source_config_orders;
|
|
464
|
+
var orders = (_listPageProps_source_config_orders = (_listPageProps3 = listPageProps) === null || _listPageProps3 === void 0 ? void 0 : (_listPageProps_source_config3 = _listPageProps3.source_config) === null || _listPageProps_source_config3 === void 0 ? void 0 : _listPageProps_source_config3.orders) !== null && _listPageProps_source_config_orders !== void 0 ? _listPageProps_source_config_orders : [];
|
|
461
465
|
var listView = new ListView.Designer();
|
|
462
466
|
listView.props.datasourceBind = new DataSourceBind({
|
|
463
467
|
dataCode: dataCode,
|
|
@@ -467,7 +471,7 @@ function conversionListPage(controlArray, payload) {
|
|
|
467
471
|
listView.props.isShowSubList = listPageProps.is_show_sublist;
|
|
468
472
|
listView.props.triggerType = listPageProps.timing_type;
|
|
469
473
|
listView.props.triggerFieldCode = listPageProps.ctrl_field_code;
|
|
470
|
-
listPageProps === null ||
|
|
474
|
+
(_listPageProps4 = listPageProps) === null || _listPageProps4 === void 0 ? void 0 : (_listPageProps_sublist_page = _listPageProps4.sublist_page) === null || _listPageProps_sublist_page === void 0 ? void 0 : _listPageProps_sublist_page.sublists.forEach(function(item) {
|
|
471
475
|
item.title = isLanguageObject(item.title) ? item.title.zh : item.title;
|
|
472
476
|
});
|
|
473
477
|
listView.props.sublistPage = listPageProps.sublist_page;
|
|
@@ -478,34 +482,34 @@ function conversionListPage(controlArray, payload) {
|
|
|
478
482
|
];
|
|
479
483
|
}
|
|
480
484
|
function conversionSearch(searchControl) {
|
|
481
|
-
searchControl.type =
|
|
482
|
-
searchControl.control_type =
|
|
485
|
+
searchControl.type = "simple-search";
|
|
486
|
+
searchControl.control_type = "search-view";
|
|
483
487
|
searchControl.children.forEach(function(item) {
|
|
484
|
-
var placeholder = isLanguageObject(item.placeholder) ? item.placeholder[
|
|
485
|
-
if (item.type ===
|
|
486
|
-
item.type =
|
|
488
|
+
var placeholder = isLanguageObject(item.placeholder) ? item.placeholder["zh"] : item.placeholder;
|
|
489
|
+
if (item.type === "number-range") {
|
|
490
|
+
item.type = "search-number-range";
|
|
487
491
|
item.placeholderStart = placeholder;
|
|
488
492
|
item.placeholderEnd = placeholder;
|
|
489
493
|
}
|
|
490
|
-
if (item.type ===
|
|
491
|
-
var
|
|
492
|
-
item.type =
|
|
494
|
+
if (item.type === "date-pick") {
|
|
495
|
+
var _item_dateType_replace, _item_dateType;
|
|
496
|
+
item.type = "search-date-range";
|
|
493
497
|
item.placeholderStart = placeholder;
|
|
494
498
|
item.placeholderEnd = placeholder;
|
|
495
|
-
item.dateType = (
|
|
499
|
+
item.dateType = (_item_dateType = item.dateType) === null || _item_dateType === void 0 ? void 0 : (_item_dateType_replace = _item_dateType.replace) === null || _item_dateType_replace === void 0 ? void 0 : _item_dateType_replace.call(_item_dateType, /range$/);
|
|
496
500
|
}
|
|
497
|
-
if (item.type ===
|
|
498
|
-
item.type =
|
|
499
|
-
item.props.defaultValue =
|
|
501
|
+
if (item.type === "automatic-number" || item.type === "auto-number") {
|
|
502
|
+
item.type = "search-input";
|
|
503
|
+
item.props.defaultValue = "";
|
|
500
504
|
}
|
|
501
505
|
});
|
|
502
506
|
}
|
|
503
507
|
function conversionGridTable(tableControl, toolbox) {
|
|
504
508
|
// 去掉了'list-page-btn-custom-head'按钮控件
|
|
505
509
|
tableControl.children = toolbox.children.filter(function(item) {
|
|
506
|
-
return item.type !==
|
|
510
|
+
return item.type !== "list-page-btn-custom-head";
|
|
507
511
|
});
|
|
508
|
-
tableControl.type =
|
|
512
|
+
tableControl.type = "grid-table";
|
|
509
513
|
if (tableControl.props.sublist_page) {
|
|
510
514
|
tableControl.props.sublist_page.form_bind = {
|
|
511
515
|
data_code: tableControl.props.sublist_page.data_code,
|
|
@@ -515,63 +519,63 @@ function conversionGridTable(tableControl, toolbox) {
|
|
|
515
519
|
if (Array.isArray(tableControl.props.headers)) {
|
|
516
520
|
tableControl.props.headers = tableControl.props.headers.map(function(item) {
|
|
517
521
|
var obj = {
|
|
518
|
-
type:
|
|
519
|
-
control_type:
|
|
522
|
+
type: "",
|
|
523
|
+
control_type: "column",
|
|
520
524
|
props: {
|
|
521
|
-
widthType:
|
|
525
|
+
widthType: "px",
|
|
522
526
|
width: 50,
|
|
523
|
-
caption:
|
|
527
|
+
caption: "",
|
|
524
528
|
field_code: item.field_code,
|
|
525
|
-
field_name: isLanguageObject(item.field_name) ? item.field_name[
|
|
529
|
+
field_name: isLanguageObject(item.field_name) ? item.field_name["zh"] : item.field_name
|
|
526
530
|
}
|
|
527
531
|
};
|
|
528
|
-
obj.props.caption = isLanguageObject(item.field_name) ? item.field_name[
|
|
532
|
+
obj.props.caption = isLanguageObject(item.field_name) ? item.field_name["zh"] : item.field_name;
|
|
529
533
|
obj.props.filter_tags = item.is_filter_tags;
|
|
530
534
|
obj.props.fixed = item.fixed;
|
|
531
535
|
obj.props.display_bo_list = item.display_bo_list;
|
|
532
536
|
obj.props.date_type = item.date_type;
|
|
533
|
-
obj.props.optionConfig =
|
|
537
|
+
obj.props.optionConfig = "none";
|
|
534
538
|
if (item.header_width_config) {
|
|
535
|
-
obj.props.widthType = item.header_width_config ===
|
|
539
|
+
obj.props.widthType = item.header_width_config === "1" ? "auto" : "px";
|
|
536
540
|
}
|
|
537
|
-
if (obj.props.widthType ===
|
|
541
|
+
if (obj.props.widthType === "px" && item.header_width) {
|
|
538
542
|
obj.props.width = Number(item.header_width);
|
|
539
543
|
}
|
|
540
|
-
if (item.table_header_type ===
|
|
541
|
-
obj.type =
|
|
544
|
+
if (item.table_header_type === "order") {
|
|
545
|
+
obj.type = "order-column";
|
|
542
546
|
obj.props.fixed = true;
|
|
543
|
-
} else if (item.table_header_type ===
|
|
544
|
-
obj.type =
|
|
545
|
-
var
|
|
546
|
-
obj.props.check = (
|
|
547
|
-
obj.props.check.openType =
|
|
548
|
-
var
|
|
549
|
-
obj.props.delete = (
|
|
550
|
-
obj.props.delete.openType =
|
|
551
|
-
var
|
|
552
|
-
obj.props.edit = (
|
|
553
|
-
obj.props.edit.openType =
|
|
547
|
+
} else if (item.table_header_type === "operation") {
|
|
548
|
+
obj.type = "operation-column";
|
|
549
|
+
var _item_check;
|
|
550
|
+
obj.props.check = (_item_check = item.check) !== null && _item_check !== void 0 ? _item_check : {};
|
|
551
|
+
obj.props.check.openType = "window";
|
|
552
|
+
var _item_delete;
|
|
553
|
+
obj.props.delete = (_item_delete = item.delete) !== null && _item_delete !== void 0 ? _item_delete : {};
|
|
554
|
+
obj.props.delete.openType = "window";
|
|
555
|
+
var _item_edit;
|
|
556
|
+
obj.props.edit = (_item_edit = item.edit) !== null && _item_edit !== void 0 ? _item_edit : {};
|
|
557
|
+
obj.props.edit.openType = "window";
|
|
554
558
|
obj.props.fixed = true;
|
|
555
559
|
} else {
|
|
556
|
-
obj.type = item.field_type +
|
|
557
|
-
if (item.field_type ===
|
|
558
|
-
obj.type =
|
|
560
|
+
obj.type = item.field_type + "-column";
|
|
561
|
+
if (item.field_type === "auto_number") {
|
|
562
|
+
obj.type = "auto-number-column";
|
|
559
563
|
}
|
|
560
|
-
if (item.field_type ===
|
|
561
|
-
obj.type =
|
|
564
|
+
if (item.field_type === "relation") {
|
|
565
|
+
obj.type = "varchar-column";
|
|
562
566
|
}
|
|
563
567
|
}
|
|
564
568
|
if (item.convert_switch) {
|
|
565
|
-
obj.props.optionConfig = item.convert_type === 1 ?
|
|
569
|
+
obj.props.optionConfig = item.convert_type === 1 ? "datasource" : "custom";
|
|
566
570
|
}
|
|
567
|
-
if (obj.props.optionConfig ===
|
|
571
|
+
if (obj.props.optionConfig === "datasource") {
|
|
568
572
|
obj.props.datasource_bind = new DataSourceBind({
|
|
569
573
|
svcCode: item.svc_code,
|
|
570
574
|
displayBoList: item.display_bo_list,
|
|
571
575
|
valueFieldCode: item.field_match,
|
|
572
576
|
dataCode: item.field_source
|
|
573
577
|
});
|
|
574
|
-
} else if (obj.props.optionConfig ===
|
|
578
|
+
} else if (obj.props.optionConfig === "custom") {
|
|
575
579
|
obj.props.options = item.custom_match_bo_list;
|
|
576
580
|
}
|
|
577
581
|
return obj;
|
|
@@ -581,12 +585,12 @@ function conversionGridTable(tableControl, toolbox) {
|
|
|
581
585
|
function groupPanelHandler(controlArray) {
|
|
582
586
|
var group = null;
|
|
583
587
|
for(var i = 0; i < controlArray.length; i++){
|
|
584
|
-
var
|
|
588
|
+
var _item_children_;
|
|
585
589
|
var item = controlArray[i];
|
|
586
590
|
if (!item) {
|
|
587
591
|
continue;
|
|
588
592
|
}
|
|
589
|
-
if (item.children && ((
|
|
593
|
+
if (item.children && ((_item_children_ = item.children[0]) === null || _item_children_ === void 0 ? void 0 : _item_children_.type) === "group-panel") {
|
|
590
594
|
group = item.children[0];
|
|
591
595
|
continue;
|
|
592
596
|
}
|
|
@@ -612,7 +616,7 @@ function conversionPageEvents(events) {
|
|
|
612
616
|
});
|
|
613
617
|
}
|
|
614
618
|
function conversionControlEvents(control, controlEvents) {
|
|
615
|
-
var
|
|
619
|
+
var _controlEvents_control_id;
|
|
616
620
|
if (!controlEvents || !control.props.events) {
|
|
617
621
|
return;
|
|
618
622
|
}
|
|
@@ -621,7 +625,7 @@ function conversionControlEvents(control, controlEvents) {
|
|
|
621
625
|
return;
|
|
622
626
|
}
|
|
623
627
|
eventKeys.forEach(function(eventKey) {
|
|
624
|
-
var
|
|
628
|
+
var _controlEvents_control_id_eventKey;
|
|
625
629
|
if (!control.props.events[eventKey].length) {
|
|
626
630
|
return;
|
|
627
631
|
}
|
|
@@ -631,17 +635,17 @@ function conversionControlEvents(control, controlEvents) {
|
|
|
631
635
|
if (!controlEvents[control.id][eventKey]) {
|
|
632
636
|
controlEvents[control.id][eventKey] = [];
|
|
633
637
|
}
|
|
634
|
-
(
|
|
638
|
+
(_controlEvents_control_id_eventKey = controlEvents[control.id][eventKey]).push.apply(_controlEvents_control_id_eventKey, _to_consumable_array(control.props.events[eventKey].map(function(item) {
|
|
635
639
|
return item.name;
|
|
636
640
|
})));
|
|
637
641
|
});
|
|
638
642
|
// 将失焦事件转换为change事件
|
|
639
|
-
if ((
|
|
640
|
-
var
|
|
643
|
+
if ((_controlEvents_control_id = controlEvents[control.id]) === null || _controlEvents_control_id === void 0 ? void 0 : _controlEvents_control_id.on_blur) {
|
|
644
|
+
var _controlEvents_control_id_on_change;
|
|
641
645
|
if (!controlEvents[control.id].on_change) {
|
|
642
646
|
controlEvents[control.id].on_change = [];
|
|
643
647
|
}
|
|
644
|
-
(
|
|
648
|
+
(_controlEvents_control_id_on_change = controlEvents[control.id].on_change).push.apply(_controlEvents_control_id_on_change, _to_consumable_array(controlEvents[control.id].on_blur));
|
|
645
649
|
}
|
|
646
650
|
}
|
|
647
651
|
export { dataCleaner };
|