@byteluck-fe/model-driven-engine 2.22.0-beta.4 → 2.22.1-beta.0

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.
@@ -549,7 +549,6 @@ var Engine = /*#__PURE__*/ function(Watcher) {
549
549
  createdNewRows = createRows(newRowLengths);
550
550
  createdNewRowsData = args;
551
551
  (_subtable_children = subtable.children)[type].apply(_subtable_children, _to_consumable_array(createdNewRows));
552
- this.runtime.getFlatInstances();
553
552
  break;
554
553
  case "splice":
555
554
  if (args.length > 2) {
@@ -567,7 +566,6 @@ var Engine = /*#__PURE__*/ function(Watcher) {
567
566
  start,
568
567
  replace
569
568
  ].concat(_to_consumable_array(createdNewRows)));
570
- this.runtime.getFlatInstances();
571
569
  // newValues.forEach((item: any, index) => {
572
570
  // let newIndex = start + index
573
571
  // this.setStates(item, newIndex, options)
@@ -583,14 +581,12 @@ var Engine = /*#__PURE__*/ function(Watcher) {
583
581
  isDeleteLastOne = true;
584
582
  }
585
583
  (_subtable_children2 = subtable.children)[type].apply(_subtable_children2, _to_consumable_array(args));
586
- this.runtime.getFlatInstances();
587
584
  }
588
585
  break;
589
586
  default:
590
587
  var // @ts-ignore
591
588
  _subtable_children3;
592
589
  (_subtable_children3 = subtable.children)[type].apply(_subtable_children3, _to_consumable_array(args));
593
- this.runtime.getFlatInstances();
594
590
  break;
595
591
  }
596
592
  if (type === "splice") {
@@ -605,6 +601,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
605
601
  }
606
602
  var subtableData = this.getState(subtable.id);
607
603
  this._handlerSubtableUpdateUid(subtableData);
