e-virt-table 1.3.9 → 1.3.10

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
@@ -1072,45 +1072,53 @@ class ye {
1072
1072
  * @param level
1073
1073
  */
1074
1074
  initData(t, e = 0, i = []) {
1075
- const s = t.length;
1076
- t.forEach((o, r) => {
1077
- var p;
1078
- const { ROW_KEY: a = "", DEFAULT_EXPAND_ALL: l, CELL_HEIGHT: c, SELECTABLE_METHOD: d, CHECKBOX_KEY: f } = this.ctx.config, x = o[a], u = x != null ? `${x}` : zt();
1079
- this.itemRowKeyMap.set(o, u);
1080
- const g = o._height || c, m = o._readonly;
1081
- let w = !0;
1082
- if (typeof d == "function" && (w = d), f) {
1083
- const C = o[f];
1084
- if (this.checkboxKeyMap.has(C)) {
1085
- const b = this.checkboxKeyMap.get(C) || [];
1086
- b.push(u), this.checkboxKeyMap.set(C, b);
1075
+ const s = t.length, {
1076
+ ROW_KEY: o = "",
1077
+ DEFAULT_EXPAND_ALL: r,
1078
+ CELL_HEIGHT: a,
1079
+ SELECTABLE_METHOD: l,
1080
+ CHECKBOX_KEY: c,
1081
+ TREE_CHILDREN_KEY: d
1082
+ } = this.ctx.config;
1083
+ t.forEach((f, x) => {
1084
+ var C;
1085
+ d !== "children" && (f.children = f[d]);
1086
+ const u = f[o], g = u != null ? `${u}` : zt();
1087
+ this.itemRowKeyMap.set(f, g);
1088
+ const m = f._height || a, w = f._readonly;
1089
+ let E = !0;
1090
+ if (typeof l == "function" && (E = l), c) {
1091
+ const b = f[c];
1092
+ if (this.checkboxKeyMap.has(b)) {
1093
+ const y = this.checkboxKeyMap.get(b) || [];
1094
+ y.push(g), this.checkboxKeyMap.set(b, y);
1087
1095
  } else
1088
- this.checkboxKeyMap.set(C, [u]);
1096
+ this.checkboxKeyMap.set(b, [g]);
1089
1097
  }
1090
- this.selectionMap.set(u, {
1091
- key: f ? o[f] : u,
1092
- row: o,
1093
- check: ((p = this.selectionMap.get(u)) == null ? void 0 : p.check) || !1
1098
+ this.selectionMap.set(g, {
1099
+ key: c ? f[c] : g,
1100
+ row: f,
1101
+ check: ((C = this.selectionMap.get(g)) == null ? void 0 : C.check) || !1
1094
1102
  });
1095
- const E = l || this.expandMap.get(u) || o._expand || !1;
1096
- this.expandMap.set(u, E), this.rowKeyMap.set(u, {
1097
- readonly: m,
1098
- index: r,
1099
- rowIndex: r,
1103
+ const p = r || this.expandMap.get(g) || f._expand || !1;
1104
+ this.expandMap.set(g, p), this.rowKeyMap.set(g, {
1105
+ readonly: w,
1106
+ index: x,
1107
+ rowIndex: x,
1100
1108
  level: e,
1101
- height: g,
1109
+ height: m,
1102
1110
  calculatedHeight: -1,
1103
1111
  check: !1,
1104
- selectable: w,
1105
- expand: E,
1112
+ selectable: E,
1113
+ expand: p,
1106
1114
  expandLazy: !1,
1107
- hasChildren: o._hasChildren || (Array.isArray(o.children) ? o.children.length > 0 : !1),
1115
+ hasChildren: f._hasChildren || (Array.isArray(f.children) ? f.children.length > 0 : !1),
1108
1116
  expandLoading: !1,
1109
- item: o,
1117
+ item: f,
1110
1118
  parentRowKeys: i,
1111
1119
  parentRowKey: i[i.length - 1] || "",
1112
- isLastChild: r === s - 1
1113
- }), Array.isArray(o.children) && o.children.length && this.initData(o.children, e + 1, [...i, u]);
1120
+ isLastChild: x === s - 1
1121
+ }), Array.isArray(f.children) && f.children.length && this.initData(f.children, e + 1, [...i, g]);
1114
1122
  });
1115
1123
  }
1116
1124
  /**
@@ -2809,6 +2817,8 @@ class Dt {
2809
2817
  n(this, "ENABLE_SELECTOR", !0);
2810
2818
  /** 树形选择模式 */
2811
2819
  n(this, "TREE_SELECT_MODE", "auto");
2820
+ /** 树形子项key名称 */
2821
+ n(this, "TREE_CHILDREN_KEY", "children");
2812
2822
  /** 树形缩进宽度 */
2813
2823
  n(this, "TREE_INDENT", 20);
2814
2824
  /** 树形图标大小 */
@@ -4270,9 +4280,9 @@ class He {
4270
4280
  const f = this.ctx.database.getColumns();
4271
4281
  this.columns = f;
4272
4282
  }
4273
- this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [], this.visibleHeight = this.height, this.visibleColumns = $t(this.columns);
4283
+ this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [], this.visibleColumns = $t(this.columns);
4274
4284
  const s = ot(this.visibleColumns), o = J(this.visibleColumns);
4275
- this.height = e * s, this.width = o.reduce((f, x) => {
4285
+ this.height = e * s, this.visibleHeight = this.height, this.width = o.reduce((f, x) => {
4276
4286
  const u = x.width || 100, { maxWidth: g, minWidth: m } = x;
4277
4287
  return g && u > g ? f + g : m && u < m ? f + m : f + u;
4278
4288
  }, 0), this.columnIndex = 0, this.resizeNum = 0;