@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,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,12 +109,12 @@ 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
|
-
function
|
|
114
|
+
function _iterable_to_array(iter) {
|
|
115
115
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function _iterable_to_array_limit(arr, i) {
|
|
118
118
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
119
119
|
if (_i == null) return;
|
|
120
120
|
var _arr = [];
|
|
@@ -138,13 +138,13 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
138
138
|
}
|
|
139
139
|
return _arr;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
141
|
+
function _non_iterable_rest() {
|
|
142
142
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function _non_iterable_spread() {
|
|
145
145
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function _object_spread(target) {
|
|
148
148
|
for(var i = 1; i < arguments.length; i++){
|
|
149
149
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
150
150
|
var ownKeys = Object.keys(source);
|
|
@@ -154,7 +154,7 @@ function _objectSpread(target) {
|
|
|
154
154
|
}));
|
|
155
155
|
}
|
|
156
156
|
ownKeys.forEach(function(key) {
|
|
157
|
-
|
|
157
|
+
_define_property(target, key, source[key]);
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
160
|
return target;
|
|
@@ -172,7 +172,7 @@ function ownKeys(object, enumerableOnly) {
|
|
|
172
172
|
}
|
|
173
173
|
return keys;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function _object_spread_props(target, source) {
|
|
176
176
|
source = source != null ? source : {};
|
|
177
177
|
if (Object.getOwnPropertyDescriptors) {
|
|
178
178
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
@@ -183,45 +183,45 @@ function _objectSpreadProps(target, source) {
|
|
|
183
183
|
}
|
|
184
184
|
return target;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
187
|
-
if (call && (
|
|
186
|
+
function _possible_constructor_return(self, call) {
|
|
187
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
188
188
|
return call;
|
|
189
189
|
}
|
|
190
|
-
return
|
|
190
|
+
return _assert_this_initialized(self);
|
|
191
191
|
}
|
|
192
|
-
function
|
|
193
|
-
|
|
192
|
+
function _set_prototype_of(o, p) {
|
|
193
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
194
194
|
o.__proto__ = p;
|
|
195
195
|
return o;
|
|
196
196
|
};
|
|
197
|
-
return
|
|
197
|
+
return _set_prototype_of(o, p);
|
|
198
198
|
}
|
|
199
|
-
function
|
|
200
|
-
return
|
|
199
|
+
function _sliced_to_array(arr, i) {
|
|
200
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function _super_prop_base(object, property) {
|
|
203
203
|
while(!Object.prototype.hasOwnProperty.call(object, property)){
|
|
204
|
-
object =
|
|
204
|
+
object = _get_prototype_of(object);
|
|
205
205
|
if (object === null) break;
|
|
206
206
|
}
|
|
207
207
|
return object;
|
|
208
208
|
}
|
|
209
|
-
function
|
|
210
|
-
return
|
|
209
|
+
function _to_consumable_array(arr) {
|
|
210
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
211
211
|
}
|
|
212
|
-
|
|
212
|
+
function _type_of(obj) {
|
|
213
213
|
"@swc/helpers - typeof";
|
|
214
214
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
215
|
-
}
|
|
216
|
-
function
|
|
215
|
+
}
|
|
216
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
217
217
|
if (!o) return;
|
|
218
|
-
if (typeof o === "string") return
|
|
218
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
219
219
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
220
220
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
221
221
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
222
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
222
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function _is_native_reflect_construct() {
|
|
225
225
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
226
226
|
if (Reflect.construct.sham) return false;
|
|
227
227
|
if (typeof Proxy === "function") return true;
|
|
@@ -232,20 +232,20 @@ function _isNativeReflectConstruct() {
|
|
|
232
232
|
return false;
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
function
|
|
236
|
-
var hasNativeReflectConstruct =
|
|
235
|
+
function _create_super(Derived) {
|
|
236
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
237
237
|
return function _createSuperInternal() {
|
|
238
|
-
var Super =
|
|
238
|
+
var Super = _get_prototype_of(Derived), result;
|
|
239
239
|
if (hasNativeReflectConstruct) {
|
|
240
|
-
var NewTarget =
|
|
240
|
+
var NewTarget = _get_prototype_of(this).constructor;
|
|
241
241
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
242
242
|
} else {
|
|
243
243
|
result = Super.apply(this, arguments);
|
|
244
244
|
}
|
|
245
|
-
return
|
|
245
|
+
return _possible_constructor_return(this, result);
|
|
246
246
|
};
|
|
247
247
|
}
|
|
248
|
-
|
|
248
|
+
function _ts_generator(thisArg, body) {
|
|
249
249
|
var f, y, t, g, _ = {
|
|
250
250
|
label: 0,
|
|
251
251
|
sent: function() {
|
|
@@ -339,7 +339,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
339
339
|
done: true
|
|
340
340
|
};
|
|
341
341
|
}
|
|
342
|
-
}
|
|
342
|
+
}
|
|
343
343
|
import { isDataBind } from "@byteluck-fe/model-driven-core";
|
|
344
344
|
import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, RulesMessage, updateValueFromKeys, warn, Watcher } from "@byteluck-fe/model-driven-shared";
|
|
345
345
|
import { Runtime } from "./Runtime";
|
|
@@ -360,29 +360,29 @@ var applyingPluginName = "";
|
|
|
360
360
|
var Engine = /*#__PURE__*/ function(Watcher) {
|
|
361
361
|
"use strict";
|
|
362
362
|
_inherits(Engine, Watcher);
|
|
363
|
-
var _super =
|
|
363
|
+
var _super = _create_super(Engine);
|
|
364
364
|
function Engine(props) {
|
|
365
|
-
|
|
365
|
+
_class_call_check(this, Engine);
|
|
366
366
|
var _this;
|
|
367
367
|
_this = _super.call(this);
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
368
|
+
_define_property(_assert_this_initialized(_this), "store", void 0);
|
|
369
|
+
_define_property(_assert_this_initialized(_this), "rawStore", {});
|
|
370
|
+
_define_property(_assert_this_initialized(_this), "parent", void 0);
|
|
371
371
|
// 提供注册运行态控件以及实例化控件的能力
|
|
372
|
-
|
|
372
|
+
_define_property(_assert_this_initialized(_this), "runtime", void 0);
|
|
373
373
|
// 提供子线程处理脚本以及修改数据的能力
|
|
374
374
|
// public worker: OkWorker
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
375
|
+
_define_property(_assert_this_initialized(_this), "isMounted", false);
|
|
376
|
+
_define_property(_assert_this_initialized(_this), "id", genNonDuplicateId(8));
|
|
377
|
+
_define_property(_assert_this_initialized(_this), "externalParams", void 0);
|
|
378
378
|
// 提供外部注册插件,在不同的hooks触发时执行固定函数的能力
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
379
|
+
_define_property(_assert_this_initialized(_this), "__plugins", void 0);
|
|
380
|
+
_define_property(_assert_this_initialized(_this), "__pluginsApplied", false);
|
|
381
|
+
_define_property(_assert_this_initialized(_this), "$options", void 0);
|
|
382
|
+
_define_property(_assert_this_initialized(_this), "actionManager", new ActionManager());
|
|
383
|
+
_define_property(_assert_this_initialized(_this), "dataManager", void 0);
|
|
384
|
+
_define_property(_assert_this_initialized(_this), "_jobTasks", []);
|
|
385
|
+
_define_property(_assert_this_initialized(_this), "createControlInstance", _this.createInstance);
|
|
386
386
|
_this.$options = Object.freeze(props);
|
|
387
387
|
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,
|
|
388
388
|
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;
|
|
@@ -401,14 +401,14 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
401
401
|
autoMount && _this.mount();
|
|
402
402
|
return _this;
|
|
403
403
|
}
|
|
404
|
-
|
|
404
|
+
_create_class(Engine, [
|
|
405
405
|
{
|
|
406
406
|
key: "debugLog",
|
|
407
407
|
value: function debugLog() {
|
|
408
408
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
409
409
|
args[_key] = arguments[_key];
|
|
410
410
|
}
|
|
411
|
-
this.debug && log.apply(void 0,
|
|
411
|
+
this.debug && log.apply(void 0, _to_consumable_array(args));
|
|
412
412
|
}
|
|
413
413
|
},
|
|
414
414
|
{
|
|
@@ -428,7 +428,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
428
428
|
arg[_key] = arguments[_key];
|
|
429
429
|
}
|
|
430
430
|
var _this_runtime;
|
|
431
|
-
(_this_runtime = this.runtime).register.apply(_this_runtime,
|
|
431
|
+
(_this_runtime = this.runtime).register.apply(_this_runtime, _to_consumable_array(arg));
|
|
432
432
|
return this;
|
|
433
433
|
}
|
|
434
434
|
},
|
|
@@ -474,6 +474,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
474
474
|
}
|
|
475
475
|
// @ts-ignore
|
|
476
476
|
if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE)) {
|
|
477
|
+
var _newValue;
|
|
477
478
|
if (newValue === null) {
|
|
478
479
|
return [];
|
|
479
480
|
}
|
|
@@ -488,7 +489,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
488
489
|
}, {});
|
|
489
490
|
// @ts-ignore
|
|
490
491
|
var emptyState = this.getEmptyState(instance.id);
|
|
491
|
-
return newValue === null ||
|
|
492
|
+
return (_newValue = newValue) === null || _newValue === void 0 ? void 0 : _newValue.map(function(row) {
|
|
492
493
|
return(// @ts-ignore
|
|
493
494
|
checkerSubtableValue(fieldTypeMap, row, emptyState));
|
|
494
495
|
});
|
|
@@ -517,9 +518,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
517
518
|
key: "_handlerArrayUpdate",
|
|
518
519
|
value: function _handlerArrayUpdate(state, key, type, args, result) {
|
|
519
520
|
var _this = this;
|
|
521
|
+
var _subtable;
|
|
520
522
|
var subtable = findItem(this.runtime.flatInstances, key, this.runtime.instanceMap);
|
|
521
523
|
// if (!(subtable instanceof RuntimeListControl)) return
|
|
522
|
-
if (!((subtable === null ||
|
|
524
|
+
if (!(((_subtable = subtable) === null || _subtable === void 0 ? void 0 : _subtable.controlType) === CONTROL_BASE_TYPE.LIST)) return;
|
|
523
525
|
// 新增多行方法
|
|
524
526
|
var createRows = function(len) {
|
|
525
527
|
// @ts-ignore
|
|
@@ -547,7 +549,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
547
549
|
var newRowLengths = args.length;
|
|
548
550
|
createdNewRows = createRows(newRowLengths);
|
|
549
551
|
createdNewRowsData = args;
|
|
550
|
-
(_subtable_children = subtable.children)[type].apply(_subtable_children,
|
|
552
|
+
(_subtable_children = subtable.children)[type].apply(_subtable_children, _to_consumable_array(createdNewRows));
|
|
551
553
|
this.runtime.getFlatInstances();
|
|
552
554
|
break;
|
|
553
555
|
case "splice":
|
|
@@ -565,7 +567,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
565
567
|
(_subtable_children1 = subtable.children)[type].apply(_subtable_children1, [
|
|
566
568
|
start,
|
|
567
569
|
replace
|
|
568
|
-
].concat(
|
|
570
|
+
].concat(_to_consumable_array(createdNewRows)));
|
|
569
571
|
this.runtime.getFlatInstances();
|
|
570
572
|
// newValues.forEach((item: any, index) => {
|
|
571
573
|
// let newIndex = start + index
|
|
@@ -581,14 +583,14 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
581
583
|
if (start1 + replace1 === subtable.children.length - 1) {
|
|
582
584
|
isDeleteLastOne = true;
|
|
583
585
|
}
|
|
584
|
-
(_subtable_children2 = subtable.children)[type].apply(_subtable_children2,
|
|
586
|
+
(_subtable_children2 = subtable.children)[type].apply(_subtable_children2, _to_consumable_array(args));
|
|
585
587
|
this.runtime.getFlatInstances();
|
|
586
588
|
}
|
|
587
589
|
break;
|
|
588
590
|
default:
|
|
589
591
|
var // @ts-ignore
|
|
590
592
|
_subtable_children3;
|
|
591
|
-
(_subtable_children3 = subtable.children)[type].apply(_subtable_children3,
|
|
593
|
+
(_subtable_children3 = subtable.children)[type].apply(_subtable_children3, _to_consumable_array(args));
|
|
592
594
|
this.runtime.getFlatInstances();
|
|
593
595
|
break;
|
|
594
596
|
}
|
|
@@ -640,7 +642,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
640
642
|
var row = this.listControlCreateRow(instance, "subtable-row");
|
|
641
643
|
row && newRows.push(row);
|
|
642
644
|
}
|
|
643
|
-
(_instance_children = instance.children).push.apply(_instance_children,
|
|
645
|
+
(_instance_children = instance.children).push.apply(_instance_children, _to_consumable_array(newRows));
|
|
644
646
|
this.runtime.getFlatInstances();
|
|
645
647
|
// 这里已经能拿到控件实例,所以在这里触发setStates,触发每一行每一个控件的change事件
|
|
646
648
|
// for (let i = 0; i < newValue.length; i++) {
|
|
@@ -649,7 +651,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
649
651
|
this.emit("list-change", {
|
|
650
652
|
instance: instance,
|
|
651
653
|
value: value,
|
|
652
|
-
options:
|
|
654
|
+
options: _object_spread_props(_object_spread({}, options), {
|
|
653
655
|
// @ts-ignore
|
|
654
656
|
changed: newRows,
|
|
655
657
|
data: newValue,
|
|
@@ -661,7 +663,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
661
663
|
instance: instance,
|
|
662
664
|
value: this.getState(instance.id, index),
|
|
663
665
|
rowIndex: index,
|
|
664
|
-
options:
|
|
666
|
+
options: _object_spread_props(_object_spread({}, options), {
|
|
665
667
|
oldValue: oldValue
|
|
666
668
|
})
|
|
667
669
|
});
|
|
@@ -700,7 +702,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
700
702
|
var template = JSONCopy(instance.props.headers);
|
|
701
703
|
// @ts-ignore
|
|
702
704
|
var columns = this.createControl(template);
|
|
703
|
-
(_inst_children = inst.children).push.apply(_inst_children,
|
|
705
|
+
(_inst_children = inst.children).push.apply(_inst_children, _to_consumable_array(columns));
|
|
704
706
|
}
|
|
705
707
|
return row;
|
|
706
708
|
}
|
|
@@ -721,11 +723,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
721
723
|
function emit(eventKey, payload) {
|
|
722
724
|
var _this = this;
|
|
723
725
|
var _this1 = this, _superprop_get_emit = function() {
|
|
724
|
-
return _get(
|
|
726
|
+
return _get(_get_prototype_of(Engine.prototype), "emit", _this);
|
|
725
727
|
};
|
|
726
|
-
return
|
|
728
|
+
return _async_to_generator(function() {
|
|
727
729
|
var needWait, promiseResolver, promise, results;
|
|
728
|
-
return
|
|
730
|
+
return _ts_generator(this, function(_state) {
|
|
729
731
|
switch(_state.label){
|
|
730
732
|
case 0:
|
|
731
733
|
if (!(eventKey === "engine-mounted")) return [
|
|
@@ -744,7 +746,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
744
746
|
2
|
|
745
747
|
];
|
|
746
748
|
console.time("engine-mounted need wait");
|
|
747
|
-
needWait =
|
|
749
|
+
needWait = _to_consumable_array(_this1._jobTasks);
|
|
748
750
|
return [
|
|
749
751
|
4,
|
|
750
752
|
Promise.all(needWait)
|
|
@@ -790,7 +792,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
790
792
|
if (applyingPluginName) {
|
|
791
793
|
callback.applyingPluginName = applyingPluginName;
|
|
792
794
|
}
|
|
793
|
-
return _get(
|
|
795
|
+
return _get(_get_prototype_of(Engine.prototype), "on", this).call(this, key, callback);
|
|
794
796
|
}
|
|
795
797
|
},
|
|
796
798
|
{
|
|
@@ -800,7 +802,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
800
802
|
args[_key] = arguments[_key];
|
|
801
803
|
}
|
|
802
804
|
var _this_runtime;
|
|
803
|
-
return (_this_runtime = this.runtime).createControl.apply(_this_runtime,
|
|
805
|
+
return (_this_runtime = this.runtime).createControl.apply(_this_runtime, _to_consumable_array(args));
|
|
804
806
|
}
|
|
805
807
|
},
|
|
806
808
|
{
|
|
@@ -907,7 +909,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
907
909
|
var newStates = states !== null && states !== void 0 ? states : {};
|
|
908
910
|
Object.keys(newStates).forEach(function(stateId) {
|
|
909
911
|
Object.entries(_this.store.controlIdMapping).forEach(function(param) {
|
|
910
|
-
var _param =
|
|
912
|
+
var _param = _sliced_to_array(param, 2), controlId = _param[0], controlIdMapping = _param[1];
|
|
911
913
|
if (controlIdMapping.dataView === stateId) {
|
|
912
914
|
// state对象是dataView包裹的
|
|
913
915
|
var value = newStates[stateId][controlId];
|
|
@@ -951,7 +953,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
951
953
|
//if (dataBind instanceof ObjectDataBind) {
|
|
952
954
|
if (!isDataBind(dataBind)) {
|
|
953
955
|
return Object.entries(dataBind).reduce(function(result, param) {
|
|
954
|
-
var _param =
|
|
956
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], dataBind = _param[1];
|
|
955
957
|
// objectDataBind的元素,跳过下一次赋值
|
|
956
958
|
if (dataBind.fieldCode === fieldCode) {
|
|
957
959
|
return result[key];
|
|
@@ -977,8 +979,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
977
979
|
var data = getFieldData.map(function(item) {
|
|
978
980
|
var obj = {};
|
|
979
981
|
for(var key in item){
|
|
980
|
-
var _controlIdMapping_controlId_children_key, _controlIdMapping_controlId
|
|
981
|
-
var fieldCode = (
|
|
982
|
+
var _controlIdMapping_controlId_children_key_dataBind, _controlIdMapping_controlId_children_key, _controlIdMapping_controlId;
|
|
983
|
+
var fieldCode = (_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;
|
|
982
984
|
//未绑定字段的控件,直接抛弃
|
|
983
985
|
if (fieldCode !== "") {
|
|
984
986
|
var _controlIdMapping_controlId1;
|
|
@@ -988,7 +990,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
988
990
|
// 兼容一个控件需要绑定多个字段的情况
|
|
989
991
|
for(var keyChi in item[key]){
|
|
990
992
|
var _controlIdMapping_controlId_children_key1, _controlIdMapping_controlId2;
|
|
991
|
-
obj[(
|
|
993
|
+
obj[(_controlIdMapping_controlId2 = controlIdMapping[controlId]) === null || _controlIdMapping_controlId2 === void 0 ? void 0 : (_controlIdMapping_controlId_children_key1 = _controlIdMapping_controlId2.children[key]) === null || _controlIdMapping_controlId_children_key1 === void 0 ? void 0 : _controlIdMapping_controlId_children_key1.dataBind[keyChi].fieldCode] = item[key][keyChi];
|
|
992
994
|
}
|
|
993
995
|
}
|
|
994
996
|
}
|
|
@@ -998,7 +1000,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
998
1000
|
return data;
|
|
999
1001
|
} else {
|
|
1000
1002
|
var _loop = function(key) {
|
|
1001
|
-
var _controlIdMapping_key,
|
|
1003
|
+
var _controlIdMapping_key_dataBind, _controlIdMapping_key, _controlIdMapping_key_dataBind1, _controlIdMapping_key1;
|
|
1002
1004
|
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) {
|
|
1003
1005
|
var _controlIdMapping_key2;
|
|
1004
1006
|
obj[(_controlIdMapping_key2 = controlIdMapping[key]) === null || _controlIdMapping_key2 === void 0 ? void 0 : _controlIdMapping_key2.dataBind.fieldCode] = getFieldData[key];
|
|
@@ -1028,7 +1030,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1028
1030
|
// 兼容一个控件需要绑定多个字段的情况
|
|
1029
1031
|
for(var keyChi in getFieldData[key]){
|
|
1030
1032
|
var _controlIdMapping_key_dataBind_keyChi, _controlIdMapping_key4;
|
|
1031
|
-
obj[(
|
|
1033
|
+
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];
|
|
1032
1034
|
}
|
|
1033
1035
|
}
|
|
1034
1036
|
};
|
|
@@ -1062,7 +1064,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1062
1064
|
var oldState = (_JSONCopy = JSONCopy(this.getState(controlId, rowIndex))) !== null && _JSONCopy !== void 0 ? _JSONCopy : this.getEmptyState(controlId);
|
|
1063
1065
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
1064
1066
|
var newState = Object.entries(dataBind).reduce(function(result, param) {
|
|
1065
|
-
var _param =
|
|
1067
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], dataBind = _param[1];
|
|
1066
1068
|
// objectDataBind的元素,跳过下一次赋值
|
|
1067
1069
|
if (dataBind.fieldCode === fieldCode) {
|
|
1068
1070
|
result[key] = value;
|
|
@@ -1105,7 +1107,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1105
1107
|
var oldState = (_JSONCopy = JSONCopy(_this.getState(controlId, rowIndex))) !== null && _JSONCopy !== void 0 ? _JSONCopy : _this.getEmptyState(controlId);
|
|
1106
1108
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
1107
1109
|
var newState = Object.entries(dataBind).reduce(function(result, param) {
|
|
1108
|
-
var _param =
|
|
1110
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], dataBind = _param[1];
|
|
1109
1111
|
// objectDataBind的元素,跳过下一次赋值
|
|
1110
1112
|
skipKeys.push(dataBind.fieldCode);
|
|
1111
1113
|
var value = state[dataBind.fieldCode];
|
|
@@ -1149,7 +1151,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1149
1151
|
var oldState = _this.getEmptyState(controlId);
|
|
1150
1152
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
1151
1153
|
result[item.controlId] = Object.entries(dataBind).reduce(function(result, param) {
|
|
1152
|
-
var _param =
|
|
1154
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], dataBind = _param[1];
|
|
1153
1155
|
// objectDataBind的元素,跳过下一次赋值
|
|
1154
1156
|
skipKeys.push(dataBind.fieldCode);
|
|
1155
1157
|
var value = state[dataBind.fieldCode];
|
|
@@ -1196,7 +1198,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1196
1198
|
var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
|
|
1197
1199
|
;
|
|
1198
1200
|
Object.keys(row).map(function(fieldCode) {
|
|
1199
|
-
var
|
|
1201
|
+
var _this_store_dataBindMapping_dataCode_fields, _this_store_dataBindMapping_dataCode;
|
|
1200
1202
|
if (skipKey.includes(fieldCode)) {
|
|
1201
1203
|
return;
|
|
1202
1204
|
}
|
|
@@ -1262,19 +1264,22 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1262
1264
|
}
|
|
1263
1265
|
var newMapping = _this.getDataBindMapping(dataCode);
|
|
1264
1266
|
if (newMapping) {
|
|
1265
|
-
var _newMapping_fields;
|
|
1266
|
-
var mappingKeys = newMapping === null ||
|
|
1267
|
-
|
|
1267
|
+
var _newMapping_fields, _newMapping, _newMapping1, _newMapping2, _newState, _mappingKeys;
|
|
1268
|
+
var mappingKeys = (_newMapping = newMapping) === null || _newMapping === void 0 ? void 0 : (_newMapping_fields = _newMapping.fields) === null || _newMapping_fields === void 0 ? void 0 : _newMapping_fields.map(function(item) {
|
|
1269
|
+
var _item;
|
|
1270
|
+
return (_item = item) === null || _item === void 0 ? void 0 : _item.controlId;
|
|
1268
1271
|
});
|
|
1269
|
-
var mappingValue = _this.getEmptyState(newMapping === null ||
|
|
1272
|
+
var mappingValue = _this.getEmptyState((_newMapping1 = newMapping) === null || _newMapping1 === void 0 ? void 0 : _newMapping1.controlId);
|
|
1270
1273
|
var _newState_newMapping_controlId;
|
|
1271
|
-
var mainStateKeys = Object.keys((_newState_newMapping_controlId = newState === null ||
|
|
1272
|
-
mappingKeys === null ||
|
|
1273
|
-
|
|
1274
|
+
var mainStateKeys = Object.keys((_newState_newMapping_controlId = (_newState = newState) === null || _newState === void 0 ? void 0 : _newState[(_newMapping2 = newMapping) === null || _newMapping2 === void 0 ? void 0 : _newMapping2.controlId]) !== null && _newState_newMapping_controlId !== void 0 ? _newState_newMapping_controlId : {});
|
|
1275
|
+
(_mappingKeys = mappingKeys) === null || _mappingKeys === void 0 ? void 0 : _mappingKeys.forEach(function(key) {
|
|
1276
|
+
var _newMapping;
|
|
1277
|
+
if (!mainStateKeys.includes(key) && key !== "uid" && newState[(_newMapping = newMapping) === null || _newMapping === void 0 ? void 0 : _newMapping.controlId]) {
|
|
1274
1278
|
if (Object.keys(newState).length) {
|
|
1275
|
-
|
|
1279
|
+
var _newMapping1;
|
|
1280
|
+
Object.assign(newState[(_newMapping1 = newMapping) === null || _newMapping1 === void 0 ? void 0 : _newMapping1.controlId], _define_property({}, key, mappingValue[key]));
|
|
1276
1281
|
} else {
|
|
1277
|
-
Object.assign(newState,
|
|
1282
|
+
Object.assign(newState, _define_property({}, newMapping.controlId, _define_property({}, key, mappingValue[key])));
|
|
1278
1283
|
}
|
|
1279
1284
|
}
|
|
1280
1285
|
});
|
|
@@ -1349,8 +1354,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1349
1354
|
var _this_getControlIdMapping;
|
|
1350
1355
|
var controlIdMapping = (_this_getControlIdMapping = this.getControlIdMapping()) !== null && _this_getControlIdMapping !== void 0 ? _this_getControlIdMapping : {};
|
|
1351
1356
|
var _Object_entries_find;
|
|
1352
|
-
var _ref =
|
|
1353
|
-
var _param =
|
|
1357
|
+
var _ref = _sliced_to_array((_Object_entries_find = Object.entries(controlIdMapping).find(function(param) {
|
|
1358
|
+
var _param = _sliced_to_array(param, 2), _ = _param[0], mapping = _param[1];
|
|
1354
1359
|
return mapping.children && controlId in mapping.children;
|
|
1355
1360
|
})) !== null && _Object_entries_find !== void 0 ? _Object_entries_find : [], 1), subtableId = _ref[0];
|
|
1356
1361
|
if (subtableId) {
|
|
@@ -1580,7 +1585,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1580
1585
|
args[_key] = arguments[_key];
|
|
1581
1586
|
}
|
|
1582
1587
|
var _this_runtime;
|
|
1583
|
-
return (_this_runtime = this.runtime).registerControlConfig.apply(_this_runtime,
|
|
1588
|
+
return (_this_runtime = this.runtime).registerControlConfig.apply(_this_runtime, _to_consumable_array(args));
|
|
1584
1589
|
}
|
|
1585
1590
|
},
|
|
1586
1591
|
{
|
|
@@ -1596,7 +1601,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1596
1601
|
var mapping = (_this_store_controlIdMapping = this.store.controlIdMapping) !== null && _this_store_controlIdMapping !== void 0 ? _this_store_controlIdMapping : {};
|
|
1597
1602
|
var listKey = undefined;
|
|
1598
1603
|
Object.keys(mapping).some(function(key) {
|
|
1599
|
-
var
|
|
1604
|
+
var _mapping_key_children, _mapping_key;
|
|
1600
1605
|
var matched = (_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);
|
|
1601
1606
|
if (matched) {
|
|
1602
1607
|
listKey = key;
|
|
@@ -1615,7 +1620,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1615
1620
|
arg[_key] = arguments[_key];
|
|
1616
1621
|
}
|
|
1617
1622
|
var _Runtime;
|
|
1618
|
-
return (_Runtime = Runtime).register.apply(_Runtime,
|
|
1623
|
+
return (_Runtime = Runtime).register.apply(_Runtime, _to_consumable_array(arg));
|
|
1619
1624
|
}
|
|
1620
1625
|
},
|
|
1621
1626
|
{
|
|
@@ -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) {
|