e-virt-table 1.2.32 → 1.2.33

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
@@ -66,7 +66,7 @@ function Dt() {
66
66
  return (c === "x" ? t : t & 3 | 8).toString(16);
67
67
  });
68
68
  }
69
- function j(c, t) {
69
+ function Z(c, t) {
70
70
  let e = 0, i;
71
71
  return function(...s) {
72
72
  const o = (/* @__PURE__ */ new Date()).getTime(), r = o - e, a = typeof t == "function" ? t() : t;
@@ -214,7 +214,7 @@ function xe(c, t = document.documentElement) {
214
214
  const e = c.startsWith("--") ? c : `--${c}`;
215
215
  return getComputedStyle(t).getPropertyValue(e).trim();
216
216
  }
217
- function Rt(c) {
217
+ function It(c) {
218
218
  if (!c) return /* @__PURE__ */ new Date(0);
219
219
  if (typeof c == "number")
220
220
  return new Date(c);
@@ -269,7 +269,7 @@ function Rt(c) {
269
269
  return /* @__PURE__ */ new Date(NaN);
270
270
  }
271
271
  function ue(c, t) {
272
- const e = Rt(c), i = Rt(t);
272
+ const e = It(c), i = It(t);
273
273
  return isNaN(e.getTime()) && isNaN(i.getTime()) ? 0 : isNaN(e.getTime()) ? -1 : isNaN(i.getTime()) ? 1 : e.getTime() - i.getTime();
274
274
  }
275
275
  class Bt {
@@ -523,16 +523,16 @@ class ut extends Bt {
523
523
  this.rowExpand = h, this.rowHasChildren = d;
524
524
  const { TREE_INDENT: x = 16, CHECKBOX_SIZE: w, TREE_ICON_SIZE: E } = this.ctx.config;
525
525
  if (r = u * x, f) {
526
- const I = this.ctx.icons.get("loading");
527
- a = "loading", o = I;
526
+ const R = this.ctx.icons.get("loading");
527
+ a = "loading", o = R;
528
528
  } else if (d) {
529
- const I = this.ctx.icons.get("expand"), _ = this.ctx.icons.get("shrink");
530
- o = h ? _ : I, a = h ? "shrink" : "expand";
529
+ const R = this.ctx.icons.get("expand"), _ = this.ctx.icons.get("shrink");
530
+ o = h ? _ : R, a = h ? "shrink" : "expand";
531
531
  }
532
532
  let g = E, m = E, y = this.drawX;
533
533
  (this.align === "center" || this.align === "right") && (y = this.drawX + (this.visibleWidth - g - 2 * e) / 2, this.align = "left");
534
- let p = y + r + e, R = this.drawY + (this.visibleHeight - m) / 2, C = r + this.drawX + g - 0.5;
535
- this.type === "selection-tree" ? (p = r + this.drawSelectionImageX + this.drawSelectionImageWidth, C = p + g - e / 2) : this.type === "tree-selection" ? C = p + w + g - e / 2 : C = p + g - e / 2, this.drawTextX = C, this.drawTextWidth = this.drawX + this.visibleWidth - C, !(p + g + e > this.drawX + this.visibleWidth) && (R + m + e > this.drawY + this.visibleHeight || (this.drawTreeImageX = p, this.drawTreeImageY = R, this.drawTreeImageWidth = g, this.drawTreeImageHeight = m, o ? (this.drawTreeImageName = a, this.drawTreeImageSource = o) : (this.drawTreeImageName = "", this.drawTreeImageSource = void 0)));
534
+ let p = y + r + e, b = this.drawY + (this.visibleHeight - m) / 2, C = r + this.drawX + g - 0.5;
535
+ this.type === "selection-tree" ? (p = r + this.drawSelectionImageX + this.drawSelectionImageWidth, C = p + g - e / 2) : this.type === "tree-selection" ? C = p + w + g - e / 2 : C = p + g - e / 2, this.drawTextX = C, this.drawTextWidth = this.drawX + this.visibleWidth - C, !(p + g + e > this.drawX + this.visibleWidth) && (b + m + e > this.drawY + this.visibleHeight || (this.drawTreeImageX = p, this.drawTreeImageY = b, this.drawTreeImageWidth = g, this.drawTreeImageHeight = m, o ? (this.drawTreeImageName = a, this.drawTreeImageSource = o) : (this.drawTreeImageName = "", this.drawTreeImageSource = void 0)));
536
536
  }
537
537
  drawTreeLine() {
538
538
  const { TREE_LINE: e, TREE_INDENT: i = 16, TREE_ICON_SIZE: s = 16, TREE_LINE_COLOR: o = "#e1e6eb" } = this.ctx.config;
@@ -544,8 +544,8 @@ class ut extends Bt {
544
544
  for (let g = 0; g < a - 1; g += 1) {
545
545
  const m = f[g + 1];
546
546
  if (!!(m ? this.ctx.database.getRowForRowKey(m) || {} : {}).isLastChild) continue;
547
- const R = Math.round(this.drawTreeImageX - (a - g) * i + s / 2);
548
- this.ctx.paint.drawLine([R, this.drawY, R, this.drawY + this.visibleHeight], {
547
+ const b = Math.round(this.drawTreeImageX - (a - g) * i + s / 2);
548
+ this.ctx.paint.drawLine([b, this.drawY, b, this.drawY + this.visibleHeight], {
549
549
  borderColor: o,
550
550
  borderWidth: 1,
551
551
  lineDash: [4, 4],
@@ -595,31 +595,31 @@ class ut extends Bt {
595
595
  STRIPE_COLOR: E
596
596
  } = this.ctx.config;
597
597
  if (this.cellType === "footer") {
598
- let _ = h, v = l;
598
+ let _ = h, T = l;
599
599
  if (typeof o == "function") {
600
- const S = o, { backgroundColor: b, color: O } = S({
600
+ const S = o, { backgroundColor: I, color: v } = S({
601
601
  row: this.row,
602
602
  rowIndex: this.rowIndex,
603
603
  colIndex: this.colIndex,
604
604
  column: this.column,
605
605
  value: this.getValue()
606
606
  }) || {};
607
- b && (_ = b), O && (v = O);
607
+ I && (_ = I), v && (T = v);
608
608
  }
609
- this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = _, this.drawTextColor = v;
609
+ this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = _, this.drawTextColor = T;
610
610
  return;
611
611
  }
612
612
  let g = "transparent";
613
613
  const m = this.ctx.hoverCell, y = this.ctx.currentCell;
614
- let p = this.rowIndex, R = this.rowIndex;
614
+ let p = this.rowIndex, b = this.rowIndex;
615
615
  if (this.rowspan !== 1 && (u || d)) {
616
- const _ = this.getSpanInfo(), { yArr: v } = _;
617
- p = v[0], R = v[1];
616
+ const _ = this.getSpanInfo(), { yArr: T } = _;
617
+ p = T[0], b = T[1];
618
618
  }
619
- u && m && (m.rowKey === this.rowKey && (g = x), m.rowIndex >= p && m.rowIndex <= R && (g = x)), d && y && (y.rowKey === this.rowKey && (g = f), y.rowIndex >= p && y.rowIndex <= R && (g = f)), this.drawCellSkyBgColor = g;
620
- let C = e, I = a;
621
- if (this.ctx.database.getReadonly(this.rowKey, this.key) || (C = i, I = r), w && (this.rowIndex % 2 ? C = E : C = e), typeof s == "function") {
622
- const _ = s, { backgroundColor: v, color: S } = _({
619
+ u && m && (m.rowKey === this.rowKey && (g = x), m.rowIndex >= p && m.rowIndex <= b && (g = x)), d && y && (y.rowKey === this.rowKey && (g = f), y.rowIndex >= p && y.rowIndex <= b && (g = f)), this.drawCellSkyBgColor = g;
620
+ let C = e, R = a;
621
+ if (this.ctx.database.getReadonly(this.rowKey, this.key) || (C = i, R = r), w && (this.rowIndex % 2 ? C = E : C = e), typeof s == "function") {
622
+ const _ = s, { backgroundColor: T, color: S } = _({
623
623
  row: this.row,
624
624
  rowIndex: this.rowIndex,
625
625
  colIndex: this.colIndex,
@@ -627,9 +627,9 @@ class ut extends Bt {
627
627
  isHasChanged: this.isHasChanged,
628
628
  value: this.getValue()
629
629
  }) || {};
630
- v && (C = v), S && (I = S);
630
+ T && (C = T), S && (R = S);
631
631
  }
632
- this.drawCellBgColor = C, this.drawTextColor = I;
632
+ this.drawCellBgColor = C, this.drawTextColor = R;
633
633
  }
634
634
  updateSelection() {
635
635
  const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: a, rowIndex: l, rowKey: h } = this;
@@ -641,8 +641,8 @@ class ut extends Bt {
641
641
  let w = x, E = this.drawY + (i - f) / 2;
642
642
  if (a !== "selection-tree") {
643
643
  if (a === "tree-selection") {
644
- const { TREE_INDENT: y = 16, TREE_ICON_SIZE: p } = this.ctx.config, R = this.ctx.database.getRowForRowKey(h), { level: C = 0 } = R || {}, I = C * y;
645
- w = x + p + I;
644
+ const { TREE_INDENT: y = 16, TREE_ICON_SIZE: p } = this.ctx.config, b = this.ctx.database.getRowForRowKey(h), { level: C = 0 } = b || {}, R = C * y;
645
+ w = x + p + R;
646
646
  }
647
647
  }
648
648
  let g = this.ctx.icons.get("checkbox-uncheck"), m = "checkbox-uncheck";
@@ -949,10 +949,10 @@ class ut extends Bt {
949
949
  drawBorder(e) {
950
950
  const { drawX: i, drawY: s, rowIndex: o, colIndex: r, height: a, width: l } = this;
951
951
  let h = i, d = s;
952
- const { xArr: f, yArr: u, lineDash: x = [], borderWidth: w = 1, borderColor: E, fillColor: g } = e, m = f[0], y = f[1], p = u[0], R = u[1];
952
+ const { xArr: f, yArr: u, lineDash: x = [], borderWidth: w = 1, borderColor: E, fillColor: g } = e, m = f[0], y = f[1], p = u[0], b = u[1];
953
953
  if (r >= m && r <= y && o === p) {
954
- const C = r === y ? 1 : 0, I = r === m ? 1 : 0;
955
- this.ctx.paint.drawLine([h + I, d + 1, h + l - C, d + 1], {
954
+ const C = r === y ? 1 : 0, R = r === m ? 1 : 0;
955
+ this.ctx.paint.drawLine([h + R, d + 1, h + l - C, d + 1], {
956
956
  borderColor: E,
957
957
  fillColor: g,
958
958
  borderWidth: w,
@@ -961,9 +961,9 @@ class ut extends Bt {
961
961
  lineDash: x
962
962
  });
963
963
  }
964
- if (r === y && o >= p && o <= R) {
965
- const C = o === p ? 1 : 0, I = o === R ? 1 : 0;
966
- this.ctx.paint.drawLine([h + l - 1, d + C, h + l - 1, d + a - I], {
964
+ if (r === y && o >= p && o <= b) {
965
+ const C = o === p ? 1 : 0, R = o === b ? 1 : 0;
966
+ this.ctx.paint.drawLine([h + l - 1, d + C, h + l - 1, d + a - R], {
967
967
  borderColor: E,
968
968
  fillColor: g,
969
969
  borderWidth: w,
@@ -972,9 +972,9 @@ class ut extends Bt {
972
972
  lineDash: x
973
973
  });
974
974
  }
975
- if (r >= m && r <= y && o === R) {
976
- const C = r === y ? 1 : 0, I = r === m ? 1 : 0;
977
- this.ctx.paint.drawLine([h + I, d + a - 1, h + l - C, d + a - 1], {
975
+ if (r >= m && r <= y && o === b) {
976
+ const C = r === y ? 1 : 0, R = r === m ? 1 : 0;
977
+ this.ctx.paint.drawLine([h + R, d + a - 1, h + l - C, d + a - 1], {
978
978
  borderColor: E,
979
979
  fillColor: g,
980
980
  borderWidth: w,
@@ -983,9 +983,9 @@ class ut extends Bt {
983
983
  lineDash: x
984
984
  });
985
985
  }
986
- if (r === m && o >= p && o <= R) {
987
- const C = o === R ? 1 : 0, I = o === p ? 1 : 0;
988
- this.ctx.paint.drawLine([h + 1, d + I, h + 1, d + a - C], {
986
+ if (r === m && o >= p && o <= b) {
987
+ const C = o === b ? 1 : 0, R = o === p ? 1 : 0;
988
+ this.ctx.paint.drawLine([h + 1, d + R, h + 1, d + a - C], {
989
989
  borderColor: E,
990
990
  fillColor: g,
991
991
  borderWidth: w,
@@ -1064,8 +1064,8 @@ class ge {
1064
1064
  if (typeof d == "function" && (g = d), f) {
1065
1065
  const p = o[f];
1066
1066
  if (this.checkboxKeyMap.has(p)) {
1067
- const R = this.checkboxKeyMap.get(p) || [];
1068
- R.push(x), this.checkboxKeyMap.set(p, R);
1067
+ const b = this.checkboxKeyMap.get(p) || [];
1068
+ b.push(x), this.checkboxKeyMap.set(p, b);
1069
1069
  } else
1070
1070
  this.checkboxKeyMap.set(p, [x]);
1071
1071
  }
@@ -1383,8 +1383,8 @@ class ge {
1383
1383
  let l = [], h = t.map((x) => {
1384
1384
  const { rowKey: w, key: E } = x;
1385
1385
  let g = x.value, m = g;
1386
- const y = this.getRowDataItemForRowKey(w), p = this.getItemValue(w, E), R = this.getVirtualBodyCellByKey(w, E);
1387
- return (R == null ? void 0 : R.type) === "number" && (["", void 0, null].includes(g) ? m = null : /^-?\d+(\.\d+)?$/.test(`${g}`) ? m = Number(g) : (m = p, l.push({
1386
+ const y = this.getRowDataItemForRowKey(w), p = this.getItemValue(w, E), b = this.getVirtualBodyCellByKey(w, E);
1387
+ return (b == null ? void 0 : b.type) === "number" && (["", void 0, null].includes(g) ? m = null : /^-?\d+(\.\d+)?$/.test(`${g}`) ? m = Number(g) : (m = p, l.push({
1388
1388
  ...x,
1389
1389
  value: m,
1390
1390
  oldValue: p,
@@ -1947,85 +1947,85 @@ class ge {
1947
1947
  }
1948
1948
  ]
1949
1949
  };
1950
- let g = e, m = e, y = a, p = a, R = [], C = 0, I = 0, _ = 0, v = 0;
1950
+ let g = e, m = e, y = a, p = a, b = [], C = 0, R = 0, _ = 0, T = 0;
1951
1951
  if (d !== 1 && w) {
1952
- v = u;
1953
- const S = l.reduce((b, O) => {
1954
- const T = this.getItemValue(s, O) ?? "";
1955
- return `${b}${T}`;
1952
+ T = u;
1953
+ const S = l.reduce((I, v) => {
1954
+ const O = this.getItemValue(s, v) ?? "";
1955
+ return `${I}${O}`;
1956
1956
  }, "");
1957
- for (let b = e - 1; b >= 0; b--) {
1958
- const O = this.rowIndexRowKeyMap.get(b) || "", T = l.reduce((M, L) => {
1959
- const A = this.getItemValue(O, L) ?? "";
1960
- return `${M}${A}`;
1957
+ for (let I = e - 1; I >= 0; I--) {
1958
+ const v = this.rowIndexRowKeyMap.get(I) || "", O = l.reduce((A, L) => {
1959
+ const M = this.getItemValue(v, L) ?? "";
1960
+ return `${A}${M}`;
1961
1961
  }, "");
1962
- if (S === T)
1963
- g = b;
1962
+ if (S === O)
1963
+ g = I;
1964
1964
  else
1965
1965
  break;
1966
1966
  }
1967
- for (let b = e; b <= this.ctx.maxRowIndex; b++) {
1968
- const O = this.rowIndexRowKeyMap.get(b) || "", T = l.reduce((M, L) => {
1969
- const A = this.getItemValue(O, L) ?? "";
1970
- return `${M}${A}`;
1967
+ for (let I = e; I <= this.ctx.maxRowIndex; I++) {
1968
+ const v = this.rowIndexRowKeyMap.get(I) || "", O = l.reduce((A, L) => {
1969
+ const M = this.getItemValue(v, L) ?? "";
1970
+ return `${A}${M}`;
1971
1971
  }, "");
1972
- if (S === T)
1973
- m = b;
1972
+ if (S === O)
1973
+ m = I;
1974
1974
  else
1975
1975
  break;
1976
1976
  }
1977
- for (let b = g; b < e; b++) {
1978
- const { height: O } = this.positions[b];
1979
- C += O;
1977
+ for (let I = g; I < e; I++) {
1978
+ const { height: v } = this.positions[I];
1979
+ C += v;
1980
1980
  }
1981
- for (let b = g; b <= m; b++) {
1982
- const { height: O } = this.positions[b];
1983
- _ += O;
1984
- const T = this.rowIndexRowKeyMap.get(b) || "", { item: M } = this.rowKeyMap.get(T), L = this.getItemValue(T, i);
1985
- R.push({
1986
- rowKey: T,
1981
+ for (let I = g; I <= m; I++) {
1982
+ const { height: v } = this.positions[I];
1983
+ _ += v;
1984
+ const O = this.rowIndexRowKeyMap.get(I) || "", { item: A } = this.rowKeyMap.get(O), L = this.getItemValue(O, i);
1985
+ b.push({
1986
+ rowKey: O,
1987
1987
  key: i,
1988
1988
  value: L,
1989
- row: M
1989
+ row: A
1990
1990
  });
1991
1991
  }
1992
1992
  }
1993
1993
  if (x !== 1 && E) {
1994
1994
  _ = f;
1995
1995
  for (let S = a - 1; S >= 0; S--) {
1996
- const b = this.getColumnByColIndex(S);
1997
- if (!b)
1996
+ const I = this.getColumnByColIndex(S);
1997
+ if (!I)
1998
1998
  break;
1999
- const O = this.getItemValue(s, i), T = this.getItemValue(s, b.key);
2000
- if (O === T && h.includes(b.key))
1999
+ const v = this.getItemValue(s, i), O = this.getItemValue(s, I.key);
2000
+ if (v === O && h.includes(I.key))
2001
2001
  y = S;
2002
2002
  else
2003
2003
  break;
2004
2004
  }
2005
2005
  for (let S = a; S <= this.ctx.maxColIndex; S++) {
2006
- const b = this.getColumnByColIndex(S);
2007
- if (!b)
2006
+ const I = this.getColumnByColIndex(S);
2007
+ if (!I)
2008
2008
  break;
2009
- const O = this.getItemValue(s, i), T = this.getItemValue(s, b.key);
2010
- if (O === T && h.includes(b.key))
2009
+ const v = this.getItemValue(s, i), O = this.getItemValue(s, I.key);
2010
+ if (v === O && h.includes(I.key))
2011
2011
  p = S;
2012
2012
  else
2013
2013
  break;
2014
2014
  }
2015
2015
  for (let S = y; S < a; S++) {
2016
- const b = this.getColumnByColIndex(S);
2017
- if (!b)
2016
+ const I = this.getColumnByColIndex(S);
2017
+ if (!I)
2018
2018
  break;
2019
- I += b.width || 100;
2019
+ R += I.width || 100;
2020
2020
  }
2021
2021
  for (let S = y; S <= p; S++) {
2022
- const b = this.getColumnByColIndex(S);
2023
- if (!b)
2022
+ const I = this.getColumnByColIndex(S);
2023
+ if (!I)
2024
2024
  break;
2025
- v += b.width || 100, R.push({
2025
+ T += I.width || 100, b.push({
2026
2026
  rowKey: s,
2027
- key: b.key,
2028
- value: this.getItemValue(s, b.key),
2027
+ key: I.key,
2028
+ value: this.getItemValue(s, I.key),
2029
2029
  row: o
2030
2030
  });
2031
2031
  }
@@ -2036,10 +2036,10 @@ class ge {
2036
2036
  rowspan: d,
2037
2037
  colspan: x,
2038
2038
  height: _,
2039
- width: v,
2039
+ width: T,
2040
2040
  offsetTop: C,
2041
- offsetLeft: I,
2042
- dataList: R
2041
+ offsetLeft: R,
2042
+ dataList: b
2043
2043
  };
2044
2044
  }
2045
2045
  setValidationErrorByRowIndex(t, e, i) {
@@ -2387,7 +2387,7 @@ class pe {
2387
2387
  * @returns 是否溢出
2388
2388
  */
2389
2389
  drawText(t = "", e, i, s, o, r = {}) {
2390
- var O;
2390
+ var I;
2391
2391
  this.ctx.save();
2392
2392
  const {
2393
2393
  font: a = "12px Arial",
@@ -2402,44 +2402,42 @@ class pe {
2402
2402
  } = r;
2403
2403
  if (this.ctx.font = a, this.ctx.fillStyle = h, this.ctx.textAlign = l, ["", null, void 0].includes(t))
2404
2404
  return this.ctx.restore(), !1;
2405
- const m = parseInt(((O = a.match(/\d+/)) == null ? void 0 : O[0]) || "12") * (r.lineHeight || 1.2), y = s - d * 2 - w - E, p = this.ctx.measureText("...").width;
2406
- let R = !1;
2407
- if (s <= p + d * 2 + w + E)
2408
- return this.ctx.restore(), R = !0, R;
2409
- const C = Math.round((o - 2 * d) / m);
2410
- let I = this.wrapText(t, y, r.cacheTextKey), _ = Math.min(I.length, Math.max(C, 1));
2411
- u === "auto" && x ? _ = I.length : typeof u == "number" && u < _ ? _ = u : (u === 1 && !x && (I = [t], _ = 1), u === "auto" && C === 1 && (I = [t], _ = 1));
2412
- let v = i + d;
2413
- const S = Math.round(_ * m);
2414
- f === "middle" ? v = i + (o - S) / 2 : f === "bottom" && (v = i + o - S - d);
2415
- let b = e + d + w;
2416
- l === "center" ? b = e + s / 2 : l === "right" && (b = e + s - d - E);
2417
- for (let T = 0; T < I.length; T++) {
2418
- const M = I[T], L = v + T * m;
2419
- if (this.ctx.textBaseline = "top", T === _ - 1) {
2420
- const { _text: A, ellipsis: D } = this.handleEllipsis(M, s, d, a);
2421
- this.ctx.fillText(A, b, L), R = D;
2405
+ const m = parseInt(((I = a.match(/\d+/)) == null ? void 0 : I[0]) || "12") * (r.lineHeight || 1.2), y = s - d * 2 - w - E;
2406
+ let p = !1;
2407
+ const b = Math.round((o - 2 * d) / m);
2408
+ let C = this.wrapText(t, y, r.cacheTextKey), R = Math.min(C.length, Math.max(b, 1));
2409
+ 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));
2410
+ let _ = i + d;
2411
+ const T = Math.round(R * m);
2412
+ f === "middle" ? _ = i + (o - T) / 2 : f === "bottom" && (_ = i + o - T - d);
2413
+ let S = e + d + w;
2414
+ l === "center" ? S = e + s / 2 : l === "right" && (S = e + s - d - E);
2415
+ for (let v = 0; v < C.length; v++) {
2416
+ const O = C[v], A = _ + v * m;
2417
+ if (this.ctx.textBaseline = "top", v === R - 1) {
2418
+ const M = C.slice(v).join(""), { _text: D, ellipsis: H } = this.handleEllipsis(M, s, d, a);
2419
+ this.ctx.fillText(D, S, A), p = H;
2422
2420
  break;
2423
2421
  }
2424
- this.ctx.fillText(M, b, L);
2422
+ this.ctx.fillText(O, S, A);
2425
2423
  }
2426
- if (r.textCallback && I.length) {
2427
- const T = Math.round(this.ctx.measureText(I[0]).width);
2428
- let M = b, L = b + T;
2429
- l === "center" ? (M = b - T / 2, L = b + T / 2) : l === "right" && (M = b - T, L = b);
2430
- const A = {
2431
- x: b,
2432
- y: v,
2433
- width: T,
2434
- height: S,
2435
- left: M,
2424
+ if (r.textCallback && C.length) {
2425
+ const v = C.reduce((D, H) => Math.max(D, this.ctx.measureText(H).width), 0), O = Math.round(v);
2426
+ let A = S, L = S + O;
2427
+ l === "center" ? (A = S - O / 2, L = S + O / 2) : l === "right" && (A = S - O, L = S);
2428
+ const M = {
2429
+ x: S,
2430
+ y: _,
2431
+ width: O,
2432
+ height: T,
2433
+ left: A,
2436
2434
  right: L,
2437
- top: v,
2438
- bottom: v + S
2435
+ top: _,
2436
+ bottom: _ + T
2439
2437
  };
2440
- r.textCallback(A);
2438
+ r.textCallback(M);
2441
2439
  }
2442
- return this.ctx.restore(), R;
2440
+ return this.ctx.restore(), p;
2443
2441
  }
2444
2442
  /**
2445
2443
  * 将文本按宽度换行
@@ -2466,13 +2464,6 @@ class pe {
2466
2464
  }
2467
2465
  h && s.push(h);
2468
2466
  }
2469
- if (s.length >= 1) {
2470
- const a = s[s.length - 1], { ellipsis: l } = this.handleEllipsis(a, e, 0, this.ctx.font);
2471
- if (l) {
2472
- const h = a.slice(0, -1);
2473
- s[s.length - 1] = h, s.push(a.slice(-1));
2474
- }
2475
- }
2476
2467
  const r = s.length > 0 ? s : [""];
2477
2468
  return i && this.textCacheMap.set(i, r), r;
2478
2469
  }
@@ -2513,7 +2504,7 @@ class pe {
2513
2504
  ellipsis: !0
2514
2505
  };
2515
2506
  const l = this.ctx.measureText(t).width, h = e - i * 2;
2516
- if (l && l + a >= h) {
2507
+ if (l && l >= h) {
2517
2508
  o = !0;
2518
2509
  let d = 0;
2519
2510
  for (let f = 0; f < t.length; f++)
@@ -2528,7 +2519,7 @@ class pe {
2528
2519
  };
2529
2520
  }
2530
2521
  }
2531
- class It {
2522
+ class Rt {
2532
2523
  constructor(t) {
2533
2524
  n(this, "_config", {});
2534
2525
  /** CSS 类名前缀 */
@@ -2555,8 +2546,6 @@ class It {
2555
2546
  n(this, "BORDER_COLOR", "#e1e6eb");
2556
2547
  /** 宽度为 0 表示自适应100% */
2557
2548
  n(this, "WIDTH", 0);
2558
- /** 最小可调整宽度 */
2559
- n(this, "RESIZE_MIN_WIDTH", 40);
2560
2549
  /** 高度,为 0 表示自适应 */
2561
2550
  n(this, "HEIGHT", 0);
2562
2551
  /** 占位文本颜色 */
@@ -3050,7 +3039,7 @@ class ct extends Bt {
3050
3039
  n(this, "sortDescIconName", "sort-desc");
3051
3040
  n(this, "visibleWidth", 0);
3052
3041
  n(this, "visibleHeight", 0);
3053
- n(this, "maxLineClamp", "auto");
3042
+ n(this, "maxLineClampHeader", "auto");
3054
3043
  n(this, "domDataset", {});
3055
3044
  n(this, "drawTextX", 0);
3056
3045
  n(this, "drawTextY", 0);
@@ -3071,7 +3060,7 @@ class ct extends Bt {
3071
3060
  n(this, "drawSortImageHeight", 0);
3072
3061
  n(this, "drawSortImageName", "");
3073
3062
  n(this, "drawSortImageSource");
3074
- 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.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 = Dt(), this.overflowTooltipShow = l.overflowTooltipHeaderShow !== !1, this.hasChildren = l.children && l.children.length > 0 || !1, this.render = l.renderHeader;
3063
+ 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.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 = Dt(), this.overflowTooltipShow = l.overflowTooltipHeaderShow !== !1, this.hasChildren = l.children && l.children.length > 0 || !1, this.render = l.renderHeader, this.maxLineClampHeader = l.maxLineClampHeader || "auto";
3075
3064
  }
3076
3065
  /**
3077
3066
  * 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
@@ -3132,7 +3121,7 @@ class ct extends Bt {
3132
3121
  color: this.drawTextColor,
3133
3122
  align: this.align,
3134
3123
  verticalAlign: this.verticalAlign,
3135
- maxLineClamp: this.maxLineClamp,
3124
+ maxLineClamp: this.maxLineClampHeader,
3136
3125
  offsetRight: this.column.sortBy ? 16 : 0,
3137
3126
  // 排序图标占位
3138
3127
  offsetLeft: this.required ? 12 : 0,
@@ -3211,7 +3200,7 @@ class ct extends Bt {
3211
3200
  };
3212
3201
  }
3213
3202
  }
3214
- class Re {
3203
+ class Ie {
3215
3204
  constructor(t) {
3216
3205
  n(this, "ctx");
3217
3206
  n(this, "visibleHoverCell");
@@ -3499,7 +3488,7 @@ class Re {
3499
3488
  this.resizeObserver.unobserve(this.ctx.stageElement), this.mutationObserver.disconnect();
3500
3489
  }
3501
3490
  }
3502
- class Ie {
3491
+ class Re {
3503
3492
  constructor(t, e) {
3504
3493
  n(this, "eventBus");
3505
3494
  n(this, "eventBrowser");
@@ -3532,6 +3521,10 @@ class Ie {
3532
3521
  // 自动填充移动中
3533
3522
  n(this, "selectorMove", !1);
3534
3523
  // 选择器移动中
3524
+ n(this, "selectColsIng", !1);
3525
+ // 选择列中
3526
+ n(this, "selectRowsIng", !1);
3527
+ // 选择行中
3535
3528
  n(this, "adjustPositioning", !1);
3536
3529
  // 调整位置中
3537
3530
  n(this, "editing", !1);
@@ -3624,10 +3617,10 @@ class Ie {
3624
3617
  loadingElement: h,
3625
3618
  contextMenuElement: d
3626
3619
  } = t;
3627
- this.containerElement = i, s.tabIndex = 0, this.stageElement = s, this.canvasElement = o, this.overlayerElement = r, this.editorElement = a, this.emptyElement = l, this.loadingElement = h, this.contextMenuElement = d, this.config = new It(e.config || {}), this.eventBus = new me(), this.eventBrowser = new Ee(this), this.eventTable = new Re(this), this.paint = new pe(this.canvasElement), this.database = new ge(this, e), this.history = new we(this), this.icons = new be(this);
3620
+ this.containerElement = i, s.tabIndex = 0, this.stageElement = s, this.canvasElement = o, this.overlayerElement = r, this.editorElement = a, this.emptyElement = l, this.loadingElement = h, this.contextMenuElement = d, this.config = new Rt(e.config || {}), this.eventBus = new me(), this.eventBrowser = new Ee(this), this.eventTable = new Ie(this), this.paint = new pe(this.canvasElement), this.database = new ge(this, e), this.history = new we(this), this.icons = new be(this);
3628
3621
  }
3629
3622
  setConfig(t) {
3630
- this.config = new It(t);
3623
+ this.config = new Rt(t);
3631
3624
  }
3632
3625
  setItemValueByEditor(t, e, i, s = !0, o = !0, r = !0) {
3633
3626
  if (this.config.ENABLE_MERGE_CELL_LINK) {
@@ -3723,6 +3716,12 @@ class Ie {
3723
3716
  const s = this.body.height - this.body.visibleHeight + i;
3724
3717
  e < 0 ? e = 0 : e > s && (e = s), this.emit("setScrollY", e);
3725
3718
  }
3719
+ startAdjustPosition(t) {
3720
+ this.emit("startAdjustPosition", t);
3721
+ }
3722
+ stopAdjustPosition() {
3723
+ this.emit("stopAdjustPosition");
3724
+ }
3726
3725
  isTarget(t) {
3727
3726
  return !!this.containerElement.contains(t.target);
3728
3727
  }
@@ -3880,10 +3879,18 @@ class vt {
3880
3879
  }
3881
3880
  }
3882
3881
  class Se {
3882
+ // 垂直滚动定时器
3883
3883
  constructor(t) {
3884
3884
  n(this, "ctx");
3885
3885
  n(this, "verticalScrollbar");
3886
3886
  n(this, "horizontalScrollbar");
3887
+ n(this, "mousedownHeader", !1);
3888
+ // 是否点击了表头,点击头部处理滚动条调整位置
3889
+ n(this, "adjustPositionX", "");
3890
+ n(this, "adjustPositionY", "");
3891
+ n(this, "timerX", 0);
3892
+ // 水平滚动定时器
3893
+ n(this, "timerY", 0);
3887
3894
  this.ctx = t, this.verticalScrollbar = new vt(t, "vertical"), this.horizontalScrollbar = new vt(t, "horizontal"), this.ctx.on("wheel", (e) => this.onWheel(e)), this.ctx.on("mousedown", (e) => this.onMouseDown(e)), this.ctx.on("mousemove", (e) => this.onMouseMove(e)), this.ctx.on("mouseup", () => this.onMouseUp()), this.ctx.on("touchmove", (e) => this.onTouchmove(e)), this.ctx.on("touchstart", (e) => {
3888
3895
  this.onTouchstart(e);
3889
3896
  }), this.ctx.on("setScroll", (e, i) => {
@@ -3892,6 +3899,12 @@ class Se {
3892
3899
  this.setScrollX(e);
3893
3900
  }), this.ctx.on("setScrollY", (e) => {
3894
3901
  this.setScrollY(e);
3902
+ }), this.ctx.on("cellHeaderMousedown", () => {
3903
+ this.mousedownHeader = !0;
3904
+ }), this.ctx.on("startAdjustPosition", (e) => {
3905
+ this.startAdjustPosition(e);
3906
+ }), this.ctx.on("stopAdjustPosition", () => {
3907
+ this.stopAdjustPosition();
3895
3908
  });
3896
3909
  }
3897
3910
  onWheel(t) {
@@ -3910,7 +3923,7 @@ class Se {
3910
3923
  this.verticalScrollbar.onMouseMove(t), this.horizontalScrollbar.onMouseMove(t), this.draw();
3911
3924
  }
3912
3925
  onMouseUp() {
3913
- this.verticalScrollbar.onMouseUp(), this.horizontalScrollbar.onMouseUp(), this.ctx.scrollerMove = !1;
3926
+ this.mousedownHeader = !1, this.verticalScrollbar.onMouseUp(), this.horizontalScrollbar.onMouseUp(), this.ctx.scrollerMove = !1;
3914
3927
  }
3915
3928
  draw() {
3916
3929
  this.verticalScrollbar.draw(), this.horizontalScrollbar.draw();
@@ -3945,6 +3958,35 @@ class Se {
3945
3958
  const { top: o } = i.getPositionForRowIndex(s);
3946
3959
  this.setScrollY(o - e.visibleHeight / 2);
3947
3960
  }
3961
+ /**
3962
+ * 调整滚动条位置,让到达边界时自动滚动
3963
+ */
3964
+ startAdjustPosition(t) {
3965
+ var r, a;
3966
+ const { offsetX: e, offsetY: i } = this.ctx.getOffset(t);
3967
+ let s = "", o = "";
3968
+ if (((r = this.ctx.focusCell) == null ? void 0 : r.fixed) !== "left" && e < this.ctx.fixedLeftWidth ? s = "left" : ((a = this.ctx.focusCell) == null ? void 0 : a.fixed) !== "right" && e > this.ctx.body.visibleWidth - this.ctx.fixedRightWidth ? s = "right" : (s = "", this.stopAdjustPosition(!0, !1)), !this.mousedownHeader && i < this.ctx.header.visibleHeight ? o = "top" : i > this.ctx.header.visibleHeight + this.ctx.body.visibleHeight ? o = "bottom" : (o = "", this.stopAdjustPosition(!1, !0)), s && this.adjustPositionX !== s) {
3969
+ this.adjustPositionX = s;
3970
+ let h = 10 * (s === "left" ? -1 : 1);
3971
+ this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
3972
+ h *= 1.5;
3973
+ const { scrollX: d } = this.ctx, f = d + h;
3974
+ (f < 0 || f > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(f);
3975
+ }, 100);
3976
+ }
3977
+ if (o && this.adjustPositionY !== o) {
3978
+ this.adjustPositionY = o;
3979
+ let h = 10 * (o === "top" ? -1 : 1);
3980
+ this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
3981
+ h *= 1.5;
3982
+ const { scrollY: d } = this.ctx, f = d + h;
3983
+ (f < 0 || f > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(f);
3984
+ }, 100);
3985
+ }
3986
+ }
3987
+ stopAdjustPosition(t = !0, e = !0) {
3988
+ t && (this.adjustPositionX = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0)), e && (this.adjustPositionY = "", this.timerY && (clearInterval(this.timerY), this.timerY = 0));
3989
+ }
3948
3990
  }
3949
3991
  class _e {
3950
3992
  constructor(t) {
@@ -3985,7 +4027,7 @@ class _e {
3985
4027
  n(this, "renderFixedCellHeaders", []);
3986
4028
  this.ctx = t, this.ctx.on(
3987
4029
  "resetHeader",
3988
- j(() => {
4030
+ Z(() => {
3989
4031
  this.init(), this.ctx.emit("draw");
3990
4032
  }, 100)
3991
4033
  ), this.init(), this.initResizeColumn();
@@ -4290,26 +4332,26 @@ class ve {
4290
4332
  let m = g;
4291
4333
  const y = window.innerHeight, { top: p } = this.containerRect || this.ctx.containerElement.getBoundingClientRect();
4292
4334
  if (y > p && d && !a) {
4293
- const T = y - p - f;
4294
- T > e.height + r ? m = T : g > h && (m = h);
4335
+ const O = y - p - f;
4336
+ O > e.height + r ? m = O : g > h && (m = h);
4295
4337
  } else this.data.length && a ? m = a : this.data.length && h && g > h && (m = h);
4296
4338
  m > 0 && (this.ctx.stageHeight = Math.floor(m), this.ctx.stageElement.style.height = `${this.ctx.stageHeight}px`);
4297
- let R = this.ctx.stageHeight - e.height - r;
4298
- o ? this.visibleHeight = R - E : this.visibleHeight = R, 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;
4299
- const C = window.devicePixelRatio || 1, I = this.ctx.stageWidth * C, _ = this.ctx.stageHeight * C;
4300
- t.width = Math.round(I), t.height = Math.round(_);
4301
- const v = this.data.length ? "not-empty" : "empty";
4339
+ let b = this.ctx.stageHeight - e.height - r;
4340
+ o ? this.visibleHeight = b - E : 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;
4341
+ const C = window.devicePixelRatio || 1, R = this.ctx.stageWidth * C, _ = this.ctx.stageHeight * C;
4342
+ t.width = Math.round(R), t.height = Math.round(_);
4343
+ const T = this.data.length ? "not-empty" : "empty";
4302
4344
  this.ctx.emit("emptyChange", {
4303
- isEmpty: v,
4304
- type: v,
4345
+ isEmpty: T,
4346
+ type: T,
4305
4347
  headerHeight: e.height,
4306
4348
  bodyHeight: this.height,
4307
4349
  footerHeight: E,
4308
4350
  width: this.width,
4309
4351
  height: this.data.length ? 0 : l + E
4310
4352
  });
4311
- const S = Math.round(t.width / C * 1e4) / 1e4, b = Math.round(t.height / C * 1e4) / 1e4;
4312
- this.ctx.canvasElement.setAttribute("style", `height:${b}px;width:${S}px;`), this.ctx.paint.scale(C);
4353
+ const S = Math.round(t.width / C * 1e4) / 1e4, I = Math.round(t.height / C * 1e4) / 1e4;
4354
+ this.ctx.canvasElement.setAttribute("style", `height:${I}px;width:${S}px;`), this.ctx.paint.scale(C);
4313
4355
  }
4314
4356
  // 调整行的高度
4315
4357
  initResizeRow() {
@@ -4545,17 +4587,10 @@ class Te {
4545
4587
  }
4546
4588
  }
4547
4589
  class Oe {
4548
- // 垂直滚动定时器
4549
4590
  constructor(t) {
4550
4591
  n(this, "isCut", !1);
4551
4592
  n(this, "isMultipleRow", !1);
4552
- n(this, "mousedownHeader", !1);
4553
4593
  n(this, "ctx");
4554
- n(this, "adjustPositionX", "");
4555
- n(this, "adjustPositionY", "");
4556
- n(this, "timerX", 0);
4557
- // 水平滚动定时器
4558
- n(this, "timerY", 0);
4559
4594
  this.ctx = t, this.init();
4560
4595
  }
4561
4596
  init() {
@@ -4563,9 +4598,8 @@ class Oe {
4563
4598
  this.moveFocus(t);
4564
4599
  }), this.ctx.on(
4565
4600
  "mousemove",
4566
- j((t) => {
4567
- const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = this.ctx.isTarget(t) && i > 0 && i < this.ctx.body.visibleWidth && e > this.ctx.header.visibleHeight && e < this.ctx.header.visibleHeight + this.ctx.body.visibleHeight;
4568
- (this.ctx.selectorMove || this.ctx.autofillMove) && (!s && !this.mousedownHeader ? this.startAdjustPosition(t) : this.stopAdjustPosition());
4601
+ Z((t) => {
4602
+ this.ctx.selectorMove && this.ctx.startAdjustPosition(t);
4569
4603
  }, 100)
4570
4604
  ), this.ctx.on("cellHoverChange", (t) => {
4571
4605
  if (!this.ctx.autofillMove) {
@@ -4584,7 +4618,7 @@ class Oe {
4584
4618
  }
4585
4619
  window.getComputedStyle(e.target).userSelect !== "text" && e.preventDefault(), this.isMultipleRow = !1, this.click(e.shiftKey), this.ctx.emit("selectorClick", t);
4586
4620
  }), this.ctx.on("mouseup", () => {
4587
- this.mousedownHeader = !1;
4621
+ this.ctx.selectorMove = !1, this.ctx.stopAdjustPosition();
4588
4622
  const t = setTimeout(() => {
4589
4623
  this.ctx.adjustPositioning = !1, clearTimeout(t);
4590
4624
  }, 0);
@@ -4593,7 +4627,7 @@ class Oe {
4593
4627
  }), this.ctx.on("cellHeaderMousedown", (t, e) => {
4594
4628
  if (this.ctx.stageElement.style.cursor === "pointer" || this.ctx.isPointer)
4595
4629
  return;
4596
- window.getComputedStyle(e.target).userSelect !== "text" && e.preventDefault(), this.mousedownHeader = !0, this.selectCols(t);
4630
+ window.getComputedStyle(e.target).userSelect !== "text" && e.preventDefault(), this.selectCols(t);
4597
4631
  }), this.ctx.on("keydown", (t) => {
4598
4632
  if (!this.ctx.editing) {
4599
4633
  if (t.ctrlKey && t.code === "KeyV" || t.metaKey && t.code === "KeyV") {
@@ -4642,8 +4676,6 @@ class Oe {
4642
4676
  this.isCut = !0, this.copy();
4643
4677
  }), this.ctx.on("setSelectorCell", (t) => {
4644
4678
  this.ctx.setFocusCell(t), this.click();
4645
- }), this.ctx.on("mouseup", () => {
4646
- this.ctx.selectorMove = !1, this.stopAdjustPosition();
4647
4679
  });
4648
4680
  }
4649
4681
  setSelector(t, e) {
@@ -4667,14 +4699,14 @@ class Oe {
4667
4699
  SELECTOR_AREA_MAX_X_OFFSET: f,
4668
4700
  SELECTOR_AREA_MAX_Y_OFFSET: u
4669
4701
  } = this.ctx.config, x = a, w = l || this.ctx.maxColIndex - f, E = h, g = d || this.ctx.maxRowIndex - u;
4670
- let [m, y] = o, [p, R] = r;
4671
- if (m < x || y > w || p < E || R > g)
4702
+ let [m, y] = o, [p, b] = r;
4703
+ if (m < x || y > w || p < E || b > g)
4672
4704
  return;
4673
4705
  if (this.ctx.stageElement.focus({ preventScroll: !0 }), this.ctx.config.ENABLE_MERGE_CELL_LINK) {
4674
- const I = this.adjustMergeCells(o, r);
4675
- p = I.yArr[0], R = I.yArr[1], m = I.xArr[0], y = I.xArr[1], this.ctx.onlyMergeCell = I.onlyMergeCell;
4706
+ const R = this.adjustMergeCells(o, r);
4707
+ p = R.yArr[0], b = R.yArr[1], m = R.xArr[0], y = R.xArr[1], this.ctx.onlyMergeCell = R.onlyMergeCell;
4676
4708
  }
4677
- m === y && p === R ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, o = [Math.max(x, m), Math.min(w, y)], r = [Math.max(E, p), Math.min(g, R)];
4709
+ m === y && p === b ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, o = [Math.max(x, m), Math.min(w, y)], r = [Math.max(E, p), Math.min(g, b)];
4678
4710
  const { BEFORE_SET_SELECTOR_METHOD: C } = this.ctx.config;
4679
4711
  if (typeof C == "function") {
4680
4712
  const _ = C({
@@ -4686,12 +4718,18 @@ class Oe {
4686
4718
  return;
4687
4719
  o = _.xArr, r = _.yArr;
4688
4720
  }
4689
- this.ctx.selector.xArr = o, this.ctx.selector.yArr = r, this.ctx.emit("setSelector", this.ctx.selector), this.ctx.emit("drawView");
4721
+ this.ctx.selector.xArr = o, this.ctx.selector.yArr = r, b === this.ctx.maxRowIndex && p === 0 ? this.ctx.selectColsIng = !0 : this.ctx.selectColsIng = !1, y === this.ctx.maxColIndex && m === 0 ? this.ctx.selectRowsIng = !0 : this.ctx.selectRowsIng = !1, this.ctx.emit("setSelector", this.ctx.selector), this.ctx.emit("drawView");
4690
4722
  }
4691
4723
  }
4692
4724
  adjustMergeCells(t, e) {
4693
4725
  var w;
4694
4726
  const [i, s] = e, [o, r] = t;
4727
+ if (s === this.ctx.maxRowIndex && i === 0 || r === this.ctx.maxColIndex && o === 0)
4728
+ return {
4729
+ xArr: t,
4730
+ yArr: e,
4731
+ onlyMergeCell: !1
4732
+ };
4695
4733
  let a = [], l = [];
4696
4734
  for (let E = 0; E <= e[1] - e[0]; E++)
4697
4735
  for (let g = 0; g <= t[1] - t[0]; g++) {
@@ -4921,18 +4959,18 @@ class Oe {
4921
4959
  }
4922
4960
  let g = [];
4923
4961
  for (let p = 0; p <= r.length - 1; p++) {
4924
- const R = r[p].length;
4925
- for (let C = 0; C <= R - 1; C++) {
4926
- const I = p + e, _ = C + i, v = r[p][C], S = this.ctx.database.getItemValueForRowIndexAndColIndex(
4927
- I,
4962
+ const b = r[p].length;
4963
+ for (let C = 0; C <= b - 1; C++) {
4964
+ const R = p + e, _ = C + i, T = r[p][C], S = this.ctx.database.getItemValueForRowIndexAndColIndex(
4965
+ R,
4928
4966
  _
4929
4967
  );
4930
4968
  if (S) {
4931
- const { rowKey: b, key: O } = S;
4932
- this.ctx.database.getReadonly(b, O) || (s.add(b), g.push({
4933
- rowKey: b,
4934
- key: O,
4935
- value: v,
4969
+ const { rowKey: I, key: v } = S;
4970
+ this.ctx.database.getReadonly(I, v) || (s.add(I), g.push({
4971
+ rowKey: I,
4972
+ key: v,
4973
+ value: T,
4936
4974
  row: {}
4937
4975
  //内部有设置
4938
4976
  }));
@@ -4945,23 +4983,23 @@ class Oe {
4945
4983
  this.ctx.selector.yArrCopy,
4946
4984
  !0
4947
4985
  // 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
4948
- ), R = g.map((C) => `${C.rowKey}-${C.key}`);
4986
+ ), b = g.map((C) => `${C.rowKey}-${C.key}`);
4949
4987
  p.forEach((C) => {
4950
- R.includes(`${C.rowKey}-${C.key}`) || g.unshift(C);
4988
+ b.includes(`${C.rowKey}-${C.key}`) || g.unshift(C);
4951
4989
  }), this.isCut = !1;
4952
4990
  }
4953
4991
  if (!g.length)
4954
4992
  return;
4955
4993
  const { BEFORE_PASTE_DATA_METHOD: m } = this.ctx.config;
4956
4994
  if (typeof m == "function") {
4957
- const p = m, R = g.map((C) => ({
4995
+ const p = m, b = g.map((C) => ({
4958
4996
  rowKey: C.rowKey,
4959
4997
  key: C.key,
4960
4998
  value: C.value,
4961
4999
  oldValue: this.ctx.database.getItemValue(C.rowKey, C.key),
4962
5000
  row: this.ctx.database.getRowDataItemForRowKey(C.rowKey)
4963
5001
  }));
4964
- if (g = await p(R, a, l, r), g && !g.length)
5002
+ if (g = await p(b, a, l, r), g && !g.length)
4965
5003
  return;
4966
5004
  }
4967
5005
  this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(g, !0);
@@ -5002,9 +5040,6 @@ class Oe {
5002
5040
  const h = [i, i], d = [s, s], f = this.getCell(s, i);
5003
5041
  f && (f.operation || this.isInSettingRange(f.rowIndex, f.colIndex) && (this.ctx.setFocusCell(f), this.setSelector(h, d), this.adjustBoundaryPosition(), this.ctx.emit("moveFocus", f), this.ctx.emit("draw")));
5004
5042
  }
5005
- stopAdjustPosition() {
5006
- this.adjustPositionX = "", this.adjustPositionY = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerY && (clearInterval(this.timerY), this.timerY = 0);
5007
- }
5008
5043
  // 判断是否在设置范围内
5009
5044
  isInSettingRange(t, e) {
5010
5045
  const {
@@ -5017,31 +5052,6 @@ class Oe {
5017
5052
  } = this.ctx.config, h = i, d = s || this.ctx.maxColIndex - a, f = o, u = r || this.ctx.maxRowIndex - l;
5018
5053
  return !(e < h || e > d || t < f || t > u);
5019
5054
  }
5020
- /**
5021
- * 调整滚动条位置,让到达边界时自动滚动
5022
- */
5023
- startAdjustPosition(t) {
5024
- const { offsetX: e, offsetY: i } = this.ctx.getOffset(t);
5025
- let s = "", o = "";
5026
- if (e < 0 ? s = "left" : e > this.ctx.body.visibleWidth && (s = "right"), i < this.ctx.header.visibleHeight ? o = "top" : i > this.ctx.header.visibleHeight + this.ctx.body.visibleHeight && (o = "bottom"), s && this.adjustPositionX !== s) {
5027
- this.adjustPositionX = s;
5028
- let a = 10 * (s === "left" ? -1 : 1);
5029
- this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
5030
- a *= 1.5;
5031
- const { scrollX: l } = this.ctx, h = l + a;
5032
- (h < 0 || h > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(h);
5033
- }, 100);
5034
- }
5035
- if (o && this.adjustPositionY !== o) {
5036
- this.adjustPositionY = o;
5037
- let a = 10 * (o === "top" ? -1 : 1);
5038
- this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
5039
- a *= 1.5;
5040
- const { scrollY: l } = this.ctx, h = l + a;
5041
- (h < 0 || h > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(h);
5042
- }, 100);
5043
- }
5044
- }
5045
5055
  /**
5046
5056
  * 调整滚动条位置,让焦点单元格始终出现在可视区域内
5047
5057
  */
@@ -5062,17 +5072,16 @@ class Oe {
5062
5072
  if (!i)
5063
5073
  return;
5064
5074
  w && this.ctx.onlyMergeCell && i.updateSpanInfo();
5065
- const { drawX: E, drawY: g, width: m, height: y, fixed: p } = i, R = o - E + 1, C = i.drawX + m - (e - s) + 1;
5066
- let I = r.height - g, _ = y;
5075
+ const { drawX: E, drawY: g, width: m, height: y, fixed: p } = i, b = o - E + 1, C = i.drawX + m - (e - s) + 1;
5076
+ let R = r.height - g, _ = y;
5067
5077
  _ > l.visibleHeight && (_ = l.visibleHeight);
5068
- let v = 0;
5069
- u && (x === "top" ? I = r.height + a.height - g : v = a.visibleHeight);
5070
- const S = g + _ - (t - v - f);
5071
- let b = h, O = d;
5072
- C > 0 && !p ? b = Math.floor(h + C) : R > 0 && !p && (b = Math.floor(h - R)), I > 0 ? O = Math.floor(d - I) : S > 0 && (O = Math.floor(d + S)), (Math.abs(h - b) > 2 || Math.abs(d - O) > 2) && (this.ctx.adjustPositioning = !0, this.ctx.setScroll(b, O), this.ctx.emit("adjustBoundaryPosition", i));
5078
+ let T = 0;
5079
+ u && (x === "top" ? R = r.height + a.height - g : T = a.visibleHeight);
5080
+ const S = g + _ - (t - T - f);
5081
+ let I = h, v = d;
5082
+ C > 0 && !p ? I = Math.floor(h + C) : b > 0 && !p && (I = Math.floor(h - b)), R > 0 ? v = Math.floor(d - R) : S > 0 && (v = Math.floor(d + S)), (Math.abs(h - I) > 2 || Math.abs(d - v) > 2) && (this.ctx.adjustPositioning = !0, this.ctx.setScroll(I, v), this.ctx.emit("adjustBoundaryPosition", i));
5073
5083
  }
5074
5084
  destroy() {
5075
- this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
5076
5085
  }
5077
5086
  }
5078
5087
  class Le {
@@ -5086,14 +5095,14 @@ class Le {
5086
5095
  if (this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default"), this.ctx.editing || !this.ctx.focusCell || !this.maxColRowCell)
5087
5096
  return;
5088
5097
  const { offsetX: e, offsetY: i } = this.ctx.getOffset(t), { colIndex: s, rowIndex: o, drawX: r, drawY: a, width: l, height: h } = this.maxColRowCell, d = 6, f = s === this.ctx.maxColIndex || o === this.ctx.maxRowIndex ? 0 : 2, u = r + l - d + f, x = a + h - d + f;
5089
- e > u && i > x && e < u + d && i < x + d && (this.ctx.stageElement.style.cursor = "crosshair");
5098
+ e > u && i > x && e < u + d && i < x + d && (this.ctx.stageElement.style.cursor = "crosshair"), this.ctx.autofillMove && this.ctx.startAdjustPosition(t);
5090
5099
  }), this.ctx.on("cellMouseenter", (t) => {
5091
5100
  const { xArr: e, yArr: i } = this.ctx.selector, s = e[1], o = i[1], { colIndex: r, rowIndex: a } = t;
5092
5101
  this.ctx.config.ENABLE_AUTOFILL && r === s && a === o && (this.maxColRowCell = t), this.mouseenter(t);
5093
5102
  }), this.ctx.on("mousedown", () => {
5094
5103
  this.ctx.stageElement.style.cursor === "crosshair" && this.setMousedown();
5095
5104
  }), this.ctx.on("mouseup", () => {
5096
- this.setMouseUp();
5105
+ this.setMouseUp(), this.ctx.stopAdjustPosition();
5097
5106
  });
5098
5107
  }
5099
5108
  /**
@@ -5134,20 +5143,20 @@ class Le {
5134
5143
  SELECTOR_AREA_MAX_X_OFFSET: u,
5135
5144
  SELECTOR_AREA_MAX_Y_OFFSET: x
5136
5145
  } = this.ctx.config, w = l, E = h || this.ctx.maxColIndex - u, g = d, m = f || this.ctx.maxRowIndex - x;
5137
- let [y, p] = r, [R, C] = a;
5138
- if (y < w || R < g)
5146
+ let [y, p] = r, [b, C] = a;
5147
+ if (y < w || b < g)
5139
5148
  return;
5140
- r = [Math.max(w, y), Math.min(E, p)], a = [Math.max(g, R), Math.min(m, C)];
5141
- const { BEFORE_SET_AUTOFILL_METHOD: I } = this.ctx.config;
5142
- if (typeof I == "function") {
5143
- const v = I({
5149
+ r = [Math.max(w, y), Math.min(E, p)], a = [Math.max(g, b), Math.min(m, C)];
5150
+ const { BEFORE_SET_AUTOFILL_METHOD: R } = this.ctx.config;
5151
+ if (typeof R == "function") {
5152
+ const T = R({
5144
5153
  focusCell: this.ctx.focusCell,
5145
5154
  xArr: r,
5146
5155
  yArr: a
5147
5156
  });
5148
- if (!v)
5157
+ if (!T)
5149
5158
  return;
5150
- r = v.xArr, a = v.yArr;
5159
+ r = T.xArr, a = T.yArr;
5151
5160
  }
5152
5161
  this.ctx.autofill.xArr = r, this.ctx.autofill.yArr = a, this.ctx.emit("setAutofill", this.ctx.autofill), this.ctx.emit("draw");
5153
5162
  }
@@ -5176,9 +5185,9 @@ class Le {
5176
5185
  for (let w = 0; w <= a[1] - a[0]; w++) {
5177
5186
  const E = w + a[0], g = x + l[0], m = s[x % r][w % o], y = this.ctx.database.getItemValueForRowIndexAndColIndex(g, E), p = `${g}-${E}`;
5178
5187
  if (y && !i.has(p)) {
5179
- const { rowKey: R, key: C } = y;
5180
- this.ctx.database.getReadonly(R, C) || (t.add(R), d.push({
5181
- rowKey: R,
5188
+ const { rowKey: b, key: C } = y;
5189
+ this.ctx.database.getReadonly(b, C) || (t.add(b), d.push({
5190
+ rowKey: b,
5182
5191
  key: C,
5183
5192
  value: m,
5184
5193
  row: {}
@@ -5221,12 +5230,12 @@ class Le {
5221
5230
  const q = Math.min, $ = Math.max, st = Math.round, B = (c) => ({
5222
5231
  x: c,
5223
5232
  y: c
5224
- }), Me = {
5233
+ }), Ae = {
5225
5234
  left: "right",
5226
5235
  right: "left",
5227
5236
  bottom: "top",
5228
5237
  top: "bottom"
5229
- }, Ae = {
5238
+ }, Me = {
5230
5239
  start: "end",
5231
5240
  end: "start"
5232
5241
  };
@@ -5266,7 +5275,7 @@ function Ne(c) {
5266
5275
  return [ft(c), t, ft(t)];
5267
5276
  }
5268
5277
  function ft(c) {
5269
- return c.replace(/start|end/g, (t) => Ae[t]);
5278
+ return c.replace(/start|end/g, (t) => Me[t]);
5270
5279
  }
5271
5280
  const Tt = ["left", "right"], Ot = ["right", "left"], ke = ["top", "bottom"], Xe = ["bottom", "top"];
5272
5281
  function Ye(c, t, e) {
@@ -5287,7 +5296,7 @@ function Be(c, t, e, i) {
5287
5296
  return s && (o = o.map((r) => r + "-" + s), t && (o = o.concat(o.map(ft)))), o;
5288
5297
  }
5289
5298
  function ot(c) {
5290
- return c.replace(/left|right|bottom|top/g, (t) => Me[t]);
5299
+ return c.replace(/left|right|bottom|top/g, (t) => Ae[t]);
5291
5300
  }
5292
5301
  function Ke(c) {
5293
5302
  return {
@@ -5394,7 +5403,7 @@ const We = async (c, t, e) => {
5394
5403
  } = a[E], {
5395
5404
  x: y,
5396
5405
  y: p,
5397
- data: R,
5406
+ data: b,
5398
5407
  reset: C
5399
5408
  } = await m({
5400
5409
  x: d,
@@ -5414,7 +5423,7 @@ const We = async (c, t, e) => {
5414
5423
  ...x,
5415
5424
  [g]: {
5416
5425
  ...x[g],
5417
- ...R
5426
+ ...b
5418
5427
  }
5419
5428
  }, C && w <= 50 && (w++, typeof C == "object" && (C.placement && (u = C.placement), C.rects && (h = C.rects === !0 ? await r.getElementRects({
5420
5429
  reference: c,
@@ -5459,7 +5468,7 @@ async function Vt(c, t) {
5459
5468
  y: s,
5460
5469
  width: r.floating.width,
5461
5470
  height: r.floating.height
5462
- } : r.reference, p = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(a.floating)), R = await (o.isElement == null ? void 0 : o.isElement(p)) ? await (o.getScale == null ? void 0 : o.getScale(p)) || {
5471
+ } : r.reference, p = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(a.floating)), b = await (o.isElement == null ? void 0 : o.isElement(p)) ? await (o.getScale == null ? void 0 : o.getScale(p)) || {
5463
5472
  x: 1,
5464
5473
  y: 1
5465
5474
  } : {
@@ -5472,10 +5481,10 @@ async function Vt(c, t) {
5472
5481
  strategy: l
5473
5482
  }) : y);
5474
5483
  return {
5475
- top: (m.top - C.top + w.top) / R.y,
5476
- bottom: (C.bottom - m.bottom + w.bottom) / R.y,
5477
- left: (m.left - C.left + w.left) / R.x,
5478
- right: (C.right - m.right + w.right) / R.x
5484
+ top: (m.top - C.top + w.top) / b.y,
5485
+ bottom: (C.bottom - m.bottom + w.bottom) / b.y,
5486
+ left: (m.left - C.left + w.left) / b.x,
5487
+ right: (C.right - m.right + w.right) / b.x
5479
5488
  };
5480
5489
  }
5481
5490
  const Fe = (c) => ({
@@ -5499,17 +5508,17 @@ const Fe = (c) => ({
5499
5508
  const f = Ft(d), u = {
5500
5509
  x: e,
5501
5510
  y: i
5502
- }, x = Et(s), w = wt(x), E = await r.getDimensions(h), g = x === "y", m = g ? "top" : "left", y = g ? "bottom" : "right", p = g ? "clientHeight" : "clientWidth", R = o.reference[w] + o.reference[x] - u[x] - o.floating[w], C = u[x] - o.reference[x], I = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(h));
5503
- let _ = I ? I[p] : 0;
5504
- (!_ || !await (r.isElement == null ? void 0 : r.isElement(I))) && (_ = a.floating[p] || o.floating[w]);
5505
- const v = R / 2 - C / 2, S = _ / 2 - E[w] / 2 - 1, b = q(f[m], S), O = q(f[y], S), T = b, M = _ - E[w] - O, L = _ / 2 - E[w] / 2 + v, A = dt(T, L, M), D = !l.arrow && tt(s) != null && L !== A && o.reference[w] / 2 - (L < T ? b : O) - E[w] / 2 < 0, N = D ? L < T ? L - T : L - M : 0;
5511
+ }, x = Et(s), w = wt(x), E = await r.getDimensions(h), g = x === "y", m = g ? "top" : "left", y = g ? "bottom" : "right", p = g ? "clientHeight" : "clientWidth", b = o.reference[w] + o.reference[x] - u[x] - o.floating[w], C = u[x] - o.reference[x], R = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(h));
5512
+ let _ = R ? R[p] : 0;
5513
+ (!_ || !await (r.isElement == null ? void 0 : r.isElement(R))) && (_ = a.floating[p] || o.floating[w]);
5514
+ const T = b / 2 - C / 2, S = _ / 2 - E[w] / 2 - 1, I = q(f[m], S), v = q(f[y], S), O = I, A = _ - E[w] - v, L = _ / 2 - E[w] / 2 + T, M = dt(O, L, A), D = !l.arrow && tt(s) != null && L !== M && o.reference[w] / 2 - (L < O ? I : v) - E[w] / 2 < 0, H = D ? L < O ? L - O : L - A : 0;
5506
5515
  return {
5507
- [x]: u[x] + N,
5516
+ [x]: u[x] + H,
5508
5517
  data: {
5509
- [x]: A,
5510
- centerOffset: L - A - N,
5518
+ [x]: M,
5519
+ centerOffset: L - M - H,
5511
5520
  ...D && {
5512
- alignmentOffset: N
5521
+ alignmentOffset: H
5513
5522
  }
5514
5523
  },
5515
5524
  reset: D
@@ -5539,47 +5548,47 @@ const Fe = (c) => ({
5539
5548
  } = Q(c, t);
5540
5549
  if ((e = o.arrow) != null && e.alignmentOffset)
5541
5550
  return {};
5542
- const m = z(s), y = V(a), p = z(a) === a, R = await (l.isRTL == null ? void 0 : l.isRTL(h.floating)), C = u || (p || !E ? [ot(a)] : Ne(a)), I = w !== "none";
5543
- !u && I && C.push(...Be(a, E, w, R));
5544
- const _ = [a, ...C], v = await Vt(t, g), S = [];
5545
- let b = ((i = o.flip) == null ? void 0 : i.overflows) || [];
5546
- if (d && S.push(v[m]), f) {
5547
- const L = De(s, r, R);
5548
- S.push(v[L[0]], v[L[1]]);
5551
+ const m = z(s), y = V(a), p = z(a) === a, b = await (l.isRTL == null ? void 0 : l.isRTL(h.floating)), C = u || (p || !E ? [ot(a)] : Ne(a)), R = w !== "none";
5552
+ !u && R && C.push(...Be(a, E, w, b));
5553
+ const _ = [a, ...C], T = await Vt(t, g), S = [];
5554
+ let I = ((i = o.flip) == null ? void 0 : i.overflows) || [];
5555
+ if (d && S.push(T[m]), f) {
5556
+ const L = De(s, r, b);
5557
+ S.push(T[L[0]], T[L[1]]);
5549
5558
  }
5550
- if (b = [...b, {
5559
+ if (I = [...I, {
5551
5560
  placement: s,
5552
5561
  overflows: S
5553
5562
  }], !S.every((L) => L <= 0)) {
5554
- var O, T;
5555
- const L = (((O = o.flip) == null ? void 0 : O.index) || 0) + 1, A = _[L];
5556
- if (A && (!(f === "alignment" ? y !== V(A) : !1) || // We leave the current main axis only if every placement on that axis
5563
+ var v, O;
5564
+ const L = (((v = o.flip) == null ? void 0 : v.index) || 0) + 1, M = _[L];
5565
+ if (M && (!(f === "alignment" ? y !== V(M) : !1) || // We leave the current main axis only if every placement on that axis
5557
5566
  // overflows the main axis.
5558
- b.every((k) => V(k.placement) === y ? k.overflows[0] > 0 : !0)))
5567
+ I.every((k) => V(k.placement) === y ? k.overflows[0] > 0 : !0)))
5559
5568
  return {
5560
5569
  data: {
5561
5570
  index: L,
5562
- overflows: b
5571
+ overflows: I
5563
5572
  },
5564
5573
  reset: {
5565
- placement: A
5574
+ placement: M
5566
5575
  }
5567
5576
  };
5568
- let D = (T = b.filter((N) => N.overflows[0] <= 0).sort((N, k) => N.overflows[1] - k.overflows[1])[0]) == null ? void 0 : T.placement;
5577
+ let D = (O = I.filter((H) => H.overflows[0] <= 0).sort((H, k) => H.overflows[1] - k.overflows[1])[0]) == null ? void 0 : O.placement;
5569
5578
  if (!D)
5570
5579
  switch (x) {
5571
5580
  case "bestFit": {
5572
- var M;
5573
- const N = (M = b.filter((k) => {
5574
- if (I) {
5581
+ var A;
5582
+ const H = (A = I.filter((k) => {
5583
+ if (R) {
5575
5584
  const F = V(k.placement);
5576
5585
  return F === y || // Create a bias to the `y` side axis due to horizontal
5577
5586
  // reading directions favoring greater width.
5578
5587
  F === "y";
5579
5588
  }
5580
5589
  return !0;
5581
- }).map((k) => [k.placement, k.overflows.filter((F) => F > 0).reduce((F, se) => F + se, 0)]).sort((k, F) => k[1] - F[1])[0]) == null ? void 0 : M[0];
5582
- N && (D = N);
5590
+ }).map((k) => [k.placement, k.overflows.filter((F) => F > 0).reduce((F, se) => F + se, 0)]).sort((k, F) => k[1] - F[1])[0]) == null ? void 0 : A[0];
5591
+ H && (D = H);
5583
5592
  break;
5584
5593
  }
5585
5594
  case "initialPlacement":
@@ -5706,10 +5715,10 @@ const $e = function(c) {
5706
5715
  function nt() {
5707
5716
  return typeof window < "u";
5708
5717
  }
5709
- function Z(c) {
5718
+ function j(c) {
5710
5719
  return Pt(c) ? (c.nodeName || "").toLowerCase() : "#document";
5711
5720
  }
5712
- function H(c) {
5721
+ function N(c) {
5713
5722
  var t;
5714
5723
  return (c == null || (t = c.ownerDocument) == null ? void 0 : t.defaultView) || window;
5715
5724
  }
@@ -5718,16 +5727,16 @@ function W(c) {
5718
5727
  return (t = (Pt(c) ? c.ownerDocument : c.document) || window.document) == null ? void 0 : t.documentElement;
5719
5728
  }
5720
5729
  function Pt(c) {
5721
- return nt() ? c instanceof Node || c instanceof H(c).Node : !1;
5730
+ return nt() ? c instanceof Node || c instanceof N(c).Node : !1;
5722
5731
  }
5723
5732
  function X(c) {
5724
- return nt() ? c instanceof Element || c instanceof H(c).Element : !1;
5733
+ return nt() ? c instanceof Element || c instanceof N(c).Element : !1;
5725
5734
  }
5726
5735
  function K(c) {
5727
- return nt() ? c instanceof HTMLElement || c instanceof H(c).HTMLElement : !1;
5736
+ return nt() ? c instanceof HTMLElement || c instanceof N(c).HTMLElement : !1;
5728
5737
  }
5729
- function Mt(c) {
5730
- return !nt() || typeof ShadowRoot > "u" ? !1 : c instanceof ShadowRoot || c instanceof H(c).ShadowRoot;
5738
+ function At(c) {
5739
+ return !nt() || typeof ShadowRoot > "u" ? !1 : c instanceof ShadowRoot || c instanceof N(c).ShadowRoot;
5731
5740
  }
5732
5741
  const Ue = /* @__PURE__ */ new Set(["inline", "contents"]);
5733
5742
  function et(c) {
@@ -5739,9 +5748,9 @@ function et(c) {
5739
5748
  } = Y(c);
5740
5749
  return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !Ue.has(s);
5741
5750
  }
5742
- const Ze = /* @__PURE__ */ new Set(["table", "td", "th"]);
5743
- function je(c) {
5744
- return Ze.has(Z(c));
5751
+ const je = /* @__PURE__ */ new Set(["table", "td", "th"]);
5752
+ function Ze(c) {
5753
+ return je.has(j(c));
5745
5754
  }
5746
5755
  const qe = [":popover-open", ":modal"];
5747
5756
  function at(c) {
@@ -5774,10 +5783,10 @@ function pt() {
5774
5783
  }
5775
5784
  const ii = /* @__PURE__ */ new Set(["html", "body", "#document"]);
5776
5785
  function U(c) {
5777
- return ii.has(Z(c));
5786
+ return ii.has(j(c));
5778
5787
  }
5779
5788
  function Y(c) {
5780
- return H(c).getComputedStyle(c);
5789
+ return N(c).getComputedStyle(c);
5781
5790
  }
5782
5791
  function lt(c) {
5783
5792
  return X(c) ? {
@@ -5789,16 +5798,16 @@ function lt(c) {
5789
5798
  };
5790
5799
  }
5791
5800
  function P(c) {
5792
- if (Z(c) === "html")
5801
+ if (j(c) === "html")
5793
5802
  return c;
5794
5803
  const t = (
5795
5804
  // Step into the shadow DOM of the parent of a slotted node.
5796
5805
  c.assignedSlot || // DOM Element detected.
5797
5806
  c.parentNode || // ShadowRoot detected.
5798
- Mt(c) && c.host || // Fallback.
5807
+ At(c) && c.host || // Fallback.
5799
5808
  W(c)
5800
5809
  );
5801
- return Mt(t) ? t.host : t;
5810
+ return At(t) ? t.host : t;
5802
5811
  }
5803
5812
  function zt(c) {
5804
5813
  const t = P(c);
@@ -5807,7 +5816,7 @@ function zt(c) {
5807
5816
  function $t(c, t, e) {
5808
5817
  var i;
5809
5818
  t === void 0 && (t = []);
5810
- const s = zt(c), o = s === ((i = c.ownerDocument) == null ? void 0 : i.body), r = H(s);
5819
+ const s = zt(c), o = s === ((i = c.ownerDocument) == null ? void 0 : i.body), r = N(s);
5811
5820
  return o ? (xt(r), t.concat(r, r.visualViewport || [], et(s) ? s : [], [])) : t.concat(s, $t(s, []));
5812
5821
  }
5813
5822
  function xt(c) {
@@ -5842,29 +5851,29 @@ function G(c) {
5842
5851
  };
5843
5852
  }
5844
5853
  const si = /* @__PURE__ */ B(0);
5845
- function Zt(c) {
5846
- const t = H(c);
5854
+ function jt(c) {
5855
+ const t = N(c);
5847
5856
  return !pt() || !t.visualViewport ? si : {
5848
5857
  x: t.visualViewport.offsetLeft,
5849
5858
  y: t.visualViewport.offsetTop
5850
5859
  };
5851
5860
  }
5852
5861
  function oi(c, t, e) {
5853
- return t === void 0 && (t = !1), !e || t && e !== H(c) ? !1 : t;
5862
+ return t === void 0 && (t = !1), !e || t && e !== N(c) ? !1 : t;
5854
5863
  }
5855
5864
  function J(c, t, e, i) {
5856
5865
  t === void 0 && (t = !1), e === void 0 && (e = !1);
5857
5866
  const s = c.getBoundingClientRect(), o = Ut(c);
5858
5867
  let r = B(1);
5859
5868
  t && (i ? X(i) && (r = G(i)) : r = G(c));
5860
- const a = oi(o, e, i) ? Zt(o) : B(0);
5869
+ const a = oi(o, e, i) ? jt(o) : B(0);
5861
5870
  let l = (s.left + a.x) / r.x, h = (s.top + a.y) / r.y, d = s.width / r.x, f = s.height / r.y;
5862
5871
  if (o) {
5863
- const u = H(o), x = i && X(i) ? H(i) : i;
5872
+ const u = N(o), x = i && X(i) ? N(i) : i;
5864
5873
  let w = u, E = xt(w);
5865
5874
  for (; E && i && x !== w; ) {
5866
- const g = G(E), m = E.getBoundingClientRect(), y = Y(E), p = m.left + (E.clientLeft + parseFloat(y.paddingLeft)) * g.x, R = m.top + (E.clientTop + parseFloat(y.paddingTop)) * g.y;
5867
- l *= g.x, h *= g.y, d *= g.x, f *= g.y, l += p, h += R, w = H(E), E = xt(w);
5875
+ const g = G(E), m = E.getBoundingClientRect(), y = Y(E), p = m.left + (E.clientLeft + parseFloat(y.paddingLeft)) * g.x, b = m.top + (E.clientTop + parseFloat(y.paddingTop)) * g.y;
5876
+ l *= g.x, h *= g.y, d *= g.x, f *= g.y, l += p, h += b, w = N(E), E = xt(w);
5868
5877
  }
5869
5878
  }
5870
5879
  return rt({
@@ -5878,7 +5887,7 @@ function yt(c, t) {
5878
5887
  const e = lt(c).scrollLeft;
5879
5888
  return t ? t.left + e : J(W(c)).left + e;
5880
5889
  }
5881
- function jt(c, t, e) {
5890
+ function Zt(c, t, e) {
5882
5891
  e === void 0 && (e = !1);
5883
5892
  const i = c.getBoundingClientRect(), s = i.left + t.scrollLeft - (e ? 0 : (
5884
5893
  // RTL <body> scrollbar.
@@ -5904,11 +5913,11 @@ function ri(c) {
5904
5913
  scrollTop: 0
5905
5914
  }, h = B(1);
5906
5915
  const d = B(0), f = K(i);
5907
- if ((f || !f && !o) && ((Z(i) !== "body" || et(r)) && (l = lt(i)), K(i))) {
5916
+ if ((f || !f && !o) && ((j(i) !== "body" || et(r)) && (l = lt(i)), K(i))) {
5908
5917
  const x = J(i);
5909
5918
  h = G(i), d.x = x.x + i.clientLeft, d.y = x.y + i.clientTop;
5910
5919
  }
5911
- const u = r && !f && !o ? jt(r, l, !0) : B(0);
5920
+ const u = r && !f && !o ? Zt(r, l, !0) : B(0);
5912
5921
  return {
5913
5922
  width: e.width * h.x,
5914
5923
  height: e.height * h.y,
@@ -5931,7 +5940,7 @@ function ai(c) {
5931
5940
  };
5932
5941
  }
5933
5942
  function li(c, t) {
5934
- const e = H(c), i = W(c), s = e.visualViewport;
5943
+ const e = N(c), i = W(c), s = e.visualViewport;
5935
5944
  let o = i.clientWidth, r = i.clientHeight, a = 0, l = 0;
5936
5945
  if (s) {
5937
5946
  o = s.width, r = s.height;
@@ -5955,7 +5964,7 @@ function ci(c, t) {
5955
5964
  y: h
5956
5965
  };
5957
5966
  }
5958
- function At(c, t, e) {
5967
+ function Mt(c, t, e) {
5959
5968
  let i;
5960
5969
  if (t === "viewport")
5961
5970
  i = li(c, e);
@@ -5964,7 +5973,7 @@ function At(c, t, e) {
5964
5973
  else if (X(t))
5965
5974
  i = ci(t, e);
5966
5975
  else {
5967
- const s = Zt(c);
5976
+ const s = jt(c);
5968
5977
  i = {
5969
5978
  x: t.x - s.x,
5970
5979
  y: t.y - s.y,
@@ -5982,7 +5991,7 @@ function di(c, t) {
5982
5991
  const e = t.get(c);
5983
5992
  if (e)
5984
5993
  return e;
5985
- let i = $t(c, []).filter((a) => X(a) && Z(a) !== "body"), s = null;
5994
+ let i = $t(c, []).filter((a) => X(a) && j(a) !== "body"), s = null;
5986
5995
  const o = Y(c).position === "fixed";
5987
5996
  let r = o ? P(c) : c;
5988
5997
  for (; X(r) && !U(r); ) {
@@ -5999,9 +6008,9 @@ function fi(c) {
5999
6008
  strategy: s
6000
6009
  } = c;
6001
6010
  const r = [...e === "clippingAncestors" ? at(t) ? [] : di(t, this._c) : [].concat(e), i], a = r[0], l = r.reduce((h, d) => {
6002
- const f = At(t, d, s);
6011
+ const f = Mt(t, d, s);
6003
6012
  return h.top = $(f.top, h.top), h.right = q(f.right, h.right), h.bottom = q(f.bottom, h.bottom), h.left = $(f.left, h.left), h;
6004
- }, At(t, a, s));
6013
+ }, Mt(t, a, s));
6005
6014
  return {
6006
6015
  width: l.right - l.left,
6007
6016
  height: l.bottom - l.top,
@@ -6030,12 +6039,12 @@ function ui(c, t, e) {
6030
6039
  l.x = yt(s);
6031
6040
  }
6032
6041
  if (i || !i && !o)
6033
- if ((Z(t) !== "body" || et(s)) && (a = lt(t)), i) {
6042
+ if ((j(t) !== "body" || et(s)) && (a = lt(t)), i) {
6034
6043
  const x = J(t, !0, o, t);
6035
6044
  l.x = x.x + t.clientLeft, l.y = x.y + t.clientTop;
6036
6045
  } else s && h();
6037
6046
  o && !i && s && h();
6038
- const d = s && !i && !o ? jt(s, a) : B(0), f = r.left + a.scrollLeft - l.x - d.x, u = r.top + a.scrollTop - l.y - d.y;
6047
+ const d = s && !i && !o ? Zt(s, a) : B(0), f = r.left + a.scrollLeft - l.x - d.x, u = r.top + a.scrollTop - l.y - d.y;
6039
6048
  return {
6040
6049
  x: f,
6041
6050
  y: u,
@@ -6055,7 +6064,7 @@ function Ht(c, t) {
6055
6064
  return W(c) === e && (e = e.ownerDocument.body), e;
6056
6065
  }
6057
6066
  function Jt(c, t) {
6058
- const e = H(c);
6067
+ const e = N(c);
6059
6068
  if (at(c))
6060
6069
  return e;
6061
6070
  if (!K(c)) {
@@ -6068,7 +6077,7 @@ function Jt(c, t) {
6068
6077
  return e;
6069
6078
  }
6070
6079
  let i = Ht(c, t);
6071
- for (; i && je(i) && ht(i); )
6080
+ for (; i && Ze(i) && ht(i); )
6072
6081
  i = Ht(i, t);
6073
6082
  return i && U(i) && ht(i) && !mt(i) ? e : i || ei(c) || e;
6074
6083
  }
@@ -6454,7 +6463,7 @@ class bi {
6454
6463
  n(this, "ctx");
6455
6464
  n(this, "observer");
6456
6465
  this.ctx = t, this.observer = new MutationObserver(
6457
- j(() => {
6466
+ Z(() => {
6458
6467
  const e = this.ctx.overlayerElement.querySelectorAll('[data-auto-height="true"]'), i = /* @__PURE__ */ new Map();
6459
6468
  e.forEach((r) => {
6460
6469
  const a = Number(r.getAttribute("data-row-index")), l = Number(r.getAttribute("data-col-index"));
@@ -6668,7 +6677,7 @@ class bi {
6668
6677
  };
6669
6678
  }
6670
6679
  }
6671
- class Ri {
6680
+ class Ii {
6672
6681
  constructor(t) {
6673
6682
  n(this, "ctx");
6674
6683
  n(this, "contextMenuEl");
@@ -6754,7 +6763,7 @@ class Ri {
6754
6763
  this.contextMenuEl.remove();
6755
6764
  }
6756
6765
  }
6757
- class Ii {
6766
+ class Ri {
6758
6767
  constructor(t) {
6759
6768
  n(this, "ctx");
6760
6769
  n(this, "loadingEl");
@@ -6808,9 +6817,9 @@ class Ti {
6808
6817
  o,
6809
6818
  r
6810
6819
  );
6811
- this.ctx = new Ie(a, this.options), this.header = new _e(this.ctx), this.footer = new Te(this.ctx), this.body = new ve(this.ctx), this.scroller = new Se(this.ctx), this.selector = new Oe(this.ctx), this.autofill = new Le(this.ctx), this.tooltip = new pi(this.ctx), this.empty = new Ci(this.ctx), this.editor = new yi(this.ctx), this.overlayer = new bi(this.ctx), this.contextMenu = new Ri(this.ctx), this.loading = new Ii(this.ctx), this.ctx.on(
6820
+ this.ctx = new Re(a, this.options), this.header = new _e(this.ctx), this.footer = new Te(this.ctx), this.body = new ve(this.ctx), this.scroller = new Se(this.ctx), this.selector = new Oe(this.ctx), this.autofill = new Le(this.ctx), this.tooltip = new pi(this.ctx), this.empty = new Ci(this.ctx), this.editor = new yi(this.ctx), this.overlayer = new bi(this.ctx), this.contextMenu = new Ii(this.ctx), this.loading = new Ri(this.ctx), this.ctx.on(
6812
6821
  "draw",
6813
- j(
6822
+ Z(
6814
6823
  () => {
6815
6824
  this.draw();
6816
6825
  },
@@ -6818,7 +6827,7 @@ class Ti {
6818
6827
  )
6819
6828
  ), this.ctx.on(
6820
6829
  "drawView",
6821
- j(
6830
+ Z(
6822
6831
  () => {
6823
6832
  this.draw(!0);
6824
6833
  },