@byteluck-fe/model-driven-engine 2.23.0-beta.0 → 2.23.0-beta.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.
Files changed (32) hide show
  1. package/README.md +30 -30
  2. package/dist/esm/common/ActionManager.js +4 -4
  3. package/dist/esm/common/Engine.js +91 -112
  4. package/dist/esm/common/Runtime.js +14 -30
  5. package/dist/esm/common/Store.js +18 -13
  6. package/dist/esm/common/checkerValue.js +17 -37
  7. package/dist/esm/common/proxyState.js +18 -18
  8. package/dist/esm/plugins/CalcPlugin.js +43 -43
  9. package/dist/esm/plugins/ControlsEventPlugin.js +2 -2
  10. package/dist/esm/plugins/LifecycleEventPlugin.js +2 -2
  11. package/dist/esm/plugins/StylePlugin.js +6 -6
  12. package/dist/index.umd.js +7 -7
  13. package/dist/types/common/ActionManager.d.ts +14 -14
  14. package/dist/types/common/DataManager.d.ts +10 -10
  15. package/dist/types/common/Engine.d.ts +201 -194
  16. package/dist/types/common/OkWorker.d.ts +13 -13
  17. package/dist/types/common/Plugin.d.ts +6 -6
  18. package/dist/types/common/Runtime.d.ts +31 -31
  19. package/dist/types/common/Store.d.ts +54 -54
  20. package/dist/types/common/checkerValue.d.ts +3 -3
  21. package/dist/types/common/index.d.ts +2 -2
  22. package/dist/types/common/proxyState.d.ts +30 -30
  23. package/dist/types/index.d.ts +3 -3
  24. package/dist/types/plugins/CalcPlugin.d.ts +121 -121
  25. package/dist/types/plugins/ControlsEventPlugin.d.ts +17 -17
  26. package/dist/types/plugins/ES6ModulePlugin.d.ts +27 -27
  27. package/dist/types/plugins/LifecycleEventPlugin.d.ts +15 -15
  28. package/dist/types/plugins/StylePlugin.d.ts +13 -13
  29. package/dist/types/plugins/index.d.ts +5 -5
  30. package/dist/types/utils/index.d.ts +1 -1
  31. package/dist/types/utils/runtimeUtils.d.ts +5 -5
  32. package/package.json +4 -4
package/README.md CHANGED
@@ -1,30 +1,30 @@
1
- # Engine
2
- 运行态引擎
3
-
4
- ```
5
- │ index.ts // 入口文件
6
-
7
- ├─common // 引擎相关
8
- │ ActionManager.ts // utils操作管理
9
- │ checkerValue.ts // 表单值校验器
10
- │ DataManager.ts // 数据源容器
11
- │ Engine.ts // 引擎
12
- │ index.ts // 入口
13
- │ OkWorker.ts // 无用
14
- │ Plugin.ts // 插件
15
- │ proxyState.ts // 劫持引擎表单数据
16
- │ Runtime.ts // 控件注册和创建
17
- │ Store.ts // 数据管理
18
-
19
- ├─plugins
20
- │ CalcPlugin.ts // 计算公式插件
21
- │ ControlsEventPlugin.ts // 控件二开事件插件
22
- │ ES6ModulePlugin.ts //
23
- │ index.ts
24
- │ LifecycleEventPlugin.ts // 页面生命周期事件
25
- │ StylePlugin.ts // css二开
26
-
27
- └─utils
28
- index.ts
29
- runtimeUtils.ts // 工具函数
30
- ```
1
+ # Engine
2
+ 运行态引擎
3
+
4
+ ```
5
+ │ index.ts // 入口文件
6
+
7
+ ├─common // 引擎相关
8
+ │ ActionManager.ts // utils操作管理
9
+ │ checkerValue.ts // 表单值校验器
10
+ │ DataManager.ts // 数据源容器
11
+ │ Engine.ts // 引擎
12
+ │ index.ts // 入口
13
+ │ OkWorker.ts // 无用
14
+ │ Plugin.ts // 插件
15
+ │ proxyState.ts // 劫持引擎表单数据
16
+ │ Runtime.ts // 控件注册和创建
17
+ │ Store.ts // 数据管理
18
+
19
+ ├─plugins
20
+ │ CalcPlugin.ts // 计算公式插件
21
+ │ ControlsEventPlugin.ts // 控件二开事件插件
22
+ │ ES6ModulePlugin.ts //
23
+ │ index.ts
24
+ │ LifecycleEventPlugin.ts // 页面生命周期事件
25
+ │ StylePlugin.ts // css二开
26
+
27
+ └─utils
28
+ index.ts
29
+ runtimeUtils.ts // 工具函数
30
+ ```
@@ -186,11 +186,11 @@ export var ActionManager = /*#__PURE__*/ function() {
186
186
  _class_call_check(this, ActionManager);
187
187
  _define_property(this, "actionMap", new Map());
188
188
  _define_property(this, "buildinActions", {});
189
- /**
190
- * 执行action的时候,作为第二个参数传递给方法,可以通过外部挂载
189
+ /**
190
+ * 执行action的时候,作为第二个参数传递给方法,可以通过外部挂载
191
191
  */ _define_property(this, "actionUtils", {});
192
- /**
193
- * 用于存储es module解析出来的源码,CustomVueControlPlugin
192
+ /**
193
+ * 用于存储es module解析出来的源码,CustomVueControlPlugin
194
194
  */ _define_property(this, "sources", {});
195
195
  }
