e-virt-table 1.2.18 → 1.2.19

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
@@ -433,17 +433,17 @@ class ut extends Dt {
433
433
  if (this.type === "tree" && s === "body") {
434
434
  const a = this.ctx.database.getRowForRowKey(i), { expand: h = !1, hasChildren: d = !1, expandLoading: f = !1, level: x = 0 } = a || {};
435
435
  if (this.rowExpand = h, this.rowHasChildren = d, f) {
436
- const w = this.ctx.icons.get("loading");
437
- l = "loading", o = w, r = x * 8;
436
+ const g = this.ctx.icons.get("loading");
437
+ l = "loading", o = g, r = x * 8;
438
438
  } else if (d) {
439
- const w = this.ctx.icons.get("expand"), g = this.ctx.icons.get("shrink");
440
- o = h ? g : w, l = h ? "shrink" : "expand", r = x * 8;
439
+ const g = this.ctx.icons.get("expand"), w = this.ctx.icons.get("shrink");
440
+ o = h ? w : g, l = h ? "shrink" : "expand", r = x * 8;
441
441
  } else
442
442
  r = x * 8;
443
443
  let u = 20, p = 20;
444
444
  if (o) {
445
- let w = this.drawX + r + e, g = this.drawY + (this.visibleHeight - p) / 2;
446
- this.ctx.paint.drawImage(o, w, g, u, p), this.drawImageX = w, this.drawImageY = g, this.drawImageWidth = u, this.drawImageHeight = p, this.drawImageName = l, this.drawImageSource = o;
445
+ let g = this.drawX + r + e, w = this.drawY + (this.visibleHeight - p) / 2;
446
+ this.ctx.paint.drawImage(o, g, w, u, p), this.drawImageX = g, this.drawImageY = w, this.drawImageWidth = u, this.drawImageHeight = p, this.drawImageName = l, this.drawImageSource = o;
447
447
  }
448
448
  this.align = "left", this.drawTextX = r + this.drawX + u - 0.5;
449
449
  }
@@ -463,7 +463,7 @@ class ut extends Dt {
463
463
  HIGHLIGHT_HOVER_ROW: x,
464
464
  HIGHLIGHT_HOVER_ROW_COLOR: u,
465
465
  STRIPE: p,
466
- STRIPE_COLOR: w
466
+ STRIPE_COLOR: g
467
467
  } = this.ctx.config;
468
468
  if (this.cellType === "footer") {
469
469
  let _ = h, S = a;
@@ -480,16 +480,16 @@ class ut extends Dt {
480
480
  this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = _, this.drawTextColor = S;
481
481
  return;
482
482
  }
483
- let g = "transparent";
484
- const E = this.ctx.hoverCell, C = this.ctx.currentCell;
485
- let m = this.rowIndex, R = this.rowIndex;
483
+ let w = "transparent";
484
+ const E = this.ctx.hoverCell, m = this.ctx.currentCell;
485
+ let y = this.rowIndex, R = this.rowIndex;
486
486
  if (this.rowspan !== 1 && (x || d)) {
487
487
  const _ = this.getSpanInfo(), { yArr: S } = _;
488
- m = S[0], R = S[1];
488
+ y = S[0], R = S[1];
489
489
  }
490
- x && E && (E.rowKey === this.rowKey && (g = u), E.rowIndex >= m && E.rowIndex <= R && (g = u)), d && C && (C.rowKey === this.rowKey && (g = f), C.rowIndex >= m && C.rowIndex <= R && (g = f)), this.drawCellSkyBgColor = g;
491
- let y = e, I = l;
492
- if (this.ctx.database.getReadonly(this.rowKey, this.key) || (y = i, I = r), p && (this.rowIndex % 2 ? y = w : y = e), typeof s == "function") {
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
493
  const _ = s, { backgroundColor: S, color: v } = _({
494
494
  row: this.row,
495
495
  rowIndex: this.rowIndex,
@@ -498,16 +498,16 @@ class ut extends Dt {
498
498
  isHasChanged: this.isHasChanged,
499
499
  value: this.getValue()
500
500
  }) || {};
501
- S && (y = S), v && (I = v);
501
+ S && (C = S), v && (I = v);
502
502
  }
503
- this.drawCellBgColor = y, this.drawTextColor = I;
503
+ this.drawCellBgColor = C, this.drawTextColor = I;
504
504
  }
505
505
  updateSelection() {
506
506
  const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: l, rowIndex: a, rowKey: h } = this;
507
507
  if (!(s === 0 || o === 0) && r !== "footer" && ["index-selection", "selection"].includes(l)) {
508
508
  const d = this.ctx.database.getRowSelection(h), f = this.ctx.database.getRowSelectable(h), { CHECKBOX_SIZE: x = 0 } = this.ctx.config, u = this.drawX + (e - x) / 2, p = this.drawY + (i - x) / 2;
509
- let w = this.ctx.icons.get("checkbox-uncheck"), g = "checkbox-uncheck";
510
- d && f ? (w = this.ctx.icons.get("checkbox-check"), g = "checkbox-check") : d && f ? (w = this.ctx.icons.get("checkbox-check-disabled"), g = "checkbox-check-disabled") : !d && f ? (w = this.ctx.icons.get("checkbox-uncheck"), g = "checkbox-uncheck") : (w = this.ctx.icons.get("checkbox-disabled"), g = "checkbox-disabled"), w && l == "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === a || ["checkbox-disabled", "checkbox-check"].includes(g)) && (this.drawImageX = u, this.drawImageY = p, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = g, this.drawImageSource = w) : w && l === "selection" && (this.drawImageX = u, this.drawImageY = p, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = g, this.drawImageSource = w);
509
+ let g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck";
510
+ d && f ? (g = this.ctx.icons.get("checkbox-check"), w = "checkbox-check") : d && f ? (g = this.ctx.icons.get("checkbox-check-disabled"), w = "checkbox-check-disabled") : !d && f ? (g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), w = "checkbox-disabled"), g && l == "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === a || ["checkbox-disabled", "checkbox-check"].includes(w)) && (this.drawImageX = u, this.drawImageY = p, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = w, this.drawImageSource = g) : g && l === "selection" && (this.drawImageX = u, this.drawImageY = p, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = w, this.drawImageSource = g);
511
511
  }
512
512
  }
