e-virt-table 1.2.28 → 1.2.29
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 +647 -602
- 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/Body.js +9 -3
- package/dist/lib/Body.js.map +1 -1
- package/dist/lib/Cell.js +26 -8
- package/dist/lib/Cell.js.map +1 -1
- package/dist/lib/CellHeader.d.ts +1 -0
- package/dist/lib/CellHeader.js +16 -0
- package/dist/lib/CellHeader.js.map +1 -1
- package/dist/lib/Database.d.ts +4 -3
- package/dist/lib/Database.js +7 -13
- package/dist/lib/Database.js.map +1 -1
- package/dist/lib/EVirtTable.js +1 -0
- package/dist/lib/EVirtTable.js.map +1 -1
- package/dist/lib/Overlayer.d.ts +1 -0
- package/dist/lib/Overlayer.js +43 -6
- package/dist/lib/Overlayer.js.map +1 -1
- package/dist/lib/Paint.js +1 -1
- package/dist/lib/Paint.js.map +1 -1
- package/dist/lib/Row.d.ts +1 -1
- package/dist/lib/Row.js +2 -3
- package/dist/lib/Row.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -8,50 +8,50 @@ class re {
|
|
|
8
8
|
this.rules = t;
|
|
9
9
|
}
|
|
10
10
|
validate(t) {
|
|
11
|
-
const e = [], { column: i, row: s, key: o, rowKey: r, colIndex: a, rowIndex:
|
|
11
|
+
const e = [], { column: i, row: s, key: o, rowKey: r, colIndex: a, rowIndex: h, value: l, field: d, fieldValue: f } = t;
|
|
12
12
|
Array.isArray(this.rules) || (this.rules = [this.rules]);
|
|
13
13
|
for (const u of this.rules) {
|
|
14
14
|
if (u.validator) {
|
|
15
15
|
const x = {
|
|
16
16
|
field: d,
|
|
17
17
|
fieldValue: f,
|
|
18
|
-
value:
|
|
18
|
+
value: l,
|
|
19
19
|
column: i,
|
|
20
20
|
colIndex: a,
|
|
21
|
-
rowIndex:
|
|
21
|
+
rowIndex: h,
|
|
22
22
|
row: s,
|
|
23
23
|
key: o,
|
|
24
24
|
rowKey: r,
|
|
25
25
|
...u
|
|
26
26
|
};
|
|
27
|
-
u.validator(x,
|
|
27
|
+
u.validator(x, l, (w) => {
|
|
28
28
|
w && e.push({
|
|
29
29
|
...x,
|
|
30
30
|
message: w
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
if (!u.required && (
|
|
34
|
+
if (!u.required && (l == null || l === ""))
|
|
35
35
|
return e;
|
|
36
|
-
u.pattern && !u.pattern.test(
|
|
37
|
-
value:
|
|
36
|
+
u.pattern && !u.pattern.test(l) && e.push({
|
|
37
|
+
value: l,
|
|
38
38
|
column: i,
|
|
39
39
|
row: s,
|
|
40
40
|
key: o,
|
|
41
41
|
rowKey: r,
|
|
42
42
|
colIndex: a,
|
|
43
|
-
rowIndex:
|
|
43
|
+
rowIndex: h,
|
|
44
44
|
field: d,
|
|
45
45
|
fieldValue: f,
|
|
46
46
|
message: u.message || `${o} is pattern validation error`
|
|
47
|
-
}), u.required && (
|
|
48
|
-
value:
|
|
47
|
+
}), u.required && (l == null || l === "") && e.push({
|
|
48
|
+
value: l,
|
|
49
49
|
column: i,
|
|
50
50
|
row: s,
|
|
51
51
|
key: o,
|
|
52
52
|
rowKey: r,
|
|
53
53
|
colIndex: a,
|
|
54
|
-
rowIndex:
|
|
54
|
+
rowIndex: h,
|
|
55
55
|
field: d,
|
|
56
56
|
fieldValue: f,
|
|
57
57
|
message: u.message || `${o} is required`
|
|
@@ -60,13 +60,13 @@ class re {
|
|
|
60
60
|
return e;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function Ht() {
|
|
64
64
|
return "xxxxxxxxxxxxxxxxxx".replace(/[x]/g, function(c) {
|
|
65
65
|
const t = Math.random() * 16 | 0;
|
|
66
66
|
return (c === "x" ? t : t & 3 | 8).toString(16);
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function xt(c, t) {
|
|
70
70
|
let e = 0, i;
|
|
71
71
|
return function(...s) {
|
|
72
72
|
const o = (/* @__PURE__ */ new Date()).getTime(), r = o - e;
|
|
@@ -121,26 +121,26 @@ function et(c = []) {
|
|
|
121
121
|
e.children ? t = t.concat(et(e.children)) : t.push(e);
|
|
122
122
|
}), t;
|
|
123
123
|
}
|
|
124
|
-
const
|
|
125
|
-
function
|
|
124
|
+
const Ct = /^(\r\n|\n\r|\r|\n)/, ae = /^[^\t\r\n]+/, bt = /^\t/;
|
|
125
|
+
function he(c) {
|
|
126
126
|
let t = [[""]];
|
|
127
127
|
if (c.length === 0)
|
|
128
128
|
return t;
|
|
129
129
|
let e = 0, i = 0, s;
|
|
130
130
|
for (; c.length > 0 && s !== c.length; )
|
|
131
|
-
if (s = c.length, c.match(
|
|
132
|
-
c = c.replace(
|
|
133
|
-
else if (c.match(
|
|
134
|
-
c = c.replace(
|
|
131
|
+
if (s = c.length, c.match(bt))
|
|
132
|
+
c = c.replace(bt, ""), e += 1, t[i][e] = "";
|
|
133
|
+
else if (c.match(Ct))
|
|
134
|
+
c = c.replace(Ct, ""), e = 0, i += 1, t[i] = [""];
|
|
135
135
|
else {
|
|
136
136
|
let o = "";
|
|
137
137
|
if (c.startsWith('"')) {
|
|
138
138
|
let r = 0, a = !0;
|
|
139
139
|
for (; a; ) {
|
|
140
|
-
const
|
|
141
|
-
|
|
140
|
+
const h = c.slice(0, 1);
|
|
141
|
+
h === '"' && (r += 1), o += h, c = c.slice(1), (c.length === 0 || c.match(/^[\t\r\n]/) && r % 2 === 0) && (a = !1);
|
|
142
142
|
}
|
|
143
|
-
o = o.replace(/^"/, "").replace(/"$/, "").replace(/["]*/g, (
|
|
143
|
+
o = o.replace(/^"/, "").replace(/"$/, "").replace(/["]*/g, (h) => new Array(Math.floor(h.length / 2)).fill('"').join(""));
|
|
144
144
|
} else {
|
|
145
145
|
const r = c.match(ae);
|
|
146
146
|
o = r ? r[0] : "", c = c.slice(o.length);
|
|
@@ -149,7 +149,7 @@ function le(c) {
|
|
|
149
149
|
}
|
|
150
150
|
return Array.isArray(t) && t.length > 1 && t[t.length - 1].length === 1 && t[t.length - 1][0] === "" && (t = t.slice(0, t.length - 1)), t;
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function le(c) {
|
|
153
153
|
let t, e, i, s, o = "", r;
|
|
154
154
|
for (t = 0, e = c.length; t < e; t += 1) {
|
|
155
155
|
for (s = c[t].length, i = 0; i < s; i += 1)
|
|
@@ -167,8 +167,8 @@ function kt(c, t, e = []) {
|
|
|
167
167
|
if (r === 0)
|
|
168
168
|
s.push(1);
|
|
169
169
|
else {
|
|
170
|
-
const a = e.reduce((
|
|
171
|
-
a ===
|
|
170
|
+
const a = e.reduce((l, d) => `${l}${o[d] ?? ""}`, "") || o[t], h = e.reduce((l, d) => `${l}${c[r - 1][d] ?? ""}`, "") || c[r - 1][t];
|
|
171
|
+
a === h ? (s[i] += 1, s.push(0)) : (s.push(1), i = r);
|
|
172
172
|
}
|
|
173
173
|
}), s;
|
|
174
174
|
}
|
|
@@ -214,7 +214,7 @@ function fe(c, t = document.documentElement) {
|
|
|
214
214
|
const e = c.startsWith("--") ? c : `--${c}`;
|
|
215
215
|
return getComputedStyle(t).getPropertyValue(e).trim();
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function Rt(c) {
|
|
218
218
|
if (!c) return /* @__PURE__ */ new Date(0);
|
|
219
219
|
if (typeof c == "number")
|
|
220
220
|
return new Date(c);
|
|
@@ -252,24 +252,24 @@ function bt(c) {
|
|
|
252
252
|
if (o) {
|
|
253
253
|
const r = o.slice(1).map(Number);
|
|
254
254
|
if (s.source.includes("YYYY-MM-DD") || s.source.includes("YYYY/MM/DD") || s.source.includes("YYYY.MM.DD")) {
|
|
255
|
-
const [a,
|
|
256
|
-
return new Date(a,
|
|
255
|
+
const [a, h, l, d = 0, f = 0, u = 0] = r;
|
|
256
|
+
return new Date(a, h - 1, l, d, f, u);
|
|
257
257
|
} else if (s.source.includes("DD-MM-YYYY") || s.source.includes("DD/MM/YYYY") || s.source.includes("DD.MM.YYYY")) {
|
|
258
|
-
const [a,
|
|
259
|
-
return new Date(
|
|
258
|
+
const [a, h, l, d = 0, f = 0, u = 0] = r;
|
|
259
|
+
return new Date(l, h - 1, a, d, f, u);
|
|
260
260
|
} else if (s.source.includes("MM-DD-YYYY") || s.source.includes("MM/DD/YYYY") || s.source.includes("MM.DD.YYYY")) {
|
|
261
|
-
const [a,
|
|
262
|
-
return new Date(
|
|
261
|
+
const [a, h, l, d = 0, f = 0, u = 0] = r;
|
|
262
|
+
return new Date(l, a - 1, h, d, f, u);
|
|
263
263
|
} else if (s.source.includes("YYYYMMDD")) {
|
|
264
|
-
const [a,
|
|
265
|
-
return new Date(a,
|
|
264
|
+
const [a, h, l] = r;
|
|
265
|
+
return new Date(a, h - 1, l);
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
return /* @__PURE__ */ new Date(NaN);
|
|
270
270
|
}
|
|
271
271
|
function xe(c, t) {
|
|
272
|
-
const e =
|
|
272
|
+
const e = Rt(c), i = Rt(t);
|
|
273
273
|
return isNaN(e.getTime()) && isNaN(i.getTime()) ? 0 : isNaN(e.getTime()) ? -1 : isNaN(i.getTime()) ? 1 : e.getTime() - i.getTime();
|
|
274
274
|
}
|
|
275
275
|
class Yt {
|
|
@@ -318,9 +318,9 @@ class Yt {
|
|
|
318
318
|
getRightFixedX() {
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
class
|
|
322
|
-
constructor(e, i, s, o, r, a,
|
|
323
|
-
super(e, o, r, a,
|
|
321
|
+
class ut extends Yt {
|
|
322
|
+
constructor(e, i, s, o, r, a, h, l, d, f = "body") {
|
|
323
|
+
super(e, o, r, a, h, f, l.fixed);
|
|
324
324
|
n(this, "formatter");
|
|
325
325
|
n(this, "formatterFooter");
|
|
326
326
|
n(this, "hoverIconName", "");
|
|
@@ -401,7 +401,7 @@ class xt extends Yt {
|
|
|
401
401
|
n(this, "overflowTooltipMaxWidth", 500);
|
|
402
402
|
n(this, "overflowTooltipPlacement", "top");
|
|
403
403
|
n(this, "maxLineClamp", "auto");
|
|
404
|
-
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key =
|
|
404
|
+
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = l.key, this.type = l.type || "", this.editorType = l.editorType || "text", this.selectorCellValueType = l.selectorCellValueType || this.ctx.config.SELECTOR_CELL_VALUE_TYPE || "value", this.editorProps = l.editorProps || {}, this.cellType = f, this.align = l.align || this.ctx.config.COLUMNS_ALIGN, this.verticalAlign = l.verticalAlign || this.ctx.config.COLUMNS_VERTICAL_ALIGN, this.fixed = l.fixed, this.level = l.level || 0, this.operation = l.operation || !1, this.column = l, this.rules = l.rules || [], this.row = d, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = l.render, this.overflowTooltipShow = l.overflowTooltipShow !== !1, this.autoRowHeight = l.autoRowHeight || this.ctx.config.AUTO_ROW_HEIGHT, this.overflowTooltipMaxWidth = l.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = l.overflowTooltipPlacement || "top", this.renderFooter = l.renderFooter, this.hoverIconName = l.hoverIconName, this.formatter = l.formatter, this.formatterFooter = l.formatterFooter, this.maxLineClamp = l.maxLineClamp || "auto", this.update();
|
|
405
405
|
}
|
|
406
406
|
setWidthHeight(e, i) {
|
|
407
407
|
this.width = e, this.height = i;
|
|
@@ -427,8 +427,8 @@ class xt extends Yt {
|
|
|
427
427
|
rowspan: o = 1,
|
|
428
428
|
relationRowKeys: r,
|
|
429
429
|
relationColKeys: a,
|
|
430
|
-
mergeRow:
|
|
431
|
-
mergeCol:
|
|
430
|
+
mergeRow: h = !1,
|
|
431
|
+
mergeCol: l = !1
|
|
432
432
|
} = i({
|
|
433
433
|
row: this.row,
|
|
434
434
|
rowIndex: this.rowIndex,
|
|
@@ -441,7 +441,7 @@ class xt extends Yt {
|
|
|
441
441
|
visibleLeafColumns: this.ctx.header.visibleLeafColumns,
|
|
442
442
|
rows: this.ctx.body.data
|
|
443
443
|
}) || {};
|
|
444
|
-
Array.isArray(r) && r.length > 0 ? this.relationRowKeys = r : this.relationRowKeys = [this.key], Array.isArray(a) && a.length > 0 ? this.relationColKeys = a : this.relationColKeys = [this.key], this.mergeCol =
|
|
444
|
+
Array.isArray(r) && r.length > 0 ? this.relationRowKeys = r : this.relationRowKeys = [this.key], Array.isArray(a) && a.length > 0 ? this.relationColKeys = a : this.relationColKeys = [this.key], this.mergeCol = l, this.mergeRow = h, this.colspan = s, this.rowspan = o, this.visibleWidth = this.getWidthByColIndexColSpan(this.colIndex, this.colspan), this.visibleHeight = this.ctx.database.getHeightByRowIndexRowSpan(this.rowIndex, this.rowspan);
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
447
|
updateSpanInfo() {
|
|
@@ -509,8 +509,9 @@ class xt extends Yt {
|
|
|
509
509
|
*/
|
|
510
510
|
updateStyle() {
|
|
511
511
|
this.autoRowHeight && (this.domDataset = {
|
|
512
|
-
|
|
513
|
-
|
|
512
|
+
"data-auto-height": !0,
|
|
513
|
+
"data-row-index": this.rowIndex,
|
|
514
|
+
"data-col-index": this.colIndex
|
|
514
515
|
}), this.style = this.getOverlayerViewsStyle();
|
|
515
516
|
}
|
|
516
517
|
updateTree() {
|
|
@@ -518,15 +519,15 @@ class xt extends Yt {
|
|
|
518
519
|
let o, r = 0, a = "";
|
|
519
520
|
if (!(["tree", "selection-tree", "tree-selection"].includes(this.type) && s === "body"))
|
|
520
521
|
return;
|
|
521
|
-
const
|
|
522
|
-
this.rowExpand =
|
|
522
|
+
const h = this.ctx.database.getRowForRowKey(i), { expand: l = !1, hasChildren: d = !1, expandLoading: f = !1, level: u = 0 } = h || {};
|
|
523
|
+
this.rowExpand = l, this.rowHasChildren = d;
|
|
523
524
|
const { TREE_INDENT: x = 16, CHECKBOX_SIZE: w, TREE_ICON_SIZE: m } = this.ctx.config;
|
|
524
525
|
if (r = u * x, f) {
|
|
525
526
|
const I = this.ctx.icons.get("loading");
|
|
526
527
|
a = "loading", o = I;
|
|
527
528
|
} else if (d) {
|
|
528
|
-
const I = this.ctx.icons.get("expand"),
|
|
529
|
-
o =
|
|
529
|
+
const I = this.ctx.icons.get("expand"), S = this.ctx.icons.get("shrink");
|
|
530
|
+
o = l ? S : I, a = l ? "shrink" : "expand";
|
|
530
531
|
}
|
|
531
532
|
let g = m, p = m, y = this.drawX;
|
|
532
533
|
(this.align === "center" || this.align === "right") && (y = this.drawX + (this.visibleWidth - g - 2 * e) / 2, this.align = "left");
|
|
@@ -536,7 +537,7 @@ class xt extends Yt {
|
|
|
536
537
|
drawTreeLine() {
|
|
537
538
|
const { TREE_LINE: e, TREE_INDENT: i = 16, TREE_ICON_SIZE: s = 16, TREE_LINE_COLOR: o = "#e1e6eb" } = this.ctx.config;
|
|
538
539
|
if (!e || this.cellType !== "body" || !["tree", "selection-tree", "tree-selection"].includes(this.type) || this.rowspan === 0 || this.colspan === 0) return;
|
|
539
|
-
const r = this.ctx.database.getRowForRowKey(this.rowKey) || {}, a = r.level ?? 0,
|
|
540
|
+
const r = this.ctx.database.getRowForRowKey(this.rowKey) || {}, a = r.level ?? 0, h = this.drawTreeImageX + this.drawTreeImageWidth / 2, l = this.drawTreeImageY + this.drawTreeImageHeight / 2;
|
|
540
541
|
let d = this.drawTreeImageX - a * i;
|
|
541
542
|
const f = Array.isArray(r.parentRowKeys) ? r.parentRowKeys : [];
|
|
542
543
|
if (a > 0) {
|
|
@@ -551,7 +552,7 @@ class xt extends Yt {
|
|
|
551
552
|
lineDashOffset: 0
|
|
552
553
|
});
|
|
553
554
|
}
|
|
554
|
-
const u = Math.round(this.drawTreeImageX - i + s / 2), w = !!r.isLastChild ?
|
|
555
|
+
const u = Math.round(this.drawTreeImageX - i + s / 2), w = !!r.isLastChild ? l : this.drawY + this.visibleHeight;
|
|
555
556
|
this.ctx.paint.drawLine([u, this.drawY, u, w], {
|
|
556
557
|
borderColor: o,
|
|
557
558
|
borderWidth: 1,
|
|
@@ -559,7 +560,7 @@ class xt extends Yt {
|
|
|
559
560
|
lineDashOffset: 0
|
|
560
561
|
});
|
|
561
562
|
const m = Math.round(d + (a - 1) * i + s / 2);
|
|
562
|
-
this.ctx.paint.drawLine([m, h, l
|
|
563
|
+
this.ctx.paint.drawLine([m, l, h, l], {
|
|
563
564
|
borderColor: o,
|
|
564
565
|
borderWidth: 1,
|
|
565
566
|
lineDash: [4, 4],
|
|
@@ -568,7 +569,7 @@ class xt extends Yt {
|
|
|
568
569
|
}
|
|
569
570
|
if (r.hasChildren && r.expand) {
|
|
570
571
|
const u = this.drawTreeImageY + this.drawTreeImageHeight, x = this.drawY + this.visibleHeight;
|
|
571
|
-
this.ctx.paint.drawLine([
|
|
572
|
+
this.ctx.paint.drawLine([h, u, h, x], {
|
|
572
573
|
borderColor: o,
|
|
573
574
|
borderWidth: 1,
|
|
574
575
|
lineDash: [4, 4],
|
|
@@ -584,8 +585,8 @@ class xt extends Yt {
|
|
|
584
585
|
FOOTER_CELL_STYLE_METHOD: o,
|
|
585
586
|
READONLY_TEXT_COLOR: r,
|
|
586
587
|
BODY_TEXT_COLOR: a,
|
|
587
|
-
FOOTER_TEXT_COLOR:
|
|
588
|
-
FOOTER_BG_COLOR:
|
|
588
|
+
FOOTER_TEXT_COLOR: h,
|
|
589
|
+
FOOTER_BG_COLOR: l,
|
|
589
590
|
HIGHLIGHT_SELECTED_ROW: d,
|
|
590
591
|
HIGHLIGHT_SELECTED_ROW_COLOR: f,
|
|
591
592
|
HIGHLIGHT_HOVER_ROW: u,
|
|
@@ -594,31 +595,31 @@ class xt extends Yt {
|
|
|
594
595
|
STRIPE_COLOR: m
|
|
595
596
|
} = this.ctx.config;
|
|
596
597
|
if (this.cellType === "footer") {
|
|
597
|
-
let
|
|
598
|
+
let S = l, _ = h;
|
|
598
599
|
if (typeof o == "function") {
|
|
599
|
-
const
|
|
600
|
+
const v = o, { backgroundColor: b, color: O } = v({
|
|
600
601
|
row: this.row,
|
|
601
602
|
rowIndex: this.rowIndex,
|
|
602
603
|
colIndex: this.colIndex,
|
|
603
604
|
column: this.column,
|
|
604
605
|
value: this.getValue()
|
|
605
606
|
}) || {};
|
|
606
|
-
b && (
|
|
607
|
+
b && (S = b), O && (_ = O);
|
|
607
608
|
}
|
|
608
|
-
this.drawCellSkyBgColor = "transparent", this.drawCellBgColor =
|
|
609
|
+
this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = S, this.drawTextColor = _;
|
|
609
610
|
return;
|
|
610
611
|
}
|
|
611
612
|
let g = "transparent";
|
|
612
613
|
const p = this.ctx.hoverCell, y = this.ctx.currentCell;
|
|
613
614
|
let E = this.rowIndex, R = this.rowIndex;
|
|
614
615
|
if (this.rowspan !== 1 && (u || d)) {
|
|
615
|
-
const
|
|
616
|
+
const S = this.getSpanInfo(), { yArr: _ } = S;
|
|
616
617
|
E = _[0], R = _[1];
|
|
617
618
|
}
|
|
618
619
|
u && p && (p.rowKey === this.rowKey && (g = x), p.rowIndex >= E && p.rowIndex <= R && (g = x)), d && y && (y.rowKey === this.rowKey && (g = f), y.rowIndex >= E && y.rowIndex <= R && (g = f)), this.drawCellSkyBgColor = g;
|
|
619
620
|
let C = e, I = a;
|
|
620
621
|
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (C = i, I = r), w && (this.rowIndex % 2 ? C = m : C = e), typeof s == "function") {
|
|
621
|
-
const
|
|
622
|
+
const S = s, { backgroundColor: _, color: v } = S({
|
|
622
623
|
row: this.row,
|
|
623
624
|
rowIndex: this.rowIndex,
|
|
624
625
|
colIndex: this.colIndex,
|
|
@@ -626,60 +627,60 @@ class xt extends Yt {
|
|
|
626
627
|
isHasChanged: this.isHasChanged,
|
|
627
628
|
value: this.getValue()
|
|
628
629
|
}) || {};
|
|
629
|
-
_ && (C = _),
|
|
630
|
+
_ && (C = _), v && (I = v);
|
|
630
631
|
}
|
|
631
632
|
this.drawCellBgColor = C, this.drawTextColor = I;
|
|
632
633
|
}
|
|
633
634
|
updateSelection() {
|
|
634
|
-
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: a, rowIndex:
|
|
635
|
+
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: a, rowIndex: h, rowKey: l } = this;
|
|
635
636
|
if (s === 0 || o === 0 || r === "footer" || !["index-selection", "selection", "selection-tree", "tree-selection"].includes(a))
|
|
636
637
|
return;
|
|
637
|
-
const d = this.ctx.database.getRowSelectable(
|
|
638
|
+
const d = this.ctx.database.getRowSelectable(l), { CHECKBOX_SIZE: f = 0, CELL_PADDING: u } = this.ctx.config;
|
|
638
639
|
let x = this.drawX + u;
|
|
639
640
|
(this.align === "center" || this.align === "right") && (x = this.drawX + (e - f) / 2);
|
|
640
641
|
let w = x, m = this.drawY + (i - f) / 2;
|
|
641
642
|
if (a !== "selection-tree") {
|
|
642
643
|
if (a === "tree-selection") {
|
|
643
|
-
const { TREE_INDENT: y = 16, TREE_ICON_SIZE: E } = this.ctx.config, R = this.ctx.database.getRowForRowKey(
|
|
644
|
+
const { TREE_INDENT: y = 16, TREE_ICON_SIZE: E } = this.ctx.config, R = this.ctx.database.getRowForRowKey(l), { level: C = 0 } = R || {}, I = C * y;
|
|
644
645
|
w = x + E + I;
|
|
645
646
|
}
|
|
646
647
|
}
|
|
647
648
|
let g = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck";
|
|
648
649
|
if (a === "selection-tree" || a === "tree-selection") {
|
|
649
|
-
const y = this.ctx.database.getTreeSelectionState(
|
|
650
|
+
const y = this.ctx.database.getTreeSelectionState(l);
|
|
650
651
|
y.indeterminate && d ? (g = this.ctx.icons.get("checkbox-indeterminate"), p = "checkbox-indeterminate") : y.checked && d ? (g = this.ctx.icons.get("checkbox-check"), p = "checkbox-check") : !y.checked && d ? (g = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), p = "checkbox-disabled");
|
|
651
652
|
} else {
|
|
652
|
-
const y = this.ctx.database.getRowSelection(
|
|
653
|
+
const y = this.ctx.database.getRowSelection(l);
|
|
653
654
|
y && d ? (g = this.ctx.icons.get("checkbox-check"), p = "checkbox-check") : y && !d ? (g = this.ctx.icons.get("checkbox-check-disabled"), p = "checkbox-check-disabled") : !y && d ? (g = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), p = "checkbox-disabled");
|
|
654
655
|
}
|
|
655
|
-
w + f + u > this.drawX + this.visibleWidth || m + f + u > this.drawY + this.visibleHeight || (a === "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex ===
|
|
656
|
+
w + f + u > this.drawX + this.visibleWidth || m + f + u > this.drawY + this.visibleHeight || (a === "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === h || ["checkbox-disabled", "checkbox-check"].includes(p)) && (this.drawSelectionImageX = w, this.drawSelectionImageY = m, this.drawSelectionImageWidth = f, this.drawSelectionImageHeight = f, this.drawSelectionImageName = p, this.drawSelectionImageSource = g) : (this.drawSelectionImageX = w, this.drawSelectionImageY = m, this.drawSelectionImageWidth = f, this.drawSelectionImageHeight = f, this.drawSelectionImageName = p, this.drawSelectionImageSource = g));
|
|
656
657
|
}
|
|
657
658
|
updateHoverIcon() {
|
|
658
659
|
if (this.ctx.database.getReadonly(this.rowKey, this.key))
|
|
659
660
|
return;
|
|
660
661
|
const { BODY_CELL_HOVER_ICON_METHOD: i, CELL_HOVER_ICON_SIZE: s, CELL_PADDING: o, ENABLE_MERGE_CELL_LINK: r } = this.ctx.config;
|
|
661
662
|
if (typeof i == "function") {
|
|
662
|
-
const
|
|
663
|
+
const l = i({
|
|
663
664
|
row: this.row,
|
|
664
665
|
rowIndex: this.rowIndex,
|
|
665
666
|
colIndex: this.colIndex,
|
|
666
667
|
column: this.column,
|
|
667
668
|
value: this.getValue()
|
|
668
669
|
});
|
|
669
|
-
|
|
670
|
+
l !== void 0 && (this.hoverIconName = l);
|
|
670
671
|
}
|
|
671
672
|
const { hoverCell: a } = this.ctx;
|
|
672
673
|
if (this.hoverIconName && !this.ctx.editing && a) {
|
|
673
|
-
let
|
|
674
|
-
if (a.rowKey === this.rowKey && (
|
|
674
|
+
let h = 0, l = 0;
|
|
675
|
+
if (a.rowKey === this.rowKey && (h = this.drawX + this.width - s - o, l = this.drawY + (this.height - s) / 2), this.rowspan !== 1 && r) {
|
|
675
676
|
const f = this.getSpanInfo(), { yArr: u } = f, x = u[0], w = u[1];
|
|
676
677
|
if (a.rowIndex >= x && a.rowIndex <= w) {
|
|
677
678
|
const { width: m, height: g, offsetTop: p, offsetLeft: y } = f;
|
|
678
|
-
|
|
679
|
+
h = this.drawX - y + m - s - o, l = this.drawY - p + (g - s) / 2;
|
|
679
680
|
}
|
|
680
681
|
}
|
|
681
682
|
const d = this.ctx.icons.get(this.hoverIconName);
|
|
682
|
-
this.drawHoverImageX =
|
|
683
|
+
this.drawHoverImageX = h, this.drawHoverImageY = l, this.drawHoverImageWidth = s, this.drawHoverImageHeight = s, this.drawHoverImageName = this.hoverIconName, this.drawHoverImageSource = d;
|
|
683
684
|
}
|
|
684
685
|
}
|
|
685
686
|
/**
|
|
@@ -688,11 +689,13 @@ class xt extends Yt {
|
|
|
688
689
|
*/
|
|
689
690
|
getAutoHeight() {
|
|
690
691
|
if (this.cellType !== "body" || !this.autoRowHeight || this.rowspan === 0)
|
|
691
|
-
return
|
|
692
|
-
if (this.render)
|
|
693
|
-
|
|
692
|
+
return 0;
|
|
693
|
+
if (this.render) {
|
|
694
|
+
const r = this.ctx.database.getOverlayerAutoHeight(this.rowIndex, this.colIndex);
|
|
695
|
+
return this.rowspan > 1 ? r < this.visibleHeight ? 0 : Math.round(r - (this.visibleHeight - this.height)) : Math.round(r);
|
|
696
|
+
}
|
|
694
697
|
if (!(this.displayText && typeof this.displayText == "string"))
|
|
695
|
-
return
|
|
698
|
+
return 0;
|
|
696
699
|
const { BODY_FONT: e, CELL_PADDING: i, CELL_LINE_HEIGHT: s } = this.ctx.config, o = this.ctx.paint.calculateTextHeight(this.displayText, this.drawTextWidth, {
|
|
697
700
|
font: e,
|
|
698
701
|
padding: i,
|
|
@@ -703,7 +706,7 @@ class xt extends Yt {
|
|
|
703
706
|
lineHeight: s,
|
|
704
707
|
maxLineClamp: this.maxLineClamp
|
|
705
708
|
});
|
|
706
|
-
return this.rowspan > 1 ? Math.round(o - (this.visibleHeight - this.height)) : Math.round(o);
|
|
709
|
+
return this.rowspan > 1 ? o < this.visibleHeight ? 0 : Math.round(o - (this.visibleHeight - this.height)) : Math.round(o);
|
|
707
710
|
}
|
|
708
711
|
// 过去跨度配置
|
|
709
712
|
getSpanInfo() {
|
|
@@ -758,13 +761,14 @@ class xt extends Yt {
|
|
|
758
761
|
*/
|
|
759
762
|
getOverlayerViewsStyle() {
|
|
760
763
|
let e = `${this.drawX - this.ctx.fixedLeftWidth}px`, i = `${this.drawY - this.ctx.body.y}px`;
|
|
761
|
-
return this.fixed === "left" ? e = `${this.drawX}px` : this.fixed === "right" && (e = `${this.drawX - (this.ctx.stageWidth - this.ctx.fixedRightWidth)}px`), this.cellType === "footer" && this.ctx.config.FOOTER_FIXED && (i = `${this.drawY - this.ctx.footer.y}px`), {
|
|
764
|
+
return this.fixed === "left" ? e = `${this.drawX}px` : this.fixed === "right" && (e = `${this.drawX - (this.ctx.stageWidth - this.ctx.fixedRightWidth)}px`), this.cellType === "footer" && this.ctx.config.FOOTER_FIXED && (i = `${this.drawY - this.ctx.footer.y}px`), this.autoRowHeight && this.ctx.database.getOverlayerAutoHeight(this.rowIndex, this.colIndex) === 0 && (e = "-99999px", i = "-99999px"), {
|
|
762
765
|
position: "absolute",
|
|
763
766
|
overflow: "hidden",
|
|
764
767
|
left: e,
|
|
765
768
|
top: i,
|
|
766
769
|
width: `${this.visibleWidth}px`,
|
|
767
770
|
height: this.autoRowHeight ? "auto" : `${this.visibleHeight}px`,
|
|
771
|
+
// height: `${this.visibleHeight}px`,
|
|
768
772
|
// minHeight: `${this.visibleHeight}px`,
|
|
769
773
|
pointerEvents: "initial",
|
|
770
774
|
userSelect: "none"
|
|
@@ -798,8 +802,8 @@ class xt extends Yt {
|
|
|
798
802
|
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s, AUTOFILL_POINT_BORDER_COLOR: o } = this.ctx.config;
|
|
799
803
|
if (!s || !i || this.ctx.editing)
|
|
800
804
|
return;
|
|
801
|
-
const { xArr: r, yArr: a } = this.ctx.selector,
|
|
802
|
-
if (d ===
|
|
805
|
+
const { xArr: r, yArr: a } = this.ctx.selector, h = r[1], l = a[1], { colIndex: d, rowIndex: f, drawX: u, drawY: x } = this;
|
|
806
|
+
if (d === h && f === l) {
|
|
803
807
|
const m = d === this.ctx.maxColIndex || f === this.ctx.maxRowIndex || d === this.ctx.lastCenterColIndex ? 6 : 4;
|
|
804
808
|
this.ctx.paint.drawRect(u + this.width - m, x + this.height - m, 6, 6, {
|
|
805
809
|
borderColor: o,
|
|
@@ -826,8 +830,8 @@ class xt extends Yt {
|
|
|
826
830
|
}
|
|
827
831
|
drawText() {
|
|
828
832
|
const { CELL_PADDING: e, BODY_FONT: i, PLACEHOLDER_COLOR: s, CELL_LINE_HEIGHT: o } = this.ctx.config, { placeholder: r } = this.column;
|
|
829
|
-
let a = this.displayText,
|
|
830
|
-
return !this.ctx.database.getReadonly(this.rowKey, this.key) && r && ["", null, void 0].includes(this.text) && this.cellType === "body" && !(this.rowspan === 0 || this.colspan === 0) && (a = r,
|
|
833
|
+
let a = this.displayText, h = this.drawTextColor;
|
|
834
|
+
return !this.ctx.database.getReadonly(this.rowKey, this.key) && r && ["", null, void 0].includes(this.text) && this.cellType === "body" && !(this.rowspan === 0 || this.colspan === 0) && (a = r, h = s), a ? (this.ellipsis = this.ctx.paint.drawText(
|
|
831
835
|
a,
|
|
832
836
|
this.drawTextX,
|
|
833
837
|
this.drawTextY,
|
|
@@ -838,7 +842,7 @@ class xt extends Yt {
|
|
|
838
842
|
padding: e,
|
|
839
843
|
align: this.align,
|
|
840
844
|
verticalAlign: this.verticalAlign,
|
|
841
|
-
color:
|
|
845
|
+
color: h,
|
|
842
846
|
autoRowHeight: this.autoRowHeight,
|
|
843
847
|
lineHeight: o,
|
|
844
848
|
maxLineClamp: this.maxLineClamp
|
|
@@ -908,11 +912,11 @@ class xt extends Yt {
|
|
|
908
912
|
fillColor: "transparent",
|
|
909
913
|
borderWidth: 1
|
|
910
914
|
});
|
|
911
|
-
const [a,
|
|
912
|
-
!(a ===
|
|
915
|
+
const [a, h] = i, [l, d] = s;
|
|
916
|
+
!(a === h && l === d) && this.colIndex >= a && this.colIndex <= h && this.rowIndex >= l && this.rowIndex <= d && this.ctx.paint.drawRect(this.drawX, this.drawY, this.width, this.height, {
|
|
913
917
|
borderColor: "transparent",
|
|
914
918
|
fillColor: this.ctx.config.SELECT_AREA_COLOR || "rgba(82,146,247,0.1)"
|
|
915
|
-
}), this.operation && this.rowIndex >=
|
|
919
|
+
}), this.operation && this.rowIndex >= l && this.rowIndex <= d && this.ctx.paint.drawRect(this.drawX, this.drawY, this.visibleWidth, this.visibleHeight, {
|
|
916
920
|
borderColor: "transparent",
|
|
917
921
|
fillColor: this.ctx.config.SELECT_ROW_COL_BG_COLOR || "transparent"
|
|
918
922
|
});
|
|
@@ -937,12 +941,12 @@ class xt extends Yt {
|
|
|
937
941
|
});
|
|
938
942
|
}
|
|
939
943
|
drawBorder(e) {
|
|
940
|
-
const { drawX: i, drawY: s, rowIndex: o, colIndex: r, height: a, width:
|
|
941
|
-
let
|
|
944
|
+
const { drawX: i, drawY: s, rowIndex: o, colIndex: r, height: a, width: h } = this;
|
|
945
|
+
let l = i, d = s;
|
|
942
946
|
const { xArr: f, yArr: u, lineDash: x = [], borderWidth: w = 1, borderColor: m, fillColor: g } = e, p = f[0], y = f[1], E = u[0], R = u[1];
|
|
943
947
|
if (r >= p && r <= y && o === E) {
|
|
944
948
|
const C = r === y ? 1 : 0, I = r === p ? 1 : 0;
|
|
945
|
-
this.ctx.paint.drawLine([
|
|
949
|
+
this.ctx.paint.drawLine([l + I, d + 1, l + h - C, d + 1], {
|
|
946
950
|
borderColor: m,
|
|
947
951
|
fillColor: g,
|
|
948
952
|
borderWidth: w,
|
|
@@ -953,7 +957,7 @@ class xt extends Yt {
|
|
|
953
957
|
}
|
|
954
958
|
if (r === y && o >= E && o <= R) {
|
|
955
959
|
const C = o === E ? 1 : 0, I = o === R ? 1 : 0;
|
|
956
|
-
this.ctx.paint.drawLine([
|
|
960
|
+
this.ctx.paint.drawLine([l + h - 1, d + C, l + h - 1, d + a - I], {
|
|
957
961
|
borderColor: m,
|
|
958
962
|
fillColor: g,
|
|
959
963
|
borderWidth: w,
|
|
@@ -964,7 +968,7 @@ class xt extends Yt {
|
|
|
964
968
|
}
|
|
965
969
|
if (r >= p && r <= y && o === R) {
|
|
966
970
|
const C = r === y ? 1 : 0, I = r === p ? 1 : 0;
|
|
967
|
-
this.ctx.paint.drawLine([
|
|
971
|
+
this.ctx.paint.drawLine([l + I, d + a - 1, l + h - C, d + a - 1], {
|
|
968
972
|
borderColor: m,
|
|
969
973
|
fillColor: g,
|
|
970
974
|
borderWidth: w,
|
|
@@ -975,7 +979,7 @@ class xt extends Yt {
|
|
|
975
979
|
}
|
|
976
980
|
if (r === p && o >= E && o <= R) {
|
|
977
981
|
const C = o === R ? 1 : 0, I = o === E ? 1 : 0;
|
|
978
|
-
this.ctx.paint.drawLine([
|
|
982
|
+
this.ctx.paint.drawLine([l + 1, d + I, l + 1, d + a - C], {
|
|
979
983
|
borderColor: m,
|
|
980
984
|
fillColor: g,
|
|
981
985
|
borderWidth: w,
|
|
@@ -1048,9 +1052,9 @@ class ue {
|
|
|
1048
1052
|
const s = t.length;
|
|
1049
1053
|
t.forEach((o, r) => {
|
|
1050
1054
|
var y;
|
|
1051
|
-
const { ROW_KEY: a = "", DEFAULT_EXPAND_ALL:
|
|
1055
|
+
const { ROW_KEY: a = "", DEFAULT_EXPAND_ALL: h, CELL_HEIGHT: l, SELECTABLE_METHOD: d, CHECKBOX_KEY: f } = this.ctx.config, u = o[a], x = u != null ? `${u}` : Ht();
|
|
1052
1056
|
this.itemRowKeyMap.set(o, x);
|
|
1053
|
-
const w = o._height ||
|
|
1057
|
+
const w = o._height || l, m = o._readonly;
|
|
1054
1058
|
let g = !0;
|
|
1055
1059
|
if (typeof d == "function" && (g = d), f) {
|
|
1056
1060
|
const E = o[f];
|
|
@@ -1065,7 +1069,7 @@ class ue {
|
|
|
1065
1069
|
row: o,
|
|
1066
1070
|
check: ((y = this.selectionMap.get(x)) == null ? void 0 : y.check) || !1
|
|
1067
1071
|
});
|
|
1068
|
-
const p =
|
|
1072
|
+
const p = h || this.expandMap.get(x) || o._expand || !1;
|
|
1069
1073
|
this.expandMap.set(x, p), this.rowKeyMap.set(x, {
|
|
1070
1074
|
readonly: m,
|
|
1071
1075
|
index: r,
|
|
@@ -1165,13 +1169,13 @@ class ue {
|
|
|
1165
1169
|
const i = (o) => {
|
|
1166
1170
|
o.forEach((r) => {
|
|
1167
1171
|
t.push(r);
|
|
1168
|
-
const a = this.itemRowKeyMap.get(r), { expand:
|
|
1172
|
+
const a = this.itemRowKeyMap.get(r), { expand: h, hasChildren: l, height: d, calculatedHeight: f } = this.rowKeyMap.get(a), u = this.sumHeight, x = Math.max(f, d);
|
|
1169
1173
|
this.sumHeight += x, this.rowIndexRowKeyMap.set(e, a), this.rowKeyRowIndexMap.set(a, e), this.positions.push({
|
|
1170
1174
|
top: u,
|
|
1171
1175
|
height: x,
|
|
1172
1176
|
bottom: this.sumHeight,
|
|
1173
1177
|
calculatedHeight: f
|
|
1174
|
-
}), e += 1,
|
|
1178
|
+
}), e += 1, h && l && i(r.children);
|
|
1175
1179
|
});
|
|
1176
1180
|
};
|
|
1177
1181
|
this.rowIndexRowKeyMap.clear(), this.rowKeyRowIndexMap.clear();
|
|
@@ -1248,18 +1252,18 @@ class ue {
|
|
|
1248
1252
|
*/
|
|
1249
1253
|
applySingleColumnSort(t, e, i, s) {
|
|
1250
1254
|
return t.sort((o, r) => {
|
|
1251
|
-
const a = o[e],
|
|
1252
|
-
let
|
|
1255
|
+
const a = o[e], h = r[e];
|
|
1256
|
+
let l = 0;
|
|
1253
1257
|
if (typeof s == "function")
|
|
1254
|
-
|
|
1258
|
+
l = s(o, r);
|
|
1255
1259
|
else if (s === "number") {
|
|
1256
|
-
const d = Number(a) || 0, f = Number(
|
|
1257
|
-
|
|
1260
|
+
const d = Number(a) || 0, f = Number(h) || 0;
|
|
1261
|
+
l = d - f;
|
|
1258
1262
|
} else if (s === "string") {
|
|
1259
|
-
const d = String(a || ""), f = String(
|
|
1260
|
-
|
|
1261
|
-
} else s === "date" && (
|
|
1262
|
-
return i === "asc" ?
|
|
1263
|
+
const d = String(a || ""), f = String(h || "");
|
|
1264
|
+
l = d.localeCompare(f);
|
|
1265
|
+
} else s === "date" && (l = xe(a, h));
|
|
1266
|
+
return i === "asc" ? l : -l;
|
|
1263
1267
|
});
|
|
1264
1268
|
}
|
|
1265
1269
|
/**
|
|
@@ -1371,11 +1375,11 @@ class ue {
|
|
|
1371
1375
|
async batchSetItemValue(t, e = !1, i = !0, s = "none") {
|
|
1372
1376
|
let o = [], r = i;
|
|
1373
1377
|
const a = /* @__PURE__ */ new Set();
|
|
1374
|
-
let
|
|
1378
|
+
let h = [], l = t.map((x) => {
|
|
1375
1379
|
const { rowKey: w, key: m } = x;
|
|
1376
1380
|
let g = x.value, p = g;
|
|
1377
1381
|
const y = this.getRowDataItemForRowKey(w), E = this.getItemValue(w, m), R = this.getVirtualBodyCellByKey(w, m);
|
|
1378
|
-
return (R == null ? void 0 : R.type) === "number" && (["", void 0, null].includes(g) ? p = null : /^-?\d+(\.\d+)?$/.test(`${g}`) ? p = Number(g) : (p = E,
|
|
1382
|
+
return (R == null ? void 0 : R.type) === "number" && (["", void 0, null].includes(g) ? p = null : /^-?\d+(\.\d+)?$/.test(`${g}`) ? p = Number(g) : (p = E, h.push({
|
|
1379
1383
|
...x,
|
|
1380
1384
|
value: p,
|
|
1381
1385
|
oldValue: E,
|
|
@@ -1387,18 +1391,18 @@ class ue {
|
|
|
1387
1391
|
row: y
|
|
1388
1392
|
};
|
|
1389
1393
|
});
|
|
1390
|
-
if (
|
|
1394
|
+
if (l = l.filter((x) => !h.some((w) => x.rowKey === w.rowKey && x.key === w.key)), h.length) {
|
|
1391
1395
|
const x = {
|
|
1392
1396
|
code: "ERR_BATCH_SET_NUMBER_VALUE",
|
|
1393
1397
|
message: "Assignment failed, not a numeric type",
|
|
1394
|
-
data:
|
|
1398
|
+
data: h
|
|
1395
1399
|
};
|
|
1396
1400
|
this.ctx.emit("error", x);
|
|
1397
1401
|
}
|
|
1398
|
-
if (
|
|
1402
|
+
if (l = l.filter((x) => x.oldValue !== x.value), !l.length)
|
|
1399
1403
|
return;
|
|
1400
1404
|
const { BEFORE_VALUE_CHANGE_METHOD: d } = this.ctx.config;
|
|
1401
|
-
s === "none" && typeof d == "function" && (
|
|
1405
|
+
s === "none" && typeof d == "function" && (l = await d(l), r = !1), l.forEach((x) => {
|
|
1402
1406
|
const { value: w, rowKey: m, key: g } = x, p = this.getItemValue(m, g);
|
|
1403
1407
|
a.add(m), this.setItemValue(m, g, w, !1, !1, !1, r), o.push({
|
|
1404
1408
|
rowKey: m,
|
|
@@ -1411,10 +1415,10 @@ class ue {
|
|
|
1411
1415
|
a.forEach((x) => {
|
|
1412
1416
|
f.push(this.ctx.database.getRowDataItemForRowKey(x));
|
|
1413
1417
|
});
|
|
1414
|
-
const u =
|
|
1418
|
+
const u = l.map(({ rowKey: x, key: w }) => this.getValidator(x, w));
|
|
1415
1419
|
Promise.all(u).then(() => {
|
|
1416
1420
|
this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
|
|
1417
|
-
}), this.ctx.emit("change",
|
|
1421
|
+
}), this.ctx.emit("change", l, f), e && this.ctx.history.pushState({
|
|
1418
1422
|
changeList: o,
|
|
1419
1423
|
scrollX: this.ctx.scrollX,
|
|
1420
1424
|
scrollY: this.ctx.scrollY,
|
|
@@ -1435,16 +1439,16 @@ class ue {
|
|
|
1435
1439
|
async setItemValue(t, e, i, s = !1, o = !1, r = !1, a = !0) {
|
|
1436
1440
|
if (!this.rowKeyMap.has(t))
|
|
1437
1441
|
return {};
|
|
1438
|
-
const { item:
|
|
1439
|
-
let
|
|
1442
|
+
const { item: h } = this.rowKeyMap.get(t);
|
|
1443
|
+
let l = h[e], d = i;
|
|
1440
1444
|
if (a && this.ctx.database.getReadonly(t, e))
|
|
1441
1445
|
return {
|
|
1442
|
-
oldValue:
|
|
1443
|
-
newValue:
|
|
1446
|
+
oldValue: l,
|
|
1447
|
+
newValue: l
|
|
1444
1448
|
};
|
|
1445
|
-
|
|
1449
|
+
h[e] !== null && typeof h[e] == "object" && (l = JSON.parse(JSON.stringify(h[e])));
|
|
1446
1450
|
const f = `${t}_${e}`;
|
|
1447
|
-
this.originalDataMap.has(f) || this.originalDataMap.set(f,
|
|
1451
|
+
this.originalDataMap.has(f) || this.originalDataMap.set(f, l);
|
|
1448
1452
|
const u = this.originalDataMap.get(f), x = this.getRowDataItemForRowKey(t);
|
|
1449
1453
|
if (r) {
|
|
1450
1454
|
const w = this.getVirtualBodyCellByKey(t, e);
|
|
@@ -1454,7 +1458,7 @@ class ue {
|
|
|
1454
1458
|
else if (/^-?\d+(\.\d+)?$/.test(`${i}`))
|
|
1455
1459
|
d = Number(i);
|
|
1456
1460
|
else {
|
|
1457
|
-
d =
|
|
1461
|
+
d = l;
|
|
1458
1462
|
const g = {
|
|
1459
1463
|
code: "ERR_SET_NUMBER_VALUE",
|
|
1460
1464
|
message: "Assignment failed, not a numeric type",
|
|
@@ -1463,46 +1467,46 @@ class ue {
|
|
|
1463
1467
|
rowKey: t,
|
|
1464
1468
|
key: e,
|
|
1465
1469
|
value: d,
|
|
1466
|
-
oldValue:
|
|
1470
|
+
oldValue: l,
|
|
1467
1471
|
row: x
|
|
1468
1472
|
}
|
|
1469
1473
|
]
|
|
1470
1474
|
};
|
|
1471
1475
|
this.ctx.emit("error", g);
|
|
1472
1476
|
}
|
|
1473
|
-
if (d ===
|
|
1477
|
+
if (d === l)
|
|
1474
1478
|
return {
|
|
1475
|
-
oldValue:
|
|
1476
|
-
newValue:
|
|
1479
|
+
oldValue: l,
|
|
1480
|
+
newValue: l
|
|
1477
1481
|
};
|
|
1478
1482
|
let m = [
|
|
1479
1483
|
{
|
|
1480
1484
|
rowKey: t,
|
|
1481
1485
|
key: e,
|
|
1482
1486
|
value: d,
|
|
1483
|
-
oldValue:
|
|
1487
|
+
oldValue: l,
|
|
1484
1488
|
row: x
|
|
1485
1489
|
}
|
|
1486
1490
|
];
|
|
1487
1491
|
this.batchSetItemValue(m, s, !1), this.ctx.emit("editChange", {
|
|
1488
1492
|
rowKey: t,
|
|
1489
1493
|
key: e,
|
|
1490
|
-
oldValue:
|
|
1494
|
+
oldValue: l,
|
|
1491
1495
|
value: d,
|
|
1492
1496
|
originalValue: u,
|
|
1493
1497
|
row: x
|
|
1494
1498
|
});
|
|
1495
1499
|
} else
|
|
1496
|
-
this.changedDataMap.set(f, d),
|
|
1500
|
+
this.changedDataMap.set(f, d), h[e] = d;
|
|
1497
1501
|
return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
|
|
1498
1502
|
rowKey: t,
|
|
1499
1503
|
key: e,
|
|
1500
|
-
oldValue:
|
|
1504
|
+
oldValue: l,
|
|
1501
1505
|
value: d,
|
|
1502
1506
|
originalValue: this.originalDataMap.get(f),
|
|
1503
1507
|
row: x
|
|
1504
1508
|
}), o && this.ctx.emit("draw"), {
|
|
1505
|
-
oldValue:
|
|
1509
|
+
oldValue: l,
|
|
1506
1510
|
newValue: d
|
|
1507
1511
|
};
|
|
1508
1512
|
}
|
|
@@ -1529,8 +1533,8 @@ class ue {
|
|
|
1529
1533
|
return !1;
|
|
1530
1534
|
const { item: s } = this.rowKeyMap.get(t), o = s[i];
|
|
1531
1535
|
this.checkboxKeyMap.has(o) && (this.checkboxKeyMap.get(o) || []).forEach((a) => {
|
|
1532
|
-
const
|
|
1533
|
-
|
|
1536
|
+
const h = this.selectionMap.get(a);
|
|
1537
|
+
h && (h.check = e);
|
|
1534
1538
|
});
|
|
1535
1539
|
}
|
|
1536
1540
|
}
|
|
@@ -1576,11 +1580,11 @@ class ue {
|
|
|
1576
1580
|
const e = this.getTreeParent(t);
|
|
1577
1581
|
if (!e)
|
|
1578
1582
|
return;
|
|
1579
|
-
const s = this.getTreeChildren(e).map((
|
|
1583
|
+
const s = this.getTreeChildren(e).map((l) => this.selectionMap.get(l)), o = s.filter((l) => l == null ? void 0 : l.check).length, r = s.length;
|
|
1580
1584
|
let a = !1;
|
|
1581
1585
|
r > 0 && (o === 0 ? a = !1 : o === r || this.ctx.config.TREE_SELECT_MODE === "auto" ? a = !0 : this.ctx.config.TREE_SELECT_MODE === "cautious" && (a = !1));
|
|
1582
|
-
const
|
|
1583
|
-
|
|
1586
|
+
const h = this.selectionMap.get(e);
|
|
1587
|
+
h && h.check !== a && (h.check = a, this.setRowSelectionByCheckboxKey(e, a), this.updateParentTreeSelection(e));
|
|
1584
1588
|
}
|
|
1585
1589
|
/**
|
|
1586
1590
|
* 根据rowKey 设置选中状态
|
|
@@ -1613,22 +1617,22 @@ class ue {
|
|
|
1613
1617
|
return { checked: s, indeterminate: !1 };
|
|
1614
1618
|
let r = !1, a = s;
|
|
1615
1619
|
if (this.ctx.config.TREE_SELECT_MODE === "auto") {
|
|
1616
|
-
const
|
|
1620
|
+
const l = (g) => {
|
|
1617
1621
|
const p = this.getTreeChildren(g);
|
|
1618
1622
|
let y = [];
|
|
1619
1623
|
for (const E of p)
|
|
1620
|
-
y.push(E), y.push(...
|
|
1624
|
+
y.push(E), y.push(...l(E));
|
|
1621
1625
|
return y;
|
|
1622
|
-
}, f =
|
|
1626
|
+
}, f = l(t).map((g) => this.selectionMap.get(g)), u = f.filter((g) => g == null ? void 0 : g.check).length, x = f.length, w = u > 0;
|
|
1623
1627
|
r = w && !(u === x), a = s || w, s && x > 0 && u === 0 && (a = !1, r = !1);
|
|
1624
1628
|
} else if (this.ctx.config.TREE_SELECT_MODE === "cautious") {
|
|
1625
|
-
const
|
|
1629
|
+
const l = (g) => {
|
|
1626
1630
|
const p = this.getTreeChildren(g);
|
|
1627
1631
|
let y = [];
|
|
1628
1632
|
for (const E of p)
|
|
1629
|
-
y.push(E), y.push(...
|
|
1633
|
+
y.push(E), y.push(...l(E));
|
|
1630
1634
|
return y;
|
|
1631
|
-
}, f =
|
|
1635
|
+
}, f = l(t).map((g) => this.selectionMap.get(g)), u = f.filter((g) => g == null ? void 0 : g.check).length, x = f.length, w = u > 0, m = u === x;
|
|
1632
1636
|
r = w && !m, a = s || m, s && x > 0 && u === 0 && (a = !1, r = !1);
|
|
1633
1637
|
} else this.ctx.config.TREE_SELECT_MODE === "strictly" && (r = !1, a = s);
|
|
1634
1638
|
return { checked: a, indeterminate: r };
|
|
@@ -1655,9 +1659,9 @@ class ue {
|
|
|
1655
1659
|
for (const a of o.children) {
|
|
1656
1660
|
if (this.getRowKeyByItem(a) === s)
|
|
1657
1661
|
return r;
|
|
1658
|
-
const
|
|
1659
|
-
if (
|
|
1660
|
-
return
|
|
1662
|
+
const l = e(o.children, s);
|
|
1663
|
+
if (l)
|
|
1664
|
+
return l;
|
|
1661
1665
|
}
|
|
1662
1666
|
}
|
|
1663
1667
|
return null;
|
|
@@ -1740,15 +1744,15 @@ class ue {
|
|
|
1740
1744
|
rowIndex: u.rowIndex
|
|
1741
1745
|
})), w && (o += 1);
|
|
1742
1746
|
});
|
|
1743
|
-
const
|
|
1747
|
+
const h = r > i && s === 0 && a, l = o && o > s && s > 0 || h, d = o !== 0, f = !!o && o === s;
|
|
1744
1748
|
return this.bufferCheckState = {
|
|
1745
1749
|
buffer: !0,
|
|
1746
1750
|
check: f,
|
|
1747
|
-
indeterminate:
|
|
1751
|
+
indeterminate: l,
|
|
1748
1752
|
selectable: d
|
|
1749
1753
|
}, {
|
|
1750
1754
|
check: f,
|
|
1751
|
-
indeterminate:
|
|
1755
|
+
indeterminate: l,
|
|
1752
1756
|
selectable: d
|
|
1753
1757
|
};
|
|
1754
1758
|
}
|
|
@@ -1840,9 +1844,9 @@ class ue {
|
|
|
1840
1844
|
const s = this.rowKeyMap.get(t), o = this.headerMap.get(e);
|
|
1841
1845
|
if (!s || !o)
|
|
1842
1846
|
return !0;
|
|
1843
|
-
const r = s.readonly, a = o.readonly, { BODY_CELL_READONLY_METHOD:
|
|
1844
|
-
if (typeof
|
|
1845
|
-
const d =
|
|
1847
|
+
const r = s.readonly, a = o.readonly, { BODY_CELL_READONLY_METHOD: h } = this.ctx.config;
|
|
1848
|
+
if (typeof h == "function" && o) {
|
|
1849
|
+
const d = h({
|
|
1846
1850
|
row: s.item,
|
|
1847
1851
|
rowIndex: s.rowIndex,
|
|
1848
1852
|
colIndex: o.colIndex,
|
|
@@ -1866,7 +1870,7 @@ class ue {
|
|
|
1866
1870
|
if (o === void 0)
|
|
1867
1871
|
return i([]);
|
|
1868
1872
|
const a = o.column;
|
|
1869
|
-
let
|
|
1873
|
+
let h = a.rules;
|
|
1870
1874
|
if (typeof r == "function") {
|
|
1871
1875
|
const d = r({
|
|
1872
1876
|
row: s.item,
|
|
@@ -1875,10 +1879,10 @@ class ue {
|
|
|
1875
1879
|
column: a,
|
|
1876
1880
|
value: this.getItemValue(t, e)
|
|
1877
1881
|
});
|
|
1878
|
-
d && (
|
|
1882
|
+
d && (h = d);
|
|
1879
1883
|
}
|
|
1880
|
-
if (
|
|
1881
|
-
const
|
|
1884
|
+
if (h) {
|
|
1885
|
+
const l = {
|
|
1882
1886
|
row: s.item,
|
|
1883
1887
|
rowIndex: s.rowIndex,
|
|
1884
1888
|
colIndex: o.colIndex,
|
|
@@ -1888,7 +1892,7 @@ class ue {
|
|
|
1888
1892
|
value: this.getItemValue(t, e),
|
|
1889
1893
|
field: e,
|
|
1890
1894
|
fieldValue: this.getItemValue(t, e)
|
|
1891
|
-
}, f = new re(
|
|
1895
|
+
}, f = new re(h).validate(l);
|
|
1892
1896
|
this.setValidationError(t, e, f), i(f);
|
|
1893
1897
|
} else
|
|
1894
1898
|
this.clearValidationError(t, e), i([]);
|
|
@@ -1910,8 +1914,8 @@ class ue {
|
|
|
1910
1914
|
row: o,
|
|
1911
1915
|
value: r,
|
|
1912
1916
|
colIndex: a,
|
|
1913
|
-
relationRowKeys:
|
|
1914
|
-
relationColKeys:
|
|
1917
|
+
relationRowKeys: h,
|
|
1918
|
+
relationColKeys: l,
|
|
1915
1919
|
rowspan: d,
|
|
1916
1920
|
height: f,
|
|
1917
1921
|
width: u,
|
|
@@ -1938,29 +1942,29 @@ class ue {
|
|
|
1938
1942
|
}
|
|
1939
1943
|
]
|
|
1940
1944
|
};
|
|
1941
|
-
let g = e, p = e, y = a, E = a, R = [], C = 0, I = 0,
|
|
1945
|
+
let g = e, p = e, y = a, E = a, R = [], C = 0, I = 0, S = 0, _ = 0;
|
|
1942
1946
|
if (d !== 1 && w) {
|
|
1943
1947
|
_ = u;
|
|
1944
|
-
const
|
|
1948
|
+
const v = h.reduce((b, O) => {
|
|
1945
1949
|
const T = this.getItemValue(s, O) ?? "";
|
|
1946
1950
|
return `${b}${T}`;
|
|
1947
1951
|
}, "");
|
|
1948
1952
|
for (let b = e - 1; b >= 0; b--) {
|
|
1949
|
-
const O = this.rowIndexRowKeyMap.get(b) || "", T =
|
|
1953
|
+
const O = this.rowIndexRowKeyMap.get(b) || "", T = h.reduce((M, L) => {
|
|
1950
1954
|
const A = this.getItemValue(O, L) ?? "";
|
|
1951
1955
|
return `${M}${A}`;
|
|
1952
1956
|
}, "");
|
|
1953
|
-
if (
|
|
1957
|
+
if (v === T)
|
|
1954
1958
|
g = b;
|
|
1955
1959
|
else
|
|
1956
1960
|
break;
|
|
1957
1961
|
}
|
|
1958
1962
|
for (let b = e; b <= this.ctx.maxRowIndex; b++) {
|
|
1959
|
-
const O = this.rowIndexRowKeyMap.get(b) || "", T =
|
|
1963
|
+
const O = this.rowIndexRowKeyMap.get(b) || "", T = h.reduce((M, L) => {
|
|
1960
1964
|
const A = this.getItemValue(O, L) ?? "";
|
|
1961
1965
|
return `${M}${A}`;
|
|
1962
1966
|
}, "");
|
|
1963
|
-
if (
|
|
1967
|
+
if (v === T)
|
|
1964
1968
|
p = b;
|
|
1965
1969
|
else
|
|
1966
1970
|
break;
|
|
@@ -1971,7 +1975,7 @@ class ue {
|
|
|
1971
1975
|
}
|
|
1972
1976
|
for (let b = g; b <= p; b++) {
|
|
1973
1977
|
const { height: O } = this.positions[b];
|
|
1974
|
-
|
|
1978
|
+
S += O;
|
|
1975
1979
|
const T = this.rowIndexRowKeyMap.get(b) || "", { item: M } = this.rowKeyMap.get(T), L = this.getItemValue(T, i);
|
|
1976
1980
|
R.push({
|
|
1977
1981
|
rowKey: T,
|
|
@@ -1982,35 +1986,35 @@ class ue {
|
|
|
1982
1986
|
}
|
|
1983
1987
|
}
|
|
1984
1988
|
if (x !== 1 && m) {
|
|
1985
|
-
|
|
1986
|
-
for (let
|
|
1987
|
-
const b = this.getColumnByColIndex(
|
|
1989
|
+
S = f;
|
|
1990
|
+
for (let v = a - 1; v >= 0; v--) {
|
|
1991
|
+
const b = this.getColumnByColIndex(v);
|
|
1988
1992
|
if (!b)
|
|
1989
1993
|
break;
|
|
1990
1994
|
const O = this.getItemValue(s, i), T = this.getItemValue(s, b.key);
|
|
1991
|
-
if (O === T &&
|
|
1992
|
-
y =
|
|
1995
|
+
if (O === T && l.includes(b.key))
|
|
1996
|
+
y = v;
|
|
1993
1997
|
else
|
|
1994
1998
|
break;
|
|
1995
1999
|
}
|
|
1996
|
-
for (let
|
|
1997
|
-
const b = this.getColumnByColIndex(
|
|
2000
|
+
for (let v = a; v <= this.ctx.maxColIndex; v++) {
|
|
2001
|
+
const b = this.getColumnByColIndex(v);
|
|
1998
2002
|
if (!b)
|
|
1999
2003
|
break;
|
|
2000
2004
|
const O = this.getItemValue(s, i), T = this.getItemValue(s, b.key);
|
|
2001
|
-
if (O === T &&
|
|
2002
|
-
E =
|
|
2005
|
+
if (O === T && l.includes(b.key))
|
|
2006
|
+
E = v;
|
|
2003
2007
|
else
|
|
2004
2008
|
break;
|
|
2005
2009
|
}
|
|
2006
|
-
for (let
|
|
2007
|
-
const b = this.getColumnByColIndex(
|
|
2010
|
+
for (let v = y; v < a; v++) {
|
|
2011
|
+
const b = this.getColumnByColIndex(v);
|
|
2008
2012
|
if (!b)
|
|
2009
2013
|
break;
|
|
2010
2014
|
I += b.width || 100;
|
|
2011
2015
|
}
|
|
2012
|
-
for (let
|
|
2013
|
-
const b = this.getColumnByColIndex(
|
|
2016
|
+
for (let v = y; v <= E; v++) {
|
|
2017
|
+
const b = this.getColumnByColIndex(v);
|
|
2014
2018
|
if (!b)
|
|
2015
2019
|
break;
|
|
2016
2020
|
_ += b.width || 100, R.push({
|
|
@@ -2026,7 +2030,7 @@ class ue {
|
|
|
2026
2030
|
yArr: [g, p],
|
|
2027
2031
|
rowspan: d,
|
|
2028
2032
|
colspan: x,
|
|
2029
|
-
height:
|
|
2033
|
+
height: S,
|
|
2030
2034
|
width: _,
|
|
2031
2035
|
offsetTop: C,
|
|
2032
2036
|
offsetLeft: I,
|
|
@@ -2043,7 +2047,7 @@ class ue {
|
|
|
2043
2047
|
const s = this.rowIndexRowKeyMap.get(t), o = `${s}_${e}`, r = this.getRowForRowIndex(t), a = this.getColumnByKey(e);
|
|
2044
2048
|
if (!s || !a || !r)
|
|
2045
2049
|
return;
|
|
2046
|
-
const
|
|
2050
|
+
const h = this.getItemValue(s, e), l = [
|
|
2047
2051
|
{
|
|
2048
2052
|
key: e,
|
|
2049
2053
|
rowKey: s,
|
|
@@ -2051,13 +2055,13 @@ class ue {
|
|
|
2051
2055
|
colIndex: a.colIndex,
|
|
2052
2056
|
column: a.column,
|
|
2053
2057
|
row: r,
|
|
2054
|
-
value:
|
|
2058
|
+
value: h,
|
|
2055
2059
|
message: i,
|
|
2056
2060
|
field: e,
|
|
2057
|
-
fieldValue:
|
|
2061
|
+
fieldValue: h
|
|
2058
2062
|
}
|
|
2059
2063
|
];
|
|
2060
|
-
this.validationErrorMap.set(o,
|
|
2064
|
+
this.validationErrorMap.set(o, l);
|
|
2061
2065
|
}
|
|
2062
2066
|
setValidationError(t, e, i) {
|
|
2063
2067
|
const s = `${t}_${e}`;
|
|
@@ -2074,7 +2078,7 @@ class ue {
|
|
|
2074
2078
|
// 获取虚拟单元格,只针对可见的
|
|
2075
2079
|
getVirtualBodyCell(t, e) {
|
|
2076
2080
|
const i = this.getColumnByColIndex(e), s = this.getRowForRowIndex(t);
|
|
2077
|
-
return !i || !s ? void 0 : new
|
|
2081
|
+
return !i || !s ? void 0 : new ut(this.ctx, t, e, 0, 0, 0, 0, i, s.item, "body");
|
|
2078
2082
|
}
|
|
2079
2083
|
getVirtualBodyCellByKey(t, e) {
|
|
2080
2084
|
const i = this.getRowIndexForRowKey(t), s = this.getColIndexForKey(e);
|
|
@@ -2108,15 +2112,15 @@ class ue {
|
|
|
2108
2112
|
}
|
|
2109
2113
|
}), i;
|
|
2110
2114
|
}
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
}), this.overlayerAutoHeightMap = e;
|
|
2115
|
+
setOverlayerAutoHeightMap(t) {
|
|
2116
|
+
this.overlayerAutoHeightMap = t;
|
|
2117
|
+
}
|
|
2118
|
+
getOverlayerAutoHeightMap() {
|
|
2119
|
+
return this.overlayerAutoHeightMap;
|
|
2117
2120
|
}
|
|
2118
|
-
|
|
2119
|
-
|
|
2121
|
+
getOverlayerAutoHeight(t, e) {
|
|
2122
|
+
const i = `${t}_${e}`;
|
|
2123
|
+
return this.overlayerAutoHeightMap.get(i) || 0;
|
|
2120
2124
|
}
|
|
2121
2125
|
}
|
|
2122
2126
|
class ge {
|
|
@@ -2324,21 +2328,21 @@ class pe {
|
|
|
2324
2328
|
* @param {string} color - 阴影的颜色
|
|
2325
2329
|
*/
|
|
2326
2330
|
drawShadow(t, e, i, s, o) {
|
|
2327
|
-
const { fillColor: r, side: a, shadowWidth:
|
|
2331
|
+
const { fillColor: r, side: a, shadowWidth: h, colorStart: l, colorEnd: d } = o;
|
|
2328
2332
|
this.ctx.save(), r && (this.ctx.fillStyle = r, this.ctx.fillRect(t, e, i, s));
|
|
2329
2333
|
let f;
|
|
2330
2334
|
switch (a) {
|
|
2331
2335
|
case "left":
|
|
2332
|
-
f = this.ctx.createLinearGradient(t -
|
|
2336
|
+
f = this.ctx.createLinearGradient(t - h, e, t, e), f.addColorStop(0, l), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t - h, e, h, s);
|
|
2333
2337
|
break;
|
|
2334
2338
|
case "right":
|
|
2335
|
-
f = this.ctx.createLinearGradient(t + i, e, t + i +
|
|
2339
|
+
f = this.ctx.createLinearGradient(t + i, e, t + i + h, e), f.addColorStop(0, l), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t + i, e, h, s);
|
|
2336
2340
|
break;
|
|
2337
2341
|
case "top":
|
|
2338
|
-
f = this.ctx.createLinearGradient(t, e -
|
|
2342
|
+
f = this.ctx.createLinearGradient(t, e - h, t, e), f.addColorStop(0, l), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t, e - h, i, h);
|
|
2339
2343
|
break;
|
|
2340
2344
|
case "bottom":
|
|
2341
|
-
f = this.ctx.createLinearGradient(t, e + s, t, e + s +
|
|
2345
|
+
f = this.ctx.createLinearGradient(t, e + s, t, e + s + h), f.addColorStop(0, l), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t, e + s, i, h);
|
|
2342
2346
|
break;
|
|
2343
2347
|
default:
|
|
2344
2348
|
console.error("Invalid side specified for shadow");
|
|
@@ -2360,12 +2364,12 @@ class pe {
|
|
|
2360
2364
|
drawImage(t, e, i, s, o) {
|
|
2361
2365
|
this.ctx.save(), this.ctx.drawImage(t, e, i, s, o), this.ctx.restore();
|
|
2362
2366
|
}
|
|
2363
|
-
drawRect(t, e, i, s, { borderWidth: o = 1, borderColor: r, fillColor: a, radius:
|
|
2364
|
-
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),
|
|
2367
|
+
drawRect(t, e, i, s, { borderWidth: o = 1, borderColor: r, fillColor: a, radius: h = 0 } = {}) {
|
|
2368
|
+
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), h === 0)
|
|
2365
2369
|
this.ctx.rect(t - 0.5, e - 0.5, i, s);
|
|
2366
2370
|
else {
|
|
2367
|
-
const [
|
|
2368
|
-
this.ctx.moveTo(t +
|
|
2371
|
+
const [l, d, f, u] = typeof h == "number" ? [h, h, h, h] : h;
|
|
2372
|
+
this.ctx.moveTo(t + l, 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 + l, e, l);
|
|
2369
2373
|
}
|
|
2370
2374
|
a !== void 0 && this.ctx.fill(), r !== void 0 && this.ctx.stroke(), this.ctx.restore();
|
|
2371
2375
|
}
|
|
@@ -2384,8 +2388,8 @@ class pe {
|
|
|
2384
2388
|
this.ctx.save();
|
|
2385
2389
|
const {
|
|
2386
2390
|
font: a = "12px Arial",
|
|
2387
|
-
align:
|
|
2388
|
-
color:
|
|
2391
|
+
align: h = "center",
|
|
2392
|
+
color: l = "#495060",
|
|
2389
2393
|
padding: d = 0,
|
|
2390
2394
|
verticalAlign: f = "middle",
|
|
2391
2395
|
maxLineClamp: u = 1,
|
|
@@ -2393,22 +2397,22 @@ class pe {
|
|
|
2393
2397
|
offsetLeft: w = 0,
|
|
2394
2398
|
offsetRight: m = 0
|
|
2395
2399
|
} = r;
|
|
2396
|
-
this.ctx.font = a, this.ctx.fillStyle =
|
|
2400
|
+
this.ctx.font = a, this.ctx.fillStyle = l, this.ctx.textAlign = h;
|
|
2397
2401
|
const p = parseInt(((O = a.match(/\d+/)) == null ? void 0 : O[0]) || "12") * (r.lineHeight || 1.2), y = s - d * 2 - w - m, E = this.ctx.measureText("...").width;
|
|
2398
2402
|
let R = !1;
|
|
2399
2403
|
if (s <= E + d * 2 + w + m)
|
|
2400
2404
|
return this.ctx.restore(), R = !0, R;
|
|
2401
2405
|
const C = Math.round((o - 2 * d) / p);
|
|
2402
|
-
let I = this.wrapText(t, y),
|
|
2403
|
-
u === "auto" && x ?
|
|
2406
|
+
let I = this.wrapText(t, y), S = Math.min(I.length, Math.max(C, 1));
|
|
2407
|
+
u === "auto" && x ? S = I.length : typeof u == "number" && u < C ? S = u : (u === 1 && !x && (I = [t], S = 1), u === "auto" && C === 1 && (I = [t], S = 1));
|
|
2404
2408
|
let _ = i + d;
|
|
2405
|
-
const
|
|
2406
|
-
f === "middle" ? _ = i + (o -
|
|
2409
|
+
const v = Math.round(S * p);
|
|
2410
|
+
f === "middle" ? _ = i + (o - v) / 2 : f === "bottom" && (_ = i + o - v - d);
|
|
2407
2411
|
let b = e + d + w;
|
|
2408
|
-
|
|
2412
|
+
h === "center" ? b = e + s / 2 : h === "right" && (b = e + s - d - m);
|
|
2409
2413
|
for (let T = 0; T < I.length; T++) {
|
|
2410
2414
|
const M = I[T], L = _ + T * p;
|
|
2411
|
-
if (this.ctx.textBaseline = "top", T ===
|
|
2415
|
+
if (this.ctx.textBaseline = "top", T === S - 1) {
|
|
2412
2416
|
const { _text: A, ellipsis: D } = this.handleEllipsis(M, s, d, a);
|
|
2413
2417
|
this.ctx.fillText(A, b, L), R = D;
|
|
2414
2418
|
break;
|
|
@@ -2418,16 +2422,16 @@ class pe {
|
|
|
2418
2422
|
if (r.textCallback && I.length) {
|
|
2419
2423
|
const T = Math.round(this.ctx.measureText(I[0]).width);
|
|
2420
2424
|
let M = b, L = b + T;
|
|
2421
|
-
|
|
2425
|
+
h === "center" ? (M = b - T / 2, L = b + T / 2) : h === "right" && (M = b - T, L = b);
|
|
2422
2426
|
const A = {
|
|
2423
2427
|
x: b,
|
|
2424
2428
|
y: _,
|
|
2425
2429
|
width: T,
|
|
2426
|
-
height:
|
|
2430
|
+
height: v,
|
|
2427
2431
|
left: M,
|
|
2428
2432
|
right: L,
|
|
2429
2433
|
top: _,
|
|
2430
|
-
bottom: _ +
|
|
2434
|
+
bottom: _ + v
|
|
2431
2435
|
};
|
|
2432
2436
|
r.textCallback(A);
|
|
2433
2437
|
}
|
|
@@ -2450,9 +2454,9 @@ class pe {
|
|
|
2450
2454
|
}
|
|
2451
2455
|
const r = o.split("");
|
|
2452
2456
|
let a = "";
|
|
2453
|
-
for (const
|
|
2454
|
-
const
|
|
2455
|
-
this.ctx.measureText(
|
|
2457
|
+
for (const h of r) {
|
|
2458
|
+
const l = a + h;
|
|
2459
|
+
this.ctx.measureText(l).width <= e ? a = l : a ? (i.push(a), a = h) : (i.push(h), a = "");
|
|
2456
2460
|
}
|
|
2457
2461
|
a && i.push(a);
|
|
2458
2462
|
}
|
|
@@ -2474,11 +2478,11 @@ class pe {
|
|
|
2474
2478
|
*/
|
|
2475
2479
|
calculateTextHeight(t = "", e, i = {}) {
|
|
2476
2480
|
var w;
|
|
2477
|
-
const { font: s = "12px Arial", padding: o = 0, align: r = "center", color: a = "#495060", maxLineClamp:
|
|
2481
|
+
const { font: s = "12px Arial", padding: o = 0, align: r = "center", color: a = "#495060", maxLineClamp: h = 1 } = i;
|
|
2478
2482
|
this.ctx.save(), this.ctx.font = s, this.ctx.fillStyle = a, this.ctx.textAlign = r;
|
|
2479
|
-
const
|
|
2483
|
+
const l = parseInt(((w = s.match(/\d+/)) == null ? void 0 : w[0]) || "12"), d = l * (i.lineHeight || 1.2), f = e - o * 2, u = this.wrapText(t, f);
|
|
2480
2484
|
let x = 1;
|
|
2481
|
-
return
|
|
2485
|
+
return h === "auto" ? x = u.length : u.length > h ? x = h : x = u.length, this.ctx.restore(), Math.max(Math.floor(x * d + o * 2), Math.floor(l + o * 2));
|
|
2482
2486
|
}
|
|
2483
2487
|
handleEllipsis(t, e, i = 0, s = "12px Arial") {
|
|
2484
2488
|
this.ctx.save();
|
|
@@ -2494,12 +2498,12 @@ class pe {
|
|
|
2494
2498
|
_text: "",
|
|
2495
2499
|
ellipsis: !0
|
|
2496
2500
|
};
|
|
2497
|
-
const
|
|
2498
|
-
if (
|
|
2501
|
+
const h = this.ctx.measureText(t).width, l = e - i * 2;
|
|
2502
|
+
if (h && h + a >= l) {
|
|
2499
2503
|
o = !0;
|
|
2500
2504
|
let d = 0;
|
|
2501
2505
|
for (let f = 0; f < t.length; f++)
|
|
2502
|
-
if (d += this.ctx.measureText(t[f]).width, d >=
|
|
2506
|
+
if (d += this.ctx.measureText(t[f]).width, d >= l - a) {
|
|
2503
2507
|
r = t.slice(0, f) + "...", o = !0;
|
|
2504
2508
|
break;
|
|
2505
2509
|
}
|
|
@@ -2510,7 +2514,7 @@ class pe {
|
|
|
2510
2514
|
};
|
|
2511
2515
|
}
|
|
2512
2516
|
}
|
|
2513
|
-
class
|
|
2517
|
+
class It {
|
|
2514
2518
|
constructor(t) {
|
|
2515
2519
|
n(this, "_config", {});
|
|
2516
2520
|
/** CSS 类名前缀 */
|
|
@@ -2816,7 +2820,7 @@ class Rt {
|
|
|
2816
2820
|
}), Object.assign(this, t, this._config);
|
|
2817
2821
|
}
|
|
2818
2822
|
}
|
|
2819
|
-
const
|
|
2823
|
+
const vt = '<svg t="1724122044148" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4551" width="32" height="32"><path d="M707.648 401.28L489.28 560.704l22.656 30.976 22.656-30.976L316.16 401.216q-3.072-2.24-6.464-3.84-3.456-1.536-7.104-2.432-3.712-0.896-7.488-1.088-3.776-0.128-7.488 0.448-3.776 0.64-7.296 1.92-3.584 1.28-6.784 3.2-3.2 1.984-6.016 4.544-2.816 2.56-5.056 5.632-2.176 3.072-3.84 6.464-1.536 3.456-2.432 7.104-0.896 3.712-1.088 7.488-0.128 3.776 0.448 7.488 0.64 3.776 1.92 7.296 1.28 3.584 3.2 6.784 1.984 3.2 4.544 6.016 2.56 2.752 5.632 4.992l218.368 159.552q4.928 3.584 10.752 5.504 5.76 1.92 11.904 1.92 6.08 0 11.904-1.92 5.76-1.92 10.752-5.504l218.368-159.552q3.008-2.24 5.568-4.992 2.56-2.816 4.544-6.016 1.92-3.2 3.264-6.784 1.28-3.52 1.92-7.296 0.576-3.712 0.384-7.488-0.128-3.84-1.024-7.488-0.896-3.648-2.496-7.04-1.6-3.456-3.84-6.528-2.24-3.072-4.992-5.632-2.816-2.56-6.016-4.48-3.2-1.984-6.784-3.328-3.584-1.28-7.296-1.856-3.712-0.64-7.488-0.448-3.84 0.192-7.488 1.088-3.648 0.896-7.04 2.496-3.456 1.536-6.528 3.84z m61.056 30.976q0-3.84-0.768-7.488-0.704-3.712-2.176-7.232-1.472-3.456-3.52-6.656-2.112-3.136-4.8-5.76-2.688-2.688-5.76-4.8-3.2-2.112-6.72-3.584-3.456-1.408-7.168-2.176-3.712-0.704-7.488-0.704-3.84 0-7.488 0.704-3.712 0.768-7.232 2.176-3.456 1.472-6.656 3.584-3.136 2.112-5.76 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.584 6.656-1.408 3.52-2.176 7.232-0.704 3.712-0.704 7.488 0 3.776 0.704 7.488 0.768 3.712 2.176 7.168 1.472 3.52 3.584 6.656 2.112 3.2 4.8 5.824 2.624 2.688 5.76 4.8 3.2 2.112 6.656 3.52 3.52 1.472 7.232 2.176 3.712 0.768 7.488 0.768 3.776 0 7.488-0.768 3.712-0.704 7.168-2.176 3.52-1.408 6.656-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.048-3.2 3.52-6.72 1.472-3.456 2.176-7.168 0.768-3.712 0.768-7.488z m-436.736 0q0-3.84-0.768-7.488-0.704-3.712-2.176-7.232-1.408-3.456-3.52-6.656-2.112-3.136-4.8-5.76-2.688-2.688-5.76-4.8-3.2-2.112-6.656-3.584-3.52-1.408-7.232-2.176-3.712-0.704-7.488-0.704-3.84 0-7.488 0.704-3.712 0.768-7.232 2.176-3.456 1.472-6.592 3.584-3.2 2.112-5.824 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.52 6.656-1.472 3.52-2.24 7.232-0.704 3.712-0.704 7.488 0 3.776 0.704 7.488 0.768 3.712 2.24 7.168 1.408 3.52 3.52 6.656 2.112 3.2 4.8 5.824 2.624 2.688 5.76 4.8 3.2 2.112 6.656 3.52 3.52 1.472 7.232 2.176 3.712 0.768 7.488 0.768 3.776 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.408 6.592-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.112-3.2 3.52-6.72 1.472-3.456 2.176-7.168 0.768-3.712 0.768-7.488z" p-id="4552"></path></svg>', gt = '<svg t="1755138507987" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5079" width="200" height="200"><path d="M512 938.688a42.688 42.688 0 0 1-35.072-18.432l-192-277.312A42.56 42.56 0 0 1 320 576h384a42.752 42.752 0 0 1 35.072 66.944l-192 277.312a42.688 42.688 0 0 1-35.072 18.432" fill="currentColor" p-id="2016"></path><path d="M704 448H320a42.752 42.752 0 0 1-35.072-66.944l192-277.312c16-23.04 54.208-23.04 70.144 0l192 277.312A42.56 42.56 0 0 1 704 448" fill="currentColor" p-id="2015"></path></svg>', Ee = gt.replace('fill="currentColor" p-id="2016"', 'fill="#bec4c7" p-id="2016"'), ye = gt.replace('fill="currentColor" p-id="2015"', 'fill="#bec4c7" p-id="2015"');
|
|
2820
2824
|
class Ce {
|
|
2821
2825
|
constructor(t) {
|
|
2822
2826
|
n(this, "ctx");
|
|
@@ -2839,7 +2843,7 @@ class Ce {
|
|
|
2839
2843
|
name: "shrink",
|
|
2840
2844
|
configName: "CHECKBOX_UNCHECK_SVG",
|
|
2841
2845
|
configColorName: "SHRINK_ICON_COLOR",
|
|
2842
|
-
svg:
|
|
2846
|
+
svg: vt,
|
|
2843
2847
|
color: "#4E5969"
|
|
2844
2848
|
},
|
|
2845
2849
|
{
|
|
@@ -2891,7 +2895,7 @@ class Ce {
|
|
|
2891
2895
|
name: "icon-select",
|
|
2892
2896
|
configName: "CHECKBOX_UNCHECK_SVG",
|
|
2893
2897
|
configColorName: "SHRINK_ICON_COLOR",
|
|
2894
|
-
svg:
|
|
2898
|
+
svg: vt,
|
|
2895
2899
|
color: "#4E5969"
|
|
2896
2900
|
},
|
|
2897
2901
|
{
|
|
@@ -2911,7 +2915,7 @@ class Ce {
|
|
|
2911
2915
|
{
|
|
2912
2916
|
name: "sort-default",
|
|
2913
2917
|
configName: "SORTABLE_ICON_SVG",
|
|
2914
|
-
svg:
|
|
2918
|
+
svg: gt,
|
|
2915
2919
|
color: "#bec4c7"
|
|
2916
2920
|
}
|
|
2917
2921
|
]);
|
|
@@ -2948,22 +2952,22 @@ class Ce {
|
|
|
2948
2952
|
}
|
|
2949
2953
|
async createImageFromSVG(t, e, i = !1) {
|
|
2950
2954
|
const r = new DOMParser().parseFromString(t, "image/svg+xml").documentElement;
|
|
2951
|
-
e && r.querySelectorAll("*").forEach((
|
|
2952
|
-
const d =
|
|
2953
|
-
(d === "currentColor" || d === null) &&
|
|
2955
|
+
e && r.querySelectorAll("*").forEach((l) => {
|
|
2956
|
+
const d = l.getAttribute("fill");
|
|
2957
|
+
(d === "currentColor" || d === null) && l.setAttribute("fill", e);
|
|
2954
2958
|
});
|
|
2955
2959
|
const a = new Image();
|
|
2956
|
-
let
|
|
2960
|
+
let h = "";
|
|
2957
2961
|
if (i) {
|
|
2958
|
-
const
|
|
2962
|
+
const l = new Blob([new XMLSerializer().serializeToString(r)], {
|
|
2959
2963
|
type: "image/svg+xml"
|
|
2960
2964
|
});
|
|
2961
|
-
|
|
2965
|
+
h = URL.createObjectURL(l);
|
|
2962
2966
|
} else
|
|
2963
|
-
|
|
2964
|
-
return a.src =
|
|
2967
|
+
h = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(r));
|
|
2968
|
+
return a.src = h, new Promise((l, d) => {
|
|
2965
2969
|
a.onerror = () => d(new Error("Failed to load image:" + t)), a.onload = () => {
|
|
2966
|
-
|
|
2970
|
+
l(a);
|
|
2967
2971
|
};
|
|
2968
2972
|
});
|
|
2969
2973
|
}
|
|
@@ -2971,9 +2975,9 @@ class Ce {
|
|
|
2971
2975
|
return this.icons.get(t);
|
|
2972
2976
|
}
|
|
2973
2977
|
}
|
|
2974
|
-
class
|
|
2975
|
-
constructor(e, i, s, o, r, a,
|
|
2976
|
-
super(e, s, o, r, a, "header",
|
|
2978
|
+
class lt extends Yt {
|
|
2979
|
+
constructor(e, i, s, o, r, a, h) {
|
|
2980
|
+
super(e, s, o, r, a, "header", h.fixed);
|
|
2977
2981
|
n(this, "align");
|
|
2978
2982
|
n(this, "hideHeaderSelection", !1);
|
|
2979
2983
|
n(this, "verticalAlign", "middle");
|
|
@@ -3011,6 +3015,7 @@ class ht extends Yt {
|
|
|
3011
3015
|
n(this, "visibleWidth", 0);
|
|
3012
3016
|
n(this, "visibleHeight", 0);
|
|
3013
3017
|
n(this, "maxLineClamp", "auto");
|
|
3018
|
+
n(this, "domDataset", {});
|
|
3014
3019
|
n(this, "drawTextX", 0);
|
|
3015
3020
|
n(this, "drawTextY", 0);
|
|
3016
3021
|
n(this, "drawTextWidth", 0);
|
|
@@ -3030,7 +3035,7 @@ class ht extends Yt {
|
|
|
3030
3035
|
n(this, "drawSortImageHeight", 0);
|
|
3031
3036
|
n(this, "drawSortImageName", "");
|
|
3032
3037
|
n(this, "drawSortImageSource");
|
|
3033
|
-
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 =
|
|
3038
|
+
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 = h.key, this.minWidth = h.minWidth, this.maxWidth = h.maxWidth, this.type = h.type || "", this.editorType = h.editorType || "text", this.hideHeaderSelection = h.hideHeaderSelection || !1, this.align = h.headerAlign || h.align || this.ctx.config.COLUMNS_ALIGN, this.verticalAlign = h.headerVerticalAlign || h.verticalAlign || this.ctx.config.COLUMNS_VERTICAL_ALIGN, this.fixed = h.fixed, this.level = h.level || 0, this.operation = h.operation || !1, this.text = h.title, this.column = h, this.colspan = h.colspan || 1, this.widthFillDisable = h.widthFillDisable || !1, this.rowspan = h.rowspan || 1, this.rules = h.rules, this.readonly = h.readonly || !1, this.required = h.required || !1, this.sortIconName = h.sortIconName || "sort-default", this.sortAscIconName = h.sortAscIconName || "sort-asc", this.sortDescIconName = h.sortDescIconName || "sort-desc", this.rowKey = Ht(), this.overflowTooltipShow = h.overflowTooltipHeaderShow !== !1, this.hasChildren = h.children && h.children.length > 0 || !1, this.render = h.renderHeader;
|
|
3034
3039
|
}
|
|
3035
3040
|
/**
|
|
3036
3041
|
* 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
|
|
@@ -3050,11 +3055,11 @@ class ht extends Yt {
|
|
|
3050
3055
|
const { HEADER_CELL_STYLE_METHOD: e, HEADER_BG_COLOR: i, HEADER_TEXT_COLOR: s } = this.ctx.config;
|
|
3051
3056
|
let o = i, r = s;
|
|
3052
3057
|
if (typeof e == "function") {
|
|
3053
|
-
const a = e, { backgroundColor:
|
|
3058
|
+
const a = e, { backgroundColor: h, color: l } = a({
|
|
3054
3059
|
colIndex: this.colIndex,
|
|
3055
3060
|
column: this.column
|
|
3056
3061
|
}) || {};
|
|
3057
|
-
|
|
3062
|
+
h && (o = h), l && (r = l);
|
|
3058
3063
|
}
|
|
3059
3064
|
this.drawCellBgColor = o, this.drawTextColor = r;
|
|
3060
3065
|
}
|
|
@@ -3094,8 +3099,23 @@ class ht extends Yt {
|
|
|
3094
3099
|
maxLineClamp: this.maxLineClamp,
|
|
3095
3100
|
offsetRight: this.column.sortBy ? 16 : 0,
|
|
3096
3101
|
// 排序图标占位
|
|
3102
|
+
offsetLeft: this.required ? 12 : 0,
|
|
3103
|
+
// 必填星号占位
|
|
3097
3104
|
textCallback: (o) => {
|
|
3098
|
-
this.column.sortBy && (this.drawSortImageX = o.right + 4, this.drawSortImageY = o.top + (o.height - 16) / 2)
|
|
3105
|
+
this.column.sortBy && (this.drawSortImageX = o.right + 4, this.drawSortImageY = o.top + (o.height - 16) / 2), this.required && e.drawText(
|
|
3106
|
+
"*",
|
|
3107
|
+
o.left - 18,
|
|
3108
|
+
o.top + (o.height - 12) / 2,
|
|
3109
|
+
24,
|
|
3110
|
+
24,
|
|
3111
|
+
{
|
|
3112
|
+
color: "red",
|
|
3113
|
+
font: "18px Arial",
|
|
3114
|
+
align: "center",
|
|
3115
|
+
verticalAlign: "middle",
|
|
3116
|
+
padding: 0
|
|
3117
|
+
}
|
|
3118
|
+
);
|
|
3099
3119
|
}
|
|
3100
3120
|
}
|
|
3101
3121
|
);
|
|
@@ -3113,10 +3133,10 @@ class ht extends Yt {
|
|
|
3113
3133
|
drawSelection() {
|
|
3114
3134
|
if (!this.hideHeaderSelection && ["index-selection", "selection", "selection-tree", "tree-selection"].includes(this.type)) {
|
|
3115
3135
|
const { indeterminate: e, check: i, selectable: s } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: o = 0, CELL_PADDING: r } = this.ctx.config;
|
|
3116
|
-
let a = this.drawX + (this.width - o) / 2,
|
|
3117
|
-
this.drawTextX = a + o - r / 2, this.drawTextWidth = this.drawX + this.visibleWidth - this.drawTextX, (this.align === "left" || this.align === "right") && (a = this.drawX + r, this.drawTextX = a + o - r / 2, this.drawTextWidth = this.drawX + this.visibleWidth - this.drawTextX), this.verticalAlign === "top" ?
|
|
3118
|
-
let
|
|
3119
|
-
e ? (
|
|
3136
|
+
let a = this.drawX + (this.width - o) / 2, h = this.drawY + (this.height - o) / 2;
|
|
3137
|
+
this.drawTextX = a + o - r / 2, this.drawTextWidth = this.drawX + this.visibleWidth - this.drawTextX, (this.align === "left" || this.align === "right") && (a = this.drawX + r, this.drawTextX = a + o - r / 2, this.drawTextWidth = this.drawX + this.visibleWidth - this.drawTextX), this.verticalAlign === "top" ? h = this.drawY + r / 2 : this.verticalAlign === "bottom" && (h = this.drawY + this.height - o - r / 2);
|
|
3138
|
+
let l = this.ctx.icons.get("checkbox-uncheck"), d = "checkbox-uncheck";
|
|
3139
|
+
e ? (l = this.ctx.icons.get("checkbox-indeterminate"), d = "checkbox-indeterminate") : i && s ? (l = this.ctx.icons.get("checkbox-check"), d = "checkbox-check") : i && !s ? (l = this.ctx.icons.get("checkbox-check-disabled"), d = "checkbox-check-disabled") : !i && s ? (l = this.ctx.icons.get("checkbox-uncheck"), d = "checkbox-uncheck") : (l = this.ctx.icons.get("checkbox-disabled"), d = "checkbox-disabled"), l && (this.drawSelectionImageX = a, this.drawSelectionImageY = h, this.drawSelectionImageWidth = o, this.drawSelectionImageHeight = o, this.drawSelectionImageName = d, this.drawSelectionImageSource = l, this.ctx.paint.drawImage(
|
|
3120
3140
|
this.drawSelectionImageSource,
|
|
3121
3141
|
this.drawSelectionImageX,
|
|
3122
3142
|
this.drawSelectionImageY,
|
|
@@ -3280,7 +3300,7 @@ class be {
|
|
|
3280
3300
|
t.drawSelectionImageWidth,
|
|
3281
3301
|
t.drawSelectionImageHeight
|
|
3282
3302
|
))
|
|
3283
|
-
if (t instanceof
|
|
3303
|
+
if (t instanceof lt)
|
|
3284
3304
|
t.drawSelectionImageName === "checkbox-uncheck" || t.drawSelectionImageName === "checkbox-indeterminate" ? this.ctx.database.toggleAllSelection() : t.drawSelectionImageName === "checkbox-check" && this.ctx.database.clearSelection(!0);
|
|
3285
3305
|
else {
|
|
3286
3306
|
if (!this.ctx.database.getRowSelectable(t.rowKey))
|
|
@@ -3305,8 +3325,8 @@ class be {
|
|
|
3305
3325
|
t.drawTreeImageHeight
|
|
3306
3326
|
))
|
|
3307
3327
|
return;
|
|
3308
|
-
const
|
|
3309
|
-
if (f && u && !
|
|
3328
|
+
const h = this.ctx.database.getRowForRowKey(t.rowKey), { expand: l = !1, expandLazy: d = !1 } = h || {}, { EXPAND_LAZY: f, EXPAND_LAZY_METHOD: u } = this.ctx.config;
|
|
3329
|
+
if (f && u && !l && !d)
|
|
3310
3330
|
typeof u == "function" && (this.ctx.database.expandLoading(t.rowKey, !0), u({
|
|
3311
3331
|
row: t.row,
|
|
3312
3332
|
rowIndex: t.rowIndex,
|
|
@@ -3335,8 +3355,8 @@ class be {
|
|
|
3335
3355
|
))
|
|
3336
3356
|
return;
|
|
3337
3357
|
const a = this.ctx.database.getSortState(t.key);
|
|
3338
|
-
let
|
|
3339
|
-
a.direction === "none" ?
|
|
3358
|
+
let h;
|
|
3359
|
+
a.direction === "none" ? h = "asc" : a.direction === "asc" ? h = "desc" : h = "none", this.ctx.database.setSortState(t.key, h);
|
|
3340
3360
|
}
|
|
3341
3361
|
/**
|
|
3342
3362
|
* 图标进入和离开事件,包括选中,展开,提示图标等
|
|
@@ -3345,7 +3365,7 @@ class be {
|
|
|
3345
3365
|
*/
|
|
3346
3366
|
imageEnterAndLeave(t, e) {
|
|
3347
3367
|
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), o = i, r = s;
|
|
3348
|
-
if (t instanceof
|
|
3368
|
+
if (t instanceof lt) {
|
|
3349
3369
|
if (t.drawSelectionImageSource && this.isInsideElement(
|
|
3350
3370
|
r,
|
|
3351
3371
|
o,
|
|
@@ -3369,7 +3389,7 @@ class be {
|
|
|
3369
3389
|
return;
|
|
3370
3390
|
}
|
|
3371
3391
|
}
|
|
3372
|
-
if (t instanceof
|
|
3392
|
+
if (t instanceof ut) {
|
|
3373
3393
|
if (t.drawSelectionImageSource && this.isInsideElement(
|
|
3374
3394
|
r,
|
|
3375
3395
|
o,
|
|
@@ -3419,15 +3439,15 @@ class be {
|
|
|
3419
3439
|
if (this.isInsideBody(e))
|
|
3420
3440
|
for (const r of i) {
|
|
3421
3441
|
const a = r.fixedCells.concat(r.noFixedCells);
|
|
3422
|
-
for (const
|
|
3423
|
-
const
|
|
3442
|
+
for (const h of a) {
|
|
3443
|
+
const l = h.getDrawX(), d = h.getDrawY();
|
|
3424
3444
|
if (o) {
|
|
3425
|
-
if (t >
|
|
3426
|
-
s(
|
|
3445
|
+
if (t > l && t < l + h.visibleWidth && e > d && e < d + h.visibleHeight) {
|
|
3446
|
+
s(h);
|
|
3427
3447
|
return;
|
|
3428
3448
|
}
|
|
3429
|
-
} else if (t >
|
|
3430
|
-
s(
|
|
3449
|
+
} else if (t > l && t < l + h.width && e > d && e < d + h.height) {
|
|
3450
|
+
s(h);
|
|
3431
3451
|
return;
|
|
3432
3452
|
}
|
|
3433
3453
|
}
|
|
@@ -3566,20 +3586,20 @@ class Re {
|
|
|
3566
3586
|
canvasElement: o,
|
|
3567
3587
|
overlayerElement: r,
|
|
3568
3588
|
editorElement: a,
|
|
3569
|
-
emptyElement:
|
|
3570
|
-
contextMenuElement:
|
|
3589
|
+
emptyElement: h,
|
|
3590
|
+
contextMenuElement: l
|
|
3571
3591
|
} = t;
|
|
3572
|
-
this.containerElement = i, s.tabIndex = 0, this.stageElement = s, this.canvasElement = o, this.overlayerElement = r, this.editorElement = a, this.emptyElement =
|
|
3592
|
+
this.containerElement = i, s.tabIndex = 0, this.stageElement = s, this.canvasElement = o, this.overlayerElement = r, this.editorElement = a, this.emptyElement = h, this.contextMenuElement = l, this.config = new It(e.config || {}), this.eventBus = new me(), this.eventBrowser = new we(this), this.eventTable = new be(this), this.paint = new pe(this.canvasElement), this.database = new ue(this, e), this.history = new ge(this), this.icons = new Ce(this);
|
|
3573
3593
|
}
|
|
3574
3594
|
setConfig(t) {
|
|
3575
|
-
this.config = new
|
|
3595
|
+
this.config = new It(t);
|
|
3576
3596
|
}
|
|
3577
3597
|
setItemValueByEditor(t, e, i, s = !0, o = !0, r = !0) {
|
|
3578
3598
|
if (this.config.ENABLE_MERGE_CELL_LINK) {
|
|
3579
3599
|
const a = this.database.getVirtualBodyCellByKey(t, e);
|
|
3580
3600
|
if (a && (a.mergeRow || a.mergeCol)) {
|
|
3581
|
-
const { dataList:
|
|
3582
|
-
this.database.batchSetItemValue(
|
|
3601
|
+
const { dataList: h } = a.getSpanInfo(), l = h.map((d) => ({ ...d, value: i }));
|
|
3602
|
+
this.database.batchSetItemValue(l, s, r);
|
|
3583
3603
|
return;
|
|
3584
3604
|
}
|
|
3585
3605
|
}
|
|
@@ -3591,9 +3611,9 @@ class Re {
|
|
|
3591
3611
|
t.forEach((o) => {
|
|
3592
3612
|
const r = this.database.getRowIndexForRowKey(o.rowKey), a = this.database.getColIndexForKey(o.key);
|
|
3593
3613
|
if (r === void 0 || a === void 0) return;
|
|
3594
|
-
const
|
|
3595
|
-
if (
|
|
3596
|
-
const { dataList:
|
|
3614
|
+
const h = this.database.getVirtualBodyCell(r, a);
|
|
3615
|
+
if (h) {
|
|
3616
|
+
const { dataList: l } = h.getSpanInfo(), d = l.map((f) => ({ ...f, value: o.value }));
|
|
3597
3617
|
s.push(...d);
|
|
3598
3618
|
}
|
|
3599
3619
|
}), this.database.batchSetItemValue(s, e, i);
|
|
@@ -3638,7 +3658,7 @@ class Re {
|
|
|
3638
3658
|
for (let o = 0; o <= e[1] - e[0]; o++) {
|
|
3639
3659
|
const r = [];
|
|
3640
3660
|
for (let a = 0; a <= i[1] - i[0]; a++) {
|
|
3641
|
-
const
|
|
3661
|
+
const h = o + e[0], l = a + i[0], d = this.database.getVirtualBodyCell(h, l);
|
|
3642
3662
|
d && (d.selectorCellValueType === "displayText" ? r.push(d.displayText) : r.push(d.getValue()));
|
|
3643
3663
|
}
|
|
3644
3664
|
s += `${r.join(" ")}\r`, t.push(r);
|
|
@@ -3759,8 +3779,8 @@ class St {
|
|
|
3759
3779
|
if (this.isOnScrollbar(e, i) && t.target === this.ctx.canvasElement ? this.isFocus = !0 : this.isFocus = !1, r === 0 || s == this.clientX && o == this.clientY) return;
|
|
3760
3780
|
let a = 0;
|
|
3761
3781
|
if (this.type === "horizontal" ? a = s - this.clientX : a = o - this.clientY, this.isDragging && a !== 0) {
|
|
3762
|
-
let
|
|
3763
|
-
this.type === "vertical" ?
|
|
3782
|
+
let h = 0;
|
|
3783
|
+
this.type === "vertical" ? h = this.dragStart + a / (this.visibleDistance - this.barHeight) * this.distance : h = this.dragStart + a / (this.visibleDistance - this.barWidth) * this.distance, this.scroll = Math.max(0, Math.min(h, this.distance));
|
|
3764
3784
|
}
|
|
3765
3785
|
}
|
|
3766
3786
|
isPointInElement(t, e, i, s, o, r) {
|
|
@@ -3786,21 +3806,21 @@ class St {
|
|
|
3786
3806
|
stageHeight: i,
|
|
3787
3807
|
stageWidth: s,
|
|
3788
3808
|
config: { SCROLLER_TRACK_SIZE: o = 0, SCROLLER_SIZE: r = 0, BORDER: a }
|
|
3789
|
-
} = this.ctx,
|
|
3809
|
+
} = this.ctx, h = s, l = i, d = e.height, f = e.width, u = t.height, x = this.ctx.footer.height;
|
|
3790
3810
|
if (this.type === "vertical") {
|
|
3791
|
-
this.visibleDistance =
|
|
3811
|
+
this.visibleDistance = l - o - d, this.distance = u - this.visibleDistance + x, this.trackX = h - o, this.trackY = 0, this.splitPoints = [this.trackX, d, this.trackX + o, d], this.trackWidth = o, this.trackHeight = l, this.barX = this.trackX - 1 + (o - r) / 2, this.barWidth = r;
|
|
3792
3812
|
const w = this.distance ? this.visibleDistance / (u + x) : 0;
|
|
3793
3813
|
let m = Math.floor(w * this.visibleDistance);
|
|
3794
3814
|
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));
|
|
3795
3815
|
} else {
|
|
3796
|
-
this.visibleDistance =
|
|
3797
|
-
l - o,
|
|
3816
|
+
this.visibleDistance = h - o, this.distance = f - this.visibleDistance, this.splitPoints = [
|
|
3798
3817
|
h - o,
|
|
3799
3818
|
l - o,
|
|
3800
|
-
h
|
|
3819
|
+
h - o,
|
|
3820
|
+
l
|
|
3801
3821
|
];
|
|
3802
3822
|
const w = a ? 0 : 0.5;
|
|
3803
|
-
this.trackX = 0, this.trackY =
|
|
3823
|
+
this.trackX = 0, this.trackY = l - o + w, this.trackWidth = h, this.trackHeight = o;
|
|
3804
3824
|
const m = this.distance ? this.visibleDistance / f : 0;
|
|
3805
3825
|
let g = Math.floor(m * this.visibleDistance);
|
|
3806
3826
|
this.barY = this.trackY - 1 + (o - r) / 2, g < 30 ? g = 30 : g >= this.visibleDistance && (g = 0), this.barWidth = g, this.barHeight = r, this.barX = this.scroll / this.distance * (this.visibleDistance - this.barWidth), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
@@ -3891,7 +3911,7 @@ class Ie {
|
|
|
3891
3911
|
this.setScrollY(o - e.visibleHeight / 2);
|
|
3892
3912
|
}
|
|
3893
3913
|
}
|
|
3894
|
-
class
|
|
3914
|
+
class ve {
|
|
3895
3915
|
constructor(t) {
|
|
3896
3916
|
n(this, "ctx");
|
|
3897
3917
|
// 上下文
|
|
@@ -3930,7 +3950,7 @@ class Se {
|
|
|
3930
3950
|
n(this, "renderFixedCellHeaders", []);
|
|
3931
3951
|
this.ctx = t, this.ctx.on(
|
|
3932
3952
|
"resetHeader",
|
|
3933
|
-
|
|
3953
|
+
xt(() => {
|
|
3934
3954
|
this.init(), this.ctx.emit("draw");
|
|
3935
3955
|
}, 100)
|
|
3936
3956
|
), this.init(), this.initResizeColumn();
|
|
@@ -3949,13 +3969,13 @@ class Se {
|
|
|
3949
3969
|
this.columnIndex = 0, this.resizeNum = 0, this.render(r, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
3950
3970
|
const a = this.ctx.containerElement.getBoundingClientRect();
|
|
3951
3971
|
this.resizeNum > 0 ? this.ctx.stageWidth = Math.floor(a.width) : this.ctx.stageWidth = Math.floor(this.width + e), this.ctx.stageElement.style.width = this.ctx.stageWidth + "px", this.visibleWidth = this.ctx.stageWidth - e;
|
|
3952
|
-
const
|
|
3953
|
-
if (this.resizeNum &&
|
|
3954
|
-
const f = Math.floor(
|
|
3972
|
+
const h = this.visibleWidth - this.width;
|
|
3973
|
+
if (this.resizeNum && h > 0) {
|
|
3974
|
+
const f = Math.floor(h / this.resizeNum * 100) / 100;
|
|
3955
3975
|
this.resizeAllColumn(f);
|
|
3956
3976
|
}
|
|
3957
|
-
const
|
|
3958
|
-
this.ctx.fixedLeftWidth =
|
|
3977
|
+
const l = this.fixedLeftCellHeaders.filter((f) => !f.hasChildren);
|
|
3978
|
+
this.ctx.fixedLeftWidth = l.reduce((f, u) => f + u.width, 0);
|
|
3959
3979
|
const d = this.fixedRightCellHeaders.filter((f) => !f.hasChildren);
|
|
3960
3980
|
this.ctx.fixedRightWidth = d.reduce((f, u) => f + u.width, e), 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.visibleWidth = this.visibleWidth, this.ctx.header.visibleHeight = this.visibleHeight;
|
|
3961
3981
|
}
|
|
@@ -3976,8 +3996,8 @@ class Se {
|
|
|
3976
3996
|
} = this.ctx;
|
|
3977
3997
|
if (this.isResizing && this.resizeTarget) {
|
|
3978
3998
|
const o = this.resizeTarget.width, r = this.resizeTarget.minWidth, a = this.resizeTarget.maxWidth;
|
|
3979
|
-
let
|
|
3980
|
-
|
|
3999
|
+
let h = e.clientX - this.clientX;
|
|
4000
|
+
h + o < s && (h = -(o - s)), r && h + o < r && (h = -(o - r)), a && h + o > a && (h = a - o), this.resizeDiff = h, this.ctx.emit("draw");
|
|
3981
4001
|
} else {
|
|
3982
4002
|
if (this.resizeTarget = null, this.isMouseDown)
|
|
3983
4003
|
return;
|
|
@@ -3988,9 +4008,9 @@ class Se {
|
|
|
3988
4008
|
this.ctx.stageElement.style.cursor === "col-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3989
4009
|
const o = [...this.renderFixedCellHeaders, ...this.renderCenterCellHeaders];
|
|
3990
4010
|
for (const r of o) {
|
|
3991
|
-
const { offsetX: a, offsetY:
|
|
3992
|
-
|
|
3993
|
-
r.colspan <= 1 && this.ctx.isTarget(e) &&
|
|
4011
|
+
const { offsetX: a, offsetY: h } = this.ctx.getOffset(e), l = a, d = r.getDrawX();
|
|
4012
|
+
l > d + r.width - 5 && l < d + r.width + 4 && l < i - 4 && // 视窗中最后一列不允许调整宽
|
|
4013
|
+
r.colspan <= 1 && this.ctx.isTarget(e) && h <= this.height && (this.ctx.stageElement.style.cursor = "col-resize", this.resizeTarget = r);
|
|
3994
4014
|
}
|
|
3995
4015
|
}
|
|
3996
4016
|
}));
|
|
@@ -4044,10 +4064,10 @@ class Se {
|
|
|
4044
4064
|
let s = e;
|
|
4045
4065
|
const { HEADER_HEIGHT: o = 0 } = this.ctx.config;
|
|
4046
4066
|
for (let r = 0; r < i; r++) {
|
|
4047
|
-
const a = t[r],
|
|
4067
|
+
const a = t[r], h = o * (a.rowspan || 0), l = o * (a.level || 0);
|
|
4048
4068
|
let { minWidth: d, maxWidth: f } = a, u = a.width || 100;
|
|
4049
4069
|
d && u < d && (u = d), f && u > f && (u = f), a.children && (u = et(a.children).reduce((m, g) => m + ((g == null ? void 0 : g.width) || 100), 0));
|
|
4050
|
-
const x = new
|
|
4070
|
+
const x = new lt(this.ctx, this.columnIndex, s, l, u, h, a);
|
|
4051
4071
|
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;
|
|
4052
4072
|
}
|
|
4053
4073
|
}
|
|
@@ -4079,8 +4099,8 @@ class Se {
|
|
|
4079
4099
|
colorStart: "rgba(0,0,0,0.1)",
|
|
4080
4100
|
colorEnd: "rgba(0,0,0,0)"
|
|
4081
4101
|
}), i < Math.floor(s.width - o - 1) && e !== a) {
|
|
4082
|
-
const
|
|
4083
|
-
this.ctx.paint.drawShadow(
|
|
4102
|
+
const h = s.width - (this.x + this.width) + o - e;
|
|
4103
|
+
this.ctx.paint.drawShadow(h, this.y, e, this.height, {
|
|
4084
4104
|
fillColor: r,
|
|
4085
4105
|
side: "left",
|
|
4086
4106
|
shadowWidth: 4,
|
|
@@ -4122,7 +4142,7 @@ class Se {
|
|
|
4122
4142
|
}
|
|
4123
4143
|
}
|
|
4124
4144
|
class Bt {
|
|
4125
|
-
constructor(t, e, i = 0, s = 0, o = 0, r = 0, a,
|
|
4145
|
+
constructor(t, e, i = 0, s = 0, o = 0, r = 0, a, h = "body") {
|
|
4126
4146
|
n(this, "ctx");
|
|
4127
4147
|
n(this, "x", 0);
|
|
4128
4148
|
n(this, "y", 0);
|
|
@@ -4137,12 +4157,12 @@ class Bt {
|
|
|
4137
4157
|
n(this, "rowType", "body");
|
|
4138
4158
|
n(this, "data");
|
|
4139
4159
|
n(this, "calculatedHeight", -1);
|
|
4140
|
-
this.ctx = t, this.x = i, this.y = s, this.width = o, this.height = r, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e) || "", this.rowType =
|
|
4160
|
+
this.ctx = t, this.x = i, this.y = s, this.width = o, this.height = r, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e) || "", this.rowType = h, this.data = a, this.update();
|
|
4141
4161
|
}
|
|
4142
4162
|
update() {
|
|
4143
4163
|
const { header: t } = this.ctx, e = [], i = [], s = [], o = [];
|
|
4144
4164
|
t.renderLeafCellHeaders.forEach((r) => {
|
|
4145
|
-
const a = new
|
|
4165
|
+
const a = new ut(
|
|
4146
4166
|
this.ctx,
|
|
4147
4167
|
this.rowIndex,
|
|
4148
4168
|
r.colIndex,
|
|
@@ -4155,11 +4175,11 @@ class Bt {
|
|
|
4155
4175
|
this.rowType
|
|
4156
4176
|
);
|
|
4157
4177
|
a.fixed ? i.push(a) : s.push(a), e.push(a), a.autoRowHeight && o.push(a);
|
|
4158
|
-
}), this.cells = e, this.calculatedHeightCells = o, this.fixedCells = i, this.noFixedCells = s
|
|
4178
|
+
}), this.cells = e, this.calculatedHeightCells = o, this.fixedCells = i, this.noFixedCells = s;
|
|
4159
4179
|
}
|
|
4160
|
-
|
|
4180
|
+
updateCalculatedHeight() {
|
|
4161
4181
|
const t = this.calculatedHeightCells.map((e) => e.getAutoHeight());
|
|
4162
|
-
|
|
4182
|
+
this.calculatedHeight = t.length ? Math.max(...t) : -1;
|
|
4163
4183
|
}
|
|
4164
4184
|
drawCenter() {
|
|
4165
4185
|
this.noFixedCells.forEach((t) => {
|
|
@@ -4182,7 +4202,7 @@ class Bt {
|
|
|
4182
4202
|
});
|
|
4183
4203
|
}
|
|
4184
4204
|
}
|
|
4185
|
-
class
|
|
4205
|
+
class Se {
|
|
4186
4206
|
constructor(t) {
|
|
4187
4207
|
n(this, "resizeTarget", null);
|
|
4188
4208
|
//调整行大小的目标
|
|
@@ -4219,8 +4239,8 @@ class ve {
|
|
|
4219
4239
|
FOOTER_FIXED: o,
|
|
4220
4240
|
SCROLLER_TRACK_SIZE: r = 0,
|
|
4221
4241
|
HEIGHT: a,
|
|
4222
|
-
EMPTY_BODY_HEIGHT:
|
|
4223
|
-
MAX_HEIGHT:
|
|
4242
|
+
EMPTY_BODY_HEIGHT: h = 0,
|
|
4243
|
+
MAX_HEIGHT: l = 0,
|
|
4224
4244
|
ENABLE_OFFSET_HEIGHT: d = 0,
|
|
4225
4245
|
OFFSET_HEIGHT: f = 0,
|
|
4226
4246
|
FOOTER_POSITION: u
|
|
@@ -4232,20 +4252,20 @@ class ve {
|
|
|
4232
4252
|
const { data: x, sumHeight: w } = s.getData();
|
|
4233
4253
|
this.height = w, this.data = x, this.width = e.width, this.visibleWidth = this.ctx.stageWidth - r;
|
|
4234
4254
|
const m = this.ctx.footer.height;
|
|
4235
|
-
!this.data.length && !a ? this.height =
|
|
4255
|
+
!this.data.length && !a ? this.height = h : !this.data.length && a && (this.height = a - e.height - m - r);
|
|
4236
4256
|
let g = this.height + e.height + r;
|
|
4237
4257
|
g += m;
|
|
4238
4258
|
let p = g;
|
|
4239
4259
|
const y = window.innerHeight, { top: E } = this.containerRect || this.ctx.containerElement.getBoundingClientRect();
|
|
4240
4260
|
if (y > E && d && !a) {
|
|
4241
4261
|
const T = y - E - f;
|
|
4242
|
-
T > e.height + r ? p = T : g >
|
|
4243
|
-
} else this.data.length && a ? p = a : this.data.length &&
|
|
4262
|
+
T > e.height + r ? p = T : g > l && (p = l);
|
|
4263
|
+
} else this.data.length && a ? p = a : this.data.length && l && g > l && (p = l);
|
|
4244
4264
|
p > 0 && (this.ctx.stageHeight = Math.floor(p), this.ctx.stageElement.style.height = `${this.ctx.stageHeight}px`);
|
|
4245
4265
|
let R = this.ctx.stageHeight - e.height - r;
|
|
4246
4266
|
o ? this.visibleHeight = R - m : this.visibleHeight = R, this.data.length || (this.height = this.visibleHeight), this.ctx.body.x = this.x, this.ctx.body.y = this.y, this.ctx.body.width = this.width, this.ctx.body.height = this.height, this.ctx.body.visibleWidth = this.visibleWidth, this.ctx.body.visibleHeight = this.visibleHeight, this.ctx.body.data = x;
|
|
4247
|
-
const C = window.devicePixelRatio || 1, I = this.ctx.stageWidth * C,
|
|
4248
|
-
t.width = Math.round(I), t.height = Math.round(
|
|
4267
|
+
const C = window.devicePixelRatio || 1, I = this.ctx.stageWidth * C, S = this.ctx.stageHeight * C;
|
|
4268
|
+
t.width = Math.round(I), t.height = Math.round(S);
|
|
4249
4269
|
const _ = this.data.length ? "not-empty" : "empty";
|
|
4250
4270
|
this.ctx.emit("emptyChange", {
|
|
4251
4271
|
isEmpty: _,
|
|
@@ -4254,10 +4274,10 @@ class ve {
|
|
|
4254
4274
|
bodyHeight: this.height,
|
|
4255
4275
|
footerHeight: m,
|
|
4256
4276
|
width: this.width,
|
|
4257
|
-
height: this.data.length ? 0 :
|
|
4277
|
+
height: this.data.length ? 0 : h + m
|
|
4258
4278
|
});
|
|
4259
|
-
const
|
|
4260
|
-
this.ctx.canvasElement.setAttribute("style", `height:${b}px;width:${
|
|
4279
|
+
const v = Math.round(t.width / C * 1e4) / 1e4, b = Math.round(t.height / C * 1e4) / 1e4;
|
|
4280
|
+
this.ctx.canvasElement.setAttribute("style", `height:${b}px;width:${v}px;`), this.ctx.paint.scale(C);
|
|
4261
4281
|
}
|
|
4262
4282
|
// 调整行的高度
|
|
4263
4283
|
initResizeRow() {
|
|
@@ -4277,8 +4297,8 @@ class ve {
|
|
|
4277
4297
|
}), this.ctx.on("mousemove", (e) => {
|
|
4278
4298
|
if (this.ctx.editing) return;
|
|
4279
4299
|
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), o = i, r = s, a = e.clientY, {
|
|
4280
|
-
stageHeight:
|
|
4281
|
-
scrollY:
|
|
4300
|
+
stageHeight: h,
|
|
4301
|
+
scrollY: l,
|
|
4282
4302
|
config: { RESIZE_ROW_MIN_HEIGHT: d = 0 }
|
|
4283
4303
|
} = this.ctx;
|
|
4284
4304
|
if (this.isResizing && this.resizeTarget) {
|
|
@@ -4298,7 +4318,7 @@ class ve {
|
|
|
4298
4318
|
this.ctx.stageElement.style.cursor === "row-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
4299
4319
|
for (let f = 0; f < this.renderRows.length; f++) {
|
|
4300
4320
|
const u = this.renderRows[f];
|
|
4301
|
-
if (o > u.y -
|
|
4321
|
+
if (o > u.y - l + u.height - 1.5 && o < u.y - l + u.height + 1.5 && o < h - 4)
|
|
4302
4322
|
for (let w = 0; w < u.cells.length; w++) {
|
|
4303
4323
|
const m = u.cells[w];
|
|
4304
4324
|
r > m.drawX + 10 && r < m.drawX + m.width - 10 && m.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = u);
|
|
@@ -4347,8 +4367,8 @@ class ve {
|
|
|
4347
4367
|
colorStart: "rgba(0,0,0,0.1)",
|
|
4348
4368
|
colorEnd: "rgba(0,0,0,0)"
|
|
4349
4369
|
}), i < Math.floor(s.width - o - 1) && e !== a) {
|
|
4350
|
-
const
|
|
4351
|
-
this.ctx.paint.drawShadow(
|
|
4370
|
+
const h = s.width - (this.x + this.width) + o - e;
|
|
4371
|
+
this.ctx.paint.drawShadow(h, this.y, e, this.height, {
|
|
4352
4372
|
fillColor: r,
|
|
4353
4373
|
side: "left",
|
|
4354
4374
|
shadowWidth: 4,
|
|
@@ -4376,12 +4396,12 @@ class ve {
|
|
|
4376
4396
|
config: { CELL_HEIGHT: s }
|
|
4377
4397
|
} = this.ctx, o = i, { data: r, positions: a } = e.getData();
|
|
4378
4398
|
this.ctx.maxRowIndex = r.length - 1;
|
|
4379
|
-
let
|
|
4380
|
-
if (
|
|
4399
|
+
let h = this.binarySearch(a, o), l = this.binarySearch(a, o + this.visibleHeight);
|
|
4400
|
+
if (l === -1 && (l = this.ctx.maxRowIndex), h === -1 && l === this.ctx.maxRowIndex) {
|
|
4381
4401
|
const f = Math.floor(this.visibleHeight / s);
|
|
4382
|
-
|
|
4402
|
+
h = this.ctx.maxRowIndex - f;
|
|
4383
4403
|
}
|
|
4384
|
-
this.headIndex = Math.max(0,
|
|
4404
|
+
this.headIndex = Math.max(0, h), this.tailIndex = Math.min(this.ctx.maxRowIndex, l + 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;
|
|
4385
4405
|
const d = [];
|
|
4386
4406
|
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
4387
4407
|
const u = this.headIndex + f, x = this.visibleRows[f], { height: w, top: m } = this.ctx.database.getPositionForRowIndex(u), g = new Bt(this.ctx, u, 0, m + this.y, t.width, w, x);
|
|
@@ -4391,12 +4411,16 @@ class ve {
|
|
|
4391
4411
|
}
|
|
4392
4412
|
updateAutoHeight() {
|
|
4393
4413
|
const t = this.ctx.body.renderRows;
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4414
|
+
if (!t.some((s) => s.calculatedHeightCells.length > 0))
|
|
4415
|
+
return;
|
|
4416
|
+
t.forEach((s) => {
|
|
4417
|
+
s.updateCalculatedHeight();
|
|
4418
|
+
});
|
|
4419
|
+
const i = t.map((s) => ({
|
|
4420
|
+
height: s.calculatedHeight,
|
|
4421
|
+
rowIndex: s.rowIndex
|
|
4398
4422
|
}));
|
|
4399
|
-
this.ctx.database.setBatchCalculatedRowHeight(
|
|
4423
|
+
this.ctx.database.setBatchCalculatedRowHeight(i);
|
|
4400
4424
|
}
|
|
4401
4425
|
draw() {
|
|
4402
4426
|
this.renderRows.forEach((t) => {
|
|
@@ -4407,7 +4431,7 @@ class ve {
|
|
|
4407
4431
|
t.drawFixedContainer();
|
|
4408
4432
|
}), this.renderRows.forEach((t) => {
|
|
4409
4433
|
t.drawFixed();
|
|
4410
|
-
}), this.drawTipLine()
|
|
4434
|
+
}), this.drawTipLine();
|
|
4411
4435
|
}
|
|
4412
4436
|
}
|
|
4413
4437
|
class _e {
|
|
@@ -4441,16 +4465,16 @@ class _e {
|
|
|
4441
4465
|
stageWidth: o,
|
|
4442
4466
|
config: { HEADER_BG_COLOR: r, SCROLLER_TRACK_SIZE: a }
|
|
4443
4467
|
} = this.ctx;
|
|
4444
|
-
let
|
|
4445
|
-
if (this.ctx.config.FOOTER_FIXED || (
|
|
4468
|
+
let h = this.y;
|
|
4469
|
+
if (this.ctx.config.FOOTER_FIXED || (h = this.y - this.ctx.scrollY), i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, h, t, this.height, {
|
|
4446
4470
|
fillColor: r,
|
|
4447
4471
|
side: "right",
|
|
4448
4472
|
shadowWidth: 4,
|
|
4449
4473
|
colorStart: "rgba(0,0,0,0.1)",
|
|
4450
4474
|
colorEnd: "rgba(0,0,0,0)"
|
|
4451
4475
|
}), i < Math.floor(s.width - o - 1) && e !== a) {
|
|
4452
|
-
const
|
|
4453
|
-
this.ctx.paint.drawShadow(
|
|
4476
|
+
const l = s.width - (this.x + this.width) + o - e;
|
|
4477
|
+
this.ctx.paint.drawShadow(l, h, e, this.height, {
|
|
4454
4478
|
fillColor: r,
|
|
4455
4479
|
side: "left",
|
|
4456
4480
|
shadowWidth: 4,
|
|
@@ -4510,7 +4534,7 @@ class Te {
|
|
|
4510
4534
|
this.moveFocus(t);
|
|
4511
4535
|
}), this.ctx.on(
|
|
4512
4536
|
"mousemove",
|
|
4513
|
-
|
|
4537
|
+
xt((t) => {
|
|
4514
4538
|
const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = this.ctx.isTarget(t) && i > 0 && i < this.ctx.body.visibleWidth && e > this.ctx.header.visibleHeight && e < this.ctx.header.visibleHeight + this.ctx.body.visibleHeight;
|
|
4515
4539
|
(this.ctx.selectorMove || this.ctx.autofillMove) && (!s && !this.mousedownHeader ? this.startAdjustPosition(t) : this.stopAdjustPosition());
|
|
4516
4540
|
}, 100)
|
|
@@ -4608,12 +4632,12 @@ class Te {
|
|
|
4608
4632
|
this.ctx.mousedown && (this.ctx.selectorMove = !0), this.ctx.selector.enable = !0;
|
|
4609
4633
|
const {
|
|
4610
4634
|
SELECTOR_AREA_MIN_X: a,
|
|
4611
|
-
SELECTOR_AREA_MAX_X:
|
|
4612
|
-
SELECTOR_AREA_MIN_Y:
|
|
4635
|
+
SELECTOR_AREA_MAX_X: h,
|
|
4636
|
+
SELECTOR_AREA_MIN_Y: l,
|
|
4613
4637
|
SELECTOR_AREA_MAX_Y: d,
|
|
4614
4638
|
SELECTOR_AREA_MAX_X_OFFSET: f,
|
|
4615
4639
|
SELECTOR_AREA_MAX_Y_OFFSET: u
|
|
4616
|
-
} = this.ctx.config, x = a, w =
|
|
4640
|
+
} = this.ctx.config, x = a, w = h || this.ctx.maxColIndex - f, m = l, g = d || this.ctx.maxRowIndex - u;
|
|
4617
4641
|
let [p, y] = o, [E, R] = r;
|
|
4618
4642
|
if (p < x || y > w || E < m || R > g)
|
|
4619
4643
|
return;
|
|
@@ -4624,14 +4648,14 @@ class Te {
|
|
|
4624
4648
|
p === y && E === R ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, o = [Math.max(x, p), Math.min(w, y)], r = [Math.max(m, E), Math.min(g, R)];
|
|
4625
4649
|
const { BEFORE_SET_SELECTOR_METHOD: C } = this.ctx.config;
|
|
4626
4650
|
if (typeof C == "function") {
|
|
4627
|
-
const
|
|
4651
|
+
const S = C({
|
|
4628
4652
|
focusCell: this.ctx.focusCell,
|
|
4629
4653
|
xArr: o,
|
|
4630
4654
|
yArr: r
|
|
4631
4655
|
});
|
|
4632
|
-
if (!
|
|
4656
|
+
if (!S)
|
|
4633
4657
|
return;
|
|
4634
|
-
o =
|
|
4658
|
+
o = S.xArr, r = S.yArr;
|
|
4635
4659
|
}
|
|
4636
4660
|
this.ctx.selector.xArr = o, this.ctx.selector.yArr = r, this.ctx.emit("setSelector", this.ctx.selector), this.ctx.emit("drawView");
|
|
4637
4661
|
}
|
|
@@ -4639,13 +4663,13 @@ class Te {
|
|
|
4639
4663
|
adjustMergeCells(t, e) {
|
|
4640
4664
|
var w;
|
|
4641
4665
|
const [i, s] = e, [o, r] = t;
|
|
4642
|
-
let a = [],
|
|
4666
|
+
let a = [], h = [];
|
|
4643
4667
|
for (let m = 0; m <= e[1] - e[0]; m++)
|
|
4644
4668
|
for (let g = 0; g <= t[1] - t[0]; g++) {
|
|
4645
4669
|
const p = m + e[0], y = g + t[0], E = this.ctx.database.getVirtualBodyCell(p, y);
|
|
4646
|
-
E && ((p === i || p === s) && a.push(E), (y === o || y === r) &&
|
|
4670
|
+
E && ((p === i || p === s) && a.push(E), (y === o || y === r) && h.push(E));
|
|
4647
4671
|
}
|
|
4648
|
-
const
|
|
4672
|
+
const l = a.reduce(
|
|
4649
4673
|
(m, g) => {
|
|
4650
4674
|
const { yArr: p } = g.getSpanInfo(), [y, E] = p;
|
|
4651
4675
|
return m.minY = Math.min(m.minY, y), m.maxY = Math.max(m.maxY, E), m;
|
|
@@ -4654,7 +4678,7 @@ class Te {
|
|
|
4654
4678
|
minY: i,
|
|
4655
4679
|
maxY: s
|
|
4656
4680
|
}
|
|
4657
|
-
), d =
|
|
4681
|
+
), d = h.reduce(
|
|
4658
4682
|
(m, g) => {
|
|
4659
4683
|
const { xArr: p } = g.getSpanInfo(), [y, E] = p;
|
|
4660
4684
|
return m.minX = Math.min(m.minX, y), m.maxX = Math.max(m.maxX, E), m;
|
|
@@ -4663,9 +4687,9 @@ class Te {
|
|
|
4663
4687
|
minX: o,
|
|
4664
4688
|
maxX: r
|
|
4665
4689
|
}
|
|
4666
|
-
), f = [d.minX, d.maxX], u = [
|
|
4690
|
+
), f = [d.minX, d.maxX], u = [l.minY, l.maxY];
|
|
4667
4691
|
let x = !1;
|
|
4668
|
-
if (d.minX !== d.maxX ||
|
|
4692
|
+
if (d.minX !== d.maxX || l.minY !== l.maxY) {
|
|
4669
4693
|
const m = JSON.stringify(f) + JSON.stringify(u), g = (w = this.ctx.focusCell) == null ? void 0 : w.getSpanInfo();
|
|
4670
4694
|
x = (g && JSON.stringify(g.xArr) + JSON.stringify(g.yArr)) === m;
|
|
4671
4695
|
}
|
|
@@ -4686,15 +4710,15 @@ class Te {
|
|
|
4686
4710
|
if (this.ctx.mousedown && this.ctx.focusCellHeader) {
|
|
4687
4711
|
const { colIndex: a } = this.ctx.focusCellHeader;
|
|
4688
4712
|
if (this.ctx.clearSelector(), t.colIndex >= a) {
|
|
4689
|
-
const
|
|
4690
|
-
this.setSelector(
|
|
4713
|
+
const h = [a, t.colIndex + t.colspan - 1], l = [o, r];
|
|
4714
|
+
this.setSelector(h, l);
|
|
4691
4715
|
} else {
|
|
4692
|
-
const
|
|
4693
|
-
this.setSelector(
|
|
4716
|
+
const h = [t.colIndex, a], l = [o, r];
|
|
4717
|
+
this.setSelector(h, l);
|
|
4694
4718
|
}
|
|
4695
4719
|
} else {
|
|
4696
|
-
const a = [t.colIndex, t.colIndex + t.colspan - 1],
|
|
4697
|
-
this.setSelector(a,
|
|
4720
|
+
const a = [t.colIndex, t.colIndex + t.colspan - 1], h = [o, r];
|
|
4721
|
+
this.setSelector(a, h);
|
|
4698
4722
|
}
|
|
4699
4723
|
}
|
|
4700
4724
|
selectAll() {
|
|
@@ -4708,8 +4732,8 @@ class Te {
|
|
|
4708
4732
|
SELECTOR_AREA_MIN_Y: o,
|
|
4709
4733
|
SELECTOR_AREA_MAX_Y: r,
|
|
4710
4734
|
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
4711
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
4712
|
-
} = this.ctx.config,
|
|
4735
|
+
SELECTOR_AREA_MAX_Y_OFFSET: h
|
|
4736
|
+
} = this.ctx.config, l = i, d = s || this.ctx.maxColIndex - a, f = o, u = r || this.ctx.maxRowIndex - h, x = [l, d], w = [f, u];
|
|
4713
4737
|
this.setSelector(x, w);
|
|
4714
4738
|
}
|
|
4715
4739
|
}
|
|
@@ -4719,17 +4743,17 @@ class Te {
|
|
|
4719
4743
|
const { SELECTOR_AREA_MIN_X: i, SELECTOR_AREA_MAX_X: s, SELECTOR_AREA_MAX_X_OFFSET: o } = this.ctx.config, r = s || this.ctx.maxColIndex - o, a = i;
|
|
4720
4744
|
if (e) {
|
|
4721
4745
|
this.ctx.setFocusCell(t);
|
|
4722
|
-
const
|
|
4723
|
-
this.setSelector(
|
|
4746
|
+
const h = [a, r], l = [t.rowIndex, t.rowIndex];
|
|
4747
|
+
this.setSelector(h, l);
|
|
4724
4748
|
}
|
|
4725
4749
|
if (this.ctx.focusCell && this.ctx.mousedown) {
|
|
4726
|
-
const { rowIndex:
|
|
4727
|
-
if (t.rowIndex >=
|
|
4728
|
-
const
|
|
4729
|
-
this.setSelector(
|
|
4750
|
+
const { rowIndex: h } = this.ctx.focusCell;
|
|
4751
|
+
if (t.rowIndex >= h) {
|
|
4752
|
+
const l = [a, r], d = [h, t.rowIndex];
|
|
4753
|
+
this.setSelector(l, d);
|
|
4730
4754
|
} else {
|
|
4731
|
-
const
|
|
4732
|
-
this.setSelector(
|
|
4755
|
+
const l = [a, r], d = [t.rowIndex, h];
|
|
4756
|
+
this.setSelector(l, d);
|
|
4733
4757
|
}
|
|
4734
4758
|
}
|
|
4735
4759
|
}
|
|
@@ -4738,7 +4762,7 @@ class Te {
|
|
|
4738
4762
|
return;
|
|
4739
4763
|
const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
|
|
4740
4764
|
if (t && e && i) {
|
|
4741
|
-
const { rowIndex: s, colIndex: o } = e, r = Math.min(i.colIndex, o), a = Math.max(i.colIndex, o),
|
|
4765
|
+
const { rowIndex: s, colIndex: o } = e, r = Math.min(i.colIndex, o), a = Math.max(i.colIndex, o), h = Math.min(i.rowIndex, s), l = Math.max(i.rowIndex, s), d = [r, a], f = [h, l];
|
|
4742
4766
|
this.setSelector(d, f);
|
|
4743
4767
|
}
|
|
4744
4768
|
}
|
|
@@ -4748,7 +4772,7 @@ class Te {
|
|
|
4748
4772
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
4749
4773
|
if (this.ctx.config.ENABLE_SELECTOR_SINGLE)
|
|
4750
4774
|
return;
|
|
4751
|
-
const { colIndex: s, rowIndex: o } = i, { colIndex: r, rowIndex: a } = e,
|
|
4775
|
+
const { colIndex: s, rowIndex: o } = i, { colIndex: r, rowIndex: a } = e, h = Math.min(r, s), l = Math.max(r, s), d = Math.min(a, o), f = Math.max(a, o), u = [h, l], x = [d, f];
|
|
4752
4776
|
this.setSelector(u, x);
|
|
4753
4777
|
} else {
|
|
4754
4778
|
this.ctx.emit("cellSelectedClick", e);
|
|
@@ -4801,7 +4825,7 @@ class Te {
|
|
|
4801
4825
|
return;
|
|
4802
4826
|
t = a.data;
|
|
4803
4827
|
}
|
|
4804
|
-
const o =
|
|
4828
|
+
const o = le(t);
|
|
4805
4829
|
navigator.clipboard ? navigator.clipboard.writeText(o).then(() => {
|
|
4806
4830
|
this.ctx.selector.xArrCopy = this.ctx.selector.xArr.slice(), this.ctx.selector.yArrCopy = this.ctx.selector.yArr.slice(), this.ctx.emit("copyChange", {
|
|
4807
4831
|
xArr: this.ctx.selector.xArrCopy,
|
|
@@ -4813,9 +4837,9 @@ class Te {
|
|
|
4813
4837
|
clearSelectedData(t, e, i = !1, s = null) {
|
|
4814
4838
|
let o = [];
|
|
4815
4839
|
const r = /* @__PURE__ */ new Set();
|
|
4816
|
-
for (let
|
|
4817
|
-
for (let
|
|
4818
|
-
const d =
|
|
4840
|
+
for (let h = 0; h <= e[1] - e[0]; h++)
|
|
4841
|
+
for (let l = 0; l <= t[1] - t[0]; l++) {
|
|
4842
|
+
const d = h + e[0], f = l + t[0], u = this.ctx.database.getItemValueForRowIndexAndColIndex(d, f);
|
|
4819
4843
|
if (u) {
|
|
4820
4844
|
const { rowKey: x, key: w } = u;
|
|
4821
4845
|
this.ctx.database.getReadonly(x, w) || (r.add(x), o.push({
|
|
@@ -4833,8 +4857,8 @@ class Te {
|
|
|
4833
4857
|
return o;
|
|
4834
4858
|
this.ctx.database.batchSetItemValue(o, !0);
|
|
4835
4859
|
let a = [];
|
|
4836
|
-
return r.forEach((
|
|
4837
|
-
a.push(this.ctx.database.getRowDataItemForRowKey(
|
|
4860
|
+
return r.forEach((h) => {
|
|
4861
|
+
a.push(this.ctx.database.getRowDataItemForRowKey(h));
|
|
4838
4862
|
}), this.ctx.emit("clearSelectedDataChange", o, a), o;
|
|
4839
4863
|
}
|
|
4840
4864
|
paste() {
|
|
@@ -4846,19 +4870,19 @@ class Te {
|
|
|
4846
4870
|
if (this.ctx.selector.enable && t) {
|
|
4847
4871
|
const e = this.ctx.selector.yArr[0], i = this.ctx.selector.xArr[0], s = /* @__PURE__ */ new Set();
|
|
4848
4872
|
navigator.clipboard.readText().then(async (o) => {
|
|
4849
|
-
let r =
|
|
4850
|
-
const a = [i, i + r[0].length - 1],
|
|
4873
|
+
let r = he(o);
|
|
4874
|
+
const a = [i, i + r[0].length - 1], h = [e, e + r.length - 1], [l, d] = h, [f, u] = a, x = d - this.ctx.maxRowIndex, w = u - this.ctx.maxColIndex;
|
|
4851
4875
|
(x > 0 || w > 0) && this.ctx.emit("onPastedDataOverflow", {
|
|
4852
4876
|
maxY: d,
|
|
4853
4877
|
maxX: u,
|
|
4854
|
-
minY:
|
|
4878
|
+
minY: l,
|
|
4855
4879
|
minX: f,
|
|
4856
4880
|
overflowRowCount: x,
|
|
4857
4881
|
overflowColCount: w,
|
|
4858
4882
|
textArr: r
|
|
4859
4883
|
});
|
|
4860
4884
|
const m = r.length === 1 && r[0].length === 1;
|
|
4861
|
-
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a,
|
|
4885
|
+
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a, h) && !m) {
|
|
4862
4886
|
const E = {
|
|
4863
4887
|
code: "ERR_MERGED_CELLS_PASTE",
|
|
4864
4888
|
message: "Merged cells cannot span paste data"
|
|
@@ -4870,12 +4894,12 @@ class Te {
|
|
|
4870
4894
|
for (let E = 0; E <= r.length - 1; E++) {
|
|
4871
4895
|
const R = r[E].length;
|
|
4872
4896
|
for (let C = 0; C <= R - 1; C++) {
|
|
4873
|
-
const I = E + e,
|
|
4897
|
+
const I = E + e, S = C + i, _ = r[E][C], v = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
4874
4898
|
I,
|
|
4875
|
-
|
|
4899
|
+
S
|
|
4876
4900
|
);
|
|
4877
|
-
if (
|
|
4878
|
-
const { rowKey: b, key: O } =
|
|
4901
|
+
if (v) {
|
|
4902
|
+
const { rowKey: b, key: O } = v;
|
|
4879
4903
|
this.ctx.database.getReadonly(b, O) || (s.add(b), g.push({
|
|
4880
4904
|
rowKey: b,
|
|
4881
4905
|
key: O,
|
|
@@ -4908,7 +4932,7 @@ class Te {
|
|
|
4908
4932
|
oldValue: this.ctx.database.getItemValue(C.rowKey, C.key),
|
|
4909
4933
|
row: this.ctx.database.getRowDataItemForRowKey(C.rowKey)
|
|
4910
4934
|
}));
|
|
4911
|
-
if (g = await E(R, a,
|
|
4935
|
+
if (g = await E(R, a, h, r), g && !g.length)
|
|
4912
4936
|
return;
|
|
4913
4937
|
}
|
|
4914
4938
|
this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(g, !0);
|
|
@@ -4931,7 +4955,7 @@ class Te {
|
|
|
4931
4955
|
if (!e)
|
|
4932
4956
|
return;
|
|
4933
4957
|
let { colIndex: i = 0, rowIndex: s = 0 } = e;
|
|
4934
|
-
const o = 0, r = 0, a = this.ctx.maxColIndex,
|
|
4958
|
+
const o = 0, r = 0, a = this.ctx.maxColIndex, h = this.ctx.maxRowIndex;
|
|
4935
4959
|
switch (t) {
|
|
4936
4960
|
case "LEFT":
|
|
4937
4961
|
i > o && i--;
|
|
@@ -4943,11 +4967,11 @@ class Te {
|
|
|
4943
4967
|
i < a && i++;
|
|
4944
4968
|
break;
|
|
4945
4969
|
case "BOTTOM":
|
|
4946
|
-
s <
|
|
4970
|
+
s < h && s++;
|
|
4947
4971
|
break;
|
|
4948
4972
|
}
|
|
4949
|
-
const
|
|
4950
|
-
f && (f.operation || this.isInSettingRange(f.rowIndex, f.colIndex) && (this.ctx.setFocusCell(f), this.setSelector(
|
|
4973
|
+
const l = [i, i], d = [s, s], f = this.getCell(s, i);
|
|
4974
|
+
f && (f.operation || this.isInSettingRange(f.rowIndex, f.colIndex) && (this.ctx.setFocusCell(f), this.setSelector(l, d), this.adjustBoundaryPosition(), this.ctx.emit("moveFocus", f), this.ctx.emit("draw")));
|
|
4951
4975
|
}
|
|
4952
4976
|
stopAdjustPosition() {
|
|
4953
4977
|
this.adjustPositionX = "", this.adjustPositionY = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerY && (clearInterval(this.timerY), this.timerY = 0);
|
|
@@ -4960,9 +4984,9 @@ class Te {
|
|
|
4960
4984
|
SELECTOR_AREA_MIN_Y: o,
|
|
4961
4985
|
SELECTOR_AREA_MAX_Y: r,
|
|
4962
4986
|
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
4963
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
4964
|
-
} = this.ctx.config,
|
|
4965
|
-
return !(e <
|
|
4987
|
+
SELECTOR_AREA_MAX_Y_OFFSET: h
|
|
4988
|
+
} = this.ctx.config, l = i, d = s || this.ctx.maxColIndex - a, f = o, u = r || this.ctx.maxRowIndex - h;
|
|
4989
|
+
return !(e < l || e > d || t < f || t > u);
|
|
4966
4990
|
}
|
|
4967
4991
|
/**
|
|
4968
4992
|
* 调整滚动条位置,让到达边界时自动滚动
|
|
@@ -4975,8 +4999,8 @@ class Te {
|
|
|
4975
4999
|
let a = 10 * (s === "left" ? -1 : 1);
|
|
4976
5000
|
this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
|
|
4977
5001
|
a *= 1.5;
|
|
4978
|
-
const { scrollX:
|
|
4979
|
-
(
|
|
5002
|
+
const { scrollX: h } = this.ctx, l = h + a;
|
|
5003
|
+
(l < 0 || l > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(l);
|
|
4980
5004
|
}, 100);
|
|
4981
5005
|
}
|
|
4982
5006
|
if (o && this.adjustPositionY !== o) {
|
|
@@ -4984,8 +5008,8 @@ class Te {
|
|
|
4984
5008
|
let a = 10 * (o === "top" ? -1 : 1);
|
|
4985
5009
|
this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
|
|
4986
5010
|
a *= 1.5;
|
|
4987
|
-
const { scrollY:
|
|
4988
|
-
(
|
|
5011
|
+
const { scrollY: h } = this.ctx, l = h + a;
|
|
5012
|
+
(l < 0 || l > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(l);
|
|
4989
5013
|
}, 100);
|
|
4990
5014
|
}
|
|
4991
5015
|
}
|
|
@@ -5001,8 +5025,8 @@ class Te {
|
|
|
5001
5025
|
fixedLeftWidth: o,
|
|
5002
5026
|
header: r,
|
|
5003
5027
|
footer: a,
|
|
5004
|
-
body:
|
|
5005
|
-
scrollX:
|
|
5028
|
+
body: h,
|
|
5029
|
+
scrollX: l,
|
|
5006
5030
|
scrollY: d,
|
|
5007
5031
|
config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED: u, FOOTER_POSITION: x, ENABLE_MERGE_CELL_LINK: w }
|
|
5008
5032
|
} = this.ctx;
|
|
@@ -5010,13 +5034,13 @@ class Te {
|
|
|
5010
5034
|
return;
|
|
5011
5035
|
w && this.ctx.onlyMergeCell && i.updateSpanInfo();
|
|
5012
5036
|
const { drawX: m, drawY: g, width: p, height: y, fixed: E } = i, R = o - m + 1, C = i.drawX + p - (e - s) + 1;
|
|
5013
|
-
let I = r.height - g,
|
|
5014
|
-
|
|
5037
|
+
let I = r.height - g, S = y;
|
|
5038
|
+
S > h.visibleHeight && (S = h.visibleHeight);
|
|
5015
5039
|
let _ = 0;
|
|
5016
5040
|
u && (x === "top" ? I = r.height + a.height - g : _ = a.visibleHeight);
|
|
5017
|
-
const
|
|
5018
|
-
let b =
|
|
5019
|
-
C > 0 && !E ? b = Math.floor(
|
|
5041
|
+
const v = g + S - (t - _ - f);
|
|
5042
|
+
let b = l, O = d;
|
|
5043
|
+
C > 0 && !E ? b = Math.floor(l + C) : R > 0 && !E && (b = Math.floor(l - R)), I > 0 ? O = Math.floor(d - I) : v > 0 && (O = Math.floor(d + v)), (Math.abs(l - b) > 2 || Math.abs(d - O) > 2) && (this.ctx.adjustPositioning = !0, this.ctx.setScroll(b, O), this.ctx.emit("adjustBoundaryPosition", i));
|
|
5020
5044
|
}
|
|
5021
5045
|
destroy() {
|
|
5022
5046
|
this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
|
|
@@ -5032,7 +5056,7 @@ class Oe {
|
|
|
5032
5056
|
this.ctx.on("mousemove", (t) => {
|
|
5033
5057
|
if (this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default"), this.ctx.editing || !this.ctx.focusCell || !this.maxColRowCell)
|
|
5034
5058
|
return;
|
|
5035
|
-
const { offsetX: e, offsetY: i } = this.ctx.getOffset(t), { colIndex: s, rowIndex: o, drawX: r, drawY: a, width:
|
|
5059
|
+
const { offsetX: e, offsetY: i } = this.ctx.getOffset(t), { colIndex: s, rowIndex: o, drawX: r, drawY: a, width: h, height: l } = this.maxColRowCell, d = 6, f = s === this.ctx.maxColIndex || o === this.ctx.maxRowIndex ? 0 : 2, u = r + h - d + f, x = a + l - d + f;
|
|
5036
5060
|
e > u && i > x && e < u + d && i < x + d && (this.ctx.stageElement.style.cursor = "crosshair");
|
|
5037
5061
|
}), this.ctx.on("cellMouseenter", (t) => {
|
|
5038
5062
|
const { xArr: e, yArr: i } = this.ctx.selector, s = e[1], o = i[1], { colIndex: r, rowIndex: a } = t;
|
|
@@ -5065,22 +5089,22 @@ class Oe {
|
|
|
5065
5089
|
return;
|
|
5066
5090
|
let r = t, a = e;
|
|
5067
5091
|
if (!o) {
|
|
5068
|
-
const [
|
|
5069
|
-
a = [
|
|
5092
|
+
const [h] = a;
|
|
5093
|
+
a = [h, h];
|
|
5070
5094
|
}
|
|
5071
5095
|
if (!s) {
|
|
5072
|
-
const [
|
|
5073
|
-
r = [
|
|
5096
|
+
const [h] = r;
|
|
5097
|
+
r = [h, h];
|
|
5074
5098
|
}
|
|
5075
5099
|
if (JSON.stringify(this.ctx.autofill.xArr) !== JSON.stringify(r) || JSON.stringify(this.ctx.autofill.yArr) !== JSON.stringify(a)) {
|
|
5076
5100
|
const {
|
|
5077
|
-
SELECTOR_AREA_MIN_X:
|
|
5078
|
-
SELECTOR_AREA_MAX_X:
|
|
5101
|
+
SELECTOR_AREA_MIN_X: h,
|
|
5102
|
+
SELECTOR_AREA_MAX_X: l,
|
|
5079
5103
|
SELECTOR_AREA_MIN_Y: d,
|
|
5080
5104
|
SELECTOR_AREA_MAX_Y: f,
|
|
5081
5105
|
SELECTOR_AREA_MAX_X_OFFSET: u,
|
|
5082
5106
|
SELECTOR_AREA_MAX_Y_OFFSET: x
|
|
5083
|
-
} = this.ctx.config, w =
|
|
5107
|
+
} = this.ctx.config, w = h, m = l || this.ctx.maxColIndex - u, g = d, p = f || this.ctx.maxRowIndex - x;
|
|
5084
5108
|
let [y, E] = r, [R, C] = a;
|
|
5085
5109
|
if (y < w || R < g)
|
|
5086
5110
|
return;
|
|
@@ -5109,8 +5133,8 @@ class Oe {
|
|
|
5109
5133
|
const m = x + e.yArr[0], g = w + e.xArr[0];
|
|
5110
5134
|
i.set(`${m}-${g}`, !0);
|
|
5111
5135
|
}
|
|
5112
|
-
const { value: s } = e, o = s[0].length, r = s.length, a = this.ctx.autofill.xArr,
|
|
5113
|
-
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a,
|
|
5136
|
+
const { value: s } = e, o = s[0].length, r = s.length, a = this.ctx.autofill.xArr, h = this.ctx.autofill.yArr, l = o === 1 && r === 1;
|
|
5137
|
+
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a, h) && !l) {
|
|
5114
5138
|
const x = {
|
|
5115
5139
|
code: "ERR_MERGED_CELLS_AUTOFILL",
|
|
5116
5140
|
message: "Merged cells cannot span autofill data"
|
|
@@ -5119,9 +5143,9 @@ class Oe {
|
|
|
5119
5143
|
return;
|
|
5120
5144
|
}
|
|
5121
5145
|
let d = [];
|
|
5122
|
-
for (let x = 0; x <=
|
|
5146
|
+
for (let x = 0; x <= h[1] - h[0]; x++)
|
|
5123
5147
|
for (let w = 0; w <= a[1] - a[0]; w++) {
|
|
5124
|
-
const m = w + a[0], g = x +
|
|
5148
|
+
const m = w + a[0], g = x + h[0], p = s[x % r][w % o], y = this.ctx.database.getItemValueForRowIndexAndColIndex(g, m), E = `${g}-${m}`;
|
|
5125
5149
|
if (y && !i.has(E)) {
|
|
5126
5150
|
const { rowKey: R, key: C } = y;
|
|
5127
5151
|
this.ctx.database.getReadonly(R, C) || (t.add(R), d.push({
|
|
@@ -5144,7 +5168,7 @@ class Oe {
|
|
|
5144
5168
|
oldValue: this.ctx.database.getItemValue(m.rowKey, m.key),
|
|
5145
5169
|
row: this.ctx.database.getRowDataItemForRowKey(m.rowKey)
|
|
5146
5170
|
}));
|
|
5147
|
-
if (d = await x(w, a,
|
|
5171
|
+
if (d = await x(w, a, h), d && !d.length)
|
|
5148
5172
|
return;
|
|
5149
5173
|
}
|
|
5150
5174
|
this.ctx.batchSetItemValueByEditor(d, !0);
|
|
@@ -5192,19 +5216,19 @@ function Q(c) {
|
|
|
5192
5216
|
function Kt(c) {
|
|
5193
5217
|
return c === "x" ? "y" : "x";
|
|
5194
5218
|
}
|
|
5195
|
-
function
|
|
5219
|
+
function wt(c) {
|
|
5196
5220
|
return c === "y" ? "height" : "width";
|
|
5197
5221
|
}
|
|
5198
5222
|
const Ae = /* @__PURE__ */ new Set(["top", "bottom"]);
|
|
5199
5223
|
function V(c) {
|
|
5200
5224
|
return Ae.has(z(c)) ? "y" : "x";
|
|
5201
5225
|
}
|
|
5202
|
-
function
|
|
5226
|
+
function mt(c) {
|
|
5203
5227
|
return Kt(V(c));
|
|
5204
5228
|
}
|
|
5205
5229
|
function He(c, t, e) {
|
|
5206
5230
|
e === void 0 && (e = !1);
|
|
5207
|
-
const i = Q(c), s =
|
|
5231
|
+
const i = Q(c), s = mt(c), o = wt(s);
|
|
5208
5232
|
let r = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
|
|
5209
5233
|
return t.reference[o] > t.floating[o] && (r = st(r)), [r, st(r)];
|
|
5210
5234
|
}
|
|
@@ -5215,12 +5239,12 @@ function De(c) {
|
|
|
5215
5239
|
function dt(c) {
|
|
5216
5240
|
return c.replace(/start|end/g, (t) => Me[t]);
|
|
5217
5241
|
}
|
|
5218
|
-
const
|
|
5242
|
+
const _t = ["left", "right"], Tt = ["right", "left"], Ne = ["top", "bottom"], ke = ["bottom", "top"];
|
|
5219
5243
|
function Xe(c, t, e) {
|
|
5220
5244
|
switch (c) {
|
|
5221
5245
|
case "top":
|
|
5222
5246
|
case "bottom":
|
|
5223
|
-
return e ? t ?
|
|
5247
|
+
return e ? t ? Tt : _t : t ? _t : Tt;
|
|
5224
5248
|
case "left":
|
|
5225
5249
|
case "right":
|
|
5226
5250
|
return t ? Ne : ke;
|
|
@@ -5245,7 +5269,7 @@ function Be(c) {
|
|
|
5245
5269
|
...c
|
|
5246
5270
|
};
|
|
5247
5271
|
}
|
|
5248
|
-
function
|
|
5272
|
+
function Wt(c) {
|
|
5249
5273
|
return typeof c != "number" ? Be(c) : {
|
|
5250
5274
|
top: c,
|
|
5251
5275
|
right: c,
|
|
@@ -5271,14 +5295,14 @@ function ot(c) {
|
|
|
5271
5295
|
y: e
|
|
5272
5296
|
};
|
|
5273
5297
|
}
|
|
5274
|
-
function
|
|
5298
|
+
function Ot(c, t, e) {
|
|
5275
5299
|
let {
|
|
5276
5300
|
reference: i,
|
|
5277
5301
|
floating: s
|
|
5278
5302
|
} = c;
|
|
5279
|
-
const o = V(t), r =
|
|
5303
|
+
const o = V(t), r = mt(t), a = wt(r), h = z(t), l = 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;
|
|
5280
5304
|
let x;
|
|
5281
|
-
switch (
|
|
5305
|
+
switch (h) {
|
|
5282
5306
|
case "top":
|
|
5283
5307
|
x = {
|
|
5284
5308
|
x: d,
|
|
@@ -5311,10 +5335,10 @@ function Tt(c, t, e) {
|
|
|
5311
5335
|
}
|
|
5312
5336
|
switch (Q(t)) {
|
|
5313
5337
|
case "start":
|
|
5314
|
-
x[r] -= u * (e &&
|
|
5338
|
+
x[r] -= u * (e && l ? -1 : 1);
|
|
5315
5339
|
break;
|
|
5316
5340
|
case "end":
|
|
5317
|
-
x[r] += u * (e &&
|
|
5341
|
+
x[r] += u * (e && l ? -1 : 1);
|
|
5318
5342
|
break;
|
|
5319
5343
|
}
|
|
5320
5344
|
return x;
|
|
@@ -5325,15 +5349,15 @@ const Ke = async (c, t, e) => {
|
|
|
5325
5349
|
strategy: s = "absolute",
|
|
5326
5350
|
middleware: o = [],
|
|
5327
5351
|
platform: r
|
|
5328
|
-
} = e, a = o.filter(Boolean),
|
|
5329
|
-
let
|
|
5352
|
+
} = e, a = o.filter(Boolean), h = await (r.isRTL == null ? void 0 : r.isRTL(t));
|
|
5353
|
+
let l = await r.getElementRects({
|
|
5330
5354
|
reference: c,
|
|
5331
5355
|
floating: t,
|
|
5332
5356
|
strategy: s
|
|
5333
5357
|
}), {
|
|
5334
5358
|
x: d,
|
|
5335
5359
|
y: f
|
|
5336
|
-
} =
|
|
5360
|
+
} = Ot(l, i, h), u = i, x = {}, w = 0;
|
|
5337
5361
|
for (let m = 0; m < a.length; m++) {
|
|
5338
5362
|
const {
|
|
5339
5363
|
name: g,
|
|
@@ -5350,7 +5374,7 @@ const Ke = async (c, t, e) => {
|
|
|
5350
5374
|
placement: u,
|
|
5351
5375
|
strategy: s,
|
|
5352
5376
|
middlewareData: x,
|
|
5353
|
-
rects:
|
|
5377
|
+
rects: l,
|
|
5354
5378
|
platform: r,
|
|
5355
5379
|
elements: {
|
|
5356
5380
|
reference: c,
|
|
@@ -5363,14 +5387,14 @@ const Ke = async (c, t, e) => {
|
|
|
5363
5387
|
...x[g],
|
|
5364
5388
|
...R
|
|
5365
5389
|
}
|
|
5366
|
-
}, C && w <= 50 && (w++, typeof C == "object" && (C.placement && (u = C.placement), C.rects && (
|
|
5390
|
+
}, C && w <= 50 && (w++, typeof C == "object" && (C.placement && (u = C.placement), C.rects && (l = C.rects === !0 ? await r.getElementRects({
|
|
5367
5391
|
reference: c,
|
|
5368
5392
|
floating: t,
|
|
5369
5393
|
strategy: s
|
|
5370
5394
|
}) : C.rects), {
|
|
5371
5395
|
x: d,
|
|
5372
5396
|
y: f
|
|
5373
|
-
} =
|
|
5397
|
+
} = Ot(l, u, h)), m = -1);
|
|
5374
5398
|
}
|
|
5375
5399
|
return {
|
|
5376
5400
|
x: d,
|
|
@@ -5380,7 +5404,7 @@ const Ke = async (c, t, e) => {
|
|
|
5380
5404
|
middlewareData: x
|
|
5381
5405
|
};
|
|
5382
5406
|
};
|
|
5383
|
-
async function
|
|
5407
|
+
async function Ft(c, t) {
|
|
5384
5408
|
var e;
|
|
5385
5409
|
t === void 0 && (t = {});
|
|
5386
5410
|
const {
|
|
@@ -5389,18 +5413,18 @@ async function Wt(c, t) {
|
|
|
5389
5413
|
platform: o,
|
|
5390
5414
|
rects: r,
|
|
5391
5415
|
elements: a,
|
|
5392
|
-
strategy:
|
|
5416
|
+
strategy: h
|
|
5393
5417
|
} = c, {
|
|
5394
|
-
boundary:
|
|
5418
|
+
boundary: l = "clippingAncestors",
|
|
5395
5419
|
rootBoundary: d = "viewport",
|
|
5396
5420
|
elementContext: f = "floating",
|
|
5397
5421
|
altBoundary: u = !1,
|
|
5398
5422
|
padding: x = 0
|
|
5399
|
-
} = J(t, c), w =
|
|
5423
|
+
} = J(t, c), w = Wt(x), g = a[u ? f === "floating" ? "reference" : "floating" : f], p = ot(await o.getClippingRect({
|
|
5400
5424
|
element: (e = await (o.isElement == null ? void 0 : o.isElement(g))) == null || e ? g : g.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(a.floating)),
|
|
5401
|
-
boundary:
|
|
5425
|
+
boundary: l,
|
|
5402
5426
|
rootBoundary: d,
|
|
5403
|
-
strategy:
|
|
5427
|
+
strategy: h
|
|
5404
5428
|
})), y = f === "floating" ? {
|
|
5405
5429
|
x: i,
|
|
5406
5430
|
y: s,
|
|
@@ -5416,7 +5440,7 @@ async function Wt(c, t) {
|
|
|
5416
5440
|
elements: a,
|
|
5417
5441
|
rect: y,
|
|
5418
5442
|
offsetParent: E,
|
|
5419
|
-
strategy:
|
|
5443
|
+
strategy: h
|
|
5420
5444
|
}) : y);
|
|
5421
5445
|
return {
|
|
5422
5446
|
top: (p.top - C.top + w.top) / R.y,
|
|
@@ -5425,7 +5449,7 @@ async function Wt(c, t) {
|
|
|
5425
5449
|
right: (C.right - p.right + w.right) / R.x
|
|
5426
5450
|
};
|
|
5427
5451
|
}
|
|
5428
|
-
const
|
|
5452
|
+
const We = (c) => ({
|
|
5429
5453
|
name: "arrow",
|
|
5430
5454
|
options: c,
|
|
5431
5455
|
async fn(t) {
|
|
@@ -5436,20 +5460,20 @@ const Fe = (c) => ({
|
|
|
5436
5460
|
rects: o,
|
|
5437
5461
|
platform: r,
|
|
5438
5462
|
elements: a,
|
|
5439
|
-
middlewareData:
|
|
5463
|
+
middlewareData: h
|
|
5440
5464
|
} = t, {
|
|
5441
|
-
element:
|
|
5465
|
+
element: l,
|
|
5442
5466
|
padding: d = 0
|
|
5443
5467
|
} = J(c, t) || {};
|
|
5444
|
-
if (
|
|
5468
|
+
if (l == null)
|
|
5445
5469
|
return {};
|
|
5446
|
-
const f =
|
|
5470
|
+
const f = Wt(d), u = {
|
|
5447
5471
|
x: e,
|
|
5448
5472
|
y: i
|
|
5449
|
-
}, x =
|
|
5450
|
-
let
|
|
5451
|
-
(!
|
|
5452
|
-
const _ = R / 2 - C / 2,
|
|
5473
|
+
}, x = mt(s), w = wt(x), m = await r.getDimensions(l), g = x === "y", p = g ? "top" : "left", y = g ? "bottom" : "right", E = g ? "clientHeight" : "clientWidth", R = o.reference[w] + o.reference[x] - u[x] - o.floating[w], C = u[x] - o.reference[x], I = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(l));
|
|
5474
|
+
let S = I ? I[E] : 0;
|
|
5475
|
+
(!S || !await (r.isElement == null ? void 0 : r.isElement(I))) && (S = a.floating[E] || o.floating[w]);
|
|
5476
|
+
const _ = R / 2 - C / 2, v = S / 2 - m[w] / 2 - 1, b = j(f[p], v), O = j(f[y], v), T = b, M = S - m[w] - O, L = S / 2 - m[w] / 2 + _, A = ct(T, L, M), D = !h.arrow && Q(s) != null && L !== A && o.reference[w] / 2 - (L < T ? b : O) - m[w] / 2 < 0, N = D ? L < T ? L - T : L - M : 0;
|
|
5453
5477
|
return {
|
|
5454
5478
|
[x]: u[x] + N,
|
|
5455
5479
|
data: {
|
|
@@ -5462,7 +5486,7 @@ const Fe = (c) => ({
|
|
|
5462
5486
|
reset: D
|
|
5463
5487
|
};
|
|
5464
5488
|
}
|
|
5465
|
-
}),
|
|
5489
|
+
}), Fe = function(c) {
|
|
5466
5490
|
return c === void 0 && (c = {}), {
|
|
5467
5491
|
name: "flip",
|
|
5468
5492
|
options: c,
|
|
@@ -5473,8 +5497,8 @@ const Fe = (c) => ({
|
|
|
5473
5497
|
middlewareData: o,
|
|
5474
5498
|
rects: r,
|
|
5475
5499
|
initialPlacement: a,
|
|
5476
|
-
platform:
|
|
5477
|
-
elements:
|
|
5500
|
+
platform: h,
|
|
5501
|
+
elements: l
|
|
5478
5502
|
} = t, {
|
|
5479
5503
|
mainAxis: d = !0,
|
|
5480
5504
|
crossAxis: f = !0,
|
|
@@ -5486,20 +5510,20 @@ const Fe = (c) => ({
|
|
|
5486
5510
|
} = J(c, t);
|
|
5487
5511
|
if ((e = o.arrow) != null && e.alignmentOffset)
|
|
5488
5512
|
return {};
|
|
5489
|
-
const p = z(s), y = V(a), E = z(a) === a, R = await (
|
|
5513
|
+
const p = z(s), y = V(a), E = z(a) === a, R = await (h.isRTL == null ? void 0 : h.isRTL(l.floating)), C = u || (E || !m ? [st(a)] : De(a)), I = w !== "none";
|
|
5490
5514
|
!u && I && C.push(...Ye(a, m, w, R));
|
|
5491
|
-
const
|
|
5515
|
+
const S = [a, ...C], _ = await Ft(t, g), v = [];
|
|
5492
5516
|
let b = ((i = o.flip) == null ? void 0 : i.overflows) || [];
|
|
5493
|
-
if (d &&
|
|
5517
|
+
if (d && v.push(_[p]), f) {
|
|
5494
5518
|
const L = He(s, r, R);
|
|
5495
|
-
|
|
5519
|
+
v.push(_[L[0]], _[L[1]]);
|
|
5496
5520
|
}
|
|
5497
5521
|
if (b = [...b, {
|
|
5498
5522
|
placement: s,
|
|
5499
|
-
overflows:
|
|
5500
|
-
}], !
|
|
5523
|
+
overflows: v
|
|
5524
|
+
}], !v.every((L) => L <= 0)) {
|
|
5501
5525
|
var O, T;
|
|
5502
|
-
const L = (((O = o.flip) == null ? void 0 : O.index) || 0) + 1, A =
|
|
5526
|
+
const L = (((O = o.flip) == null ? void 0 : O.index) || 0) + 1, A = S[L];
|
|
5503
5527
|
if (A && (!(f === "alignment" ? y !== V(A) : !1) || // We leave the current main axis only if every placement on that axis
|
|
5504
5528
|
// overflows the main axis.
|
|
5505
5529
|
b.every((k) => V(k.placement) === y ? k.overflows[0] > 0 : !0)))
|
|
@@ -5519,13 +5543,13 @@ const Fe = (c) => ({
|
|
|
5519
5543
|
var M;
|
|
5520
5544
|
const N = (M = b.filter((k) => {
|
|
5521
5545
|
if (I) {
|
|
5522
|
-
const
|
|
5523
|
-
return
|
|
5546
|
+
const F = V(k.placement);
|
|
5547
|
+
return F === y || // Create a bias to the `y` side axis due to horizontal
|
|
5524
5548
|
// reading directions favoring greater width.
|
|
5525
|
-
|
|
5549
|
+
F === "y";
|
|
5526
5550
|
}
|
|
5527
5551
|
return !0;
|
|
5528
|
-
}).map((k) => [k.placement, k.overflows.filter((
|
|
5552
|
+
}).map((k) => [k.placement, k.overflows.filter((F) => F > 0).reduce((F, ie) => F + ie, 0)]).sort((k, F) => k[1] - F[1])[0]) == null ? void 0 : M[0];
|
|
5529
5553
|
N && (D = N);
|
|
5530
5554
|
break;
|
|
5531
5555
|
}
|
|
@@ -5549,7 +5573,7 @@ async function Pe(c, t) {
|
|
|
5549
5573
|
placement: e,
|
|
5550
5574
|
platform: i,
|
|
5551
5575
|
elements: s
|
|
5552
|
-
} = c, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r = z(e), a = Q(e),
|
|
5576
|
+
} = c, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r = z(e), a = Q(e), h = V(e) === "y", l = Ve.has(r) ? -1 : 1, d = o && h ? -1 : 1, f = J(t, c);
|
|
5553
5577
|
let {
|
|
5554
5578
|
mainAxis: u,
|
|
5555
5579
|
crossAxis: x,
|
|
@@ -5563,11 +5587,11 @@ async function Pe(c, t) {
|
|
|
5563
5587
|
crossAxis: f.crossAxis || 0,
|
|
5564
5588
|
alignmentAxis: f.alignmentAxis
|
|
5565
5589
|
};
|
|
5566
|
-
return a && typeof w == "number" && (x = a === "end" ? w * -1 : w),
|
|
5590
|
+
return a && typeof w == "number" && (x = a === "end" ? w * -1 : w), h ? {
|
|
5567
5591
|
x: x * d,
|
|
5568
|
-
y: u *
|
|
5592
|
+
y: u * l
|
|
5569
5593
|
} : {
|
|
5570
|
-
x: u *
|
|
5594
|
+
x: u * l,
|
|
5571
5595
|
y: x * d
|
|
5572
5596
|
};
|
|
5573
5597
|
}
|
|
@@ -5582,12 +5606,12 @@ const ze = function(c) {
|
|
|
5582
5606
|
y: o,
|
|
5583
5607
|
placement: r,
|
|
5584
5608
|
middlewareData: a
|
|
5585
|
-
} = t,
|
|
5609
|
+
} = t, h = await Pe(t, c);
|
|
5586
5610
|
return r === ((e = a.offset) == null ? void 0 : e.placement) && (i = a.arrow) != null && i.alignmentOffset ? {} : {
|
|
5587
|
-
x: s +
|
|
5588
|
-
y: o +
|
|
5611
|
+
x: s + h.x,
|
|
5612
|
+
y: o + h.y,
|
|
5589
5613
|
data: {
|
|
5590
|
-
...
|
|
5614
|
+
...h,
|
|
5591
5615
|
placement: r
|
|
5592
5616
|
}
|
|
5593
5617
|
};
|
|
@@ -5617,12 +5641,12 @@ const ze = function(c) {
|
|
|
5617
5641
|
};
|
|
5618
5642
|
}
|
|
5619
5643
|
},
|
|
5620
|
-
...
|
|
5621
|
-
} = J(c, t),
|
|
5644
|
+
...h
|
|
5645
|
+
} = J(c, t), l = {
|
|
5622
5646
|
x: e,
|
|
5623
5647
|
y: i
|
|
5624
|
-
}, d = await
|
|
5625
|
-
let x =
|
|
5648
|
+
}, d = await Ft(t, h), f = V(z(s)), u = Kt(f);
|
|
5649
|
+
let x = l[u], w = l[f];
|
|
5626
5650
|
if (o) {
|
|
5627
5651
|
const g = u === "y" ? "top" : "left", p = u === "y" ? "bottom" : "right", y = x + d[g], E = x - d[p];
|
|
5628
5652
|
x = ct(y, x, E);
|
|
@@ -5660,7 +5684,7 @@ function H(c) {
|
|
|
5660
5684
|
var t;
|
|
5661
5685
|
return (c == null || (t = c.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
5662
5686
|
}
|
|
5663
|
-
function
|
|
5687
|
+
function W(c) {
|
|
5664
5688
|
var t;
|
|
5665
5689
|
return (t = (Vt(c) ? c.ownerDocument : c.document) || window.document) == null ? void 0 : t.documentElement;
|
|
5666
5690
|
}
|
|
@@ -5673,7 +5697,7 @@ function X(c) {
|
|
|
5673
5697
|
function K(c) {
|
|
5674
5698
|
return rt() ? c instanceof HTMLElement || c instanceof H(c).HTMLElement : !1;
|
|
5675
5699
|
}
|
|
5676
|
-
function
|
|
5700
|
+
function Lt(c) {
|
|
5677
5701
|
return !rt() || typeof ShadowRoot > "u" ? !1 : c instanceof ShadowRoot || c instanceof H(c).ShadowRoot;
|
|
5678
5702
|
}
|
|
5679
5703
|
const Ge = /* @__PURE__ */ new Set(["inline", "contents"]);
|
|
@@ -5701,14 +5725,14 @@ function nt(c) {
|
|
|
5701
5725
|
});
|
|
5702
5726
|
}
|
|
5703
5727
|
const qe = ["transform", "translate", "scale", "rotate", "perspective"], Je = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Qe = ["paint", "layout", "strict", "content"];
|
|
5704
|
-
function
|
|
5705
|
-
const t =
|
|
5728
|
+
function pt(c) {
|
|
5729
|
+
const t = Et(), e = X(c) ? Y(c) : c;
|
|
5706
5730
|
return qe.some((i) => e[i] ? e[i] !== "none" : !1) || (e.containerType ? e.containerType !== "normal" : !1) || !t && (e.backdropFilter ? e.backdropFilter !== "none" : !1) || !t && (e.filter ? e.filter !== "none" : !1) || Je.some((i) => (e.willChange || "").includes(i)) || Qe.some((i) => (e.contain || "").includes(i));
|
|
5707
5731
|
}
|
|
5708
5732
|
function ti(c) {
|
|
5709
5733
|
let t = P(c);
|
|
5710
5734
|
for (; K(t) && !U(t); ) {
|
|
5711
|
-
if (
|
|
5735
|
+
if (pt(t))
|
|
5712
5736
|
return t;
|
|
5713
5737
|
if (nt(t))
|
|
5714
5738
|
return null;
|
|
@@ -5716,7 +5740,7 @@ function ti(c) {
|
|
|
5716
5740
|
}
|
|
5717
5741
|
return null;
|
|
5718
5742
|
}
|
|
5719
|
-
function
|
|
5743
|
+
function Et() {
|
|
5720
5744
|
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
5721
5745
|
}
|
|
5722
5746
|
const ei = /* @__PURE__ */ new Set(["html", "body", "#document"]);
|
|
@@ -5742,10 +5766,10 @@ function P(c) {
|
|
|
5742
5766
|
// Step into the shadow DOM of the parent of a slotted node.
|
|
5743
5767
|
c.assignedSlot || // DOM Element detected.
|
|
5744
5768
|
c.parentNode || // ShadowRoot detected.
|
|
5745
|
-
|
|
5746
|
-
|
|
5769
|
+
Lt(c) && c.host || // Fallback.
|
|
5770
|
+
W(c)
|
|
5747
5771
|
);
|
|
5748
|
-
return
|
|
5772
|
+
return Lt(t) ? t.host : t;
|
|
5749
5773
|
}
|
|
5750
5774
|
function Pt(c) {
|
|
5751
5775
|
const t = P(c);
|
|
@@ -5791,7 +5815,7 @@ function G(c) {
|
|
|
5791
5815
|
const ii = /* @__PURE__ */ B(0);
|
|
5792
5816
|
function Ut(c) {
|
|
5793
5817
|
const t = H(c);
|
|
5794
|
-
return !
|
|
5818
|
+
return !Et() || !t.visualViewport ? ii : {
|
|
5795
5819
|
x: t.visualViewport.offsetLeft,
|
|
5796
5820
|
y: t.visualViewport.offsetTop
|
|
5797
5821
|
};
|
|
@@ -5805,31 +5829,31 @@ function q(c, t, e, i) {
|
|
|
5805
5829
|
let r = B(1);
|
|
5806
5830
|
t && (i ? X(i) && (r = G(i)) : r = G(c));
|
|
5807
5831
|
const a = si(o, e, i) ? Ut(o) : B(0);
|
|
5808
|
-
let
|
|
5832
|
+
let h = (s.left + a.x) / r.x, l = (s.top + a.y) / r.y, d = s.width / r.x, f = s.height / r.y;
|
|
5809
5833
|
if (o) {
|
|
5810
5834
|
const u = H(o), x = i && X(i) ? H(i) : i;
|
|
5811
5835
|
let w = u, m = ft(w);
|
|
5812
5836
|
for (; m && i && x !== w; ) {
|
|
5813
5837
|
const g = G(m), p = m.getBoundingClientRect(), y = Y(m), E = p.left + (m.clientLeft + parseFloat(y.paddingLeft)) * g.x, R = p.top + (m.clientTop + parseFloat(y.paddingTop)) * g.y;
|
|
5814
|
-
|
|
5838
|
+
h *= g.x, l *= g.y, d *= g.x, f *= g.y, h += E, l += R, w = H(m), m = ft(w);
|
|
5815
5839
|
}
|
|
5816
5840
|
}
|
|
5817
5841
|
return ot({
|
|
5818
5842
|
width: d,
|
|
5819
5843
|
height: f,
|
|
5820
|
-
x:
|
|
5821
|
-
y:
|
|
5844
|
+
x: h,
|
|
5845
|
+
y: l
|
|
5822
5846
|
});
|
|
5823
5847
|
}
|
|
5824
|
-
function
|
|
5848
|
+
function yt(c, t) {
|
|
5825
5849
|
const e = at(c).scrollLeft;
|
|
5826
|
-
return t ? t.left + e : q(
|
|
5850
|
+
return t ? t.left + e : q(W(c)).left + e;
|
|
5827
5851
|
}
|
|
5828
5852
|
function Zt(c, t, e) {
|
|
5829
5853
|
e === void 0 && (e = !1);
|
|
5830
5854
|
const i = c.getBoundingClientRect(), s = i.left + t.scrollLeft - (e ? 0 : (
|
|
5831
5855
|
// RTL <body> scrollbar.
|
|
5832
|
-
|
|
5856
|
+
yt(c, i)
|
|
5833
5857
|
)), o = i.top + t.scrollTop;
|
|
5834
5858
|
return {
|
|
5835
5859
|
x: s,
|
|
@@ -5843,32 +5867,32 @@ function oi(c) {
|
|
|
5843
5867
|
offsetParent: i,
|
|
5844
5868
|
strategy: s
|
|
5845
5869
|
} = c;
|
|
5846
|
-
const o = s === "fixed", r =
|
|
5870
|
+
const o = s === "fixed", r = W(i), a = t ? nt(t.floating) : !1;
|
|
5847
5871
|
if (i === r || a && o)
|
|
5848
5872
|
return e;
|
|
5849
|
-
let
|
|
5873
|
+
let h = {
|
|
5850
5874
|
scrollLeft: 0,
|
|
5851
5875
|
scrollTop: 0
|
|
5852
|
-
},
|
|
5876
|
+
}, l = B(1);
|
|
5853
5877
|
const d = B(0), f = K(i);
|
|
5854
|
-
if ((f || !f && !o) && ((Z(i) !== "body" || tt(r)) && (
|
|
5878
|
+
if ((f || !f && !o) && ((Z(i) !== "body" || tt(r)) && (h = at(i)), K(i))) {
|
|
5855
5879
|
const x = q(i);
|
|
5856
|
-
|
|
5880
|
+
l = G(i), d.x = x.x + i.clientLeft, d.y = x.y + i.clientTop;
|
|
5857
5881
|
}
|
|
5858
|
-
const u = r && !f && !o ? Zt(r,
|
|
5882
|
+
const u = r && !f && !o ? Zt(r, h, !0) : B(0);
|
|
5859
5883
|
return {
|
|
5860
|
-
width: e.width *
|
|
5861
|
-
height: e.height *
|
|
5862
|
-
x: e.x *
|
|
5863
|
-
y: e.y *
|
|
5884
|
+
width: e.width * l.x,
|
|
5885
|
+
height: e.height * l.y,
|
|
5886
|
+
x: e.x * l.x - h.scrollLeft * l.x + d.x + u.x,
|
|
5887
|
+
y: e.y * l.y - h.scrollTop * l.y + d.y + u.y
|
|
5864
5888
|
};
|
|
5865
5889
|
}
|
|
5866
5890
|
function ri(c) {
|
|
5867
5891
|
return Array.from(c.getClientRects());
|
|
5868
5892
|
}
|
|
5869
5893
|
function ni(c) {
|
|
5870
|
-
const t =
|
|
5871
|
-
let r = -e.scrollLeft +
|
|
5894
|
+
const t = W(c), e = at(c), i = c.ownerDocument.body, s = $(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), o = $(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
|
|
5895
|
+
let r = -e.scrollLeft + yt(c);
|
|
5872
5896
|
const a = -e.scrollTop;
|
|
5873
5897
|
return Y(i).direction === "rtl" && (r += $(t.clientWidth, i.clientWidth) - s), {
|
|
5874
5898
|
width: s,
|
|
@@ -5878,38 +5902,38 @@ function ni(c) {
|
|
|
5878
5902
|
};
|
|
5879
5903
|
}
|
|
5880
5904
|
function ai(c, t) {
|
|
5881
|
-
const e = H(c), i =
|
|
5882
|
-
let o = i.clientWidth, r = i.clientHeight, a = 0,
|
|
5905
|
+
const e = H(c), i = W(c), s = e.visualViewport;
|
|
5906
|
+
let o = i.clientWidth, r = i.clientHeight, a = 0, h = 0;
|
|
5883
5907
|
if (s) {
|
|
5884
5908
|
o = s.width, r = s.height;
|
|
5885
|
-
const
|
|
5886
|
-
(!
|
|
5909
|
+
const l = Et();
|
|
5910
|
+
(!l || l && t === "fixed") && (a = s.offsetLeft, h = s.offsetTop);
|
|
5887
5911
|
}
|
|
5888
5912
|
return {
|
|
5889
5913
|
width: o,
|
|
5890
5914
|
height: r,
|
|
5891
5915
|
x: a,
|
|
5892
|
-
y:
|
|
5916
|
+
y: h
|
|
5893
5917
|
};
|
|
5894
5918
|
}
|
|
5895
|
-
const
|
|
5896
|
-
function
|
|
5897
|
-
const e = q(c, !0, t === "fixed"), i = e.top + c.clientTop, s = e.left + c.clientLeft, o = K(c) ? G(c) : B(1), r = c.clientWidth * o.x, a = c.clientHeight * o.y,
|
|
5919
|
+
const hi = /* @__PURE__ */ new Set(["absolute", "fixed"]);
|
|
5920
|
+
function li(c, t) {
|
|
5921
|
+
const e = q(c, !0, t === "fixed"), i = e.top + c.clientTop, s = e.left + c.clientLeft, o = K(c) ? G(c) : B(1), r = c.clientWidth * o.x, a = c.clientHeight * o.y, h = s * o.x, l = i * o.y;
|
|
5898
5922
|
return {
|
|
5899
5923
|
width: r,
|
|
5900
5924
|
height: a,
|
|
5901
|
-
x:
|
|
5902
|
-
y:
|
|
5925
|
+
x: h,
|
|
5926
|
+
y: l
|
|
5903
5927
|
};
|
|
5904
5928
|
}
|
|
5905
|
-
function
|
|
5929
|
+
function Mt(c, t, e) {
|
|
5906
5930
|
let i;
|
|
5907
5931
|
if (t === "viewport")
|
|
5908
5932
|
i = ai(c, e);
|
|
5909
5933
|
else if (t === "document")
|
|
5910
|
-
i = ni(
|
|
5934
|
+
i = ni(W(c));
|
|
5911
5935
|
else if (X(t))
|
|
5912
|
-
i =
|
|
5936
|
+
i = li(t, e);
|
|
5913
5937
|
else {
|
|
5914
5938
|
const s = Ut(c);
|
|
5915
5939
|
i = {
|
|
@@ -5933,8 +5957,8 @@ function ci(c, t) {
|
|
|
5933
5957
|
const o = Y(c).position === "fixed";
|
|
5934
5958
|
let r = o ? P(c) : c;
|
|
5935
5959
|
for (; X(r) && !U(r); ) {
|
|
5936
|
-
const a = Y(r),
|
|
5937
|
-
!
|
|
5960
|
+
const a = Y(r), h = pt(r);
|
|
5961
|
+
!h && a.position === "fixed" && (s = null), (o ? !h && !s : !h && a.position === "static" && !!s && hi.has(s.position) || tt(r) && !h && jt(c, r)) ? i = i.filter((d) => d !== r) : s = a, r = P(r);
|
|
5938
5962
|
}
|
|
5939
5963
|
return t.set(c, i), i;
|
|
5940
5964
|
}
|
|
@@ -5945,15 +5969,15 @@ function di(c) {
|
|
|
5945
5969
|
rootBoundary: i,
|
|
5946
5970
|
strategy: s
|
|
5947
5971
|
} = c;
|
|
5948
|
-
const r = [...e === "clippingAncestors" ? nt(t) ? [] : ci(t, this._c) : [].concat(e), i], a = r[0],
|
|
5949
|
-
const f =
|
|
5950
|
-
return
|
|
5951
|
-
},
|
|
5972
|
+
const r = [...e === "clippingAncestors" ? nt(t) ? [] : ci(t, this._c) : [].concat(e), i], a = r[0], h = r.reduce((l, d) => {
|
|
5973
|
+
const f = Mt(t, d, s);
|
|
5974
|
+
return l.top = $(f.top, l.top), l.right = j(f.right, l.right), l.bottom = j(f.bottom, l.bottom), l.left = $(f.left, l.left), l;
|
|
5975
|
+
}, Mt(t, a, s));
|
|
5952
5976
|
return {
|
|
5953
|
-
width:
|
|
5954
|
-
height:
|
|
5955
|
-
x:
|
|
5956
|
-
y:
|
|
5977
|
+
width: h.right - h.left,
|
|
5978
|
+
height: h.bottom - h.top,
|
|
5979
|
+
x: h.left,
|
|
5980
|
+
y: h.top
|
|
5957
5981
|
};
|
|
5958
5982
|
}
|
|
5959
5983
|
function fi(c) {
|
|
@@ -5967,22 +5991,22 @@ function fi(c) {
|
|
|
5967
5991
|
};
|
|
5968
5992
|
}
|
|
5969
5993
|
function xi(c, t, e) {
|
|
5970
|
-
const i = K(t), s =
|
|
5994
|
+
const i = K(t), s = W(t), o = e === "fixed", r = q(c, !0, o, t);
|
|
5971
5995
|
let a = {
|
|
5972
5996
|
scrollLeft: 0,
|
|
5973
5997
|
scrollTop: 0
|
|
5974
5998
|
};
|
|
5975
|
-
const
|
|
5976
|
-
function
|
|
5977
|
-
|
|
5999
|
+
const h = B(0);
|
|
6000
|
+
function l() {
|
|
6001
|
+
h.x = yt(s);
|
|
5978
6002
|
}
|
|
5979
6003
|
if (i || !i && !o)
|
|
5980
6004
|
if ((Z(t) !== "body" || tt(s)) && (a = at(t)), i) {
|
|
5981
6005
|
const x = q(t, !0, o, t);
|
|
5982
|
-
|
|
5983
|
-
} else s &&
|
|
5984
|
-
o && !i && s &&
|
|
5985
|
-
const d = s && !i && !o ? Zt(s, a) : B(0), f = r.left + a.scrollLeft -
|
|
6006
|
+
h.x = x.x + t.clientLeft, h.y = x.y + t.clientTop;
|
|
6007
|
+
} else s && l();
|
|
6008
|
+
o && !i && s && l();
|
|
6009
|
+
const d = s && !i && !o ? Zt(s, a) : B(0), f = r.left + a.scrollLeft - h.x - d.x, u = r.top + a.scrollTop - h.y - d.y;
|
|
5986
6010
|
return {
|
|
5987
6011
|
x: f,
|
|
5988
6012
|
y: u,
|
|
@@ -5990,16 +6014,16 @@ function xi(c, t, e) {
|
|
|
5990
6014
|
height: r.height
|
|
5991
6015
|
};
|
|
5992
6016
|
}
|
|
5993
|
-
function
|
|
6017
|
+
function ht(c) {
|
|
5994
6018
|
return Y(c).position === "static";
|
|
5995
6019
|
}
|
|
5996
|
-
function
|
|
6020
|
+
function At(c, t) {
|
|
5997
6021
|
if (!K(c) || Y(c).position === "fixed")
|
|
5998
6022
|
return null;
|
|
5999
6023
|
if (t)
|
|
6000
6024
|
return t(c);
|
|
6001
6025
|
let e = c.offsetParent;
|
|
6002
|
-
return
|
|
6026
|
+
return W(c) === e && (e = e.ownerDocument.body), e;
|
|
6003
6027
|
}
|
|
6004
6028
|
function qt(c, t) {
|
|
6005
6029
|
const e = H(c);
|
|
@@ -6008,16 +6032,16 @@ function qt(c, t) {
|
|
|
6008
6032
|
if (!K(c)) {
|
|
6009
6033
|
let s = P(c);
|
|
6010
6034
|
for (; s && !U(s); ) {
|
|
6011
|
-
if (X(s) && !
|
|
6035
|
+
if (X(s) && !ht(s))
|
|
6012
6036
|
return s;
|
|
6013
6037
|
s = P(s);
|
|
6014
6038
|
}
|
|
6015
6039
|
return e;
|
|
6016
6040
|
}
|
|
6017
|
-
let i =
|
|
6018
|
-
for (; i && Ze(i) &&
|
|
6019
|
-
i =
|
|
6020
|
-
return i && U(i) &&
|
|
6041
|
+
let i = At(c, t);
|
|
6042
|
+
for (; i && Ze(i) && ht(i); )
|
|
6043
|
+
i = At(i, t);
|
|
6044
|
+
return i && U(i) && ht(i) && !pt(i) ? e : i || ti(c) || e;
|
|
6021
6045
|
}
|
|
6022
6046
|
const ui = async function(c) {
|
|
6023
6047
|
const t = this.getOffsetParent || qt, e = this.getDimensions, i = await e(c.floating);
|
|
@@ -6036,7 +6060,7 @@ function gi(c) {
|
|
|
6036
6060
|
}
|
|
6037
6061
|
const wi = {
|
|
6038
6062
|
convertOffsetParentRelativeRectToViewportRelativeRect: oi,
|
|
6039
|
-
getDocumentElement:
|
|
6063
|
+
getDocumentElement: W,
|
|
6040
6064
|
getClippingRect: di,
|
|
6041
6065
|
getOffsetParent: qt,
|
|
6042
6066
|
getElementRects: ui,
|
|
@@ -6045,7 +6069,7 @@ const wi = {
|
|
|
6045
6069
|
getScale: G,
|
|
6046
6070
|
isElement: X,
|
|
6047
6071
|
isRTL: gi
|
|
6048
|
-
}, Jt = ze, Qt = $e, te =
|
|
6072
|
+
}, Jt = ze, Qt = $e, te = Fe, mi = We, ee = (c, t, e) => {
|
|
6049
6073
|
const i = /* @__PURE__ */ new Map(), s = {
|
|
6050
6074
|
platform: wi,
|
|
6051
6075
|
...e
|
|
@@ -6079,7 +6103,7 @@ let pi = class {
|
|
|
6079
6103
|
borderRadius: "4px",
|
|
6080
6104
|
fontSize: "12px",
|
|
6081
6105
|
...o
|
|
6082
|
-
},
|
|
6106
|
+
}, h = {
|
|
6083
6107
|
position: "absolute",
|
|
6084
6108
|
width: "10px",
|
|
6085
6109
|
height: "10px",
|
|
@@ -6088,7 +6112,7 @@ let pi = class {
|
|
|
6088
6112
|
transform: "rotate(45deg)",
|
|
6089
6113
|
zIndex: a.zIndex
|
|
6090
6114
|
};
|
|
6091
|
-
Object.assign(this.arrowEl.style,
|
|
6115
|
+
Object.assign(this.arrowEl.style, h), Object.assign(this.floatingEl.style, a), this.floatingEl.appendChild(this.contentEl), this.floatingEl.appendChild(this.arrowEl), this.ctx.containerElement.appendChild(this.floatingEl), this.init();
|
|
6092
6116
|
}
|
|
6093
6117
|
init() {
|
|
6094
6118
|
this.floatingEl.addEventListener("mouseleave", () => {
|
|
@@ -6137,10 +6161,10 @@ let pi = class {
|
|
|
6137
6161
|
placement: t.overflowTooltipPlacement,
|
|
6138
6162
|
middleware: [Qt(), te(), Jt(6), mi({ element: this.arrowEl })]
|
|
6139
6163
|
}).then((a) => {
|
|
6140
|
-
const { x:
|
|
6164
|
+
const { x: h, y: l, placement: d, middlewareData: f } = a;
|
|
6141
6165
|
if (Object.assign(this.floatingEl.style, {
|
|
6142
|
-
top: `${
|
|
6143
|
-
left: `${
|
|
6166
|
+
top: `${l}px`,
|
|
6167
|
+
left: `${h}px`
|
|
6144
6168
|
}), f.arrow) {
|
|
6145
6169
|
const u = f.arrow;
|
|
6146
6170
|
["left", "left-start", "left-end"].includes(d) ? Object.assign(this.arrowEl.style, {
|
|
@@ -6205,15 +6229,15 @@ class Ei {
|
|
|
6205
6229
|
return;
|
|
6206
6230
|
if (t.code === "Escape" && this.ctx.editing) {
|
|
6207
6231
|
this.cancel = !0;
|
|
6208
|
-
const { focusCell:
|
|
6209
|
-
|
|
6232
|
+
const { focusCell: h } = this.ctx;
|
|
6233
|
+
h && (this.ctx.emit("setSelectorCell", h), this.cellTarget = h), this.doneEdit();
|
|
6210
6234
|
return;
|
|
6211
6235
|
}
|
|
6212
6236
|
if ((t.altKey || t.metaKey) && t.code === "Enter" && this.ctx.editing && this.inputEl) {
|
|
6213
6237
|
t.preventDefault();
|
|
6214
|
-
const
|
|
6215
|
-
this.inputEl.value =
|
|
6216
|
-
` + d, this.inputEl.selectionStart = this.inputEl.selectionEnd =
|
|
6238
|
+
const h = this.inputEl.selectionStart, l = this.inputEl.value.substring(0, h), d = this.inputEl.value.substring(h);
|
|
6239
|
+
this.inputEl.value = l + `
|
|
6240
|
+
` + d, this.inputEl.selectionStart = this.inputEl.selectionEnd = h + 1, this.autoSize();
|
|
6217
6241
|
return;
|
|
6218
6242
|
}
|
|
6219
6243
|
if (t.code === "Tab" && this.ctx.editing) {
|
|
@@ -6289,8 +6313,8 @@ class Ei {
|
|
|
6289
6313
|
});
|
|
6290
6314
|
}
|
|
6291
6315
|
isInSelectorRange(t, e) {
|
|
6292
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a,
|
|
6293
|
-
return !(e < o || e > r || t < a || t >
|
|
6316
|
+
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a, h] = s;
|
|
6317
|
+
return !(e < o || e > r || t < a || t > h);
|
|
6294
6318
|
}
|
|
6295
6319
|
initTextEditor() {
|
|
6296
6320
|
this.inputEl = document.createElement("textarea"), this.inputEl.setAttribute("rows", "1"), this.inputEl.addEventListener("input", this.autoSize.bind(this)), this.inputEl.addEventListener("blur", () => {
|
|
@@ -6312,15 +6336,15 @@ class Ei {
|
|
|
6312
6336
|
startEditByInput(t, e = !1) {
|
|
6313
6337
|
const i = e ? null : t.getValue(), { editorType: s } = t;
|
|
6314
6338
|
t.update(), this.ctx.config.ENABLE_MERGE_CELL_LINK && t.updateSpanInfo();
|
|
6315
|
-
let { height: o, width: r, drawY: a, drawX:
|
|
6316
|
-
this.drawX =
|
|
6339
|
+
let { height: o, width: r, drawY: a, drawX: h } = t;
|
|
6340
|
+
this.drawX = h, this.drawY = a;
|
|
6317
6341
|
const {
|
|
6318
|
-
config: { CELL_PADDING:
|
|
6342
|
+
config: { CELL_PADDING: l },
|
|
6319
6343
|
header: d
|
|
6320
6344
|
} = this.ctx;
|
|
6321
6345
|
let f = this.ctx.body.visibleHeight;
|
|
6322
6346
|
if (o > f && (o = f), this.editorEl.style.display = "inline-block", this.editorEl.style.left = `${this.drawX - 1}px`, this.editorEl.style.top = `${this.drawY - 1}px`, this.editorEl.style.bottom = "auto", this.editorEl.style.maxHeight = `${f}px`, s === "text") {
|
|
6323
|
-
this.inputEl.style.display = "block", 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 - 1}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${
|
|
6347
|
+
this.inputEl.style.display = "block", 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 - 1}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${l}px`, i !== null && (this.inputEl.value = i), this.inputEl.focus({ preventScroll: !0 });
|
|
6324
6348
|
const u = this.inputEl.value.length;
|
|
6325
6349
|
this.inputEl.setSelectionRange(u, u);
|
|
6326
6350
|
} else
|
|
@@ -6344,22 +6368,22 @@ class Ei {
|
|
|
6344
6368
|
const { rowKey: o, key: r, editorType: a } = i;
|
|
6345
6369
|
if (a === "none")
|
|
6346
6370
|
return;
|
|
6347
|
-
const
|
|
6348
|
-
i && !
|
|
6371
|
+
const h = this.ctx.database.getReadonly(o, r);
|
|
6372
|
+
i && !h && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = i, this.startEditByInput(this.cellTarget, t), this.ctx.emit("startEdit", this.cellTarget));
|
|
6349
6373
|
}
|
|
6350
6374
|
editCell(t, e) {
|
|
6351
|
-
const i = this.ctx.body.renderRows.find((
|
|
6375
|
+
const i = this.ctx.body.renderRows.find((l) => l.rowIndex === t);
|
|
6352
6376
|
if (!i)
|
|
6353
6377
|
return;
|
|
6354
|
-
const s = i.cells.find((
|
|
6378
|
+
const s = i.cells.find((l) => l.colIndex === e);
|
|
6355
6379
|
if (!s)
|
|
6356
6380
|
return;
|
|
6357
6381
|
this.ctx.emit("setSelectorCell", s);
|
|
6358
6382
|
const o = this.ctx.focusCell;
|
|
6359
6383
|
if (!o || ["index", "index-selection", "selection"].includes(o.type) || this.enable)
|
|
6360
6384
|
return;
|
|
6361
|
-
const { rowKey: r, key: a } = o,
|
|
6362
|
-
o && !
|
|
6385
|
+
const { rowKey: r, key: a } = o, h = this.ctx.database.getReadonly(r, a);
|
|
6386
|
+
o && !h && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = o, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
6363
6387
|
}
|
|
6364
6388
|
doneEdit() {
|
|
6365
6389
|
this.enable && (this.doneEditByInput(), this.ctx.emit("doneEdit", this.cellTarget), this.enable = !1, this.ctx.editing = !1, this.ctx.containerElement.focus({ preventScroll: !0 }), this.editorEl.style.display = "none", this.ctx.emit("draw"));
|
|
@@ -6379,17 +6403,17 @@ class yi {
|
|
|
6379
6403
|
this.ctx = t;
|
|
6380
6404
|
const { EMPTY_TEXT: e, EMPTY_CUSTOM_STYLE: i } = this.ctx.config;
|
|
6381
6405
|
this.ctx.emptyElement ? this.emptyEl = this.ctx.emptyElement : (this.emptyEl = document.createElement("div"), this.emptyEl.innerText = e), this.emptyEl.className = "e-virt-table-empty", this.emptyEl.style.display = "none", this.ctx.containerElement.appendChild(this.emptyEl), this.ctx.on("emptyChange", ({ type: s, headerHeight: o, bodyHeight: r, footerHeight: a }) => {
|
|
6382
|
-
const
|
|
6406
|
+
const h = o + (r + a) / 2, l = {
|
|
6383
6407
|
display: s === "empty" ? "block" : "none",
|
|
6384
6408
|
position: "absolute",
|
|
6385
6409
|
fontSize: "14px",
|
|
6386
6410
|
color: "#666",
|
|
6387
6411
|
left: "50%",
|
|
6388
|
-
top: `${
|
|
6412
|
+
top: `${h}px`,
|
|
6389
6413
|
transform: "translate(-50%, -50%)",
|
|
6390
6414
|
...i
|
|
6391
6415
|
};
|
|
6392
|
-
Object.assign(this.emptyEl.style,
|
|
6416
|
+
Object.assign(this.emptyEl.style, l);
|
|
6393
6417
|
});
|
|
6394
6418
|
}
|
|
6395
6419
|
destroy() {
|
|
@@ -6400,9 +6424,30 @@ class Ci {
|
|
|
6400
6424
|
constructor(t) {
|
|
6401
6425
|
n(this, "ctx");
|
|
6402
6426
|
n(this, "observer");
|
|
6403
|
-
this.ctx = t, this.observer = new MutationObserver(
|
|
6404
|
-
|
|
6405
|
-
|
|
6427
|
+
this.ctx = t, this.observer = new MutationObserver(
|
|
6428
|
+
xt(() => {
|
|
6429
|
+
const e = this.ctx.overlayerElement.querySelectorAll('[data-auto-height="true"]'), i = /* @__PURE__ */ new Map();
|
|
6430
|
+
e.forEach((r) => {
|
|
6431
|
+
const a = Number(r.getAttribute("data-row-index")), h = Number(r.getAttribute("data-col-index"));
|
|
6432
|
+
if (isNaN(a) || isNaN(h) || !(r instanceof HTMLElement) || r.offsetWidth === 0)
|
|
6433
|
+
return;
|
|
6434
|
+
const l = `${a}_${h}`;
|
|
6435
|
+
i.set(l, Math.round(r.offsetHeight));
|
|
6436
|
+
});
|
|
6437
|
+
const s = this.ctx.database.getOverlayerAutoHeightMap();
|
|
6438
|
+
if (!this.arerMapsEqual(s, i)) {
|
|
6439
|
+
if (this.ctx.database.setOverlayerAutoHeightMap(i), s.size === 0 && i.size === 0)
|
|
6440
|
+
return;
|
|
6441
|
+
this.ctx.emit("draw");
|
|
6442
|
+
}
|
|
6443
|
+
}, 16.67)
|
|
6444
|
+
), this.observer.observe(this.ctx.overlayerElement, { childList: !0, subtree: !0, attributes: !0 });
|
|
6445
|
+
}
|
|
6446
|
+
arerMapsEqual(t, e) {
|
|
6447
|
+
if (t.size !== e.size) return !1;
|
|
6448
|
+
for (let [i, s] of t)
|
|
6449
|
+
if (!e.has(i) || e.get(i) !== s) return !1;
|
|
6450
|
+
return !0;
|
|
6406
6451
|
}
|
|
6407
6452
|
draw() {
|
|
6408
6453
|
const t = this.getContainer();
|
|
@@ -6428,9 +6473,9 @@ class Ci {
|
|
|
6428
6473
|
fixedRightWidth: e,
|
|
6429
6474
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
6430
6475
|
} = this.ctx, { visibleWidth: o, visibleHeight: r, renderCellHeaders: a } = this.ctx.header;
|
|
6431
|
-
let
|
|
6476
|
+
let h = [], l = [], d = [];
|
|
6432
6477
|
a.forEach((g) => {
|
|
6433
|
-
g.render && (g.fixed === "left" ?
|
|
6478
|
+
g.render && (g.fixed === "left" ? l.push(g) : g.fixed === "right" ? d.push(g) : h.push(g));
|
|
6434
6479
|
});
|
|
6435
6480
|
const f = e - i, u = {
|
|
6436
6481
|
key: "left",
|
|
@@ -6442,7 +6487,7 @@ class Ci {
|
|
|
6442
6487
|
width: `${t}px`,
|
|
6443
6488
|
height: `${r}px`
|
|
6444
6489
|
},
|
|
6445
|
-
cells:
|
|
6490
|
+
cells: l
|
|
6446
6491
|
}, x = {
|
|
6447
6492
|
key: "center",
|
|
6448
6493
|
style: {
|
|
@@ -6453,7 +6498,7 @@ class Ci {
|
|
|
6453
6498
|
width: `${o - t - f + 1}px`,
|
|
6454
6499
|
height: `${r}px`
|
|
6455
6500
|
},
|
|
6456
|
-
cells:
|
|
6501
|
+
cells: h
|
|
6457
6502
|
}, w = {
|
|
6458
6503
|
key: "right",
|
|
6459
6504
|
style: {
|
|
@@ -6489,8 +6534,8 @@ class Ci {
|
|
|
6489
6534
|
const {
|
|
6490
6535
|
fixedLeftWidth: o,
|
|
6491
6536
|
fixedRightWidth: r,
|
|
6492
|
-
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX:
|
|
6493
|
-
} = this.ctx, { visibleWidth:
|
|
6537
|
+
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX: h }
|
|
6538
|
+
} = this.ctx, { visibleWidth: l, visibleHeight: d } = this.ctx.body, f = r - a, u = {
|
|
6494
6539
|
key: "left",
|
|
6495
6540
|
style: {
|
|
6496
6541
|
position: "absolute",
|
|
@@ -6508,7 +6553,7 @@ class Ci {
|
|
|
6508
6553
|
top: `${0.5}px`,
|
|
6509
6554
|
left: `${o - 0.5}px`,
|
|
6510
6555
|
overflow: "hidden",
|
|
6511
|
-
width: `${
|
|
6556
|
+
width: `${l - o - f}px`,
|
|
6512
6557
|
height: `${d}px`
|
|
6513
6558
|
},
|
|
6514
6559
|
cells: t
|
|
@@ -6526,11 +6571,11 @@ class Ci {
|
|
|
6526
6571
|
};
|
|
6527
6572
|
return {
|
|
6528
6573
|
type: "body",
|
|
6529
|
-
class: `${
|
|
6574
|
+
class: `${h}-overlayer-body`,
|
|
6530
6575
|
style: {
|
|
6531
6576
|
position: "relative",
|
|
6532
6577
|
overflow: "hidden",
|
|
6533
|
-
width: `${
|
|
6578
|
+
width: `${l}px`,
|
|
6534
6579
|
height: `${d}px`
|
|
6535
6580
|
},
|
|
6536
6581
|
views: [u, x, w]
|
|
@@ -6547,7 +6592,7 @@ class Ci {
|
|
|
6547
6592
|
fixedLeftWidth: s,
|
|
6548
6593
|
fixedRightWidth: o,
|
|
6549
6594
|
config: { SCROLLER_TRACK_SIZE: r, CSS_PREFIX: a }
|
|
6550
|
-
} = this.ctx, { visibleWidth:
|
|
6595
|
+
} = this.ctx, { visibleWidth: h, visibleHeight: l } = this.ctx.footer, d = o - r, f = {
|
|
6551
6596
|
key: "left",
|
|
6552
6597
|
style: {
|
|
6553
6598
|
position: "absolute",
|
|
@@ -6555,7 +6600,7 @@ class Ci {
|
|
|
6555
6600
|
left: `${0.5}px`,
|
|
6556
6601
|
overflow: "hidden",
|
|
6557
6602
|
width: `${s}px`,
|
|
6558
|
-
height: `${
|
|
6603
|
+
height: `${l}px`
|
|
6559
6604
|
},
|
|
6560
6605
|
cells: e
|
|
6561
6606
|
}, u = {
|
|
@@ -6565,8 +6610,8 @@ class Ci {
|
|
|
6565
6610
|
top: `${0.5}px`,
|
|
6566
6611
|
left: `${s - 0.5}px`,
|
|
6567
6612
|
overflow: "hidden",
|
|
6568
|
-
width: `${
|
|
6569
|
-
height: `${
|
|
6613
|
+
width: `${h - s - d}px`,
|
|
6614
|
+
height: `${l}px`
|
|
6570
6615
|
},
|
|
6571
6616
|
cells: t
|
|
6572
6617
|
}, x = {
|
|
@@ -6577,7 +6622,7 @@ class Ci {
|
|
|
6577
6622
|
right: `${0.5}px`,
|
|
6578
6623
|
overflow: "hidden",
|
|
6579
6624
|
width: `${d}px`,
|
|
6580
|
-
height: `${
|
|
6625
|
+
height: `${l}px`
|
|
6581
6626
|
},
|
|
6582
6627
|
cells: i
|
|
6583
6628
|
};
|
|
@@ -6587,8 +6632,8 @@ class Ci {
|
|
|
6587
6632
|
style: {
|
|
6588
6633
|
position: "relative",
|
|
6589
6634
|
overflow: "hidden",
|
|
6590
|
-
width: `${
|
|
6591
|
-
height: `${
|
|
6635
|
+
width: `${h}px`,
|
|
6636
|
+
height: `${l}px`
|
|
6592
6637
|
},
|
|
6593
6638
|
views: [f, u, x]
|
|
6594
6639
|
};
|
|
@@ -6605,8 +6650,8 @@ class bi {
|
|
|
6605
6650
|
this.ctx.on("cellContextMenuClick", (t, e) => {
|
|
6606
6651
|
if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
|
|
6607
6652
|
e.preventDefault();
|
|
6608
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a,
|
|
6609
|
-
|
|
6653
|
+
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a, h] = s, { rowIndex: l, colIndex: d } = t;
|
|
6654
|
+
l >= a && l <= h && d >= o && d <= r || this.ctx.emit("setSelectorCell", t, e);
|
|
6610
6655
|
const u = {
|
|
6611
6656
|
getBoundingClientRect: () => ({
|
|
6612
6657
|
width: 0,
|
|
@@ -6680,7 +6725,7 @@ class bi {
|
|
|
6680
6725
|
this.contextMenuEl.remove();
|
|
6681
6726
|
}
|
|
6682
6727
|
}
|
|
6683
|
-
class
|
|
6728
|
+
class vi {
|
|
6684
6729
|
constructor(t, e) {
|
|
6685
6730
|
n(this, "options");
|
|
6686
6731
|
n(this, "scroller");
|
|
@@ -6703,7 +6748,7 @@ class Si {
|
|
|
6703
6748
|
o,
|
|
6704
6749
|
r
|
|
6705
6750
|
);
|
|
6706
|
-
this.ctx = new Re(a, this.options), this.header = new
|
|
6751
|
+
this.ctx = new Re(a, this.options), this.header = new ve(this.ctx), this.footer = new _e(this.ctx), this.body = new Se(this.ctx), this.scroller = new Ie(this.ctx), this.selector = new Te(this.ctx), this.autofill = new Oe(this.ctx), this.tooltip = new pi(this.ctx), this.empty = new yi(this.ctx), this.editor = new Ei(this.ctx), this.overlayer = new Ci(this.ctx), this.contextMenu = new bi(this.ctx), this.ctx.on("draw", () => {
|
|
6707
6752
|
this.draw();
|
|
6708
6753
|
}), this.ctx.on("drawView", () => {
|
|
6709
6754
|
this.draw(!0);
|
|
@@ -6711,24 +6756,24 @@ class Si {
|
|
|
6711
6756
|
}
|
|
6712
6757
|
createContainer(t, e, i, s, o) {
|
|
6713
6758
|
t.className = "e-virt-table-container";
|
|
6714
|
-
const r = document.createElement("div"), a = document.createElement("canvas"),
|
|
6715
|
-
r.className = "e-virt-table-stage", t.tabIndex = 0, a.className = "e-virt-table-canvas",
|
|
6716
|
-
const
|
|
6717
|
-
|
|
6759
|
+
const r = document.createElement("div"), a = document.createElement("canvas"), h = e || document.createElement("div");
|
|
6760
|
+
r.className = "e-virt-table-stage", t.tabIndex = 0, a.className = "e-virt-table-canvas", h.className = "e-virt-table-overlayer";
|
|
6761
|
+
const l = i || document.createElement("div");
|
|
6762
|
+
l.className = "e-virt-table-editor";
|
|
6718
6763
|
const d = s, f = o;
|
|
6719
|
-
return r.appendChild(a), r.appendChild(
|
|
6764
|
+
return r.appendChild(a), r.appendChild(h), t.appendChild(r), {
|
|
6720
6765
|
containerElement: t,
|
|
6721
6766
|
stageElement: r,
|
|
6722
6767
|
canvasElement: a,
|
|
6723
|
-
overlayerElement:
|
|
6724
|
-
editorElement:
|
|
6768
|
+
overlayerElement: h,
|
|
6769
|
+
editorElement: l,
|
|
6725
6770
|
emptyElement: d,
|
|
6726
6771
|
contextMenuElement: f
|
|
6727
6772
|
};
|
|
6728
6773
|
}
|
|
6729
6774
|
draw(t = !1) {
|
|
6730
6775
|
requestAnimationFrame(() => {
|
|
6731
|
-
this.header.update(), this.footer.update(), this.body.update(), this.ctx.paint.clear(), this.body.draw(), this.footer.draw(), this.header.draw(), this.scroller.draw(), t || this.overlayer.draw();
|
|
6776
|
+
this.header.update(), this.footer.update(), this.body.update(), this.ctx.paint.clear(), this.body.draw(), this.footer.draw(), this.header.draw(), this.scroller.draw(), t || this.overlayer.draw(), this.body.updateAutoHeight();
|
|
6732
6777
|
});
|
|
6733
6778
|
}
|
|
6734
6779
|
loadConfig(t) {
|
|
@@ -6808,15 +6853,15 @@ class Si {
|
|
|
6808
6853
|
return new Promise(async (i, s) => {
|
|
6809
6854
|
let o = [];
|
|
6810
6855
|
for (let r = 0; r < t.length; r++) {
|
|
6811
|
-
const { rowKey: a, key:
|
|
6812
|
-
Array.isArray(
|
|
6856
|
+
const { rowKey: a, key: h } = t[r], l = await this.ctx.database.getValidator(a, h);
|
|
6857
|
+
Array.isArray(l) && l.length && o.push(l);
|
|
6813
6858
|
}
|
|
6814
6859
|
if (o.length) {
|
|
6815
6860
|
if (s(o), e) {
|
|
6816
6861
|
const [r] = o;
|
|
6817
6862
|
if (Array.isArray(r) && r.length) {
|
|
6818
|
-
const [a] = r, { rowKey:
|
|
6819
|
-
this.scrollToRowkey(
|
|
6863
|
+
const [a] = r, { rowKey: h, key: l } = a;
|
|
6864
|
+
this.scrollToRowkey(h), this.scrollToColkey(l);
|
|
6820
6865
|
}
|
|
6821
6866
|
}
|
|
6822
6867
|
this.ctx.emit("draw");
|
|
@@ -6833,12 +6878,12 @@ class Si {
|
|
|
6833
6878
|
if (t && Array.isArray(s) && s.length) {
|
|
6834
6879
|
const [o] = s;
|
|
6835
6880
|
if (Array.isArray(o) && o.length) {
|
|
6836
|
-
const [r] = o, { rowKey: a, key:
|
|
6837
|
-
if (
|
|
6838
|
-
const { parentRowKeys: d = [] } =
|
|
6881
|
+
const [r] = o, { rowKey: a, key: h } = r, l = this.ctx.database.getRowForRowKey(a);
|
|
6882
|
+
if (l) {
|
|
6883
|
+
const { parentRowKeys: d = [] } = l;
|
|
6839
6884
|
d && d.length && this.setExpandRowKeys(d, !0);
|
|
6840
6885
|
}
|
|
6841
|
-
this.scrollToRowkey(a), this.scrollToColkey(
|
|
6886
|
+
this.scrollToRowkey(a), this.scrollToColkey(h);
|
|
6842
6887
|
}
|
|
6843
6888
|
}
|
|
6844
6889
|
i(s);
|
|
@@ -6863,7 +6908,7 @@ class Si {
|
|
|
6863
6908
|
let o = [];
|
|
6864
6909
|
for (let r = 0; r < i.length; r++)
|
|
6865
6910
|
for (let a = 0; a < s.length; a++) {
|
|
6866
|
-
const
|
|
6911
|
+
const h = this.ctx.database.getRowKeyByItem(i[r]), d = s[a].key, f = await this.ctx.database.getValidator(h, d);
|
|
6867
6912
|
Array.isArray(f) && f.length && o.push(f);
|
|
6868
6913
|
}
|
|
6869
6914
|
o.length ? (e(o), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
|
|
@@ -6964,6 +7009,6 @@ class Si {
|
|
|
6964
7009
|
}
|
|
6965
7010
|
}
|
|
6966
7011
|
export {
|
|
6967
|
-
|
|
7012
|
+
vi as default
|
|
6968
7013
|
};
|
|
6969
7014
|
//# sourceMappingURL=index.es.js.map
|