@byteluck-fe/model-driven-upgrade 2.21.0-beta.9 → 2.22.0-beta.1
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 +10 -10
- package/dist/esm/index.js +2 -2
- package/dist/esm/upgrade/index.js +45 -43
- package/dist/esm/upgrade/v1_0.js +114 -114
- package/dist/esm/upgrade/v2_0.js +2 -2
- package/dist/esm/upgrade/v2_1.js +9 -9
- package/dist/esm/upgrade/v2_10.js +1 -1
- package/dist/esm/upgrade/v2_2.js +13 -13
- package/dist/esm/upgrade/v2_3.js +2 -2
- 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 +1 -1
- package/dist/esm/upgrade/v2_7.js +5 -5
- package/dist/esm/upgrade/v2_8.js +2 -2
- package/dist/esm/upgrade/v2_9.js +1 -1
- package/dist/esm/upgrade/v3_0.js +22 -22
- package/dist/esm/upgrade/v3_1.js +36 -36
- package/dist/esm/upgrade/v3_10.js +71 -0
- package/dist/esm/upgrade/v3_2.js +4 -4
- package/dist/esm/upgrade/v3_3.js +8 -8
- package/dist/esm/upgrade/v3_4.js +11 -11
- package/dist/esm/upgrade/v3_5.js +19 -19
- package/dist/esm/upgrade/v3_6.js +9 -9
- package/dist/esm/upgrade/v3_7.js +5 -5
- package/dist/esm/upgrade/v3_8.js +106 -13
- package/dist/index.umd.js +1 -1
- package/dist/types/types.d.ts +1 -0
- package/dist/types/upgrade/index.d.ts +2 -1
- package/dist/types/upgrade/v3_10.d.ts +3 -0
- package/package.json +5 -5
|
@@ -30,11 +30,11 @@ function _define_property(obj, key, value) {
|
|
|
30
30
|
}
|
|
31
31
|
return obj;
|
|
32
32
|
}
|
|
33
|
-
import { error, log } from
|
|
34
|
-
import dataCleaner from
|
|
35
|
-
import { compareVersions, compare } from
|
|
33
|
+
import { error, log } from '@byteluck-fe/model-driven-shared';
|
|
34
|
+
import dataCleaner from './upgrade';
|
|
35
|
+
import { compareVersions, compare } from 'compare-versions';
|
|
36
36
|
function versionReplace$v(version) {
|
|
37
|
-
return version.replace(/^v/,
|
|
37
|
+
return version.replace(/^v/, '');
|
|
38
38
|
}
|
|
39
39
|
function versionToNumber(version) {
|
|
40
40
|
return Number(versionReplace$v(version));
|
|
@@ -56,10 +56,10 @@ export var VersionBuilder = /*#__PURE__*/ function() {
|
|
|
56
56
|
this.schemaVersion = schemaVersion;
|
|
57
57
|
this.toVersion = version;
|
|
58
58
|
// if (versionToNumber(version) > versionToNumber(nowVersion)) {
|
|
59
|
-
if (compare(version, nowVersion,
|
|
59
|
+
if (compare(version, nowVersion, '>')) {
|
|
60
60
|
error("Version Builder: The specified ".concat(version, " is an undefined version, and the current latest version is ").concat(nowVersion));
|
|
61
61
|
} else if (!versionKeys.includes(versionReplace$v(version)) || !versionKeys.includes(versionReplace$v(schemaVersion))) {
|
|
62
|
-
error("Version Builder: Please give me a valid version number, The valid version is: ".concat(versionKeys.join(
|
|
62
|
+
error("Version Builder: Please give me a valid version number, The valid version is: ".concat(versionKeys.join(','), ", But give me a ").concat(schemaVersion));
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
_create_class(VersionBuilder, [
|
|
@@ -68,7 +68,7 @@ export var VersionBuilder = /*#__PURE__*/ function() {
|
|
|
68
68
|
value: function dataCleaner1(schema, payload) {
|
|
69
69
|
var _this = this;
|
|
70
70
|
// if (this._version === this._schemaVersion) {
|
|
71
|
-
if (compare(this.toVersion, this.schemaVersion,
|
|
71
|
+
if (compare(this.toVersion, this.schemaVersion, '=')) {
|
|
72
72
|
return schema;
|
|
73
73
|
}
|
|
74
74
|
var result = this.callDataCleanerKeys.reduce(function(schema, currentVersion, index, arr) {
|
|
@@ -77,7 +77,7 @@ export var VersionBuilder = /*#__PURE__*/ function() {
|
|
|
77
77
|
log("Version Builder: current version: ".concat(currentVersion, ", nextVersion: ").concat(nextVersion));
|
|
78
78
|
var callback = dataCleaner[currentVersion];
|
|
79
79
|
var result = schema;
|
|
80
|
-
if (typeof callback ===
|
|
80
|
+
if (typeof callback === 'function') {
|
|
81
81
|
var callResult = callback(schema, payload);
|
|
82
82
|
if (callResult) {
|
|
83
83
|
result = callResult;
|
|
@@ -95,7 +95,7 @@ export var VersionBuilder = /*#__PURE__*/ function() {
|
|
|
95
95
|
var _this = this;
|
|
96
96
|
return versionKeys.filter(function(item) {
|
|
97
97
|
return(// Number(item) >= this._schemaVersion && Number(item) < this._version
|
|
98
|
-
compare(item, _this.schemaVersion,
|
|
98
|
+
compare(item, _this.schemaVersion, '>=') && compare(item, _this.toVersion, '<'));
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
},
|
|
@@ -103,7 +103,7 @@ export var VersionBuilder = /*#__PURE__*/ function() {
|
|
|
103
103
|
key: "callDataCleanerKeys",
|
|
104
104
|
get: function get() {
|
|
105
105
|
return this.runDataCleanerKeys.map(function(key) {
|
|
106
|
-
return
|
|
106
|
+
return 'v' + key;
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
},
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from './VersionBuilder';
|
|
2
|
+
export * from './types';
|
|
@@ -5,51 +5,53 @@
|
|
|
5
5
|
* @LastEditTime: 2024-05-11 14:42:17
|
|
6
6
|
* @FilePath: /model-driven/packages/upgrade/src/upgrade/index.ts
|
|
7
7
|
* @Description:
|
|
8
|
-
*/ import { dataCleaner as dataCleanerV1toV2 } from
|
|
9
|
-
import { dataCleaner as dataCleanerV2toV2_1 } from
|
|
10
|
-
import { dataCleaner as dataCleanerV2_1toV2_2 } from
|
|
11
|
-
import { dataCleaner as dataCleanerV2_2toV2_3 } from
|
|
12
|
-
import { dataCleaner as dataCleanerV2_3toV2_4 } from
|
|
13
|
-
import { dataCleaner as dataCleanerV2_4toV2_5 } from
|
|
14
|
-
import { dataCleaner as dataCleanerV2_5toV2_6 } from
|
|
15
|
-
import { dataCleaner as dataCleanerV2_6toV2_7 } from
|
|
16
|
-
import { dataCleaner as dataCleanerV2_7toV2_8 } from
|
|
17
|
-
import { dataCleaner as dataCleanerV2_8toV2_9 } from
|
|
18
|
-
import { dataCleaner as dataCleanerV2_9toV2_10 } from
|
|
19
|
-
import { dataCleaner as dataCleanerV2_10toV3_0 } from
|
|
20
|
-
import { dataCleaner as dataCleanerV3_0toV3_1 } from
|
|
21
|
-
import { dataCleaner as dataCleanerV3_1toV3_2 } from
|
|
22
|
-
import { dataCleaner as dataCleanerV3_1toV3_3 } from
|
|
23
|
-
import { dataCleaner as dataCleanerV3_1toV3_4 } from
|
|
24
|
-
import { dataCleaner as dataCleanerV3_1toV3_5 } from
|
|
25
|
-
import { dataCleaner as dataCleanerV3_5toV3_6 } from
|
|
26
|
-
import { dataCleaner as dataCleanerV3_6toV3_7 } from
|
|
27
|
-
import { dataCleaner as dataCleanerV3_7toV3_8 } from
|
|
28
|
-
import { dataCleaner as dataCleanerV3_7toV3_9 } from
|
|
8
|
+
*/ import { dataCleaner as dataCleanerV1toV2 } from './v1_0';
|
|
9
|
+
import { dataCleaner as dataCleanerV2toV2_1 } from './v2_0';
|
|
10
|
+
import { dataCleaner as dataCleanerV2_1toV2_2 } from './v2_1';
|
|
11
|
+
import { dataCleaner as dataCleanerV2_2toV2_3 } from './v2_2';
|
|
12
|
+
import { dataCleaner as dataCleanerV2_3toV2_4 } from './v2_3';
|
|
13
|
+
import { dataCleaner as dataCleanerV2_4toV2_5 } from './v2_4';
|
|
14
|
+
import { dataCleaner as dataCleanerV2_5toV2_6 } from './v2_5';
|
|
15
|
+
import { dataCleaner as dataCleanerV2_6toV2_7 } from './v2_6';
|
|
16
|
+
import { dataCleaner as dataCleanerV2_7toV2_8 } from './v2_7';
|
|
17
|
+
import { dataCleaner as dataCleanerV2_8toV2_9 } from './v2_8';
|
|
18
|
+
import { dataCleaner as dataCleanerV2_9toV2_10 } from './v2_9';
|
|
19
|
+
import { dataCleaner as dataCleanerV2_10toV3_0 } from './v2_10';
|
|
20
|
+
import { dataCleaner as dataCleanerV3_0toV3_1 } from './v3_0';
|
|
21
|
+
import { dataCleaner as dataCleanerV3_1toV3_2 } from './v3_1';
|
|
22
|
+
import { dataCleaner as dataCleanerV3_1toV3_3 } from './v3_2';
|
|
23
|
+
import { dataCleaner as dataCleanerV3_1toV3_4 } from './v3_3';
|
|
24
|
+
import { dataCleaner as dataCleanerV3_1toV3_5 } from './v3_4';
|
|
25
|
+
import { dataCleaner as dataCleanerV3_5toV3_6 } from './v3_5';
|
|
26
|
+
import { dataCleaner as dataCleanerV3_6toV3_7 } from './v3_6';
|
|
27
|
+
import { dataCleaner as dataCleanerV3_7toV3_8 } from './v3_7';
|
|
28
|
+
import { dataCleaner as dataCleanerV3_7toV3_9 } from './v3_8';
|
|
29
|
+
import { dataCleaner as dataCleanerV3_9toV3_10 } from './v3_10';
|
|
29
30
|
// TODO 切记复制粘贴的时候改一下from后边的路径,不然会出事儿
|
|
30
31
|
// TODO 注意从2.5版本开始,没有进行驼峰转下划线了,写的时候要注意
|
|
31
32
|
export default {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
'v1.0': dataCleanerV1toV2,
|
|
34
|
+
'v2.0': dataCleanerV2toV2_1,
|
|
35
|
+
'v2.1': dataCleanerV2_1toV2_2,
|
|
36
|
+
'v2.2': dataCleanerV2_2toV2_3,
|
|
37
|
+
'v2.3': dataCleanerV2_3toV2_4,
|
|
38
|
+
'v2.4': dataCleanerV2_4toV2_5,
|
|
39
|
+
'v2.5': dataCleanerV2_5toV2_6,
|
|
40
|
+
'v2.6': dataCleanerV2_6toV2_7,
|
|
41
|
+
'v2.7': dataCleanerV2_7toV2_8,
|
|
42
|
+
'v2.8': dataCleanerV2_8toV2_9,
|
|
43
|
+
'v2.9': dataCleanerV2_9toV2_10,
|
|
44
|
+
'v2.10': dataCleanerV2_10toV3_0,
|
|
45
|
+
'v3.0': dataCleanerV3_0toV3_1,
|
|
46
|
+
'v3.1': dataCleanerV3_1toV3_2,
|
|
47
|
+
'v3.2': dataCleanerV3_1toV3_3,
|
|
47
48
|
// 每次都需要预留一个下一版本的转换函数,会使用到对应的key作为当前最新的schema version
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
'v3.3': dataCleanerV3_1toV3_4,
|
|
50
|
+
'v3.4': dataCleanerV3_1toV3_5,
|
|
51
|
+
'v3.5': dataCleanerV3_5toV3_6,
|
|
52
|
+
'v3.6': dataCleanerV3_6toV3_7,
|
|
53
|
+
'v3.7': dataCleanerV3_7toV3_8,
|
|
54
|
+
'v3.8': dataCleanerV3_7toV3_9,
|
|
55
|
+
'v3.10': dataCleanerV3_9toV3_10,
|
|
56
|
+
'v3.11': function() {}
|
|
55
57
|
};
|
package/dist/esm/upgrade/v1_0.js
CHANGED
|
@@ -56,9 +56,9 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
56
56
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
57
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
63
|
var isArray = Array.isArray(schemaItems);
|
|
64
64
|
var schemaArray = isArray ? schemaItems : [
|
|
@@ -80,33 +80,33 @@ 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
93
|
function conversion(item, payload) {
|
|
94
94
|
var _item_props, _item_props1, _item_props2;
|
|
95
95
|
var new_item = item;
|
|
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;
|
|
@@ -132,34 +132,34 @@ function conversion(item, payload) {
|
|
|
132
132
|
new_item.props.placeholder_end = item.props.placeholder_end.zh;
|
|
133
133
|
}
|
|
134
134
|
// 部门组件
|
|
135
|
-
if (item.type ===
|
|
136
|
-
new_item.type =
|
|
135
|
+
if (item.type === 'department-search') {
|
|
136
|
+
new_item.type = 'department';
|
|
137
137
|
if (item.props.value.length) {
|
|
138
138
|
new_item.props.default_value = item.props.value;
|
|
139
139
|
}
|
|
140
|
-
new_item.props.showType = item.props.show_tree ?
|
|
140
|
+
new_item.props.showType = item.props.show_tree ? 'tree' : 'default';
|
|
141
141
|
new_item.props.rangeOptions = item.props.department_list;
|
|
142
142
|
}
|
|
143
|
-
if (item.type ===
|
|
144
|
-
new_item.type =
|
|
143
|
+
if (item.type === 'automatic-number') {
|
|
144
|
+
new_item.type = 'auto-number';
|
|
145
145
|
new_item.props.defaultValue = item.props.value;
|
|
146
146
|
}
|
|
147
147
|
// 附件类型转换
|
|
148
|
-
if (item.type ===
|
|
148
|
+
if (item.type === 'file') {
|
|
149
149
|
var _item_attachment_format;
|
|
150
|
-
new_item.type =
|
|
151
|
-
new_item.props.attachmentAccept = (_item_attachment_format = item.attachment_format) === null || _item_attachment_format === void 0 ? void 0 : _item_attachment_format.split(
|
|
152
|
-
new_item.props.showType = item.props.show_type ===
|
|
150
|
+
new_item.type = 'attachment';
|
|
151
|
+
new_item.props.attachmentAccept = (_item_attachment_format = item.attachment_format) === null || _item_attachment_format === void 0 ? void 0 : _item_attachment_format.split(',');
|
|
152
|
+
new_item.props.showType = item.props.show_type === 'title' ? 'default' : 'table';
|
|
153
153
|
}
|
|
154
|
-
if (item.type ===
|
|
154
|
+
if (item.type === 'image') {
|
|
155
155
|
var _item_attachment_format1;
|
|
156
|
-
new_item.props.attachmentAccept = (_item_attachment_format1 = item.attachment_format) === null || _item_attachment_format1 === void 0 ? void 0 : _item_attachment_format1.split(
|
|
156
|
+
new_item.props.attachmentAccept = (_item_attachment_format1 = item.attachment_format) === null || _item_attachment_format1 === void 0 ? void 0 : _item_attachment_format1.split(',');
|
|
157
157
|
}
|
|
158
158
|
// 日期选择转换
|
|
159
|
-
if (item.type ===
|
|
160
|
-
new_item.type =
|
|
159
|
+
if (item.type === 'date-pick') {
|
|
160
|
+
new_item.type = 'date-picker';
|
|
161
161
|
}
|
|
162
|
-
if (item.type ===
|
|
162
|
+
if (item.type === 'rich-text') {
|
|
163
163
|
if (isLanguageObject(item.props.value)) {
|
|
164
164
|
new_item.props.defaultValue = item.props.value.zh;
|
|
165
165
|
} else {
|
|
@@ -167,9 +167,9 @@ function conversion(item, payload) {
|
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
if ([
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
'link',
|
|
171
|
+
'text',
|
|
172
|
+
'button'
|
|
173
173
|
].includes(item.type)) {
|
|
174
174
|
if (isLanguageObject(item.props.value)) {
|
|
175
175
|
new_item.props.content = item.props.value.zh;
|
|
@@ -177,25 +177,25 @@ function conversion(item, payload) {
|
|
|
177
177
|
new_item.props.content = item.props.value;
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
|
-
if (item.type ===
|
|
181
|
-
if (item.props.showState ===
|
|
182
|
-
new_item.props.showState =
|
|
180
|
+
if (item.type === 'text') {
|
|
181
|
+
if (item.props.showState === 'iconText') {
|
|
182
|
+
new_item.props.showState = 'image';
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
-
if (item.type ===
|
|
186
|
-
new_item.type =
|
|
185
|
+
if (item.type === 'user-search') {
|
|
186
|
+
new_item.type = 'employee';
|
|
187
187
|
new_item.props.defaultValue = item.props.value;
|
|
188
188
|
}
|
|
189
|
-
if (item.type ===
|
|
189
|
+
if (item.type === 'address') {
|
|
190
190
|
new_item.props.addressType = item.props.address_type_value;
|
|
191
191
|
}
|
|
192
192
|
//明细子表去掉 subtable-row,保留 subtable-column
|
|
193
|
-
if (new_item.type ===
|
|
193
|
+
if (new_item.type === 'subtable') {
|
|
194
194
|
var _new_item_children_;
|
|
195
195
|
// 转换打开方式
|
|
196
196
|
var entryType = new_item.props.entry_type || new_item.props.entryType;
|
|
197
|
-
new_item.props.openType = entryType ===
|
|
198
|
-
if (((_new_item_children_ = new_item.children[0]) === null || _new_item_children_ === void 0 ? void 0 : _new_item_children_.type) ===
|
|
197
|
+
new_item.props.openType = entryType === 'subpage' ? 'modal' : 'default';
|
|
198
|
+
if (((_new_item_children_ = new_item.children[0]) === null || _new_item_children_ === void 0 ? void 0 : _new_item_children_.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,14 +216,14 @@ 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
229
|
if (optionsControl.includes(item.type)) {
|
|
@@ -234,7 +234,7 @@ function conversion(item, payload) {
|
|
|
234
234
|
new_item = item;
|
|
235
235
|
}
|
|
236
236
|
// grid-row 更改type,并且添加col控件
|
|
237
|
-
if (item.type ===
|
|
237
|
+
if (item.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 (item.type ===
|
|
249
|
-
new_item.type =
|
|
248
|
+
if (item.type === 'grid-layout-row') {
|
|
249
|
+
new_item.type = 'row';
|
|
250
250
|
}
|
|
251
|
-
if (item.type ===
|
|
252
|
-
new_item.type =
|
|
251
|
+
if (item.type === 'grid-layout-col') {
|
|
252
|
+
new_item.type = 'col';
|
|
253
253
|
}
|
|
254
|
-
if (item.type ===
|
|
255
|
-
new_item.type =
|
|
256
|
-
new_item.props.collapse = new_item.props.flod ===
|
|
254
|
+
if (item.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 (item.type ===
|
|
260
|
-
new_item.type =
|
|
259
|
+
if (item.type === 'tabs-pane') {
|
|
260
|
+
new_item.type = 'tab-pane';
|
|
261
261
|
}
|
|
262
|
-
if (item.type ===
|
|
262
|
+
if (item.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 (item.type ===
|
|
287
|
-
new_item.type =
|
|
288
|
-
new_item.controlType =
|
|
286
|
+
if (item.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,8 +320,8 @@ function conversion(item, payload) {
|
|
|
320
320
|
new_item.props.defaultValue = defaultValue;
|
|
321
321
|
delete new_item.children;
|
|
322
322
|
}
|
|
323
|
-
if (item.type ===
|
|
324
|
-
new_item.controlType =
|
|
323
|
+
if (item.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
327
|
new_item.props.placeholderStart = isLanguageObject(item.props.placeholder) ? item.props.placeholder.zh : item.props.placeholder;
|
|
@@ -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 (item.type ===
|
|
339
|
+
if (item.type === 'score') {
|
|
340
340
|
new_item.props.defaultValue = new_item.props.value * 1;
|
|
341
341
|
}
|
|
342
342
|
if ([
|
|
343
|
-
|
|
344
|
-
|
|
343
|
+
'input',
|
|
344
|
+
'textarea'
|
|
345
345
|
].includes(item.type)) {
|
|
346
346
|
new_item.props.defaultValue = isLanguageObject(item.props.value) ? item.props.value.zh : item.props.value;
|
|
347
347
|
}
|
|
348
|
-
if (item.type ===
|
|
348
|
+
if (item.type === 'number') {
|
|
349
349
|
new_item.props.range_min = toNumberOrEmpty(item.props.range_min);
|
|
350
350
|
new_item.props.range_max = toNumberOrEmpty(item.props.range_max);
|
|
351
351
|
new_item.props.defaultValue = toNumberOrEmpty(item.props.value);
|
|
352
352
|
}
|
|
353
|
-
if (item.type ===
|
|
354
|
-
item.type =
|
|
353
|
+
if (item.type === 'list-page-btn-custom-button') {
|
|
354
|
+
item.type = 'button';
|
|
355
355
|
}
|
|
356
|
-
if (item.type ===
|
|
357
|
-
if (item.props.button_type ===
|
|
358
|
-
new_item.props.buttonType =
|
|
356
|
+
if (item.type === 'button') {
|
|
357
|
+
if (item.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);
|
|
@@ -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;
|
|
@@ -422,10 +422,10 @@ function conversionLayoutControl(schemArray) {
|
|
|
422
422
|
var _controlArray_i_children, _controlArray_i;
|
|
423
423
|
var control = controlArray[i];
|
|
424
424
|
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];
|
|
425
|
-
if (control.type ===
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
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
|
}
|
|
@@ -438,7 +438,7 @@ function conversionListPage(controlArray, payload) {
|
|
|
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
|
|
@@ -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 ===
|
|
490
|
+
if (item.type === 'date-pick') {
|
|
491
491
|
var _item_dateType_replace, _item_dateType;
|
|
492
|
-
item.type =
|
|
492
|
+
item.type = 'search-date-range';
|
|
493
493
|
item.placeholderStart = placeholder;
|
|
494
494
|
item.placeholderEnd = placeholder;
|
|
495
495
|
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
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 =
|
|
543
|
+
} else if (item.table_header_type === 'operation') {
|
|
544
|
+
obj.type = 'operation-column';
|
|
545
545
|
var _item_check;
|
|
546
546
|
obj.props.check = (_item_check = item.check) !== null && _item_check !== void 0 ? _item_check : {};
|
|
547
|
-
obj.props.check.openType =
|
|
547
|
+
obj.props.check.openType = 'window';
|
|
548
548
|
var _item_delete;
|
|
549
549
|
obj.props.delete = (_item_delete = item.delete) !== null && _item_delete !== void 0 ? _item_delete : {};
|
|
550
|
-
obj.props.delete.openType =
|
|
550
|
+
obj.props.delete.openType = 'window';
|
|
551
551
|
var _item_edit;
|
|
552
552
|
obj.props.edit = (_item_edit = item.edit) !== null && _item_edit !== void 0 ? _item_edit : {};
|
|
553
|
-
obj.props.edit.openType =
|
|
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;
|
|
@@ -586,7 +586,7 @@ function groupPanelHandler(controlArray) {
|
|
|
586
586
|
if (!item) {
|
|
587
587
|
continue;
|
|
588
588
|
}
|
|
589
|
-
if (item.children && ((_item_children_ = item.children[0]) === null || _item_children_ === void 0 ? void 0 : _item_children_.type) ===
|
|
589
|
+
if (item.children && ((_item_children_ = item.children[0]) === null || _item_children_ === void 0 ? void 0 : _item_children_.type) === 'group-panel') {
|
|
590
590
|
group = item.children[0];
|
|
591
591
|
continue;
|
|
592
592
|
}
|
package/dist/esm/upgrade/v2_0.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { decamelizeKeys, loop, CONTROL_TYPE } from
|
|
2
|
-
import { DataBind } from
|
|
1
|
+
import { decamelizeKeys, loop, CONTROL_TYPE } from '@byteluck-fe/model-driven-shared';
|
|
2
|
+
import { DataBind } from '@byteluck-fe/model-driven-core';
|
|
3
3
|
var dataCleaner = function(schemaItems, payload) {
|
|
4
4
|
var isArray = Array.isArray(schemaItems);
|
|
5
5
|
var schemaArray = isArray ? schemaItems : [
|