196
196
  _create_class(ActionManager, [
@@ -44,6 +44,10 @@ function _async_to_generator(fn) {
44
44
  });
45
45
  };
46
46
  }
47
+ function _call_super(_this, derived, args) {
48
+ derived = _get_prototype_of(derived);
49
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
50
+ }
47
51
  function _class_call_check(instance, Constructor) {
48
52
  if (!(instance instanceof Constructor)) {
49
53
  throw new TypeError("Cannot call a class as a function");
@@ -222,28 +226,12 @@ function _unsupported_iterable_to_array(o, minLen) {
222
226
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
223
227
  }
224
228
  function _is_native_reflect_construct() {
225
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
226
- if (Reflect.construct.sham) return false;
227
- if (typeof Proxy === "function") return true;
228
229
  try {
229
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
230
- return true;
231
- } catch (e) {
232
- return false;
233
- }
234
- }
235
- function _create_super(Derived) {
236
- var hasNativeReflectConstruct = _is_native_reflect_construct();
237
- return function _createSuperInternal() {
238
- var Super = _get_prototype_of(Derived), result;
239
- if (hasNativeReflectConstruct) {
240
- var NewTarget = _get_prototype_of(this).constructor;
241
- result = Reflect.construct(Super, arguments, NewTarget);
242
- } else {
243
- result = Super.apply(this, arguments);
244
- }
245
- return _possible_constructor_return(this, result);
246
- };
230
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
231
+ } catch (_) {}
232
+ return (_is_native_reflect_construct = function() {
233
+ return !!result;
234
+ })();
247
235
  }
248
236
  function _ts_generator(thisArg, body) {
249
237
  var f, y, t, g, _ = {
@@ -361,39 +349,25 @@ var applyingPluginName = '';
361
349
  var Engine = /*#__PURE__*/ function(Watcher) {
362
350
  "use strict";
363
351
  _inherits(Engine, Watcher);
364
- var _super = _create_super(Engine);
365
352
  function Engine(props) {
366
353
  _class_call_check(this, Engine);
367
354
  var _this;
368
- _this = _super.call(this);
369
- _define_property(_assert_this_initialized(_this), "store", void 0);
370
- _define_property(_assert_this_initialized(_this), "rawStore", {});
371
- _define_property(_assert_this_initialized(_this), "parent", void 0);
372
- // 提供注册运行态控件以及实例化控件的能力
373
- _define_property(_assert_this_initialized(_this), "runtime", void 0);
374
- // 提供子线程处理脚本以及修改数据的能力
355
+ _this = _call_super(this, Engine), _define_property(_this, "store", void 0), _define_property(_this, "rawStore", {}), _define_property(_this, "parent", void 0), // 提供注册运行态控件以及实例化控件的能力
356
+ _define_property(_this, "runtime", void 0), // 提供子线程处理脚本以及修改数据的能力
375
357
  // public worker: OkWorker
376
- _define_property(_assert_this_initialized(_this), "isMounted", false);
377
- _define_property(_assert_this_initialized(_this), "id", genNonDuplicateId(8));
378
- _define_property(_assert_this_initialized(_this), "externalParams", void 0);
379
- // 提供外部注册插件,在不同的hooks触发时执行固定函数的能力
380
- _define_property(_assert_this_initialized(_this), "__plugins", void 0);
381
- _define_property(_assert_this_initialized(_this), "__pluginsApplied", false);
382
- _define_property(_assert_this_initialized(_this), "$options", void 0);
383
- _define_property(_assert_this_initialized(_this), "actionManager", new ActionManager());
384
- _define_property(_assert_this_initialized(_this), "dataManager", void 0);
385
- _define_property(_assert_this_initialized(_this), "_jobTasks", []);
386
- _define_property(_assert_this_initialized(_this), "createControlInstance", _this.createInstance);
358
+ _define_property(_this, "isMounted", false), _define_property(_this, "id", genNonDuplicateId(8)), _define_property(_this, "externalParams", void 0), _define_property(_this, "children", void 0), // 提供外部注册插件,在不同的hooks触发时执行固定函数的能力
359
+ _define_property(_this, "__plugins", void 0), _define_property(_this, "__pluginsApplied", false), _define_property(_this, "$options", void 0), _define_property(_this, "actionManager", new ActionManager()), _define_property(_this, "dataManager", void 0), _define_property(_this, "_jobTasks", []), _define_property(_this, "createControlInstance", _this.createInstance);
387
360
  _this.$options = Object.freeze(props);
388
361
  var _this_$options = _this.$options, _this_$options_autoMount = _this_$options.autoMount, autoMount = _this_$options_autoMount === void 0 ? true : _this_$options_autoMount, schema = _this_$options.schema, beforeCreateInstance = _this_$options.beforeCreateInstance, externalParams = _this_$options.externalParams, _this_$options_language = _this_$options.// fieldModel,
389
- language, language = _this_$options_language === void 0 ? DEFAULT_LOCALE : _this_$options_language, _this_$options_debug = _this_$options.debug, debug = _this_$options_debug === void 0 ? false : _this_$options_debug;
390
- RulesMessage.setLocale(language);
362
+ language, language = _this_$options_language === void 0 ? DEFAULT_LOCALE : _this_$options_language, _this_$options_debug = _this_$options.debug, debug = _this_$options_debug === void 0 ? false : _this_$options_debug, messagesI18n = _this_$options.messagesI18n, children = _this_$options.children;
363
+ RulesMessage.setLocale(language, messagesI18n);
391
364
  _this.debug = debug;
392
365
  _this.runtime = new Runtime({
393
366
  schema: schema,
394
367
  beforeCreateInstance: beforeCreateInstance
395
368
  });
396
369
  _this.externalParams = externalParams;
370
+ _this.children = children;
397
371
  _this.store = new Store({
398
372
  instance: _this.runtime.instance
399
373
  });
@@ -623,6 +597,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
623
597
  {
624
598
  key: "_handlerSubtableUpdateUid",
625
599
  value: function _handlerSubtableUpdateUid(subtableData) {
600
+ ;
626
601
  subtableData.forEach(function(item) {
627
602
  if (!item.uid) {
628
603
  Object.assign(item, {
@@ -976,9 +951,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
976
951
  }
977
952
  },
978
953
  {
979
- /**
980
- * 设置payload的options,提供在不是使用标准api修改state的时候可以传递options,会在本次任务执行完成之后清空
981
- * @param options 需要携带的options
954
+ /**
955
+ * 设置payload的options,提供在不是使用标准api修改state的时候可以传递options,会在本次任务执行完成之后清空
956
+ * @param options 需要携带的options
982
957
  * */ key: "setPayloadOptions",
983
958
  value: function setPayloadOptions(options) {
984
959
  eventOptionsTemp = options;
@@ -995,9 +970,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
995
970
  }
996
971
  },
997
972
  {
998
- /**
999
- * 向Store设置一组值,明细表必须全量赋值,并触发事件(触发事件是根据组件在页面中的顺序逐个触发)
1000
- * @param states
973
+ /**
974
+ * 向Store设置一组值,明细表必须全量赋值,并触发事件(触发事件是根据组件在页面中的顺序逐个触发)
975
+ * @param states
1001
976
  */ key: "setStates",
1002
977
  value: function setStates(states, rowIndex, options) {
1003
978
  var _this = this;
@@ -1024,11 +999,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1024
999
  }
1025
1000
  },
1026
1001
  {
1027
- /**
1028
- * 通过dataCode和fieldCode来获取控件的值
1029
- * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
1030
- * @param fieldCode 字段编码 - 控件绑定的数据项的编码
1031
- * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
1002
+ /**
1003
+ * 通过dataCode和fieldCode来获取控件的值
1004
+ * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
1005
+ * @param fieldCode 字段编码 - 控件绑定的数据项的编码
1006
+ * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
1032
1007
  * */ key: "getField",
1033
1008
  value: function getField(dataCode, fieldCode, rowIndex) {
1034
1009
  if (!fieldCode) {
@@ -1100,27 +1075,31 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1100
1075
  var _controlIdMapping_key2;
1101
1076
  obj[(_controlIdMapping_key2 = controlIdMapping[key]) === null || _controlIdMapping_key2 === void 0 ? void 0 : _controlIdMapping_key2.dataBind.fieldCode] = getFieldData[key];
1102
1077
  } else if ((_controlIdMapping_key1 = controlIdMapping[key]) === null || _controlIdMapping_key1 === void 0 ? void 0 : (_controlIdMapping_key_dataBind1 = _controlIdMapping_key1.dataBind) === null || _controlIdMapping_key_dataBind1 === void 0 ? void 0 : _controlIdMapping_key_dataBind1.dataCode) {
1103
- var _controlIdMapping_key3;
1104
- // 明细字表只循环一层明细子表未递归
1105
- obj[(_controlIdMapping_key3 = controlIdMapping[key]) === null || _controlIdMapping_key3 === void 0 ? void 0 : _controlIdMapping_key3.dataBind.dataCode] = getFieldData[key].map(function(item) {
1106
- var objChi = {};
1107
- for(var keyChi in item){
1108
- var _controlIdMapping_key_children_keyChi;
1109
- var fieldCode = (_controlIdMapping_key_children_keyChi = controlIdMapping[key].children[keyChi]) === null || _controlIdMapping_key_children_keyChi === void 0 ? void 0 : _controlIdMapping_key_children_keyChi.dataBind.fieldCode;
1110
- //未绑定字段的控件,直接抛弃
1111
- if (fieldCode !== '') {
1112
- if (fieldCode) {
1113
- objChi[fieldCode] = item[keyChi];
1114
- } else {
1115
- for(var keyChi1 in item[keyChi]){
1116
- var _controlIdMapping_key_children_keyChi1;
1117
- objChi[(_controlIdMapping_key_children_keyChi1 = controlIdMapping[key].children[keyChi]) === null || _controlIdMapping_key_children_keyChi1 === void 0 ? void 0 : _controlIdMapping_key_children_keyChi1.dataBind[keyChi1].fieldCode] = item[keyChi][keyChi1];
1078
+ if (!Array.isArray(getFieldData[key])) {
1079
+ // obj[controlIdMapping[key]?.dataBind.dataCode] = ''
1080
+ } else {
1081
+ var _controlIdMapping_key3, _getFieldData_key;
1082
+ // 明细字表只循环一层明细子表未递归
1083
+ obj[(_controlIdMapping_key3 = controlIdMapping[key]) === null || _controlIdMapping_key3 === void 0 ? void 0 : _controlIdMapping_key3.dataBind.dataCode] = (_getFieldData_key = getFieldData[key]) === null || _getFieldData_key === void 0 ? void 0 : _getFieldData_key.map(function(item) {
1084
+ var objChi = {};
1085
+ for(var keyChi in item){
1086
+ var _controlIdMapping_key_children_keyChi;
1087
+ var fieldCode = (_controlIdMapping_key_children_keyChi = controlIdMapping[key].children[keyChi]) === null || _controlIdMapping_key_children_keyChi === void 0 ? void 0 : _controlIdMapping_key_children_keyChi.dataBind.fieldCode;
1088
+ //未绑定字段的控件,直接抛弃
1089
+ if (fieldCode !== '') {
1090
+ if (fieldCode) {
1091
+ objChi[fieldCode] = item[keyChi];
1092
+ } else {
1093
+ for(var keyChi1 in item[keyChi]){
1094
+ var _controlIdMapping_key_children_keyChi1;
1095
+ objChi[(_controlIdMapping_key_children_keyChi1 = controlIdMapping[key].children[keyChi]) === null || _controlIdMapping_key_children_keyChi1 === void 0 ? void 0 : _controlIdMapping_key_children_keyChi1.dataBind[keyChi1].fieldCode] = item[keyChi][keyChi1];
1096
+ }
1118
1097
  }
1119
1098
  }
1120
1099
  }
1121
- }
1122
- return objChi;
1123
- });
1100
+ return objChi;
1101
+ });
1102
+ }
1124
1103
  } else if (controlIdMapping[key]) {
1125
1104
  // 兼容一个控件需要绑定多个字段的情况
1126
1105
  for(var keyChi in getFieldData[key]){
@@ -1139,13 +1118,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1139
1118
  }
1140
1119
  },
1141
1120
  {
1142
- /**
1143
- * 通过dataCode和fieldCode来设置控件的值
1144
- * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
1145
- * @param fieldCode 字段编码 - 控件绑定的数据项的编码
1146
- * @param value 修改的值
1147
- * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
1148
- * @param options 触发事件携带的参数
1121
+ /**
1122
+ * 通过dataCode和fieldCode来设置控件的值
1123
+ * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
1124
+ * @param fieldCode 字段编码 - 控件绑定的数据项的编码
1125
+ * @param value 修改的值
1126
+ * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
1127
+ * @param options 触发事件携带的参数
1149
1128
  * */ key: "setField",
1150
1129
  value: function setField(dataCode, fieldCode, value, rowIndex, options) {
1151
1130
  var dataBindMapping = this.getDataBindMapping(dataCode, fieldCode);
@@ -1173,12 +1152,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1173
1152
  }
1174
1153
  },
1175
1154
  {
1176
- /**
1177
- * 通过dataCode和 state来给一组控件赋值,并触发事件携带options
1178
- * @param dataCode 需要赋值的目标模型
1179
- * @param state 赋值对象,以fieldCode为key组成的对象
1180
- * @param rowIndex 行下标,给明细子表赋值时指定赋值某行
1181
- * @param options 触发事件携带的参数
1155
+ /**
1156
+ * 通过dataCode和 state来给一组控件赋值,并触发事件携带options
1157
+ * @param dataCode 需要赋值的目标模型
1158
+ * @param state 赋值对象,以fieldCode为key组成的对象
1159
+ * @param rowIndex 行下标,给明细子表赋值时指定赋值某行
1160
+ * @param options 触发事件携带的参数
1182
1161
  * */ key: "setFields",
1183
1162
  value: function setFields(dataCode, state, rowIndex, options) {
1184
1163
  var _this = this;
@@ -1219,10 +1198,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1219
1198
  }
1220
1199
  },
1221
1200
  {
1222
- /**
1223
- * 通过dataCode来将state转化为标准的state结构
1224
- * @param dataCode 需要转换的目标模型code
1225
- * @param state 值对象,以fieldCode为key组成的对象
1201
+ /**
1202
+ * 通过dataCode来将state转化为标准的state结构
1203
+ * @param dataCode 需要转换的目标模型code
1204
+ * @param state 值对象,以fieldCode为key组成的对象
1226
1205
  * */ key: "buildFields",
1227
1206
  value: function buildFields(dataCode, state) {
1228
1207
  var _this = this;
@@ -1263,10 +1242,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1263
1242
  }
1264
1243
  },
1265
1244
  {
1266
- /**
1267
- * 向Store设置一组值,并触发事件携带options
1268
- * @param dataSet
1269
- * @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
1245
+ /**
1246
+ * 向Store设置一组值,并触发事件携带options
1247
+ * @param dataSet
1248
+ * @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
1270
1249
  */ key: "setData",
1271
1250
  value: function setData(dataSet, options) {
1272
1251
  var _this = this;
@@ -1404,19 +1383,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1404
1383
  }
1405
1384
  },
1406
1385
  {
1407
- /**
1408
- * 获取控件的dataBind
1409
- * @param controlId
1386
+ /**
1387
+ * 获取控件的dataBind
1388
+ * @param controlId
1410
1389
  * */ key: "getDataBind",
1411
1390
  value: function getDataBind(controlId) {
1412
1391
  return this.store.getDataBind(controlId);
1413
1392
  }
1414
1393
  },
1415
1394
  {
1416
- /**
1417
- * 获取组件实例,传入rowIndex代表获取明细表内的控件实例,rowIndex传入-1代表获取表头内的实例
1418
- * @param controlId
1419
- * @param rowIndex
1395
+ /**
1396
+ * 获取组件实例,传入rowIndex代表获取明细表内的控件实例,rowIndex传入-1代表获取表头内的实例
1397
+ * @param controlId
1398
+ * @param rowIndex
1420
1399
  */ key: "getInstance",
1421
1400
  value: function getInstance(controlId, rowIndex) {
1422
1401
  var instances = this.getInstances(controlId, rowIndex === -1);
@@ -1435,10 +1414,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1435
1414
  }
1436
1415
  },
1437
1416
  {
1438
- /**
1439
- * 获取组件实例,明细表中的组件将会得到数组, 第二个参数为(false/不传入)则获取到的是明细表内不包含表头内实例的所有控件实例,传入true则获取到包含表头内实例的所有控件实例,表头内实例永远在下标0的位置
1440
- * @param controlId
1441
- * @param header 明细表内是否获取表头的控件
1417
+ /**
1418
+ * 获取组件实例,明细表中的组件将会得到数组, 第二个参数为(false/不传入)则获取到的是明细表内不包含表头内实例的所有控件实例,传入true则获取到包含表头内实例的所有控件实例,表头内实例永远在下标0的位置
1419
+ * @param controlId
1420
+ * @param header 明细表内是否获取表头的控件
1442
1421
  */ // getInstances(
1443
1422
  // controlId?: string,
1444
1423
  // header: boolean = false
@@ -1614,27 +1593,27 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1614
1593
  },
1615
1594
  {
1616
1595
  key: "assertInstance",
1617
- value: /**
1618
- * 判断控件的类型,返回当前控件的正确类型
1596
+ value: /**
1597
+ * 判断控件的类型,返回当前控件的正确类型
1619
1598
  * */ function assertInstance(instance, types) {
1620
1599
  return isString(types) ? instance.type === types : types.includes(instance.type);
1621
1600
  }
1622
1601
  },
1623
1602
  {
1624
1603
  key: "assertInstanceIsCustomControl",
1625
- value: /**
1626
- * 判断控件或控件类型是一个自定义控件
1604
+ value: /**
1605
+ * 判断控件或控件类型是一个自定义控件
1627
1606
  * */ function assertInstanceIsCustomControl(instance) {
1628
1607
  return !isBuiltInControls(isString(instance) ? instance : instance.type);
1629
1608
  }
1630
1609
  },
1631
1610
  {
1632
1611
  key: "getInstanceRowIndex",
1633
- value: /**
1634
- * 获取控件在明细子表中的行下标,
1635
- * 如果控件在表头内,则返回-1
1636
- * 如果控件在表内,则返回行下标
1637
- * 如果控件不在明细表内,则返回undefined
1612
+ value: /**
1613
+ * 获取控件在明细子表中的行下标,
1614
+ * 如果控件在表头内,则返回-1
1615
+ * 如果控件在表内,则返回行下标
1616
+ * 如果控件不在明细表内,则返回undefined
1638
1617
  * */ // public getInstanceRowIndex(
1639
1618
  // instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl
1640
1619
  // ) {
@@ -4,6 +4,10 @@ function _assert_this_initialized(self) {
4
4
  }
5
5
  return self;
6
6
  }
7
+ function _call_super(_this, derived, args) {
8
+ derived = _get_prototype_of(derived);
9
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
10
+ }
7
11
  function _class_call_check(instance, Constructor) {
8
12
  if (!(instance instanceof Constructor)) {
9
13
  throw new TypeError("Cannot call a class as a function");
@@ -73,28 +77,12 @@ function _type_of(obj) {
73
77
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
74
78
  }
75
79
  function _is_native_reflect_construct() {
76
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
77
- if (Reflect.construct.sham) return false;
78
- if (typeof Proxy === "function") return true;
79
80
  try {
80
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
81
- return true;
82
- } catch (e) {
83
- return false;
84
- }
85
- }
86
- function _create_super(Derived) {
87
- var hasNativeReflectConstruct = _is_native_reflect_construct();
88
- return function _createSuperInternal() {
89
- var Super = _get_prototype_of(Derived), result;
90
- if (hasNativeReflectConstruct) {
91
- var NewTarget = _get_prototype_of(this).constructor;
92
- result = Reflect.construct(Super, arguments, NewTarget);
93
- } else {
94
- result = Super.apply(this, arguments);
95
- }
96
- return _possible_constructor_return(this, result);
97
- };
81
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
82
+ } catch (_) {}
83
+ return (_is_native_reflect_construct = function() {
84
+ return !!result;
85
+ })();
98
86
  }
99
87
  import { RegisterControls, isDataBind } from '@byteluck-fe/model-driven-core';
100
88
  import { CONTROL_BASE_TYPE, CONTROL_TYPE, JSONCopy, loopFormSchema, isArray } from '@byteluck-fe/model-driven-shared';
@@ -102,16 +90,12 @@ import { hasChildrenControl, loopDataViewControl, loopFormControl } from '../uti
102
90
  export var Runtime = /*#__PURE__*/ function(RegisterControls) {
103
91
  "use strict";
104
92
  _inherits(Runtime, RegisterControls);
105
- var _super = _create_super(Runtime);
106
93
  function Runtime(props) {
107
94
  _class_call_check(this, Runtime);
108
95
  var _this;
109
- _this = _super.call(this, 'Runtime');
110
- _define_property(_assert_this_initialized(_this), "_schema", void 0);
111
- _define_property(_assert_this_initialized(_this), "_instance", void 0);
112
- _define_property(_assert_this_initialized(_this), "_flatInstances", []);
113
- _define_property(_assert_this_initialized(_this), "_instanceMap", {});
114
- _define_property(_assert_this_initialized(_this), "_controlParentIdMap", {});
96
+ _this = _call_super(this, Runtime, [
97
+ 'Runtime'
98
+ ]), _define_property(_this, "_schema", void 0), _define_property(_this, "_instance", void 0), _define_property(_this, "_flatInstances", []), _define_property(_this, "_instanceMap", {}), _define_property(_this, "_controlParentIdMap", {});
115
99
  var schema = props.schema;
116
100
  _this._schema = schema;
117
101
  _this._instance = _this.createControl(schema, props.beforeCreateInstance);
@@ -305,8 +289,8 @@ function loop(control, parentId, callback) {
305
289
  function hasHeaderOrFooterControl(control, checkType) {
306
290
  return checkType in control.props && isArray(control.props[checkType]);
307
291
  }
308
- /**
309
- * 控件是否在视图中隐藏,遍历查找所有parent
292
+ /**
293
+ * 控件是否在视图中隐藏,遍历查找所有parent
310
294
  * */ function getControlIsHide(control) {
311
295
  if (control.props.isHide) {
312
296
  return true;
@@ -69,10 +69,10 @@ var Store = /*#__PURE__*/ function() {
69
69
  }
70
70
  _create_class(Store, [
71
71
  {
72
- /**
73
- * 使用该方法仅改变数据,不会表单触发事件。明细表可全量赋值也可根据rowIndex进行单独设置
74
- * @param controlId 组件ID
75
- * @param value
72
+ /**
73
+ * 使用该方法仅改变数据,不会表单触发事件。明细表可全量赋值也可根据rowIndex进行单独设置
74
+ * @param controlId 组件ID
75
+ * @param value
76
76
  */ key: "setState",
77
77
  value: function setState(controlId, value, rowIndex) {
78
78
  var _this = this;
@@ -81,6 +81,7 @@ var Store = /*#__PURE__*/ function() {
81
81
  if (controlInfo !== undefined) {
82
82
  //明细表
83
83
  if (controlInfo.children) {
84
+ ;
84
85
  value.forEach(function(item) {
85
86
  if (!item.uid) {
86
87
  Object.assign(item, {
@@ -109,6 +110,7 @@ var Store = /*#__PURE__*/ function() {
109
110
  Object.keys(children).map(function(childControlId) {
110
111
  if (childControlId === controlId) {
111
112
  if (_this.state[dataView][subtableId][rowIndex]) {
113
+ ;
112
114
  _this.state[dataView][subtableId][rowIndex][controlId] = noProxyValue;
113
115
  }
114
116
  }
@@ -167,6 +169,7 @@ var Store = /*#__PURE__*/ function() {
167
169
  if (children !== undefined) {
168
170
  Object.keys(children).map(function(childControlId) {
169
171
  if (childControlId === controlId) {
172
+ ;
170
173
  _this.state[dataViewId][subtableId].map(function(item) {
171
174
  states.push(item[controlId]);
172
175
  });
@@ -364,15 +367,17 @@ item) {
364
367
  Object.keys(item.props.dataBind).map(function(key) {
365
368
  var dataBind = item.props.dataBind;
366
369
  var dataCode = dataBind[key].dataCode;
367
- data[dataCode].fields.push({
368
- fieldCode: dataBind[key].fieldCode,
369
- controlId: item.id,
370
- dataBind: dataBind,
371
- dataViewId: [
372
- dataViewId,
373
- subtableId
374
- ]
375
- });
370
+ if (dataBind[key].fieldCode !== '') {
371
+ data[dataCode].fields.push({
372
+ fieldCode: dataBind[key].fieldCode,
373
+ controlId: item.id,
374
+ dataBind: dataBind,
375
+ dataViewId: [
376
+ dataViewId,
377
+ subtableId
378
+ ]
379
+ });
380
+ }
376
381
  });
377
382
  } else {
378
383
  if (data[item.props.dataBind.dataCode] === undefined) {