@byteluck-fe/model-driven-engine 2.7.0-alpha.20 → 2.7.0-alpha.22
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 +113 -108
- 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 +17 -16
- package/dist/esm/common/checkerValue.js +73 -71
- package/dist/esm/common/proxyState.js +20 -17
- package/dist/esm/plugins/CalcPlugin.js +28 -27
- package/dist/esm/plugins/ControlsEventPlugin.js +16 -16
- 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/esm/utils/runtimeUtils.js +4 -2
- package/dist/index.umd.js +9 -9
- package/package.json +2 -2
|
@@ -1,10 +1,10 @@
|
|
|
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
|
}
|
|
5
5
|
}
|
|
6
6
|
var Plugin = function Plugin() {
|
|
7
7
|
"use strict";
|
|
8
|
-
|
|
8
|
+
_class_call_check(this, Plugin);
|
|
9
9
|
};
|
|
10
10
|
export { Plugin };
|
|
@@ -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,
|
|
@@ -30,7 +30,7 @@ function _defineProperty(obj, key, value) {
|
|
|
30
30
|
}
|
|
31
31
|
return obj;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function _object_spread(target) {
|
|
34
34
|
for(var i = 1; i < arguments.length; i++){
|
|
35
35
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
36
36
|
var ownKeys = Object.keys(source);
|
|
@@ -40,7 +40,7 @@ function _objectSpread(target) {
|
|
|
40
40
|
}));
|
|
41
41
|
}
|
|
42
42
|
ownKeys.forEach(function(key) {
|
|
43
|
-
|
|
43
|
+
_define_property(target, key, source[key]);
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
return target;
|
|
@@ -51,13 +51,13 @@ import { loopDataViewControl, loopFormControl, buildUUID } from "../utils/runtim
|
|
|
51
51
|
var Store = /*#__PURE__*/ function() {
|
|
52
52
|
"use strict";
|
|
53
53
|
function Store(props) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
_class_call_check(this, Store);
|
|
55
|
+
_define_property(this, "emptyState", void 0);
|
|
56
|
+
_define_property(this, "state", void 0);
|
|
57
|
+
_define_property(this, "dataBindMapping", void 0 // 主要提供给二开使用
|
|
58
58
|
);
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
_define_property(this, "controlIdMapping", void 0);
|
|
60
|
+
_define_property(this, "defaultState", void 0);
|
|
61
61
|
var _init = init(props.instance), state = _init.state, emptyState = _init.emptyState, databindMapping = _init.databindMapping, controlidMapping = _init.controlidMapping, defaultState = _init.defaultState;
|
|
62
62
|
this.emptyState = emptyState;
|
|
63
63
|
this.state = state;
|
|
@@ -65,7 +65,7 @@ var Store = /*#__PURE__*/ function() {
|
|
|
65
65
|
this.controlIdMapping = controlidMapping;
|
|
66
66
|
this.defaultState = defaultState;
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
_create_class(Store, [
|
|
69
69
|
{
|
|
70
70
|
/**
|
|
71
71
|
* 使用该方法仅改变数据,不会表单触发事件。明细表可全量赋值也可根据rowIndex进行单独设置
|
|
@@ -200,6 +200,7 @@ var Store = /*#__PURE__*/ function() {
|
|
|
200
200
|
{
|
|
201
201
|
key: "getDataBind",
|
|
202
202
|
value: function getDataBind(controlId) {
|
|
203
|
+
var _result;
|
|
203
204
|
var result = this.controlIdMapping[controlId];
|
|
204
205
|
if (result) {
|
|
205
206
|
return result.dataBind;
|
|
@@ -215,7 +216,7 @@ var Store = /*#__PURE__*/ function() {
|
|
|
215
216
|
}
|
|
216
217
|
}
|
|
217
218
|
}
|
|
218
|
-
return result === null ||
|
|
219
|
+
return (_result = result) === null || _result === void 0 ? void 0 : _result.dataBind;
|
|
219
220
|
}
|
|
220
221
|
}
|
|
221
222
|
]);
|
|
@@ -268,7 +269,7 @@ item) {
|
|
|
268
269
|
});
|
|
269
270
|
var _item_props_defaultRows, _fill_map;
|
|
270
271
|
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() {
|
|
271
|
-
return
|
|
272
|
+
return _object_spread({
|
|
272
273
|
uid: "new:" + buildUUID("uid")
|
|
273
274
|
}, JSONCopy(emptyTemplate));
|
|
274
275
|
})) !== null && _fill_map !== void 0 ? _fill_map : [];
|
|
@@ -279,7 +280,7 @@ function buildDataBindMapping(data, dataViewId, // @ts-ignore
|
|
|
279
280
|
item) {
|
|
280
281
|
// if (item instanceof RuntimeFormControl) {
|
|
281
282
|
if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
282
|
-
var
|
|
283
|
+
var _item_props_dataBind, _item_props;
|
|
283
284
|
// if (item.props.dataBind instanceof ObjectDataBind) {
|
|
284
285
|
if (!isDataBind(item.props.dataBind)) {
|
|
285
286
|
// 特殊的dataBind,比如:金额是currency+amount两个key组成的,日期区间,继承自ObjectDataBind的需要通过Object.keys拿到多个databind
|
|
@@ -387,7 +388,7 @@ item) {
|
|
|
387
388
|
loopFormSchema(item.props.headers, function(formControl) {
|
|
388
389
|
var _data_item_id;
|
|
389
390
|
var _data_item_id_children;
|
|
390
|
-
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 : {},
|
|
391
|
+
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, {
|
|
391
392
|
dataBind: formControl.props.dataBind
|
|
392
393
|
}));
|
|
393
394
|
});
|
|
@@ -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,9 +61,9 @@ 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
|
-
function
|
|
66
|
+
function _iterable_to_array_limit(arr, i) {
|
|
67
67
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
68
68
|
if (_i == null) return;
|
|
69
69
|
var _arr = [];
|
|
@@ -87,10 +87,10 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
87
87
|
}
|
|
88
88
|
return _arr;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function _non_iterable_rest() {
|
|
91
91
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function _object_spread(target) {
|
|
94
94
|
for(var i = 1; i < arguments.length; i++){
|
|
95
95
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
96
96
|
var ownKeys = Object.keys(source);
|
|
@@ -100,40 +100,40 @@ function _objectSpread(target) {
|
|
|
100
100
|
}));
|
|
101
101
|
}
|
|
102
102
|
ownKeys.forEach(function(key) {
|
|
103
|
-
|
|
103
|
+
_define_property(target, key, source[key]);
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
return target;
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
if (call && (
|
|
108
|
+
function _possible_constructor_return(self, call) {
|
|
109
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
110
110
|
return call;
|
|
111
111
|
}
|
|
112
|
-
return
|
|
112
|
+
return _assert_this_initialized(self);
|
|
113
113
|
}
|
|
114
|
-
function
|
|
115
|
-
|
|
114
|
+
function _set_prototype_of(o, p) {
|
|
115
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
116
116
|
o.__proto__ = p;
|
|
117
117
|
return o;
|
|
118
118
|
};
|
|
119
|
-
return
|
|
119
|
+
return _set_prototype_of(o, p);
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
return
|
|
121
|
+
function _sliced_to_array(arr, i) {
|
|
122
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
123
123
|
}
|
|
124
|
-
|
|
124
|
+
function _type_of(obj) {
|
|
125
125
|
"@swc/helpers - typeof";
|
|
126
126
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
127
|
-
}
|
|
128
|
-
function
|
|
127
|
+
}
|
|
128
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
129
129
|
if (!o) return;
|
|
130
|
-
if (typeof o === "string") return
|
|
130
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
131
131
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
132
132
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
133
133
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
134
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
134
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
135
135
|
}
|
|
136
|
-
function
|
|
136
|
+
function _is_native_reflect_construct() {
|
|
137
137
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
138
138
|
if (Reflect.construct.sham) return false;
|
|
139
139
|
if (typeof Proxy === "function") return true;
|
|
@@ -144,17 +144,17 @@ function _isNativeReflectConstruct() {
|
|
|
144
144
|
return false;
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
var hasNativeReflectConstruct =
|
|
147
|
+
function _create_super(Derived) {
|
|
148
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
149
149
|
return function _createSuperInternal() {
|
|
150
|
-
var Super =
|
|
150
|
+
var Super = _get_prototype_of(Derived), result;
|
|
151
151
|
if (hasNativeReflectConstruct) {
|
|
152
|
-
var NewTarget =
|
|
152
|
+
var NewTarget = _get_prototype_of(this).constructor;
|
|
153
153
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
154
154
|
} else {
|
|
155
155
|
result = Super.apply(this, arguments);
|
|
156
156
|
}
|
|
157
|
-
return
|
|
157
|
+
return _possible_constructor_return(this, result);
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
160
|
import { isArray, isFunction, isString, isJSONArray, isJSONObject, isNumber, isNumberAndEmptyStringArray, isPlainObject, isStringArray, FieldTypes, isObject } from "@byteluck-fe/model-driven-shared";
|
|
@@ -162,17 +162,17 @@ import { AddressValue, AmountValue, CalcValue, RangeDateValue } from "@byteluck-
|
|
|
162
162
|
import { camelizeKeys } from "humps";
|
|
163
163
|
var ValueChecker = function ValueChecker() {
|
|
164
164
|
"use strict";
|
|
165
|
-
|
|
165
|
+
_class_call_check(this, ValueChecker);
|
|
166
166
|
};
|
|
167
167
|
var StringValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
168
168
|
"use strict";
|
|
169
169
|
_inherits(StringValueChecker, ValueChecker);
|
|
170
|
-
var _super =
|
|
170
|
+
var _super = _create_super(StringValueChecker);
|
|
171
171
|
function StringValueChecker() {
|
|
172
|
-
|
|
172
|
+
_class_call_check(this, StringValueChecker);
|
|
173
173
|
return _super.apply(this, arguments);
|
|
174
174
|
}
|
|
175
|
-
|
|
175
|
+
_create_class(StringValueChecker, [
|
|
176
176
|
{
|
|
177
177
|
key: "validate",
|
|
178
178
|
value: function validate(value) {
|
|
@@ -200,12 +200,12 @@ var StringValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
200
200
|
var NumberValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
201
201
|
"use strict";
|
|
202
202
|
_inherits(NumberValueChecker, ValueChecker);
|
|
203
|
-
var _super =
|
|
203
|
+
var _super = _create_super(NumberValueChecker);
|
|
204
204
|
function NumberValueChecker() {
|
|
205
|
-
|
|
205
|
+
_class_call_check(this, NumberValueChecker);
|
|
206
206
|
return _super.apply(this, arguments);
|
|
207
207
|
}
|
|
208
|
-
|
|
208
|
+
_create_class(NumberValueChecker, [
|
|
209
209
|
{
|
|
210
210
|
// 数字类型允许是空字符串,用于置空数据
|
|
211
211
|
key: "validate",
|
|
@@ -232,12 +232,12 @@ var NumberValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
232
232
|
var StringArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
233
233
|
"use strict";
|
|
234
234
|
_inherits(StringArrayValueChecker, ValueChecker);
|
|
235
|
-
var _super =
|
|
235
|
+
var _super = _create_super(StringArrayValueChecker);
|
|
236
236
|
function StringArrayValueChecker() {
|
|
237
|
-
|
|
237
|
+
_class_call_check(this, StringArrayValueChecker);
|
|
238
238
|
return _super.apply(this, arguments);
|
|
239
239
|
}
|
|
240
|
-
|
|
240
|
+
_create_class(StringArrayValueChecker, [
|
|
241
241
|
{
|
|
242
242
|
key: "validate",
|
|
243
243
|
value: function validate(value) {
|
|
@@ -277,12 +277,12 @@ var StringArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
277
277
|
var NumberArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
278
278
|
"use strict";
|
|
279
279
|
_inherits(NumberArrayValueChecker, ValueChecker);
|
|
280
|
-
var _super =
|
|
280
|
+
var _super = _create_super(NumberArrayValueChecker);
|
|
281
281
|
function NumberArrayValueChecker() {
|
|
282
|
-
|
|
282
|
+
_class_call_check(this, NumberArrayValueChecker);
|
|
283
283
|
return _super.apply(this, arguments);
|
|
284
284
|
}
|
|
285
|
-
|
|
285
|
+
_create_class(NumberArrayValueChecker, [
|
|
286
286
|
{
|
|
287
287
|
key: "validate",
|
|
288
288
|
value: function validate(value) {
|
|
@@ -328,12 +328,12 @@ var NumberArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
328
328
|
var MoneyValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
329
329
|
"use strict";
|
|
330
330
|
_inherits(MoneyValueChecker, ValueChecker);
|
|
331
|
-
var _super =
|
|
331
|
+
var _super = _create_super(MoneyValueChecker);
|
|
332
332
|
function MoneyValueChecker() {
|
|
333
|
-
|
|
333
|
+
_class_call_check(this, MoneyValueChecker);
|
|
334
334
|
return _super.apply(this, arguments);
|
|
335
335
|
}
|
|
336
|
-
|
|
336
|
+
_create_class(MoneyValueChecker, [
|
|
337
337
|
{
|
|
338
338
|
key: "validate",
|
|
339
339
|
value: function validate(value) {
|
|
@@ -345,18 +345,19 @@ var MoneyValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
345
345
|
key: "transform",
|
|
346
346
|
value: function transform(value, oldValue) {
|
|
347
347
|
if (value === undefined || value === null || value === "") {
|
|
348
|
+
var _oldValue;
|
|
348
349
|
return new AmountValue({
|
|
349
|
-
currency: oldValue === null ||
|
|
350
|
+
currency: (_oldValue = oldValue) === null || _oldValue === void 0 ? void 0 : _oldValue.currency
|
|
350
351
|
});
|
|
351
352
|
}
|
|
352
353
|
var result;
|
|
353
354
|
if (isPlainObject(value)) {
|
|
354
|
-
result = new AmountValue(
|
|
355
|
+
result = new AmountValue(_object_spread({}, oldValue, value));
|
|
355
356
|
}
|
|
356
357
|
if (isString(value) && isJSONObject(value)) {
|
|
357
358
|
try {
|
|
358
359
|
var newValue = JSON.parse(value);
|
|
359
|
-
result = new AmountValue(
|
|
360
|
+
result = new AmountValue(_object_spread({}, oldValue, newValue));
|
|
360
361
|
} catch (e) {}
|
|
361
362
|
}
|
|
362
363
|
if (result) {
|
|
@@ -379,12 +380,12 @@ var MoneyValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
379
380
|
var TimeScopeValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
380
381
|
"use strict";
|
|
381
382
|
_inherits(TimeScopeValueChecker, ValueChecker);
|
|
382
|
-
var _super =
|
|
383
|
+
var _super = _create_super(TimeScopeValueChecker);
|
|
383
384
|
function TimeScopeValueChecker() {
|
|
384
|
-
|
|
385
|
+
_class_call_check(this, TimeScopeValueChecker);
|
|
385
386
|
return _super.apply(this, arguments);
|
|
386
387
|
}
|
|
387
|
-
|
|
388
|
+
_create_class(TimeScopeValueChecker, [
|
|
388
389
|
{
|
|
389
390
|
key: "validate",
|
|
390
391
|
value: function validate(value) {
|
|
@@ -400,12 +401,12 @@ var TimeScopeValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
400
401
|
}
|
|
401
402
|
var result;
|
|
402
403
|
if (isPlainObject(value)) {
|
|
403
|
-
result = new RangeDateValue(
|
|
404
|
+
result = new RangeDateValue(_object_spread({}, oldValue, value));
|
|
404
405
|
}
|
|
405
406
|
if (isString(value) && isJSONObject(value)) {
|
|
406
407
|
try {
|
|
407
408
|
var newValue = JSON.parse(value);
|
|
408
|
-
result = new RangeDateValue(
|
|
409
|
+
result = new RangeDateValue(_object_spread({}, oldValue, newValue));
|
|
409
410
|
} catch (e) {}
|
|
410
411
|
}
|
|
411
412
|
if (result) {
|
|
@@ -427,12 +428,12 @@ var TimeScopeValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
427
428
|
var CalcValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
428
429
|
"use strict";
|
|
429
430
|
_inherits(CalcValueChecker, ValueChecker);
|
|
430
|
-
var _super =
|
|
431
|
+
var _super = _create_super(CalcValueChecker);
|
|
431
432
|
function CalcValueChecker() {
|
|
432
|
-
|
|
433
|
+
_class_call_check(this, CalcValueChecker);
|
|
433
434
|
return _super.apply(this, arguments);
|
|
434
435
|
}
|
|
435
|
-
|
|
436
|
+
_create_class(CalcValueChecker, [
|
|
436
437
|
{
|
|
437
438
|
key: "validate",
|
|
438
439
|
value: function validate(value) {
|
|
@@ -444,18 +445,19 @@ var CalcValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
444
445
|
key: "transform",
|
|
445
446
|
value: function transform(value, oldValue) {
|
|
446
447
|
if (value === undefined || value === null || value === "") {
|
|
448
|
+
var _oldValue;
|
|
447
449
|
return new CalcValue({
|
|
448
|
-
unit: oldValue === null ||
|
|
450
|
+
unit: (_oldValue = oldValue) === null || _oldValue === void 0 ? void 0 : _oldValue.unit
|
|
449
451
|
});
|
|
450
452
|
}
|
|
451
453
|
var result;
|
|
452
454
|
if (isPlainObject(value)) {
|
|
453
|
-
result = new CalcValue(
|
|
455
|
+
result = new CalcValue(_object_spread({}, oldValue, value));
|
|
454
456
|
}
|
|
455
457
|
if (isString(value) && isJSONObject(value)) {
|
|
456
458
|
try {
|
|
457
459
|
var newValue = JSON.parse(value);
|
|
458
|
-
result = new CalcValue(
|
|
460
|
+
result = new CalcValue(_object_spread({}, oldValue, newValue));
|
|
459
461
|
} catch (e) {}
|
|
460
462
|
}
|
|
461
463
|
if (result) {
|
|
@@ -478,12 +480,12 @@ var CalcValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
478
480
|
var AddressValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
479
481
|
"use strict";
|
|
480
482
|
_inherits(AddressValueChecker, ValueChecker);
|
|
481
|
-
var _super =
|
|
483
|
+
var _super = _create_super(AddressValueChecker);
|
|
482
484
|
function AddressValueChecker() {
|
|
483
|
-
|
|
485
|
+
_class_call_check(this, AddressValueChecker);
|
|
484
486
|
return _super.apply(this, arguments);
|
|
485
487
|
}
|
|
486
|
-
|
|
488
|
+
_create_class(AddressValueChecker, [
|
|
487
489
|
{
|
|
488
490
|
key: "validate",
|
|
489
491
|
value: function validate(value) {
|
|
@@ -509,12 +511,12 @@ var AddressValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
509
511
|
}
|
|
510
512
|
var result;
|
|
511
513
|
if (isPlainObject(value)) {
|
|
512
|
-
result = new AddressValue(
|
|
514
|
+
result = new AddressValue(_object_spread({}, oldValue, camelizeKeys(value)));
|
|
513
515
|
}
|
|
514
516
|
if (isString(value) && isJSONObject(value)) {
|
|
515
517
|
try {
|
|
516
518
|
var newValue = JSON.parse(value);
|
|
517
|
-
result = new AddressValue(
|
|
519
|
+
result = new AddressValue(_object_spread({}, oldValue, camelizeKeys(newValue)));
|
|
518
520
|
} catch (e) {}
|
|
519
521
|
}
|
|
520
522
|
if (result) {
|
|
@@ -539,9 +541,9 @@ var AddressValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
539
541
|
var ValueCheckerFactory = /*#__PURE__*/ function() {
|
|
540
542
|
"use strict";
|
|
541
543
|
function ValueCheckerFactory() {
|
|
542
|
-
|
|
544
|
+
_class_call_check(this, ValueCheckerFactory);
|
|
543
545
|
}
|
|
544
|
-
|
|
546
|
+
_create_class(ValueCheckerFactory, null, [
|
|
545
547
|
{
|
|
546
548
|
key: "getValueChecker",
|
|
547
549
|
value: function getValueChecker(fieldType) {
|
|
@@ -621,7 +623,7 @@ export function checkerValue(fieldType, key, value, oldValue) {
|
|
|
621
623
|
}
|
|
622
624
|
export function checkerSubtableValue(fieldTypeMap, value, emptyValue) {
|
|
623
625
|
return Object.entries(fieldTypeMap).reduce(function(result, param) {
|
|
624
|
-
var _param =
|
|
626
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], fieldType = _param[1];
|
|
625
627
|
var nowValue = value[key];
|
|
626
628
|
result[key] = checkerValue(fieldType, key, nowValue, emptyValue[key]);
|
|
627
629
|
return result;
|