e-virt-table 1.3.22 → 1.3.24

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
@@ -411,7 +411,9 @@ class vt extends qt {
411
411
  n(this, "overflowTooltipMaxWidth", 500);
412
412
  n(this, "overflowTooltipPlacement", "top");
413
413
  n(this, "maxLineClamp", "auto");
414
- this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = h.key, this.type = h.type || "", this.editorType = h.editorType || "text", this.selectorCellValueType = h.selectorCellValueType || this.ctx.config.SELECTOR_CELL_VALUE_TYPE || "value", this.editorProps = h.editorProps || {}, this.cellType = f, this.align = h.align || this.ctx.config.COLUMNS_ALIGN, this.verticalAlign = h.verticalAlign || this.ctx.config.COLUMNS_VERTICAL_ALIGN, this.fixed = h.fixed || "", this.level = h.level || 0, this.operation = h.operation || !1, this.column = h, this.rules = h.rules || [], this.row = d, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = h.render, this.overflowTooltipShow = h.overflowTooltipShow !== !1, this.autoRowHeight = h.autoRowHeight !== void 0 ? h.autoRowHeight : this.ctx.config.AUTO_ROW_HEIGHT, this.overflowTooltipMaxWidth = h.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = h.overflowTooltipPlacement || "top", this.renderFooter = h.renderFooter, this.hoverIconName = h.hoverIconName, this.formatter = h.formatter, this.formatterFooter = h.formatterFooter, this.maxLineClamp = h.maxLineClamp || "auto", u && this.update();
414
+ n(this, "renderType", "default");
415
+ n(this, "renderFooterType", "default");
416
+ this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = h.key, this.type = h.type || "", this.editorType = h.editorType || "text", this.selectorCellValueType = h.selectorCellValueType || this.ctx.config.SELECTOR_CELL_VALUE_TYPE || "value", this.editorProps = h.editorProps || {}, this.cellType = f, this.align = h.align || this.ctx.config.COLUMNS_ALIGN, this.verticalAlign = h.verticalAlign || this.ctx.config.COLUMNS_VERTICAL_ALIGN, this.fixed = h.fixed || "", this.level = h.level || 0, this.operation = h.operation || !1, this.column = h, this.rules = h.rules || [], this.row = d, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = h.render, this.overflowTooltipShow = h.overflowTooltipShow !== !1, this.autoRowHeight = h.autoRowHeight !== void 0 ? h.autoRowHeight : this.ctx.config.AUTO_ROW_HEIGHT, this.overflowTooltipMaxWidth = h.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = h.overflowTooltipPlacement || "top", this.renderFooter = h.renderFooter, this.hoverIconName = h.hoverIconName, this.formatter = h.formatter, this.formatterFooter = h.formatterFooter, this.maxLineClamp = h.maxLineClamp || "auto", this.renderType = h.renderType || "default", this.renderFooterType = h.renderFooterType || "default", u && this.update();
415
417
  }
