@byteluck-fe/model-driven-engine 2.2.7-beta.1 → 2.2.7-beta.3
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 +100 -102
- package/dist/esm/common/OkWorker.js +10 -10
- package/dist/esm/common/Plugin.js +2 -2
- package/dist/esm/common/Runtime.js +29 -29
- package/dist/esm/common/Store.js +11 -11
- package/dist/esm/common/checkerValue.js +77 -77
- package/dist/esm/common/proxyState.js +18 -18
- package/dist/esm/plugins/CalcPlugin.js +29 -29
- package/dist/esm/plugins/ControlsEventPlugin.js +18 -18
- package/dist/esm/plugins/ES6ModulePlugin.js +19 -19
- package/dist/esm/plugins/LifecycleEventPlugin.js +28 -28
- package/dist/esm/plugins/StylePlugin.js +7 -7
- package/dist/index.umd.js +9 -10
- package/package.json +2 -2
|
@@ -1,15 +1,15 @@
|
|
|
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 _assert_this_initialized(self) {
|
|
13
13
|
if (self === void 0) {
|
|
14
14
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
15
15
|
}
|
|
@@ -29,7 +29,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
29
29
|
Promise.resolve(value).then(_next, _throw);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function _async_to_generator(fn) {
|
|
33
33
|
return function() {
|
|
34
34
|
var self = this, args = arguments;
|
|
35
35
|
return new Promise(function(resolve, reject) {
|
|
@@ -44,7 +44,7 @@ function _asyncToGenerator(fn) {
|
|
|
44
44
|
});
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function _class_call_check(instance, Constructor) {
|
|
48
48
|
if (!(instance instanceof Constructor)) {
|
|
49
49
|
throw new TypeError("Cannot call a class as a function");
|
|
50
50
|
}
|
|
@@ -58,12 +58,12 @@ function _defineProperties(target, props) {
|
|
|
58
58
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
62
62
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
63
63
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
64
64
|
return Constructor;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function _define_property(obj, key, value) {
|
|
67
67
|
if (key in obj) {
|
|
68
68
|
Object.defineProperty(obj, key, {
|
|
69
69
|
value: value,
|
|
@@ -80,23 +80,23 @@ function _get(target, property, receiver) {
|
|
|
80
80
|
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
81
81
|
_get = Reflect.get;
|
|
82
82
|
} else {
|
|
83
|
-
_get = function
|
|
84
|
-
var base =
|
|
83
|
+
_get = function get(target, property, receiver) {
|
|
84
|
+
var base = _super_prop_base(target, property);
|
|
85
85
|
if (!base) return;
|
|
86
86
|
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
87
87
|
if (desc.get) {
|
|
88
|
-
return desc.get.call(receiver);
|
|
88
|
+
return desc.get.call(receiver || target);
|
|
89
89
|
}
|
|
90
90
|
return desc.value;
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
93
|
return _get(target, property, receiver || target);
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
|
|
95
|
+
function _get_prototype_of(o) {
|
|
96
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
97
97
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
98
98
|
};
|
|
99
|
-
return
|
|
99
|
+
return _get_prototype_of(o);
|
|
100
100
|
}
|
|
101
101
|
function _inherits(subClass, superClass) {
|
|
102
102
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -109,7 +109,7 @@ function _inherits(subClass, superClass) {
|
|
|
109
109
|
configurable: true
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
|
-
if (superClass)
|
|
112
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
113
113
|
}
|
|
114
114
|
function _instanceof(left, right) {
|
|
115
115
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
@@ -118,10 +118,10 @@ function _instanceof(left, right) {
|
|
|
118
118
|
return left instanceof right;
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function _iterable_to_array(iter) {
|
|
122
122
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function _iterable_to_array_limit(arr, i) {
|
|
125
125
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
126
126
|
if (_i == null) return;
|
|
127
127
|
var _arr = [];
|
|
@@ -145,13 +145,13 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
145
145
|
}
|
|
146
146
|
return _arr;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function _non_iterable_rest() {
|
|
149
149
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function _non_iterable_spread() {
|
|
152
152
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function _object_spread(target) {
|
|
155
155
|
for(var i = 1; i < arguments.length; i++){
|
|
156
156
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
157
157
|
var ownKeys = Object.keys(source);
|
|
@@ -161,7 +161,7 @@ function _objectSpread(target) {
|
|
|
161
161
|
}));
|
|
162
162
|
}
|
|
163
163
|
ownKeys.forEach(function(key) {
|
|
164
|
-
|
|
164
|
+
_define_property(target, key, source[key]);
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
return target;
|
|
@@ -179,7 +179,7 @@ function ownKeys(object, enumerableOnly) {
|
|
|
179
179
|
}
|
|
180
180
|
return keys;
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function _object_spread_props(target, source) {
|
|
183
183
|
source = source != null ? source : {};
|
|
184
184
|
if (Object.getOwnPropertyDescriptors) {
|
|
185
185
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
@@ -190,45 +190,45 @@ function _objectSpreadProps(target, source) {
|
|
|
190
190
|
}
|
|
191
191
|
return target;
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
if (call && (
|
|
193
|
+
function _possible_constructor_return(self, call) {
|
|
194
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
195
195
|
return call;
|
|
196
196
|
}
|
|
197
|
-
return
|
|
197
|
+
return _assert_this_initialized(self);
|
|
198
198
|
}
|
|
199
|
-
function
|
|
200
|
-
|
|
199
|
+
function _set_prototype_of(o, p) {
|
|
200
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
201
201
|
o.__proto__ = p;
|
|
202
202
|
return o;
|
|
203
203
|
};
|
|
204
|
-
return
|
|
204
|
+
return _set_prototype_of(o, p);
|
|
205
205
|
}
|
|
206
|
-
function
|
|
207
|
-
return
|
|
206
|
+
function _sliced_to_array(arr, i) {
|
|
207
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function _super_prop_base(object, property) {
|
|
210
210
|
while(!Object.prototype.hasOwnProperty.call(object, property)){
|
|
211
|
-
object =
|
|
211
|
+
object = _get_prototype_of(object);
|
|
212
212
|
if (object === null) break;
|
|
213
213
|
}
|
|
214
214
|
return object;
|
|
215
215
|
}
|
|
216
|
-
function
|
|
217
|
-
return
|
|
216
|
+
function _to_consumable_array(arr) {
|
|
217
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
218
218
|
}
|
|
219
|
-
|
|
219
|
+
function _type_of(obj) {
|
|
220
220
|
"@swc/helpers - typeof";
|
|
221
221
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
222
|
-
}
|
|
223
|
-
function
|
|
222
|
+
}
|
|
223
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
224
224
|
if (!o) return;
|
|
225
|
-
if (typeof o === "string") return
|
|
225
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
226
226
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
227
227
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
228
228
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
229
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
229
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
230
230
|
}
|
|
231
|
-
function
|
|
231
|
+
function _is_native_reflect_construct() {
|
|
232
232
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
233
233
|
if (Reflect.construct.sham) return false;
|
|
234
234
|
if (typeof Proxy === "function") return true;
|
|
@@ -239,20 +239,20 @@ function _isNativeReflectConstruct() {
|
|
|
239
239
|
return false;
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
|
-
function
|
|
243
|
-
var hasNativeReflectConstruct =
|
|
242
|
+
function _create_super(Derived) {
|
|
243
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
244
244
|
return function _createSuperInternal() {
|
|
245
|
-
var Super =
|
|
245
|
+
var Super = _get_prototype_of(Derived), result;
|
|
246
246
|
if (hasNativeReflectConstruct) {
|
|
247
|
-
var NewTarget =
|
|
247
|
+
var NewTarget = _get_prototype_of(this).constructor;
|
|
248
248
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
249
249
|
} else {
|
|
250
250
|
result = Super.apply(this, arguments);
|
|
251
251
|
}
|
|
252
|
-
return
|
|
252
|
+
return _possible_constructor_return(this, result);
|
|
253
253
|
};
|
|
254
254
|
}
|
|
255
|
-
|
|
255
|
+
function _ts_generator(thisArg, body) {
|
|
256
256
|
var f, y, t, g, _ = {
|
|
257
257
|
label: 0,
|
|
258
258
|
sent: function() {
|
|
@@ -346,7 +346,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
346
346
|
done: true
|
|
347
347
|
};
|
|
348
348
|
}
|
|
349
|
-
}
|
|
349
|
+
}
|
|
350
350
|
import { DataBind, ObjectDataBind, RuntimeListControl } from "@byteluck-fe/model-driven-core";
|
|
351
351
|
import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, RulesMessage, updateValueFromKeys, warn, Watcher } from "@byteluck-fe/model-driven-shared";
|
|
352
352
|
import { Runtime } from "./Runtime";
|
|
@@ -367,29 +367,29 @@ var applyingPluginName = "";
|
|
|
367
367
|
var Engine = /*#__PURE__*/ function(Watcher) {
|
|
368
368
|
"use strict";
|
|
369
369
|
_inherits(Engine, Watcher);
|
|
370
|
-
var _super =
|
|
370
|
+
var _super = _create_super(Engine);
|
|
371
371
|
function Engine(props) {
|
|
372
|
-
|
|
372
|
+
_class_call_check(this, Engine);
|
|
373
373
|
var _this;
|
|
374
374
|
_this = _super.call(this);
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
375
|
+
_define_property(_assert_this_initialized(_this), "store", void 0);
|
|
376
|
+
_define_property(_assert_this_initialized(_this), "rawStore", {});
|
|
377
|
+
_define_property(_assert_this_initialized(_this), "parent", void 0);
|
|
378
378
|
// 提供注册运行态控件以及实例化控件的能力
|
|
379
|
-
|
|
379
|
+
_define_property(_assert_this_initialized(_this), "runtime", void 0);
|
|
380
380
|
// 提供子线程处理脚本以及修改数据的能力
|
|
381
381
|
// public worker: OkWorker
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
382
|
+
_define_property(_assert_this_initialized(_this), "isMounted", false);
|
|
383
|
+
_define_property(_assert_this_initialized(_this), "id", genNonDuplicateId(8));
|
|
384
|
+
_define_property(_assert_this_initialized(_this), "externalParams", void 0);
|
|
385
385
|
// 提供外部注册插件,在不同的hooks触发时执行固定函数的能力
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
386
|
+
_define_property(_assert_this_initialized(_this), "__plugins", void 0);
|
|
387
|
+
_define_property(_assert_this_initialized(_this), "__pluginsApplied", false);
|
|
388
|
+
_define_property(_assert_this_initialized(_this), "$options", void 0);
|
|
389
|
+
_define_property(_assert_this_initialized(_this), "actionManager", new ActionManager());
|
|
390
|
+
_define_property(_assert_this_initialized(_this), "dataManager", void 0);
|
|
391
|
+
_define_property(_assert_this_initialized(_this), "_jobTasks", []);
|
|
392
|
+
_define_property(_assert_this_initialized(_this), "createControlInstance", _this.createInstance);
|
|
393
393
|
_this.$options = Object.freeze(props);
|
|
394
394
|
var _this_$options = _this.$options, _this_$options_autoMount = _this_$options.autoMount, autoMount = _this_$options_autoMount === void 0 ? true : _this_$options_autoMount, schema = _this_$options.schema, beforeCreateInstance = _this_$options.beforeCreateInstance, externalParams = _this_$options.externalParams, _this_$options_language = _this_$options.// fieldModel,
|
|
395
395
|
language, language = _this_$options_language === void 0 ? DEFAULT_LOCALE : _this_$options_language, _this_$options_debug = _this_$options.debug, debug = _this_$options_debug === void 0 ? false : _this_$options_debug;
|
|
@@ -408,14 +408,14 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
408
408
|
autoMount && _this.mount();
|
|
409
409
|
return _this;
|
|
410
410
|
}
|
|
411
|
-
|
|
411
|
+
_create_class(Engine, [
|
|
412
412
|
{
|
|
413
413
|
key: "debugLog",
|
|
414
414
|
value: function debugLog() {
|
|
415
415
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
416
416
|
args[_key] = arguments[_key];
|
|
417
417
|
}
|
|
418
|
-
this.debug && log.apply(void 0,
|
|
418
|
+
this.debug && log.apply(void 0, _to_consumable_array(args));
|
|
419
419
|
}
|
|
420
420
|
},
|
|
421
421
|
{
|
|
@@ -435,7 +435,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
435
435
|
arg[_key] = arguments[_key];
|
|
436
436
|
}
|
|
437
437
|
var _this_runtime;
|
|
438
|
-
(_this_runtime = this.runtime).register.apply(_this_runtime,
|
|
438
|
+
(_this_runtime = this.runtime).register.apply(_this_runtime, _to_consumable_array(arg));
|
|
439
439
|
return this;
|
|
440
440
|
}
|
|
441
441
|
},
|
|
@@ -552,7 +552,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
552
552
|
var newRowLengths = args.length;
|
|
553
553
|
createdNewRows = createRows(newRowLengths);
|
|
554
554
|
createdNewRowsData = args;
|
|
555
|
-
(_subtable_children = subtable.children)[type].apply(_subtable_children,
|
|
555
|
+
(_subtable_children = subtable.children)[type].apply(_subtable_children, _to_consumable_array(createdNewRows));
|
|
556
556
|
this.runtime.getFlatInstances();
|
|
557
557
|
break;
|
|
558
558
|
case "splice":
|
|
@@ -570,7 +570,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
570
570
|
(_subtable_children1 = subtable.children)[type].apply(_subtable_children1, [
|
|
571
571
|
start,
|
|
572
572
|
replace
|
|
573
|
-
].concat(
|
|
573
|
+
].concat(_to_consumable_array(createdNewRows)));
|
|
574
574
|
this.runtime.getFlatInstances();
|
|
575
575
|
// newValues.forEach((item: any, index) => {
|
|
576
576
|
// let newIndex = start + index
|
|
@@ -579,14 +579,14 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
579
579
|
} else {
|
|
580
580
|
var // @ts-ignore
|
|
581
581
|
_subtable_children2;
|
|
582
|
-
(_subtable_children2 = subtable.children)[type].apply(_subtable_children2,
|
|
582
|
+
(_subtable_children2 = subtable.children)[type].apply(_subtable_children2, _to_consumable_array(args));
|
|
583
583
|
this.runtime.getFlatInstances();
|
|
584
584
|
}
|
|
585
585
|
break;
|
|
586
586
|
default:
|
|
587
587
|
var // @ts-ignore
|
|
588
588
|
_subtable_children3;
|
|
589
|
-
(_subtable_children3 = subtable.children)[type].apply(_subtable_children3,
|
|
589
|
+
(_subtable_children3 = subtable.children)[type].apply(_subtable_children3, _to_consumable_array(args));
|
|
590
590
|
this.runtime.getFlatInstances();
|
|
591
591
|
break;
|
|
592
592
|
}
|
|
@@ -637,7 +637,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
637
637
|
var row = this.listControlCreateRow(instance, "subtable-row");
|
|
638
638
|
row && newRows.push(row);
|
|
639
639
|
}
|
|
640
|
-
(_instance_children = instance.children).push.apply(_instance_children,
|
|
640
|
+
(_instance_children = instance.children).push.apply(_instance_children, _to_consumable_array(newRows));
|
|
641
641
|
this.runtime.getFlatInstances();
|
|
642
642
|
// 这里已经能拿到控件实例,所以在这里触发setStates,触发每一行每一个控件的change事件
|
|
643
643
|
// for (let i = 0; i < newValue.length; i++) {
|
|
@@ -646,7 +646,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
646
646
|
this.emit("list-change", {
|
|
647
647
|
instance: instance,
|
|
648
648
|
value: value,
|
|
649
|
-
options:
|
|
649
|
+
options: _object_spread_props(_object_spread({}, options), {
|
|
650
650
|
// @ts-ignore
|
|
651
651
|
changed: newRows,
|
|
652
652
|
data: newValue,
|
|
@@ -658,7 +658,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
658
658
|
instance: instance,
|
|
659
659
|
value: this.getState(instance.id, index),
|
|
660
660
|
rowIndex: index,
|
|
661
|
-
options:
|
|
661
|
+
options: _object_spread_props(_object_spread({}, options), {
|
|
662
662
|
oldValue: oldValue
|
|
663
663
|
})
|
|
664
664
|
});
|
|
@@ -697,7 +697,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
697
697
|
var template = JSONCopy(instance.props.headers);
|
|
698
698
|
// @ts-ignore
|
|
699
699
|
var columns = this.createControl(template);
|
|
700
|
-
(_inst_children = inst.children).push.apply(_inst_children,
|
|
700
|
+
(_inst_children = inst.children).push.apply(_inst_children, _to_consumable_array(columns));
|
|
701
701
|
}
|
|
702
702
|
return row;
|
|
703
703
|
}
|
|
@@ -718,11 +718,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
718
718
|
function emit(eventKey, payload) {
|
|
719
719
|
var _this = this;
|
|
720
720
|
var _this1 = this, _superprop_get_emit = function() {
|
|
721
|
-
return _get(
|
|
721
|
+
return _get(_get_prototype_of(Engine.prototype), "emit", _this);
|
|
722
722
|
};
|
|
723
|
-
return
|
|
723
|
+
return _async_to_generator(function() {
|
|
724
724
|
var needWait, promiseResolver, promise, results;
|
|
725
|
-
return
|
|
725
|
+
return _ts_generator(this, function(_state) {
|
|
726
726
|
switch(_state.label){
|
|
727
727
|
case 0:
|
|
728
728
|
if (!(eventKey === "engine-mounted")) return [
|
|
@@ -741,7 +741,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
741
741
|
2
|
|
742
742
|
];
|
|
743
743
|
console.time("engine-mounted need wait");
|
|
744
|
-
needWait =
|
|
744
|
+
needWait = _to_consumable_array(_this1._jobTasks);
|
|
745
745
|
return [
|
|
746
746
|
4,
|
|
747
747
|
Promise.all(needWait)
|
|
@@ -787,7 +787,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
787
787
|
if (applyingPluginName) {
|
|
788
788
|
callback.applyingPluginName = applyingPluginName;
|
|
789
789
|
}
|
|
790
|
-
return _get(
|
|
790
|
+
return _get(_get_prototype_of(Engine.prototype), "on", this).call(this, key, callback);
|
|
791
791
|
}
|
|
792
792
|
},
|
|
793
793
|
{
|
|
@@ -797,7 +797,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
797
797
|
args[_key] = arguments[_key];
|
|
798
798
|
}
|
|
799
799
|
var _this_runtime;
|
|
800
|
-
return (_this_runtime = this.runtime).createControl.apply(_this_runtime,
|
|
800
|
+
return (_this_runtime = this.runtime).createControl.apply(_this_runtime, _to_consumable_array(args));
|
|
801
801
|
}
|
|
802
802
|
},
|
|
803
803
|
{
|
|
@@ -889,7 +889,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
889
889
|
var newStates = states;
|
|
890
890
|
Object.keys(newStates).forEach(function(stateId) {
|
|
891
891
|
Object.entries(_this.store.controlIdMapping).forEach(function(param) {
|
|
892
|
-
var _param =
|
|
892
|
+
var _param = _sliced_to_array(param, 2), controlId = _param[0], controlIdMapping = _param[1];
|
|
893
893
|
if (controlIdMapping.dataView === stateId) {
|
|
894
894
|
// state对象是dataView包裹的
|
|
895
895
|
var value = newStates[stateId][controlId];
|
|
@@ -932,7 +932,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
932
932
|
var state = this.getState(controlId1, rowIndex);
|
|
933
933
|
if (_instanceof(dataBind, ObjectDataBind)) {
|
|
934
934
|
return Object.entries(dataBind).reduce(function(result, param) {
|
|
935
|
-
var _param =
|
|
935
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], dataBind = _param[1];
|
|
936
936
|
// objectDataBind的元素,跳过下一次赋值
|
|
937
937
|
if (dataBind.fieldCode === fieldCode) {
|
|
938
938
|
return result[key];
|
|
@@ -958,15 +958,15 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
958
958
|
var data = getFieldData.map(function(item) {
|
|
959
959
|
var obj = {};
|
|
960
960
|
for(var key in item){
|
|
961
|
-
var _controlIdMapping_controlId_children_key, _controlIdMapping_controlId,
|
|
962
|
-
if ((
|
|
961
|
+
var _controlIdMapping_controlId_children_key_dataBind, _controlIdMapping_controlId_children_key, _controlIdMapping_controlId, _controlIdMapping_controlId1;
|
|
962
|
+
if ((_controlIdMapping_controlId = controlIdMapping[controlId]) === null || _controlIdMapping_controlId === void 0 ? void 0 : (_controlIdMapping_controlId_children_key = _controlIdMapping_controlId.children[key]) === null || _controlIdMapping_controlId_children_key === void 0 ? void 0 : (_controlIdMapping_controlId_children_key_dataBind = _controlIdMapping_controlId_children_key.dataBind) === null || _controlIdMapping_controlId_children_key_dataBind === void 0 ? void 0 : _controlIdMapping_controlId_children_key_dataBind.fieldCode) {
|
|
963
963
|
var _controlIdMapping_controlId_children_key1;
|
|
964
964
|
obj[(_controlIdMapping_controlId_children_key1 = controlIdMapping[controlId].children[key]) === null || _controlIdMapping_controlId_children_key1 === void 0 ? void 0 : _controlIdMapping_controlId_children_key1.dataBind.fieldCode] = item[key];
|
|
965
965
|
} else if ((_controlIdMapping_controlId1 = controlIdMapping[controlId]) === null || _controlIdMapping_controlId1 === void 0 ? void 0 : _controlIdMapping_controlId1.children[key]) {
|
|
966
966
|
// 兼容一个控件需要绑定多个字段的情况
|
|
967
967
|
for(var keyChi in item[key]){
|
|
968
968
|
var _controlIdMapping_controlId_children_key2, _controlIdMapping_controlId2;
|
|
969
|
-
obj[(
|
|
969
|
+
obj[(_controlIdMapping_controlId2 = controlIdMapping[controlId]) === null || _controlIdMapping_controlId2 === void 0 ? void 0 : (_controlIdMapping_controlId_children_key2 = _controlIdMapping_controlId2.children[key]) === null || _controlIdMapping_controlId_children_key2 === void 0 ? void 0 : _controlIdMapping_controlId_children_key2.dataBind[keyChi].fieldCode] = item[key][keyChi];
|
|
970
970
|
}
|
|
971
971
|
}
|
|
972
972
|
}
|
|
@@ -975,7 +975,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
975
975
|
return data;
|
|
976
976
|
} else {
|
|
977
977
|
var _loop = function(key) {
|
|
978
|
-
var _controlIdMapping_key,
|
|
978
|
+
var _controlIdMapping_key_dataBind, _controlIdMapping_key, _controlIdMapping_key_dataBind1, _controlIdMapping_key1;
|
|
979
979
|
if ((_controlIdMapping_key = controlIdMapping[key]) === null || _controlIdMapping_key === void 0 ? void 0 : (_controlIdMapping_key_dataBind = _controlIdMapping_key.dataBind) === null || _controlIdMapping_key_dataBind === void 0 ? void 0 : _controlIdMapping_key_dataBind.fieldCode) {
|
|
980
980
|
var _controlIdMapping_key2;
|
|
981
981
|
obj[(_controlIdMapping_key2 = controlIdMapping[key]) === null || _controlIdMapping_key2 === void 0 ? void 0 : _controlIdMapping_key2.dataBind.fieldCode] = getFieldData[key];
|
|
@@ -1003,7 +1003,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1003
1003
|
// 兼容一个控件需要绑定多个字段的情况
|
|
1004
1004
|
for(var keyChi in getFieldData[key]){
|
|
1005
1005
|
var _controlIdMapping_key_dataBind_keyChi, _controlIdMapping_key4;
|
|
1006
|
-
obj[(
|
|
1006
|
+
obj[(_controlIdMapping_key4 = controlIdMapping[key]) === null || _controlIdMapping_key4 === void 0 ? void 0 : (_controlIdMapping_key_dataBind_keyChi = _controlIdMapping_key4.dataBind[keyChi]) === null || _controlIdMapping_key_dataBind_keyChi === void 0 ? void 0 : _controlIdMapping_key_dataBind_keyChi.fieldCode] = getFieldData[key][keyChi];
|
|
1007
1007
|
}
|
|
1008
1008
|
}
|
|
1009
1009
|
};
|
|
@@ -1036,7 +1036,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1036
1036
|
var oldState = (_JSONCopy = JSONCopy(this.getState(controlId, rowIndex))) !== null && _JSONCopy !== void 0 ? _JSONCopy : this.getEmptyState(controlId);
|
|
1037
1037
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
1038
1038
|
var newState = Object.entries(dataBind).reduce(function(result, param) {
|
|
1039
|
-
var _param =
|
|
1039
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], dataBind = _param[1];
|
|
1040
1040
|
// objectDataBind的元素,跳过下一次赋值
|
|
1041
1041
|
if (dataBind.fieldCode === fieldCode) {
|
|
1042
1042
|
result[key] = value;
|
|
@@ -1078,7 +1078,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1078
1078
|
var oldState = (_JSONCopy = JSONCopy(_this.getState(controlId, rowIndex))) !== null && _JSONCopy !== void 0 ? _JSONCopy : _this.getEmptyState(controlId);
|
|
1079
1079
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
1080
1080
|
var newState = Object.entries(dataBind).reduce(function(result, param) {
|
|
1081
|
-
var _param =
|
|
1081
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], dataBind = _param[1];
|
|
1082
1082
|
// objectDataBind的元素,跳过下一次赋值
|
|
1083
1083
|
skipKeys.push(dataBind.fieldCode);
|
|
1084
1084
|
var value = state[dataBind.fieldCode];
|
|
@@ -1121,7 +1121,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1121
1121
|
var oldState = _this.getEmptyState(controlId);
|
|
1122
1122
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
1123
1123
|
result[item.controlId] = Object.entries(dataBind).reduce(function(result, param) {
|
|
1124
|
-
var _param =
|
|
1124
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], dataBind = _param[1];
|
|
1125
1125
|
// objectDataBind的元素,跳过下一次赋值
|
|
1126
1126
|
skipKeys.push(dataBind.fieldCode);
|
|
1127
1127
|
var value = state[dataBind.fieldCode];
|
|
@@ -1159,7 +1159,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1159
1159
|
var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
|
|
1160
1160
|
;
|
|
1161
1161
|
Object.keys(row).map(function(fieldCode) {
|
|
1162
|
-
var
|
|
1162
|
+
var _this_store_dataBindMapping_dataCode_fields, _this_store_dataBindMapping_dataCode;
|
|
1163
1163
|
if (skipKey.includes(fieldCode)) {
|
|
1164
1164
|
return;
|
|
1165
1165
|
}
|
|
@@ -1273,17 +1273,15 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1273
1273
|
// 如果能从flatInstances里边取到,就通过getInstanceInSubtableHeader方法取,取不到则换一种方式
|
|
1274
1274
|
if (instances.length) {
|
|
1275
1275
|
var instance = instances[0];
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
instances.unshift(headerInstance);
|
|
1280
|
-
}
|
|
1276
|
+
var headerInstance = this.getInstanceInSubtableHeader(instance);
|
|
1277
|
+
if (headerInstance) {
|
|
1278
|
+
instances.unshift(headerInstance);
|
|
1281
1279
|
}
|
|
1282
1280
|
} else {
|
|
1283
1281
|
var controlIdMapping = this.getControlIdMapping();
|
|
1284
1282
|
var _Object_entries_find;
|
|
1285
|
-
var _ref =
|
|
1286
|
-
var _param =
|
|
1283
|
+
var _ref = _sliced_to_array((_Object_entries_find = Object.entries(controlIdMapping).find(function(param) {
|
|
1284
|
+
var _param = _sliced_to_array(param, 2), _ = _param[0], mapping = _param[1];
|
|
1287
1285
|
return mapping.children && controlId in mapping.children;
|
|
1288
1286
|
})) !== null && _Object_entries_find !== void 0 ? _Object_entries_find : [], 1), subtableId = _ref[0];
|
|
1289
1287
|
if (subtableId) {
|
|
@@ -1493,7 +1491,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1493
1491
|
args[_key] = arguments[_key];
|
|
1494
1492
|
}
|
|
1495
1493
|
var _this_runtime;
|
|
1496
|
-
return (_this_runtime = this.runtime).registerControlConfig.apply(_this_runtime,
|
|
1494
|
+
return (_this_runtime = this.runtime).registerControlConfig.apply(_this_runtime, _to_consumable_array(args));
|
|
1497
1495
|
}
|
|
1498
1496
|
},
|
|
1499
1497
|
{
|
|
@@ -1507,7 +1505,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1507
1505
|
value: function inList(controlId) {
|
|
1508
1506
|
var mapping = this.store.controlIdMapping;
|
|
1509
1507
|
var result = Object.keys(mapping).some(function(key) {
|
|
1510
|
-
var
|
|
1508
|
+
var _mapping_key_children, _mapping_key;
|
|
1511
1509
|
return (_mapping_key = mapping[key]) === null || _mapping_key === void 0 ? void 0 : (_mapping_key_children = _mapping_key.children) === null || _mapping_key_children === void 0 ? void 0 : _mapping_key_children.hasOwnProperty(controlId);
|
|
1512
1510
|
});
|
|
1513
1511
|
return result;
|
|
@@ -1522,7 +1520,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1522
1520
|
arg[_key] = arguments[_key];
|
|
1523
1521
|
}
|
|
1524
1522
|
var _Runtime;
|
|
1525
|
-
return (_Runtime = Runtime).register.apply(_Runtime,
|
|
1523
|
+
return (_Runtime = Runtime).register.apply(_Runtime, _to_consumable_array(arg));
|
|
1526
1524
|
}
|
|
1527
1525
|
},
|
|
1528
1526
|
{
|
|
@@ -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,
|
|
@@ -34,10 +34,10 @@ import { log } from "@byteluck-fe/model-driven-shared";
|
|
|
34
34
|
var OkWorker = /*#__PURE__*/ function() {
|
|
35
35
|
"use strict";
|
|
36
36
|
function OkWorker() {
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
_class_call_check(this, OkWorker);
|
|
38
|
+
_define_property(this, "worker", void 0);
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
_create_class(OkWorker, [
|
|
41
41
|
{
|
|
42
42
|
key: "run",
|
|
43
43
|
value: function run(initState) {
|
|
@@ -77,7 +77,9 @@ var OkWorker = /*#__PURE__*/ function() {
|
|
|
77
77
|
key: "createWorkerFunction",
|
|
78
78
|
value: function createWorkerFunction() {
|
|
79
79
|
return function() {
|
|
80
|
-
|
|
80
|
+
log("\uD83D\uDE80 worker running");
|
|
81
|
+
var _self = self;
|
|
82
|
+
function createHandler(parentKey) {
|
|
81
83
|
return {
|
|
82
84
|
get: function get(target, key, value) {
|
|
83
85
|
return Reflect.get(target, key, value);
|
|
@@ -92,9 +94,7 @@ var OkWorker = /*#__PURE__*/ function() {
|
|
|
92
94
|
return Reflect.set(target, key, value);
|
|
93
95
|
}
|
|
94
96
|
};
|
|
95
|
-
}
|
|
96
|
-
log("\uD83D\uDE80 worker running");
|
|
97
|
-
var _self = self;
|
|
97
|
+
}
|
|
98
98
|
// function createProxy(
|
|
99
99
|
// obj: Record<string, unknown> | Array<Record<string, unknown>>,
|
|
100
100
|
// parentKey?: string
|
|
@@ -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 };
|