@byteluck-fe/model-driven-engine 2.7.0-alpha.23 → 2.7.0-alpha.25
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 +108 -113
- 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 +16 -17
- package/dist/esm/common/checkerValue.js +71 -73
- package/dist/esm/common/proxyState.js +16 -17
- package/dist/esm/plugins/CalcPlugin.js +27 -28
- 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 +2 -4
- package/dist/index.umd.js +9 -9
- package/package.json +4 -4
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _arrayLikeToArray(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 _arrayWithHoles(arr) {
|
|
7
7
|
if (Array.isArray(arr)) return arr;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
if (Array.isArray(arr)) return
|
|
9
|
+
function _arrayWithoutHoles(arr) {
|
|
10
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function _assertThisInitialized(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 _asyncToGenerator(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 _async_to_generator(fn) {
|
|
|
44
44
|
});
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function _classCallCheck(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 _createClass(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 _defineProperty(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 = _superPropBase(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);
|
|
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 _getPrototypeOf(o) {
|
|
96
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
97
97
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
98
98
|
};
|
|
99
|
-
return
|
|
99
|
+
return _getPrototypeOf(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) _setPrototypeOf(subClass, superClass);
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function _iterableToArray(iter) {
|
|
115
115
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function _iterableToArrayLimit(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 _iterable_to_array_limit(arr, i) {
|
|
|
138
138
|
}
|
|
139
139
|
return _arr;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
141
|
+
function _nonIterableRest() {
|
|
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 _nonIterableSpread() {
|
|
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 _objectSpread(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 _object_spread(target) {
|
|
|
154
154
|
}));
|
|
155
155
|
}
|
|
156
156
|
ownKeys.forEach(function(key) {
|
|
157
|
-
|
|
157
|
+
_defineProperty(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 _objectSpreadProps(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 _object_spread_props(target, source) {
|
|
|
183
183
|
}
|
|
184
184
|
return target;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
187
|
-
if (call && (
|
|
186
|
+
function _possibleConstructorReturn(self, call) {
|
|
187
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
188
188
|
return call;
|
|
189
189
|
}
|
|
190
|
-
return
|
|
190
|
+
return _assertThisInitialized(self);
|
|
191
191
|
}
|
|
192
|
-
function
|
|
193
|
-
|
|
192
|
+
function _setPrototypeOf(o, p) {
|
|
193
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
194
194
|
o.__proto__ = p;
|
|
195
195
|
return o;
|
|
196
196
|
};
|
|
197
|
-
return
|
|
197
|
+
return _setPrototypeOf(o, p);
|
|
198
198
|
}
|
|
199
|
-
function
|
|
200
|
-
return
|
|
199
|
+
function _slicedToArray(arr, i) {
|
|
200
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function _superPropBase(object, property) {
|
|
203
203
|
while(!Object.prototype.hasOwnProperty.call(object, property)){
|
|
204
|
-
object =
|
|
204
|
+
object = _getPrototypeOf(object);
|
|
205
205
|
if (object === null) break;
|
|
206
206
|
}
|
|
207
207
|
return object;
|
|
208
208
|
}
|
|
209
|
-
function
|
|
210
|
-
return
|
|
209
|
+
function _toConsumableArray(arr) {
|
|
210
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
var _typeof = function(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 _unsupportedIterableToArray(o, minLen) {
|
|
217
217
|
if (!o) return;
|
|
218
|
-
if (typeof o === "string") return
|
|
218
|
+
if (typeof o === "string") return _arrayLikeToArray(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 _arrayLikeToArray(o, minLen);
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function _isNativeReflectConstruct() {
|
|
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 _is_native_reflect_construct() {
|
|
|
232
232
|
return false;
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
function
|
|
236
|
-
var hasNativeReflectConstruct =
|
|
235
|
+
function _createSuper(Derived) {
|
|
236
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
237
237
|
return function _createSuperInternal() {
|
|
238
|
-
var Super =
|
|
238
|
+
var Super = _getPrototypeOf(Derived), result;
|
|
239
239
|
if (hasNativeReflectConstruct) {
|
|
240
|
-
var NewTarget =
|
|
240
|
+
var NewTarget = _getPrototypeOf(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 _possibleConstructorReturn(this, result);
|
|
246
246
|
};
|
|
247
247
|
}
|
|
248
|
-
function
|
|
248
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
249
249
|
var f, y, t, g, _ = {
|
|
250
250
|
label: 0,
|
|
251
251
|
sent: function() {
|
|
@@ -339,7 +339,7 @@ function _ts_generator(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 = _createSuper(Engine);
|
|
364
364
|
function Engine(props) {
|
|
365
|
-
|
|
365
|
+
_classCallCheck(this, Engine);
|
|
366
366
|
var _this;
|
|
367
367
|
_this = _super.call(this);
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
368
|
+
_defineProperty(_assertThisInitialized(_this), "store", void 0);
|
|
369
|
+
_defineProperty(_assertThisInitialized(_this), "rawStore", {});
|
|
370
|
+
_defineProperty(_assertThisInitialized(_this), "parent", void 0);
|
|
371
371
|
// 提供注册运行态控件以及实例化控件的能力
|
|
372
|
-
|
|
372
|
+
_defineProperty(_assertThisInitialized(_this), "runtime", void 0);
|
|
373
373
|
// 提供子线程处理脚本以及修改数据的能力
|
|
374
374
|
// public worker: OkWorker
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
375
|
+
_defineProperty(_assertThisInitialized(_this), "isMounted", false);
|
|
376
|
+
_defineProperty(_assertThisInitialized(_this), "id", genNonDuplicateId(8));
|
|
377
|
+
_defineProperty(_assertThisInitialized(_this), "externalParams", void 0);
|
|
378
378
|
// 提供外部注册插件,在不同的hooks触发时执行固定函数的能力
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
379
|
+
_defineProperty(_assertThisInitialized(_this), "__plugins", void 0);
|
|
380
|
+
_defineProperty(_assertThisInitialized(_this), "__pluginsApplied", false);
|
|
381
|
+
_defineProperty(_assertThisInitialized(_this), "$options", void 0);
|
|
382
|
+
_defineProperty(_assertThisInitialized(_this), "actionManager", new ActionManager());
|
|
383
|
+
_defineProperty(_assertThisInitialized(_this), "dataManager", void 0);
|
|
384
|
+
_defineProperty(_assertThisInitialized(_this), "_jobTasks", []);
|
|
385
|
+
_defineProperty(_assertThisInitialized(_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
|
+
_createClass(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, _toConsumableArray(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, _toConsumableArray(arg));
|
|
432
432
|
return this;
|
|
433
433
|
}
|
|
434
434
|
},
|
|
@@ -474,7 +474,6 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
474
474
|
}
|
|
475
475
|
// @ts-ignore
|
|
476
476
|
if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE)) {
|
|
477
|
-
var _newValue;
|
|
478
477
|
if (newValue === null) {
|
|
479
478
|
return [];
|
|
480
479
|
}
|
|
@@ -489,7 +488,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
489
488
|
}, {});
|
|
490
489
|
// @ts-ignore
|
|
491
490
|
var emptyState = this.getEmptyState(instance.id);
|
|
492
|
-
return
|
|
491
|
+
return newValue === null || newValue === void 0 ? void 0 : newValue.map(function(row) {
|
|
493
492
|
return(// @ts-ignore
|
|
494
493
|
checkerSubtableValue(fieldTypeMap, row, emptyState));
|
|
495
494
|
});
|
|
@@ -518,10 +517,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
518
517
|
key: "_handlerArrayUpdate",
|
|
519
518
|
value: function _handlerArrayUpdate(state, key, type, args, result) {
|
|
520
519
|
var _this = this;
|
|
521
|
-
var _subtable;
|
|
522
520
|
var subtable = findItem(this.runtime.flatInstances, key, this.runtime.instanceMap);
|
|
523
521
|
// if (!(subtable instanceof RuntimeListControl)) return
|
|
524
|
-
if (!((
|
|
522
|
+
if (!((subtable === null || subtable === void 0 ? void 0 : subtable.controlType) === CONTROL_BASE_TYPE.LIST)) return;
|
|
525
523
|
// 新增多行方法
|
|
526
524
|
var createRows = function(len) {
|
|
527
525
|
// @ts-ignore
|
|
@@ -549,7 +547,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
549
547
|
var newRowLengths = args.length;
|
|
550
548
|
createdNewRows = createRows(newRowLengths);
|
|
551
549
|
createdNewRowsData = args;
|
|
552
|
-
(_subtable_children = subtable.children)[type].apply(_subtable_children,
|
|
550
|
+
(_subtable_children = subtable.children)[type].apply(_subtable_children, _toConsumableArray(createdNewRows));
|
|
553
551
|
this.runtime.getFlatInstances();
|
|
554
552
|
break;
|
|
555
553
|
case "splice":
|
|
@@ -567,7 +565,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
567
565
|
(_subtable_children1 = subtable.children)[type].apply(_subtable_children1, [
|
|
568
566
|
start,
|
|
569
567
|
replace
|
|
570
|
-
].concat(
|
|
568
|
+
].concat(_toConsumableArray(createdNewRows)));
|
|
571
569
|
this.runtime.getFlatInstances();
|
|
572
570
|
// newValues.forEach((item: any, index) => {
|
|
573
571
|
// let newIndex = start + index
|
|
@@ -583,14 +581,14 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
583
581
|
if (start1 + replace1 === subtable.children.length - 1) {
|
|
584
582
|
isDeleteLastOne = true;
|
|
585
583
|
}
|
|
586
|
-
(_subtable_children2 = subtable.children)[type].apply(_subtable_children2,
|
|
584
|
+
(_subtable_children2 = subtable.children)[type].apply(_subtable_children2, _toConsumableArray(args));
|
|
587
585
|
this.runtime.getFlatInstances();
|
|
588
586
|
}
|
|
589
587
|
break;
|
|
590
588
|
default:
|
|
591
589
|
var // @ts-ignore
|
|
592
590
|
_subtable_children3;
|
|
593
|
-
(_subtable_children3 = subtable.children)[type].apply(_subtable_children3,
|
|
591
|
+
(_subtable_children3 = subtable.children)[type].apply(_subtable_children3, _toConsumableArray(args));
|
|
594
592
|
this.runtime.getFlatInstances();
|
|
595
593
|
break;
|
|
596
594
|
}
|
|
@@ -642,7 +640,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
642
640
|
var row = this.listControlCreateRow(instance, "subtable-row");
|
|
643
641
|
row && newRows.push(row);
|
|
644
642
|
}
|
|
645
|
-
(_instance_children = instance.children).push.apply(_instance_children,
|
|
643
|
+
(_instance_children = instance.children).push.apply(_instance_children, _toConsumableArray(newRows));
|
|
646
644
|
this.runtime.getFlatInstances();
|
|
647
645
|
// 这里已经能拿到控件实例,所以在这里触发setStates,触发每一行每一个控件的change事件
|
|
648
646
|
// for (let i = 0; i < newValue.length; i++) {
|
|
@@ -651,7 +649,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
651
649
|
this.emit("list-change", {
|
|
652
650
|
instance: instance,
|
|
653
651
|
value: value,
|
|
654
|
-
options:
|
|
652
|
+
options: _objectSpreadProps(_objectSpread({}, options), {
|
|
655
653
|
// @ts-ignore
|
|
656
654
|
changed: newRows,
|
|
657
655
|
data: newValue,
|
|
@@ -663,7 +661,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
663
661
|
instance: instance,
|
|
664
662
|
value: this.getState(instance.id, index),
|
|
665
663
|
rowIndex: index,
|
|
666
|
-
options:
|
|
664
|
+
options: _objectSpreadProps(_objectSpread({}, options), {
|
|
667
665
|
oldValue: oldValue
|
|
668
666
|
})
|
|
669
667
|
});
|
|
@@ -702,7 +700,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
702
700
|
var template = JSONCopy(instance.props.headers);
|
|
703
701
|
// @ts-ignore
|
|
704
702
|
var columns = this.createControl(template);
|
|
705
|
-
(_inst_children = inst.children).push.apply(_inst_children,
|
|
703
|
+
(_inst_children = inst.children).push.apply(_inst_children, _toConsumableArray(columns));
|
|
706
704
|
}
|
|
707
705
|
return row;
|
|
708
706
|
}
|
|
@@ -723,11 +721,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
723
721
|
function emit(eventKey, payload) {
|
|
724
722
|
var _this = this;
|
|
725
723
|
var _this1 = this, _superprop_get_emit = function() {
|
|
726
|
-
return _get(
|
|
724
|
+
return _get(_getPrototypeOf(Engine.prototype), "emit", _this);
|
|
727
725
|
};
|
|
728
|
-
return
|
|
726
|
+
return _asyncToGenerator(function() {
|
|
729
727
|
var needWait, promiseResolver, promise, results;
|
|
730
|
-
return
|
|
728
|
+
return __generator(this, function(_state) {
|
|
731
729
|
switch(_state.label){
|
|
732
730
|
case 0:
|
|
733
731
|
if (!(eventKey === "engine-mounted")) return [
|
|
@@ -746,7 +744,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
746
744
|
2
|
|
747
745
|
];
|
|
748
746
|
console.time("engine-mounted need wait");
|
|
749
|
-
needWait =
|
|
747
|
+
needWait = _toConsumableArray(_this1._jobTasks);
|
|
750
748
|
return [
|
|
751
749
|
4,
|
|
752
750
|
Promise.all(needWait)
|
|
@@ -792,7 +790,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
792
790
|
if (applyingPluginName) {
|
|
793
791
|
callback.applyingPluginName = applyingPluginName;
|
|
794
792
|
}
|
|
795
|
-
return _get(
|
|
793
|
+
return _get(_getPrototypeOf(Engine.prototype), "on", this).call(this, key, callback);
|
|
796
794
|
}
|
|
797
795
|
},
|
|
798
796
|
{
|
|
@@ -802,7 +800,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
802
800
|
args[_key] = arguments[_key];
|
|
803
801
|
}
|
|
804
802
|
var _this_runtime;
|
|
805
|
-
return (_this_runtime = this.runtime).createControl.apply(_this_runtime,
|
|
803
|
+
return (_this_runtime = this.runtime).createControl.apply(_this_runtime, _toConsumableArray(args));
|
|
806
804
|
}
|
|
807
805
|
},
|
|
808
806
|
{
|
|
@@ -909,7 +907,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
909
907
|
var newStates = states !== null && states !== void 0 ? states : {};
|
|
910
908
|
Object.keys(newStates).forEach(function(stateId) {
|
|
911
909
|
Object.entries(_this.store.controlIdMapping).forEach(function(param) {
|
|
912
|
-
var _param =
|
|
910
|
+
var _param = _slicedToArray(param, 2), controlId = _param[0], controlIdMapping = _param[1];
|
|
913
911
|
if (controlIdMapping.dataView === stateId) {
|
|
914
912
|
// state对象是dataView包裹的
|
|
915
913
|
var value = newStates[stateId][controlId];
|
|
@@ -953,7 +951,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
953
951
|
//if (dataBind instanceof ObjectDataBind) {
|
|
954
952
|
if (!isDataBind(dataBind)) {
|
|
955
953
|
return Object.entries(dataBind).reduce(function(result, param) {
|
|
956
|
-
var _param =
|
|
954
|
+
var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
|
|
957
955
|
// objectDataBind的元素,跳过下一次赋值
|
|
958
956
|
if (dataBind.fieldCode === fieldCode) {
|
|
959
957
|
return result[key];
|
|
@@ -979,8 +977,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
979
977
|
var data = getFieldData.map(function(item) {
|
|
980
978
|
var obj = {};
|
|
981
979
|
for(var key in item){
|
|
982
|
-
var
|
|
983
|
-
var fieldCode = (_controlIdMapping_controlId = controlIdMapping[controlId]) === null || _controlIdMapping_controlId === void 0 ? void 0 :
|
|
980
|
+
var _controlIdMapping_controlId_children_key, _controlIdMapping_controlId, _controlIdMapping_controlId_children_key_dataBind;
|
|
981
|
+
var fieldCode = (_controlIdMapping_controlId_children_key = (_controlIdMapping_controlId = controlIdMapping[controlId]) === null || _controlIdMapping_controlId === void 0 ? void 0 : _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;
|
|
984
982
|
//未绑定字段的控件,直接抛弃
|
|
985
983
|
if (fieldCode !== "") {
|
|
986
984
|
var _controlIdMapping_controlId1;
|
|
@@ -990,7 +988,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
990
988
|
// 兼容一个控件需要绑定多个字段的情况
|
|
991
989
|
for(var keyChi in item[key]){
|
|
992
990
|
var _controlIdMapping_controlId_children_key1, _controlIdMapping_controlId2;
|
|
993
|
-
obj[(_controlIdMapping_controlId2 = controlIdMapping[controlId]) === null || _controlIdMapping_controlId2 === void 0 ? void 0 :
|
|
991
|
+
obj[(_controlIdMapping_controlId_children_key1 = (_controlIdMapping_controlId2 = controlIdMapping[controlId]) === null || _controlIdMapping_controlId2 === void 0 ? void 0 : _controlIdMapping_controlId2.children[key]) === null || _controlIdMapping_controlId_children_key1 === void 0 ? void 0 : _controlIdMapping_controlId_children_key1.dataBind[keyChi].fieldCode] = item[key][keyChi];
|
|
994
992
|
}
|
|
995
993
|
}
|
|
996
994
|
}
|
|
@@ -1000,7 +998,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1000
998
|
return data;
|
|
1001
999
|
} else {
|
|
1002
1000
|
var _loop = function(key) {
|
|
1003
|
-
var _controlIdMapping_key_dataBind,
|
|
1001
|
+
var _controlIdMapping_key, _controlIdMapping_key_dataBind, _controlIdMapping_key1, _controlIdMapping_key_dataBind1;
|
|
1004
1002
|
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) {
|
|
1005
1003
|
var _controlIdMapping_key2;
|
|
1006
1004
|
obj[(_controlIdMapping_key2 = controlIdMapping[key]) === null || _controlIdMapping_key2 === void 0 ? void 0 : _controlIdMapping_key2.dataBind.fieldCode] = getFieldData[key];
|
|
@@ -1030,7 +1028,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1030
1028
|
// 兼容一个控件需要绑定多个字段的情况
|
|
1031
1029
|
for(var keyChi in getFieldData[key]){
|
|
1032
1030
|
var _controlIdMapping_key_dataBind_keyChi, _controlIdMapping_key4;
|
|
1033
|
-
obj[(_controlIdMapping_key4 = controlIdMapping[key]) === null || _controlIdMapping_key4 === void 0 ? void 0 :
|
|
1031
|
+
obj[(_controlIdMapping_key_dataBind_keyChi = (_controlIdMapping_key4 = controlIdMapping[key]) === null || _controlIdMapping_key4 === void 0 ? void 0 : _controlIdMapping_key4.dataBind[keyChi]) === null || _controlIdMapping_key_dataBind_keyChi === void 0 ? void 0 : _controlIdMapping_key_dataBind_keyChi.fieldCode] = getFieldData[key][keyChi];
|
|
1034
1032
|
}
|
|
1035
1033
|
}
|
|
1036
1034
|
};
|
|
@@ -1064,7 +1062,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1064
1062
|
var oldState = (_JSONCopy = JSONCopy(this.getState(controlId, rowIndex))) !== null && _JSONCopy !== void 0 ? _JSONCopy : this.getEmptyState(controlId);
|
|
1065
1063
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
1066
1064
|
var newState = Object.entries(dataBind).reduce(function(result, param) {
|
|
1067
|
-
var _param =
|
|
1065
|
+
var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
|
|
1068
1066
|
// objectDataBind的元素,跳过下一次赋值
|
|
1069
1067
|
if (dataBind.fieldCode === fieldCode) {
|
|
1070
1068
|
result[key] = value;
|
|
@@ -1107,7 +1105,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1107
1105
|
var oldState = (_JSONCopy = JSONCopy(_this.getState(controlId, rowIndex))) !== null && _JSONCopy !== void 0 ? _JSONCopy : _this.getEmptyState(controlId);
|
|
1108
1106
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
1109
1107
|
var newState = Object.entries(dataBind).reduce(function(result, param) {
|
|
1110
|
-
var _param =
|
|
1108
|
+
var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
|
|
1111
1109
|
// objectDataBind的元素,跳过下一次赋值
|
|
1112
1110
|
skipKeys.push(dataBind.fieldCode);
|
|
1113
1111
|
var value = state[dataBind.fieldCode];
|
|
@@ -1151,7 +1149,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1151
1149
|
var oldState = _this.getEmptyState(controlId);
|
|
1152
1150
|
// fieldCode不代表是key,所以需要找到对应的key
|
|
1153
1151
|
result[item.controlId] = Object.entries(dataBind).reduce(function(result, param) {
|
|
1154
|
-
var _param =
|
|
1152
|
+
var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
|
|
1155
1153
|
// objectDataBind的元素,跳过下一次赋值
|
|
1156
1154
|
skipKeys.push(dataBind.fieldCode);
|
|
1157
1155
|
var value = state[dataBind.fieldCode];
|
|
@@ -1198,7 +1196,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1198
1196
|
var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
|
|
1199
1197
|
;
|
|
1200
1198
|
Object.keys(row).map(function(fieldCode) {
|
|
1201
|
-
var
|
|
1199
|
+
var _this_store_dataBindMapping_dataCode, _this_store_dataBindMapping_dataCode_fields;
|
|
1202
1200
|
if (skipKey.includes(fieldCode)) {
|
|
1203
1201
|
return;
|
|
1204
1202
|
}
|
|
@@ -1264,22 +1262,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1264
1262
|
}
|
|
1265
1263
|
var newMapping = _this.getDataBindMapping(dataCode);
|
|
1266
1264
|
if (newMapping) {
|
|
1267
|
-
var _newMapping_fields
|
|
1268
|
-
var mappingKeys =
|
|
1269
|
-
|
|
1270
|
-
return (_item = item) === null || _item === void 0 ? void 0 : _item.controlId;
|
|
1265
|
+
var _newMapping_fields;
|
|
1266
|
+
var mappingKeys = newMapping === null || newMapping === void 0 ? void 0 : (_newMapping_fields = newMapping.fields) === null || _newMapping_fields === void 0 ? void 0 : _newMapping_fields.map(function(item) {
|
|
1267
|
+
return item === null || item === void 0 ? void 0 : item.controlId;
|
|
1271
1268
|
});
|
|
1272
|
-
var mappingValue = _this.getEmptyState(
|
|
1269
|
+
var mappingValue = _this.getEmptyState(newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId);
|
|
1273
1270
|
var _newState_newMapping_controlId;
|
|
1274
|
-
var mainStateKeys = Object.keys((_newState_newMapping_controlId =
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
if (!mainStateKeys.includes(key) && key !== "uid" && newState[(_newMapping = newMapping) === null || _newMapping === void 0 ? void 0 : _newMapping.controlId]) {
|
|
1271
|
+
var mainStateKeys = Object.keys((_newState_newMapping_controlId = newState === null || newState === void 0 ? void 0 : newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) !== null && _newState_newMapping_controlId !== void 0 ? _newState_newMapping_controlId : {});
|
|
1272
|
+
mappingKeys === null || mappingKeys === void 0 ? void 0 : mappingKeys.forEach(function(key) {
|
|
1273
|
+
if (!mainStateKeys.includes(key) && key !== "uid" && newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) {
|
|
1278
1274
|
if (Object.keys(newState).length) {
|
|
1279
|
-
|
|
1280
|
-
Object.assign(newState[(_newMapping1 = newMapping) === null || _newMapping1 === void 0 ? void 0 : _newMapping1.controlId], _define_property({}, key, mappingValue[key]));
|
|
1275
|
+
Object.assign(newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId], _defineProperty({}, key, mappingValue[key]));
|
|
1281
1276
|
} else {
|
|
1282
|
-
Object.assign(newState,
|
|
1277
|
+
Object.assign(newState, _defineProperty({}, newMapping.controlId, _defineProperty({}, key, mappingValue[key])));
|
|
1283
1278
|
}
|
|
1284
1279
|
}
|
|
1285
1280
|
});
|
|
@@ -1354,8 +1349,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1354
1349
|
var _this_getControlIdMapping;
|
|
1355
1350
|
var controlIdMapping = (_this_getControlIdMapping = this.getControlIdMapping()) !== null && _this_getControlIdMapping !== void 0 ? _this_getControlIdMapping : {};
|
|
1356
1351
|
var _Object_entries_find;
|
|
1357
|
-
var _ref =
|
|
1358
|
-
var _param =
|
|
1352
|
+
var _ref = _slicedToArray((_Object_entries_find = Object.entries(controlIdMapping).find(function(param) {
|
|
1353
|
+
var _param = _slicedToArray(param, 2), _ = _param[0], mapping = _param[1];
|
|
1359
1354
|
return mapping.children && controlId in mapping.children;
|
|
1360
1355
|
})) !== null && _Object_entries_find !== void 0 ? _Object_entries_find : [], 1), subtableId = _ref[0];
|
|
1361
1356
|
if (subtableId) {
|
|
@@ -1585,7 +1580,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1585
1580
|
args[_key] = arguments[_key];
|
|
1586
1581
|
}
|
|
1587
1582
|
var _this_runtime;
|
|
1588
|
-
return (_this_runtime = this.runtime).registerControlConfig.apply(_this_runtime,
|
|
1583
|
+
return (_this_runtime = this.runtime).registerControlConfig.apply(_this_runtime, _toConsumableArray(args));
|
|
1589
1584
|
}
|
|
1590
1585
|
},
|
|
1591
1586
|
{
|
|
@@ -1601,7 +1596,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1601
1596
|
var mapping = (_this_store_controlIdMapping = this.store.controlIdMapping) !== null && _this_store_controlIdMapping !== void 0 ? _this_store_controlIdMapping : {};
|
|
1602
1597
|
var listKey = undefined;
|
|
1603
1598
|
Object.keys(mapping).some(function(key) {
|
|
1604
|
-
var
|
|
1599
|
+
var _mapping_key, _mapping_key_children;
|
|
1605
1600
|
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);
|
|
1606
1601
|
if (matched) {
|
|
1607
1602
|
listKey = key;
|
|
@@ -1620,7 +1615,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1620
1615
|
arg[_key] = arguments[_key];
|
|
1621
1616
|
}
|
|
1622
1617
|
var _Runtime;
|
|
1623
|
-
return (_Runtime = Runtime).register.apply(_Runtime,
|
|
1618
|
+
return (_Runtime = Runtime).register.apply(_Runtime, _toConsumableArray(arg));
|
|
1624
1619
|
}
|
|
1625
1620
|
},
|
|
1626
1621
|
{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _classCallCheck(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 _createClass(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 _defineProperty(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
|
+
_classCallCheck(this, OkWorker);
|
|
38
|
+
_defineProperty(this, "worker", void 0);
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
_createClass(OkWorker, [
|
|
41
41
|
{
|
|
42
42
|
key: "run",
|
|
43
43
|
value: function run(initState) {
|