@byteluck-fe/model-driven-engine 2.22.2-beta.16 → 2.22.2-beta.18

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.
@@ -329,7 +329,7 @@ function _ts_generator(thisArg, body) {
329
329
  }
330
330
  }
331
331
  import { isDataBind } from '@byteluck-fe/model-driven-core';
332
- import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, RulesMessage, updateValueFromKeys, warn, Watcher, isBuiltInControls } from '@byteluck-fe/model-driven-shared';
332
+ import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, updateValueFromKeys, warn, Watcher, isBuiltInControls } from '@byteluck-fe/model-driven-shared';
333
333
  import { Runtime } from './Runtime';
334
334
  import { Store } from './Store';
335
335
  import { findItem, proxyState } from './proxyState';
@@ -360,7 +360,6 @@ var Engine = /*#__PURE__*/ function(Watcher) {
360
360
  _this.$options = Object.freeze(props);
361
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,
362
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);
364
363
  _this.debug = debug;
365
364
  _this.runtime = new Runtime({
366
365
  schema: schema,
@@ -951,9 +950,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
951
950
  }
952
951
  },
953
952
  {
954
- /**
955
- * 设置payload的options,提供在不是使用标准api修改state的时候可以传递options,会在本次任务执行完成之后清空
956
- * @param options 需要携带的options
953
+ /**
954
+ * 设置payload的options,提供在不是使用标准api修改state的时候可以传递options,会在本次任务执行完成之后清空
955
+ * @param options 需要携带的options
957
956
  * */ key: "setPayloadOptions",
958
957
  value: function setPayloadOptions(options) {
959
958
  eventOptionsTemp = options;
@@ -970,9 +969,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
970
969
  }
971
970
  },
972
971
  {
973
- /**
974
- * 向Store设置一组值,明细表必须全量赋值,并触发事件(触发事件是根据组件在页面中的顺序逐个触发)
975
- * @param states
972
+ /**
973
+ * 向Store设置一组值,明细表必须全量赋值,并触发事件(触发事件是根据组件在页面中的顺序逐个触发)
974
+ * @param states
976
975
  */ key: "setStates",
977
976
  value: function setStates(states, rowIndex, options) {
978
977
  var _this = this;
@@ -999,11 +998,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
999
998
  }
1000
999
  },
