@byteluck-fe/model-driven-engine 2.5.0-beta.4 → 2.6.0-alpha.10

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.
@@ -354,7 +354,6 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
354
354
  }
355
355
  // @ts-ignore
356
356
  if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE)) {
357
- var ref;
358
357
  if (newValue === null) {
359
358
  return [];
360
359
  }
@@ -369,7 +368,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
369
368
  }, {});
370
369
  // @ts-ignore
371
370
  var emptyState = this.getEmptyState(instance.id);
372
- return (ref = newValue) === null || ref === void 0 ? void 0 : ref.map(function(row) {
371
+ return newValue.map(function(row) {
373
372
  // @ts-ignore
374
373
  return checkerSubtableValue(fieldTypeMap, row, emptyState);
375
374
  });
@@ -770,7 +769,7 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
770
769
  */ key: "setStates",
771
770
  value: function setStates(states, rowIndex, options) {
772
771
  var _this = this;
773
- var newStates = states !== null && states !== void 0 ? states : {};
772
+ var newStates = states;
774
773
  Object.keys(newStates).forEach(function(stateId) {
775
774
  var _this2 = _this;
776
775
  Object.entries(_this.store.controlIdMapping).forEach(function(param) {
@@ -843,19 +842,15 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
843
842
  var data = getFieldData.map(function(item) {
844
843
  var obj = {};
845
844
  for(var key in item){
846
- var ref, ref2, ref3;
847
- var fieldCode = (ref2 = (ref = controlIdMapping[controlId]) === null || ref === void 0 ? void 0 : ref.children[key]) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.dataBind) === null || ref3 === void 0 ? void 0 : ref3.fieldCode;
848
- //未绑定字段的控件,直接抛弃
849
- if (fieldCode !== '') {
850
- var ref4;
851
- if (fieldCode) {
852
- obj[fieldCode] = item[key];
853
- } else if ((ref4 = controlIdMapping[controlId]) === null || ref4 === void 0 ? void 0 : ref4.children[key]) {
854
- // 兼容一个控件需要绑定多个字段的情况
855
- for(var keyChi in item[key]){
856
- var ref5, ref6;
857
- obj[(ref6 = (ref5 = controlIdMapping[controlId]) === null || ref5 === void 0 ? void 0 : ref5.children[key]) === null || ref6 === void 0 ? void 0 : ref6.dataBind[keyChi].fieldCode] = item[key][keyChi];
858
- }
845
+ var ref, ref2, ref3, ref4;
846
+ if ((ref2 = (ref = controlIdMapping[controlId]) === null || ref === void 0 ? void 0 : ref.children[key]) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.dataBind) === null || ref3 === void 0 ? void 0 : ref3.fieldCode) {
847
+ var ref5;
848
+ obj[(ref5 = controlIdMapping[controlId].children[key]) === null || ref5 === void 0 ? void 0 : ref5.dataBind.fieldCode] = item[key];
849
+ } else if ((ref4 = controlIdMapping[controlId]) === null || ref4 === void 0 ? void 0 : ref4.children[key]) {
850
+ // 兼容一个控件需要绑定多个字段的情况
851
+ for(var keyChi in item[key]){
852
+ var ref6, ref7;
853
+ obj[(ref7 = (ref6 = controlIdMapping[controlId]) === null || ref6 === void 0 ? void 0 : ref6.children[key]) === null || ref7 === void 0 ? void 0 : ref7.dataBind[keyChi].fieldCode] = item[key][keyChi];
859
854
  }
860
855
  }
861
856
  }
@@ -864,27 +859,25 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
864
859
  return data;
865
860
  } else {
866
861
  var _loop = function(key1) {
867
- var ref15, ref7, ref8, ref9;
868
- if ((ref15 = controlIdMapping[key1]) === null || ref15 === void 0 ? void 0 : (ref7 = ref15.dataBind) === null || ref7 === void 0 ? void 0 : ref7.fieldCode) {
869
- var ref10;
870
- obj1[(ref10 = controlIdMapping[key1]) === null || ref10 === void 0 ? void 0 : ref10.dataBind.fieldCode] = getFieldData[key1];
871
- } else if ((ref8 = controlIdMapping[key1]) === null || ref8 === void 0 ? void 0 : (ref9 = ref8.dataBind) === null || ref9 === void 0 ? void 0 : ref9.dataCode) {
862
+ var ref17, ref8, ref9, ref10;
863
+ if ((ref17 = controlIdMapping[key1]) === null || ref17 === void 0 ? void 0 : (ref8 = ref17.dataBind) === null || ref8 === void 0 ? void 0 : ref8.fieldCode) {
872
864
  var ref11;
865
+ obj1[(ref11 = controlIdMapping[key1]) === null || ref11 === void 0 ? void 0 : ref11.dataBind.fieldCode] = getFieldData[key1];
866
+ } else if ((ref9 = controlIdMapping[key1]) === null || ref9 === void 0 ? void 0 : (ref10 = ref9.dataBind) === null || ref10 === void 0 ? void 0 : ref10.dataCode) {
867
+ var ref12;
873
868
  // 明细字表只循环一层明细子表未递归
874
- obj1[(ref11 = controlIdMapping[key1]) === null || ref11 === void 0 ? void 0 : ref11.dataBind.dataCode] = getFieldData[key1].map(function(item) {
869
+ obj1[(ref12 = controlIdMapping[key1]) === null || ref12 === void 0 ? void 0 : ref12.dataBind.dataCode] = getFieldData[key1].map(function(item) {
875
870
  var objChi = {};
876
871
  for(var keyChi in item){
877
872
  var ref;
878
- var fieldCode = (ref = controlIdMapping[key1].children[keyChi]) === null || ref === void 0 ? void 0 : ref.dataBind.fieldCode;
879
- //未绑定字段的控件,直接抛弃
880
- if (fieldCode !== '') {
881
- if (fieldCode) {
882
- objChi[fieldCode] = item[keyChi];
883
- } else {
884
- for(var keyChi1 in item[keyChi]){
885
- var ref14;
886
- objChi[(ref14 = controlIdMapping[key1].children[keyChi]) === null || ref14 === void 0 ? void 0 : ref14.dataBind[keyChi1].fieldCode] = item[keyChi][keyChi1];
887
- }
873
+ if ((ref = controlIdMapping[key1].children[keyChi]) === null || ref === void 0 ? void 0 : ref.dataBind.fieldCode) {
874
+ var ref15;
875
+ objChi[(ref15 = controlIdMapping[key1].children[keyChi]) === null || ref15 === void 0 ? void 0 : ref15.dataBind.fieldCode] = item[keyChi];
876
+ } else {
877
+ for(var keyChi1 in item[keyChi]){
878
+ var ref16;
879
+ objChi[(ref16 = controlIdMapping[key1].children[keyChi]) === null || ref16 === void 0 ? void 0 : ref16.dataBind[keyChi1].fieldCode] = item[keyChi][keyChi1];
880
+ //
888
881
  }
889
882
  }
890
883
  }
@@ -893,8 +886,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
893
886
  } else if (controlIdMapping[key1]) {
894
887
  // 兼容一个控件需要绑定多个字段的情况
895
888
  for(var keyChi2 in getFieldData[key1]){
896
- var ref12, ref13;
897
- obj1[(ref13 = (ref12 = controlIdMapping[key1]) === null || ref12 === void 0 ? void 0 : ref12.dataBind[keyChi2]) === null || ref13 === void 0 ? void 0 : ref13.fieldCode] = getFieldData[key1][keyChi2];
889
+ var ref13, ref14;
890
+ obj1[(ref14 = (ref13 = controlIdMapping[key1]) === null || ref13 === void 0 ? void 0 : ref13.dataBind[keyChi2]) === null || ref14 === void 0 ? void 0 : ref14.fieldCode] = getFieldData[key1][keyChi2];
898
891
  }
899
892
  }
900
893
  };
@@ -1037,38 +1030,40 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1037
1030
  value: function setData(dataSet, options) {
1038
1031
  var _this6 = this;
1039
1032
  this.debugLog("engine setData方法执行,参数为%o,%o。", dataSet, options);
1040
- var newState = this.store.defaultState;
1033
+ var isEmpty = function(value) {
1034
+ if (isString(value) || Array.isArray(value)) {
1035
+ return value.length === 0;
1036
+ }
1037
+ return false;
1038
+ };
1039
+ var newState = {};
1041
1040
  Object.keys(dataSet).map(function(dataCode) {
1042
1041
  var entity = dataSet[dataCode];
1043
1042
  if (Array.isArray(entity)) {
1044
1043
  var _this4 = _this6;
1045
- var mapping = _this6.getDataBindMapping(dataCode);
1046
- if (!mapping) {
1047
- return;
1048
- }
1049
- if (!newState[mapping.dataViewId]) {
1050
- newState[mapping.dataViewId] = {};
1051
- }
1052
- newState[mapping.dataViewId][mapping.controlId] = [];
1053
1044
  entity.map(function(row) {
1054
1045
  var _this = _this4;
1046
+ var mapping = _this4.getDataBindMapping(dataCode);
1047
+ if (!mapping) {
1048
+ return;
1049
+ }
1055
1050
  var newRow = JSONCopy(_this4.store.emptyState[mapping.dataViewId][mapping.controlId]);
1056
1051
  var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
1057
1052
  ;
1058
1053
  Object.keys(row).map(function(fieldCode) {
1059
- var ref, ref18;
1054
+ var ref, ref19;
1060
1055
  if (skipKey.includes(fieldCode)) {
1061
1056
  return;
1062
1057
  }
1063
- var fieldMapping = (ref = _this.store.dataBindMapping[dataCode]) === null || ref === void 0 ? void 0 : (ref18 = ref.fields) === null || ref18 === void 0 ? void 0 : ref18.find(function(i) {
1058
+ var fieldMapping = (ref = _this.store.dataBindMapping[dataCode]) === null || ref === void 0 ? void 0 : (ref19 = ref.fields) === null || ref19 === void 0 ? void 0 : ref19.find(function(i) {
1064
1059
  return i.fieldCode === fieldCode;
1065
1060
  });
1066
1061
  if (fieldMapping) {
1067
1062
  if (_instanceof(fieldMapping.dataBind, DataBind) && row[fieldCode] !== undefined) {
1068
1063
  newRow[fieldMapping.controlId] = row[fieldCode];
1069
1064
  } else if (_instanceof(fieldMapping.dataBind, ObjectDataBind)) {
1070
- var ref19;
1071
- var objValue = JSONCopy((ref19 = _this.getEmptyState(fieldMapping.controlId)) !== null && ref19 !== void 0 ? ref19 : {});
1065
+ var ref20;
1066
+ var objValue = JSONCopy((ref20 = _this.getEmptyState(fieldMapping.controlId)) !== null && ref20 !== void 0 ? ref20 : {});
1072
1067
  Object.keys(fieldMapping.dataBind).map(function(key) {
1073
1068
  var dataBind = fieldMapping.dataBind[key];
1074
1069
  if (row[dataBind.fieldCode] !== undefined) {
@@ -1080,55 +1075,56 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1080
1075
  }
1081
1076
  }
1082
1077
  });
1078
+ if (!newState[mapping.dataViewId]) {
1079
+ newState[mapping.dataViewId] = {};
1080
+ }
1081
+ if (!newState[mapping.dataViewId][mapping.controlId]) {
1082
+ newState[mapping.dataViewId][mapping.controlId] = [];
1083
+ }
1083
1084
  newState[mapping.dataViewId][mapping.controlId].push(newRow);
1084
1085
  });
1085
1086
  } else if (entity) {
1086
- var ref20;
1087
+ var _this3 = _this6;
1087
1088
  var skipKey1 = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
1088
1089
  ;
1089
1090
  var emptyState = JSONCopy(_this6.store.emptyState);
1090
- if (!((ref20 = Object.keys(entity)) === null || ref20 === void 0 ? void 0 : ref20.length)) {
1091
- // newState = this.store.defaultState
1092
- } else {
1093
- var _this3 = _this6;
1094
- Object.keys(entity).map(function(fieldCode) {
1095
- if (skipKey1.includes(fieldCode)) {
1096
- return;
1091
+ Object.keys(entity).map(function(fieldCode) {
1092
+ if (skipKey1.includes(fieldCode)) {
1093
+ return;
1094
+ }
1095
+ var mapping = _this3.getDataBindMapping(dataCode, fieldCode);
1096
+ if (mapping) {
1097
+ if (!newState[mapping.dataViewId[0]]) {
1098
+ newState[mapping.dataViewId[0]] = {};
1097
1099
  }
1098
- var mapping = _this3.getDataBindMapping(dataCode, fieldCode);
1099
- if (mapping) {
1100
- if (!newState[mapping.dataViewId[0]]) {
1101
- newState[mapping.dataViewId[0]] = {};
1102
- }
1103
- if (_instanceof(mapping.dataBind, DataBind) && entity[fieldCode] !== undefined) {
1104
- newState[mapping.dataViewId[0]][mapping.controlId] = entity[fieldCode] !== undefined ? entity[fieldCode] : emptyState[mapping.dataViewId[0]][mapping.controlId];
1105
- } else if (_instanceof(mapping.dataBind, ObjectDataBind)) {
1106
- var ref;
1107
- var objValue = (ref = _this3.getEmptyState(mapping.controlId)) !== null && ref !== void 0 ? ref : {};
1108
- Object.keys(mapping.dataBind).map(function(key) {
1109
- var dataBind = mapping.dataBind[key];
1110
- if (entity[dataBind.fieldCode] !== undefined) {
1111
- objValue[key] = entity[dataBind.fieldCode];
1112
- }
1113
- skipKey1.push(dataBind.fieldCode);
1114
- });
1115
- newState[mapping.dataViewId[0]][mapping.controlId] = objValue;
1116
- }
1100
+ if (_instanceof(mapping.dataBind, DataBind) && entity[fieldCode] !== undefined) {
1101
+ newState[mapping.dataViewId[0]][mapping.controlId] = entity[fieldCode] !== undefined ? entity[fieldCode] : emptyState[mapping.dataViewId[0]][mapping.controlId];
1102
+ } else if (_instanceof(mapping.dataBind, ObjectDataBind)) {
1103
+ var ref;
1104
+ var objValue = (ref = _this3.getEmptyState(mapping.controlId)) !== null && ref !== void 0 ? ref : {};
1105
+ Object.keys(mapping.dataBind).map(function(key) {
1106
+ var dataBind = mapping.dataBind[key];
1107
+ if (entity[dataBind.fieldCode] !== undefined) {
1108
+ objValue[key] = entity[dataBind.fieldCode];
1109
+ }
1110
+ skipKey1.push(dataBind.fieldCode);
1111
+ });
1112
+ newState[mapping.dataViewId[0]][mapping.controlId] = objValue;
1117
1113
  }
1118
- });
1119
- }
1114
+ }
1115
+ });
1120
1116
  var newMapping = _this6.getDataBindMapping(dataCode);
1121
1117
  if (newMapping) {
1122
- var ref16;
1123
- var mappingKeys = newMapping === null || newMapping === void 0 ? void 0 : (ref16 = newMapping.fields) === null || ref16 === void 0 ? void 0 : ref16.map(function(item) {
1118
+ var ref21;
1119
+ var mappingKeys = newMapping === null || newMapping === void 0 ? void 0 : (ref21 = newMapping.fields) === null || ref21 === void 0 ? void 0 : ref21.map(function(item) {
1124
1120
  return item === null || item === void 0 ? void 0 : item.controlId;
1125
1121
  });
1126
1122
  var mappingValue = _this6.getEmptyState(newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId);
1127
- var ref17;
1128
- var mainStateKeys = Object.keys((ref17 = newState === null || newState === void 0 ? void 0 : newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) !== null && ref17 !== void 0 ? ref17 : {});
1123
+ var ref18;
1124
+ var mainStateKeys = Object.keys((ref18 = newState === null || newState === void 0 ? void 0 : newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) !== null && ref18 !== void 0 ? ref18 : {});
1129
1125
  mappingKeys === null || mappingKeys === void 0 ? void 0 : mappingKeys.forEach(function(key) {
1130
- if (!mainStateKeys.includes(key) && key !== 'uid' && newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) {
1131
- if (Object.keys(newState).length) {
1126
+ if (!mainStateKeys.includes(key) && key !== 'uid') {
1127
+ if (Object.keys(newState).length && newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) {
1132
1128
  Object.assign(newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId], _defineProperty({}, key, mappingValue[key]));
1133
1129
  } else {
1134
1130
  Object.assign(newState, _defineProperty({}, newMapping.controlId, _defineProperty({}, key, mappingValue[key])));
@@ -1195,20 +1191,19 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1195
1191
  // 如果能从flatInstances里边取到,就通过getInstanceInSubtableHeader方法取,取不到则换一种方式
1196
1192
  if (instances.length) {
1197
1193
  var instance = instances[0];
1198
- if (this.inList(instance.id) !== undefined) {
1194
+ if (this.inList(instance.id) === true) {
1199
1195
  var headerInstance = this.getInstanceInSubtableHeader(instance);
1200
1196
  if (headerInstance) {
1201
1197
  instances.unshift(headerInstance);
1202
1198
  }
1203
1199
  }
1204
1200
  } else {
1201
+ var controlIdMapping = this.getControlIdMapping();
1205
1202
  var ref;
1206
- var controlIdMapping = (ref = this.getControlIdMapping()) !== null && ref !== void 0 ? ref : {};
1207
- var ref21;
1208
- var ref22 = _slicedToArray((ref21 = Object.entries(controlIdMapping).find(function(param) {
1203
+ var ref22 = _slicedToArray((ref = Object.entries(controlIdMapping).find(function(param) {
1209
1204
  var _param = _slicedToArray(param, 2), _ = _param[0], mapping = _param[1];
1210
1205
  return mapping.children && controlId in mapping.children;
1211
- })) !== null && ref21 !== void 0 ? ref21 : [], 1), subtableId = ref22[0];
1206
+ })) !== null && ref !== void 0 ? ref : [], 1), subtableId = ref22[0];
1212
1207
  if (subtableId) {
1213
1208
  var subtable = this.getInstance(subtableId);
1214
1209
  // @ts-ignore
@@ -1428,18 +1423,12 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1428
1423
  {
1429
1424
  key: "inList",
1430
1425
  value: function inList(controlId) {
1431
- var _controlIdMapping;
1432
- var mapping = (_controlIdMapping = this.store.controlIdMapping) !== null && _controlIdMapping !== void 0 ? _controlIdMapping : {};
1433
- var listKey = undefined;
1434
- Object.keys(mapping).some(function(key) {
1426
+ var mapping = this.store.controlIdMapping;
1427
+ var result = Object.keys(mapping).some(function(key) {
1435
1428
  var ref, ref23;
1436
- var matched = (ref = mapping[key]) === null || ref === void 0 ? void 0 : (ref23 = ref.children) === null || ref23 === void 0 ? void 0 : ref23.hasOwnProperty(controlId);
1437
- if (matched) {
1438
- listKey = key;
1439
- }
1440
- return matched;
1429
+ return (ref = mapping[key]) === null || ref === void 0 ? void 0 : (ref23 = ref.children) === null || ref23 === void 0 ? void 0 : ref23.hasOwnProperty(controlId);
1441
1430
  });
1442
- return listKey;
1431
+ return result;
1443
1432
  }
1444
1433
  }
1445
1434
  ], [
@@ -1464,3 +1453,4 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1464
1453
  return Engine;
1465
1454
  }(Watcher);
1466
1455
  export { Engine };
1456
+ console.log('a');
@@ -37,21 +37,6 @@ function _instanceof(left, right) {
37
37
  return left instanceof right;
38
38
  }
39
39
  }
40
- function _objectSpread(target) {
41
- for(var i = 1; i < arguments.length; i++){
42
- var source = arguments[i] != null ? arguments[i] : {};
43
- var ownKeys = Object.keys(source);
44
- if (typeof Object.getOwnPropertySymbols === "function") {
45
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
46
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
47
- }));
48
- }
49
- ownKeys.forEach(function(key) {
50
- _defineProperty(target, key, source[key]);
51
- });
52
- }
53
- return target;
54
- }
55
40
  import { DataBind, ObjectDataBind } from '@byteluck-fe/model-driven-core';
56
41
  import { loopFormSchema, JSONCopy, warn, CONTROL_TYPE, CONTROL_BASE_TYPE } from '@byteluck-fe/model-driven-shared';
57
42
  import { loopDataViewControl, loopFormControl, buildUUID } from '../utils/runtimeUtils';
@@ -59,12 +44,11 @@ var Store = /*#__PURE__*/ function() {
59
44
  "use strict";
60
45
  function Store(props) {
61
46
  _classCallCheck(this, Store);
62
- var ref = init(props.instance), state = ref.state, emptyState = ref.emptyState, databindMapping = ref.databindMapping, controlidMapping = ref.controlidMapping, defaultState = ref.defaultState;
47
+ var ref = init(props.instance), state = ref.state, emptyState = ref.emptyState, databindMapping = ref.databindMapping, controlidMapping = ref.controlidMapping;
63
48
  this.emptyState = emptyState;
64
49
  this.state = state;
65
50
  this.dataBindMapping = databindMapping;
66
51
  this.controlIdMapping = controlidMapping;
67
- this.defaultState = defaultState;
68
52
  }
69
53
  _createClass(Store, [
70
54
  {
@@ -230,7 +214,6 @@ function init(instance) {
230
214
  var emptyState = {};
231
215
  var databindMapping = {};
232
216
  var controlidMapping = {};
233
- var defaultState = {};
234
217
  // loopFormControl(instance, (item, children) => {
235
218
  // })
236
219
  // @ts-ignore
@@ -246,13 +229,11 @@ function init(instance) {
246
229
  buildDataBindMapping(databindMapping, dvId, item);
247
230
  buildControlIdMapping(controlidMapping, dvId, item);
248
231
  });
249
- state[dvId] = {};
250
- defaultState[dvId] = dataViewState;
232
+ state[dvId] = dataViewState;
251
233
  emptyState[dvId] = emptyDataViewState;
252
234
  });
253
235
  return {
254
236
  state: state,
255
- defaultState: defaultState,
256
237
  emptyState: emptyState,
257
238
  databindMapping: databindMapping,
258
239
  controlidMapping: controlidMapping
@@ -263,7 +244,7 @@ item) {
263
244
  //if (item instanceof RuntimeFormControl) {
264
245
  if (item.controlType === CONTROL_BASE_TYPE.FORM) {
265
246
  // 2023-4-2 jiaqi 首次进入页面去除填充默认值
266
- dataViewState[item.id] = JSONCopy(item.props.defaultValue);
247
+ // dataViewState[item.id] = JSONCopy(item.props.defaultValue)
267
248
  emptyDataViewState[item.id] = JSONCopy(item.props.defaultValue);
268
249
  } else {
269
250
  var emptyTemplate = {};
@@ -272,9 +253,7 @@ item) {
272
253
  });
273
254
  var _defaultRows;
274
255
  dataViewState[item.id] = new Array((_defaultRows = item.props.defaultRows) !== null && _defaultRows !== void 0 ? _defaultRows : 1).fill(0).map(function() {
275
- return _objectSpread({
276
- uid: 'new:' + buildUUID('uid')
277
- }, JSONCopy(emptyTemplate));
256
+ return JSONCopy(emptyTemplate);
278
257
  });
279
258
  emptyDataViewState[item.id] = emptyTemplate;
280
259
  }
@@ -350,10 +350,6 @@ export var CalcPlugin = /*#__PURE__*/ function() {
350
350
  if (!scriptEcho || scriptEcho.length === 0) {
351
351
  return;
352
352
  }
353
- var rowIndex = undefined;
354
- if (this.controlInSubtable(control)) {
355
- rowIndex = this.engine.getInstanceRowIndex(control);
356
- }
357
353
  // @ts-ignore
358
354
  var scriptText = scriptEcho.reduce(function(result, current) {
359
355
  if (current.type === CALC_TOKEN_TYPE.Operator || current.type === CALC_TOKEN_TYPE.Number) {
@@ -371,7 +367,7 @@ export var CalcPlugin = /*#__PURE__*/ function() {
371
367
  }
372
368
  case CALC_TOKEN_TYPE.VariableInCurrentSubTable:
373
369
  {
374
- //const rowIndex = this.engine.getInstanceRowIndex(control)
370
+ var rowIndex = _this.engine.getInstanceRowIndex(control);
375
371
  instance = _this.engine.getInstance(current.id, rowIndex);
376
372
  var state = _this.engine.getState(current.id, rowIndex);
377
373
  var value1 = _this.getNumberValue(state);
@@ -410,15 +406,15 @@ export var CalcPlugin = /*#__PURE__*/ function() {
410
406
  }));
411
407
  this.cacheComputedResult[scriptText] = value3;
412
408
  }
413
- // let rowIndex = undefined
409
+ var rowIndex1 = undefined;
414
410
  if (this.controlInSubtable(control)) {
415
- // rowIndex = this.engine.getInstanceRowIndex(control)
411
+ rowIndex1 = this.engine.getInstanceRowIndex(control);
416
412
  // 控件在明细表内,但是没有行下标,说明控件被已经删除了,所以直接return
417
- if (rowIndex === undefined) {
413
+ if (rowIndex1 === undefined) {
418
414
  return;
419
415
  }
420
416
  }
421
- var oldValue = this.engine.getState(control.id, rowIndex);
417
+ var oldValue = this.engine.getState(control.id, rowIndex1);
422
418
  var result1 = !value3 || value3 === Infinity || value3 === -Infinity ? 0 : control.props.precision === '' ? value3 : Number(value3.toFixed(control.props.precision));
423
419
  // 如果值没变的话,不触发修改
424
420
  if (result1 === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.result)) {
@@ -428,7 +424,7 @@ export var CalcPlugin = /*#__PURE__*/ function() {
428
424
  this.engine.setState(control.id, {
429
425
  result: result1,
430
426
  unit: (ref = oldValue === null || oldValue === void 0 ? void 0 : oldValue.unit) !== null && ref !== void 0 ? ref : ''
431
- }, rowIndex);
427
+ }, rowIndex1);
432
428
  }
433
429
  },
434
430
  {