@byteluck-fe/model-driven-engine 6.2.0-beta.8 → 6.2.0-cyj.0
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 +16 -21
- package/dist/esm/common/DataManager.js +4 -11
- package/dist/esm/common/Engine.js +135 -115
- package/dist/esm/common/OkWorker.js +2 -6
- package/dist/esm/common/Plugin.js +1 -3
- package/dist/esm/common/Runtime.js +12 -20
- package/dist/esm/common/Store.js +2 -6
- package/dist/esm/common/checkerValue.js +13 -21
- package/dist/esm/common/proxyState.js +4 -2
- package/dist/esm/plugins/CalcPlugin.js +6 -8
- package/dist/esm/plugins/ControlsEventPlugin.js +4 -11
- package/dist/esm/plugins/ES6ModulePlugin.js +3 -7
- package/dist/esm/plugins/LifecycleEventPlugin.js +13 -20
- package/dist/esm/plugins/StylePlugin.js +2 -6
- package/dist/index.umd.js +31 -24
- package/dist/types/common/Engine.d.ts +2 -2
- package/package.json +4 -4
|
@@ -14,11 +14,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
14
14
|
reject(error);
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
-
if (info.done)
|
|
18
|
-
|
|
19
|
-
} else {
|
|
20
|
-
Promise.resolve(value).then(_next, _throw);
|
|
21
|
-
}
|
|
17
|
+
if (info.done) resolve(value);
|
|
18
|
+
else Promise.resolve(value).then(_next, _throw);
|
|
22
19
|
}
|
|
23
20
|
function _async_to_generator(fn) {
|
|
24
21
|
return function() {
|
|
@@ -36,9 +33,7 @@ function _async_to_generator(fn) {
|
|
|
36
33
|
};
|
|
37
34
|
}
|
|
38
35
|
function _class_call_check(instance, Constructor) {
|
|
39
|
-
if (!(instance instanceof Constructor))
|
|
40
|
-
throw new TypeError("Cannot call a class as a function");
|
|
41
|
-
}
|
|
36
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
42
37
|
}
|
|
43
38
|
function _defineProperties(target, props) {
|
|
44
39
|
for(var i = 0; i < props.length; i++){
|
|
@@ -62,28 +57,20 @@ function _define_property(obj, key, value) {
|
|
|
62
57
|
configurable: true,
|
|
63
58
|
writable: true
|
|
64
59
|
});
|
|
65
|
-
} else
|
|
66
|
-
obj[key] = value;
|
|
67
|
-
}
|
|
60
|
+
} else obj[key] = value;
|
|
68
61
|
return obj;
|
|
69
62
|
}
|
|
70
63
|
function _iterable_to_array(iter) {
|
|
71
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
64
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
|
|
65
|
+
return Array.from(iter);
|
|
66
|
+
}
|
|
72
67
|
}
|
|
73
68
|
function _non_iterable_spread() {
|
|
74
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance
|
|
69
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
75
70
|
}
|
|
76
71
|
function _to_consumable_array(arr) {
|
|
77
72
|
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
78
73
|
}
|
|
79
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
80
|
-
if (!o) return;
|
|
81
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
82
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
83
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
84
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
85
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
86
|
-
}
|
|
87
74
|
function _ts_generator(thisArg, body) {
|
|
88
75
|
var f, y, t, _ = {
|
|
89
76
|
label: 0,
|
|
@@ -183,6 +170,14 @@ function _ts_generator(thisArg, body) {
|
|
|
183
170
|
};
|
|
184
171
|
}
|
|
185
172
|
}
|
|
173
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
174
|
+
if (!o) return;
|
|
175
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
176
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
177
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
178
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
179
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
180
|
+
}
|
|
186
181
|
import { error, logerror } from '@byteluck-fe/model-driven-shared';
|
|
187
182
|
export var ActionManager = /*#__PURE__*/ function() {
|
|
188
183
|
"use strict";
|
|
@@ -6,11 +6,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
6
6
|
reject(error);
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
|
-
if (info.done)
|
|
10
|
-
|
|
11
|
-
} else {
|
|
12
|
-
Promise.resolve(value).then(_next, _throw);
|
|
13
|
-
}
|
|
9
|
+
if (info.done) resolve(value);
|
|
10
|
+
else Promise.resolve(value).then(_next, _throw);
|
|
14
11
|
}
|
|
15
12
|
function _async_to_generator(fn) {
|
|
16
13
|
return function() {
|
|
@@ -28,9 +25,7 @@ function _async_to_generator(fn) {
|
|
|
28
25
|
};
|
|
29
26
|
}
|
|
30
27
|
function _class_call_check(instance, Constructor) {
|
|
31
|
-
if (!(instance instanceof Constructor))
|
|
32
|
-
throw new TypeError("Cannot call a class as a function");
|
|
33
|
-
}
|
|
28
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
34
29
|
}
|
|
35
30
|
function _defineProperties(target, props) {
|
|
36
31
|
for(var i = 0; i < props.length; i++){
|
|
@@ -54,9 +49,7 @@ function _define_property(obj, key, value) {
|
|
|
54
49
|
configurable: true,
|
|
55
50
|
writable: true
|
|
56
51
|
});
|
|
57
|
-
} else
|
|
58
|
-
obj[key] = value;
|
|
59
|
-
}
|
|
52
|
+
} else obj[key] = value;
|
|
60
53
|
return obj;
|
|
61
54
|
}
|
|
62
55
|
function _ts_generator(thisArg, body) {
|
|
@@ -10,9 +10,7 @@ function _array_without_holes(arr) {
|
|
|
10
10
|
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
11
11
|
}
|
|
12
12
|
function _assert_this_initialized(self) {
|
|
13
|
-
if (self === void 0)
|
|
14
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
15
|
-
}
|
|
13
|
+
if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
16
14
|
return self;
|
|
17
15
|
}
|
|
18
16
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -23,11 +21,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
23
21
|
reject(error);
|
|
24
22
|
return;
|
|
25
23
|
}
|
|
26
|
-
if (info.done)
|
|
27
|
-
|
|
28
|
-
} else {
|
|
29
|
-
Promise.resolve(value).then(_next, _throw);
|
|
30
|
-
}
|
|
24
|
+
if (info.done) resolve(value);
|
|
25
|
+
else Promise.resolve(value).then(_next, _throw);
|
|
31
26
|
}
|
|
32
27
|
function _async_to_generator(fn) {
|
|
33
28
|
return function() {
|
|
@@ -49,9 +44,7 @@ function _call_super(_this, derived, args) {
|
|
|
49
44
|
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
50
45
|
}
|
|
51
46
|
function _class_call_check(instance, Constructor) {
|
|
52
|
-
if (!(instance instanceof Constructor))
|
|
53
|
-
throw new TypeError("Cannot call a class as a function");
|
|
54
|
-
}
|
|
47
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
55
48
|
}
|
|
56
49
|
function _defineProperties(target, props) {
|
|
57
50
|
for(var i = 0; i < props.length; i++){
|
|
@@ -75,22 +68,17 @@ function _define_property(obj, key, value) {
|
|
|
75
68
|
configurable: true,
|
|
76
69
|
writable: true
|
|
77
70
|
});
|
|
78
|
-
} else
|
|
79
|
-
obj[key] = value;
|
|
80
|
-
}
|
|
71
|
+
} else obj[key] = value;
|
|
81
72
|
return obj;
|
|
82
73
|
}
|
|
83
74
|
function _get(target, property, receiver) {
|
|
84
|
-
if (typeof Reflect !== "undefined" && Reflect.get)
|
|
85
|
-
|
|
86
|
-
} else {
|
|
75
|
+
if (typeof Reflect !== "undefined" && Reflect.get) _get = Reflect.get;
|
|
76
|
+
else {
|
|
87
77
|
_get = function get(target, property, receiver) {
|
|
88
78
|
var base = _super_prop_base(target, property);
|
|
89
79
|
if (!base) return;
|
|
90
80
|
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
91
|
-
if (desc.get)
|
|
92
|
-
return desc.get.call(receiver || target);
|
|
93
|
-
}
|
|
81
|
+
if (desc.get) return desc.get.call(receiver || target);
|
|
94
82
|
return desc.value;
|
|
95
83
|
};
|
|
96
84
|
}
|
|
@@ -115,8 +103,18 @@ function _inherits(subClass, superClass) {
|
|
|
115
103
|
});
|
|
116
104
|
if (superClass) _set_prototype_of(subClass, superClass);
|
|
117
105
|
}
|
|
106
|
+
function _is_native_reflect_construct() {
|
|
107
|
+
try {
|
|
108
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
109
|
+
} catch (_) {}
|
|
110
|
+
return (_is_native_reflect_construct = function() {
|
|
111
|
+
return !!result;
|
|
112
|
+
})();
|
|
113
|
+
}
|
|
118
114
|
function _iterable_to_array(iter) {
|
|
119
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
115
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
|
|
116
|
+
return Array.from(iter);
|
|
117
|
+
}
|
|
120
118
|
}
|
|
121
119
|
function _iterable_to_array_limit(arr, i) {
|
|
122
120
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
@@ -143,10 +141,10 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
143
141
|
return _arr;
|
|
144
142
|
}
|
|
145
143
|
function _non_iterable_rest() {
|
|
146
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance
|
|
144
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
147
145
|
}
|
|
148
146
|
function _non_iterable_spread() {
|
|
149
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance
|
|
147
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
150
148
|
}
|
|
151
149
|
function _object_spread(target) {
|
|
152
150
|
for(var i = 1; i < arguments.length; i++){
|
|
@@ -178,9 +176,8 @@ function ownKeys(object, enumerableOnly) {
|
|
|
178
176
|
}
|
|
179
177
|
function _object_spread_props(target, source) {
|
|
180
178
|
source = source != null ? source : {};
|
|
181
|
-
if (Object.getOwnPropertyDescriptors)
|
|
182
|
-
|
|
183
|
-
} else {
|
|
179
|
+
if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
180
|
+
else {
|
|
184
181
|
ownKeys(Object(source)).forEach(function(key) {
|
|
185
182
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
186
183
|
});
|
|
@@ -188,9 +185,7 @@ function _object_spread_props(target, source) {
|
|
|
188
185
|
return target;
|
|
189
186
|
}
|
|
190
187
|
function _possible_constructor_return(self, call) {
|
|
191
|
-
if (call && (_type_of(call) === "object" || typeof call === "function"))
|
|
192
|
-
return call;
|
|
193
|
-
}
|
|
188
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) return call;
|
|
194
189
|
return _assert_this_initialized(self);
|
|
195
190
|
}
|
|
196
191
|
function _set_prototype_of(o, p) {
|
|
@@ -213,26 +208,6 @@ function _super_prop_base(object, property) {
|
|
|
213
208
|
function _to_consumable_array(arr) {
|
|
214
209
|
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
215
210
|
}
|
|
216
|
-
function _type_of(obj) {
|
|
217
|
-
"@swc/helpers - typeof";
|
|
218
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
219
|
-
}
|
|
220
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
221
|
-
if (!o) return;
|
|
222
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
223
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
224
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
225
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
226
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
227
|
-
}
|
|
228
|
-
function _is_native_reflect_construct() {
|
|
229
|
-
try {
|
|
230
|
-
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
231
|
-
} catch (_) {}
|
|
232
|
-
return (_is_native_reflect_construct = function() {
|
|
233
|
-
return !!result;
|
|
234
|
-
})();
|
|
235
|
-
}
|
|
236
211
|
function _ts_generator(thisArg, body) {
|
|
237
212
|
var f, y, t, _ = {
|
|
238
213
|
label: 0,
|
|
@@ -332,9 +307,20 @@ function _ts_generator(thisArg, body) {
|
|
|
332
307
|
};
|
|
333
308
|
}
|
|
334
309
|
}
|
|
335
|
-
|
|
310
|
+
function _type_of(obj) {
|
|
311
|
+
"@swc/helpers - typeof";
|
|
312
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
313
|
+
}
|
|
314
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
315
|
+
if (!o) return;
|
|
316
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
317
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
318
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
319
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
320
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
321
|
+
}
|
|
336
322
|
import { isDataBind } from '@byteluck-fe/model-driven-core';
|
|
337
|
-
import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, updateValueFromKeys, warn, Watcher,
|
|
323
|
+
import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, updateValueFromKeys, warn, Watcher, isBuiltInControls } from '@byteluck-fe/model-driven-shared';
|
|
338
324
|
import { Runtime } from './Runtime';
|
|
339
325
|
import { Store } from './Store';
|
|
340
326
|
import { findItem, proxyState } from './proxyState';
|
|
@@ -1268,112 +1254,134 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1268
1254
|
* @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
|
|
1269
1255
|
*/ key: "setData",
|
|
1270
1256
|
value: function setData(dataSet, options) {
|
|
1271
|
-
var _this =
|
|
1272
|
-
|
|
1273
|
-
this.debugLog("engine setData方法执行,参数为%o,%o。", dataSet, options);
|
|
1274
|
-
var onlySetData = options === null || options === void 0 ? void 0 : options.onlySetData;
|
|
1275
|
-
var newState = this.store.defaultState;
|
|
1276
|
-
if (onlySetData === true) {
|
|
1277
|
-
newState = {};
|
|
1278
|
-
}
|
|
1279
|
-
Object.keys(dataSet).map(function(dataCode) {
|
|
1257
|
+
var _this, _loop = function(i) {
|
|
1258
|
+
var dataCode = dataCodes[i];
|
|
1280
1259
|
var entity = dataSet[dataCode];
|
|
1281
1260
|
if (Array.isArray(entity)) {
|
|
1282
|
-
var
|
|
1261
|
+
var _storeEmptyState_dataViewId;
|
|
1262
|
+
var mapping = dataBindMapping[dataCode];
|
|
1283
1263
|
if (!mapping) {
|
|
1284
|
-
return;
|
|
1264
|
+
return "continue";
|
|
1285
1265
|
}
|
|
1286
|
-
|
|
1287
|
-
|
|
1266
|
+
var dataViewId = mapping.dataViewId, controlId = mapping.controlId, fields = mapping.fields;
|
|
1267
|
+
if (!newState[dataViewId]) {
|
|
1268
|
+
newState[dataViewId] = {};
|
|
1288
1269
|
}
|
|
1289
1270
|
if (!entity.length) {
|
|
1290
|
-
var
|
|
1291
|
-
newState[
|
|
1271
|
+
var _newState_dataViewId_controlId;
|
|
1272
|
+
newState[dataViewId][controlId] = (_newState_dataViewId_controlId = newState[dataViewId][controlId]) !== null && _newState_dataViewId_controlId !== void 0 ? _newState_dataViewId_controlId : [];
|
|
1292
1273
|
} else {
|
|
1293
|
-
newState[
|
|
1274
|
+
newState[dataViewId][controlId] = [];
|
|
1275
|
+
}
|
|
1276
|
+
var fieldMap = new Map();
|
|
1277
|
+
for(var j = 0; j < fields.length; j++){
|
|
1278
|
+
var field = fields[j];
|
|
1279
|
+
fieldMap.set(field.fieldCode, field);
|
|
1294
1280
|
}
|
|
1281
|
+
var unboundFields = new Set();
|
|
1282
|
+
for(var j1 = 0; j1 < fields.length; j1++){
|
|
1283
|
+
var field1 = fields[j1];
|
|
1284
|
+
if (field1.fieldCode) {
|
|
1285
|
+
unboundFields.add(field1.fieldCode);
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
var emptyRowTemplate = (_storeEmptyState_dataViewId = storeEmptyState[dataViewId]) === null || _storeEmptyState_dataViewId === void 0 ? void 0 : _storeEmptyState_dataViewId[controlId];
|
|
1295
1289
|
var cacheEmptyState = {};
|
|
1296
1290
|
var cacheFieldMapping = {};
|
|
1297
|
-
entity.
|
|
1298
|
-
var
|
|
1299
|
-
var
|
|
1300
|
-
;
|
|
1301
|
-
Object.keys(row)
|
|
1302
|
-
|
|
1303
|
-
|
|
1291
|
+
for(var j2 = 0; j2 < entity.length; j2++){
|
|
1292
|
+
var row = entity[j2];
|
|
1293
|
+
var newRow = JSONCopy(emptyRowTemplate);
|
|
1294
|
+
var skipKey = new Set();
|
|
1295
|
+
var rowKeys = Object.keys(row);
|
|
1296
|
+
for(var k = 0; k < rowKeys.length; k++){
|
|
1297
|
+
var fieldCode = rowKeys[k];
|
|
1298
|
+
var rowValue = row[fieldCode];
|
|
1299
|
+
if (!unboundFields.has(fieldCode) && fieldCode in newRow && rowValue !== undefined) {
|
|
1300
|
+
newRow[fieldCode] = rowValue;
|
|
1304
1301
|
}
|
|
1305
|
-
if (
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1302
|
+
if (skipKey.has(fieldCode)) {
|
|
1303
|
+
continue;
|
|
1304
|
+
}
|
|
1305
|
+
if (!cacheFieldMapping[fieldCode]) {
|
|
1306
|
+
var mappedField = fieldMap.get(fieldCode);
|
|
1307
|
+
if (mappedField) {
|
|
1308
|
+
cacheFieldMapping[fieldCode] = mappedField;
|
|
1309
|
+
}
|
|
1310
1310
|
}
|
|
1311
1311
|
var fieldMapping = cacheFieldMapping[fieldCode];
|
|
1312
1312
|
if (fieldMapping) {
|
|
1313
|
-
if (
|
|
1314
|
-
|
|
1315
|
-
newRow[fieldMapping.controlId] = row[fieldCode];
|
|
1316
|
-
// } else if (fieldMapping.dataBind instanceof ObjectDataBind) {
|
|
1313
|
+
if (isDataBind(fieldMapping.dataBind) && rowValue !== undefined) {
|
|
1314
|
+
newRow[fieldMapping.controlId] = rowValue;
|
|
1317
1315
|
} else if (!isDataBind(fieldMapping.dataBind)) {
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1316
|
+
var fieldControlId = fieldMapping.controlId;
|
|
1317
|
+
if (!cacheEmptyState[fieldControlId]) {
|
|
1318
|
+
var _this_store_getEmptyState;
|
|
1319
|
+
cacheEmptyState[fieldControlId] = JSONCopy((_this_store_getEmptyState = _this.store.getEmptyState(fieldControlId)) !== null && _this_store_getEmptyState !== void 0 ? _this_store_getEmptyState : {});
|
|
1321
1320
|
}
|
|
1322
|
-
var objValue = JSONCopy(cacheEmptyState[
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1321
|
+
var objValue = JSONCopy(cacheEmptyState[fieldControlId]);
|
|
1322
|
+
var dataBind = fieldMapping.dataBind;
|
|
1323
|
+
var bindKeys = Object.keys(dataBind);
|
|
1324
|
+
for(var m = 0; m < bindKeys.length; m++){
|
|
1325
|
+
var key = bindKeys[m];
|
|
1326
|
+
var bindInfo = dataBind[key];
|
|
1327
|
+
var fieldCodeValue = row[bindInfo.fieldCode];
|
|
1328
|
+
if (fieldCodeValue !== undefined) {
|
|
1329
|
+
objValue[key] = fieldCodeValue;
|
|
1327
1330
|
}
|
|
1328
|
-
skipKey.
|
|
1329
|
-
}
|
|
1330
|
-
newRow[
|
|
1331
|
+
skipKey.add(bindInfo.fieldCode);
|
|
1332
|
+
}
|
|
1333
|
+
newRow[fieldControlId] = objValue;
|
|
1331
1334
|
}
|
|
1332
|
-
} else if (fieldCode === 'uid' &&
|
|
1333
|
-
newRow.uid =
|
|
1334
|
-
} else if (fieldCode === 'virtualStore' &&
|
|
1335
|
-
newRow.virtualStore = Object.freeze(
|
|
1335
|
+
} else if (fieldCode === 'uid' && rowValue !== undefined) {
|
|
1336
|
+
newRow.uid = rowValue;
|
|
1337
|
+
} else if (fieldCode === 'virtualStore' && rowValue !== undefined) {
|
|
1338
|
+
newRow.virtualStore = Object.freeze(rowValue);
|
|
1336
1339
|
}
|
|
1337
|
-
}
|
|
1338
|
-
newState[
|
|
1339
|
-
}
|
|
1340
|
+
}
|
|
1341
|
+
newState[dataViewId][controlId].push(newRow);
|
|
1342
|
+
}
|
|
1340
1343
|
} else if (entity) {
|
|
1341
1344
|
var _Object_keys;
|
|
1342
|
-
var
|
|
1343
|
-
;
|
|
1345
|
+
var skipKey1 = [];
|
|
1344
1346
|
var emptyState = JSONCopy(_this.store.emptyState);
|
|
1345
1347
|
if (!((_Object_keys = Object.keys(entity)) === null || _Object_keys === void 0 ? void 0 : _Object_keys.length)) {
|
|
1346
|
-
//
|
|
1348
|
+
// 空对象,不做处理
|
|
1347
1349
|
} else {
|
|
1348
1350
|
Object.keys(entity).map(function(fieldCode) {
|
|
1349
|
-
if (
|
|
1351
|
+
if (skipKey1.includes(fieldCode)) {
|
|
1350
1352
|
return;
|
|
1351
1353
|
}
|
|
1352
|
-
var mapping =
|
|
1354
|
+
var mapping = _this1.getDataBindMapping(dataCode, fieldCode);
|
|
1353
1355
|
if (mapping) {
|
|
1354
1356
|
if (!newState[mapping.dataViewId[0]]) {
|
|
1355
1357
|
newState[mapping.dataViewId[0]] = {};
|
|
1356
1358
|
}
|
|
1357
|
-
if (
|
|
1358
|
-
isDataBind(mapping.dataBind) && entity[fieldCode] !== undefined) {
|
|
1359
|
+
if (isDataBind(mapping.dataBind) && entity[fieldCode] !== undefined) {
|
|
1359
1360
|
newState[mapping.dataViewId[0]][mapping.controlId] = entity[fieldCode] !== undefined ? entity[fieldCode] : emptyState[mapping.dataViewId[0]][mapping.controlId];
|
|
1360
|
-
// } else if (mapping.dataBind instanceof ObjectDataBind) {
|
|
1361
1361
|
} else if (!isDataBind(mapping.dataBind)) {
|
|
1362
1362
|
var _this_getEmptyState;
|
|
1363
|
-
var objValue = (_this_getEmptyState =
|
|
1363
|
+
var objValue = (_this_getEmptyState = _this1.getEmptyState(mapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {};
|
|
1364
1364
|
Object.keys(mapping.dataBind).map(function(key) {
|
|
1365
1365
|
var dataBind = mapping.dataBind[key];
|
|
1366
|
-
//金额及计算公式控件在赋值时会经过两次 且当控件值不为同一个模型时,会赋值两次 会导致前后覆盖行为。
|
|
1367
1366
|
if (dataSet[dataBind.dataCode]) {
|
|
1368
1367
|
var extendEntity = dataSet[dataBind.dataCode];
|
|
1369
1368
|
if (extendEntity[dataBind.fieldCode] !== undefined) {
|
|
1370
1369
|
objValue[key] = extendEntity[dataBind.fieldCode];
|
|
1371
1370
|
}
|
|
1372
1371
|
}
|
|
1373
|
-
|
|
1372
|
+
skipKey1.push(dataBind.fieldCode);
|
|
1374
1373
|
});
|
|
1375
1374
|
newState[mapping.dataViewId[0]][mapping.controlId] = objValue;
|
|
1376
1375
|
}
|
|
1376
|
+
} else {
|
|
1377
|
+
var mapping1 = _this1.getDataBindMapping(dataCode);
|
|
1378
|
+
if ((mapping1 === null || mapping1 === void 0 ? void 0 : mapping1.dataViewId) && entity[fieldCode] !== undefined) {
|
|
1379
|
+
var dataViweId = mapping1 === null || mapping1 === void 0 ? void 0 : mapping1.dataViewId;
|
|
1380
|
+
var isInDataView = fieldCode in (emptyState[dataViweId] || {});
|
|
1381
|
+
if (isInDataView) {
|
|
1382
|
+
newState[dataViweId][fieldCode] = entity[fieldCode];
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1377
1385
|
}
|
|
1378
1386
|
});
|
|
1379
1387
|
}
|
|
@@ -1399,7 +1407,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1399
1407
|
_this.debugLog("engine setData方法默认值及表单数据组合完成,参数为%o。", newState);
|
|
1400
1408
|
}
|
|
1401
1409
|
}
|
|
1402
|
-
}
|
|
1410
|
+
};
|
|
1411
|
+
var _this1 = this;
|
|
1412
|
+
// @i18n-translate-ignore
|
|
1413
|
+
this.debugLog("engine setData方法执行,参数为%o,%o。", dataSet, options);
|
|
1414
|
+
var onlySetData = options === null || options === void 0 ? void 0 : options.onlySetData;
|
|
1415
|
+
var newState = this.store.defaultState;
|
|
1416
|
+
if (onlySetData === true) {
|
|
1417
|
+
newState = {};
|
|
1418
|
+
}
|
|
1419
|
+
var dataBindMapping = this.store.dataBindMapping;
|
|
1420
|
+
var storeEmptyState = this.store.emptyState;
|
|
1421
|
+
var dataCodes = Object.keys(dataSet);
|
|
1422
|
+
for(var i = 0; i < dataCodes.length; i++)_this = this, _loop(i);
|
|
1403
1423
|
// @i18n-translate-ignore
|
|
1404
1424
|
this.debugLog("engine setData方法数据组合完成,参数为%o。", newState);
|
|
1405
1425
|
this.setStates(newState, undefined, _object_spread({
|
|
@@ -1407,7 +1427,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1407
1427
|
}, options));
|
|
1408
1428
|
this.runtime.getFlatInstances();
|
|
1409
1429
|
// @i18n-translate-ignore
|
|
1410
|
-
this.debugLog(
|
|
1430
|
+
this.debugLog("engine setData方法执行完成。");
|
|
1411
1431
|
}
|
|
1412
1432
|
},
|
|
1413
1433
|
{
|
|
@@ -1601,7 +1621,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
|
|
|
1601
1621
|
var _instance = this.getInstance(dataBindMapping.controlId, rowIndex);
|
|
1602
1622
|
this.debugLog("调用了setFieldInstance[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
|
|
1603
1623
|
this.setInstance(_instance.id, props, value, rowIndex);
|
|
1604
|
-
return
|
|
1624
|
+
return _instance;
|
|
1605
1625
|
}
|
|
1606
1626
|
}
|
|
1607
1627
|
},
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
function _class_call_check(instance, Constructor) {
|
|
2
|
-
if (!(instance instanceof Constructor))
|
|
3
|
-
throw new TypeError("Cannot call a class as a function");
|
|
4
|
-
}
|
|
2
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
5
3
|
}
|
|
6
4
|
function _defineProperties(target, props) {
|
|
7
5
|
for(var i = 0; i < props.length; i++){
|
|
@@ -25,9 +23,7 @@ function _define_property(obj, key, value) {
|
|
|
25
23
|
configurable: true,
|
|
26
24
|
writable: true
|
|
27
25
|
});
|
|
28
|
-
} else
|
|
29
|
-
obj[key] = value;
|
|
30
|
-
}
|
|
26
|
+
} else obj[key] = value;
|
|
31
27
|
return obj;
|
|
32
28
|
}
|
|
33
29
|
import { log } from '@byteluck-fe/model-driven-shared';
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
function _class_call_check(instance, Constructor) {
|
|
2
|
-
if (!(instance instanceof Constructor))
|
|
3
|
-
throw new TypeError("Cannot call a class as a function");
|
|
4
|
-
}
|
|
2
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
5
3
|
}
|
|
6
4
|
var Plugin = function Plugin() {
|
|
7
5
|
"use strict";
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
function _assert_this_initialized(self) {
|
|
2
|
-
if (self === void 0)
|
|
3
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
4
|
-
}
|
|
2
|
+
if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
5
3
|
return self;
|
|
6
4
|
}
|
|
7
5
|
function _call_super(_this, derived, args) {
|
|
@@ -9,9 +7,7 @@ function _call_super(_this, derived, args) {
|
|
|
9
7
|
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
10
8
|
}
|
|
11
9
|
function _class_call_check(instance, Constructor) {
|
|
12
|
-
if (!(instance instanceof Constructor))
|
|
13
|
-
throw new TypeError("Cannot call a class as a function");
|
|
14
|
-
}
|
|
10
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
15
11
|
}
|
|
16
12
|
function _defineProperties(target, props) {
|
|
17
13
|
for(var i = 0; i < props.length; i++){
|
|
@@ -35,9 +31,7 @@ function _define_property(obj, key, value) {
|
|
|
35
31
|
configurable: true,
|
|
36
32
|
writable: true
|
|
37
33
|
});
|
|
38
|
-
} else
|
|
39
|
-
obj[key] = value;
|
|
40
|
-
}
|
|
34
|
+
} else obj[key] = value;
|
|
41
35
|
return obj;
|
|
42
36
|
}
|
|
43
37
|
function _get_prototype_of(o) {
|
|
@@ -59,10 +53,16 @@ function _inherits(subClass, superClass) {
|
|
|
59
53
|
});
|
|
60
54
|
if (superClass) _set_prototype_of(subClass, superClass);
|
|
61
55
|
}
|
|
56
|
+
function _is_native_reflect_construct() {
|
|
57
|
+
try {
|
|
58
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
59
|
+
} catch (_) {}
|
|
60
|
+
return (_is_native_reflect_construct = function() {
|
|
61
|
+
return !!result;
|
|
62
|
+
})();
|
|
63
|
+
}
|
|
62
64
|
function _possible_constructor_return(self, call) {
|
|
63
|
-
if (call && (_type_of(call) === "object" || typeof call === "function"))
|
|
64
|
-
return call;
|
|
65
|
-
}
|
|
65
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) return call;
|
|
66
66
|
return _assert_this_initialized(self);
|
|
67
67
|
}
|
|
68
68
|
function _set_prototype_of(o, p) {
|
|
@@ -76,14 +76,6 @@ function _type_of(obj) {
|
|
|
76
76
|
"@swc/helpers - typeof";
|
|
77
77
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
78
78
|
}
|
|
79
|
-
function _is_native_reflect_construct() {
|
|
80
|
-
try {
|
|
81
|
-
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
82
|
-
} catch (_) {}
|
|
83
|
-
return (_is_native_reflect_construct = function() {
|
|
84
|
-
return !!result;
|
|
85
|
-
})();
|
|
86
|
-
}
|
|
87
79
|
import { RegisterControls, isDataBind } from '@byteluck-fe/model-driven-core';
|
|
88
80
|
import { CONTROL_BASE_TYPE, CONTROL_TYPE, JSONCopy, loopFormSchema, isArray } from '@byteluck-fe/model-driven-shared';
|
|
89
81
|
import { hasChildrenControl, loopDataViewControl, loopFormControl } from '../utils/runtimeUtils';
|
package/dist/esm/common/Store.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
function _class_call_check(instance, Constructor) {
|
|
2
|
-
if (!(instance instanceof Constructor))
|
|
3
|
-
throw new TypeError("Cannot call a class as a function");
|
|
4
|
-
}
|
|
2
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
5
3
|
}
|
|
6
4
|
function _defineProperties(target, props) {
|
|
7
5
|
for(var i = 0; i < props.length; i++){
|
|
@@ -25,9 +23,7 @@ function _define_property(obj, key, value) {
|
|
|
25
23
|
configurable: true,
|
|
26
24
|
writable: true
|
|
27
25
|
});
|
|
28
|
-
} else
|
|
29
|
-
obj[key] = value;
|
|
30
|
-
}
|
|
26
|
+
} else obj[key] = value;
|
|
31
27
|
return obj;
|
|
32
28
|
}
|
|
33
29
|
function _object_spread(target) {
|