604
+ this.runtime.getFlatInstances();
608
605
  this.emit("list-change", {
609
606
  instance: subtable,
610
607
  value: subtableData,
@@ -658,7 +655,6 @@ var Engine = /*#__PURE__*/ function(Watcher) {
658
655
  row && newRows.push(row);
659
656
  }
660
657
  (_instance_children = instance.children).push.apply(_instance_children, _to_consumable_array(newRows));
661
- this.runtime.getFlatInstances();
662
658
  // 这里已经能拿到控件实例,所以在这里触发setStates,触发每一行每一个控件的change事件
663
659
  // for (let i = 0; i < newValue.length; i++) {
664
660
  // this.setStates(newValue[i], i, options)
@@ -666,6 +662,8 @@ var Engine = /*#__PURE__*/ function(Watcher) {
666
662
  var deleted = oldValue !== null && oldValue !== void 0 ? oldValue : [];
667
663
  if ((options === null || options === void 0 ? void 0 : options.setData) === true) {
668
664
  deleted = [];
665
+ } else {
666
+ this.runtime.getFlatInstances();
669
667
  }
670
668
  this._handlerSubtableUpdateUid(newValue);
671
669
  this.emit("list-change", {
@@ -1401,6 +1399,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1401
1399
  this.setStates(newState, undefined, _object_spread({
1402
1400
  setData: true
1403
1401
  }, options));
1402
+ this.runtime.getFlatInstances();
1404
1403
  this.debugLog("engine setData方法执行完成。");
1405
1404
  }
1406
1405
  },
@@ -1505,12 +1504,16 @@ var Engine = /*#__PURE__*/ function(Watcher) {
1505
1504
  var instances = Array.from(this.runtime.instanceMap[controlId] || []);
1506
1505
  if (header) {
1507
1506
  // 如果能从flatInstances里边取到,就通过getInstanceInSubtableHeader方法取,取不到则换一种方式
1508
- if (instances.length) {
1509
- var instance = instances[0];
1510
- var headerInstance = this.findSubtableHeadersControl(instance.id);
1511
- if (headerInstance !== undefined) {
1512
- instances.unshift(headerInstance);
1513
- }
1507
+ // if (instances.length) {
1508
+ // const instance: RuntimeControl = instances[0]
1509
+ // const headerInstance = this.findSubtableHeadersControl(instance.id)
1510
+ // if (headerInstance !== undefined) {
1511
+ // instances.unshift(headerInstance)
1512
+ // }
1513
+ // }
1514
+ var headerInstance = this.findSubtableHeadersControl(controlId);
1515
+ if (headerInstance !== undefined) {
1516
+ instances.unshift(headerInstance);
1514
1517
  }
1515
1518
  }
1516
1519
  // @ts-ignore
@@ -126,6 +126,7 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls) {
126
126
  var instanceMap = {};
127
127
  var controlParentIdMap = {};
128
128
  loop(this._instance, "", function(item, parentId) {
129
+ var _item_parent;
129
130
  // 3.4.1 避免将subtable-row 放到 _flatInstances 中
130
131
  //4.3.0-lh2 将自处注释掉,为使instance.parent能取到父级
131
132
  // if (item.type === 'subtable-row' || item.type === 'subtable-column') {
@@ -145,6 +146,9 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls) {
145
146
  }
146
147
  }
147
148
  instances.push(item);
149
+ if (((_item_parent = item.parent) === null || _item_parent === void 0 ? void 0 : _item_parent.type) === CONTROL_TYPE.SUBTABLE_COLUMN && item.parent.parent === undefined) {
150
+ return;
151
+ }
148
152
  instanceMap[item.id].push(item);
149
153
  });
150
154
  this._flatInstances = instances;
@@ -293,9 +297,9 @@ function loop(control, parentId, callback) {
293
297
  if (hasHeaderOrFooterControl(item, "headers")) {
294
298
  loop(item.props.headers, item.id, callback);
295
299
  }
296
- if (hasHeaderOrFooterControl(item, "footers")) {
297
- loop(item.props.footers, item.id, callback);
298
- }
300
+ // if (hasHeaderOrFooterControl(item, 'footers')) {
301
+ // loop((item.props as any).footers, item.id, callback)
302
+ // }
299
303
  });
300
304
  }
301
305
  function hasHeaderOrFooterControl(control, checkType) {
@@ -39,10 +39,13 @@ function _define_property(obj, key, value) {
39
39
  export var StylePlugin = /*#__PURE__*/ function() {
40
40
  "use strict";
41
41
  function StylePlugin(config) {
42
+ var isPC = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
42
43
  _class_call_check(this, StylePlugin);
43
44
  _define_property(this, "config", void 0);
44
45
  _define_property(this, "engine", void 0);
46
+ _define_property(this, "isPc", void 0);
45
47
  this.config = config;
48
+ this.isPc = isPC;
46
49
  }
47
50
  _create_class(StylePlugin, [
48
51
  {
@@ -55,8 +58,11 @@ export var StylePlugin = /*#__PURE__*/ function() {
55
58
  var style = document.createElement("style");
56
59
  style.className = "edit-css-" + engine.id;
57
60
  style.type = "text/css";
58
- // style.innerHTML = compiledStyle
59
- style.innerHTML = "[data-engine-id='".concat(engine.id, "']{ ").concat(compiledStyle, " }");
61
+ if (this.isPc) {
62
+ style.innerHTML = "[data-engine-id='".concat(engine.id, "']{ ").concat(compiledStyle, " }");
63
+ } else {
64
+ style.innerHTML = compiledStyle;
65
+ }
60
66
  var dom = document.querySelector("head");
61
67
  dom.appendChild(style);
62
68
  }
@@ -6,7 +6,8 @@ export function loopFormControl(control, callback) {
6
6
  if (Array.isArray(control)) {
7
7
  control.map(function(item) {
8
8
  //TODO 此处需要再抽象一层 datagrid/datalist
9
- if (item.type === CONTROL_TYPE.SUBTABLE) {
9
+ // if (item.type === CONTROL_TYPE.SUBTABLE) {
10
+ if (item.controlType === CONTROL_BASE_TYPE.LIST) {
10
11
  // @ts-ignore
11
12
  var children = []//item.getChildrenFormControl() as RuntimeFormControl[]
12
13
  ;