@byteluck-fe/model-driven-engine 2.7.0-alpha.25 → 2.7.0-alpha.27
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 +17 -16
- 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 +3 -3
|
@@ -1,27 +1,27 @@
|
|
|
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
|
|
7
|
-
if (Array.isArray(arr)) return
|
|
6
|
+
function _array_without_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function _iterable_to_array(iter) {
|
|
10
10
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function _non_iterable_spread() {
|
|
13
13
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
return
|
|
15
|
+
function _to_consumable_array(arr) {
|
|
16
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
19
19
|
if (!o) return;
|
|
20
|
-
if (typeof o === "string") return
|
|
20
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
21
21
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
22
22
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
23
23
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
24
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
24
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
25
25
|
}
|
|
26
26
|
var cc = console;
|
|
27
27
|
import { CONTROL_BASE_TYPE, error, logerror } from "@byteluck-fe/model-driven-shared";
|
|
@@ -207,7 +207,7 @@ function flatInstanceForChildren(controls) {
|
|
|
207
207
|
result.push(item);
|
|
208
208
|
if (item.controlType === "layout" || item.controlType === "wrap") {
|
|
209
209
|
var _result;
|
|
210
|
-
(_result = result).push.apply(_result,
|
|
210
|
+
(_result = result).push.apply(_result, _to_consumable_array(flatInstanceForChildren(item.children)));
|
|
211
211
|
}
|
|
212
212
|
});
|
|
213
213
|
return result;
|
|
@@ -237,17 +237,18 @@ function flatInstanceForChildren(controls) {
|
|
|
237
237
|
var index = Number(key);
|
|
238
238
|
var isNotIndex = Number.isNaN(index);
|
|
239
239
|
if (isNotIndex && prevItem) {
|
|
240
|
-
var
|
|
241
|
-
var
|
|
240
|
+
var _prevItem, _flatChildren;
|
|
241
|
+
var flatChildren = ((_prevItem = prevItem) === null || _prevItem === void 0 ? void 0 : _prevItem.children) ? flatInstanceForChildren(prevItem.children) : undefined;
|
|
242
|
+
var findEndItem = (_flatChildren = flatChildren) === null || _flatChildren === void 0 ? void 0 : _flatChildren.find(function(item) {
|
|
242
243
|
return item.id === key;
|
|
243
244
|
});
|
|
244
245
|
// 最后一个key可能是值对象上边的key,比如金额的amount和currency,计算公式的result和unit,所以需要判断前一个控件是不是一个表单控件,是的话就返回最后一个表单控件
|
|
245
246
|
return findEndItem ? findEndItem : prevItem.controlType === CONTROL_BASE_TYPE.FORM ? prevItem : undefined;
|
|
246
247
|
} else {
|
|
247
|
-
var _prevItem_children;
|
|
248
|
+
var _prevItem_children, _prevItem1;
|
|
248
249
|
var _prevItem_children_index;
|
|
249
250
|
// 如果有children,则取children中对应的下标,没有的话一直返回prevItem
|
|
250
|
-
return (_prevItem_children_index = prevItem === null ||
|
|
251
|
+
return (_prevItem_children_index = (_prevItem1 = prevItem) === null || _prevItem1 === void 0 ? void 0 : (_prevItem_children = _prevItem1.children) === null || _prevItem_children === void 0 ? void 0 : _prevItem_children[index]) !== null && _prevItem_children_index !== void 0 ? _prevItem_children_index : prevItem;
|
|
251
252
|
}
|
|
252
253
|
}, initInstance);
|
|
253
254
|
}
|
|
@@ -287,7 +288,7 @@ function getArrayNewArgs(type, args, value) {
|
|
|
287
288
|
var result;
|
|
288
289
|
var addValue = getArrayNewValue(key, args);
|
|
289
290
|
if (addValue.length) {
|
|
290
|
-
var
|
|
291
|
+
var _this_engineArrayBeforeSetCallbackFlag, _this;
|
|
291
292
|
// @ts-ignore
|
|
292
293
|
var newValue = (_this_engineArrayBeforeSetCallbackFlag = (_this = this)[engineArrayBeforeSetCallbackFlag]) === null || _this_engineArrayBeforeSetCallbackFlag === void 0 ? void 0 : _this_engineArrayBeforeSetCallbackFlag.call(_this, // @ts-ignore
|
|
293
294
|
this[engineTargetKey], // @ts-ignore
|
|
@@ -1,12 +1,12 @@
|
|
|
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
|
|
7
|
-
if (Array.isArray(arr)) return
|
|
6
|
+
function _array_without_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function _class_call_check(instance, Constructor) {
|
|
10
10
|
if (!(instance instanceof Constructor)) {
|
|
11
11
|
throw new TypeError("Cannot call a class as a function");
|
|
12
12
|
}
|
|
@@ -20,12 +20,12 @@ function _defineProperties(target, props) {
|
|
|
20
20
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
24
24
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
25
25
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
26
26
|
return Constructor;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function _define_property(obj, key, value) {
|
|
29
29
|
if (key in obj) {
|
|
30
30
|
Object.defineProperty(obj, key, {
|
|
31
31
|
value: value,
|
|
@@ -38,22 +38,22 @@ function _defineProperty(obj, key, value) {
|
|
|
38
38
|
}
|
|
39
39
|
return obj;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function _iterable_to_array(iter) {
|
|
42
42
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function _non_iterable_spread() {
|
|
45
45
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
return
|
|
47
|
+
function _to_consumable_array(arr) {
|
|
48
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
51
51
|
if (!o) return;
|
|
52
|
-
if (typeof o === "string") return
|
|
52
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
53
53
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
54
54
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
55
55
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
56
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
56
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
57
57
|
}
|
|
58
58
|
import { CONTROL_TYPE, CALC_TOKEN_TYPE, CALC_AGGREGATE_TYPE } from "@byteluck-fe/model-driven-shared";
|
|
59
59
|
import { format } from "mathjs";
|
|
@@ -69,27 +69,27 @@ var DisplayType;
|
|
|
69
69
|
export var CalcPlugin = /*#__PURE__*/ function() {
|
|
70
70
|
"use strict";
|
|
71
71
|
function CalcPlugin(options) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
_class_call_check(this, CalcPlugin);
|
|
73
|
+
_define_property(this, "engine", void 0);
|
|
74
|
+
_define_property(this, "options", void 0);
|
|
75
75
|
/**
|
|
76
76
|
* 所有的计算公式控件
|
|
77
77
|
* */ // @ts-ignore
|
|
78
|
-
|
|
78
|
+
_define_property(this, "calcControls", []);
|
|
79
79
|
/**
|
|
80
80
|
* key=控件id value=控件修改后需要触发重新计算的计算公式控件组成的数组
|
|
81
81
|
* 存储为一个Map,用于在控件change的时候,重新计算依赖的calc
|
|
82
|
-
* */
|
|
82
|
+
* */ _define_property(this, "dependenciesTriggerMap", new Map());
|
|
83
83
|
/**
|
|
84
84
|
* 隐藏以后需要被计算的控件
|
|
85
|
-
* */
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
* */ _define_property(this, "hideNotRememberControlIds", []);
|
|
86
|
+
_define_property(this, "dontHasPermissionControlIds", []);
|
|
87
|
+
_define_property(this, "cacheComputedResult", {});
|
|
88
88
|
this.options = options;
|
|
89
89
|
this.getDontHasPermissionControlIds();
|
|
90
90
|
this.getNeedHideRememberControlIds();
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
_create_class(CalcPlugin, [
|
|
93
93
|
{
|
|
94
94
|
key: "getNeedHideRememberControlIds",
|
|
95
95
|
value: /**
|
|
@@ -102,7 +102,7 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
102
102
|
this.hideNotRememberControlIds = this.options.displayBoList.reduce(function(result, current) {
|
|
103
103
|
if (!current.is_remember) {
|
|
104
104
|
var _result;
|
|
105
|
-
(_result = result).push.apply(_result,
|
|
105
|
+
(_result = result).push.apply(_result, _to_consumable_array(current.hide_controls));
|
|
106
106
|
}
|
|
107
107
|
return result;
|
|
108
108
|
}, []);
|
|
@@ -355,6 +355,7 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
355
355
|
* */ // @ts-ignore
|
|
356
356
|
function computedCalcValue(control) {
|
|
357
357
|
var _this = this;
|
|
358
|
+
var _oldValue, _oldValue1;
|
|
358
359
|
var scriptEcho = control.props.scriptEcho;
|
|
359
360
|
if (!scriptEcho || scriptEcho.length === 0) {
|
|
360
361
|
return;
|
|
@@ -429,13 +430,13 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
429
430
|
var oldValue = this.engine.getState(control.id, rowIndex);
|
|
430
431
|
var result = !value || value === Infinity || value === -Infinity ? 0 : control.props.precision === "" ? value : Number(value.toFixed(control.props.precision));
|
|
431
432
|
// 如果值没变的话,不触发修改
|
|
432
|
-
if (result === (oldValue === null ||
|
|
433
|
+
if (result === ((_oldValue = oldValue) === null || _oldValue === void 0 ? void 0 : _oldValue.result)) {
|
|
433
434
|
return;
|
|
434
435
|
}
|
|
435
436
|
var _oldValue_unit;
|
|
436
437
|
this.engine.setState(control.id, {
|
|
437
438
|
result: result,
|
|
438
|
-
unit: (_oldValue_unit = oldValue === null ||
|
|
439
|
+
unit: (_oldValue_unit = (_oldValue1 = oldValue) === null || _oldValue1 === void 0 ? void 0 : _oldValue1.unit) !== null && _oldValue_unit !== void 0 ? _oldValue_unit : ""
|
|
439
440
|
}, rowIndex);
|
|
440
441
|
}
|
|
441
442
|
},
|
|
@@ -466,10 +467,10 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
466
467
|
switch(type){
|
|
467
468
|
case CALC_AGGREGATE_TYPE.MAX:
|
|
468
469
|
var _Math;
|
|
469
|
-
return (_Math = Math).max.apply(_Math,
|
|
470
|
+
return (_Math = Math).max.apply(_Math, _to_consumable_array(values));
|
|
470
471
|
case CALC_AGGREGATE_TYPE.MIN:
|
|
471
472
|
var _Math1;
|
|
472
|
-
return (_Math1 = Math).min.apply(_Math1,
|
|
473
|
+
return (_Math1 = Math).min.apply(_Math1, _to_consumable_array(values));
|
|
473
474
|
case CALC_AGGREGATE_TYPE.SUM:
|
|
474
475
|
return values.reduce(function(a, b) {
|
|
475
476
|
return a + b;
|
|
@@ -12,7 +12,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
12
12
|
Promise.resolve(value).then(_next, _throw);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function _async_to_generator(fn) {
|
|
16
16
|
return function() {
|
|
17
17
|
var self = this, args = arguments;
|
|
18
18
|
return new Promise(function(resolve, reject) {
|
|
@@ -27,7 +27,7 @@ function _asyncToGenerator(fn) {
|
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function _class_call_check(instance, Constructor) {
|
|
31
31
|
if (!(instance instanceof Constructor)) {
|
|
32
32
|
throw new TypeError("Cannot call a class as a function");
|
|
33
33
|
}
|
|
@@ -41,12 +41,12 @@ function _defineProperties(target, props) {
|
|
|
41
41
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
45
45
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
46
46
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
47
47
|
return Constructor;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function _define_property(obj, key, value) {
|
|
50
50
|
if (key in obj) {
|
|
51
51
|
Object.defineProperty(obj, key, {
|
|
52
52
|
value: value,
|
|
@@ -59,7 +59,7 @@ function _defineProperty(obj, key, value) {
|
|
|
59
59
|
}
|
|
60
60
|
return obj;
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
function _ts_generator(thisArg, body) {
|
|
63
63
|
var f, y, t, g, _ = {
|
|
64
64
|
label: 0,
|
|
65
65
|
sent: function() {
|
|
@@ -153,7 +153,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
153
153
|
done: true
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
|
-
}
|
|
156
|
+
}
|
|
157
157
|
import { EventLogic } from "@byteluck-fe/model-driven-shared";
|
|
158
158
|
// type EventKeyMap = {
|
|
159
159
|
// [eventKey in EventKeys]?: string
|
|
@@ -161,12 +161,12 @@ import { EventLogic } from "@byteluck-fe/model-driven-shared";
|
|
|
161
161
|
export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
162
162
|
"use strict";
|
|
163
163
|
function ControlsEventPlugin(config) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
164
|
+
_class_call_check(this, ControlsEventPlugin);
|
|
165
|
+
_define_property(this, "config", void 0);
|
|
166
|
+
_define_property(this, "engine", void 0);
|
|
167
167
|
this.config = config;
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
_create_class(ControlsEventPlugin, [
|
|
170
170
|
{
|
|
171
171
|
key: "apply",
|
|
172
172
|
value: function apply(engine) {
|
|
@@ -208,8 +208,8 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
208
208
|
value: function engineAddEventListener(eventKey, controlEventKey) {
|
|
209
209
|
var _this = this;
|
|
210
210
|
this.engine.on(eventKey, function() {
|
|
211
|
-
var _ref =
|
|
212
|
-
return
|
|
211
|
+
var _ref = _async_to_generator(function(payload) {
|
|
212
|
+
return _ts_generator(this, function(_state) {
|
|
213
213
|
switch(_state.label){
|
|
214
214
|
case 0:
|
|
215
215
|
// 初始化state的时候不触发change事件,必须在engine mounted以后才触发
|
|
@@ -248,9 +248,9 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
248
248
|
key: "callControlEvent",
|
|
249
249
|
value: function callControlEvent(name, payload) {
|
|
250
250
|
var _this = this;
|
|
251
|
-
return
|
|
251
|
+
return _async_to_generator(function() {
|
|
252
252
|
var events, result;
|
|
253
|
-
return
|
|
253
|
+
return _ts_generator(this, function(_state) {
|
|
254
254
|
switch(_state.label){
|
|
255
255
|
case 0:
|
|
256
256
|
events = _this.config[payload.instance.id];
|
|
@@ -263,9 +263,9 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
263
263
|
return [
|
|
264
264
|
4,
|
|
265
265
|
Promise.all(events[name].map(function() {
|
|
266
|
-
var _ref =
|
|
266
|
+
var _ref = _async_to_generator(function(eventName) {
|
|
267
267
|
var execResult;
|
|
268
|
-
return
|
|
268
|
+
return _ts_generator(this, function(_state) {
|
|
269
269
|
switch(_state.label){
|
|
270
270
|
case 0:
|
|
271
271
|
return [
|
|
@@ -1,12 +1,12 @@
|
|
|
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 _class_call_check(instance, Constructor) {
|
|
10
10
|
if (!(instance instanceof Constructor)) {
|
|
11
11
|
throw new TypeError("Cannot call a class as a function");
|
|
12
12
|
}
|
|
@@ -20,12 +20,12 @@ function _defineProperties(target, props) {
|
|
|
20
20
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
24
24
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
25
25
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
26
26
|
return Constructor;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function _define_property(obj, key, value) {
|
|
29
29
|
if (key in obj) {
|
|
30
30
|
Object.defineProperty(obj, key, {
|
|
31
31
|
value: value,
|
|
@@ -38,7 +38,7 @@ function _defineProperty(obj, key, value) {
|
|
|
38
38
|
}
|
|
39
39
|
return obj;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function _iterable_to_array_limit(arr, i) {
|
|
42
42
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
43
43
|
if (_i == null) return;
|
|
44
44
|
var _arr = [];
|
|
@@ -62,32 +62,32 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
62
62
|
}
|
|
63
63
|
return _arr;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function _non_iterable_rest() {
|
|
66
66
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
67
67
|
}
|
|
68
|
-
function
|
|
69
|
-
return
|
|
68
|
+
function _sliced_to_array(arr, i) {
|
|
69
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
72
72
|
if (!o) return;
|
|
73
|
-
if (typeof o === "string") return
|
|
73
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
74
74
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
75
75
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
76
76
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
77
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
77
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
78
78
|
}
|
|
79
79
|
import { error } from "@byteluck-fe/model-driven-shared";
|
|
80
80
|
export var ES6ModulePlugin = /*#__PURE__*/ function() {
|
|
81
81
|
"use strict";
|
|
82
82
|
function ES6ModulePlugin(config, env) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
_class_call_check(this, ES6ModulePlugin);
|
|
84
|
+
_define_property(this, "config", void 0);
|
|
85
|
+
_define_property(this, "engine", void 0);
|
|
86
|
+
_define_property(this, "env", void 0);
|
|
87
87
|
this.config = config;
|
|
88
88
|
this.env = env;
|
|
89
89
|
}
|
|
90
|
-
|
|
90
|
+
_create_class(ES6ModulePlugin, [
|
|
91
91
|
{
|
|
92
92
|
key: "apply",
|
|
93
93
|
value: function apply(engine) {
|
|
@@ -104,7 +104,7 @@ export var ES6ModulePlugin = /*#__PURE__*/ function() {
|
|
|
104
104
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
105
105
|
try {
|
|
106
106
|
for(var _iterator = Object.entries(res.funcMap)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
107
|
-
var _step_value =
|
|
107
|
+
var _step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
108
108
|
actionManager.addAction(key, value);
|
|
109
109
|
}
|
|
110
110
|
} catch (err) {
|
|
@@ -153,7 +153,7 @@ export function parseModule(action, engine, env) {
|
|
|
153
153
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
154
154
|
try {
|
|
155
155
|
for(var _iterator = Object.entries(module.exports)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
156
|
-
var _step_value =
|
|
156
|
+
var _step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
157
157
|
if (typeof value === "function") {
|
|
158
158
|
funcMap[key] = value;
|
|
159
159
|
} else {
|
|
@@ -1,9 +1,9 @@
|
|
|
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
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -20,7 +20,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
20
20
|
Promise.resolve(value).then(_next, _throw);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function _async_to_generator(fn) {
|
|
24
24
|
return function() {
|
|
25
25
|
var self = this, args = arguments;
|
|
26
26
|
return new Promise(function(resolve, reject) {
|
|
@@ -35,7 +35,7 @@ function _asyncToGenerator(fn) {
|
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function _class_call_check(instance, Constructor) {
|
|
39
39
|
if (!(instance instanceof Constructor)) {
|
|
40
40
|
throw new TypeError("Cannot call a class as a function");
|
|
41
41
|
}
|
|
@@ -49,12 +49,12 @@ function _defineProperties(target, props) {
|
|
|
49
49
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
53
53
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
54
54
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
55
55
|
return Constructor;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function _define_property(obj, key, value) {
|
|
58
58
|
if (key in obj) {
|
|
59
59
|
Object.defineProperty(obj, key, {
|
|
60
60
|
value: value,
|
|
@@ -67,7 +67,7 @@ function _defineProperty(obj, key, value) {
|
|
|
67
67
|
}
|
|
68
68
|
return obj;
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function _iterable_to_array_limit(arr, i) {
|
|
71
71
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
72
72
|
if (_i == null) return;
|
|
73
73
|
var _arr = [];
|
|
@@ -91,21 +91,21 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
91
91
|
}
|
|
92
92
|
return _arr;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function _non_iterable_rest() {
|
|
95
95
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
return
|
|
97
|
+
function _sliced_to_array(arr, i) {
|
|
98
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
101
101
|
if (!o) return;
|
|
102
|
-
if (typeof o === "string") return
|
|
102
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
103
103
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
104
104
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
105
105
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
106
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
106
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
function _ts_generator(thisArg, body) {
|
|
109
109
|
var f, y, t, g, _ = {
|
|
110
110
|
label: 0,
|
|
111
111
|
sent: function() {
|
|
@@ -199,7 +199,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
199
199
|
done: true
|
|
200
200
|
};
|
|
201
201
|
}
|
|
202
|
-
}
|
|
202
|
+
}
|
|
203
203
|
var LifecycleEventKeyMap = {
|
|
204
204
|
"engine-mounted": "did_mount",
|
|
205
205
|
"engine-submit": "will_submit",
|
|
@@ -209,24 +209,24 @@ var LifecycleEventKeyMap = {
|
|
|
209
209
|
export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
210
210
|
"use strict";
|
|
211
211
|
function LifecycleEventPlugin(config) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
212
|
+
_class_call_check(this, LifecycleEventPlugin);
|
|
213
|
+
_define_property(this, "config", void 0);
|
|
214
|
+
_define_property(this, "engine", void 0);
|
|
215
215
|
this.config = config;
|
|
216
216
|
}
|
|
217
|
-
|
|
217
|
+
_create_class(LifecycleEventPlugin, [
|
|
218
218
|
{
|
|
219
219
|
key: "apply",
|
|
220
220
|
value: function apply(engine) {
|
|
221
221
|
var _this = this;
|
|
222
222
|
this.engine = engine;
|
|
223
223
|
Object.entries(LifecycleEventKeyMap).forEach(function(param) {
|
|
224
|
-
var _param =
|
|
224
|
+
var _param = _sliced_to_array(param, 2), engineKey = _param[0], lifecycleKey = _param[1];
|
|
225
225
|
var _this1 = _this;
|
|
226
226
|
engine.on(engineKey, function() {
|
|
227
|
-
var _ref =
|
|
227
|
+
var _ref = _async_to_generator(function(payload) {
|
|
228
228
|
var result;
|
|
229
|
-
return
|
|
229
|
+
return _ts_generator(this, function(_state) {
|
|
230
230
|
switch(_state.label){
|
|
231
231
|
case 0:
|
|
232
232
|
return [
|
|
@@ -263,9 +263,9 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
|
263
263
|
key: "callLifecycleEvent",
|
|
264
264
|
value: function callLifecycleEvent(name, payload) {
|
|
265
265
|
var _this = this;
|
|
266
|
-
return
|
|
266
|
+
return _async_to_generator(function() {
|
|
267
267
|
var events, result;
|
|
268
|
-
return
|
|
268
|
+
return _ts_generator(this, function(_state) {
|
|
269
269
|
switch(_state.label){
|
|
270
270
|
case 0:
|
|
271
271
|
events = _this.config;
|
|
@@ -278,9 +278,9 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
|
278
278
|
return [
|
|
279
279
|
4,
|
|
280
280
|
Promise.all(events[name].map(function() {
|
|
281
|
-
var _ref =
|
|
281
|
+
var _ref = _async_to_generator(function(eventName) {
|
|
282
282
|
var execResult;
|
|
283
|
-
return
|
|
283
|
+
return _ts_generator(this, function(_state) {
|
|
284
284
|
switch(_state.label){
|
|
285
285
|
case 0:
|
|
286
286
|
return [
|
|
@@ -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,
|
|
@@ -33,12 +33,12 @@ function _defineProperty(obj, key, value) {
|
|
|
33
33
|
export var StylePlugin = /*#__PURE__*/ function() {
|
|
34
34
|
"use strict";
|
|
35
35
|
function StylePlugin(config) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
_class_call_check(this, StylePlugin);
|
|
37
|
+
_define_property(this, "config", void 0);
|
|
38
|
+
_define_property(this, "engine", void 0);
|
|
39
39
|
this.config = config;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
_create_class(StylePlugin, [
|
|
42
42
|
{
|
|
43
43
|
key: "apply",
|
|
44
44
|
value: function apply(engine) {
|
|
@@ -12,7 +12,8 @@ export function loopFormControl(control, callback) {
|
|
|
12
12
|
;
|
|
13
13
|
callback(item, children);
|
|
14
14
|
} else if (hasChildrenControl(item)) {
|
|
15
|
-
|
|
15
|
+
var _item;
|
|
16
|
+
loopFormControl((_item = item) === null || _item === void 0 ? void 0 : _item.children, callback);
|
|
16
17
|
// @ts-ignore
|
|
17
18
|
} else if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
18
19
|
callback(item);
|
|
@@ -27,8 +28,9 @@ callback) {
|
|
|
27
28
|
if (item.type === CONTROL_TYPE.DATA_VIEW || item.type === CONTROL_TYPE.SIMPLE_SEARCH) {
|
|
28
29
|
callback(item);
|
|
29
30
|
} else if (hasChildrenControl(item)) {
|
|
31
|
+
var _item;
|
|
30
32
|
// @ts-ignore
|
|
31
|
-
loopDataViewControl(item === null ||
|
|
33
|
+
loopDataViewControl((_item = item) === null || _item === void 0 ? void 0 : _item.children, callback);
|
|
32
34
|
}
|
|
33
35
|
});
|
|
34
36
|
}
|