@byteluck-fe/model-driven-engine 7.0.0-beta.4 → 7.0.0-beta.6
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 +12 -15
- package/dist/esm/common/DataManager.js +13 -16
- package/dist/esm/common/Engine.js +23 -26
- package/dist/esm/common/Store.js +7 -6
- package/dist/esm/common/checkerValue.js +6 -6
- package/dist/esm/common/proxyState.js +3 -3
- package/dist/esm/plugins/CalcPlugin.js +6 -5
- package/dist/esm/plugins/ControlsEventPlugin.js +30 -28
- package/dist/esm/plugins/LifecycleEventPlugin.js +30 -27
- package/dist/esm/plugins/StylePlugin.js +2 -2
- package/dist/index.umd.js +27 -27
- package/package.json +2 -2
|
@@ -85,7 +85,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
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
|
-
var f, y, t, _ = {
|
|
88
|
+
var f, y, t, g, _ = {
|
|
89
89
|
label: 0,
|
|
90
90
|
sent: function() {
|
|
91
91
|
if (t[0] & 1) throw t[1];
|
|
@@ -93,17 +93,13 @@ function _ts_generator(thisArg, body) {
|
|
|
93
93
|
},
|
|
94
94
|
trys: [],
|
|
95
95
|
ops: []
|
|
96
|
-
}
|
|
97
|
-
return
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
104
|
-
value: function() {
|
|
105
|
-
return this;
|
|
106
|
-
}
|
|
96
|
+
};
|
|
97
|
+
return g = {
|
|
98
|
+
next: verb(0),
|
|
99
|
+
"throw": verb(1),
|
|
100
|
+
"return": verb(2)
|
|
101
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
102
|
+
return this;
|
|
107
103
|
}), g;
|
|
108
104
|
function verb(n) {
|
|
109
105
|
return function(v) {
|
|
@@ -115,7 +111,7 @@ function _ts_generator(thisArg, body) {
|
|
|
115
111
|
}
|
|
116
112
|
function step(op) {
|
|
117
113
|
if (f) throw new TypeError("Generator is already executing.");
|
|
118
|
-
while(
|
|
114
|
+
while(_)try {
|
|
119
115
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
120
116
|
if (y = 0, t) op = [
|
|
121
117
|
op[0] & 2,
|
|
@@ -204,12 +200,13 @@ export var ActionManager = /*#__PURE__*/ function() {
|
|
|
204
200
|
for(var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
|
|
205
201
|
args[_key - 2] = arguments[_key];
|
|
206
202
|
}
|
|
203
|
+
var _this = this;
|
|
207
204
|
return _async_to_generator(function() {
|
|
208
205
|
var action, _action_func, result, e;
|
|
209
206
|
return _ts_generator(this, function(_state) {
|
|
210
207
|
switch(_state.label){
|
|
211
208
|
case 0:
|
|
212
|
-
action =
|
|
209
|
+
action = _this.actionMap.get(name);
|
|
213
210
|
if (!action) {
|
|
214
211
|
return [
|
|
215
212
|
2
|
|
@@ -251,7 +248,7 @@ export var ActionManager = /*#__PURE__*/ function() {
|
|
|
251
248
|
];
|
|
252
249
|
}
|
|
253
250
|
});
|
|
254
|
-
})
|
|
251
|
+
})();
|
|
255
252
|
}
|
|
256
253
|
},
|
|
257
254
|
{
|
|
@@ -60,7 +60,7 @@ function _define_property(obj, key, value) {
|
|
|
60
60
|
return obj;
|
|
61
61
|
}
|
|
62
62
|
function _ts_generator(thisArg, body) {
|
|
63
|
-
var f, y, t, _ = {
|
|
63
|
+
var f, y, t, g, _ = {
|
|
64
64
|
label: 0,
|
|
65
65
|
sent: function() {
|
|
66
66
|
if (t[0] & 1) throw t[1];
|
|
@@ -68,17 +68,13 @@ function _ts_generator(thisArg, body) {
|
|
|
68
68
|
},
|
|
69
69
|
trys: [],
|
|
70
70
|
ops: []
|
|
71
|
-
}
|
|
72
|
-
return
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
79
|
-
value: function() {
|
|
80
|
-
return this;
|
|
81
|
-
}
|
|
71
|
+
};
|
|
72
|
+
return g = {
|
|
73
|
+
next: verb(0),
|
|
74
|
+
"throw": verb(1),
|
|
75
|
+
"return": verb(2)
|
|
76
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
77
|
+
return this;
|
|
82
78
|
}), g;
|
|
83
79
|
function verb(n) {
|
|
84
80
|
return function(v) {
|
|
@@ -90,7 +86,7 @@ function _ts_generator(thisArg, body) {
|
|
|
90
86
|
}
|
|
91
87
|
function step(op) {
|
|
92
88
|
if (f) throw new TypeError("Generator is already executing.");
|
|
93
|
-
while(
|
|
89
|
+
while(_)try {
|
|
94
90
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
95
91
|
if (y = 0, t) op = [
|
|
96
92
|
op[0] & 2,
|
|
@@ -190,9 +186,10 @@ export var DataManager = /*#__PURE__*/ function() {
|
|
|
190
186
|
{
|
|
191
187
|
key: "getRemoteData",
|
|
192
188
|
value: function getRemoteData(payload) {
|
|
189
|
+
var _this = this;
|
|
193
190
|
return _async_to_generator(function() {
|
|
194
191
|
return _ts_generator(this, function(_state) {
|
|
195
|
-
if (
|
|
192
|
+
if (_this.executer === undefined) {
|
|
196
193
|
// @i18n-translate-ignore
|
|
197
194
|
logerror('未初始化executer');
|
|
198
195
|
return [
|
|
@@ -202,14 +199,14 @@ export var DataManager = /*#__PURE__*/ function() {
|
|
|
202
199
|
} else {
|
|
203
200
|
return [
|
|
204
201
|
2,
|
|
205
|
-
|
|
202
|
+
_this.executer(payload)
|
|
206
203
|
];
|
|
207
204
|
}
|
|
208
205
|
return [
|
|
209
206
|
2
|
|
210
207
|
];
|
|
211
208
|
});
|
|
212
|
-
})
|
|
209
|
+
})();
|
|
213
210
|
}
|
|
214
211
|
}
|
|
215
212
|
]);
|
|
@@ -234,7 +234,7 @@ function _is_native_reflect_construct() {
|
|
|
234
234
|
})();
|
|
235
235
|
}
|
|
236
236
|
function _ts_generator(thisArg, body) {
|
|
237
|
-
var f, y, t, _ = {
|
|
237
|
+
var f, y, t, g, _ = {
|
|
238
238
|
label: 0,
|
|
239
239
|
sent: function() {
|
|
240
240
|
if (t[0] & 1) throw t[1];
|
|
@@ -242,17 +242,13 @@ function _ts_generator(thisArg, body) {
|
|
|
242
242
|
},
|
|
243
243
|
trys: [],
|
|
244
244
|
ops: []
|
|
245
|
-
}
|
|
246
|
-
return
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
253
|
-
value: function() {
|
|
254
|
-
return this;
|
|
255
|
-
}
|
|
245
|
+
};
|
|
246
|
+
return g = {
|
|
247
|
+
next: verb(0),
|
|
248
|
+
"throw": verb(1),
|
|
249
|
+
"return": verb(2)
|
|
250
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
251
|
+
return this;
|
|
256
252
|
}), g;
|
|
257
253
|
function verb(n) {
|
|
258
254
|
return function(v) {
|
|
@@ -264,7 +260,7 @@ function _ts_generator(thisArg, body) {
|
|
|
264
260
|
}
|
|
265
261
|
function step(op) {
|
|
266
262
|
if (f) throw new TypeError("Generator is already executing.");
|
|
267
|
-
while(
|
|
263
|
+
while(_)try {
|
|
268
264
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
269
265
|
if (y = 0, t) op = [
|
|
270
266
|
op[0] & 2,
|
|
@@ -332,6 +328,7 @@ function _ts_generator(thisArg, body) {
|
|
|
332
328
|
};
|
|
333
329
|
}
|
|
334
330
|
}
|
|
331
|
+
import { getLocaleText } from '@byteluck-fe/locale-message';
|
|
335
332
|
import { isDataBind } from '@byteluck-fe/model-driven-core';
|
|
336
333
|
import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, updateValueFromKeys, warn, Watcher, isBuiltInControls } from '@byteluck-fe/model-driven-shared';
|
|
337
334
|
import { Runtime } from './Runtime';
|
|
@@ -501,7 +498,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
501
498
|
// if (!(subtable instanceof RuntimeListControl)) return
|
|
502
499
|
if (!((subtable === null || subtable === void 0 ? void 0 : subtable.controlType) === CONTROL_BASE_TYPE.LIST)) return;
|
|
503
500
|
// 新增多行方法
|
|
504
|
-
var createRows = function
|
|
501
|
+
var createRows = function(len) {
|
|
505
502
|
// @ts-ignore
|
|
506
503
|
var newRows = [];
|
|
507
504
|
for(var i = 0; i < len; i++){
|
|
@@ -784,7 +781,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
784
781
|
value: // payload应该是runtimeSchema和value,然后通过runTimeSchema去找需要修改的data里边的key
|
|
785
782
|
function emit(eventKey, payload) {
|
|
786
783
|
var _this = this;
|
|
787
|
-
var _this1 = this, _superprop_get_emit = function
|
|
784
|
+
var _this1 = this, _superprop_get_emit = function() {
|
|
788
785
|
return _get(_get_prototype_of(Engine.prototype), "emit", _this);
|
|
789
786
|
};
|
|
790
787
|
return _async_to_generator(function() {
|
|
@@ -796,19 +793,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
796
793
|
3,
|
|
797
794
|
3
|
|
798
795
|
];
|
|
799
|
-
if (
|
|
796
|
+
if (_this1.isMounted) {
|
|
800
797
|
warn('The engine-mounted life cycle can only be triggered once');
|
|
801
798
|
return [
|
|
802
799
|
2,
|
|
803
800
|
Promise.resolve([])
|
|
804
801
|
];
|
|
805
802
|
}
|
|
806
|
-
if (!
|
|
803
|
+
if (!_this1._jobTasks.length) return [
|
|
807
804
|
3,
|
|
808
805
|
2
|
|
809
806
|
];
|
|
810
807
|
console.time('engine-mounted need wait');
|
|
811
|
-
needWait = _to_consumable_array(
|
|
808
|
+
needWait = _to_consumable_array(_this1._jobTasks);
|
|
812
809
|
return [
|
|
813
810
|
4,
|
|
814
811
|
Promise.all(needWait)
|
|
@@ -818,15 +815,15 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
818
815
|
console.timeEnd('engine-mounted need wait');
|
|
819
816
|
_state.label = 2;
|
|
820
817
|
case 2:
|
|
821
|
-
|
|
818
|
+
_this1.isMounted = true;
|
|
822
819
|
_state.label = 3;
|
|
823
820
|
case 3:
|
|
824
821
|
// 如果没有挂载的话,需要记录在挂载之前触发的所有任务
|
|
825
|
-
if (!
|
|
822
|
+
if (!_this1.isMounted) {
|
|
826
823
|
promise = new Promise(function(resolve) {
|
|
827
824
|
promiseResolver = resolve;
|
|
828
825
|
});
|
|
829
|
-
|
|
826
|
+
_this1._jobTasks.push(promise);
|
|
830
827
|
}
|
|
831
828
|
return [
|
|
832
829
|
4,
|
|
@@ -837,7 +834,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
837
834
|
if (promiseResolver && promise) {
|
|
838
835
|
// 每一个任务完成的时候,都把自己从task中去掉
|
|
839
836
|
promiseResolver();
|
|
840
|
-
|
|
837
|
+
_this1._jobTasks.splice(_this1._jobTasks.indexOf(promise), 1);
|
|
841
838
|
}
|
|
842
839
|
return [
|
|
843
840
|
2,
|
|
@@ -845,7 +842,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
845
842
|
];
|
|
846
843
|
}
|
|
847
844
|
});
|
|
848
|
-
})
|
|
845
|
+
})();
|
|
849
846
|
}
|
|
850
847
|
},
|
|
851
848
|
{
|
|
@@ -1400,13 +1397,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1400
1397
|
}
|
|
1401
1398
|
var newMapping = _this.getDataBindMapping(dataCode);
|
|
1402
1399
|
if (newMapping) {
|
|
1403
|
-
var _ref;
|
|
1404
1400
|
var _newMapping_fields;
|
|
1405
1401
|
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) {
|
|
1406
1402
|
return item === null || item === void 0 ? void 0 : item.controlId;
|
|
1407
1403
|
});
|
|
1408
1404
|
var mappingValue = _this.getEmptyState(newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId);
|
|
1409
|
-
var
|
|
1405
|
+
var _newState_newMapping_controlId;
|
|
1406
|
+
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 : {});
|
|
1410
1407
|
mappingKeys === null || mappingKeys === void 0 ? void 0 : mappingKeys.forEach(function(key) {
|
|
1411
1408
|
if (!mainStateKeys.includes(key) && key !== 'uid' && newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) {
|
|
1412
1409
|
if (Object.keys(newState).length) {
|
|
@@ -1632,7 +1629,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1632
1629
|
var dataBindMapping = this.getDataBindMapping(dataCode, fieldCode);
|
|
1633
1630
|
if (dataBindMapping) {
|
|
1634
1631
|
var _instance = this.getInstance(dataBindMapping.controlId, rowIndex);
|
|
1635
|
-
this.debugLog(
|
|
1632
|
+
this.debugLog(getLocaleText('CMD.c7371777541576312'), _instance.id, _instance, props, value);
|
|
1636
1633
|
this.setInstance(_instance.id, props, value, rowIndex);
|
|
1637
1634
|
return _instance;
|
|
1638
1635
|
}
|
package/dist/esm/common/Store.js
CHANGED
|
@@ -54,7 +54,8 @@ var Store = /*#__PURE__*/ function() {
|
|
|
54
54
|
_class_call_check(this, Store);
|
|
55
55
|
_define_property(this, "emptyState", void 0);
|
|
56
56
|
_define_property(this, "state", void 0);
|
|
57
|
-
_define_property(this, "dataBindMapping", void 0
|
|
57
|
+
_define_property(this, "dataBindMapping", void 0 // 主要提供给二开使用
|
|
58
|
+
);
|
|
58
59
|
_define_property(this, "controlIdMapping", void 0);
|
|
59
60
|
_define_property(this, "subtableHeadersControlIdMapping", void 0);
|
|
60
61
|
_define_property(this, "defaultState", void 0);
|
|
@@ -135,10 +136,10 @@ var Store = /*#__PURE__*/ function() {
|
|
|
135
136
|
} else {
|
|
136
137
|
var controlInfo = this.controlIdMapping[controlId];
|
|
137
138
|
if (controlInfo !== undefined) {
|
|
138
|
-
var _ref;
|
|
139
139
|
var data = this.state[controlInfo.dataView][controlId];
|
|
140
|
+
var _controlInfo_children;
|
|
140
141
|
// 只有明细表key,再通过rowIndex获取行数据
|
|
141
|
-
if (rowIndex !== undefined && Object.keys((
|
|
142
|
+
if (rowIndex !== undefined && Object.keys((_controlInfo_children = controlInfo === null || controlInfo === void 0 ? void 0 : controlInfo.children) !== null && _controlInfo_children !== void 0 ? _controlInfo_children : {}).length > 0) {
|
|
142
143
|
return data[rowIndex];
|
|
143
144
|
} else {
|
|
144
145
|
return data;
|
|
@@ -287,11 +288,11 @@ item) {
|
|
|
287
288
|
dataViewState[item.id] = JSONCopy(item.props.defaultValue);
|
|
288
289
|
emptyDataViewState[item.id] = JSONCopy(item.props.defaultValue);
|
|
289
290
|
} else {
|
|
290
|
-
var _fill_map, _item_props_defaultRows;
|
|
291
291
|
var emptyTemplate = {};
|
|
292
292
|
loopFormSchema(item.props.headers, function(headerItem) {
|
|
293
293
|
emptyTemplate[headerItem.id] = JSONCopy(headerItem.props.defaultValue);
|
|
294
294
|
});
|
|
295
|
+
var _item_props_defaultRows, _fill_map;
|
|
295
296
|
dataViewState[item.id] = (_fill_map = new Array((_item_props_defaultRows = item.props.defaultRows) !== null && _item_props_defaultRows !== void 0 ? _item_props_defaultRows : 1).fill(0).map(function() {
|
|
296
297
|
return _object_spread({
|
|
297
298
|
uid: 'new:' + buildUUID('uid')
|
|
@@ -419,9 +420,9 @@ item) {
|
|
|
419
420
|
options: []
|
|
420
421
|
};
|
|
421
422
|
loopFormSchema(item.props.headers, function(formControl) {
|
|
422
|
-
var _ref;
|
|
423
423
|
var _data_item_id;
|
|
424
|
-
|
|
424
|
+
var _data_item_id_children;
|
|
425
|
+
Object.assign((_data_item_id_children = (_data_item_id = data[item.id]) === null || _data_item_id === void 0 ? void 0 : _data_item_id.children) !== null && _data_item_id_children !== void 0 ? _data_item_id_children : {}, _define_property({}, formControl.id, {
|
|
425
426
|
dataBind: formControl.props.dataBind
|
|
426
427
|
}));
|
|
427
428
|
});
|
|
@@ -249,7 +249,7 @@ var StringArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
249
249
|
if (Array.isArray(newValue)) {
|
|
250
250
|
return getStringValueArray(newValue);
|
|
251
251
|
}
|
|
252
|
-
} catch (
|
|
252
|
+
} catch (e) {}
|
|
253
253
|
}
|
|
254
254
|
return [
|
|
255
255
|
String(value)
|
|
@@ -295,7 +295,7 @@ var NumberArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
295
295
|
if (isArray(newValue)) {
|
|
296
296
|
return getNumberValueArray(newValue);
|
|
297
297
|
}
|
|
298
|
-
} catch (
|
|
298
|
+
} catch (e) {}
|
|
299
299
|
}
|
|
300
300
|
var newValue1 = Number(value);
|
|
301
301
|
if (Number.isNaN(newValue1)) {
|
|
@@ -340,7 +340,7 @@ var MoneyValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
340
340
|
try {
|
|
341
341
|
var newValue = JSON.parse(value);
|
|
342
342
|
result = new AmountValue(_object_spread({}, oldValue, newValue));
|
|
343
|
-
} catch (
|
|
343
|
+
} catch (e) {}
|
|
344
344
|
}
|
|
345
345
|
if (result) {
|
|
346
346
|
var numberChecker = new NumberValueChecker();
|
|
@@ -388,7 +388,7 @@ var TimeScopeValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
388
388
|
try {
|
|
389
389
|
var newValue = JSON.parse(value);
|
|
390
390
|
result = new RangeDateValue(_object_spread({}, oldValue, newValue));
|
|
391
|
-
} catch (
|
|
391
|
+
} catch (e) {}
|
|
392
392
|
}
|
|
393
393
|
if (result) {
|
|
394
394
|
var stringChecker = new StringValueChecker();
|
|
@@ -437,7 +437,7 @@ var CalcValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
437
437
|
try {
|
|
438
438
|
var newValue = JSON.parse(value);
|
|
439
439
|
result = new CalcValue(_object_spread({}, oldValue, newValue));
|
|
440
|
-
} catch (
|
|
440
|
+
} catch (e) {}
|
|
441
441
|
}
|
|
442
442
|
if (result) {
|
|
443
443
|
var numberChecker = new NumberValueChecker();
|
|
@@ -495,7 +495,7 @@ var AddressValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
495
495
|
try {
|
|
496
496
|
var newValue = JSON.parse(value);
|
|
497
497
|
result = new AddressValue(_object_spread({}, oldValue, camelizeKeys(newValue)));
|
|
498
|
-
} catch (
|
|
498
|
+
} catch (e) {}
|
|
499
499
|
}
|
|
500
500
|
if (result) {
|
|
501
501
|
var stringChecker = new StringValueChecker();
|
|
@@ -129,7 +129,6 @@ function ArrayHandler(target, propertyKey, value, thisKey, callback) {
|
|
|
129
129
|
return Reflect.get(target, propertyKey, receiver);
|
|
130
130
|
},
|
|
131
131
|
set: function set(target, propertyKey, value, receiver) {
|
|
132
|
-
var _reProxyState;
|
|
133
132
|
var newValue = JSONCopy(value);
|
|
134
133
|
// @ts-ignore
|
|
135
134
|
var oldValue = target[propertyKey];
|
|
@@ -146,6 +145,7 @@ function ArrayHandler(target, propertyKey, value, thisKey, callback) {
|
|
|
146
145
|
}
|
|
147
146
|
}
|
|
148
147
|
}
|
|
148
|
+
var _reProxyState;
|
|
149
149
|
newValue = (_reProxyState = reProxyState(newValue)) !== null && _reProxyState !== void 0 ? _reProxyState : newValue;
|
|
150
150
|
// 先设置值,然后再进行触发回调,确保回调内拿到的是最新的值
|
|
151
151
|
var setResult;
|
|
@@ -248,10 +248,10 @@ function flatInstanceForChildren(controls) {
|
|
|
248
248
|
// 最后一个key可能是值对象上边的key,比如金额的amount和currency,计算公式的result和unit,所以需要判断前一个控件是不是一个表单控件,是的话就返回最后一个表单控件
|
|
249
249
|
return findEndItem ? findEndItem : prevItem.controlType === CONTROL_BASE_TYPE.FORM ? prevItem : undefined;
|
|
250
250
|
} else {
|
|
251
|
-
var _ref;
|
|
252
251
|
var _prevItem_children;
|
|
252
|
+
var _prevItem_children_index;
|
|
253
253
|
// 如果有children,则取children中对应的下标,没有的话一直返回prevItem
|
|
254
|
-
return (
|
|
254
|
+
return (_prevItem_children_index = prevItem === null || prevItem === void 0 ? void 0 : (_prevItem_children = prevItem.children) === null || _prevItem_children === void 0 ? void 0 : _prevItem_children[index]) !== null && _prevItem_children_index !== void 0 ? _prevItem_children_index : prevItem;
|
|
255
255
|
}
|
|
256
256
|
}, initInstance);
|
|
257
257
|
}
|
|
@@ -296,18 +296,19 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
296
296
|
* */ function watchSubtableChange() {
|
|
297
297
|
var _this = this;
|
|
298
298
|
this.engine.on('list-change', function(payload) {
|
|
299
|
-
var _ref, _this_dependenciesTriggerMap_get;
|
|
300
299
|
var _payload_options;
|
|
301
300
|
// 初始化前是批量操作。不做处理
|
|
302
301
|
if (_this.engine.isMounted === false) return;
|
|
303
302
|
_this.resetDependencies();
|
|
304
|
-
var
|
|
303
|
+
var _payload_options_changed;
|
|
304
|
+
var changedRows = (_payload_options_changed = (_payload_options = payload.options) === null || _payload_options === void 0 ? void 0 : _payload_options.changed) !== null && _payload_options_changed !== void 0 ? _payload_options_changed : [];
|
|
305
305
|
// 对发生改变的行进行重新计算
|
|
306
306
|
var changedCalc = _this.getCalcControlsFromSubtableRows(changedRows);
|
|
307
307
|
// @ts-ignore
|
|
308
308
|
changedCalc.forEach(function(calcControl) {
|
|
309
309
|
_this.computedCalcValue(calcControl);
|
|
310
310
|
});
|
|
311
|
+
var _this_dependenciesTriggerMap_get;
|
|
311
312
|
var calcControls = (_this_dependenciesTriggerMap_get = _this.dependenciesTriggerMap.get(payload.instance.id)) !== null && _this_dependenciesTriggerMap_get !== void 0 ? _this_dependenciesTriggerMap_get : [];
|
|
312
313
|
// @ts-ignore
|
|
313
314
|
calcControls.forEach(function(calcControl) {
|
|
@@ -323,13 +324,13 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
323
324
|
* */ function watchControlChange() {
|
|
324
325
|
var _this = this;
|
|
325
326
|
this.engine.on('change', function(payload) {
|
|
326
|
-
var _this_dependenciesTriggerMap_get;
|
|
327
327
|
// 初始化前是批量操作。不做处理
|
|
328
328
|
if (_this.engine.isMounted === false) return;
|
|
329
329
|
var instance = payload.instance;
|
|
330
330
|
if (!_this.dependenciesTriggerMap.has(instance.id)) {
|
|
331
331
|
return;
|
|
332
332
|
}
|
|
333
|
+
var _this_dependenciesTriggerMap_get;
|
|
333
334
|
var calcControls = (_this_dependenciesTriggerMap_get = _this.dependenciesTriggerMap.get(instance.id)) !== null && _this_dependenciesTriggerMap_get !== void 0 ? _this_dependenciesTriggerMap_get : [];
|
|
334
335
|
// 在明细子表中的控件,如果计算公式也在明细子表,那只触发同一行的计算公式的计算
|
|
335
336
|
if (payload.rowIndex !== undefined && payload.rowIndex > -1) {
|
|
@@ -368,7 +369,6 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
368
369
|
* */ // @ts-ignore
|
|
369
370
|
function computedCalcValue(control) {
|
|
370
371
|
var _this = this;
|
|
371
|
-
var _ref;
|
|
372
372
|
var scriptEcho = control.props.scriptEcho;
|
|
373
373
|
if (!scriptEcho || scriptEcho.length === 0) {
|
|
374
374
|
return;
|
|
@@ -446,9 +446,10 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
446
446
|
if (result === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.result)) {
|
|
447
447
|
return;
|
|
448
448
|
}
|
|
449
|
+
var _oldValue_unit;
|
|
449
450
|
this.engine.setState(control.id, {
|
|
450
451
|
result: result,
|
|
451
|
-
unit: (
|
|
452
|
+
unit: (_oldValue_unit = oldValue === null || oldValue === void 0 ? void 0 : oldValue.unit) !== null && _oldValue_unit !== void 0 ? _oldValue_unit : ''
|
|
452
453
|
}, rowIndex);
|
|
453
454
|
}
|
|
454
455
|
},
|
|
@@ -60,7 +60,7 @@ function _define_property(obj, key, value) {
|
|
|
60
60
|
return obj;
|
|
61
61
|
}
|
|
62
62
|
function _ts_generator(thisArg, body) {
|
|
63
|
-
var f, y, t, _ = {
|
|
63
|
+
var f, y, t, g, _ = {
|
|
64
64
|
label: 0,
|
|
65
65
|
sent: function() {
|
|
66
66
|
if (t[0] & 1) throw t[1];
|
|
@@ -68,17 +68,13 @@ function _ts_generator(thisArg, body) {
|
|
|
68
68
|
},
|
|
69
69
|
trys: [],
|
|
70
70
|
ops: []
|
|
71
|
-
}
|
|
72
|
-
return
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
79
|
-
value: function() {
|
|
80
|
-
return this;
|
|
81
|
-
}
|
|
71
|
+
};
|
|
72
|
+
return g = {
|
|
73
|
+
next: verb(0),
|
|
74
|
+
"throw": verb(1),
|
|
75
|
+
"return": verb(2)
|
|
76
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
77
|
+
return this;
|
|
82
78
|
}), g;
|
|
83
79
|
function verb(n) {
|
|
84
80
|
return function(v) {
|
|
@@ -90,7 +86,7 @@ function _ts_generator(thisArg, body) {
|
|
|
90
86
|
}
|
|
91
87
|
function step(op) {
|
|
92
88
|
if (f) throw new TypeError("Generator is already executing.");
|
|
93
|
-
while(
|
|
89
|
+
while(_)try {
|
|
94
90
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
95
91
|
if (y = 0, t) op = [
|
|
96
92
|
op[0] & 2,
|
|
@@ -222,13 +218,13 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
222
218
|
key: "engineAddEventListener",
|
|
223
219
|
value: function engineAddEventListener(eventKey, controlEventKey) {
|
|
224
220
|
var _this = this;
|
|
225
|
-
this.engine.on(eventKey, function(
|
|
226
|
-
|
|
221
|
+
this.engine.on(eventKey, /*#__PURE__*/ function() {
|
|
222
|
+
var _ref = _async_to_generator(function(payload) {
|
|
227
223
|
return _ts_generator(this, function(_state) {
|
|
228
224
|
switch(_state.label){
|
|
229
225
|
case 0:
|
|
230
226
|
// 初始化state的时候不触发change事件,必须在engine mounted以后才触发
|
|
231
|
-
if ((eventKey === 'change' || eventKey === 'list-change') && !
|
|
227
|
+
if ((eventKey === 'change' || eventKey === 'list-change') && !_this.engine.isMounted) {
|
|
232
228
|
return [
|
|
233
229
|
2
|
|
234
230
|
];
|
|
@@ -239,7 +235,7 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
239
235
|
];
|
|
240
236
|
return [
|
|
241
237
|
4,
|
|
242
|
-
|
|
238
|
+
_this.callControlEvent(controlEventKey, payload)
|
|
243
239
|
];
|
|
244
240
|
case 1:
|
|
245
241
|
return [
|
|
@@ -252,20 +248,23 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
252
248
|
];
|
|
253
249
|
}
|
|
254
250
|
});
|
|
255
|
-
})
|
|
256
|
-
|
|
251
|
+
});
|
|
252
|
+
return function(payload) {
|
|
253
|
+
return _ref.apply(this, arguments);
|
|
254
|
+
};
|
|
255
|
+
}());
|
|
257
256
|
}
|
|
258
257
|
},
|
|
259
258
|
{
|
|
260
259
|
key: "callControlEvent",
|
|
261
260
|
value: function callControlEvent(name, payload) {
|
|
261
|
+
var _this = this;
|
|
262
262
|
return _async_to_generator(function() {
|
|
263
|
-
var
|
|
263
|
+
var events, result;
|
|
264
264
|
return _ts_generator(this, function(_state) {
|
|
265
265
|
switch(_state.label){
|
|
266
266
|
case 0:
|
|
267
|
-
|
|
268
|
-
events = this.config[payload.instance.id];
|
|
267
|
+
events = _this.config[payload.instance.id];
|
|
269
268
|
if (!events || !Array.isArray(events[name])) {
|
|
270
269
|
return [
|
|
271
270
|
2,
|
|
@@ -274,15 +273,15 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
274
273
|
}
|
|
275
274
|
return [
|
|
276
275
|
4,
|
|
277
|
-
Promise.all(events[name].map(function(
|
|
278
|
-
|
|
276
|
+
Promise.all(events[name].map(/*#__PURE__*/ function() {
|
|
277
|
+
var _ref = _async_to_generator(function(eventName) {
|
|
279
278
|
var execResult;
|
|
280
279
|
return _ts_generator(this, function(_state) {
|
|
281
280
|
switch(_state.label){
|
|
282
281
|
case 0:
|
|
283
282
|
return [
|
|
284
283
|
4,
|
|
285
|
-
|
|
284
|
+
_this.engine.getAction().execAction(eventName, //qiyu 注释掉的两个参数变为全局参数
|
|
286
285
|
// this.engine,
|
|
287
286
|
// this.engine.getAction().actionUtils, //以前是params,空的
|
|
288
287
|
payload)
|
|
@@ -295,8 +294,11 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
295
294
|
];
|
|
296
295
|
}
|
|
297
296
|
});
|
|
298
|
-
})
|
|
299
|
-
|
|
297
|
+
});
|
|
298
|
+
return function(eventName) {
|
|
299
|
+
return _ref.apply(this, arguments);
|
|
300
|
+
};
|
|
301
|
+
}()))
|
|
300
302
|
];
|
|
301
303
|
case 1:
|
|
302
304
|
result = _state.sent();
|
|
@@ -316,7 +318,7 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
316
318
|
];
|
|
317
319
|
}
|
|
318
320
|
});
|
|
319
|
-
})
|
|
321
|
+
})();
|
|
320
322
|
}
|
|
321
323
|
}
|
|
322
324
|
]);
|