e-virt-table 1.2.15 → 1.2.16

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.
package/dist/index.es.js CHANGED
@@ -1429,8 +1429,9 @@ class li {
1429
1429
  const { data: i = [], columns: s = [], footerData: r = [] } = e;
1430
1430
  this.data = i, this.footerData = r, this.columns = s, this.setLoading(!0), this.init();
1431
1431
  }
1432
- init() {
1433
- this.clearBufferData(), this.rowKeyMap.clear(), this.checkboxKeyMap.clear(), this.colIndexKeyMap.clear(), this.rowIndexRowKeyMap.clear(), this.rowKeyRowIndexMap.clear(), this.originalDataMap.clear(), this.changedDataMap.clear(), this.validationErrorMap.clear(), this.itemRowKeyMap = /* @__PURE__ */ new WeakMap(), this.initData(this.data), this.getData(), this.bufferCheckState.buffer = !1;
1432
+ // 初始化默认不忽略清空改变值和校验map
1433
+ init(t = !0) {
1434
+ this.clearBufferData(), this.rowKeyMap.clear(), this.checkboxKeyMap.clear(), this.colIndexKeyMap.clear(), this.rowIndexRowKeyMap.clear(), this.rowKeyRowIndexMap.clear(), t && (this.originalDataMap.clear(), this.changedDataMap.clear(), this.validationErrorMap.clear()), this.itemRowKeyMap = /* @__PURE__ */ new WeakMap(), this.initData(this.data), this.getData(), this.bufferCheckState.buffer = !1;
1434
1435
  }
1435
1436
  /**
1436
1437
  * 清除缓存数据
@@ -1443,17 +1444,15 @@ class li {
1443
1444
  * @param dataList
1444
1445
  * @param level
1445
1446
  */
1446
- initData(t, e = 0) {
1447
- t.forEach((i, s) => {
1447
+ initData(t, e = 0, i = []) {
1448
+ t.forEach((s, r) => {
1448
1449
  var m;
1449
- let r = !1;
1450
- Array.isArray(i.children) && (r = i._hasChildren, i.children.length && (r = !0, this.initData(i.children, e + 1)));
1451
- const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: n, CELL_HEIGHT: h, SELECTABLE_METHOD: c, CHECKBOX_KEY: d } = this.ctx.config, f = i[o], x = f != null ? `${f}` : Jt();
1452
- this.itemRowKeyMap.set(i, x);
1453
- const g = i._height || h, p = i._readonly;
1450
+ const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: n, CELL_HEIGHT: h, SELECTABLE_METHOD: c, CHECKBOX_KEY: d } = this.ctx.config, f = s[o], x = f != null ? `${f}` : Jt();
1451
+ this.itemRowKeyMap.set(s, x);
1452
+ const g = s._height || h, p = s._readonly;
1454
1453
  let u = !0;
1455
1454
  if (typeof c == "function" && (u = c), d) {
1456
- const C = i[d];
1455
+ const C = s[d];
1457
1456
  if (this.checkboxKeyMap.has(C)) {
1458
1457
  const y = this.checkboxKeyMap.get(C) || [];
1459
1458
  y.push(x), this.checkboxKeyMap.set(C, y);
@@ -1461,25 +1460,26 @@ class li {
1461
1460
  this.checkboxKeyMap.set(C, [x]);
1462
1461
  }
1463
1462
  this.selectionMap.set(x, {
1464
- key: d ? i[d] : x,
1465
- row: i,
1463
+ key: d ? s[d] : x,
1464
+ row: s,
1466
1465
  check: ((m = this.selectionMap.get(x)) == null ? void 0 : m.check) || !1
1467
1466
  });
1468
- const w = n || this.expandMap.get(x) || i._expand || !1;
1467
+ const w = n || this.expandMap.get(x) || s._expand || !1;
1469
1468
  this.expandMap.set(x, w), this.rowKeyMap.set(x, {
1470
1469
  readonly: p,
1471
- index: s,
1472
- rowIndex: s,
1470
+ index: r,
1471
+ rowIndex: r,
1473
1472
  level: e,
1474
1473
  height: g,
1475
1474
  check: !1,
1476
1475
  selectable: u,
1477
1476
  expand: w,
1478
1477
  expandLazy: !1,
1479
- hasChildren: r,
1478
+ hasChildren: s._hasChildren || (Array.isArray(s.children) ? s.children.length > 0 : !1),
1480
1479
  expandLoading: !1,
1481
- item: i
1482
- });
1480
+ item: s,
1481
+ parentRowKeys: i
1482
+ }), Array.isArray(s.children) && s.children.length && this.initData(s.children, e + 1, [...i, x]);
1483
1483
  });
1484
1484
  }
1485
1485
  /**
@@ -6479,7 +6479,7 @@ class os {
6479
6479
  });
6480
6480
  }
6481
6481
  loadConfig(t) {
6482
- this.ctx.config.init(t), this.ctx.database.init(), this.header.init(), this.contextMenu.updated(), this.ctx.emit("draw");
6482
+ this.ctx.config.init(t), this.ctx.database.init(!1), this.header.init(), this.contextMenu.updated(), this.ctx.emit("draw");
6483
6483
  }
6484
6484
  loadColumns(t) {
6485
6485
  this.editor.doneEdit(), this.ctx.database.setColumns(t), this.header.init(), this.ctx.emit("draw");
@@ -6503,7 +6503,7 @@ class os {
6503
6503
  this.ctx.off(t, e);
6504
6504
  }
6505
6505
  filterMethod(t) {
6506
- this.scrollTo(0, 0), this.ctx.database.setFilterMethod(t), this.ctx.database.init(), this.header.init(), this.ctx.emit("draw");
6506
+ this.ctx.database.setFilterMethod(t), this.ctx.database.init(!1), this.header.init(), this.ctx.emit("draw");
6507
6507
  }
6508
6508
  editCell(t, e) {
6509
6509
  this.editor.editCell(t, e);
@@ -6576,7 +6576,11 @@ class os {
6576
6576
  if (t && Array.isArray(s) && s.length) {
6577
6577
  const [r] = s;
6578
6578
  if (Array.isArray(r) && r.length) {
6579
- const [o] = r, { rowKey: n, key: h } = o;
6579
+ const [o] = r, { rowKey: n, key: h } = o, c = this.ctx.database.getRowForRowKey(n);
6580
+ if (c) {
6581
+ const { parentRowKeys: d = [] } = c;
6582
+ d && d.length && this.setExpandRowKeys(d, !0);
6583
+ }
6580
6584
  this.scrollToRowkey(n), this.scrollToColkey(h);
6581
6585
  }
6582
6586
  }