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.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +377 -370
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Context.d.ts +2 -2
- package/dist/lib/Context.js +6 -6
- package/dist/lib/Context.js.map +1 -1
- package/dist/lib/Database.d.ts +3 -2
- package/dist/lib/Database.js +23 -18
- package/dist/lib/Database.js.map +1 -1
- package/dist/lib/EVirtTable.d.ts +4 -3
- package/dist/lib/EVirtTable.js +11 -6
- package/dist/lib/EVirtTable.js.map +1 -1
- package/dist/lib/History.js +2 -2
- package/dist/lib/History.js.map +1 -1
- package/dist/lib/Selector.d.ts +2 -1
- package/dist/lib/Selector.js +2 -2
- package/dist/lib/Selector.js.map +1 -1
- package/package.json +1 -1
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
|
|
437
|
-
l = "loading", o =
|
|
436
|
+
const g = this.ctx.icons.get("loading");
|
|
437
|
+
l = "loading", o = g, r = x * 8;
|
|
438
438
|
} else if (d) {
|
|
439
|
-
const
|
|
440
|
-
o = h ?
|
|
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
|
|
446
|
-
this.ctx.paint.drawImage(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:
|
|
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
|
|
484
|
-
const E = this.ctx.hoverCell,
|
|
485
|
-
let
|
|
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
|
-
|
|
488
|
+
y = S[0], R = S[1];
|
|
489
489
|
}
|
|
490
|
-
x && E && (E.rowKey === this.rowKey && (
|
|
491
|
-
let
|
|
492
|
-
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (
|
|
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 && (
|
|
501
|
+
S && (C = S), v && (I = v);
|
|
502
502
|
}
|
|
503
|
-
this.drawCellBgColor =
|
|
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
|
|
510
|
-
d && f ? (
|
|
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:
|
|
534
|
-
a = this.drawX -
|
|
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
|
|
636
|
-
this.ctx.paint.drawRect(x + this.width -
|
|
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:
|
|
764
|
-
if (r >= E && r <=
|
|
765
|
-
const
|
|
766
|
-
this.ctx.paint.drawLine([h + I, d + 1, h + a -
|
|
767
|
-
borderColor:
|
|
768
|
-
fillColor:
|
|
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 ===
|
|
776
|
-
const
|
|
777
|
-
this.ctx.paint.drawLine([h + a - 1, d +
|
|
778
|
-
borderColor:
|
|
779
|
-
fillColor:
|
|
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 <=
|
|
787
|
-
const
|
|
788
|
-
this.ctx.paint.drawLine([h + I, d + l - 1, h + a -
|
|
789
|
-
borderColor:
|
|
790
|
-
fillColor:
|
|
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 >=
|
|
798
|
-
const
|
|
799
|
-
this.ctx.paint.drawLine([h + 1, d + I, h + 1, d + l -
|
|
800
|
-
borderColor:
|
|
801
|
-
fillColor:
|
|
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
|
|
873
|
-
if (typeof h == "function" && (
|
|
874
|
-
const
|
|
875
|
-
if (this.checkboxKeyMap.has(
|
|
876
|
-
const
|
|
877
|
-
|
|
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(
|
|
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
|
|
887
|
-
this.expandMap.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:
|
|
895
|
-
expand:
|
|
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
|
|
1105
|
-
const
|
|
1106
|
-
let
|
|
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
|
|
1110
|
-
return (E == null ? void 0 : E.type) === "number" && (["", void 0, null].includes(u) ? p = null : /^-?\d+(\.\d+)?$/.test(`${u}`) ? p = Number(u) : (p =
|
|
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:
|
|
1114
|
-
row:
|
|
1113
|
+
oldValue: w,
|
|
1114
|
+
row: g
|
|
1115
1115
|
}))), {
|
|
1116
1116
|
...d,
|
|
1117
1117
|
value: p,
|
|
1118
|
-
oldValue:
|
|
1119
|
-
row:
|
|
1118
|
+
oldValue: w,
|
|
1119
|
+
row: g
|
|
1120
1120
|
};
|
|
1121
1121
|
});
|
|
1122
|
-
if (
|
|
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:
|
|
1126
|
+
data: r
|
|
1127
1127
|
};
|
|
1128
1128
|
this.ctx.emit("error", d);
|
|
1129
1129
|
}
|
|
1130
|
-
if (!
|
|
1130
|
+
if (!l.length)
|
|
1131
1131
|
return;
|
|
1132
|
-
const { BEFORE_VALUE_CHANGE_METHOD:
|
|
1133
|
-
typeof
|
|
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
|
-
|
|
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
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
})
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
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:
|
|
1170
|
-
let
|
|
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:
|
|
1174
|
-
newValue:
|
|
1176
|
+
oldValue: h,
|
|
1177
|
+
newValue: h
|
|
1175
1178
|
};
|
|
1176
|
-
|
|
1177
|
-
const
|
|
1178
|
-
this.originalDataMap.has(
|
|
1179
|
-
const
|
|
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
|
|
1182
|
-
if ((
|
|
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
|
-
|
|
1187
|
+
d = null;
|
|
1185
1188
|
else if (/^-?\d+(\.\d+)?$/.test(`${i}`))
|
|
1186
|
-
|
|
1189
|
+
d = Number(i);
|
|
1187
1190
|
else {
|
|
1188
|
-
|
|
1189
|
-
const
|
|
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:
|
|
1197
|
-
oldValue:
|
|
1198
|
-
row:
|
|
1199
|
+
value: d,
|
|
1200
|
+
oldValue: h,
|
|
1201
|
+
row: u
|
|
1199
1202
|
}
|
|
1200
1203
|
]
|
|
1201
1204
|
};
|
|
1202
|
-
this.ctx.emit("error",
|
|
1205
|
+
this.ctx.emit("error", E);
|
|
1203
1206
|
}
|
|
1204
|
-
if (
|
|
1207
|
+
if (d === h)
|
|
1205
1208
|
return {
|
|
1206
|
-
oldValue:
|
|
1207
|
-
newValue:
|
|
1209
|
+
oldValue: h,
|
|
1210
|
+
newValue: h
|
|
1208
1211
|
};
|
|
1209
|
-
const { BEFORE_VALUE_CHANGE_METHOD:
|
|
1210
|
-
if (typeof
|
|
1211
|
-
const
|
|
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:
|
|
1216
|
-
oldValue:
|
|
1217
|
-
row:
|
|
1218
|
+
value: d,
|
|
1219
|
+
oldValue: a[e],
|
|
1220
|
+
row: u
|
|
1218
1221
|
}
|
|
1219
1222
|
]);
|
|
1220
|
-
|
|
1223
|
+
m && m.length && (d = m[0].value);
|
|
1221
1224
|
}
|
|
1222
|
-
this.changedDataMap.set(
|
|
1225
|
+
this.changedDataMap.set(f, d), a[e] = d;
|
|
1223
1226
|
const w = {
|
|
1224
1227
|
rowKey: t,
|
|
1225
1228
|
key: e,
|
|
1226
|
-
oldValue:
|
|
1227
|
-
value:
|
|
1228
|
-
row:
|
|
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], [
|
|
1235
|
+
}), this.ctx.emit("change", [w], [u])), this.ctx.emit("editChange", {
|
|
1233
1236
|
rowKey: t,
|
|
1234
1237
|
key: e,
|
|
1235
|
-
oldValue:
|
|
1236
|
-
value:
|
|
1237
|
-
originalValue:
|
|
1238
|
-
row:
|
|
1238
|
+
oldValue: h,
|
|
1239
|
+
value: d,
|
|
1240
|
+
originalValue: x,
|
|
1241
|
+
row: u
|
|
1239
1242
|
});
|
|
1240
1243
|
} else
|
|
1241
|
-
this.changedDataMap.set(
|
|
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:
|
|
1246
|
-
value:
|
|
1247
|
-
originalValue: this.originalDataMap.get(
|
|
1248
|
-
row:
|
|
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:
|
|
1258
|
-
newValue:
|
|
1260
|
+
oldValue: h,
|
|
1261
|
+
newValue: d
|
|
1259
1262
|
}
|
|
1260
1263
|
]
|
|
1261
1264
|
}), o && this.ctx.emit("draw"), {
|
|
1262
|
-
oldValue:
|
|
1263
|
-
newValue:
|
|
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
|
|
1384
|
-
(
|
|
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:
|
|
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
|
|
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
|
-
|
|
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 =
|
|
1618
|
+
for (let b = w; b < e; b++) {
|
|
1616
1619
|
const { height: O } = this.positions[b];
|
|
1617
|
-
|
|
1620
|
+
C += O;
|
|
1618
1621
|
}
|
|
1619
|
-
for (let 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 &&
|
|
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
|
-
|
|
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
|
-
|
|
1652
|
+
y = v;
|
|
1650
1653
|
else
|
|
1651
1654
|
break;
|
|
1652
1655
|
}
|
|
1653
|
-
for (let 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 =
|
|
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: [
|
|
1673
|
-
yArr: [
|
|
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:
|
|
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:
|
|
2018
|
-
return this.ctx.fillText(p, u, x), this.ctx.restore(),
|
|
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
|
|
2887
|
-
if (
|
|
2888
|
-
const { dataList:
|
|
2889
|
-
this.database.batchSetItemValue(
|
|
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
|
|
2898
|
-
t.forEach((
|
|
2899
|
-
const
|
|
2900
|
-
if (
|
|
2901
|
-
const
|
|
2902
|
-
if (
|
|
2903
|
-
const { dataList:
|
|
2904
|
-
|
|
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(
|
|
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
|
|
3101
|
-
|
|
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
|
|
3112
|
-
let
|
|
3113
|
-
this.barY = this.trackY - 1 + (o - r) / 2,
|
|
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:
|
|
3253
|
-
return p && u > p ? f + p :
|
|
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((
|
|
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
|
|
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
|
|
3536
|
-
!this.data.length && !l ? this.height = a : !this.data.length && l && (this.height = l - e.height -
|
|
3537
|
-
let
|
|
3538
|
-
|
|
3539
|
-
let E =
|
|
3540
|
-
const
|
|
3541
|
-
if (
|
|
3542
|
-
const L =
|
|
3543
|
-
L > e.height + r ? E = L :
|
|
3544
|
-
} else this.data.length && l ? E = l : this.data.length && 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 -
|
|
3548
|
-
const
|
|
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:
|
|
3559
|
+
footerHeight: g,
|
|
3557
3560
|
width: this.width,
|
|
3558
|
-
height: this.data.length ? 0 : a +
|
|
3561
|
+
height: this.data.length ? 0 : a + g
|
|
3559
3562
|
});
|
|
3560
|
-
const v = Math.round(t.width /
|
|
3561
|
-
this.ctx.canvasElement.setAttribute("style", `height:${b}px;width:${v}px;`), this.ctx.paint.scale(
|
|
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
|
|
3604
|
-
r >
|
|
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:
|
|
3688
|
-
d.push(
|
|
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
|
|
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,
|
|
3908
|
-
let [E,
|
|
3909
|
-
if (E < u ||
|
|
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
|
-
|
|
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 ===
|
|
3916
|
-
const { BEFORE_SET_SELECTOR_METHOD:
|
|
3917
|
-
if (typeof
|
|
3918
|
-
const _ =
|
|
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
|
|
3935
|
-
for (let
|
|
3936
|
-
const E =
|
|
3937
|
-
|
|
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
|
-
(
|
|
3941
|
-
const { yArr: E } =
|
|
3942
|
-
return
|
|
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
|
-
(
|
|
3950
|
-
const { xArr: E } =
|
|
3951
|
-
return
|
|
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
|
|
3961
|
-
u = (
|
|
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
|
|
4106
|
-
const
|
|
4107
|
-
for (let
|
|
4108
|
-
for (let
|
|
4109
|
-
const
|
|
4110
|
-
if (
|
|
4111
|
-
const { rowKey:
|
|
4112
|
-
this.ctx.database.getReadonly(
|
|
4113
|
-
rowKey:
|
|
4114
|
-
key:
|
|
4115
|
-
value:
|
|
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 (!
|
|
4124
|
+
if (!o.length)
|
|
4122
4125
|
return [];
|
|
4123
4126
|
if (i)
|
|
4124
|
-
return
|
|
4125
|
-
this.ctx.database.batchSetItemValue(
|
|
4126
|
-
let
|
|
4127
|
-
return
|
|
4128
|
-
|
|
4129
|
-
}), this.ctx.emit("clearSelectedDataChange",
|
|
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
|
|
4152
|
-
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(l, a) && !
|
|
4153
|
-
const
|
|
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",
|
|
4160
|
+
this.ctx.hasEvent("error") ? this.ctx.emit("error", y) : alert(y.message);
|
|
4158
4161
|
return;
|
|
4159
4162
|
}
|
|
4160
|
-
let
|
|
4161
|
-
for (let
|
|
4162
|
-
const R = r[
|
|
4163
|
-
for (let
|
|
4164
|
-
const I =
|
|
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),
|
|
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
|
|
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 =
|
|
4187
|
-
|
|
4188
|
-
R.includes(`${
|
|
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 (!
|
|
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
|
|
4196
|
-
rowKey:
|
|
4197
|
-
key:
|
|
4198
|
-
value:
|
|
4199
|
-
oldValue: this.ctx.database.getItemValue(
|
|
4200
|
-
row: this.ctx.database.getRowDataItemForRowKey(
|
|
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 (
|
|
4205
|
+
if (w = await y(R, l, a, r), w && !w.length)
|
|
4203
4206
|
return;
|
|
4204
4207
|
}
|
|
4205
|
-
this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(
|
|
4206
|
-
let
|
|
4207
|
-
s.forEach((
|
|
4208
|
-
|
|
4209
|
-
}), this.ctx.emit("pasteChange",
|
|
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:
|
|
4304
|
-
let I = r.height -
|
|
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 -
|
|
4308
|
-
const v =
|
|
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
|
-
|
|
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,
|
|
4375
|
-
let [
|
|
4376
|
-
if (
|
|
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,
|
|
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
|
|
4401
|
-
i.set(`${
|
|
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
|
|
4416
|
-
if (
|
|
4417
|
-
const { rowKey: R, key:
|
|
4418
|
-
this.ctx.database.getReadonly(R,
|
|
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:
|
|
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((
|
|
4432
|
-
rowKey:
|
|
4433
|
-
key:
|
|
4434
|
-
value:
|
|
4435
|
-
oldValue: this.ctx.database.getItemValue(
|
|
4436
|
-
row: this.ctx.database.getRowDataItemForRowKey(
|
|
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
|
|
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
|
|
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
|
|
4630
|
+
for (let g = 0; g < l.length; g++) {
|
|
4628
4631
|
const {
|
|
4629
|
-
name:
|
|
4632
|
+
name: w,
|
|
4630
4633
|
fn: E
|
|
4631
|
-
} = l[
|
|
4632
|
-
x:
|
|
4633
|
-
y
|
|
4634
|
+
} = l[g], {
|
|
4635
|
+
x: m,
|
|
4636
|
+
y,
|
|
4634
4637
|
data: R,
|
|
4635
|
-
reset:
|
|
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 =
|
|
4653
|
+
d = m ?? d, f = y ?? f, u = {
|
|
4651
4654
|
...u,
|
|
4652
|
-
[
|
|
4653
|
-
...u[
|
|
4655
|
+
[w]: {
|
|
4656
|
+
...u[w],
|
|
4654
4657
|
...R
|
|
4655
4658
|
}
|
|
4656
|
-
},
|
|
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
|
-
}) :
|
|
4663
|
+
}) : C.rects), {
|
|
4661
4664
|
x: d,
|
|
4662
4665
|
y: f
|
|
4663
|
-
} = vt(h, x, a)),
|
|
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),
|
|
4690
|
-
element: (e = await (o.isElement == null ? void 0 : o.isElement(
|
|
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
|
-
})),
|
|
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,
|
|
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
|
-
},
|
|
4708
|
+
}, C = ot(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
4706
4709
|
elements: l,
|
|
4707
|
-
rect:
|
|
4708
|
-
offsetParent:
|
|
4710
|
+
rect: m,
|
|
4711
|
+
offsetParent: y,
|
|
4709
4712
|
strategy: a
|
|
4710
|
-
}) :
|
|
4713
|
+
}) : m);
|
|
4711
4714
|
return {
|
|
4712
|
-
top: (E.top -
|
|
4713
|
-
bottom: (
|
|
4714
|
-
left: (E.left -
|
|
4715
|
-
right: (
|
|
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),
|
|
4740
|
-
let _ = I ? I[
|
|
4741
|
-
(!_ || !await (r.isElement == null ? void 0 : r.isElement(I))) && (_ = l.floating[
|
|
4742
|
-
const S = R / 2 -
|
|
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] +
|
|
4747
|
+
[u]: x[u] + B,
|
|
4745
4748
|
data: {
|
|
4746
4749
|
[u]: X,
|
|
4747
|
-
centerOffset: T - X -
|
|
4750
|
+
centerOffset: T - X - B,
|
|
4748
4751
|
...K && {
|
|
4749
|
-
alignmentOffset:
|
|
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:
|
|
4775
|
-
...
|
|
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),
|
|
4780
|
-
!x && I &&
|
|
4781
|
-
const _ = [l, ...
|
|
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((
|
|
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
|
|
4811
|
+
const B = (M = b.filter((Y) => {
|
|
4809
4812
|
if (I) {
|
|
4810
4813
|
const F = G(Y.placement);
|
|
4811
|
-
return F ===
|
|
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
|
-
|
|
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: (
|
|
4900
|
+
fn: (w) => {
|
|
4898
4901
|
let {
|
|
4899
4902
|
x: E,
|
|
4900
|
-
y:
|
|
4901
|
-
} =
|
|
4903
|
+
y: m
|
|
4904
|
+
} = w;
|
|
4902
4905
|
return {
|
|
4903
4906
|
x: E,
|
|
4904
|
-
y:
|
|
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 =
|
|
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
|
|
4916
|
-
u = ht(
|
|
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
|
|
4920
|
-
p = ht(
|
|
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
|
|
4925
|
+
const g = l.fn({
|
|
4923
4926
|
...t,
|
|
4924
4927
|
[x]: u,
|
|
4925
4928
|
[f]: p
|
|
4926
4929
|
});
|
|
4927
4930
|
return {
|
|
4928
|
-
...
|
|
4931
|
+
...g,
|
|
4929
4932
|
data: {
|
|
4930
|
-
x:
|
|
4931
|
-
y:
|
|
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
|
|
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
|
|
4995
|
+
function Be(c) {
|
|
4993
4996
|
let t = W(c);
|
|
4994
|
-
for (;
|
|
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 :
|
|
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 =
|
|
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 (!
|
|
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
|
|
5081
|
+
const ke = /* @__PURE__ */ V(0);
|
|
5079
5082
|
function Pt(c) {
|
|
5080
5083
|
const t = A(c);
|
|
5081
|
-
return !Et() || !t.visualViewport ?
|
|
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,
|
|
5099
|
-
for (;
|
|
5100
|
-
const
|
|
5101
|
-
a *=
|
|
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 =
|
|
5126
|
-
if ((f || !f && !o) && ((j(i) !== "body" || tt(r)) && (a = lt(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 =
|
|
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 =
|
|
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 (!
|
|
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 (!
|
|
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 ||
|
|
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((
|
|
5709
|
-
|
|
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((
|
|
5761
|
-
|
|
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((
|
|
5818
|
-
|
|
5819
|
-
|
|
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
|
-
|
|
6044
|
-
this.ctx.
|
|
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
|
-
|
|
6047
|
-
this.ctx.
|
|
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();
|