@byteluck-fe/model-driven-upgrade 2.7.0-alpha.2 → 2.7.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/VersionBuilder.js +43 -26
- package/dist/esm/upgrade/v1_0.js +42 -38
- package/dist/esm/upgrade/v2_6.js +2 -2
- package/dist/esm/upgrade/v2_8.js +1 -1
- package/dist/esm/upgrade/v3_0.js +5 -5
- package/dist/index.umd.js +1 -1
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _class_call_check(instance, Constructor) {
|
|
2
2
|
if (!(instance instanceof Constructor)) {
|
|
3
3
|
throw new TypeError("Cannot call a class as a function");
|
|
4
4
|
}
|
|
@@ -12,11 +12,24 @@ function _defineProperties(target, props) {
|
|
|
12
12
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
16
16
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
17
17
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
18
18
|
return Constructor;
|
|
19
19
|
}
|
|
20
|
+
function _define_property(obj, key, value) {
|
|
21
|
+
if (key in obj) {
|
|
22
|
+
Object.defineProperty(obj, key, {
|
|
23
|
+
value: value,
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true
|
|
27
|
+
});
|
|
28
|
+
} else {
|
|
29
|
+
obj[key] = value;
|
|
30
|
+
}
|
|
31
|
+
return obj;
|
|
32
|
+
}
|
|
20
33
|
import { error, log } from "@byteluck-fe/model-driven-shared";
|
|
21
34
|
import dataCleaner from "./upgrade";
|
|
22
35
|
import { compareVersions, compare } from "compare-versions";
|
|
@@ -37,7 +50,9 @@ export var VersionBuilder = /*#__PURE__*/ function() {
|
|
|
37
50
|
"use strict";
|
|
38
51
|
function VersionBuilder(schemaVersion) {
|
|
39
52
|
var version = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : nowVersion;
|
|
40
|
-
|
|
53
|
+
_class_call_check(this, VersionBuilder);
|
|
54
|
+
_define_property(this, "toVersion", void 0);
|
|
55
|
+
_define_property(this, "schemaVersion", void 0);
|
|
41
56
|
this.schemaVersion = schemaVersion;
|
|
42
57
|
this.toVersion = version;
|
|
43
58
|
// if (versionToNumber(version) > versionToNumber(nowVersion)) {
|
|
@@ -47,31 +62,33 @@ export var VersionBuilder = /*#__PURE__*/ function() {
|
|
|
47
62
|
error("Version Builder: Please give me a valid version number, The valid version is: ".concat(versionKeys.join(","), ", But give me a ").concat(schemaVersion));
|
|
48
63
|
}
|
|
49
64
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
var _arr_;
|
|
59
|
-
var nextVersion = (_arr_ = arr[index + 1]) !== null && _arr_ !== void 0 ? _arr_ : _this.toVersion;
|
|
60
|
-
log("Version Builder: current version: ".concat(currentVersion, ", nextVersion: ").concat(nextVersion));
|
|
61
|
-
var callback = dataCleaner[currentVersion];
|
|
62
|
-
var result = schema;
|
|
63
|
-
if (typeof callback === "function") {
|
|
64
|
-
var callResult = callback(schema, payload);
|
|
65
|
-
if (callResult) {
|
|
66
|
-
result = callResult;
|
|
65
|
+
_create_class(VersionBuilder, [
|
|
66
|
+
{
|
|
67
|
+
key: "dataCleaner",
|
|
68
|
+
value: function dataCleaner1(schema, payload) {
|
|
69
|
+
var _this = this;
|
|
70
|
+
// if (this._version === this._schemaVersion) {
|
|
71
|
+
if (compare(this.toVersion, this.schemaVersion, "=")) {
|
|
72
|
+
return schema;
|
|
67
73
|
}
|
|
74
|
+
var result = this.callDataCleanerKeys.reduce(function(schema, currentVersion, index, arr) {
|
|
75
|
+
var _arr_;
|
|
76
|
+
var nextVersion = (_arr_ = arr[index + 1]) !== null && _arr_ !== void 0 ? _arr_ : _this.toVersion;
|
|
77
|
+
log("Version Builder: current version: ".concat(currentVersion, ", nextVersion: ").concat(nextVersion));
|
|
78
|
+
var callback = dataCleaner[currentVersion];
|
|
79
|
+
var result = schema;
|
|
80
|
+
if (typeof callback === "function") {
|
|
81
|
+
var callResult = callback(schema, payload);
|
|
82
|
+
if (callResult) {
|
|
83
|
+
result = callResult;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return result;
|
|
87
|
+
}, schema);
|
|
88
|
+
log("Version Builder: Version conversion completed, evolving from ".concat(this.schemaVersion, " to ").concat(this.toVersion));
|
|
89
|
+
return result;
|
|
68
90
|
}
|
|
69
|
-
|
|
70
|
-
}, schema);
|
|
71
|
-
log("Version Builder: Version conversion completed, evolving from ".concat(this.schemaVersion, " to ").concat(this.toVersion));
|
|
72
|
-
return result;
|
|
73
|
-
};
|
|
74
|
-
_createClass(VersionBuilder, [
|
|
91
|
+
},
|
|
75
92
|
{
|
|
76
93
|
key: "runDataCleanerKeys",
|
|
77
94
|
get: function get() {
|
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
59
|
import { loop, toNumberOrEmpty, isLanguageObject, camelizeKeys, decamelizeKeys, CONTROL_TYPE } from "@byteluck-fe/model-driven-shared";
|
|
60
60
|
import { DataSourceBind } from "@byteluck-fe/model-driven-core";
|
|
61
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);
|
|
@@ -91,7 +92,7 @@ var searchViewControlKeys = [
|
|
|
91
92
|
"simple-search"
|
|
92
93
|
];
|
|
93
94
|
function conversion(item, payload) {
|
|
94
|
-
var _item_props, _item_props1, _item_props2;
|
|
95
|
+
var _item_props, _item, _item_props1, _item1, _item_props2, _item2, _payload;
|
|
95
96
|
var new_item = item;
|
|
96
97
|
if (!new_item.controlType) {
|
|
97
98
|
if (new_item.is_layout_control === true) {
|
|
@@ -122,13 +123,13 @@ function conversion(item, payload) {
|
|
|
122
123
|
item.props.defaultValue = item.props.value;
|
|
123
124
|
}
|
|
124
125
|
//caption/placeholder/placeholder_end 的 zh 属性将被保留,国际化资源都丢弃,放到外部
|
|
125
|
-
if (isLanguageObject(item === null ||
|
|
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)) {
|
|
126
127
|
new_item.props.caption = item.props.caption.zh;
|
|
127
128
|
}
|
|
128
|
-
if (isLanguageObject(item === null ||
|
|
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)) {
|
|
129
130
|
new_item.props.placeholder = item.props.placeholder.zh;
|
|
130
131
|
}
|
|
131
|
-
if (isLanguageObject(item === null ||
|
|
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)) {
|
|
132
133
|
new_item.props.placeholder_end = item.props.placeholder_end.zh;
|
|
133
134
|
}
|
|
134
135
|
// 部门组件
|
|
@@ -260,8 +261,9 @@ function conversion(item, payload) {
|
|
|
260
261
|
new_item.type = "tab-pane";
|
|
261
262
|
}
|
|
262
263
|
if (item.type === "calc") {
|
|
263
|
-
var
|
|
264
|
-
var
|
|
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);
|
|
@@ -284,10 +286,11 @@ function conversion(item, payload) {
|
|
|
284
286
|
delete new_item.children;
|
|
285
287
|
}
|
|
286
288
|
if (item.type === "amount-currency") {
|
|
289
|
+
var _new_item2, _new_item3;
|
|
287
290
|
new_item.type = "amount";
|
|
288
291
|
new_item.controlType = "form";
|
|
289
|
-
var amount = new_item === null ||
|
|
290
|
-
var currency = new_item === null ||
|
|
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.
|
|
@@ -321,9 +324,10 @@ function conversion(item, payload) {
|
|
|
321
324
|
delete new_item.children;
|
|
322
325
|
}
|
|
323
326
|
if (item.type === "date-range") {
|
|
327
|
+
var _new_item4, _new_item5;
|
|
324
328
|
new_item.controlType = "form";
|
|
325
|
-
var min = new_item === null ||
|
|
326
|
-
var max = new_item === null ||
|
|
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];
|
|
327
331
|
new_item.props.placeholderStart = isLanguageObject(item.props.placeholder) ? item.props.placeholder.zh : item.props.placeholder;
|
|
328
332
|
new_item.props.caption = isLanguageObject(item.props.caption) ? item.props.caption.zh : item.props.caption;
|
|
329
333
|
var newDataBind2 = {};
|
|
@@ -358,7 +362,7 @@ function conversion(item, payload) {
|
|
|
358
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) {
|
|
@@ -419,7 +423,7 @@ 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
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];
|
|
425
429
|
if (control.type === "grid-row" && child && [
|
|
@@ -433,7 +437,7 @@ function conversionLayoutControl(schemArray) {
|
|
|
433
437
|
});
|
|
434
438
|
}
|
|
435
439
|
function conversionListPage(controlArray, payload) {
|
|
436
|
-
var _listPageProps_source_config, _listPageProps_source_config1, _listPageProps_source_config2, _listPageProps_source_config3, _listPageProps_sublist_page;
|
|
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
|
}
|
|
@@ -443,9 +447,9 @@ function conversionListPage(controlArray, payload) {
|
|
|
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,
|
|
@@ -453,11 +457,11 @@ function conversionListPage(controlArray, payload) {
|
|
|
453
457
|
// })
|
|
454
458
|
conversionGridTable(table, toolbox);
|
|
455
459
|
var _listPageProps_source_config_data_code;
|
|
456
|
-
var dataCode = (_listPageProps_source_config_data_code = listPageProps === null ||
|
|
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;
|
|
457
461
|
var _listPageProps_source_config_svc_code;
|
|
458
|
-
var svcCode = ((_listPageProps_source_config_svc_code = listPageProps === null ||
|
|
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;
|
|
459
463
|
var _listPageProps_source_config_orders;
|
|
460
|
-
var orders = (_listPageProps_source_config_orders = listPageProps === null ||
|
|
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;
|
|
@@ -488,7 +492,7 @@ function conversionSearch(searchControl) {
|
|
|
488
492
|
item.placeholderEnd = placeholder;
|
|
489
493
|
}
|
|
490
494
|
if (item.type === "date-pick") {
|
|
491
|
-
var
|
|
495
|
+
var _item_dateType_replace, _item_dateType;
|
|
492
496
|
item.type = "search-date-range";
|
|
493
497
|
item.placeholderStart = placeholder;
|
|
494
498
|
item.placeholderEnd = placeholder;
|
|
@@ -631,7 +635,7 @@ function conversionControlEvents(control, controlEvents) {
|
|
|
631
635
|
if (!controlEvents[control.id][eventKey]) {
|
|
632
636
|
controlEvents[control.id][eventKey] = [];
|
|
633
637
|
}
|
|
634
|
-
(_controlEvents_control_id_eventKey = controlEvents[control.id][eventKey]).push.apply(_controlEvents_control_id_eventKey,
|
|
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
|
});
|
|
@@ -641,7 +645,7 @@ function conversionControlEvents(control, controlEvents) {
|
|
|
641
645
|
if (!controlEvents[control.id].on_change) {
|
|
642
646
|
controlEvents[control.id].on_change = [];
|
|
643
647
|
}
|
|
644
|
-
(_controlEvents_control_id_on_change = controlEvents[control.id].on_change).push.apply(_controlEvents_control_id_on_change,
|
|
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 };
|
package/dist/esm/upgrade/v2_6.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
2
|
if (key in obj) {
|
|
3
3
|
Object.defineProperty(obj, key, {
|
|
4
4
|
value: value,
|
|
@@ -29,7 +29,7 @@ function setFieldTypeToDataBind(DataBind, fieldType) {
|
|
|
29
29
|
}
|
|
30
30
|
function conversion(schema, payload) {
|
|
31
31
|
var _obj;
|
|
32
|
-
var fieldTypeMap = (_obj = {},
|
|
32
|
+
var fieldTypeMap = (_obj = {}, _define_property(_obj, CONTROL_TYPE.TITLE, FieldTypes.AUTO_NUMBER), _define_property(_obj, CONTROL_TYPE.ADDRESS, FieldTypes.ADDRESS), _define_property(_obj, CONTROL_TYPE.ATTACHMENT, FieldTypes.FILE), _define_property(_obj, CONTROL_TYPE.AUTO_NUMBER, FieldTypes.AUTO_NUMBER), _define_property(_obj, CONTROL_TYPE.CHECKBOX, FieldTypes.ARRAY), _define_property(_obj, CONTROL_TYPE.DATE_PICKER, FieldTypes.TIMESTAMP), _define_property(_obj, CONTROL_TYPE.DEPARTMENT, FieldTypes.DEPARTMENTS), _define_property(_obj, CONTROL_TYPE.EMPLOYEE, FieldTypes.EMPLOYEES), _define_property(_obj, CONTROL_TYPE.EMPLOYEE2, FieldTypes.EMPLOYEES), _define_property(_obj, CONTROL_TYPE.IMAGE, FieldTypes.IMAGE), _define_property(_obj, CONTROL_TYPE.INPUT, FieldTypes.VARCHAR), _define_property(_obj, CONTROL_TYPE.NUMBER, FieldTypes.DECIMAL), _define_property(_obj, CONTROL_TYPE.RADIO, FieldTypes.VARCHAR), _define_property(_obj, CONTROL_TYPE.RICH_TEXT, FieldTypes.TEXT), _define_property(_obj, CONTROL_TYPE.SCORE, FieldTypes.DECIMAL), _define_property(_obj, CONTROL_TYPE.SELECT, FieldTypes.VARCHAR), _define_property(_obj, CONTROL_TYPE.SELECT_MULTIPLE, FieldTypes.ARRAY), _define_property(_obj, CONTROL_TYPE.SELECT_RELATION, FieldTypes.VARCHAR), _define_property(_obj, CONTROL_TYPE.TEXTAREA, FieldTypes.TEXT), _define_property(_obj, CONTROL_TYPE.TREE, FieldTypes.ARRAY), _define_property(_obj, CONTROL_TYPE.SEARCH_DATE_RANGE, FieldTypes.ARRAY), _define_property(_obj, CONTROL_TYPE.SEARCH_INPUT, FieldTypes.VARCHAR), _define_property(_obj, CONTROL_TYPE.SEARCH_NUMBER_RANGE, FieldTypes.ARRAY), _obj);
|
|
33
33
|
if (fieldTypeMap.hasOwnProperty(schema.type)) {
|
|
34
34
|
// @ts-ignore
|
|
35
35
|
setFieldTypeToDataBind(schema.props.data_bind, fieldTypeMap[schema.type]);
|
package/dist/esm/upgrade/v2_8.js
CHANGED
|
@@ -14,7 +14,7 @@ function conversion(schema, payload) {
|
|
|
14
14
|
if (schema.type === CONTROL_TYPE.SIMPLE_SEARCH && schema.children.length) {
|
|
15
15
|
if (!schema.props.query_type_map) schema.props.query_type_map = [];
|
|
16
16
|
schema.children.forEach(function(item) {
|
|
17
|
-
var
|
|
17
|
+
var _item_props_data_bind, _item_props;
|
|
18
18
|
if ([
|
|
19
19
|
FieldTypes.VARCHAR,
|
|
20
20
|
FieldTypes.TEXT,
|
package/dist/esm/upgrade/v3_0.js
CHANGED
|
@@ -26,7 +26,7 @@ function conversion(schema, payload) {
|
|
|
26
26
|
if (schema.type === CONTROL_TYPE.GRID_TABLE) {
|
|
27
27
|
schema.props.headers.map(function(item) {
|
|
28
28
|
if (item.type === CONTROL_TYPE.OPERATION_COLUMN) {
|
|
29
|
-
var _item_props, _item_props1, _item_props2;
|
|
29
|
+
var _item, _item_props, _item_props1, _item_props2;
|
|
30
30
|
if (item.props.width_type === "auto") {
|
|
31
31
|
item.props.auto_width = {
|
|
32
32
|
min_width: 120,
|
|
@@ -42,7 +42,7 @@ function conversion(schema, payload) {
|
|
|
42
42
|
}
|
|
43
43
|
item.props.width_type = "auto";
|
|
44
44
|
var _item_children;
|
|
45
|
-
item.children = (_item_children = item === null ||
|
|
45
|
+
item.children = (_item_children = (_item = item) === null || _item === void 0 ? void 0 : _item.children) !== null && _item_children !== void 0 ? _item_children : [];
|
|
46
46
|
delete item.props.custom;
|
|
47
47
|
if (((_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.check) !== undefined) {
|
|
48
48
|
var _item_props3, _item_props4, _item_props5, _item_props6, _item_props7, _item_props8;
|
|
@@ -60,7 +60,7 @@ function conversion(schema, payload) {
|
|
|
60
60
|
if ((_item_props7 = item.props) === null || _item_props7 === void 0 ? void 0 : _item_props7.check.is_show) {
|
|
61
61
|
item.children.push(optbtn.toSchema());
|
|
62
62
|
}
|
|
63
|
-
(_item_props8 = item.props) === null || _item_props8 === void 0 ?
|
|
63
|
+
(_item_props8 = item.props) === null || _item_props8 === void 0 ? true : delete _item_props8.check;
|
|
64
64
|
}
|
|
65
65
|
if (((_item_props1 = item.props) === null || _item_props1 === void 0 ? void 0 : _item_props1.edit) !== undefined) {
|
|
66
66
|
var _item_props9, _item_props10, _item_props11, _item_props12, _item_props13, _item_props14;
|
|
@@ -78,7 +78,7 @@ function conversion(schema, payload) {
|
|
|
78
78
|
if ((_item_props13 = item.props) === null || _item_props13 === void 0 ? void 0 : _item_props13.edit.is_show) {
|
|
79
79
|
item.children.push(optbtn1.toSchema());
|
|
80
80
|
}
|
|
81
|
-
(_item_props14 = item.props) === null || _item_props14 === void 0 ?
|
|
81
|
+
(_item_props14 = item.props) === null || _item_props14 === void 0 ? true : delete _item_props14.edit;
|
|
82
82
|
}
|
|
83
83
|
if (((_item_props2 = item.props) === null || _item_props2 === void 0 ? void 0 : _item_props2.delete) !== undefined) {
|
|
84
84
|
var _item_props15, _item_props16, _item_props17, _item_props18, _item_props19, _item_props20;
|
|
@@ -98,7 +98,7 @@ function conversion(schema, payload) {
|
|
|
98
98
|
if ((_item_props19 = item.props) === null || _item_props19 === void 0 ? void 0 : _item_props19.delete.is_show) {
|
|
99
99
|
item.children.push(optbtn2.toSchema());
|
|
100
100
|
}
|
|
101
|
-
(_item_props20 = item.props) === null || _item_props20 === void 0 ?
|
|
101
|
+
(_item_props20 = item.props) === null || _item_props20 === void 0 ? true : delete _item_props20.delete;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
});
|