e-virt-table 1.2.19 → 1.2.20

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
@@ -11,6 +11,8 @@ class te {
11
11
  const e = [], { column: i, row: s, key: o, rowKey: r, colIndex: l, rowIndex: a, value: h, field: d, fieldValue: f } = t;
12
12
  Array.isArray(this.rules) || (this.rules = [this.rules]);
13
13
  for (const x of this.rules) {
14
+ if (!x.required && (h == null || h === ""))
15
+ return e;
14
16
  if (x.validator) {
15
17
  const u = {
16
18
  field: d,
@@ -468,7 +470,7 @@ class ut extends Dt {
468
470
  if (this.cellType === "footer") {
469
471
  let _ = h, S = a;
470
472
  if (typeof o == "function") {
471
- const v = o, { backgroundColor: b, color: O } = v({
473
+ const I = o, { backgroundColor: b, color: O } = I({
472
474
  row: this.row,
473
475
  rowIndex: this.rowIndex,
474
476
  colIndex: this.colIndex,
@@ -481,16 +483,16 @@ class ut extends Dt {
481
483
  return;
482
484
  }
483
485
  let w = "transparent";
484
- const E = this.ctx.hoverCell, m = this.ctx.currentCell;
485
- let y = this.rowIndex, R = this.rowIndex;
486
+ const E = this.ctx.hoverCell, y = this.ctx.currentCell;
487
+ let m = this.rowIndex, R = this.rowIndex;
486
488
  if (this.rowspan !== 1 && (x || d)) {
487
489
  const _ = this.getSpanInfo(), { yArr: S } = _;
488
- y = S[0], R = S[1];
490
+ m = S[0], R = S[1];
489
491
  }
490
- x && E && (E.rowKey === this.rowKey && (w = u), E.rowIndex >= y && E.rowIndex <= R && (w = u)), d && m && (m.rowKey === this.rowKey && (w = f), m.rowIndex >= y && m.rowIndex <= R && (w = f)), this.drawCellSkyBgColor = w;
491
- let C = e, I = l;
492
- if (this.ctx.database.getReadonly(this.rowKey, this.key) || (C = i, I = r), p && (this.rowIndex % 2 ? C = g : C = e), typeof s == "function") {
493
- const _ = s, { backgroundColor: S, color: v } = _({
492
+ x && E && (E.rowKey === this.rowKey && (w = u), E.rowIndex >= m && E.rowIndex <= R && (w = u)), d && y && (y.rowKey === this.rowKey && (w = f), y.rowIndex >= m && y.rowIndex <= R && (w = f)), this.drawCellSkyBgColor = w;
493
+ let C = e, v = l;
494
+ if (this.ctx.database.getReadonly(this.rowKey, this.key) || (C = i, v = r), p && (this.rowIndex % 2 ? C = g : C = e), typeof s == "function") {
495
+ const _ = s, { backgroundColor: S, color: I } = _({
494
496
  row: this.row,
495
497
  rowIndex: this.rowIndex,
496
498
  colIndex: this.colIndex,
@@ -498,9 +500,9 @@ class ut extends Dt {
498
500
  isHasChanged: this.isHasChanged,
499
501
  value: this.getValue()
500
502
  }) || {};
501
- S && (C = S), v && (I = v);
503
+ S && (C = S), I && (v = I);
502
504
  }
503
- this.drawCellBgColor = C, this.drawTextColor = I;
505
+ this.drawCellBgColor = C, this.drawTextColor = v;
504
506
  }
505
507
  updateSelection() {
506
508
  const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: l, rowIndex: a, rowKey: h } = this;
@@ -530,8 +532,8 @@ class ut extends Dt {
530
532
  if (l.rowKey === this.rowKey && (a = this.drawX + this.width - s - o, h = this.drawY + (this.height - s) / 2), this.rowspan !== 1 && r) {
531
533
  const f = this.getSpanInfo(), { yArr: x } = f, u = x[0], p = x[1];
532
534
  if (l.rowIndex >= u && l.rowIndex <= p) {
533
- const { width: g, height: w, offsetTop: E, offsetLeft: m } = f;
534
- a = this.drawX - m + g - s - o, h = this.drawY - E + (w - s) / 2;
535
+ const { width: g, height: w, offsetTop: E, offsetLeft: y } = f;
536
+ a = this.drawX - y + g - s - o, h = this.drawY - E + (w - s) / 2;
535
537
  }
536
538
  }
537
539
  const d = this.ctx.icons.get(this.hoverIconName);
@@ -760,10 +762,10 @@ class ut extends Dt {
760
762
  drawBorder(e) {
761
763
  const { drawX: i, drawY: s, rowIndex: o, colIndex: r, height: l, width: a } = this;
762
764
  let h = i, d = s;
763
- const { xArr: f, yArr: x, lineDash: u = [], borderWidth: p = 1, borderColor: g, fillColor: w } = e, E = f[0], m = f[1], y = x[0], R = x[1];
764
- if (r >= E && r <= m && o === y) {
765
- const C = r === m ? 1 : 0, I = r === E ? 1 : 0;
766
- this.ctx.paint.drawLine([h + I, d + 1, h + a - C, d + 1], {
765
+ const { xArr: f, yArr: x, lineDash: u = [], borderWidth: p = 1, borderColor: g, fillColor: w } = e, E = f[0], y = f[1], m = x[0], R = x[1];
766
+ if (r >= E && r <= y && o === m) {
767
+ const C = r === y ? 1 : 0, v = r === E ? 1 : 0;
768
+ this.ctx.paint.drawLine([h + v, d + 1, h + a - C, d + 1], {
767
769
  borderColor: g,
768
770
  fillColor: w,
769
771
  borderWidth: p,
@@ -772,9 +774,9 @@ class ut extends Dt {
772
774
  lineDash: u
773
775
  });
774
776
  }
775
- if (r === m && o >= y && o <= R) {
776
- const C = o === y ? 1 : 0, I = o === R ? 1 : 0;
777
- this.ctx.paint.drawLine([h + a - 1, d + C, h + a - 1, d + l - I], {
777
+ if (r === y && o >= m && o <= R) {
778
+ const C = o === m ? 1 : 0, v = o === R ? 1 : 0;
779
+ this.ctx.paint.drawLine([h + a - 1, d + C, h + a - 1, d + l - v], {
778
780
  borderColor: g,
779
781
  fillColor: w,
780
782
  borderWidth: p,
@@ -783,9 +785,9 @@ class ut extends Dt {
783
785
  lineDash: u
784
786
  });
785
787
  }
786
- if (r >= E && r <= m && o === R) {
787
- const C = r === m ? 1 : 0, I = r === E ? 1 : 0;
788
- this.ctx.paint.drawLine([h + I, d + l - 1, h + a - C, d + l - 1], {
788
+ if (r >= E && r <= y && o === R) {
789
+ const C = r === y ? 1 : 0, v = r === E ? 1 : 0;
790
+ this.ctx.paint.drawLine([h + v, d + l - 1, h + a - C, d + l - 1], {
789
791
  borderColor: g,
790
792
  fillColor: w,
791
793
  borderWidth: p,
@@ -794,9 +796,9 @@ class ut extends Dt {
794
796
  lineDash: u
795
797
  });
796
798
  }
797
- if (r === E && o >= y && o <= R) {
798
- const C = o === R ? 1 : 0, I = o === y ? 1 : 0;
799
- this.ctx.paint.drawLine([h + 1, d + I, h + 1, d + l - C], {
799
+ if (r === E && o >= m && o <= R) {
800
+ const C = o === R ? 1 : 0, v = o === m ? 1 : 0;
801
+ this.ctx.paint.drawLine([h + 1, d + v, h + 1, d + l - C], {
800
802
  borderColor: g,
801
803
  fillColor: w,
802
804
  borderWidth: p,
@@ -871,12 +873,12 @@ class ae {
871
873
  const u = s._height || a, p = s._readonly;
872
874
  let g = !0;
873
875
  if (typeof h == "function" && (g = h), d) {
874
- const m = s[d];
875
- if (this.checkboxKeyMap.has(m)) {
876
- const y = this.checkboxKeyMap.get(m) || [];
877
- y.push(x), this.checkboxKeyMap.set(m, y);
876
+ const y = s[d];
877
+ if (this.checkboxKeyMap.has(y)) {
878
+ const m = this.checkboxKeyMap.get(y) || [];
879
+ m.push(x), this.checkboxKeyMap.set(y, m);
878
880
  } else
879
- this.checkboxKeyMap.set(m, [x]);
881
+ this.checkboxKeyMap.set(y, [x]);
880
882
  }
881
883
  this.selectionMap.set(x, {
882
884
  key: d ? s[d] : x,
@@ -1100,56 +1102,54 @@ class ae {
1100
1102
  * @param history
1101
1103
  * @returns
1102
1104
  */
1103
- async batchSetItemValue(t, e = !1, i = !0) {
1104
- let s = [];
1105
- const o = /* @__PURE__ */ new Set();
1106
- let r = [], l = t.map((d) => {
1107
- const { rowKey: f, key: x } = d;
1108
- let u = d.value, p = u;
1109
- const g = this.getRowDataItemForRowKey(f), w = this.getItemValue(f, x), E = this.getVirtualBodyCellByKey(f, x);
1110
- return (E == null ? void 0 : E.type) === "number" && (["", void 0, null].includes(u) ? p = null : /^-?\d+(\.\d+)?$/.test(`${u}`) ? p = Number(u) : (p = w, r.push({
1111
- ...d,
1112
- value: p,
1113
- oldValue: w,
1114
- row: g
1105
+ async batchSetItemValue(t, e = !1, i = !0, s = "none") {
1106
+ let o = [], r = i;
1107
+ const l = /* @__PURE__ */ new Set();
1108
+ let a = [], h = t.map((u) => {
1109
+ const { rowKey: p, key: g } = u;
1110
+ let w = u.value, E = w;
1111
+ const y = this.getRowDataItemForRowKey(p), m = this.getItemValue(p, g), R = this.getVirtualBodyCellByKey(p, g);
1112
+ return (R == null ? void 0 : R.type) === "number" && (["", void 0, null].includes(w) ? E = null : /^-?\d+(\.\d+)?$/.test(`${w}`) ? E = Number(w) : (E = m, a.push({
1113
+ ...u,
1114
+ value: E,
1115
+ oldValue: m,
1116
+ row: y
1115
1117
  }))), {
1116
- ...d,
1117
- value: p,
1118
- oldValue: w,
1119
- row: g
1118
+ ...u,
1119
+ value: E,
1120
+ oldValue: m,
1121
+ row: y
1120
1122
  };
1121
1123
  });
1122
- if (l = l.filter((d) => !r.some((f) => d.rowKey === f.rowKey && d.key === f.key)), r.length) {
1123
- const d = {
1124
+ if (h = h.filter((u) => !a.some((p) => u.rowKey === p.rowKey && u.key === p.key)), a.length) {
1125
+ const u = {
1124
1126
  code: "ERR_BATCH_SET_NUMBER_VALUE",
1125
1127
  message: "Assignment failed, not a numeric type",
1126
- data: r
1128
+ data: a
1127
1129
  };
1128
- this.ctx.emit("error", d);
1130
+ this.ctx.emit("error", u);
1129
1131
  }
1130
- if (!l.length)
1132
+ if (!h.length)
1131
1133
  return;
1132
- const { BEFORE_VALUE_CHANGE_METHOD: a } = this.ctx.config;
1133
- typeof a == "function" && (l = await a(l)), l.forEach((d) => {
1134
- const { value: f, rowKey: x, key: u, oldValue: p } = d;
1135
- o.add(x), this.setItemValue(x, u, f, !1, !1, !1, i), s.push({
1136
- rowKey: x,
1137
- key: u,
1138
- oldValue: p,
1139
- newValue: f
1134
+ const { BEFORE_VALUE_CHANGE_METHOD: d } = this.ctx.config;
1135
+ s === "none" && typeof d == "function" && (h = await d(h), r = !1), h.forEach((u) => {
1136
+ const { value: p, rowKey: g, key: w } = u, E = this.getItemValue(g, w);
1137
+ l.add(g), this.setItemValue(g, w, p, !1, !1, !1, r), o.push({
1138
+ rowKey: g,
1139
+ key: w,
1140
+ oldValue: E,
1141
+ newValue: p
1140
1142
  });
1141
1143
  });
1142
- let h = [];
1143
- if (o.forEach((d) => {
1144
- h.push(this.ctx.database.getRowDataItemForRowKey(d));
1145
- }), i) {
1146
- const d = l.map(({ rowKey: f, key: x }) => this.getValidator(f, x));
1147
- Promise.all(d).then(() => {
1148
- this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
1149
- }), this.ctx.emit("change", l, h);
1150
- }
1151
- e && this.ctx.history.pushState({
1152
- changeList: s,
1144
+ let f = [];
1145
+ l.forEach((u) => {
1146
+ f.push(this.ctx.database.getRowDataItemForRowKey(u));
1147
+ });
1148
+ const x = h.map(({ rowKey: u, key: p }) => this.getValidator(u, p));
1149
+ Promise.all(x).then(() => {
1150
+ this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
1151
+ }), this.ctx.emit("change", h, f), e && this.ctx.history.pushState({
1152
+ changeList: o,
1153
1153
  scrollX: this.ctx.scrollX,
1154
1154
  scrollY: this.ctx.scrollY,
1155
1155
  type: "multiple"
@@ -1189,7 +1189,7 @@ class ae {
1189
1189
  d = Number(i);
1190
1190
  else {
1191
1191
  d = h;
1192
- const E = {
1192
+ const w = {
1193
1193
  code: "ERR_SET_NUMBER_VALUE",
1194
1194
  message: "Assignment failed, not a numeric type",
1195
1195
  data: [
@@ -1202,37 +1202,23 @@ class ae {
1202
1202
  }
1203
1203
  ]
1204
1204
  };
1205
- this.ctx.emit("error", E);
1205
+ this.ctx.emit("error", w);
1206
1206
  }
1207
1207
  if (d === h)
1208
1208
  return {
1209
1209
  oldValue: h,
1210
1210
  newValue: h
1211
1211
  };
1212
- const { BEFORE_VALUE_CHANGE_METHOD: g } = this.ctx.config;
1213
- if (typeof g == "function") {
1214
- const m = await g([
1215
- {
1216
- rowKey: t,
1217
- key: e,
1218
- value: d,
1219
- oldValue: a[e],
1220
- row: u
1221
- }
1222
- ]);
1223
- m && m.length && (d = m[0].value);
1224
- }
1225
- this.changedDataMap.set(f, d), a[e] = d;
1226
- const w = {
1227
- rowKey: t,
1228
- key: e,
1229
- oldValue: h,
1230
- value: d,
1231
- row: u
1232
- };
1233
- l && (this.getValidator(t, e).then(() => {
1234
- this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
1235
- }), this.ctx.emit("change", [w], [u])), this.ctx.emit("editChange", {
1212
+ let g = [
1213
+ {
1214
+ rowKey: t,
1215
+ key: e,
1216
+ value: d,
1217
+ oldValue: h,
1218
+ row: u
1219
+ }
1220
+ ];
1221
+ this.batchSetItemValue(g, s, !1), this.ctx.emit("editChange", {
1236
1222
  rowKey: t,
1237
1223
  key: e,
1238
1224
  oldValue: h,
@@ -1249,18 +1235,6 @@ class ae {
1249
1235
  value: d,
1250
1236
  originalValue: this.originalDataMap.get(f),
1251
1237
  row: u
1252
- }), s && this.ctx.history.pushState({
1253
- type: "single",
1254
- scrollX: this.ctx.scrollX,
1255
- scrollY: this.ctx.scrollY,
1256
- changeList: [
1257
- {
1258
- rowKey: t,
1259
- key: e,
1260
- oldValue: h,
1261
- newValue: d
1262
- }
1263
- ]
1264
1238
  }), o && this.ctx.emit("draw"), {
1265
1239
  oldValue: h,
1266
1240
  newValue: d
@@ -1588,29 +1562,29 @@ class ae {
1588
1562
  }
1589
1563
  ]
1590
1564
  };
1591
- let w = e, E = e, m = l, y = l, R = [], C = 0, I = 0, _ = 0, S = 0;
1565
+ let w = e, E = e, y = l, m = l, R = [], C = 0, v = 0, _ = 0, S = 0;
1592
1566
  if (d !== 1 && p) {
1593
1567
  S = x;
1594
- const v = a.reduce((b, O) => {
1568
+ const I = a.reduce((b, O) => {
1595
1569
  const L = this.getItemValue(s, O) ?? "";
1596
1570
  return `${b}${L}`;
1597
1571
  }, "");
1598
1572
  for (let b = e - 1; b >= 0; b--) {
1599
1573
  const O = this.rowIndexRowKeyMap.get(b) || "", L = a.reduce((M, T) => {
1600
- const X = this.getItemValue(O, T) ?? "";
1601
- return `${M}${X}`;
1574
+ const k = this.getItemValue(O, T) ?? "";
1575
+ return `${M}${k}`;
1602
1576
  }, "");
1603
- if (v === L)
1577
+ if (I === L)
1604
1578
  w = b;
1605
1579
  else
1606
1580
  break;
1607
1581
  }
1608
1582
  for (let b = e; b <= this.ctx.maxRowIndex; b++) {
1609
1583
  const O = this.rowIndexRowKeyMap.get(b) || "", L = a.reduce((M, T) => {
1610
- const X = this.getItemValue(O, T) ?? "";
1611
- return `${M}${X}`;
1584
+ const k = this.getItemValue(O, T) ?? "";
1585
+ return `${M}${k}`;
1612
1586
  }, "");
1613
- if (v === L)
1587
+ if (I === L)
1614
1588
  E = b;
1615
1589
  else
1616
1590
  break;
@@ -1633,34 +1607,34 @@ class ae {
1633
1607
  }
1634
1608
  if (u !== 1 && g) {
1635
1609
  _ = f;
1636
- for (let v = l - 1; v >= 0; v--) {
1637
- const b = this.getColumnByColIndex(v);
1610
+ for (let I = l - 1; I >= 0; I--) {
1611
+ const b = this.getColumnByColIndex(I);
1638
1612
  if (!b)
1639
1613
  break;
1640
1614
  const O = this.getItemValue(s, i), L = this.getItemValue(s, b.key);
1641
1615
  if (O === L && h.includes(b.key))
1642
- m = v;
1616
+ y = I;
1643
1617
  else
1644
1618
  break;
1645
1619
  }
1646
- for (let v = l; v <= this.ctx.maxColIndex; v++) {
1647
- const b = this.getColumnByColIndex(v);
1620
+ for (let I = l; I <= this.ctx.maxColIndex; I++) {
1621
+ const b = this.getColumnByColIndex(I);
1648
1622
  if (!b)
1649
1623
  break;
1650
1624
  const O = this.getItemValue(s, i), L = this.getItemValue(s, b.key);
1651
1625
  if (O === L && h.includes(b.key))
1652
- y = v;
1626
+ m = I;
1653
1627
  else
1654
1628
  break;
1655
1629
  }
1656
- for (let v = m; v < l; v++) {
1657
- const b = this.getColumnByColIndex(v);
1630
+ for (let I = y; I < l; I++) {
1631
+ const b = this.getColumnByColIndex(I);
1658
1632
  if (!b)
1659
1633
  break;
1660
- I += b.width || 100;
1634
+ v += b.width || 100;
1661
1635
  }
1662
- for (let v = m; v <= y; v++) {
1663
- const b = this.getColumnByColIndex(v);
1636
+ for (let I = y; I <= m; I++) {
1637
+ const b = this.getColumnByColIndex(I);
1664
1638
  if (!b)
1665
1639
  break;
1666
1640
  S += b.width || 100, R.push({
@@ -1672,14 +1646,14 @@ class ae {
1672
1646
  }
1673
1647
  }
1674
1648
  return {
1675
- xArr: [m, y],
1649
+ xArr: [y, m],
1676
1650
  yArr: [w, E],
1677
1651
  rowspan: d,
1678
1652
  colspan: u,
1679
1653
  height: _,
1680
1654
  width: S,
1681
1655
  offsetTop: C,
1682
- offsetLeft: I,
1656
+ offsetLeft: v,
1683
1657
  dataList: R
1684
1658
  };
1685
1659
  }
@@ -1778,7 +1752,7 @@ class he {
1778
1752
  value: o.oldValue,
1779
1753
  row: {}
1780
1754
  }));
1781
- this.ctx.setScroll(e, i), this.ctx.database.batchSetItemValue(s, !1, !1), this.historyIndex -= 1;
1755
+ this.ctx.setScroll(e, i), this.ctx.database.batchSetItemValue(s, !1, !1, "back"), this.historyIndex -= 1;
1782
1756
  }
1783
1757
  }
1784
1758
  // 前进
@@ -1791,7 +1765,7 @@ class he {
1791
1765
  value: i.newValue,
1792
1766
  row: {}
1793
1767
  }));
1794
- this.ctx.database.batchSetItemValue(e, !1, !1);
1768
+ this.ctx.database.batchSetItemValue(e, !1, !1, "forward");
1795
1769
  }
1796
1770
  }
1797
1771
  // 清空历史
@@ -2452,7 +2426,7 @@ class xe {
2452
2426
  return this.icons.get(t);
2453
2427
  }
2454
2428
  }
2455
- class Xt extends Dt {
2429
+ class kt extends Dt {
2456
2430
  constructor(e, i, s, o, r, l, a) {
2457
2431
  super(e, s, o, r, l, "header", a.fixed);
2458
2432
  n(this, "align");
@@ -2672,7 +2646,7 @@ class ue {
2672
2646
  */
2673
2647
  selectionClick(t) {
2674
2648
  if (["selection", "index-selection"].includes(t.type) && this.ctx.isPointer)
2675
- if (t instanceof Xt)
2649
+ if (t instanceof kt)
2676
2650
  t.drawImageName === "checkbox-uncheck" || t.drawImageName === "checkbox-indeterminate" ? this.ctx.database.toggleAllSelection() : t.drawImageName === "checkbox-check" && this.ctx.database.clearSelection(!0);
2677
2651
  else {
2678
2652
  if (!this.ctx.database.getRowSelectable(t.rowKey))
@@ -3357,7 +3331,7 @@ class pe {
3357
3331
  const l = t[r], a = o * (l.rowspan || 0), h = o * (l.level || 0);
3358
3332
  let { minWidth: d, maxWidth: f } = l, x = l.width || 100;
3359
3333
  d && x < d && (x = d), f && x > f && (x = f), l.children && (x = et(l.children).reduce((g, w) => g + ((w == null ? void 0 : w.width) || 100), 0));
3360
- const u = new Xt(this.ctx, this.columnIndex, s, h, x, a, l);
3334
+ const u = new kt(this.ctx, this.columnIndex, s, h, x, a, l);
3361
3335
  this.ctx.database.setHeader(l.key, u), this.allCellHeaders.push(u), l.children || (this.leafCellHeaders.push(u), u.column.widthFillDisable || this.resizeNum++), l.fixed === "left" ? this.fixedLeftCellHeaders.push(u) : l.fixed === "right" ? this.fixedRightCellHeaders.push(u) : this.centerCellHeaders.push(u), !l.children && this.columnIndex++, l.children && this.render(l.children, s), s += x;
3362
3336
  }
3363
3337
  }
@@ -3431,7 +3405,7 @@ class pe {
3431
3405
  }), this.drawTipLine(), this.drawBottomLine();
3432
3406
  }
3433
3407
  }
3434
- class Bt {
3408
+ class Xt {
3435
3409
  constructor(t, e, i = 0, s = 0, o = 0, r = 0, l, a = "body") {
3436
3410
  n(this, "ctx");
3437
3411
  n(this, "x", 0);
@@ -3540,16 +3514,16 @@ class Ee {
3540
3514
  let w = this.height + e.height + r;
3541
3515
  w += g;
3542
3516
  let E = w;
3543
- const m = window.innerHeight, { top: y } = this.containerRect || this.ctx.containerElement.getBoundingClientRect();
3544
- if (m > y && d && !l) {
3545
- const L = m - y - f;
3517
+ const y = window.innerHeight, { top: m } = this.containerRect || this.ctx.containerElement.getBoundingClientRect();
3518
+ if (y > m && d && !l) {
3519
+ const L = y - m - f;
3546
3520
  L > e.height + r ? E = L : w > h && (E = h);
3547
3521
  } else this.data.length && l ? E = l : this.data.length && h && w > h && (E = h);
3548
3522
  E > 0 && (this.ctx.stageHeight = Math.floor(E), this.ctx.stageElement.style.height = `${this.ctx.stageHeight}px`);
3549
3523
  let R = this.ctx.stageHeight - e.height - r;
3550
3524
  o ? this.visibleHeight = R - g : 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 = u;
3551
- const C = window.devicePixelRatio || 1, I = this.ctx.stageWidth * C, _ = this.ctx.stageHeight * C;
3552
- t.width = Math.round(I), t.height = Math.round(_);
3525
+ const C = window.devicePixelRatio || 1, v = this.ctx.stageWidth * C, _ = this.ctx.stageHeight * C;
3526
+ t.width = Math.round(v), t.height = Math.round(_);
3553
3527
  const S = this.data.length ? "not-empty" : "empty";
3554
3528
  this.ctx.emit("emptyChange", {
3555
3529
  isEmpty: S,
@@ -3560,8 +3534,8 @@ class Ee {
3560
3534
  width: this.width,
3561
3535
  height: this.data.length ? 0 : a + g
3562
3536
  });
3563
- const v = Math.round(t.width / C * 1e4) / 1e4, b = Math.round(t.height / C * 1e4) / 1e4;
3564
- this.ctx.canvasElement.setAttribute("style", `height:${b}px;width:${v}px;`), this.ctx.paint.scale(C);
3537
+ const I = Math.round(t.width / C * 1e4) / 1e4, b = Math.round(t.height / C * 1e4) / 1e4;
3538
+ this.ctx.canvasElement.setAttribute("style", `height:${b}px;width:${I}px;`), this.ctx.paint.scale(C);
3565
3539
  }
3566
3540
  // 调整行的高度
3567
3541
  initResizeRow() {
@@ -3687,7 +3661,7 @@ class Ee {
3687
3661
  this.headIndex = Math.max(0, a), 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;
3688
3662
  const d = [];
3689
3663
  for (let f = 0; f < this.visibleRows.length; f++) {
3690
- const x = this.headIndex + f, u = this.visibleRows[f], { height: p, top: g } = this.ctx.database.getPositionForRowIndex(x), w = new Bt(this.ctx, x, 0, g + this.y, t.width, p, u);
3664
+ const x = this.headIndex + f, u = this.visibleRows[f], { height: p, top: g } = this.ctx.database.getPositionForRowIndex(x), w = new Xt(this.ctx, x, 0, g + this.y, t.width, p, u);
3691
3665
  d.push(w);
3692
3666
  }
3693
3667
  this.renderRows = d, this.ctx.body.renderRows = d;
@@ -3759,7 +3733,7 @@ class me {
3759
3733
  let e = this.y;
3760
3734
  const i = [];
3761
3735
  this.data.forEach((s, o) => {
3762
- const r = new Bt(this.ctx, o, 0, e, this.width, t, s, "footer");
3736
+ const r = new Xt(this.ctx, o, 0, e, this.width, t, s, "footer");
3763
3737
  e += t, i.push(r);
3764
3738
  }), this.renderRows = i, this.ctx.footer.renderRows = this.renderRows;
3765
3739
  }
@@ -3908,14 +3882,14 @@ class ye {
3908
3882
  SELECTOR_AREA_MAX_X_OFFSET: f,
3909
3883
  SELECTOR_AREA_MAX_Y_OFFSET: x
3910
3884
  } = this.ctx.config, u = l, p = a || this.ctx.maxColIndex - f, g = h, w = d || this.ctx.maxRowIndex - x;
3911
- let [E, m] = o, [y, R] = r;
3912
- if (E < u || m > p || y < g || R > w)
3885
+ let [E, y] = o, [m, R] = r;
3886
+ if (E < u || y > p || m < g || R > w)
3913
3887
  return;
3914
3888
  if (this.ctx.stageElement.focus({ preventScroll: !0 }), this.ctx.config.ENABLE_MERGE_CELL_LINK) {
3915
- const I = this.adjustMergeCells(o, r);
3916
- y = I.yArr[0], R = I.yArr[1], E = I.xArr[0], m = I.xArr[1], this.ctx.onlyMergeCell = I.onlyMergeCell;
3889
+ const v = this.adjustMergeCells(o, r);
3890
+ m = v.yArr[0], R = v.yArr[1], E = v.xArr[0], y = v.xArr[1], this.ctx.onlyMergeCell = v.onlyMergeCell;
3917
3891
  }
3918
- E === m && y === R ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, o = [Math.max(u, E), Math.min(p, m)], r = [Math.max(g, y), Math.min(w, R)];
3892
+ E === y && m === R ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, o = [Math.max(u, E), Math.min(p, y)], r = [Math.max(g, m), Math.min(w, R)];
3919
3893
  const { BEFORE_SET_SELECTOR_METHOD: C } = this.ctx.config;
3920
3894
  if (typeof C == "function") {
3921
3895
  const _ = C({
@@ -3936,13 +3910,13 @@ class ye {
3936
3910
  let l = [], a = [];
3937
3911
  for (let g = 0; g <= e[1] - e[0]; g++)
3938
3912
  for (let w = 0; w <= t[1] - t[0]; w++) {
3939
- const E = g + e[0], m = w + t[0], y = this.ctx.database.getVirtualBodyCell(E, m);
3940
- y && ((E === i || E === s) && l.push(y), (m === o || m === r) && a.push(y));
3913
+ const E = g + e[0], y = w + t[0], m = this.ctx.database.getVirtualBodyCell(E, y);
3914
+ m && ((E === i || E === s) && l.push(m), (y === o || y === r) && a.push(m));
3941
3915
  }
3942
3916
  const h = l.reduce(
3943
3917
  (g, w) => {
3944
- const { yArr: E } = w.getSpanInfo(), [m, y] = E;
3945
- return g.minY = Math.min(g.minY, m), g.maxY = Math.max(g.maxY, y), g;
3918
+ const { yArr: E } = w.getSpanInfo(), [y, m] = E;
3919
+ return g.minY = Math.min(g.minY, y), g.maxY = Math.max(g.maxY, m), g;
3946
3920
  },
3947
3921
  {
3948
3922
  minY: i,
@@ -3950,8 +3924,8 @@ class ye {
3950
3924
  }
3951
3925
  ), d = a.reduce(
3952
3926
  (g, w) => {
3953
- const { xArr: E } = w.getSpanInfo(), [m, y] = E;
3954
- return g.minX = Math.min(g.minX, m), g.maxX = Math.max(g.maxX, y), g;
3927
+ const { xArr: E } = w.getSpanInfo(), [y, m] = E;
3928
+ return g.minX = Math.min(g.minX, y), g.maxX = Math.max(g.maxX, m), g;
3955
3929
  },
3956
3930
  {
3957
3931
  minX: o,
@@ -4153,23 +4127,23 @@ class ye {
4153
4127
  });
4154
4128
  const g = r.length === 1 && r[0].length === 1;
4155
4129
  if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(l, a) && !g) {
4156
- const y = {
4130
+ const m = {
4157
4131
  code: "ERR_MERGED_CELLS_PASTE",
4158
4132
  message: "Merged cells cannot span paste data"
4159
4133
  };
4160
- this.ctx.hasEvent("error") ? this.ctx.emit("error", y) : alert(y.message);
4134
+ this.ctx.hasEvent("error") ? this.ctx.emit("error", m) : alert(m.message);
4161
4135
  return;
4162
4136
  }
4163
4137
  let w = [];
4164
- for (let y = 0; y <= r.length - 1; y++) {
4165
- const R = r[y].length;
4138
+ for (let m = 0; m <= r.length - 1; m++) {
4139
+ const R = r[m].length;
4166
4140
  for (let C = 0; C <= R - 1; C++) {
4167
- const I = y + e, _ = C + i, S = r[y][C], v = this.ctx.database.getItemValueForRowIndexAndColIndex(
4168
- I,
4141
+ const v = m + e, _ = C + i, S = r[m][C], I = this.ctx.database.getItemValueForRowIndexAndColIndex(
4142
+ v,
4169
4143
  _
4170
4144
  );
4171
- if (v) {
4172
- const { rowKey: b, key: O } = v;
4145
+ if (I) {
4146
+ const { rowKey: b, key: O } = I;
4173
4147
  this.ctx.database.getReadonly(b, O) || (s.add(b), w.push({
4174
4148
  rowKey: b,
4175
4149
  key: O,
@@ -4181,13 +4155,13 @@ class ye {
4181
4155
  }
4182
4156
  }
4183
4157
  if (this.isCut) {
4184
- const y = this.clearSelectedData(
4158
+ const m = this.clearSelectedData(
4185
4159
  this.ctx.selector.xArrCopy,
4186
4160
  this.ctx.selector.yArrCopy,
4187
4161
  !0
4188
4162
  // 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
4189
4163
  ), R = w.map((C) => `${C.rowKey}-${C.key}`);
4190
- y.forEach((C) => {
4164
+ m.forEach((C) => {
4191
4165
  R.includes(`${C.rowKey}-${C.key}`) || w.unshift(C);
4192
4166
  }), this.isCut = !1;
4193
4167
  }
@@ -4195,21 +4169,21 @@ class ye {
4195
4169
  return;
4196
4170
  const { BEFORE_PASTE_DATA_METHOD: E } = this.ctx.config;
4197
4171
  if (typeof E == "function") {
4198
- const y = E, R = w.map((C) => ({
4172
+ const m = E, R = w.map((C) => ({
4199
4173
  rowKey: C.rowKey,
4200
4174
  key: C.key,
4201
4175
  value: C.value,
4202
4176
  oldValue: this.ctx.database.getItemValue(C.rowKey, C.key),
4203
4177
  row: this.ctx.database.getRowDataItemForRowKey(C.rowKey)
4204
4178
  }));
4205
- if (w = await y(R, l, a, r), w && !w.length)
4179
+ if (w = await m(R, l, a, r), w && !w.length)
4206
4180
  return;
4207
4181
  }
4208
4182
  this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(w, !0);
4209
- let m = [];
4210
- s.forEach((y) => {
4211
- m.push(this.ctx.database.getRowDataItemForRowKey(y));
4212
- }), this.ctx.emit("pasteChange", w, m);
4183
+ let y = [];
4184
+ s.forEach((m) => {
4185
+ y.push(this.ctx.database.getRowDataItemForRowKey(m));
4186
+ }), this.ctx.emit("pasteChange", w, y);
4213
4187
  }).catch((o) => {
4214
4188
  console.error("Failed to get the clipboard content:", o);
4215
4189
  });
@@ -4303,14 +4277,14 @@ class ye {
4303
4277
  if (!i)
4304
4278
  return;
4305
4279
  p && this.ctx.onlyMergeCell && i.updateSpanInfo();
4306
- const { drawX: g, drawY: w, width: E, height: m, fixed: y } = i, R = o - g + 1, C = i.drawX + E - (e - s) + 1;
4307
- let I = r.height - w, _ = m;
4280
+ const { drawX: g, drawY: w, width: E, height: y, fixed: m } = i, R = o - g + 1, C = i.drawX + E - (e - s) + 1;
4281
+ let v = r.height - w, _ = y;
4308
4282
  _ > a.visibleHeight && (_ = a.visibleHeight);
4309
4283
  let S = 0;
4310
- x && (u === "top" ? I = r.height + l.height - w : S = l.visibleHeight);
4311
- const v = w + _ - (t - S - f);
4284
+ x && (u === "top" ? v = r.height + l.height - w : S = l.visibleHeight);
4285
+ const I = w + _ - (t - S - f);
4312
4286
  let b = h, O = d;
4313
- C > 0 && !y ? b = Math.floor(h + C) : R > 0 && !y && (b = Math.floor(h - R)), I > 0 ? O = Math.floor(d - I) : v > 0 && (O = Math.floor(d + v)), (Math.abs(h - b) > 2 || Math.abs(d - O) > 2) && (this.ctx.adjustPositioning = !0, this.ctx.setScroll(b, O), this.ctx.emit("adjustBoundaryPosition", i));
4287
+ C > 0 && !m ? b = Math.floor(h + C) : R > 0 && !m && (b = Math.floor(h - R)), v > 0 ? O = Math.floor(d - v) : I > 0 && (O = Math.floor(d + I)), (Math.abs(h - b) > 2 || Math.abs(d - O) > 2) && (this.ctx.adjustPositioning = !0, this.ctx.setScroll(b, O), this.ctx.emit("adjustBoundaryPosition", i));
4314
4288
  }
4315
4289
  destroy() {
4316
4290
  this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
@@ -4375,13 +4349,13 @@ class Ce {
4375
4349
  SELECTOR_AREA_MAX_X_OFFSET: x,
4376
4350
  SELECTOR_AREA_MAX_Y_OFFSET: u
4377
4351
  } = this.ctx.config, p = a, g = h || this.ctx.maxColIndex - x, w = d, E = f || this.ctx.maxRowIndex - u;
4378
- let [m, y] = r, [R, C] = l;
4379
- if (m < p || R < w)
4352
+ let [y, m] = r, [R, C] = l;
4353
+ if (y < p || R < w)
4380
4354
  return;
4381
- r = [Math.max(p, m), Math.min(g, y)], l = [Math.max(w, R), Math.min(E, C)];
4382
- const { BEFORE_SET_AUTOFILL_METHOD: I } = this.ctx.config;
4383
- if (typeof I == "function") {
4384
- const S = I({
4355
+ r = [Math.max(p, y), Math.min(g, m)], l = [Math.max(w, R), Math.min(E, C)];
4356
+ const { BEFORE_SET_AUTOFILL_METHOD: v } = this.ctx.config;
4357
+ if (typeof v == "function") {
4358
+ const S = v({
4385
4359
  focusCell: this.ctx.focusCell,
4386
4360
  xArr: r,
4387
4361
  yArr: l
@@ -4415,9 +4389,9 @@ class Ce {
4415
4389
  let d = [];
4416
4390
  for (let u = 0; u <= a[1] - a[0]; u++)
4417
4391
  for (let p = 0; p <= l[1] - l[0]; p++) {
4418
- const g = p + l[0], w = u + a[0], E = s[u % r][p % o], m = this.ctx.database.getItemValueForRowIndexAndColIndex(w, g), y = `${w}-${g}`;
4419
- if (m && !i.has(y)) {
4420
- const { rowKey: R, key: C } = m;
4392
+ const g = p + l[0], w = u + a[0], E = s[u % r][p % o], y = this.ctx.database.getItemValueForRowIndexAndColIndex(w, g), m = `${w}-${g}`;
4393
+ if (y && !i.has(m)) {
4394
+ const { rowKey: R, key: C } = y;
4421
4395
  this.ctx.database.getReadonly(R, C) || (t.add(R), d.push({
4422
4396
  rowKey: R,
4423
4397
  key: C,
@@ -4459,7 +4433,7 @@ class Ce {
4459
4433
  destroy() {
4460
4434
  }
4461
4435
  }
4462
- const Z = Math.min, z = Math.max, it = Math.round, V = (c) => ({
4436
+ const Z = Math.min, z = Math.max, it = Math.round, W = (c) => ({
4463
4437
  x: c,
4464
4438
  y: c
4465
4439
  }), be = {
@@ -4483,7 +4457,7 @@ function P(c) {
4483
4457
  function Q(c) {
4484
4458
  return c.split("-")[1];
4485
4459
  }
4486
- function kt(c) {
4460
+ function Bt(c) {
4487
4461
  return c === "x" ? "y" : "x";
4488
4462
  }
4489
4463
  function gt(c) {
@@ -4493,15 +4467,15 @@ function G(c) {
4493
4467
  return ["top", "bottom"].includes(P(c)) ? "y" : "x";
4494
4468
  }
4495
4469
  function wt(c) {
4496
- return kt(G(c));
4470
+ return Bt(G(c));
4497
4471
  }
4498
- function ve(c, t, e) {
4472
+ function Ie(c, t, e) {
4499
4473
  e === void 0 && (e = !1);
4500
4474
  const i = Q(c), s = wt(c), o = gt(s);
4501
4475
  let r = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
4502
4476
  return t.reference[o] > t.floating[o] && (r = st(r)), [r, st(r)];
4503
4477
  }
4504
- function Ie(c) {
4478
+ function ve(c) {
4505
4479
  const t = st(c);
4506
4480
  return [ct(c), t, ct(t)];
4507
4481
  }
@@ -4564,7 +4538,7 @@ function ot(c) {
4564
4538
  y: e
4565
4539
  };
4566
4540
  }
4567
- function vt(c, t, e) {
4541
+ function It(c, t, e) {
4568
4542
  let {
4569
4543
  reference: i,
4570
4544
  floating: s
@@ -4626,14 +4600,14 @@ const Le = async (c, t, e) => {
4626
4600
  }), {
4627
4601
  x: d,
4628
4602
  y: f
4629
- } = vt(h, i, a), x = i, u = {}, p = 0;
4603
+ } = It(h, i, a), x = i, u = {}, p = 0;
4630
4604
  for (let g = 0; g < l.length; g++) {
4631
4605
  const {
4632
4606
  name: w,
4633
4607
  fn: E
4634
4608
  } = l[g], {
4635
- x: m,
4636
- y,
4609
+ x: y,
4610
+ y: m,
4637
4611
  data: R,
4638
4612
  reset: C
4639
4613
  } = await E({
@@ -4650,7 +4624,7 @@ const Le = async (c, t, e) => {
4650
4624
  floating: t
4651
4625
  }
4652
4626
  });
4653
- d = m ?? d, f = y ?? f, u = {
4627
+ d = y ?? d, f = m ?? f, u = {
4654
4628
  ...u,
4655
4629
  [w]: {
4656
4630
  ...u[w],
@@ -4663,7 +4637,7 @@ const Le = async (c, t, e) => {
4663
4637
  }) : C.rects), {
4664
4638
  x: d,
4665
4639
  y: f
4666
- } = vt(h, x, a)), g = -1);
4640
+ } = It(h, x, a)), g = -1);
4667
4641
  }
4668
4642
  return {
4669
4643
  x: d,
@@ -4694,12 +4668,12 @@ async function Nt(c, t) {
4694
4668
  boundary: h,
4695
4669
  rootBoundary: d,
4696
4670
  strategy: a
4697
- })), m = f === "floating" ? {
4671
+ })), y = f === "floating" ? {
4698
4672
  x: i,
4699
4673
  y: s,
4700
4674
  width: r.floating.width,
4701
4675
  height: r.floating.height
4702
- } : r.reference, y = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(l.floating)), R = await (o.isElement == null ? void 0 : o.isElement(y)) ? await (o.getScale == null ? void 0 : o.getScale(y)) || {
4676
+ } : r.reference, m = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(l.floating)), R = await (o.isElement == null ? void 0 : o.isElement(m)) ? await (o.getScale == null ? void 0 : o.getScale(m)) || {
4703
4677
  x: 1,
4704
4678
  y: 1
4705
4679
  } : {
@@ -4707,10 +4681,10 @@ async function Nt(c, t) {
4707
4681
  y: 1
4708
4682
  }, C = ot(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
4709
4683
  elements: l,
4710
- rect: m,
4711
- offsetParent: y,
4684
+ rect: y,
4685
+ offsetParent: m,
4712
4686
  strategy: a
4713
- }) : m);
4687
+ }) : y);
4714
4688
  return {
4715
4689
  top: (E.top - C.top + p.top) / R.y,
4716
4690
  bottom: (C.bottom - E.bottom + p.bottom) / R.y,
@@ -4739,17 +4713,17 @@ const Te = (c) => ({
4739
4713
  const f = Kt(d), x = {
4740
4714
  x: e,
4741
4715
  y: i
4742
- }, u = wt(s), p = gt(u), g = await r.getDimensions(h), w = u === "y", E = w ? "top" : "left", m = w ? "bottom" : "right", y = w ? "clientHeight" : "clientWidth", R = o.reference[p] + o.reference[u] - x[u] - o.floating[p], C = x[u] - o.reference[u], I = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(h));
4743
- let _ = I ? I[y] : 0;
4744
- (!_ || !await (r.isElement == null ? void 0 : r.isElement(I))) && (_ = l.floating[y] || o.floating[p]);
4745
- const S = R / 2 - C / 2, v = _ / 2 - g[p] / 2 - 1, b = Z(f[E], v), O = Z(f[m], v), L = b, M = _ - g[p] - O, T = _ / 2 - g[p] / 2 + S, X = ht(L, T, M), K = !a.arrow && Q(s) != null && T !== X && o.reference[p] / 2 - (T < L ? b : O) - g[p] / 2 < 0, B = K ? T < L ? T - L : T - M : 0;
4716
+ }, u = wt(s), p = gt(u), g = await r.getDimensions(h), w = u === "y", E = w ? "top" : "left", y = w ? "bottom" : "right", m = w ? "clientHeight" : "clientWidth", R = o.reference[p] + o.reference[u] - x[u] - o.floating[p], C = x[u] - o.reference[u], v = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(h));
4717
+ let _ = v ? v[m] : 0;
4718
+ (!_ || !await (r.isElement == null ? void 0 : r.isElement(v))) && (_ = l.floating[m] || o.floating[p]);
4719
+ const S = R / 2 - C / 2, I = _ / 2 - g[p] / 2 - 1, b = Z(f[E], I), O = Z(f[y], I), L = b, M = _ - g[p] - O, T = _ / 2 - g[p] / 2 + S, k = ht(L, T, M), K = !a.arrow && Q(s) != null && T !== k && o.reference[p] / 2 - (T < L ? b : O) - g[p] / 2 < 0, X = K ? T < L ? T - L : T - M : 0;
4746
4720
  return {
4747
- [u]: x[u] + B,
4721
+ [u]: x[u] + X,
4748
4722
  data: {
4749
- [u]: X,
4750
- centerOffset: T - X - B,
4723
+ [u]: k,
4724
+ centerOffset: T - k - X,
4751
4725
  ...K && {
4752
- alignmentOffset: B
4726
+ alignmentOffset: X
4753
4727
  }
4754
4728
  },
4755
4729
  reset: K
@@ -4779,45 +4753,45 @@ const Te = (c) => ({
4779
4753
  } = J(c, t);
4780
4754
  if ((e = o.arrow) != null && e.alignmentOffset)
4781
4755
  return {};
4782
- const E = P(s), m = G(l), y = P(l) === l, R = await (a.isRTL == null ? void 0 : a.isRTL(h.floating)), C = x || (y || !g ? [st(l)] : Ie(l)), I = p !== "none";
4783
- !x && I && C.push(...Oe(l, g, p, R));
4784
- const _ = [l, ...C], S = await Nt(t, w), v = [];
4756
+ const E = P(s), y = G(l), m = P(l) === l, R = await (a.isRTL == null ? void 0 : a.isRTL(h.floating)), C = x || (m || !g ? [st(l)] : ve(l)), v = p !== "none";
4757
+ !x && v && C.push(...Oe(l, g, p, R));
4758
+ const _ = [l, ...C], S = await Nt(t, w), I = [];
4785
4759
  let b = ((i = o.flip) == null ? void 0 : i.overflows) || [];
4786
- if (d && v.push(S[E]), f) {
4787
- const T = ve(s, r, R);
4788
- v.push(S[T[0]], S[T[1]]);
4760
+ if (d && I.push(S[E]), f) {
4761
+ const T = Ie(s, r, R);
4762
+ I.push(S[T[0]], S[T[1]]);
4789
4763
  }
4790
4764
  if (b = [...b, {
4791
4765
  placement: s,
4792
- overflows: v
4793
- }], !v.every((T) => T <= 0)) {
4766
+ overflows: I
4767
+ }], !I.every((T) => T <= 0)) {
4794
4768
  var O, L;
4795
- const T = (((O = o.flip) == null ? void 0 : O.index) || 0) + 1, X = _[T];
4796
- if (X)
4769
+ const T = (((O = o.flip) == null ? void 0 : O.index) || 0) + 1, k = _[T];
4770
+ if (k)
4797
4771
  return {
4798
4772
  data: {
4799
4773
  index: T,
4800
4774
  overflows: b
4801
4775
  },
4802
4776
  reset: {
4803
- placement: X
4777
+ placement: k
4804
4778
  }
4805
4779
  };
4806
- let K = (L = b.filter((B) => B.overflows[0] <= 0).sort((B, Y) => B.overflows[1] - Y.overflows[1])[0]) == null ? void 0 : L.placement;
4780
+ let K = (L = b.filter((X) => X.overflows[0] <= 0).sort((X, Y) => X.overflows[1] - Y.overflows[1])[0]) == null ? void 0 : L.placement;
4807
4781
  if (!K)
4808
4782
  switch (u) {
4809
4783
  case "bestFit": {
4810
4784
  var M;
4811
- const B = (M = b.filter((Y) => {
4812
- if (I) {
4785
+ const X = (M = b.filter((Y) => {
4786
+ if (v) {
4813
4787
  const F = G(Y.placement);
4814
- return F === m || // Create a bias to the `y` side axis due to horizontal
4788
+ return F === y || // Create a bias to the `y` side axis due to horizontal
4815
4789
  // reading directions favoring greater width.
4816
4790
  F === "y";
4817
4791
  }
4818
4792
  return !0;
4819
4793
  }).map((Y) => [Y.placement, Y.overflows.filter((F) => F > 0).reduce((F, qt) => F + qt, 0)]).sort((Y, F) => Y[1] - F[1])[0]) == null ? void 0 : M[0];
4820
- B && (K = B);
4794
+ X && (K = X);
4821
4795
  break;
4822
4796
  }
4823
4797
  case "initialPlacement":
@@ -4900,11 +4874,11 @@ const He = function(c) {
4900
4874
  fn: (w) => {
4901
4875
  let {
4902
4876
  x: E,
4903
- y: m
4877
+ y
4904
4878
  } = w;
4905
4879
  return {
4906
4880
  x: E,
4907
- y: m
4881
+ y
4908
4882
  };
4909
4883
  }
4910
4884
  },
@@ -4912,15 +4886,15 @@ const He = function(c) {
4912
4886
  } = J(c, t), h = {
4913
4887
  x: e,
4914
4888
  y: i
4915
- }, d = await Nt(t, a), f = G(P(s)), x = kt(f);
4889
+ }, d = await Nt(t, a), f = G(P(s)), x = Bt(f);
4916
4890
  let u = h[x], p = h[f];
4917
4891
  if (o) {
4918
- const w = x === "y" ? "top" : "left", E = x === "y" ? "bottom" : "right", m = u + d[w], y = u - d[E];
4919
- u = ht(m, u, y);
4892
+ const w = x === "y" ? "top" : "left", E = x === "y" ? "bottom" : "right", y = u + d[w], m = u - d[E];
4893
+ u = ht(y, u, m);
4920
4894
  }
4921
4895
  if (r) {
4922
- const w = f === "y" ? "top" : "left", E = f === "y" ? "bottom" : "right", m = p + d[w], y = p - d[E];
4923
- p = ht(m, p, y);
4896
+ const w = f === "y" ? "top" : "left", E = f === "y" ? "bottom" : "right", y = p + d[w], m = p - d[E];
4897
+ p = ht(y, p, m);
4924
4898
  }
4925
4899
  const g = l.fn({
4926
4900
  ...t,
@@ -4961,10 +4935,10 @@ function Yt(c) {
4961
4935
  function H(c) {
4962
4936
  return rt() ? c instanceof Element || c instanceof A(c).Element : !1;
4963
4937
  }
4964
- function k(c) {
4938
+ function B(c) {
4965
4939
  return rt() ? c instanceof HTMLElement || c instanceof A(c).HTMLElement : !1;
4966
4940
  }
4967
- function It(c) {
4941
+ function vt(c) {
4968
4942
  return !rt() || typeof ShadowRoot > "u" ? !1 : c instanceof ShadowRoot || c instanceof A(c).ShadowRoot;
4969
4943
  }
4970
4944
  function tt(c) {
@@ -4976,7 +4950,7 @@ function tt(c) {
4976
4950
  } = D(c);
4977
4951
  return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !["inline", "contents"].includes(s);
4978
4952
  }
4979
- function Xe(c) {
4953
+ function ke(c) {
4980
4954
  return ["table", "td", "th"].includes(j(c));
4981
4955
  }
4982
4956
  function nt(c) {
@@ -4992,14 +4966,14 @@ function pt(c) {
4992
4966
  const t = Et(), e = H(c) ? D(c) : c;
4993
4967
  return e.transform !== "none" || e.perspective !== "none" || (e.containerType ? e.containerType !== "normal" : !1) || !t && (e.backdropFilter ? e.backdropFilter !== "none" : !1) || !t && (e.filter ? e.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((i) => (e.willChange || "").includes(i)) || ["paint", "layout", "strict", "content"].some((i) => (e.contain || "").includes(i));
4994
4968
  }
4995
- function Be(c) {
4996
- let t = W(c);
4997
- for (; k(t) && !U(t); ) {
4969
+ function Xe(c) {
4970
+ let t = V(c);
4971
+ for (; B(t) && !U(t); ) {
4998
4972
  if (pt(t))
4999
4973
  return t;
5000
4974
  if (nt(t))
5001
4975
  return null;
5002
- t = W(t);
4976
+ t = V(t);
5003
4977
  }
5004
4978
  return null;
5005
4979
  }
@@ -5021,21 +4995,21 @@ function lt(c) {
5021
4995
  scrollTop: c.scrollY
5022
4996
  };
5023
4997
  }
5024
- function W(c) {
4998
+ function V(c) {
5025
4999
  if (j(c) === "html")
5026
5000
  return c;
5027
5001
  const t = (
5028
5002
  // Step into the shadow DOM of the parent of a slotted node.
5029
5003
  c.assignedSlot || // DOM Element detected.
5030
5004
  c.parentNode || // ShadowRoot detected.
5031
- It(c) && c.host || // Fallback.
5005
+ vt(c) && c.host || // Fallback.
5032
5006
  N(c)
5033
5007
  );
5034
- return It(t) ? t.host : t;
5008
+ return vt(t) ? t.host : t;
5035
5009
  }
5036
5010
  function Ft(c) {
5037
- const t = W(c);
5038
- return U(t) ? c.ownerDocument ? c.ownerDocument.body : c.body : k(t) && tt(t) ? t : Ft(t);
5011
+ const t = V(c);
5012
+ return U(t) ? c.ownerDocument ? c.ownerDocument.body : c.body : B(t) && tt(t) ? t : Ft(t);
5039
5013
  }
5040
5014
  function dt(c, t, e) {
5041
5015
  var i;
@@ -5050,38 +5024,38 @@ function dt(c, t, e) {
5050
5024
  function ft(c) {
5051
5025
  return c.parent && Object.getPrototypeOf(c.parent) ? c.frameElement : null;
5052
5026
  }
5053
- function Vt(c) {
5027
+ function Wt(c) {
5054
5028
  const t = D(c);
5055
5029
  let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
5056
- const s = k(c), o = s ? c.offsetWidth : e, r = s ? c.offsetHeight : i, l = it(e) !== o || it(i) !== r;
5030
+ const s = B(c), o = s ? c.offsetWidth : e, r = s ? c.offsetHeight : i, l = it(e) !== o || it(i) !== r;
5057
5031
  return l && (e = o, i = r), {
5058
5032
  width: e,
5059
5033
  height: i,
5060
5034
  $: l
5061
5035
  };
5062
5036
  }
5063
- function Wt(c) {
5037
+ function Vt(c) {
5064
5038
  return H(c) ? c : c.contextElement;
5065
5039
  }
5066
5040
  function $(c) {
5067
- const t = Wt(c);
5068
- if (!k(t))
5069
- return V(1);
5041
+ const t = Vt(c);
5042
+ if (!B(t))
5043
+ return W(1);
5070
5044
  const e = t.getBoundingClientRect(), {
5071
5045
  width: i,
5072
5046
  height: s,
5073
5047
  $: o
5074
- } = Vt(t);
5048
+ } = Wt(t);
5075
5049
  let r = (o ? it(e.width) : e.width) / i, l = (o ? it(e.height) : e.height) / s;
5076
5050
  return (!r || !Number.isFinite(r)) && (r = 1), (!l || !Number.isFinite(l)) && (l = 1), {
5077
5051
  x: r,
5078
5052
  y: l
5079
5053
  };
5080
5054
  }
5081
- const ke = /* @__PURE__ */ V(0);
5055
+ const Be = /* @__PURE__ */ W(0);
5082
5056
  function Pt(c) {
5083
5057
  const t = A(c);
5084
- return !Et() || !t.visualViewport ? ke : {
5058
+ return !Et() || !t.visualViewport ? Be : {
5085
5059
  x: t.visualViewport.offsetLeft,
5086
5060
  y: t.visualViewport.offsetTop
5087
5061
  };
@@ -5091,17 +5065,17 @@ function Ke(c, t, e) {
5091
5065
  }
5092
5066
  function q(c, t, e, i) {
5093
5067
  t === void 0 && (t = !1), e === void 0 && (e = !1);
5094
- const s = c.getBoundingClientRect(), o = Wt(c);
5095
- let r = V(1);
5068
+ const s = c.getBoundingClientRect(), o = Vt(c);
5069
+ let r = W(1);
5096
5070
  t && (i ? H(i) && (r = $(i)) : r = $(c));
5097
- const l = Ke(o, e, i) ? Pt(o) : V(0);
5071
+ const l = Ke(o, e, i) ? Pt(o) : W(0);
5098
5072
  let a = (s.left + l.x) / r.x, h = (s.top + l.y) / r.y, d = s.width / r.x, f = s.height / r.y;
5099
5073
  if (o) {
5100
5074
  const x = A(o), u = i && H(i) ? A(i) : i;
5101
5075
  let p = x, g = ft(p);
5102
5076
  for (; g && i && u !== p; ) {
5103
- const w = $(g), E = g.getBoundingClientRect(), m = D(g), y = E.left + (g.clientLeft + parseFloat(m.paddingLeft)) * w.x, R = E.top + (g.clientTop + parseFloat(m.paddingTop)) * w.y;
5104
- a *= w.x, h *= w.y, d *= w.x, f *= w.y, a += y, h += R, p = A(g), g = ft(p);
5077
+ const w = $(g), E = g.getBoundingClientRect(), y = D(g), m = E.left + (g.clientLeft + parseFloat(y.paddingLeft)) * w.x, R = E.top + (g.clientTop + parseFloat(y.paddingTop)) * w.y;
5078
+ a *= w.x, h *= w.y, d *= w.x, f *= w.y, a += m, h += R, p = A(g), g = ft(p);
5105
5079
  }
5106
5080
  }
5107
5081
  return ot({
@@ -5124,9 +5098,9 @@ function Ne(c) {
5124
5098
  let a = {
5125
5099
  scrollLeft: 0,
5126
5100
  scrollTop: 0
5127
- }, h = V(1);
5128
- const d = V(0), f = k(i);
5129
- if ((f || !f && !o) && ((j(i) !== "body" || tt(r)) && (a = lt(i)), k(i))) {
5101
+ }, h = W(1);
5102
+ const d = W(0), f = B(i);
5103
+ if ((f || !f && !o) && ((j(i) !== "body" || tt(r)) && (a = lt(i)), B(i))) {
5130
5104
  const x = q(i);
5131
5105
  h = $(i), d.x = x.x + i.clientLeft, d.y = x.y + i.clientTop;
5132
5106
  }
@@ -5155,7 +5129,7 @@ function Fe(c) {
5155
5129
  y: l
5156
5130
  };
5157
5131
  }
5158
- function Ve(c, t) {
5132
+ function We(c, t) {
5159
5133
  const e = A(c), i = N(c), s = e.visualViewport;
5160
5134
  let o = i.clientWidth, r = i.clientHeight, l = 0, a = 0;
5161
5135
  if (s) {
@@ -5170,8 +5144,8 @@ function Ve(c, t) {
5170
5144
  y: a
5171
5145
  };
5172
5146
  }
5173
- function We(c, t) {
5174
- const e = q(c, !0, t === "fixed"), i = e.top + c.clientTop, s = e.left + c.clientLeft, o = k(c) ? $(c) : V(1), r = c.clientWidth * o.x, l = c.clientHeight * o.y, a = s * o.x, h = i * o.y;
5147
+ function Ve(c, t) {
5148
+ const e = q(c, !0, t === "fixed"), i = e.top + c.clientTop, s = e.left + c.clientLeft, o = B(c) ? $(c) : W(1), r = c.clientWidth * o.x, l = c.clientHeight * o.y, a = s * o.x, h = i * o.y;
5175
5149
  return {
5176
5150
  width: r,
5177
5151
  height: l,
@@ -5182,11 +5156,11 @@ function We(c, t) {
5182
5156
  function _t(c, t, e) {
5183
5157
  let i;
5184
5158
  if (t === "viewport")
5185
- i = Ve(c, e);
5159
+ i = We(c, e);
5186
5160
  else if (t === "document")
5187
5161
  i = Fe(N(c));
5188
5162
  else if (H(t))
5189
- i = We(t, e);
5163
+ i = Ve(t, e);
5190
5164
  else {
5191
5165
  const s = Pt(c);
5192
5166
  i = {
@@ -5198,7 +5172,7 @@ function _t(c, t, e) {
5198
5172
  return ot(i);
5199
5173
  }
5200
5174
  function zt(c, t) {
5201
- const e = W(c);
5175
+ const e = V(c);
5202
5176
  return e === t || !H(e) || U(e) ? !1 : D(e).position === "fixed" || zt(e, t);
5203
5177
  }
5204
5178
  function Pe(c, t) {
@@ -5207,10 +5181,10 @@ function Pe(c, t) {
5207
5181
  return e;
5208
5182
  let i = dt(c, [], !1).filter((l) => H(l) && j(l) !== "body"), s = null;
5209
5183
  const o = D(c).position === "fixed";
5210
- let r = o ? W(c) : c;
5184
+ let r = o ? V(c) : c;
5211
5185
  for (; H(r) && !U(r); ) {
5212
5186
  const l = D(r), a = pt(r);
5213
- !a && l.position === "fixed" && (s = null), (o ? !a && !s : !a && l.position === "static" && !!s && ["absolute", "fixed"].includes(s.position) || tt(r) && !a && zt(c, r)) ? i = i.filter((d) => d !== r) : s = l, r = W(r);
5187
+ !a && l.position === "fixed" && (s = null), (o ? !a && !s : !a && l.position === "static" && !!s && ["absolute", "fixed"].includes(s.position) || tt(r) && !a && zt(c, r)) ? i = i.filter((d) => d !== r) : s = l, r = V(r);
5214
5188
  }
5215
5189
  return t.set(c, i), i;
5216
5190
  }
@@ -5236,19 +5210,19 @@ function $e(c) {
5236
5210
  const {
5237
5211
  width: t,
5238
5212
  height: e
5239
- } = Vt(c);
5213
+ } = Wt(c);
5240
5214
  return {
5241
5215
  width: t,
5242
5216
  height: e
5243
5217
  };
5244
5218
  }
5245
5219
  function Ge(c, t, e) {
5246
- const i = k(t), s = N(t), o = e === "fixed", r = q(c, !0, o, t);
5220
+ const i = B(t), s = N(t), o = e === "fixed", r = q(c, !0, o, t);
5247
5221
  let l = {
5248
5222
  scrollLeft: 0,
5249
5223
  scrollTop: 0
5250
5224
  };
5251
- const a = V(0);
5225
+ const a = W(0);
5252
5226
  if (i || !i && !o)
5253
5227
  if ((j(t) !== "body" || tt(s)) && (l = lt(t)), i) {
5254
5228
  const u = q(t, !0, o, t);
@@ -5272,7 +5246,7 @@ function at(c) {
5272
5246
  return D(c).position === "static";
5273
5247
  }
5274
5248
  function Ot(c, t) {
5275
- if (!k(c) || D(c).position === "fixed")
5249
+ if (!B(c) || D(c).position === "fixed")
5276
5250
  return null;
5277
5251
  if (t)
5278
5252
  return t(c);
@@ -5283,19 +5257,19 @@ function $t(c, t) {
5283
5257
  const e = A(c);
5284
5258
  if (nt(c))
5285
5259
  return e;
5286
- if (!k(c)) {
5287
- let s = W(c);
5260
+ if (!B(c)) {
5261
+ let s = V(c);
5288
5262
  for (; s && !U(s); ) {
5289
5263
  if (H(s) && !at(s))
5290
5264
  return s;
5291
- s = W(s);
5265
+ s = V(s);
5292
5266
  }
5293
5267
  return e;
5294
5268
  }
5295
5269
  let i = Ot(c, t);
5296
- for (; i && Xe(i) && at(i); )
5270
+ for (; i && ke(i) && at(i); )
5297
5271
  i = Ot(i, t);
5298
- return i && U(i) && at(i) && !pt(i) ? e : i || Be(c) || e;
5272
+ return i && U(i) && at(i) && !pt(i) ? e : i || Xe(c) || e;
5299
5273
  }
5300
5274
  const Ue = async function(c) {
5301
5275
  const t = this.getOffsetParent || $t, e = this.getDimensions, i = await e(c.floating);
@@ -6040,14 +6014,14 @@ class ri {
6040
6014
  editCell(t, e) {
6041
6015
  this.editor.editCell(t, e);
6042
6016
  }
6043
- setItemValue(t, e, i, s = !0, o = !0, r = !1, l = !0) {
6044
- this.ctx.database.setItemValue(t, e, i, s, o, r, l);
6017
+ setItemValue(t, e, i, s = !0, o = !0, r = !1) {
6018
+ this.ctx.database.setItemValue(t, e, i, s, o, r);
6045
6019
  }
6046
- batchSetItemValue(t, e = !0, i = !0) {
6047
- this.ctx.database.batchSetItemValue(t, e, i);
6020
+ batchSetItemValue(t, e = !0) {
6021
+ this.ctx.database.batchSetItemValue(t, e);
6048
6022
  }
6049
- setItemValueByEditor(t, e, i, s = !0, o = !0, r = !0) {
6050
- this.ctx.setItemValueByEditor(t, e, i, s, o, r), this.editor.doneEdit();
6023
+ setItemValueByEditor(t, e, i, s = !0, o = !0) {
6024
+ this.ctx.setItemValueByEditor(t, e, i, s, o), this.editor.doneEdit();
6051
6025
  }
6052
6026
  clearEditableData(t = null) {
6053
6027
  const e = [0, this.ctx.maxColIndex], i = [0, this.ctx.maxRowIndex];