@byteluck-fe/model-driven-engine 2.7.0-alpha.4 → 2.7.0-beta.4
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/common/ActionManager.js +28 -28
- package/dist/esm/common/DataManager.js +12 -12
- package/dist/esm/common/Engine.js +105 -100
- package/dist/esm/common/OkWorker.js +6 -6
- package/dist/esm/common/Plugin.js +2 -2
- package/dist/esm/common/Runtime.js +29 -29
- package/dist/esm/common/Store.js +24 -21
- package/dist/esm/common/checkerValue.js +69 -69
- package/dist/esm/common/proxyState.js +20 -18
- package/dist/esm/plugins/CalcPlugin.js +25 -25
- package/dist/esm/plugins/ControlsEventPlugin.js +17 -17
- package/dist/esm/plugins/ES6ModulePlugin.js +19 -19
- package/dist/esm/plugins/LifecycleEventPlugin.js +26 -26
- package/dist/esm/plugins/StylePlugin.js +7 -7
- package/dist/index.umd.js +9 -10
- package/package.json +4 -4
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _assert_this_initialized(self) {
|
|
2
2
|
if (self === void 0) {
|
|
3
3
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
4
4
|
}
|
|
5
5
|
return self;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function _class_call_check(instance, Constructor) {
|
|
8
8
|
if (!(instance instanceof Constructor)) {
|
|
9
9
|
throw new TypeError("Cannot call a class as a function");
|
|
10
10
|
}
|
|
@@ -18,12 +18,12 @@ function _defineProperties(target, props) {
|
|
|
18
18
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
22
22
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
23
23
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
24
24
|
return Constructor;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function _define_property(obj, key, value) {
|
|
27
27
|
if (key in obj) {
|
|
28
28
|
Object.defineProperty(obj, key, {
|
|
29
29
|
value: value,
|
|
@@ -36,11 +36,11 @@ function _defineProperty(obj, key, value) {
|
|
|
36
36
|
}
|
|
37
37
|
return obj;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
|
|
39
|
+
function _get_prototype_of(o) {
|
|
40
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
41
41
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
42
42
|
};
|
|
43
|
-
return
|
|
43
|
+
return _get_prototype_of(o);
|
|
44
44
|
}
|
|
45
45
|
function _inherits(subClass, superClass) {
|
|
46
46
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -53,26 +53,26 @@ function _inherits(subClass, superClass) {
|
|
|
53
53
|
configurable: true
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
|
-
if (superClass)
|
|
56
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
if (call && (
|
|
58
|
+
function _possible_constructor_return(self, call) {
|
|
59
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
60
60
|
return call;
|
|
61
61
|
}
|
|
62
|
-
return
|
|
62
|
+
return _assert_this_initialized(self);
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
|
|
64
|
+
function _set_prototype_of(o, p) {
|
|
65
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
66
66
|
o.__proto__ = p;
|
|
67
67
|
return o;
|
|
68
68
|
};
|
|
69
|
-
return
|
|
69
|
+
return _set_prototype_of(o, p);
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
function _type_of(obj) {
|
|
72
72
|
"@swc/helpers - typeof";
|
|
73
73
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
74
|
-
}
|
|
75
|
-
function
|
|
74
|
+
}
|
|
75
|
+
function _is_native_reflect_construct() {
|
|
76
76
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
77
77
|
if (Reflect.construct.sham) return false;
|
|
78
78
|
if (typeof Proxy === "function") return true;
|
|
@@ -83,17 +83,17 @@ function _isNativeReflectConstruct() {
|
|
|
83
83
|
return false;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
function
|
|
87
|
-
var hasNativeReflectConstruct =
|
|
86
|
+
function _create_super(Derived) {
|
|
87
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
88
88
|
return function _createSuperInternal() {
|
|
89
|
-
var Super =
|
|
89
|
+
var Super = _get_prototype_of(Derived), result;
|
|
90
90
|
if (hasNativeReflectConstruct) {
|
|
91
|
-
var NewTarget =
|
|
91
|
+
var NewTarget = _get_prototype_of(this).constructor;
|
|
92
92
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
93
93
|
} else {
|
|
94
94
|
result = Super.apply(this, arguments);
|
|
95
95
|
}
|
|
96
|
-
return
|
|
96
|
+
return _possible_constructor_return(this, result);
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
import { RegisterControls } from "@byteluck-fe/model-driven-core";
|
|
@@ -102,22 +102,22 @@ import { hasChildrenControl, loopDataViewControl, loopFormControl } from "../uti
|
|
|
102
102
|
export var Runtime = /*#__PURE__*/ function(RegisterControls) {
|
|
103
103
|
"use strict";
|
|
104
104
|
_inherits(Runtime, RegisterControls);
|
|
105
|
-
var _super =
|
|
105
|
+
var _super = _create_super(Runtime);
|
|
106
106
|
function Runtime(props) {
|
|
107
|
-
|
|
107
|
+
_class_call_check(this, Runtime);
|
|
108
108
|
var _this;
|
|
109
109
|
_this = _super.call(this, "Runtime");
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
_define_property(_assert_this_initialized(_this), "_schema", void 0);
|
|
111
|
+
_define_property(_assert_this_initialized(_this), "_instance", void 0);
|
|
112
|
+
_define_property(_assert_this_initialized(_this), "_flatInstances", []);
|
|
113
|
+
_define_property(_assert_this_initialized(_this), "_instanceMap", {});
|
|
114
114
|
var schema = props.schema;
|
|
115
115
|
_this._schema = schema;
|
|
116
116
|
_this._instance = _this.createControl(schema, props.beforeCreateInstance);
|
|
117
117
|
_this.getFlatInstances();
|
|
118
118
|
return _this;
|
|
119
119
|
}
|
|
120
|
-
|
|
120
|
+
_create_class(Runtime, [
|
|
121
121
|
{
|
|
122
122
|
key: "getFlatInstances",
|
|
123
123
|
value: function getFlatInstances() {
|
package/dist/esm/common/Store.js
CHANGED
|
@@ -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,12 +12,12 @@ 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
|
|
20
|
+
function _define_property(obj, key, value) {
|
|
21
21
|
if (key in obj) {
|
|
22
22
|
Object.defineProperty(obj, key, {
|
|
23
23
|
value: value,
|
|
@@ -37,7 +37,7 @@ function _instanceof(left, right) {
|
|
|
37
37
|
return left instanceof right;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function _object_spread(target) {
|
|
41
41
|
for(var i = 1; i < arguments.length; i++){
|
|
42
42
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
43
43
|
var ownKeys = Object.keys(source);
|
|
@@ -47,7 +47,7 @@ function _objectSpread(target) {
|
|
|
47
47
|
}));
|
|
48
48
|
}
|
|
49
49
|
ownKeys.forEach(function(key) {
|
|
50
|
-
|
|
50
|
+
_define_property(target, key, source[key]);
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
return target;
|
|
@@ -58,13 +58,13 @@ import { loopDataViewControl, loopFormControl, buildUUID } from "../utils/runtim
|
|
|
58
58
|
var Store = /*#__PURE__*/ function() {
|
|
59
59
|
"use strict";
|
|
60
60
|
function Store(props) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
_class_call_check(this, Store);
|
|
62
|
+
_define_property(this, "emptyState", void 0);
|
|
63
|
+
_define_property(this, "state", void 0);
|
|
64
|
+
_define_property(this, "dataBindMapping", void 0 // 主要提供给二开使用
|
|
65
65
|
);
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
_define_property(this, "controlIdMapping", void 0);
|
|
67
|
+
_define_property(this, "defaultState", void 0);
|
|
68
68
|
var _init = init(props.instance), state = _init.state, emptyState = _init.emptyState, databindMapping = _init.databindMapping, controlidMapping = _init.controlidMapping, defaultState = _init.defaultState;
|
|
69
69
|
this.emptyState = emptyState;
|
|
70
70
|
this.state = state;
|
|
@@ -72,7 +72,7 @@ var Store = /*#__PURE__*/ function() {
|
|
|
72
72
|
this.controlIdMapping = controlidMapping;
|
|
73
73
|
this.defaultState = defaultState;
|
|
74
74
|
}
|
|
75
|
-
|
|
75
|
+
_create_class(Store, [
|
|
76
76
|
{
|
|
77
77
|
/**
|
|
78
78
|
* 使用该方法仅改变数据,不会表单触发事件。明细表可全量赋值也可根据rowIndex进行单独设置
|
|
@@ -82,9 +82,10 @@ var Store = /*#__PURE__*/ function() {
|
|
|
82
82
|
value: function setState(controlId, value, rowIndex) {
|
|
83
83
|
var _this = this;
|
|
84
84
|
var controlInfo = this.controlIdMapping[controlId];
|
|
85
|
+
var noProxyValue = JSONCopy(value);
|
|
85
86
|
if (controlInfo !== undefined) {
|
|
86
87
|
//qiyu 按照对象赋值,Object.assign会触发多次key的change事件
|
|
87
|
-
this.state[controlInfo.dataView][controlId] =
|
|
88
|
+
this.state[controlInfo.dataView][controlId] = noProxyValue;
|
|
88
89
|
// if (
|
|
89
90
|
// controlInfo.dataBind instanceof ObjectDataBind &&
|
|
90
91
|
// isPlainObject(value)
|
|
@@ -102,14 +103,16 @@ var Store = /*#__PURE__*/ function() {
|
|
|
102
103
|
if (children !== undefined) {
|
|
103
104
|
Object.keys(children).map(function(childControlId) {
|
|
104
105
|
if (childControlId === controlId) {
|
|
105
|
-
_this.state[dataView][subtableId][rowIndex]
|
|
106
|
+
if (_this.state[dataView][subtableId][rowIndex]) {
|
|
107
|
+
_this.state[dataView][subtableId][rowIndex][controlId] = noProxyValue;
|
|
108
|
+
}
|
|
106
109
|
}
|
|
107
110
|
});
|
|
108
111
|
}
|
|
109
112
|
});
|
|
110
113
|
} else {
|
|
111
114
|
//不存在的 controlId,直接被挂载到外部key
|
|
112
|
-
this.state[controlId] =
|
|
115
|
+
this.state[controlId] = noProxyValue;
|
|
113
116
|
}
|
|
114
117
|
}
|
|
115
118
|
}
|
|
@@ -271,12 +274,12 @@ item) {
|
|
|
271
274
|
loopFormSchema(item.props.headers, function(headerItem) {
|
|
272
275
|
emptyTemplate[headerItem.id] = JSONCopy(headerItem.props.defaultValue);
|
|
273
276
|
});
|
|
274
|
-
var _item_props_defaultRows;
|
|
275
|
-
dataViewState[item.id] = new Array((_item_props_defaultRows = item.props.defaultRows) !== null && _item_props_defaultRows !== void 0 ? _item_props_defaultRows : 1).fill(0).map(function() {
|
|
276
|
-
return
|
|
277
|
+
var _item_props_defaultRows, _fill_map;
|
|
278
|
+
dataViewState[item.id] = (_fill_map = new Array((_item_props_defaultRows = item.props.defaultRows) !== null && _item_props_defaultRows !== void 0 ? _item_props_defaultRows : 1).fill(0).map(function() {
|
|
279
|
+
return _object_spread({
|
|
277
280
|
uid: "new:" + buildUUID("uid")
|
|
278
281
|
}, JSONCopy(emptyTemplate));
|
|
279
|
-
});
|
|
282
|
+
})) !== null && _fill_map !== void 0 ? _fill_map : [];
|
|
280
283
|
emptyDataViewState[item.id] = emptyTemplate;
|
|
281
284
|
}
|
|
282
285
|
}
|
|
@@ -284,7 +287,7 @@ function buildDataBindMapping(data, dataViewId, // @ts-ignore
|
|
|
284
287
|
item) {
|
|
285
288
|
// if (item instanceof RuntimeFormControl) {
|
|
286
289
|
if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
287
|
-
var
|
|
290
|
+
var _item_props_dataBind, _item_props;
|
|
288
291
|
if (_instanceof(item.props.dataBind, ObjectDataBind)) {
|
|
289
292
|
// 特殊的dataBind,比如:金额是currency+amount两个key组成的,日期区间,继承自ObjectDataBind的需要通过Object.keys拿到多个databind
|
|
290
293
|
Object.keys(item.props.dataBind).map(function(key) {
|
|
@@ -390,7 +393,7 @@ item) {
|
|
|
390
393
|
loopFormSchema(item.props.headers, function(formControl) {
|
|
391
394
|
var _data_item_id;
|
|
392
395
|
var _data_item_id_children;
|
|
393
|
-
Object.assign((_data_item_id_children = (_data_item_id = data[item.id]) === null || _data_item_id === void 0 ? void 0 : _data_item_id.children) !== null && _data_item_id_children !== void 0 ? _data_item_id_children : {},
|
|
396
|
+
Object.assign((_data_item_id_children = (_data_item_id = data[item.id]) === null || _data_item_id === void 0 ? void 0 : _data_item_id.children) !== null && _data_item_id_children !== void 0 ? _data_item_id_children : {}, _define_property({}, formControl.id, {
|
|
394
397
|
dataBind: formControl.props.dataBind
|
|
395
398
|
}));
|
|
396
399
|
});
|
|
@@ -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
|
|
9
|
+
function _assert_this_initialized(self) {
|
|
10
10
|
if (self === void 0) {
|
|
11
11
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
12
12
|
}
|
|
13
13
|
return self;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function _class_call_check(instance, Constructor) {
|
|
16
16
|
if (!(instance instanceof Constructor)) {
|
|
17
17
|
throw new TypeError("Cannot call a class as a function");
|
|
18
18
|
}
|
|
@@ -26,12 +26,12 @@ function _defineProperties(target, props) {
|
|
|
26
26
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
30
30
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
31
31
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
32
32
|
return Constructor;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function _define_property(obj, key, value) {
|
|
35
35
|
if (key in obj) {
|
|
36
36
|
Object.defineProperty(obj, key, {
|
|
37
37
|
value: value,
|
|
@@ -44,11 +44,11 @@ function _defineProperty(obj, key, value) {
|
|
|
44
44
|
}
|
|
45
45
|
return obj;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
|
|
47
|
+
function _get_prototype_of(o) {
|
|
48
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
49
49
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
50
50
|
};
|
|
51
|
-
return
|
|
51
|
+
return _get_prototype_of(o);
|
|
52
52
|
}
|
|
53
53
|
function _inherits(subClass, superClass) {
|
|
54
54
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -61,7 +61,7 @@ function _inherits(subClass, superClass) {
|
|
|
61
61
|
configurable: true
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
|
-
if (superClass)
|
|
64
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
65
65
|
}
|
|
66
66
|
function _instanceof(left, right) {
|
|
67
67
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
@@ -70,7 +70,7 @@ function _instanceof(left, right) {
|
|
|
70
70
|
return left instanceof right;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function _iterable_to_array_limit(arr, i) {
|
|
74
74
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
75
75
|
if (_i == null) return;
|
|
76
76
|
var _arr = [];
|
|
@@ -94,10 +94,10 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
94
94
|
}
|
|
95
95
|
return _arr;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function _non_iterable_rest() {
|
|
98
98
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function _object_spread(target) {
|
|
101
101
|
for(var i = 1; i < arguments.length; i++){
|
|
102
102
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
103
103
|
var ownKeys = Object.keys(source);
|
|
@@ -107,40 +107,40 @@ function _objectSpread(target) {
|
|
|
107
107
|
}));
|
|
108
108
|
}
|
|
109
109
|
ownKeys.forEach(function(key) {
|
|
110
|
-
|
|
110
|
+
_define_property(target, key, source[key]);
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
return target;
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
if (call && (
|
|
115
|
+
function _possible_constructor_return(self, call) {
|
|
116
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
117
117
|
return call;
|
|
118
118
|
}
|
|
119
|
-
return
|
|
119
|
+
return _assert_this_initialized(self);
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
|
|
121
|
+
function _set_prototype_of(o, p) {
|
|
122
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
123
123
|
o.__proto__ = p;
|
|
124
124
|
return o;
|
|
125
125
|
};
|
|
126
|
-
return
|
|
126
|
+
return _set_prototype_of(o, p);
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
return
|
|
128
|
+
function _sliced_to_array(arr, i) {
|
|
129
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
function _type_of(obj) {
|
|
132
132
|
"@swc/helpers - typeof";
|
|
133
133
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
134
|
-
}
|
|
135
|
-
function
|
|
134
|
+
}
|
|
135
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
136
136
|
if (!o) return;
|
|
137
|
-
if (typeof o === "string") return
|
|
137
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
138
138
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
139
139
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
140
140
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
141
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
141
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function _is_native_reflect_construct() {
|
|
144
144
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
145
145
|
if (Reflect.construct.sham) return false;
|
|
146
146
|
if (typeof Proxy === "function") return true;
|
|
@@ -151,17 +151,17 @@ function _isNativeReflectConstruct() {
|
|
|
151
151
|
return false;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
function
|
|
155
|
-
var hasNativeReflectConstruct =
|
|
154
|
+
function _create_super(Derived) {
|
|
155
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
156
156
|
return function _createSuperInternal() {
|
|
157
|
-
var Super =
|
|
157
|
+
var Super = _get_prototype_of(Derived), result;
|
|
158
158
|
if (hasNativeReflectConstruct) {
|
|
159
|
-
var NewTarget =
|
|
159
|
+
var NewTarget = _get_prototype_of(this).constructor;
|
|
160
160
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
161
161
|
} else {
|
|
162
162
|
result = Super.apply(this, arguments);
|
|
163
163
|
}
|
|
164
|
-
return
|
|
164
|
+
return _possible_constructor_return(this, result);
|
|
165
165
|
};
|
|
166
166
|
}
|
|
167
167
|
import { isArray, isFunction, isString, isJSONArray, isJSONObject, isNumber, isNumberAndEmptyStringArray, isPlainObject, isStringArray, FieldTypes, isObject } from "@byteluck-fe/model-driven-shared";
|
|
@@ -169,17 +169,17 @@ import { AddressValue, AmountValue, CalcValue, RangeDateValue } from "@byteluck-
|
|
|
169
169
|
import { camelizeKeys } from "humps";
|
|
170
170
|
var ValueChecker = function ValueChecker() {
|
|
171
171
|
"use strict";
|
|
172
|
-
|
|
172
|
+
_class_call_check(this, ValueChecker);
|
|
173
173
|
};
|
|
174
174
|
var StringValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
175
175
|
"use strict";
|
|
176
176
|
_inherits(StringValueChecker, ValueChecker);
|
|
177
|
-
var _super =
|
|
177
|
+
var _super = _create_super(StringValueChecker);
|
|
178
178
|
function StringValueChecker() {
|
|
179
|
-
|
|
179
|
+
_class_call_check(this, StringValueChecker);
|
|
180
180
|
return _super.apply(this, arguments);
|
|
181
181
|
}
|
|
182
|
-
|
|
182
|
+
_create_class(StringValueChecker, [
|
|
183
183
|
{
|
|
184
184
|
key: "validate",
|
|
185
185
|
value: function validate(value) {
|
|
@@ -207,12 +207,12 @@ var StringValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
207
207
|
var NumberValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
208
208
|
"use strict";
|
|
209
209
|
_inherits(NumberValueChecker, ValueChecker);
|
|
210
|
-
var _super =
|
|
210
|
+
var _super = _create_super(NumberValueChecker);
|
|
211
211
|
function NumberValueChecker() {
|
|
212
|
-
|
|
212
|
+
_class_call_check(this, NumberValueChecker);
|
|
213
213
|
return _super.apply(this, arguments);
|
|
214
214
|
}
|
|
215
|
-
|
|
215
|
+
_create_class(NumberValueChecker, [
|
|
216
216
|
{
|
|
217
217
|
// 数字类型允许是空字符串,用于置空数据
|
|
218
218
|
key: "validate",
|
|
@@ -239,12 +239,12 @@ var NumberValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
239
239
|
var StringArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
240
240
|
"use strict";
|
|
241
241
|
_inherits(StringArrayValueChecker, ValueChecker);
|
|
242
|
-
var _super =
|
|
242
|
+
var _super = _create_super(StringArrayValueChecker);
|
|
243
243
|
function StringArrayValueChecker() {
|
|
244
|
-
|
|
244
|
+
_class_call_check(this, StringArrayValueChecker);
|
|
245
245
|
return _super.apply(this, arguments);
|
|
246
246
|
}
|
|
247
|
-
|
|
247
|
+
_create_class(StringArrayValueChecker, [
|
|
248
248
|
{
|
|
249
249
|
key: "validate",
|
|
250
250
|
value: function validate(value) {
|
|
@@ -284,12 +284,12 @@ var StringArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
284
284
|
var NumberArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
285
285
|
"use strict";
|
|
286
286
|
_inherits(NumberArrayValueChecker, ValueChecker);
|
|
287
|
-
var _super =
|
|
287
|
+
var _super = _create_super(NumberArrayValueChecker);
|
|
288
288
|
function NumberArrayValueChecker() {
|
|
289
|
-
|
|
289
|
+
_class_call_check(this, NumberArrayValueChecker);
|
|
290
290
|
return _super.apply(this, arguments);
|
|
291
291
|
}
|
|
292
|
-
|
|
292
|
+
_create_class(NumberArrayValueChecker, [
|
|
293
293
|
{
|
|
294
294
|
key: "validate",
|
|
295
295
|
value: function validate(value) {
|
|
@@ -335,12 +335,12 @@ var NumberArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
335
335
|
var MoneyValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
336
336
|
"use strict";
|
|
337
337
|
_inherits(MoneyValueChecker, ValueChecker);
|
|
338
|
-
var _super =
|
|
338
|
+
var _super = _create_super(MoneyValueChecker);
|
|
339
339
|
function MoneyValueChecker() {
|
|
340
|
-
|
|
340
|
+
_class_call_check(this, MoneyValueChecker);
|
|
341
341
|
return _super.apply(this, arguments);
|
|
342
342
|
}
|
|
343
|
-
|
|
343
|
+
_create_class(MoneyValueChecker, [
|
|
344
344
|
{
|
|
345
345
|
key: "validate",
|
|
346
346
|
value: function validate(value) {
|
|
@@ -357,12 +357,12 @@ var MoneyValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
357
357
|
}
|
|
358
358
|
var result;
|
|
359
359
|
if (isPlainObject(value)) {
|
|
360
|
-
result = new AmountValue(
|
|
360
|
+
result = new AmountValue(_object_spread({}, oldValue, value));
|
|
361
361
|
}
|
|
362
362
|
if (isString(value) && isJSONObject(value)) {
|
|
363
363
|
try {
|
|
364
364
|
var newValue = JSON.parse(value);
|
|
365
|
-
result = new AmountValue(
|
|
365
|
+
result = new AmountValue(_object_spread({}, oldValue, newValue));
|
|
366
366
|
} catch (e) {}
|
|
367
367
|
}
|
|
368
368
|
if (result) {
|
|
@@ -385,12 +385,12 @@ var MoneyValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
385
385
|
var TimeScopeValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
386
386
|
"use strict";
|
|
387
387
|
_inherits(TimeScopeValueChecker, ValueChecker);
|
|
388
|
-
var _super =
|
|
388
|
+
var _super = _create_super(TimeScopeValueChecker);
|
|
389
389
|
function TimeScopeValueChecker() {
|
|
390
|
-
|
|
390
|
+
_class_call_check(this, TimeScopeValueChecker);
|
|
391
391
|
return _super.apply(this, arguments);
|
|
392
392
|
}
|
|
393
|
-
|
|
393
|
+
_create_class(TimeScopeValueChecker, [
|
|
394
394
|
{
|
|
395
395
|
key: "validate",
|
|
396
396
|
value: function validate(value) {
|
|
@@ -405,12 +405,12 @@ var TimeScopeValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
405
405
|
}
|
|
406
406
|
var result;
|
|
407
407
|
if (isPlainObject(value)) {
|
|
408
|
-
result = new RangeDateValue(
|
|
408
|
+
result = new RangeDateValue(_object_spread({}, oldValue, value));
|
|
409
409
|
}
|
|
410
410
|
if (isString(value) && isJSONObject(value)) {
|
|
411
411
|
try {
|
|
412
412
|
var newValue = JSON.parse(value);
|
|
413
|
-
result = new RangeDateValue(
|
|
413
|
+
result = new RangeDateValue(_object_spread({}, oldValue, newValue));
|
|
414
414
|
} catch (e) {}
|
|
415
415
|
}
|
|
416
416
|
if (result) {
|
|
@@ -432,12 +432,12 @@ var TimeScopeValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
432
432
|
var CalcValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
433
433
|
"use strict";
|
|
434
434
|
_inherits(CalcValueChecker, ValueChecker);
|
|
435
|
-
var _super =
|
|
435
|
+
var _super = _create_super(CalcValueChecker);
|
|
436
436
|
function CalcValueChecker() {
|
|
437
|
-
|
|
437
|
+
_class_call_check(this, CalcValueChecker);
|
|
438
438
|
return _super.apply(this, arguments);
|
|
439
439
|
}
|
|
440
|
-
|
|
440
|
+
_create_class(CalcValueChecker, [
|
|
441
441
|
{
|
|
442
442
|
key: "validate",
|
|
443
443
|
value: function validate(value) {
|
|
@@ -454,12 +454,12 @@ var CalcValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
454
454
|
}
|
|
455
455
|
var result;
|
|
456
456
|
if (isPlainObject(value)) {
|
|
457
|
-
result = new CalcValue(
|
|
457
|
+
result = new CalcValue(_object_spread({}, oldValue, value));
|
|
458
458
|
}
|
|
459
459
|
if (isString(value) && isJSONObject(value)) {
|
|
460
460
|
try {
|
|
461
461
|
var newValue = JSON.parse(value);
|
|
462
|
-
result = new CalcValue(
|
|
462
|
+
result = new CalcValue(_object_spread({}, oldValue, newValue));
|
|
463
463
|
} catch (e) {}
|
|
464
464
|
}
|
|
465
465
|
if (result) {
|
|
@@ -482,12 +482,12 @@ var CalcValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
482
482
|
var AddressValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
483
483
|
"use strict";
|
|
484
484
|
_inherits(AddressValueChecker, ValueChecker);
|
|
485
|
-
var _super =
|
|
485
|
+
var _super = _create_super(AddressValueChecker);
|
|
486
486
|
function AddressValueChecker() {
|
|
487
|
-
|
|
487
|
+
_class_call_check(this, AddressValueChecker);
|
|
488
488
|
return _super.apply(this, arguments);
|
|
489
489
|
}
|
|
490
|
-
|
|
490
|
+
_create_class(AddressValueChecker, [
|
|
491
491
|
{
|
|
492
492
|
key: "validate",
|
|
493
493
|
value: function validate(value) {
|
|
@@ -502,12 +502,12 @@ var AddressValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
502
502
|
}
|
|
503
503
|
var result;
|
|
504
504
|
if (isPlainObject(value)) {
|
|
505
|
-
result = new AddressValue(
|
|
505
|
+
result = new AddressValue(_object_spread({}, oldValue, camelizeKeys(value)));
|
|
506
506
|
}
|
|
507
507
|
if (isString(value) && isJSONObject(value)) {
|
|
508
508
|
try {
|
|
509
509
|
var newValue = JSON.parse(value);
|
|
510
|
-
result = new AddressValue(
|
|
510
|
+
result = new AddressValue(_object_spread({}, oldValue, camelizeKeys(newValue)));
|
|
511
511
|
} catch (e) {}
|
|
512
512
|
}
|
|
513
513
|
if (result) {
|
|
@@ -532,9 +532,9 @@ var AddressValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
532
532
|
var ValueCheckerFactory = /*#__PURE__*/ function() {
|
|
533
533
|
"use strict";
|
|
534
534
|
function ValueCheckerFactory() {
|
|
535
|
-
|
|
535
|
+
_class_call_check(this, ValueCheckerFactory);
|
|
536
536
|
}
|
|
537
|
-
|
|
537
|
+
_create_class(ValueCheckerFactory, null, [
|
|
538
538
|
{
|
|
539
539
|
key: "getValueChecker",
|
|
540
540
|
value: function getValueChecker(fieldType) {
|
|
@@ -614,7 +614,7 @@ export function checkerValue(fieldType, key, value, oldValue) {
|
|
|
614
614
|
}
|
|
615
615
|
export function checkerSubtableValue(fieldTypeMap, value, emptyValue) {
|
|
616
616
|
return Object.entries(fieldTypeMap).reduce(function(result, param) {
|
|
617
|
-
var _param =
|
|
617
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], fieldType = _param[1];
|
|
618
618
|
var nowValue = value[key];
|
|
619
619
|
result[key] = checkerValue(fieldType, key, nowValue, emptyValue[key]);
|
|
620
620
|
return result;
|