@byteluck-fe/model-driven-engine 2.7.0-alpha.3 → 2.7.0-alpha.30a

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.
@@ -1,15 +1,15 @@
1
- function _arrayLikeToArray(arr, len) {
1
+ function _array_like_to_array(arr, len) {
2
2
  if (len == null || len > arr.length) len = arr.length;
3
3
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
4
  return arr2;
5
5
  }
6
- function _arrayWithHoles(arr) {
6
+ function _array_with_holes(arr) {
7
7
  if (Array.isArray(arr)) return arr;
8
8
  }
9
- function _arrayWithoutHoles(arr) {
10
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
9
+ function _array_without_holes(arr) {
10
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
11
11
  }
12
- function _assertThisInitialized(self) {
12
+ function _assert_this_initialized(self) {
13
13
  if (self === void 0) {
14
14
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
15
15
  }
@@ -29,7 +29,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
29
29
  Promise.resolve(value).then(_next, _throw);
30
30
  }
31
31
  }
32
- function _asyncToGenerator(fn) {
32
+ function _async_to_generator(fn) {
33
33
  return function() {
34
34
  var self = this, args = arguments;
35
35
  return new Promise(function(resolve, reject) {
@@ -44,7 +44,7 @@ function _asyncToGenerator(fn) {
44
44
  });
45
45
  };
46
46
  }
47
- function _classCallCheck(instance, Constructor) {
47
+ function _class_call_check(instance, Constructor) {
48
48
  if (!(instance instanceof Constructor)) {
49
49
  throw new TypeError("Cannot call a class as a function");
50
50
  }
@@ -58,12 +58,12 @@ function _defineProperties(target, props) {
58
58
  Object.defineProperty(target, descriptor.key, descriptor);
59
59
  }
60
60
  }
61
- function _createClass(Constructor, protoProps, staticProps) {
61
+ function _create_class(Constructor, protoProps, staticProps) {
62
62
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
63
63
  if (staticProps) _defineProperties(Constructor, staticProps);
64
64
  return Constructor;
65
65
  }
66
- function _defineProperty(obj, key, value) {
66
+ function _define_property(obj, key, value) {
67
67
  if (key in obj) {
68
68
  Object.defineProperty(obj, key, {
69
69
  value: value,
@@ -80,23 +80,23 @@ function _get(target, property, receiver) {
80
80
  if (typeof Reflect !== "undefined" && Reflect.get) {
81
81
  _get = Reflect.get;
82
82
  } else {
83
- _get = function _get(target, property, receiver) {
84
- var base = _superPropBase(target, property);
83
+ _get = function get(target, property, receiver) {
84
+ var base = _super_prop_base(target, property);
85
85
  if (!base) return;
86
86
  var desc = Object.getOwnPropertyDescriptor(base, property);
87
87
  if (desc.get) {
88
- return desc.get.call(receiver);
88
+ return desc.get.call(receiver || target);
89
89
  }
90
90
  return desc.value;
91
91
  };
92
92
  }
93
93
  return _get(target, property, receiver || target);
94
94
  }
95
- function _getPrototypeOf(o) {
96
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
95
+ function _get_prototype_of(o) {
96
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
97
97
  return o.__proto__ || Object.getPrototypeOf(o);
98
98
  };
99
- return _getPrototypeOf(o);
99
+ return _get_prototype_of(o);
100
100
  }
101
101
  function _inherits(subClass, superClass) {
102
102
  if (typeof superClass !== "function" && superClass !== null) {
@@ -109,19 +109,12 @@ function _inherits(subClass, superClass) {
109
109
  configurable: true
110
110
  }
111
111
  });
112
- if (superClass) _setPrototypeOf(subClass, superClass);
112
+ if (superClass) _set_prototype_of(subClass, superClass);
113
113
  }
114
- function _instanceof(left, right) {
115
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
116
- return !!right[Symbol.hasInstance](left);
117
- } else {
118
- return left instanceof right;
119
- }
120
- }
121
- function _iterableToArray(iter) {
114
+ function _iterable_to_array(iter) {
122
115
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
123
116
  }
124
- function _iterableToArrayLimit(arr, i) {
117
+ function _iterable_to_array_limit(arr, i) {
125
118
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
126
119
  if (_i == null) return;
127
120
  var _arr = [];
@@ -145,13 +138,13 @@ function _iterableToArrayLimit(arr, i) {
145
138
  }
146
139
  return _arr;
147
140
  }
148
- function _nonIterableRest() {
141
+ function _non_iterable_rest() {
149
142
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
150
143
  }
151
- function _nonIterableSpread() {
144
+ function _non_iterable_spread() {
152
145
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
153
146
  }
154
- function _objectSpread(target) {
147
+ function _object_spread(target) {
155
148
  for(var i = 1; i < arguments.length; i++){
156
149
  var source = arguments[i] != null ? arguments[i] : {};
157
150
  var ownKeys = Object.keys(source);
@@ -161,7 +154,7 @@ function _objectSpread(target) {
161
154
  }));
162
155
  }
163
156
  ownKeys.forEach(function(key) {
164
- _defineProperty(target, key, source[key]);
157
+ _define_property(target, key, source[key]);
165
158
  });
166
159
  }
167
160
  return target;
@@ -179,7 +172,7 @@ function ownKeys(object, enumerableOnly) {
179
172
  }
180
173
  return keys;
181
174
  }
182
- function _objectSpreadProps(target, source) {
175
+ function _object_spread_props(target, source) {
183
176
  source = source != null ? source : {};
184
177
  if (Object.getOwnPropertyDescriptors) {
185
178
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
@@ -190,45 +183,45 @@ function _objectSpreadProps(target, source) {
190
183
  }
191
184
  return target;
192
185
  }
193
- function _possibleConstructorReturn(self, call) {
194
- if (call && (_typeof(call) === "object" || typeof call === "function")) {
186
+ function _possible_constructor_return(self, call) {
187
+ if (call && (_type_of(call) === "object" || typeof call === "function")) {
195
188
  return call;
196
189
  }
197
- return _assertThisInitialized(self);
190
+ return _assert_this_initialized(self);
198
191
  }
199
- function _setPrototypeOf(o, p) {
200
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
192
+ function _set_prototype_of(o, p) {
193
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
201
194
  o.__proto__ = p;
202
195
  return o;
203
196
  };
204
- return _setPrototypeOf(o, p);
197
+ return _set_prototype_of(o, p);
205
198
  }
206
- function _slicedToArray(arr, i) {
207
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
199
+ function _sliced_to_array(arr, i) {
200
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
208
201
  }
209
- function _superPropBase(object, property) {
202
+ function _super_prop_base(object, property) {
210
203
  while(!Object.prototype.hasOwnProperty.call(object, property)){
211
- object = _getPrototypeOf(object);
204
+ object = _get_prototype_of(object);
212
205
  if (object === null) break;
213
206
  }
214
207
  return object;
215
208
  }
216
- function _toConsumableArray(arr) {
217
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
209
+ function _to_consumable_array(arr) {
210
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
218
211
  }
219
- var _typeof = function(obj) {
212
+ function _type_of(obj) {
220
213
  "@swc/helpers - typeof";
221
214
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
222
- };
223
- function _unsupportedIterableToArray(o, minLen) {
215
+ }
216
+ function _unsupported_iterable_to_array(o, minLen) {
224
217
  if (!o) return;
225
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
218
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
226
219
  var n = Object.prototype.toString.call(o).slice(8, -1);
227
220
  if (n === "Object" && o.constructor) n = o.constructor.name;
228
221
  if (n === "Map" || n === "Set") return Array.from(n);
229
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
222
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
230
223
  }
231
- function _isNativeReflectConstruct() {
224
+ function _is_native_reflect_construct() {
232
225
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
233
226
  if (Reflect.construct.sham) return false;
234
227
  if (typeof Proxy === "function") return true;
@@ -239,20 +232,20 @@ function _isNativeReflectConstruct() {
239
232
  return false;
240
233
  }
241
234
  }
242
- function _createSuper(Derived) {
243
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
235
+ function _create_super(Derived) {
236
+ var hasNativeReflectConstruct = _is_native_reflect_construct();
244
237
  return function _createSuperInternal() {
245
- var Super = _getPrototypeOf(Derived), result;
238
+ var Super = _get_prototype_of(Derived), result;
246
239
  if (hasNativeReflectConstruct) {
247
- var NewTarget = _getPrototypeOf(this).constructor;
240
+ var NewTarget = _get_prototype_of(this).constructor;
248
241
  result = Reflect.construct(Super, arguments, NewTarget);
249
242
  } else {
250
243
  result = Super.apply(this, arguments);
251
244
  }
252
- return _possibleConstructorReturn(this, result);
245
+ return _possible_constructor_return(this, result);
253
246
  };
254
247
  }
255
- var __generator = this && this.__generator || function(thisArg, body) {
248
+ function _ts_generator(thisArg, body) {
256
249
  var f, y, t, g, _ = {
257
250
  label: 0,
258
251
  sent: function() {
@@ -346,8 +339,8 @@ var __generator = this && this.__generator || function(thisArg, body) {
346
339
  done: true
347
340
  };
348
341
  }
349
- };
350
- import { DataBind, ObjectDataBind, RuntimeListControl } from "@byteluck-fe/model-driven-core";
342
+ }
343
+ import { isDataBind } from "@byteluck-fe/model-driven-core";
351
344
  import { CONTROL_BASE_TYPE, CONTROL_TYPE, DEFAULT_LOCALE, error, genNonDuplicateId, isString, JSONCopy, log, RulesMessage, updateValueFromKeys, warn, Watcher } from "@byteluck-fe/model-driven-shared";
352
345
  import { Runtime } from "./Runtime";
353
346
  import { Store } from "./Store";
@@ -367,29 +360,29 @@ var applyingPluginName = "";
367
360
  var Engine = /*#__PURE__*/ function(Watcher) {
368
361
  "use strict";
369
362
  _inherits(Engine, Watcher);
370
- var _super = _createSuper(Engine);
363
+ var _super = _create_super(Engine);
371
364
  function Engine(props) {
372
- _classCallCheck(this, Engine);
365
+ _class_call_check(this, Engine);
373
366
  var _this;
374
367
  _this = _super.call(this);
375
- _defineProperty(_assertThisInitialized(_this), "store", void 0);
376
- _defineProperty(_assertThisInitialized(_this), "rawStore", {});
377
- _defineProperty(_assertThisInitialized(_this), "parent", void 0);
368
+ _define_property(_assert_this_initialized(_this), "store", void 0);
369
+ _define_property(_assert_this_initialized(_this), "rawStore", {});
370
+ _define_property(_assert_this_initialized(_this), "parent", void 0);
378
371
  // 提供注册运行态控件以及实例化控件的能力
379
- _defineProperty(_assertThisInitialized(_this), "runtime", void 0);
372
+ _define_property(_assert_this_initialized(_this), "runtime", void 0);
380
373
  // 提供子线程处理脚本以及修改数据的能力
381
374
  // public worker: OkWorker
382
- _defineProperty(_assertThisInitialized(_this), "isMounted", false);
383
- _defineProperty(_assertThisInitialized(_this), "id", genNonDuplicateId(8));
384
- _defineProperty(_assertThisInitialized(_this), "externalParams", void 0);
375
+ _define_property(_assert_this_initialized(_this), "isMounted", false);
376
+ _define_property(_assert_this_initialized(_this), "id", genNonDuplicateId(8));
377
+ _define_property(_assert_this_initialized(_this), "externalParams", void 0);
385
378
  // 提供外部注册插件,在不同的hooks触发时执行固定函数的能力
386
- _defineProperty(_assertThisInitialized(_this), "__plugins", void 0);
387
- _defineProperty(_assertThisInitialized(_this), "__pluginsApplied", false);
388
- _defineProperty(_assertThisInitialized(_this), "$options", void 0);
389
- _defineProperty(_assertThisInitialized(_this), "actionManager", new ActionManager());
390
- _defineProperty(_assertThisInitialized(_this), "dataManager", void 0);
391
- _defineProperty(_assertThisInitialized(_this), "_jobTasks", []);
392
- _defineProperty(_assertThisInitialized(_this), "createControlInstance", _this.createInstance);
379
+ _define_property(_assert_this_initialized(_this), "__plugins", void 0);
380
+ _define_property(_assert_this_initialized(_this), "__pluginsApplied", false);
381
+ _define_property(_assert_this_initialized(_this), "$options", void 0);
382
+ _define_property(_assert_this_initialized(_this), "actionManager", new ActionManager());
383
+ _define_property(_assert_this_initialized(_this), "dataManager", void 0);
384
+ _define_property(_assert_this_initialized(_this), "_jobTasks", []);
385
+ _define_property(_assert_this_initialized(_this), "createControlInstance", _this.createInstance);
393
386
  _this.$options = Object.freeze(props);
394
387
  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,
395
388
  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;
@@ -408,14 +401,14 @@ var Engine = /*#__PURE__*/ function(Watcher) {
408
401
  autoMount && _this.mount();
409
402
  return _this;
410
403
  }
411
- _createClass(Engine, [
404
+ _create_class(Engine, [
412
405
  {
413
406
  key: "debugLog",
414
407
  value: function debugLog() {
415
408
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
416
409
  args[_key] = arguments[_key];
417
410
  }
418
- this.debug && log.apply(void 0, _toConsumableArray(args));
411
+ this.debug && log.apply(void 0, _to_consumable_array(args));
419
412
  }
420
413
  },
421
414
  {
@@ -435,7 +428,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
435
428
  arg[_key] = arguments[_key];
436
429
  }
437
430
  var _this_runtime;
438
- (_this_runtime = this.runtime).register.apply(_this_runtime, _toConsumableArray(arg));
431
+ (_this_runtime = this.runtime).register.apply(_this_runtime, _to_consumable_array(arg));
439
432
  return this;
440
433
  }
441
434
  },
@@ -525,7 +518,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
525
518
  value: function _handlerArrayUpdate(state, key, type, args, result) {
526
519
  var _this = this;
527
520
  var subtable = findItem(this.runtime.flatInstances, key, this.runtime.instanceMap);
528
- if (!_instanceof(subtable, RuntimeListControl)) return;
521
+ // if (!(subtable instanceof RuntimeListControl)) return
522
+ if (!((subtable === null || subtable === void 0 ? void 0 : subtable.controlType) === CONTROL_BASE_TYPE.LIST)) return;
529
523
  // 新增多行方法
530
524
  var createRows = function(len) {
531
525
  // @ts-ignore
@@ -543,6 +537,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
543
537
  var createdNewRows = [];
544
538
  var createdNewRowsData = [];
545
539
  var deleted = [];
540
+ var isDeleteLastOne = false;
546
541
  if (type && args) {
547
542
  // const subtableOldLength = subtable.children.length
548
543
  switch(type){
@@ -552,7 +547,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
552
547
  var newRowLengths = args.length;
553
548
  createdNewRows = createRows(newRowLengths);
554
549
  createdNewRowsData = args;
555
- (_subtable_children = subtable.children)[type].apply(_subtable_children, _toConsumableArray(createdNewRows));
550
+ (_subtable_children = subtable.children)[type].apply(_subtable_children, _to_consumable_array(createdNewRows));
556
551
  this.runtime.getFlatInstances();
557
552
  break;
558
553
  case "splice":
@@ -570,7 +565,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
570
565
  (_subtable_children1 = subtable.children)[type].apply(_subtable_children1, [
571
566
  start,
572
567
  replace
573
- ].concat(_toConsumableArray(createdNewRows)));
568
+ ].concat(_to_consumable_array(createdNewRows)));
574
569
  this.runtime.getFlatInstances();
575
570
  // newValues.forEach((item: any, index) => {
576
571
  // let newIndex = start + index
@@ -579,14 +574,21 @@ var Engine = /*#__PURE__*/ function(Watcher) {
579
574
  } else {
580
575
  var // @ts-ignore
581
576
  _subtable_children2;
582
- (_subtable_children2 = subtable.children)[type].apply(_subtable_children2, _toConsumableArray(args));
577
+ // 从哪儿开始
578
+ var start1 = args[0];
579
+ // 替换几个
580
+ var replace1 = args[1];
581
+ if (start1 + replace1 === subtable.children.length - 1) {
582
+ isDeleteLastOne = true;
583
+ }
584
+ (_subtable_children2 = subtable.children)[type].apply(_subtable_children2, _to_consumable_array(args));
583
585
  this.runtime.getFlatInstances();
584
586
  }
585
587
  break;
586
588
  default:
587
589
  var // @ts-ignore
588
590
  _subtable_children3;
589
- (_subtable_children3 = subtable.children)[type].apply(_subtable_children3, _toConsumableArray(args));
591
+ (_subtable_children3 = subtable.children)[type].apply(_subtable_children3, _to_consumable_array(args));
590
592
  this.runtime.getFlatInstances();
591
593
  break;
592
594
  }
@@ -607,7 +609,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
607
609
  changed: createdNewRows,
608
610
  data: createdNewRowsData,
609
611
  deleted: deleted !== null && deleted !== void 0 ? deleted : [],
610
- jsonValue: JSON.stringify(this.getState(subtable.id))
612
+ jsonValue: JSON.stringify(this.getState(subtable.id)),
613
+ isDeleteLastOne: isDeleteLastOne
611
614
  })
612
615
  });
613
616
  // 主动清空本次任务中的options
@@ -637,7 +640,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
637
640
  var row = this.listControlCreateRow(instance, "subtable-row");
638
641
  row && newRows.push(row);
639
642
  }
640
- (_instance_children = instance.children).push.apply(_instance_children, _toConsumableArray(newRows));
643
+ (_instance_children = instance.children).push.apply(_instance_children, _to_consumable_array(newRows));
641
644
  this.runtime.getFlatInstances();
642
645
  // 这里已经能拿到控件实例,所以在这里触发setStates,触发每一行每一个控件的change事件
643
646
  // for (let i = 0; i < newValue.length; i++) {
@@ -646,7 +649,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
646
649
  this.emit("list-change", {
647
650
  instance: instance,
648
651
  value: value,
649
- options: _objectSpreadProps(_objectSpread({}, options), {
652
+ options: _object_spread_props(_object_spread({}, options), {
650
653
  // @ts-ignore
651
654
  changed: newRows,
652
655
  data: newValue,
@@ -658,7 +661,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
658
661
  instance: instance,
659
662
  value: this.getState(instance.id, index),
660
663
  rowIndex: index,
661
- options: _objectSpreadProps(_objectSpread({}, options), {
664
+ options: _object_spread_props(_object_spread({}, options), {
662
665
  oldValue: oldValue
663
666
  })
664
667
  });
@@ -697,8 +700,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
697
700
  var template = JSONCopy(instance.props.headers);
698
701
  // @ts-ignore
699
702
  var columns = this.createControl(template);
700
- (_inst_children = inst.children).push.apply(_inst_children, _toConsumableArray(columns));
703
+ (_inst_children = inst.children).push.apply(_inst_children, _to_consumable_array(columns));
701
704
  }
705
+ //@ts-ignore
706
+ row.parent = instance;
702
707
  return row;
703
708
  }
704
709
  },
@@ -718,11 +723,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
718
723
  function emit(eventKey, payload) {
719
724
  var _this = this;
720
725
  var _this1 = this, _superprop_get_emit = function() {
721
- return _get(_getPrototypeOf(Engine.prototype), "emit", _this);
726
+ return _get(_get_prototype_of(Engine.prototype), "emit", _this);
722
727
  };
723
- return _asyncToGenerator(function() {
728
+ return _async_to_generator(function() {
724
729
  var needWait, promiseResolver, promise, results;
725
- return __generator(this, function(_state) {
730
+ return _ts_generator(this, function(_state) {
726
731
  switch(_state.label){
727
732
  case 0:
728
733
  if (!(eventKey === "engine-mounted")) return [
@@ -741,7 +746,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
741
746
  2
742
747
  ];
743
748
  console.time("engine-mounted need wait");
744
- needWait = _toConsumableArray(_this1._jobTasks);
749
+ needWait = _to_consumable_array(_this1._jobTasks);
745
750
  return [
746
751
  4,
747
752
  Promise.all(needWait)
@@ -787,7 +792,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
787
792
  if (applyingPluginName) {
788
793
  callback.applyingPluginName = applyingPluginName;
789
794
  }
790
- return _get(_getPrototypeOf(Engine.prototype), "on", this).call(this, key, callback);
795
+ return _get(_get_prototype_of(Engine.prototype), "on", this).call(this, key, callback);
791
796
  }
792
797
  },
793
798
  {
@@ -797,7 +802,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
797
802
  args[_key] = arguments[_key];
798
803
  }
799
804
  var _this_runtime;
800
- return (_this_runtime = this.runtime).createControl.apply(_this_runtime, _toConsumableArray(args));
805
+ return (_this_runtime = this.runtime).createControl.apply(_this_runtime, _to_consumable_array(args));
801
806
  }
802
807
  },
803
808
  {
@@ -818,6 +823,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
818
823
  return this.setInstance(instance, props, value, rowIndex);
819
824
  }
820
825
  },
826
+ {
827
+ key: "getRule",
828
+ value: function getRule(controlType, props) {
829
+ return Runtime.staticGetRules(controlType, props);
830
+ }
831
+ },
821
832
  {
822
833
  key: "getAllRules",
823
834
  value: function getAllRules(controlId) {
@@ -904,7 +915,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
904
915
  var newStates = states !== null && states !== void 0 ? states : {};
905
916
  Object.keys(newStates).forEach(function(stateId) {
906
917
  Object.entries(_this.store.controlIdMapping).forEach(function(param) {
907
- var _param = _slicedToArray(param, 2), controlId = _param[0], controlIdMapping = _param[1];
918
+ var _param = _sliced_to_array(param, 2), controlId = _param[0], controlIdMapping = _param[1];
908
919
  if (controlIdMapping.dataView === stateId) {
909
920
  // state对象是dataView包裹的
910
921
  var value = newStates[stateId][controlId];
@@ -945,9 +956,10 @@ var Engine = /*#__PURE__*/ function(Watcher) {
945
956
  }
946
957
  var dataBind = dataBindMapping1.dataBind, controlId1 = dataBindMapping1.controlId;
947
958
  var state = this.getState(controlId1, rowIndex);
948
- if (_instanceof(dataBind, ObjectDataBind)) {
959
+ //if (dataBind instanceof ObjectDataBind) {
960
+ if (!isDataBind(dataBind)) {
949
961
  return Object.entries(dataBind).reduce(function(result, param) {
950
- var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
962
+ var _param = _sliced_to_array(param, 2), key = _param[0], dataBind = _param[1];
951
963
  // objectDataBind的元素,跳过下一次赋值
952
964
  if (dataBind.fieldCode === fieldCode) {
953
965
  return result[key];
@@ -973,8 +985,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
973
985
  var data = getFieldData.map(function(item) {
974
986
  var obj = {};
975
987
  for(var key in item){
976
- var _controlIdMapping_controlId_children_key, _controlIdMapping_controlId, _controlIdMapping_controlId_children_key_dataBind;
977
- var fieldCode = (_controlIdMapping_controlId_children_key = (_controlIdMapping_controlId = controlIdMapping[controlId]) === null || _controlIdMapping_controlId === void 0 ? void 0 : _controlIdMapping_controlId.children[key]) === null || _controlIdMapping_controlId_children_key === void 0 ? void 0 : (_controlIdMapping_controlId_children_key_dataBind = _controlIdMapping_controlId_children_key.dataBind) === null || _controlIdMapping_controlId_children_key_dataBind === void 0 ? void 0 : _controlIdMapping_controlId_children_key_dataBind.fieldCode;
988
+ var _controlIdMapping_controlId_children_key_dataBind, _controlIdMapping_controlId_children_key, _controlIdMapping_controlId;
989
+ var fieldCode = (_controlIdMapping_controlId = controlIdMapping[controlId]) === null || _controlIdMapping_controlId === void 0 ? void 0 : (_controlIdMapping_controlId_children_key = _controlIdMapping_controlId.children[key]) === null || _controlIdMapping_controlId_children_key === void 0 ? void 0 : (_controlIdMapping_controlId_children_key_dataBind = _controlIdMapping_controlId_children_key.dataBind) === null || _controlIdMapping_controlId_children_key_dataBind === void 0 ? void 0 : _controlIdMapping_controlId_children_key_dataBind.fieldCode;
978
990
  //未绑定字段的控件,直接抛弃
979
991
  if (fieldCode !== "") {
980
992
  var _controlIdMapping_controlId1;
@@ -984,7 +996,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
984
996
  // 兼容一个控件需要绑定多个字段的情况
985
997
  for(var keyChi in item[key]){
986
998
  var _controlIdMapping_controlId_children_key1, _controlIdMapping_controlId2;
987
- obj[(_controlIdMapping_controlId_children_key1 = (_controlIdMapping_controlId2 = controlIdMapping[controlId]) === null || _controlIdMapping_controlId2 === void 0 ? void 0 : _controlIdMapping_controlId2.children[key]) === null || _controlIdMapping_controlId_children_key1 === void 0 ? void 0 : _controlIdMapping_controlId_children_key1.dataBind[keyChi].fieldCode] = item[key][keyChi];
999
+ obj[(_controlIdMapping_controlId2 = controlIdMapping[controlId]) === null || _controlIdMapping_controlId2 === void 0 ? void 0 : (_controlIdMapping_controlId_children_key1 = _controlIdMapping_controlId2.children[key]) === null || _controlIdMapping_controlId_children_key1 === void 0 ? void 0 : _controlIdMapping_controlId_children_key1.dataBind[keyChi].fieldCode] = item[key][keyChi];
988
1000
  }
989
1001
  }
990
1002
  }
@@ -994,7 +1006,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
994
1006
  return data;
995
1007
  } else {
996
1008
  var _loop = function(key) {
997
- var _controlIdMapping_key, _controlIdMapping_key_dataBind, _controlIdMapping_key1, _controlIdMapping_key_dataBind1;
1009
+ var _controlIdMapping_key_dataBind, _controlIdMapping_key, _controlIdMapping_key_dataBind1, _controlIdMapping_key1;
998
1010
  if ((_controlIdMapping_key = controlIdMapping[key]) === null || _controlIdMapping_key === void 0 ? void 0 : (_controlIdMapping_key_dataBind = _controlIdMapping_key.dataBind) === null || _controlIdMapping_key_dataBind === void 0 ? void 0 : _controlIdMapping_key_dataBind.fieldCode) {
999
1011
  var _controlIdMapping_key2;
1000
1012
  obj[(_controlIdMapping_key2 = controlIdMapping[key]) === null || _controlIdMapping_key2 === void 0 ? void 0 : _controlIdMapping_key2.dataBind.fieldCode] = getFieldData[key];
@@ -1024,7 +1036,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1024
1036
  // 兼容一个控件需要绑定多个字段的情况
1025
1037
  for(var keyChi in getFieldData[key]){
1026
1038
  var _controlIdMapping_key_dataBind_keyChi, _controlIdMapping_key4;
1027
- obj[(_controlIdMapping_key_dataBind_keyChi = (_controlIdMapping_key4 = controlIdMapping[key]) === null || _controlIdMapping_key4 === void 0 ? void 0 : _controlIdMapping_key4.dataBind[keyChi]) === null || _controlIdMapping_key_dataBind_keyChi === void 0 ? void 0 : _controlIdMapping_key_dataBind_keyChi.fieldCode] = getFieldData[key][keyChi];
1039
+ obj[(_controlIdMapping_key4 = controlIdMapping[key]) === null || _controlIdMapping_key4 === void 0 ? void 0 : (_controlIdMapping_key_dataBind_keyChi = _controlIdMapping_key4.dataBind[keyChi]) === null || _controlIdMapping_key_dataBind_keyChi === void 0 ? void 0 : _controlIdMapping_key_dataBind_keyChi.fieldCode] = getFieldData[key][keyChi];
1028
1040
  }
1029
1041
  }
1030
1042
  };
@@ -1052,12 +1064,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1052
1064
  return;
1053
1065
  }
1054
1066
  var dataBind = dataBindMapping.dataBind, controlId = dataBindMapping.controlId;
1055
- if (_instanceof(dataBind, ObjectDataBind)) {
1067
+ // if (dataBind instanceof ObjectDataBind) {
1068
+ if (!isDataBind(dataBind)) {
1056
1069
  var _JSONCopy;
1057
1070
  var oldState = (_JSONCopy = JSONCopy(this.getState(controlId, rowIndex))) !== null && _JSONCopy !== void 0 ? _JSONCopy : this.getEmptyState(controlId);
1058
1071
  // fieldCode不代表是key,所以需要找到对应的key
1059
1072
  var newState = Object.entries(dataBind).reduce(function(result, param) {
1060
- var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
1073
+ var _param = _sliced_to_array(param, 2), key = _param[0], dataBind = _param[1];
1061
1074
  // objectDataBind的元素,跳过下一次赋值
1062
1075
  if (dataBind.fieldCode === fieldCode) {
1063
1076
  result[key] = value;
@@ -1094,12 +1107,13 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1094
1107
  return;
1095
1108
  }
1096
1109
  // 对象类型的值
1097
- if (_instanceof(dataBind, ObjectDataBind)) {
1110
+ // if (dataBind instanceof ObjectDataBind) {
1111
+ if (!isDataBind(dataBind)) {
1098
1112
  var _JSONCopy;
1099
1113
  var oldState = (_JSONCopy = JSONCopy(_this.getState(controlId, rowIndex))) !== null && _JSONCopy !== void 0 ? _JSONCopy : _this.getEmptyState(controlId);
1100
1114
  // fieldCode不代表是key,所以需要找到对应的key
1101
1115
  var newState = Object.entries(dataBind).reduce(function(result, param) {
1102
- var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
1116
+ var _param = _sliced_to_array(param, 2), key = _param[0], dataBind = _param[1];
1103
1117
  // objectDataBind的元素,跳过下一次赋值
1104
1118
  skipKeys.push(dataBind.fieldCode);
1105
1119
  var value = state[dataBind.fieldCode];
@@ -1124,7 +1138,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1124
1138
  value: function buildFields(dataCode, state) {
1125
1139
  var _this = this;
1126
1140
  var mapping = this.getDataBindMapping(dataCode);
1127
- if (!mapping) {
1141
+ if (!mapping || !mapping.fields) {
1128
1142
  return;
1129
1143
  }
1130
1144
  var skipKeys = [];
@@ -1138,11 +1152,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1138
1152
  return;
1139
1153
  }
1140
1154
  // 对象类型的值
1141
- if (_instanceof(dataBind, ObjectDataBind)) {
1155
+ // if (dataBind instanceof ObjectDataBind) {
1156
+ if (!isDataBind(dataBind)) {
1142
1157
  var oldState = _this.getEmptyState(controlId);
1143
1158
  // fieldCode不代表是key,所以需要找到对应的key
1144
1159
  result[item.controlId] = Object.entries(dataBind).reduce(function(result, param) {
1145
- var _param = _slicedToArray(param, 2), key = _param[0], dataBind = _param[1];
1160
+ var _param = _sliced_to_array(param, 2), key = _param[0], dataBind = _param[1];
1146
1161
  // objectDataBind的元素,跳过下一次赋值
1147
1162
  skipKeys.push(dataBind.fieldCode);
1148
1163
  var value = state[dataBind.fieldCode];
@@ -1178,13 +1193,18 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1178
1193
  if (!newState[mapping.dataViewId]) {
1179
1194
  newState[mapping.dataViewId] = {};
1180
1195
  }
1181
- newState[mapping.dataViewId][mapping.controlId] = [];
1196
+ if (!entity.length) {
1197
+ var _newState_mapping_dataViewId_mapping_controlId;
1198
+ 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 : [];
1199
+ } else {
1200
+ newState[mapping.dataViewId][mapping.controlId] = [];
1201
+ }
1182
1202
  entity.map(function(row) {
1183
1203
  var newRow = JSONCopy(_this.store.emptyState[mapping.dataViewId][mapping.controlId]);
1184
1204
  var skipKey = [] //qiyu ObjectDataBind中会提前将相关key拿出来赋值,为了避免重复赋值,设置了此变量
1185
1205
  ;
1186
1206
  Object.keys(row).map(function(fieldCode) {
1187
- var _this_store_dataBindMapping_dataCode, _this_store_dataBindMapping_dataCode_fields;
1207
+ var _this_store_dataBindMapping_dataCode_fields, _this_store_dataBindMapping_dataCode;
1188
1208
  if (skipKey.includes(fieldCode)) {
1189
1209
  return;
1190
1210
  }
@@ -1192,9 +1212,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1192
1212
  return i.fieldCode === fieldCode;
1193
1213
  });
1194
1214
  if (fieldMapping) {
1195
- if (_instanceof(fieldMapping.dataBind, DataBind) && row[fieldCode] !== undefined) {
1215
+ if (// fieldMapping.dataBind instanceof DataBind &&
1216
+ isDataBind(fieldMapping.dataBind) && row[fieldCode] !== undefined) {
1196
1217
  newRow[fieldMapping.controlId] = row[fieldCode];
1197
- } else if (_instanceof(fieldMapping.dataBind, ObjectDataBind)) {
1218
+ // } else if (fieldMapping.dataBind instanceof ObjectDataBind) {
1219
+ } else if (!isDataBind(fieldMapping.dataBind)) {
1198
1220
  var _this_getEmptyState;
1199
1221
  var objValue = JSONCopy((_this_getEmptyState = _this.getEmptyState(fieldMapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {});
1200
1222
  Object.keys(fieldMapping.dataBind).map(function(key) {
@@ -1227,9 +1249,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1227
1249
  if (!newState[mapping.dataViewId[0]]) {
1228
1250
  newState[mapping.dataViewId[0]] = {};
1229
1251
  }
1230
- if (_instanceof(mapping.dataBind, DataBind) && entity[fieldCode] !== undefined) {
1252
+ if (// mapping.dataBind instanceof DataBind &&
1253
+ isDataBind(mapping.dataBind) && entity[fieldCode] !== undefined) {
1231
1254
  newState[mapping.dataViewId[0]][mapping.controlId] = entity[fieldCode] !== undefined ? entity[fieldCode] : emptyState[mapping.dataViewId[0]][mapping.controlId];
1232
- } else if (_instanceof(mapping.dataBind, ObjectDataBind)) {
1255
+ // } else if (mapping.dataBind instanceof ObjectDataBind) {
1256
+ } else if (!isDataBind(mapping.dataBind)) {
1233
1257
  var _this_getEmptyState;
1234
1258
  var objValue = (_this_getEmptyState = _this.getEmptyState(mapping.controlId)) !== null && _this_getEmptyState !== void 0 ? _this_getEmptyState : {};
1235
1259
  Object.keys(mapping.dataBind).map(function(key) {
@@ -1256,9 +1280,9 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1256
1280
  mappingKeys === null || mappingKeys === void 0 ? void 0 : mappingKeys.forEach(function(key) {
1257
1281
  if (!mainStateKeys.includes(key) && key !== "uid" && newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId]) {
1258
1282
  if (Object.keys(newState).length) {
1259
- Object.assign(newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId], _defineProperty({}, key, mappingValue[key]));
1283
+ Object.assign(newState[newMapping === null || newMapping === void 0 ? void 0 : newMapping.controlId], _define_property({}, key, mappingValue[key]));
1260
1284
  } else {
1261
- Object.assign(newState, _defineProperty({}, newMapping.controlId, _defineProperty({}, key, mappingValue[key])));
1285
+ Object.assign(newState, _define_property({}, newMapping.controlId, _define_property({}, key, mappingValue[key])));
1262
1286
  }
1263
1287
  }
1264
1288
  });
@@ -1307,7 +1331,59 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1307
1331
  * 获取组件实例,明细表中的组件将会得到数组, 第二个参数为(false/不传入)则获取到的是明细表内不包含表头内实例的所有控件实例,传入true则获取到包含表头内实例的所有控件实例,表头内实例永远在下标0的位置
1308
1332
  * @param controlId
1309
1333
  * @param header 明细表内是否获取表头的控件
1310
- */ key: "getInstances",
1334
+ */ // getInstances(
1335
+ // controlId?: string,
1336
+ // header: boolean = false
1337
+ // ): ControlRuntimeInstance<ControlsKeys>[] {
1338
+ // // const cc = console
1339
+ // // const label = '🐑 genInstances ' + controlId + ' ' + Date.now()
1340
+ // // cc.time(label)
1341
+ //
1342
+ // if (controlId === undefined) {
1343
+ // // cc.timeEnd(label)
1344
+ // return this.runtime.flatInstances
1345
+ // }
1346
+ // const instances = Array.from(this.runtime.instanceMap[controlId] || [])
1347
+ // if (header) {
1348
+ // // 如果能从flatInstances里边取到,就通过getInstanceInSubtableHeader方法取,取不到则换一种方式
1349
+ // if (instances.length) {
1350
+ // const instance: RuntimeControl = instances[0]
1351
+ // // if (this.inList(instance.id) === true) {
1352
+ // if (this.inList(instance.id) !== undefined) {
1353
+ // const headerInstance = this.getInstanceInSubtableHeader(instance)
1354
+ // if (headerInstance) {
1355
+ // instances.unshift(headerInstance)
1356
+ // }
1357
+ // }
1358
+ // } else {
1359
+ // const controlIdMapping = this.getControlIdMapping()
1360
+ // const [subtableId] =
1361
+ // Object.entries(controlIdMapping).find(
1362
+ // ([_, mapping]) => mapping.children && controlId in mapping.children
1363
+ // ) ?? []
1364
+ // if (subtableId) {
1365
+ // const subtable = this.getInstance(subtableId)
1366
+ // // @ts-ignore
1367
+ // const headerColumn = subtable.props.headers.find((column: any) =>
1368
+ // column.children.find((item: any) => item.id === controlId)
1369
+ // )
1370
+ // if (headerColumn) {
1371
+ // const headerInstance = headerColumn.children.find(
1372
+ // (item: any) => item.id === controlId
1373
+ // )
1374
+ // if (headerInstance) {
1375
+ // instances.unshift(
1376
+ // headerInstance as ControlRuntimeInstance<ControlsKeys>
1377
+ // )
1378
+ // }
1379
+ // }
1380
+ // }
1381
+ // }
1382
+ // }
1383
+ // // @ts-ignore
1384
+ // return instances
1385
+ // }
1386
+ key: "getInstances",
1311
1387
  value: function getInstances(controlId) {
1312
1388
  var header = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
1313
1389
  // const cc = console
@@ -1317,41 +1393,15 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1317
1393
  // cc.timeEnd(label)
1318
1394
  return this.runtime.flatInstances;
1319
1395
  }
1320
- var instances = Array.from(this.runtime.instanceMap[controlId] || []);
1396
+ var instances = this.runtime.instanceMap[controlId] || [];
1321
1397
  if (header) {
1322
- // 如果能从flatInstances里边取到,就通过getInstanceInSubtableHeader方法取,取不到则换一种方式
1323
- if (instances.length) {
1324
- var instance = instances[0];
1325
- if (this.inList(instance.id) !== undefined) {
1326
- var headerInstance = this.getInstanceInSubtableHeader(instance);
1327
- if (headerInstance) {
1328
- instances.unshift(headerInstance);
1329
- }
1330
- }
1331
- } else {
1332
- var _this_getControlIdMapping;
1333
- var controlIdMapping = (_this_getControlIdMapping = this.getControlIdMapping()) !== null && _this_getControlIdMapping !== void 0 ? _this_getControlIdMapping : {};
1334
- var _Object_entries_find;
1335
- var _ref = _slicedToArray((_Object_entries_find = Object.entries(controlIdMapping).find(function(param) {
1336
- var _param = _slicedToArray(param, 2), _ = _param[0], mapping = _param[1];
1337
- return mapping.children && controlId in mapping.children;
1338
- })) !== null && _Object_entries_find !== void 0 ? _Object_entries_find : [], 1), subtableId = _ref[0];
1339
- if (subtableId) {
1340
- var subtable = this.getInstance(subtableId);
1341
- // @ts-ignore
1342
- var headerColumn = subtable.props.headers.find(function(column) {
1343
- return column.children.find(function(item) {
1344
- return item.id === controlId;
1345
- });
1346
- });
1347
- if (headerColumn) {
1348
- var headerInstance1 = headerColumn.children.find(function(item) {
1349
- return item.id === controlId;
1350
- });
1351
- if (headerInstance1) {
1352
- instances.unshift(headerInstance1);
1353
- }
1354
- }
1398
+ var instance = instances[0];
1399
+ if (instance) {
1400
+ var _instance_parent;
1401
+ // @ts-ignore
1402
+ var parentId = (_instance_parent = instance.parent) === null || _instance_parent === void 0 ? void 0 : _instance_parent.id;
1403
+ if (parentId) {
1404
+ instances = this.runtime.instanceMap[parentId] || [];
1355
1405
  }
1356
1406
  }
1357
1407
  }
@@ -1466,28 +1516,57 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1466
1516
  * 如果控件在表头内,则返回-1
1467
1517
  * 如果控件在表内,则返回行下标
1468
1518
  * 如果控件不在明细表内,则返回undefined
1469
- * */ function getInstanceRowIndex(instance) {
1519
+ * */ // public getInstanceRowIndex(
1520
+ // instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl
1521
+ // ) {
1522
+ // if (!instance.parent) {
1523
+ // return
1524
+ // }
1525
+ // let rowIndex: number | undefined
1526
+ // // @ts-ignore
1527
+ // if (this.assertInstance(instance.parent, CONTROL_TYPE.SUBTABLE)) {
1528
+ // // 表头内的控件
1529
+ // // @ts-ignore
1530
+ // if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE_COLUMN)) {
1531
+ // rowIndex = -1
1532
+ // } else {
1533
+ // // @ts-ignore
1534
+ // // const index = instance.parent.children.findIndex(
1535
+ // // (item: any) => item === instance
1536
+ // // )
1537
+ // let instances = this.runtime.instanceMap[instance.id] || []
1538
+ // const index = instances.findIndex((item: any) => item === instance)
1539
+ // if (index > -1) {
1540
+ // rowIndex = index
1541
+ // }
1542
+ // }
1543
+ // } else {
1544
+ // rowIndex = this.getInstanceRowIndex(instance.parent)
1545
+ // }
1546
+ // return rowIndex
1547
+ // }
1548
+ function getInstanceRowIndex(instance) {
1470
1549
  if (!instance.parent) {
1471
1550
  return;
1472
1551
  }
1473
1552
  var rowIndex;
1474
1553
  // @ts-ignore
1475
- if (this.assertInstance(instance.parent, CONTROL_TYPE.SUBTABLE)) {
1476
- // 表头内的控件
1477
- // @ts-ignore
1478
- if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE_COLUMN)) {
1479
- rowIndex = -1;
1480
- } else {
1481
- // @ts-ignore
1482
- var index = instance.parent.children.findIndex(function(item) {
1483
- return item === instance;
1484
- });
1485
- if (index > -1) {
1486
- rowIndex = index;
1554
+ if (this.assertInstance(instance, CONTROL_TYPE.SUBTABLE_COLUMN)) {
1555
+ rowIndex = -1;
1556
+ } else {
1557
+ var isColumnChild = this.getInstanceParentControl(instance, // @ts-ignore
1558
+ CONTROL_TYPE.SUBTABLE_COLUMN);
1559
+ if (isColumnChild) {
1560
+ var instanceList = this.runtime.instanceMap[instance.id];
1561
+ if (Object.prototype.toString.call(instanceList) === "[object Array]") {
1562
+ var index = instanceList.findIndex(function(item) {
1563
+ return item === instance;
1564
+ });
1565
+ if (index > -1) {
1566
+ rowIndex = index;
1567
+ }
1487
1568
  }
1488
1569
  }
1489
- } else {
1490
- rowIndex = this.getInstanceRowIndex(instance.parent);
1491
1570
  }
1492
1571
  return rowIndex;
1493
1572
  }
@@ -1543,7 +1622,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1543
1622
  args[_key] = arguments[_key];
1544
1623
  }
1545
1624
  var _this_runtime;
1546
- return (_this_runtime = this.runtime).registerControlConfig.apply(_this_runtime, _toConsumableArray(args));
1625
+ return (_this_runtime = this.runtime).registerControlConfig.apply(_this_runtime, _to_consumable_array(args));
1547
1626
  }
1548
1627
  },
1549
1628
  {
@@ -1559,7 +1638,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1559
1638
  var mapping = (_this_store_controlIdMapping = this.store.controlIdMapping) !== null && _this_store_controlIdMapping !== void 0 ? _this_store_controlIdMapping : {};
1560
1639
  var listKey = undefined;
1561
1640
  Object.keys(mapping).some(function(key) {
1562
- var _mapping_key, _mapping_key_children;
1641
+ var _mapping_key_children, _mapping_key;
1563
1642
  var matched = (_mapping_key = mapping[key]) === null || _mapping_key === void 0 ? void 0 : (_mapping_key_children = _mapping_key.children) === null || _mapping_key_children === void 0 ? void 0 : _mapping_key_children.hasOwnProperty(controlId);
1564
1643
  if (matched) {
1565
1644
  listKey = key;
@@ -1573,12 +1652,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1573
1652
  {
1574
1653
  key: "register",
1575
1654
  value: // 注册外部控件
1576
- function register() {
1577
- for(var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++){
1578
- arg[_key] = arguments[_key];
1579
- }
1580
- var _Runtime;
1581
- return (_Runtime = Runtime).register.apply(_Runtime, _toConsumableArray(arg));
1655
+ function register(control) {
1656
+ return Runtime.register(control, "Runtime");
1582
1657
  }
1583
1658
  },
1584
1659
  {
@@ -1590,4 +1665,5 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1590
1665
  ]);
1591
1666
  return Engine;
1592
1667
  }(Watcher);
1668
+ // @ts-ignore
1593
1669
  export { Engine };