@byteluck-fe/model-driven-engine 6.2.0-beta.9 → 6.2.0-cyj.1

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.
@@ -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
- resolve(value);
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) return Array.from(iter);
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.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
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,
@@ -93,9 +80,17 @@ function _ts_generator(thisArg, body) {
93
80
  },
94
81
  trys: [],
95
82
  ops: []
96
- }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
97
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
98
- return this;
83
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
84
+ return d(g, "next", {
85
+ value: verb(0)
86
+ }), d(g, "throw", {
87
+ value: verb(1)
88
+ }), d(g, "return", {
89
+ value: verb(2)
90
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
91
+ value: function() {
92
+ return this;
93
+ }
99
94
  }), g;
100
95
  function verb(n) {
101
96
  return function(v) {
@@ -175,6 +170,14 @@ function _ts_generator(thisArg, body) {
175
170
  };
176
171
  }
177
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
+ }
178
181
  import { error, logerror } from '@byteluck-fe/model-driven-shared';
179
182
  export var ActionManager = /*#__PURE__*/ function() {
180
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
- resolve(value);
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) {
@@ -68,9 +61,17 @@ function _ts_generator(thisArg, body) {
68
61
  },
69
62
  trys: [],
70
63
  ops: []
71
- }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
72
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
73
- return this;
64
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
65
+ return d(g, "next", {
66
+ value: verb(0)
67
+ }), d(g, "throw", {
68
+ value: verb(1)
69
+ }), d(g, "return", {
70
+ value: verb(2)
71
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
72
+ value: function() {
73
+ return this;
74
+ }
74
75
  }), g;
75
76
  function verb(n) {
76
77
  return function(v) {
@@ -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
- resolve(value);
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
- _get = Reflect.get;
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) return Array.from(iter);
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.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
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.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
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
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
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,
@@ -242,9 +217,17 @@ function _ts_generator(thisArg, body) {
242
217
  },
243
218
  trys: [],
244
219
  ops: []
245
- }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
246
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
247
- return this;
220
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
221
+ return d(g, "next", {
222
+ value: verb(0)
223
+ }), d(g, "throw", {
224
+ value: verb(1)
225
+ }), d(g, "return", {
226
+ value: verb(2)
227
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
228
+ value: function() {
229
+ return this;
230
+ }
248
231
  }), g;
249
232
  function verb(n) {
250
233
  return function(v) {
@@ -324,9 +307,20 @@ function _ts_generator(thisArg, body) {
324
307
  };
325
308
  }
326
309
  }
327
- import { getLocaleText } from '@byteluck-fe/locale-message';
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
+ }
328
322
  import { isDataBind } from '@byteluck-fe/model-driven-core';
329
- import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, updateValueFromKeys, warn, Watcher, deepFreeze, isBuiltInControls } from '@byteluck-fe/model-driven-shared';
323
+ import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, updateValueFromKeys, warn, Watcher, isBuiltInControls } from '@byteluck-fe/model-driven-shared';
330
324
  import { Runtime } from './Runtime';
331
325
  import { Store } from './Store';
332
326
  import { findItem, proxyState } from './proxyState';
@@ -494,7 +488,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
494
488
  // if (!(subtable instanceof RuntimeListControl)) return
495
489
  if (!((subtable === null || subtable === void 0 ? void 0 : subtable.controlType) === CONTROL_BASE_TYPE.LIST)) return;
496
490
  // 新增多行方法