513
513
  updateHoverIcon() {
@@ -530,8 +530,8 @@ class ut extends Dt {
530
530
  if (l.rowKey === this.rowKey && (a = this.drawX + this.width - s - o, h = this.drawY + (this.height - s) / 2), this.rowspan !== 1 && r) {
531
531
  const f = this.getSpanInfo(), { yArr: x } = f, u = x[0], p = x[1];
532
532
  if (l.rowIndex >= u && l.rowIndex <= p) {
533
- const { width: w, height: g, offsetTop: E, offsetLeft: C } = f;
534
- a = this.drawX - C + w - s - o, h = this.drawY - E + (g - s) / 2;
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
535
  }
536
536
  }
537
537
  const d = this.ctx.icons.get(this.hoverIconName);
@@ -632,8 +632,8 @@ class ut extends Dt {
632
632
  return;
633
633
  const { xArr: r, yArr: l } = this.ctx.selector, a = r[1], h = l[1], { colIndex: d, rowIndex: f, drawX: x, drawY: u } = this;
634
634
  if (d === a && f === h) {
635
- const w = d === this.ctx.maxColIndex || f === this.ctx.maxRowIndex || d === this.ctx.lastCenterColIndex ? 6 : 4;
636
- this.ctx.paint.drawRect(x + this.width - w, u + this.height - w, 6, 6, {
635
+ const g = d === this.ctx.maxColIndex || f === this.ctx.maxRowIndex || d === this.ctx.lastCenterColIndex ? 6 : 4;
636
+ this.ctx.paint.drawRect(x + this.width - g, u + this.height - g, 6, 6, {
637
637
  borderColor: o,
638
638
  fillColor: e
639
639
  });
@@ -760,45 +760,45 @@ class ut extends Dt {
760
760
  drawBorder(e) {
761
761
  const { drawX: i, drawY: s, rowIndex: o, colIndex: r, height: l, width: a } = this;
762
762
  let h = i, d = s;
763
- const { xArr: f, yArr: x, lineDash: u = [], borderWidth: p = 1, borderColor: w, fillColor: g } = e, E = f[0], C = f[1], m = x[0], R = x[1];
764
- if (r >= E && r <= C && o === m) {
765
- const y = r === C ? 1 : 0, I = r === E ? 1 : 0;
766
- this.ctx.paint.drawLine([h + I, d + 1, h + a - y, d + 1], {
767
- borderColor: w,
768
- fillColor: g,
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], {
767
+ borderColor: g,
768
+ fillColor: w,
769
769
  borderWidth: p,
770
770
  lineCap: "round",
771
771
  lineJoin: "round",
772
772
  lineDash: u
773
773
  });
774
774
  }
775
- if (r === C && o >= m && o <= R) {
776
- const y = o === m ? 1 : 0, I = o === R ? 1 : 0;
777
- this.ctx.paint.drawLine([h + a - 1, d + y, h + a - 1, d + l - I], {
778
- borderColor: w,
779
- fillColor: g,
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], {
778
+ borderColor: g,
779
+ fillColor: w,
780
780
  borderWidth: p,
781
781
  lineCap: "round",
782
782
  lineJoin: "round",
783
783
  lineDash: u
784
784
  });
785
785
  }
786
- if (r >= E && r <= C && o === R) {
787
- const y = r === C ? 1 : 0, I = r === E ? 1 : 0;
788
- this.ctx.paint.drawLine([h + I, d + l - 1, h + a - y, d + l - 1], {
789
- borderColor: w,
790
- fillColor: g,
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], {
789
+ borderColor: g,
790
+ fillColor: w,
791
791
  borderWidth: p,
792
792
  lineCap: "round",
793
793
  lineJoin: "round",
794
794
  lineDash: u
795
795
  });
796
796
  }
797
- if (r === E && o >= m && o <= R) {
798
- const y = o === R ? 1 : 0, I = o === m ? 1 : 0;
799
- this.ctx.paint.drawLine([h + 1, d + I, h + 1, d + l - y], {
800
- borderColor: w,
801
- fillColor: g,
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], {
800
+ borderColor: g,
801
+ fillColor: w,
802
802
  borderWidth: p,
803
803
  lineCap: "round",
804
804
  lineJoin: "round",
@@ -869,30 +869,30 @@ class ae {
869
869
  const { ROW_KEY: r = "", DEFAULT_EXPAND_ALL: l, CELL_HEIGHT: a, SELECTABLE_METHOD: h, CHECKBOX_KEY: d } = this.ctx.config, f = s[r], x = f != null ? `${f}` : St();
870
870
  this.itemRowKeyMap.set(s, x);
871
871
  const u = s._height || a, p = s._readonly;
872
- let w = !0;
873
- if (typeof h == "function" && (w = h), d) {
874
- const C = s[d];
875
- if (this.checkboxKeyMap.has(C)) {
876
- const m = this.checkboxKeyMap.get(C) || [];
877
- m.push(x), this.checkboxKeyMap.set(C, m);
872
+ let g = !0;
873
+ 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);
878
878
  } else
879
- this.checkboxKeyMap.set(C, [x]);
879
+ this.checkboxKeyMap.set(m, [x]);
880
880
  }
881
881
  this.selectionMap.set(x, {
882
882
  key: d ? s[d] : x,
883
883
  row: s,
884
884
  check: ((E = this.selectionMap.get(x)) == null ? void 0 : E.check) || !1
885
885
  });
886
- const g = l || this.expandMap.get(x) || s._expand || !1;
887
- this.expandMap.set(x, g), this.rowKeyMap.set(x, {
886
+ const w = l || this.expandMap.get(x) || s._expand || !1;
887
+ this.expandMap.set(x, w), this.rowKeyMap.set(x, {
888
888
  readonly: p,
889
889
  index: o,
890
890
  rowIndex: o,
891
891
  level: e,
892
892
  height: u,
893
893
  check: !1,
894
- selectable: w,
895
- expand: g,
894
+ selectable: g,
895
+ expand: w,
896
896
  expandLazy: !1,
897
897
  hasChildren: s._hasChildren || (Array.isArray(s.children) ? s.children.length > 0 : !1),
898
898
  expandLoading: !1,
@@ -1100,54 +1100,56 @@ class ae {
1100
1100
  * @param history
1101
1101
  * @returns
1102
1102
  */
1103
- async batchSetItemValue(t, e = !1) {
1104
- let i = [];
1105
- const s = /* @__PURE__ */ new Set();
1106
- let o = [], r = t.map((d) => {
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
1107
  const { rowKey: f, key: x } = d;
1108
1108
  let u = d.value, p = u;
1109
- const w = this.getRowDataItemForRowKey(f), g = 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 = g, o.push({
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
1111
  ...d,
1112
1112
  value: p,
1113
- oldValue: g,
1114
- row: w
1113
+ oldValue: w,
1114
+ row: g
1115
1115
  }))), {
1116
1116
  ...d,
1117
1117
  value: p,
1118
- oldValue: g,
1119
- row: w
1118
+ oldValue: w,
1119
+ row: g
1120
1120
  };
1121
1121
  });
1122
- if (r = r.filter((d) => !o.some((f) => d.rowKey === f.rowKey && d.key === f.key)), o.length) {
1122
+ if (l = l.filter((d) => !r.some((f) => d.rowKey === f.rowKey && d.key === f.key)), r.length) {
1123
1123
  const d = {
1124
1124
  code: "ERR_BATCH_SET_NUMBER_VALUE",
1125
1125
  message: "Assignment failed, not a numeric type",
1126
- data: o
1126
+ data: r
1127
1127
  };
1128
1128
  this.ctx.emit("error", d);
1129
1129
  }
1130
- if (!r.length)
1130
+ if (!l.length)
1131
1131
  return;
1132
- const { BEFORE_VALUE_CHANGE_METHOD: l } = this.ctx.config;
1133
- typeof l == "function" && (r = await l(r)), r.forEach((d) => {
1132
+ const { BEFORE_VALUE_CHANGE_METHOD: a } = this.ctx.config;
1133
+ typeof a == "function" && (l = await a(l)), l.forEach((d) => {
1134
1134
  const { value: f, rowKey: x, key: u, oldValue: p } = d;
1135
- s.add(x), this.setItemValue(x, u, f), i.push({
1135
+ o.add(x), this.setItemValue(x, u, f, !1, !1, !1, i), s.push({
1136
1136
  rowKey: x,
1137
1137
  key: u,
1138
1138
  oldValue: p,
1139
1139
  newValue: f
1140
1140
  });
1141
1141
  });
1142
- let a = [];
1143
- s.forEach((d) => {
1144
- a.push(this.ctx.database.getRowDataItemForRowKey(d));
1145
- });
1146
- const h = r.map(({ rowKey: d, key: f }) => this.getValidator(d, f));
1147
- Promise.all(h).then(() => {
1148
- this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
1149
- }), this.ctx.emit("change", r, a), e && this.ctx.history.pushState({
1150
- changeList: i,
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,
1151
1153
  scrollX: this.ctx.scrollX,
1152
1154
  scrollY: this.ctx.scrollY,
1153
1155
  type: "multiple"
@@ -1161,91 +1163,92 @@ class ae {
1161
1163
  * @param history 是否添加历史记录
1162
1164
  * @param reDraw 是否刷新重绘
1163
1165
  * @param isEditor 是否是编辑器
1166
+ * @param checkReadonly 是否检查只读
1164
1167
  * @returns
1165
1168
  */
1166
- async setItemValue(t, e, i, s = !1, o = !1, r = !1) {
1169
+ async setItemValue(t, e, i, s = !1, o = !1, r = !1, l = !0) {
1167
1170
  if (!this.rowKeyMap.has(t))
1168
1171
  return {};
1169
- const { item: l } = this.rowKeyMap.get(t);
1170
- let a = l[e], h = i;
1171
- if (this.ctx.database.getReadonly(t, e))
1172
+ const { item: a } = this.rowKeyMap.get(t);
1173
+ let h = a[e], d = i;
1174
+ if (l && this.ctx.database.getReadonly(t, e))
1172
1175
  return {
1173
- oldValue: a,
1174
- newValue: a
1176
+ oldValue: h,
1177
+ newValue: h
1175
1178
  };
1176
- l[e] !== null && typeof l[e] == "object" && (a = JSON.parse(JSON.stringify(l[e])));
1177
- const d = `${t}​_${e}`;
1178
- this.originalDataMap.has(d) || this.originalDataMap.set(d, a);
1179
- const f = this.originalDataMap.get(d), x = this.getRowDataItemForRowKey(t);
1179
+ a[e] !== null && typeof a[e] == "object" && (h = JSON.parse(JSON.stringify(a[e])));
1180
+ const f = `${t}​_${e}`;
1181
+ this.originalDataMap.has(f) || this.originalDataMap.set(f, h);
1182
+ const x = this.originalDataMap.get(f), u = this.getRowDataItemForRowKey(t);
1180
1183
  if (r) {
1181
- const u = this.getVirtualBodyCellByKey(t, e);
1182
- if ((u == null ? void 0 : u.type) === "number")
1184
+ const p = this.getVirtualBodyCellByKey(t, e);
1185
+ if ((p == null ? void 0 : p.type) === "number")
1183
1186
  if (["", void 0, null].includes(i))
1184
- h = null;
1187
+ d = null;
1185
1188
  else if (/^-?\d+(\.\d+)?$/.test(`${i}`))
1186
- h = Number(i);
1189
+ d = Number(i);
1187
1190
  else {
1188
- h = a;
1189
- const g = {
1191
+ d = h;
1192
+ const E = {
1190
1193
  code: "ERR_SET_NUMBER_VALUE",
1191
1194
  message: "Assignment failed, not a numeric type",
1192
1195
  data: [
1193
1196
  {
1194
1197
  rowKey: t,
1195
1198
  key: e,
1196
- value: h,
1197
- oldValue: a,
1198
- row: x
1199
+ value: d,
1200
+ oldValue: h,
1201
+ row: u
1199
1202
  }
1200
1203
  ]
1201
1204
  };
1202
- this.ctx.emit("error", g);
1205
+ this.ctx.emit("error", E);
1203
1206
  }
1204
- if (h === a)
1207
+ if (d === h)
1205
1208
  return {
1206
- oldValue: a,
1207
- newValue: a
1209
+ oldValue: h,
1210
+ newValue: h
1208
1211
  };
1209
- const { BEFORE_VALUE_CHANGE_METHOD: p } = this.ctx.config;
1210
- if (typeof p == "function") {
1211
- const E = await p([
1212
+ const { BEFORE_VALUE_CHANGE_METHOD: g } = this.ctx.config;
1213
+ if (typeof g == "function") {
1214
+ const m = await g([
1212
1215
  {
1213
1216
  rowKey: t,
1214
1217
  key: e,
1215
- value: h,
1216
- oldValue: l[e],
1217
- row: x
1218
+ value: d,
1219
+ oldValue: a[e],
1220
+ row: u
1218
1221
  }
1219
1222
  ]);
1220
- E && E.length && (h = E[0].value);
1223
+ m && m.length && (d = m[0].value);
1221
1224
  }
1222
- this.changedDataMap.set(d, h), l[e] = h;
1225
+ this.changedDataMap.set(f, d), a[e] = d;
1223
1226
  const w = {
1224
1227
  rowKey: t,
1225
1228
  key: e,
1226
- oldValue: a,
1227
- value: h,
1228
- row: x
1229
+ oldValue: h,
1230
+ value: d,
1231
+ row: u
1229
1232
  };
1230
- this.getValidator(t, e).then(() => {
1233
+ l && (this.getValidator(t, e).then(() => {
1231
1234
  this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
1232
- }), this.ctx.emit("change", [w], [x]), this.ctx.emit("editChange", {
1235
+ }), this.ctx.emit("change", [w], [u])), this.ctx.emit("editChange", {
1233
1236
  rowKey: t,
1234
1237
  key: e,
1235
- oldValue: a,
1236
- value: h,
1237
- originalValue: f,
1238
- row: x
1238
+ oldValue: h,
1239
+ value: d,
1240
+ originalValue: x,
1241
+ row: u
1239
1242
  });
1240
1243
  } else
1241
- this.changedDataMap.set(d, h), l[e] = h;
1244
+ this.changedDataMap.set(f, d), a[e] = d;
1242
1245
  return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
1243
1246
  rowKey: t,
1244
1247
  key: e,
1245
- oldValue: a,
1246
- value: h,
1247
- originalValue: this.originalDataMap.get(d),
1248
- row: x
1248
+ oldValue: h,
1249
+ value: d,
1250
+ originalValue: this.originalDataMap.get(f),
1251
+ row: u
1249
1252
  }), s && this.ctx.history.pushState({
1250
1253
  type: "single",
1251
1254
  scrollX: this.ctx.scrollX,
@@ -1254,13 +1257,13 @@ class ae {
1254
1257
  {
1255
1258
  rowKey: t,
1256
1259
  key: e,
1257
- oldValue: a,
1258
- newValue: h
1260
+ oldValue: h,
1261
+ newValue: d
1259
1262
  }
1260
1263
  ]
1261
1264
  }), o && this.ctx.emit("draw"), {
1262
- oldValue: a,
1263
- newValue: h
1265
+ oldValue: h,
1266
+ newValue: d
1264
1267
  };
1265
1268
  }
1266
1269
  /**
@@ -1380,8 +1383,8 @@ class ae {
1380
1383
  let s = 0, o = 0;
1381
1384
  const r = this.selectionMap.size, l = Array.from(this.selectionMap.values()).some((x) => x.check);
1382
1385
  this.rowKeyMap.forEach((x, u) => {
1383
- var w;
1384
- (w = this.selectionMap.get(u)) != null && w.check && (s += 1);
1386
+ var g;
1387
+ (g = this.selectionMap.get(u)) != null && g.check && (s += 1);
1385
1388
  let p = x.selectable;
1386
1389
  typeof p == "function" && (p = p({
1387
1390
  row: x.item,
@@ -1564,7 +1567,7 @@ class ae {
1564
1567
  width: x,
1565
1568
  colspan: u,
1566
1569
  mergeRow: p,
1567
- mergeCol: w
1570
+ mergeCol: g
1568
1571
  } = t;
1569
1572
  if (d === 1 && u === 1)
1570
1573
  return {
@@ -1585,7 +1588,7 @@ class ae {
1585
1588
  }
1586
1589
  ]
1587
1590
  };
1588
- let g = e, E = e, C = l, m = l, R = [], y = 0, I = 0, _ = 0, S = 0;
1591
+ let w = e, E = e, m = l, y = l, R = [], C = 0, I = 0, _ = 0, S = 0;
1589
1592
  if (d !== 1 && p) {
1590
1593
  S = x;
1591
1594
  const v = a.reduce((b, O) => {
@@ -1598,7 +1601,7 @@ class ae {
1598
1601
  return `${M}${X}`;
1599
1602
  }, "");
1600
1603
  if (v === L)
1601
- g = b;
1604
+ w = b;
1602
1605
  else
1603
1606
  break;
1604
1607
  }
@@ -1612,11 +1615,11 @@ class ae {
1612
1615
  else
1613
1616
  break;
1614
1617
  }
1615
- for (let b = g; b < e; b++) {
1618
+ for (let b = w; b < e; b++) {
1616
1619
  const { height: O } = this.positions[b];
1617
- y += O;
1620
+ C += O;
1618
1621
  }
1619
- for (let b = g; b <= E; b++) {
1622
+ for (let b = w; b <= E; b++) {
1620
1623
  const { height: O } = this.positions[b];
1621
1624
  _ += O;
1622
1625
  const L = this.rowIndexRowKeyMap.get(b) || "", { item: M } = this.rowKeyMap.get(L), T = this.getItemValue(L, i);
@@ -1628,7 +1631,7 @@ class ae {
1628
1631
  });
1629
1632
  }
1630
1633
  }
1631
- if (u !== 1 && w) {
1634
+ if (u !== 1 && g) {
1632
1635
  _ = f;
1633
1636
  for (let v = l - 1; v >= 0; v--) {
1634
1637
  const b = this.getColumnByColIndex(v);
@@ -1636,7 +1639,7 @@ class ae {
1636
1639
  break;
1637
1640
  const O = this.getItemValue(s, i), L = this.getItemValue(s, b.key);
1638
1641
  if (O === L && h.includes(b.key))
1639
- C = v;
1642
+ m = v;
1640
1643
  else
1641
1644
  break;
1642
1645
  }
@@ -1646,17 +1649,17 @@ class ae {
1646
1649
  break;
1647
1650
  const O = this.getItemValue(s, i), L = this.getItemValue(s, b.key);
1648
1651
  if (O === L && h.includes(b.key))
1649
- m = v;
1652
+ y = v;
1650
1653
  else
1651
1654
  break;
1652
1655
  }
1653
- for (let v = C; v < l; v++) {
1656
+ for (let v = m; v < l; v++) {
1654
1657
  const b = this.getColumnByColIndex(v);
1655
1658
  if (!b)
1656
1659
  break;
1657
1660
  I += b.width || 100;
1658
1661
  }
1659
- for (let v = C; v <= m; v++) {
1662
+ for (let v = m; v <= y; v++) {
1660
1663
  const b = this.getColumnByColIndex(v);
1661
1664
  if (!b)
1662
1665
  break;
@@ -1669,13 +1672,13 @@ class ae {
1669
1672
  }
1670
1673
  }
1671
1674
  return {
1672
- xArr: [C, m],
1673
- yArr: [g, E],
1675
+ xArr: [m, y],
1676
+ yArr: [w, E],
1674
1677
  rowspan: d,
1675
1678
  colspan: u,
1676
1679
  height: _,
1677
1680
  width: S,
1678
- offsetTop: y,
1681
+ offsetTop: C,
1679
1682
  offsetLeft: I,
1680
1683
  dataList: R
1681
1684
  };
@@ -1775,7 +1778,7 @@ class he {
1775
1778
  value: o.oldValue,
1776
1779
  row: {}
1777
1780
  }));
1778
- this.ctx.setScroll(e, i), this.ctx.database.batchSetItemValue(s, !1), this.historyIndex -= 1;
1781
+ this.ctx.setScroll(e, i), this.ctx.database.batchSetItemValue(s, !1, !1), this.historyIndex -= 1;
1779
1782
  }
1780
1783
  }
1781
1784
  // 前进
@@ -1788,7 +1791,7 @@ class he {
1788
1791
  value: i.newValue,
1789
1792
  row: {}
1790
1793
  }));
1791
- this.ctx.database.batchSetItemValue(e, !1);
1794
+ this.ctx.database.batchSetItemValue(e, !1, !1);
1792
1795
  }
1793
1796
  }
1794
1797
  // 清空历史
@@ -2014,8 +2017,8 @@ class fe {
2014
2017
  f === "top" ? x = i + d : f === "bottom" ? x = i + o - d : x = i + (o + 1) / 2;
2015
2018
  let u = 0;
2016
2019
  a === "left" ? u = e + d : a === "right" ? u = e + s - d : u = e + s / 2;
2017
- const { _text: p, ellipsis: w } = this.handleEllipsis(t, s, d, l);
2018
- return this.ctx.fillText(p, u, x), this.ctx.restore(), w;
2020
+ const { _text: p, ellipsis: g } = this.handleEllipsis(t, s, d, l);
2021
+ return this.ctx.fillText(p, u, x), this.ctx.restore(), g;
2019
2022
  }
2020
2023
  handleEllipsis(t, e, i = 0, s = "12px Arial") {
2021
2024
  let o = !1, r = t;
@@ -2881,31 +2884,31 @@ class ge {
2881
2884
  setConfig(t) {
2882
2885
  this.config = new Ct(t);
2883
2886
  }
2884
- setItemValueByEditor(t, e, i, s = !0, o = !0) {
2887
+ setItemValueByEditor(t, e, i, s = !0, o = !0, r = !0) {
2885
2888
  if (this.config.ENABLE_MERGE_CELL_LINK) {
2886
- const r = this.database.getVirtualBodyCellByKey(t, e);
2887
- if (r && (r.mergeRow || r.mergeCol)) {
2888
- const { dataList: l } = r.getSpanInfo(), a = l.map((h) => ({ ...h, value: i }));
2889
- this.database.batchSetItemValue(a, s);
2889
+ const l = this.database.getVirtualBodyCellByKey(t, e);
2890
+ if (l && (l.mergeRow || l.mergeCol)) {
2891
+ const { dataList: a } = l.getSpanInfo(), h = a.map((d) => ({ ...d, value: i }));
2892
+ this.database.batchSetItemValue(h, s, r);
2890
2893
  return;
2891
2894
  }
2892
2895
  }
2893
- this.database.setItemValue(t, e, i, s, o, !0);
2896
+ this.database.setItemValue(t, e, i, s, o, !0, r);
2894
2897
  }
2895
- batchSetItemValueByEditor(t, e = !0) {
2898
+ batchSetItemValueByEditor(t, e = !0, i = !0) {
2896
2899
  if (this.config.ENABLE_MERGE_CELL_LINK) {
2897
- const i = [];
2898
- t.forEach((s) => {
2899
- const o = this.database.getRowIndexForRowKey(s.rowKey), r = this.database.getColIndexForKey(s.key);
2900
- if (o === void 0 || r === void 0) return;
2901
- const l = this.database.getVirtualBodyCell(o, r);
2902
- if (l) {
2903
- const { dataList: a } = l.getSpanInfo(), h = a.map((d) => ({ ...d, value: s.value }));
2904
- i.push(...h);
2900
+ const s = [];
2901
+ t.forEach((o) => {
2902
+ const r = this.database.getRowIndexForRowKey(o.rowKey), l = this.database.getColIndexForKey(o.key);
2903
+ if (r === void 0 || l === void 0) return;
2904
+ const a = this.database.getVirtualBodyCell(r, l);
2905
+ if (a) {
2906
+ const { dataList: h } = a.getSpanInfo(), d = h.map((f) => ({ ...f, value: o.value }));
2907
+ s.push(...d);
2905
2908
  }
2906
- }), this.database.batchSetItemValue(i, e);
2909
+ }), this.database.batchSetItemValue(s, e, i);
2907
2910
  } else
2908
- this.database.batchSetItemValue(t, e);
2911
+ this.database.batchSetItemValue(t, e, i);
2909
2912
  }
2910
2913
  setFocusCell(t) {
2911
2914
  var e;
@@ -3097,8 +3100,8 @@ class Rt {
3097
3100
  if (this.type === "vertical") {
3098
3101
  this.visibleDistance = h - o - d, this.distance = x - this.visibleDistance + u, this.trackX = a - 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;
3099
3102
  const p = this.distance ? this.visibleDistance / (x + u) : 0;
3100
- let w = Math.floor(p * this.visibleDistance);
3101
- w < 30 ? w = 30 : w > this.visibleDistance && (w = 0), this.barHeight = w, this.barY = d + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
3103
+ let g = Math.floor(p * this.visibleDistance);
3104
+ g < 30 ? g = 30 : g > this.visibleDistance && (g = 0), this.barHeight = g, this.barY = d + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
3102
3105
  } else {
3103
3106
  this.visibleDistance = a - o, this.distance = f - this.visibleDistance, this.splitPoints = [
3104
3107
  a - o,
@@ -3108,9 +3111,9 @@ class Rt {
3108
3111
  ];
3109
3112
  const p = l ? 0 : 0.5;
3110
3113
  this.trackX = 0, this.trackY = h - o + p, this.trackWidth = a, this.trackHeight = o;
3111
- const w = this.distance ? this.visibleDistance / f : 0;
3112
- let g = Math.floor(w * this.visibleDistance);
3113
- 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));
3114
+ const g = this.distance ? this.visibleDistance / f : 0;
3115
+ let w = Math.floor(g * this.visibleDistance);
3116
+ this.barY = this.trackY - 1 + (o - r) / 2, w < 30 ? w = 30 : w >= this.visibleDistance && (w = 0), this.barWidth = w, this.barHeight = r, this.barX = this.scroll / this.distance * (this.visibleDistance - this.barWidth), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
3114
3117
  }
3115
3118
  }
3116
3119
  draw() {
@@ -3249,8 +3252,8 @@ class pe {
3249
3252
  this.columns = i, this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [];
3250
3253
  const s = Tt(i), o = et(i);
3251
3254
  this.height = t * s, this.width = o.reduce((f, x) => {
3252
- const u = x.width || 100, { maxWidth: p, minWidth: w } = x;
3253
- return p && u > p ? f + p : w && u < w ? f + w : f + u;
3255
+ const u = x.width || 100, { maxWidth: p, minWidth: g } = x;
3256
+ return p && u > p ? f + p : g && u < g ? f + g : f + u;
3254
3257
  }, 0), this.visibleHeight = this.height;
3255
3258
  const r = ee(At(i, s));
3256
3259
  this.columnIndex = 0, this.resizeNum = 0, this.render(r, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
@@ -3353,7 +3356,7 @@ class pe {
3353
3356
  for (let r = 0; r < i; r++) {
3354
3357
  const l = t[r], a = o * (l.rowspan || 0), h = o * (l.level || 0);
3355
3358
  let { minWidth: d, maxWidth: f } = l, x = l.width || 100;
3356
- d && x < d && (x = d), f && x > f && (x = f), l.children && (x = et(l.children).reduce((w, g) => w + ((g == null ? void 0 : g.width) || 100), 0));
3359
+ 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));
3357
3360
  const u = new Xt(this.ctx, this.columnIndex, s, h, x, a, l);
3358
3361
  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;
3359
3362
  }
@@ -3428,7 +3431,7 @@ class pe {
3428
3431
  }), this.drawTipLine(), this.drawBottomLine();
3429
3432
  }
3430
3433
  }
3431
- class kt {
3434
+ class Bt {
3432
3435
  constructor(t, e, i = 0, s = 0, o = 0, r = 0, l, a = "body") {
3433
3436
  n(this, "ctx");
3434
3437
  n(this, "x", 0);
@@ -3532,20 +3535,20 @@ class Ee {
3532
3535
  this.x = 0, x === "top" && o ? this.y = e.height + i.height : this.y = e.height;
3533
3536
  const { data: u, sumHeight: p } = s.getData();
3534
3537
  this.height = p, this.data = u, this.width = e.width, this.visibleWidth = this.ctx.stageWidth - r;
3535
- const w = this.ctx.footer.height;
3536
- !this.data.length && !l ? this.height = a : !this.data.length && l && (this.height = l - e.height - w - r);
3537
- let g = this.height + e.height + r;
3538
- g += w;
3539
- let E = g;
3540
- const C = window.innerHeight, { top: m } = this.containerRect || this.ctx.containerElement.getBoundingClientRect();
3541
- if (C > m && d && !l) {
3542
- const L = C - m - f;
3543
- L > e.height + r ? E = L : g > h && (E = h);
3544
- } else this.data.length && l ? E = l : this.data.length && h && g > h && (E = h);
3538
+ const g = this.ctx.footer.height;
3539
+ !this.data.length && !l ? this.height = a : !this.data.length && l && (this.height = l - e.height - g - r);
3540
+ let w = this.height + e.height + r;
3541
+ w += g;
3542
+ 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;
3546
+ L > e.height + r ? E = L : w > h && (E = h);
3547
+ } else this.data.length && l ? E = l : this.data.length && h && w > h && (E = h);
3545
3548
  E > 0 && (this.ctx.stageHeight = Math.floor(E), this.ctx.stageElement.style.height = `${this.ctx.stageHeight}px`);
3546
3549
  let R = this.ctx.stageHeight - e.height - r;
3547
- o ? this.visibleHeight = R - w : 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;
3548
- const y = window.devicePixelRatio || 1, I = this.ctx.stageWidth * y, _ = this.ctx.stageHeight * y;
3550
+ 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;
3549
3552
  t.width = Math.round(I), t.height = Math.round(_);
3550
3553
  const S = this.data.length ? "not-empty" : "empty";
3551
3554
  this.ctx.emit("emptyChange", {
@@ -3553,12 +3556,12 @@ class Ee {
3553
3556
  type: S,
3554
3557
  headerHeight: e.height,
3555
3558
  bodyHeight: this.height,
3556
- footerHeight: w,
3559
+ footerHeight: g,
3557
3560
  width: this.width,
3558
- height: this.data.length ? 0 : a + w
3561
+ height: this.data.length ? 0 : a + g
3559
3562
  });
3560
- const v = Math.round(t.width / y * 1e4) / 1e4, b = Math.round(t.height / y * 1e4) / 1e4;
3561
- this.ctx.canvasElement.setAttribute("style", `height:${b}px;width:${v}px;`), this.ctx.paint.scale(y);
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);
3562
3565
  }
3563
3566
  // 调整行的高度
3564
3567
  initResizeRow() {
@@ -3600,8 +3603,8 @@ class Ee {
3600
3603
  const x = this.renderRows[f];
3601
3604
  if (o > x.y - h + x.height - 1.5 && o < x.y - h + x.height + 1.5 && o < a - 4)
3602
3605
  for (let p = 0; p < x.cells.length; p++) {
3603
- const w = x.cells[p];
3604
- r > w.drawX + 10 && r < w.drawX + w.width - 10 && w.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = x);
3606
+ const g = x.cells[p];
3607
+ r > g.drawX + 10 && r < g.drawX + g.width - 10 && g.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = x);
3605
3608
  }
3606
3609
  }
3607
3610
  }
@@ -3684,8 +3687,8 @@ class Ee {
3684
3687
  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;
3685
3688
  const d = [];
3686
3689
  for (let f = 0; f < this.visibleRows.length; f++) {
3687
- const x = this.headIndex + f, u = this.visibleRows[f], { height: p, top: w } = this.ctx.database.getPositionForRowIndex(x), g = new kt(this.ctx, x, 0, w + this.y, t.width, p, u);
3688
- d.push(g);
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);
3691
+ d.push(w);
3689
3692
  }
3690
3693
  this.renderRows = d, this.ctx.body.renderRows = d;
3691
3694
  }
@@ -3756,7 +3759,7 @@ class me {
3756
3759
  let e = this.y;
3757
3760
  const i = [];
3758
3761
  this.data.forEach((s, o) => {
3759
- const r = new kt(this.ctx, o, 0, e, this.width, t, s, "footer");
3762
+ const r = new Bt(this.ctx, o, 0, e, this.width, t, s, "footer");
3760
3763
  e += t, i.push(r);
3761
3764
  }), this.renderRows = i, this.ctx.footer.renderRows = this.renderRows;
3762
3765
  }
@@ -3904,18 +3907,18 @@ class ye {
3904
3907
  SELECTOR_AREA_MAX_Y: d,
3905
3908
  SELECTOR_AREA_MAX_X_OFFSET: f,
3906
3909
  SELECTOR_AREA_MAX_Y_OFFSET: x
3907
- } = this.ctx.config, u = l, p = a || this.ctx.maxColIndex - f, w = h, g = d || this.ctx.maxRowIndex - x;
3908
- let [E, C] = o, [m, R] = r;
3909
- if (E < u || C > p || m < w || R > g)
3910
+ } = 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)
3910
3913
  return;
3911
3914
  if (this.ctx.stageElement.focus({ preventScroll: !0 }), this.ctx.config.ENABLE_MERGE_CELL_LINK) {
3912
3915
  const I = this.adjustMergeCells(o, r);
3913
- m = I.yArr[0], R = I.yArr[1], E = I.xArr[0], C = I.xArr[1], this.ctx.onlyMergeCell = I.onlyMergeCell;
3916
+ y = I.yArr[0], R = I.yArr[1], E = I.xArr[0], m = I.xArr[1], this.ctx.onlyMergeCell = I.onlyMergeCell;
3914
3917
  }
3915
- E === C && m === R ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, o = [Math.max(u, E), Math.min(p, C)], r = [Math.max(w, m), Math.min(g, R)];
3916
- const { BEFORE_SET_SELECTOR_METHOD: y } = this.ctx.config;
3917
- if (typeof y == "function") {
3918
- const _ = y({
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)];
3919
+ const { BEFORE_SET_SELECTOR_METHOD: C } = this.ctx.config;
3920
+ if (typeof C == "function") {
3921
+ const _ = C({
3919
3922
  focusCell: this.ctx.focusCell,
3920
3923
  xArr: o,
3921
3924
  yArr: r
@@ -3931,24 +3934,24 @@ class ye {
3931
3934
  var p;
3932
3935
  const [i, s] = e, [o, r] = t;
3933
3936
  let l = [], a = [];
3934
- for (let w = 0; w <= e[1] - e[0]; w++)
3935
- for (let g = 0; g <= t[1] - t[0]; g++) {
3936
- const E = w + e[0], C = g + t[0], m = this.ctx.database.getVirtualBodyCell(E, C);
3937
- m && ((E === i || E === s) && l.push(m), (C === o || C === r) && a.push(m));
3937
+ for (let g = 0; g <= e[1] - e[0]; g++)
3938
+ 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));
3938
3941
  }
3939
3942
  const h = l.reduce(
3940
- (w, g) => {
3941
- const { yArr: E } = g.getSpanInfo(), [C, m] = E;
3942
- return w.minY = Math.min(w.minY, C), w.maxY = Math.max(w.maxY, m), w;
3943
+ (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;
3943
3946
  },
3944
3947
  {
3945
3948
  minY: i,
3946
3949
  maxY: s
3947
3950
  }
3948
3951
  ), d = a.reduce(
3949
- (w, g) => {
3950
- const { xArr: E } = g.getSpanInfo(), [C, m] = E;
3951
- return w.minX = Math.min(w.minX, C), w.maxX = Math.max(w.maxX, m), w;
3952
+ (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;
3952
3955
  },
3953
3956
  {
3954
3957
  minX: o,
@@ -3957,8 +3960,8 @@ class ye {
3957
3960
  ), f = [d.minX, d.maxX], x = [h.minY, h.maxY];
3958
3961
  let u = !1;
3959
3962
  if (d.minX !== d.maxX || h.minY !== h.maxY) {
3960
- const w = JSON.stringify(f) + JSON.stringify(x), g = (p = this.ctx.focusCell) == null ? void 0 : p.getSpanInfo();
3961
- u = (g && JSON.stringify(g.xArr) + JSON.stringify(g.yArr)) === w;
3963
+ const g = JSON.stringify(f) + JSON.stringify(x), w = (p = this.ctx.focusCell) == null ? void 0 : p.getSpanInfo();
3964
+ u = (w && JSON.stringify(w.xArr) + JSON.stringify(w.yArr)) === g;
3962
3965
  }
3963
3966
  return {
3964
3967
  xArr: f,
@@ -4101,32 +4104,32 @@ class ye {
4101
4104
  }), this.ctx.emit("draw");
4102
4105
  }).catch((r) => console.error("Copy Failure:", r)) : console.error("current browser does not support the Clipboard API");
4103
4106
  }
4104
- clearSelectedData(t, e, i = !1) {
4105
- let s = [];
4106
- const o = /* @__PURE__ */ new Set();
4107
- for (let l = 0; l <= e[1] - e[0]; l++)
4108
- for (let a = 0; a <= t[1] - t[0]; a++) {
4109
- const h = l + e[0], d = a + t[0], f = this.ctx.database.getItemValueForRowIndexAndColIndex(h, d);
4110
- if (f) {
4111
- const { rowKey: x, key: u } = f;
4112
- this.ctx.database.getReadonly(x, u) || (o.add(x), s.push({
4113
- rowKey: x,
4114
- key: u,
4115
- value: null,
4107
+ clearSelectedData(t, e, i = !1, s = null) {
4108
+ let o = [];
4109
+ const r = /* @__PURE__ */ new Set();
4110
+ for (let a = 0; a <= e[1] - e[0]; a++)
4111
+ for (let h = 0; h <= t[1] - t[0]; h++) {
4112
+ const d = a + e[0], f = h + t[0], x = this.ctx.database.getItemValueForRowIndexAndColIndex(d, f);
4113
+ if (x) {
4114
+ const { rowKey: u, key: p } = x;
4115
+ this.ctx.database.getReadonly(u, p) || (r.add(u), o.push({
4116
+ rowKey: u,
4117
+ key: p,
4118
+ value: s,
4116
4119
  row: {}
4117
4120
  //内部有设置
4118
4121
  }));
4119
4122
  }
4120
4123
  }
4121
- if (!s.length)
4124
+ if (!o.length)
4122
4125
  return [];
4123
4126
  if (i)
4124
- return s;
4125
- this.ctx.database.batchSetItemValue(s, !0);
4126
- let r = [];
4127
- return o.forEach((l) => {
4128
- r.push(this.ctx.database.getRowDataItemForRowKey(l));
4129
- }), this.ctx.emit("clearSelectedDataChange", s, r), s;
4127
+ return o;
4128
+ this.ctx.database.batchSetItemValue(o, !0);
4129
+ let l = [];
4130
+ return r.forEach((a) => {
4131
+ l.push(this.ctx.database.getRowDataItemForRowKey(a));
4132
+ }), this.ctx.emit("clearSelectedDataChange", o, l), o;
4130
4133
  }
4131
4134
  paste() {
4132
4135
  if (!navigator.clipboard) {
@@ -4148,26 +4151,26 @@ class ye {
4148
4151
  overflowColCount: p,
4149
4152
  textArr: r
4150
4153
  });
4151
- const w = r.length === 1 && r[0].length === 1;
4152
- if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(l, a) && !w) {
4153
- const m = {
4154
+ const g = r.length === 1 && r[0].length === 1;
4155
+ if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(l, a) && !g) {
4156
+ const y = {
4154
4157
  code: "ERR_MERGED_CELLS_PASTE",
4155
4158
  message: "Merged cells cannot span paste data"
4156
4159
  };
4157
- this.ctx.hasEvent("error") ? this.ctx.emit("error", m) : alert(m.message);
4160
+ this.ctx.hasEvent("error") ? this.ctx.emit("error", y) : alert(y.message);
4158
4161
  return;
4159
4162
  }
4160
- let g = [];
4161
- for (let m = 0; m <= r.length - 1; m++) {
4162
- const R = r[m].length;
4163
- for (let y = 0; y <= R - 1; y++) {
4164
- const I = m + e, _ = y + i, S = r[m][y], v = this.ctx.database.getItemValueForRowIndexAndColIndex(
4163
+ let w = [];
4164
+ for (let y = 0; y <= r.length - 1; y++) {
4165
+ const R = r[y].length;
4166
+ for (let C = 0; C <= R - 1; C++) {
4167
+ const I = y + e, _ = C + i, S = r[y][C], v = this.ctx.database.getItemValueForRowIndexAndColIndex(
4165
4168
  I,
4166
4169
  _
4167
4170
  );
4168
4171
  if (v) {
4169
4172
  const { rowKey: b, key: O } = v;
4170
- this.ctx.database.getReadonly(b, O) || (s.add(b), g.push({
4173
+ this.ctx.database.getReadonly(b, O) || (s.add(b), w.push({
4171
4174
  rowKey: b,
4172
4175
  key: O,
4173
4176
  value: S,
@@ -4178,35 +4181,35 @@ class ye {
4178
4181
  }
4179
4182
  }
4180
4183
  if (this.isCut) {
4181
- const m = this.clearSelectedData(
4184
+ const y = this.clearSelectedData(
4182
4185
  this.ctx.selector.xArrCopy,
4183
4186
  this.ctx.selector.yArrCopy,
4184
4187
  !0
4185
4188
  // 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
4186
- ), R = g.map((y) => `${y.rowKey}-${y.key}`);
4187
- m.forEach((y) => {
4188
- R.includes(`${y.rowKey}-${y.key}`) || g.unshift(y);
4189
+ ), R = w.map((C) => `${C.rowKey}-${C.key}`);
4190
+ y.forEach((C) => {
4191
+ R.includes(`${C.rowKey}-${C.key}`) || w.unshift(C);
4189
4192
  }), this.isCut = !1;
4190
4193
  }
4191
- if (!g.length)
4194
+ if (!w.length)
4192
4195
  return;
4193
4196
  const { BEFORE_PASTE_DATA_METHOD: E } = this.ctx.config;
4194
4197
  if (typeof E == "function") {
4195
- const m = E, R = g.map((y) => ({
4196
- rowKey: y.rowKey,
4197
- key: y.key,
4198
- value: y.value,
4199
- oldValue: this.ctx.database.getItemValue(y.rowKey, y.key),
4200
- row: this.ctx.database.getRowDataItemForRowKey(y.rowKey)
4198
+ const y = E, R = w.map((C) => ({
4199
+ rowKey: C.rowKey,
4200
+ key: C.key,
4201
+ value: C.value,
4202
+ oldValue: this.ctx.database.getItemValue(C.rowKey, C.key),
4203
+ row: this.ctx.database.getRowDataItemForRowKey(C.rowKey)
4201
4204
  }));
4202
- if (g = await m(R, l, a, r), g && !g.length)
4205
+ if (w = await y(R, l, a, r), w && !w.length)
4203
4206
  return;
4204
4207
  }
4205
- this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(g, !0);
4206
- let C = [];
4207
- s.forEach((m) => {
4208
- C.push(this.ctx.database.getRowDataItemForRowKey(m));
4209
- }), this.ctx.emit("pasteChange", g, C);
4208
+ 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);
4210
4213
  }).catch((o) => {
4211
4214
  console.error("Failed to get the clipboard content:", o);
4212
4215
  });
@@ -4300,14 +4303,14 @@ class ye {
4300
4303
  if (!i)
4301
4304
  return;
4302
4305
  p && this.ctx.onlyMergeCell && i.updateSpanInfo();
4303
- const { drawX: w, drawY: g, width: E, height: C, fixed: m } = i, R = o - w + 1, y = i.drawX + E - (e - s) + 1;
4304
- let I = r.height - g, _ = C;
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;
4305
4308
  _ > a.visibleHeight && (_ = a.visibleHeight);
4306
4309
  let S = 0;
4307
- x && (u === "top" ? I = r.height + l.height - g : S = l.visibleHeight);
4308
- const v = g + _ - (t - S - f);
4310
+ x && (u === "top" ? I = r.height + l.height - w : S = l.visibleHeight);
4311
+ const v = w + _ - (t - S - f);
4309
4312
  let b = h, O = d;
4310
- y > 0 && !m ? b = Math.floor(h + y) : R > 0 && !m && (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));
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));
4311
4314
  }
4312
4315
  destroy() {
4313
4316
  this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
@@ -4371,11 +4374,11 @@ class Ce {
4371
4374
  SELECTOR_AREA_MAX_Y: f,
4372
4375
  SELECTOR_AREA_MAX_X_OFFSET: x,
4373
4376
  SELECTOR_AREA_MAX_Y_OFFSET: u
4374
- } = this.ctx.config, p = a, w = h || this.ctx.maxColIndex - x, g = d, E = f || this.ctx.maxRowIndex - u;
4375
- let [C, m] = r, [R, y] = l;
4376
- if (C < p || R < g)
4377
+ } = 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)
4377
4380
  return;
4378
- r = [Math.max(p, C), Math.min(w, m)], l = [Math.max(g, R), Math.min(E, y)];
4381
+ r = [Math.max(p, m), Math.min(g, y)], l = [Math.max(w, R), Math.min(E, C)];
4379
4382
  const { BEFORE_SET_AUTOFILL_METHOD: I } = this.ctx.config;
4380
4383
  if (typeof I == "function") {
4381
4384
  const S = I({
@@ -4397,8 +4400,8 @@ class Ce {
4397
4400
  const t = /* @__PURE__ */ new Set(), e = this.ctx.getSelectedData(), i = /* @__PURE__ */ new Map();
4398
4401
  for (let u = 0; u <= e.yArr[1] - e.yArr[0]; u++)
4399
4402
  for (let p = 0; p <= e.xArr[1] - e.xArr[0]; p++) {
4400
- const w = u + e.yArr[0], g = p + e.xArr[0];
4401
- i.set(`${w}-${g}`, !0);
4403
+ const g = u + e.yArr[0], w = p + e.xArr[0];
4404
+ i.set(`${g}-${w}`, !0);
4402
4405
  }
4403
4406
  const { value: s } = e, o = s[0].length, r = s.length, l = this.ctx.autofill.xArr, a = this.ctx.autofill.yArr, h = o === 1 && r === 1;
4404
4407
  if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(l, a) && !h) {
@@ -4412,12 +4415,12 @@ class Ce {
4412
4415
  let d = [];
4413
4416
  for (let u = 0; u <= a[1] - a[0]; u++)
4414
4417
  for (let p = 0; p <= l[1] - l[0]; p++) {
4415
- const w = p + l[0], g = u + a[0], E = s[u % r][p % o], C = this.ctx.database.getItemValueForRowIndexAndColIndex(g, w), m = `${g}-${w}`;
4416
- if (C && !i.has(m)) {
4417
- const { rowKey: R, key: y } = C;
4418
- this.ctx.database.getReadonly(R, y) || (t.add(R), d.push({
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;
4421
+ this.ctx.database.getReadonly(R, C) || (t.add(R), d.push({
4419
4422
  rowKey: R,
4420
- key: y,
4423
+ key: C,
4421
4424
  value: E,
4422
4425
  row: {}
4423
4426
  }));
@@ -4428,12 +4431,12 @@ class Ce {
4428
4431
  this.ctx.selector.xArr = this.ctx.autofill.xArr, this.ctx.selector.yArr = this.ctx.autofill.yArr;
4429
4432
  const { BEFORE_AUTOFILL_DATA_METHOD: f } = this.ctx.config;
4430
4433
  if (typeof f == "function") {
4431
- const u = f, p = d.map((w) => ({
4432
- rowKey: w.rowKey,
4433
- key: w.key,
4434
- value: w.value,
4435
- oldValue: this.ctx.database.getItemValue(w.rowKey, w.key),
4436
- row: this.ctx.database.getRowDataItemForRowKey(w.rowKey)
4434
+ const u = f, p = d.map((g) => ({
4435
+ rowKey: g.rowKey,
4436
+ key: g.key,
4437
+ value: g.value,
4438
+ oldValue: this.ctx.database.getItemValue(g.rowKey, g.key),
4439
+ row: this.ctx.database.getRowDataItemForRowKey(g.rowKey)
4437
4440
  }));
4438
4441
  if (d = await u(p, l, a), d && !d.length)
4439
4442
  return;
@@ -4480,7 +4483,7 @@ function P(c) {
4480
4483
  function Q(c) {
4481
4484
  return c.split("-")[1];
4482
4485
  }
4483
- function Bt(c) {
4486
+ function kt(c) {
4484
4487
  return c === "x" ? "y" : "x";
4485
4488
  }
4486
4489
  function gt(c) {
@@ -4490,7 +4493,7 @@ function G(c) {
4490
4493
  return ["top", "bottom"].includes(P(c)) ? "y" : "x";
4491
4494
  }
4492
4495
  function wt(c) {
4493
- return Bt(G(c));
4496
+ return kt(G(c));
4494
4497
  }
4495
4498
  function ve(c, t, e) {
4496
4499
  e === void 0 && (e = !1);
@@ -4624,15 +4627,15 @@ const Le = async (c, t, e) => {
4624
4627
  x: d,
4625
4628
  y: f
4626
4629
  } = vt(h, i, a), x = i, u = {}, p = 0;
4627
- for (let w = 0; w < l.length; w++) {
4630
+ for (let g = 0; g < l.length; g++) {
4628
4631
  const {
4629
- name: g,
4632
+ name: w,
4630
4633
  fn: E
4631
- } = l[w], {
4632
- x: C,
4633
- y: m,
4634
+ } = l[g], {
4635
+ x: m,
4636
+ y,
4634
4637
  data: R,
4635
- reset: y
4638
+ reset: C
4636
4639
  } = await E({
4637
4640
  x: d,
4638
4641
  y: f,
@@ -4647,20 +4650,20 @@ const Le = async (c, t, e) => {
4647
4650
  floating: t
4648
4651
  }
4649
4652
  });
4650
- d = C ?? d, f = m ?? f, u = {
4653
+ d = m ?? d, f = y ?? f, u = {
4651
4654
  ...u,
4652
- [g]: {
4653
- ...u[g],
4655
+ [w]: {
4656
+ ...u[w],
4654
4657
  ...R
4655
4658
  }
4656
- }, y && p <= 50 && (p++, typeof y == "object" && (y.placement && (x = y.placement), y.rects && (h = y.rects === !0 ? await r.getElementRects({
4659
+ }, C && p <= 50 && (p++, typeof C == "object" && (C.placement && (x = C.placement), C.rects && (h = C.rects === !0 ? await r.getElementRects({
4657
4660
  reference: c,
4658
4661
  floating: t,
4659
4662
  strategy: s
4660
- }) : y.rects), {
4663
+ }) : C.rects), {
4661
4664
  x: d,
4662
4665
  y: f
4663
- } = vt(h, x, a)), w = -1);
4666
+ } = vt(h, x, a)), g = -1);
4664
4667
  }
4665
4668
  return {
4666
4669
  x: d,
@@ -4686,33 +4689,33 @@ async function Nt(c, t) {
4686
4689
  elementContext: f = "floating",
4687
4690
  altBoundary: x = !1,
4688
4691
  padding: u = 0
4689
- } = J(t, c), p = Kt(u), g = l[x ? f === "floating" ? "reference" : "floating" : f], E = ot(await o.getClippingRect({
4690
- element: (e = await (o.isElement == null ? void 0 : o.isElement(g))) == null || e ? g : g.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(l.floating)),
4692
+ } = J(t, c), p = Kt(u), w = l[x ? f === "floating" ? "reference" : "floating" : f], E = ot(await o.getClippingRect({
4693
+ element: (e = await (o.isElement == null ? void 0 : o.isElement(w))) == null || e ? w : w.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(l.floating)),
4691
4694
  boundary: h,
4692
4695
  rootBoundary: d,
4693
4696
  strategy: a
4694
- })), C = f === "floating" ? {
4697
+ })), m = f === "floating" ? {
4695
4698
  x: i,
4696
4699
  y: s,
4697
4700
  width: r.floating.width,
4698
4701
  height: r.floating.height
4699
- } : 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)) || {
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)) || {
4700
4703
  x: 1,
4701
4704
  y: 1
4702
4705
  } : {
4703
4706
  x: 1,
4704
4707
  y: 1
4705
- }, y = ot(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
4708
+ }, C = ot(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
4706
4709
  elements: l,
4707
- rect: C,
4708
- offsetParent: m,
4710
+ rect: m,
4711
+ offsetParent: y,
4709
4712
  strategy: a
4710
- }) : C);
4713
+ }) : m);
4711
4714
  return {
4712
- top: (E.top - y.top + p.top) / R.y,
4713
- bottom: (y.bottom - E.bottom + p.bottom) / R.y,
4714
- left: (E.left - y.left + p.left) / R.x,
4715
- right: (y.right - E.right + p.right) / R.x
4715
+ top: (E.top - C.top + p.top) / R.y,
4716
+ bottom: (C.bottom - E.bottom + p.bottom) / R.y,
4717
+ left: (E.left - C.left + p.left) / R.x,
4718
+ right: (C.right - E.right + p.right) / R.x
4716
4719
  };
4717
4720
  }
4718
4721
  const Te = (c) => ({
@@ -4736,17 +4739,17 @@ const Te = (c) => ({
4736
4739
  const f = Kt(d), x = {
4737
4740
  x: e,
4738
4741
  y: i
4739
- }, u = wt(s), p = gt(u), w = await r.getDimensions(h), g = u === "y", E = g ? "top" : "left", C = g ? "bottom" : "right", m = g ? "clientHeight" : "clientWidth", R = o.reference[p] + o.reference[u] - x[u] - o.floating[p], y = x[u] - o.reference[u], I = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(h));
4740
- let _ = I ? I[m] : 0;
4741
- (!_ || !await (r.isElement == null ? void 0 : r.isElement(I))) && (_ = l.floating[m] || o.floating[p]);
4742
- const S = R / 2 - y / 2, v = _ / 2 - w[p] / 2 - 1, b = Z(f[E], v), O = Z(f[C], v), L = b, M = _ - w[p] - O, T = _ / 2 - w[p] / 2 + S, X = ht(L, T, M), K = !a.arrow && Q(s) != null && T !== X && o.reference[p] / 2 - (T < L ? b : O) - w[p] / 2 < 0, k = K ? T < L ? T - L : T - M : 0;
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;
4743
4746
  return {
4744
- [u]: x[u] + k,
4747
+ [u]: x[u] + B,
4745
4748
  data: {
4746
4749
  [u]: X,
4747
- centerOffset: T - X - k,
4750
+ centerOffset: T - X - B,
4748
4751
  ...K && {
4749
- alignmentOffset: k
4752
+ alignmentOffset: B
4750
4753
  }
4751
4754
  },
4752
4755
  reset: K
@@ -4771,14 +4774,14 @@ const Te = (c) => ({
4771
4774
  fallbackPlacements: x,
4772
4775
  fallbackStrategy: u = "bestFit",
4773
4776
  fallbackAxisSideDirection: p = "none",
4774
- flipAlignment: w = !0,
4775
- ...g
4777
+ flipAlignment: g = !0,
4778
+ ...w
4776
4779
  } = J(c, t);
4777
4780
  if ((e = o.arrow) != null && e.alignmentOffset)
4778
4781
  return {};
4779
- const E = P(s), C = G(l), m = P(l) === l, R = await (a.isRTL == null ? void 0 : a.isRTL(h.floating)), y = x || (m || !w ? [st(l)] : Ie(l)), I = p !== "none";
4780
- !x && I && y.push(...Oe(l, w, p, R));
4781
- const _ = [l, ...y], S = await Nt(t, g), v = [];
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 = [];
4782
4785
  let b = ((i = o.flip) == null ? void 0 : i.overflows) || [];
4783
4786
  if (d && v.push(S[E]), f) {
4784
4787
  const T = ve(s, r, R);
@@ -4800,21 +4803,21 @@ const Te = (c) => ({
4800
4803
  placement: X
4801
4804
  }
4802
4805
  };
4803
- let K = (L = b.filter((k) => k.overflows[0] <= 0).sort((k, Y) => k.overflows[1] - Y.overflows[1])[0]) == null ? void 0 : L.placement;
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;
4804
4807
  if (!K)
4805
4808
  switch (u) {
4806
4809
  case "bestFit": {
4807
4810
  var M;
4808
- const k = (M = b.filter((Y) => {
4811
+ const B = (M = b.filter((Y) => {
4809
4812
  if (I) {
4810
4813
  const F = G(Y.placement);
4811
- return F === C || // Create a bias to the `y` side axis due to horizontal
4814
+ return F === m || // Create a bias to the `y` side axis due to horizontal
4812
4815
  // reading directions favoring greater width.
4813
4816
  F === "y";
4814
4817
  }
4815
4818
  return !0;
4816
4819
  }).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];
4817
- k && (K = k);
4820
+ B && (K = B);
4818
4821
  break;
4819
4822
  }
4820
4823
  case "initialPlacement":
@@ -4894,14 +4897,14 @@ const He = function(c) {
4894
4897
  mainAxis: o = !0,
4895
4898
  crossAxis: r = !1,
4896
4899
  limiter: l = {
4897
- fn: (g) => {
4900
+ fn: (w) => {
4898
4901
  let {
4899
4902
  x: E,
4900
- y: C
4901
- } = g;
4903
+ y: m
4904
+ } = w;
4902
4905
  return {
4903
4906
  x: E,
4904
- y: C
4907
+ y: m
4905
4908
  };
4906
4909
  }
4907
4910
  },
@@ -4909,26 +4912,26 @@ const He = function(c) {
4909
4912
  } = J(c, t), h = {
4910
4913
  x: e,
4911
4914
  y: i
4912
- }, d = await Nt(t, a), f = G(P(s)), x = Bt(f);
4915
+ }, d = await Nt(t, a), f = G(P(s)), x = kt(f);
4913
4916
  let u = h[x], p = h[f];
4914
4917
  if (o) {
4915
- const g = x === "y" ? "top" : "left", E = x === "y" ? "bottom" : "right", C = u + d[g], m = u - d[E];
4916
- u = ht(C, u, m);
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);
4917
4920
  }
4918
4921
  if (r) {
4919
- const g = f === "y" ? "top" : "left", E = f === "y" ? "bottom" : "right", C = p + d[g], m = p - d[E];
4920
- p = ht(C, p, m);
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);
4921
4924
  }
4922
- const w = l.fn({
4925
+ const g = l.fn({
4923
4926
  ...t,
4924
4927
  [x]: u,
4925
4928
  [f]: p
4926
4929
  });
4927
4930
  return {
4928
- ...w,
4931
+ ...g,
4929
4932
  data: {
4930
- x: w.x - e,
4931
- y: w.y - i,
4933
+ x: g.x - e,
4934
+ y: g.y - i,
4932
4935
  enabled: {
4933
4936
  [x]: o,
4934
4937
  [f]: r
@@ -4958,7 +4961,7 @@ function Yt(c) {
4958
4961
  function H(c) {
4959
4962
  return rt() ? c instanceof Element || c instanceof A(c).Element : !1;
4960
4963
  }
4961
- function B(c) {
4964
+ function k(c) {
4962
4965
  return rt() ? c instanceof HTMLElement || c instanceof A(c).HTMLElement : !1;
4963
4966
  }
4964
4967
  function It(c) {
@@ -4989,9 +4992,9 @@ function pt(c) {
4989
4992
  const t = Et(), e = H(c) ? D(c) : c;
4990
4993
  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));
4991
4994
  }
4992
- function ke(c) {
4995
+ function Be(c) {
4993
4996
  let t = W(c);
4994
- for (; B(t) && !U(t); ) {
4997
+ for (; k(t) && !U(t); ) {
4995
4998
  if (pt(t))
4996
4999
  return t;
4997
5000
  if (nt(t))
@@ -5032,7 +5035,7 @@ function W(c) {
5032
5035
  }
5033
5036
  function Ft(c) {
5034
5037
  const t = W(c);
5035
- return U(t) ? c.ownerDocument ? c.ownerDocument.body : c.body : B(t) && tt(t) ? t : Ft(t);
5038
+ return U(t) ? c.ownerDocument ? c.ownerDocument.body : c.body : k(t) && tt(t) ? t : Ft(t);
5036
5039
  }
5037
5040
  function dt(c, t, e) {
5038
5041
  var i;
@@ -5050,7 +5053,7 @@ function ft(c) {
5050
5053
  function Vt(c) {
5051
5054
  const t = D(c);
5052
5055
  let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
5053
- const s = B(c), o = s ? c.offsetWidth : e, r = s ? c.offsetHeight : i, l = it(e) !== o || it(i) !== r;
5056
+ const s = k(c), o = s ? c.offsetWidth : e, r = s ? c.offsetHeight : i, l = it(e) !== o || it(i) !== r;
5054
5057
  return l && (e = o, i = r), {
5055
5058
  width: e,
5056
5059
  height: i,
@@ -5062,7 +5065,7 @@ function Wt(c) {
5062
5065
  }
5063
5066
  function $(c) {
5064
5067
  const t = Wt(c);
5065
- if (!B(t))
5068
+ if (!k(t))
5066
5069
  return V(1);
5067
5070
  const e = t.getBoundingClientRect(), {
5068
5071
  width: i,
@@ -5075,10 +5078,10 @@ function $(c) {
5075
5078
  y: l
5076
5079
  };
5077
5080
  }
5078
- const Be = /* @__PURE__ */ V(0);
5081
+ const ke = /* @__PURE__ */ V(0);
5079
5082
  function Pt(c) {
5080
5083
  const t = A(c);
5081
- return !Et() || !t.visualViewport ? Be : {
5084
+ return !Et() || !t.visualViewport ? ke : {
5082
5085
  x: t.visualViewport.offsetLeft,
5083
5086
  y: t.visualViewport.offsetTop
5084
5087
  };
@@ -5095,10 +5098,10 @@ function q(c, t, e, i) {
5095
5098
  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;
5096
5099
  if (o) {
5097
5100
  const x = A(o), u = i && H(i) ? A(i) : i;
5098
- let p = x, w = ft(p);
5099
- for (; w && i && u !== p; ) {
5100
- const g = $(w), E = w.getBoundingClientRect(), C = D(w), m = E.left + (w.clientLeft + parseFloat(C.paddingLeft)) * g.x, R = E.top + (w.clientTop + parseFloat(C.paddingTop)) * g.y;
5101
- a *= g.x, h *= g.y, d *= g.x, f *= g.y, a += m, h += R, p = A(w), w = ft(p);
5101
+ let p = x, g = ft(p);
5102
+ 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);
5102
5105
  }
5103
5106
  }
5104
5107
  return ot({
@@ -5122,8 +5125,8 @@ function Ne(c) {
5122
5125
  scrollLeft: 0,
5123
5126
  scrollTop: 0
5124
5127
  }, h = V(1);
5125
- const d = V(0), f = B(i);
5126
- if ((f || !f && !o) && ((j(i) !== "body" || tt(r)) && (a = lt(i)), B(i))) {
5128
+ const d = V(0), f = k(i);
5129
+ if ((f || !f && !o) && ((j(i) !== "body" || tt(r)) && (a = lt(i)), k(i))) {
5127
5130
  const x = q(i);
5128
5131
  h = $(i), d.x = x.x + i.clientLeft, d.y = x.y + i.clientTop;
5129
5132
  }
@@ -5168,7 +5171,7 @@ function Ve(c, t) {
5168
5171
  };
5169
5172
  }
5170
5173
  function We(c, t) {
5171
- const e = q(c, !0, t === "fixed"), i = e.top + c.clientTop, s = e.left + c.clientLeft, o = B(c) ? $(c) : V(1), r = c.clientWidth * o.x, l = c.clientHeight * o.y, a = s * o.x, h = i * o.y;
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;
5172
5175
  return {
5173
5176
  width: r,
5174
5177
  height: l,
@@ -5240,7 +5243,7 @@ function $e(c) {
5240
5243
  };
5241
5244
  }
5242
5245
  function Ge(c, t, e) {
5243
- const i = B(t), s = N(t), o = e === "fixed", r = q(c, !0, o, t);
5246
+ const i = k(t), s = N(t), o = e === "fixed", r = q(c, !0, o, t);
5244
5247
  let l = {
5245
5248
  scrollLeft: 0,
5246
5249
  scrollTop: 0
@@ -5269,7 +5272,7 @@ function at(c) {
5269
5272
  return D(c).position === "static";
5270
5273
  }
5271
5274
  function Ot(c, t) {
5272
- if (!B(c) || D(c).position === "fixed")
5275
+ if (!k(c) || D(c).position === "fixed")
5273
5276
  return null;
5274
5277
  if (t)
5275
5278
  return t(c);
@@ -5280,7 +5283,7 @@ function $t(c, t) {
5280
5283
  const e = A(c);
5281
5284
  if (nt(c))
5282
5285
  return e;
5283
- if (!B(c)) {
5286
+ if (!k(c)) {
5284
5287
  let s = W(c);
5285
5288
  for (; s && !U(s); ) {
5286
5289
  if (H(s) && !at(s))
@@ -5292,7 +5295,7 @@ function $t(c, t) {
5292
5295
  let i = Ot(c, t);
5293
5296
  for (; i && Xe(i) && at(i); )
5294
5297
  i = Ot(i, t);
5295
- return i && U(i) && at(i) && !pt(i) ? e : i || ke(c) || e;
5298
+ return i && U(i) && at(i) && !pt(i) ? e : i || Be(c) || e;
5296
5299
  }
5297
5300
  const Ue = async function(c) {
5298
5301
  const t = this.getOffsetParent || $t, e = this.getDimensions, i = await e(c.floating);
@@ -5705,8 +5708,8 @@ class ei {
5705
5708
  config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
5706
5709
  } = this.ctx, { visibleWidth: o, visibleHeight: r, renderCellHeaders: l } = this.ctx.header;
5707
5710
  let a = [], h = [], d = [];
5708
- l.forEach((g) => {
5709
- g.render && (g.fixed === "left" ? h.push(g) : g.fixed === "right" ? d.push(g) : a.push(g));
5711
+ l.forEach((w) => {
5712
+ w.render && (w.fixed === "left" ? h.push(w) : w.fixed === "right" ? d.push(w) : a.push(w));
5710
5713
  });
5711
5714
  const f = e - i, x = {
5712
5715
  key: "left",
@@ -5757,8 +5760,8 @@ class ei {
5757
5760
  getBody() {
5758
5761
  const t = [], e = [], i = [];
5759
5762
  let s = this.ctx.body.renderRows;
5760
- this.ctx.config.FOOTER_FIXED || (s = s.concat(this.ctx.footer.renderRows)), s.forEach((g) => {
5761
- g.cells.forEach((E) => {
5763
+ this.ctx.config.FOOTER_FIXED || (s = s.concat(this.ctx.footer.renderRows)), s.forEach((w) => {
5764
+ w.cells.forEach((E) => {
5762
5765
  E.cellType === "footer" && (E.render = E.renderFooter), E.render && (E.fixed === "left" ? e.push(E) : E.fixed === "right" ? i.push(E) : t.push(E));
5763
5766
  });
5764
5767
  });
@@ -5814,9 +5817,9 @@ class ei {
5814
5817
  }
5815
5818
  getFooter() {
5816
5819
  const t = [], e = [], i = [];
5817
- this.ctx.footer.renderRows.forEach((w) => {
5818
- w.cells.forEach((g) => {
5819
- g.cellType === "footer" && g.renderFooter && (g.render = g.renderFooter, g.fixed === "left" ? e.push(g) : g.fixed === "right" ? i.push(g) : t.push(g));
5820
+ this.ctx.footer.renderRows.forEach((g) => {
5821
+ g.cells.forEach((w) => {
5822
+ w.cellType === "footer" && w.renderFooter && (w.render = w.renderFooter, w.fixed === "left" ? e.push(w) : w.fixed === "right" ? i.push(w) : t.push(w));
5820
5823
  });
5821
5824
  });
5822
5825
  const {
@@ -6037,14 +6040,18 @@ class ri {
6037
6040
  editCell(t, e) {
6038
6041
  this.editor.editCell(t, e);
6039
6042
  }
6040
- setItemValue(t, e, i, s = !0, o = !0, r = !1) {
6041
- this.ctx.database.setItemValue(t, e, i, s, o, r);
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);
6045
+ }
6046
+ batchSetItemValue(t, e = !0, i = !0) {
6047
+ this.ctx.database.batchSetItemValue(t, e, i);
6042
6048
  }
6043
- batchSetItemValue(t, e = !0) {
6044
- this.ctx.database.batchSetItemValue(t, e);
6049
+ setItemValueByEditor(t, e, i, s = !0, o = !0, r = !0) {
6050
+ this.ctx.setItemValueByEditor(t, e, i, s, o, r), this.editor.doneEdit();
6045
6051
  }
6046
- setItemValueByEditor(t, e, i, s = !0, o = !0) {
6047
- this.ctx.setItemValueByEditor(t, e, i, s, o), this.editor.doneEdit();
6052
+ clearEditableData(t = null) {
6053
+ const e = [0, this.ctx.maxColIndex], i = [0, this.ctx.maxRowIndex];
6054
+ return this.selector.clearSelectedData(e, i, !1, t);
6048
6055
  }
6049
6056
  clearEditor() {
6050
6057
  this.editor.clearEditor();