@byteluck-fe/model-driven-engine 2.23.0-beta.13 → 2.23.0-beta.14
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/Engine.js +41 -14
- package/dist/esm/common/Runtime.js +28 -12
- package/dist/esm/common/Store.js +0 -3
- package/dist/esm/common/checkerValue.js +37 -17
- package/dist/esm/plugins/ControlsEventPlugin.js +2 -2
- package/dist/esm/plugins/LifecycleEventPlugin.js +2 -2
- package/dist/index.umd.js +12 -7
- package/package.json +4 -4
|
@@ -44,10 +44,6 @@ function _async_to_generator(fn) {
|
|
|
44
44
|
});
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
function _call_super(_this, derived, args) {
|
|
48
|
-
derived = _get_prototype_of(derived);
|
|
49
|
-
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
50
|
-
}
|
|
51
47
|
function _class_call_check(instance, Constructor) {
|
|
52
48
|
if (!(instance instanceof Constructor)) {
|
|
53
49
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -226,12 +222,28 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
226
222
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
227
223
|
}
|
|
228
224
|
function _is_native_reflect_construct() {
|
|
225
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
226
|
+
if (Reflect.construct.sham) return false;
|
|
227
|
+
if (typeof Proxy === "function") return true;
|
|
229
228
|
try {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
return
|
|
234
|
-
}
|
|
229
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
230
|
+
return true;
|
|
231
|
+
} catch (e) {
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
function _create_super(Derived) {
|
|
236
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
237
|
+
return function _createSuperInternal() {
|
|
238
|
+
var Super = _get_prototype_of(Derived), result;
|
|
239
|
+
if (hasNativeReflectConstruct) {
|
|
240
|
+
var NewTarget = _get_prototype_of(this).constructor;
|
|
241
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
242
|
+
} else {
|
|
243
|
+
result = Super.apply(this, arguments);
|
|
244
|
+
}
|
|
245
|
+
return _possible_constructor_return(this, result);
|
|
246
|
+
};
|
|
235
247
|
}
|
|
236
248
|
function _ts_generator(thisArg, body) {
|
|
237
249
|
var f, y, t, g, _ = {
|
|
@@ -349,14 +361,30 @@ var applyingPluginName = '';
|
|
|
349
361
|
var Engine = /*#__PURE__*/ function(Watcher) {
|
|
350
362
|
"use strict";
|
|
351
363
|
_inherits(Engine, Watcher);
|
|
364
|
+
var _super = _create_super(Engine);
|
|
352
365
|
function Engine(props) {
|
|
353
366
|
_class_call_check(this, Engine);
|
|
354
367
|
var _this;
|
|
355
|
-
_this =
|
|
356
|
-
_define_property(_this, "
|
|
368
|
+
_this = _super.call(this);
|
|
369
|
+
_define_property(_assert_this_initialized(_this), "store", void 0);
|
|
370
|
+
_define_property(_assert_this_initialized(_this), "rawStore", {});
|
|
371
|
+
_define_property(_assert_this_initialized(_this), "parent", void 0);
|
|
372
|
+
// 提供注册运行态控件以及实例化控件的能力
|
|
373
|
+
_define_property(_assert_this_initialized(_this), "runtime", void 0);
|
|
374
|
+
// 提供子线程处理脚本以及修改数据的能力
|
|
357
375
|
// public worker: OkWorker
|
|
358
|
-
_define_property(_this, "isMounted", false)
|
|
359
|
-
_define_property(
|
|
376
|
+
_define_property(_assert_this_initialized(_this), "isMounted", false);
|
|
377
|
+
_define_property(_assert_this_initialized(_this), "id", genNonDuplicateId(8));
|
|
378
|
+
_define_property(_assert_this_initialized(_this), "externalParams", void 0);
|
|
379
|
+
_define_property(_assert_this_initialized(_this), "children", void 0);
|
|
380
|
+
// 提供外部注册插件,在不同的hooks触发时执行固定函数的能力
|
|
381
|
+
_define_property(_assert_this_initialized(_this), "__plugins", void 0);
|
|
382
|
+
_define_property(_assert_this_initialized(_this), "__pluginsApplied", false);
|
|
383
|
+
_define_property(_assert_this_initialized(_this), "$options", void 0);
|
|
384
|
+
_define_property(_assert_this_initialized(_this), "actionManager", new ActionManager());
|
|
385
|
+
_define_property(_assert_this_initialized(_this), "dataManager", void 0);
|
|
386
|
+
_define_property(_assert_this_initialized(_this), "_jobTasks", []);
|
|
387
|
+
_define_property(_assert_this_initialized(_this), "createControlInstance", _this.createInstance);
|
|
360
388
|
_this.$options = Object.freeze(props);
|
|
361
389
|
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,
|
|
362
390
|
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, messagesI18n = _this_$options.messagesI18n, children = _this_$options.children;
|
|
@@ -596,7 +624,6 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
596
624
|
{
|
|
597
625
|
key: "_handlerSubtableUpdateUid",
|
|
598
626
|
value: function _handlerSubtableUpdateUid(subtableData) {
|
|
599
|
-
;
|
|
600
627
|
subtableData.forEach(function(item) {
|
|
601
628
|
if (!item.uid) {
|
|
602
629
|
Object.assign(item, {
|
|
@@ -4,10 +4,6 @@ function _assert_this_initialized(self) {
|
|
|
4
4
|
}
|
|
5
5
|
return self;
|
|
6
6
|
}
|
|
7
|
-
function _call_super(_this, derived, args) {
|
|
8
|
-
derived = _get_prototype_of(derived);
|
|
9
|
-
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
10
|
-
}
|
|
11
7
|
function _class_call_check(instance, Constructor) {
|
|
12
8
|
if (!(instance instanceof Constructor)) {
|
|
13
9
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -77,12 +73,28 @@ function _type_of(obj) {
|
|
|
77
73
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
78
74
|
}
|
|
79
75
|
function _is_native_reflect_construct() {
|
|
76
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
77
|
+
if (Reflect.construct.sham) return false;
|
|
78
|
+
if (typeof Proxy === "function") return true;
|
|
80
79
|
try {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return
|
|
85
|
-
}
|
|
80
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
81
|
+
return true;
|
|
82
|
+
} catch (e) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function _create_super(Derived) {
|
|
87
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
88
|
+
return function _createSuperInternal() {
|
|
89
|
+
var Super = _get_prototype_of(Derived), result;
|
|
90
|
+
if (hasNativeReflectConstruct) {
|
|
91
|
+
var NewTarget = _get_prototype_of(this).constructor;
|
|
92
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
93
|
+
} else {
|
|
94
|
+
result = Super.apply(this, arguments);
|
|
95
|
+
}
|
|
96
|
+
return _possible_constructor_return(this, result);
|
|
97
|
+
};
|
|
86
98
|
}
|
|
87
99
|
import { RegisterControls, isDataBind } from '@byteluck-fe/model-driven-core';
|
|
88
100
|
import { CONTROL_BASE_TYPE, CONTROL_TYPE, JSONCopy, loopFormSchema, isArray } from '@byteluck-fe/model-driven-shared';
|
|
@@ -90,12 +102,16 @@ import { hasChildrenControl, loopDataViewControl, loopFormControl } from '../uti
|
|
|
90
102
|
export var Runtime = /*#__PURE__*/ function(RegisterControls) {
|
|
91
103
|
"use strict";
|
|
92
104
|
_inherits(Runtime, RegisterControls);
|
|
105
|
+
var _super = _create_super(Runtime);
|
|
93
106
|
function Runtime(props) {
|
|
94
107
|
_class_call_check(this, Runtime);
|
|
95
108
|
var _this;
|
|
96
|
-
_this =
|
|
97
|
-
|
|
98
|
-
|
|
109
|
+
_this = _super.call(this, 'Runtime');
|
|
110
|
+
_define_property(_assert_this_initialized(_this), "_schema", void 0);
|
|
111
|
+
_define_property(_assert_this_initialized(_this), "_instance", void 0);
|
|
112
|
+
_define_property(_assert_this_initialized(_this), "_flatInstances", []);
|
|
113
|
+
_define_property(_assert_this_initialized(_this), "_instanceMap", {});
|
|
114
|
+
_define_property(_assert_this_initialized(_this), "_controlParentIdMap", {});
|
|
99
115
|
var schema = props.schema;
|
|
100
116
|
_this._schema = schema;
|
|
101
117
|
_this._instance = _this.createControl(schema, props.beforeCreateInstance);
|
package/dist/esm/common/Store.js
CHANGED
|
@@ -81,7 +81,6 @@ var Store = /*#__PURE__*/ function() {
|
|
|
81
81
|
if (controlInfo !== undefined) {
|
|
82
82
|
//明细表
|
|
83
83
|
if (controlInfo.children) {
|
|
84
|
-
;
|
|
85
84
|
value.forEach(function(item) {
|
|
86
85
|
if (!item.uid) {
|
|
87
86
|
Object.assign(item, {
|
|
@@ -110,7 +109,6 @@ var Store = /*#__PURE__*/ function() {
|
|
|
110
109
|
Object.keys(children).map(function(childControlId) {
|
|
111
110
|
if (childControlId === controlId) {
|
|
112
111
|
if (_this.state[dataView][subtableId][rowIndex]) {
|
|
113
|
-
;
|
|
114
112
|
_this.state[dataView][subtableId][rowIndex][controlId] = noProxyValue;
|
|
115
113
|
}
|
|
116
114
|
}
|
|
@@ -169,7 +167,6 @@ var Store = /*#__PURE__*/ function() {
|
|
|
169
167
|
if (children !== undefined) {
|
|
170
168
|
Object.keys(children).map(function(childControlId) {
|
|
171
169
|
if (childControlId === controlId) {
|
|
172
|
-
;
|
|
173
170
|
_this.state[dataViewId][subtableId].map(function(item) {
|
|
174
171
|
states.push(item[controlId]);
|
|
175
172
|
});
|
|
@@ -12,10 +12,6 @@ function _assert_this_initialized(self) {
|
|
|
12
12
|
}
|
|
13
13
|
return self;
|
|
14
14
|
}
|
|
15
|
-
function _call_super(_this, derived, args) {
|
|
16
|
-
derived = _get_prototype_of(derived);
|
|
17
|
-
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
18
|
-
}
|
|
19
15
|
function _class_call_check(instance, Constructor) {
|
|
20
16
|
if (!(instance instanceof Constructor)) {
|
|
21
17
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -138,12 +134,28 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
138
134
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
139
135
|
}
|
|
140
136
|
function _is_native_reflect_construct() {
|
|
137
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
138
|
+
if (Reflect.construct.sham) return false;
|
|
139
|
+
if (typeof Proxy === "function") return true;
|
|
141
140
|
try {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
return
|
|
146
|
-
}
|
|
141
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
142
|
+
return true;
|
|
143
|
+
} catch (e) {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function _create_super(Derived) {
|
|
148
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
149
|
+
return function _createSuperInternal() {
|
|
150
|
+
var Super = _get_prototype_of(Derived), result;
|
|
151
|
+
if (hasNativeReflectConstruct) {
|
|
152
|
+
var NewTarget = _get_prototype_of(this).constructor;
|
|
153
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
154
|
+
} else {
|
|
155
|
+
result = Super.apply(this, arguments);
|
|
156
|
+
}
|
|
157
|
+
return _possible_constructor_return(this, result);
|
|
158
|
+
};
|
|
147
159
|
}
|
|
148
160
|
import { isArray, isFunction, isString, isJSONArray, isJSONObject, isNumber, isNumberAndEmptyStringArray, isPlainObject, isStringArray, FieldTypes, isObject } from '@byteluck-fe/model-driven-shared';
|
|
149
161
|
import { AddressValue, AmountValue, CalcValue, RangeDateValue } from '@byteluck-fe/model-driven-core';
|
|
@@ -155,9 +167,10 @@ var ValueChecker = function ValueChecker() {
|
|
|
155
167
|
var StringValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
156
168
|
"use strict";
|
|
157
169
|
_inherits(StringValueChecker, ValueChecker);
|
|
170
|
+
var _super = _create_super(StringValueChecker);
|
|
158
171
|
function StringValueChecker() {
|
|
159
172
|
_class_call_check(this, StringValueChecker);
|
|
160
|
-
return
|
|
173
|
+
return _super.apply(this, arguments);
|
|
161
174
|
}
|
|
162
175
|
_create_class(StringValueChecker, [
|
|
163
176
|
{
|
|
@@ -187,9 +200,10 @@ var StringValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
187
200
|
var NumberValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
188
201
|
"use strict";
|
|
189
202
|
_inherits(NumberValueChecker, ValueChecker);
|
|
203
|
+
var _super = _create_super(NumberValueChecker);
|
|
190
204
|
function NumberValueChecker() {
|
|
191
205
|
_class_call_check(this, NumberValueChecker);
|
|
192
|
-
return
|
|
206
|
+
return _super.apply(this, arguments);
|
|
193
207
|
}
|
|
194
208
|
_create_class(NumberValueChecker, [
|
|
195
209
|
{
|
|
@@ -218,9 +232,10 @@ var NumberValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
218
232
|
var StringArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
219
233
|
"use strict";
|
|
220
234
|
_inherits(StringArrayValueChecker, ValueChecker);
|
|
235
|
+
var _super = _create_super(StringArrayValueChecker);
|
|
221
236
|
function StringArrayValueChecker() {
|
|
222
237
|
_class_call_check(this, StringArrayValueChecker);
|
|
223
|
-
return
|
|
238
|
+
return _super.apply(this, arguments);
|
|
224
239
|
}
|
|
225
240
|
_create_class(StringArrayValueChecker, [
|
|
226
241
|
{
|
|
@@ -262,9 +277,10 @@ var StringArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
262
277
|
var NumberArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
263
278
|
"use strict";
|
|
264
279
|
_inherits(NumberArrayValueChecker, ValueChecker);
|
|
280
|
+
var _super = _create_super(NumberArrayValueChecker);
|
|
265
281
|
function NumberArrayValueChecker() {
|
|
266
282
|
_class_call_check(this, NumberArrayValueChecker);
|
|
267
|
-
return
|
|
283
|
+
return _super.apply(this, arguments);
|
|
268
284
|
}
|
|
269
285
|
_create_class(NumberArrayValueChecker, [
|
|
270
286
|
{
|
|
@@ -312,9 +328,10 @@ var NumberArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
312
328
|
var MoneyValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
313
329
|
"use strict";
|
|
314
330
|
_inherits(MoneyValueChecker, ValueChecker);
|
|
331
|
+
var _super = _create_super(MoneyValueChecker);
|
|
315
332
|
function MoneyValueChecker() {
|
|
316
333
|
_class_call_check(this, MoneyValueChecker);
|
|
317
|
-
return
|
|
334
|
+
return _super.apply(this, arguments);
|
|
318
335
|
}
|
|
319
336
|
_create_class(MoneyValueChecker, [
|
|
320
337
|
{
|
|
@@ -362,9 +379,10 @@ var MoneyValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
362
379
|
var TimeScopeValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
363
380
|
"use strict";
|
|
364
381
|
_inherits(TimeScopeValueChecker, ValueChecker);
|
|
382
|
+
var _super = _create_super(TimeScopeValueChecker);
|
|
365
383
|
function TimeScopeValueChecker() {
|
|
366
384
|
_class_call_check(this, TimeScopeValueChecker);
|
|
367
|
-
return
|
|
385
|
+
return _super.apply(this, arguments);
|
|
368
386
|
}
|
|
369
387
|
_create_class(TimeScopeValueChecker, [
|
|
370
388
|
{
|
|
@@ -409,9 +427,10 @@ var TimeScopeValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
409
427
|
var CalcValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
410
428
|
"use strict";
|
|
411
429
|
_inherits(CalcValueChecker, ValueChecker);
|
|
430
|
+
var _super = _create_super(CalcValueChecker);
|
|
412
431
|
function CalcValueChecker() {
|
|
413
432
|
_class_call_check(this, CalcValueChecker);
|
|
414
|
-
return
|
|
433
|
+
return _super.apply(this, arguments);
|
|
415
434
|
}
|
|
416
435
|
_create_class(CalcValueChecker, [
|
|
417
436
|
{
|
|
@@ -459,9 +478,10 @@ var CalcValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
459
478
|
var AddressValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
460
479
|
"use strict";
|
|
461
480
|
_inherits(AddressValueChecker, ValueChecker);
|
|
481
|
+
var _super = _create_super(AddressValueChecker);
|
|
462
482
|
function AddressValueChecker() {
|
|
463
483
|
_class_call_check(this, AddressValueChecker);
|
|
464
|
-
return
|
|
484
|
+
return _super.apply(this, arguments);
|
|
465
485
|
}
|
|
466
486
|
_create_class(AddressValueChecker, [
|
|
467
487
|
{
|
|
@@ -217,7 +217,7 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
217
217
|
key: "engineAddEventListener",
|
|
218
218
|
value: function engineAddEventListener(eventKey, controlEventKey) {
|
|
219
219
|
var _this = this;
|
|
220
|
-
this.engine.on(eventKey,
|
|
220
|
+
this.engine.on(eventKey, function() {
|
|
221
221
|
var _ref = _async_to_generator(function(payload) {
|
|
222
222
|
return _ts_generator(this, function(_state) {
|
|
223
223
|
switch(_state.label){
|
|
@@ -272,7 +272,7 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
272
272
|
}
|
|
273
273
|
return [
|
|
274
274
|
4,
|
|
275
|
-
Promise.all(events[name].map(
|
|
275
|
+
Promise.all(events[name].map(function() {
|
|
276
276
|
var _ref = _async_to_generator(function(eventName) {
|
|
277
277
|
var execResult;
|
|
278
278
|
return _ts_generator(this, function(_state) {
|
|
@@ -224,7 +224,7 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
|
224
224
|
Object.entries(LifecycleEventKeyMap).forEach(function(param) {
|
|
225
225
|
var _param = _sliced_to_array(param, 2), engineKey = _param[0], lifecycleKey = _param[1];
|
|
226
226
|
var _this1 = _this;
|
|
227
|
-
engine.on(engineKey,
|
|
227
|
+
engine.on(engineKey, function() {
|
|
228
228
|
var _ref = _async_to_generator(function(payload) {
|
|
229
229
|
var result;
|
|
230
230
|
return _ts_generator(this, function(_state) {
|
|
@@ -278,7 +278,7 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
|
278
278
|
}
|
|
279
279
|
return [
|
|
280
280
|
4,
|
|
281
|
-
Promise.all(events[name].map(
|
|
281
|
+
Promise.all(events[name].map(function() {
|
|
282
282
|
var _ref = _async_to_generator(function(eventName) {
|
|
283
283
|
var execResult;
|
|
284
284
|
return _ts_generator(this, function(_state) {
|