@byteluck-fe/model-driven-engine 2.6.0-alpha.17b → 2.6.0-alpha.17c

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.
@@ -1466,12 +1466,8 @@ var Engine = // 整体渲染引擎 并且 提供发布订阅能力
1466
1466
  {
1467
1467
  key: "register",
1468
1468
  value: // 注册外部控件
1469
- function register() {
1470
- for(var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++){
1471
- arg[_key] = arguments[_key];
1472
- }
1473
- var _Runtime;
1474
- return (_Runtime = Runtime).register.apply(_Runtime, _toConsumableArray(arg));
1469
+ function register(control) {
1470
+ return Runtime.register(control, 'Runtime');
1475
1471
  }
1476
1472
  },
1477
1473
  {
@@ -96,6 +96,7 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls1) {
96
96
  _this = _super.call(this, 'Runtime');
97
97
  _this._flatInstances = [];
98
98
  _this._instanceMap = {};
99
+ _this._controlParentIdMap = {};
99
100
  var schema = props.schema;
100
101
  _this._schema = schema;
101
102
  _this._instance = _this.createControl(schema, props.beforeCreateInstance);
@@ -108,19 +109,26 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls1) {
108
109
  value: function getFlatInstances() {
109
110
  var instances = [];
110
111
  var instanceMap = {};
111
- loop(this._instance, function(item) {
112
+ var controlParentIdMap = {};
113
+ loop(this._instance, '', function(item, parentId) {
112
114
  // 3.4.1 避免将subtable-row 放到 _flatInstances 中
113
- if (item.type === 'subtable-row' || item.type === 'subtable-column') {
114
- return;
115
- }
115
+ //4.3.0-lh2 将自处注释掉,为使instance.parent能取到父级
116
+ // if (item.type === 'subtable-row' || item.type === 'subtable-column') {
117
+ // return
118
+ // }
116
119
  instances.push(item);
117
120
  if (!instanceMap[item.id]) {
118
121
  instanceMap[item.id] = [];
119
122
  }
120
123
  instanceMap[item.id].push(item);
124
+ if (parentId) {
125
+ // @ts-ignore
126
+ controlParentIdMap[item.id] = parentId;
127
+ }
121
128
  });
122
129
  this._flatInstances = instances;
123
130
  this._instanceMap = instanceMap;
131
+ this._controlParentIdMap = controlParentIdMap;
124
132
  return this._flatInstances;
125
133
  }
126
134
  },
@@ -234,21 +242,21 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls1) {
234
242
  ]);
235
243
  return Runtime;
236
244
  }(RegisterControls);
237
- function loop(control, callback) {
245
+ function loop(control, parentId, callback) {
238
246
  if (Array.isArray(control)) {
239
247
  control.map(function(item) {
240
- callback(item);
248
+ callback(item, parentId);
241
249
  if (hasChildrenControl(item)) {
242
250
  var ctl = item;
243
251
  if (!ctl.children) {
244
252
  ctl.children = [];
245
253
  }
246
254
  // @ts-ignore
247
- loop(ctl.children, callback);
255
+ loop(ctl.children, ctl.id, callback);
248
256
  }
249
257
  });
250
258
  } else {
251
- callback(control);
259
+ callback(control, parentId);
252
260
  }
253
261
  }
254
262
  /**