497
- var createRows = function(len) {
491
+ var createRows = function createRows(len) {
498
492
  // @ts-ignore
499
493
  var newRows = [];
500
494
  for(var i = 0; i < len; i++){
@@ -777,7 +771,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
777
771
  value: // payload应该是runtimeSchema和value,然后通过runTimeSchema去找需要修改的data里边的key
778
772
  function emit(eventKey, payload) {
779
773
  var _this = this;
780
- var _this1 = this, _superprop_get_emit = function() {
774
+ var _this1 = this, _superprop_get_emit = function _superprop_get_emit() {
781
775
  return _get(_get_prototype_of(Engine.prototype), "emit", _this);
782
776
  };
783
777
  return _async_to_generator(function() {
@@ -1260,124 +1254,146 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1260
1254
  * @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
1261
1255
  */ key: "setData",
1262
1256
  value: function setData(dataSet, options) {
1263
- var _this = this;
1264
- // @i18n-translate-ignore
1265
- this.debugLog("engine setData方法执行,参数为%o,%o。", dataSet, options);
1266
- var onlySetData = options === null || options === void 0 ? void 0 : options.onlySetData;
1267
- var newState = this.store.defaultState;
1268
- if (onlySetData === true) {
1269
- newState = {};
1270
- }
1271
- Object.keys(dataSet).map(function(dataCode) {
1257
+ var _this, _loop = function(i) {
1258
+ var dataCode = dataCodes[i];
1272
1259
  var entity = dataSet[dataCode];
1273
1260
  if (Array.isArray(entity)) {
1274
- var mapping = _this.getDataBindMapping(dataCode);
1261
+ var _storeEmptyState_dataViewId;
1262
+ var mapping = dataBindMapping[dataCode];
1275
1263
  if (!mapping) {
1276
- return;
1264
+ return "continue";
1277
1265
  }
1278
- if (!newState[mapping.dataViewId]) {
1279
- newState[mapping.dataViewId] = {};
1266
+ var dataViewId = mapping.dataViewId, controlId = mapping.controlId, fields = mapping.fields;
1267
+ if (!newState[dataViewId]) {
1268
+ newState[dataViewId] = {};
1280
1269
  }
1281
1270
  if (!entity.length) {
1282
- var _newState_mapping_dataViewId_mapping_controlId;
1283
- newState[mapping.dataViewId][mapping.controlId] = (_newState_mapping_dataViewId_mapping_controlId = newState[mapping.dataViewId][mapping.controlId]) !== null && _newState_mapping_dataViewId_mapping_controlId !== void 0 ? _newState_mapping_dataViewId_mapping_controlId : [];
1271
+ var _newState_dataViewId_controlId;
1272
+ newState[dataViewId][controlId] = (_newState_dataViewId_controlId = newState[dataViewId][controlId]) !== null && _newState_dataViewId_controlId !== void 0 ? _newState_dataViewId_controlId : [];
1284
1273
  } else {
1285
- newState[mapping.dataViewId][mapping.controlId] = [];
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);
1286
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];
1287
1289
  var cacheEmptyState = {};
1288
1290
  var cacheFieldMapping = {};
1289
- entity.map(function(row) {
1290
- var newRow = JSONCopy(_this.store.emptyState[mapping.dataViewId][mapping.controlId]);
1291
- var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
1292
- ;
1293
- Object.keys(row).map(function(fieldCode) {
1294
- if (skipKey.includes(fieldCode)) {
1295
- return;
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;
1296
1301
  }
1297
- if (cacheFieldMapping.hasOwnProperty(fieldCode) === false) {
1298
- var _this_store_dataBindMapping_dataCode_fields, _this_store_dataBindMapping_dataCode;
1299
- cacheFieldMapping[fieldCode] = (_this_store_dataBindMapping_dataCode = _this.store.dataBindMapping[dataCode]) === null || _this_store_dataBindMapping_dataCode === void 0 ? void 0 : (_this_store_dataBindMapping_dataCode_fields = _this_store_dataBindMapping_dataCode.fields) === null || _this_store_dataBindMapping_dataCode_fields === void 0 ? void 0 : _this_store_dataBindMapping_dataCode_fields.find(function(i) {
1300
- return i.fieldCode === fieldCode;
1301
- });
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
+ }
1302
1310
  }
1303
1311
  var fieldMapping = cacheFieldMapping[fieldCode];
1304
1312
  if (fieldMapping) {
1305
- if (// fieldMapping.dataBind instanceof DataBind &&
1306
- isDataBind(fieldMapping.dataBind) && row[fieldCode] !== undefined) {
1307
- newRow[fieldMapping.controlId] = row[fieldCode];
1308
- // } else if (fieldMapping.dataBind instanceof ObjectDataBind) {
1313
+ if (isDataBind(fieldMapping.dataBind) && rowValue !== undefined) {
1314
+ newRow[fieldMapping.controlId] = rowValue;
1309
1315
  } else if (!isDataBind(fieldMapping.dataBind)) {
1310
- if (cacheEmptyState.hasOwnProperty(fieldMapping.controlId) === false) {
1311
- var _this_getEmptyState;
1312
- cacheEmptyState[fieldMapping.controlId] = JSONCopy((_this_getEmptyState = _this.getEmptyState(fieldMapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {});
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 : {});
1313
1320
  }
1314
- var objValue = JSONCopy(cacheEmptyState[fieldMapping.controlId]);
1315
- Object.keys(fieldMapping.dataBind).map(function(key) {
1316
- var dataBind = fieldMapping.dataBind[key];
1317
- if (row[dataBind.fieldCode] !== undefined) {
1318
- objValue[key] = row[dataBind.fieldCode];
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;
1319
1330
  }
1320
- skipKey.push(dataBind.fieldCode);
1321
- });
1322
- newRow[fieldMapping.controlId] = objValue;
1331
+ skipKey.add(bindInfo.fieldCode);
1332
+ }
1333
+ newRow[fieldControlId] = objValue;
1323
1334
  }
1324
- } else if (fieldCode === 'uid' && row.uid !== undefined) {
1325
- newRow.uid = row.uid;
1326
- } else if (fieldCode === 'virtualStore' && row.virtualStore !== undefined) {
1327
- newRow.virtualStore = Object.freeze(row.virtualStore);
1335
+ } else if (fieldCode === 'uid' && rowValue !== undefined) {
1336
+ newRow.uid = rowValue;
1337
+ } else if (fieldCode === 'virtualStore' && rowValue !== undefined) {
1338
+ newRow.virtualStore = Object.freeze(rowValue);
1328
1339
  }
1329
- });
1330
- newState[mapping.dataViewId][mapping.controlId].push(newRow);
1331
- });
1340
+ }
1341
+ newState[dataViewId][controlId].push(newRow);
1342
+ }
1332
1343
  } else if (entity) {
1333
1344
  var _Object_keys;
1334
- var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
1335
- ;
1345
+ var skipKey1 = [];
1336
1346
  var emptyState = JSONCopy(_this.store.emptyState);
1337
1347
  if (!((_Object_keys = Object.keys(entity)) === null || _Object_keys === void 0 ? void 0 : _Object_keys.length)) {
1338
- // newState = this.store.defaultState
1348
+ // 空对象,不做处理
1339
1349
  } else {
1340
1350
  Object.keys(entity).map(function(fieldCode) {
1341
- if (skipKey.includes(fieldCode)) {
1351
+ if (skipKey1.includes(fieldCode)) {
1342
1352
  return;
1343
1353
  }
1344
- var mapping = _this.getDataBindMapping(dataCode, fieldCode);
1354
+ var mapping = _this1.getDataBindMapping(dataCode, fieldCode);
1345
1355
  if (mapping) {
1346
1356
  if (!newState[mapping.dataViewId[0]]) {
1347
1357
  newState[mapping.dataViewId[0]] = {};
1348
1358
  }
1349
- if (// mapping.dataBind instanceof DataBind &&
1350
- isDataBind(mapping.dataBind) && entity[fieldCode] !== undefined) {
1359
+ if (isDataBind(mapping.dataBind) && entity[fieldCode] !== undefined) {
1351
1360
  newState[mapping.dataViewId[0]][mapping.controlId] = entity[fieldCode] !== undefined ? entity[fieldCode] : emptyState[mapping.dataViewId[0]][mapping.controlId];
1352
- // } else if (mapping.dataBind instanceof ObjectDataBind) {
1353
1361
  } else if (!isDataBind(mapping.dataBind)) {
1354
1362
  var _this_getEmptyState;
1355
- var objValue = (_this_getEmptyState = _this.getEmptyState(mapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {};
1363
+ var objValue = (_this_getEmptyState = _this1.getEmptyState(mapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {};
1356
1364
  Object.keys(mapping.dataBind).map(function(key) {
1357
1365
  var dataBind = mapping.dataBind[key];
1358
- //金额及计算公式控件在赋值时会经过两次 且当控件值不为同一个模型时,会赋值两次 会导致前后覆盖行为。
1359
1366
  if (dataSet[dataBind.dataCode]) {
1360
1367
  var extendEntity = dataSet[dataBind.dataCode];
1361
1368
  if (extendEntity[dataBind.fieldCode] !== undefined) {
1362
1369
  objValue[key] = extendEntity[dataBind.fieldCode];
1363
1370
  }
1364
1371
  }
1365
- skipKey.push(dataBind.fieldCode);
1372
+ skipKey1.push(dataBind.fieldCode);
1366
1373
  });
1367
1374
  newState[mapping.dataViewId[0]][mapping.controlId] = objValue;
1368
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
+ }
1369
1385
  }
1370
1386
  });
1371
1387
  }
1372
1388
  var newMapping = _this.getDataBindMapping(dataCode);
1373
1389
  if (newMapping) {
1390
+ var _ref;
1374
1391
  var _newMapping_fields;
1375
1392
  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) {
1376
1393
  return item === null || item === void 0 ? void 0 : item.controlId;
1377
1394
  });
1378
1395
  var mappingValue = _this.getEmptyState(newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId);
1379
- var _newState_newMapping_controlId;
1380
- 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 : {});
1396
+ var mainStateKeys = Object.keys((_ref = newState === null || newState === void 0 ? void 0 : newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) !== null && _ref !== void 0 ? _ref : {});
1381
1397
  mappingKeys === null || mappingKeys === void 0 ? void 0 : mappingKeys.forEach(function(key) {
1382
1398
  if (!mainStateKeys.includes(key) && key !== 'uid' && newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) {
1383
1399
  if (Object.keys(newState).length) {
@@ -1391,7 +1407,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1391
1407
  _this.debugLog("engine setData方法默认值及表单数据组合完成,参数为%o。", newState);
1392
1408
  }
1393
1409
  }
1394
- });
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);
1395
1423
  // @i18n-translate-ignore
1396
1424
  this.debugLog("engine setData方法数据组合完成,参数为%o。", newState);
1397
1425
  this.setStates(newState, undefined, _object_spread({
@@ -1399,7 +1427,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1399
1427
  }, options));
1400
1428
  this.runtime.getFlatInstances();
1401
1429
  // @i18n-translate-ignore
1402
- this.debugLog(getLocaleText('CMD.b44b1751969061759'));
1430
+ this.debugLog("engine setData方法执行完成。");
1403
1431
  }
1404
1432
  },
1405
1433
  {
@@ -1593,7 +1621,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1593
1621
  var _instance = this.getInstance(dataBindMapping.controlId, rowIndex);
1594
1622
  this.debugLog("调用了setFieldInstance[%o]: 修改instance: %o的%o属性,修改的值为%o。", _instance.id, _instance, props, value);
1595
1623
  this.setInstance(_instance.id, props, value, rowIndex);
1596
- return deepFreeze(_instance);
1624
+ return _instance;
1597
1625
  }
1598
1626
  }
1599
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";