e-virt-table 1.3.23 → 1.3.24
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 +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +314 -302
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Cell.d.ts +3 -1
- package/dist/lib/Cell.js +17 -3
- package/dist/lib/Cell.js.map +1 -1
- package/dist/lib/CellHeader.d.ts +2 -1
- package/dist/lib/CellHeader.js +8 -1
- package/dist/lib/CellHeader.js.map +1 -1
- package/dist/lib/Config.d.ts +5 -1
- package/dist/lib/Config.js +14 -0
- package/dist/lib/Config.js.map +1 -1
- package/dist/lib/ContextMenu.js +28 -6
- package/dist/lib/ContextMenu.js.map +1 -1
- package/dist/lib/DOMTreeMenu.d.ts +0 -1
- package/dist/lib/DOMTreeMenu.js +0 -8
- package/dist/lib/DOMTreeMenu.js.map +1 -1
- package/dist/lib/Editor.js +4 -4
- package/dist/lib/Editor.js.map +1 -1
- package/dist/lib/types.d.ts +11 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -411,7 +411,9 @@ class vt extends qt {
|
|
|
411
411
|
n(this, "overflowTooltipMaxWidth", 500);
|
|
412
412
|
n(this, "overflowTooltipPlacement", "top");
|
|
413
413
|
n(this, "maxLineClamp", "auto");
|
|
414
|
-
|
|
414
|
+
n(this, "renderType", "default");
|
|
415
|
+
n(this, "renderFooterType", "default");
|
|
416
|
+
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = h.key, this.type = h.type || "", this.editorType = h.editorType || "text", this.selectorCellValueType = h.selectorCellValueType || this.ctx.config.SELECTOR_CELL_VALUE_TYPE || "value", this.editorProps = h.editorProps || {}, this.cellType = f, this.align = h.align || this.ctx.config.COLUMNS_ALIGN, this.verticalAlign = h.verticalAlign || this.ctx.config.COLUMNS_VERTICAL_ALIGN, this.fixed = h.fixed || "", this.level = h.level || 0, this.operation = h.operation || !1, this.column = h, this.rules = h.rules || [], this.row = d, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = h.render, this.overflowTooltipShow = h.overflowTooltipShow !== !1, this.autoRowHeight = h.autoRowHeight !== void 0 ? h.autoRowHeight : this.ctx.config.AUTO_ROW_HEIGHT, this.overflowTooltipMaxWidth = h.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = h.overflowTooltipPlacement || "top", this.renderFooter = h.renderFooter, this.hoverIconName = h.hoverIconName, this.formatter = h.formatter, this.formatterFooter = h.formatterFooter, this.maxLineClamp = h.maxLineClamp || "auto", this.renderType = h.renderType || "default", this.renderFooterType = h.renderFooterType || "default", u && this.update();
|
|
415
417
|
}
|
|
416
418
|
setWidthHeight(e, i) {
|
|
417
419
|
this.width = e, this.height = i;
|
|
@@ -533,16 +535,16 @@ class vt extends qt {
|
|
|
533
535
|
this.rowExpand = h, this.rowHasChildren = d;
|
|
534
536
|
const { TREE_INDENT: x = 16, CHECKBOX_SIZE: g, TREE_ICON_SIZE: m } = this.ctx.config;
|
|
535
537
|
if (r = u * x, f) {
|
|
536
|
-
const
|
|
537
|
-
a = "loading", o =
|
|
538
|
+
const I = this.ctx.icons.get("loading");
|
|
539
|
+
a = "loading", o = I;
|
|
538
540
|
} else if (d) {
|
|
539
|
-
const
|
|
540
|
-
o = h ?
|
|
541
|
+
const I = this.ctx.icons.get("expand"), _ = this.ctx.icons.get("shrink");
|
|
542
|
+
o = h ? _ : I, a = h ? "shrink" : "expand";
|
|
541
543
|
}
|
|
542
544
|
let w = m, E = m, p = this.drawX;
|
|
543
545
|
(this.align === "center" || this.align === "right") && (p = this.drawX + (this.visibleWidth - w - 2 * e) / 2, this.align = "left");
|
|
544
|
-
let
|
|
545
|
-
this.type === "selection-tree" ? (
|
|
546
|
+
let C = p + r + e, b = this.drawY + (this.visibleHeight - E) / 2, y = r + this.drawX + w - 0.5;
|
|
547
|
+
this.type === "selection-tree" ? (C = r + this.drawSelectionImageX + this.drawSelectionImageWidth, y = C + w - e / 2) : this.type === "tree-selection" ? y = C + g + w - e / 2 : y = C + w - e / 2, this.drawTextX = y, this.drawTextWidth = this.drawX + this.visibleWidth - y, !(C + w + e > this.drawX + this.visibleWidth) && (b + E + e > this.drawY + this.visibleHeight || (this.drawTreeImageX = C, this.drawTreeImageY = b, this.drawTreeImageWidth = w, this.drawTreeImageHeight = E, o ? (this.drawTreeImageName = a, this.drawTreeImageSource = o) : (this.drawTreeImageName = "", this.drawTreeImageSource = void 0)));
|
|
546
548
|
}
|
|
547
549
|
drawTreeLine() {
|
|
548
550
|
const { TREE_LINE: e, TREE_INDENT: i = 16, TREE_ICON_SIZE: s = 16, TREE_LINE_COLOR: o = "#e1e6eb" } = this.ctx.config;
|
|
@@ -606,31 +608,31 @@ class vt extends qt {
|
|
|
606
608
|
FINDER_CELL_BG_COLOR: w
|
|
607
609
|
} = this.ctx.config;
|
|
608
610
|
if (this.cellType === "footer") {
|
|
609
|
-
let
|
|
611
|
+
let S = h, T = l;
|
|
610
612
|
if (typeof o == "function") {
|
|
611
|
-
const M = o, { backgroundColor:
|
|
613
|
+
const M = o, { backgroundColor: O, color: A, font: H } = M({
|
|
612
614
|
row: this.row,
|
|
613
615
|
rowIndex: this.rowIndex,
|
|
614
616
|
colIndex: this.colIndex,
|
|
615
617
|
column: this.column,
|
|
616
618
|
value: this.getValue()
|
|
617
619
|
}) || {};
|
|
618
|
-
|
|
620
|
+
O && (S = O), A && (T = A), H && (this.drawTextFont = H);
|
|
619
621
|
}
|
|
620
|
-
this.drawCellSkyBgColor = "transparent", this.drawCellBgColor =
|
|
622
|
+
this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = S, this.drawTextColor = T;
|
|
621
623
|
return;
|
|
622
624
|
}
|
|
623
625
|
let E = "transparent";
|
|
624
|
-
const p = this.ctx.hoverCell,
|
|
625
|
-
let b = this.rowIndex,
|
|
626
|
+
const p = this.ctx.hoverCell, C = this.ctx.currentCell;
|
|
627
|
+
let b = this.rowIndex, y = this.rowIndex;
|
|
626
628
|
if (this.rowspan !== 1 && (u || d)) {
|
|
627
|
-
const
|
|
628
|
-
b = T[0],
|
|
629
|
+
const S = this.getSpanInfo(), { yArr: T } = S;
|
|
630
|
+
b = T[0], y = T[1];
|
|
629
631
|
}
|
|
630
|
-
u && p && (p.rowKey === this.rowKey && (E = x), p.rowIndex >= b && p.rowIndex <=
|
|
631
|
-
let
|
|
632
|
-
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (
|
|
633
|
-
const
|
|
632
|
+
u && p && (p.rowKey === this.rowKey && (E = x), p.rowIndex >= b && p.rowIndex <= y && (E = x)), d && C && (C.rowKey === this.rowKey && (E = f), C.rowIndex >= b && C.rowIndex <= y && (E = f)), this.drawCellSkyBgColor = E;
|
|
633
|
+
let I = e, _ = a;
|
|
634
|
+
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (I = i, _ = r), g && (this.rowIndex % 2 ? I = m : I = e), typeof s == "function") {
|
|
635
|
+
const S = s, { backgroundColor: T, color: M, font: O } = S({
|
|
634
636
|
row: this.row,
|
|
635
637
|
rowIndex: this.rowIndex,
|
|
636
638
|
colIndex: this.colIndex,
|
|
@@ -638,10 +640,10 @@ class vt extends qt {
|
|
|
638
640
|
isHasChanged: this.isHasChanged,
|
|
639
641
|
value: this.getValue()
|
|
640
642
|
}) || {};
|
|
641
|
-
T && (
|
|
643
|
+
T && (I = T), M && (_ = M), O && (this.drawTextFont = O);
|
|
642
644
|
}
|
|
643
|
-
const { rowIndex:
|
|
644
|
-
|
|
645
|
+
const { rowIndex: L, colIndex: R, type: v } = this.ctx.finderBar;
|
|
646
|
+
L === this.rowIndex && R === this.colIndex && v === "body" && (I = w), this.drawCellBgColor = I, this.drawTextColor = _;
|
|
645
647
|
}
|
|
646
648
|
updateSelection() {
|
|
647
649
|
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: a, rowIndex: l, rowKey: h } = this;
|
|
@@ -653,8 +655,8 @@ class vt extends qt {
|
|
|
653
655
|
let g = x, m = this.drawY + (i - f) / 2;
|
|
654
656
|
if (a !== "selection-tree") {
|
|
655
657
|
if (a === "tree-selection") {
|
|
656
|
-
const { TREE_INDENT: p = 16, TREE_ICON_SIZE:
|
|
657
|
-
g = x +
|
|
658
|
+
const { TREE_INDENT: p = 16, TREE_ICON_SIZE: C } = this.ctx.config, b = this.ctx.database.getRowForRowKey(h), { level: y = 0 } = b || {}, I = y * p;
|
|
659
|
+
g = x + C + I;
|
|
658
660
|
}
|
|
659
661
|
}
|
|
660
662
|
let w = this.ctx.icons.get("checkbox-uncheck"), E = "checkbox-uncheck";
|
|
@@ -730,7 +732,7 @@ class vt extends qt {
|
|
|
730
732
|
* @returns
|
|
731
733
|
*/
|
|
732
734
|
getDisplayText() {
|
|
733
|
-
return this.cellType === "footer" ? this.renderFooter || this.text === null || this.text === void 0 ? "" : this.text : this.rowspan === 0 || this.colspan === 0 || this.render || this.type === "index-selection" && (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === this.rowIndex || ["checkbox-disabled", "checkbox-check"].includes(this.drawSelectionImageName)) || this.text === null || this.text === void 0 ? "" : `${this.text}`;
|
|
735
|
+
return this.cellType === "footer" ? this.renderFooter && this.renderFooterType === "default" || this.text === null || this.text === void 0 ? "" : this.text : this.rowspan === 0 || this.colspan === 0 || this.render && this.renderType === "default" || this.type === "index-selection" && (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === this.rowIndex || ["checkbox-disabled", "checkbox-check"].includes(this.drawSelectionImageName)) || this.text === null || this.text === void 0 ? "" : `${this.text}`;
|
|
734
736
|
}
|
|
735
737
|
/**
|
|
736
738
|
* 获取文本
|
|
@@ -791,7 +793,7 @@ class vt extends qt {
|
|
|
791
793
|
left: `${Math.round(e - 1)}px`,
|
|
792
794
|
top: `${Math.round(i - 1)}px`,
|
|
793
795
|
width: `${this.visibleWidth}px`,
|
|
794
|
-
height: this.autoRowHeight ? "auto" : `${this.visibleHeight}px`,
|
|
796
|
+
height: this.autoRowHeight && this.renderType === "default" ? "auto" : `${this.visibleHeight}px`,
|
|
795
797
|
// height: `${this.visibleHeight}px`,
|
|
796
798
|
// minHeight: `${this.visibleHeight}px`,
|
|
797
799
|
pointerEvents: "initial",
|
|
@@ -973,10 +975,10 @@ class vt extends qt {
|
|
|
973
975
|
drawBorder(e) {
|
|
974
976
|
const { drawX: i, drawY: s, rowIndex: o, colIndex: r, height: a, width: l } = this;
|
|
975
977
|
let h = i, d = s;
|
|
976
|
-
const { xArr: f, yArr: u, lineDash: x = [], borderWidth: g = 1, borderColor: m, fillColor: w } = e, E = f[0], p = f[1],
|
|
977
|
-
if (r >= E && r <= p && o ===
|
|
978
|
-
const
|
|
979
|
-
this.ctx.paint.drawLine([h +
|
|
978
|
+
const { xArr: f, yArr: u, lineDash: x = [], borderWidth: g = 1, borderColor: m, fillColor: w } = e, E = f[0], p = f[1], C = u[0], b = u[1];
|
|
979
|
+
if (r >= E && r <= p && o === C) {
|
|
980
|
+
const y = r === p ? 1 : 0, I = r === E ? 1 : 0;
|
|
981
|
+
this.ctx.paint.drawLine([h + I, d + 1, h + l - y, d + 1], {
|
|
980
982
|
borderColor: m,
|
|
981
983
|
fillColor: w,
|
|
982
984
|
borderWidth: g,
|
|
@@ -985,9 +987,9 @@ class vt extends qt {
|
|
|
985
987
|
lineDash: x
|
|
986
988
|
});
|
|
987
989
|
}
|
|
988
|
-
if (r === p && o >=
|
|
989
|
-
const
|
|
990
|
-
this.ctx.paint.drawLine([h + l - 1, d +
|
|
990
|
+
if (r === p && o >= C && o <= b) {
|
|
991
|
+
const y = o === C ? 1 : 0, I = o === b ? 1 : 0;
|
|
992
|
+
this.ctx.paint.drawLine([h + l - 1, d + y, h + l - 1, d + a - I], {
|
|
991
993
|
borderColor: m,
|
|
992
994
|
fillColor: w,
|
|
993
995
|
borderWidth: g,
|
|
@@ -997,8 +999,8 @@ class vt extends qt {
|
|
|
997
999
|
});
|
|
998
1000
|
}
|
|
999
1001
|
if (r >= E && r <= p && o === b) {
|
|
1000
|
-
const
|
|
1001
|
-
this.ctx.paint.drawLine([h +
|
|
1002
|
+
const y = r === p ? 1 : 0, I = r === E ? 1 : 0;
|
|
1003
|
+
this.ctx.paint.drawLine([h + I, d + a - 1, h + l - y, d + a - 1], {
|
|
1002
1004
|
borderColor: m,
|
|
1003
1005
|
fillColor: w,
|
|
1004
1006
|
borderWidth: g,
|
|
@@ -1007,9 +1009,9 @@ class vt extends qt {
|
|
|
1007
1009
|
lineDash: x
|
|
1008
1010
|
});
|
|
1009
1011
|
}
|
|
1010
|
-
if (r === E && o >=
|
|
1011
|
-
const
|
|
1012
|
-
this.ctx.paint.drawLine([h + 1, d +
|
|
1012
|
+
if (r === E && o >= C && o <= b) {
|
|
1013
|
+
const y = o === b ? 1 : 0, I = o === C ? 1 : 0;
|
|
1014
|
+
this.ctx.paint.drawLine([h + 1, d + I, h + 1, d + a - y], {
|
|
1013
1015
|
borderColor: m,
|
|
1014
1016
|
fillColor: w,
|
|
1015
1017
|
borderWidth: g,
|
|
@@ -1095,7 +1097,7 @@ class be {
|
|
|
1095
1097
|
TREE_CHILDREN_KEY: d
|
|
1096
1098
|
} = this.ctx.config;
|
|
1097
1099
|
t.forEach((f, u) => {
|
|
1098
|
-
var
|
|
1100
|
+
var C;
|
|
1099
1101
|
d !== "children" && (f.children = f[d]);
|
|
1100
1102
|
const x = f[o], g = x != null ? `${x}` : $t();
|
|
1101
1103
|
this.itemRowKeyMap.set(f, g);
|
|
@@ -1104,15 +1106,15 @@ class be {
|
|
|
1104
1106
|
if (typeof l == "function" && (E = l), h) {
|
|
1105
1107
|
const b = f[h];
|
|
1106
1108
|
if (this.checkboxKeyMap.has(b)) {
|
|
1107
|
-
const
|
|
1108
|
-
|
|
1109
|
+
const y = this.checkboxKeyMap.get(b) || [];
|
|
1110
|
+
y.push(g), this.checkboxKeyMap.set(b, y);
|
|
1109
1111
|
} else
|
|
1110
1112
|
this.checkboxKeyMap.set(b, [g]);
|
|
1111
1113
|
}
|
|
1112
1114
|
this.selectionMap.set(g, {
|
|
1113
1115
|
key: h ? f[h] : g,
|
|
1114
1116
|
row: f,
|
|
1115
|
-
check: ((
|
|
1117
|
+
check: ((C = this.selectionMap.get(g)) == null ? void 0 : C.check) || !1
|
|
1116
1118
|
});
|
|
1117
1119
|
const p = r || this.expandMap.get(g) || f._expand || !1;
|
|
1118
1120
|
this.expandMap.set(g, p), this.rowKeyMap.set(g, {
|
|
@@ -1435,17 +1437,17 @@ class be {
|
|
|
1435
1437
|
let l = [], h = t.map((g) => {
|
|
1436
1438
|
const { rowKey: m, key: w } = g;
|
|
1437
1439
|
let E = g.value, p = E;
|
|
1438
|
-
const
|
|
1439
|
-
return (
|
|
1440
|
+
const C = this.getRowDataItemForRowKey(m), b = this.getItemValue(m, w), y = this.getVirtualBodyCellByKey(m, w);
|
|
1441
|
+
return (y == null ? void 0 : y.type) === "number" && (["", void 0, null].includes(E) ? p = null : /^-?\d+(\.\d+)?$/.test(`${E}`) ? p = Number(E) : (p = b, l.push({
|
|
1440
1442
|
...g,
|
|
1441
1443
|
value: p,
|
|
1442
1444
|
oldValue: b,
|
|
1443
|
-
row:
|
|
1445
|
+
row: C
|
|
1444
1446
|
}))), {
|
|
1445
1447
|
...g,
|
|
1446
1448
|
value: p,
|
|
1447
1449
|
oldValue: b,
|
|
1448
|
-
row:
|
|
1450
|
+
row: C
|
|
1449
1451
|
};
|
|
1450
1452
|
});
|
|
1451
1453
|
if (h = h.filter((g) => !l.some((m) => g.rowKey === m.rowKey && g.key === m.key)), l.length) {
|
|
@@ -1689,8 +1691,8 @@ class be {
|
|
|
1689
1691
|
const h = (w) => {
|
|
1690
1692
|
const E = this.getTreeChildren(w);
|
|
1691
1693
|
let p = [];
|
|
1692
|
-
for (const
|
|
1693
|
-
p.push(
|
|
1694
|
+
for (const C of E)
|
|
1695
|
+
p.push(C), p.push(...h(C));
|
|
1694
1696
|
return p;
|
|
1695
1697
|
}, f = h(t).map((w) => this.selectionMap.get(w)), u = f.filter((w) => w == null ? void 0 : w.check).length, x = f.length, g = u > 0;
|
|
1696
1698
|
r = g && !(u === x), a = s || g, s && x > 0 && u === 0 && (a = !1, r = !1);
|
|
@@ -1698,8 +1700,8 @@ class be {
|
|
|
1698
1700
|
const h = (w) => {
|
|
1699
1701
|
const E = this.getTreeChildren(w);
|
|
1700
1702
|
let p = [];
|
|
1701
|
-
for (const
|
|
1702
|
-
p.push(
|
|
1703
|
+
for (const C of E)
|
|
1704
|
+
p.push(C), p.push(...h(C));
|
|
1703
1705
|
return p;
|
|
1704
1706
|
}, f = h(t).map((w) => this.selectionMap.get(w)), u = f.filter((w) => w == null ? void 0 : w.check).length, x = f.length, g = u > 0, m = u === x;
|
|
1705
1707
|
r = g && !m, a = s || m, s && x > 0 && u === 0 && (a = !1, r = !1);
|
|
@@ -2013,98 +2015,98 @@ class be {
|
|
|
2013
2015
|
}
|
|
2014
2016
|
]
|
|
2015
2017
|
};
|
|
2016
|
-
let w = e, E = e, p = a,
|
|
2018
|
+
let w = e, E = e, p = a, C = a, b = [], y = 0, I = 0, _ = 0, L = 0;
|
|
2017
2019
|
if (d !== 1 && g) {
|
|
2018
|
-
|
|
2019
|
-
const
|
|
2020
|
-
const T = this.getItemValue(s,
|
|
2021
|
-
return `${
|
|
2020
|
+
L = u;
|
|
2021
|
+
const R = l.reduce((v, S) => {
|
|
2022
|
+
const T = this.getItemValue(s, S) ?? "";
|
|
2023
|
+
return `${v}${T}`;
|
|
2022
2024
|
}, "");
|
|
2023
|
-
for (let
|
|
2024
|
-
const
|
|
2025
|
-
const A = this.getItemValue(
|
|
2025
|
+
for (let v = e - 1; v >= 0; v--) {
|
|
2026
|
+
const S = this.rowIndexRowKeyMap.get(v) || "", T = l.reduce((M, O) => {
|
|
2027
|
+
const A = this.getItemValue(S, O) ?? "";
|
|
2026
2028
|
return `${M}${A}`;
|
|
2027
2029
|
}, "");
|
|
2028
|
-
if (
|
|
2029
|
-
w =
|
|
2030
|
+
if (R === T)
|
|
2031
|
+
w = v;
|
|
2030
2032
|
else
|
|
2031
2033
|
break;
|
|
2032
2034
|
}
|
|
2033
|
-
for (let
|
|
2034
|
-
const
|
|
2035
|
-
const A = this.getItemValue(
|
|
2035
|
+
for (let v = e; v <= this.ctx.maxRowIndex; v++) {
|
|
2036
|
+
const S = this.rowIndexRowKeyMap.get(v) || "", T = l.reduce((M, O) => {
|
|
2037
|
+
const A = this.getItemValue(S, O) ?? "";
|
|
2036
2038
|
return `${M}${A}`;
|
|
2037
2039
|
}, "");
|
|
2038
|
-
if (
|
|
2039
|
-
E =
|
|
2040
|
+
if (R === T)
|
|
2041
|
+
E = v;
|
|
2040
2042
|
else
|
|
2041
2043
|
break;
|
|
2042
2044
|
}
|
|
2043
|
-
for (let
|
|
2044
|
-
const { height:
|
|
2045
|
-
|
|
2045
|
+
for (let v = w; v < e; v++) {
|
|
2046
|
+
const { height: S } = this.positions[v];
|
|
2047
|
+
y += S;
|
|
2046
2048
|
}
|
|
2047
|
-
for (let
|
|
2048
|
-
const { height:
|
|
2049
|
-
|
|
2050
|
-
const T = this.rowIndexRowKeyMap.get(
|
|
2049
|
+
for (let v = w; v <= E; v++) {
|
|
2050
|
+
const { height: S } = this.positions[v];
|
|
2051
|
+
_ += S;
|
|
2052
|
+
const T = this.rowIndexRowKeyMap.get(v) || "", { item: M } = this.rowKeyMap.get(T), O = this.getItemValue(T, i);
|
|
2051
2053
|
b.push({
|
|
2052
2054
|
rowKey: T,
|
|
2053
2055
|
key: i,
|
|
2054
|
-
value:
|
|
2056
|
+
value: O,
|
|
2055
2057
|
row: M
|
|
2056
2058
|
});
|
|
2057
2059
|
}
|
|
2058
2060
|
}
|
|
2059
2061
|
if (x !== 1 && m) {
|
|
2060
|
-
|
|
2061
|
-
for (let
|
|
2062
|
-
const
|
|
2063
|
-
if (!
|
|
2062
|
+
_ = f;
|
|
2063
|
+
for (let R = a - 1; R >= 0; R--) {
|
|
2064
|
+
const v = this.getColumnByColIndex(R);
|
|
2065
|
+
if (!v)
|
|
2064
2066
|
break;
|
|
2065
|
-
const
|
|
2066
|
-
if (
|
|
2067
|
-
p =
|
|
2067
|
+
const S = this.getItemValue(s, i), T = this.getItemValue(s, v.key);
|
|
2068
|
+
if (S === T && h.includes(v.key))
|
|
2069
|
+
p = R;
|
|
2068
2070
|
else
|
|
2069
2071
|
break;
|
|
2070
2072
|
}
|
|
2071
|
-
for (let
|
|
2072
|
-
const
|
|
2073
|
-
if (!
|
|
2073
|
+
for (let R = a; R <= this.ctx.maxColIndex; R++) {
|
|
2074
|
+
const v = this.getColumnByColIndex(R);
|
|
2075
|
+
if (!v)
|
|
2074
2076
|
break;
|
|
2075
|
-
const
|
|
2076
|
-
if (
|
|
2077
|
-
|
|
2077
|
+
const S = this.getItemValue(s, i), T = this.getItemValue(s, v.key);
|
|
2078
|
+
if (S === T && h.includes(v.key))
|
|
2079
|
+
C = R;
|
|
2078
2080
|
else
|
|
2079
2081
|
break;
|
|
2080
2082
|
}
|
|
2081
|
-
for (let
|
|
2082
|
-
const
|
|
2083
|
-
if (!
|
|
2083
|
+
for (let R = p; R < a; R++) {
|
|
2084
|
+
const v = this.getColumnByColIndex(R);
|
|
2085
|
+
if (!v)
|
|
2084
2086
|
break;
|
|
2085
|
-
|
|
2087
|
+
I += v.width || 100;
|
|
2086
2088
|
}
|
|
2087
|
-
for (let
|
|
2088
|
-
const
|
|
2089
|
-
if (!
|
|
2089
|
+
for (let R = p; R <= C; R++) {
|
|
2090
|
+
const v = this.getColumnByColIndex(R);
|
|
2091
|
+
if (!v)
|
|
2090
2092
|
break;
|
|
2091
|
-
|
|
2093
|
+
L += v.width || 100, b.push({
|
|
2092
2094
|
rowKey: s,
|
|
2093
|
-
key:
|
|
2094
|
-
value: this.getItemValue(s,
|
|
2095
|
+
key: v.key,
|
|
2096
|
+
value: this.getItemValue(s, v.key),
|
|
2095
2097
|
row: o
|
|
2096
2098
|
});
|
|
2097
2099
|
}
|
|
2098
2100
|
}
|
|
2099
2101
|
return {
|
|
2100
|
-
xArr: [p,
|
|
2102
|
+
xArr: [p, C],
|
|
2101
2103
|
yArr: [w, E],
|
|
2102
2104
|
rowspan: d,
|
|
2103
2105
|
colspan: x,
|
|
2104
|
-
height:
|
|
2105
|
-
width:
|
|
2106
|
-
offsetTop:
|
|
2107
|
-
offsetLeft:
|
|
2106
|
+
height: _,
|
|
2107
|
+
width: L,
|
|
2108
|
+
offsetTop: y,
|
|
2109
|
+
offsetLeft: I,
|
|
2108
2110
|
dataList: b
|
|
2109
2111
|
};
|
|
2110
2112
|
}
|
|
@@ -2524,7 +2526,7 @@ class _e {
|
|
|
2524
2526
|
* @returns 是否溢出
|
|
2525
2527
|
*/
|
|
2526
2528
|
drawText(t = "", e, i, s, o, r = {}) {
|
|
2527
|
-
var
|
|
2529
|
+
var v;
|
|
2528
2530
|
this.ctx.save();
|
|
2529
2531
|
const {
|
|
2530
2532
|
font: a = "12px Arial",
|
|
@@ -2539,42 +2541,42 @@ class _e {
|
|
|
2539
2541
|
} = r;
|
|
2540
2542
|
if (this.ctx.font = a, this.ctx.fillStyle = h, this.ctx.textAlign = l, ["", null, void 0].includes(t))
|
|
2541
2543
|
return this.ctx.restore(), !1;
|
|
2542
|
-
const E = parseInt(((
|
|
2543
|
-
let
|
|
2544
|
+
const E = parseInt(((v = a.match(/\d+/)) == null ? void 0 : v[0]) || "12") * (r.lineHeight || 1.2), p = s - d * 2 - g - m;
|
|
2545
|
+
let C = !1;
|
|
2544
2546
|
const b = Math.round((o - 2 * d) / E);
|
|
2545
|
-
let
|
|
2546
|
-
u === "auto" && x ?
|
|
2547
|
-
let
|
|
2548
|
-
const
|
|
2549
|
-
f === "middle" ?
|
|
2550
|
-
let
|
|
2551
|
-
l === "center" ?
|
|
2552
|
-
for (let
|
|
2553
|
-
const T =
|
|
2554
|
-
if (this.ctx.textBaseline = "top",
|
|
2555
|
-
const A =
|
|
2556
|
-
this.ctx.fillText(H,
|
|
2547
|
+
let y = this.wrapText(t, p, r.cacheTextKey), I = Math.min(y.length, Math.max(b, 1));
|
|
2548
|
+
u === "auto" && x ? I = y.length : typeof u == "number" && u < I && u !== 1 ? I = u : (u === 1 && (y = [t], I = 1), u === "auto" && b === 1 && (y = [t], I = 1));
|
|
2549
|
+
let _ = i + d;
|
|
2550
|
+
const L = Math.round(I * E);
|
|
2551
|
+
f === "middle" ? _ = i + (o - L) / 2 : f === "bottom" && (_ = i + o - L - d);
|
|
2552
|
+
let R = e + d + g;
|
|
2553
|
+
l === "center" ? R = e + s / 2 : l === "right" && (R = e + s - d - m);
|
|
2554
|
+
for (let S = 0; S < y.length; S++) {
|
|
2555
|
+
const T = y[S], M = _ + S * E;
|
|
2556
|
+
if (this.ctx.textBaseline = "top", S === I - 1) {
|
|
2557
|
+
const A = y.slice(S).join(""), { _text: H, ellipsis: D } = this.handleEllipsis(A, s, d, a);
|
|
2558
|
+
this.ctx.fillText(H, R, M), C = D;
|
|
2557
2559
|
break;
|
|
2558
2560
|
}
|
|
2559
|
-
this.ctx.fillText(T,
|
|
2561
|
+
this.ctx.fillText(T, R, M);
|
|
2560
2562
|
}
|
|
2561
|
-
if (r.textCallback &&
|
|
2562
|
-
const
|
|
2563
|
-
let M =
|
|
2564
|
-
l === "center" ? (M =
|
|
2563
|
+
if (r.textCallback && y.length) {
|
|
2564
|
+
const S = y.reduce((H, D) => Math.max(H, this.ctx.measureText(D).width), 0), T = Math.round(S);
|
|
2565
|
+
let M = R, O = R + T;
|
|
2566
|
+
l === "center" ? (M = R - T / 2, O = R + T / 2) : l === "right" && (M = R - T, O = R);
|
|
2565
2567
|
const A = {
|
|
2566
|
-
x:
|
|
2567
|
-
y:
|
|
2568
|
+
x: R,
|
|
2569
|
+
y: _,
|
|
2568
2570
|
width: T,
|
|
2569
|
-
height:
|
|
2571
|
+
height: L,
|
|
2570
2572
|
left: M,
|
|
2571
|
-
right:
|
|
2572
|
-
top:
|
|
2573
|
-
bottom:
|
|
2573
|
+
right: O,
|
|
2574
|
+
top: _,
|
|
2575
|
+
bottom: _ + L
|
|
2574
2576
|
};
|
|
2575
2577
|
r.textCallback(A);
|
|
2576
2578
|
}
|
|
2577
|
-
return this.ctx.restore(),
|
|
2579
|
+
return this.ctx.restore(), C;
|
|
2578
2580
|
}
|
|
2579
2581
|
/**
|
|
2580
2582
|
* 将文本按宽度换行
|
|
@@ -3000,6 +3002,10 @@ class Nt {
|
|
|
3000
3002
|
n(this, "BEFORE_SET_SELECTOR_METHOD");
|
|
3001
3003
|
/** 设置填充器前回调 */
|
|
3002
3004
|
n(this, "BEFORE_SET_AUTOFILL_METHOD");
|
|
3005
|
+
/** 自定义表头右键菜单 */
|
|
3006
|
+
n(this, "BEFORE_HEADER_CONTEXT_MENU_METHOD");
|
|
3007
|
+
/** 自定义BODY右键菜单 */
|
|
3008
|
+
n(this, "BEFORE_BODY_CONTEXT_MENU_METHOD");
|
|
3003
3009
|
/** 数据复制前回调 */
|
|
3004
3010
|
n(this, "BEFORE_COPY_METHOD");
|
|
3005
3011
|
this._config = t, this.updateCssVar();
|
|
@@ -3235,7 +3241,8 @@ class mt extends qt {
|
|
|
3235
3241
|
n(this, "drawSortImageHeight", 0);
|
|
3236
3242
|
n(this, "drawSortImageName", "");
|
|
3237
3243
|
n(this, "drawSortImageSource");
|
|
3238
|
-
|
|
3244
|
+
n(this, "renderHeaderType", "default");
|
|
3245
|
+
this.ctx = e, this.x = s, this.y = o, this.width = r, this.height = a, this.visibleWidth = r, this.visibleHeight = a, this.colIndex = i, this.key = l.key, this.minWidth = l.minWidth, this.maxWidth = l.maxWidth, this.hide = (typeof l.hide == "function" ? l.hide(l) : l.hide) || !1, this.type = l.type || "", this.editorType = l.editorType || "text", this.hideHeaderSelection = l.hideHeaderSelection || !1, this.align = l.headerAlign || l.align || this.ctx.config.COLUMNS_ALIGN, this.verticalAlign = l.headerVerticalAlign || l.verticalAlign || this.ctx.config.COLUMNS_VERTICAL_ALIGN, this.fixed = l.fixed || "", this.level = l.level || 0, this.operation = l.operation || !1, this.text = l.title, this.column = l, this.colspan = l.colspan || 1, this.widthFillDisable = l.widthFillDisable || !1, this.rowspan = l.rowspan || 1, this.rules = l.rules, this.readonly = l.readonly || !1, this.required = l.required || !1, this.sortIconName = l.sortIconName || "sort-default", this.sortAscIconName = l.sortAscIconName || "sort-asc", this.sortDescIconName = l.sortDescIconName || "sort-desc", this.rowKey = $t(), this.overflowTooltipShow = l.overflowTooltipHeaderShow !== !1, this.hasChildren = l.children && l.children.length > 0 || !1, this.render = l.renderHeader, this.maxLineClampHeader = l.maxLineClampHeader || "auto", this.renderHeaderType = l.renderHeaderType || "default";
|
|
3239
3246
|
}
|
|
3240
3247
|
/**
|
|
3241
3248
|
* 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
|
|
@@ -3362,7 +3369,7 @@ class mt extends qt {
|
|
|
3362
3369
|
));
|
|
3363
3370
|
}
|
|
3364
3371
|
getText() {
|
|
3365
|
-
return this.render || ["", null, void 0].includes(this.text) ? "" : `${this.text}`;
|
|
3372
|
+
return this.render && this.renderHeaderType === "default" || ["", null, void 0].includes(this.text) ? "" : `${this.text}`;
|
|
3366
3373
|
}
|
|
3367
3374
|
/**
|
|
3368
3375
|
* 获取样式
|
|
@@ -4724,28 +4731,28 @@ class Ne {
|
|
|
4724
4731
|
let w = this.height + e.height + r;
|
|
4725
4732
|
w += m;
|
|
4726
4733
|
let E = w;
|
|
4727
|
-
const p = window.innerHeight, { top:
|
|
4728
|
-
if (p >
|
|
4729
|
-
const T = p -
|
|
4734
|
+
const p = window.innerHeight, { top: C } = this.containerRect || this.ctx.containerElement.getBoundingClientRect();
|
|
4735
|
+
if (p > C && d && !a) {
|
|
4736
|
+
const T = p - C - f;
|
|
4730
4737
|
T > e.height + r ? E = T : w > h && (E = h);
|
|
4731
4738
|
} else this.data.length && a ? E = a : this.data.length && h && w > h && (E = h);
|
|
4732
4739
|
E > 0 && (this.ctx.stageHeight = Math.floor(E), this.ctx.stageElement.style.height = `${this.ctx.stageHeight}px`);
|
|
4733
4740
|
let b = this.ctx.stageHeight - e.height - r;
|
|
4734
4741
|
o ? this.visibleHeight = b - m : this.visibleHeight = b, this.data.length || (this.height = this.visibleHeight), this.ctx.body.x = this.x, this.ctx.body.y = this.y, this.ctx.body.width = this.width, this.ctx.body.height = this.height, this.ctx.body.visibleWidth = this.visibleWidth, this.ctx.body.visibleHeight = this.visibleHeight, this.ctx.body.data = x;
|
|
4735
|
-
const
|
|
4736
|
-
t.width = Math.round(
|
|
4737
|
-
const
|
|
4742
|
+
const y = window.devicePixelRatio || 1, I = this.ctx.stageWidth * y, _ = this.ctx.stageHeight * y;
|
|
4743
|
+
t.width = Math.round(I), t.height = Math.round(_);
|
|
4744
|
+
const L = this.data.length ? "not-empty" : "empty";
|
|
4738
4745
|
this.ctx.emit("emptyChange", {
|
|
4739
|
-
isEmpty:
|
|
4740
|
-
type:
|
|
4746
|
+
isEmpty: L,
|
|
4747
|
+
type: L,
|
|
4741
4748
|
headerHeight: e.height,
|
|
4742
4749
|
bodyHeight: this.height,
|
|
4743
4750
|
footerHeight: m,
|
|
4744
4751
|
width: this.width,
|
|
4745
4752
|
height: this.data.length ? 0 : l + m
|
|
4746
4753
|
});
|
|
4747
|
-
const
|
|
4748
|
-
this.ctx.canvasElement.setAttribute("style", `height:${
|
|
4754
|
+
const R = Math.round(t.width / y * 1e4) / 1e4, v = Math.round(t.height / y * 1e4) / 1e4;
|
|
4755
|
+
this.ctx.canvasElement.setAttribute("style", `height:${v}px;width:${R}px;`), this.ctx.paint.scale(y);
|
|
4749
4756
|
}
|
|
4750
4757
|
// 调整行的高度
|
|
4751
4758
|
initResizeRow() {
|
|
@@ -5101,26 +5108,26 @@ class Be {
|
|
|
5101
5108
|
SELECTOR_AREA_MAX_X_OFFSET: f,
|
|
5102
5109
|
SELECTOR_AREA_MAX_Y_OFFSET: u
|
|
5103
5110
|
} = this.ctx.config, x = a, g = l || this.ctx.maxColIndex - f, m = h, w = d || this.ctx.maxRowIndex - u;
|
|
5104
|
-
let [E, p] = o, [
|
|
5105
|
-
if (E < x || p > g ||
|
|
5111
|
+
let [E, p] = o, [C, b] = r;
|
|
5112
|
+
if (E < x || p > g || C < m || b > w)
|
|
5106
5113
|
return;
|
|
5107
5114
|
if (this.ctx.config.ENABLE_MERGE_CELL_LINK) {
|
|
5108
|
-
const
|
|
5109
|
-
|
|
5115
|
+
const I = this.adjustMergeCells(o, r);
|
|
5116
|
+
C = I.yArr[0], b = I.yArr[1], E = I.xArr[0], p = I.xArr[1], this.ctx.onlyMergeCell = I.onlyMergeCell;
|
|
5110
5117
|
}
|
|
5111
|
-
E === p &&
|
|
5112
|
-
const { BEFORE_SET_SELECTOR_METHOD:
|
|
5113
|
-
if (typeof
|
|
5114
|
-
const
|
|
5118
|
+
E === p && C === b ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, o = [Math.max(x, E), Math.min(g, p)], r = [Math.max(m, C), Math.min(w, b)];
|
|
5119
|
+
const { BEFORE_SET_SELECTOR_METHOD: y } = this.ctx.config;
|
|
5120
|
+
if (typeof y == "function") {
|
|
5121
|
+
const _ = y({
|
|
5115
5122
|
focusCell: this.ctx.focusCell,
|
|
5116
5123
|
xArr: o,
|
|
5117
5124
|
yArr: r
|
|
5118
5125
|
});
|
|
5119
|
-
if (!
|
|
5126
|
+
if (!_)
|
|
5120
5127
|
return;
|
|
5121
|
-
o =
|
|
5128
|
+
o = _.xArr, r = _.yArr;
|
|
5122
5129
|
}
|
|
5123
|
-
this.ctx.selector.xArr = o, this.ctx.selector.yArr = r, b === this.ctx.maxRowIndex &&
|
|
5130
|
+
this.ctx.selector.xArr = o, this.ctx.selector.yArr = r, b === this.ctx.maxRowIndex && C === 0 ? this.ctx.selectColsIng = !0 : this.ctx.selectColsIng = !1, p === this.ctx.maxColIndex && E === 0 ? this.ctx.selectRowsIng = !0 : this.ctx.selectRowsIng = !1, this.ctx.emit("setSelector", this.ctx.selector), this.ctx.emit("drawView");
|
|
5124
5131
|
}
|
|
5125
5132
|
}
|
|
5126
5133
|
adjustMergeCells(t, e) {
|
|
@@ -5135,13 +5142,13 @@ class Be {
|
|
|
5135
5142
|
let a = [], l = [];
|
|
5136
5143
|
for (let m = 0; m <= e[1] - e[0]; m++)
|
|
5137
5144
|
for (let w = 0; w <= t[1] - t[0]; w++) {
|
|
5138
|
-
const E = m + e[0], p = w + t[0],
|
|
5139
|
-
|
|
5145
|
+
const E = m + e[0], p = w + t[0], C = this.ctx.database.getVirtualBodyCell(E, p);
|
|
5146
|
+
C && ((E === i || E === s) && a.push(C), (p === o || p === r) && l.push(C));
|
|
5140
5147
|
}
|
|
5141
5148
|
const h = a.reduce(
|
|
5142
5149
|
(m, w) => {
|
|
5143
|
-
const { yArr: E } = w.getSpanInfo(), [p,
|
|
5144
|
-
return m.minY = Math.min(m.minY, p), m.maxY = Math.max(m.maxY,
|
|
5150
|
+
const { yArr: E } = w.getSpanInfo(), [p, C] = E;
|
|
5151
|
+
return m.minY = Math.min(m.minY, p), m.maxY = Math.max(m.maxY, C), m;
|
|
5145
5152
|
},
|
|
5146
5153
|
{
|
|
5147
5154
|
minY: i,
|
|
@@ -5149,8 +5156,8 @@ class Be {
|
|
|
5149
5156
|
}
|
|
5150
5157
|
), d = l.reduce(
|
|
5151
5158
|
(m, w) => {
|
|
5152
|
-
const { xArr: E } = w.getSpanInfo(), [p,
|
|
5153
|
-
return m.minX = Math.min(m.minX, p), m.maxX = Math.max(m.maxX,
|
|
5159
|
+
const { xArr: E } = w.getSpanInfo(), [p, C] = E;
|
|
5160
|
+
return m.minX = Math.min(m.minX, p), m.maxX = Math.max(m.maxX, C), m;
|
|
5154
5161
|
},
|
|
5155
5162
|
{
|
|
5156
5163
|
minX: o,
|
|
@@ -5345,27 +5352,27 @@ class Be {
|
|
|
5345
5352
|
});
|
|
5346
5353
|
const m = r.length === 1 && r[0].length === 1;
|
|
5347
5354
|
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a, l) && !m) {
|
|
5348
|
-
const
|
|
5355
|
+
const C = {
|
|
5349
5356
|
code: "ERR_MERGED_CELLS_PASTE",
|
|
5350
5357
|
message: "Merged cells cannot span paste data"
|
|
5351
5358
|
};
|
|
5352
|
-
this.ctx.hasEvent("error") ? this.ctx.emit("error",
|
|
5359
|
+
this.ctx.hasEvent("error") ? this.ctx.emit("error", C) : alert(C.message);
|
|
5353
5360
|
return;
|
|
5354
5361
|
}
|
|
5355
5362
|
let w = [];
|
|
5356
|
-
for (let
|
|
5357
|
-
const b = r[
|
|
5358
|
-
for (let
|
|
5359
|
-
const
|
|
5360
|
-
|
|
5361
|
-
|
|
5363
|
+
for (let C = 0; C <= r.length - 1; C++) {
|
|
5364
|
+
const b = r[C].length;
|
|
5365
|
+
for (let y = 0; y <= b - 1; y++) {
|
|
5366
|
+
const I = C + e, _ = y + i, L = r[C][y], R = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
5367
|
+
I,
|
|
5368
|
+
_
|
|
5362
5369
|
);
|
|
5363
|
-
if (
|
|
5364
|
-
const { rowKey:
|
|
5365
|
-
this.ctx.database.getReadonly(
|
|
5366
|
-
rowKey:
|
|
5367
|
-
key:
|
|
5368
|
-
value:
|
|
5370
|
+
if (R) {
|
|
5371
|
+
const { rowKey: v, key: S } = R;
|
|
5372
|
+
this.ctx.database.getReadonly(v, S) || (s.add(v), w.push({
|
|
5373
|
+
rowKey: v,
|
|
5374
|
+
key: S,
|
|
5375
|
+
value: L,
|
|
5369
5376
|
row: {}
|
|
5370
5377
|
//内部有设置
|
|
5371
5378
|
}));
|
|
@@ -5373,34 +5380,34 @@ class Be {
|
|
|
5373
5380
|
}
|
|
5374
5381
|
}
|
|
5375
5382
|
if (this.isCut) {
|
|
5376
|
-
const
|
|
5383
|
+
const C = this.clearSelectedData(
|
|
5377
5384
|
this.ctx.selector.xArrCopy,
|
|
5378
5385
|
this.ctx.selector.yArrCopy,
|
|
5379
5386
|
!0
|
|
5380
5387
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
5381
|
-
), b = w.map((
|
|
5382
|
-
|
|
5383
|
-
b.includes(`${
|
|
5388
|
+
), b = w.map((y) => `${y.rowKey}-${y.key}`);
|
|
5389
|
+
C.forEach((y) => {
|
|
5390
|
+
b.includes(`${y.rowKey}-${y.key}`) || w.unshift(y);
|
|
5384
5391
|
}), this.isCut = !1;
|
|
5385
5392
|
}
|
|
5386
5393
|
if (!w.length)
|
|
5387
5394
|
return;
|
|
5388
5395
|
const { BEFORE_PASTE_DATA_METHOD: E } = this.ctx.config;
|
|
5389
5396
|
if (typeof E == "function") {
|
|
5390
|
-
const
|
|
5391
|
-
rowKey:
|
|
5392
|
-
key:
|
|
5393
|
-
value:
|
|
5394
|
-
oldValue: this.ctx.database.getItemValue(
|
|
5395
|
-
row: this.ctx.database.getRowDataItemForRowKey(
|
|
5397
|
+
const C = E, b = w.map((y) => ({
|
|
5398
|
+
rowKey: y.rowKey,
|
|
5399
|
+
key: y.key,
|
|
5400
|
+
value: y.value,
|
|
5401
|
+
oldValue: this.ctx.database.getItemValue(y.rowKey, y.key),
|
|
5402
|
+
row: this.ctx.database.getRowDataItemForRowKey(y.rowKey)
|
|
5396
5403
|
}));
|
|
5397
|
-
if (w = await
|
|
5404
|
+
if (w = await C(b, a, l, r), w && !w.length)
|
|
5398
5405
|
return;
|
|
5399
5406
|
}
|
|
5400
5407
|
this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(w, !0);
|
|
5401
5408
|
let p = [];
|
|
5402
|
-
s.forEach((
|
|
5403
|
-
p.push(this.ctx.database.getRowDataItemForRowKey(
|
|
5409
|
+
s.forEach((C) => {
|
|
5410
|
+
p.push(this.ctx.database.getRowDataItemForRowKey(C));
|
|
5404
5411
|
}), this.ctx.emit("pasteChange", w, p), this.ctx.emit("draw");
|
|
5405
5412
|
}).catch((o) => {
|
|
5406
5413
|
console.error("Failed to get the clipboard content:", o);
|
|
@@ -5467,14 +5474,14 @@ class Be {
|
|
|
5467
5474
|
if (!i)
|
|
5468
5475
|
return;
|
|
5469
5476
|
g && this.ctx.onlyMergeCell && i.updateSpanInfo();
|
|
5470
|
-
const { drawX: m, drawY: w, width: E, height: p, fixed:
|
|
5471
|
-
let
|
|
5472
|
-
|
|
5473
|
-
let
|
|
5474
|
-
u && (x === "top" ?
|
|
5475
|
-
const
|
|
5476
|
-
let
|
|
5477
|
-
|
|
5477
|
+
const { drawX: m, drawY: w, width: E, height: p, fixed: C } = i, b = o - m + 1, y = i.drawX + E - (e - s) + 1;
|
|
5478
|
+
let I = r.height - w, _ = p;
|
|
5479
|
+
_ > l.visibleHeight && (_ = l.visibleHeight);
|
|
5480
|
+
let L = 0;
|
|
5481
|
+
u && (x === "top" ? I = r.height + a.height - w : L = a.visibleHeight);
|
|
5482
|
+
const R = w + _ - (t - L - f);
|
|
5483
|
+
let v = h, S = d;
|
|
5484
|
+
y > 0 && !C ? v = Math.floor(h + y) : b > 0 && !C && (v = Math.floor(h - b)), I > 0 ? S = Math.floor(d - I) : R > 0 && (S = Math.floor(d + R)), (Math.abs(h - v) > 2.5 || Math.abs(d - S) > 2.5) && this.ctx.setScroll(v, S);
|
|
5478
5485
|
}
|
|
5479
5486
|
destroy() {
|
|
5480
5487
|
}
|
|
@@ -5532,21 +5539,21 @@ class Xe {
|
|
|
5532
5539
|
SELECTOR_AREA_MAX_Y: x,
|
|
5533
5540
|
SELECTOR_AREA_MAX_X_OFFSET: g,
|
|
5534
5541
|
SELECTOR_AREA_MAX_Y_OFFSET: m
|
|
5535
|
-
} = this.ctx.config, w = d, E = f || this.ctx.maxColIndex - g, p = u,
|
|
5536
|
-
let [b,
|
|
5537
|
-
if (b < w ||
|
|
5542
|
+
} = this.ctx.config, w = d, E = f || this.ctx.maxColIndex - g, p = u, C = x || this.ctx.maxRowIndex - m;
|
|
5543
|
+
let [b, y] = r, [I, _] = a;
|
|
5544
|
+
if (b < w || I < p)
|
|
5538
5545
|
return;
|
|
5539
|
-
r = [Math.max(w, b), Math.min(E,
|
|
5540
|
-
const { BEFORE_SET_AUTOFILL_METHOD:
|
|
5541
|
-
if (typeof
|
|
5542
|
-
const
|
|
5546
|
+
r = [Math.max(w, b), Math.min(E, y)], a = [Math.max(p, I), Math.min(C, _)];
|
|
5547
|
+
const { BEFORE_SET_AUTOFILL_METHOD: L } = this.ctx.config;
|
|
5548
|
+
if (typeof L == "function") {
|
|
5549
|
+
const v = L({
|
|
5543
5550
|
focusCell: this.ctx.focusCell,
|
|
5544
5551
|
xArr: r,
|
|
5545
5552
|
yArr: a
|
|
5546
5553
|
});
|
|
5547
|
-
if (!
|
|
5554
|
+
if (!v)
|
|
5548
5555
|
return;
|
|
5549
|
-
r =
|
|
5556
|
+
r = v.xArr, a = v.yArr;
|
|
5550
5557
|
}
|
|
5551
5558
|
this.ctx.autofill.xArr = r, this.ctx.autofill.yArr = a, this.ctx.emit("setAutofill", this.ctx.autofill), this.ctx.emit("draw");
|
|
5552
5559
|
}
|
|
@@ -5573,12 +5580,12 @@ class Xe {
|
|
|
5573
5580
|
let d = [];
|
|
5574
5581
|
for (let x = 0; x <= l[1] - l[0]; x++)
|
|
5575
5582
|
for (let g = 0; g <= a[1] - a[0]; g++) {
|
|
5576
|
-
const m = g + a[0], w = x + l[0], E = s[x % r][g % o], p = this.ctx.database.getItemValueForRowIndexAndColIndex(w, m),
|
|
5577
|
-
if (p && !i.has(
|
|
5578
|
-
const { rowKey: b, key:
|
|
5579
|
-
this.ctx.database.getReadonly(b,
|
|
5583
|
+
const m = g + a[0], w = x + l[0], E = s[x % r][g % o], p = this.ctx.database.getItemValueForRowIndexAndColIndex(w, m), C = `${w}-${m}`;
|
|
5584
|
+
if (p && !i.has(C)) {
|
|
5585
|
+
const { rowKey: b, key: y } = p;
|
|
5586
|
+
this.ctx.database.getReadonly(b, y) || (t.add(b), d.push({
|
|
5580
5587
|
rowKey: b,
|
|
5581
|
-
key:
|
|
5588
|
+
key: y,
|
|
5582
5589
|
value: E,
|
|
5583
5590
|
row: {}
|
|
5584
5591
|
}));
|
|
@@ -5792,9 +5799,9 @@ const je = async (c, t, e) => {
|
|
|
5792
5799
|
fn: E
|
|
5793
5800
|
} = a[m], {
|
|
5794
5801
|
x: p,
|
|
5795
|
-
y,
|
|
5802
|
+
y: C,
|
|
5796
5803
|
data: b,
|
|
5797
|
-
reset:
|
|
5804
|
+
reset: y
|
|
5798
5805
|
} = await E({
|
|
5799
5806
|
x: d,
|
|
5800
5807
|
y: f,
|
|
@@ -5809,17 +5816,17 @@ const je = async (c, t, e) => {
|
|
|
5809
5816
|
floating: t
|
|
5810
5817
|
}
|
|
5811
5818
|
});
|
|
5812
|
-
d = p ?? d, f =
|
|
5819
|
+
d = p ?? d, f = C ?? f, x = {
|
|
5813
5820
|
...x,
|
|
5814
5821
|
[w]: {
|
|
5815
5822
|
...x[w],
|
|
5816
5823
|
...b
|
|
5817
5824
|
}
|
|
5818
|
-
},
|
|
5825
|
+
}, y && g <= 50 && (g++, typeof y == "object" && (y.placement && (u = y.placement), y.rects && (h = y.rects === !0 ? await r.getElementRects({
|
|
5819
5826
|
reference: c,
|
|
5820
5827
|
floating: t,
|
|
5821
5828
|
strategy: s
|
|
5822
|
-
}) :
|
|
5829
|
+
}) : y.rects), {
|
|
5823
5830
|
x: d,
|
|
5824
5831
|
y: f
|
|
5825
5832
|
} = Ft(h, u, l)), m = -1);
|
|
@@ -5858,23 +5865,23 @@ async function ee(c, t) {
|
|
|
5858
5865
|
y: s,
|
|
5859
5866
|
width: r.floating.width,
|
|
5860
5867
|
height: r.floating.height
|
|
5861
|
-
} : r.reference,
|
|
5868
|
+
} : r.reference, C = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(a.floating)), b = await (o.isElement == null ? void 0 : o.isElement(C)) ? await (o.getScale == null ? void 0 : o.getScale(C)) || {
|
|
5862
5869
|
x: 1,
|
|
5863
5870
|
y: 1
|
|
5864
5871
|
} : {
|
|
5865
5872
|
x: 1,
|
|
5866
5873
|
y: 1
|
|
5867
|
-
},
|
|
5874
|
+
}, y = ht(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
5868
5875
|
elements: a,
|
|
5869
5876
|
rect: p,
|
|
5870
|
-
offsetParent:
|
|
5877
|
+
offsetParent: C,
|
|
5871
5878
|
strategy: l
|
|
5872
5879
|
}) : p);
|
|
5873
5880
|
return {
|
|
5874
|
-
top: (E.top -
|
|
5875
|
-
bottom: (
|
|
5876
|
-
left: (E.left -
|
|
5877
|
-
right: (
|
|
5881
|
+
top: (E.top - y.top + g.top) / b.y,
|
|
5882
|
+
bottom: (y.bottom - E.bottom + g.bottom) / b.y,
|
|
5883
|
+
left: (E.left - y.left + g.left) / b.x,
|
|
5884
|
+
right: (y.right - E.right + g.right) / b.x
|
|
5878
5885
|
};
|
|
5879
5886
|
}
|
|
5880
5887
|
const qe = (c) => ({
|
|
@@ -5898,15 +5905,15 @@ const qe = (c) => ({
|
|
|
5898
5905
|
const f = te(d), u = {
|
|
5899
5906
|
x: e,
|
|
5900
5907
|
y: i
|
|
5901
|
-
}, x = _t(s), g = Rt(x), m = await r.getDimensions(h), w = x === "y", E = w ? "top" : "left", p = w ? "bottom" : "right",
|
|
5902
|
-
let
|
|
5903
|
-
(!
|
|
5904
|
-
const
|
|
5908
|
+
}, x = _t(s), g = Rt(x), m = await r.getDimensions(h), w = x === "y", E = w ? "top" : "left", p = w ? "bottom" : "right", C = w ? "clientHeight" : "clientWidth", b = o.reference[g] + o.reference[x] - u[x] - o.floating[g], y = u[x] - o.reference[x], I = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(h));
|
|
5909
|
+
let _ = I ? I[C] : 0;
|
|
5910
|
+
(!_ || !await (r.isElement == null ? void 0 : r.isElement(I))) && (_ = a.floating[C] || o.floating[g]);
|
|
5911
|
+
const L = b / 2 - y / 2, R = _ / 2 - m[g] / 2 - 1, v = j(f[E], R), S = j(f[p], R), T = v, M = _ - m[g] - S, O = _ / 2 - m[g] / 2 + L, A = Et(T, O, M), H = !l.arrow && et(s) != null && O !== A && o.reference[g] / 2 - (O < T ? v : S) - m[g] / 2 < 0, D = H ? O < T ? O - T : O - M : 0;
|
|
5905
5912
|
return {
|
|
5906
5913
|
[x]: u[x] + D,
|
|
5907
5914
|
data: {
|
|
5908
5915
|
[x]: A,
|
|
5909
|
-
centerOffset:
|
|
5916
|
+
centerOffset: O - A - D,
|
|
5910
5917
|
...H && {
|
|
5911
5918
|
alignmentOffset: D
|
|
5912
5919
|
}
|
|
@@ -5938,39 +5945,39 @@ const qe = (c) => ({
|
|
|
5938
5945
|
} = tt(c, t);
|
|
5939
5946
|
if ((e = o.arrow) != null && e.alignmentOffset)
|
|
5940
5947
|
return {};
|
|
5941
|
-
const E = $(s), p = V(a),
|
|
5942
|
-
!u &&
|
|
5943
|
-
const
|
|
5944
|
-
let
|
|
5945
|
-
if (d &&
|
|
5946
|
-
const
|
|
5947
|
-
|
|
5948
|
+
const E = $(s), p = V(a), C = $(a) === a, b = await (l.isRTL == null ? void 0 : l.isRTL(h.floating)), y = u || (C || !m ? [lt(a)] : Ve(a)), I = g !== "none";
|
|
5949
|
+
!u && I && y.push(...Ge(a, m, g, b));
|
|
5950
|
+
const _ = [a, ...y], L = await ee(t, w), R = [];
|
|
5951
|
+
let v = ((i = o.flip) == null ? void 0 : i.overflows) || [];
|
|
5952
|
+
if (d && R.push(L[E]), f) {
|
|
5953
|
+
const O = We(s, r, b);
|
|
5954
|
+
R.push(L[O[0]], L[O[1]]);
|
|
5948
5955
|
}
|
|
5949
|
-
if (
|
|
5956
|
+
if (v = [...v, {
|
|
5950
5957
|
placement: s,
|
|
5951
|
-
overflows:
|
|
5952
|
-
}], !
|
|
5953
|
-
var
|
|
5954
|
-
const
|
|
5958
|
+
overflows: R
|
|
5959
|
+
}], !R.every((O) => O <= 0)) {
|
|
5960
|
+
var S, T;
|
|
5961
|
+
const O = (((S = o.flip) == null ? void 0 : S.index) || 0) + 1, A = _[O];
|
|
5955
5962
|
if (A && (!(f === "alignment" ? p !== V(A) : !1) || // We leave the current main axis only if every placement on that axis
|
|
5956
5963
|
// overflows the main axis.
|
|
5957
|
-
|
|
5964
|
+
v.every((k) => V(k.placement) === p ? k.overflows[0] > 0 : !0)))
|
|
5958
5965
|
return {
|
|
5959
5966
|
data: {
|
|
5960
|
-
index:
|
|
5961
|
-
overflows:
|
|
5967
|
+
index: O,
|
|
5968
|
+
overflows: v
|
|
5962
5969
|
},
|
|
5963
5970
|
reset: {
|
|
5964
5971
|
placement: A
|
|
5965
5972
|
}
|
|
5966
5973
|
};
|
|
5967
|
-
let H = (T =
|
|
5974
|
+
let H = (T = v.filter((D) => D.overflows[0] <= 0).sort((D, k) => D.overflows[1] - k.overflows[1])[0]) == null ? void 0 : T.placement;
|
|
5968
5975
|
if (!H)
|
|
5969
5976
|
switch (x) {
|
|
5970
5977
|
case "bestFit": {
|
|
5971
5978
|
var M;
|
|
5972
|
-
const D = (M =
|
|
5973
|
-
if (
|
|
5979
|
+
const D = (M = v.filter((k) => {
|
|
5980
|
+
if (I) {
|
|
5974
5981
|
const W = V(k.placement);
|
|
5975
5982
|
return W === p || // Create a bias to the `y` side axis due to horizontal
|
|
5976
5983
|
// reading directions favoring greater width.
|
|
@@ -6076,12 +6083,12 @@ const ti = function(c) {
|
|
|
6076
6083
|
}, d = await ee(t, l), f = V($(s)), u = Qt(f);
|
|
6077
6084
|
let x = h[u], g = h[f];
|
|
6078
6085
|
if (o) {
|
|
6079
|
-
const w = u === "y" ? "top" : "left", E = u === "y" ? "bottom" : "right", p = x + d[w],
|
|
6080
|
-
x = Et(p, x,
|
|
6086
|
+
const w = u === "y" ? "top" : "left", E = u === "y" ? "bottom" : "right", p = x + d[w], C = x - d[E];
|
|
6087
|
+
x = Et(p, x, C);
|
|
6081
6088
|
}
|
|
6082
6089
|
if (r) {
|
|
6083
|
-
const w = f === "y" ? "top" : "left", E = f === "y" ? "bottom" : "right", p = g + d[w],
|
|
6084
|
-
g = Et(p, g,
|
|
6090
|
+
const w = f === "y" ? "top" : "left", E = f === "y" ? "bottom" : "right", p = g + d[w], C = g - d[E];
|
|
6091
|
+
g = Et(p, g, C);
|
|
6085
6092
|
}
|
|
6086
6093
|
const m = a.fn({
|
|
6087
6094
|
...t,
|
|
@@ -6266,8 +6273,8 @@ function G(c, t, e, i) {
|
|
|
6266
6273
|
const u = N(o), x = i && B(i) ? N(i) : i;
|
|
6267
6274
|
let g = u, m = yt(g);
|
|
6268
6275
|
for (; m && i && x !== g; ) {
|
|
6269
|
-
const w = U(m), E = m.getBoundingClientRect(), p = X(m),
|
|
6270
|
-
l *= w.x, h *= w.y, d *= w.x, f *= w.y, l +=
|
|
6276
|
+
const w = U(m), E = m.getBoundingClientRect(), p = X(m), C = E.left + (m.clientLeft + parseFloat(p.paddingLeft)) * w.x, b = E.top + (m.clientTop + parseFloat(p.paddingTop)) * w.y;
|
|
6277
|
+
l *= w.x, h *= w.y, d *= w.x, f *= w.y, l += C, h += b, g = N(m), m = yt(g);
|
|
6271
6278
|
}
|
|
6272
6279
|
}
|
|
6273
6280
|
return ht({
|
|
@@ -6522,30 +6529,30 @@ function _i(c, t) {
|
|
|
6522
6529
|
} = h;
|
|
6523
6530
|
if (a || t(), !u || !x)
|
|
6524
6531
|
return;
|
|
6525
|
-
const g = st(f), m = st(s.clientWidth - (d + u)), w = st(s.clientHeight - (f + x)), E = st(d),
|
|
6532
|
+
const g = st(f), m = st(s.clientWidth - (d + u)), w = st(s.clientHeight - (f + x)), E = st(d), C = {
|
|
6526
6533
|
rootMargin: -g + "px " + -m + "px " + -w + "px " + -E + "px",
|
|
6527
6534
|
threshold: z(0, j(1, l)) || 1
|
|
6528
6535
|
};
|
|
6529
6536
|
let b = !0;
|
|
6530
|
-
function
|
|
6531
|
-
const
|
|
6532
|
-
if (
|
|
6537
|
+
function y(I) {
|
|
6538
|
+
const _ = I[0].intersectionRatio;
|
|
6539
|
+
if (_ !== l) {
|
|
6533
6540
|
if (!b)
|
|
6534
6541
|
return r();
|
|
6535
|
-
|
|
6542
|
+
_ ? r(!1, _) : i = setTimeout(() => {
|
|
6536
6543
|
r(!1, 1e-7);
|
|
6537
6544
|
}, 1e3);
|
|
6538
6545
|
}
|
|
6539
|
-
|
|
6546
|
+
_ === 1 && !he(h, c.getBoundingClientRect()) && r(), b = !1;
|
|
6540
6547
|
}
|
|
6541
6548
|
try {
|
|
6542
|
-
e = new IntersectionObserver(
|
|
6543
|
-
...
|
|
6549
|
+
e = new IntersectionObserver(y, {
|
|
6550
|
+
...C,
|
|
6544
6551
|
// Handle <iframe>s
|
|
6545
6552
|
root: s.ownerDocument
|
|
6546
6553
|
});
|
|
6547
6554
|
} catch {
|
|
6548
|
-
e = new IntersectionObserver(
|
|
6555
|
+
e = new IntersectionObserver(y, C);
|
|
6549
6556
|
}
|
|
6550
6557
|
e.observe(c);
|
|
6551
6558
|
}
|
|
@@ -6570,8 +6577,8 @@ function Ct(c, t, e, i) {
|
|
|
6570
6577
|
r && (x = new ResizeObserver((E) => {
|
|
6571
6578
|
let [p] = E;
|
|
6572
6579
|
p && p.target === h && x && (x.unobserve(t), cancelAnimationFrame(u), u = requestAnimationFrame(() => {
|
|
6573
|
-
var
|
|
6574
|
-
(
|
|
6580
|
+
var C;
|
|
6581
|
+
(C = x) == null || C.observe(t);
|
|
6575
6582
|
})), e();
|
|
6576
6583
|
}), h && !l && x.observe(h), x.observe(t));
|
|
6577
6584
|
let g, m = l ? G(c) : null;
|
|
@@ -6815,7 +6822,7 @@ class Oi {
|
|
|
6815
6822
|
"F12"
|
|
6816
6823
|
].includes(s))
|
|
6817
6824
|
return;
|
|
6818
|
-
if (!(document.activeElement === this.inputEl)) {
|
|
6825
|
+
if (!(document.activeElement === this.inputEl) && e.editorType === "text") {
|
|
6819
6826
|
t.preventDefault();
|
|
6820
6827
|
return;
|
|
6821
6828
|
}
|
|
@@ -6877,7 +6884,7 @@ class Oi {
|
|
|
6877
6884
|
header: d
|
|
6878
6885
|
} = this.ctx;
|
|
6879
6886
|
let f = this.ctx.body.visibleHeight;
|
|
6880
|
-
o > f && (o = f), this.editorEl.style.zIndex = "100", this.editorEl.style.left = `${this.drawX - 1}px`, this.editorEl.style.top = `${this.drawY}px`, this.editorEl.style.bottom = "auto", this.editorEl.style.maxWidth = "none", this.editorEl.style.maxHeight = `${f}px`, ["text"].includes(s) ? (this.inputEl.style.opacity = "1", this.inputEl.style.position = "relative", this.inputEl.style.minWidth = `${r - 1}px`, this.inputEl.style.minHeight = `${o - 1}px`, this.inputEl.style.maxHeight = `${f}px`, this.inputEl.style.width = `${r}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${h}px`, this.inputEl.value = "", i !== null && (this.inputEl.value = i)) : (this.inputEl.style.opacity = "0", this.inputEl.style.width = "1px", this.inputEl.style.height = "1px", this.inputEl.style.position = "absolute", this.inputEl.style.left = "0px", this.inputEl.style.top = "0px")
|
|
6887
|
+
o > f && (o = f), this.editorEl.style.zIndex = "100", this.editorEl.style.left = `${this.drawX - 1}px`, this.editorEl.style.top = `${this.drawY}px`, this.editorEl.style.bottom = "auto", this.editorEl.style.maxWidth = "none", this.editorEl.style.maxHeight = `${f}px`, ["text"].includes(s) ? (this.inputEl.style.opacity = "1", this.inputEl.style.position = "relative", this.inputEl.style.minWidth = `${r - 1}px`, this.inputEl.style.minHeight = `${o - 1}px`, this.inputEl.style.maxHeight = `${f}px`, this.inputEl.style.width = `${r}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${h}px`, this.inputEl.value = "", i !== null && (this.inputEl.value = i), (this.inputEl.scrollHeight > o || this.drawY < d.height) && this.autoSize()) : (this.inputEl.style.opacity = "0", this.inputEl.style.width = "1px", this.inputEl.style.height = "1px", this.inputEl.style.position = "absolute", this.inputEl.style.left = "0px", this.inputEl.style.top = "0px");
|
|
6881
6888
|
}
|
|
6882
6889
|
doneEditByInput() {
|
|
6883
6890
|
if (this.cellTarget && this.cellTarget.editorType === "text") {
|
|
@@ -7322,7 +7329,7 @@ class zt {
|
|
|
7322
7329
|
}
|
|
7323
7330
|
}
|
|
7324
7331
|
const i = e.getAttribute("data-menu") || (e == null ? void 0 : e.getAttribute("data-submenu")), s = this.findMenuItem(i || "");
|
|
7325
|
-
s &&
|
|
7332
|
+
s && this.onClick && this.onClick(s, i || "");
|
|
7326
7333
|
}
|
|
7327
7334
|
findMenuItem(t, e = this.menuData) {
|
|
7328
7335
|
for (const i of e) {
|
|
@@ -7360,9 +7367,6 @@ class zt {
|
|
|
7360
7367
|
});
|
|
7361
7368
|
});
|
|
7362
7369
|
}
|
|
7363
|
-
hide() {
|
|
7364
|
-
this.cleanupAllSubmenus(this.container), this.container.style.display = "none";
|
|
7365
|
-
}
|
|
7366
7370
|
destroy() {
|
|
7367
7371
|
this.container.removeEventListener("mouseenter", this.boundMouseEnterHandler, !0), this.container.removeEventListener("mouseleave", this.boundMouseLeaveHandler, !0), this.container.removeEventListener("click", this.boundClickHandler), this.cleanupAllSubmenus(this.container), this.container.style.display = "none", this.container.replaceChildren();
|
|
7368
7372
|
}
|
|
@@ -7427,60 +7431,68 @@ class Ai {
|
|
|
7427
7431
|
init() {
|
|
7428
7432
|
this.ctx.on("outsideMousedown", () => {
|
|
7429
7433
|
this.hide();
|
|
7430
|
-
}), this.ctx.on("cellContextMenuClick", (t, e) => {
|
|
7434
|
+
}), this.ctx.on("cellContextMenuClick", async (t, e) => {
|
|
7431
7435
|
if (this.isCustom) {
|
|
7432
7436
|
this.contextMenuEl.style.display = "block", this.positionMenu(e);
|
|
7433
7437
|
return;
|
|
7434
7438
|
}
|
|
7435
|
-
const { ENABLE_CONTEXT_MENU: i, CUSTOM_BODY_CONTEXT_MENU: s, CONTEXT_MENU: o } = this.ctx.config
|
|
7436
|
-
|
|
7439
|
+
const { ENABLE_CONTEXT_MENU: i, CUSTOM_BODY_CONTEXT_MENU: s, CONTEXT_MENU: o, BEFORE_BODY_CONTEXT_MENU_METHOD: r } = this.ctx.config;
|
|
7440
|
+
let a = [...o, ...s];
|
|
7441
|
+
if (r && (a = await r({ list: a, cell: t, hide: this.hide.bind(this) })), !i || a.length === 0) return;
|
|
7437
7442
|
e.preventDefault();
|
|
7438
|
-
const { xArr:
|
|
7439
|
-
|
|
7440
|
-
onClick: (
|
|
7441
|
-
|
|
7443
|
+
const { xArr: l, yArr: h } = this.ctx.selector, [d, f] = l, [u, x] = h, { rowIndex: g, colIndex: m } = t;
|
|
7444
|
+
g >= u && g <= x && m >= d && m <= f || this.ctx.emit("setSelectorCell", t, e), this.currentDOMTreeMenu && this.currentDOMTreeMenu.destroy(), this.ctx.contextMenuIng = !0, this.currentDOMTreeMenu = new zt(this.contextMenuEl, a, {
|
|
7445
|
+
onClick: (E, p) => {
|
|
7446
|
+
p === "copy" ? (this.ctx.emit("contextMenuCopy"), this.hide()) : p === "paste" ? (this.ctx.emit("contextMenuPaste"), this.hide()) : p === "cut" ? (this.ctx.emit("contextMenuCut"), this.hide()) : p === "clearSelected" ? (this.ctx.emit("contextMenuClearSelected"), this.hide()) : E.event && E.event(e, {
|
|
7447
|
+
hide: this.hide.bind(this),
|
|
7448
|
+
cell: t
|
|
7449
|
+
});
|
|
7442
7450
|
}
|
|
7443
7451
|
}), this.currentDOMTreeMenu.positionMenu(e);
|
|
7444
|
-
}), this.ctx.on("cellHeaderContextMenuClick", (t, e) => {
|
|
7452
|
+
}), this.ctx.on("cellHeaderContextMenuClick", async (t, e) => {
|
|
7445
7453
|
if (this.isCustom) {
|
|
7446
7454
|
this.contextMenuEl.style.display = "block", this.positionMenu(e);
|
|
7447
7455
|
return;
|
|
7448
7456
|
}
|
|
7449
|
-
const { SELECTOR_AREA_MIN_X: i, SELECTOR_AREA_MAX_X: s, SELECTOR_AREA_MAX_X_OFFSET: o } = this.ctx.config,
|
|
7450
|
-
if (t.colIndex <
|
|
7457
|
+
const { SELECTOR_AREA_MIN_X: i, SELECTOR_AREA_MAX_X: s, SELECTOR_AREA_MAX_X_OFFSET: o, BEFORE_HEADER_CONTEXT_MENU_METHOD: r } = this.ctx.config, a = i, l = s || this.ctx.maxColIndex - o;
|
|
7458
|
+
if (t.colIndex < a || t.colIndex > l)
|
|
7451
7459
|
return;
|
|
7452
|
-
const { HEADER_CONTEXT_MENU:
|
|
7453
|
-
|
|
7460
|
+
const { HEADER_CONTEXT_MENU: h, CUSTOM_HEADER_CONTEXT_MENU: d, ENABLE_HEADER_CONTEXT_MENU: f } = this.ctx.config;
|
|
7461
|
+
let u = [...h, ...d];
|
|
7462
|
+
if (r && (u = await r({ list: u, cell: t, hide: this.hide.bind(this) })), !f || u.length === 0) return;
|
|
7454
7463
|
e.preventDefault();
|
|
7455
|
-
const { xArr:
|
|
7456
|
-
|
|
7457
|
-
const
|
|
7458
|
-
...
|
|
7459
|
-
children: this.filterColumns(
|
|
7460
|
-
} :
|
|
7461
|
-
this.ctx.contextMenuIng = !0, this.currentDOMTreeMenu = new zt(this.contextMenuEl,
|
|
7462
|
-
onClick: (
|
|
7463
|
-
const { xArr:
|
|
7464
|
-
if (
|
|
7465
|
-
const
|
|
7464
|
+
const { xArr: x } = this.ctx.selector, [g, m] = x, { colIndex: w } = t;
|
|
7465
|
+
w >= g && w <= m || (this.ctx.focusCellHeader = t, this.ctx.emit("selectCols", t)), this.currentDOMTreeMenu && this.currentDOMTreeMenu.destroy();
|
|
7466
|
+
const p = this.ctx.database.getColumns(), C = u.map((b) => b.value === "visible" ? {
|
|
7467
|
+
...b,
|
|
7468
|
+
children: this.filterColumns(p)
|
|
7469
|
+
} : b);
|
|
7470
|
+
this.ctx.contextMenuIng = !0, this.currentDOMTreeMenu = new zt(this.contextMenuEl, C, {
|
|
7471
|
+
onClick: (b, y) => {
|
|
7472
|
+
const { xArr: I } = this.ctx.selector, [_, L] = I;
|
|
7473
|
+
if (y === "fixedLeft" || y === "fixedRight" || y === "fixedNone") {
|
|
7474
|
+
const R = this.ctx.header.allCellHeaders.filter((v) => v.colIndex >= _ && v.colIndex <= L).filter((v) => v.level === 0).filter((v) => !v.column.fixedDisabled).map((v) => v.key);
|
|
7466
7475
|
this.ctx.database.setCustomHeaderFixedData(
|
|
7467
|
-
|
|
7468
|
-
|
|
7476
|
+
R,
|
|
7477
|
+
y === "fixedLeft" ? "left" : y === "fixedRight" ? "right" : ""
|
|
7469
7478
|
), this.hide();
|
|
7470
|
-
} else if (
|
|
7471
|
-
const
|
|
7472
|
-
|
|
7473
|
-
} else if (
|
|
7474
|
-
if (!
|
|
7475
|
-
if (
|
|
7476
|
-
const
|
|
7477
|
-
this.ctx.database.setCustomHeaderHideData(
|
|
7479
|
+
} else if (y === "hide") {
|
|
7480
|
+
const R = this.ctx.header.leafCellHeaders.filter((v) => v.colIndex >= _ && v.colIndex <= L).filter((v) => !v.children.length).filter((v) => !v.column.hideDisabled).map((v) => v.key);
|
|
7481
|
+
R.length > 0 && this.ctx.database.setCustomHeaderHideData(R, !0), this.hide();
|
|
7482
|
+
} else if (y !== "visible") if (y.startsWith("visible_")) {
|
|
7483
|
+
if (!b.key) return;
|
|
7484
|
+
if (b.children) {
|
|
7485
|
+
const T = this.getLeafKeys(b.children);
|
|
7486
|
+
this.ctx.database.setCustomHeaderHideData(T, !1);
|
|
7478
7487
|
} else
|
|
7479
|
-
this.ctx.database.setCustomHeaderHideData([
|
|
7480
|
-
this.currentDOMTreeMenu && this.currentDOMTreeMenu.removeSubMenuItem(
|
|
7481
|
-
const
|
|
7482
|
-
J(
|
|
7483
|
-
} else
|
|
7488
|
+
this.ctx.database.setCustomHeaderHideData([b.key], !1);
|
|
7489
|
+
this.currentDOMTreeMenu && this.currentDOMTreeMenu.removeSubMenuItem(y);
|
|
7490
|
+
const R = this.ctx.database.getColumns();
|
|
7491
|
+
J(R).filter((T) => T.hide).length === 0 && this.hide();
|
|
7492
|
+
} else y === "resetHeader" ? (this.ctx.database.resetCustomHeader(), this.hide()) : b.event && b.event(e, {
|
|
7493
|
+
hide: this.hide.bind(this),
|
|
7494
|
+
cell: t
|
|
7495
|
+
});
|
|
7484
7496
|
}
|
|
7485
7497
|
}), this.positionMenu(e);
|
|
7486
7498
|
}), this.ctx.on("click", () => {
|