e-virt-table 1.2.28 → 1.2.30

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
@@ -8,50 +8,50 @@ class re {
8
8
  this.rules = t;
9
9
  }
10
10
  validate(t) {
11
- const e = [], { column: i, row: s, key: o, rowKey: r, colIndex: a, rowIndex: l, value: h, field: d, fieldValue: f } = t;
11
+ const e = [], { column: i, row: s, key: o, rowKey: r, colIndex: a, rowIndex: h, value: l, field: d, fieldValue: f } = t;
12
12
  Array.isArray(this.rules) || (this.rules = [this.rules]);
13
13
  for (const u of this.rules) {
14
14
  if (u.validator) {
15
15
  const x = {
16
16
  field: d,
17
17
  fieldValue: f,
18
- value: h,
18
+ value: l,
19
19
  column: i,
20
20
  colIndex: a,
21
- rowIndex: l,
21
+ rowIndex: h,
22
22
  row: s,
23
23
  key: o,
24
24
  rowKey: r,
25
25
  ...u
26
26
  };
27
- u.validator(x, h, (w) => {
27
+ u.validator(x, l, (w) => {
28
28
  w && e.push({
29
29
  ...x,
30
30
  message: w
31
31
  });
32
32
  });
33
33
  }
34
- if (!u.required && (h == null || h === ""))
34
+ if (!u.required && (l == null || l === ""))
35
35
  return e;
36
- u.pattern && !u.pattern.test(h) && e.push({
37
- value: h,
36
+ u.pattern && !u.pattern.test(l) && e.push({
37
+ value: l,
38
38
  column: i,
39
39
  row: s,
40
40
  key: o,
41
41
  rowKey: r,
42
42
  colIndex: a,
43
- rowIndex: l,
43
+ rowIndex: h,
44
44
  field: d,
45
45
  fieldValue: f,
46
46
  message: u.message || `${o} is pattern validation error`
47
- }), u.required && (h == null || h === "") && e.push({
48
- value: h,
47
+ }), u.required && (l == null || l === "") && e.push({
48
+ value: l,
49
49
  column: i,
50
50
  row: s,
51
51
  key: o,
52
52
  rowKey: r,
53
53
  colIndex: a,
54
- rowIndex: l,
54
+ rowIndex: h,
55
55
  field: d,
56
56
  fieldValue: f,
57
57
  message: u.message || `${o} is required`
@@ -60,19 +60,19 @@ class re {
60
60
  return e;
61
61
  }
62
62
  }
63
- function At() {
63
+ function Ht() {
64
64
  return "xxxxxxxxxxxxxxxxxx".replace(/[x]/g, function(c) {
65
65
  const t = Math.random() * 16 | 0;
66
66
  return (c === "x" ? t : t & 3 | 8).toString(16);
67
67
  });
68
68
  }
69
- function Ht(c, t) {
69
+ function Z(c, t) {
70
70
  let e = 0, i;
71
71
  return function(...s) {
72
- const o = (/* @__PURE__ */ new Date()).getTime(), r = o - e;
73
- !e || r >= t ? (c.apply(this, s), e = o) : i || (i = setTimeout(() => {
72
+ const o = (/* @__PURE__ */ new Date()).getTime(), r = o - e, a = typeof t == "function" ? t() : t;
73
+ !e || r >= a ? (c.apply(this, s), e = o) : i || (i = setTimeout(() => {
74
74
  c.apply(this, s), e = (/* @__PURE__ */ new Date()).getTime(), i = void 0;
75
- }, t - r));
75
+ }, a - r));
76
76
  };
77
77
  }
78
78
  function Dt(c = []) {
@@ -115,32 +115,32 @@ function Nt(c = [], t = 1, e = 0) {
115
115
  };
116
116
  });
117
117
  }
118
- function et(c = []) {
118
+ function it(c = []) {
119
119
  let t = [];
120
120
  return c.forEach((e) => {
121
- e.children ? t = t.concat(et(e.children)) : t.push(e);
121
+ e.children ? t = t.concat(it(e.children)) : t.push(e);
122
122
  }), t;
123
123
  }
124
- const yt = /^(\r\n|\n\r|\r|\n)/, ae = /^[^\t\r\n]+/, Ct = /^\t/;
125
- function le(c) {
124
+ const Ct = /^(\r\n|\n\r|\r|\n)/, ae = /^[^\t\r\n]+/, bt = /^\t/;
125
+ function he(c) {
126
126
  let t = [[""]];
127
127
  if (c.length === 0)
128
128
  return t;
129
129
  let e = 0, i = 0, s;
130
130
  for (; c.length > 0 && s !== c.length; )
131
- if (s = c.length, c.match(Ct))
132
- c = c.replace(Ct, ""), e += 1, t[i][e] = "";
133
- else if (c.match(yt))
134
- c = c.replace(yt, ""), e = 0, i += 1, t[i] = [""];
131
+ if (s = c.length, c.match(bt))
132
+ c = c.replace(bt, ""), e += 1, t[i][e] = "";
133
+ else if (c.match(Ct))
134
+ c = c.replace(Ct, ""), e = 0, i += 1, t[i] = [""];
135
135
  else {
136
136
  let o = "";
137
137
  if (c.startsWith('"')) {
138
138
  let r = 0, a = !0;
139
139
  for (; a; ) {
140
- const l = c.slice(0, 1);
141
- l === '"' && (r += 1), o += l, c = c.slice(1), (c.length === 0 || c.match(/^[\t\r\n]/) && r % 2 === 0) && (a = !1);
140
+ const h = c.slice(0, 1);
141
+ h === '"' && (r += 1), o += h, c = c.slice(1), (c.length === 0 || c.match(/^[\t\r\n]/) && r % 2 === 0) && (a = !1);
142
142
  }
143
- o = o.replace(/^"/, "").replace(/"$/, "").replace(/["]*/g, (l) => new Array(Math.floor(l.length / 2)).fill('"').join(""));
143
+ o = o.replace(/^"/, "").replace(/"$/, "").replace(/["]*/g, (h) => new Array(Math.floor(h.length / 2)).fill('"').join(""));
144
144
  } else {
145
145
  const r = c.match(ae);
146
146
  o = r ? r[0] : "", c = c.slice(o.length);
@@ -149,7 +149,7 @@ function le(c) {
149
149
  }
150
150
  return Array.isArray(t) && t.length > 1 && t[t.length - 1].length === 1 && t[t.length - 1][0] === "" && (t = t.slice(0, t.length - 1)), t;
151
151
  }
152
- function he(c) {
152
+ function le(c) {
153
153
  let t, e, i, s, o = "", r;
154
154
  for (t = 0, e = c.length; t < e; t += 1) {
155
155
  for (s = c[t].length, i = 0; i < s; i += 1)
@@ -167,8 +167,8 @@ function kt(c, t, e = []) {
167
167
  if (r === 0)
168
168
  s.push(1);
169
169
  else {
170
- const a = e.reduce((h, d) => `${h}${o[d] ?? ""}`, "") || o[t], l = e.reduce((h, d) => `${h}${c[r - 1][d] ?? ""}`, "") || c[r - 1][t];
171
- a === l ? (s[i] += 1, s.push(0)) : (s.push(1), i = r);
170
+ const a = e.reduce((l, d) => `${l}${o[d] ?? ""}`, "") || o[t], h = e.reduce((l, d) => `${l}${c[r - 1][d] ?? ""}`, "") || c[r - 1][t];
171
+ a === h ? (s[i] += 1, s.push(0)) : (s.push(1), i = r);
172
172
  }
173
173
  }), s;
174
174
  }
@@ -214,7 +214,7 @@ function fe(c, t = document.documentElement) {
214
214
  const e = c.startsWith("--") ? c : `--${c}`;
215
215
  return getComputedStyle(t).getPropertyValue(e).trim();
216
216
  }
217
- function bt(c) {
217
+ function Rt(c) {
218
218
  if (!c) return /* @__PURE__ */ new Date(0);
219
219
  if (typeof c == "number")
220
220
  return new Date(c);
@@ -252,24 +252,24 @@ function bt(c) {
252
252
  if (o) {
253
253
  const r = o.slice(1).map(Number);
254
254
  if (s.source.includes("YYYY-MM-DD") || s.source.includes("YYYY/MM/DD") || s.source.includes("YYYY.MM.DD")) {
255
- const [a, l, h, d = 0, f = 0, u = 0] = r;
256
- return new Date(a, l - 1, h, d, f, u);
255
+ const [a, h, l, d = 0, f = 0, u = 0] = r;
256
+ return new Date(a, h - 1, l, d, f, u);
257
257
  } else if (s.source.includes("DD-MM-YYYY") || s.source.includes("DD/MM/YYYY") || s.source.includes("DD.MM.YYYY")) {
258
- const [a, l, h, d = 0, f = 0, u = 0] = r;
259
- return new Date(h, l - 1, a, d, f, u);
258
+ const [a, h, l, d = 0, f = 0, u = 0] = r;
259
+ return new Date(l, h - 1, a, d, f, u);
260
260
  } else if (s.source.includes("MM-DD-YYYY") || s.source.includes("MM/DD/YYYY") || s.source.includes("MM.DD.YYYY")) {
261
- const [a, l, h, d = 0, f = 0, u = 0] = r;
262
- return new Date(h, a - 1, l, d, f, u);
261
+ const [a, h, l, d = 0, f = 0, u = 0] = r;
262
+ return new Date(l, a - 1, h, d, f, u);
263
263
  } else if (s.source.includes("YYYYMMDD")) {
264
- const [a, l, h] = r;
265
- return new Date(a, l - 1, h);
264
+ const [a, h, l] = r;
265
+ return new Date(a, h - 1, l);
266
266
  }
267
267
  }
268
268
  }
269
269
  return /* @__PURE__ */ new Date(NaN);
270
270
  }
271
271
  function xe(c, t) {
272
- const e = bt(c), i = bt(t);
272
+ const e = Rt(c), i = Rt(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 Yt {
@@ -318,9 +318,9 @@ class Yt {
318
318
  getRightFixedX() {
319
319
  }
320
320
  }
321
- class xt extends Yt {
322
- constructor(e, i, s, o, r, a, l, h, d, f = "body") {
323
- super(e, o, r, a, l, f, h.fixed);
321
+ class ut extends Yt {
322
+ constructor(e, i, s, o, r, a, h, l, d, f = "body") {
323
+ super(e, o, r, a, h, f, l.fixed);
324
324
  n(this, "formatter");
325
325
  n(this, "formatterFooter");
326
326
  n(this, "hoverIconName", "");
@@ -401,7 +401,7 @@ class xt extends Yt {
401
401
  n(this, "overflowTooltipMaxWidth", 500);
402
402
  n(this, "overflowTooltipPlacement", "top");
403
403
  n(this, "maxLineClamp", "auto");
404
- 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 || 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.update();
404
+ this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = l.key, this.type = l.type || "", this.editorType = l.editorType || "text", this.selectorCellValueType = l.selectorCellValueType || this.ctx.config.SELECTOR_CELL_VALUE_TYPE || "value", this.editorProps = l.editorProps || {}, this.cellType = f, this.align = l.align || this.ctx.config.COLUMNS_ALIGN, this.verticalAlign = l.verticalAlign || this.ctx.config.COLUMNS_VERTICAL_ALIGN, this.fixed = l.fixed, this.level = l.level || 0, this.operation = l.operation || !1, this.column = l, this.rules = l.rules || [], this.row = d, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = l.render, this.overflowTooltipShow = l.overflowTooltipShow !== !1, this.autoRowHeight = l.autoRowHeight !== void 0 ? l.autoRowHeight : this.ctx.config.AUTO_ROW_HEIGHT, this.overflowTooltipMaxWidth = l.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = l.overflowTooltipPlacement || "top", this.renderFooter = l.renderFooter, this.hoverIconName = l.hoverIconName, this.formatter = l.formatter, this.formatterFooter = l.formatterFooter, this.maxLineClamp = l.maxLineClamp || "auto", this.update();
405
405
  }
406
406
  setWidthHeight(e, i) {
407
407
  this.width = e, this.height = i;
@@ -427,8 +427,8 @@ class xt extends Yt {
427
427
  rowspan: o = 1,
428
428
  relationRowKeys: r,
429
429
  relationColKeys: a,
430
- mergeRow: l = !1,
431
- mergeCol: h = !1
430
+ mergeRow: h = !1,
431
+ mergeCol: l = !1
432
432
  } = i({
433
433
  row: this.row,
434
434
  rowIndex: this.rowIndex,
@@ -441,7 +441,7 @@ class xt extends Yt {
441
441
  visibleLeafColumns: this.ctx.header.visibleLeafColumns,
442
442
  rows: this.ctx.body.data
443
443
  }) || {};
444
- Array.isArray(r) && r.length > 0 ? this.relationRowKeys = r : this.relationRowKeys = [this.key], Array.isArray(a) && a.length > 0 ? this.relationColKeys = a : this.relationColKeys = [this.key], this.mergeCol = h, this.mergeRow = l, this.colspan = s, this.rowspan = o, this.visibleWidth = this.getWidthByColIndexColSpan(this.colIndex, this.colspan), this.visibleHeight = this.ctx.database.getHeightByRowIndexRowSpan(this.rowIndex, this.rowspan);
444
+ Array.isArray(r) && r.length > 0 ? this.relationRowKeys = r : this.relationRowKeys = [this.key], Array.isArray(a) && a.length > 0 ? this.relationColKeys = a : this.relationColKeys = [this.key], this.mergeCol = l, this.mergeRow = h, this.colspan = s, this.rowspan = o, this.visibleWidth = this.getWidthByColIndexColSpan(this.colIndex, this.colspan), this.visibleHeight = this.ctx.database.getHeightByRowIndexRowSpan(this.rowIndex, this.rowspan);
445
445
  }
446
446
  }
447
447
  updateSpanInfo() {
@@ -509,8 +509,9 @@ class xt extends Yt {
509
509
  */
510
510
  updateStyle() {
511
511
  this.autoRowHeight && (this.domDataset = {
512
- autoHeight: !0,
513
- rowIndex: this.rowIndex
512
+ "data-auto-height": !0,
513
+ "data-row-index": this.rowIndex,
514
+ "data-col-index": this.colIndex
514
515
  }), this.style = this.getOverlayerViewsStyle();
515
516
  }
516
517
  updateTree() {
@@ -518,15 +519,15 @@ class xt extends Yt {
518
519
  let o, r = 0, a = "";
519
520
  if (!(["tree", "selection-tree", "tree-selection"].includes(this.type) && s === "body"))
520
521
  return;
521
- const l = this.ctx.database.getRowForRowKey(i), { expand: h = !1, hasChildren: d = !1, expandLoading: f = !1, level: u = 0 } = l || {};
522
- this.rowExpand = h, this.rowHasChildren = d;
522
+ const h = this.ctx.database.getRowForRowKey(i), { expand: l = !1, hasChildren: d = !1, expandLoading: f = !1, level: u = 0 } = h || {};
523
+ this.rowExpand = l, this.rowHasChildren = d;
523
524
  const { TREE_INDENT: x = 16, CHECKBOX_SIZE: w, TREE_ICON_SIZE: m } = this.ctx.config;
524
525
  if (r = u * x, f) {
525
526
  const I = this.ctx.icons.get("loading");
526
527
  a = "loading", o = I;
527
528
  } else if (d) {
528
- const I = this.ctx.icons.get("expand"), v = this.ctx.icons.get("shrink");
529
- o = h ? v : I, a = h ? "shrink" : "expand";
529
+ const I = this.ctx.icons.get("expand"), S = this.ctx.icons.get("shrink");
530
+ o = l ? S : I, a = l ? "shrink" : "expand";
530
531
  }
531
532
  let g = m, p = m, y = this.drawX;
532
533
  (this.align === "center" || this.align === "right") && (y = this.drawX + (this.visibleWidth - g - 2 * e) / 2, this.align = "left");
@@ -536,7 +537,7 @@ class xt extends Yt {
536
537
  drawTreeLine() {
537
538
  const { TREE_LINE: e, TREE_INDENT: i = 16, TREE_ICON_SIZE: s = 16, TREE_LINE_COLOR: o = "#e1e6eb" } = this.ctx.config;
538
539
  if (!e || this.cellType !== "body" || !["tree", "selection-tree", "tree-selection"].includes(this.type) || this.rowspan === 0 || this.colspan === 0) return;
539
- const r = this.ctx.database.getRowForRowKey(this.rowKey) || {}, a = r.level ?? 0, l = this.drawTreeImageX + this.drawTreeImageWidth / 2, h = this.drawTreeImageY + this.drawTreeImageHeight / 2;
540
+ const r = this.ctx.database.getRowForRowKey(this.rowKey) || {}, a = r.level ?? 0, h = this.drawTreeImageX + this.drawTreeImageWidth / 2, l = this.drawTreeImageY + this.drawTreeImageHeight / 2;
540
541
  let d = this.drawTreeImageX - a * i;
541
542
  const f = Array.isArray(r.parentRowKeys) ? r.parentRowKeys : [];
542
543
  if (a > 0) {
@@ -551,7 +552,7 @@ class xt extends Yt {
551
552
  lineDashOffset: 0
552
553
  });
553
554
  }
554
- const u = Math.round(this.drawTreeImageX - i + s / 2), w = !!r.isLastChild ? h : this.drawY + this.visibleHeight;
555
+ const u = Math.round(this.drawTreeImageX - i + s / 2), w = !!r.isLastChild ? l : this.drawY + this.visibleHeight;
555
556
  this.ctx.paint.drawLine([u, this.drawY, u, w], {
556
557
  borderColor: o,
557
558
  borderWidth: 1,
@@ -559,7 +560,7 @@ class xt extends Yt {
559
560
  lineDashOffset: 0
560
561
  });
561
562
  const m = Math.round(d + (a - 1) * i + s / 2);
562
- this.ctx.paint.drawLine([m, h, l, h], {
563
+ this.ctx.paint.drawLine([m, l, h, l], {
563
564
  borderColor: o,
564
565
  borderWidth: 1,
565
566
  lineDash: [4, 4],
@@ -568,7 +569,7 @@ class xt extends Yt {
568
569
  }
569
570
  if (r.hasChildren && r.expand) {
570
571
  const u = this.drawTreeImageY + this.drawTreeImageHeight, x = this.drawY + this.visibleHeight;
571
- this.ctx.paint.drawLine([l, u, l, x], {
572
+ this.ctx.paint.drawLine([h, u, h, x], {
572
573
  borderColor: o,
573
574
  borderWidth: 1,
574
575
  lineDash: [4, 4],
@@ -584,8 +585,8 @@ class xt extends Yt {
584
585
  FOOTER_CELL_STYLE_METHOD: o,
585
586
  READONLY_TEXT_COLOR: r,
586
587
  BODY_TEXT_COLOR: a,
587
- FOOTER_TEXT_COLOR: l,
588
- FOOTER_BG_COLOR: h,
588
+ FOOTER_TEXT_COLOR: h,
589
+ FOOTER_BG_COLOR: l,
589
590
  HIGHLIGHT_SELECTED_ROW: d,
590
591
  HIGHLIGHT_SELECTED_ROW_COLOR: f,
591
592
  HIGHLIGHT_HOVER_ROW: u,
@@ -594,31 +595,31 @@ class xt extends Yt {
594
595
  STRIPE_COLOR: m
595
596
  } = this.ctx.config;
596
597
  if (this.cellType === "footer") {
597
- let v = h, _ = l;
598
+ let S = l, _ = h;
598
599
  if (typeof o == "function") {
599
- const S = o, { backgroundColor: b, color: O } = S({
600
+ const v = o, { backgroundColor: b, color: O } = v({
600
601
  row: this.row,
601
602
  rowIndex: this.rowIndex,
602
603
  colIndex: this.colIndex,
603
604
  column: this.column,
604
605
  value: this.getValue()
605
606
  }) || {};
606
- b && (v = b), O && (_ = O);
607
+ b && (S = b), O && (_ = O);
607
608
  }
608
- this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = v, this.drawTextColor = _;
609
+ this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = S, this.drawTextColor = _;
609
610
  return;
610
611
  }
611
612
  let g = "transparent";
612
613
  const p = this.ctx.hoverCell, y = this.ctx.currentCell;
613
614
  let E = this.rowIndex, R = this.rowIndex;
614
615
  if (this.rowspan !== 1 && (u || d)) {
615
- const v = this.getSpanInfo(), { yArr: _ } = v;
616
+ const S = this.getSpanInfo(), { yArr: _ } = S;
616
617
  E = _[0], R = _[1];
617
618
  }
618
619
  u && p && (p.rowKey === this.rowKey && (g = x), p.rowIndex >= E && p.rowIndex <= R && (g = x)), d && y && (y.rowKey === this.rowKey && (g = f), y.rowIndex >= E && y.rowIndex <= R && (g = f)), this.drawCellSkyBgColor = g;
619
620
  let C = e, I = a;
620
621
  if (this.ctx.database.getReadonly(this.rowKey, this.key) || (C = i, I = r), w && (this.rowIndex % 2 ? C = m : C = e), typeof s == "function") {
621
- const v = s, { backgroundColor: _, color: S } = v({
622
+ const S = s, { backgroundColor: _, color: v } = S({
622
623
  row: this.row,
623
624
  rowIndex: this.rowIndex,
624
625
  colIndex: this.colIndex,
@@ -626,60 +627,60 @@ class xt extends Yt {
626
627
  isHasChanged: this.isHasChanged,
627
628
  value: this.getValue()
628
629
  }) || {};
629
- _ && (C = _), S && (I = S);
630
+ _ && (C = _), v && (I = v);
630
631
  }
631
632
  this.drawCellBgColor = C, this.drawTextColor = I;
632
633
  }
633
634
  updateSelection() {
634
- const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: a, rowIndex: l, rowKey: h } = this;
635
+ const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: a, rowIndex: h, rowKey: l } = this;
635
636
  if (s === 0 || o === 0 || r === "footer" || !["index-selection", "selection", "selection-tree", "tree-selection"].includes(a))
636
637
  return;
637
- const d = this.ctx.database.getRowSelectable(h), { CHECKBOX_SIZE: f = 0, CELL_PADDING: u } = this.ctx.config;
638
+ const d = this.ctx.database.getRowSelectable(l), { CHECKBOX_SIZE: f = 0, CELL_PADDING: u } = this.ctx.config;
638
639
  let x = this.drawX + u;
639
640
  (this.align === "center" || this.align === "right") && (x = this.drawX + (e - f) / 2);
640
641
  let w = x, m = this.drawY + (i - f) / 2;
641
642
  if (a !== "selection-tree") {
642
643
  if (a === "tree-selection") {
643
- const { TREE_INDENT: y = 16, TREE_ICON_SIZE: E } = this.ctx.config, R = this.ctx.database.getRowForRowKey(h), { level: C = 0 } = R || {}, I = C * y;
644
+ const { TREE_INDENT: y = 16, TREE_ICON_SIZE: E } = this.ctx.config, R = this.ctx.database.getRowForRowKey(l), { level: C = 0 } = R || {}, I = C * y;
644
645
  w = x + E + I;
645
646
  }
646
647
  }
647
648
  let g = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck";
648
649
  if (a === "selection-tree" || a === "tree-selection") {
649
- const y = this.ctx.database.getTreeSelectionState(h);
650
+ const y = this.ctx.database.getTreeSelectionState(l);
650
651
  y.indeterminate && d ? (g = this.ctx.icons.get("checkbox-indeterminate"), p = "checkbox-indeterminate") : y.checked && d ? (g = this.ctx.icons.get("checkbox-check"), p = "checkbox-check") : !y.checked && d ? (g = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), p = "checkbox-disabled");
651
652
  } else {
652
- const y = this.ctx.database.getRowSelection(h);
653
+ const y = this.ctx.database.getRowSelection(l);
653
654
  y && d ? (g = this.ctx.icons.get("checkbox-check"), p = "checkbox-check") : y && !d ? (g = this.ctx.icons.get("checkbox-check-disabled"), p = "checkbox-check-disabled") : !y && d ? (g = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), p = "checkbox-disabled");
654
655
  }
655
- w + f + u > this.drawX + this.visibleWidth || m + f + u > this.drawY + this.visibleHeight || (a === "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === l || ["checkbox-disabled", "checkbox-check"].includes(p)) && (this.drawSelectionImageX = w, this.drawSelectionImageY = m, this.drawSelectionImageWidth = f, this.drawSelectionImageHeight = f, this.drawSelectionImageName = p, this.drawSelectionImageSource = g) : (this.drawSelectionImageX = w, this.drawSelectionImageY = m, this.drawSelectionImageWidth = f, this.drawSelectionImageHeight = f, this.drawSelectionImageName = p, this.drawSelectionImageSource = g));
656
+ w + f + u > this.drawX + this.visibleWidth || m + f + u > this.drawY + this.visibleHeight || (a === "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === h || ["checkbox-disabled", "checkbox-check"].includes(p)) && (this.drawSelectionImageX = w, this.drawSelectionImageY = m, this.drawSelectionImageWidth = f, this.drawSelectionImageHeight = f, this.drawSelectionImageName = p, this.drawSelectionImageSource = g) : (this.drawSelectionImageX = w, this.drawSelectionImageY = m, this.drawSelectionImageWidth = f, this.drawSelectionImageHeight = f, this.drawSelectionImageName = p, this.drawSelectionImageSource = g));
656
657
  }
657
658
  updateHoverIcon() {
658
659
  if (this.ctx.database.getReadonly(this.rowKey, this.key))
659
660
  return;
660
661
  const { BODY_CELL_HOVER_ICON_METHOD: i, CELL_HOVER_ICON_SIZE: s, CELL_PADDING: o, ENABLE_MERGE_CELL_LINK: r } = this.ctx.config;
661
662
  if (typeof i == "function") {
662
- const h = i({
663
+ const l = i({
663
664
  row: this.row,
664
665
  rowIndex: this.rowIndex,
665
666
  colIndex: this.colIndex,
666
667
  column: this.column,
667
668
  value: this.getValue()
668
669
  });
669
- h !== void 0 && (this.hoverIconName = h);
670
+ l !== void 0 && (this.hoverIconName = l);
670
671
  }
671
672
  const { hoverCell: a } = this.ctx;
672
673
  if (this.hoverIconName && !this.ctx.editing && a) {
673
- let l = 0, h = 0;
674
- if (a.rowKey === this.rowKey && (l = this.drawX + this.width - s - o, h = this.drawY + (this.height - s) / 2), this.rowspan !== 1 && r) {
674
+ let h = 0, l = 0;
675
+ if (a.rowKey === this.rowKey && (h = this.drawX + this.width - s - o, l = this.drawY + (this.height - s) / 2), this.rowspan !== 1 && r) {
675
676
  const f = this.getSpanInfo(), { yArr: u } = f, x = u[0], w = u[1];
676
677
  if (a.rowIndex >= x && a.rowIndex <= w) {
677
678
  const { width: m, height: g, offsetTop: p, offsetLeft: y } = f;
678
- l = this.drawX - y + m - s - o, h = this.drawY - p + (g - s) / 2;
679
+ h = this.drawX - y + m - s - o, l = this.drawY - p + (g - s) / 2;
679
680
  }
680
681
  }
681
682
  const d = this.ctx.icons.get(this.hoverIconName);
682
- this.drawHoverImageX = l, this.drawHoverImageY = h, this.drawHoverImageWidth = s, this.drawHoverImageHeight = s, this.drawHoverImageName = this.hoverIconName, this.drawHoverImageSource = d;
683
+ this.drawHoverImageX = h, this.drawHoverImageY = l, this.drawHoverImageWidth = s, this.drawHoverImageHeight = s, this.drawHoverImageName = this.hoverIconName, this.drawHoverImageSource = d;
683
684
  }
684
685
  }
685
686
  /**
@@ -688,12 +689,14 @@ class xt extends Yt {
688
689
  */
689
690
  getAutoHeight() {
690
691
  if (this.cellType !== "body" || !this.autoRowHeight || this.rowspan === 0)
691
- return -1;
692
- if (this.render)
693
- return this.ctx.database.getOverlayerAutoHeightByRowIndex(this.rowIndex);
692
+ return 0;
693
+ if (this.render) {
694
+ const a = this.ctx.database.getOverlayerAutoHeight(this.rowIndex, this.colIndex);
695
+ return this.rowspan > 1 ? a < this.visibleHeight ? 0 : Math.round(a - (this.visibleHeight - this.height)) : Math.round(a);
696
+ }
694
697
  if (!(this.displayText && typeof this.displayText == "string"))
695
- return -1;
696
- const { BODY_FONT: e, CELL_PADDING: i, CELL_LINE_HEIGHT: s } = this.ctx.config, o = this.ctx.paint.calculateTextHeight(this.displayText, this.drawTextWidth, {
698
+ return 0;
699
+ const { BODY_FONT: e, CELL_PADDING: i, CELL_LINE_HEIGHT: s } = this.ctx.config, o = `${this.displayText}_${this.drawTextWidth}`, r = this.ctx.paint.calculateTextHeight(this.displayText, this.drawTextWidth, {
697
700
  font: e,
698
701
  padding: i,
699
702
  align: this.align,
@@ -701,9 +704,10 @@ class xt extends Yt {
701
704
  color: this.drawTextColor,
702
705
  autoRowHeight: this.autoRowHeight,
703
706
  lineHeight: s,
704
- maxLineClamp: this.maxLineClamp
707
+ maxLineClamp: this.maxLineClamp,
708
+ cacheTextKey: o
705
709
  });
706
- return this.rowspan > 1 ? Math.round(o - (this.visibleHeight - this.height)) : Math.round(o);
710
+ return this.rowspan > 1 ? r < this.visibleHeight ? 0 : Math.round(r - (this.visibleHeight - this.height)) : Math.round(r);
707
711
  }
708
712
  // 过去跨度配置
709
713
  getSpanInfo() {
@@ -758,13 +762,14 @@ class xt extends Yt {
758
762
  */
759
763
  getOverlayerViewsStyle() {
760
764
  let e = `${this.drawX - this.ctx.fixedLeftWidth}px`, i = `${this.drawY - this.ctx.body.y}px`;
761
- return this.fixed === "left" ? e = `${this.drawX}px` : this.fixed === "right" && (e = `${this.drawX - (this.ctx.stageWidth - this.ctx.fixedRightWidth)}px`), this.cellType === "footer" && this.ctx.config.FOOTER_FIXED && (i = `${this.drawY - this.ctx.footer.y}px`), {
765
+ return this.fixed === "left" ? e = `${this.drawX}px` : this.fixed === "right" && (e = `${this.drawX - (this.ctx.stageWidth - this.ctx.fixedRightWidth)}px`), this.cellType === "footer" && this.ctx.config.FOOTER_FIXED && (i = `${this.drawY - this.ctx.footer.y}px`), this.autoRowHeight && this.ctx.database.getOverlayerAutoHeight(this.rowIndex, this.colIndex) === 0 && (e = "-99999px", i = "-99999px"), {
762
766
  position: "absolute",
763
767
  overflow: "hidden",
764
768
  left: e,
765
769
  top: i,
766
770
  width: `${this.visibleWidth}px`,
767
771
  height: this.autoRowHeight ? "auto" : `${this.visibleHeight}px`,
772
+ // height: `${this.visibleHeight}px`,
768
773
  // minHeight: `${this.visibleHeight}px`,
769
774
  pointerEvents: "initial",
770
775
  userSelect: "none"
@@ -798,8 +803,8 @@ class xt extends Yt {
798
803
  const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s, AUTOFILL_POINT_BORDER_COLOR: o } = this.ctx.config;
799
804
  if (!s || !i || this.ctx.editing)
800
805
  return;
801
- const { xArr: r, yArr: a } = this.ctx.selector, l = r[1], h = a[1], { colIndex: d, rowIndex: f, drawX: u, drawY: x } = this;
802
- if (d === l && f === h) {
806
+ const { xArr: r, yArr: a } = this.ctx.selector, h = r[1], l = a[1], { colIndex: d, rowIndex: f, drawX: u, drawY: x } = this;
807
+ if (d === h && f === l) {
803
808
  const m = d === this.ctx.maxColIndex || f === this.ctx.maxRowIndex || d === this.ctx.lastCenterColIndex ? 6 : 4;
804
809
  this.ctx.paint.drawRect(u + this.width - m, x + this.height - m, 6, 6, {
805
810
  borderColor: o,
@@ -826,8 +831,11 @@ class xt extends Yt {
826
831
  }
827
832
  drawText() {
828
833
  const { CELL_PADDING: e, BODY_FONT: i, PLACEHOLDER_COLOR: s, CELL_LINE_HEIGHT: o } = this.ctx.config, { placeholder: r } = this.column;
829
- let a = this.displayText, l = this.drawTextColor;
830
- return !this.ctx.database.getReadonly(this.rowKey, this.key) && r && ["", null, void 0].includes(this.text) && this.cellType === "body" && !(this.rowspan === 0 || this.colspan === 0) && (a = r, l = s), a ? (this.ellipsis = this.ctx.paint.drawText(
834
+ let a = this.displayText, h = this.drawTextColor;
835
+ if (!this.ctx.database.getReadonly(this.rowKey, this.key) && r && ["", null, void 0].includes(this.text) && this.cellType === "body" && !(this.rowspan === 0 || this.colspan === 0) && (a = r, h = s), !a)
836
+ return !1;
837
+ const d = `${a}_${this.drawTextWidth}`;
838
+ return this.ellipsis = this.ctx.paint.drawText(
831
839
  a,
832
840
  this.drawTextX,
833
841
  this.drawTextY,
@@ -838,12 +846,13 @@ class xt extends Yt {
838
846
  padding: e,
839
847
  align: this.align,
840
848
  verticalAlign: this.verticalAlign,
841
- color: l,
849
+ color: h,
842
850
  autoRowHeight: this.autoRowHeight,
843
851
  lineHeight: o,
844
- maxLineClamp: this.maxLineClamp
852
+ maxLineClamp: this.maxLineClamp,
853
+ cacheTextKey: d
845
854
  }
846
- ), this.ellipsis) : !1;
855
+ ), this.ellipsis;
847
856
  }
848
857
  drawImage() {
849
858
  if (this.drawSelectionImageSource && this.ctx.paint.drawImage(
@@ -908,11 +917,11 @@ class xt extends Yt {
908
917
  fillColor: "transparent",
909
918
  borderWidth: 1
910
919
  });
911
- const [a, l] = i, [h, d] = s;
912
- !(a === l && h === d) && this.colIndex >= a && this.colIndex <= l && this.rowIndex >= h && this.rowIndex <= d && this.ctx.paint.drawRect(this.drawX, this.drawY, this.width, this.height, {
920
+ const [a, h] = i, [l, d] = s;
921
+ !(a === h && l === d) && this.colIndex >= a && this.colIndex <= h && this.rowIndex >= l && this.rowIndex <= d && this.ctx.paint.drawRect(this.drawX, this.drawY, this.width, this.height, {
913
922
  borderColor: "transparent",
914
923
  fillColor: this.ctx.config.SELECT_AREA_COLOR || "rgba(82,146,247,0.1)"
915
- }), this.operation && this.rowIndex >= h && this.rowIndex <= d && this.ctx.paint.drawRect(this.drawX, this.drawY, this.visibleWidth, this.visibleHeight, {
924
+ }), this.operation && this.rowIndex >= l && this.rowIndex <= d && this.ctx.paint.drawRect(this.drawX, this.drawY, this.visibleWidth, this.visibleHeight, {
916
925
  borderColor: "transparent",
917
926
  fillColor: this.ctx.config.SELECT_ROW_COL_BG_COLOR || "transparent"
918
927
  });
@@ -937,12 +946,12 @@ class xt extends Yt {
937
946
  });
938
947
  }
939
948
  drawBorder(e) {
940
- const { drawX: i, drawY: s, rowIndex: o, colIndex: r, height: a, width: l } = this;
941
- let h = i, d = s;
949
+ const { drawX: i, drawY: s, rowIndex: o, colIndex: r, height: a, width: h } = this;
950
+ let l = i, d = s;
942
951
  const { xArr: f, yArr: u, lineDash: x = [], borderWidth: w = 1, borderColor: m, fillColor: g } = e, p = f[0], y = f[1], E = u[0], R = u[1];
943
952
  if (r >= p && r <= y && o === E) {
944
953
  const C = r === y ? 1 : 0, I = r === p ? 1 : 0;
945
- this.ctx.paint.drawLine([h + I, d + 1, h + l - C, d + 1], {
954
+ this.ctx.paint.drawLine([l + I, d + 1, l + h - C, d + 1], {
946
955
  borderColor: m,
947
956
  fillColor: g,
948
957
  borderWidth: w,
@@ -953,7 +962,7 @@ class xt extends Yt {
953
962
  }
954
963
  if (r === y && o >= E && o <= R) {
955
964
  const C = o === E ? 1 : 0, I = o === R ? 1 : 0;
956
- this.ctx.paint.drawLine([h + l - 1, d + C, h + l - 1, d + a - I], {
965
+ this.ctx.paint.drawLine([l + h - 1, d + C, l + h - 1, d + a - I], {
957
966
  borderColor: m,
958
967
  fillColor: g,
959
968
  borderWidth: w,
@@ -964,7 +973,7 @@ class xt extends Yt {
964
973
  }
965
974
  if (r >= p && r <= y && o === R) {
966
975
  const C = r === y ? 1 : 0, I = r === p ? 1 : 0;
967
- this.ctx.paint.drawLine([h + I, d + a - 1, h + l - C, d + a - 1], {
976
+ this.ctx.paint.drawLine([l + I, d + a - 1, l + h - C, d + a - 1], {
968
977
  borderColor: m,
969
978
  fillColor: g,
970
979
  borderWidth: w,
@@ -975,7 +984,7 @@ class xt extends Yt {
975
984
  }
976
985
  if (r === p && o >= E && o <= R) {
977
986
  const C = o === R ? 1 : 0, I = o === E ? 1 : 0;
978
- this.ctx.paint.drawLine([h + 1, d + I, h + 1, d + a - C], {
987
+ this.ctx.paint.drawLine([l + 1, d + I, l + 1, d + a - C], {
979
988
  borderColor: m,
980
989
  fillColor: g,
981
990
  borderWidth: w,
@@ -1024,8 +1033,8 @@ class ue {
1024
1033
  }
1025
1034
  // 初始化默认不忽略清空改变值和校验map
1026
1035
  init(t = !0) {
1027
- this.clearBufferData(), this.rowKeyMap.clear(), this.checkboxKeyMap.clear(), this.colIndexKeyMap.clear(), this.rowIndexRowKeyMap.clear(), this.rowKeyRowIndexMap.clear();
1028
- const e = this.getColumns(), i = et(e);
1036
+ this.ctx.paint.clearTextCache(), this.clearBufferData(), this.rowKeyMap.clear(), this.checkboxKeyMap.clear(), this.colIndexKeyMap.clear(), this.rowIndexRowKeyMap.clear(), this.rowKeyRowIndexMap.clear();
1037
+ const e = this.getColumns(), i = it(e);
1029
1038
  if (this.ctx.hasSelection = i.some((s) => s.type === "selection"), this.ctx.hasTree = i.some((s) => s.type === "tree"), t) {
1030
1039
  this.originalDataMap.clear(), this.changedDataMap.clear(), this.validationErrorMap.clear();
1031
1040
  const { ROW_KEY: s } = this.ctx.config;
@@ -1048,9 +1057,9 @@ class ue {
1048
1057
  const s = t.length;
1049
1058
  t.forEach((o, r) => {
1050
1059
  var y;
1051
- const { ROW_KEY: a = "", DEFAULT_EXPAND_ALL: l, CELL_HEIGHT: h, SELECTABLE_METHOD: d, CHECKBOX_KEY: f } = this.ctx.config, u = o[a], x = u != null ? `${u}` : At();
1060
+ const { ROW_KEY: a = "", DEFAULT_EXPAND_ALL: h, CELL_HEIGHT: l, SELECTABLE_METHOD: d, CHECKBOX_KEY: f } = this.ctx.config, u = o[a], x = u != null ? `${u}` : Ht();
1052
1061
  this.itemRowKeyMap.set(o, x);
1053
- const w = o._height || h, m = o._readonly;
1062
+ const w = o._height || l, m = o._readonly;
1054
1063
  let g = !0;
1055
1064
  if (typeof d == "function" && (g = d), f) {
1056
1065
  const E = o[f];
@@ -1065,7 +1074,7 @@ class ue {
1065
1074
  row: o,
1066
1075
  check: ((y = this.selectionMap.get(x)) == null ? void 0 : y.check) || !1
1067
1076
  });
1068
- const p = l || this.expandMap.get(x) || o._expand || !1;
1077
+ const p = h || this.expandMap.get(x) || o._expand || !1;
1069
1078
  this.expandMap.set(x, p), this.rowKeyMap.set(x, {
1070
1079
  readonly: m,
1071
1080
  index: r,
@@ -1165,13 +1174,13 @@ class ue {
1165
1174
  const i = (o) => {
1166
1175
  o.forEach((r) => {
1167
1176
  t.push(r);
1168
- const a = this.itemRowKeyMap.get(r), { expand: l, hasChildren: h, height: d, calculatedHeight: f } = this.rowKeyMap.get(a), u = this.sumHeight, x = Math.max(f, d);
1177
+ const a = this.itemRowKeyMap.get(r), { expand: h, hasChildren: l, height: d, calculatedHeight: f } = this.rowKeyMap.get(a), u = this.sumHeight, x = Math.max(f, d);
1169
1178
  this.sumHeight += x, this.rowIndexRowKeyMap.set(e, a), this.rowKeyRowIndexMap.set(a, e), this.positions.push({
1170
1179
  top: u,
1171
1180
  height: x,
1172
1181
  bottom: this.sumHeight,
1173
1182
  calculatedHeight: f
1174
- }), e += 1, l && h && i(r.children);
1183
+ }), e += 1, h && l && i(r.children);
1175
1184
  });
1176
1185
  };
1177
1186
  this.rowIndexRowKeyMap.clear(), this.rowKeyRowIndexMap.clear();
@@ -1248,18 +1257,18 @@ class ue {
1248
1257
  */
1249
1258
  applySingleColumnSort(t, e, i, s) {
1250
1259
  return t.sort((o, r) => {
1251
- const a = o[e], l = r[e];
1252
- let h = 0;
1260
+ const a = o[e], h = r[e];
1261
+ let l = 0;
1253
1262
  if (typeof s == "function")
1254
- h = s(o, r);
1263
+ l = s(o, r);
1255
1264
  else if (s === "number") {
1256
- const d = Number(a) || 0, f = Number(l) || 0;
1257
- h = d - f;
1265
+ const d = Number(a) || 0, f = Number(h) || 0;
1266
+ l = d - f;
1258
1267
  } else if (s === "string") {
1259
- const d = String(a || ""), f = String(l || "");
1260
- h = d.localeCompare(f);
1261
- } else s === "date" && (h = xe(a, l));
1262
- return i === "asc" ? h : -h;
1268
+ const d = String(a || ""), f = String(h || "");
1269
+ l = d.localeCompare(f);
1270
+ } else s === "date" && (l = xe(a, h));
1271
+ return i === "asc" ? l : -l;
1263
1272
  });
1264
1273
  }
1265
1274
  /**
@@ -1371,11 +1380,11 @@ class ue {
1371
1380
  async batchSetItemValue(t, e = !1, i = !0, s = "none") {
1372
1381
  let o = [], r = i;
1373
1382
  const a = /* @__PURE__ */ new Set();
1374
- let l = [], h = t.map((x) => {
1383
+ let h = [], l = t.map((x) => {
1375
1384
  const { rowKey: w, key: m } = x;
1376
1385
  let g = x.value, p = g;
1377
1386
  const y = this.getRowDataItemForRowKey(w), E = this.getItemValue(w, m), R = this.getVirtualBodyCellByKey(w, m);
1378
- return (R == null ? void 0 : R.type) === "number" && (["", void 0, null].includes(g) ? p = null : /^-?\d+(\.\d+)?$/.test(`${g}`) ? p = Number(g) : (p = E, l.push({
1387
+ return (R == null ? void 0 : R.type) === "number" && (["", void 0, null].includes(g) ? p = null : /^-?\d+(\.\d+)?$/.test(`${g}`) ? p = Number(g) : (p = E, h.push({
1379
1388
  ...x,
1380
1389
  value: p,
1381
1390
  oldValue: E,
@@ -1387,18 +1396,18 @@ class ue {
1387
1396
  row: y
1388
1397
  };
1389
1398
  });
1390
- if (h = h.filter((x) => !l.some((w) => x.rowKey === w.rowKey && x.key === w.key)), l.length) {
1399
+ if (l = l.filter((x) => !h.some((w) => x.rowKey === w.rowKey && x.key === w.key)), h.length) {
1391
1400
  const x = {
1392
1401
  code: "ERR_BATCH_SET_NUMBER_VALUE",
1393
1402
  message: "Assignment failed, not a numeric type",
1394
- data: l
1403
+ data: h
1395
1404
  };
1396
1405
  this.ctx.emit("error", x);
1397
1406
  }
1398
- if (h = h.filter((x) => x.oldValue !== x.value), !h.length)
1407
+ if (l = l.filter((x) => x.oldValue !== x.value), !l.length)
1399
1408
  return;
1400
1409
  const { BEFORE_VALUE_CHANGE_METHOD: d } = this.ctx.config;
1401
- s === "none" && typeof d == "function" && (h = await d(h), r = !1), h.forEach((x) => {
1410
+ s === "none" && typeof d == "function" && (l = await d(l), r = !1), l.forEach((x) => {
1402
1411
  const { value: w, rowKey: m, key: g } = x, p = this.getItemValue(m, g);
1403
1412
  a.add(m), this.setItemValue(m, g, w, !1, !1, !1, r), o.push({
1404
1413
  rowKey: m,
@@ -1411,10 +1420,10 @@ class ue {
1411
1420
  a.forEach((x) => {
1412
1421
  f.push(this.ctx.database.getRowDataItemForRowKey(x));
1413
1422
  });
1414
- const u = h.map(({ rowKey: x, key: w }) => this.getValidator(x, w));
1423
+ const u = l.map(({ rowKey: x, key: w }) => this.getValidator(x, w));
1415
1424
  Promise.all(u).then(() => {
1416
1425
  this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
1417
- }), this.ctx.emit("change", h, f), e && this.ctx.history.pushState({
1426
+ }), this.ctx.emit("change", l, f), e && this.ctx.history.pushState({
1418
1427
  changeList: o,
1419
1428
  scrollX: this.ctx.scrollX,
1420
1429
  scrollY: this.ctx.scrollY,
@@ -1435,16 +1444,16 @@ class ue {
1435
1444
  async setItemValue(t, e, i, s = !1, o = !1, r = !1, a = !0) {
1436
1445
  if (!this.rowKeyMap.has(t))
1437
1446
  return {};
1438
- const { item: l } = this.rowKeyMap.get(t);
1439
- let h = l[e], d = i;
1447
+ const { item: h } = this.rowKeyMap.get(t);
1448
+ let l = h[e], d = i;
1440
1449
  if (a && this.ctx.database.getReadonly(t, e))
1441
1450
  return {
1442
- oldValue: h,
1443
- newValue: h
1451
+ oldValue: l,
1452
+ newValue: l
1444
1453
  };
1445
- l[e] !== null && typeof l[e] == "object" && (h = JSON.parse(JSON.stringify(l[e])));
1454
+ h[e] !== null && typeof h[e] == "object" && (l = JSON.parse(JSON.stringify(h[e])));
1446
1455
  const f = `${t}​_${e}`;
1447
- this.originalDataMap.has(f) || this.originalDataMap.set(f, h);
1456
+ this.originalDataMap.has(f) || this.originalDataMap.set(f, l);
1448
1457
  const u = this.originalDataMap.get(f), x = this.getRowDataItemForRowKey(t);
1449
1458
  if (r) {
1450
1459
  const w = this.getVirtualBodyCellByKey(t, e);
@@ -1454,7 +1463,7 @@ class ue {
1454
1463
  else if (/^-?\d+(\.\d+)?$/.test(`${i}`))
1455
1464
  d = Number(i);
1456
1465
  else {
1457
- d = h;
1466
+ d = l;
1458
1467
  const g = {
1459
1468
  code: "ERR_SET_NUMBER_VALUE",
1460
1469
  message: "Assignment failed, not a numeric type",
@@ -1463,46 +1472,46 @@ class ue {
1463
1472
  rowKey: t,
1464
1473
  key: e,
1465
1474
  value: d,
1466
- oldValue: h,
1475
+ oldValue: l,
1467
1476
  row: x
1468
1477
  }
1469
1478
  ]
1470
1479
  };
1471
1480
  this.ctx.emit("error", g);
1472
1481
  }
1473
- if (d === h)
1482
+ if (d === l)
1474
1483
  return {
1475
- oldValue: h,
1476
- newValue: h
1484
+ oldValue: l,
1485
+ newValue: l
1477
1486
  };
1478
1487
  let m = [
1479
1488
  {
1480
1489
  rowKey: t,
1481
1490
  key: e,
1482
1491
  value: d,
1483
- oldValue: h,
1492
+ oldValue: l,
1484
1493
  row: x
1485
1494
  }
1486
1495
  ];
1487
1496
  this.batchSetItemValue(m, s, !1), this.ctx.emit("editChange", {
1488
1497
  rowKey: t,
1489
1498
  key: e,
1490
- oldValue: h,
1499
+ oldValue: l,
1491
1500
  value: d,
1492
1501
  originalValue: u,
1493
1502
  row: x
1494
1503
  });
1495
1504
  } else
1496
- this.changedDataMap.set(f, d), l[e] = d;
1505
+ this.changedDataMap.set(f, d), h[e] = d;
1497
1506
  return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
1498
1507
  rowKey: t,
1499
1508
  key: e,
1500
- oldValue: h,
1509
+ oldValue: l,
1501
1510
  value: d,
1502
1511
  originalValue: this.originalDataMap.get(f),
1503
1512
  row: x
1504
1513
  }), o && this.ctx.emit("draw"), {
1505
- oldValue: h,
1514
+ oldValue: l,
1506
1515
  newValue: d
1507
1516
  };
1508
1517
  }
@@ -1529,8 +1538,8 @@ class ue {
1529
1538
  return !1;
1530
1539
  const { item: s } = this.rowKeyMap.get(t), o = s[i];
1531
1540
  this.checkboxKeyMap.has(o) && (this.checkboxKeyMap.get(o) || []).forEach((a) => {
1532
- const l = this.selectionMap.get(a);
1533
- l && (l.check = e);
1541
+ const h = this.selectionMap.get(a);
1542
+ h && (h.check = e);
1534
1543
  });
1535
1544
  }
1536
1545
  }
@@ -1576,11 +1585,11 @@ class ue {
1576
1585
  const e = this.getTreeParent(t);
1577
1586
  if (!e)
1578
1587
  return;
1579
- const s = this.getTreeChildren(e).map((h) => this.selectionMap.get(h)), o = s.filter((h) => h == null ? void 0 : h.check).length, r = s.length;
1588
+ const s = this.getTreeChildren(e).map((l) => this.selectionMap.get(l)), o = s.filter((l) => l == null ? void 0 : l.check).length, r = s.length;
1580
1589
  let a = !1;
1581
1590
  r > 0 && (o === 0 ? a = !1 : o === r || this.ctx.config.TREE_SELECT_MODE === "auto" ? a = !0 : this.ctx.config.TREE_SELECT_MODE === "cautious" && (a = !1));
1582
- const l = this.selectionMap.get(e);
1583
- l && l.check !== a && (l.check = a, this.setRowSelectionByCheckboxKey(e, a), this.updateParentTreeSelection(e));
1591
+ const h = this.selectionMap.get(e);
1592
+ h && h.check !== a && (h.check = a, this.setRowSelectionByCheckboxKey(e, a), this.updateParentTreeSelection(e));
1584
1593
  }
1585
1594
  /**
1586
1595
  * 根据rowKey 设置选中状态
@@ -1613,22 +1622,22 @@ class ue {
1613
1622
  return { checked: s, indeterminate: !1 };
1614
1623
  let r = !1, a = s;
1615
1624
  if (this.ctx.config.TREE_SELECT_MODE === "auto") {
1616
- const h = (g) => {
1625
+ const l = (g) => {
1617
1626
  const p = this.getTreeChildren(g);
1618
1627
  let y = [];
1619
1628
  for (const E of p)
1620
- y.push(E), y.push(...h(E));
1629
+ y.push(E), y.push(...l(E));
1621
1630
  return y;
1622
- }, f = h(t).map((g) => this.selectionMap.get(g)), u = f.filter((g) => g == null ? void 0 : g.check).length, x = f.length, w = u > 0;
1631
+ }, f = l(t).map((g) => this.selectionMap.get(g)), u = f.filter((g) => g == null ? void 0 : g.check).length, x = f.length, w = u > 0;
1623
1632
  r = w && !(u === x), a = s || w, s && x > 0 && u === 0 && (a = !1, r = !1);
1624
1633
  } else if (this.ctx.config.TREE_SELECT_MODE === "cautious") {
1625
- const h = (g) => {
1634
+ const l = (g) => {
1626
1635
  const p = this.getTreeChildren(g);
1627
1636
  let y = [];
1628
1637
  for (const E of p)
1629
- y.push(E), y.push(...h(E));
1638
+ y.push(E), y.push(...l(E));
1630
1639
  return y;
1631
- }, f = h(t).map((g) => this.selectionMap.get(g)), u = f.filter((g) => g == null ? void 0 : g.check).length, x = f.length, w = u > 0, m = u === x;
1640
+ }, f = l(t).map((g) => this.selectionMap.get(g)), u = f.filter((g) => g == null ? void 0 : g.check).length, x = f.length, w = u > 0, m = u === x;
1632
1641
  r = w && !m, a = s || m, s && x > 0 && u === 0 && (a = !1, r = !1);
1633
1642
  } else this.ctx.config.TREE_SELECT_MODE === "strictly" && (r = !1, a = s);
1634
1643
  return { checked: a, indeterminate: r };
@@ -1655,9 +1664,9 @@ class ue {
1655
1664
  for (const a of o.children) {
1656
1665
  if (this.getRowKeyByItem(a) === s)
1657
1666
  return r;
1658
- const h = e(o.children, s);
1659
- if (h)
1660
- return h;
1667
+ const l = e(o.children, s);
1668
+ if (l)
1669
+ return l;
1661
1670
  }
1662
1671
  }
1663
1672
  return null;
@@ -1740,15 +1749,15 @@ class ue {
1740
1749
  rowIndex: u.rowIndex
1741
1750
  })), w && (o += 1);
1742
1751
  });
1743
- const l = r > i && s === 0 && a, h = o && o > s && s > 0 || l, d = o !== 0, f = !!o && o === s;
1752
+ const h = r > i && s === 0 && a, l = o && o > s && s > 0 || h, d = o !== 0, f = !!o && o === s;
1744
1753
  return this.bufferCheckState = {
1745
1754
  buffer: !0,
1746
1755
  check: f,
1747
- indeterminate: h,
1756
+ indeterminate: l,
1748
1757
  selectable: d
1749
1758
  }, {
1750
1759
  check: f,
1751
- indeterminate: h,
1760
+ indeterminate: l,
1752
1761
  selectable: d
1753
1762
  };
1754
1763
  }
@@ -1840,9 +1849,9 @@ class ue {
1840
1849
  const s = this.rowKeyMap.get(t), o = this.headerMap.get(e);
1841
1850
  if (!s || !o)
1842
1851
  return !0;
1843
- const r = s.readonly, a = o.readonly, { BODY_CELL_READONLY_METHOD: l } = this.ctx.config;
1844
- if (typeof l == "function" && o) {
1845
- const d = l({
1852
+ const r = s.readonly, a = o.readonly, { BODY_CELL_READONLY_METHOD: h } = this.ctx.config;
1853
+ if (typeof h == "function" && o) {
1854
+ const d = h({
1846
1855
  row: s.item,
1847
1856
  rowIndex: s.rowIndex,
1848
1857
  colIndex: o.colIndex,
@@ -1866,7 +1875,7 @@ class ue {
1866
1875
  if (o === void 0)
1867
1876
  return i([]);
1868
1877
  const a = o.column;
1869
- let l = a.rules;
1878
+ let h = a.rules;
1870
1879
  if (typeof r == "function") {
1871
1880
  const d = r({
1872
1881
  row: s.item,
@@ -1875,10 +1884,10 @@ class ue {
1875
1884
  column: a,
1876
1885
  value: this.getItemValue(t, e)
1877
1886
  });
1878
- d && (l = d);
1887
+ d && (h = d);
1879
1888
  }
1880
- if (l) {
1881
- const h = {
1889
+ if (h) {
1890
+ const l = {
1882
1891
  row: s.item,
1883
1892
  rowIndex: s.rowIndex,
1884
1893
  colIndex: o.colIndex,
@@ -1888,7 +1897,7 @@ class ue {
1888
1897
  value: this.getItemValue(t, e),
1889
1898
  field: e,
1890
1899
  fieldValue: this.getItemValue(t, e)
1891
- }, f = new re(l).validate(h);
1900
+ }, f = new re(h).validate(l);
1892
1901
  this.setValidationError(t, e, f), i(f);
1893
1902
  } else
1894
1903
  this.clearValidationError(t, e), i([]);
@@ -1910,8 +1919,8 @@ class ue {
1910
1919
  row: o,
1911
1920
  value: r,
1912
1921
  colIndex: a,
1913
- relationRowKeys: l,
1914
- relationColKeys: h,
1922
+ relationRowKeys: h,
1923
+ relationColKeys: l,
1915
1924
  rowspan: d,
1916
1925
  height: f,
1917
1926
  width: u,
@@ -1938,29 +1947,29 @@ class ue {
1938
1947
  }
1939
1948
  ]
1940
1949
  };
1941
- let g = e, p = e, y = a, E = a, R = [], C = 0, I = 0, v = 0, _ = 0;
1950
+ let g = e, p = e, y = a, E = a, R = [], C = 0, I = 0, S = 0, _ = 0;
1942
1951
  if (d !== 1 && w) {
1943
1952
  _ = u;
1944
- const S = l.reduce((b, O) => {
1953
+ const v = h.reduce((b, O) => {
1945
1954
  const T = this.getItemValue(s, O) ?? "";
1946
1955
  return `${b}${T}`;
1947
1956
  }, "");
1948
1957
  for (let b = e - 1; b >= 0; b--) {
1949
- const O = this.rowIndexRowKeyMap.get(b) || "", T = l.reduce((M, L) => {
1958
+ const O = this.rowIndexRowKeyMap.get(b) || "", T = h.reduce((M, L) => {
1950
1959
  const A = this.getItemValue(O, L) ?? "";
1951
1960
  return `${M}${A}`;
1952
1961
  }, "");
1953
- if (S === T)
1962
+ if (v === T)
1954
1963
  g = b;
1955
1964
  else
1956
1965
  break;
1957
1966
  }
1958
1967
  for (let b = e; b <= this.ctx.maxRowIndex; b++) {
1959
- const O = this.rowIndexRowKeyMap.get(b) || "", T = l.reduce((M, L) => {
1968
+ const O = this.rowIndexRowKeyMap.get(b) || "", T = h.reduce((M, L) => {
1960
1969
  const A = this.getItemValue(O, L) ?? "";
1961
1970
  return `${M}${A}`;
1962
1971
  }, "");
1963
- if (S === T)
1972
+ if (v === T)
1964
1973
  p = b;
1965
1974
  else
1966
1975
  break;
@@ -1971,7 +1980,7 @@ class ue {
1971
1980
  }
1972
1981
  for (let b = g; b <= p; b++) {
1973
1982
  const { height: O } = this.positions[b];
1974
- v += O;
1983
+ S += O;
1975
1984
  const T = this.rowIndexRowKeyMap.get(b) || "", { item: M } = this.rowKeyMap.get(T), L = this.getItemValue(T, i);
1976
1985
  R.push({
1977
1986
  rowKey: T,
@@ -1982,35 +1991,35 @@ class ue {
1982
1991
  }
1983
1992
  }
1984
1993
  if (x !== 1 && m) {
1985
- v = f;
1986
- for (let S = a - 1; S >= 0; S--) {
1987
- const b = this.getColumnByColIndex(S);
1994
+ S = f;
1995
+ for (let v = a - 1; v >= 0; v--) {
1996
+ const b = this.getColumnByColIndex(v);
1988
1997
  if (!b)
1989
1998
  break;
1990
1999
  const O = this.getItemValue(s, i), T = this.getItemValue(s, b.key);
1991
- if (O === T && h.includes(b.key))
1992
- y = S;
2000
+ if (O === T && l.includes(b.key))
2001
+ y = v;
1993
2002
  else
1994
2003
  break;
1995
2004
  }
1996
- for (let S = a; S <= this.ctx.maxColIndex; S++) {
1997
- const b = this.getColumnByColIndex(S);
2005
+ for (let v = a; v <= this.ctx.maxColIndex; v++) {
2006
+ const b = this.getColumnByColIndex(v);
1998
2007
  if (!b)
1999
2008
  break;
2000
2009
  const O = this.getItemValue(s, i), T = this.getItemValue(s, b.key);
2001
- if (O === T && h.includes(b.key))
2002
- E = S;
2010
+ if (O === T && l.includes(b.key))
2011
+ E = v;
2003
2012
  else
2004
2013
  break;
2005
2014
  }
2006
- for (let S = y; S < a; S++) {
2007
- const b = this.getColumnByColIndex(S);
2015
+ for (let v = y; v < a; v++) {
2016
+ const b = this.getColumnByColIndex(v);
2008
2017
  if (!b)
2009
2018
  break;
2010
2019
  I += b.width || 100;
2011
2020
  }
2012
- for (let S = y; S <= E; S++) {
2013
- const b = this.getColumnByColIndex(S);
2021
+ for (let v = y; v <= E; v++) {
2022
+ const b = this.getColumnByColIndex(v);
2014
2023
  if (!b)
2015
2024
  break;
2016
2025
  _ += b.width || 100, R.push({
@@ -2026,7 +2035,7 @@ class ue {
2026
2035
  yArr: [g, p],
2027
2036
  rowspan: d,
2028
2037
  colspan: x,
2029
- height: v,
2038
+ height: S,
2030
2039
  width: _,
2031
2040
  offsetTop: C,
2032
2041
  offsetLeft: I,
@@ -2043,7 +2052,7 @@ class ue {
2043
2052
  const s = this.rowIndexRowKeyMap.get(t), o = `${s}​_${e}`, r = this.getRowForRowIndex(t), a = this.getColumnByKey(e);
2044
2053
  if (!s || !a || !r)
2045
2054
  return;
2046
- const l = this.getItemValue(s, e), h = [
2055
+ const h = this.getItemValue(s, e), l = [
2047
2056
  {
2048
2057
  key: e,
2049
2058
  rowKey: s,
@@ -2051,13 +2060,13 @@ class ue {
2051
2060
  colIndex: a.colIndex,
2052
2061
  column: a.column,
2053
2062
  row: r,
2054
- value: l,
2063
+ value: h,
2055
2064
  message: i,
2056
2065
  field: e,
2057
- fieldValue: l
2066
+ fieldValue: h
2058
2067
  }
2059
2068
  ];
2060
- this.validationErrorMap.set(o, h);
2069
+ this.validationErrorMap.set(o, l);
2061
2070
  }
2062
2071
  setValidationError(t, e, i) {
2063
2072
  const s = `${t}​_${e}`;
@@ -2074,7 +2083,7 @@ class ue {
2074
2083
  // 获取虚拟单元格,只针对可见的
2075
2084
  getVirtualBodyCell(t, e) {
2076
2085
  const i = this.getColumnByColIndex(e), s = this.getRowForRowIndex(t);
2077
- return !i || !s ? void 0 : new xt(this.ctx, t, e, 0, 0, 0, 0, i, s.item, "body");
2086
+ return !i || !s ? void 0 : new ut(this.ctx, t, e, 0, 0, 0, 0, i, s.item, "body");
2078
2087
  }
2079
2088
  getVirtualBodyCellByKey(t, e) {
2080
2089
  const i = this.getRowIndexForRowKey(t), s = this.getColIndexForKey(e);
@@ -2108,15 +2117,15 @@ class ue {
2108
2117
  }
2109
2118
  }), i;
2110
2119
  }
2111
- updateOverlayerAutoHeightMap() {
2112
- const t = this.ctx.overlayerElement.querySelectorAll('[data-auto-height="true"]'), e = /* @__PURE__ */ new Map();
2113
- t.forEach((i) => {
2114
- const s = Number(i.getAttribute("data-row-index"));
2115
- isNaN(s) || e.set(s, i.clientHeight);
2116
- }), this.overlayerAutoHeightMap = e;
2120
+ setOverlayerAutoHeightMap(t) {
2121
+ this.overlayerAutoHeightMap = t;
2122
+ }
2123
+ getOverlayerAutoHeightMap() {
2124
+ return this.overlayerAutoHeightMap;
2117
2125
  }
2118
- getOverlayerAutoHeightByRowIndex(t) {
2119
- return this.overlayerAutoHeightMap.get(t) || -1;
2126
+ getOverlayerAutoHeight(t, e) {
2127
+ const i = `${t}​_${e}`;
2128
+ return this.overlayerAutoHeightMap.get(i) || 0;
2120
2129
  }
2121
2130
  }
2122
2131
  class ge {
@@ -2291,10 +2300,14 @@ class me {
2291
2300
  class pe {
2292
2301
  constructor(t) {
2293
2302
  n(this, "ctx");
2303
+ n(this, "textCacheMap", /* @__PURE__ */ new Map());
2294
2304
  const e = t.getContext("2d");
2295
2305
  if (!e) throw new Error("canvas context not found");
2296
2306
  this.ctx = e;
2297
2307
  }
2308
+ clearTextCache() {
2309
+ this.textCacheMap.clear();
2310
+ }
2298
2311
  scale(t) {
2299
2312
  this.ctx.setTransform(1, 0, 0, 1, 0, 0), this.ctx.scale(t, t);
2300
2313
  }
@@ -2324,21 +2337,21 @@ class pe {
2324
2337
  * @param {string} color - 阴影的颜色
2325
2338
  */
2326
2339
  drawShadow(t, e, i, s, o) {
2327
- const { fillColor: r, side: a, shadowWidth: l, colorStart: h, colorEnd: d } = o;
2340
+ const { fillColor: r, side: a, shadowWidth: h, colorStart: l, colorEnd: d } = o;
2328
2341
  this.ctx.save(), r && (this.ctx.fillStyle = r, this.ctx.fillRect(t, e, i, s));
2329
2342
  let f;
2330
2343
  switch (a) {
2331
2344
  case "left":
2332
- f = this.ctx.createLinearGradient(t - l, e, t, e), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t - l, e, l, s);
2345
+ f = this.ctx.createLinearGradient(t - h, e, t, e), f.addColorStop(0, l), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t - h, e, h, s);
2333
2346
  break;
2334
2347
  case "right":
2335
- f = this.ctx.createLinearGradient(t + i, e, t + i + l, e), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t + i, e, l, s);
2348
+ f = this.ctx.createLinearGradient(t + i, e, t + i + h, e), f.addColorStop(0, l), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t + i, e, h, s);
2336
2349
  break;
2337
2350
  case "top":
2338
- f = this.ctx.createLinearGradient(t, e - l, t, e), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t, e - l, i, l);
2351
+ f = this.ctx.createLinearGradient(t, e - h, t, e), f.addColorStop(0, l), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t, e - h, i, h);
2339
2352
  break;
2340
2353
  case "bottom":
2341
- f = this.ctx.createLinearGradient(t, e + s, t, e + s + l), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t, e + s, i, l);
2354
+ f = this.ctx.createLinearGradient(t, e + s, t, e + s + h), f.addColorStop(0, l), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t, e + s, i, h);
2342
2355
  break;
2343
2356
  default:
2344
2357
  console.error("Invalid side specified for shadow");
@@ -2360,12 +2373,12 @@ class pe {
2360
2373
  drawImage(t, e, i, s, o) {
2361
2374
  this.ctx.save(), this.ctx.drawImage(t, e, i, s, o), this.ctx.restore();
2362
2375
  }
2363
- drawRect(t, e, i, s, { borderWidth: o = 1, borderColor: r, fillColor: a, radius: l = 0 } = {}) {
2364
- if (this.ctx.save(), this.ctx.beginPath(), a !== void 0 && (this.ctx.fillStyle = a), r !== void 0 && (this.ctx.lineWidth = o, this.ctx.strokeStyle = r), l === 0)
2376
+ drawRect(t, e, i, s, { borderWidth: o = 1, borderColor: r, fillColor: a, radius: h = 0 } = {}) {
2377
+ if (this.ctx.save(), this.ctx.beginPath(), a !== void 0 && (this.ctx.fillStyle = a), r !== void 0 && (this.ctx.lineWidth = o, this.ctx.strokeStyle = r), h === 0)
2365
2378
  this.ctx.rect(t - 0.5, e - 0.5, i, s);
2366
2379
  else {
2367
- const [h, d, f, u] = typeof l == "number" ? [l, l, l, l] : l;
2368
- this.ctx.moveTo(t + h, e), this.ctx.arcTo(t + i, e, t + i, e + d, d), this.ctx.arcTo(t + i, e + s, t + i - f, e + s, f), this.ctx.arcTo(t, e + s, t, e + s - u, u), this.ctx.arcTo(t, e, t + h, e, h);
2380
+ const [l, d, f, u] = typeof h == "number" ? [h, h, h, h] : h;
2381
+ this.ctx.moveTo(t + l, e), this.ctx.arcTo(t + i, e, t + i, e + d, d), this.ctx.arcTo(t + i, e + s, t + i - f, e + s, f), this.ctx.arcTo(t, e + s, t, e + s - u, u), this.ctx.arcTo(t, e, t + l, e, l);
2369
2382
  }
2370
2383
  a !== void 0 && this.ctx.fill(), r !== void 0 && this.ctx.stroke(), this.ctx.restore();
2371
2384
  }
@@ -2384,8 +2397,8 @@ class pe {
2384
2397
  this.ctx.save();
2385
2398
  const {
2386
2399
  font: a = "12px Arial",
2387
- align: l = "center",
2388
- color: h = "#495060",
2400
+ align: h = "center",
2401
+ color: l = "#495060",
2389
2402
  padding: d = 0,
2390
2403
  verticalAlign: f = "middle",
2391
2404
  maxLineClamp: u = 1,
@@ -2393,22 +2406,22 @@ class pe {
2393
2406
  offsetLeft: w = 0,
2394
2407
  offsetRight: m = 0
2395
2408
  } = r;
2396
- this.ctx.font = a, this.ctx.fillStyle = h, this.ctx.textAlign = l;
2409
+ this.ctx.font = a, this.ctx.fillStyle = l, this.ctx.textAlign = h;
2397
2410
  const p = parseInt(((O = a.match(/\d+/)) == null ? void 0 : O[0]) || "12") * (r.lineHeight || 1.2), y = s - d * 2 - w - m, E = this.ctx.measureText("...").width;
2398
2411
  let R = !1;
2399
2412
  if (s <= E + d * 2 + w + m)
2400
2413
  return this.ctx.restore(), R = !0, R;
2401
2414
  const C = Math.round((o - 2 * d) / p);
2402
- let I = this.wrapText(t, y), v = Math.min(I.length, Math.max(C, 1));
2403
- u === "auto" && x ? v = I.length : typeof u == "number" && u < C ? v = u : (u === 1 && !x && (I = [t], v = 1), u === "auto" && C === 1 && (I = [t], v = 1));
2415
+ let I = this.wrapText(t, y, r.cacheTextKey), S = Math.min(I.length, Math.max(C, 1));
2416
+ u === "auto" && x ? S = I.length : typeof u == "number" && u < C ? S = u : (u === 1 && !x && (I = [t], S = 1), u === "auto" && C === 1 && (I = [t], S = 1));
2404
2417
  let _ = i + d;
2405
- const S = Math.round(v * p);
2406
- f === "middle" ? _ = i + (o - S) / 2 : f === "bottom" && (_ = i + o - S - d);
2418
+ const v = Math.round(S * p);
2419
+ f === "middle" ? _ = i + (o - v) / 2 : f === "bottom" && (_ = i + o - v - d);
2407
2420
  let b = e + d + w;
2408
- l === "center" ? b = e + (s - w - m) / 2 : l === "right" && (b = e + s - d - m);
2421
+ h === "center" ? b = e + s / 2 : h === "right" && (b = e + s - d - m);
2409
2422
  for (let T = 0; T < I.length; T++) {
2410
2423
  const M = I[T], L = _ + T * p;
2411
- if (this.ctx.textBaseline = "top", T === v - 1) {
2424
+ if (this.ctx.textBaseline = "top", T === S - 1) {
2412
2425
  const { _text: A, ellipsis: D } = this.handleEllipsis(M, s, d, a);
2413
2426
  this.ctx.fillText(A, b, L), R = D;
2414
2427
  break;
@@ -2418,16 +2431,16 @@ class pe {
2418
2431
  if (r.textCallback && I.length) {
2419
2432
  const T = Math.round(this.ctx.measureText(I[0]).width);
2420
2433
  let M = b, L = b + T;
2421
- l === "center" ? (M = b - T / 2, L = b + T / 2) : l === "right" && (M = b - T, L = b);
2434
+ h === "center" ? (M = b - T / 2, L = b + T / 2) : h === "right" && (M = b - T, L = b);
2422
2435
  const A = {
2423
2436
  x: b,
2424
2437
  y: _,
2425
2438
  width: T,
2426
- height: S,
2439
+ height: v,
2427
2440
  left: M,
2428
2441
  right: L,
2429
2442
  top: _,
2430
- bottom: _ + S
2443
+ bottom: _ + v
2431
2444
  };
2432
2445
  r.textCallback(A);
2433
2446
  }
@@ -2439,31 +2452,34 @@ class pe {
2439
2452
  * @param maxWidth
2440
2453
  * @returns
2441
2454
  */
2442
- wrapText(t, e) {
2455
+ wrapText(t, e, i = "") {
2443
2456
  if (!t) return [""];
2444
- const i = [], s = t.split(`
2457
+ if (i && this.textCacheMap.has(i))
2458
+ return this.textCacheMap.get(i) || [""];
2459
+ const s = [], o = t.split(`
2445
2460
  `);
2446
- for (const o of s) {
2447
- if (o === "") {
2448
- i.push("");
2461
+ for (const a of o) {
2462
+ if (a === "") {
2463
+ s.push("");
2449
2464
  continue;
2450
2465
  }
2451
- const r = o.split("");
2452
- let a = "";
2453
- for (const l of r) {
2454
- const h = a + l;
2455
- this.ctx.measureText(h).width <= e ? a = h : a ? (i.push(a), a = l) : (i.push(l), a = "");
2466
+ const h = a.split("");
2467
+ let l = "";
2468
+ for (const d of h) {
2469
+ const f = l + d;
2470
+ this.ctx.measureText(f).width <= e ? l = f : l ? (s.push(l), l = d) : (s.push(d), l = "");
2456
2471
  }
2457
- a && i.push(a);
2472
+ l && s.push(l);
2458
2473
  }
2459
- if (i.length >= 1) {
2460
- const o = i[i.length - 1], { ellipsis: r } = this.handleEllipsis(o, e, 0, this.ctx.font);
2461
- if (r) {
2462
- const a = o.slice(0, -1);
2463
- i[i.length - 1] = a, i.push(o.slice(-1));
2474
+ if (s.length >= 1) {
2475
+ const a = s[s.length - 1], { ellipsis: h } = this.handleEllipsis(a, e, 0, this.ctx.font);
2476
+ if (h) {
2477
+ const l = a.slice(0, -1);
2478
+ s[s.length - 1] = l, s.push(a.slice(-1));
2464
2479
  }
2465
2480
  }
2466
- return i.length > 0 ? i : [""];
2481
+ const r = s.length > 0 ? s : [""];
2482
+ return i && this.textCacheMap.set(i, r), r;
2467
2483
  }
2468
2484
  /**
2469
2485
  * 计算文本自适应高度
@@ -2473,12 +2489,19 @@ class pe {
2473
2489
  * @returns 计算出的高度
2474
2490
  */
2475
2491
  calculateTextHeight(t = "", e, i = {}) {
2476
- var w;
2477
- const { font: s = "12px Arial", padding: o = 0, align: r = "center", color: a = "#495060", maxLineClamp: l = 1 } = i;
2492
+ var m;
2493
+ const {
2494
+ font: s = "12px Arial",
2495
+ padding: o = 0,
2496
+ align: r = "center",
2497
+ color: a = "#495060",
2498
+ maxLineClamp: h = 1,
2499
+ cacheTextKey: l = ""
2500
+ } = i;
2478
2501
  this.ctx.save(), this.ctx.font = s, this.ctx.fillStyle = a, this.ctx.textAlign = r;
2479
- const h = parseInt(((w = s.match(/\d+/)) == null ? void 0 : w[0]) || "12"), d = h * (i.lineHeight || 1.2), f = e - o * 2, u = this.wrapText(t, f);
2480
- let x = 1;
2481
- return l === "auto" ? x = u.length : u.length > l ? x = l : x = u.length, this.ctx.restore(), Math.max(Math.floor(x * d + o * 2), Math.floor(h + o * 2));
2502
+ const d = parseInt(((m = s.match(/\d+/)) == null ? void 0 : m[0]) || "12"), f = d * (i.lineHeight || 1.2), u = e - o * 2, x = this.wrapText(t, u, l);
2503
+ let w = 1;
2504
+ return h === "auto" ? w = x.length : x.length > h ? w = h : w = x.length, this.ctx.restore(), Math.max(Math.floor(w * f + o * 2), Math.floor(d + o * 2));
2482
2505
  }
2483
2506
  handleEllipsis(t, e, i = 0, s = "12px Arial") {
2484
2507
  this.ctx.save();
@@ -2494,12 +2517,12 @@ class pe {
2494
2517
  _text: "",
2495
2518
  ellipsis: !0
2496
2519
  };
2497
- const l = this.ctx.measureText(t).width, h = e - i * 2;
2498
- if (l && l + a >= h) {
2520
+ const h = this.ctx.measureText(t).width, l = e - i * 2;
2521
+ if (h && h + a >= l) {
2499
2522
  o = !0;
2500
2523
  let d = 0;
2501
2524
  for (let f = 0; f < t.length; f++)
2502
- if (d += this.ctx.measureText(t[f]).width, d >= h - a) {
2525
+ if (d += this.ctx.measureText(t[f]).width, d >= l - a) {
2503
2526
  r = t.slice(0, f) + "...", o = !0;
2504
2527
  break;
2505
2528
  }
@@ -2510,11 +2533,13 @@ class pe {
2510
2533
  };
2511
2534
  }
2512
2535
  }
2513
- class Rt {
2536
+ class It {
2514
2537
  constructor(t) {
2515
2538
  n(this, "_config", {});
2516
2539
  /** CSS 类名前缀 */
2517
2540
  n(this, "CSS_PREFIX", "e-virt-table");
2541
+ /** 绘制时间 */
2542
+ n(this, "DRAW_TIME_MULTIPLIER", 2);
2518
2543
  /** 图标集合 */
2519
2544
  n(this, "ICONS", []);
2520
2545
  /** 行的唯一标识键 */
@@ -2816,7 +2841,7 @@ class Rt {
2816
2841
  }), Object.assign(this, t, this._config);
2817
2842
  }
2818
2843
  }
2819
- const It = '<svg t="1724122044148" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4551" width="32" height="32"><path d="M707.648 401.28L489.28 560.704l22.656 30.976 22.656-30.976L316.16 401.216q-3.072-2.24-6.464-3.84-3.456-1.536-7.104-2.432-3.712-0.896-7.488-1.088-3.776-0.128-7.488 0.448-3.776 0.64-7.296 1.92-3.584 1.28-6.784 3.2-3.2 1.984-6.016 4.544-2.816 2.56-5.056 5.632-2.176 3.072-3.84 6.464-1.536 3.456-2.432 7.104-0.896 3.712-1.088 7.488-0.128 3.776 0.448 7.488 0.64 3.776 1.92 7.296 1.28 3.584 3.2 6.784 1.984 3.2 4.544 6.016 2.56 2.752 5.632 4.992l218.368 159.552q4.928 3.584 10.752 5.504 5.76 1.92 11.904 1.92 6.08 0 11.904-1.92 5.76-1.92 10.752-5.504l218.368-159.552q3.008-2.24 5.568-4.992 2.56-2.816 4.544-6.016 1.92-3.2 3.264-6.784 1.28-3.52 1.92-7.296 0.576-3.712 0.384-7.488-0.128-3.84-1.024-7.488-0.896-3.648-2.496-7.04-1.6-3.456-3.84-6.528-2.24-3.072-4.992-5.632-2.816-2.56-6.016-4.48-3.2-1.984-6.784-3.328-3.584-1.28-7.296-1.856-3.712-0.64-7.488-0.448-3.84 0.192-7.488 1.088-3.648 0.896-7.04 2.496-3.456 1.536-6.528 3.84z m61.056 30.976q0-3.84-0.768-7.488-0.704-3.712-2.176-7.232-1.472-3.456-3.52-6.656-2.112-3.136-4.8-5.76-2.688-2.688-5.76-4.8-3.2-2.112-6.72-3.584-3.456-1.408-7.168-2.176-3.712-0.704-7.488-0.704-3.84 0-7.488 0.704-3.712 0.768-7.232 2.176-3.456 1.472-6.656 3.584-3.136 2.112-5.76 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.584 6.656-1.408 3.52-2.176 7.232-0.704 3.712-0.704 7.488 0 3.776 0.704 7.488 0.768 3.712 2.176 7.168 1.472 3.52 3.584 6.656 2.112 3.2 4.8 5.824 2.624 2.688 5.76 4.8 3.2 2.112 6.656 3.52 3.52 1.472 7.232 2.176 3.712 0.768 7.488 0.768 3.776 0 7.488-0.768 3.712-0.704 7.168-2.176 3.52-1.408 6.656-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.048-3.2 3.52-6.72 1.472-3.456 2.176-7.168 0.768-3.712 0.768-7.488z m-436.736 0q0-3.84-0.768-7.488-0.704-3.712-2.176-7.232-1.408-3.456-3.52-6.656-2.112-3.136-4.8-5.76-2.688-2.688-5.76-4.8-3.2-2.112-6.656-3.584-3.52-1.408-7.232-2.176-3.712-0.704-7.488-0.704-3.84 0-7.488 0.704-3.712 0.768-7.232 2.176-3.456 1.472-6.592 3.584-3.2 2.112-5.824 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.52 6.656-1.472 3.52-2.24 7.232-0.704 3.712-0.704 7.488 0 3.776 0.704 7.488 0.768 3.712 2.24 7.168 1.408 3.52 3.52 6.656 2.112 3.2 4.8 5.824 2.624 2.688 5.76 4.8 3.2 2.112 6.656 3.52 3.52 1.472 7.232 2.176 3.712 0.768 7.488 0.768 3.776 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.408 6.592-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.112-3.2 3.52-6.72 1.472-3.456 2.176-7.168 0.768-3.712 0.768-7.488z" p-id="4552"></path></svg>', ut = '<svg t="1755138507987" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5079" width="200" height="200"><path d="M512 938.688a42.688 42.688 0 0 1-35.072-18.432l-192-277.312A42.56 42.56 0 0 1 320 576h384a42.752 42.752 0 0 1 35.072 66.944l-192 277.312a42.688 42.688 0 0 1-35.072 18.432" fill="currentColor" p-id="2016"></path><path d="M704 448H320a42.752 42.752 0 0 1-35.072-66.944l192-277.312c16-23.04 54.208-23.04 70.144 0l192 277.312A42.56 42.56 0 0 1 704 448" fill="currentColor" p-id="2015"></path></svg>', Ee = ut.replace('fill="currentColor" p-id="2016"', 'fill="#bec4c7" p-id="2016"'), ye = ut.replace('fill="currentColor" p-id="2015"', 'fill="#bec4c7" p-id="2015"');
2844
+ const vt = '<svg t="1724122044148" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4551" width="32" height="32"><path d="M707.648 401.28L489.28 560.704l22.656 30.976 22.656-30.976L316.16 401.216q-3.072-2.24-6.464-3.84-3.456-1.536-7.104-2.432-3.712-0.896-7.488-1.088-3.776-0.128-7.488 0.448-3.776 0.64-7.296 1.92-3.584 1.28-6.784 3.2-3.2 1.984-6.016 4.544-2.816 2.56-5.056 5.632-2.176 3.072-3.84 6.464-1.536 3.456-2.432 7.104-0.896 3.712-1.088 7.488-0.128 3.776 0.448 7.488 0.64 3.776 1.92 7.296 1.28 3.584 3.2 6.784 1.984 3.2 4.544 6.016 2.56 2.752 5.632 4.992l218.368 159.552q4.928 3.584 10.752 5.504 5.76 1.92 11.904 1.92 6.08 0 11.904-1.92 5.76-1.92 10.752-5.504l218.368-159.552q3.008-2.24 5.568-4.992 2.56-2.816 4.544-6.016 1.92-3.2 3.264-6.784 1.28-3.52 1.92-7.296 0.576-3.712 0.384-7.488-0.128-3.84-1.024-7.488-0.896-3.648-2.496-7.04-1.6-3.456-3.84-6.528-2.24-3.072-4.992-5.632-2.816-2.56-6.016-4.48-3.2-1.984-6.784-3.328-3.584-1.28-7.296-1.856-3.712-0.64-7.488-0.448-3.84 0.192-7.488 1.088-3.648 0.896-7.04 2.496-3.456 1.536-6.528 3.84z m61.056 30.976q0-3.84-0.768-7.488-0.704-3.712-2.176-7.232-1.472-3.456-3.52-6.656-2.112-3.136-4.8-5.76-2.688-2.688-5.76-4.8-3.2-2.112-6.72-3.584-3.456-1.408-7.168-2.176-3.712-0.704-7.488-0.704-3.84 0-7.488 0.704-3.712 0.768-7.232 2.176-3.456 1.472-6.656 3.584-3.136 2.112-5.76 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.584 6.656-1.408 3.52-2.176 7.232-0.704 3.712-0.704 7.488 0 3.776 0.704 7.488 0.768 3.712 2.176 7.168 1.472 3.52 3.584 6.656 2.112 3.2 4.8 5.824 2.624 2.688 5.76 4.8 3.2 2.112 6.656 3.52 3.52 1.472 7.232 2.176 3.712 0.768 7.488 0.768 3.776 0 7.488-0.768 3.712-0.704 7.168-2.176 3.52-1.408 6.656-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.048-3.2 3.52-6.72 1.472-3.456 2.176-7.168 0.768-3.712 0.768-7.488z m-436.736 0q0-3.84-0.768-7.488-0.704-3.712-2.176-7.232-1.408-3.456-3.52-6.656-2.112-3.136-4.8-5.76-2.688-2.688-5.76-4.8-3.2-2.112-6.656-3.584-3.52-1.408-7.232-2.176-3.712-0.704-7.488-0.704-3.84 0-7.488 0.704-3.712 0.768-7.232 2.176-3.456 1.472-6.592 3.584-3.2 2.112-5.824 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.52 6.656-1.472 3.52-2.24 7.232-0.704 3.712-0.704 7.488 0 3.776 0.704 7.488 0.768 3.712 2.24 7.168 1.408 3.52 3.52 6.656 2.112 3.2 4.8 5.824 2.624 2.688 5.76 4.8 3.2 2.112 6.656 3.52 3.52 1.472 7.232 2.176 3.712 0.768 7.488 0.768 3.776 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.408 6.592-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.112-3.2 3.52-6.72 1.472-3.456 2.176-7.168 0.768-3.712 0.768-7.488z" p-id="4552"></path></svg>', gt = '<svg t="1755138507987" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5079" width="200" height="200"><path d="M512 938.688a42.688 42.688 0 0 1-35.072-18.432l-192-277.312A42.56 42.56 0 0 1 320 576h384a42.752 42.752 0 0 1 35.072 66.944l-192 277.312a42.688 42.688 0 0 1-35.072 18.432" fill="currentColor" p-id="2016"></path><path d="M704 448H320a42.752 42.752 0 0 1-35.072-66.944l192-277.312c16-23.04 54.208-23.04 70.144 0l192 277.312A42.56 42.56 0 0 1 704 448" fill="currentColor" p-id="2015"></path></svg>', Ee = gt.replace('fill="currentColor" p-id="2016"', 'fill="#bec4c7" p-id="2016"'), ye = gt.replace('fill="currentColor" p-id="2015"', 'fill="#bec4c7" p-id="2015"');
2820
2845
  class Ce {
2821
2846
  constructor(t) {
2822
2847
  n(this, "ctx");
@@ -2839,7 +2864,7 @@ class Ce {
2839
2864
  name: "shrink",
2840
2865
  configName: "CHECKBOX_UNCHECK_SVG",
2841
2866
  configColorName: "SHRINK_ICON_COLOR",
2842
- svg: It,
2867
+ svg: vt,
2843
2868
  color: "#4E5969"
2844
2869
  },
2845
2870
  {
@@ -2891,7 +2916,7 @@ class Ce {
2891
2916
  name: "icon-select",
2892
2917
  configName: "CHECKBOX_UNCHECK_SVG",
2893
2918
  configColorName: "SHRINK_ICON_COLOR",
2894
- svg: It,
2919
+ svg: vt,
2895
2920
  color: "#4E5969"
2896
2921
  },
2897
2922
  {
@@ -2911,7 +2936,7 @@ class Ce {
2911
2936
  {
2912
2937
  name: "sort-default",
2913
2938
  configName: "SORTABLE_ICON_SVG",
2914
- svg: ut,
2939
+ svg: gt,
2915
2940
  color: "#bec4c7"
2916
2941
  }
2917
2942
  ]);
@@ -2948,22 +2973,22 @@ class Ce {
2948
2973
  }
2949
2974
  async createImageFromSVG(t, e, i = !1) {
2950
2975
  const r = new DOMParser().parseFromString(t, "image/svg+xml").documentElement;
2951
- e && r.querySelectorAll("*").forEach((h) => {
2952
- const d = h.getAttribute("fill");
2953
- (d === "currentColor" || d === null) && h.setAttribute("fill", e);
2976
+ e && r.querySelectorAll("*").forEach((l) => {
2977
+ const d = l.getAttribute("fill");
2978
+ (d === "currentColor" || d === null) && l.setAttribute("fill", e);
2954
2979
  });
2955
2980
  const a = new Image();
2956
- let l = "";
2981
+ let h = "";
2957
2982
  if (i) {
2958
- const h = new Blob([new XMLSerializer().serializeToString(r)], {
2983
+ const l = new Blob([new XMLSerializer().serializeToString(r)], {
2959
2984
  type: "image/svg+xml"
2960
2985
  });
2961
- l = URL.createObjectURL(h);
2986
+ h = URL.createObjectURL(l);
2962
2987
  } else
2963
- l = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(r));
2964
- return a.src = l, new Promise((h, d) => {
2988
+ h = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(r));
2989
+ return a.src = h, new Promise((l, d) => {
2965
2990
  a.onerror = () => d(new Error("Failed to load image:" + t)), a.onload = () => {
2966
- h(a);
2991
+ l(a);
2967
2992
  };
2968
2993
  });
2969
2994
  }
@@ -2971,9 +2996,9 @@ class Ce {
2971
2996
  return this.icons.get(t);
2972
2997
  }
2973
2998
  }
2974
- class ht extends Yt {
2975
- constructor(e, i, s, o, r, a, l) {
2976
- super(e, s, o, r, a, "header", l.fixed);
2999
+ class ct extends Yt {
3000
+ constructor(e, i, s, o, r, a, h) {
3001
+ super(e, s, o, r, a, "header", h.fixed);
2977
3002
  n(this, "align");
2978
3003
  n(this, "hideHeaderSelection", !1);
2979
3004
  n(this, "verticalAlign", "middle");
@@ -3011,6 +3036,7 @@ class ht extends Yt {
3011
3036
  n(this, "visibleWidth", 0);
3012
3037
  n(this, "visibleHeight", 0);
3013
3038
  n(this, "maxLineClamp", "auto");
3039
+ n(this, "domDataset", {});
3014
3040
  n(this, "drawTextX", 0);
3015
3041
  n(this, "drawTextY", 0);
3016
3042
  n(this, "drawTextWidth", 0);
@@ -3030,7 +3056,7 @@ class ht extends Yt {
3030
3056
  n(this, "drawSortImageHeight", 0);
3031
3057
  n(this, "drawSortImageName", "");
3032
3058
  n(this, "drawSortImageSource");
3033
- 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 = At(), this.overflowTooltipShow = l.overflowTooltipHeaderShow !== !1, this.hasChildren = l.children && l.children.length > 0 || !1, this.render = l.renderHeader;
3059
+ 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 = h.key, this.minWidth = h.minWidth, this.maxWidth = h.maxWidth, this.type = h.type || "", this.editorType = h.editorType || "text", this.hideHeaderSelection = h.hideHeaderSelection || !1, this.align = h.headerAlign || h.align || this.ctx.config.COLUMNS_ALIGN, this.verticalAlign = h.headerVerticalAlign || h.verticalAlign || this.ctx.config.COLUMNS_VERTICAL_ALIGN, this.fixed = h.fixed, this.level = h.level || 0, this.operation = h.operation || !1, this.text = h.title, this.column = h, this.colspan = h.colspan || 1, this.widthFillDisable = h.widthFillDisable || !1, this.rowspan = h.rowspan || 1, this.rules = h.rules, this.readonly = h.readonly || !1, this.required = h.required || !1, this.sortIconName = h.sortIconName || "sort-default", this.sortAscIconName = h.sortAscIconName || "sort-asc", this.sortDescIconName = h.sortDescIconName || "sort-desc", this.rowKey = Ht(), this.overflowTooltipShow = h.overflowTooltipHeaderShow !== !1, this.hasChildren = h.children && h.children.length > 0 || !1, this.render = h.renderHeader;
3034
3060
  }
3035
3061
  /**
3036
3062
  * 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
@@ -3050,11 +3076,11 @@ class ht extends Yt {
3050
3076
  const { HEADER_CELL_STYLE_METHOD: e, HEADER_BG_COLOR: i, HEADER_TEXT_COLOR: s } = this.ctx.config;
3051
3077
  let o = i, r = s;
3052
3078
  if (typeof e == "function") {
3053
- const a = e, { backgroundColor: l, color: h } = a({
3079
+ const a = e, { backgroundColor: h, color: l } = a({
3054
3080
  colIndex: this.colIndex,
3055
3081
  column: this.column
3056
3082
  }) || {};
3057
- l && (o = l), h && (r = h);
3083
+ h && (o = h), l && (r = l);
3058
3084
  }
3059
3085
  this.drawCellBgColor = o, this.drawTextColor = r;
3060
3086
  }
@@ -3078,7 +3104,7 @@ class ht extends Yt {
3078
3104
  const {
3079
3105
  paint: e,
3080
3106
  config: { HEADER_FONT: i, CELL_PADDING: s }
3081
- } = this.ctx;
3107
+ } = this.ctx, o = `${this.displayText}_${this.drawTextWidth}`;
3082
3108
  this.ellipsis = e.drawText(
3083
3109
  this.displayText,
3084
3110
  this.drawTextX,
@@ -3094,8 +3120,24 @@ class ht extends Yt {
3094
3120
  maxLineClamp: this.maxLineClamp,
3095
3121
  offsetRight: this.column.sortBy ? 16 : 0,
3096
3122
  // 排序图标占位
3097
- textCallback: (o) => {
3098
- this.column.sortBy && (this.drawSortImageX = o.right + 4, this.drawSortImageY = o.top + (o.height - 16) / 2);
3123
+ offsetLeft: this.required ? 12 : 0,
3124
+ // 必填星号占位
3125
+ cacheTextKey: o,
3126
+ textCallback: (r) => {
3127
+ this.column.sortBy && (this.drawSortImageX = r.right + 4, this.drawSortImageY = r.top + (r.height - 16) / 2), this.required && e.drawText(
3128
+ "*",
3129
+ r.left - 18,
3130
+ r.top + (r.height - 12) / 2,
3131
+ 24,
3132
+ 24,
3133
+ {
3134
+ color: "red",
3135
+ font: "18px Arial",
3136
+ align: "center",
3137
+ verticalAlign: "middle",
3138
+ padding: 0
3139
+ }
3140
+ );
3099
3141
  }
3100
3142
  }
3101
3143
  );
@@ -3113,10 +3155,10 @@ class ht extends Yt {
3113
3155
  drawSelection() {
3114
3156
  if (!this.hideHeaderSelection && ["index-selection", "selection", "selection-tree", "tree-selection"].includes(this.type)) {
3115
3157
  const { indeterminate: e, check: i, selectable: s } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: o = 0, CELL_PADDING: r } = this.ctx.config;
3116
- let a = this.drawX + (this.width - o) / 2, l = this.drawY + (this.height - o) / 2;
3117
- this.drawTextX = a + o - r / 2, this.drawTextWidth = this.drawX + this.visibleWidth - this.drawTextX, (this.align === "left" || this.align === "right") && (a = this.drawX + r, this.drawTextX = a + o - r / 2, this.drawTextWidth = this.drawX + this.visibleWidth - this.drawTextX), this.verticalAlign === "top" ? l = this.drawY + r / 2 : this.verticalAlign === "bottom" && (l = this.drawY + this.height - o - r / 2);
3118
- let h = this.ctx.icons.get("checkbox-uncheck"), d = "checkbox-uncheck";
3119
- e ? (h = this.ctx.icons.get("checkbox-indeterminate"), d = "checkbox-indeterminate") : i && s ? (h = this.ctx.icons.get("checkbox-check"), d = "checkbox-check") : i && !s ? (h = this.ctx.icons.get("checkbox-check-disabled"), d = "checkbox-check-disabled") : !i && s ? (h = this.ctx.icons.get("checkbox-uncheck"), d = "checkbox-uncheck") : (h = this.ctx.icons.get("checkbox-disabled"), d = "checkbox-disabled"), h && (this.drawSelectionImageX = a, this.drawSelectionImageY = l, this.drawSelectionImageWidth = o, this.drawSelectionImageHeight = o, this.drawSelectionImageName = d, this.drawSelectionImageSource = h, this.ctx.paint.drawImage(
3158
+ let a = this.drawX + (this.width - o) / 2, h = this.drawY + (this.height - o) / 2;
3159
+ this.drawTextX = a + o - r / 2, this.drawTextWidth = this.drawX + this.visibleWidth - this.drawTextX, (this.align === "left" || this.align === "right") && (a = this.drawX + r, this.drawTextX = a + o - r / 2, this.drawTextWidth = this.drawX + this.visibleWidth - this.drawTextX), this.verticalAlign === "top" ? h = this.drawY + r / 2 : this.verticalAlign === "bottom" && (h = this.drawY + this.height - o - r / 2);
3160
+ let l = this.ctx.icons.get("checkbox-uncheck"), d = "checkbox-uncheck";
3161
+ e ? (l = this.ctx.icons.get("checkbox-indeterminate"), d = "checkbox-indeterminate") : i && s ? (l = this.ctx.icons.get("checkbox-check"), d = "checkbox-check") : i && !s ? (l = this.ctx.icons.get("checkbox-check-disabled"), d = "checkbox-check-disabled") : !i && s ? (l = this.ctx.icons.get("checkbox-uncheck"), d = "checkbox-uncheck") : (l = this.ctx.icons.get("checkbox-disabled"), d = "checkbox-disabled"), l && (this.drawSelectionImageX = a, this.drawSelectionImageY = h, this.drawSelectionImageWidth = o, this.drawSelectionImageHeight = o, this.drawSelectionImageName = d, this.drawSelectionImageSource = l, this.ctx.paint.drawImage(
3120
3162
  this.drawSelectionImageSource,
3121
3163
  this.drawSelectionImageX,
3122
3164
  this.drawSelectionImageY,
@@ -3280,7 +3322,7 @@ class be {
3280
3322
  t.drawSelectionImageWidth,
3281
3323
  t.drawSelectionImageHeight
3282
3324
  ))
3283
- if (t instanceof ht)
3325
+ if (t instanceof ct)
3284
3326
  t.drawSelectionImageName === "checkbox-uncheck" || t.drawSelectionImageName === "checkbox-indeterminate" ? this.ctx.database.toggleAllSelection() : t.drawSelectionImageName === "checkbox-check" && this.ctx.database.clearSelection(!0);
3285
3327
  else {
3286
3328
  if (!this.ctx.database.getRowSelectable(t.rowKey))
@@ -3305,8 +3347,8 @@ class be {
3305
3347
  t.drawTreeImageHeight
3306
3348
  ))
3307
3349
  return;
3308
- const l = this.ctx.database.getRowForRowKey(t.rowKey), { expand: h = !1, expandLazy: d = !1 } = l || {}, { EXPAND_LAZY: f, EXPAND_LAZY_METHOD: u } = this.ctx.config;
3309
- if (f && u && !h && !d)
3350
+ const h = this.ctx.database.getRowForRowKey(t.rowKey), { expand: l = !1, expandLazy: d = !1 } = h || {}, { EXPAND_LAZY: f, EXPAND_LAZY_METHOD: u } = this.ctx.config;
3351
+ if (f && u && !l && !d)
3310
3352
  typeof u == "function" && (this.ctx.database.expandLoading(t.rowKey, !0), u({
3311
3353
  row: t.row,
3312
3354
  rowIndex: t.rowIndex,
@@ -3335,8 +3377,8 @@ class be {
3335
3377
  ))
3336
3378
  return;
3337
3379
  const a = this.ctx.database.getSortState(t.key);
3338
- let l;
3339
- a.direction === "none" ? l = "asc" : a.direction === "asc" ? l = "desc" : l = "none", this.ctx.database.setSortState(t.key, l);
3380
+ let h;
3381
+ a.direction === "none" ? h = "asc" : a.direction === "asc" ? h = "desc" : h = "none", this.ctx.database.setSortState(t.key, h);
3340
3382
  }
3341
3383
  /**
3342
3384
  * 图标进入和离开事件,包括选中,展开,提示图标等
@@ -3345,7 +3387,7 @@ class be {
3345
3387
  */
3346
3388
  imageEnterAndLeave(t, e) {
3347
3389
  const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), o = i, r = s;
3348
- if (t instanceof ht) {
3390
+ if (t instanceof ct) {
3349
3391
  if (t.drawSelectionImageSource && this.isInsideElement(
3350
3392
  r,
3351
3393
  o,
@@ -3369,7 +3411,7 @@ class be {
3369
3411
  return;
3370
3412
  }
3371
3413
  }
3372
- if (t instanceof xt) {
3414
+ if (t instanceof ut) {
3373
3415
  if (t.drawSelectionImageSource && this.isInsideElement(
3374
3416
  r,
3375
3417
  o,
@@ -3419,15 +3461,15 @@ class be {
3419
3461
  if (this.isInsideBody(e))
3420
3462
  for (const r of i) {
3421
3463
  const a = r.fixedCells.concat(r.noFixedCells);
3422
- for (const l of a) {
3423
- const h = l.getDrawX(), d = l.getDrawY();
3464
+ for (const h of a) {
3465
+ const l = h.getDrawX(), d = h.getDrawY();
3424
3466
  if (o) {
3425
- if (t > h && t < h + l.visibleWidth && e > d && e < d + l.visibleHeight) {
3426
- s(l);
3467
+ if (t > l && t < l + h.visibleWidth && e > d && e < d + h.visibleHeight) {
3468
+ s(h);
3427
3469
  return;
3428
3470
  }
3429
- } else if (t > h && t < h + l.width && e > d && e < d + l.height) {
3430
- s(l);
3471
+ } else if (t > l && t < l + h.width && e > d && e < d + h.height) {
3472
+ s(h);
3431
3473
  return;
3432
3474
  }
3433
3475
  }
@@ -3560,26 +3602,27 @@ class Re {
3560
3602
  n(this, "database");
3561
3603
  n(this, "history");
3562
3604
  n(this, "config");
3605
+ n(this, "drawTime", 0);
3563
3606
  const {
3564
3607
  containerElement: i,
3565
3608
  stageElement: s,
3566
3609
  canvasElement: o,
3567
3610
  overlayerElement: r,
3568
3611
  editorElement: a,
3569
- emptyElement: l,
3570
- contextMenuElement: h
3612
+ emptyElement: h,
3613
+ contextMenuElement: l
3571
3614
  } = t;
3572
- this.containerElement = i, s.tabIndex = 0, this.stageElement = s, this.canvasElement = o, this.overlayerElement = r, this.editorElement = a, this.emptyElement = l, this.contextMenuElement = h, this.config = new Rt(e.config || {}), this.eventBus = new me(), this.eventBrowser = new we(this), this.eventTable = new be(this), this.paint = new pe(this.canvasElement), this.database = new ue(this, e), this.history = new ge(this), this.icons = new Ce(this);
3615
+ this.containerElement = i, s.tabIndex = 0, this.stageElement = s, this.canvasElement = o, this.overlayerElement = r, this.editorElement = a, this.emptyElement = h, this.contextMenuElement = l, this.config = new It(e.config || {}), this.eventBus = new me(), this.eventBrowser = new we(this), this.eventTable = new be(this), this.paint = new pe(this.canvasElement), this.database = new ue(this, e), this.history = new ge(this), this.icons = new Ce(this);
3573
3616
  }
3574
3617
  setConfig(t) {
3575
- this.config = new Rt(t);
3618
+ this.config = new It(t);
3576
3619
  }
3577
3620
  setItemValueByEditor(t, e, i, s = !0, o = !0, r = !0) {
3578
3621
  if (this.config.ENABLE_MERGE_CELL_LINK) {
3579
3622
  const a = this.database.getVirtualBodyCellByKey(t, e);
3580
3623
  if (a && (a.mergeRow || a.mergeCol)) {
3581
- const { dataList: l } = a.getSpanInfo(), h = l.map((d) => ({ ...d, value: i }));
3582
- this.database.batchSetItemValue(h, s, r);
3624
+ const { dataList: h } = a.getSpanInfo(), l = h.map((d) => ({ ...d, value: i }));
3625
+ this.database.batchSetItemValue(l, s, r);
3583
3626
  return;
3584
3627
  }
3585
3628
  }
@@ -3591,9 +3634,9 @@ class Re {
3591
3634
  t.forEach((o) => {
3592
3635
  const r = this.database.getRowIndexForRowKey(o.rowKey), a = this.database.getColIndexForKey(o.key);
3593
3636
  if (r === void 0 || a === void 0) return;
3594
- const l = this.database.getVirtualBodyCell(r, a);
3595
- if (l) {
3596
- const { dataList: h } = l.getSpanInfo(), d = h.map((f) => ({ ...f, value: o.value }));
3637
+ const h = this.database.getVirtualBodyCell(r, a);
3638
+ if (h) {
3639
+ const { dataList: l } = h.getSpanInfo(), d = l.map((f) => ({ ...f, value: o.value }));
3597
3640
  s.push(...d);
3598
3641
  }
3599
3642
  }), this.database.batchSetItemValue(s, e, i);
@@ -3638,7 +3681,7 @@ class Re {
3638
3681
  for (let o = 0; o <= e[1] - e[0]; o++) {
3639
3682
  const r = [];
3640
3683
  for (let a = 0; a <= i[1] - i[0]; a++) {
3641
- const l = o + e[0], h = a + i[0], d = this.database.getVirtualBodyCell(l, h);
3684
+ const h = o + e[0], l = a + i[0], d = this.database.getVirtualBodyCell(h, l);
3642
3685
  d && (d.selectorCellValueType === "displayText" ? r.push(d.displayText) : r.push(d.getValue()));
3643
3686
  }
3644
3687
  s += `${r.join(" ")}\r`, t.push(r);
@@ -3759,8 +3802,8 @@ class St {
3759
3802
  if (this.isOnScrollbar(e, i) && t.target === this.ctx.canvasElement ? this.isFocus = !0 : this.isFocus = !1, r === 0 || s == this.clientX && o == this.clientY) return;
3760
3803
  let a = 0;
3761
3804
  if (this.type === "horizontal" ? a = s - this.clientX : a = o - this.clientY, this.isDragging && a !== 0) {
3762
- let l = 0;
3763
- this.type === "vertical" ? l = this.dragStart + a / (this.visibleDistance - this.barHeight) * this.distance : l = this.dragStart + a / (this.visibleDistance - this.barWidth) * this.distance, this.scroll = Math.max(0, Math.min(l, this.distance));
3805
+ let h = 0;
3806
+ this.type === "vertical" ? h = this.dragStart + a / (this.visibleDistance - this.barHeight) * this.distance : h = this.dragStart + a / (this.visibleDistance - this.barWidth) * this.distance, this.scroll = Math.max(0, Math.min(h, this.distance));
3764
3807
  }
3765
3808
  }
3766
3809
  isPointInElement(t, e, i, s, o, r) {
@@ -3786,21 +3829,21 @@ class St {
3786
3829
  stageHeight: i,
3787
3830
  stageWidth: s,
3788
3831
  config: { SCROLLER_TRACK_SIZE: o = 0, SCROLLER_SIZE: r = 0, BORDER: a }
3789
- } = this.ctx, l = s, h = i, d = e.height, f = e.width, u = t.height, x = this.ctx.footer.height;
3832
+ } = this.ctx, h = s, l = i, d = e.height, f = e.width, u = t.height, x = this.ctx.footer.height;
3790
3833
  if (this.type === "vertical") {
3791
- this.visibleDistance = h - o - d, this.distance = u - this.visibleDistance + x, this.trackX = l - o, this.trackY = 0, this.splitPoints = [this.trackX, d, this.trackX + o, d], this.trackWidth = o, this.trackHeight = h, this.barX = this.trackX - 1 + (o - r) / 2, this.barWidth = r;
3834
+ this.visibleDistance = l - o - d, this.distance = u - this.visibleDistance + x, this.trackX = h - o, this.trackY = 0, this.splitPoints = [this.trackX, d, this.trackX + o, d], this.trackWidth = o, this.trackHeight = l, this.barX = this.trackX - 1 + (o - r) / 2, this.barWidth = r;
3792
3835
  const w = this.distance ? this.visibleDistance / (u + x) : 0;
3793
3836
  let m = Math.floor(w * this.visibleDistance);
3794
3837
  m < 30 ? m = 30 : m > this.visibleDistance && (m = 0), this.barHeight = m, this.barY = d + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
3795
3838
  } else {
3796
- this.visibleDistance = l - o, this.distance = f - this.visibleDistance, this.splitPoints = [
3797
- l - o,
3839
+ this.visibleDistance = h - o, this.distance = f - this.visibleDistance, this.splitPoints = [
3798
3840
  h - o,
3799
3841
  l - o,
3800
- h
3842
+ h - o,
3843
+ l
3801
3844
  ];
3802
3845
  const w = a ? 0 : 0.5;
3803
- this.trackX = 0, this.trackY = h - o + w, this.trackWidth = l, this.trackHeight = o;
3846
+ this.trackX = 0, this.trackY = l - o + w, this.trackWidth = h, this.trackHeight = o;
3804
3847
  const m = this.distance ? this.visibleDistance / f : 0;
3805
3848
  let g = Math.floor(m * this.visibleDistance);
3806
3849
  this.barY = this.trackY - 1 + (o - r) / 2, g < 30 ? g = 30 : g >= this.visibleDistance && (g = 0), this.barWidth = g, this.barHeight = r, this.barX = this.scroll / this.distance * (this.visibleDistance - this.barWidth), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
@@ -3891,7 +3934,7 @@ class Ie {
3891
3934
  this.setScrollY(o - e.visibleHeight / 2);
3892
3935
  }
3893
3936
  }
3894
- class Se {
3937
+ class ve {
3895
3938
  constructor(t) {
3896
3939
  n(this, "ctx");
3897
3940
  // 上下文
@@ -3930,7 +3973,7 @@ class Se {
3930
3973
  n(this, "renderFixedCellHeaders", []);
3931
3974
  this.ctx = t, this.ctx.on(
3932
3975
  "resetHeader",
3933
- Ht(() => {
3976
+ Z(() => {
3934
3977
  this.init(), this.ctx.emit("draw");
3935
3978
  }, 100)
3936
3979
  ), this.init(), this.initResizeColumn();
@@ -3940,7 +3983,7 @@ class Se {
3940
3983
  config: { HEADER_HEIGHT: t, SCROLLER_TRACK_SIZE: e }
3941
3984
  } = this.ctx, i = this.ctx.database.getColumns();
3942
3985
  this.columns = i, this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [];
3943
- const s = Dt(i), o = et(i);
3986
+ const s = Dt(i), o = it(i);
3944
3987
  this.height = t * s, this.width = o.reduce((f, u) => {
3945
3988
  const x = u.width || 100, { maxWidth: w, minWidth: m } = u;
3946
3989
  return w && x > w ? f + w : m && x < m ? f + m : f + x;
@@ -3949,13 +3992,13 @@ class Se {
3949
3992
  this.columnIndex = 0, this.resizeNum = 0, this.render(r, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
3950
3993
  const a = this.ctx.containerElement.getBoundingClientRect();
3951
3994
  this.resizeNum > 0 ? this.ctx.stageWidth = Math.floor(a.width) : this.ctx.stageWidth = Math.floor(this.width + e), this.ctx.stageElement.style.width = this.ctx.stageWidth + "px", this.visibleWidth = this.ctx.stageWidth - e;
3952
- const l = this.visibleWidth - this.width;
3953
- if (this.resizeNum && l > 0) {
3954
- const f = Math.floor(l / this.resizeNum * 100) / 100;
3995
+ const h = this.visibleWidth - this.width;
3996
+ if (this.resizeNum && h > 0) {
3997
+ const f = Math.floor(h / this.resizeNum * 100) / 100;
3955
3998
  this.resizeAllColumn(f);
3956
3999
  }
3957
- const h = this.fixedLeftCellHeaders.filter((f) => !f.hasChildren);
3958
- this.ctx.fixedLeftWidth = h.reduce((f, u) => f + u.width, 0);
4000
+ const l = this.fixedLeftCellHeaders.filter((f) => !f.hasChildren);
4001
+ this.ctx.fixedLeftWidth = l.reduce((f, u) => f + u.width, 0);
3959
4002
  const d = this.fixedRightCellHeaders.filter((f) => !f.hasChildren);
3960
4003
  this.ctx.fixedRightWidth = d.reduce((f, u) => f + u.width, e), this.ctx.maxColIndex = this.leafCellHeaders.length - 1, this.ctx.header.x = this.x, this.ctx.header.y = this.y, this.ctx.header.width = this.width, this.ctx.header.height = this.height, this.ctx.header.visibleWidth = this.visibleWidth, this.ctx.header.visibleHeight = this.visibleHeight;
3961
4004
  }
@@ -3976,8 +4019,8 @@ class Se {
3976
4019
  } = this.ctx;
3977
4020
  if (this.isResizing && this.resizeTarget) {
3978
4021
  const o = this.resizeTarget.width, r = this.resizeTarget.minWidth, a = this.resizeTarget.maxWidth;
3979
- let l = e.clientX - this.clientX;
3980
- l + o < s && (l = -(o - s)), r && l + o < r && (l = -(o - r)), a && l + o > a && (l = a - o), this.resizeDiff = l, this.ctx.emit("draw");
4022
+ let h = e.clientX - this.clientX;
4023
+ h + o < s && (h = -(o - s)), r && h + o < r && (h = -(o - r)), a && h + o > a && (h = a - o), this.resizeDiff = h, this.ctx.emit("draw");
3981
4024
  } else {
3982
4025
  if (this.resizeTarget = null, this.isMouseDown)
3983
4026
  return;
@@ -3988,9 +4031,9 @@ class Se {
3988
4031
  this.ctx.stageElement.style.cursor === "col-resize" && (this.ctx.stageElement.style.cursor = "default");
3989
4032
  const o = [...this.renderFixedCellHeaders, ...this.renderCenterCellHeaders];
3990
4033
  for (const r of o) {
3991
- const { offsetX: a, offsetY: l } = this.ctx.getOffset(e), h = a, d = r.getDrawX();
3992
- h > d + r.width - 5 && h < d + r.width + 4 && h < i - 4 && // 视窗中最后一列不允许调整宽
3993
- r.colspan <= 1 && this.ctx.isTarget(e) && l <= this.height && (this.ctx.stageElement.style.cursor = "col-resize", this.resizeTarget = r);
4034
+ const { offsetX: a, offsetY: h } = this.ctx.getOffset(e), l = a, d = r.getDrawX();
4035
+ l > d + r.width - 5 && l < d + r.width + 4 && l < i - 4 && // 视窗中最后一列不允许调整宽
4036
+ r.colspan <= 1 && this.ctx.isTarget(e) && h <= this.height && (this.ctx.stageElement.style.cursor = "col-resize", this.resizeTarget = r);
3994
4037
  }
3995
4038
  }
3996
4039
  }));
@@ -4044,10 +4087,10 @@ class Se {
4044
4087
  let s = e;
4045
4088
  const { HEADER_HEIGHT: o = 0 } = this.ctx.config;
4046
4089
  for (let r = 0; r < i; r++) {
4047
- const a = t[r], l = o * (a.rowspan || 0), h = o * (a.level || 0);
4090
+ const a = t[r], h = o * (a.rowspan || 0), l = o * (a.level || 0);
4048
4091
  let { minWidth: d, maxWidth: f } = a, u = a.width || 100;
4049
- d && u < d && (u = d), f && u > f && (u = f), a.children && (u = et(a.children).reduce((m, g) => m + ((g == null ? void 0 : g.width) || 100), 0));
4050
- const x = new ht(this.ctx, this.columnIndex, s, h, u, l, a);
4092
+ d && u < d && (u = d), f && u > f && (u = f), a.children && (u = it(a.children).reduce((m, g) => m + ((g == null ? void 0 : g.width) || 100), 0));
4093
+ const x = new ct(this.ctx, this.columnIndex, s, l, u, h, a);
4051
4094
  this.ctx.database.setHeader(a.key, x), this.allCellHeaders.push(x), a.children || (this.leafCellHeaders.push(x), x.column.widthFillDisable || this.resizeNum++), a.fixed === "left" ? this.fixedLeftCellHeaders.push(x) : a.fixed === "right" ? this.fixedRightCellHeaders.push(x) : this.centerCellHeaders.push(x), !a.children && this.columnIndex++, a.children && this.render(a.children, s), s += u;
4052
4095
  }
4053
4096
  }
@@ -4079,8 +4122,8 @@ class Se {
4079
4122
  colorStart: "rgba(0,0,0,0.1)",
4080
4123
  colorEnd: "rgba(0,0,0,0)"
4081
4124
  }), i < Math.floor(s.width - o - 1) && e !== a) {
4082
- const l = s.width - (this.x + this.width) + o - e;
4083
- this.ctx.paint.drawShadow(l, this.y, e, this.height, {
4125
+ const h = s.width - (this.x + this.width) + o - e;
4126
+ this.ctx.paint.drawShadow(h, this.y, e, this.height, {
4084
4127
  fillColor: r,
4085
4128
  side: "left",
4086
4129
  shadowWidth: 4,
@@ -4122,7 +4165,7 @@ class Se {
4122
4165
  }
4123
4166
  }
4124
4167
  class Bt {
4125
- constructor(t, e, i = 0, s = 0, o = 0, r = 0, a, l = "body") {
4168
+ constructor(t, e, i = 0, s = 0, o = 0, r = 0, a, h = "body") {
4126
4169
  n(this, "ctx");
4127
4170
  n(this, "x", 0);
4128
4171
  n(this, "y", 0);
@@ -4137,12 +4180,12 @@ class Bt {
4137
4180
  n(this, "rowType", "body");
4138
4181
  n(this, "data");
4139
4182
  n(this, "calculatedHeight", -1);
4140
- this.ctx = t, this.x = i, this.y = s, this.width = o, this.height = r, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e) || "", this.rowType = l, this.data = a, this.update();
4183
+ this.ctx = t, this.x = i, this.y = s, this.width = o, this.height = r, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e) || "", this.rowType = h, this.data = a, this.update();
4141
4184
  }
4142
4185
  update() {
4143
4186
  const { header: t } = this.ctx, e = [], i = [], s = [], o = [];
4144
4187
  t.renderLeafCellHeaders.forEach((r) => {
4145
- const a = new xt(
4188
+ const a = new ut(
4146
4189
  this.ctx,
4147
4190
  this.rowIndex,
4148
4191
  r.colIndex,
@@ -4155,11 +4198,11 @@ class Bt {
4155
4198
  this.rowType
4156
4199
  );
4157
4200
  a.fixed ? i.push(a) : s.push(a), e.push(a), a.autoRowHeight && o.push(a);
4158
- }), this.cells = e, this.calculatedHeightCells = o, this.fixedCells = i, this.noFixedCells = s, this.calculatedHeight = this.getCalculatedHeight();
4201
+ }), this.cells = e, this.calculatedHeightCells = o, this.fixedCells = i, this.noFixedCells = s;
4159
4202
  }
4160
- getCalculatedHeight() {
4203
+ updateCalculatedHeight() {
4161
4204
  const t = this.calculatedHeightCells.map((e) => e.getAutoHeight());
4162
- return t.length ? Math.max(...t) : -1;
4205
+ this.calculatedHeight = t.length ? Math.max(...t) : -1;
4163
4206
  }
4164
4207
  drawCenter() {
4165
4208
  this.noFixedCells.forEach((t) => {
@@ -4182,7 +4225,7 @@ class Bt {
4182
4225
  });
4183
4226
  }
4184
4227
  }
4185
- class ve {
4228
+ class Se {
4186
4229
  constructor(t) {
4187
4230
  n(this, "resizeTarget", null);
4188
4231
  //调整行大小的目标
@@ -4219,8 +4262,8 @@ class ve {
4219
4262
  FOOTER_FIXED: o,
4220
4263
  SCROLLER_TRACK_SIZE: r = 0,
4221
4264
  HEIGHT: a,
4222
- EMPTY_BODY_HEIGHT: l = 0,
4223
- MAX_HEIGHT: h = 0,
4265
+ EMPTY_BODY_HEIGHT: h = 0,
4266
+ MAX_HEIGHT: l = 0,
4224
4267
  ENABLE_OFFSET_HEIGHT: d = 0,
4225
4268
  OFFSET_HEIGHT: f = 0,
4226
4269
  FOOTER_POSITION: u
@@ -4232,20 +4275,20 @@ class ve {
4232
4275
  const { data: x, sumHeight: w } = s.getData();
4233
4276
  this.height = w, this.data = x, this.width = e.width, this.visibleWidth = this.ctx.stageWidth - r;
4234
4277
  const m = this.ctx.footer.height;
4235
- !this.data.length && !a ? this.height = l : !this.data.length && a && (this.height = a - e.height - m - r);
4278
+ !this.data.length && !a ? this.height = h : !this.data.length && a && (this.height = a - e.height - m - r);
4236
4279
  let g = this.height + e.height + r;
4237
4280
  g += m;
4238
4281
  let p = g;
4239
4282
  const y = window.innerHeight, { top: E } = this.containerRect || this.ctx.containerElement.getBoundingClientRect();
4240
4283
  if (y > E && d && !a) {
4241
4284
  const T = y - E - f;
4242
- T > e.height + r ? p = T : g > h && (p = h);
4243
- } else this.data.length && a ? p = a : this.data.length && h && g > h && (p = h);
4285
+ T > e.height + r ? p = T : g > l && (p = l);
4286
+ } else this.data.length && a ? p = a : this.data.length && l && g > l && (p = l);
4244
4287
  p > 0 && (this.ctx.stageHeight = Math.floor(p), this.ctx.stageElement.style.height = `${this.ctx.stageHeight}px`);
4245
4288
  let R = this.ctx.stageHeight - e.height - r;
4246
4289
  o ? this.visibleHeight = R - m : 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;
4247
- const C = window.devicePixelRatio || 1, I = this.ctx.stageWidth * C, v = this.ctx.stageHeight * C;
4248
- t.width = Math.round(I), t.height = Math.round(v);
4290
+ const C = window.devicePixelRatio || 1, I = this.ctx.stageWidth * C, S = this.ctx.stageHeight * C;
4291
+ t.width = Math.round(I), t.height = Math.round(S);
4249
4292
  const _ = this.data.length ? "not-empty" : "empty";
4250
4293
  this.ctx.emit("emptyChange", {
4251
4294
  isEmpty: _,
@@ -4254,10 +4297,10 @@ class ve {
4254
4297
  bodyHeight: this.height,
4255
4298
  footerHeight: m,
4256
4299
  width: this.width,
4257
- height: this.data.length ? 0 : l + m
4300
+ height: this.data.length ? 0 : h + m
4258
4301
  });
4259
- const S = Math.round(t.width / C * 1e4) / 1e4, b = Math.round(t.height / C * 1e4) / 1e4;
4260
- this.ctx.canvasElement.setAttribute("style", `height:${b}px;width:${S}px;`), this.ctx.paint.scale(C);
4302
+ const v = Math.round(t.width / C * 1e4) / 1e4, b = Math.round(t.height / C * 1e4) / 1e4;
4303
+ this.ctx.canvasElement.setAttribute("style", `height:${b}px;width:${v}px;`), this.ctx.paint.scale(C);
4261
4304
  }
4262
4305
  // 调整行的高度
4263
4306
  initResizeRow() {
@@ -4277,8 +4320,8 @@ class ve {
4277
4320
  }), this.ctx.on("mousemove", (e) => {
4278
4321
  if (this.ctx.editing) return;
4279
4322
  const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), o = i, r = s, a = e.clientY, {
4280
- stageHeight: l,
4281
- scrollY: h,
4323
+ stageHeight: h,
4324
+ scrollY: l,
4282
4325
  config: { RESIZE_ROW_MIN_HEIGHT: d = 0 }
4283
4326
  } = this.ctx;
4284
4327
  if (this.isResizing && this.resizeTarget) {
@@ -4298,7 +4341,7 @@ class ve {
4298
4341
  this.ctx.stageElement.style.cursor === "row-resize" && (this.ctx.stageElement.style.cursor = "default");
4299
4342
  for (let f = 0; f < this.renderRows.length; f++) {
4300
4343
  const u = this.renderRows[f];
4301
- if (o > u.y - h + u.height - 1.5 && o < u.y - h + u.height + 1.5 && o < l - 4)
4344
+ if (o > u.y - l + u.height - 1.5 && o < u.y - l + u.height + 1.5 && o < h - 4)
4302
4345
  for (let w = 0; w < u.cells.length; w++) {
4303
4346
  const m = u.cells[w];
4304
4347
  r > m.drawX + 10 && r < m.drawX + m.width - 10 && m.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = u);
@@ -4347,8 +4390,8 @@ class ve {
4347
4390
  colorStart: "rgba(0,0,0,0.1)",
4348
4391
  colorEnd: "rgba(0,0,0,0)"
4349
4392
  }), i < Math.floor(s.width - o - 1) && e !== a) {
4350
- const l = s.width - (this.x + this.width) + o - e;
4351
- this.ctx.paint.drawShadow(l, this.y, e, this.height, {
4393
+ const h = s.width - (this.x + this.width) + o - e;
4394
+ this.ctx.paint.drawShadow(h, this.y, e, this.height, {
4352
4395
  fillColor: r,
4353
4396
  side: "left",
4354
4397
  shadowWidth: 4,
@@ -4376,12 +4419,12 @@ class ve {
4376
4419
  config: { CELL_HEIGHT: s }
4377
4420
  } = this.ctx, o = i, { data: r, positions: a } = e.getData();
4378
4421
  this.ctx.maxRowIndex = r.length - 1;
4379
- let l = this.binarySearch(a, o), h = this.binarySearch(a, o + this.visibleHeight);
4380
- if (h === -1 && (h = this.ctx.maxRowIndex), l === -1 && h === this.ctx.maxRowIndex) {
4422
+ let h = this.binarySearch(a, o), l = this.binarySearch(a, o + this.visibleHeight);
4423
+ if (l === -1 && (l = this.ctx.maxRowIndex), h === -1 && l === this.ctx.maxRowIndex) {
4381
4424
  const f = Math.floor(this.visibleHeight / s);
4382
- l = this.ctx.maxRowIndex - f;
4425
+ h = this.ctx.maxRowIndex - f;
4383
4426
  }
4384
- this.headIndex = Math.max(0, l), this.tailIndex = Math.min(this.ctx.maxRowIndex, h + 1), this.visibleRows = r.slice(this.headIndex, this.tailIndex + 1), this.ctx.body.headIndex = this.headIndex, this.ctx.body.tailIndex = this.tailIndex, this.ctx.body.visibleRows = this.visibleRows;
4427
+ this.headIndex = Math.max(0, h), this.tailIndex = Math.min(this.ctx.maxRowIndex, l + 1), this.visibleRows = r.slice(this.headIndex, this.tailIndex + 1), this.ctx.body.headIndex = this.headIndex, this.ctx.body.tailIndex = this.tailIndex, this.ctx.body.visibleRows = this.visibleRows;
4385
4428
  const d = [];
4386
4429
  for (let f = 0; f < this.visibleRows.length; f++) {
4387
4430
  const u = this.headIndex + f, x = this.visibleRows[f], { height: w, top: m } = this.ctx.database.getPositionForRowIndex(u), g = new Bt(this.ctx, u, 0, m + this.y, t.width, w, x);
@@ -4391,12 +4434,16 @@ class ve {
4391
4434
  }
4392
4435
  updateAutoHeight() {
4393
4436
  const t = this.ctx.body.renderRows;
4394
- this.ctx.database.updateOverlayerAutoHeightMap();
4395
- const e = t.map((i) => ({
4396
- height: i.calculatedHeight,
4397
- rowIndex: i.rowIndex
4437
+ if (!t.some((s) => s.calculatedHeightCells.length > 0))
4438
+ return;
4439
+ t.forEach((s) => {
4440
+ s.updateCalculatedHeight();
4441
+ });
4442
+ const i = t.map((s) => ({
4443
+ height: s.calculatedHeight,
4444
+ rowIndex: s.rowIndex
4398
4445
  }));
4399
- this.ctx.database.setBatchCalculatedRowHeight(e);
4446
+ this.ctx.database.setBatchCalculatedRowHeight(i);
4400
4447
  }
4401
4448
  draw() {
4402
4449
  this.renderRows.forEach((t) => {
@@ -4407,7 +4454,7 @@ class ve {
4407
4454
  t.drawFixedContainer();
4408
4455
  }), this.renderRows.forEach((t) => {
4409
4456
  t.drawFixed();
4410
- }), this.drawTipLine(), this.updateAutoHeight();
4457
+ }), this.drawTipLine();
4411
4458
  }
4412
4459
  }
4413
4460
  class _e {
@@ -4441,16 +4488,16 @@ class _e {
4441
4488
  stageWidth: o,
4442
4489
  config: { HEADER_BG_COLOR: r, SCROLLER_TRACK_SIZE: a }
4443
4490
  } = this.ctx;
4444
- let l = this.y;
4445
- if (this.ctx.config.FOOTER_FIXED || (l = this.y - this.ctx.scrollY), i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, l, t, this.height, {
4491
+ let h = this.y;
4492
+ if (this.ctx.config.FOOTER_FIXED || (h = this.y - this.ctx.scrollY), i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, h, t, this.height, {
4446
4493
  fillColor: r,
4447
4494
  side: "right",
4448
4495
  shadowWidth: 4,
4449
4496
  colorStart: "rgba(0,0,0,0.1)",
4450
4497
  colorEnd: "rgba(0,0,0,0)"
4451
4498
  }), i < Math.floor(s.width - o - 1) && e !== a) {
4452
- const h = s.width - (this.x + this.width) + o - e;
4453
- this.ctx.paint.drawShadow(h, l, e, this.height, {
4499
+ const l = s.width - (this.x + this.width) + o - e;
4500
+ this.ctx.paint.drawShadow(l, h, e, this.height, {
4454
4501
  fillColor: r,
4455
4502
  side: "left",
4456
4503
  shadowWidth: 4,
@@ -4510,7 +4557,7 @@ class Te {
4510
4557
  this.moveFocus(t);
4511
4558
  }), this.ctx.on(
4512
4559
  "mousemove",
4513
- Ht((t) => {
4560
+ Z((t) => {
4514
4561
  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;
4515
4562
  (this.ctx.selectorMove || this.ctx.autofillMove) && (!s && !this.mousedownHeader ? this.startAdjustPosition(t) : this.stopAdjustPosition());
4516
4563
  }, 100)
@@ -4608,12 +4655,12 @@ class Te {
4608
4655
  this.ctx.mousedown && (this.ctx.selectorMove = !0), this.ctx.selector.enable = !0;
4609
4656
  const {
4610
4657
  SELECTOR_AREA_MIN_X: a,
4611
- SELECTOR_AREA_MAX_X: l,
4612
- SELECTOR_AREA_MIN_Y: h,
4658
+ SELECTOR_AREA_MAX_X: h,
4659
+ SELECTOR_AREA_MIN_Y: l,
4613
4660
  SELECTOR_AREA_MAX_Y: d,
4614
4661
  SELECTOR_AREA_MAX_X_OFFSET: f,
4615
4662
  SELECTOR_AREA_MAX_Y_OFFSET: u
4616
- } = this.ctx.config, x = a, w = l || this.ctx.maxColIndex - f, m = h, g = d || this.ctx.maxRowIndex - u;
4663
+ } = this.ctx.config, x = a, w = h || this.ctx.maxColIndex - f, m = l, g = d || this.ctx.maxRowIndex - u;
4617
4664
  let [p, y] = o, [E, R] = r;
4618
4665
  if (p < x || y > w || E < m || R > g)
4619
4666
  return;
@@ -4624,14 +4671,14 @@ class Te {
4624
4671
  p === y && E === R ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, o = [Math.max(x, p), Math.min(w, y)], r = [Math.max(m, E), Math.min(g, R)];
4625
4672
  const { BEFORE_SET_SELECTOR_METHOD: C } = this.ctx.config;
4626
4673
  if (typeof C == "function") {
4627
- const v = C({
4674
+ const S = C({
4628
4675
  focusCell: this.ctx.focusCell,
4629
4676
  xArr: o,
4630
4677
  yArr: r
4631
4678
  });
4632
- if (!v)
4679
+ if (!S)
4633
4680
  return;
4634
- o = v.xArr, r = v.yArr;
4681
+ o = S.xArr, r = S.yArr;
4635
4682
  }
4636
4683
  this.ctx.selector.xArr = o, this.ctx.selector.yArr = r, this.ctx.emit("setSelector", this.ctx.selector), this.ctx.emit("drawView");
4637
4684
  }
@@ -4639,13 +4686,13 @@ class Te {
4639
4686
  adjustMergeCells(t, e) {
4640
4687
  var w;
4641
4688
  const [i, s] = e, [o, r] = t;
4642
- let a = [], l = [];
4689
+ let a = [], h = [];
4643
4690
  for (let m = 0; m <= e[1] - e[0]; m++)
4644
4691
  for (let g = 0; g <= t[1] - t[0]; g++) {
4645
4692
  const p = m + e[0], y = g + t[0], E = this.ctx.database.getVirtualBodyCell(p, y);
4646
- E && ((p === i || p === s) && a.push(E), (y === o || y === r) && l.push(E));
4693
+ E && ((p === i || p === s) && a.push(E), (y === o || y === r) && h.push(E));
4647
4694
  }
4648
- const h = a.reduce(
4695
+ const l = a.reduce(
4649
4696
  (m, g) => {
4650
4697
  const { yArr: p } = g.getSpanInfo(), [y, E] = p;
4651
4698
  return m.minY = Math.min(m.minY, y), m.maxY = Math.max(m.maxY, E), m;
@@ -4654,7 +4701,7 @@ class Te {
4654
4701
  minY: i,
4655
4702
  maxY: s
4656
4703
  }
4657
- ), d = l.reduce(
4704
+ ), d = h.reduce(
4658
4705
  (m, g) => {
4659
4706
  const { xArr: p } = g.getSpanInfo(), [y, E] = p;
4660
4707
  return m.minX = Math.min(m.minX, y), m.maxX = Math.max(m.maxX, E), m;
@@ -4663,9 +4710,9 @@ class Te {
4663
4710
  minX: o,
4664
4711
  maxX: r
4665
4712
  }
4666
- ), f = [d.minX, d.maxX], u = [h.minY, h.maxY];
4713
+ ), f = [d.minX, d.maxX], u = [l.minY, l.maxY];
4667
4714
  let x = !1;
4668
- if (d.minX !== d.maxX || h.minY !== h.maxY) {
4715
+ if (d.minX !== d.maxX || l.minY !== l.maxY) {
4669
4716
  const m = JSON.stringify(f) + JSON.stringify(u), g = (w = this.ctx.focusCell) == null ? void 0 : w.getSpanInfo();
4670
4717
  x = (g && JSON.stringify(g.xArr) + JSON.stringify(g.yArr)) === m;
4671
4718
  }
@@ -4686,15 +4733,15 @@ class Te {
4686
4733
  if (this.ctx.mousedown && this.ctx.focusCellHeader) {
4687
4734
  const { colIndex: a } = this.ctx.focusCellHeader;
4688
4735
  if (this.ctx.clearSelector(), t.colIndex >= a) {
4689
- const l = [a, t.colIndex + t.colspan - 1], h = [o, r];
4690
- this.setSelector(l, h);
4736
+ const h = [a, t.colIndex + t.colspan - 1], l = [o, r];
4737
+ this.setSelector(h, l);
4691
4738
  } else {
4692
- const l = [t.colIndex, a], h = [o, r];
4693
- this.setSelector(l, h);
4739
+ const h = [t.colIndex, a], l = [o, r];
4740
+ this.setSelector(h, l);
4694
4741
  }
4695
4742
  } else {
4696
- const a = [t.colIndex, t.colIndex + t.colspan - 1], l = [o, r];
4697
- this.setSelector(a, l);
4743
+ const a = [t.colIndex, t.colIndex + t.colspan - 1], h = [o, r];
4744
+ this.setSelector(a, h);
4698
4745
  }
4699
4746
  }
4700
4747
  selectAll() {
@@ -4708,8 +4755,8 @@ class Te {
4708
4755
  SELECTOR_AREA_MIN_Y: o,
4709
4756
  SELECTOR_AREA_MAX_Y: r,
4710
4757
  SELECTOR_AREA_MAX_X_OFFSET: a,
4711
- SELECTOR_AREA_MAX_Y_OFFSET: l
4712
- } = this.ctx.config, h = i, d = s || this.ctx.maxColIndex - a, f = o, u = r || this.ctx.maxRowIndex - l, x = [h, d], w = [f, u];
4758
+ SELECTOR_AREA_MAX_Y_OFFSET: h
4759
+ } = this.ctx.config, l = i, d = s || this.ctx.maxColIndex - a, f = o, u = r || this.ctx.maxRowIndex - h, x = [l, d], w = [f, u];
4713
4760
  this.setSelector(x, w);
4714
4761
  }
4715
4762
  }
@@ -4719,17 +4766,17 @@ class Te {
4719
4766
  const { SELECTOR_AREA_MIN_X: i, SELECTOR_AREA_MAX_X: s, SELECTOR_AREA_MAX_X_OFFSET: o } = this.ctx.config, r = s || this.ctx.maxColIndex - o, a = i;
4720
4767
  if (e) {
4721
4768
  this.ctx.setFocusCell(t);
4722
- const l = [a, r], h = [t.rowIndex, t.rowIndex];
4723
- this.setSelector(l, h);
4769
+ const h = [a, r], l = [t.rowIndex, t.rowIndex];
4770
+ this.setSelector(h, l);
4724
4771
  }
4725
4772
  if (this.ctx.focusCell && this.ctx.mousedown) {
4726
- const { rowIndex: l } = this.ctx.focusCell;
4727
- if (t.rowIndex >= l) {
4728
- const h = [a, r], d = [l, t.rowIndex];
4729
- this.setSelector(h, d);
4773
+ const { rowIndex: h } = this.ctx.focusCell;
4774
+ if (t.rowIndex >= h) {
4775
+ const l = [a, r], d = [h, t.rowIndex];
4776
+ this.setSelector(l, d);
4730
4777
  } else {
4731
- const h = [a, r], d = [t.rowIndex, l];
4732
- this.setSelector(h, d);
4778
+ const l = [a, r], d = [t.rowIndex, h];
4779
+ this.setSelector(l, d);
4733
4780
  }
4734
4781
  }
4735
4782
  }
@@ -4738,7 +4785,7 @@ class Te {
4738
4785
  return;
4739
4786
  const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
4740
4787
  if (t && e && i) {
4741
- const { rowIndex: s, colIndex: o } = e, r = Math.min(i.colIndex, o), a = Math.max(i.colIndex, o), l = Math.min(i.rowIndex, s), h = Math.max(i.rowIndex, s), d = [r, a], f = [l, h];
4788
+ const { rowIndex: s, colIndex: o } = e, r = Math.min(i.colIndex, o), a = Math.max(i.colIndex, o), h = Math.min(i.rowIndex, s), l = Math.max(i.rowIndex, s), d = [r, a], f = [h, l];
4742
4789
  this.setSelector(d, f);
4743
4790
  }
4744
4791
  }
@@ -4748,7 +4795,7 @@ class Te {
4748
4795
  if (this.ctx.selector.enable = !0, i && t) {
4749
4796
  if (this.ctx.config.ENABLE_SELECTOR_SINGLE)
4750
4797
  return;
4751
- const { colIndex: s, rowIndex: o } = i, { colIndex: r, rowIndex: a } = e, l = Math.min(r, s), h = Math.max(r, s), d = Math.min(a, o), f = Math.max(a, o), u = [l, h], x = [d, f];
4798
+ const { colIndex: s, rowIndex: o } = i, { colIndex: r, rowIndex: a } = e, h = Math.min(r, s), l = Math.max(r, s), d = Math.min(a, o), f = Math.max(a, o), u = [h, l], x = [d, f];
4752
4799
  this.setSelector(u, x);
4753
4800
  } else {
4754
4801
  this.ctx.emit("cellSelectedClick", e);
@@ -4801,7 +4848,7 @@ class Te {
4801
4848
  return;
4802
4849
  t = a.data;
4803
4850
  }
4804
- const o = he(t);
4851
+ const o = le(t);
4805
4852
  navigator.clipboard ? navigator.clipboard.writeText(o).then(() => {
4806
4853
  this.ctx.selector.xArrCopy = this.ctx.selector.xArr.slice(), this.ctx.selector.yArrCopy = this.ctx.selector.yArr.slice(), this.ctx.emit("copyChange", {
4807
4854
  xArr: this.ctx.selector.xArrCopy,
@@ -4813,9 +4860,9 @@ class Te {
4813
4860
  clearSelectedData(t, e, i = !1, s = null) {
4814
4861
  let o = [];
4815
4862
  const r = /* @__PURE__ */ new Set();
4816
- for (let l = 0; l <= e[1] - e[0]; l++)
4817
- for (let h = 0; h <= t[1] - t[0]; h++) {
4818
- const d = l + e[0], f = h + t[0], u = this.ctx.database.getItemValueForRowIndexAndColIndex(d, f);
4863
+ for (let h = 0; h <= e[1] - e[0]; h++)
4864
+ for (let l = 0; l <= t[1] - t[0]; l++) {
4865
+ const d = h + e[0], f = l + t[0], u = this.ctx.database.getItemValueForRowIndexAndColIndex(d, f);
4819
4866
  if (u) {
4820
4867
  const { rowKey: x, key: w } = u;
4821
4868
  this.ctx.database.getReadonly(x, w) || (r.add(x), o.push({
@@ -4833,8 +4880,8 @@ class Te {
4833
4880
  return o;
4834
4881
  this.ctx.database.batchSetItemValue(o, !0);
4835
4882
  let a = [];
4836
- return r.forEach((l) => {
4837
- a.push(this.ctx.database.getRowDataItemForRowKey(l));
4883
+ return r.forEach((h) => {
4884
+ a.push(this.ctx.database.getRowDataItemForRowKey(h));
4838
4885
  }), this.ctx.emit("clearSelectedDataChange", o, a), o;
4839
4886
  }
4840
4887
  paste() {
@@ -4846,19 +4893,19 @@ class Te {
4846
4893
  if (this.ctx.selector.enable && t) {
4847
4894
  const e = this.ctx.selector.yArr[0], i = this.ctx.selector.xArr[0], s = /* @__PURE__ */ new Set();
4848
4895
  navigator.clipboard.readText().then(async (o) => {
4849
- let r = le(o);
4850
- const a = [i, i + r[0].length - 1], l = [e, e + r.length - 1], [h, d] = l, [f, u] = a, x = d - this.ctx.maxRowIndex, w = u - this.ctx.maxColIndex;
4896
+ let r = he(o);
4897
+ const a = [i, i + r[0].length - 1], h = [e, e + r.length - 1], [l, d] = h, [f, u] = a, x = d - this.ctx.maxRowIndex, w = u - this.ctx.maxColIndex;
4851
4898
  (x > 0 || w > 0) && this.ctx.emit("onPastedDataOverflow", {
4852
4899
  maxY: d,
4853
4900
  maxX: u,
4854
- minY: h,
4901
+ minY: l,
4855
4902
  minX: f,
4856
4903
  overflowRowCount: x,
4857
4904
  overflowColCount: w,
4858
4905
  textArr: r
4859
4906
  });
4860
4907
  const m = r.length === 1 && r[0].length === 1;
4861
- if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a, l) && !m) {
4908
+ if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a, h) && !m) {
4862
4909
  const E = {
4863
4910
  code: "ERR_MERGED_CELLS_PASTE",
4864
4911
  message: "Merged cells cannot span paste data"
@@ -4870,12 +4917,12 @@ class Te {
4870
4917
  for (let E = 0; E <= r.length - 1; E++) {
4871
4918
  const R = r[E].length;
4872
4919
  for (let C = 0; C <= R - 1; C++) {
4873
- const I = E + e, v = C + i, _ = r[E][C], S = this.ctx.database.getItemValueForRowIndexAndColIndex(
4920
+ const I = E + e, S = C + i, _ = r[E][C], v = this.ctx.database.getItemValueForRowIndexAndColIndex(
4874
4921
  I,
4875
- v
4922
+ S
4876
4923
  );
4877
- if (S) {
4878
- const { rowKey: b, key: O } = S;
4924
+ if (v) {
4925
+ const { rowKey: b, key: O } = v;
4879
4926
  this.ctx.database.getReadonly(b, O) || (s.add(b), g.push({
4880
4927
  rowKey: b,
4881
4928
  key: O,
@@ -4908,7 +4955,7 @@ class Te {
4908
4955
  oldValue: this.ctx.database.getItemValue(C.rowKey, C.key),
4909
4956
  row: this.ctx.database.getRowDataItemForRowKey(C.rowKey)
4910
4957
  }));
4911
- if (g = await E(R, a, l, r), g && !g.length)
4958
+ if (g = await E(R, a, h, r), g && !g.length)
4912
4959
  return;
4913
4960
  }
4914
4961
  this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(g, !0);
@@ -4931,7 +4978,7 @@ class Te {
4931
4978
  if (!e)
4932
4979
  return;
4933
4980
  let { colIndex: i = 0, rowIndex: s = 0 } = e;
4934
- const o = 0, r = 0, a = this.ctx.maxColIndex, l = this.ctx.maxRowIndex;
4981
+ const o = 0, r = 0, a = this.ctx.maxColIndex, h = this.ctx.maxRowIndex;
4935
4982
  switch (t) {
4936
4983
  case "LEFT":
4937
4984
  i > o && i--;
@@ -4943,11 +4990,11 @@ class Te {
4943
4990
  i < a && i++;
4944
4991
  break;
4945
4992
  case "BOTTOM":
4946
- s < l && s++;
4993
+ s < h && s++;
4947
4994
  break;
4948
4995
  }
4949
- const h = [i, i], d = [s, s], f = this.getCell(s, i);
4950
- 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")));
4996
+ const l = [i, i], d = [s, s], f = this.getCell(s, i);
4997
+ f && (f.operation || this.isInSettingRange(f.rowIndex, f.colIndex) && (this.ctx.setFocusCell(f), this.setSelector(l, d), this.adjustBoundaryPosition(), this.ctx.emit("moveFocus", f), this.ctx.emit("draw")));
4951
4998
  }
4952
4999
  stopAdjustPosition() {
4953
5000
  this.adjustPositionX = "", this.adjustPositionY = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerY && (clearInterval(this.timerY), this.timerY = 0);
@@ -4960,9 +5007,9 @@ class Te {
4960
5007
  SELECTOR_AREA_MIN_Y: o,
4961
5008
  SELECTOR_AREA_MAX_Y: r,
4962
5009
  SELECTOR_AREA_MAX_X_OFFSET: a,
4963
- SELECTOR_AREA_MAX_Y_OFFSET: l
4964
- } = this.ctx.config, h = i, d = s || this.ctx.maxColIndex - a, f = o, u = r || this.ctx.maxRowIndex - l;
4965
- return !(e < h || e > d || t < f || t > u);
5010
+ SELECTOR_AREA_MAX_Y_OFFSET: h
5011
+ } = this.ctx.config, l = i, d = s || this.ctx.maxColIndex - a, f = o, u = r || this.ctx.maxRowIndex - h;
5012
+ return !(e < l || e > d || t < f || t > u);
4966
5013
  }
4967
5014
  /**
4968
5015
  * 调整滚动条位置,让到达边界时自动滚动
@@ -4975,8 +5022,8 @@ class Te {
4975
5022
  let a = 10 * (s === "left" ? -1 : 1);
4976
5023
  this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
4977
5024
  a *= 1.5;
4978
- const { scrollX: l } = this.ctx, h = l + a;
4979
- (h < 0 || h > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(h);
5025
+ const { scrollX: h } = this.ctx, l = h + a;
5026
+ (l < 0 || l > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(l);
4980
5027
  }, 100);
4981
5028
  }
4982
5029
  if (o && this.adjustPositionY !== o) {
@@ -4984,8 +5031,8 @@ class Te {
4984
5031
  let a = 10 * (o === "top" ? -1 : 1);
4985
5032
  this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
4986
5033
  a *= 1.5;
4987
- const { scrollY: l } = this.ctx, h = l + a;
4988
- (h < 0 || h > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(h);
5034
+ const { scrollY: h } = this.ctx, l = h + a;
5035
+ (l < 0 || l > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(l);
4989
5036
  }, 100);
4990
5037
  }
4991
5038
  }
@@ -5001,8 +5048,8 @@ class Te {
5001
5048
  fixedLeftWidth: o,
5002
5049
  header: r,
5003
5050
  footer: a,
5004
- body: l,
5005
- scrollX: h,
5051
+ body: h,
5052
+ scrollX: l,
5006
5053
  scrollY: d,
5007
5054
  config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED: u, FOOTER_POSITION: x, ENABLE_MERGE_CELL_LINK: w }
5008
5055
  } = this.ctx;
@@ -5010,13 +5057,13 @@ class Te {
5010
5057
  return;
5011
5058
  w && this.ctx.onlyMergeCell && i.updateSpanInfo();
5012
5059
  const { drawX: m, drawY: g, width: p, height: y, fixed: E } = i, R = o - m + 1, C = i.drawX + p - (e - s) + 1;
5013
- let I = r.height - g, v = y;
5014
- v > l.visibleHeight && (v = l.visibleHeight);
5060
+ let I = r.height - g, S = y;
5061
+ S > h.visibleHeight && (S = h.visibleHeight);
5015
5062
  let _ = 0;
5016
5063
  u && (x === "top" ? I = r.height + a.height - g : _ = a.visibleHeight);
5017
- const S = g + v - (t - _ - f);
5018
- let b = h, O = d;
5019
- C > 0 && !E ? b = Math.floor(h + C) : R > 0 && !E && (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));
5064
+ const v = g + S - (t - _ - f);
5065
+ let b = l, O = d;
5066
+ C > 0 && !E ? b = Math.floor(l + C) : R > 0 && !E && (b = Math.floor(l - R)), I > 0 ? O = Math.floor(d - I) : v > 0 && (O = Math.floor(d + v)), (Math.abs(l - b) > 2 || Math.abs(d - O) > 2) && (this.ctx.adjustPositioning = !0, this.ctx.setScroll(b, O), this.ctx.emit("adjustBoundaryPosition", i));
5020
5067
  }
5021
5068
  destroy() {
5022
5069
  this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
@@ -5032,7 +5079,7 @@ class Oe {
5032
5079
  this.ctx.on("mousemove", (t) => {
5033
5080
  if (this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default"), this.ctx.editing || !this.ctx.focusCell || !this.maxColRowCell)
5034
5081
  return;
5035
- 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;
5082
+ const { offsetX: e, offsetY: i } = this.ctx.getOffset(t), { colIndex: s, rowIndex: o, drawX: r, drawY: a, width: h, height: l } = this.maxColRowCell, d = 6, f = s === this.ctx.maxColIndex || o === this.ctx.maxRowIndex ? 0 : 2, u = r + h - d + f, x = a + l - d + f;
5036
5083
  e > u && i > x && e < u + d && i < x + d && (this.ctx.stageElement.style.cursor = "crosshair");
5037
5084
  }), this.ctx.on("cellMouseenter", (t) => {
5038
5085
  const { xArr: e, yArr: i } = this.ctx.selector, s = e[1], o = i[1], { colIndex: r, rowIndex: a } = t;
@@ -5065,22 +5112,22 @@ class Oe {
5065
5112
  return;
5066
5113
  let r = t, a = e;
5067
5114
  if (!o) {
5068
- const [l] = a;
5069
- a = [l, l];
5115
+ const [h] = a;
5116
+ a = [h, h];
5070
5117
  }
5071
5118
  if (!s) {
5072
- const [l] = r;
5073
- r = [l, l];
5119
+ const [h] = r;
5120
+ r = [h, h];
5074
5121
  }
5075
5122
  if (JSON.stringify(this.ctx.autofill.xArr) !== JSON.stringify(r) || JSON.stringify(this.ctx.autofill.yArr) !== JSON.stringify(a)) {
5076
5123
  const {
5077
- SELECTOR_AREA_MIN_X: l,
5078
- SELECTOR_AREA_MAX_X: h,
5124
+ SELECTOR_AREA_MIN_X: h,
5125
+ SELECTOR_AREA_MAX_X: l,
5079
5126
  SELECTOR_AREA_MIN_Y: d,
5080
5127
  SELECTOR_AREA_MAX_Y: f,
5081
5128
  SELECTOR_AREA_MAX_X_OFFSET: u,
5082
5129
  SELECTOR_AREA_MAX_Y_OFFSET: x
5083
- } = this.ctx.config, w = l, m = h || this.ctx.maxColIndex - u, g = d, p = f || this.ctx.maxRowIndex - x;
5130
+ } = this.ctx.config, w = h, m = l || this.ctx.maxColIndex - u, g = d, p = f || this.ctx.maxRowIndex - x;
5084
5131
  let [y, E] = r, [R, C] = a;
5085
5132
  if (y < w || R < g)
5086
5133
  return;
@@ -5109,8 +5156,8 @@ class Oe {
5109
5156
  const m = x + e.yArr[0], g = w + e.xArr[0];
5110
5157
  i.set(`${m}-${g}`, !0);
5111
5158
  }
5112
- const { value: s } = e, o = s[0].length, r = s.length, a = this.ctx.autofill.xArr, l = this.ctx.autofill.yArr, h = o === 1 && r === 1;
5113
- if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a, l) && !h) {
5159
+ const { value: s } = e, o = s[0].length, r = s.length, a = this.ctx.autofill.xArr, h = this.ctx.autofill.yArr, l = o === 1 && r === 1;
5160
+ if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a, h) && !l) {
5114
5161
  const x = {
5115
5162
  code: "ERR_MERGED_CELLS_AUTOFILL",
5116
5163
  message: "Merged cells cannot span autofill data"
@@ -5119,9 +5166,9 @@ class Oe {
5119
5166
  return;
5120
5167
  }
5121
5168
  let d = [];
5122
- for (let x = 0; x <= l[1] - l[0]; x++)
5169
+ for (let x = 0; x <= h[1] - h[0]; x++)
5123
5170
  for (let w = 0; w <= a[1] - a[0]; w++) {
5124
- const m = w + a[0], g = x + l[0], p = s[x % r][w % o], y = this.ctx.database.getItemValueForRowIndexAndColIndex(g, m), E = `${g}-${m}`;
5171
+ const m = w + a[0], g = x + h[0], p = s[x % r][w % o], y = this.ctx.database.getItemValueForRowIndexAndColIndex(g, m), E = `${g}-${m}`;
5125
5172
  if (y && !i.has(E)) {
5126
5173
  const { rowKey: R, key: C } = y;
5127
5174
  this.ctx.database.getReadonly(R, C) || (t.add(R), d.push({
@@ -5144,7 +5191,7 @@ class Oe {
5144
5191
  oldValue: this.ctx.database.getItemValue(m.rowKey, m.key),
5145
5192
  row: this.ctx.database.getRowDataItemForRowKey(m.rowKey)
5146
5193
  }));
5147
- if (d = await x(w, a, l), d && !d.length)
5194
+ if (d = await x(w, a, h), d && !d.length)
5148
5195
  return;
5149
5196
  }
5150
5197
  this.ctx.batchSetItemValueByEditor(d, !0);
@@ -5165,7 +5212,7 @@ class Oe {
5165
5212
  destroy() {
5166
5213
  }
5167
5214
  }
5168
- const j = Math.min, $ = Math.max, it = Math.round, B = (c) => ({
5215
+ const j = Math.min, $ = Math.max, st = Math.round, B = (c) => ({
5169
5216
  x: c,
5170
5217
  y: c
5171
5218
  }), Le = {
@@ -5177,50 +5224,50 @@ const j = Math.min, $ = Math.max, it = Math.round, B = (c) => ({
5177
5224
  start: "end",
5178
5225
  end: "start"
5179
5226
  };
5180
- function ct(c, t, e) {
5227
+ function dt(c, t, e) {
5181
5228
  return $(c, j(t, e));
5182
5229
  }
5183
- function J(c, t) {
5230
+ function Q(c, t) {
5184
5231
  return typeof c == "function" ? c(t) : c;
5185
5232
  }
5186
5233
  function z(c) {
5187
5234
  return c.split("-")[0];
5188
5235
  }
5189
- function Q(c) {
5236
+ function tt(c) {
5190
5237
  return c.split("-")[1];
5191
5238
  }
5192
5239
  function Kt(c) {
5193
5240
  return c === "x" ? "y" : "x";
5194
5241
  }
5195
- function gt(c) {
5242
+ function wt(c) {
5196
5243
  return c === "y" ? "height" : "width";
5197
5244
  }
5198
5245
  const Ae = /* @__PURE__ */ new Set(["top", "bottom"]);
5199
5246
  function V(c) {
5200
5247
  return Ae.has(z(c)) ? "y" : "x";
5201
5248
  }
5202
- function wt(c) {
5249
+ function mt(c) {
5203
5250
  return Kt(V(c));
5204
5251
  }
5205
5252
  function He(c, t, e) {
5206
5253
  e === void 0 && (e = !1);
5207
- const i = Q(c), s = wt(c), o = gt(s);
5254
+ const i = tt(c), s = mt(c), o = wt(s);
5208
5255
  let r = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
5209
- return t.reference[o] > t.floating[o] && (r = st(r)), [r, st(r)];
5256
+ return t.reference[o] > t.floating[o] && (r = ot(r)), [r, ot(r)];
5210
5257
  }
5211
5258
  function De(c) {
5212
- const t = st(c);
5213
- return [dt(c), t, dt(t)];
5259
+ const t = ot(c);
5260
+ return [ft(c), t, ft(t)];
5214
5261
  }
5215
- function dt(c) {
5262
+ function ft(c) {
5216
5263
  return c.replace(/start|end/g, (t) => Me[t]);
5217
5264
  }
5218
- const vt = ["left", "right"], _t = ["right", "left"], Ne = ["top", "bottom"], ke = ["bottom", "top"];
5265
+ const _t = ["left", "right"], Tt = ["right", "left"], Ne = ["top", "bottom"], ke = ["bottom", "top"];
5219
5266
  function Xe(c, t, e) {
5220
5267
  switch (c) {
5221
5268
  case "top":
5222
5269
  case "bottom":
5223
- return e ? t ? _t : vt : t ? vt : _t;
5270
+ return e ? t ? Tt : _t : t ? _t : Tt;
5224
5271
  case "left":
5225
5272
  case "right":
5226
5273
  return t ? Ne : ke;
@@ -5229,11 +5276,11 @@ function Xe(c, t, e) {
5229
5276
  }
5230
5277
  }
5231
5278
  function Ye(c, t, e, i) {
5232
- const s = Q(c);
5279
+ const s = tt(c);
5233
5280
  let o = Xe(z(c), e === "start", i);
5234
- return s && (o = o.map((r) => r + "-" + s), t && (o = o.concat(o.map(dt)))), o;
5281
+ return s && (o = o.map((r) => r + "-" + s), t && (o = o.concat(o.map(ft)))), o;
5235
5282
  }
5236
- function st(c) {
5283
+ function ot(c) {
5237
5284
  return c.replace(/left|right|bottom|top/g, (t) => Le[t]);
5238
5285
  }
5239
5286
  function Be(c) {
@@ -5245,7 +5292,7 @@ function Be(c) {
5245
5292
  ...c
5246
5293
  };
5247
5294
  }
5248
- function Ft(c) {
5295
+ function Wt(c) {
5249
5296
  return typeof c != "number" ? Be(c) : {
5250
5297
  top: c,
5251
5298
  right: c,
@@ -5253,7 +5300,7 @@ function Ft(c) {
5253
5300
  left: c
5254
5301
  };
5255
5302
  }
5256
- function ot(c) {
5303
+ function rt(c) {
5257
5304
  const {
5258
5305
  x: t,
5259
5306
  y: e,
@@ -5271,14 +5318,14 @@ function ot(c) {
5271
5318
  y: e
5272
5319
  };
5273
5320
  }
5274
- function Tt(c, t, e) {
5321
+ function Ot(c, t, e) {
5275
5322
  let {
5276
5323
  reference: i,
5277
5324
  floating: s
5278
5325
  } = c;
5279
- const o = V(t), r = wt(t), a = gt(r), l = z(t), h = o === "y", d = i.x + i.width / 2 - s.width / 2, f = i.y + i.height / 2 - s.height / 2, u = i[a] / 2 - s[a] / 2;
5326
+ const o = V(t), r = mt(t), a = wt(r), h = z(t), l = o === "y", d = i.x + i.width / 2 - s.width / 2, f = i.y + i.height / 2 - s.height / 2, u = i[a] / 2 - s[a] / 2;
5280
5327
  let x;
5281
- switch (l) {
5328
+ switch (h) {
5282
5329
  case "top":
5283
5330
  x = {
5284
5331
  x: d,
@@ -5309,12 +5356,12 @@ function Tt(c, t, e) {
5309
5356
  y: i.y
5310
5357
  };
5311
5358
  }
5312
- switch (Q(t)) {
5359
+ switch (tt(t)) {
5313
5360
  case "start":
5314
- x[r] -= u * (e && h ? -1 : 1);
5361
+ x[r] -= u * (e && l ? -1 : 1);
5315
5362
  break;
5316
5363
  case "end":
5317
- x[r] += u * (e && h ? -1 : 1);
5364
+ x[r] += u * (e && l ? -1 : 1);
5318
5365
  break;
5319
5366
  }
5320
5367
  return x;
@@ -5325,15 +5372,15 @@ const Ke = async (c, t, e) => {
5325
5372
  strategy: s = "absolute",
5326
5373
  middleware: o = [],
5327
5374
  platform: r
5328
- } = e, a = o.filter(Boolean), l = await (r.isRTL == null ? void 0 : r.isRTL(t));
5329
- let h = await r.getElementRects({
5375
+ } = e, a = o.filter(Boolean), h = await (r.isRTL == null ? void 0 : r.isRTL(t));
5376
+ let l = await r.getElementRects({
5330
5377
  reference: c,
5331
5378
  floating: t,
5332
5379
  strategy: s
5333
5380
  }), {
5334
5381
  x: d,
5335
5382
  y: f
5336
- } = Tt(h, i, l), u = i, x = {}, w = 0;
5383
+ } = Ot(l, i, h), u = i, x = {}, w = 0;
5337
5384
  for (let m = 0; m < a.length; m++) {
5338
5385
  const {
5339
5386
  name: g,
@@ -5350,7 +5397,7 @@ const Ke = async (c, t, e) => {
5350
5397
  placement: u,
5351
5398
  strategy: s,
5352
5399
  middlewareData: x,
5353
- rects: h,
5400
+ rects: l,
5354
5401
  platform: r,
5355
5402
  elements: {
5356
5403
  reference: c,
@@ -5363,14 +5410,14 @@ const Ke = async (c, t, e) => {
5363
5410
  ...x[g],
5364
5411
  ...R
5365
5412
  }
5366
- }, C && w <= 50 && (w++, typeof C == "object" && (C.placement && (u = C.placement), C.rects && (h = C.rects === !0 ? await r.getElementRects({
5413
+ }, C && w <= 50 && (w++, typeof C == "object" && (C.placement && (u = C.placement), C.rects && (l = C.rects === !0 ? await r.getElementRects({
5367
5414
  reference: c,
5368
5415
  floating: t,
5369
5416
  strategy: s
5370
5417
  }) : C.rects), {
5371
5418
  x: d,
5372
5419
  y: f
5373
- } = Tt(h, u, l)), m = -1);
5420
+ } = Ot(l, u, h)), m = -1);
5374
5421
  }
5375
5422
  return {
5376
5423
  x: d,
@@ -5380,7 +5427,7 @@ const Ke = async (c, t, e) => {
5380
5427
  middlewareData: x
5381
5428
  };
5382
5429
  };
5383
- async function Wt(c, t) {
5430
+ async function Ft(c, t) {
5384
5431
  var e;
5385
5432
  t === void 0 && (t = {});
5386
5433
  const {
@@ -5389,18 +5436,18 @@ async function Wt(c, t) {
5389
5436
  platform: o,
5390
5437
  rects: r,
5391
5438
  elements: a,
5392
- strategy: l
5439
+ strategy: h
5393
5440
  } = c, {
5394
- boundary: h = "clippingAncestors",
5441
+ boundary: l = "clippingAncestors",
5395
5442
  rootBoundary: d = "viewport",
5396
5443
  elementContext: f = "floating",
5397
5444
  altBoundary: u = !1,
5398
5445
  padding: x = 0
5399
- } = J(t, c), w = Ft(x), g = a[u ? f === "floating" ? "reference" : "floating" : f], p = ot(await o.getClippingRect({
5446
+ } = Q(t, c), w = Wt(x), g = a[u ? f === "floating" ? "reference" : "floating" : f], p = rt(await o.getClippingRect({
5400
5447
  element: (e = await (o.isElement == null ? void 0 : o.isElement(g))) == null || e ? g : g.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(a.floating)),
5401
- boundary: h,
5448
+ boundary: l,
5402
5449
  rootBoundary: d,
5403
- strategy: l
5450
+ strategy: h
5404
5451
  })), y = f === "floating" ? {
5405
5452
  x: i,
5406
5453
  y: s,
@@ -5412,11 +5459,11 @@ async function Wt(c, t) {
5412
5459
  } : {
5413
5460
  x: 1,
5414
5461
  y: 1
5415
- }, C = ot(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
5462
+ }, C = rt(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
5416
5463
  elements: a,
5417
5464
  rect: y,
5418
5465
  offsetParent: E,
5419
- strategy: l
5466
+ strategy: h
5420
5467
  }) : y);
5421
5468
  return {
5422
5469
  top: (p.top - C.top + w.top) / R.y,
@@ -5425,7 +5472,7 @@ async function Wt(c, t) {
5425
5472
  right: (C.right - p.right + w.right) / R.x
5426
5473
  };
5427
5474
  }
5428
- const Fe = (c) => ({
5475
+ const We = (c) => ({
5429
5476
  name: "arrow",
5430
5477
  options: c,
5431
5478
  async fn(t) {
@@ -5436,20 +5483,20 @@ const Fe = (c) => ({
5436
5483
  rects: o,
5437
5484
  platform: r,
5438
5485
  elements: a,
5439
- middlewareData: l
5486
+ middlewareData: h
5440
5487
  } = t, {
5441
- element: h,
5488
+ element: l,
5442
5489
  padding: d = 0
5443
- } = J(c, t) || {};
5444
- if (h == null)
5490
+ } = Q(c, t) || {};
5491
+ if (l == null)
5445
5492
  return {};
5446
- const f = Ft(d), u = {
5493
+ const f = Wt(d), u = {
5447
5494
  x: e,
5448
5495
  y: i
5449
- }, x = wt(s), w = gt(x), m = await r.getDimensions(h), g = x === "y", p = g ? "top" : "left", y = g ? "bottom" : "right", E = 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));
5450
- let v = I ? I[E] : 0;
5451
- (!v || !await (r.isElement == null ? void 0 : r.isElement(I))) && (v = a.floating[E] || o.floating[w]);
5452
- const _ = R / 2 - C / 2, S = v / 2 - m[w] / 2 - 1, b = j(f[p], S), O = j(f[y], S), T = b, M = v - m[w] - O, L = v / 2 - m[w] / 2 + _, A = ct(T, L, M), D = !l.arrow && Q(s) != null && L !== A && o.reference[w] / 2 - (L < T ? b : O) - m[w] / 2 < 0, N = D ? L < T ? L - T : L - M : 0;
5496
+ }, x = mt(s), w = wt(x), m = await r.getDimensions(l), g = x === "y", p = g ? "top" : "left", y = g ? "bottom" : "right", E = 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(l));
5497
+ let S = I ? I[E] : 0;
5498
+ (!S || !await (r.isElement == null ? void 0 : r.isElement(I))) && (S = a.floating[E] || o.floating[w]);
5499
+ const _ = R / 2 - C / 2, v = S / 2 - m[w] / 2 - 1, b = j(f[p], v), O = j(f[y], v), T = b, M = S - m[w] - O, L = S / 2 - m[w] / 2 + _, A = dt(T, L, M), D = !h.arrow && tt(s) != null && L !== A && o.reference[w] / 2 - (L < T ? b : O) - m[w] / 2 < 0, N = D ? L < T ? L - T : L - M : 0;
5453
5500
  return {
5454
5501
  [x]: u[x] + N,
5455
5502
  data: {
@@ -5462,7 +5509,7 @@ const Fe = (c) => ({
5462
5509
  reset: D
5463
5510
  };
5464
5511
  }
5465
- }), We = function(c) {
5512
+ }), Fe = function(c) {
5466
5513
  return c === void 0 && (c = {}), {
5467
5514
  name: "flip",
5468
5515
  options: c,
@@ -5473,8 +5520,8 @@ const Fe = (c) => ({
5473
5520
  middlewareData: o,
5474
5521
  rects: r,
5475
5522
  initialPlacement: a,
5476
- platform: l,
5477
- elements: h
5523
+ platform: h,
5524
+ elements: l
5478
5525
  } = t, {
5479
5526
  mainAxis: d = !0,
5480
5527
  crossAxis: f = !0,
@@ -5483,23 +5530,23 @@ const Fe = (c) => ({
5483
5530
  fallbackAxisSideDirection: w = "none",
5484
5531
  flipAlignment: m = !0,
5485
5532
  ...g
5486
- } = J(c, t);
5533
+ } = Q(c, t);
5487
5534
  if ((e = o.arrow) != null && e.alignmentOffset)
5488
5535
  return {};
5489
- const p = z(s), y = V(a), E = z(a) === a, R = await (l.isRTL == null ? void 0 : l.isRTL(h.floating)), C = u || (E || !m ? [st(a)] : De(a)), I = w !== "none";
5536
+ const p = z(s), y = V(a), E = z(a) === a, R = await (h.isRTL == null ? void 0 : h.isRTL(l.floating)), C = u || (E || !m ? [ot(a)] : De(a)), I = w !== "none";
5490
5537
  !u && I && C.push(...Ye(a, m, w, R));
5491
- const v = [a, ...C], _ = await Wt(t, g), S = [];
5538
+ const S = [a, ...C], _ = await Ft(t, g), v = [];
5492
5539
  let b = ((i = o.flip) == null ? void 0 : i.overflows) || [];
5493
- if (d && S.push(_[p]), f) {
5540
+ if (d && v.push(_[p]), f) {
5494
5541
  const L = He(s, r, R);
5495
- S.push(_[L[0]], _[L[1]]);
5542
+ v.push(_[L[0]], _[L[1]]);
5496
5543
  }
5497
5544
  if (b = [...b, {
5498
5545
  placement: s,
5499
- overflows: S
5500
- }], !S.every((L) => L <= 0)) {
5546
+ overflows: v
5547
+ }], !v.every((L) => L <= 0)) {
5501
5548
  var O, T;
5502
- const L = (((O = o.flip) == null ? void 0 : O.index) || 0) + 1, A = v[L];
5549
+ const L = (((O = o.flip) == null ? void 0 : O.index) || 0) + 1, A = S[L];
5503
5550
  if (A && (!(f === "alignment" ? y !== V(A) : !1) || // We leave the current main axis only if every placement on that axis
5504
5551
  // overflows the main axis.
5505
5552
  b.every((k) => V(k.placement) === y ? k.overflows[0] > 0 : !0)))
@@ -5519,13 +5566,13 @@ const Fe = (c) => ({
5519
5566
  var M;
5520
5567
  const N = (M = b.filter((k) => {
5521
5568
  if (I) {
5522
- const W = V(k.placement);
5523
- return W === y || // Create a bias to the `y` side axis due to horizontal
5569
+ const F = V(k.placement);
5570
+ return F === y || // Create a bias to the `y` side axis due to horizontal
5524
5571
  // reading directions favoring greater width.
5525
- W === "y";
5572
+ F === "y";
5526
5573
  }
5527
5574
  return !0;
5528
- }).map((k) => [k.placement, k.overflows.filter((W) => W > 0).reduce((W, ie) => W + ie, 0)]).sort((k, W) => k[1] - W[1])[0]) == null ? void 0 : M[0];
5575
+ }).map((k) => [k.placement, k.overflows.filter((F) => F > 0).reduce((F, ie) => F + ie, 0)]).sort((k, F) => k[1] - F[1])[0]) == null ? void 0 : M[0];
5529
5576
  N && (D = N);
5530
5577
  break;
5531
5578
  }
@@ -5549,7 +5596,7 @@ async function Pe(c, t) {
5549
5596
  placement: e,
5550
5597
  platform: i,
5551
5598
  elements: s
5552
- } = c, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r = z(e), a = Q(e), l = V(e) === "y", h = Ve.has(r) ? -1 : 1, d = o && l ? -1 : 1, f = J(t, c);
5599
+ } = c, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r = z(e), a = tt(e), h = V(e) === "y", l = Ve.has(r) ? -1 : 1, d = o && h ? -1 : 1, f = Q(t, c);
5553
5600
  let {
5554
5601
  mainAxis: u,
5555
5602
  crossAxis: x,
@@ -5563,11 +5610,11 @@ async function Pe(c, t) {
5563
5610
  crossAxis: f.crossAxis || 0,
5564
5611
  alignmentAxis: f.alignmentAxis
5565
5612
  };
5566
- return a && typeof w == "number" && (x = a === "end" ? w * -1 : w), l ? {
5613
+ return a && typeof w == "number" && (x = a === "end" ? w * -1 : w), h ? {
5567
5614
  x: x * d,
5568
- y: u * h
5615
+ y: u * l
5569
5616
  } : {
5570
- x: u * h,
5617
+ x: u * l,
5571
5618
  y: x * d
5572
5619
  };
5573
5620
  }
@@ -5582,12 +5629,12 @@ const ze = function(c) {
5582
5629
  y: o,
5583
5630
  placement: r,
5584
5631
  middlewareData: a
5585
- } = t, l = await Pe(t, c);
5632
+ } = t, h = await Pe(t, c);
5586
5633
  return r === ((e = a.offset) == null ? void 0 : e.placement) && (i = a.arrow) != null && i.alignmentOffset ? {} : {
5587
- x: s + l.x,
5588
- y: o + l.y,
5634
+ x: s + h.x,
5635
+ y: o + h.y,
5589
5636
  data: {
5590
- ...l,
5637
+ ...h,
5591
5638
  placement: r
5592
5639
  }
5593
5640
  };
@@ -5617,19 +5664,19 @@ const ze = function(c) {
5617
5664
  };
5618
5665
  }
5619
5666
  },
5620
- ...l
5621
- } = J(c, t), h = {
5667
+ ...h
5668
+ } = Q(c, t), l = {
5622
5669
  x: e,
5623
5670
  y: i
5624
- }, d = await Wt(t, l), f = V(z(s)), u = Kt(f);
5625
- let x = h[u], w = h[f];
5671
+ }, d = await Ft(t, h), f = V(z(s)), u = Kt(f);
5672
+ let x = l[u], w = l[f];
5626
5673
  if (o) {
5627
5674
  const g = u === "y" ? "top" : "left", p = u === "y" ? "bottom" : "right", y = x + d[g], E = x - d[p];
5628
- x = ct(y, x, E);
5675
+ x = dt(y, x, E);
5629
5676
  }
5630
5677
  if (r) {
5631
5678
  const g = f === "y" ? "top" : "left", p = f === "y" ? "bottom" : "right", y = w + d[g], E = w - d[p];
5632
- w = ct(y, w, E);
5679
+ w = dt(y, w, E);
5633
5680
  }
5634
5681
  const m = a.fn({
5635
5682
  ...t,
@@ -5650,34 +5697,34 @@ const ze = function(c) {
5650
5697
  }
5651
5698
  };
5652
5699
  };
5653
- function rt() {
5700
+ function nt() {
5654
5701
  return typeof window < "u";
5655
5702
  }
5656
- function Z(c) {
5703
+ function q(c) {
5657
5704
  return Vt(c) ? (c.nodeName || "").toLowerCase() : "#document";
5658
5705
  }
5659
5706
  function H(c) {
5660
5707
  var t;
5661
5708
  return (c == null || (t = c.ownerDocument) == null ? void 0 : t.defaultView) || window;
5662
5709
  }
5663
- function F(c) {
5710
+ function W(c) {
5664
5711
  var t;
5665
5712
  return (t = (Vt(c) ? c.ownerDocument : c.document) || window.document) == null ? void 0 : t.documentElement;
5666
5713
  }
5667
5714
  function Vt(c) {
5668
- return rt() ? c instanceof Node || c instanceof H(c).Node : !1;
5715
+ return nt() ? c instanceof Node || c instanceof H(c).Node : !1;
5669
5716
  }
5670
5717
  function X(c) {
5671
- return rt() ? c instanceof Element || c instanceof H(c).Element : !1;
5718
+ return nt() ? c instanceof Element || c instanceof H(c).Element : !1;
5672
5719
  }
5673
5720
  function K(c) {
5674
- return rt() ? c instanceof HTMLElement || c instanceof H(c).HTMLElement : !1;
5721
+ return nt() ? c instanceof HTMLElement || c instanceof H(c).HTMLElement : !1;
5675
5722
  }
5676
- function Ot(c) {
5677
- return !rt() || typeof ShadowRoot > "u" ? !1 : c instanceof ShadowRoot || c instanceof H(c).ShadowRoot;
5723
+ function Lt(c) {
5724
+ return !nt() || typeof ShadowRoot > "u" ? !1 : c instanceof ShadowRoot || c instanceof H(c).ShadowRoot;
5678
5725
  }
5679
5726
  const Ge = /* @__PURE__ */ new Set(["inline", "contents"]);
5680
- function tt(c) {
5727
+ function et(c) {
5681
5728
  const {
5682
5729
  overflow: t,
5683
5730
  overflowX: e,
@@ -5687,12 +5734,12 @@ function tt(c) {
5687
5734
  return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !Ge.has(s);
5688
5735
  }
5689
5736
  const Ue = /* @__PURE__ */ new Set(["table", "td", "th"]);
5690
- function Ze(c) {
5691
- return Ue.has(Z(c));
5737
+ function qe(c) {
5738
+ return Ue.has(q(c));
5692
5739
  }
5693
- const je = [":popover-open", ":modal"];
5694
- function nt(c) {
5695
- return je.some((t) => {
5740
+ const Ze = [":popover-open", ":modal"];
5741
+ function at(c) {
5742
+ return Ze.some((t) => {
5696
5743
  try {
5697
5744
  return c.matches(t);
5698
5745
  } catch {
@@ -5700,33 +5747,33 @@ function nt(c) {
5700
5747
  }
5701
5748
  });
5702
5749
  }
5703
- const qe = ["transform", "translate", "scale", "rotate", "perspective"], Je = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Qe = ["paint", "layout", "strict", "content"];
5704
- function mt(c) {
5705
- const t = pt(), e = X(c) ? Y(c) : c;
5706
- return qe.some((i) => e[i] ? e[i] !== "none" : !1) || (e.containerType ? e.containerType !== "normal" : !1) || !t && (e.backdropFilter ? e.backdropFilter !== "none" : !1) || !t && (e.filter ? e.filter !== "none" : !1) || Je.some((i) => (e.willChange || "").includes(i)) || Qe.some((i) => (e.contain || "").includes(i));
5750
+ const je = ["transform", "translate", "scale", "rotate", "perspective"], Je = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Qe = ["paint", "layout", "strict", "content"];
5751
+ function pt(c) {
5752
+ const t = Et(), e = X(c) ? Y(c) : c;
5753
+ return je.some((i) => e[i] ? e[i] !== "none" : !1) || (e.containerType ? e.containerType !== "normal" : !1) || !t && (e.backdropFilter ? e.backdropFilter !== "none" : !1) || !t && (e.filter ? e.filter !== "none" : !1) || Je.some((i) => (e.willChange || "").includes(i)) || Qe.some((i) => (e.contain || "").includes(i));
5707
5754
  }
5708
5755
  function ti(c) {
5709
5756
  let t = P(c);
5710
5757
  for (; K(t) && !U(t); ) {
5711
- if (mt(t))
5758
+ if (pt(t))
5712
5759
  return t;
5713
- if (nt(t))
5760
+ if (at(t))
5714
5761
  return null;
5715
5762
  t = P(t);
5716
5763
  }
5717
5764
  return null;
5718
5765
  }
5719
- function pt() {
5766
+ function Et() {
5720
5767
  return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
5721
5768
  }
5722
5769
  const ei = /* @__PURE__ */ new Set(["html", "body", "#document"]);
5723
5770
  function U(c) {
5724
- return ei.has(Z(c));
5771
+ return ei.has(q(c));
5725
5772
  }
5726
5773
  function Y(c) {
5727
5774
  return H(c).getComputedStyle(c);
5728
5775
  }
5729
- function at(c) {
5776
+ function ht(c) {
5730
5777
  return X(c) ? {
5731
5778
  scrollLeft: c.scrollLeft,
5732
5779
  scrollTop: c.scrollTop
@@ -5736,34 +5783,34 @@ function at(c) {
5736
5783
  };
5737
5784
  }
5738
5785
  function P(c) {
5739
- if (Z(c) === "html")
5786
+ if (q(c) === "html")
5740
5787
  return c;
5741
5788
  const t = (
5742
5789
  // Step into the shadow DOM of the parent of a slotted node.
5743
5790
  c.assignedSlot || // DOM Element detected.
5744
5791
  c.parentNode || // ShadowRoot detected.
5745
- Ot(c) && c.host || // Fallback.
5746
- F(c)
5792
+ Lt(c) && c.host || // Fallback.
5793
+ W(c)
5747
5794
  );
5748
- return Ot(t) ? t.host : t;
5795
+ return Lt(t) ? t.host : t;
5749
5796
  }
5750
5797
  function Pt(c) {
5751
5798
  const t = P(c);
5752
- return U(t) ? c.ownerDocument ? c.ownerDocument.body : c.body : K(t) && tt(t) ? t : Pt(t);
5799
+ return U(t) ? c.ownerDocument ? c.ownerDocument.body : c.body : K(t) && et(t) ? t : Pt(t);
5753
5800
  }
5754
5801
  function zt(c, t, e) {
5755
5802
  var i;
5756
5803
  t === void 0 && (t = []);
5757
5804
  const s = Pt(c), o = s === ((i = c.ownerDocument) == null ? void 0 : i.body), r = H(s);
5758
- return o ? (ft(r), t.concat(r, r.visualViewport || [], tt(s) ? s : [], [])) : t.concat(s, zt(s, []));
5805
+ return o ? (xt(r), t.concat(r, r.visualViewport || [], et(s) ? s : [], [])) : t.concat(s, zt(s, []));
5759
5806
  }
5760
- function ft(c) {
5807
+ function xt(c) {
5761
5808
  return c.parent && Object.getPrototypeOf(c.parent) ? c.frameElement : null;
5762
5809
  }
5763
5810
  function $t(c) {
5764
5811
  const t = Y(c);
5765
5812
  let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
5766
- const s = K(c), o = s ? c.offsetWidth : e, r = s ? c.offsetHeight : i, a = it(e) !== o || it(i) !== r;
5813
+ const s = K(c), o = s ? c.offsetWidth : e, r = s ? c.offsetHeight : i, a = st(e) !== o || st(i) !== r;
5767
5814
  return a && (e = o, i = r), {
5768
5815
  width: e,
5769
5816
  height: i,
@@ -5782,7 +5829,7 @@ function G(c) {
5782
5829
  height: s,
5783
5830
  $: o
5784
5831
  } = $t(t);
5785
- let r = (o ? it(e.width) : e.width) / i, a = (o ? it(e.height) : e.height) / s;
5832
+ let r = (o ? st(e.width) : e.width) / i, a = (o ? st(e.height) : e.height) / s;
5786
5833
  return (!r || !Number.isFinite(r)) && (r = 1), (!a || !Number.isFinite(a)) && (a = 1), {
5787
5834
  x: r,
5788
5835
  y: a
@@ -5791,7 +5838,7 @@ function G(c) {
5791
5838
  const ii = /* @__PURE__ */ B(0);
5792
5839
  function Ut(c) {
5793
5840
  const t = H(c);
5794
- return !pt() || !t.visualViewport ? ii : {
5841
+ return !Et() || !t.visualViewport ? ii : {
5795
5842
  x: t.visualViewport.offsetLeft,
5796
5843
  y: t.visualViewport.offsetTop
5797
5844
  };
@@ -5799,37 +5846,37 @@ function Ut(c) {
5799
5846
  function si(c, t, e) {
5800
5847
  return t === void 0 && (t = !1), !e || t && e !== H(c) ? !1 : t;
5801
5848
  }
5802
- function q(c, t, e, i) {
5849
+ function J(c, t, e, i) {
5803
5850
  t === void 0 && (t = !1), e === void 0 && (e = !1);
5804
5851
  const s = c.getBoundingClientRect(), o = Gt(c);
5805
5852
  let r = B(1);
5806
5853
  t && (i ? X(i) && (r = G(i)) : r = G(c));
5807
5854
  const a = si(o, e, i) ? Ut(o) : B(0);
5808
- 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;
5855
+ let h = (s.left + a.x) / r.x, l = (s.top + a.y) / r.y, d = s.width / r.x, f = s.height / r.y;
5809
5856
  if (o) {
5810
5857
  const u = H(o), x = i && X(i) ? H(i) : i;
5811
- let w = u, m = ft(w);
5858
+ let w = u, m = xt(w);
5812
5859
  for (; m && i && x !== w; ) {
5813
5860
  const g = G(m), p = m.getBoundingClientRect(), y = Y(m), E = p.left + (m.clientLeft + parseFloat(y.paddingLeft)) * g.x, R = p.top + (m.clientTop + parseFloat(y.paddingTop)) * g.y;
5814
- l *= g.x, h *= g.y, d *= g.x, f *= g.y, l += E, h += R, w = H(m), m = ft(w);
5861
+ h *= g.x, l *= g.y, d *= g.x, f *= g.y, h += E, l += R, w = H(m), m = xt(w);
5815
5862
  }
5816
5863
  }
5817
- return ot({
5864
+ return rt({
5818
5865
  width: d,
5819
5866
  height: f,
5820
- x: l,
5821
- y: h
5867
+ x: h,
5868
+ y: l
5822
5869
  });
5823
5870
  }
5824
- function Et(c, t) {
5825
- const e = at(c).scrollLeft;
5826
- return t ? t.left + e : q(F(c)).left + e;
5871
+ function yt(c, t) {
5872
+ const e = ht(c).scrollLeft;
5873
+ return t ? t.left + e : J(W(c)).left + e;
5827
5874
  }
5828
- function Zt(c, t, e) {
5875
+ function qt(c, t, e) {
5829
5876
  e === void 0 && (e = !1);
5830
5877
  const i = c.getBoundingClientRect(), s = i.left + t.scrollLeft - (e ? 0 : (
5831
5878
  // RTL <body> scrollbar.
5832
- Et(c, i)
5879
+ yt(c, i)
5833
5880
  )), o = i.top + t.scrollTop;
5834
5881
  return {
5835
5882
  x: s,
@@ -5843,32 +5890,32 @@ function oi(c) {
5843
5890
  offsetParent: i,
5844
5891
  strategy: s
5845
5892
  } = c;
5846
- const o = s === "fixed", r = F(i), a = t ? nt(t.floating) : !1;
5893
+ const o = s === "fixed", r = W(i), a = t ? at(t.floating) : !1;
5847
5894
  if (i === r || a && o)
5848
5895
  return e;
5849
- let l = {
5896
+ let h = {
5850
5897
  scrollLeft: 0,
5851
5898
  scrollTop: 0
5852
- }, h = B(1);
5899
+ }, l = B(1);
5853
5900
  const d = B(0), f = K(i);
5854
- if ((f || !f && !o) && ((Z(i) !== "body" || tt(r)) && (l = at(i)), K(i))) {
5855
- const x = q(i);
5856
- h = G(i), d.x = x.x + i.clientLeft, d.y = x.y + i.clientTop;
5901
+ if ((f || !f && !o) && ((q(i) !== "body" || et(r)) && (h = ht(i)), K(i))) {
5902
+ const x = J(i);
5903
+ l = G(i), d.x = x.x + i.clientLeft, d.y = x.y + i.clientTop;
5857
5904
  }
5858
- const u = r && !f && !o ? Zt(r, l, !0) : B(0);
5905
+ const u = r && !f && !o ? qt(r, h, !0) : B(0);
5859
5906
  return {
5860
- width: e.width * h.x,
5861
- height: e.height * h.y,
5862
- x: e.x * h.x - l.scrollLeft * h.x + d.x + u.x,
5863
- y: e.y * h.y - l.scrollTop * h.y + d.y + u.y
5907
+ width: e.width * l.x,
5908
+ height: e.height * l.y,
5909
+ x: e.x * l.x - h.scrollLeft * l.x + d.x + u.x,
5910
+ y: e.y * l.y - h.scrollTop * l.y + d.y + u.y
5864
5911
  };
5865
5912
  }
5866
5913
  function ri(c) {
5867
5914
  return Array.from(c.getClientRects());
5868
5915
  }
5869
5916
  function ni(c) {
5870
- const t = F(c), e = at(c), i = c.ownerDocument.body, s = $(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), o = $(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
5871
- let r = -e.scrollLeft + Et(c);
5917
+ const t = W(c), e = ht(c), i = c.ownerDocument.body, s = $(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), o = $(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
5918
+ let r = -e.scrollLeft + yt(c);
5872
5919
  const a = -e.scrollTop;
5873
5920
  return Y(i).direction === "rtl" && (r += $(t.clientWidth, i.clientWidth) - s), {
5874
5921
  width: s,
@@ -5878,38 +5925,38 @@ function ni(c) {
5878
5925
  };
5879
5926
  }
5880
5927
  function ai(c, t) {
5881
- const e = H(c), i = F(c), s = e.visualViewport;
5882
- let o = i.clientWidth, r = i.clientHeight, a = 0, l = 0;
5928
+ const e = H(c), i = W(c), s = e.visualViewport;
5929
+ let o = i.clientWidth, r = i.clientHeight, a = 0, h = 0;
5883
5930
  if (s) {
5884
5931
  o = s.width, r = s.height;
5885
- const h = pt();
5886
- (!h || h && t === "fixed") && (a = s.offsetLeft, l = s.offsetTop);
5932
+ const l = Et();
5933
+ (!l || l && t === "fixed") && (a = s.offsetLeft, h = s.offsetTop);
5887
5934
  }
5888
5935
  return {
5889
5936
  width: o,
5890
5937
  height: r,
5891
5938
  x: a,
5892
- y: l
5939
+ y: h
5893
5940
  };
5894
5941
  }
5895
- const li = /* @__PURE__ */ new Set(["absolute", "fixed"]);
5896
- function hi(c, t) {
5897
- const e = q(c, !0, t === "fixed"), i = e.top + c.clientTop, s = e.left + c.clientLeft, o = K(c) ? G(c) : B(1), r = c.clientWidth * o.x, a = c.clientHeight * o.y, l = s * o.x, h = i * o.y;
5942
+ const hi = /* @__PURE__ */ new Set(["absolute", "fixed"]);
5943
+ function li(c, t) {
5944
+ const e = J(c, !0, t === "fixed"), i = e.top + c.clientTop, s = e.left + c.clientLeft, o = K(c) ? G(c) : B(1), r = c.clientWidth * o.x, a = c.clientHeight * o.y, h = s * o.x, l = i * o.y;
5898
5945
  return {
5899
5946
  width: r,
5900
5947
  height: a,
5901
- x: l,
5902
- y: h
5948
+ x: h,
5949
+ y: l
5903
5950
  };
5904
5951
  }
5905
- function Lt(c, t, e) {
5952
+ function Mt(c, t, e) {
5906
5953
  let i;
5907
5954
  if (t === "viewport")
5908
5955
  i = ai(c, e);
5909
5956
  else if (t === "document")
5910
- i = ni(F(c));
5957
+ i = ni(W(c));
5911
5958
  else if (X(t))
5912
- i = hi(t, e);
5959
+ i = li(t, e);
5913
5960
  else {
5914
5961
  const s = Ut(c);
5915
5962
  i = {
@@ -5919,22 +5966,22 @@ function Lt(c, t, e) {
5919
5966
  height: t.height
5920
5967
  };
5921
5968
  }
5922
- return ot(i);
5969
+ return rt(i);
5923
5970
  }
5924
- function jt(c, t) {
5971
+ function Zt(c, t) {
5925
5972
  const e = P(c);
5926
- return e === t || !X(e) || U(e) ? !1 : Y(e).position === "fixed" || jt(e, t);
5973
+ return e === t || !X(e) || U(e) ? !1 : Y(e).position === "fixed" || Zt(e, t);
5927
5974
  }
5928
5975
  function ci(c, t) {
5929
5976
  const e = t.get(c);
5930
5977
  if (e)
5931
5978
  return e;
5932
- let i = zt(c, []).filter((a) => X(a) && Z(a) !== "body"), s = null;
5979
+ let i = zt(c, []).filter((a) => X(a) && q(a) !== "body"), s = null;
5933
5980
  const o = Y(c).position === "fixed";
5934
5981
  let r = o ? P(c) : c;
5935
5982
  for (; X(r) && !U(r); ) {
5936
- const a = Y(r), l = mt(r);
5937
- !l && a.position === "fixed" && (s = null), (o ? !l && !s : !l && a.position === "static" && !!s && li.has(s.position) || tt(r) && !l && jt(c, r)) ? i = i.filter((d) => d !== r) : s = a, r = P(r);
5983
+ const a = Y(r), h = pt(r);
5984
+ !h && a.position === "fixed" && (s = null), (o ? !h && !s : !h && a.position === "static" && !!s && hi.has(s.position) || et(r) && !h && Zt(c, r)) ? i = i.filter((d) => d !== r) : s = a, r = P(r);
5938
5985
  }
5939
5986
  return t.set(c, i), i;
5940
5987
  }
@@ -5945,15 +5992,15 @@ function di(c) {
5945
5992
  rootBoundary: i,
5946
5993
  strategy: s
5947
5994
  } = c;
5948
- const r = [...e === "clippingAncestors" ? nt(t) ? [] : ci(t, this._c) : [].concat(e), i], a = r[0], l = r.reduce((h, d) => {
5949
- const f = Lt(t, d, s);
5950
- return h.top = $(f.top, h.top), h.right = j(f.right, h.right), h.bottom = j(f.bottom, h.bottom), h.left = $(f.left, h.left), h;
5951
- }, Lt(t, a, s));
5995
+ const r = [...e === "clippingAncestors" ? at(t) ? [] : ci(t, this._c) : [].concat(e), i], a = r[0], h = r.reduce((l, d) => {
5996
+ const f = Mt(t, d, s);
5997
+ return l.top = $(f.top, l.top), l.right = j(f.right, l.right), l.bottom = j(f.bottom, l.bottom), l.left = $(f.left, l.left), l;
5998
+ }, Mt(t, a, s));
5952
5999
  return {
5953
- width: l.right - l.left,
5954
- height: l.bottom - l.top,
5955
- x: l.left,
5956
- y: l.top
6000
+ width: h.right - h.left,
6001
+ height: h.bottom - h.top,
6002
+ x: h.left,
6003
+ y: h.top
5957
6004
  };
5958
6005
  }
5959
6006
  function fi(c) {
@@ -5967,22 +6014,22 @@ function fi(c) {
5967
6014
  };
5968
6015
  }
5969
6016
  function xi(c, t, e) {
5970
- const i = K(t), s = F(t), o = e === "fixed", r = q(c, !0, o, t);
6017
+ const i = K(t), s = W(t), o = e === "fixed", r = J(c, !0, o, t);
5971
6018
  let a = {
5972
6019
  scrollLeft: 0,
5973
6020
  scrollTop: 0
5974
6021
  };
5975
- const l = B(0);
5976
- function h() {
5977
- l.x = Et(s);
6022
+ const h = B(0);
6023
+ function l() {
6024
+ h.x = yt(s);
5978
6025
  }
5979
6026
  if (i || !i && !o)
5980
- if ((Z(t) !== "body" || tt(s)) && (a = at(t)), i) {
5981
- const x = q(t, !0, o, t);
5982
- l.x = x.x + t.clientLeft, l.y = x.y + t.clientTop;
5983
- } else s && h();
5984
- o && !i && s && h();
5985
- 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;
6027
+ if ((q(t) !== "body" || et(s)) && (a = ht(t)), i) {
6028
+ const x = J(t, !0, o, t);
6029
+ h.x = x.x + t.clientLeft, h.y = x.y + t.clientTop;
6030
+ } else s && l();
6031
+ o && !i && s && l();
6032
+ const d = s && !i && !o ? qt(s, a) : B(0), f = r.left + a.scrollLeft - h.x - d.x, u = r.top + a.scrollTop - h.y - d.y;
5986
6033
  return {
5987
6034
  x: f,
5988
6035
  y: u,
@@ -5993,17 +6040,17 @@ function xi(c, t, e) {
5993
6040
  function lt(c) {
5994
6041
  return Y(c).position === "static";
5995
6042
  }
5996
- function Mt(c, t) {
6043
+ function At(c, t) {
5997
6044
  if (!K(c) || Y(c).position === "fixed")
5998
6045
  return null;
5999
6046
  if (t)
6000
6047
  return t(c);
6001
6048
  let e = c.offsetParent;
6002
- return F(c) === e && (e = e.ownerDocument.body), e;
6049
+ return W(c) === e && (e = e.ownerDocument.body), e;
6003
6050
  }
6004
- function qt(c, t) {
6051
+ function jt(c, t) {
6005
6052
  const e = H(c);
6006
- if (nt(c))
6053
+ if (at(c))
6007
6054
  return e;
6008
6055
  if (!K(c)) {
6009
6056
  let s = P(c);
@@ -6014,13 +6061,13 @@ function qt(c, t) {
6014
6061
  }
6015
6062
  return e;
6016
6063
  }
6017
- let i = Mt(c, t);
6018
- for (; i && Ze(i) && lt(i); )
6019
- i = Mt(i, t);
6020
- return i && U(i) && lt(i) && !mt(i) ? e : i || ti(c) || e;
6064
+ let i = At(c, t);
6065
+ for (; i && qe(i) && lt(i); )
6066
+ i = At(i, t);
6067
+ return i && U(i) && lt(i) && !pt(i) ? e : i || ti(c) || e;
6021
6068
  }
6022
6069
  const ui = async function(c) {
6023
- const t = this.getOffsetParent || qt, e = this.getDimensions, i = await e(c.floating);
6070
+ const t = this.getOffsetParent || jt, e = this.getDimensions, i = await e(c.floating);
6024
6071
  return {
6025
6072
  reference: xi(c.reference, await t(c.floating), c.strategy),
6026
6073
  floating: {
@@ -6036,16 +6083,16 @@ function gi(c) {
6036
6083
  }
6037
6084
  const wi = {
6038
6085
  convertOffsetParentRelativeRectToViewportRelativeRect: oi,
6039
- getDocumentElement: F,
6086
+ getDocumentElement: W,
6040
6087
  getClippingRect: di,
6041
- getOffsetParent: qt,
6088
+ getOffsetParent: jt,
6042
6089
  getElementRects: ui,
6043
6090
  getClientRects: ri,
6044
6091
  getDimensions: fi,
6045
6092
  getScale: G,
6046
6093
  isElement: X,
6047
6094
  isRTL: gi
6048
- }, Jt = ze, Qt = $e, te = We, mi = Fe, ee = (c, t, e) => {
6095
+ }, Jt = ze, Qt = $e, te = Fe, mi = We, ee = (c, t, e) => {
6049
6096
  const i = /* @__PURE__ */ new Map(), s = {
6050
6097
  platform: wi,
6051
6098
  ...e
@@ -6079,7 +6126,7 @@ let pi = class {
6079
6126
  borderRadius: "4px",
6080
6127
  fontSize: "12px",
6081
6128
  ...o
6082
- }, l = {
6129
+ }, h = {
6083
6130
  position: "absolute",
6084
6131
  width: "10px",
6085
6132
  height: "10px",
@@ -6088,7 +6135,7 @@ let pi = class {
6088
6135
  transform: "rotate(45deg)",
6089
6136
  zIndex: a.zIndex
6090
6137
  };
6091
- Object.assign(this.arrowEl.style, l), Object.assign(this.floatingEl.style, a), this.floatingEl.appendChild(this.contentEl), this.floatingEl.appendChild(this.arrowEl), this.ctx.containerElement.appendChild(this.floatingEl), this.init();
6138
+ Object.assign(this.arrowEl.style, h), Object.assign(this.floatingEl.style, a), this.floatingEl.appendChild(this.contentEl), this.floatingEl.appendChild(this.arrowEl), this.ctx.containerElement.appendChild(this.floatingEl), this.init();
6092
6139
  }
6093
6140
  init() {
6094
6141
  this.floatingEl.addEventListener("mouseleave", () => {
@@ -6137,10 +6184,10 @@ let pi = class {
6137
6184
  placement: t.overflowTooltipPlacement,
6138
6185
  middleware: [Qt(), te(), Jt(6), mi({ element: this.arrowEl })]
6139
6186
  }).then((a) => {
6140
- const { x: l, y: h, placement: d, middlewareData: f } = a;
6187
+ const { x: h, y: l, placement: d, middlewareData: f } = a;
6141
6188
  if (Object.assign(this.floatingEl.style, {
6142
- top: `${h}px`,
6143
- left: `${l}px`
6189
+ top: `${l}px`,
6190
+ left: `${h}px`
6144
6191
  }), f.arrow) {
6145
6192
  const u = f.arrow;
6146
6193
  ["left", "left-start", "left-end"].includes(d) ? Object.assign(this.arrowEl.style, {
@@ -6205,15 +6252,15 @@ class Ei {
6205
6252
  return;
6206
6253
  if (t.code === "Escape" && this.ctx.editing) {
6207
6254
  this.cancel = !0;
6208
- const { focusCell: l } = this.ctx;
6209
- l && (this.ctx.emit("setSelectorCell", l), this.cellTarget = l), this.doneEdit();
6255
+ const { focusCell: h } = this.ctx;
6256
+ h && (this.ctx.emit("setSelectorCell", h), this.cellTarget = h), this.doneEdit();
6210
6257
  return;
6211
6258
  }
6212
6259
  if ((t.altKey || t.metaKey) && t.code === "Enter" && this.ctx.editing && this.inputEl) {
6213
6260
  t.preventDefault();
6214
- const l = this.inputEl.selectionStart, h = this.inputEl.value.substring(0, l), d = this.inputEl.value.substring(l);
6215
- this.inputEl.value = h + `
6216
- ` + d, this.inputEl.selectionStart = this.inputEl.selectionEnd = l + 1, this.autoSize();
6261
+ const h = this.inputEl.selectionStart, l = this.inputEl.value.substring(0, h), d = this.inputEl.value.substring(h);
6262
+ this.inputEl.value = l + `
6263
+ ` + d, this.inputEl.selectionStart = this.inputEl.selectionEnd = h + 1, this.autoSize();
6217
6264
  return;
6218
6265
  }
6219
6266
  if (t.code === "Tab" && this.ctx.editing) {
@@ -6289,8 +6336,8 @@ class Ei {
6289
6336
  });
6290
6337
  }
6291
6338
  isInSelectorRange(t, e) {
6292
- const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a, l] = s;
6293
- return !(e < o || e > r || t < a || t > l);
6339
+ const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a, h] = s;
6340
+ return !(e < o || e > r || t < a || t > h);
6294
6341
  }
6295
6342
  initTextEditor() {
6296
6343
  this.inputEl = document.createElement("textarea"), this.inputEl.setAttribute("rows", "1"), this.inputEl.addEventListener("input", this.autoSize.bind(this)), this.inputEl.addEventListener("blur", () => {
@@ -6312,15 +6359,15 @@ class Ei {
6312
6359
  startEditByInput(t, e = !1) {
6313
6360
  const i = e ? null : t.getValue(), { editorType: s } = t;
6314
6361
  t.update(), this.ctx.config.ENABLE_MERGE_CELL_LINK && t.updateSpanInfo();
6315
- let { height: o, width: r, drawY: a, drawX: l } = t;
6316
- this.drawX = l, this.drawY = a;
6362
+ let { height: o, width: r, drawY: a, drawX: h } = t;
6363
+ this.drawX = h, this.drawY = a;
6317
6364
  const {
6318
- config: { CELL_PADDING: h },
6365
+ config: { CELL_PADDING: l },
6319
6366
  header: d
6320
6367
  } = this.ctx;
6321
6368
  let f = this.ctx.body.visibleHeight;
6322
6369
  if (o > f && (o = f), this.editorEl.style.display = "inline-block", this.editorEl.style.left = `${this.drawX - 1}px`, this.editorEl.style.top = `${this.drawY - 1}px`, this.editorEl.style.bottom = "auto", this.editorEl.style.maxHeight = `${f}px`, s === "text") {
6323
- this.inputEl.style.display = "block", 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 - 1}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${h}px`, i !== null && (this.inputEl.value = i), this.inputEl.focus({ preventScroll: !0 });
6370
+ this.inputEl.style.display = "block", 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 - 1}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${l}px`, i !== null && (this.inputEl.value = i), this.inputEl.focus({ preventScroll: !0 });
6324
6371
  const u = this.inputEl.value.length;
6325
6372
  this.inputEl.setSelectionRange(u, u);
6326
6373
  } else
@@ -6344,22 +6391,22 @@ class Ei {
6344
6391
  const { rowKey: o, key: r, editorType: a } = i;
6345
6392
  if (a === "none")
6346
6393
  return;
6347
- const l = this.ctx.database.getReadonly(o, r);
6348
- i && !l && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = i, this.startEditByInput(this.cellTarget, t), this.ctx.emit("startEdit", this.cellTarget));
6394
+ const h = this.ctx.database.getReadonly(o, r);
6395
+ i && !h && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = i, this.startEditByInput(this.cellTarget, t), this.ctx.emit("startEdit", this.cellTarget));
6349
6396
  }
6350
6397
  editCell(t, e) {
6351
- const i = this.ctx.body.renderRows.find((h) => h.rowIndex === t);
6398
+ const i = this.ctx.body.renderRows.find((l) => l.rowIndex === t);
6352
6399
  if (!i)
6353
6400
  return;
6354
- const s = i.cells.find((h) => h.colIndex === e);
6401
+ const s = i.cells.find((l) => l.colIndex === e);
6355
6402
  if (!s)
6356
6403
  return;
6357
6404
  this.ctx.emit("setSelectorCell", s);
6358
6405
  const o = this.ctx.focusCell;
6359
6406
  if (!o || ["index", "index-selection", "selection"].includes(o.type) || this.enable)
6360
6407
  return;
6361
- const { rowKey: r, key: a } = o, l = this.ctx.database.getReadonly(r, a);
6362
- o && !l && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = o, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
6408
+ const { rowKey: r, key: a } = o, h = this.ctx.database.getReadonly(r, a);
6409
+ o && !h && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = o, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
6363
6410
  }
6364
6411
  doneEdit() {
6365
6412
  this.enable && (this.doneEditByInput(), this.ctx.emit("doneEdit", this.cellTarget), this.enable = !1, this.ctx.editing = !1, this.ctx.containerElement.focus({ preventScroll: !0 }), this.editorEl.style.display = "none", this.ctx.emit("draw"));
@@ -6379,17 +6426,17 @@ class yi {
6379
6426
  this.ctx = t;
6380
6427
  const { EMPTY_TEXT: e, EMPTY_CUSTOM_STYLE: i } = this.ctx.config;
6381
6428
  this.ctx.emptyElement ? this.emptyEl = this.ctx.emptyElement : (this.emptyEl = document.createElement("div"), this.emptyEl.innerText = e), this.emptyEl.className = "e-virt-table-empty", this.emptyEl.style.display = "none", this.ctx.containerElement.appendChild(this.emptyEl), this.ctx.on("emptyChange", ({ type: s, headerHeight: o, bodyHeight: r, footerHeight: a }) => {
6382
- const l = o + (r + a) / 2, h = {
6429
+ const h = o + (r + a) / 2, l = {
6383
6430
  display: s === "empty" ? "block" : "none",
6384
6431
  position: "absolute",
6385
6432
  fontSize: "14px",
6386
6433
  color: "#666",
6387
6434
  left: "50%",
6388
- top: `${l}px`,
6435
+ top: `${h}px`,
6389
6436
  transform: "translate(-50%, -50%)",
6390
6437
  ...i
6391
6438
  };
6392
- Object.assign(this.emptyEl.style, h);
6439
+ Object.assign(this.emptyEl.style, l);
6393
6440
  });
6394
6441
  }
6395
6442
  destroy() {
@@ -6400,9 +6447,30 @@ class Ci {
6400
6447
  constructor(t) {
6401
6448
  n(this, "ctx");
6402
6449
  n(this, "observer");
6403
- this.ctx = t, this.observer = new MutationObserver(() => {
6404
- this.ctx.overlayerElement.querySelectorAll('[data-auto-height="true"]').length > 0 && this.ctx.emit("drawView");
6405
- }), this.observer.observe(this.ctx.overlayerElement, { childList: !0, subtree: !0 });
6450
+ this.ctx = t, this.observer = new MutationObserver(
6451
+ Z(() => {
6452
+ const e = this.ctx.overlayerElement.querySelectorAll('[data-auto-height="true"]'), i = /* @__PURE__ */ new Map();
6453
+ e.forEach((r) => {
6454
+ const a = Number(r.getAttribute("data-row-index")), h = Number(r.getAttribute("data-col-index"));
6455
+ if (isNaN(a) || isNaN(h) || !(r instanceof HTMLElement) || r.offsetWidth === 0)
6456
+ return;
6457
+ const l = `${a}​_${h}`;
6458
+ i.set(l, Math.round(r.offsetHeight));
6459
+ });
6460
+ const s = this.ctx.database.getOverlayerAutoHeightMap();
6461
+ if (!this.arerMapsEqual(s, i)) {
6462
+ if (this.ctx.database.setOverlayerAutoHeightMap(i), s.size === 0 && i.size === 0)
6463
+ return;
6464
+ this.ctx.emit("draw");
6465
+ }
6466
+ }, 16.67)
6467
+ ), this.observer.observe(this.ctx.overlayerElement, { childList: !0, subtree: !0, attributes: !0 });
6468
+ }
6469
+ arerMapsEqual(t, e) {
6470
+ if (t.size !== e.size) return !1;
6471
+ for (let [i, s] of t)
6472
+ if (!e.has(i) || e.get(i) !== s) return !1;
6473
+ return !0;
6406
6474
  }
6407
6475
  draw() {
6408
6476
  const t = this.getContainer();
@@ -6428,9 +6496,9 @@ class Ci {
6428
6496
  fixedRightWidth: e,
6429
6497
  config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
6430
6498
  } = this.ctx, { visibleWidth: o, visibleHeight: r, renderCellHeaders: a } = this.ctx.header;
6431
- let l = [], h = [], d = [];
6499
+ let h = [], l = [], d = [];
6432
6500
  a.forEach((g) => {
6433
- g.render && (g.fixed === "left" ? h.push(g) : g.fixed === "right" ? d.push(g) : l.push(g));
6501
+ g.render && (g.fixed === "left" ? l.push(g) : g.fixed === "right" ? d.push(g) : h.push(g));
6434
6502
  });
6435
6503
  const f = e - i, u = {
6436
6504
  key: "left",
@@ -6442,7 +6510,7 @@ class Ci {
6442
6510
  width: `${t}px`,
6443
6511
  height: `${r}px`
6444
6512
  },
6445
- cells: h
6513
+ cells: l
6446
6514
  }, x = {
6447
6515
  key: "center",
6448
6516
  style: {
@@ -6453,7 +6521,7 @@ class Ci {
6453
6521
  width: `${o - t - f + 1}px`,
6454
6522
  height: `${r}px`
6455
6523
  },
6456
- cells: l
6524
+ cells: h
6457
6525
  }, w = {
6458
6526
  key: "right",
6459
6527
  style: {
@@ -6489,8 +6557,8 @@ class Ci {
6489
6557
  const {
6490
6558
  fixedLeftWidth: o,
6491
6559
  fixedRightWidth: r,
6492
- config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX: l }
6493
- } = this.ctx, { visibleWidth: h, visibleHeight: d } = this.ctx.body, f = r - a, u = {
6560
+ config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX: h }
6561
+ } = this.ctx, { visibleWidth: l, visibleHeight: d } = this.ctx.body, f = r - a, u = {
6494
6562
  key: "left",
6495
6563
  style: {
6496
6564
  position: "absolute",
@@ -6508,7 +6576,7 @@ class Ci {
6508
6576
  top: `${0.5}px`,
6509
6577
  left: `${o - 0.5}px`,
6510
6578
  overflow: "hidden",
6511
- width: `${h - o - f}px`,
6579
+ width: `${l - o - f}px`,
6512
6580
  height: `${d}px`
6513
6581
  },
6514
6582
  cells: t
@@ -6526,11 +6594,11 @@ class Ci {
6526
6594
  };
6527
6595
  return {
6528
6596
  type: "body",
6529
- class: `${l}-overlayer-body`,
6597
+ class: `${h}-overlayer-body`,
6530
6598
  style: {
6531
6599
  position: "relative",
6532
6600
  overflow: "hidden",
6533
- width: `${h}px`,
6601
+ width: `${l}px`,
6534
6602
  height: `${d}px`
6535
6603
  },
6536
6604
  views: [u, x, w]
@@ -6547,7 +6615,7 @@ class Ci {
6547
6615
  fixedLeftWidth: s,
6548
6616
  fixedRightWidth: o,
6549
6617
  config: { SCROLLER_TRACK_SIZE: r, CSS_PREFIX: a }
6550
- } = this.ctx, { visibleWidth: l, visibleHeight: h } = this.ctx.footer, d = o - r, f = {
6618
+ } = this.ctx, { visibleWidth: h, visibleHeight: l } = this.ctx.footer, d = o - r, f = {
6551
6619
  key: "left",
6552
6620
  style: {
6553
6621
  position: "absolute",
@@ -6555,7 +6623,7 @@ class Ci {
6555
6623
  left: `${0.5}px`,
6556
6624
  overflow: "hidden",
6557
6625
  width: `${s}px`,
6558
- height: `${h}px`
6626
+ height: `${l}px`
6559
6627
  },
6560
6628
  cells: e
6561
6629
  }, u = {
@@ -6565,8 +6633,8 @@ class Ci {
6565
6633
  top: `${0.5}px`,
6566
6634
  left: `${s - 0.5}px`,
6567
6635
  overflow: "hidden",
6568
- width: `${l - s - d}px`,
6569
- height: `${h}px`
6636
+ width: `${h - s - d}px`,
6637
+ height: `${l}px`
6570
6638
  },
6571
6639
  cells: t
6572
6640
  }, x = {
@@ -6577,7 +6645,7 @@ class Ci {
6577
6645
  right: `${0.5}px`,
6578
6646
  overflow: "hidden",
6579
6647
  width: `${d}px`,
6580
- height: `${h}px`
6648
+ height: `${l}px`
6581
6649
  },
6582
6650
  cells: i
6583
6651
  };
@@ -6587,8 +6655,8 @@ class Ci {
6587
6655
  style: {
6588
6656
  position: "relative",
6589
6657
  overflow: "hidden",
6590
- width: `${l}px`,
6591
- height: `${h}px`
6658
+ width: `${h}px`,
6659
+ height: `${l}px`
6592
6660
  },
6593
6661
  views: [f, u, x]
6594
6662
  };
@@ -6605,8 +6673,8 @@ class bi {
6605
6673
  this.ctx.on("cellContextMenuClick", (t, e) => {
6606
6674
  if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
6607
6675
  e.preventDefault();
6608
- const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a, l] = s, { rowIndex: h, colIndex: d } = t;
6609
- h >= a && h <= l && d >= o && d <= r || this.ctx.emit("setSelectorCell", t, e);
6676
+ const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a, h] = s, { rowIndex: l, colIndex: d } = t;
6677
+ l >= a && l <= h && d >= o && d <= r || this.ctx.emit("setSelectorCell", t, e);
6610
6678
  const u = {
6611
6679
  getBoundingClientRect: () => ({
6612
6680
  width: 0,
@@ -6680,7 +6748,7 @@ class bi {
6680
6748
  this.contextMenuEl.remove();
6681
6749
  }
6682
6750
  }
6683
- class Si {
6751
+ class vi {
6684
6752
  constructor(t, e) {
6685
6753
  n(this, "options");
6686
6754
  n(this, "scroller");
@@ -6703,32 +6771,49 @@ class Si {
6703
6771
  o,
6704
6772
  r
6705
6773
  );
6706
- this.ctx = new Re(a, this.options), this.header = new Se(this.ctx), this.footer = new _e(this.ctx), this.body = new ve(this.ctx), this.scroller = new Ie(this.ctx), this.selector = new Te(this.ctx), this.autofill = new Oe(this.ctx), this.tooltip = new pi(this.ctx), this.empty = new yi(this.ctx), this.editor = new Ei(this.ctx), this.overlayer = new Ci(this.ctx), this.contextMenu = new bi(this.ctx), this.ctx.on("draw", () => {
6707
- this.draw();
6708
- }), this.ctx.on("drawView", () => {
6709
- this.draw(!0);
6710
- }), this.draw();
6774
+ this.ctx = new Re(a, this.options), this.header = new ve(this.ctx), this.footer = new _e(this.ctx), this.body = new Se(this.ctx), this.scroller = new Ie(this.ctx), this.selector = new Te(this.ctx), this.autofill = new Oe(this.ctx), this.tooltip = new pi(this.ctx), this.empty = new yi(this.ctx), this.editor = new Ei(this.ctx), this.overlayer = new Ci(this.ctx), this.contextMenu = new bi(this.ctx), this.ctx.on(
6775
+ "draw",
6776
+ Z(
6777
+ () => {
6778
+ this.draw();
6779
+ },
6780
+ () => this.ctx.drawTime
6781
+ )
6782
+ ), this.ctx.on(
6783
+ "drawView",
6784
+ Z(
6785
+ () => {
6786
+ this.draw(!0);
6787
+ },
6788
+ () => this.ctx.drawTime
6789
+ )
6790
+ ), this.draw();
6711
6791
  }
6712
6792
  createContainer(t, e, i, s, o) {
6713
6793
  t.className = "e-virt-table-container";
6714
- const r = document.createElement("div"), a = document.createElement("canvas"), l = e || document.createElement("div");
6715
- r.className = "e-virt-table-stage", t.tabIndex = 0, a.className = "e-virt-table-canvas", l.className = "e-virt-table-overlayer";
6716
- const h = i || document.createElement("div");
6717
- h.className = "e-virt-table-editor";
6794
+ const r = document.createElement("div"), a = document.createElement("canvas"), h = e || document.createElement("div");
6795
+ r.className = "e-virt-table-stage", t.tabIndex = 0, a.className = "e-virt-table-canvas", h.className = "e-virt-table-overlayer";
6796
+ const l = i || document.createElement("div");
6797
+ l.className = "e-virt-table-editor";
6718
6798
  const d = s, f = o;
6719
- return r.appendChild(a), r.appendChild(l), t.appendChild(r), {
6799
+ return r.appendChild(a), r.appendChild(h), t.appendChild(r), {
6720
6800
  containerElement: t,
6721
6801
  stageElement: r,
6722
6802
  canvasElement: a,
6723
- overlayerElement: l,
6724
- editorElement: h,
6803
+ overlayerElement: h,
6804
+ editorElement: l,
6725
6805
  emptyElement: d,
6726
6806
  contextMenuElement: f
6727
6807
  };
6728
6808
  }
6729
6809
  draw(t = !1) {
6730
6810
  requestAnimationFrame(() => {
6731
- this.header.update(), this.footer.update(), this.body.update(), this.ctx.paint.clear(), this.body.draw(), this.footer.draw(), this.header.draw(), this.scroller.draw(), t || this.overlayer.draw();
6811
+ const e = performance.now();
6812
+ this.header.update(), this.footer.update(), this.body.update(), this.ctx.paint.clear(), this.body.draw(), this.footer.draw(), this.header.draw(), this.scroller.draw(), t || this.overlayer.draw(), requestAnimationFrame(() => {
6813
+ this.body.updateAutoHeight();
6814
+ });
6815
+ const i = performance.now(), s = Math.round(i - e);
6816
+ this.ctx.drawTime = s * this.ctx.config.DRAW_TIME_MULTIPLIER;
6732
6817
  });
6733
6818
  }
6734
6819
  loadConfig(t) {
@@ -6808,15 +6893,15 @@ class Si {
6808
6893
  return new Promise(async (i, s) => {
6809
6894
  let o = [];
6810
6895
  for (let r = 0; r < t.length; r++) {
6811
- const { rowKey: a, key: l } = t[r], h = await this.ctx.database.getValidator(a, l);
6812
- Array.isArray(h) && h.length && o.push(h);
6896
+ const { rowKey: a, key: h } = t[r], l = await this.ctx.database.getValidator(a, h);
6897
+ Array.isArray(l) && l.length && o.push(l);
6813
6898
  }
6814
6899
  if (o.length) {
6815
6900
  if (s(o), e) {
6816
6901
  const [r] = o;
6817
6902
  if (Array.isArray(r) && r.length) {
6818
- const [a] = r, { rowKey: l, key: h } = a;
6819
- this.scrollToRowkey(l), this.scrollToColkey(h);
6903
+ const [a] = r, { rowKey: h, key: l } = a;
6904
+ this.scrollToRowkey(h), this.scrollToColkey(l);
6820
6905
  }
6821
6906
  }
6822
6907
  this.ctx.emit("draw");
@@ -6833,12 +6918,12 @@ class Si {
6833
6918
  if (t && Array.isArray(s) && s.length) {
6834
6919
  const [o] = s;
6835
6920
  if (Array.isArray(o) && o.length) {
6836
- const [r] = o, { rowKey: a, key: l } = r, h = this.ctx.database.getRowForRowKey(a);
6837
- if (h) {
6838
- const { parentRowKeys: d = [] } = h;
6921
+ const [r] = o, { rowKey: a, key: h } = r, l = this.ctx.database.getRowForRowKey(a);
6922
+ if (l) {
6923
+ const { parentRowKeys: d = [] } = l;
6839
6924
  d && d.length && this.setExpandRowKeys(d, !0);
6840
6925
  }
6841
- this.scrollToRowkey(a), this.scrollToColkey(l);
6926
+ this.scrollToRowkey(a), this.scrollToColkey(h);
6842
6927
  }
6843
6928
  }
6844
6929
  i(s);
@@ -6863,7 +6948,7 @@ class Si {
6863
6948
  let o = [];
6864
6949
  for (let r = 0; r < i.length; r++)
6865
6950
  for (let a = 0; a < s.length; a++) {
6866
- const l = this.ctx.database.getRowKeyByItem(i[r]), d = s[a].key, f = await this.ctx.database.getValidator(l, d);
6951
+ const h = this.ctx.database.getRowKeyByItem(i[r]), d = s[a].key, f = await this.ctx.database.getValidator(h, d);
6867
6952
  Array.isArray(f) && f.length && o.push(f);
6868
6953
  }
6869
6954
  o.length ? (e(o), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
@@ -6964,6 +7049,6 @@ class Si {
6964
7049
  }
6965
7050
  }
6966
7051
  export {
6967
- Si as default
7052
+ vi as default
6968
7053
  };
6969
7054
  //# sourceMappingURL=index.es.js.map