e-virt-table 1.3.15 → 1.3.16
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 +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +296 -297
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Config.d.ts +0 -2
- package/dist/lib/Config.js +0 -7
- package/dist/lib/Config.js.map +1 -1
- package/dist/lib/Database.d.ts +4 -6
- package/dist/lib/Database.js +16 -36
- package/dist/lib/Database.js.map +1 -1
- package/dist/lib/EVirtTable.d.ts +3 -2
- package/dist/lib/EVirtTable.js +10 -3
- package/dist/lib/EVirtTable.js.map +1 -1
- package/dist/lib/Editor.js +3 -3
- package/dist/lib/Editor.js.map +1 -1
- package/dist/lib/FinderBar.js +2 -2
- package/dist/lib/FinderBar.js.map +1 -1
- package/dist/lib/Row.d.ts +1 -1
- package/dist/lib/Row.js +13 -1
- package/dist/lib/Row.js.map +1 -1
- package/dist/lib/types.d.ts +4 -0
- package/package.json +4 -1
package/dist/index.es.js
CHANGED
|
@@ -10,9 +10,9 @@ class ue {
|
|
|
10
10
|
validate(t) {
|
|
11
11
|
const e = [], { column: i, row: s, key: o, rowKey: r, colIndex: a, rowIndex: l, value: h, field: d, fieldValue: f } = t;
|
|
12
12
|
Array.isArray(this.rules) || (this.rules = [this.rules]);
|
|
13
|
-
for (const
|
|
14
|
-
if (
|
|
15
|
-
const
|
|
13
|
+
for (const u of this.rules) {
|
|
14
|
+
if (u.validator) {
|
|
15
|
+
const x = {
|
|
16
16
|
field: d,
|
|
17
17
|
fieldValue: f,
|
|
18
18
|
value: h,
|
|
@@ -22,18 +22,18 @@ class ue {
|
|
|
22
22
|
row: s,
|
|
23
23
|
key: o,
|
|
24
24
|
rowKey: r,
|
|
25
|
-
...
|
|
25
|
+
...u
|
|
26
26
|
};
|
|
27
|
-
|
|
27
|
+
u.validator(x, h, (g) => {
|
|
28
28
|
g && e.push({
|
|
29
|
-
...
|
|
29
|
+
...x,
|
|
30
30
|
message: g
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
if (!
|
|
34
|
+
if (!u.required && (h == null || h === ""))
|
|
35
35
|
return e;
|
|
36
|
-
|
|
36
|
+
u.pattern && !u.pattern.test(h) && e.push({
|
|
37
37
|
value: h,
|
|
38
38
|
column: i,
|
|
39
39
|
row: s,
|
|
@@ -43,8 +43,8 @@ class ue {
|
|
|
43
43
|
rowIndex: l,
|
|
44
44
|
field: d,
|
|
45
45
|
fieldValue: f,
|
|
46
|
-
message:
|
|
47
|
-
}),
|
|
46
|
+
message: u.message || `${o} is pattern validation error`
|
|
47
|
+
}), u.required && (h == null || h === "") && e.push({
|
|
48
48
|
value: h,
|
|
49
49
|
column: i,
|
|
50
50
|
row: s,
|
|
@@ -54,7 +54,7 @@ class ue {
|
|
|
54
54
|
rowIndex: l,
|
|
55
55
|
field: d,
|
|
56
56
|
fieldValue: f,
|
|
57
|
-
message:
|
|
57
|
+
message: u.message || `${o} is required`
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
return e;
|
|
@@ -261,14 +261,14 @@ function Dt(c) {
|
|
|
261
261
|
if (o) {
|
|
262
262
|
const r = o.slice(1).map(Number);
|
|
263
263
|
if (s.source.includes("YYYY-MM-DD") || s.source.includes("YYYY/MM/DD") || s.source.includes("YYYY.MM.DD")) {
|
|
264
|
-
const [a, l, h, d = 0, f = 0,
|
|
265
|
-
return new Date(a, l - 1, h, d, f,
|
|
264
|
+
const [a, l, h, d = 0, f = 0, u = 0] = r;
|
|
265
|
+
return new Date(a, l - 1, h, d, f, u);
|
|
266
266
|
} else if (s.source.includes("DD-MM-YYYY") || s.source.includes("DD/MM/YYYY") || s.source.includes("DD.MM.YYYY")) {
|
|
267
|
-
const [a, l, h, d = 0, f = 0,
|
|
268
|
-
return new Date(h, l - 1, a, d, f,
|
|
267
|
+
const [a, l, h, d = 0, f = 0, u = 0] = r;
|
|
268
|
+
return new Date(h, l - 1, a, d, f, u);
|
|
269
269
|
} else if (s.source.includes("MM-DD-YYYY") || s.source.includes("MM/DD/YYYY") || s.source.includes("MM.DD.YYYY")) {
|
|
270
|
-
const [a, l, h, d = 0, f = 0,
|
|
271
|
-
return new Date(h, a - 1, l, d, f,
|
|
270
|
+
const [a, l, h, d = 0, f = 0, u = 0] = r;
|
|
271
|
+
return new Date(h, a - 1, l, d, f, u);
|
|
272
272
|
} else if (s.source.includes("YYYYMMDD")) {
|
|
273
273
|
const [a, l, h] = r;
|
|
274
274
|
return new Date(a, l - 1, h);
|
|
@@ -328,7 +328,7 @@ class qt {
|
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
330
|
class vt extends qt {
|
|
331
|
-
constructor(e, i, s, o, r, a, l, h, d, f = "body",
|
|
331
|
+
constructor(e, i, s, o, r, a, l, h, d, f = "body", u = !0) {
|
|
332
332
|
super(e, o, r, a, l, f, h.fixed);
|
|
333
333
|
n(this, "formatter");
|
|
334
334
|
n(this, "formatterFooter");
|
|
@@ -411,7 +411,7 @@ class vt extends qt {
|
|
|
411
411
|
n(this, "overflowTooltipMaxWidth", 500);
|
|
412
412
|
n(this, "overflowTooltipPlacement", "top");
|
|
413
413
|
n(this, "maxLineClamp", "auto");
|
|
414
|
-
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",
|
|
414
|
+
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", u && this.update();
|
|
415
415
|
}
|
|
416
416
|
setWidthHeight(e, i) {
|
|
417
417
|
this.width = e, this.height = i;
|
|
@@ -529,10 +529,10 @@ class vt extends qt {
|
|
|
529
529
|
let o, r = 0, a = "";
|
|
530
530
|
if (!(["tree", "selection-tree", "tree-selection"].includes(this.type) && s === "body"))
|
|
531
531
|
return;
|
|
532
|
-
const l = this.ctx.database.getRowForRowKey(i), { expand: h = !1, hasChildren: d = !1, expandLoading: f = !1, level:
|
|
532
|
+
const l = this.ctx.database.getRowForRowKey(i), { expand: h = !1, hasChildren: d = !1, expandLoading: f = !1, level: u = 0 } = l || {};
|
|
533
533
|
this.rowExpand = h, this.rowHasChildren = d;
|
|
534
|
-
const { TREE_INDENT:
|
|
535
|
-
if (r =
|
|
534
|
+
const { TREE_INDENT: x = 16, CHECKBOX_SIZE: g, TREE_ICON_SIZE: m } = this.ctx.config;
|
|
535
|
+
if (r = u * x, f) {
|
|
536
536
|
const R = this.ctx.icons.get("loading");
|
|
537
537
|
a = "loading", o = R;
|
|
538
538
|
} else if (d) {
|
|
@@ -562,8 +562,8 @@ class vt extends qt {
|
|
|
562
562
|
lineDashOffset: 0
|
|
563
563
|
});
|
|
564
564
|
}
|
|
565
|
-
const
|
|
566
|
-
this.ctx.paint.drawLine([
|
|
565
|
+
const u = Math.round(this.drawTreeImageX - i + s / 2), g = !!r.isLastChild ? h : this.drawY + this.visibleHeight;
|
|
566
|
+
this.ctx.paint.drawLine([u, this.drawY, u, g], {
|
|
567
567
|
borderColor: o,
|
|
568
568
|
borderWidth: 1,
|
|
569
569
|
lineDash: [4, 4],
|
|
@@ -578,8 +578,8 @@ class vt extends qt {
|
|
|
578
578
|
});
|
|
579
579
|
}
|
|
580
580
|
if (r.hasChildren && r.expand) {
|
|
581
|
-
const
|
|
582
|
-
this.ctx.paint.drawLine([l,
|
|
581
|
+
const u = this.drawTreeImageY + this.drawTreeImageHeight, x = this.drawY + this.visibleHeight;
|
|
582
|
+
this.ctx.paint.drawLine([l, u, l, x], {
|
|
583
583
|
borderColor: o,
|
|
584
584
|
borderWidth: 1,
|
|
585
585
|
lineDash: [4, 4],
|
|
@@ -599,8 +599,8 @@ class vt extends qt {
|
|
|
599
599
|
FOOTER_BG_COLOR: h,
|
|
600
600
|
HIGHLIGHT_SELECTED_ROW: d,
|
|
601
601
|
HIGHLIGHT_SELECTED_ROW_COLOR: f,
|
|
602
|
-
HIGHLIGHT_HOVER_ROW:
|
|
603
|
-
HIGHLIGHT_HOVER_ROW_COLOR:
|
|
602
|
+
HIGHLIGHT_HOVER_ROW: u,
|
|
603
|
+
HIGHLIGHT_HOVER_ROW_COLOR: x,
|
|
604
604
|
STRIPE: g,
|
|
605
605
|
STRIPE_COLOR: m,
|
|
606
606
|
FINDER_CELL_BG_COLOR: w
|
|
@@ -623,11 +623,11 @@ class vt extends qt {
|
|
|
623
623
|
let E = "transparent";
|
|
624
624
|
const p = this.ctx.hoverCell, y = this.ctx.currentCell;
|
|
625
625
|
let b = this.rowIndex, C = this.rowIndex;
|
|
626
|
-
if (this.rowspan !== 1 && (
|
|
626
|
+
if (this.rowspan !== 1 && (u || d)) {
|
|
627
627
|
const _ = this.getSpanInfo(), { yArr: T } = _;
|
|
628
628
|
b = T[0], C = T[1];
|
|
629
629
|
}
|
|
630
|
-
|
|
630
|
+
u && p && (p.rowKey === this.rowKey && (E = x), p.rowIndex >= b && p.rowIndex <= C && (E = x)), d && y && (y.rowKey === this.rowKey && (E = f), y.rowIndex >= b && y.rowIndex <= C && (E = f)), this.drawCellSkyBgColor = E;
|
|
631
631
|
let R = e, S = a;
|
|
632
632
|
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (R = i, S = r), g && (this.rowIndex % 2 ? R = m : R = e), typeof s == "function") {
|
|
633
633
|
const _ = s, { backgroundColor: T, color: M, font: L } = _({
|
|
@@ -647,14 +647,14 @@ class vt extends qt {
|
|
|
647
647
|
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: a, rowIndex: l, rowKey: h } = this;
|
|
648
648
|
if (s === 0 || o === 0 || r === "footer" || !["index-selection", "selection", "selection-tree", "tree-selection"].includes(a))
|
|
649
649
|
return;
|
|
650
|
-
const d = this.ctx.database.getRowSelectable(h), { CHECKBOX_SIZE: f = 0, CELL_PADDING:
|
|
651
|
-
let
|
|
652
|
-
(this.align === "center" || this.align === "right") && (
|
|
653
|
-
let g =
|
|
650
|
+
const d = this.ctx.database.getRowSelectable(h), { CHECKBOX_SIZE: f = 0, CELL_PADDING: u } = this.ctx.config;
|
|
651
|
+
let x = this.drawX + u;
|
|
652
|
+
(this.align === "center" || this.align === "right") && (x = this.drawX + (e - f) / 2);
|
|
653
|
+
let g = x, m = this.drawY + (i - f) / 2;
|
|
654
654
|
if (a !== "selection-tree") {
|
|
655
655
|
if (a === "tree-selection") {
|
|
656
656
|
const { TREE_INDENT: p = 16, TREE_ICON_SIZE: y } = this.ctx.config, b = this.ctx.database.getRowForRowKey(h), { level: C = 0 } = b || {}, R = C * p;
|
|
657
|
-
g =
|
|
657
|
+
g = x + y + R;
|
|
658
658
|
}
|
|
659
659
|
}
|
|
660
660
|
let w = this.ctx.icons.get("checkbox-uncheck"), E = "checkbox-uncheck";
|
|
@@ -665,7 +665,7 @@ class vt extends qt {
|
|
|
665
665
|
const p = this.ctx.database.getRowSelection(h);
|
|
666
666
|
p && d ? (w = this.ctx.icons.get("checkbox-check"), E = "checkbox-check") : p && !d ? (w = this.ctx.icons.get("checkbox-check-disabled"), E = "checkbox-check-disabled") : !p && d ? (w = this.ctx.icons.get("checkbox-uncheck"), E = "checkbox-uncheck") : (w = this.ctx.icons.get("checkbox-disabled"), E = "checkbox-disabled");
|
|
667
667
|
}
|
|
668
|
-
g + f +
|
|
668
|
+
g + f + u > this.drawX + this.visibleWidth || m + f + u > this.drawY + this.visibleHeight || (a === "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === l || ["checkbox-disabled", "checkbox-check"].includes(E)) && (this.drawSelectionImageX = g, this.drawSelectionImageY = m, this.drawSelectionImageWidth = f, this.drawSelectionImageHeight = f, this.drawSelectionImageName = E, this.drawSelectionImageSource = w) : (this.drawSelectionImageX = g, this.drawSelectionImageY = m, this.drawSelectionImageWidth = f, this.drawSelectionImageHeight = f, this.drawSelectionImageName = E, this.drawSelectionImageSource = w));
|
|
669
669
|
}
|
|
670
670
|
updateHoverIcon() {
|
|
671
671
|
if (this.ctx.database.getReadonly(this.rowKey, this.key))
|
|
@@ -685,8 +685,8 @@ class vt extends qt {
|
|
|
685
685
|
if (this.hoverIconName && !this.ctx.editing && a) {
|
|
686
686
|
let l = 0, h = 0;
|
|
687
687
|
if (a.rowKey === this.rowKey && (l = this.drawX + this.width - s - o, h = this.drawY + (this.height - s) / 2), this.rowspan !== 1 && r) {
|
|
688
|
-
const f = this.getSpanInfo(), { yArr:
|
|
689
|
-
if (a.rowIndex >=
|
|
688
|
+
const f = this.getSpanInfo(), { yArr: u } = f, x = u[0], g = u[1];
|
|
689
|
+
if (a.rowIndex >= x && a.rowIndex <= g) {
|
|
690
690
|
const { width: m, height: w, offsetTop: E, offsetLeft: p } = f;
|
|
691
691
|
l = this.drawX - p + m - s - o, h = this.drawY - E + (w - s) / 2;
|
|
692
692
|
}
|
|
@@ -822,10 +822,10 @@ class vt extends qt {
|
|
|
822
822
|
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s, AUTOFILL_POINT_BORDER_COLOR: o } = this.ctx.config;
|
|
823
823
|
if (!s || !i || this.ctx.editing)
|
|
824
824
|
return;
|
|
825
|
-
const { xArr: r, yArr: a } = this.ctx.selector, l = r[1], h = a[1], { colIndex: d, rowIndex: f, drawX:
|
|
825
|
+
const { xArr: r, yArr: a } = this.ctx.selector, l = r[1], h = a[1], { colIndex: d, rowIndex: f, drawX: u, drawY: x } = this;
|
|
826
826
|
if (d === l && f === h) {
|
|
827
827
|
const m = d === this.ctx.maxColIndex || f === this.ctx.maxRowIndex || d === this.ctx.lastCenterColIndex ? 6 : 4;
|
|
828
|
-
this.ctx.paint.drawRect(
|
|
828
|
+
this.ctx.paint.drawRect(u + this.width - m, x + this.height - m, 6, 6, {
|
|
829
829
|
borderColor: o,
|
|
830
830
|
fillColor: e
|
|
831
831
|
});
|
|
@@ -968,7 +968,7 @@ class vt extends qt {
|
|
|
968
968
|
drawBorder(e) {
|
|
969
969
|
const { drawX: i, drawY: s, rowIndex: o, colIndex: r, height: a, width: l } = this;
|
|
970
970
|
let h = i, d = s;
|
|
971
|
-
const { xArr: f, yArr:
|
|
971
|
+
const { xArr: f, yArr: u, lineDash: x = [], borderWidth: g = 1, borderColor: m, fillColor: w } = e, E = f[0], p = f[1], y = u[0], b = u[1];
|
|
972
972
|
if (r >= E && r <= p && o === y) {
|
|
973
973
|
const C = r === p ? 1 : 0, R = r === E ? 1 : 0;
|
|
974
974
|
this.ctx.paint.drawLine([h + R, d + 1, h + l - C, d + 1], {
|
|
@@ -977,7 +977,7 @@ class vt extends qt {
|
|
|
977
977
|
borderWidth: g,
|
|
978
978
|
lineCap: "round",
|
|
979
979
|
lineJoin: "round",
|
|
980
|
-
lineDash:
|
|
980
|
+
lineDash: x
|
|
981
981
|
});
|
|
982
982
|
}
|
|
983
983
|
if (r === p && o >= y && o <= b) {
|
|
@@ -988,7 +988,7 @@ class vt extends qt {
|
|
|
988
988
|
borderWidth: g,
|
|
989
989
|
lineCap: "round",
|
|
990
990
|
lineJoin: "round",
|
|
991
|
-
lineDash:
|
|
991
|
+
lineDash: x
|
|
992
992
|
});
|
|
993
993
|
}
|
|
994
994
|
if (r >= E && r <= p && o === b) {
|
|
@@ -999,7 +999,7 @@ class vt extends qt {
|
|
|
999
999
|
borderWidth: g,
|
|
1000
1000
|
lineCap: "round",
|
|
1001
1001
|
lineJoin: "round",
|
|
1002
|
-
lineDash:
|
|
1002
|
+
lineDash: x
|
|
1003
1003
|
});
|
|
1004
1004
|
}
|
|
1005
1005
|
if (r === E && o >= y && o <= b) {
|
|
@@ -1010,7 +1010,7 @@ class vt extends qt {
|
|
|
1010
1010
|
borderWidth: g,
|
|
1011
1011
|
lineCap: "round",
|
|
1012
1012
|
lineJoin: "round",
|
|
1013
|
-
lineDash:
|
|
1013
|
+
lineDash: x
|
|
1014
1014
|
});
|
|
1015
1015
|
}
|
|
1016
1016
|
}
|
|
@@ -1041,8 +1041,8 @@ class be {
|
|
|
1041
1041
|
resizableData: {}
|
|
1042
1042
|
});
|
|
1043
1043
|
n(this, "overlayerAutoHeightMap", /* @__PURE__ */ new Map());
|
|
1044
|
-
n(this, "
|
|
1045
|
-
//
|
|
1044
|
+
n(this, "maxRowHeightCellMap", /* @__PURE__ */ new Map());
|
|
1045
|
+
// 记录每行的计算高度(按 rowKey 存储)
|
|
1046
1046
|
n(this, "bufferCheckState", {
|
|
1047
1047
|
buffer: !1,
|
|
1048
1048
|
check: !1,
|
|
@@ -1060,7 +1060,7 @@ class be {
|
|
|
1060
1060
|
}
|
|
1061
1061
|
// 初始化默认不忽略清空改变值和校验map
|
|
1062
1062
|
init(t = !0) {
|
|
1063
|
-
this.ctx.paint.clearTextCache(), this.clearBufferData(), this.rowKeyMap.clear(), this.checkboxKeyMap.clear(), this.colIndexKeyMap.clear(), this.rowIndexRowKeyMap.clear(), this.rowKeyRowIndexMap.clear(), this.
|
|
1063
|
+
this.ctx.paint.clearTextCache(), this.clearBufferData(), this.rowKeyMap.clear(), this.checkboxKeyMap.clear(), this.colIndexKeyMap.clear(), this.rowIndexRowKeyMap.clear(), this.rowKeyRowIndexMap.clear(), this.maxRowHeightCellMap.clear();
|
|
1064
1064
|
const e = this.getColumns(), i = J(e);
|
|
1065
1065
|
if (this.ctx.hasSelection = i.some((s) => s.type === "selection"), this.ctx.hasTree = i.some((s) => s.type === "tree"), t) {
|
|
1066
1066
|
this.originalDataMap.clear(), this.changedDataMap.clear(), this.validationErrorMap.clear();
|
|
@@ -1089,10 +1089,10 @@ class be {
|
|
|
1089
1089
|
CHECKBOX_KEY: h,
|
|
1090
1090
|
TREE_CHILDREN_KEY: d
|
|
1091
1091
|
} = this.ctx.config;
|
|
1092
|
-
t.forEach((f,
|
|
1092
|
+
t.forEach((f, u) => {
|
|
1093
1093
|
var y;
|
|
1094
1094
|
d !== "children" && (f.children = f[d]);
|
|
1095
|
-
const
|
|
1095
|
+
const x = f[o], g = x != null ? `${x}` : $t();
|
|
1096
1096
|
this.itemRowKeyMap.set(f, g);
|
|
1097
1097
|
const m = f._height || a, w = f._readonly;
|
|
1098
1098
|
let E = !0;
|
|
@@ -1112,8 +1112,8 @@ class be {
|
|
|
1112
1112
|
const p = r || this.expandMap.get(g) || f._expand || !1;
|
|
1113
1113
|
this.expandMap.set(g, p), this.rowKeyMap.set(g, {
|
|
1114
1114
|
readonly: w,
|
|
1115
|
-
index:
|
|
1116
|
-
rowIndex:
|
|
1115
|
+
index: u,
|
|
1116
|
+
rowIndex: u,
|
|
1117
1117
|
level: e,
|
|
1118
1118
|
height: m,
|
|
1119
1119
|
calculatedHeight: -1,
|
|
@@ -1126,7 +1126,7 @@ class be {
|
|
|
1126
1126
|
item: f,
|
|
1127
1127
|
parentRowKeys: i,
|
|
1128
1128
|
parentRowKey: i[i.length - 1] || "",
|
|
1129
|
-
isLastChild:
|
|
1129
|
+
isLastChild: u === s - 1
|
|
1130
1130
|
}), Array.isArray(f.children) && f.children.length && this.initData(f.children, e + 1, [...i, g]);
|
|
1131
1131
|
});
|
|
1132
1132
|
}
|
|
@@ -1157,20 +1157,11 @@ class be {
|
|
|
1157
1157
|
return t.every(({ height: i, rowIndex: s }) => this.getPositionForRowIndex(s).calculatedHeight === i) ? !1 : (t.forEach(({ rowIndex: i, height: s }) => {
|
|
1158
1158
|
const o = this.rowIndexRowKeyMap.get(i);
|
|
1159
1159
|
if (o) {
|
|
1160
|
-
const r = this.rowKeyMap.get(o);
|
|
1161
|
-
|
|
1162
|
-
const a = this.maxRowHeightMap.get(o) || r.height;
|
|
1163
|
-
s > a && this.maxRowHeightMap.set(o, s);
|
|
1164
|
-
}
|
|
1160
|
+
const r = this.rowKeyMap.get(o), { height: a = -1 } = this.getMaxRowHeightItem(o) || {};
|
|
1161
|
+
r.calculatedHeight = Math.max(s, a);
|
|
1165
1162
|
}
|
|
1166
1163
|
}), this.clearBufferData(), this.getData(), !0);
|
|
1167
1164
|
}
|
|
1168
|
-
/**
|
|
1169
|
-
* 清除最大行高记录
|
|
1170
|
-
*/
|
|
1171
|
-
clearMaxRowHeight() {
|
|
1172
|
-
this.maxRowHeightMap.clear(), this.clearBufferData(), this.getData(), this.ctx.emit("draw");
|
|
1173
|
-
}
|
|
1174
1165
|
/**
|
|
1175
1166
|
* 获取所有行数据(平铺)
|
|
1176
1167
|
* @returns 获取转化平铺数据
|
|
@@ -1186,11 +1177,11 @@ class be {
|
|
|
1186
1177
|
}
|
|
1187
1178
|
generateColumns(t) {
|
|
1188
1179
|
const e = (i) => i.map((s) => {
|
|
1189
|
-
var h, d, f,
|
|
1180
|
+
var h, d, f, u, x, g, m, w;
|
|
1190
1181
|
const o = s.children && Array.isArray(s.children) ? e(s.children) : void 0, r = {
|
|
1191
1182
|
hide: (d = (h = this.customHeader) == null ? void 0 : h.hideData) == null ? void 0 : d[s.key],
|
|
1192
|
-
fixed: (
|
|
1193
|
-
sort: (g = (
|
|
1183
|
+
fixed: (u = (f = this.customHeader) == null ? void 0 : f.fixedData) == null ? void 0 : u[s.key],
|
|
1184
|
+
sort: (g = (x = this.customHeader) == null ? void 0 : x.sortData) == null ? void 0 : g[s.key],
|
|
1194
1185
|
width: (w = (m = this.customHeader) == null ? void 0 : m.resizableData) == null ? void 0 : w[s.key]
|
|
1195
1186
|
}, a = {};
|
|
1196
1187
|
for (const [E, p] of Object.entries(r))
|
|
@@ -1230,15 +1221,10 @@ class be {
|
|
|
1230
1221
|
const i = (o) => {
|
|
1231
1222
|
o.forEach((r) => {
|
|
1232
1223
|
t.push(r);
|
|
1233
|
-
const a = this.itemRowKeyMap.get(r), { expand: l, hasChildren: h, height: d, calculatedHeight: f } = this.rowKeyMap.get(a),
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
u > g ? (this.maxRowHeightMap.set(a, u), u = u) : u = g;
|
|
1238
|
-
}
|
|
1239
|
-
this.sumHeight += u, this.rowIndexRowKeyMap.set(e, a), this.rowKeyRowIndexMap.set(a, e), this.positions.push({
|
|
1240
|
-
top: x,
|
|
1241
|
-
height: u,
|
|
1224
|
+
const a = this.itemRowKeyMap.get(r), { expand: l, hasChildren: h, height: d, calculatedHeight: f } = this.rowKeyMap.get(a), u = this.sumHeight, x = Math.max(f, d);
|
|
1225
|
+
this.sumHeight += x, this.rowIndexRowKeyMap.set(e, a), this.rowKeyRowIndexMap.set(a, e), this.positions.push({
|
|
1226
|
+
top: u,
|
|
1227
|
+
height: x,
|
|
1242
1228
|
bottom: this.sumHeight,
|
|
1243
1229
|
calculatedHeight: f
|
|
1244
1230
|
}), e += 1, l && h && i(r.children);
|
|
@@ -1481,18 +1467,18 @@ class be {
|
|
|
1481
1467
|
a.forEach((g) => {
|
|
1482
1468
|
f.push(this.ctx.database.getRowDataItemForRowKey(g));
|
|
1483
1469
|
});
|
|
1484
|
-
const
|
|
1485
|
-
Promise.all(
|
|
1470
|
+
const u = h.map(({ rowKey: g, key: m }) => this.getValidator(g, m));
|
|
1471
|
+
Promise.all(u).then(() => {
|
|
1486
1472
|
this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
|
|
1487
1473
|
});
|
|
1488
|
-
const
|
|
1474
|
+
const x = h.map((g) => {
|
|
1489
1475
|
const m = !!this.getValidationError(g.rowKey, g.key).length;
|
|
1490
1476
|
return {
|
|
1491
1477
|
...g,
|
|
1492
1478
|
errorTip: m
|
|
1493
1479
|
};
|
|
1494
1480
|
});
|
|
1495
|
-
this.ctx.emit("change",
|
|
1481
|
+
this.ctx.emit("change", x, f), e && this.ctx.history.pushState({
|
|
1496
1482
|
changeList: o,
|
|
1497
1483
|
scrollX: this.ctx.scrollX,
|
|
1498
1484
|
scrollY: this.ctx.scrollY,
|
|
@@ -1523,7 +1509,7 @@ class be {
|
|
|
1523
1509
|
l[e] !== null && typeof l[e] == "object" && (h = JSON.parse(JSON.stringify(l[e])));
|
|
1524
1510
|
const f = `${t}_${e}`;
|
|
1525
1511
|
this.originalDataMap.has(f) || this.originalDataMap.set(f, h);
|
|
1526
|
-
const
|
|
1512
|
+
const u = this.originalDataMap.get(f), x = this.getRowDataItemForRowKey(t);
|
|
1527
1513
|
if (r) {
|
|
1528
1514
|
const g = this.getVirtualBodyCellByKey(t, e);
|
|
1529
1515
|
if ((g == null ? void 0 : g.type) === "number")
|
|
@@ -1542,7 +1528,7 @@ class be {
|
|
|
1542
1528
|
key: e,
|
|
1543
1529
|
value: d,
|
|
1544
1530
|
oldValue: h,
|
|
1545
|
-
row:
|
|
1531
|
+
row: x
|
|
1546
1532
|
}
|
|
1547
1533
|
]
|
|
1548
1534
|
};
|
|
@@ -1559,7 +1545,7 @@ class be {
|
|
|
1559
1545
|
key: e,
|
|
1560
1546
|
value: d,
|
|
1561
1547
|
oldValue: h,
|
|
1562
|
-
row:
|
|
1548
|
+
row: x
|
|
1563
1549
|
}
|
|
1564
1550
|
];
|
|
1565
1551
|
this.batchSetItemValue(m, s, !1), this.ctx.emit("editChange", {
|
|
@@ -1567,8 +1553,8 @@ class be {
|
|
|
1567
1553
|
key: e,
|
|
1568
1554
|
oldValue: h,
|
|
1569
1555
|
value: d,
|
|
1570
|
-
originalValue:
|
|
1571
|
-
row:
|
|
1556
|
+
originalValue: u,
|
|
1557
|
+
row: x
|
|
1572
1558
|
});
|
|
1573
1559
|
} else
|
|
1574
1560
|
this.changedDataMap.set(f, d), l[e] = d;
|
|
@@ -1578,7 +1564,7 @@ class be {
|
|
|
1578
1564
|
oldValue: h,
|
|
1579
1565
|
value: d,
|
|
1580
1566
|
originalValue: this.originalDataMap.get(f),
|
|
1581
|
-
row:
|
|
1567
|
+
row: x
|
|
1582
1568
|
}), o && this.ctx.emit("draw"), {
|
|
1583
1569
|
oldValue: h,
|
|
1584
1570
|
newValue: d
|
|
@@ -1701,8 +1687,8 @@ class be {
|
|
|
1701
1687
|
for (const y of E)
|
|
1702
1688
|
p.push(y), p.push(...h(y));
|
|
1703
1689
|
return p;
|
|
1704
|
-
}, f = h(t).map((w) => this.selectionMap.get(w)),
|
|
1705
|
-
r = g && !(
|
|
1690
|
+
}, 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;
|
|
1691
|
+
r = g && !(u === x), a = s || g, s && x > 0 && u === 0 && (a = !1, r = !1);
|
|
1706
1692
|
} else if (this.ctx.config.TREE_SELECT_MODE === "cautious") {
|
|
1707
1693
|
const h = (w) => {
|
|
1708
1694
|
const E = this.getTreeChildren(w);
|
|
@@ -1710,8 +1696,8 @@ class be {
|
|
|
1710
1696
|
for (const y of E)
|
|
1711
1697
|
p.push(y), p.push(...h(y));
|
|
1712
1698
|
return p;
|
|
1713
|
-
}, f = h(t).map((w) => this.selectionMap.get(w)),
|
|
1714
|
-
r = g && !m, a = s || m, s &&
|
|
1699
|
+
}, 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;
|
|
1700
|
+
r = g && !m, a = s || m, s && x > 0 && u === 0 && (a = !1, r = !1);
|
|
1715
1701
|
} else this.ctx.config.TREE_SELECT_MODE === "strictly" && (r = !1, a = s);
|
|
1716
1702
|
return { checked: a, indeterminate: r };
|
|
1717
1703
|
}
|
|
@@ -1812,14 +1798,14 @@ class be {
|
|
|
1812
1798
|
return e;
|
|
1813
1799
|
const i = this.rowKeyMap.size;
|
|
1814
1800
|
let s = 0, o = 0;
|
|
1815
|
-
const r = this.selectionMap.size, a = Array.from(this.selectionMap.values()).some((
|
|
1816
|
-
this.rowKeyMap.forEach((
|
|
1801
|
+
const r = this.selectionMap.size, a = Array.from(this.selectionMap.values()).some((u) => u.check);
|
|
1802
|
+
this.rowKeyMap.forEach((u, x) => {
|
|
1817
1803
|
var m;
|
|
1818
|
-
(m = this.selectionMap.get(
|
|
1819
|
-
let g =
|
|
1804
|
+
(m = this.selectionMap.get(x)) != null && m.check && (s += 1);
|
|
1805
|
+
let g = u.selectable;
|
|
1820
1806
|
typeof g == "function" && (g = g({
|
|
1821
|
-
row:
|
|
1822
|
-
rowIndex:
|
|
1807
|
+
row: u.item,
|
|
1808
|
+
rowIndex: u.rowIndex
|
|
1823
1809
|
})), g && (o += 1);
|
|
1824
1810
|
});
|
|
1825
1811
|
const l = r > i && s === 0 && a, h = o && o > s && s > 0 || l, d = o !== 0, f = !!o && o === s;
|
|
@@ -1996,19 +1982,19 @@ class be {
|
|
|
1996
1982
|
relationColKeys: h,
|
|
1997
1983
|
rowspan: d,
|
|
1998
1984
|
height: f,
|
|
1999
|
-
width:
|
|
2000
|
-
colspan:
|
|
1985
|
+
width: u,
|
|
1986
|
+
colspan: x,
|
|
2001
1987
|
mergeRow: g,
|
|
2002
1988
|
mergeCol: m
|
|
2003
1989
|
} = t;
|
|
2004
|
-
if (d === 1 &&
|
|
1990
|
+
if (d === 1 && x === 1)
|
|
2005
1991
|
return {
|
|
2006
1992
|
xArr: [a, a],
|
|
2007
1993
|
yArr: [e, e],
|
|
2008
1994
|
rowspan: d,
|
|
2009
|
-
colspan:
|
|
1995
|
+
colspan: x,
|
|
2010
1996
|
height: f,
|
|
2011
|
-
width:
|
|
1997
|
+
width: u,
|
|
2012
1998
|
offsetTop: 0,
|
|
2013
1999
|
offsetLeft: 0,
|
|
2014
2000
|
dataList: [
|
|
@@ -2022,7 +2008,7 @@ class be {
|
|
|
2022
2008
|
};
|
|
2023
2009
|
let w = e, E = e, p = a, y = a, b = [], C = 0, R = 0, S = 0, O = 0;
|
|
2024
2010
|
if (d !== 1 && g) {
|
|
2025
|
-
O =
|
|
2011
|
+
O = u;
|
|
2026
2012
|
const v = l.reduce((I, _) => {
|
|
2027
2013
|
const T = this.getItemValue(s, _) ?? "";
|
|
2028
2014
|
return `${I}${T}`;
|
|
@@ -2063,7 +2049,7 @@ class be {
|
|
|
2063
2049
|
});
|
|
2064
2050
|
}
|
|
2065
2051
|
}
|
|
2066
|
-
if (
|
|
2052
|
+
if (x !== 1 && m) {
|
|
2067
2053
|
S = f;
|
|
2068
2054
|
for (let v = a - 1; v >= 0; v--) {
|
|
2069
2055
|
const I = this.getColumnByColIndex(v);
|
|
@@ -2107,7 +2093,7 @@ class be {
|
|
|
2107
2093
|
xArr: [p, y],
|
|
2108
2094
|
yArr: [w, E],
|
|
2109
2095
|
rowspan: d,
|
|
2110
|
-
colspan:
|
|
2096
|
+
colspan: x,
|
|
2111
2097
|
height: S,
|
|
2112
2098
|
width: O,
|
|
2113
2099
|
offsetTop: C,
|
|
@@ -2237,9 +2223,9 @@ class be {
|
|
|
2237
2223
|
s.forEach((r) => {
|
|
2238
2224
|
r.children && r.children.length > 0 && e(r.children, o);
|
|
2239
2225
|
const a = (l, h) => {
|
|
2240
|
-
var f,
|
|
2226
|
+
var f, u;
|
|
2241
2227
|
const d = (f = this.customHeader[l]) == null ? void 0 : f[r.key];
|
|
2242
|
-
d !== void 0 && d !== h && (o[l] || (o[l] = {}), o[l][r.key] = d, l === "fixedData" && !d && !h && ((
|
|
2228
|
+
d !== void 0 && d !== h && (o[l] || (o[l] = {}), o[l][r.key] = d, l === "fixedData" && !d && !h && ((u = o[l]) == null || delete u[r.key]));
|
|
2243
2229
|
};
|
|
2244
2230
|
a("fixedData", r.fixed), a("sortData", r.sort), a("hideData", r.hide), a("resizableData", r.width);
|
|
2245
2231
|
});
|
|
@@ -2247,6 +2233,15 @@ class be {
|
|
|
2247
2233
|
let i = {};
|
|
2248
2234
|
return e(t, i), i;
|
|
2249
2235
|
}
|
|
2236
|
+
setMaxRowHeightItem(t, e, i) {
|
|
2237
|
+
this.maxRowHeightCellMap.set(t, {
|
|
2238
|
+
key: e,
|
|
2239
|
+
height: i
|
|
2240
|
+
});
|
|
2241
|
+
}
|
|
2242
|
+
getMaxRowHeightItem(t) {
|
|
2243
|
+
return this.maxRowHeightCellMap.get(t);
|
|
2244
|
+
}
|
|
2250
2245
|
clearChangeData() {
|
|
2251
2246
|
this.changedDataMap.clear();
|
|
2252
2247
|
}
|
|
@@ -2506,8 +2501,8 @@ class _e {
|
|
|
2506
2501
|
if (this.ctx.save(), this.ctx.beginPath(), a !== void 0 && (this.ctx.fillStyle = a), r !== void 0 && (this.ctx.lineWidth = o, this.ctx.strokeStyle = r), l === 0)
|
|
2507
2502
|
this.ctx.rect(t - 0.5, e - 0.5, i, s);
|
|
2508
2503
|
else {
|
|
2509
|
-
const [h, d, f,
|
|
2510
|
-
this.ctx.moveTo(t + h, e), this.ctx.arcTo(t + i, e, t + i, e + d, d), this.ctx.arcTo(t + i, e + s, t + i - f, e + s, f), this.ctx.arcTo(t, e + s, t, e + s -
|
|
2504
|
+
const [h, d, f, u] = typeof l == "number" ? [l, l, l, l] : l;
|
|
2505
|
+
this.ctx.moveTo(t + h, e), this.ctx.arcTo(t + i, e, t + i, e + d, d), this.ctx.arcTo(t + i, e + s, t + i - f, e + s, f), this.ctx.arcTo(t, e + s, t, e + s - u, u), this.ctx.arcTo(t, e, t + h, e, h);
|
|
2511
2506
|
}
|
|
2512
2507
|
a !== void 0 && this.ctx.fill(), r !== void 0 && this.ctx.stroke(), this.ctx.restore();
|
|
2513
2508
|
}
|
|
@@ -2530,8 +2525,8 @@ class _e {
|
|
|
2530
2525
|
color: h = "#495060",
|
|
2531
2526
|
padding: d = 0,
|
|
2532
2527
|
verticalAlign: f = "middle",
|
|
2533
|
-
maxLineClamp:
|
|
2534
|
-
autoRowHeight:
|
|
2528
|
+
maxLineClamp: u = 1,
|
|
2529
|
+
autoRowHeight: x = !1,
|
|
2535
2530
|
offsetLeft: g = 0,
|
|
2536
2531
|
offsetRight: m = 0
|
|
2537
2532
|
} = r;
|
|
@@ -2541,7 +2536,7 @@ class _e {
|
|
|
2541
2536
|
let y = !1;
|
|
2542
2537
|
const b = Math.round((o - 2 * d) / E);
|
|
2543
2538
|
let C = this.wrapText(t, p, r.cacheTextKey), R = Math.min(C.length, Math.max(b, 1));
|
|
2544
|
-
|
|
2539
|
+
u === "auto" && x ? R = C.length : typeof u == "number" && u < R && u !== 1 ? R = u : (u === 1 && (C = [t], R = 1), u === "auto" && b === 1 && (C = [t], R = 1));
|
|
2545
2540
|
let S = i + d;
|
|
2546
2541
|
const O = Math.round(R * E);
|
|
2547
2542
|
f === "middle" ? S = i + (o - O) / 2 : f === "bottom" && (S = i + o - O - d);
|
|
@@ -2620,9 +2615,9 @@ class _e {
|
|
|
2620
2615
|
cacheTextKey: h = ""
|
|
2621
2616
|
} = i;
|
|
2622
2617
|
this.ctx.save(), this.ctx.font = s, this.ctx.fillStyle = a, this.ctx.textAlign = r;
|
|
2623
|
-
const d = parseInt(((m = s.match(/\d+/)) == null ? void 0 : m[0]) || "12"), f = d * (i.lineHeight || 1.2),
|
|
2618
|
+
const d = parseInt(((m = s.match(/\d+/)) == null ? void 0 : m[0]) || "12"), f = d * (i.lineHeight || 1.2), u = e - o * 2, x = this.wrapText(t, u, h);
|
|
2624
2619
|
let g = 1;
|
|
2625
|
-
return l === "auto" ? g =
|
|
2620
|
+
return l === "auto" ? g = x.length : x.length > l ? g = l : g = x.length, this.ctx.restore(), Math.max(Math.floor(g * f + o * 2), Math.floor(d + o * 2));
|
|
2626
2621
|
}
|
|
2627
2622
|
handleEllipsis(t, e, i = 0, s = "12px Arial") {
|
|
2628
2623
|
this.ctx.save();
|
|
@@ -2960,8 +2955,6 @@ class Nt {
|
|
|
2960
2955
|
n(this, "CELL_LINE_HEIGHT", 1.3);
|
|
2961
2956
|
/** 全局自动行高 */
|
|
2962
2957
|
n(this, "AUTO_ROW_HEIGHT", !1);
|
|
2963
|
-
/** 记录最大行高(开启后横向滚动不会导致行高变小) */
|
|
2964
|
-
n(this, "REMEMBER_MAX_ROW_HEIGHT", !1);
|
|
2965
2958
|
/** 启用拖拽表头 */
|
|
2966
2959
|
n(this, "ENABLE_DRAG_COLUMN", !1);
|
|
2967
2960
|
/** header 格子样式 */
|
|
@@ -3255,11 +3248,11 @@ class mt extends qt {
|
|
|
3255
3248
|
const { HEADER_CELL_STYLE_METHOD: e, HEADER_BG_COLOR: i, HEADER_TEXT_COLOR: s } = this.ctx.config;
|
|
3256
3249
|
let o = i, r = s;
|
|
3257
3250
|
if (typeof e == "function") {
|
|
3258
|
-
const h = e, { backgroundColor: d, color: f, font:
|
|
3251
|
+
const h = e, { backgroundColor: d, color: f, font: u } = h({
|
|
3259
3252
|
colIndex: this.colIndex,
|
|
3260
3253
|
column: this.column
|
|
3261
3254
|
}) || {};
|
|
3262
|
-
d && (o = d), f && (r = f),
|
|
3255
|
+
d && (o = d), f && (r = f), u && (this.drawTextFont = u);
|
|
3263
3256
|
}
|
|
3264
3257
|
const { colKey: a, type: l } = this.ctx.finderBar;
|
|
3265
3258
|
l === "header" && a === this.key && (o = this.ctx.config.FINDER_CELL_BG_COLOR), this.drawCellBgColor = o, this.drawTextColor = r;
|
|
@@ -3405,10 +3398,10 @@ class Le {
|
|
|
3405
3398
|
const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = e, o = i, {
|
|
3406
3399
|
body: { height: r, visibleHeight: a, visibleWidth: l, y: h }
|
|
3407
3400
|
} = this.ctx, d = Math.min(r, a);
|
|
3408
|
-
o > 0 && o < l && s > h && s < h + d || this.ctx.emit("mousedownBodyOutside", t), t.button === 0 && (this.handleHeaderEvent(o, s, this.ctx.header.renderCellHeaders, (
|
|
3409
|
-
this.ctx.focusCellHeader =
|
|
3410
|
-
}), this.handleBodyEvent(o, s, this.ctx.body.renderRows, (
|
|
3411
|
-
this.ctx.setFocusCell(
|
|
3401
|
+
o > 0 && o < l && s > h && s < h + d || this.ctx.emit("mousedownBodyOutside", t), t.button === 0 && (this.handleHeaderEvent(o, s, this.ctx.header.renderCellHeaders, (u) => {
|
|
3402
|
+
this.ctx.focusCellHeader = u, this.ctx.focusCell = void 0, this.ctx.emit("cellHeaderMousedown", u, t);
|
|
3403
|
+
}), this.handleBodyEvent(o, s, this.ctx.body.renderRows, (u) => {
|
|
3404
|
+
this.ctx.setFocusCell(u), this.ctx.focusCellHeader = void 0, this.ctx.emit("cellMousedown", u, t);
|
|
3412
3405
|
}));
|
|
3413
3406
|
}), this.ctx.on("mouseup", (t) => {
|
|
3414
3407
|
if (t.button !== 0 || this.isBusy(t))
|
|
@@ -3529,9 +3522,9 @@ class Le {
|
|
|
3529
3522
|
t.drawTreeImageHeight
|
|
3530
3523
|
))
|
|
3531
3524
|
return;
|
|
3532
|
-
const l = this.ctx.database.getRowForRowKey(t.rowKey), { expand: h = !1, expandLazy: d = !1 } = l || {}, { EXPAND_LAZY: f, EXPAND_LAZY_METHOD:
|
|
3533
|
-
if (f &&
|
|
3534
|
-
typeof
|
|
3525
|
+
const l = this.ctx.database.getRowForRowKey(t.rowKey), { expand: h = !1, expandLazy: d = !1 } = l || {}, { EXPAND_LAZY: f, EXPAND_LAZY_METHOD: u } = this.ctx.config;
|
|
3526
|
+
if (f && u && !h && !d)
|
|
3527
|
+
typeof u == "function" && (this.ctx.database.expandLoading(t.rowKey, !0), u({
|
|
3535
3528
|
row: t.row,
|
|
3536
3529
|
rowIndex: t.rowIndex,
|
|
3537
3530
|
colIndex: t.colIndex,
|
|
@@ -3543,8 +3536,8 @@ class Le {
|
|
|
3543
3536
|
this.ctx.database.expandLoading(t.rowKey, !1), console.error(g);
|
|
3544
3537
|
}));
|
|
3545
3538
|
else {
|
|
3546
|
-
const
|
|
3547
|
-
this.ctx.database.expandItem(t.rowKey, !
|
|
3539
|
+
const x = this.ctx.database.getIsExpand(t.rowKey);
|
|
3540
|
+
this.ctx.database.expandItem(t.rowKey, !x), this.ctx.emit("expandChange", this.ctx.database.getExpandRowKeys());
|
|
3548
3541
|
}
|
|
3549
3542
|
}
|
|
3550
3543
|
sortClick(t, e) {
|
|
@@ -4060,10 +4053,10 @@ class Xt {
|
|
|
4060
4053
|
stageHeight: i,
|
|
4061
4054
|
stageWidth: s,
|
|
4062
4055
|
config: { SCROLLER_TRACK_SIZE: o = 0, SCROLLER_SIZE: r = 0, BORDER: a }
|
|
4063
|
-
} = this.ctx, l = s, h = i, d = e.height, f = e.width,
|
|
4056
|
+
} = this.ctx, l = s, h = i, d = e.height, f = e.width, u = t.height, x = this.ctx.footer.height;
|
|
4064
4057
|
if (this.type === "vertical") {
|
|
4065
|
-
this.visibleDistance = h - o - d, this.distance =
|
|
4066
|
-
const g = this.distance ? this.visibleDistance / (
|
|
4058
|
+
this.visibleDistance = h - o - d, this.distance = u - this.visibleDistance + x, this.trackX = l - o, this.trackY = 0, this.splitPoints = [this.trackX, d, this.trackX + o, d], this.trackWidth = o, this.trackHeight = h, this.barX = this.trackX - 1 + (o - r) / 2, this.barWidth = r;
|
|
4059
|
+
const g = this.distance ? this.visibleDistance / (u + x) : 0;
|
|
4067
4060
|
let m = Math.floor(g * this.visibleDistance);
|
|
4068
4061
|
m < 30 ? m = 30 : m > this.visibleDistance && (m = 0), this.barHeight = m, this.barY = d + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
4069
4062
|
} else {
|
|
@@ -4314,9 +4307,9 @@ class De {
|
|
|
4314
4307
|
}
|
|
4315
4308
|
this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [], this.visibleColumns = Gt(this.columns);
|
|
4316
4309
|
const s = ot(this.visibleColumns), o = J(this.visibleColumns);
|
|
4317
|
-
this.height = e * s, this.visibleHeight = this.height, this.width = o.reduce((f,
|
|
4318
|
-
const
|
|
4319
|
-
return g &&
|
|
4310
|
+
this.height = e * s, this.visibleHeight = this.height, this.width = o.reduce((f, u) => {
|
|
4311
|
+
const x = u.width || 100, { maxWidth: g, minWidth: m } = u;
|
|
4312
|
+
return g && x > g ? f + g : m && x < m ? f + m : f + x;
|
|
4320
4313
|
}, 0), this.columnIndex = 0, this.resizeNum = 0;
|
|
4321
4314
|
const r = xe(rt(this.visibleColumns, s));
|
|
4322
4315
|
this.render(r, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
@@ -4331,9 +4324,9 @@ class De {
|
|
|
4331
4324
|
this.resizeAllColumn(f);
|
|
4332
4325
|
}
|
|
4333
4326
|
const h = this.fixedLeftCellHeaders.filter((f) => !f.hasChildren);
|
|
4334
|
-
this.ctx.fixedLeftWidth = h.reduce((f,
|
|
4327
|
+
this.ctx.fixedLeftWidth = h.reduce((f, u) => f + u.width, 0);
|
|
4335
4328
|
const d = this.fixedRightCellHeaders.filter((f) => !f.hasChildren);
|
|
4336
|
-
this.ctx.fixedRightWidth = d.reduce((f,
|
|
4329
|
+
this.ctx.fixedRightWidth = d.reduce((f, u) => f + u.width, i), this.ctx.maxColIndex = this.leafCellHeaders.length - 1, this.ctx.header.x = this.x, this.ctx.header.y = this.y, this.ctx.header.width = this.width, this.ctx.header.height = this.height, this.ctx.header.allCellHeaders = this.allCellHeaders, this.ctx.header.visibleWidth = this.visibleWidth, this.ctx.header.visibleHeight = this.visibleHeight;
|
|
4337
4330
|
}
|
|
4338
4331
|
// 调整表头的宽度
|
|
4339
4332
|
initResizeColumn() {
|
|
@@ -4364,10 +4357,10 @@ class De {
|
|
|
4364
4357
|
const { offsetX: r, offsetY: a } = this.ctx.getOffset(t), l = r, h = a, d = o.getDrawX(), f = o.getDrawY();
|
|
4365
4358
|
if (l > d + o.width - 5 && l < d + o.width + 4 && l < e - 4 && // 视窗中最后一列不允许调整宽
|
|
4366
4359
|
h > f) {
|
|
4367
|
-
const
|
|
4368
|
-
if (!
|
|
4360
|
+
const u = o.colIndex + o.colspan - 1, x = this.leafCellHeaders.find((g) => g.colIndex === u);
|
|
4361
|
+
if (!x || !x.fixed && this.ctx.stageWidth - this.ctx.fixedRightWidth < d + o.width)
|
|
4369
4362
|
return;
|
|
4370
|
-
this.ctx.isTarget(t) && a <= this.height && (this.ctx.stageElement.style.cursor = "col-resize", this.resizeTarget =
|
|
4363
|
+
this.ctx.isTarget(t) && a <= this.height && (this.ctx.stageElement.style.cursor = "col-resize", this.resizeTarget = x);
|
|
4371
4364
|
}
|
|
4372
4365
|
}
|
|
4373
4366
|
}
|
|
@@ -4381,8 +4374,8 @@ class De {
|
|
|
4381
4374
|
}), this.ctx.on("mouseup", () => {
|
|
4382
4375
|
if (this.ctx.config.ENABLE_DRAG_COLUMN) {
|
|
4383
4376
|
if (this.dragingCell && this.dragTarget) {
|
|
4384
|
-
const t = (h, d = {}) => (h.forEach((f,
|
|
4385
|
-
f.children && t(f.children, d), d[f.key] =
|
|
4377
|
+
const t = (h, d = {}) => (h.forEach((f, u) => {
|
|
4378
|
+
f.children && t(f.children, d), d[f.key] = u;
|
|
4386
4379
|
}), d), e = this.ctx.database.getColumns(), i = rt(e, ot(e)), s = new He(i, {
|
|
4387
4380
|
key: "key",
|
|
4388
4381
|
// 节点唯一标识字段(对应我们之前的field)
|
|
@@ -4487,10 +4480,10 @@ class De {
|
|
|
4487
4480
|
const { HEADER_HEIGHT: o = 0 } = this.ctx.config;
|
|
4488
4481
|
for (let r = 0; r < i; r++) {
|
|
4489
4482
|
const a = t[r], l = o * (a.rowspan || 0), h = o * (a.level || 0);
|
|
4490
|
-
let { minWidth: d, maxWidth: f } = a,
|
|
4491
|
-
d &&
|
|
4492
|
-
const
|
|
4493
|
-
this.ctx.database.setHeader(a.key,
|
|
4483
|
+
let { minWidth: d, maxWidth: f } = a, u = a.width || 100;
|
|
4484
|
+
d && u < d && (u = d), f && u > f && (u = f), a.children && (u = J(a.children).reduce((m, w) => m + ((w == null ? void 0 : w.width) || 100), 0));
|
|
4485
|
+
const x = new mt(this.ctx, this.columnIndex, s, h, u, l, a);
|
|
4486
|
+
this.ctx.database.setHeader(a.key, x), this.allCellHeaders.push(x), a.children || (this.leafCellHeaders.push(x), x.column.widthFillDisable || this.resizeNum++), a.fixed === "left" ? this.fixedLeftCellHeaders.push(x) : a.fixed === "right" ? this.fixedRightCellHeaders.push(x) : this.centerCellHeaders.push(x), !a.children && this.columnIndex++, a.children && this.render(a.children, s), s += u;
|
|
4494
4487
|
}
|
|
4495
4488
|
}
|
|
4496
4489
|
drawTipLine() {
|
|
@@ -4507,12 +4500,12 @@ class De {
|
|
|
4507
4500
|
if (this.ctx.paint.drawLine(h, {
|
|
4508
4501
|
borderColor: e
|
|
4509
4502
|
}), o) {
|
|
4510
|
-
const f = `${Math.floor(a + this.resizeDiff)}px`,
|
|
4511
|
-
this.ctx.paint.drawRect(l +
|
|
4503
|
+
const f = `${Math.floor(a + this.resizeDiff)}px`, u = 45, x = 24;
|
|
4504
|
+
this.ctx.paint.drawRect(l + u / 2, this.ctx.mouseY - x / 2, u, x, {
|
|
4512
4505
|
fillColor: s,
|
|
4513
4506
|
borderWidth: 0,
|
|
4514
4507
|
borderColor: "transparent"
|
|
4515
|
-
}), this.ctx.paint.drawText(f, l +
|
|
4508
|
+
}), this.ctx.paint.drawText(f, l + u / 2, this.ctx.mouseY - x / 2, u, x + 2, {
|
|
4516
4509
|
padding: 0,
|
|
4517
4510
|
color: i,
|
|
4518
4511
|
align: "center",
|
|
@@ -4645,8 +4638,11 @@ class Jt {
|
|
|
4645
4638
|
}), this.cells = e, this.calculatedHeightCells = o, this.fixedCells = i, this.noFixedCells = s;
|
|
4646
4639
|
}
|
|
4647
4640
|
updateCalculatedHeight() {
|
|
4648
|
-
const t = this.calculatedHeightCells.map((e) =>
|
|
4649
|
-
|
|
4641
|
+
const t = this.calculatedHeightCells.map((e) => {
|
|
4642
|
+
const i = e.getAutoHeight(), { key: s, height: o = -1 } = this.ctx.database.getMaxRowHeightItem(this.rowKey) || {};
|
|
4643
|
+
return i > o ? this.ctx.database.setMaxRowHeightItem(this.rowKey, e.key, i) : i !== 0 && e.key === s && i < o && this.ctx.database.setMaxRowHeightItem(this.rowKey, e.key, i), i;
|
|
4644
|
+
});
|
|
4645
|
+
return this.calculatedHeight = t.length ? Math.max(...t) : -1, this.calculatedHeight;
|
|
4650
4646
|
}
|
|
4651
4647
|
drawCenter() {
|
|
4652
4648
|
this.noFixedCells.forEach((t) => {
|
|
@@ -4710,14 +4706,14 @@ class Ne {
|
|
|
4710
4706
|
MAX_HEIGHT: h = 0,
|
|
4711
4707
|
ENABLE_OFFSET_HEIGHT: d = 0,
|
|
4712
4708
|
OFFSET_HEIGHT: f = 0,
|
|
4713
|
-
FOOTER_POSITION:
|
|
4709
|
+
FOOTER_POSITION: u
|
|
4714
4710
|
}
|
|
4715
4711
|
} = this.ctx;
|
|
4716
4712
|
if (!e.width)
|
|
4717
4713
|
return;
|
|
4718
|
-
this.x = 0,
|
|
4719
|
-
const { data:
|
|
4720
|
-
this.height = g, this.data =
|
|
4714
|
+
this.x = 0, u === "top" && o ? this.y = e.height + i.height : this.y = e.height;
|
|
4715
|
+
const { data: x, sumHeight: g } = s.getData();
|
|
4716
|
+
this.height = g, this.data = x, this.width = e.width, this.visibleWidth = this.ctx.stageWidth - r;
|
|
4721
4717
|
const m = this.ctx.footer.height;
|
|
4722
4718
|
this.ctx.isEmpty = !this.data.length, !this.data.length && !a ? this.height = l : !this.data.length && a && (this.height = a - e.height - m - r);
|
|
4723
4719
|
let w = this.height + e.height + r;
|
|
@@ -4730,7 +4726,7 @@ class Ne {
|
|
|
4730
4726
|
} else this.data.length && a ? E = a : this.data.length && h && w > h && (E = h);
|
|
4731
4727
|
E > 0 && (this.ctx.stageHeight = Math.floor(E), this.ctx.stageElement.style.height = `${this.ctx.stageHeight}px`);
|
|
4732
4728
|
let b = this.ctx.stageHeight - e.height - r;
|
|
4733
|
-
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 =
|
|
4729
|
+
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;
|
|
4734
4730
|
const C = window.devicePixelRatio || 1, R = this.ctx.stageWidth * C, S = this.ctx.stageHeight * C;
|
|
4735
4731
|
t.width = Math.round(R), t.height = Math.round(S);
|
|
4736
4732
|
const O = this.data.length ? "not-empty" : "empty";
|
|
@@ -4768,8 +4764,8 @@ class Ne {
|
|
|
4768
4764
|
if (this.isResizing && this.resizeTarget) {
|
|
4769
4765
|
const d = this.resizeTarget.height;
|
|
4770
4766
|
let f = r - this.clientY;
|
|
4771
|
-
const { calculatedHeight:
|
|
4772
|
-
f + d <
|
|
4767
|
+
const { calculatedHeight: u } = this.resizeTarget, x = u === -1 ? h : u;
|
|
4768
|
+
f + d < x && (f = -(d - x)), this.resizeDiff = f, this.ctx.emit("draw");
|
|
4773
4769
|
} else {
|
|
4774
4770
|
if (this.resizeTarget = null, this.isMouseDown)
|
|
4775
4771
|
return;
|
|
@@ -4783,8 +4779,8 @@ class Ne {
|
|
|
4783
4779
|
for (let d = 0; d < this.renderRows.length; d++) {
|
|
4784
4780
|
const f = this.renderRows[d];
|
|
4785
4781
|
if (s > f.y - l + f.height - 1.5 && s < f.y - l + f.height + 1.5 && s < a - 4)
|
|
4786
|
-
for (let
|
|
4787
|
-
const g = f.cells[
|
|
4782
|
+
for (let x = 0; x < f.cells.length; x++) {
|
|
4783
|
+
const g = f.cells[x];
|
|
4788
4784
|
o > g.drawX + 10 && o < g.drawX + g.width - 10 && g.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = f);
|
|
4789
4785
|
}
|
|
4790
4786
|
}
|
|
@@ -4868,7 +4864,7 @@ class Ne {
|
|
|
4868
4864
|
this.headIndex = Math.max(0, l), this.tailIndex = Math.min(this.ctx.maxRowIndex, h + 1), this.visibleRows = r.slice(this.headIndex, this.tailIndex + 1), this.ctx.body.headIndex = this.headIndex, this.ctx.body.tailIndex = this.tailIndex, this.ctx.body.visibleRows = this.visibleRows;
|
|
4869
4865
|
const d = [];
|
|
4870
4866
|
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
4871
|
-
const
|
|
4867
|
+
const u = this.headIndex + f, x = this.visibleRows[f], { height: g, top: m } = this.ctx.database.getPositionForRowIndex(u), w = new Jt(this.ctx, u, 0, m + this.y, t.width, g, x);
|
|
4872
4868
|
d.push(w);
|
|
4873
4869
|
}
|
|
4874
4870
|
this.renderRows = d, this.ctx.body.renderRows = d;
|
|
@@ -5094,16 +5090,16 @@ class Be {
|
|
|
5094
5090
|
SELECTOR_AREA_MIN_Y: h,
|
|
5095
5091
|
SELECTOR_AREA_MAX_Y: d,
|
|
5096
5092
|
SELECTOR_AREA_MAX_X_OFFSET: f,
|
|
5097
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
5098
|
-
} = this.ctx.config,
|
|
5093
|
+
SELECTOR_AREA_MAX_Y_OFFSET: u
|
|
5094
|
+
} = this.ctx.config, x = a, g = l || this.ctx.maxColIndex - f, m = h, w = d || this.ctx.maxRowIndex - u;
|
|
5099
5095
|
let [E, p] = o, [y, b] = r;
|
|
5100
|
-
if (E <
|
|
5096
|
+
if (E < x || p > g || y < m || b > w)
|
|
5101
5097
|
return;
|
|
5102
5098
|
if (this.ctx.config.ENABLE_MERGE_CELL_LINK) {
|
|
5103
5099
|
const R = this.adjustMergeCells(o, r);
|
|
5104
5100
|
y = R.yArr[0], b = R.yArr[1], E = R.xArr[0], p = R.xArr[1], this.ctx.onlyMergeCell = R.onlyMergeCell;
|
|
5105
5101
|
}
|
|
5106
|
-
E === p && y === b ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, o = [Math.max(
|
|
5102
|
+
E === p && y === b ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, o = [Math.max(x, E), Math.min(g, p)], r = [Math.max(m, y), Math.min(w, b)];
|
|
5107
5103
|
const { BEFORE_SET_SELECTOR_METHOD: C } = this.ctx.config;
|
|
5108
5104
|
if (typeof C == "function") {
|
|
5109
5105
|
const S = C({
|
|
@@ -5151,16 +5147,16 @@ class Be {
|
|
|
5151
5147
|
minX: o,
|
|
5152
5148
|
maxX: r
|
|
5153
5149
|
}
|
|
5154
|
-
), f = [d.minX, d.maxX],
|
|
5155
|
-
let
|
|
5150
|
+
), f = [d.minX, d.maxX], u = [h.minY, h.maxY];
|
|
5151
|
+
let x = !1;
|
|
5156
5152
|
if (d.minX !== d.maxX || h.minY !== h.maxY) {
|
|
5157
|
-
const m = JSON.stringify(f) + JSON.stringify(
|
|
5158
|
-
|
|
5153
|
+
const m = JSON.stringify(f) + JSON.stringify(u), w = (g = this.ctx.focusCell) == null ? void 0 : g.getSpanInfo();
|
|
5154
|
+
x = (w && JSON.stringify(w.xArr) + JSON.stringify(w.yArr)) === m;
|
|
5159
5155
|
}
|
|
5160
5156
|
return {
|
|
5161
5157
|
xArr: f,
|
|
5162
|
-
yArr:
|
|
5163
|
-
onlyMergeCell:
|
|
5158
|
+
yArr: u,
|
|
5159
|
+
onlyMergeCell: x
|
|
5164
5160
|
};
|
|
5165
5161
|
}
|
|
5166
5162
|
selectCols(t) {
|
|
@@ -5190,8 +5186,8 @@ class Be {
|
|
|
5190
5186
|
SELECTOR_AREA_MAX_Y: r,
|
|
5191
5187
|
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
5192
5188
|
SELECTOR_AREA_MAX_Y_OFFSET: l
|
|
5193
|
-
} = this.ctx.config, h = i, d = s || this.ctx.maxColIndex - a, f = o,
|
|
5194
|
-
this.setSelector(
|
|
5189
|
+
} = this.ctx.config, h = i, d = s || this.ctx.maxColIndex - a, f = o, u = r || this.ctx.maxRowIndex - l, x = [h, d], g = [f, u];
|
|
5190
|
+
this.setSelector(x, g);
|
|
5195
5191
|
}
|
|
5196
5192
|
}
|
|
5197
5193
|
selectRows(t, e = !0) {
|
|
@@ -5229,8 +5225,8 @@ class Be {
|
|
|
5229
5225
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
5230
5226
|
if (this.ctx.config.ENABLE_SELECTOR_SINGLE)
|
|
5231
5227
|
return;
|
|
5232
|
-
const { colIndex: s, rowIndex: o } = i, { colIndex: r, rowIndex: a } = e, l = Math.min(r, s), h = Math.max(r, s), d = Math.min(a, o), f = Math.max(a, o),
|
|
5233
|
-
this.setSelector(
|
|
5228
|
+
const { colIndex: s, rowIndex: o } = i, { colIndex: r, rowIndex: a } = e, l = Math.min(r, s), h = Math.max(r, s), d = Math.min(a, o), f = Math.max(a, o), u = [l, h], x = [d, f];
|
|
5229
|
+
this.setSelector(u, x);
|
|
5234
5230
|
} else {
|
|
5235
5231
|
this.ctx.emit("cellSelectedClick", e);
|
|
5236
5232
|
const s = [e.colIndex, e.colIndex], o = [e.rowIndex, e.rowIndex];
|
|
@@ -5296,11 +5292,11 @@ class Be {
|
|
|
5296
5292
|
const r = /* @__PURE__ */ new Set();
|
|
5297
5293
|
for (let l = 0; l <= e[1] - e[0]; l++)
|
|
5298
5294
|
for (let h = 0; h <= t[1] - t[0]; h++) {
|
|
5299
|
-
const d = l + e[0], f = h + t[0],
|
|
5300
|
-
if (
|
|
5301
|
-
const { rowKey:
|
|
5302
|
-
this.ctx.database.getReadonly(
|
|
5303
|
-
rowKey:
|
|
5295
|
+
const d = l + e[0], f = h + t[0], u = this.ctx.database.getItemValueForRowIndexAndColIndex(d, f);
|
|
5296
|
+
if (u) {
|
|
5297
|
+
const { rowKey: x, key: g } = u;
|
|
5298
|
+
this.ctx.database.getReadonly(x, g) || (r.add(x), o.push({
|
|
5299
|
+
rowKey: x,
|
|
5304
5300
|
key: g,
|
|
5305
5301
|
value: s,
|
|
5306
5302
|
row: {}
|
|
@@ -5328,13 +5324,13 @@ class Be {
|
|
|
5328
5324
|
const e = this.ctx.selector.yArr[0], i = this.ctx.selector.xArr[0], s = /* @__PURE__ */ new Set();
|
|
5329
5325
|
navigator.clipboard.readText().then(async (o) => {
|
|
5330
5326
|
let r = we(o);
|
|
5331
|
-
const a = [i, i + r[0].length - 1], l = [e, e + r.length - 1], [h, d] = l, [f,
|
|
5332
|
-
(
|
|
5327
|
+
const a = [i, i + r[0].length - 1], l = [e, e + r.length - 1], [h, d] = l, [f, u] = a, x = d - this.ctx.maxRowIndex, g = u - this.ctx.maxColIndex;
|
|
5328
|
+
(x > 0 || g > 0) && this.ctx.emit("onPastedDataOverflow", {
|
|
5333
5329
|
maxY: d,
|
|
5334
|
-
maxX:
|
|
5330
|
+
maxX: u,
|
|
5335
5331
|
minY: h,
|
|
5336
5332
|
minX: f,
|
|
5337
|
-
overflowRowCount:
|
|
5333
|
+
overflowRowCount: x,
|
|
5338
5334
|
overflowColCount: g,
|
|
5339
5335
|
textArr: r
|
|
5340
5336
|
});
|
|
@@ -5439,8 +5435,8 @@ class Be {
|
|
|
5439
5435
|
SELECTOR_AREA_MAX_Y: r,
|
|
5440
5436
|
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
5441
5437
|
SELECTOR_AREA_MAX_Y_OFFSET: l
|
|
5442
|
-
} = this.ctx.config, h = i, d = s || this.ctx.maxColIndex - a, f = o,
|
|
5443
|
-
return !(e < h || e > d || t < f || t >
|
|
5438
|
+
} = this.ctx.config, h = i, d = s || this.ctx.maxColIndex - a, f = o, u = r || this.ctx.maxRowIndex - l;
|
|
5439
|
+
return !(e < h || e > d || t < f || t > u);
|
|
5444
5440
|
}
|
|
5445
5441
|
/**
|
|
5446
5442
|
* 调整滚动条位置,让焦点单元格始终出现在可视区域内
|
|
@@ -5457,7 +5453,7 @@ class Be {
|
|
|
5457
5453
|
body: l,
|
|
5458
5454
|
scrollX: h,
|
|
5459
5455
|
scrollY: d,
|
|
5460
|
-
config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED:
|
|
5456
|
+
config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED: u, FOOTER_POSITION: x, ENABLE_MERGE_CELL_LINK: g }
|
|
5461
5457
|
} = this.ctx;
|
|
5462
5458
|
if (!i)
|
|
5463
5459
|
return;
|
|
@@ -5466,7 +5462,7 @@ class Be {
|
|
|
5466
5462
|
let R = r.height - w, S = p;
|
|
5467
5463
|
S > l.visibleHeight && (S = l.visibleHeight);
|
|
5468
5464
|
let O = 0;
|
|
5469
|
-
|
|
5465
|
+
u && (x === "top" ? R = r.height + a.height - w : O = a.visibleHeight);
|
|
5470
5466
|
const v = w + S - (t - O - f);
|
|
5471
5467
|
let I = h, _ = d;
|
|
5472
5468
|
C > 0 && !y ? I = Math.floor(h + C) : b > 0 && !y && (I = Math.floor(h - b)), R > 0 ? _ = Math.floor(d - R) : v > 0 && (_ = Math.floor(d + v)), (Math.abs(h - I) > 2 || Math.abs(d - _) > 2) && (this.ctx.adjustPositioning = !0, this.ctx.emit("adjustBoundaryPosition", i), this.ctx.setScroll(I, _));
|
|
@@ -5484,8 +5480,8 @@ class Xe {
|
|
|
5484
5480
|
this.ctx.on("mousemove", (t) => {
|
|
5485
5481
|
if (this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default"), this.ctx.editing || !this.ctx.focusCell || !this.maxColRowCell)
|
|
5486
5482
|
return;
|
|
5487
|
-
const { offsetX: e, offsetY: i } = this.ctx.getOffset(t), { colIndex: s, rowIndex: o, drawX: r, drawY: a, width: l, height: h } = this.maxColRowCell, d = 6, f = s === this.ctx.maxColIndex || o === this.ctx.maxRowIndex ? 0 : 2,
|
|
5488
|
-
e >
|
|
5483
|
+
const { offsetX: e, offsetY: i } = this.ctx.getOffset(t), { colIndex: s, rowIndex: o, drawX: r, drawY: a, width: l, height: h } = this.maxColRowCell, d = 6, f = s === this.ctx.maxColIndex || o === this.ctx.maxRowIndex ? 0 : 2, u = r + l - d + f, x = a + h - d + f;
|
|
5484
|
+
e > u && i > x && e < u + d && i < x + d && (this.ctx.stageElement.style.cursor = "crosshair"), this.ctx.autofillMove && this.ctx.startAdjustPosition(t);
|
|
5489
5485
|
}), this.ctx.on("cellMouseenter", (t) => {
|
|
5490
5486
|
const { xArr: e, yArr: i } = this.ctx.selector, s = e[1], o = i[1], { colIndex: r, rowIndex: a } = t;
|
|
5491
5487
|
this.ctx.config.ENABLE_AUTOFILL && r === s && a === o && (this.maxColRowCell = t), this.mouseenter(t);
|
|
@@ -5523,11 +5519,11 @@ class Xe {
|
|
|
5523
5519
|
const {
|
|
5524
5520
|
SELECTOR_AREA_MIN_X: d,
|
|
5525
5521
|
SELECTOR_AREA_MAX_X: f,
|
|
5526
|
-
SELECTOR_AREA_MIN_Y:
|
|
5527
|
-
SELECTOR_AREA_MAX_Y:
|
|
5522
|
+
SELECTOR_AREA_MIN_Y: u,
|
|
5523
|
+
SELECTOR_AREA_MAX_Y: x,
|
|
5528
5524
|
SELECTOR_AREA_MAX_X_OFFSET: g,
|
|
5529
5525
|
SELECTOR_AREA_MAX_Y_OFFSET: m
|
|
5530
|
-
} = this.ctx.config, w = d, E = f || this.ctx.maxColIndex - g, p =
|
|
5526
|
+
} = this.ctx.config, w = d, E = f || this.ctx.maxColIndex - g, p = u, y = x || this.ctx.maxRowIndex - m;
|
|
5531
5527
|
let [b, C] = r, [R, S] = a;
|
|
5532
5528
|
if (b < w || R < p)
|
|
5533
5529
|
return;
|
|
@@ -5551,24 +5547,24 @@ class Xe {
|
|
|
5551
5547
|
*/
|
|
5552
5548
|
async autofillData() {
|
|
5553
5549
|
const t = /* @__PURE__ */ new Set(), e = this.ctx.getSelectedData(), i = /* @__PURE__ */ new Map();
|
|
5554
|
-
for (let
|
|
5550
|
+
for (let x = 0; x <= e.yArr[1] - e.yArr[0]; x++)
|
|
5555
5551
|
for (let g = 0; g <= e.xArr[1] - e.xArr[0]; g++) {
|
|
5556
|
-
const m =
|
|
5552
|
+
const m = x + e.yArr[0], w = g + e.xArr[0];
|
|
5557
5553
|
i.set(`${m}-${w}`, !0);
|
|
5558
5554
|
}
|
|
5559
5555
|
const { value: s } = e, o = s[0].length, r = s.length, a = this.ctx.autofill.xArr, l = this.ctx.autofill.yArr, h = o === 1 && r === 1;
|
|
5560
5556
|
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a, l) && !h) {
|
|
5561
|
-
const
|
|
5557
|
+
const x = {
|
|
5562
5558
|
code: "ERR_MERGED_CELLS_AUTOFILL",
|
|
5563
5559
|
message: "Merged cells cannot span autofill data"
|
|
5564
5560
|
};
|
|
5565
|
-
this.ctx.hasEvent("error") ? this.ctx.emit("error",
|
|
5561
|
+
this.ctx.hasEvent("error") ? this.ctx.emit("error", x) : alert(x.message);
|
|
5566
5562
|
return;
|
|
5567
5563
|
}
|
|
5568
5564
|
let d = [];
|
|
5569
|
-
for (let
|
|
5565
|
+
for (let x = 0; x <= l[1] - l[0]; x++)
|
|
5570
5566
|
for (let g = 0; g <= a[1] - a[0]; g++) {
|
|
5571
|
-
const m = g + a[0], w =
|
|
5567
|
+
const m = g + a[0], w = x + l[0], E = s[x % r][g % o], p = this.ctx.database.getItemValueForRowIndexAndColIndex(w, m), y = `${w}-${m}`;
|
|
5572
5568
|
if (p && !i.has(y)) {
|
|
5573
5569
|
const { rowKey: b, key: C } = p;
|
|
5574
5570
|
this.ctx.database.getReadonly(b, C) || (t.add(b), d.push({
|
|
@@ -5584,21 +5580,21 @@ class Xe {
|
|
|
5584
5580
|
this.ctx.selector.xArr = this.ctx.autofill.xArr, this.ctx.selector.yArr = this.ctx.autofill.yArr;
|
|
5585
5581
|
const { BEFORE_AUTOFILL_DATA_METHOD: f } = this.ctx.config;
|
|
5586
5582
|
if (typeof f == "function") {
|
|
5587
|
-
const
|
|
5583
|
+
const x = f, g = d.map((m) => ({
|
|
5588
5584
|
rowKey: m.rowKey,
|
|
5589
5585
|
key: m.key,
|
|
5590
5586
|
value: m.value,
|
|
5591
5587
|
oldValue: this.ctx.database.getItemValue(m.rowKey, m.key),
|
|
5592
5588
|
row: this.ctx.database.getRowDataItemForRowKey(m.rowKey)
|
|
5593
5589
|
}));
|
|
5594
|
-
if (d = await
|
|
5590
|
+
if (d = await x(g, a, l), d && !d.length)
|
|
5595
5591
|
return;
|
|
5596
5592
|
}
|
|
5597
5593
|
this.ctx.batchSetItemValueByEditor(d, !0);
|
|
5598
|
-
let
|
|
5599
|
-
t.forEach((
|
|
5600
|
-
|
|
5601
|
-
}), this.ctx.emit("autofillChange", d,
|
|
5594
|
+
let u = [];
|
|
5595
|
+
t.forEach((x) => {
|
|
5596
|
+
u.push(this.ctx.database.getRowDataItemForRowKey(x));
|
|
5597
|
+
}), this.ctx.emit("autofillChange", d, u), this.ctx.emit("draw");
|
|
5602
5598
|
}
|
|
5603
5599
|
mouseenter(t) {
|
|
5604
5600
|
if (["index", "selection", "index-selection"].includes(t.type))
|
|
@@ -5723,48 +5719,48 @@ function Ft(c, t, e) {
|
|
|
5723
5719
|
reference: i,
|
|
5724
5720
|
floating: s
|
|
5725
5721
|
} = c;
|
|
5726
|
-
const o = V(t), r = _t(t), a = Rt(r), l = $(t), h = o === "y", d = i.x + i.width / 2 - s.width / 2, f = i.y + i.height / 2 - s.height / 2,
|
|
5727
|
-
let
|
|
5722
|
+
const o = V(t), r = _t(t), a = Rt(r), l = $(t), h = o === "y", d = i.x + i.width / 2 - s.width / 2, f = i.y + i.height / 2 - s.height / 2, u = i[a] / 2 - s[a] / 2;
|
|
5723
|
+
let x;
|
|
5728
5724
|
switch (l) {
|
|
5729
5725
|
case "top":
|
|
5730
|
-
|
|
5726
|
+
x = {
|
|
5731
5727
|
x: d,
|
|
5732
5728
|
y: i.y - s.height
|
|
5733
5729
|
};
|
|
5734
5730
|
break;
|
|
5735
5731
|
case "bottom":
|
|
5736
|
-
|
|
5732
|
+
x = {
|
|
5737
5733
|
x: d,
|
|
5738
5734
|
y: i.y + i.height
|
|
5739
5735
|
};
|
|
5740
5736
|
break;
|
|
5741
5737
|
case "right":
|
|
5742
|
-
|
|
5738
|
+
x = {
|
|
5743
5739
|
x: i.x + i.width,
|
|
5744
5740
|
y: f
|
|
5745
5741
|
};
|
|
5746
5742
|
break;
|
|
5747
5743
|
case "left":
|
|
5748
|
-
|
|
5744
|
+
x = {
|
|
5749
5745
|
x: i.x - s.width,
|
|
5750
5746
|
y: f
|
|
5751
5747
|
};
|
|
5752
5748
|
break;
|
|
5753
5749
|
default:
|
|
5754
|
-
|
|
5750
|
+
x = {
|
|
5755
5751
|
x: i.x,
|
|
5756
5752
|
y: i.y
|
|
5757
5753
|
};
|
|
5758
5754
|
}
|
|
5759
5755
|
switch (et(t)) {
|
|
5760
5756
|
case "start":
|
|
5761
|
-
|
|
5757
|
+
x[r] -= u * (e && h ? -1 : 1);
|
|
5762
5758
|
break;
|
|
5763
5759
|
case "end":
|
|
5764
|
-
|
|
5760
|
+
x[r] += u * (e && h ? -1 : 1);
|
|
5765
5761
|
break;
|
|
5766
5762
|
}
|
|
5767
|
-
return
|
|
5763
|
+
return x;
|
|
5768
5764
|
}
|
|
5769
5765
|
const je = async (c, t, e) => {
|
|
5770
5766
|
const {
|
|
@@ -5780,7 +5776,7 @@ const je = async (c, t, e) => {
|
|
|
5780
5776
|
}), {
|
|
5781
5777
|
x: d,
|
|
5782
5778
|
y: f
|
|
5783
|
-
} = Ft(h, i, l),
|
|
5779
|
+
} = Ft(h, i, l), u = i, x = {}, g = 0;
|
|
5784
5780
|
for (let m = 0; m < a.length; m++) {
|
|
5785
5781
|
const {
|
|
5786
5782
|
name: w,
|
|
@@ -5794,9 +5790,9 @@ const je = async (c, t, e) => {
|
|
|
5794
5790
|
x: d,
|
|
5795
5791
|
y: f,
|
|
5796
5792
|
initialPlacement: i,
|
|
5797
|
-
placement:
|
|
5793
|
+
placement: u,
|
|
5798
5794
|
strategy: s,
|
|
5799
|
-
middlewareData:
|
|
5795
|
+
middlewareData: x,
|
|
5800
5796
|
rects: h,
|
|
5801
5797
|
platform: r,
|
|
5802
5798
|
elements: {
|
|
@@ -5804,27 +5800,27 @@ const je = async (c, t, e) => {
|
|
|
5804
5800
|
floating: t
|
|
5805
5801
|
}
|
|
5806
5802
|
});
|
|
5807
|
-
d = p ?? d, f = y ?? f,
|
|
5808
|
-
...
|
|
5803
|
+
d = p ?? d, f = y ?? f, x = {
|
|
5804
|
+
...x,
|
|
5809
5805
|
[w]: {
|
|
5810
|
-
...
|
|
5806
|
+
...x[w],
|
|
5811
5807
|
...b
|
|
5812
5808
|
}
|
|
5813
|
-
}, C && g <= 50 && (g++, typeof C == "object" && (C.placement && (
|
|
5809
|
+
}, C && g <= 50 && (g++, typeof C == "object" && (C.placement && (u = C.placement), C.rects && (h = C.rects === !0 ? await r.getElementRects({
|
|
5814
5810
|
reference: c,
|
|
5815
5811
|
floating: t,
|
|
5816
5812
|
strategy: s
|
|
5817
5813
|
}) : C.rects), {
|
|
5818
5814
|
x: d,
|
|
5819
5815
|
y: f
|
|
5820
|
-
} = Ft(h,
|
|
5816
|
+
} = Ft(h, u, l)), m = -1);
|
|
5821
5817
|
}
|
|
5822
5818
|
return {
|
|
5823
5819
|
x: d,
|
|
5824
5820
|
y: f,
|
|
5825
|
-
placement:
|
|
5821
|
+
placement: u,
|
|
5826
5822
|
strategy: s,
|
|
5827
|
-
middlewareData:
|
|
5823
|
+
middlewareData: x
|
|
5828
5824
|
};
|
|
5829
5825
|
};
|
|
5830
5826
|
async function ee(c, t) {
|
|
@@ -5841,9 +5837,9 @@ async function ee(c, t) {
|
|
|
5841
5837
|
boundary: h = "clippingAncestors",
|
|
5842
5838
|
rootBoundary: d = "viewport",
|
|
5843
5839
|
elementContext: f = "floating",
|
|
5844
|
-
altBoundary:
|
|
5845
|
-
padding:
|
|
5846
|
-
} = tt(t, c), g = te(
|
|
5840
|
+
altBoundary: u = !1,
|
|
5841
|
+
padding: x = 0
|
|
5842
|
+
} = tt(t, c), g = te(x), w = a[u ? f === "floating" ? "reference" : "floating" : f], E = ht(await o.getClippingRect({
|
|
5847
5843
|
element: (e = await (o.isElement == null ? void 0 : o.isElement(w))) == null || e ? w : w.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(a.floating)),
|
|
5848
5844
|
boundary: h,
|
|
5849
5845
|
rootBoundary: d,
|
|
@@ -5890,17 +5886,17 @@ const qe = (c) => ({
|
|
|
5890
5886
|
} = tt(c, t) || {};
|
|
5891
5887
|
if (h == null)
|
|
5892
5888
|
return {};
|
|
5893
|
-
const f = te(d),
|
|
5889
|
+
const f = te(d), u = {
|
|
5894
5890
|
x: e,
|
|
5895
5891
|
y: i
|
|
5896
|
-
},
|
|
5892
|
+
}, x = _t(s), g = Rt(x), m = await r.getDimensions(h), w = x === "y", E = w ? "top" : "left", p = w ? "bottom" : "right", y = w ? "clientHeight" : "clientWidth", b = o.reference[g] + o.reference[x] - u[x] - o.floating[g], C = u[x] - o.reference[x], R = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(h));
|
|
5897
5893
|
let S = R ? R[y] : 0;
|
|
5898
5894
|
(!S || !await (r.isElement == null ? void 0 : r.isElement(R))) && (S = a.floating[y] || o.floating[g]);
|
|
5899
5895
|
const O = b / 2 - C / 2, v = S / 2 - m[g] / 2 - 1, I = j(f[E], v), _ = j(f[p], v), T = I, M = S - m[g] - _, L = S / 2 - m[g] / 2 + O, A = Et(T, L, M), H = !l.arrow && et(s) != null && L !== A && o.reference[g] / 2 - (L < T ? I : _) - m[g] / 2 < 0, D = H ? L < T ? L - T : L - M : 0;
|
|
5900
5896
|
return {
|
|
5901
|
-
[
|
|
5897
|
+
[x]: u[x] + D,
|
|
5902
5898
|
data: {
|
|
5903
|
-
[
|
|
5899
|
+
[x]: A,
|
|
5904
5900
|
centerOffset: L - A - D,
|
|
5905
5901
|
...H && {
|
|
5906
5902
|
alignmentOffset: D
|
|
@@ -5925,16 +5921,16 @@ const qe = (c) => ({
|
|
|
5925
5921
|
} = t, {
|
|
5926
5922
|
mainAxis: d = !0,
|
|
5927
5923
|
crossAxis: f = !0,
|
|
5928
|
-
fallbackPlacements:
|
|
5929
|
-
fallbackStrategy:
|
|
5924
|
+
fallbackPlacements: u,
|
|
5925
|
+
fallbackStrategy: x = "bestFit",
|
|
5930
5926
|
fallbackAxisSideDirection: g = "none",
|
|
5931
5927
|
flipAlignment: m = !0,
|
|
5932
5928
|
...w
|
|
5933
5929
|
} = tt(c, t);
|
|
5934
5930
|
if ((e = o.arrow) != null && e.alignmentOffset)
|
|
5935
5931
|
return {};
|
|
5936
|
-
const E = $(s), p = V(a), y = $(a) === a, b = await (l.isRTL == null ? void 0 : l.isRTL(h.floating)), C =
|
|
5937
|
-
!
|
|
5932
|
+
const E = $(s), p = V(a), y = $(a) === a, b = await (l.isRTL == null ? void 0 : l.isRTL(h.floating)), C = u || (y || !m ? [lt(a)] : Ve(a)), R = g !== "none";
|
|
5933
|
+
!u && R && C.push(...Ge(a, m, g, b));
|
|
5938
5934
|
const S = [a, ...C], O = await ee(t, w), v = [];
|
|
5939
5935
|
let I = ((i = o.flip) == null ? void 0 : i.overflows) || [];
|
|
5940
5936
|
if (d && v.push(O[E]), f) {
|
|
@@ -5961,7 +5957,7 @@ const qe = (c) => ({
|
|
|
5961
5957
|
};
|
|
5962
5958
|
let H = (T = I.filter((D) => D.overflows[0] <= 0).sort((D, k) => D.overflows[1] - k.overflows[1])[0]) == null ? void 0 : T.placement;
|
|
5963
5959
|
if (!H)
|
|
5964
|
-
switch (
|
|
5960
|
+
switch (x) {
|
|
5965
5961
|
case "bestFit": {
|
|
5966
5962
|
var M;
|
|
5967
5963
|
const D = (M = I.filter((k) => {
|
|
@@ -5998,8 +5994,8 @@ async function Qe(c, t) {
|
|
|
5998
5994
|
elements: s
|
|
5999
5995
|
} = c, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r = $(e), a = et(e), l = V(e) === "y", h = Je.has(r) ? -1 : 1, d = o && l ? -1 : 1, f = tt(t, c);
|
|
6000
5996
|
let {
|
|
6001
|
-
mainAxis:
|
|
6002
|
-
crossAxis:
|
|
5997
|
+
mainAxis: u,
|
|
5998
|
+
crossAxis: x,
|
|
6003
5999
|
alignmentAxis: g
|
|
6004
6000
|
} = typeof f == "number" ? {
|
|
6005
6001
|
mainAxis: f,
|
|
@@ -6010,12 +6006,12 @@ async function Qe(c, t) {
|
|
|
6010
6006
|
crossAxis: f.crossAxis || 0,
|
|
6011
6007
|
alignmentAxis: f.alignmentAxis
|
|
6012
6008
|
};
|
|
6013
|
-
return a && typeof g == "number" && (
|
|
6014
|
-
x:
|
|
6015
|
-
y:
|
|
6009
|
+
return a && typeof g == "number" && (x = a === "end" ? g * -1 : g), l ? {
|
|
6010
|
+
x: x * d,
|
|
6011
|
+
y: u * h
|
|
6016
6012
|
} : {
|
|
6017
|
-
x:
|
|
6018
|
-
y:
|
|
6013
|
+
x: u * h,
|
|
6014
|
+
y: x * d
|
|
6019
6015
|
};
|
|
6020
6016
|
}
|
|
6021
6017
|
const ti = function(c) {
|
|
@@ -6068,11 +6064,11 @@ const ti = function(c) {
|
|
|
6068
6064
|
} = tt(c, t), h = {
|
|
6069
6065
|
x: e,
|
|
6070
6066
|
y: i
|
|
6071
|
-
}, d = await ee(t, l), f = V($(s)),
|
|
6072
|
-
let
|
|
6067
|
+
}, d = await ee(t, l), f = V($(s)), u = Qt(f);
|
|
6068
|
+
let x = h[u], g = h[f];
|
|
6073
6069
|
if (o) {
|
|
6074
|
-
const w =
|
|
6075
|
-
|
|
6070
|
+
const w = u === "y" ? "top" : "left", E = u === "y" ? "bottom" : "right", p = x + d[w], y = x - d[E];
|
|
6071
|
+
x = Et(p, x, y);
|
|
6076
6072
|
}
|
|
6077
6073
|
if (r) {
|
|
6078
6074
|
const w = f === "y" ? "top" : "left", E = f === "y" ? "bottom" : "right", p = g + d[w], y = g - d[E];
|
|
@@ -6080,7 +6076,7 @@ const ti = function(c) {
|
|
|
6080
6076
|
}
|
|
6081
6077
|
const m = a.fn({
|
|
6082
6078
|
...t,
|
|
6083
|
-
[
|
|
6079
|
+
[u]: x,
|
|
6084
6080
|
[f]: g
|
|
6085
6081
|
});
|
|
6086
6082
|
return {
|
|
@@ -6089,7 +6085,7 @@ const ti = function(c) {
|
|
|
6089
6085
|
x: m.x - e,
|
|
6090
6086
|
y: m.y - i,
|
|
6091
6087
|
enabled: {
|
|
6092
|
-
[
|
|
6088
|
+
[u]: o,
|
|
6093
6089
|
[f]: r
|
|
6094
6090
|
}
|
|
6095
6091
|
}
|
|
@@ -6258,9 +6254,9 @@ function G(c, t, e, i) {
|
|
|
6258
6254
|
const a = fi(o, e, i) ? re(o) : Y(0);
|
|
6259
6255
|
let l = (s.left + a.x) / r.x, h = (s.top + a.y) / r.y, d = s.width / r.x, f = s.height / r.y;
|
|
6260
6256
|
if (o) {
|
|
6261
|
-
const
|
|
6262
|
-
let g =
|
|
6263
|
-
for (; m && i &&
|
|
6257
|
+
const u = N(o), x = i && B(i) ? N(i) : i;
|
|
6258
|
+
let g = u, m = yt(g);
|
|
6259
|
+
for (; m && i && x !== g; ) {
|
|
6264
6260
|
const w = U(m), E = m.getBoundingClientRect(), p = X(m), y = E.left + (m.clientLeft + parseFloat(p.paddingLeft)) * w.x, b = E.top + (m.clientTop + parseFloat(p.paddingTop)) * w.y;
|
|
6265
6261
|
l *= w.x, h *= w.y, d *= w.x, f *= w.y, l += y, h += b, g = N(m), m = yt(g);
|
|
6266
6262
|
}
|
|
@@ -6303,15 +6299,15 @@ function ui(c) {
|
|
|
6303
6299
|
}, h = Y(1);
|
|
6304
6300
|
const d = Y(0), f = K(i);
|
|
6305
6301
|
if ((f || !f && !o) && ((Z(i) !== "body" || it(r)) && (l = gt(i)), K(i))) {
|
|
6306
|
-
const
|
|
6307
|
-
h = U(i), d.x =
|
|
6302
|
+
const x = G(i);
|
|
6303
|
+
h = U(i), d.x = x.x + i.clientLeft, d.y = x.y + i.clientTop;
|
|
6308
6304
|
}
|
|
6309
|
-
const
|
|
6305
|
+
const u = r && !f && !o ? ne(r, l, !0) : Y(0);
|
|
6310
6306
|
return {
|
|
6311
6307
|
width: e.width * h.x,
|
|
6312
6308
|
height: e.height * h.y,
|
|
6313
|
-
x: e.x * h.x - l.scrollLeft * h.x + d.x +
|
|
6314
|
-
y: e.y * h.y - l.scrollTop * h.y + d.y +
|
|
6309
|
+
x: e.x * h.x - l.scrollLeft * h.x + d.x + u.x,
|
|
6310
|
+
y: e.y * h.y - l.scrollTop * h.y + d.y + u.y
|
|
6315
6311
|
};
|
|
6316
6312
|
}
|
|
6317
6313
|
function xi(c) {
|
|
@@ -6429,14 +6425,14 @@ function bi(c, t, e) {
|
|
|
6429
6425
|
}
|
|
6430
6426
|
if (i || !i && !o)
|
|
6431
6427
|
if ((Z(t) !== "body" || it(s)) && (a = gt(t)), i) {
|
|
6432
|
-
const
|
|
6433
|
-
l.x =
|
|
6428
|
+
const x = G(t, !0, o, t);
|
|
6429
|
+
l.x = x.x + t.clientLeft, l.y = x.y + t.clientTop;
|
|
6434
6430
|
} else s && h();
|
|
6435
6431
|
o && !i && s && h();
|
|
6436
|
-
const d = s && !i && !o ? ne(s, a) : Y(0), f = r.left + a.scrollLeft - l.x - d.x,
|
|
6432
|
+
const d = s && !i && !o ? ne(s, a) : Y(0), f = r.left + a.scrollLeft - l.x - d.x, u = r.top + a.scrollTop - l.y - d.y;
|
|
6437
6433
|
return {
|
|
6438
6434
|
x: f,
|
|
6439
|
-
y:
|
|
6435
|
+
y: u,
|
|
6440
6436
|
width: r.width,
|
|
6441
6437
|
height: r.height
|
|
6442
6438
|
};
|
|
@@ -6512,12 +6508,12 @@ function _i(c, t) {
|
|
|
6512
6508
|
const h = c.getBoundingClientRect(), {
|
|
6513
6509
|
left: d,
|
|
6514
6510
|
top: f,
|
|
6515
|
-
width:
|
|
6516
|
-
height:
|
|
6511
|
+
width: u,
|
|
6512
|
+
height: x
|
|
6517
6513
|
} = h;
|
|
6518
|
-
if (a || t(), !
|
|
6514
|
+
if (a || t(), !u || !x)
|
|
6519
6515
|
return;
|
|
6520
|
-
const g = st(f), m = st(s.clientWidth - (d +
|
|
6516
|
+
const g = st(f), m = st(s.clientWidth - (d + u)), w = st(s.clientHeight - (f + x)), E = st(d), y = {
|
|
6521
6517
|
rootMargin: -g + "px " + -m + "px " + -w + "px " + -E + "px",
|
|
6522
6518
|
threshold: z(0, j(1, l)) || 1
|
|
6523
6519
|
};
|
|
@@ -6561,14 +6557,14 @@ function Ct(c, t, e, i) {
|
|
|
6561
6557
|
}), o && E.addEventListener("resize", e);
|
|
6562
6558
|
});
|
|
6563
6559
|
const f = h && a ? _i(h, e) : null;
|
|
6564
|
-
let
|
|
6565
|
-
r && (
|
|
6560
|
+
let u = -1, x = null;
|
|
6561
|
+
r && (x = new ResizeObserver((E) => {
|
|
6566
6562
|
let [p] = E;
|
|
6567
|
-
p && p.target === h &&
|
|
6563
|
+
p && p.target === h && x && (x.unobserve(t), cancelAnimationFrame(u), u = requestAnimationFrame(() => {
|
|
6568
6564
|
var y;
|
|
6569
|
-
(y =
|
|
6565
|
+
(y = x) == null || y.observe(t);
|
|
6570
6566
|
})), e();
|
|
6571
|
-
}), h && !l &&
|
|
6567
|
+
}), h && !l && x.observe(h), x.observe(t));
|
|
6572
6568
|
let g, m = l ? G(c) : null;
|
|
6573
6569
|
l && w();
|
|
6574
6570
|
function w() {
|
|
@@ -6579,7 +6575,7 @@ function Ct(c, t, e, i) {
|
|
|
6579
6575
|
var E;
|
|
6580
6576
|
d.forEach((p) => {
|
|
6581
6577
|
s && p.removeEventListener("scroll", e), o && p.removeEventListener("resize", e);
|
|
6582
|
-
}), f == null || f(), (E =
|
|
6578
|
+
}), f == null || f(), (E = x) == null || E.disconnect(), x = null, l && cancelAnimationFrame(g);
|
|
6583
6579
|
};
|
|
6584
6580
|
}
|
|
6585
6581
|
const ct = ti, dt = ei, Mt = Ze, Si = qe, ft = (c, t, e) => {
|
|
@@ -6682,31 +6678,31 @@ let Ti = class {
|
|
|
6682
6678
|
placement: t.overflowTooltipPlacement,
|
|
6683
6679
|
middleware: [dt(), Mt(), ct(6), Si({ element: this.arrowEl })]
|
|
6684
6680
|
}).then((l) => {
|
|
6685
|
-
const { x: h, y: d, placement: f, middlewareData:
|
|
6681
|
+
const { x: h, y: d, placement: f, middlewareData: u } = l;
|
|
6686
6682
|
if (Object.assign(this.floatingEl.style, {
|
|
6687
6683
|
top: `${d}px`,
|
|
6688
6684
|
left: `${h}px`
|
|
6689
|
-
}),
|
|
6690
|
-
const
|
|
6685
|
+
}), u.arrow) {
|
|
6686
|
+
const x = u.arrow;
|
|
6691
6687
|
["left", "left-start", "left-end"].includes(f) ? Object.assign(this.arrowEl.style, {
|
|
6692
|
-
top: `${
|
|
6688
|
+
top: `${x.y}px`,
|
|
6693
6689
|
bottom: "",
|
|
6694
6690
|
left: "",
|
|
6695
6691
|
right: "-5px"
|
|
6696
6692
|
}) : ["right", "right-start", "right-end"].includes(f) ? Object.assign(this.arrowEl.style, {
|
|
6697
|
-
top: `${
|
|
6693
|
+
top: `${x.y}px`,
|
|
6698
6694
|
bottom: "",
|
|
6699
6695
|
left: "-5px",
|
|
6700
6696
|
right: ""
|
|
6701
6697
|
}) : ["bottom", "bottom-start", "bottom-end"].includes(f) ? Object.assign(this.arrowEl.style, {
|
|
6702
6698
|
top: "-5px",
|
|
6703
6699
|
bottom: "",
|
|
6704
|
-
left: `${
|
|
6700
|
+
left: `${x.x}px`,
|
|
6705
6701
|
right: ""
|
|
6706
6702
|
}) : ["top", "top-start", "top-end"].includes(f) && Object.assign(this.arrowEl.style, {
|
|
6707
6703
|
top: "",
|
|
6708
6704
|
bottom: "-5px",
|
|
6709
|
-
left: `${
|
|
6705
|
+
left: `${x.x}px`,
|
|
6710
6706
|
right: ""
|
|
6711
6707
|
});
|
|
6712
6708
|
}
|
|
@@ -6754,7 +6750,7 @@ class Oi {
|
|
|
6754
6750
|
l && (this.ctx.emit("setSelectorCell", l), this.cellTarget = l), this.doneEdit();
|
|
6755
6751
|
return;
|
|
6756
6752
|
}
|
|
6757
|
-
if ((t.altKey || t.metaKey) && t.
|
|
6753
|
+
if ((t.altKey || t.metaKey) && t.key === "Enter" && this.ctx.editing && this.inputEl) {
|
|
6758
6754
|
t.preventDefault();
|
|
6759
6755
|
const l = this.inputEl.selectionStart, h = this.inputEl.value.substring(0, l), d = this.inputEl.value.substring(l);
|
|
6760
6756
|
this.inputEl.value = h + `
|
|
@@ -6769,7 +6765,7 @@ class Oi {
|
|
|
6769
6765
|
this.ctx.emit("setMoveFocus", "RIGHT");
|
|
6770
6766
|
return;
|
|
6771
6767
|
}
|
|
6772
|
-
if (t.
|
|
6768
|
+
if (t.key === "Enter" && this.ctx.editing) {
|
|
6773
6769
|
if (t.preventDefault(), this.doneEdit(), t.shiftKey) {
|
|
6774
6770
|
this.ctx.emit("setMoveFocus", "TOP");
|
|
6775
6771
|
return;
|
|
@@ -6777,7 +6773,7 @@ class Oi {
|
|
|
6777
6773
|
this.ctx.emit("setMoveFocus", "BOTTOM");
|
|
6778
6774
|
return;
|
|
6779
6775
|
}
|
|
6780
|
-
if (t.
|
|
6776
|
+
if (t.key === "Enter" && !this.ctx.editing) {
|
|
6781
6777
|
t.preventDefault(), this.startEdit();
|
|
6782
6778
|
return;
|
|
6783
6779
|
}
|
|
@@ -7012,7 +7008,7 @@ class Mi {
|
|
|
7012
7008
|
a.forEach((w) => {
|
|
7013
7009
|
w.render && (w.fixed === "left" ? h.push(w) : w.fixed === "right" ? d.push(w) : l.push(w));
|
|
7014
7010
|
});
|
|
7015
|
-
const f = e - i,
|
|
7011
|
+
const f = e - i, u = {
|
|
7016
7012
|
key: "left",
|
|
7017
7013
|
style: {
|
|
7018
7014
|
position: "absolute",
|
|
@@ -7023,7 +7019,7 @@ class Mi {
|
|
|
7023
7019
|
height: `${r}px`
|
|
7024
7020
|
},
|
|
7025
7021
|
cells: h
|
|
7026
|
-
},
|
|
7022
|
+
}, x = {
|
|
7027
7023
|
key: "center",
|
|
7028
7024
|
style: {
|
|
7029
7025
|
position: "absolute",
|
|
@@ -7055,7 +7051,7 @@ class Mi {
|
|
|
7055
7051
|
width: `${o}px`,
|
|
7056
7052
|
height: `${r}px`
|
|
7057
7053
|
},
|
|
7058
|
-
views: [
|
|
7054
|
+
views: [u, x, g]
|
|
7059
7055
|
};
|
|
7060
7056
|
}
|
|
7061
7057
|
getBody() {
|
|
@@ -7070,7 +7066,7 @@ class Mi {
|
|
|
7070
7066
|
fixedLeftWidth: o,
|
|
7071
7067
|
fixedRightWidth: r,
|
|
7072
7068
|
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX: l }
|
|
7073
|
-
} = this.ctx, { visibleWidth: h, visibleHeight: d } = this.ctx.body, f = r - a,
|
|
7069
|
+
} = this.ctx, { visibleWidth: h, visibleHeight: d } = this.ctx.body, f = r - a, u = {
|
|
7074
7070
|
key: "left",
|
|
7075
7071
|
style: {
|
|
7076
7072
|
position: "absolute",
|
|
@@ -7081,7 +7077,7 @@ class Mi {
|
|
|
7081
7077
|
height: `${d}px`
|
|
7082
7078
|
},
|
|
7083
7079
|
cells: e
|
|
7084
|
-
},
|
|
7080
|
+
}, x = {
|
|
7085
7081
|
key: "center",
|
|
7086
7082
|
style: {
|
|
7087
7083
|
position: "absolute",
|
|
@@ -7113,7 +7109,7 @@ class Mi {
|
|
|
7113
7109
|
width: `${h}px`,
|
|
7114
7110
|
height: `${d}px`
|
|
7115
7111
|
},
|
|
7116
|
-
views: [
|
|
7112
|
+
views: [u, x, g]
|
|
7117
7113
|
};
|
|
7118
7114
|
}
|
|
7119
7115
|
getFooter() {
|
|
@@ -7138,7 +7134,7 @@ class Mi {
|
|
|
7138
7134
|
height: `${h}px`
|
|
7139
7135
|
},
|
|
7140
7136
|
cells: e
|
|
7141
|
-
},
|
|
7137
|
+
}, u = {
|
|
7142
7138
|
key: "center",
|
|
7143
7139
|
style: {
|
|
7144
7140
|
position: "absolute",
|
|
@@ -7149,7 +7145,7 @@ class Mi {
|
|
|
7149
7145
|
height: `${h}px`
|
|
7150
7146
|
},
|
|
7151
7147
|
cells: t
|
|
7152
|
-
},
|
|
7148
|
+
}, x = {
|
|
7153
7149
|
key: "right",
|
|
7154
7150
|
style: {
|
|
7155
7151
|
position: "absolute",
|
|
@@ -7170,7 +7166,7 @@ class Mi {
|
|
|
7170
7166
|
width: `${l}px`,
|
|
7171
7167
|
height: `${h}px`
|
|
7172
7168
|
},
|
|
7173
|
-
views: [f,
|
|
7169
|
+
views: [f, u, x]
|
|
7174
7170
|
};
|
|
7175
7171
|
}
|
|
7176
7172
|
}
|
|
@@ -7419,8 +7415,8 @@ class Ai {
|
|
|
7419
7415
|
const { ENABLE_CONTEXT_MENU: i, CUSTOM_BODY_CONTEXT_MENU: s, CONTEXT_MENU: o } = this.ctx.config, r = [...o, ...s];
|
|
7420
7416
|
if (!i || r.length === 0) return;
|
|
7421
7417
|
e.preventDefault();
|
|
7422
|
-
const { xArr: a, yArr: l } = this.ctx.selector, [h, d] = a, [f,
|
|
7423
|
-
|
|
7418
|
+
const { xArr: a, yArr: l } = this.ctx.selector, [h, d] = a, [f, u] = l, { rowIndex: x, colIndex: g } = t;
|
|
7419
|
+
x >= f && x <= u && g >= h && g <= d || this.ctx.emit("setSelectorCell", t, e), this.currentDOMTreeMenu && this.currentDOMTreeMenu.destroy(), this.ctx.contextMenuIng = !0, this.currentDOMTreeMenu = new zt(this.contextMenuEl, r, {
|
|
7424
7420
|
onClick: (w, E) => {
|
|
7425
7421
|
E === "copy" ? (this.ctx.emit("contextMenuCopy"), this.hide()) : E === "paste" ? (this.ctx.emit("contextMenuPaste"), this.hide()) : E === "cut" ? (this.ctx.emit("contextMenuCut"), this.hide()) : E === "clearSelected" && (this.ctx.emit("contextMenuClearSelected"), this.hide());
|
|
7426
7422
|
}
|
|
@@ -7436,8 +7432,8 @@ class Ai {
|
|
|
7436
7432
|
const { HEADER_CONTEXT_MENU: l, CUSTOM_HEADER_CONTEXT_MENU: h, ENABLE_HEADER_CONTEXT_MENU: d } = this.ctx.config, f = [...l, ...h];
|
|
7437
7433
|
if (!d || f.length === 0) return;
|
|
7438
7434
|
e.preventDefault();
|
|
7439
|
-
const { xArr:
|
|
7440
|
-
m >=
|
|
7435
|
+
const { xArr: u } = this.ctx.selector, [x, g] = u, { colIndex: m } = t;
|
|
7436
|
+
m >= x && m <= g || (this.ctx.focusCellHeader = t, this.ctx.emit("selectCols", t)), this.currentDOMTreeMenu && this.currentDOMTreeMenu.destroy();
|
|
7441
7437
|
const E = this.ctx.database.getColumns(), p = f.map((y) => y.value === "visible" ? {
|
|
7442
7438
|
...y,
|
|
7443
7439
|
children: this.filterColumns(E)
|
|
@@ -7580,11 +7576,11 @@ class Di {
|
|
|
7580
7576
|
e.preventDefault(), this.hide();
|
|
7581
7577
|
return;
|
|
7582
7578
|
}
|
|
7583
|
-
if (e.code === "ArrowUp" || e.shiftKey && e.
|
|
7579
|
+
if (e.code === "ArrowUp" || e.shiftKey && e.key === "Enter") {
|
|
7584
7580
|
e.preventDefault(), this.navigatePrevious();
|
|
7585
7581
|
return;
|
|
7586
7582
|
}
|
|
7587
|
-
if (e.code === "ArrowDown" || e.
|
|
7583
|
+
if (e.code === "ArrowDown" || e.key === "Enter") {
|
|
7588
7584
|
e.preventDefault(), this.navigateNext();
|
|
7589
7585
|
return;
|
|
7590
7586
|
}
|
|
@@ -7788,6 +7784,12 @@ class Xi {
|
|
|
7788
7784
|
getCustomHeader() {
|
|
7789
7785
|
return this.header.getCustomHeader();
|
|
7790
7786
|
}
|
|
7787
|
+
showColumns(t, e = !0) {
|
|
7788
|
+
this.ctx.database.setCustomHeaderHideData(t, !e), this.header.init(), this.ctx.emit("draw");
|
|
7789
|
+
}
|
|
7790
|
+
fixedColumns(t, e) {
|
|
7791
|
+
this.ctx.database.setCustomHeaderFixedData(t, e), this.header.init(), this.ctx.emit("draw");
|
|
7792
|
+
}
|
|
7791
7793
|
setLoading(t) {
|
|
7792
7794
|
this.ctx.loading = t, t ? this.loading.show() : this.loading.hide();
|
|
7793
7795
|
}
|
|
@@ -7992,9 +7994,6 @@ class Xi {
|
|
|
7992
7994
|
clearSort() {
|
|
7993
7995
|
this.ctx.database.clearSort();
|
|
7994
7996
|
}
|
|
7995
|
-
clearMaxRowHeight() {
|
|
7996
|
-
this.ctx.database.clearMaxRowHeight();
|
|
7997
|
-
}
|
|
7998
7997
|
contextMenuHide() {
|
|
7999
7998
|
this.contextMenu.hide();
|
|
8000
7999
|
}
|