416
418
  setWidthHeight(e, i) {
417
419
  this.width = e, this.height = i;
@@ -533,16 +535,16 @@ class vt extends qt {
533
535
  this.rowExpand = h, this.rowHasChildren = d;
534
536
  const { TREE_INDENT: x = 16, CHECKBOX_SIZE: g, TREE_ICON_SIZE: m } = this.ctx.config;
535
537
  if (r = u * x, f) {
536
- const R = this.ctx.icons.get("loading");
537
- a = "loading", o = R;
538
+ const I = this.ctx.icons.get("loading");
539
+ a = "loading", o = I;
538
540
  } else if (d) {
539
- const R = this.ctx.icons.get("expand"), S = this.ctx.icons.get("shrink");
540
- o = h ? S : R, a = h ? "shrink" : "expand";
541
+ const I = this.ctx.icons.get("expand"), _ = this.ctx.icons.get("shrink");
542
+ o = h ? _ : I, a = h ? "shrink" : "expand";
541
543
  }
542
544
  let w = m, E = m, p = this.drawX;
543
545
  (this.align === "center" || this.align === "right") && (p = this.drawX + (this.visibleWidth - w - 2 * e) / 2, this.align = "left");
544
- let y = p + r + e, b = this.drawY + (this.visibleHeight - E) / 2, C = r + this.drawX + w - 0.5;
545
- this.type === "selection-tree" ? (y = r + this.drawSelectionImageX + this.drawSelectionImageWidth, C = y + w - e / 2) : this.type === "tree-selection" ? C = y + g + w - e / 2 : C = y + w - e / 2, this.drawTextX = C, this.drawTextWidth = this.drawX + this.visibleWidth - C, !(y + w + e > this.drawX + this.visibleWidth) && (b + E + e > this.drawY + this.visibleHeight || (this.drawTreeImageX = y, this.drawTreeImageY = b, this.drawTreeImageWidth = w, this.drawTreeImageHeight = E, o ? (this.drawTreeImageName = a, this.drawTreeImageSource = o) : (this.drawTreeImageName = "", this.drawTreeImageSource = void 0)));
546
+ let C = p + r + e, b = this.drawY + (this.visibleHeight - E) / 2, y = r + this.drawX + w - 0.5;
547
+ this.type === "selection-tree" ? (C = r + this.drawSelectionImageX + this.drawSelectionImageWidth, y = C + w - e / 2) : this.type === "tree-selection" ? y = C + g + w - e / 2 : y = C + w - e / 2, this.drawTextX = y, this.drawTextWidth = this.drawX + this.visibleWidth - y, !(C + w + e > this.drawX + this.visibleWidth) && (b + E + e > this.drawY + this.visibleHeight || (this.drawTreeImageX = C, this.drawTreeImageY = b, this.drawTreeImageWidth = w, this.drawTreeImageHeight = E, o ? (this.drawTreeImageName = a, this.drawTreeImageSource = o) : (this.drawTreeImageName = "", this.drawTreeImageSource = void 0)));
546
548
  }
547
549
  drawTreeLine() {
548
550
  const { TREE_LINE: e, TREE_INDENT: i = 16, TREE_ICON_SIZE: s = 16, TREE_LINE_COLOR: o = "#e1e6eb" } = this.ctx.config;
@@ -606,31 +608,31 @@ class vt extends qt {
606
608
  FINDER_CELL_BG_COLOR: w
607
609
  } = this.ctx.config;
608
610
  if (this.cellType === "footer") {
609
- let _ = h, T = l;
611
+ let S = h, T = l;
610
612
  if (typeof o == "function") {
611
- const M = o, { backgroundColor: L, color: A, font: H } = M({
613
+ const M = o, { backgroundColor: O, color: A, font: H } = M({
612
614
  row: this.row,
613
615
  rowIndex: this.rowIndex,
614
616
  colIndex: this.colIndex,
615
617
  column: this.column,
616
618
  value: this.getValue()
617
619
  }) || {};
618
- L && (_ = L), A && (T = A), H && (this.drawTextFont = H);
620
+ O && (S = O), A && (T = A), H && (this.drawTextFont = H);
619
621
  }
620
- this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = _, this.drawTextColor = T;
622
+ this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = S, this.drawTextColor = T;
621
623
  return;
622
624
  }
623
625
  let E = "transparent";
624
- const p = this.ctx.hoverCell, y = this.ctx.currentCell;
625
- let b = this.rowIndex, C = this.rowIndex;
626
+ const p = this.ctx.hoverCell, C = this.ctx.currentCell;
627
+ let b = this.rowIndex, y = this.rowIndex;
626
628
  if (this.rowspan !== 1 && (u || d)) {
627
- const _ = this.getSpanInfo(), { yArr: T } = _;
628
- b = T[0], C = T[1];
629
+ const S = this.getSpanInfo(), { yArr: T } = S;
630
+ b = T[0], y = T[1];
629
631
  }
630
- u && p && (p.rowKey === this.rowKey && (E = x), p.rowIndex >= b && p.rowIndex <= C && (E = x)), d && y && (y.rowKey === this.rowKey && (E = f), y.rowIndex >= b && y.rowIndex <= C && (E = f)), this.drawCellSkyBgColor = E;
631
- let R = e, S = a;
632
- if (this.ctx.database.getReadonly(this.rowKey, this.key) || (R = i, S = r), g && (this.rowIndex % 2 ? R = m : R = e), typeof s == "function") {
633
- const _ = s, { backgroundColor: T, color: M, font: L } = _({
632
+ u && p && (p.rowKey === this.rowKey && (E = x), p.rowIndex >= b && p.rowIndex <= y && (E = x)), d && C && (C.rowKey === this.rowKey && (E = f), C.rowIndex >= b && C.rowIndex <= y && (E = f)), this.drawCellSkyBgColor = E;
633
+ let I = e, _ = a;
634
+ if (this.ctx.database.getReadonly(this.rowKey, this.key) || (I = i, _ = r), g && (this.rowIndex % 2 ? I = m : I = e), typeof s == "function") {
635
+ const S = s, { backgroundColor: T, color: M, font: O } = S({
634
636
  row: this.row,
635
637
  rowIndex: this.rowIndex,
636
638
  colIndex: this.colIndex,
@@ -638,10 +640,10 @@ class vt extends qt {
638
640
  isHasChanged: this.isHasChanged,
639
641
  value: this.getValue()
640
642
  }) || {};
641
- T && (R = T), M && (S = M), L && (this.drawTextFont = L);
643
+ T && (I = T), M && (_ = M), O && (this.drawTextFont = O);
642
644
  }
643
- const { rowIndex: O, colIndex: v, type: I } = this.ctx.finderBar;
644
- O === this.rowIndex && v === this.colIndex && I === "body" && (R = w), this.drawCellBgColor = R, this.drawTextColor = S;
645
+ const { rowIndex: L, colIndex: R, type: v } = this.ctx.finderBar;
646
+ L === this.rowIndex && R === this.colIndex && v === "body" && (I = w), this.drawCellBgColor = I, this.drawTextColor = _;
645
647
  }
646
648
  updateSelection() {
647
649
  const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: a, rowIndex: l, rowKey: h } = this;
@@ -653,8 +655,8 @@ class vt extends qt {
653
655
  let g = x, m = this.drawY + (i - f) / 2;
654
656
  if (a !== "selection-tree") {
655
657
  if (a === "tree-selection") {
656
- const { TREE_INDENT: p = 16, TREE_ICON_SIZE: y } = this.ctx.config, b = this.ctx.database.getRowForRowKey(h), { level: C = 0 } = b || {}, R = C * p;
657
- g = x + y + R;
658
+ const { TREE_INDENT: p = 16, TREE_ICON_SIZE: C } = this.ctx.config, b = this.ctx.database.getRowForRowKey(h), { level: y = 0 } = b || {}, I = y * p;
659
+ g = x + C + I;
658
660
  }
659
661
  }
660
662
  let w = this.ctx.icons.get("checkbox-uncheck"), E = "checkbox-uncheck";
@@ -730,7 +732,7 @@ class vt extends qt {
730
732
  * @returns
731
733
  */
732
734
  getDisplayText() {
733
- return this.cellType === "footer" ? this.renderFooter || this.text === null || this.text === void 0 ? "" : this.text : this.rowspan === 0 || this.colspan === 0 || this.render || this.type === "index-selection" && (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === this.rowIndex || ["checkbox-disabled", "checkbox-check"].includes(this.drawSelectionImageName)) || this.text === null || this.text === void 0 ? "" : `${this.text}`;
735
+ return this.cellType === "footer" ? this.renderFooter && this.renderFooterType === "default" || this.text === null || this.text === void 0 ? "" : this.text : this.rowspan === 0 || this.colspan === 0 || this.render && this.renderType === "default" || this.type === "index-selection" && (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === this.rowIndex || ["checkbox-disabled", "checkbox-check"].includes(this.drawSelectionImageName)) || this.text === null || this.text === void 0 ? "" : `${this.text}`;
734
736
  }
735
737
  /**
736
738
  * 获取文本
@@ -791,7 +793,7 @@ class vt extends qt {
791
793
  left: `${Math.round(e - 1)}px`,
792
794
  top: `${Math.round(i - 1)}px`,
793
795
  width: `${this.visibleWidth}px`,
794
- height: this.autoRowHeight ? "auto" : `${this.visibleHeight}px`,
796
+ height: this.autoRowHeight && this.renderType === "default" ? "auto" : `${this.visibleHeight}px`,
795
797
  // height: `${this.visibleHeight}px`,
796
798
  // minHeight: `${this.visibleHeight}px`,
797
799
  pointerEvents: "initial",
@@ -973,10 +975,10 @@ class vt extends qt {
973
975
  drawBorder(e) {
974
976
  const { drawX: i, drawY: s, rowIndex: o, colIndex: r, height: a, width: l } = this;
975
977
  let h = i, d = s;
976
- const { xArr: f, yArr: u, lineDash: x = [], borderWidth: g = 1, borderColor: m, fillColor: w } = e, E = f[0], p = f[1], y = u[0], b = u[1];
977
- if (r >= E && r <= p && o === y) {
978
- const C = r === p ? 1 : 0, R = r === E ? 1 : 0;
979
- this.ctx.paint.drawLine([h + R, d + 1, h + l - C, d + 1], {
978
+ const { xArr: f, yArr: u, lineDash: x = [], borderWidth: g = 1, borderColor: m, fillColor: w } = e, E = f[0], p = f[1], C = u[0], b = u[1];
979
+ if (r >= E && r <= p && o === C) {
980
+ const y = r === p ? 1 : 0, I = r === E ? 1 : 0;
981
+ this.ctx.paint.drawLine([h + I, d + 1, h + l - y, d + 1], {
980
982
  borderColor: m,
981
983
  fillColor: w,
982
984
  borderWidth: g,
@@ -985,9 +987,9 @@ class vt extends qt {
985
987
  lineDash: x
986
988
  });
987
989
  }
988
- if (r === p && o >= y && o <= b) {
989
- const C = o === y ? 1 : 0, R = o === b ? 1 : 0;
990
- this.ctx.paint.drawLine([h + l - 1, d + C, h + l - 1, d + a - R], {
990
+ if (r === p && o >= C && o <= b) {
991
+ const y = o === C ? 1 : 0, I = o === b ? 1 : 0;
992
+ this.ctx.paint.drawLine([h + l - 1, d + y, h + l - 1, d + a - I], {
991
993
  borderColor: m,
992
994
  fillColor: w,
993
995
  borderWidth: g,
@@ -997,8 +999,8 @@ class vt extends qt {
997
999
  });
998
1000
  }
999
1001
  if (r >= E && r <= p && o === b) {
1000
- const C = r === p ? 1 : 0, R = r === E ? 1 : 0;
1001
- this.ctx.paint.drawLine([h + R, d + a - 1, h + l - C, d + a - 1], {
1002
+ const y = r === p ? 1 : 0, I = r === E ? 1 : 0;
1003
+ this.ctx.paint.drawLine([h + I, d + a - 1, h + l - y, d + a - 1], {
1002
1004
  borderColor: m,
1003
1005
  fillColor: w,
1004
1006
  borderWidth: g,
@@ -1007,9 +1009,9 @@ class vt extends qt {
1007
1009
  lineDash: x
1008
1010
  });
1009
1011
  }
1010
- if (r === E && o >= y && o <= b) {
1011
- const C = o === b ? 1 : 0, R = o === y ? 1 : 0;
1012
- this.ctx.paint.drawLine([h + 1, d + R, h + 1, d + a - C], {
1012
+ if (r === E && o >= C && o <= b) {
1013
+ const y = o === b ? 1 : 0, I = o === C ? 1 : 0;
1014
+ this.ctx.paint.drawLine([h + 1, d + I, h + 1, d + a - y], {
1013
1015
  borderColor: m,
1014
1016
  fillColor: w,
1015
1017
  borderWidth: g,
@@ -1095,7 +1097,7 @@ class be {
1095
1097
  TREE_CHILDREN_KEY: d
1096
1098
  } = this.ctx.config;
1097
1099
  t.forEach((f, u) => {
1098
- var y;
1100
+ var C;
1099
1101
  d !== "children" && (f.children = f[d]);
1100
1102
  const x = f[o], g = x != null ? `${x}` : $t();
1101
1103
  this.itemRowKeyMap.set(f, g);
@@ -1104,15 +1106,15 @@ class be {
1104
1106
  if (typeof l == "function" && (E = l), h) {
1105
1107
  const b = f[h];
1106
1108
  if (this.checkboxKeyMap.has(b)) {
1107
- const C = this.checkboxKeyMap.get(b) || [];
1108
- C.push(g), this.checkboxKeyMap.set(b, C);
1109
+ const y = this.checkboxKeyMap.get(b) || [];
1110
+ y.push(g), this.checkboxKeyMap.set(b, y);
1109
1111
  } else
1110
1112
  this.checkboxKeyMap.set(b, [g]);
1111
1113
  }
1112
1114
  this.selectionMap.set(g, {
1113
1115
  key: h ? f[h] : g,
1114
1116
  row: f,
1115
- check: ((y = this.selectionMap.get(g)) == null ? void 0 : y.check) || !1
1117
+ check: ((C = this.selectionMap.get(g)) == null ? void 0 : C.check) || !1
1116
1118
  });
1117
1119
  const p = r || this.expandMap.get(g) || f._expand || !1;
1118
1120
  this.expandMap.set(g, p), this.rowKeyMap.set(g, {
@@ -1435,17 +1437,17 @@ class be {
1435
1437
  let l = [], h = t.map((g) => {
1436
1438
  const { rowKey: m, key: w } = g;
1437
1439
  let E = g.value, p = E;
1438
- const y = this.getRowDataItemForRowKey(m), b = this.getItemValue(m, w), C = this.getVirtualBodyCellByKey(m, w);
1439
- return (C == null ? void 0 : C.type) === "number" && (["", void 0, null].includes(E) ? p = null : /^-?\d+(\.\d+)?$/.test(`${E}`) ? p = Number(E) : (p = b, l.push({
1440
+ const C = this.getRowDataItemForRowKey(m), b = this.getItemValue(m, w), y = this.getVirtualBodyCellByKey(m, w);
1441
+ return (y == null ? void 0 : y.type) === "number" && (["", void 0, null].includes(E) ? p = null : /^-?\d+(\.\d+)?$/.test(`${E}`) ? p = Number(E) : (p = b, l.push({
1440
1442
  ...g,
1441
1443
  value: p,
1442
1444
  oldValue: b,
1443
- row: y
1445
+ row: C
1444
1446
  }))), {
1445
1447
  ...g,
1446
1448
  value: p,
1447
1449
  oldValue: b,
1448
- row: y
1450
+ row: C
1449
1451
  };
1450
1452
  });
1451
1453
  if (h = h.filter((g) => !l.some((m) => g.rowKey === m.rowKey && g.key === m.key)), l.length) {
@@ -1689,8 +1691,8 @@ class be {
1689
1691
  const h = (w) => {
1690
1692
  const E = this.getTreeChildren(w);
1691
1693
  let p = [];
1692
- for (const y of E)
1693
- p.push(y), p.push(...h(y));
1694
+ for (const C of E)
1695
+ p.push(C), p.push(...h(C));
1694
1696
  return p;
1695
1697
  }, f = h(t).map((w) => this.selectionMap.get(w)), u = f.filter((w) => w == null ? void 0 : w.check).length, x = f.length, g = u > 0;
1696
1698
  r = g && !(u === x), a = s || g, s && x > 0 && u === 0 && (a = !1, r = !1);
@@ -1698,8 +1700,8 @@ class be {
1698
1700
  const h = (w) => {
1699
1701
  const E = this.getTreeChildren(w);
1700
1702
  let p = [];
1701
- for (const y of E)
1702
- p.push(y), p.push(...h(y));
1703
+ for (const C of E)
1704
+ p.push(C), p.push(...h(C));
1703
1705
  return p;
1704
1706
  }, f = h(t).map((w) => this.selectionMap.get(w)), u = f.filter((w) => w == null ? void 0 : w.check).length, x = f.length, g = u > 0, m = u === x;
1705
1707
  r = g && !m, a = s || m, s && x > 0 && u === 0 && (a = !1, r = !1);
@@ -2013,98 +2015,98 @@ class be {
2013
2015
  }
2014
2016
  ]
2015
2017
  };
2016
- let w = e, E = e, p = a, y = a, b = [], C = 0, R = 0, S = 0, O = 0;
2018
+ let w = e, E = e, p = a, C = a, b = [], y = 0, I = 0, _ = 0, L = 0;
2017
2019
  if (d !== 1 && g) {
2018
- O = u;
2019
- const v = l.reduce((I, _) => {
2020
- const T = this.getItemValue(s, _) ?? "";
2021
- return `${I}${T}`;
2020
+ L = u;
2021
+ const R = l.reduce((v, S) => {
2022
+ const T = this.getItemValue(s, S) ?? "";
2023
+ return `${v}${T}`;
2022
2024
  }, "");
2023
- for (let I = e - 1; I >= 0; I--) {
2024
- const _ = this.rowIndexRowKeyMap.get(I) || "", T = l.reduce((M, L) => {
2025
- const A = this.getItemValue(_, L) ?? "";
2025
+ for (let v = e - 1; v >= 0; v--) {
2026
+ const S = this.rowIndexRowKeyMap.get(v) || "", T = l.reduce((M, O) => {
2027
+ const A = this.getItemValue(S, O) ?? "";
2026
2028
  return `${M}${A}`;
2027
2029
  }, "");
2028
- if (v === T)
2029
- w = I;
2030
+ if (R === T)
2031
+ w = v;
2030
2032
  else
2031
2033
  break;
2032
2034
  }
2033
- for (let I = e; I <= this.ctx.maxRowIndex; I++) {
2034
- const _ = this.rowIndexRowKeyMap.get(I) || "", T = l.reduce((M, L) => {
2035
- const A = this.getItemValue(_, L) ?? "";
2035
+ for (let v = e; v <= this.ctx.maxRowIndex; v++) {
2036
+ const S = this.rowIndexRowKeyMap.get(v) || "", T = l.reduce((M, O) => {
2037
+ const A = this.getItemValue(S, O) ?? "";
2036
2038
  return `${M}${A}`;
2037
2039
  }, "");
2038
- if (v === T)
2039
- E = I;
2040
+ if (R === T)
2041
+ E = v;
2040
2042
  else
2041
2043
  break;
2042
2044
  }
2043
- for (let I = w; I < e; I++) {
2044
- const { height: _ } = this.positions[I];
2045
- C += _;
2045
+ for (let v = w; v < e; v++) {
2046
+ const { height: S } = this.positions[v];
2047
+ y += S;
2046
2048
  }
2047
- for (let I = w; I <= E; I++) {
2048
- const { height: _ } = this.positions[I];
2049
- S += _;
2050
- const T = this.rowIndexRowKeyMap.get(I) || "", { item: M } = this.rowKeyMap.get(T), L = this.getItemValue(T, i);
2049
+ for (let v = w; v <= E; v++) {
2050
+ const { height: S } = this.positions[v];
2051
+ _ += S;
2052
+ const T = this.rowIndexRowKeyMap.get(v) || "", { item: M } = this.rowKeyMap.get(T), O = this.getItemValue(T, i);
2051
2053
  b.push({
2052
2054
  rowKey: T,
2053
2055
  key: i,
2054
- value: L,
2056
+ value: O,
2055
2057
  row: M
2056
2058
  });
2057
2059
  }
2058
2060
  }
2059
2061
  if (x !== 1 && m) {
2060
- S = f;
2061
- for (let v = a - 1; v >= 0; v--) {
2062
- const I = this.getColumnByColIndex(v);
2063
- if (!I)
2062
+ _ = f;
2063
+ for (let R = a - 1; R >= 0; R--) {
2064
+ const v = this.getColumnByColIndex(R);
2065
+ if (!v)
2064
2066
  break;
2065
- const _ = this.getItemValue(s, i), T = this.getItemValue(s, I.key);
2066
- if (_ === T && h.includes(I.key))
2067
- p = v;
2067
+ const S = this.getItemValue(s, i), T = this.getItemValue(s, v.key);
2068
+ if (S === T && h.includes(v.key))
2069
+ p = R;
2068
2070
  else
2069
2071
  break;
2070
2072
  }
2071
- for (let v = a; v <= this.ctx.maxColIndex; v++) {
2072
- const I = this.getColumnByColIndex(v);
2073
- if (!I)
2073
+ for (let R = a; R <= this.ctx.maxColIndex; R++) {
2074
+ const v = this.getColumnByColIndex(R);
2075
+ if (!v)
2074
2076
  break;
2075
- const _ = this.getItemValue(s, i), T = this.getItemValue(s, I.key);
2076
- if (_ === T && h.includes(I.key))
2077
- y = v;
2077
+ const S = this.getItemValue(s, i), T = this.getItemValue(s, v.key);
2078
+ if (S === T && h.includes(v.key))
2079
+ C = R;
2078
2080
  else
2079
2081
  break;
2080
2082
  }
2081
- for (let v = p; v < a; v++) {
2082
- const I = this.getColumnByColIndex(v);
2083
- if (!I)
2083
+ for (let R = p; R < a; R++) {
2084
+ const v = this.getColumnByColIndex(R);
2085
+ if (!v)
2084
2086
  break;
2085
- R += I.width || 100;
2087
+ I += v.width || 100;
2086
2088
  }
2087
- for (let v = p; v <= y; v++) {
2088
- const I = this.getColumnByColIndex(v);
2089
- if (!I)
2089
+ for (let R = p; R <= C; R++) {
2090
+ const v = this.getColumnByColIndex(R);
2091
+ if (!v)
2090
2092
  break;
2091
- O += I.width || 100, b.push({
2093
+ L += v.width || 100, b.push({
2092
2094
  rowKey: s,
2093
- key: I.key,
2094
- value: this.getItemValue(s, I.key),
2095
+ key: v.key,
2096
+ value: this.getItemValue(s, v.key),
2095
2097
  row: o
2096
2098
  });
2097
2099
  }
2098
2100
  }
2099
2101
  return {
2100
- xArr: [p, y],
2102
+ xArr: [p, C],
2101
2103
  yArr: [w, E],
2102
2104
  rowspan: d,
2103
2105
  colspan: x,
2104
- height: S,
2105
- width: O,
2106
- offsetTop: C,
2107
- offsetLeft: R,
2106
+ height: _,
2107
+ width: L,
2108
+ offsetTop: y,
2109
+ offsetLeft: I,
2108
2110
  dataList: b
2109
2111
  };
2110
2112
  }
@@ -2524,7 +2526,7 @@ class _e {
2524
2526
  * @returns 是否溢出
2525
2527
  */
2526
2528
  drawText(t = "", e, i, s, o, r = {}) {
2527
- var I;
2529
+ var v;
2528
2530
  this.ctx.save();
2529
2531
  const {
2530
2532
  font: a = "12px Arial",
@@ -2539,42 +2541,42 @@ class _e {
2539
2541
  } = r;
2540
2542
  if (this.ctx.font = a, this.ctx.fillStyle = h, this.ctx.textAlign = l, ["", null, void 0].includes(t))
2541
2543
  return this.ctx.restore(), !1;
2542
- const E = parseInt(((I = a.match(/\d+/)) == null ? void 0 : I[0]) || "12") * (r.lineHeight || 1.2), p = s - d * 2 - g - m;
2543
- let y = !1;
2544
+ const E = parseInt(((v = a.match(/\d+/)) == null ? void 0 : v[0]) || "12") * (r.lineHeight || 1.2), p = s - d * 2 - g - m;
2545
+ let C = !1;
2544
2546
  const b = Math.round((o - 2 * d) / E);
2545
- let C = this.wrapText(t, p, r.cacheTextKey), R = Math.min(C.length, Math.max(b, 1));
2546
- u === "auto" && x ? R = C.length : typeof u == "number" && u < R && u !== 1 ? R = u : (u === 1 && (C = [t], R = 1), u === "auto" && b === 1 && (C = [t], R = 1));
2547
- let S = i + d;
2548
- const O = Math.round(R * E);
2549
- f === "middle" ? S = i + (o - O) / 2 : f === "bottom" && (S = i + o - O - d);
2550
- let v = e + d + g;
2551
- l === "center" ? v = e + s / 2 : l === "right" && (v = e + s - d - m);
2552
- for (let _ = 0; _ < C.length; _++) {
2553
- const T = C[_], M = S + _ * E;
2554
- if (this.ctx.textBaseline = "top", _ === R - 1) {
2555
- const A = C.slice(_).join(""), { _text: H, ellipsis: D } = this.handleEllipsis(A, s, d, a);
2556
- this.ctx.fillText(H, v, M), y = D;
2547
+ let y = this.wrapText(t, p, r.cacheTextKey), I = Math.min(y.length, Math.max(b, 1));
2548
+ u === "auto" && x ? I = y.length : typeof u == "number" && u < I && u !== 1 ? I = u : (u === 1 && (y = [t], I = 1), u === "auto" && b === 1 && (y = [t], I = 1));
2549
+ let _ = i + d;
2550
+ const L = Math.round(I * E);
2551
+ f === "middle" ? _ = i + (o - L) / 2 : f === "bottom" && (_ = i + o - L - d);
2552
+ let R = e + d + g;
2553
+ l === "center" ? R = e + s / 2 : l === "right" && (R = e + s - d - m);
2554
+ for (let S = 0; S < y.length; S++) {
2555
+ const T = y[S], M = _ + S * E;
2556
+ if (this.ctx.textBaseline = "top", S === I - 1) {
2557
+ const A = y.slice(S).join(""), { _text: H, ellipsis: D } = this.handleEllipsis(A, s, d, a);
2558
+ this.ctx.fillText(H, R, M), C = D;
2557
2559
  break;
2558
2560
  }
2559
- this.ctx.fillText(T, v, M);
2561
+ this.ctx.fillText(T, R, M);
2560
2562
  }
2561
- if (r.textCallback && C.length) {
2562
- const _ = C.reduce((H, D) => Math.max(H, this.ctx.measureText(D).width), 0), T = Math.round(_);
2563
- let M = v, L = v + T;
2564
- l === "center" ? (M = v - T / 2, L = v + T / 2) : l === "right" && (M = v - T, L = v);
2563
+ if (r.textCallback && y.length) {
2564
+ const S = y.reduce((H, D) => Math.max(H, this.ctx.measureText(D).width), 0), T = Math.round(S);
2565
+ let M = R, O = R + T;
2566
+ l === "center" ? (M = R - T / 2, O = R + T / 2) : l === "right" && (M = R - T, O = R);
2565
2567
  const A = {
2566
- x: v,
2567
- y: S,
2568
+ x: R,
2569
+ y: _,
2568
2570
  width: T,
2569
- height: O,
2571
+ height: L,
2570
2572
  left: M,
2571
- right: L,
2572
- top: S,
2573
- bottom: S + O
2573
+ right: O,
2574
+ top: _,
2575
+ bottom: _ + L
2574
2576
  };
2575
2577
  r.textCallback(A);
2576
2578
  }
2577
- return this.ctx.restore(), y;
2579
+ return this.ctx.restore(), C;
2578
2580
  }
2579
2581
  /**
2580
2582
  * 将文本按宽度换行
@@ -3000,6 +3002,10 @@ class Nt {
3000
3002
  n(this, "BEFORE_SET_SELECTOR_METHOD");
3001
3003
  /** 设置填充器前回调 */
3002
3004
  n(this, "BEFORE_SET_AUTOFILL_METHOD");
3005
+ /** 自定义表头右键菜单 */
3006
+ n(this, "BEFORE_HEADER_CONTEXT_MENU_METHOD");
3007
+ /** 自定义BODY右键菜单 */
3008
+ n(this, "BEFORE_BODY_CONTEXT_MENU_METHOD");
3003
3009
  /** 数据复制前回调 */
3004
3010
  n(this, "BEFORE_COPY_METHOD");
3005
3011
  this._config = t, this.updateCssVar();
@@ -3235,7 +3241,8 @@ class mt extends qt {
3235
3241
  n(this, "drawSortImageHeight", 0);
3236
3242
  n(this, "drawSortImageName", "");
3237
3243
  n(this, "drawSortImageSource");
3238
- this.ctx = e, this.x = s, this.y = o, this.width = r, this.height = a, this.visibleWidth = r, this.visibleHeight = a, this.colIndex = i, this.key = l.key, this.minWidth = l.minWidth, this.maxWidth = l.maxWidth, this.hide = (typeof l.hide == "function" ? l.hide(l) : l.hide) || !1, this.type = l.type || "", this.editorType = l.editorType || "text", this.hideHeaderSelection = l.hideHeaderSelection || !1, this.align = l.headerAlign || l.align || this.ctx.config.COLUMNS_ALIGN, this.verticalAlign = l.headerVerticalAlign || l.verticalAlign || this.ctx.config.COLUMNS_VERTICAL_ALIGN, this.fixed = l.fixed || "", this.level = l.level || 0, this.operation = l.operation || !1, this.text = l.title, this.column = l, this.colspan = l.colspan || 1, this.widthFillDisable = l.widthFillDisable || !1, this.rowspan = l.rowspan || 1, this.rules = l.rules, this.readonly = l.readonly || !1, this.required = l.required || !1, this.sortIconName = l.sortIconName || "sort-default", this.sortAscIconName = l.sortAscIconName || "sort-asc", this.sortDescIconName = l.sortDescIconName || "sort-desc", this.rowKey = $t(), this.overflowTooltipShow = l.overflowTooltipHeaderShow !== !1, this.hasChildren = l.children && l.children.length > 0 || !1, this.render = l.renderHeader, this.maxLineClampHeader = l.maxLineClampHeader || "auto";
3244
+ n(this, "renderHeaderType", "default");
3245
+ this.ctx = e, this.x = s, this.y = o, this.width = r, this.height = a, this.visibleWidth = r, this.visibleHeight = a, this.colIndex = i, this.key = l.key, this.minWidth = l.minWidth, this.maxWidth = l.maxWidth, this.hide = (typeof l.hide == "function" ? l.hide(l) : l.hide) || !1, this.type = l.type || "", this.editorType = l.editorType || "text", this.hideHeaderSelection = l.hideHeaderSelection || !1, this.align = l.headerAlign || l.align || this.ctx.config.COLUMNS_ALIGN, this.verticalAlign = l.headerVerticalAlign || l.verticalAlign || this.ctx.config.COLUMNS_VERTICAL_ALIGN, this.fixed = l.fixed || "", this.level = l.level || 0, this.operation = l.operation || !1, this.text = l.title, this.column = l, this.colspan = l.colspan || 1, this.widthFillDisable = l.widthFillDisable || !1, this.rowspan = l.rowspan || 1, this.rules = l.rules, this.readonly = l.readonly || !1, this.required = l.required || !1, this.sortIconName = l.sortIconName || "sort-default", this.sortAscIconName = l.sortAscIconName || "sort-asc", this.sortDescIconName = l.sortDescIconName || "sort-desc", this.rowKey = $t(), this.overflowTooltipShow = l.overflowTooltipHeaderShow !== !1, this.hasChildren = l.children && l.children.length > 0 || !1, this.render = l.renderHeader, this.maxLineClampHeader = l.maxLineClampHeader || "auto", this.renderHeaderType = l.renderHeaderType || "default";
3239
3246
  }
3240
3247
  /**
3241
3248
  * 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
@@ -3362,7 +3369,7 @@ class mt extends qt {
3362
3369
  ));
3363
3370
  }
3364
3371
  getText() {
3365
- return this.render || ["", null, void 0].includes(this.text) ? "" : `${this.text}`;
3372
+ return this.render && this.renderHeaderType === "default" || ["", null, void 0].includes(this.text) ? "" : `${this.text}`;
3366
3373
  }
3367
3374
  /**
3368
3375
  * 获取样式
@@ -4724,28 +4731,28 @@ class Ne {
4724
4731
  let w = this.height + e.height + r;
4725
4732
  w += m;
4726
4733
  let E = w;
4727
- const p = window.innerHeight, { top: y } = this.containerRect || this.ctx.containerElement.getBoundingClientRect();
4728
- if (p > y && d && !a) {
4729
- const T = p - y - f;
4734
+ const p = window.innerHeight, { top: C } = this.containerRect || this.ctx.containerElement.getBoundingClientRect();
4735
+ if (p > C && d && !a) {
4736
+ const T = p - C - f;
4730
4737
  T > e.height + r ? E = T : w > h && (E = h);
4731
4738
  } else this.data.length && a ? E = a : this.data.length && h && w > h && (E = h);
4732
4739
  E > 0 && (this.ctx.stageHeight = Math.floor(E), this.ctx.stageElement.style.height = `${this.ctx.stageHeight}px`);
4733
4740
  let b = this.ctx.stageHeight - e.height - r;
4734
4741
  o ? this.visibleHeight = b - m : this.visibleHeight = b, this.data.length || (this.height = this.visibleHeight), this.ctx.body.x = this.x, this.ctx.body.y = this.y, this.ctx.body.width = this.width, this.ctx.body.height = this.height, this.ctx.body.visibleWidth = this.visibleWidth, this.ctx.body.visibleHeight = this.visibleHeight, this.ctx.body.data = x;
4735
- const C = window.devicePixelRatio || 1, R = this.ctx.stageWidth * C, S = this.ctx.stageHeight * C;
4736
- t.width = Math.round(R), t.height = Math.round(S);
4737
- const O = this.data.length ? "not-empty" : "empty";
4742
+ const y = window.devicePixelRatio || 1, I = this.ctx.stageWidth * y, _ = this.ctx.stageHeight * y;
4743
+ t.width = Math.round(I), t.height = Math.round(_);
4744
+ const L = this.data.length ? "not-empty" : "empty";
4738
4745
  this.ctx.emit("emptyChange", {
4739
- isEmpty: O,
4740
- type: O,
4746
+ isEmpty: L,
4747
+ type: L,
4741
4748
  headerHeight: e.height,
4742
4749
  bodyHeight: this.height,
4743
4750
  footerHeight: m,
4744
4751
  width: this.width,
4745
4752
  height: this.data.length ? 0 : l + m
4746
4753
  });
4747
- const v = Math.round(t.width / C * 1e4) / 1e4, I = Math.round(t.height / C * 1e4) / 1e4;
4748
- this.ctx.canvasElement.setAttribute("style", `height:${I}px;width:${v}px;`), this.ctx.paint.scale(C);
4754
+ const R = Math.round(t.width / y * 1e4) / 1e4, v = Math.round(t.height / y * 1e4) / 1e4;
4755
+ this.ctx.canvasElement.setAttribute("style", `height:${v}px;width:${R}px;`), this.ctx.paint.scale(y);
4749
4756
  }
4750
4757
  // 调整行的高度
4751
4758
  initResizeRow() {
@@ -4993,8 +5000,8 @@ class Be {
4993
5000
  }), this.ctx.on(
4994
5001
  "mousemove",
4995
5002
  bt((t) => {
4996
- var e, i;
4997
- (e = this.ctx.focusCell) != null && e.fixed || (i = this.ctx.focusCellHeader) != null && i.fixed || !this.ctx.dragHeaderIng && this.ctx.selectorMove && this.ctx.startAdjustPosition(t);
5003
+ var e;
5004
+ (e = this.ctx.focusCellHeader) != null && e.fixed || !this.ctx.dragHeaderIng && this.ctx.selectorMove && this.ctx.startAdjustPosition(t);
4998
5005
  }, 100)
4999
5006
  ), this.ctx.on("cellHoverChange", (t) => {
5000
5007
  if (!this.ctx.autofillMove) {
@@ -5101,26 +5108,26 @@ class Be {
5101
5108
  SELECTOR_AREA_MAX_X_OFFSET: f,
5102
5109
  SELECTOR_AREA_MAX_Y_OFFSET: u
5103
5110
  } = this.ctx.config, x = a, g = l || this.ctx.maxColIndex - f, m = h, w = d || this.ctx.maxRowIndex - u;
5104
- let [E, p] = o, [y, b] = r;
5105
- if (E < x || p > g || y < m || b > w)
5111
+ let [E, p] = o, [C, b] = r;
5112
+ if (E < x || p > g || C < m || b > w)
5106
5113
  return;
5107
5114
  if (this.ctx.config.ENABLE_MERGE_CELL_LINK) {
5108
- const R = this.adjustMergeCells(o, r);
5109
- y = R.yArr[0], b = R.yArr[1], E = R.xArr[0], p = R.xArr[1], this.ctx.onlyMergeCell = R.onlyMergeCell;
5115
+ const I = this.adjustMergeCells(o, r);
5116
+ C = I.yArr[0], b = I.yArr[1], E = I.xArr[0], p = I.xArr[1], this.ctx.onlyMergeCell = I.onlyMergeCell;
5110
5117
  }
5111
- E === p && y === b ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, o = [Math.max(x, E), Math.min(g, p)], r = [Math.max(m, y), Math.min(w, b)];
5112
- const { BEFORE_SET_SELECTOR_METHOD: C } = this.ctx.config;
5113
- if (typeof C == "function") {
5114
- const S = C({
5118
+ E === p && C === b ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, o = [Math.max(x, E), Math.min(g, p)], r = [Math.max(m, C), Math.min(w, b)];
5119
+ const { BEFORE_SET_SELECTOR_METHOD: y } = this.ctx.config;
5120
+ if (typeof y == "function") {
5121
+ const _ = y({
5115
5122
  focusCell: this.ctx.focusCell,
5116
5123
  xArr: o,
5117
5124
  yArr: r
5118
5125
  });
5119
- if (!S)
5126
+ if (!_)
5120
5127
  return;
5121
- o = S.xArr, r = S.yArr;
5128
+ o = _.xArr, r = _.yArr;
5122
5129
  }
5123
- this.ctx.selector.xArr = o, this.ctx.selector.yArr = r, b === this.ctx.maxRowIndex && y === 0 ? this.ctx.selectColsIng = !0 : this.ctx.selectColsIng = !1, p === this.ctx.maxColIndex && E === 0 ? this.ctx.selectRowsIng = !0 : this.ctx.selectRowsIng = !1, this.ctx.emit("setSelector", this.ctx.selector), this.ctx.emit("drawView");
5130
+ this.ctx.selector.xArr = o, this.ctx.selector.yArr = r, b === this.ctx.maxRowIndex && C === 0 ? this.ctx.selectColsIng = !0 : this.ctx.selectColsIng = !1, p === this.ctx.maxColIndex && E === 0 ? this.ctx.selectRowsIng = !0 : this.ctx.selectRowsIng = !1, this.ctx.emit("setSelector", this.ctx.selector), this.ctx.emit("drawView");
5124
5131
  }
5125
5132
  }
5126
5133
  adjustMergeCells(t, e) {
@@ -5135,13 +5142,13 @@ class Be {
5135
5142
  let a = [], l = [];
5136
5143
  for (let m = 0; m <= e[1] - e[0]; m++)
5137
5144
  for (let w = 0; w <= t[1] - t[0]; w++) {
5138
- const E = m + e[0], p = w + t[0], y = this.ctx.database.getVirtualBodyCell(E, p);
5139
- y && ((E === i || E === s) && a.push(y), (p === o || p === r) && l.push(y));
5145
+ const E = m + e[0], p = w + t[0], C = this.ctx.database.getVirtualBodyCell(E, p);
5146
+ C && ((E === i || E === s) && a.push(C), (p === o || p === r) && l.push(C));
5140
5147
  }
5141
5148
  const h = a.reduce(
5142
5149
  (m, w) => {
5143
- const { yArr: E } = w.getSpanInfo(), [p, y] = E;
5144
- return m.minY = Math.min(m.minY, p), m.maxY = Math.max(m.maxY, y), m;
5150
+ const { yArr: E } = w.getSpanInfo(), [p, C] = E;
5151
+ return m.minY = Math.min(m.minY, p), m.maxY = Math.max(m.maxY, C), m;
5145
5152
  },
5146
5153
  {
5147
5154
  minY: i,
@@ -5149,8 +5156,8 @@ class Be {
5149
5156
  }
5150
5157
  ), d = l.reduce(
5151
5158
  (m, w) => {
5152
- const { xArr: E } = w.getSpanInfo(), [p, y] = E;
5153
- return m.minX = Math.min(m.minX, p), m.maxX = Math.max(m.maxX, y), m;
5159
+ const { xArr: E } = w.getSpanInfo(), [p, C] = E;
5160
+ return m.minX = Math.min(m.minX, p), m.maxX = Math.max(m.maxX, C), m;
5154
5161
  },
5155
5162
  {
5156
5163
  minX: o,
@@ -5345,27 +5352,27 @@ class Be {
5345
5352
  });
5346
5353
  const m = r.length === 1 && r[0].length === 1;
5347
5354
  if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a, l) && !m) {
5348
- const y = {
5355
+ const C = {
5349
5356
  code: "ERR_MERGED_CELLS_PASTE",
5350
5357
  message: "Merged cells cannot span paste data"
5351
5358
  };
5352
- this.ctx.hasEvent("error") ? this.ctx.emit("error", y) : alert(y.message);
5359
+ this.ctx.hasEvent("error") ? this.ctx.emit("error", C) : alert(C.message);
5353
5360
  return;
5354
5361
  }
5355
5362
  let w = [];
5356
- for (let y = 0; y <= r.length - 1; y++) {
5357
- const b = r[y].length;
5358
- for (let C = 0; C <= b - 1; C++) {
5359
- const R = y + e, S = C + i, O = r[y][C], v = this.ctx.database.getItemValueForRowIndexAndColIndex(
5360
- R,
5361
- S
5363
+ for (let C = 0; C <= r.length - 1; C++) {
5364
+ const b = r[C].length;
5365
+ for (let y = 0; y <= b - 1; y++) {
5366
+ const I = C + e, _ = y + i, L = r[C][y], R = this.ctx.database.getItemValueForRowIndexAndColIndex(
5367
+ I,
5368
+ _
5362
5369
  );
5363
- if (v) {
5364
- const { rowKey: I, key: _ } = v;
5365
- this.ctx.database.getReadonly(I, _) || (s.add(I), w.push({
5366
- rowKey: I,
5367
- key: _,
5368
- value: O,
5370
+ if (R) {
5371
+ const { rowKey: v, key: S } = R;
5372
+ this.ctx.database.getReadonly(v, S) || (s.add(v), w.push({
5373
+ rowKey: v,
5374
+ key: S,
5375
+ value: L,
5369
5376
  row: {}
5370
5377
  //内部有设置
5371
5378
  }));
@@ -5373,34 +5380,34 @@ class Be {
5373
5380
  }
5374
5381
  }
5375
5382
  if (this.isCut) {
5376
- const y = this.clearSelectedData(
5383
+ const C = this.clearSelectedData(
5377
5384
  this.ctx.selector.xArrCopy,
5378
5385
  this.ctx.selector.yArrCopy,
5379
5386
  !0
5380
5387
  // 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
5381
- ), b = w.map((C) => `${C.rowKey}-${C.key}`);
5382
- y.forEach((C) => {
5383
- b.includes(`${C.rowKey}-${C.key}`) || w.unshift(C);
5388
+ ), b = w.map((y) => `${y.rowKey}-${y.key}`);
5389
+ C.forEach((y) => {
5390
+ b.includes(`${y.rowKey}-${y.key}`) || w.unshift(y);
5384
5391
  }), this.isCut = !1;
5385
5392
  }
5386
5393
  if (!w.length)
5387
5394
  return;
5388
5395
  const { BEFORE_PASTE_DATA_METHOD: E } = this.ctx.config;
5389
5396
  if (typeof E == "function") {
5390
- const y = E, b = w.map((C) => ({
5391
- rowKey: C.rowKey,
5392
- key: C.key,
5393
- value: C.value,
5394
- oldValue: this.ctx.database.getItemValue(C.rowKey, C.key),
5395
- row: this.ctx.database.getRowDataItemForRowKey(C.rowKey)
5397
+ const C = E, b = w.map((y) => ({
5398
+ rowKey: y.rowKey,
5399
+ key: y.key,
5400
+ value: y.value,
5401
+ oldValue: this.ctx.database.getItemValue(y.rowKey, y.key),
5402
+ row: this.ctx.database.getRowDataItemForRowKey(y.rowKey)
5396
5403
  }));
5397
- if (w = await y(b, a, l, r), w && !w.length)
5404
+ if (w = await C(b, a, l, r), w && !w.length)
5398
5405
  return;
5399
5406
  }
5400
5407
  this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(w, !0);
5401
5408
  let p = [];
5402
- s.forEach((y) => {
5403
- p.push(this.ctx.database.getRowDataItemForRowKey(y));
5409
+ s.forEach((C) => {
5410
+ p.push(this.ctx.database.getRowDataItemForRowKey(C));
5404
5411
  }), this.ctx.emit("pasteChange", w, p), this.ctx.emit("draw");
5405
5412
  }).catch((o) => {
5406
5413
  console.error("Failed to get the clipboard content:", o);
@@ -5467,14 +5474,14 @@ class Be {
5467
5474
  if (!i)
5468
5475
  return;
5469
5476
  g && this.ctx.onlyMergeCell && i.updateSpanInfo();
5470
- const { drawX: m, drawY: w, width: E, height: p, fixed: y } = i, b = o - m + 1, C = i.drawX + E - (e - s) + 1;
5471
- let R = r.height - w, S = p;
5472
- S > l.visibleHeight && (S = l.visibleHeight);
5473
- let O = 0;
5474
- u && (x === "top" ? R = r.height + a.height - w : O = a.visibleHeight);
5475
- const v = w + S - (t - O - f);
5476
- let I = h, _ = d;
5477
- C > 0 && !y ? I = Math.floor(h + C) : b > 0 && !y && (I = Math.floor(h - b)), R > 0 ? _ = Math.floor(d - R) : v > 0 && (_ = Math.floor(d + v)), (Math.abs(h - I) > 2.5 || Math.abs(d - _) > 2.5) && this.ctx.setScroll(I, _);
5477
+ const { drawX: m, drawY: w, width: E, height: p, fixed: C } = i, b = o - m + 1, y = i.drawX + E - (e - s) + 1;
5478
+ let I = r.height - w, _ = p;
5479
+ _ > l.visibleHeight && (_ = l.visibleHeight);
5480
+ let L = 0;
5481
+ u && (x === "top" ? I = r.height + a.height - w : L = a.visibleHeight);
5482
+ const R = w + _ - (t - L - f);
5483
+ let v = h, S = d;
5484
+ y > 0 && !C ? v = Math.floor(h + y) : b > 0 && !C && (v = Math.floor(h - b)), I > 0 ? S = Math.floor(d - I) : R > 0 && (S = Math.floor(d + R)), (Math.abs(h - v) > 2.5 || Math.abs(d - S) > 2.5) && this.ctx.setScroll(v, S);
5478
5485
  }
5479
5486
  destroy() {
5480
5487
  }
@@ -5532,21 +5539,21 @@ class Xe {
5532
5539
  SELECTOR_AREA_MAX_Y: x,
5533
5540
  SELECTOR_AREA_MAX_X_OFFSET: g,
5534
5541
  SELECTOR_AREA_MAX_Y_OFFSET: m
5535
- } = this.ctx.config, w = d, E = f || this.ctx.maxColIndex - g, p = u, y = x || this.ctx.maxRowIndex - m;
5536
- let [b, C] = r, [R, S] = a;
5537
- if (b < w || R < p)
5542
+ } = this.ctx.config, w = d, E = f || this.ctx.maxColIndex - g, p = u, C = x || this.ctx.maxRowIndex - m;
5543
+ let [b, y] = r, [I, _] = a;
5544
+ if (b < w || I < p)
5538
5545
  return;
5539
- r = [Math.max(w, b), Math.min(E, C)], a = [Math.max(p, R), Math.min(y, S)];
5540
- const { BEFORE_SET_AUTOFILL_METHOD: O } = this.ctx.config;
5541
- if (typeof O == "function") {
5542
- const I = O({
5546
+ r = [Math.max(w, b), Math.min(E, y)], a = [Math.max(p, I), Math.min(C, _)];
5547
+ const { BEFORE_SET_AUTOFILL_METHOD: L } = this.ctx.config;
5548
+ if (typeof L == "function") {
5549
+ const v = L({
5543
5550
  focusCell: this.ctx.focusCell,
5544
5551
  xArr: r,
5545
5552
  yArr: a
5546
5553
  });
5547
- if (!I)
5554
+ if (!v)
5548
5555
  return;
5549
- r = I.xArr, a = I.yArr;
5556
+ r = v.xArr, a = v.yArr;
5550
5557
  }
5551
5558
  this.ctx.autofill.xArr = r, this.ctx.autofill.yArr = a, this.ctx.emit("setAutofill", this.ctx.autofill), this.ctx.emit("draw");
5552
5559
  }
@@ -5573,12 +5580,12 @@ class Xe {
5573
5580
  let d = [];
5574
5581
  for (let x = 0; x <= l[1] - l[0]; x++)
5575
5582
  for (let g = 0; g <= a[1] - a[0]; g++) {
5576
- const m = g + a[0], w = x + l[0], E = s[x % r][g % o], p = this.ctx.database.getItemValueForRowIndexAndColIndex(w, m), y = `${w}-${m}`;
5577
- if (p && !i.has(y)) {
5578
- const { rowKey: b, key: C } = p;
5579
- this.ctx.database.getReadonly(b, C) || (t.add(b), d.push({
5583
+ const m = g + a[0], w = x + l[0], E = s[x % r][g % o], p = this.ctx.database.getItemValueForRowIndexAndColIndex(w, m), C = `${w}-${m}`;
5584
+ if (p && !i.has(C)) {
5585
+ const { rowKey: b, key: y } = p;
5586
+ this.ctx.database.getReadonly(b, y) || (t.add(b), d.push({
5580
5587
  rowKey: b,
5581
- key: C,
5588
+ key: y,
5582
5589
  value: E,
5583
5590
  row: {}
5584
5591
  }));
@@ -5792,9 +5799,9 @@ const je = async (c, t, e) => {
5792
5799
  fn: E
5793
5800
  } = a[m], {
5794
5801
  x: p,
5795
- y,
5802
+ y: C,
5796
5803
  data: b,
5797
- reset: C
5804
+ reset: y
5798
5805
  } = await E({
5799
5806
  x: d,
5800
5807
  y: f,
@@ -5809,17 +5816,17 @@ const je = async (c, t, e) => {
5809
5816
  floating: t
5810
5817
  }
5811
5818
  });
5812
- d = p ?? d, f = y ?? f, x = {
5819
+ d = p ?? d, f = C ?? f, x = {
5813
5820
  ...x,
5814
5821
  [w]: {
5815
5822
  ...x[w],
5816
5823
  ...b
5817
5824
  }
5818
- }, C && g <= 50 && (g++, typeof C == "object" && (C.placement && (u = C.placement), C.rects && (h = C.rects === !0 ? await r.getElementRects({
5825
+ }, y && g <= 50 && (g++, typeof y == "object" && (y.placement && (u = y.placement), y.rects && (h = y.rects === !0 ? await r.getElementRects({
5819
5826
  reference: c,
5820
5827
  floating: t,
5821
5828
  strategy: s
5822
- }) : C.rects), {
5829
+ }) : y.rects), {
5823
5830
  x: d,
5824
5831
  y: f
5825
5832
  } = Ft(h, u, l)), m = -1);
@@ -5858,23 +5865,23 @@ async function ee(c, t) {
5858
5865
  y: s,
5859
5866
  width: r.floating.width,
5860
5867
  height: r.floating.height
5861
- } : r.reference, y = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(a.floating)), b = await (o.isElement == null ? void 0 : o.isElement(y)) ? await (o.getScale == null ? void 0 : o.getScale(y)) || {
5868
+ } : r.reference, C = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(a.floating)), b = await (o.isElement == null ? void 0 : o.isElement(C)) ? await (o.getScale == null ? void 0 : o.getScale(C)) || {
5862
5869
  x: 1,
5863
5870
  y: 1
5864
5871
  } : {
5865
5872
  x: 1,
5866
5873
  y: 1
5867
- }, C = ht(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
5874
+ }, y = ht(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
5868
5875
  elements: a,
5869
5876
  rect: p,
5870
- offsetParent: y,
5877
+ offsetParent: C,
5871
5878
  strategy: l
5872
5879
  }) : p);
5873
5880
  return {
5874
- top: (E.top - C.top + g.top) / b.y,
5875
- bottom: (C.bottom - E.bottom + g.bottom) / b.y,
5876
- left: (E.left - C.left + g.left) / b.x,
5877
- right: (C.right - E.right + g.right) / b.x
5881
+ top: (E.top - y.top + g.top) / b.y,
5882
+ bottom: (y.bottom - E.bottom + g.bottom) / b.y,
5883
+ left: (E.left - y.left + g.left) / b.x,
5884
+ right: (y.right - E.right + g.right) / b.x
5878
5885
  };
5879
5886
  }
5880
5887
  const qe = (c) => ({
@@ -5898,15 +5905,15 @@ const qe = (c) => ({
5898
5905
  const f = te(d), u = {
5899
5906
  x: e,
5900
5907
  y: i
5901
- }, x = _t(s), g = Rt(x), m = await r.getDimensions(h), w = x === "y", E = w ? "top" : "left", p = w ? "bottom" : "right", y = w ? "clientHeight" : "clientWidth", b = o.reference[g] + o.reference[x] - u[x] - o.floating[g], C = u[x] - o.reference[x], R = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(h));
5902
- let S = R ? R[y] : 0;
5903
- (!S || !await (r.isElement == null ? void 0 : r.isElement(R))) && (S = a.floating[y] || o.floating[g]);
5904
- const O = b / 2 - C / 2, v = S / 2 - m[g] / 2 - 1, I = j(f[E], v), _ = j(f[p], v), T = I, M = S - m[g] - _, L = S / 2 - m[g] / 2 + O, A = Et(T, L, M), H = !l.arrow && et(s) != null && L !== A && o.reference[g] / 2 - (L < T ? I : _) - m[g] / 2 < 0, D = H ? L < T ? L - T : L - M : 0;
5908
+ }, x = _t(s), g = Rt(x), m = await r.getDimensions(h), w = x === "y", E = w ? "top" : "left", p = w ? "bottom" : "right", C = w ? "clientHeight" : "clientWidth", b = o.reference[g] + o.reference[x] - u[x] - o.floating[g], y = u[x] - o.reference[x], I = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(h));
5909
+ let _ = I ? I[C] : 0;
5910
+ (!_ || !await (r.isElement == null ? void 0 : r.isElement(I))) && (_ = a.floating[C] || o.floating[g]);
5911
+ const L = b / 2 - y / 2, R = _ / 2 - m[g] / 2 - 1, v = j(f[E], R), S = j(f[p], R), T = v, M = _ - m[g] - S, O = _ / 2 - m[g] / 2 + L, A = Et(T, O, M), H = !l.arrow && et(s) != null && O !== A && o.reference[g] / 2 - (O < T ? v : S) - m[g] / 2 < 0, D = H ? O < T ? O - T : O - M : 0;
5905
5912
  return {
5906
5913
  [x]: u[x] + D,
5907
5914
  data: {
5908
5915
  [x]: A,
5909
- centerOffset: L - A - D,
5916
+ centerOffset: O - A - D,
5910
5917
  ...H && {
5911
5918
  alignmentOffset: D
5912
5919
  }
@@ -5938,39 +5945,39 @@ const qe = (c) => ({
5938
5945
  } = tt(c, t);
5939
5946
  if ((e = o.arrow) != null && e.alignmentOffset)
5940
5947
  return {};
5941
- const E = $(s), p = V(a), y = $(a) === a, b = await (l.isRTL == null ? void 0 : l.isRTL(h.floating)), C = u || (y || !m ? [lt(a)] : Ve(a)), R = g !== "none";
5942
- !u && R && C.push(...Ge(a, m, g, b));
5943
- const S = [a, ...C], O = await ee(t, w), v = [];
5944
- let I = ((i = o.flip) == null ? void 0 : i.overflows) || [];
5945
- if (d && v.push(O[E]), f) {
5946
- const L = We(s, r, b);
5947
- v.push(O[L[0]], O[L[1]]);
5948
+ const E = $(s), p = V(a), C = $(a) === a, b = await (l.isRTL == null ? void 0 : l.isRTL(h.floating)), y = u || (C || !m ? [lt(a)] : Ve(a)), I = g !== "none";
5949
+ !u && I && y.push(...Ge(a, m, g, b));
5950
+ const _ = [a, ...y], L = await ee(t, w), R = [];
5951
+ let v = ((i = o.flip) == null ? void 0 : i.overflows) || [];
5952
+ if (d && R.push(L[E]), f) {
5953
+ const O = We(s, r, b);
5954
+ R.push(L[O[0]], L[O[1]]);
5948
5955
  }
5949
- if (I = [...I, {
5956
+ if (v = [...v, {
5950
5957
  placement: s,
5951
- overflows: v
5952
- }], !v.every((L) => L <= 0)) {
5953
- var _, T;
5954
- const L = (((_ = o.flip) == null ? void 0 : _.index) || 0) + 1, A = S[L];
5958
+ overflows: R
5959
+ }], !R.every((O) => O <= 0)) {
5960
+ var S, T;
5961
+ const O = (((S = o.flip) == null ? void 0 : S.index) || 0) + 1, A = _[O];
5955
5962
  if (A && (!(f === "alignment" ? p !== V(A) : !1) || // We leave the current main axis only if every placement on that axis
5956
5963
  // overflows the main axis.
5957
- I.every((k) => V(k.placement) === p ? k.overflows[0] > 0 : !0)))
5964
+ v.every((k) => V(k.placement) === p ? k.overflows[0] > 0 : !0)))
5958
5965
  return {
5959
5966
  data: {
5960
- index: L,
5961
- overflows: I
5967
+ index: O,
5968
+ overflows: v
5962
5969
  },
5963
5970
  reset: {
5964
5971
  placement: A
5965
5972
  }
5966
5973
  };
5967
- let H = (T = I.filter((D) => D.overflows[0] <= 0).sort((D, k) => D.overflows[1] - k.overflows[1])[0]) == null ? void 0 : T.placement;
5974
+ let H = (T = v.filter((D) => D.overflows[0] <= 0).sort((D, k) => D.overflows[1] - k.overflows[1])[0]) == null ? void 0 : T.placement;
5968
5975
  if (!H)
5969
5976
  switch (x) {
5970
5977
  case "bestFit": {
5971
5978
  var M;
5972
- const D = (M = I.filter((k) => {
5973
- if (R) {
5979
+ const D = (M = v.filter((k) => {
5980
+ if (I) {
5974
5981
  const W = V(k.placement);
5975
5982
  return W === p || // Create a bias to the `y` side axis due to horizontal
5976
5983
  // reading directions favoring greater width.
@@ -6076,12 +6083,12 @@ const ti = function(c) {
6076
6083
  }, d = await ee(t, l), f = V($(s)), u = Qt(f);
6077
6084
  let x = h[u], g = h[f];
6078
6085
  if (o) {
6079
- const w = u === "y" ? "top" : "left", E = u === "y" ? "bottom" : "right", p = x + d[w], y = x - d[E];
6080
- x = Et(p, x, y);
6086
+ const w = u === "y" ? "top" : "left", E = u === "y" ? "bottom" : "right", p = x + d[w], C = x - d[E];
6087
+ x = Et(p, x, C);
6081
6088
  }
6082
6089
  if (r) {
6083
- const w = f === "y" ? "top" : "left", E = f === "y" ? "bottom" : "right", p = g + d[w], y = g - d[E];
6084
- g = Et(p, g, y);
6090
+ const w = f === "y" ? "top" : "left", E = f === "y" ? "bottom" : "right", p = g + d[w], C = g - d[E];
6091
+ g = Et(p, g, C);
6085
6092
  }
6086
6093
  const m = a.fn({
6087
6094
  ...t,
@@ -6266,8 +6273,8 @@ function G(c, t, e, i) {
6266
6273
  const u = N(o), x = i && B(i) ? N(i) : i;
6267
6274
  let g = u, m = yt(g);
6268
6275
  for (; m && i && x !== g; ) {
6269
- const w = U(m), E = m.getBoundingClientRect(), p = X(m), y = E.left + (m.clientLeft + parseFloat(p.paddingLeft)) * w.x, b = E.top + (m.clientTop + parseFloat(p.paddingTop)) * w.y;
6270
- l *= w.x, h *= w.y, d *= w.x, f *= w.y, l += y, h += b, g = N(m), m = yt(g);
6276
+ const w = U(m), E = m.getBoundingClientRect(), p = X(m), C = E.left + (m.clientLeft + parseFloat(p.paddingLeft)) * w.x, b = E.top + (m.clientTop + parseFloat(p.paddingTop)) * w.y;
6277
+ l *= w.x, h *= w.y, d *= w.x, f *= w.y, l += C, h += b, g = N(m), m = yt(g);
6271
6278
  }
6272
6279
  }
6273
6280
  return ht({
@@ -6522,30 +6529,30 @@ function _i(c, t) {
6522
6529
  } = h;
6523
6530
  if (a || t(), !u || !x)
6524
6531
  return;
6525
- const g = st(f), m = st(s.clientWidth - (d + u)), w = st(s.clientHeight - (f + x)), E = st(d), y = {
6532
+ const g = st(f), m = st(s.clientWidth - (d + u)), w = st(s.clientHeight - (f + x)), E = st(d), C = {
6526
6533
  rootMargin: -g + "px " + -m + "px " + -w + "px " + -E + "px",
6527
6534
  threshold: z(0, j(1, l)) || 1
6528
6535
  };
6529
6536
  let b = !0;
6530
- function C(R) {
6531
- const S = R[0].intersectionRatio;
6532
- if (S !== l) {
6537
+ function y(I) {
6538
+ const _ = I[0].intersectionRatio;
6539
+ if (_ !== l) {
6533
6540
  if (!b)
6534
6541
  return r();
6535
- S ? r(!1, S) : i = setTimeout(() => {
6542
+ _ ? r(!1, _) : i = setTimeout(() => {
6536
6543
  r(!1, 1e-7);
6537
6544
  }, 1e3);
6538
6545
  }
6539
- S === 1 && !he(h, c.getBoundingClientRect()) && r(), b = !1;
6546
+ _ === 1 && !he(h, c.getBoundingClientRect()) && r(), b = !1;
6540
6547
  }
6541
6548
  try {
6542
- e = new IntersectionObserver(C, {
6543
- ...y,
6549
+ e = new IntersectionObserver(y, {
6550
+ ...C,
6544
6551
  // Handle <iframe>s
6545
6552
  root: s.ownerDocument
6546
6553
  });
6547
6554
  } catch {
6548
- e = new IntersectionObserver(C, y);
6555
+ e = new IntersectionObserver(y, C);
6549
6556
  }
6550
6557
  e.observe(c);
6551
6558
  }
@@ -6570,8 +6577,8 @@ function Ct(c, t, e, i) {
6570
6577
  r && (x = new ResizeObserver((E) => {
6571
6578
  let [p] = E;
6572
6579
  p && p.target === h && x && (x.unobserve(t), cancelAnimationFrame(u), u = requestAnimationFrame(() => {
6573
- var y;
6574
- (y = x) == null || y.observe(t);
6580
+ var C;
6581
+ (C = x) == null || C.observe(t);
6575
6582
  })), e();
6576
6583
  }), h && !l && x.observe(h), x.observe(t));
6577
6584
  let g, m = l ? G(c) : null;
@@ -6815,9 +6822,8 @@ class Oi {
6815
6822
  "F12"
6816
6823
  ].includes(s))
6817
6824
  return;
6818
- const d = document.activeElement === this.inputEl;
6819
- if (!this.ctx.selectOnlyOne || !d) {
6820
- t.preventDefault(), this.inputEl.blur();
6825
+ if (!(document.activeElement === this.inputEl) && e.editorType === "text") {
6826
+ t.preventDefault();
6821
6827
  return;
6822
6828
  }
6823
6829
  this.startEdit(!0);
@@ -6878,7 +6884,7 @@ class Oi {
6878
6884
  header: d
6879
6885
  } = this.ctx;
6880
6886
  let f = this.ctx.body.visibleHeight;
6881
- o > f && (o = f), this.editorEl.style.zIndex = "100", this.editorEl.style.left = `${this.drawX - 1}px`, this.editorEl.style.top = `${this.drawY}px`, this.editorEl.style.bottom = "auto", this.editorEl.style.maxWidth = "none", this.editorEl.style.maxHeight = `${f}px`, ["text"].includes(s) ? (this.inputEl.style.opacity = "1", this.inputEl.style.position = "relative", this.inputEl.style.minWidth = `${r - 1}px`, this.inputEl.style.minHeight = `${o - 1}px`, this.inputEl.style.maxHeight = `${f}px`, this.inputEl.style.width = `${r}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${h}px`, this.inputEl.value = "", i !== null && (this.inputEl.value = i)) : (this.inputEl.style.opacity = "0", this.inputEl.style.width = "1px", this.inputEl.style.height = "1px", this.inputEl.style.position = "absolute", this.inputEl.style.left = "0px", this.inputEl.style.top = "0px"), (this.inputEl.scrollHeight > o || this.drawY < d.height) && this.autoSize();
6887
+ o > f && (o = f), this.editorEl.style.zIndex = "100", this.editorEl.style.left = `${this.drawX - 1}px`, this.editorEl.style.top = `${this.drawY}px`, this.editorEl.style.bottom = "auto", this.editorEl.style.maxWidth = "none", this.editorEl.style.maxHeight = `${f}px`, ["text"].includes(s) ? (this.inputEl.style.opacity = "1", this.inputEl.style.position = "relative", this.inputEl.style.minWidth = `${r - 1}px`, this.inputEl.style.minHeight = `${o - 1}px`, this.inputEl.style.maxHeight = `${f}px`, this.inputEl.style.width = `${r}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${h}px`, this.inputEl.value = "", i !== null && (this.inputEl.value = i), (this.inputEl.scrollHeight > o || this.drawY < d.height) && this.autoSize()) : (this.inputEl.style.opacity = "0", this.inputEl.style.width = "1px", this.inputEl.style.height = "1px", this.inputEl.style.position = "absolute", this.inputEl.style.left = "0px", this.inputEl.style.top = "0px");
6882
6888
  }
6883
6889
  doneEditByInput() {
6884
6890
  if (this.cellTarget && this.cellTarget.editorType === "text") {
@@ -6887,7 +6893,7 @@ class Oi {
6887
6893
  }
6888
6894
  }
6889
6895
  focusInput() {
6890
- this.ctx.selectOnlyOne && document.activeElement !== this.inputEl && this.inputEl.focus({ preventScroll: !0 });
6896
+ document.activeElement !== this.inputEl && this.inputEl.focus({ preventScroll: !0 });
6891
6897
  }
6892
6898
  startEdit(t = !1) {
6893
6899
  this.cancel = !1;
@@ -7323,7 +7329,7 @@ class zt {
7323
7329
  }
7324
7330
  }
7325
7331
  const i = e.getAttribute("data-menu") || (e == null ? void 0 : e.getAttribute("data-submenu")), s = this.findMenuItem(i || "");
7326
- s && (s.event && s.event(t, this.hide.bind(this)), this.onClick && this.onClick(s, i || ""));
7332
+ s && this.onClick && this.onClick(s, i || "");
7327
7333
  }
7328
7334
  findMenuItem(t, e = this.menuData) {
7329
7335
  for (const i of e) {
@@ -7361,9 +7367,6 @@ class zt {
7361
7367
  });
7362
7368
  });
7363
7369
  }
7364
- hide() {
7365
- this.cleanupAllSubmenus(this.container), this.container.style.display = "none";
7366
- }
7367
7370
  destroy() {
7368
7371
  this.container.removeEventListener("mouseenter", this.boundMouseEnterHandler, !0), this.container.removeEventListener("mouseleave", this.boundMouseLeaveHandler, !0), this.container.removeEventListener("click", this.boundClickHandler), this.cleanupAllSubmenus(this.container), this.container.style.display = "none", this.container.replaceChildren();
7369
7372
  }
@@ -7428,60 +7431,68 @@ class Ai {
7428
7431
  init() {
7429
7432
  this.ctx.on("outsideMousedown", () => {
7430
7433
  this.hide();
7431
- }), this.ctx.on("cellContextMenuClick", (t, e) => {
7434
+ }), this.ctx.on("cellContextMenuClick", async (t, e) => {
7432
7435
  if (this.isCustom) {
7433
7436
  this.contextMenuEl.style.display = "block", this.positionMenu(e);
7434
7437
  return;
7435
7438
  }
7436
- const { ENABLE_CONTEXT_MENU: i, CUSTOM_BODY_CONTEXT_MENU: s, CONTEXT_MENU: o } = this.ctx.config, r = [...o, ...s];
7437
- if (!i || r.length === 0) return;
7439
+ const { ENABLE_CONTEXT_MENU: i, CUSTOM_BODY_CONTEXT_MENU: s, CONTEXT_MENU: o, BEFORE_BODY_CONTEXT_MENU_METHOD: r } = this.ctx.config;
7440
+ let a = [...o, ...s];
7441
+ if (r && (a = await r({ list: a, cell: t, hide: this.hide.bind(this) })), !i || a.length === 0) return;
7438
7442
  e.preventDefault();
7439
- const { xArr: a, yArr: l } = this.ctx.selector, [h, d] = a, [f, u] = l, { rowIndex: x, colIndex: g } = t;
7440
- x >= f && x <= u && g >= h && g <= d || this.ctx.emit("setSelectorCell", t, e), this.currentDOMTreeMenu && this.currentDOMTreeMenu.destroy(), this.ctx.contextMenuIng = !0, this.currentDOMTreeMenu = new zt(this.contextMenuEl, r, {
7441
- onClick: (w, E) => {
7442
- E === "copy" ? (this.ctx.emit("contextMenuCopy"), this.hide()) : E === "paste" ? (this.ctx.emit("contextMenuPaste"), this.hide()) : E === "cut" ? (this.ctx.emit("contextMenuCut"), this.hide()) : E === "clearSelected" && (this.ctx.emit("contextMenuClearSelected"), this.hide());
7443
+ const { xArr: l, yArr: h } = this.ctx.selector, [d, f] = l, [u, x] = h, { rowIndex: g, colIndex: m } = t;
7444
+ g >= u && g <= x && m >= d && m <= f || this.ctx.emit("setSelectorCell", t, e), this.currentDOMTreeMenu && this.currentDOMTreeMenu.destroy(), this.ctx.contextMenuIng = !0, this.currentDOMTreeMenu = new zt(this.contextMenuEl, a, {
7445
+ onClick: (E, p) => {
7446
+ p === "copy" ? (this.ctx.emit("contextMenuCopy"), this.hide()) : p === "paste" ? (this.ctx.emit("contextMenuPaste"), this.hide()) : p === "cut" ? (this.ctx.emit("contextMenuCut"), this.hide()) : p === "clearSelected" ? (this.ctx.emit("contextMenuClearSelected"), this.hide()) : E.event && E.event(e, {
7447
+ hide: this.hide.bind(this),
7448
+ cell: t
7449
+ });
7443
7450
  }
7444
7451
  }), this.currentDOMTreeMenu.positionMenu(e);
7445
- }), this.ctx.on("cellHeaderContextMenuClick", (t, e) => {
7452
+ }), this.ctx.on("cellHeaderContextMenuClick", async (t, e) => {
7446
7453
  if (this.isCustom) {
7447
7454
  this.contextMenuEl.style.display = "block", this.positionMenu(e);
7448
7455
  return;
7449
7456
  }
7450
- const { SELECTOR_AREA_MIN_X: i, SELECTOR_AREA_MAX_X: s, SELECTOR_AREA_MAX_X_OFFSET: o } = this.ctx.config, r = i, a = s || this.ctx.maxColIndex - o;
7451
- if (t.colIndex < r || t.colIndex > a)
7457
+ const { SELECTOR_AREA_MIN_X: i, SELECTOR_AREA_MAX_X: s, SELECTOR_AREA_MAX_X_OFFSET: o, BEFORE_HEADER_CONTEXT_MENU_METHOD: r } = this.ctx.config, a = i, l = s || this.ctx.maxColIndex - o;
7458
+ if (t.colIndex < a || t.colIndex > l)
7452
7459
  return;
7453
- const { HEADER_CONTEXT_MENU: l, CUSTOM_HEADER_CONTEXT_MENU: h, ENABLE_HEADER_CONTEXT_MENU: d } = this.ctx.config, f = [...l, ...h];
7454
- if (!d || f.length === 0) return;
7460
+ const { HEADER_CONTEXT_MENU: h, CUSTOM_HEADER_CONTEXT_MENU: d, ENABLE_HEADER_CONTEXT_MENU: f } = this.ctx.config;
7461
+ let u = [...h, ...d];
7462
+ if (r && (u = await r({ list: u, cell: t, hide: this.hide.bind(this) })), !f || u.length === 0) return;
7455
7463
  e.preventDefault();
7456
- const { xArr: u } = this.ctx.selector, [x, g] = u, { colIndex: m } = t;
7457
- m >= x && m <= g || (this.ctx.focusCellHeader = t, this.ctx.emit("selectCols", t)), this.currentDOMTreeMenu && this.currentDOMTreeMenu.destroy();
7458
- const E = this.ctx.database.getColumns(), p = f.map((y) => y.value === "visible" ? {
7459
- ...y,
7460
- children: this.filterColumns(E)
7461
- } : y);
7462
- this.ctx.contextMenuIng = !0, this.currentDOMTreeMenu = new zt(this.contextMenuEl, p, {
7463
- onClick: (y, b) => {
7464
- const { xArr: C } = this.ctx.selector, [R, S] = C;
7465
- if (b === "fixedLeft" || b === "fixedRight" || b === "fixedNone") {
7466
- const O = this.ctx.header.allCellHeaders.filter((v) => v.colIndex >= R && v.colIndex <= S).filter((v) => v.level === 0).filter((v) => !v.column.fixedDisabled).map((v) => v.key);
7464
+ const { xArr: x } = this.ctx.selector, [g, m] = x, { colIndex: w } = t;
7465
+ w >= g && w <= m || (this.ctx.focusCellHeader = t, this.ctx.emit("selectCols", t)), this.currentDOMTreeMenu && this.currentDOMTreeMenu.destroy();
7466
+ const p = this.ctx.database.getColumns(), C = u.map((b) => b.value === "visible" ? {
7467
+ ...b,
7468
+ children: this.filterColumns(p)
7469
+ } : b);
7470
+ this.ctx.contextMenuIng = !0, this.currentDOMTreeMenu = new zt(this.contextMenuEl, C, {
7471
+ onClick: (b, y) => {
7472
+ const { xArr: I } = this.ctx.selector, [_, L] = I;
7473
+ if (y === "fixedLeft" || y === "fixedRight" || y === "fixedNone") {
7474
+ const R = this.ctx.header.allCellHeaders.filter((v) => v.colIndex >= _ && v.colIndex <= L).filter((v) => v.level === 0).filter((v) => !v.column.fixedDisabled).map((v) => v.key);
7467
7475
  this.ctx.database.setCustomHeaderFixedData(
7468
- O,
7469
- b === "fixedLeft" ? "left" : b === "fixedRight" ? "right" : ""
7476
+ R,
7477
+ y === "fixedLeft" ? "left" : y === "fixedRight" ? "right" : ""
7470
7478
  ), this.hide();
7471
- } else if (b === "hide") {
7472
- const O = this.ctx.header.leafCellHeaders.filter((v) => v.colIndex >= R && v.colIndex <= S).filter((v) => !v.children.length).filter((v) => !v.column.hideDisabled).map((v) => v.key);
7473
- O.length > 0 && this.ctx.database.setCustomHeaderHideData(O, !0), this.hide();
7474
- } else if (b !== "visible") if (b.startsWith("visible_")) {
7475
- if (!y.key) return;
7476
- if (y.children) {
7477
- const _ = this.getLeafKeys(y.children);
7478
- this.ctx.database.setCustomHeaderHideData(_, !1);
7479
+ } else if (y === "hide") {
7480
+ const R = this.ctx.header.leafCellHeaders.filter((v) => v.colIndex >= _ && v.colIndex <= L).filter((v) => !v.children.length).filter((v) => !v.column.hideDisabled).map((v) => v.key);
7481
+ R.length > 0 && this.ctx.database.setCustomHeaderHideData(R, !0), this.hide();
7482
+ } else if (y !== "visible") if (y.startsWith("visible_")) {
7483
+ if (!b.key) return;
7484
+ if (b.children) {
7485
+ const T = this.getLeafKeys(b.children);
7486
+ this.ctx.database.setCustomHeaderHideData(T, !1);
7479
7487
  } else
7480
- this.ctx.database.setCustomHeaderHideData([y.key], !1);
7481
- this.currentDOMTreeMenu && this.currentDOMTreeMenu.removeSubMenuItem(b);
7482
- const O = this.ctx.database.getColumns();
7483
- J(O).filter((_) => _.hide).length === 0 && this.hide();
7484
- } else b === "resetHeader" && (this.ctx.database.resetCustomHeader(), this.hide());
7488
+ this.ctx.database.setCustomHeaderHideData([b.key], !1);
7489
+ this.currentDOMTreeMenu && this.currentDOMTreeMenu.removeSubMenuItem(y);
7490
+ const R = this.ctx.database.getColumns();
7491
+ J(R).filter((T) => T.hide).length === 0 && this.hide();
7492
+ } else y === "resetHeader" ? (this.ctx.database.resetCustomHeader(), this.hide()) : b.event && b.event(e, {
7493
+ hide: this.hide.bind(this),
7494
+ cell: t
7495
+ });
7485
7496
  }
7486
7497
  }), this.positionMenu(e);
7487
7498
  }), this.ctx.on("click", () => {