@byteluck-fe/model-driven-engine 2.3.11 → 2.3.12-a
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 +3 -3
- package/dist/esm/common/DataManager.js +3 -3
- package/dist/esm/common/Engine.js +10 -10
- package/dist/esm/common/Store.js +1 -1
- package/dist/esm/common/proxyState.js +1 -1
- package/dist/esm/plugins/CalcPlugin.js +7 -3
- package/dist/esm/plugins/ControlsEventPlugin.js +5 -5
- package/dist/esm/plugins/LifecycleEventPlugin.js +5 -5
- package/dist/index.umd.js +9 -10
- package/package.json +4 -4
|
@@ -84,7 +84,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
84
84
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
85
85
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
function _ts_generator(thisArg, body) {
|
|
88
88
|
var f, y, t, g, _ = {
|
|
89
89
|
label: 0,
|
|
90
90
|
sent: function() {
|
|
@@ -178,7 +178,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
178
178
|
done: true
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
|
-
}
|
|
181
|
+
}
|
|
182
182
|
import { error, logerror } from "@byteluck-fe/model-driven-shared";
|
|
183
183
|
export var ActionManager = /*#__PURE__*/ function() {
|
|
184
184
|
"use strict";
|
|
@@ -203,7 +203,7 @@ export var ActionManager = /*#__PURE__*/ function() {
|
|
|
203
203
|
var _this = this;
|
|
204
204
|
return _async_to_generator(function() {
|
|
205
205
|
var action, _action_func, result, e;
|
|
206
|
-
return
|
|
206
|
+
return _ts_generator(this, function(_state) {
|
|
207
207
|
switch(_state.label){
|
|
208
208
|
case 0:
|
|
209
209
|
action = _this.actionMap.get(name);
|
|
@@ -59,7 +59,7 @@ function _define_property(obj, key, value) {
|
|
|
59
59
|
}
|
|
60
60
|
return obj;
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
function _ts_generator(thisArg, body) {
|
|
63
63
|
var f, y, t, g, _ = {
|
|
64
64
|
label: 0,
|
|
65
65
|
sent: function() {
|
|
@@ -153,7 +153,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
153
153
|
done: true
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
|
-
}
|
|
156
|
+
}
|
|
157
157
|
import { JSONCopy, logerror } from "@byteluck-fe/model-driven-shared";
|
|
158
158
|
export var DataManager = /*#__PURE__*/ function() {
|
|
159
159
|
"use strict";
|
|
@@ -188,7 +188,7 @@ export var DataManager = /*#__PURE__*/ function() {
|
|
|
188
188
|
value: function getRemoteData(payload) {
|
|
189
189
|
var _this = this;
|
|
190
190
|
return _async_to_generator(function() {
|
|
191
|
-
return
|
|
191
|
+
return _ts_generator(this, function(_state) {
|
|
192
192
|
if (_this.executer === undefined) {
|
|
193
193
|
logerror("未初始化executer");
|
|
194
194
|
return [
|
|
@@ -252,7 +252,7 @@ function _create_super(Derived) {
|
|
|
252
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";
|
|
@@ -722,7 +722,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
722
722
|
};
|
|
723
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 [
|
|
@@ -973,15 +973,15 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
973
973
|
var data = getFieldData.map(function(item) {
|
|
974
974
|
var obj = {};
|
|
975
975
|
for(var key in item){
|
|
976
|
-
var _controlIdMapping_controlId_children_key, _controlIdMapping_controlId,
|
|
977
|
-
if ((
|
|
976
|
+
var _controlIdMapping_controlId_children_key_dataBind, _controlIdMapping_controlId_children_key, _controlIdMapping_controlId, _controlIdMapping_controlId1;
|
|
977
|
+
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) {
|
|
978
978
|
var _controlIdMapping_controlId_children_key1;
|
|
979
979
|
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];
|
|
980
980
|
} else if ((_controlIdMapping_controlId1 = controlIdMapping[controlId]) === null || _controlIdMapping_controlId1 === void 0 ? void 0 : _controlIdMapping_controlId1.children[key]) {
|
|
981
981
|
// 兼容一个控件需要绑定多个字段的情况
|
|
982
982
|
for(var keyChi in item[key]){
|
|
983
983
|
var _controlIdMapping_controlId_children_key2, _controlIdMapping_controlId2;
|
|
984
|
-
obj[(
|
|
984
|
+
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];
|
|
985
985
|
}
|
|
986
986
|
}
|
|
987
987
|
}
|
|
@@ -990,7 +990,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
990
990
|
return data;
|
|
991
991
|
} else {
|
|
992
992
|
var _loop = function(key) {
|
|
993
|
-
var _controlIdMapping_key,
|
|
993
|
+
var _controlIdMapping_key_dataBind, _controlIdMapping_key, _controlIdMapping_key_dataBind1, _controlIdMapping_key1;
|
|
994
994
|
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) {
|
|
995
995
|
var _controlIdMapping_key2;
|
|
996
996
|
obj[(_controlIdMapping_key2 = controlIdMapping[key]) === null || _controlIdMapping_key2 === void 0 ? void 0 : _controlIdMapping_key2.dataBind.fieldCode] = getFieldData[key];
|
|
@@ -1018,7 +1018,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1018
1018
|
// 兼容一个控件需要绑定多个字段的情况
|
|
1019
1019
|
for(var keyChi in getFieldData[key]){
|
|
1020
1020
|
var _controlIdMapping_key_dataBind_keyChi, _controlIdMapping_key4;
|
|
1021
|
-
obj[(
|
|
1021
|
+
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];
|
|
1022
1022
|
}
|
|
1023
1023
|
}
|
|
1024
1024
|
};
|
|
@@ -1174,7 +1174,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1174
1174
|
var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
|
|
1175
1175
|
;
|
|
1176
1176
|
Object.keys(row).map(function(fieldCode) {
|
|
1177
|
-
var
|
|
1177
|
+
var _this_store_dataBindMapping_dataCode_fields, _this_store_dataBindMapping_dataCode;
|
|
1178
1178
|
if (skipKey.includes(fieldCode)) {
|
|
1179
1179
|
return;
|
|
1180
1180
|
}
|
|
@@ -1565,7 +1565,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1565
1565
|
var _this_store_controlIdMapping;
|
|
1566
1566
|
var mapping = (_this_store_controlIdMapping = this.store.controlIdMapping) !== null && _this_store_controlIdMapping !== void 0 ? _this_store_controlIdMapping : {};
|
|
1567
1567
|
var result = Object.keys(mapping).some(function(key) {
|
|
1568
|
-
var
|
|
1568
|
+
var _mapping_key_children, _mapping_key;
|
|
1569
1569
|
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);
|
|
1570
1570
|
});
|
|
1571
1571
|
return result;
|
package/dist/esm/common/Store.js
CHANGED
|
@@ -262,7 +262,7 @@ function buildDataBindMapping(data, dataViewId, // @ts-ignore
|
|
|
262
262
|
item) {
|
|
263
263
|
// if (item instanceof RuntimeFormControl) {
|
|
264
264
|
if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
265
|
-
var
|
|
265
|
+
var _item_props_dataBind, _item_props;
|
|
266
266
|
if (_instanceof(item.props.dataBind, ObjectDataBind)) {
|
|
267
267
|
// 特殊的dataBind,比如:金额是currency+amount两个key组成的,日期区间,继承自ObjectDataBind的需要通过Object.keys拿到多个databind
|
|
268
268
|
Object.keys(item.props.dataBind).map(function(key) {
|
|
@@ -285,7 +285,7 @@ function getArrayNewArgs(type, args, value) {
|
|
|
285
285
|
var result;
|
|
286
286
|
var addValue = getArrayNewValue(key, args);
|
|
287
287
|
if (addValue.length) {
|
|
288
|
-
var
|
|
288
|
+
var _this_engineArrayBeforeSetCallbackFlag, _this;
|
|
289
289
|
// @ts-ignore
|
|
290
290
|
var newValue = (_this_engineArrayBeforeSetCallbackFlag = (_this = this)[engineArrayBeforeSetCallbackFlag]) === null || _this_engineArrayBeforeSetCallbackFlag === void 0 ? void 0 : _this_engineArrayBeforeSetCallbackFlag.call(_this, // @ts-ignore
|
|
291
291
|
this[engineTargetKey], // @ts-ignore
|
|
@@ -359,6 +359,10 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
359
359
|
if (!scriptEcho || scriptEcho.length === 0) {
|
|
360
360
|
return;
|
|
361
361
|
}
|
|
362
|
+
var rowIndex = undefined;
|
|
363
|
+
if (this.controlInSubtable(control)) {
|
|
364
|
+
rowIndex = this.engine.getInstanceRowIndex(control);
|
|
365
|
+
}
|
|
362
366
|
// @ts-ignore
|
|
363
367
|
var scriptText = scriptEcho.reduce(function(result, current) {
|
|
364
368
|
if (current.type === CALC_TOKEN_TYPE.Operator || current.type === CALC_TOKEN_TYPE.Number) {
|
|
@@ -376,7 +380,7 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
376
380
|
}
|
|
377
381
|
case CALC_TOKEN_TYPE.VariableInCurrentSubTable:
|
|
378
382
|
{
|
|
379
|
-
|
|
383
|
+
//const rowIndex = this.engine.getInstanceRowIndex(control)
|
|
380
384
|
instance = _this.engine.getInstance(current.id, rowIndex);
|
|
381
385
|
var state = _this.engine.getState(current.id, rowIndex);
|
|
382
386
|
var value1 = _this.getNumberValue(state);
|
|
@@ -414,9 +418,9 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
414
418
|
}));
|
|
415
419
|
this.cacheComputedResult[scriptText] = value;
|
|
416
420
|
}
|
|
417
|
-
|
|
421
|
+
// let rowIndex = undefined
|
|
418
422
|
if (this.controlInSubtable(control)) {
|
|
419
|
-
rowIndex = this.engine.getInstanceRowIndex(control)
|
|
423
|
+
// rowIndex = this.engine.getInstanceRowIndex(control)
|
|
420
424
|
// 控件在明细表内,但是没有行下标,说明控件被已经删除了,所以直接return
|
|
421
425
|
if (rowIndex === undefined) {
|
|
422
426
|
return;
|
|
@@ -59,7 +59,7 @@ function _define_property(obj, key, value) {
|
|
|
59
59
|
}
|
|
60
60
|
return obj;
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
function _ts_generator(thisArg, body) {
|
|
63
63
|
var f, y, t, g, _ = {
|
|
64
64
|
label: 0,
|
|
65
65
|
sent: function() {
|
|
@@ -153,7 +153,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
153
153
|
done: true
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
|
-
}
|
|
156
|
+
}
|
|
157
157
|
import { EventLogic } from "@byteluck-fe/model-driven-shared";
|
|
158
158
|
// type EventKeyMap = {
|
|
159
159
|
// [eventKey in EventKeys]?: string
|
|
@@ -209,7 +209,7 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
209
209
|
var _this = this;
|
|
210
210
|
this.engine.on(eventKey, function() {
|
|
211
211
|
var _ref = _async_to_generator(function(payload) {
|
|
212
|
-
return
|
|
212
|
+
return _ts_generator(this, function(_state) {
|
|
213
213
|
switch(_state.label){
|
|
214
214
|
case 0:
|
|
215
215
|
// 初始化state的时候不触发change事件,必须在engine mounted以后才触发
|
|
@@ -250,7 +250,7 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
250
250
|
var _this = this;
|
|
251
251
|
return _async_to_generator(function() {
|
|
252
252
|
var events, result;
|
|
253
|
-
return
|
|
253
|
+
return _ts_generator(this, function(_state) {
|
|
254
254
|
switch(_state.label){
|
|
255
255
|
case 0:
|
|
256
256
|
events = _this.config[payload.instance.id];
|
|
@@ -265,7 +265,7 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
265
265
|
Promise.all(events[name].map(function() {
|
|
266
266
|
var _ref = _async_to_generator(function(eventName) {
|
|
267
267
|
var execResult;
|
|
268
|
-
return
|
|
268
|
+
return _ts_generator(this, function(_state) {
|
|
269
269
|
switch(_state.label){
|
|
270
270
|
case 0:
|
|
271
271
|
return [
|
|
@@ -105,7 +105,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
105
105
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
106
106
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
function _ts_generator(thisArg, body) {
|
|
109
109
|
var f, y, t, g, _ = {
|
|
110
110
|
label: 0,
|
|
111
111
|
sent: function() {
|
|
@@ -199,7 +199,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
199
199
|
done: true
|
|
200
200
|
};
|
|
201
201
|
}
|
|
202
|
-
}
|
|
202
|
+
}
|
|
203
203
|
var LifecycleEventKeyMap = {
|
|
204
204
|
"engine-mounted": "did_mount",
|
|
205
205
|
"engine-submit": "will_submit",
|
|
@@ -226,7 +226,7 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
|
226
226
|
engine.on(engineKey, function() {
|
|
227
227
|
var _ref = _async_to_generator(function(payload) {
|
|
228
228
|
var result;
|
|
229
|
-
return
|
|
229
|
+
return _ts_generator(this, function(_state) {
|
|
230
230
|
switch(_state.label){
|
|
231
231
|
case 0:
|
|
232
232
|
return [
|
|
@@ -265,7 +265,7 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
|
265
265
|
var _this = this;
|
|
266
266
|
return _async_to_generator(function() {
|
|
267
267
|
var events, result;
|
|
268
|
-
return
|
|
268
|
+
return _ts_generator(this, function(_state) {
|
|
269
269
|
switch(_state.label){
|
|
270
270
|
case 0:
|
|
271
271
|
events = _this.config;
|
|
@@ -280,7 +280,7 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
|
280
280
|
Promise.all(events[name].map(function() {
|
|
281
281
|
var _ref = _async_to_generator(function(eventName) {
|
|
282
282
|
var execResult;
|
|
283
|
-
return
|
|
283
|
+
return _ts_generator(this, function(_state) {
|
|
284
284
|
switch(_state.label){
|
|
285
285
|
case 0:
|
|
286
286
|
return [
|