1001
1000
  {
1002
- /**
1003
- * 通过dataCode和fieldCode来获取控件的值
1004
- * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
1005
- * @param fieldCode 字段编码 - 控件绑定的数据项的编码
1006
- * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
1001
+ /**
1002
+ * 通过dataCode和fieldCode来获取控件的值
1003
+ * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
1004
+ * @param fieldCode 字段编码 - 控件绑定的数据项的编码
1005
+ * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
1007
1006
  * */ key: "getField",
1008
1007
  value: function getField(dataCode, fieldCode, rowIndex) {
1009
1008
  if (!fieldCode) {
@@ -1118,13 +1117,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1118
1117
  }
1119
1118
  },
1120
1119
  {
1121
- /**
1122
- * 通过dataCode和fieldCode来设置控件的值
1123
- * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
1124
- * @param fieldCode 字段编码 - 控件绑定的数据项的编码
1125
- * @param value 修改的值
1126
- * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
1127
- * @param options 触发事件携带的参数
1120
+ /**
1121
+ * 通过dataCode和fieldCode来设置控件的值
1122
+ * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
1123
+ * @param fieldCode 字段编码 - 控件绑定的数据项的编码
1124
+ * @param value 修改的值
1125
+ * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
1126
+ * @param options 触发事件携带的参数
1128
1127
  * */ key: "setField",
1129
1128
  value: function setField(dataCode, fieldCode, value, rowIndex, options) {
1130
1129
  var dataBindMapping = this.getDataBindMapping(dataCode, fieldCode);
@@ -1152,12 +1151,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1152
1151
  }
1153
1152
  },
1154
1153
  {
1155
- /**
1156
- * 通过dataCode和 state来给一组控件赋值,并触发事件携带options
1157
- * @param dataCode 需要赋值的目标模型
1158
- * @param state 赋值对象,以fieldCode为key组成的对象
1159
- * @param rowIndex 行下标,给明细子表赋值时指定赋值某行
1160
- * @param options 触发事件携带的参数
1154
+ /**
1155
+ * 通过dataCode和 state来给一组控件赋值,并触发事件携带options
1156
+ * @param dataCode 需要赋值的目标模型
1157
+ * @param state 赋值对象,以fieldCode为key组成的对象
1158
+ * @param rowIndex 行下标,给明细子表赋值时指定赋值某行
1159
+ * @param options 触发事件携带的参数
1161
1160
  * */ key: "setFields",
1162
1161
  value: function setFields(dataCode, state, rowIndex, options) {
1163
1162
  var _this = this;
@@ -1198,10 +1197,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1198
1197
  }
1199
1198
  },
1200
1199
  {
1201
- /**
1202
- * 通过dataCode来将state转化为标准的state结构
1203
- * @param dataCode 需要转换的目标模型code
1204
- * @param state 值对象,以fieldCode为key组成的对象
1200
+ /**
1201
+ * 通过dataCode来将state转化为标准的state结构
1202
+ * @param dataCode 需要转换的目标模型code
1203
+ * @param state 值对象,以fieldCode为key组成的对象
1205
1204
  * */ key: "buildFields",
1206
1205
  value: function buildFields(dataCode, state) {
1207
1206
  var _this = this;
@@ -1242,10 +1241,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1242
1241
  }
1243
1242
  },
1244
1243
  {
1245
- /**
1246
- * 向Store设置一组值,并触发事件携带options
1247
- * @param dataSet
1248
- * @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
1244
+ /**
1245
+ * 向Store设置一组值,并触发事件携带options
1246
+ * @param dataSet
1247
+ * @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
1249
1248
  */ key: "setData",
1250
1249
  value: function setData(dataSet, options) {
1251
1250
  var _this = this;
@@ -1383,19 +1382,19 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1383
1382
  }
1384
1383
  },
1385
1384
  {
1386
- /**
1387
- * 获取控件的dataBind
1388
- * @param controlId
1385
+ /**
1386
+ * 获取控件的dataBind
1387
+ * @param controlId
1389
1388
  * */ key: "getDataBind",
1390
1389
  value: function getDataBind(controlId) {
1391
1390
  return this.store.getDataBind(controlId);
1392
1391
  }
1393
1392
  },
1394
1393
  {
1395
- /**
1396
- * 获取组件实例,传入rowIndex代表获取明细表内的控件实例,rowIndex传入-1代表获取表头内的实例
1397
- * @param controlId
1398
- * @param rowIndex
1394
+ /**
1395
+ * 获取组件实例,传入rowIndex代表获取明细表内的控件实例,rowIndex传入-1代表获取表头内的实例
1396
+ * @param controlId
1397
+ * @param rowIndex
1399
1398
  */ key: "getInstance",
1400
1399
  value: function getInstance(controlId, rowIndex) {
1401
1400
  var instances = this.getInstances(controlId, rowIndex === -1);
@@ -1414,10 +1413,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1414
1413
  }
1415
1414
  },
1416
1415
  {
1417
- /**
1418
- * 获取组件实例,明细表中的组件将会得到数组, 第二个参数为(false/不传入)则获取到的是明细表内不包含表头内实例的所有控件实例,传入true则获取到包含表头内实例的所有控件实例,表头内实例永远在下标0的位置
1419
- * @param controlId
1420
- * @param header 明细表内是否获取表头的控件
1416
+ /**
1417
+ * 获取组件实例,明细表中的组件将会得到数组, 第二个参数为(false/不传入)则获取到的是明细表内不包含表头内实例的所有控件实例,传入true则获取到包含表头内实例的所有控件实例,表头内实例永远在下标0的位置
1418
+ * @param controlId
1419
+ * @param header 明细表内是否获取表头的控件
1421
1420
  */ // getInstances(
1422
1421
  // controlId?: string,
1423
1422
  // header: boolean = false
@@ -1593,27 +1592,27 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1593
1592
  },
1594
1593
  {
1595
1594
  key: "assertInstance",
1596
- value: /**
1597
- * 判断控件的类型,返回当前控件的正确类型
1595
+ value: /**
1596
+ * 判断控件的类型,返回当前控件的正确类型
1598
1597
  * */ function assertInstance(instance, types) {
1599
1598
  return isString(types) ? instance.type === types : types.includes(instance.type);
1600
1599
  }
1601
1600
  },
1602
1601
  {
1603
1602
  key: "assertInstanceIsCustomControl",
1604
- value: /**
1605
- * 判断控件或控件类型是一个自定义控件
1603
+ value: /**
1604
+ * 判断控件或控件类型是一个自定义控件
1606
1605
  * */ function assertInstanceIsCustomControl(instance) {
1607
1606
  return !isBuiltInControls(isString(instance) ? instance : instance.type);
1608
1607
  }
1609
1608
  },
1610
1609
  {
1611
1610
  key: "getInstanceRowIndex",
1612
- value: /**
1613
- * 获取控件在明细子表中的行下标,
1614
- * 如果控件在表头内,则返回-1
1615
- * 如果控件在表内,则返回行下标
1616
- * 如果控件不在明细表内,则返回undefined
1611
+ value: /**
1612
+ * 获取控件在明细子表中的行下标,
1613
+ * 如果控件在表头内,则返回-1
1614
+ * 如果控件在表内,则返回行下标
1615
+ * 如果控件不在明细表内,则返回undefined
1617
1616
  * */ // public getInstanceRowIndex(
1618
1617
  // instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl
1619
1618
  // ) {