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