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

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.
@@ -84,7 +84,7 @@ function _createSuper(Derived) {
84
84
  };
85
85
  }
86
86
  import { RegisterControls } from '@byteluck-fe/model-driven-core';
87
- import { CONTROL_BASE_TYPE, CONTROL_TYPE, JSONCopy, loopFormSchema } from '@byteluck-fe/model-driven-shared';
87
+ import { CONTROL_BASE_TYPE, CONTROL_TYPE, JSONCopy, loopFormSchema, isArray } from '@byteluck-fe/model-driven-shared';
88
88
  import { hasChildrenControl, loopDataViewControl, loopFormControl } from '../utils/runtimeUtils';
89
89
  export var Runtime = /*#__PURE__*/ function(RegisterControls1) {
90
90
  "use strict";
@@ -243,21 +243,29 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls1) {
243
243
  return Runtime;
244
244
  }(RegisterControls);
245
245
  function loop(control, parentId, callback) {
246
- if (Array.isArray(control)) {
247
- control.map(function(item) {
248
- callback(item, parentId);
249
- if (hasChildrenControl(item)) {
250
- var ctl = item;
251
- if (!ctl.children) {
252
- ctl.children = [];
253
- }
254
- // @ts-ignore
255
- loop(ctl.children, ctl.id, callback);
246
+ var _instances = Array.isArray(control) ? control : [
247
+ control
248
+ ];
249
+ _instances.map(function(item) {
250
+ callback(item, parentId);
251
+ if (hasChildrenControl(item)) {
252
+ var ctl = item;
253
+ if (!ctl.children) {
254
+ ctl.children = [];
256
255
  }
257
- });
258
- } else {
259
- callback(control, parentId);
260
- }
256
+ // @ts-ignore
257
+ loop(ctl.children, ctl.id, callback);
258
+ }
259
+ if (hasHeaderOrFooterControl(item, 'headers')) {
260
+ loop(item.props.headers, item.id, callback);
261
+ }
262
+ if (hasHeaderOrFooterControl(item, 'footers')) {
263
+ loop(item.props.footers, item.id, callback);
264
+ }
265
+ });
266
+ }
267
+ function hasHeaderOrFooterControl(control, checkType) {
268
+ return checkType in control.props && isArray(control.props[checkType]);
261
269
  }
262
270
  /**
263
271
  * 控件是否在视图中隐藏,遍历查找所有parent