e-virt-table 1.2.21 → 1.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +885 -669
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Cell.d.ts +20 -6
- package/dist/lib/Cell.js +250 -91
- package/dist/lib/Cell.js.map +1 -1
- package/dist/lib/CellHeader.d.ts +12 -6
- package/dist/lib/CellHeader.js +83 -24
- package/dist/lib/CellHeader.js.map +1 -1
- package/dist/lib/Config.d.ts +11 -1
- package/dist/lib/Config.js +35 -0
- package/dist/lib/Config.js.map +1 -1
- package/dist/lib/Database.d.ts +18 -1
- package/dist/lib/Database.js +309 -18
- package/dist/lib/Database.js.map +1 -1
- package/dist/lib/EVirtTable.d.ts +1 -1
- package/dist/lib/EVirtTable.js +3 -3
- package/dist/lib/EVirtTable.js.map +1 -1
- package/dist/lib/Editor.js +4 -0
- package/dist/lib/Editor.js.map +1 -1
- package/dist/lib/EventTable.d.ts +0 -1
- package/dist/lib/EventTable.js +96 -63
- package/dist/lib/EventTable.js.map +1 -1
- package/dist/lib/Paint.js +7 -0
- package/dist/lib/Paint.js.map +1 -1
- package/dist/lib/types.d.ts +7 -3
- package/package.json +59 -57
package/dist/index.es.js
CHANGED
|
@@ -24,10 +24,10 @@ class se {
|
|
|
24
24
|
rowKey: r,
|
|
25
25
|
...x
|
|
26
26
|
};
|
|
27
|
-
x.validator(u, h, (
|
|
28
|
-
|
|
27
|
+
x.validator(u, h, (w) => {
|
|
28
|
+
w && e.push({
|
|
29
29
|
...u,
|
|
30
|
-
message:
|
|
30
|
+
message: w
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
33
|
}
|
|
@@ -66,7 +66,7 @@ function Lt() {
|
|
|
66
66
|
return (c === "x" ? t : t & 3 | 8).toString(16);
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function At(c, t) {
|
|
70
70
|
let e = 0, i;
|
|
71
71
|
return function(...s) {
|
|
72
72
|
const o = (/* @__PURE__ */ new Date()).getTime(), r = o - e;
|
|
@@ -75,8 +75,8 @@ function Tt(c, t) {
|
|
|
75
75
|
}, t - r));
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
return c.length ? c.map((t) =>
|
|
78
|
+
function Mt(c = []) {
|
|
79
|
+
return c.length ? c.map((t) => Mt(t.children) + 1).sort((t, e) => e - t)[0] : 0;
|
|
80
80
|
}
|
|
81
81
|
function oe(c = []) {
|
|
82
82
|
let t = [], e = [], i = [];
|
|
@@ -88,14 +88,14 @@ function oe(c = []) {
|
|
|
88
88
|
...i.sort((s, o) => (s.sort ?? 0) - (o.sort ?? 0))
|
|
89
89
|
];
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function Ht(c = [], t = 1, e = 0) {
|
|
92
92
|
return c.map((i) => {
|
|
93
93
|
if (i.children) {
|
|
94
94
|
let s = 0, o = i.fixed;
|
|
95
95
|
i.children.forEach((l) => {
|
|
96
96
|
l.fixed = o;
|
|
97
97
|
});
|
|
98
|
-
const r =
|
|
98
|
+
const r = Ht(i.children, t - 1, e + 1);
|
|
99
99
|
return r && r.forEach((l) => {
|
|
100
100
|
s += l.colspan ?? 0;
|
|
101
101
|
}), {
|
|
@@ -115,23 +115,23 @@ function Mt(c = [], t = 1, e = 0) {
|
|
|
115
115
|
};
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function it(c = []) {
|
|
119
119
|
let t = [];
|
|
120
120
|
return c.forEach((e) => {
|
|
121
|
-
e.children ? t = t.concat(
|
|
121
|
+
e.children ? t = t.concat(it(e.children)) : t.push(e);
|
|
122
122
|
}), t;
|
|
123
123
|
}
|
|
124
|
-
const
|
|
124
|
+
const mt = /^(\r\n|\n\r|\r|\n)/, re = /^[^\t\r\n]+/, yt = /^\t/;
|
|
125
125
|
function ne(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(yt))
|
|
132
|
+
c = c.replace(yt, ""), e += 1, t[i][e] = "";
|
|
133
|
+
else if (c.match(mt))
|
|
134
|
+
c = c.replace(mt, ""), e = 0, i += 1, t[i] = [""];
|
|
135
135
|
else {
|
|
136
136
|
let o = "";
|
|
137
137
|
if (c.startsWith('"')) {
|
|
@@ -160,7 +160,7 @@ function le(c) {
|
|
|
160
160
|
}
|
|
161
161
|
return o;
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function Dt(c, t, e = []) {
|
|
164
164
|
let i = 0;
|
|
165
165
|
const s = [];
|
|
166
166
|
return c.forEach((o, r) => {
|
|
@@ -172,7 +172,7 @@ function Ht(c, t, e = []) {
|
|
|
172
172
|
}
|
|
173
173
|
}), s;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function kt(c, t) {
|
|
176
176
|
let e = "", i = "";
|
|
177
177
|
const s = {};
|
|
178
178
|
return t.forEach((o, r) => {
|
|
@@ -180,7 +180,7 @@ function Dt(c, t) {
|
|
|
180
180
|
}), s;
|
|
181
181
|
}
|
|
182
182
|
function ae(c, t, e = []) {
|
|
183
|
-
const { visibleRows: i, rowIndex: s, headIndex: o } = c, r =
|
|
183
|
+
const { visibleRows: i, rowIndex: s, headIndex: o } = c, r = Dt(i, t, e);
|
|
184
184
|
return r[s - o] === 0 ? {
|
|
185
185
|
rowspan: 0,
|
|
186
186
|
colspan: 0,
|
|
@@ -196,7 +196,7 @@ function ae(c, t, e = []) {
|
|
|
196
196
|
function he(c, t = []) {
|
|
197
197
|
const { column: e, row: i, visibleLeafColumns: s } = c, o = s.filter((r) => t.includes(r.key));
|
|
198
198
|
if (t.includes(e.key)) {
|
|
199
|
-
const r =
|
|
199
|
+
const r = kt(i, o);
|
|
200
200
|
return r[e.key] === 0 ? {
|
|
201
201
|
rowspan: 0,
|
|
202
202
|
colspan: 0,
|
|
@@ -214,7 +214,7 @@ function ce(c, t = document.documentElement) {
|
|
|
214
214
|
const e = c.startsWith("--") ? c : `--${c}`;
|
|
215
215
|
return getComputedStyle(t).getPropertyValue(e).trim();
|
|
216
216
|
}
|
|
217
|
-
class
|
|
217
|
+
class Xt {
|
|
218
218
|
constructor(t, e, i, s, o, r, l) {
|
|
219
219
|
n(this, "ctx");
|
|
220
220
|
n(this, "x", 0);
|
|
@@ -260,7 +260,7 @@ class kt {
|
|
|
260
260
|
getRightFixedX() {
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
|
-
class
|
|
263
|
+
class $ extends Xt {
|
|
264
264
|
constructor(e, i, s, o, r, l, a, h, d, f = "body") {
|
|
265
265
|
super(e, o, r, l, a, f, h.fixed);
|
|
266
266
|
n(this, "formatter");
|
|
@@ -307,12 +307,29 @@ class ft extends kt {
|
|
|
307
307
|
n(this, "drawTextColor", "");
|
|
308
308
|
n(this, "drawTextX", 0);
|
|
309
309
|
n(this, "drawTextY", 0);
|
|
310
|
-
n(this, "
|
|
311
|
-
n(this, "
|
|
312
|
-
|
|
313
|
-
n(this, "
|
|
314
|
-
n(this, "
|
|
315
|
-
n(this, "
|
|
310
|
+
n(this, "drawTextWidth", 0);
|
|
311
|
+
n(this, "drawTextHeight", 0);
|
|
312
|
+
// 画tree图标
|
|
313
|
+
n(this, "drawTreeImageX", 0);
|
|
314
|
+
n(this, "drawTreeImageY", 0);
|
|
315
|
+
n(this, "drawTreeImageWidth", 0);
|
|
316
|
+
n(this, "drawTreeImageHeight", 0);
|
|
317
|
+
n(this, "drawTreeImageName", "");
|
|
318
|
+
n(this, "drawTreeImageSource");
|
|
319
|
+
// 画selection图标
|
|
320
|
+
n(this, "drawSelectionImageX", 0);
|
|
321
|
+
n(this, "drawSelectionImageY", 0);
|
|
322
|
+
n(this, "drawSelectionImageWidth", 0);
|
|
323
|
+
n(this, "drawSelectionImageHeight", 0);
|
|
324
|
+
n(this, "drawSelectionImageName", "");
|
|
325
|
+
n(this, "drawSelectionImageSource");
|
|
326
|
+
// 画hover图标
|
|
327
|
+
n(this, "drawHoverImageX", 0);
|
|
328
|
+
n(this, "drawHoverImageY", 0);
|
|
329
|
+
n(this, "drawHoverImageWidth", 0);
|
|
330
|
+
n(this, "drawHoverImageHeight", 0);
|
|
331
|
+
n(this, "drawHoverImageName", "");
|
|
332
|
+
n(this, "drawHoverImageSource");
|
|
316
333
|
n(this, "ellipsis", !1);
|
|
317
334
|
n(this, "rowExpand", !1);
|
|
318
335
|
n(this, "rowHasChildren", !1);
|
|
@@ -320,7 +337,7 @@ class ft extends kt {
|
|
|
320
337
|
n(this, "selectorCellValueType", "value");
|
|
321
338
|
n(this, "overflowTooltipMaxWidth", 500);
|
|
322
339
|
n(this, "overflowTooltipPlacement", "top");
|
|
323
|
-
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = h.key, this.type = h.type || "", this.editorType = h.editorType || "text", this.selectorCellValueType = h.selectorCellValueType || this.ctx.config.SELECTOR_CELL_VALUE_TYPE || "value", this.editorProps = h.editorProps || {}, this.cellType = f, this.align = h.align ||
|
|
340
|
+
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = h.key, this.type = h.type || "", this.editorType = h.editorType || "text", this.selectorCellValueType = h.selectorCellValueType || this.ctx.config.SELECTOR_CELL_VALUE_TYPE || "value", this.editorProps = h.editorProps || {}, this.cellType = f, this.align = h.align || this.ctx.config.COLUMNS_ALIGN, this.verticalAlign = h.verticalAlign || this.ctx.config.COLUMNS_VERTICAL_ALIGN, this.fixed = h.fixed, this.level = h.level || 0, this.operation = h.operation || !1, this.column = h, this.rules = h.rules || [], this.row = d, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = h.render, this.overflowTooltipShow = h.overflowTooltipShow !== !1, this.overflowTooltipMaxWidth = h.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = h.overflowTooltipPlacement || "top", this.renderFooter = h.renderFooter, this.hoverIconName = h.hoverIconName, this.formatter = h.formatter, this.formatterFooter = h.formatterFooter, this.update();
|
|
324
341
|
}
|
|
325
342
|
setWidthHeight(e, i) {
|
|
326
343
|
this.width = e, this.height = i;
|
|
@@ -334,7 +351,7 @@ class ft extends kt {
|
|
|
334
351
|
return this.message;
|
|
335
352
|
}
|
|
336
353
|
update() {
|
|
337
|
-
this.drawX = this.getDrawX(), this.drawY = this.getDrawY(), this.drawTextX = this.drawX, this.drawTextY = this.drawY, this.isHasChanged = this.ctx.database.isHasChangedData(this.rowKey, this.key), this.updateSpan(), this.updateStyle(), this.updateType(), this.updateHoverIcon(), this.updateSelection(), this.updateTree(), this.updateEditor(), this.updateRender(), this.getValidationMessage(), this.updateContainer(), this.text = this.getText(), this.displayText = this.getDisplayText();
|
|
354
|
+
this.drawX = this.getDrawX(), this.drawY = this.getDrawY(), this.drawTextX = this.drawX, this.drawTextY = this.drawY, this.isHasChanged = this.ctx.database.isHasChangedData(this.rowKey, this.key), this.updateSpan(), this.drawTextWidth = this.visibleWidth, this.drawTextHeight = this.visibleHeight, this.updateStyle(), this.updateType(), this.updateHoverIcon(), this.updateSelection(), this.updateTree(), this.updateEditor(), this.updateRender(), this.getValidationMessage(), this.updateContainer(), this.text = this.getText(), this.displayText = this.getDisplayText();
|
|
338
355
|
}
|
|
339
356
|
updateSpan() {
|
|
340
357
|
if (this.cellType === "footer")
|
|
@@ -432,23 +449,22 @@ class ft extends kt {
|
|
|
432
449
|
updateTree() {
|
|
433
450
|
const { CELL_PADDING: e = 0 } = this.ctx.config, { rowKey: i, cellType: s } = this;
|
|
434
451
|
let o, r = 0, l = "";
|
|
435
|
-
if (
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
if (o) {
|
|
447
|
-
let g = this.drawX + r + e, w = this.drawY + (this.visibleHeight - p) / 2;
|
|
448
|
-
this.ctx.paint.drawImage(o, g, w, u, p), this.drawImageX = g, this.drawImageY = w, this.drawImageWidth = u, this.drawImageHeight = p, this.drawImageName = l, this.drawImageSource = o;
|
|
449
|
-
}
|
|
450
|
-
this.align = "left", this.drawTextX = r + this.drawX + u - 0.5;
|
|
452
|
+
if (!(["tree", "selection-tree", "tree-selection"].includes(this.type) && s === "body"))
|
|
453
|
+
return;
|
|
454
|
+
const a = this.ctx.database.getRowForRowKey(i), { expand: h = !1, hasChildren: d = !1, expandLoading: f = !1, level: x = 0 } = a || {};
|
|
455
|
+
this.rowExpand = h, this.rowHasChildren = d;
|
|
456
|
+
const { TREE_INDENT: u = 16, CHECKBOX_SIZE: w, TREE_ICON_SIZE: E } = this.ctx.config;
|
|
457
|
+
if (r = x * u, f) {
|
|
458
|
+
const I = this.ctx.icons.get("loading");
|
|
459
|
+
l = "loading", o = I;
|
|
460
|
+
} else if (d) {
|
|
461
|
+
const I = this.ctx.icons.get("expand"), _ = this.ctx.icons.get("shrink");
|
|
462
|
+
o = h ? _ : I, l = h ? "shrink" : "expand";
|
|
451
463
|
}
|
|
464
|
+
let g = E, p = E, m = this.drawX;
|
|
465
|
+
(this.align === "center" || this.align === "right") && (m = this.drawX + (this.visibleWidth - g - 2 * e) / 2, this.align = "left");
|
|
466
|
+
let y = m + r + e, b = this.drawY + (this.visibleHeight - p) / 2, C = r + this.drawX + g - 0.5;
|
|
467
|
+
this.type === "selection-tree" ? (y = r + this.drawSelectionImageX + this.drawSelectionImageWidth, C = y + g - e / 2) : this.type === "tree-selection" ? C = y + w + g - e / 2 : C = y + g - e / 2, this.drawTextX = C, this.drawTextWidth = this.drawX + this.visibleWidth - C, !(y + g + e > this.drawX + this.visibleWidth) && (b + p + e > this.drawY + this.visibleHeight || o && (this.drawTreeImageX = y, this.drawTreeImageY = b, this.drawTreeImageWidth = g, this.drawTreeImageHeight = p, this.drawTreeImageName = l, this.drawTreeImageSource = o));
|
|
452
468
|
}
|
|
453
469
|
updateContainer() {
|
|
454
470
|
const {
|
|
@@ -464,35 +480,35 @@ class ft extends kt {
|
|
|
464
480
|
HIGHLIGHT_SELECTED_ROW_COLOR: f,
|
|
465
481
|
HIGHLIGHT_HOVER_ROW: x,
|
|
466
482
|
HIGHLIGHT_HOVER_ROW_COLOR: u,
|
|
467
|
-
STRIPE:
|
|
468
|
-
STRIPE_COLOR:
|
|
483
|
+
STRIPE: w,
|
|
484
|
+
STRIPE_COLOR: E
|
|
469
485
|
} = this.ctx.config;
|
|
470
486
|
if (this.cellType === "footer") {
|
|
471
|
-
let _ = h,
|
|
487
|
+
let _ = h, T = a;
|
|
472
488
|
if (typeof o == "function") {
|
|
473
|
-
const v = o, { backgroundColor:
|
|
489
|
+
const v = o, { backgroundColor: R, color: S } = v({
|
|
474
490
|
row: this.row,
|
|
475
491
|
rowIndex: this.rowIndex,
|
|
476
492
|
colIndex: this.colIndex,
|
|
477
493
|
column: this.column,
|
|
478
494
|
value: this.getValue()
|
|
479
495
|
}) || {};
|
|
480
|
-
|
|
496
|
+
R && (_ = R), S && (T = S);
|
|
481
497
|
}
|
|
482
|
-
this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = _, this.drawTextColor =
|
|
498
|
+
this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = _, this.drawTextColor = T;
|
|
483
499
|
return;
|
|
484
500
|
}
|
|
485
|
-
let
|
|
486
|
-
const
|
|
487
|
-
let
|
|
501
|
+
let g = "transparent";
|
|
502
|
+
const p = this.ctx.hoverCell, m = this.ctx.currentCell;
|
|
503
|
+
let y = this.rowIndex, b = this.rowIndex;
|
|
488
504
|
if (this.rowspan !== 1 && (x || d)) {
|
|
489
|
-
const _ = this.getSpanInfo(), { yArr:
|
|
490
|
-
|
|
505
|
+
const _ = this.getSpanInfo(), { yArr: T } = _;
|
|
506
|
+
y = T[0], b = T[1];
|
|
491
507
|
}
|
|
492
|
-
x &&
|
|
508
|
+
x && p && (p.rowKey === this.rowKey && (g = u), p.rowIndex >= y && p.rowIndex <= b && (g = u)), d && m && (m.rowKey === this.rowKey && (g = f), m.rowIndex >= y && m.rowIndex <= b && (g = f)), this.drawCellSkyBgColor = g;
|
|
493
509
|
let C = e, I = l;
|
|
494
|
-
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (C = i, I = r),
|
|
495
|
-
const _ = s, { backgroundColor:
|
|
510
|
+
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (C = i, I = r), w && (this.rowIndex % 2 ? C = E : C = e), typeof s == "function") {
|
|
511
|
+
const _ = s, { backgroundColor: T, color: v } = _({
|
|
496
512
|
row: this.row,
|
|
497
513
|
rowIndex: this.rowIndex,
|
|
498
514
|
colIndex: this.colIndex,
|
|
@@ -500,17 +516,33 @@ class ft extends kt {
|
|
|
500
516
|
isHasChanged: this.isHasChanged,
|
|
501
517
|
value: this.getValue()
|
|
502
518
|
}) || {};
|
|
503
|
-
|
|
519
|
+
T && (C = T), v && (I = v);
|
|
504
520
|
}
|
|
505
521
|
this.drawCellBgColor = C, this.drawTextColor = I;
|
|
506
522
|
}
|
|
507
523
|
updateSelection() {
|
|
508
524
|
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: l, rowIndex: a, rowKey: h } = this;
|
|
509
|
-
if (
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
525
|
+
if (s === 0 || o === 0 || r === "footer" || !["index-selection", "selection", "selection-tree", "tree-selection"].includes(l))
|
|
526
|
+
return;
|
|
527
|
+
const d = this.ctx.database.getRowSelectable(h), { CHECKBOX_SIZE: f = 0, CELL_PADDING: x } = this.ctx.config;
|
|
528
|
+
let u = this.drawX + x;
|
|
529
|
+
(this.align === "center" || this.align === "right") && (u = this.drawX + (e - f) / 2);
|
|
530
|
+
let w = u, E = this.drawY + (i - f) / 2;
|
|
531
|
+
if (l !== "selection-tree") {
|
|
532
|
+
if (l === "tree-selection") {
|
|
533
|
+
const { TREE_INDENT: m = 16, TREE_ICON_SIZE: y } = this.ctx.config, b = this.ctx.database.getRowForRowKey(h), { level: C = 0 } = b || {}, I = C * m;
|
|
534
|
+
w = u + y + I;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
let g = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck";
|
|
538
|
+
if (l === "selection-tree" || l === "tree-selection") {
|
|
539
|
+
const m = this.ctx.database.getTreeSelectionState(h);
|
|
540
|
+
m.indeterminate && d ? (g = this.ctx.icons.get("checkbox-indeterminate"), p = "checkbox-indeterminate") : m.checked && d ? (g = this.ctx.icons.get("checkbox-check"), p = "checkbox-check") : !m.checked && d ? (g = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), p = "checkbox-disabled");
|
|
541
|
+
} else {
|
|
542
|
+
const m = this.ctx.database.getRowSelection(h);
|
|
543
|
+
m && d ? (g = this.ctx.icons.get("checkbox-check"), p = "checkbox-check") : m && !d ? (g = this.ctx.icons.get("checkbox-check-disabled"), p = "checkbox-check-disabled") : !m && d ? (g = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), p = "checkbox-disabled");
|
|
513
544
|
}
|
|
545
|
+
w + f + x > this.drawX + this.visibleWidth || E + f + x > this.drawY + this.visibleHeight || (l === "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === a || ["checkbox-disabled", "checkbox-check"].includes(p)) && (this.drawSelectionImageX = w, this.drawSelectionImageY = E, this.drawSelectionImageWidth = f, this.drawSelectionImageHeight = f, this.drawSelectionImageName = p, this.drawSelectionImageSource = g) : (this.drawSelectionImageX = w, this.drawSelectionImageY = E, this.drawSelectionImageWidth = f, this.drawSelectionImageHeight = f, this.drawSelectionImageName = p, this.drawSelectionImageSource = g));
|
|
514
546
|
}
|
|
515
547
|
updateHoverIcon() {
|
|
516
548
|
if (this.ctx.database.getReadonly(this.rowKey, this.key))
|
|
@@ -530,14 +562,14 @@ class ft extends kt {
|
|
|
530
562
|
if (this.hoverIconName && !this.ctx.editing && l) {
|
|
531
563
|
let a = 0, h = 0;
|
|
532
564
|
if (l.rowKey === this.rowKey && (a = this.drawX + this.width - s - o, h = this.drawY + (this.height - s) / 2), this.rowspan !== 1 && r) {
|
|
533
|
-
const f = this.getSpanInfo(), { yArr: x } = f, u = x[0],
|
|
534
|
-
if (l.rowIndex >= u && l.rowIndex <=
|
|
535
|
-
const { width:
|
|
536
|
-
a = this.drawX -
|
|
565
|
+
const f = this.getSpanInfo(), { yArr: x } = f, u = x[0], w = x[1];
|
|
566
|
+
if (l.rowIndex >= u && l.rowIndex <= w) {
|
|
567
|
+
const { width: E, height: g, offsetTop: p, offsetLeft: m } = f;
|
|
568
|
+
a = this.drawX - m + E - s - o, h = this.drawY - p + (g - s) / 2;
|
|
537
569
|
}
|
|
538
570
|
}
|
|
539
571
|
const d = this.ctx.icons.get(this.hoverIconName);
|
|
540
|
-
this.
|
|
572
|
+
this.drawHoverImageX = a, this.drawHoverImageY = h, this.drawHoverImageWidth = s, this.drawHoverImageHeight = s, this.drawHoverImageName = this.hoverIconName, this.drawHoverImageSource = d;
|
|
541
573
|
}
|
|
542
574
|
}
|
|
543
575
|
// 过去跨度配置
|
|
@@ -549,7 +581,7 @@ class ft extends kt {
|
|
|
549
581
|
* @returns
|
|
550
582
|
*/
|
|
551
583
|
getDisplayText() {
|
|
552
|
-
return this.cellType === "footer" ? this.renderFooter || this.text === null || this.text === void 0 ? "" : this.text : this.rowspan === 0 || this.colspan === 0 || this.render || this.type === "index-selection" && (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === this.rowIndex || ["checkbox-disabled", "checkbox-check"].includes(this.
|
|
584
|
+
return this.cellType === "footer" ? this.renderFooter || this.text === null || this.text === void 0 ? "" : this.text : this.rowspan === 0 || this.colspan === 0 || this.render || this.type === "index-selection" && (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === this.rowIndex || ["checkbox-disabled", "checkbox-check"].includes(this.drawSelectionImageName)) || this.text === null || this.text === void 0 ? "" : `${this.text}`;
|
|
553
585
|
}
|
|
554
586
|
/**
|
|
555
587
|
* 获取文本
|
|
@@ -634,8 +666,8 @@ class ft extends kt {
|
|
|
634
666
|
return;
|
|
635
667
|
const { xArr: r, yArr: l } = this.ctx.selector, a = r[1], h = l[1], { colIndex: d, rowIndex: f, drawX: x, drawY: u } = this;
|
|
636
668
|
if (d === a && f === h) {
|
|
637
|
-
const
|
|
638
|
-
this.ctx.paint.drawRect(x + this.width -
|
|
669
|
+
const E = d === this.ctx.maxColIndex || f === this.ctx.maxRowIndex || d === this.ctx.lastCenterColIndex ? 6 : 4;
|
|
670
|
+
this.ctx.paint.drawRect(x + this.width - E, u + this.height - E, 6, 6, {
|
|
639
671
|
borderColor: o,
|
|
640
672
|
fillColor: e
|
|
641
673
|
});
|
|
@@ -659,47 +691,55 @@ class ft extends kt {
|
|
|
659
691
|
return s;
|
|
660
692
|
}
|
|
661
693
|
drawText() {
|
|
662
|
-
const { CELL_PADDING: e, BODY_FONT: i, PLACEHOLDER_COLOR: s } = this.ctx.config
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
return !this.ctx.database.getReadonly(this.rowKey, this.key) && l && ["", null, void 0].includes(this.text) && this.cellType === "body" && !(this.rowspan === 0 || this.colspan === 0) && (a = l, h = s), this.ctx.paint.drawText(a, this.drawTextX, this.drawTextY, o, this.visibleHeight, {
|
|
694
|
+
const { CELL_PADDING: e, BODY_FONT: i, PLACEHOLDER_COLOR: s } = this.ctx.config, { ellipsis: o } = this.ctx.paint.handleEllipsis(
|
|
695
|
+
this.displayText,
|
|
696
|
+
this.drawTextWidth,
|
|
697
|
+
e,
|
|
698
|
+
i
|
|
699
|
+
);
|
|
700
|
+
this.ellipsis = o;
|
|
701
|
+
const { placeholder: r } = this.column;
|
|
702
|
+
let l = this.displayText, a = this.drawTextColor;
|
|
703
|
+
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) && (l = r, a = s), this.ctx.paint.drawText(l, this.drawTextX, this.drawTextY, this.drawTextWidth, this.drawTextHeight, {
|
|
673
704
|
font: i,
|
|
674
705
|
padding: e,
|
|
675
706
|
align: this.align,
|
|
676
707
|
verticalAlign: this.verticalAlign,
|
|
677
|
-
color:
|
|
708
|
+
color: a
|
|
678
709
|
});
|
|
679
710
|
}
|
|
680
711
|
drawImage() {
|
|
681
|
-
if (this.
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
this.
|
|
699
|
-
this.
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
712
|
+
if (this.drawSelectionImageSource && this.ctx.paint.drawImage(
|
|
713
|
+
this.drawSelectionImageSource,
|
|
714
|
+
this.drawSelectionImageX,
|
|
715
|
+
this.drawSelectionImageY,
|
|
716
|
+
this.drawSelectionImageWidth,
|
|
717
|
+
this.drawSelectionImageHeight
|
|
718
|
+
), this.drawTreeImageSource && this.ctx.paint.drawImage(
|
|
719
|
+
this.drawTreeImageSource,
|
|
720
|
+
this.drawTreeImageX,
|
|
721
|
+
this.drawTreeImageY,
|
|
722
|
+
this.drawTreeImageWidth,
|
|
723
|
+
this.drawTreeImageHeight
|
|
724
|
+
), this.drawHoverImageSource) {
|
|
725
|
+
const { CELL_HOVER_ICON_BG_COLOR: e, CELL_HOVER_ICON_BORDER_COLOR: i } = this.ctx.config;
|
|
726
|
+
this.ctx.paint.drawRect(
|
|
727
|
+
this.drawHoverImageX - 2,
|
|
728
|
+
this.drawHoverImageY - 2,
|
|
729
|
+
this.drawHoverImageWidth + 4,
|
|
730
|
+
this.drawHoverImageHeight + 4,
|
|
731
|
+
{
|
|
732
|
+
borderColor: i,
|
|
733
|
+
radius: 4,
|
|
734
|
+
borderWidth: 1,
|
|
735
|
+
fillColor: e
|
|
736
|
+
}
|
|
737
|
+
), this.ctx.paint.drawImage(
|
|
738
|
+
this.drawHoverImageSource,
|
|
739
|
+
this.drawHoverImageX,
|
|
740
|
+
this.drawHoverImageY,
|
|
741
|
+
this.drawHoverImageWidth,
|
|
742
|
+
this.drawHoverImageHeight
|
|
703
743
|
);
|
|
704
744
|
}
|
|
705
745
|
}
|
|
@@ -762,46 +802,46 @@ class ft extends kt {
|
|
|
762
802
|
drawBorder(e) {
|
|
763
803
|
const { drawX: i, drawY: s, rowIndex: o, colIndex: r, height: l, width: a } = this;
|
|
764
804
|
let h = i, d = s;
|
|
765
|
-
const { xArr: f, yArr: x, lineDash: u = [], borderWidth:
|
|
766
|
-
if (r >=
|
|
767
|
-
const C = r ===
|
|
805
|
+
const { xArr: f, yArr: x, lineDash: u = [], borderWidth: w = 1, borderColor: E, fillColor: g } = e, p = f[0], m = f[1], y = x[0], b = x[1];
|
|
806
|
+
if (r >= p && r <= m && o === y) {
|
|
807
|
+
const C = r === m ? 1 : 0, I = r === p ? 1 : 0;
|
|
768
808
|
this.ctx.paint.drawLine([h + I, d + 1, h + a - C, d + 1], {
|
|
769
|
-
borderColor:
|
|
770
|
-
fillColor:
|
|
771
|
-
borderWidth:
|
|
809
|
+
borderColor: E,
|
|
810
|
+
fillColor: g,
|
|
811
|
+
borderWidth: w,
|
|
772
812
|
lineCap: "round",
|
|
773
813
|
lineJoin: "round",
|
|
774
814
|
lineDash: u
|
|
775
815
|
});
|
|
776
816
|
}
|
|
777
|
-
if (r ===
|
|
778
|
-
const C = o ===
|
|
817
|
+
if (r === m && o >= y && o <= b) {
|
|
818
|
+
const C = o === y ? 1 : 0, I = o === b ? 1 : 0;
|
|
779
819
|
this.ctx.paint.drawLine([h + a - 1, d + C, h + a - 1, d + l - I], {
|
|
780
|
-
borderColor:
|
|
781
|
-
fillColor:
|
|
782
|
-
borderWidth:
|
|
820
|
+
borderColor: E,
|
|
821
|
+
fillColor: g,
|
|
822
|
+
borderWidth: w,
|
|
783
823
|
lineCap: "round",
|
|
784
824
|
lineJoin: "round",
|
|
785
825
|
lineDash: u
|
|
786
826
|
});
|
|
787
827
|
}
|
|
788
|
-
if (r >=
|
|
789
|
-
const C = r ===
|
|
828
|
+
if (r >= p && r <= m && o === b) {
|
|
829
|
+
const C = r === m ? 1 : 0, I = r === p ? 1 : 0;
|
|
790
830
|
this.ctx.paint.drawLine([h + I, d + l - 1, h + a - C, d + l - 1], {
|
|
791
|
-
borderColor:
|
|
792
|
-
fillColor:
|
|
793
|
-
borderWidth:
|
|
831
|
+
borderColor: E,
|
|
832
|
+
fillColor: g,
|
|
833
|
+
borderWidth: w,
|
|
794
834
|
lineCap: "round",
|
|
795
835
|
lineJoin: "round",
|
|
796
836
|
lineDash: u
|
|
797
837
|
});
|
|
798
838
|
}
|
|
799
|
-
if (r ===
|
|
800
|
-
const C = o ===
|
|
839
|
+
if (r === p && o >= y && o <= b) {
|
|
840
|
+
const C = o === b ? 1 : 0, I = o === y ? 1 : 0;
|
|
801
841
|
this.ctx.paint.drawLine([h + 1, d + I, h + 1, d + l - C], {
|
|
802
|
-
borderColor:
|
|
803
|
-
fillColor:
|
|
804
|
-
borderWidth:
|
|
842
|
+
borderColor: E,
|
|
843
|
+
fillColor: g,
|
|
844
|
+
borderWidth: w,
|
|
805
845
|
lineCap: "round",
|
|
806
846
|
lineJoin: "round",
|
|
807
847
|
lineDash: u
|
|
@@ -846,7 +886,7 @@ class de {
|
|
|
846
886
|
// 初始化默认不忽略清空改变值和校验map
|
|
847
887
|
init(t = !0) {
|
|
848
888
|
this.clearBufferData(), this.rowKeyMap.clear(), this.checkboxKeyMap.clear(), this.colIndexKeyMap.clear(), this.rowIndexRowKeyMap.clear(), this.rowKeyRowIndexMap.clear();
|
|
849
|
-
const e = this.getColumns(), i =
|
|
889
|
+
const e = this.getColumns(), i = it(e);
|
|
850
890
|
if (this.ctx.hasSelection = i.some((s) => s.type === "selection"), this.ctx.hasTree = i.some((s) => s.type === "tree"), t) {
|
|
851
891
|
this.originalDataMap.clear(), this.changedDataMap.clear(), this.validationErrorMap.clear();
|
|
852
892
|
const { ROW_KEY: s } = this.ctx.config;
|
|
@@ -867,34 +907,34 @@ class de {
|
|
|
867
907
|
*/
|
|
868
908
|
initData(t, e = 0, i = []) {
|
|
869
909
|
t.forEach((s, o) => {
|
|
870
|
-
var
|
|
910
|
+
var p;
|
|
871
911
|
const { ROW_KEY: r = "", DEFAULT_EXPAND_ALL: l, CELL_HEIGHT: a, SELECTABLE_METHOD: h, CHECKBOX_KEY: d } = this.ctx.config, f = s[r], x = f != null ? `${f}` : Lt();
|
|
872
912
|
this.itemRowKeyMap.set(s, x);
|
|
873
|
-
const u = s._height || a,
|
|
874
|
-
let
|
|
875
|
-
if (typeof h == "function" && (
|
|
876
|
-
const
|
|
877
|
-
if (this.checkboxKeyMap.has(
|
|
878
|
-
const
|
|
879
|
-
|
|
913
|
+
const u = s._height || a, w = s._readonly;
|
|
914
|
+
let E = !0;
|
|
915
|
+
if (typeof h == "function" && (E = h), d) {
|
|
916
|
+
const m = s[d];
|
|
917
|
+
if (this.checkboxKeyMap.has(m)) {
|
|
918
|
+
const y = this.checkboxKeyMap.get(m) || [];
|
|
919
|
+
y.push(x), this.checkboxKeyMap.set(m, y);
|
|
880
920
|
} else
|
|
881
|
-
this.checkboxKeyMap.set(
|
|
921
|
+
this.checkboxKeyMap.set(m, [x]);
|
|
882
922
|
}
|
|
883
923
|
this.selectionMap.set(x, {
|
|
884
924
|
key: d ? s[d] : x,
|
|
885
925
|
row: s,
|
|
886
|
-
check: ((
|
|
926
|
+
check: ((p = this.selectionMap.get(x)) == null ? void 0 : p.check) || !1
|
|
887
927
|
});
|
|
888
|
-
const
|
|
889
|
-
this.expandMap.set(x,
|
|
890
|
-
readonly:
|
|
928
|
+
const g = l || this.expandMap.get(x) || s._expand || !1;
|
|
929
|
+
this.expandMap.set(x, g), this.rowKeyMap.set(x, {
|
|
930
|
+
readonly: w,
|
|
891
931
|
index: o,
|
|
892
932
|
rowIndex: o,
|
|
893
933
|
level: e,
|
|
894
934
|
height: u,
|
|
895
935
|
check: !1,
|
|
896
|
-
selectable:
|
|
897
|
-
expand:
|
|
936
|
+
selectable: E,
|
|
937
|
+
expand: g,
|
|
898
938
|
expandLazy: !1,
|
|
899
939
|
hasChildren: s._hasChildren || (Array.isArray(s.children) ? s.children.length > 0 : !1),
|
|
900
940
|
expandLoading: !1,
|
|
@@ -1106,22 +1146,22 @@ class de {
|
|
|
1106
1146
|
let o = [], r = i;
|
|
1107
1147
|
const l = /* @__PURE__ */ new Set();
|
|
1108
1148
|
let a = [], h = t.map((u) => {
|
|
1109
|
-
const { rowKey:
|
|
1110
|
-
let
|
|
1111
|
-
const
|
|
1112
|
-
return (
|
|
1149
|
+
const { rowKey: w, key: E } = u;
|
|
1150
|
+
let g = u.value, p = g;
|
|
1151
|
+
const m = this.getRowDataItemForRowKey(w), y = this.getItemValue(w, E), b = this.getVirtualBodyCellByKey(w, E);
|
|
1152
|
+
return (b == null ? void 0 : b.type) === "number" && (["", void 0, null].includes(g) ? p = null : /^-?\d+(\.\d+)?$/.test(`${g}`) ? p = Number(g) : (p = y, a.push({
|
|
1113
1153
|
...u,
|
|
1114
|
-
value:
|
|
1115
|
-
oldValue:
|
|
1116
|
-
row:
|
|
1154
|
+
value: p,
|
|
1155
|
+
oldValue: y,
|
|
1156
|
+
row: m
|
|
1117
1157
|
}))), {
|
|
1118
1158
|
...u,
|
|
1119
|
-
value:
|
|
1120
|
-
oldValue:
|
|
1121
|
-
row:
|
|
1159
|
+
value: p,
|
|
1160
|
+
oldValue: y,
|
|
1161
|
+
row: m
|
|
1122
1162
|
};
|
|
1123
1163
|
});
|
|
1124
|
-
if (h = h.filter((u) => !a.some((
|
|
1164
|
+
if (h = h.filter((u) => !a.some((w) => u.rowKey === w.rowKey && u.key === w.key)), a.length) {
|
|
1125
1165
|
const u = {
|
|
1126
1166
|
code: "ERR_BATCH_SET_NUMBER_VALUE",
|
|
1127
1167
|
message: "Assignment failed, not a numeric type",
|
|
@@ -1133,19 +1173,19 @@ class de {
|
|
|
1133
1173
|
return;
|
|
1134
1174
|
const { BEFORE_VALUE_CHANGE_METHOD: d } = this.ctx.config;
|
|
1135
1175
|
s === "none" && typeof d == "function" && (h = await d(h), r = !1), h.forEach((u) => {
|
|
1136
|
-
const { value:
|
|
1137
|
-
l.add(
|
|
1138
|
-
rowKey:
|
|
1139
|
-
key:
|
|
1140
|
-
oldValue:
|
|
1141
|
-
newValue:
|
|
1176
|
+
const { value: w, rowKey: E, key: g } = u, p = this.getItemValue(E, g);
|
|
1177
|
+
l.add(E), this.setItemValue(E, g, w, !1, !1, !1, r), o.push({
|
|
1178
|
+
rowKey: E,
|
|
1179
|
+
key: g,
|
|
1180
|
+
oldValue: p,
|
|
1181
|
+
newValue: w
|
|
1142
1182
|
});
|
|
1143
1183
|
});
|
|
1144
1184
|
let f = [];
|
|
1145
1185
|
l.forEach((u) => {
|
|
1146
1186
|
f.push(this.ctx.database.getRowDataItemForRowKey(u));
|
|
1147
1187
|
});
|
|
1148
|
-
const x = h.map(({ rowKey: u, key:
|
|
1188
|
+
const x = h.map(({ rowKey: u, key: w }) => this.getValidator(u, w));
|
|
1149
1189
|
Promise.all(x).then(() => {
|
|
1150
1190
|
this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
|
|
1151
1191
|
}), this.ctx.emit("change", h, f), e && this.ctx.history.pushState({
|
|
@@ -1181,15 +1221,15 @@ class de {
|
|
|
1181
1221
|
this.originalDataMap.has(f) || this.originalDataMap.set(f, h);
|
|
1182
1222
|
const x = this.originalDataMap.get(f), u = this.getRowDataItemForRowKey(t);
|
|
1183
1223
|
if (r) {
|
|
1184
|
-
const
|
|
1185
|
-
if ((
|
|
1224
|
+
const w = this.getVirtualBodyCellByKey(t, e);
|
|
1225
|
+
if ((w == null ? void 0 : w.type) === "number")
|
|
1186
1226
|
if (["", void 0, null].includes(i))
|
|
1187
1227
|
d = null;
|
|
1188
1228
|
else if (/^-?\d+(\.\d+)?$/.test(`${i}`))
|
|
1189
1229
|
d = Number(i);
|
|
1190
1230
|
else {
|
|
1191
1231
|
d = h;
|
|
1192
|
-
const
|
|
1232
|
+
const g = {
|
|
1193
1233
|
code: "ERR_SET_NUMBER_VALUE",
|
|
1194
1234
|
message: "Assignment failed, not a numeric type",
|
|
1195
1235
|
data: [
|
|
@@ -1202,14 +1242,14 @@ class de {
|
|
|
1202
1242
|
}
|
|
1203
1243
|
]
|
|
1204
1244
|
};
|
|
1205
|
-
this.ctx.emit("error",
|
|
1245
|
+
this.ctx.emit("error", g);
|
|
1206
1246
|
}
|
|
1207
1247
|
if (d === h)
|
|
1208
1248
|
return {
|
|
1209
1249
|
oldValue: h,
|
|
1210
1250
|
newValue: h
|
|
1211
1251
|
};
|
|
1212
|
-
let
|
|
1252
|
+
let E = [
|
|
1213
1253
|
{
|
|
1214
1254
|
rowKey: t,
|
|
1215
1255
|
key: e,
|
|
@@ -1218,7 +1258,7 @@ class de {
|
|
|
1218
1258
|
row: u
|
|
1219
1259
|
}
|
|
1220
1260
|
];
|
|
1221
|
-
this.batchSetItemValue(
|
|
1261
|
+
this.batchSetItemValue(E, s, !1), this.ctx.emit("editChange", {
|
|
1222
1262
|
rowKey: t,
|
|
1223
1263
|
key: e,
|
|
1224
1264
|
oldValue: h,
|
|
@@ -1272,13 +1312,49 @@ class de {
|
|
|
1272
1312
|
* 根据rowKey 取反选中
|
|
1273
1313
|
* @param rowKey
|
|
1274
1314
|
*/
|
|
1275
|
-
toggleRowSelection(t) {
|
|
1276
|
-
const
|
|
1277
|
-
if (!
|
|
1315
|
+
toggleRowSelection(t, e) {
|
|
1316
|
+
const i = this.rowKeyMap.get(t), s = this.selectionMap.get(t);
|
|
1317
|
+
if (!s)
|
|
1318
|
+
return;
|
|
1319
|
+
e === "selection-tree" || e === "tree-selection" ? this.toggleTreeSelection(t) : (s.check = !s.check, this.setRowSelectionByCheckboxKey(t, s.check)), this.ctx.emit("toggleRowSelection", i);
|
|
1320
|
+
const o = this.getSelectionRows();
|
|
1321
|
+
this.ctx.emit("selectionChange", o), this.bufferCheckState.buffer = !1, this.ctx.emit("draw");
|
|
1322
|
+
}
|
|
1323
|
+
// 切换树形选择状态
|
|
1324
|
+
toggleTreeSelection(t) {
|
|
1325
|
+
const e = this.getTreeSelectionState(t), i = this.ctx.config.TREE_SELECT_MODE;
|
|
1326
|
+
if (i === "auto")
|
|
1327
|
+
e.checked && !e.indeterminate ? (this.setRowSelection(t, !1, !1), this.clearTreeSelectionRecursive(t)) : (this.setRowSelection(t, !0, !1), this.selectTreeSelectionRecursive(t));
|
|
1328
|
+
else if (i === "cautious")
|
|
1329
|
+
e.checked && !e.indeterminate ? (this.setRowSelection(t, !1, !1), this.clearTreeSelectionRecursive(t)) : (this.setRowSelection(t, !0, !1), this.selectTreeSelectionRecursive(t));
|
|
1330
|
+
else if (i === "strictly") {
|
|
1331
|
+
const s = this.selectionMap.get(t);
|
|
1332
|
+
s && (s.check = !s.check, this.setRowSelectionByCheckboxKey(t, s.check));
|
|
1333
|
+
}
|
|
1334
|
+
this.ctx.emit("selectionChange", this.getSelectionRows()), this.ctx.emit("draw");
|
|
1335
|
+
}
|
|
1336
|
+
// 递归选中树形选择
|
|
1337
|
+
selectTreeSelectionRecursive(t) {
|
|
1338
|
+
this.getTreeChildren(t).forEach((i) => {
|
|
1339
|
+
this.setRowSelection(i, !0, !1), this.selectTreeSelectionRecursive(i);
|
|
1340
|
+
});
|
|
1341
|
+
}
|
|
1342
|
+
// 递归取消树形选择
|
|
1343
|
+
clearTreeSelectionRecursive(t) {
|
|
1344
|
+
this.getTreeChildren(t).forEach((i) => {
|
|
1345
|
+
this.setRowSelection(i, !1, !1), this.clearTreeSelectionRecursive(i);
|
|
1346
|
+
});
|
|
1347
|
+
}
|
|
1348
|
+
// 向上递归更新父项状态
|
|
1349
|
+
updateParentTreeSelection(t) {
|
|
1350
|
+
const e = this.getTreeParent(t);
|
|
1351
|
+
if (!e)
|
|
1278
1352
|
return;
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
this.ctx.
|
|
1353
|
+
const s = this.getTreeChildren(e).map((h) => this.selectionMap.get(h)), o = s.filter((h) => h == null ? void 0 : h.check).length, r = s.length;
|
|
1354
|
+
let l = !1;
|
|
1355
|
+
r > 0 && (o === 0 ? l = !1 : o === r || this.ctx.config.TREE_SELECT_MODE === "auto" ? l = !0 : this.ctx.config.TREE_SELECT_MODE === "cautious" && (l = !1));
|
|
1356
|
+
const a = this.selectionMap.get(e);
|
|
1357
|
+
a && a.check !== l && (a.check = l, this.setRowSelectionByCheckboxKey(e, l), this.updateParentTreeSelection(e));
|
|
1282
1358
|
}
|
|
1283
1359
|
/**
|
|
1284
1360
|
* 根据rowKey 设置选中状态
|
|
@@ -1286,7 +1362,7 @@ class de {
|
|
|
1286
1362
|
*/
|
|
1287
1363
|
setRowSelection(t, e, i = !0) {
|
|
1288
1364
|
const s = this.selectionMap.get(t);
|
|
1289
|
-
s && (s.check = e, this.setRowSelectionByCheckboxKey(t, s.check), this.ctx.emit("setRowSelection", e, s.row), i && (this.bufferCheckState.buffer = !1, this.ctx.emit("draw")));
|
|
1365
|
+
s && (s.check = e, this.setRowSelectionByCheckboxKey(t, s.check), this.ctx.emit("setRowSelection", e, s.row), (this.ctx.config.TREE_SELECT_MODE === "auto" || this.ctx.config.TREE_SELECT_MODE === "cautious") && this.updateParentTreeSelection(t), i && (this.bufferCheckState.buffer = !1, this.ctx.emit("draw")));
|
|
1290
1366
|
}
|
|
1291
1367
|
getSelectionRows() {
|
|
1292
1368
|
let t = [];
|
|
@@ -1302,6 +1378,66 @@ class de {
|
|
|
1302
1378
|
const e = this.selectionMap.get(t);
|
|
1303
1379
|
return e ? e.check : !1;
|
|
1304
1380
|
}
|
|
1381
|
+
// 获取树形选择状态
|
|
1382
|
+
getTreeSelectionState(t) {
|
|
1383
|
+
if (!this.getRowForRowKey(t))
|
|
1384
|
+
return { checked: !1, indeterminate: !1 };
|
|
1385
|
+
const i = this.selectionMap.get(t), s = (i == null ? void 0 : i.check) || !1;
|
|
1386
|
+
if (this.getTreeChildren(t).length === 0)
|
|
1387
|
+
return { checked: s, indeterminate: !1 };
|
|
1388
|
+
let r = !1, l = s;
|
|
1389
|
+
if (this.ctx.config.TREE_SELECT_MODE === "auto") {
|
|
1390
|
+
const h = (g) => {
|
|
1391
|
+
const p = this.getTreeChildren(g);
|
|
1392
|
+
let m = [];
|
|
1393
|
+
for (const y of p)
|
|
1394
|
+
m.push(y), m.push(...h(y));
|
|
1395
|
+
return m;
|
|
1396
|
+
}, f = h(t).map((g) => this.selectionMap.get(g)), x = f.filter((g) => g == null ? void 0 : g.check).length, u = f.length, w = x > 0;
|
|
1397
|
+
r = w && !(x === u), l = s || w, s && u > 0 && x === 0 && (l = !1, r = !1);
|
|
1398
|
+
} else if (this.ctx.config.TREE_SELECT_MODE === "cautious") {
|
|
1399
|
+
const h = (g) => {
|
|
1400
|
+
const p = this.getTreeChildren(g);
|
|
1401
|
+
let m = [];
|
|
1402
|
+
for (const y of p)
|
|
1403
|
+
m.push(y), m.push(...h(y));
|
|
1404
|
+
return m;
|
|
1405
|
+
}, f = h(t).map((g) => this.selectionMap.get(g)), x = f.filter((g) => g == null ? void 0 : g.check).length, u = f.length, w = x > 0, E = x === u;
|
|
1406
|
+
r = w && !E, l = s || E, s && u > 0 && x === 0 && (l = !1, r = !1);
|
|
1407
|
+
} else this.ctx.config.TREE_SELECT_MODE === "strictly" && (r = !1, l = s);
|
|
1408
|
+
return { checked: l, indeterminate: r };
|
|
1409
|
+
}
|
|
1410
|
+
// 获取树形子节点
|
|
1411
|
+
getTreeChildren(t) {
|
|
1412
|
+
const e = this.getRowForRowKey(t);
|
|
1413
|
+
if (!e || !e.item || !e.item.children)
|
|
1414
|
+
return [];
|
|
1415
|
+
const i = [], s = (o) => {
|
|
1416
|
+
for (const r of o) {
|
|
1417
|
+
const l = this.getRowKeyByItem(r);
|
|
1418
|
+
l && i.push(l), r.children && r.children.length > 0 && s(r.children);
|
|
1419
|
+
}
|
|
1420
|
+
};
|
|
1421
|
+
return s(e.item.children), i;
|
|
1422
|
+
}
|
|
1423
|
+
// 获取树形父节点
|
|
1424
|
+
getTreeParent(t) {
|
|
1425
|
+
const e = (i, s) => {
|
|
1426
|
+
for (const o of i) {
|
|
1427
|
+
const r = this.getRowKeyByItem(o);
|
|
1428
|
+
if (o.children)
|
|
1429
|
+
for (const l of o.children) {
|
|
1430
|
+
if (this.getRowKeyByItem(l) === s)
|
|
1431
|
+
return r;
|
|
1432
|
+
const h = e(o.children, s);
|
|
1433
|
+
if (h)
|
|
1434
|
+
return h;
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
return null;
|
|
1438
|
+
};
|
|
1439
|
+
return e(this.data, t);
|
|
1440
|
+
}
|
|
1305
1441
|
/**
|
|
1306
1442
|
* 根据rowKey 获取选中状态
|
|
1307
1443
|
* @param rowKey
|
|
@@ -1318,32 +1454,45 @@ class de {
|
|
|
1318
1454
|
* @param rowKey
|
|
1319
1455
|
*/
|
|
1320
1456
|
toggleAllSelection() {
|
|
1321
|
-
this.rowKeyMap.forEach((
|
|
1322
|
-
let
|
|
1323
|
-
typeof
|
|
1324
|
-
row:
|
|
1325
|
-
rowIndex:
|
|
1326
|
-
})),
|
|
1457
|
+
this.ctx.config.TREE_SELECT_MODE === "auto" || this.ctx.config.TREE_SELECT_MODE === "cautious" ? this.rowKeyMap.forEach((i, s) => {
|
|
1458
|
+
let o = i.selectable;
|
|
1459
|
+
if (typeof o == "function" && (o = o({
|
|
1460
|
+
row: i.item,
|
|
1461
|
+
rowIndex: i.rowIndex
|
|
1462
|
+
})), o) {
|
|
1463
|
+
const r = this.selectionMap.get(s);
|
|
1464
|
+
r && (r.check = !0, this.setRowSelectionByCheckboxKey(s, !0));
|
|
1465
|
+
}
|
|
1466
|
+
}) : this.rowKeyMap.forEach((i, s) => {
|
|
1467
|
+
let o = i.selectable;
|
|
1468
|
+
typeof o == "function" && (o = o({
|
|
1469
|
+
row: i.item,
|
|
1470
|
+
rowIndex: i.rowIndex
|
|
1471
|
+
})), o && this.setRowSelection(s, !0, !1);
|
|
1327
1472
|
});
|
|
1328
|
-
const
|
|
1329
|
-
this.ctx.emit("toggleAllSelection",
|
|
1473
|
+
const e = this.getSelectionRows();
|
|
1474
|
+
this.ctx.emit("toggleAllSelection", e), this.ctx.emit("selectionChange", e), this.bufferCheckState.buffer = !1, this.ctx.emit("draw");
|
|
1330
1475
|
}
|
|
1331
1476
|
/**
|
|
1332
1477
|
* 清除选中
|
|
1333
1478
|
* @param rowKey
|
|
1334
1479
|
*/
|
|
1335
1480
|
clearSelection(t = !1) {
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
this.
|
|
1481
|
+
const e = this.ctx.config.TREE_SELECT_MODE === "auto" || this.ctx.config.TREE_SELECT_MODE === "cautious";
|
|
1482
|
+
t ? e ? this.rowKeyMap.forEach((s, o) => {
|
|
1483
|
+
const r = this.selectionMap.get(o);
|
|
1484
|
+
r && (r.check = !1, this.setRowSelectionByCheckboxKey(o, !1));
|
|
1485
|
+
}) : this.rowKeyMap.forEach((s, o) => {
|
|
1486
|
+
this.setRowSelection(o, !1, !1);
|
|
1487
|
+
}) : (this.selectionMap.clear(), this.rowKeyMap.forEach((s, o) => {
|
|
1488
|
+
this.selectionMap.set(o, {
|
|
1340
1489
|
check: !1,
|
|
1341
|
-
row:
|
|
1342
|
-
key:
|
|
1490
|
+
row: s.item,
|
|
1491
|
+
key: o
|
|
1343
1492
|
});
|
|
1344
1493
|
}));
|
|
1345
|
-
const
|
|
1346
|
-
this.ctx.emit("clearSelection"), this.ctx.emit("selectionChange",
|
|
1494
|
+
const i = this.getSelectionRows();
|
|
1495
|
+
this.ctx.emit("clearSelection"), this.ctx.emit("selectionChange", i), this.bufferCheckState.buffer = !1, this.ctx.emit("draw");
|
|
1347
1496
|
}
|
|
1348
1497
|
/**
|
|
1349
1498
|
* 获取选中状态,表头用
|
|
@@ -1357,13 +1506,13 @@ class de {
|
|
|
1357
1506
|
let s = 0, o = 0;
|
|
1358
1507
|
const r = this.selectionMap.size, l = Array.from(this.selectionMap.values()).some((x) => x.check);
|
|
1359
1508
|
this.rowKeyMap.forEach((x, u) => {
|
|
1360
|
-
var
|
|
1361
|
-
(
|
|
1362
|
-
let
|
|
1363
|
-
typeof
|
|
1509
|
+
var E;
|
|
1510
|
+
(E = this.selectionMap.get(u)) != null && E.check && (s += 1);
|
|
1511
|
+
let w = x.selectable;
|
|
1512
|
+
typeof w == "function" && (w = w({
|
|
1364
1513
|
row: x.item,
|
|
1365
1514
|
rowIndex: x.rowIndex
|
|
1366
|
-
})),
|
|
1515
|
+
})), w && (o += 1);
|
|
1367
1516
|
});
|
|
1368
1517
|
const a = r > i && s === 0 && l, h = o && o > s && s > 0 || a, d = o !== 0, f = !!o && o === s;
|
|
1369
1518
|
return this.bufferCheckState = {
|
|
@@ -1540,8 +1689,8 @@ class de {
|
|
|
1540
1689
|
height: f,
|
|
1541
1690
|
width: x,
|
|
1542
1691
|
colspan: u,
|
|
1543
|
-
mergeRow:
|
|
1544
|
-
mergeCol:
|
|
1692
|
+
mergeRow: w,
|
|
1693
|
+
mergeCol: E
|
|
1545
1694
|
} = t;
|
|
1546
1695
|
if (d === 1 && u === 1)
|
|
1547
1696
|
return {
|
|
@@ -1562,99 +1711,99 @@ class de {
|
|
|
1562
1711
|
}
|
|
1563
1712
|
]
|
|
1564
1713
|
};
|
|
1565
|
-
let
|
|
1566
|
-
if (d !== 1 &&
|
|
1567
|
-
|
|
1568
|
-
const v = a.reduce((
|
|
1569
|
-
const
|
|
1570
|
-
return `${
|
|
1714
|
+
let g = e, p = e, m = l, y = l, b = [], C = 0, I = 0, _ = 0, T = 0;
|
|
1715
|
+
if (d !== 1 && w) {
|
|
1716
|
+
T = x;
|
|
1717
|
+
const v = a.reduce((R, S) => {
|
|
1718
|
+
const O = this.getItemValue(s, S) ?? "";
|
|
1719
|
+
return `${R}${O}`;
|
|
1571
1720
|
}, "");
|
|
1572
|
-
for (let
|
|
1573
|
-
const
|
|
1574
|
-
const H = this.getItemValue(
|
|
1721
|
+
for (let R = e - 1; R >= 0; R--) {
|
|
1722
|
+
const S = this.rowIndexRowKeyMap.get(R) || "", O = a.reduce((M, L) => {
|
|
1723
|
+
const H = this.getItemValue(S, L) ?? "";
|
|
1575
1724
|
return `${M}${H}`;
|
|
1576
1725
|
}, "");
|
|
1577
|
-
if (v ===
|
|
1578
|
-
|
|
1726
|
+
if (v === O)
|
|
1727
|
+
g = R;
|
|
1579
1728
|
else
|
|
1580
1729
|
break;
|
|
1581
1730
|
}
|
|
1582
|
-
for (let
|
|
1583
|
-
const
|
|
1584
|
-
const H = this.getItemValue(
|
|
1731
|
+
for (let R = e; R <= this.ctx.maxRowIndex; R++) {
|
|
1732
|
+
const S = this.rowIndexRowKeyMap.get(R) || "", O = a.reduce((M, L) => {
|
|
1733
|
+
const H = this.getItemValue(S, L) ?? "";
|
|
1585
1734
|
return `${M}${H}`;
|
|
1586
1735
|
}, "");
|
|
1587
|
-
if (v ===
|
|
1588
|
-
|
|
1736
|
+
if (v === O)
|
|
1737
|
+
p = R;
|
|
1589
1738
|
else
|
|
1590
1739
|
break;
|
|
1591
1740
|
}
|
|
1592
|
-
for (let
|
|
1593
|
-
const { height:
|
|
1594
|
-
C +=
|
|
1741
|
+
for (let R = g; R < e; R++) {
|
|
1742
|
+
const { height: S } = this.positions[R];
|
|
1743
|
+
C += S;
|
|
1595
1744
|
}
|
|
1596
|
-
for (let
|
|
1597
|
-
const { height:
|
|
1598
|
-
_ +=
|
|
1599
|
-
const
|
|
1600
|
-
|
|
1601
|
-
rowKey:
|
|
1745
|
+
for (let R = g; R <= p; R++) {
|
|
1746
|
+
const { height: S } = this.positions[R];
|
|
1747
|
+
_ += S;
|
|
1748
|
+
const O = this.rowIndexRowKeyMap.get(R) || "", { item: M } = this.rowKeyMap.get(O), L = this.getItemValue(O, i);
|
|
1749
|
+
b.push({
|
|
1750
|
+
rowKey: O,
|
|
1602
1751
|
key: i,
|
|
1603
|
-
value:
|
|
1752
|
+
value: L,
|
|
1604
1753
|
row: M
|
|
1605
1754
|
});
|
|
1606
1755
|
}
|
|
1607
1756
|
}
|
|
1608
|
-
if (u !== 1 &&
|
|
1757
|
+
if (u !== 1 && E) {
|
|
1609
1758
|
_ = f;
|
|
1610
1759
|
for (let v = l - 1; v >= 0; v--) {
|
|
1611
|
-
const
|
|
1612
|
-
if (!
|
|
1760
|
+
const R = this.getColumnByColIndex(v);
|
|
1761
|
+
if (!R)
|
|
1613
1762
|
break;
|
|
1614
|
-
const
|
|
1615
|
-
if (
|
|
1616
|
-
|
|
1763
|
+
const S = this.getItemValue(s, i), O = this.getItemValue(s, R.key);
|
|
1764
|
+
if (S === O && h.includes(R.key))
|
|
1765
|
+
m = v;
|
|
1617
1766
|
else
|
|
1618
1767
|
break;
|
|
1619
1768
|
}
|
|
1620
1769
|
for (let v = l; v <= this.ctx.maxColIndex; v++) {
|
|
1621
|
-
const
|
|
1622
|
-
if (!
|
|
1770
|
+
const R = this.getColumnByColIndex(v);
|
|
1771
|
+
if (!R)
|
|
1623
1772
|
break;
|
|
1624
|
-
const
|
|
1625
|
-
if (
|
|
1626
|
-
|
|
1773
|
+
const S = this.getItemValue(s, i), O = this.getItemValue(s, R.key);
|
|
1774
|
+
if (S === O && h.includes(R.key))
|
|
1775
|
+
y = v;
|
|
1627
1776
|
else
|
|
1628
1777
|
break;
|
|
1629
1778
|
}
|
|
1630
|
-
for (let v =
|
|
1631
|
-
const
|
|
1632
|
-
if (!
|
|
1779
|
+
for (let v = m; v < l; v++) {
|
|
1780
|
+
const R = this.getColumnByColIndex(v);
|
|
1781
|
+
if (!R)
|
|
1633
1782
|
break;
|
|
1634
|
-
I +=
|
|
1783
|
+
I += R.width || 100;
|
|
1635
1784
|
}
|
|
1636
|
-
for (let v =
|
|
1637
|
-
const
|
|
1638
|
-
if (!
|
|
1785
|
+
for (let v = m; v <= y; v++) {
|
|
1786
|
+
const R = this.getColumnByColIndex(v);
|
|
1787
|
+
if (!R)
|
|
1639
1788
|
break;
|
|
1640
|
-
|
|
1789
|
+
T += R.width || 100, b.push({
|
|
1641
1790
|
rowKey: s,
|
|
1642
|
-
key:
|
|
1643
|
-
value: this.getItemValue(s,
|
|
1791
|
+
key: R.key,
|
|
1792
|
+
value: this.getItemValue(s, R.key),
|
|
1644
1793
|
row: o
|
|
1645
1794
|
});
|
|
1646
1795
|
}
|
|
1647
1796
|
}
|
|
1648
1797
|
return {
|
|
1649
|
-
xArr: [
|
|
1650
|
-
yArr: [
|
|
1798
|
+
xArr: [m, y],
|
|
1799
|
+
yArr: [g, p],
|
|
1651
1800
|
rowspan: d,
|
|
1652
1801
|
colspan: u,
|
|
1653
1802
|
height: _,
|
|
1654
|
-
width:
|
|
1803
|
+
width: T,
|
|
1655
1804
|
offsetTop: C,
|
|
1656
1805
|
offsetLeft: I,
|
|
1657
|
-
dataList:
|
|
1806
|
+
dataList: b
|
|
1658
1807
|
};
|
|
1659
1808
|
}
|
|
1660
1809
|
setLoading(t) {
|
|
@@ -1698,7 +1847,7 @@ class de {
|
|
|
1698
1847
|
// 获取虚拟单元格,只针对可见的
|
|
1699
1848
|
getVirtualBodyCell(t, e) {
|
|
1700
1849
|
const i = this.getColumnByColIndex(e), s = this.getRowForRowIndex(t);
|
|
1701
|
-
return !i || !s ? void 0 : new
|
|
1850
|
+
return !i || !s ? void 0 : new $(this.ctx, t, e, 0, 0, 0, 0, i, s.item, "body");
|
|
1702
1851
|
}
|
|
1703
1852
|
getVirtualBodyCellByKey(t, e) {
|
|
1704
1853
|
const i = this.getRowIndexForRowKey(t), s = this.getColIndexForKey(e);
|
|
@@ -1717,6 +1866,21 @@ class de {
|
|
|
1717
1866
|
}
|
|
1718
1867
|
return i;
|
|
1719
1868
|
}
|
|
1869
|
+
/**
|
|
1870
|
+
* 计算树形数据的最大深度
|
|
1871
|
+
* @param data 树形数据
|
|
1872
|
+
* @param currentDepth 当前深度
|
|
1873
|
+
* @returns 最大深度
|
|
1874
|
+
*/
|
|
1875
|
+
calculateMaxTreeDepth(t, e = 0) {
|
|
1876
|
+
let i = e;
|
|
1877
|
+
return t.forEach((s) => {
|
|
1878
|
+
if (Array.isArray(s.children) && s.children.length > 0) {
|
|
1879
|
+
const o = this.calculateMaxTreeDepth(s.children, e + 1);
|
|
1880
|
+
i = Math.max(i, o);
|
|
1881
|
+
}
|
|
1882
|
+
}), i;
|
|
1883
|
+
}
|
|
1720
1884
|
}
|
|
1721
1885
|
class fe {
|
|
1722
1886
|
constructor(t) {
|
|
@@ -1991,8 +2155,8 @@ class ge {
|
|
|
1991
2155
|
f === "top" ? x = i + d : f === "bottom" ? x = i + o - d : x = i + (o + 1) / 2;
|
|
1992
2156
|
let u = 0;
|
|
1993
2157
|
a === "left" ? u = e + d : a === "right" ? u = e + s - d : u = e + s / 2;
|
|
1994
|
-
const { _text:
|
|
1995
|
-
return this.ctx.fillText(
|
|
2158
|
+
const { _text: w, ellipsis: E } = this.handleEllipsis(t, s, d, l);
|
|
2159
|
+
return this.ctx.fillText(w, u, x), this.ctx.restore(), E;
|
|
1996
2160
|
}
|
|
1997
2161
|
handleEllipsis(t, e, i = 0, s = "12px Arial") {
|
|
1998
2162
|
let o = !1, r = t;
|
|
@@ -2001,7 +2165,13 @@ class ge {
|
|
|
2001
2165
|
_text: "",
|
|
2002
2166
|
ellipsis: o
|
|
2003
2167
|
};
|
|
2004
|
-
const l = this.ctx.measureText("...").width
|
|
2168
|
+
const l = this.ctx.measureText("...").width;
|
|
2169
|
+
if (e <= l + i * 2)
|
|
2170
|
+
return {
|
|
2171
|
+
_text: "",
|
|
2172
|
+
ellipsis: !0
|
|
2173
|
+
};
|
|
2174
|
+
const a = this.ctx.measureText(t).width;
|
|
2005
2175
|
if (a && a + l >= e - i * 2) {
|
|
2006
2176
|
o = !0;
|
|
2007
2177
|
let h = 0;
|
|
@@ -2017,7 +2187,7 @@ class ge {
|
|
|
2017
2187
|
};
|
|
2018
2188
|
}
|
|
2019
2189
|
}
|
|
2020
|
-
class
|
|
2190
|
+
class Ct {
|
|
2021
2191
|
constructor(t) {
|
|
2022
2192
|
n(this, "_config", {});
|
|
2023
2193
|
/** CSS 类名前缀 */
|
|
@@ -2088,6 +2258,10 @@ class yt {
|
|
|
2088
2258
|
n(this, "ERROR_TIP_ICON_COLOR", "red");
|
|
2089
2259
|
/** 错误提示图标大小 */
|
|
2090
2260
|
n(this, "ERROR_TIP_ICON_SIZE", 6);
|
|
2261
|
+
/** 所有列对齐方式 */
|
|
2262
|
+
n(this, "COLUMNS_ALIGN", "left");
|
|
2263
|
+
/** 所有列垂直对齐方式 */
|
|
2264
|
+
n(this, "COLUMNS_VERTICAL_ALIGN", "middle");
|
|
2091
2265
|
/** 是否开启懒加载 */
|
|
2092
2266
|
n(this, "EXPAND_LAZY", !0);
|
|
2093
2267
|
/** 默认展开全部 */
|
|
@@ -2154,6 +2328,12 @@ class yt {
|
|
|
2154
2328
|
n(this, "CELL_FOOTER_HEIGHT", 36);
|
|
2155
2329
|
/** 启用选择器 */
|
|
2156
2330
|
n(this, "ENABLE_SELECTOR", !0);
|
|
2331
|
+
/** 树形选择模式 */
|
|
2332
|
+
n(this, "TREE_SELECT_MODE", "auto");
|
|
2333
|
+
/** 树形缩进宽度 */
|
|
2334
|
+
n(this, "TREE_INDENT", 20);
|
|
2335
|
+
/** 树形图标大小 */
|
|
2336
|
+
n(this, "TREE_ICON_SIZE", 20);
|
|
2157
2337
|
/** 启用单点击立马编辑 */
|
|
2158
2338
|
n(this, "ENABLE_EDIT_SINGLE_CLICK", !1);
|
|
2159
2339
|
/** 启用点击选择器编辑 */
|
|
@@ -2292,7 +2472,7 @@ class yt {
|
|
|
2292
2472
|
}), Object.assign(this, t, this._config);
|
|
2293
2473
|
}
|
|
2294
2474
|
}
|
|
2295
|
-
const
|
|
2475
|
+
const bt = '<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>';
|
|
2296
2476
|
class we {
|
|
2297
2477
|
constructor(t) {
|
|
2298
2478
|
n(this, "ctx");
|
|
@@ -2315,7 +2495,7 @@ class we {
|
|
|
2315
2495
|
name: "shrink",
|
|
2316
2496
|
configName: "CHECKBOX_UNCHECK_SVG",
|
|
2317
2497
|
configColorName: "SHRINK_ICON_COLOR",
|
|
2318
|
-
svg:
|
|
2498
|
+
svg: bt,
|
|
2319
2499
|
color: "#4E5969"
|
|
2320
2500
|
},
|
|
2321
2501
|
{
|
|
@@ -2367,7 +2547,7 @@ class we {
|
|
|
2367
2547
|
name: "icon-select",
|
|
2368
2548
|
configName: "CHECKBOX_UNCHECK_SVG",
|
|
2369
2549
|
configColorName: "SHRINK_ICON_COLOR",
|
|
2370
|
-
svg:
|
|
2550
|
+
svg: bt,
|
|
2371
2551
|
color: "#4E5969"
|
|
2372
2552
|
}
|
|
2373
2553
|
]);
|
|
@@ -2426,10 +2606,11 @@ class we {
|
|
|
2426
2606
|
return this.icons.get(t);
|
|
2427
2607
|
}
|
|
2428
2608
|
}
|
|
2429
|
-
class
|
|
2609
|
+
class ct extends Xt {
|
|
2430
2610
|
constructor(e, i, s, o, r, l, a) {
|
|
2431
2611
|
super(e, s, o, r, l, "header", a.fixed);
|
|
2432
2612
|
n(this, "align");
|
|
2613
|
+
n(this, "hideHeaderSelection", !1);
|
|
2433
2614
|
n(this, "verticalAlign", "middle");
|
|
2434
2615
|
n(this, "fixed");
|
|
2435
2616
|
n(this, "minWidth");
|
|
@@ -2461,15 +2642,19 @@ class Xt extends kt {
|
|
|
2461
2642
|
n(this, "drawY", 0);
|
|
2462
2643
|
n(this, "visibleWidth", 0);
|
|
2463
2644
|
n(this, "visibleHeight", 0);
|
|
2645
|
+
n(this, "drawTextX", 0);
|
|
2646
|
+
n(this, "drawTextY", 0);
|
|
2647
|
+
n(this, "drawTextWidth", 0);
|
|
2648
|
+
n(this, "drawTextHeight", 0);
|
|
2464
2649
|
n(this, "drawCellBgColor", "");
|
|
2465
2650
|
n(this, "drawTextColor", "");
|
|
2466
|
-
n(this, "
|
|
2467
|
-
n(this, "
|
|
2468
|
-
n(this, "
|
|
2469
|
-
n(this, "
|
|
2470
|
-
n(this, "
|
|
2471
|
-
n(this, "
|
|
2472
|
-
this.ctx = e, this.x = s, this.y = o, this.width = r, this.height = l, this.visibleWidth = r, this.visibleHeight = l, this.colIndex = i, this.key = a.key, this.minWidth = a.minWidth, this.maxWidth = a.maxWidth, this.type = a.type || "", this.editorType = a.editorType || "text", this.align = a.align ||
|
|
2651
|
+
n(this, "drawSelectionImageX", 0);
|
|
2652
|
+
n(this, "drawSelectionImageY", 0);
|
|
2653
|
+
n(this, "drawSelectionImageWidth", 0);
|
|
2654
|
+
n(this, "drawSelectionImageHeight", 0);
|
|
2655
|
+
n(this, "drawSelectionImageName", "");
|
|
2656
|
+
n(this, "drawSelectionImageSource");
|
|
2657
|
+
this.ctx = e, this.x = s, this.y = o, this.width = r, this.height = l, this.visibleWidth = r, this.visibleHeight = l, this.colIndex = i, this.key = a.key, this.minWidth = a.minWidth, this.maxWidth = a.maxWidth, this.type = a.type || "", this.editorType = a.editorType || "text", this.hideHeaderSelection = a.hideHeaderSelection || !1, this.align = a.headerAlign || a.align || this.ctx.config.COLUMNS_ALIGN, this.verticalAlign = a.headerVerticalAlign || a.verticalAlign || this.ctx.config.COLUMNS_VERTICAL_ALIGN, this.fixed = a.fixed, this.level = a.level || 0, this.operation = a.operation || !1, this.text = a.title, this.column = a, this.colspan = a.colspan || 1, this.widthFillDisable = a.widthFillDisable || !1, this.rowspan = a.rowspan || 1, this.rules = a.rules, this.readonly = a.readonly || !1, this.required = a.required || !1, this.rowKey = Lt(), this.overflowTooltipShow = a.overflowTooltipHeaderShow !== !1, this.hasChildren = a.children && a.children.length > 0 || !1, this.render = a.renderHeader;
|
|
2473
2658
|
}
|
|
2474
2659
|
/**
|
|
2475
2660
|
* 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
|
|
@@ -2498,23 +2683,37 @@ class Xt extends kt {
|
|
|
2498
2683
|
this.drawCellBgColor = o, this.drawTextColor = r;
|
|
2499
2684
|
}
|
|
2500
2685
|
update() {
|
|
2501
|
-
this.updateContainer(), this.displayText = this.getText(), this.drawX = this.getDrawX(), this.drawY = this.getDrawY(), this.updateStyle();
|
|
2686
|
+
this.updateContainer(), this.displayText = this.getText(), this.drawX = this.getDrawX(), this.drawY = this.getDrawY(), this.drawTextX = this.drawX, this.drawTextY = this.drawY, this.drawTextWidth = this.width, this.drawTextHeight = this.height, this.updateStyle();
|
|
2502
2687
|
}
|
|
2503
2688
|
draw() {
|
|
2504
2689
|
const {
|
|
2505
2690
|
paint: e,
|
|
2506
|
-
config: { BORDER_COLOR: i,
|
|
2507
|
-
} = this.ctx, { drawX:
|
|
2508
|
-
e.drawRect(
|
|
2509
|
-
borderColor:
|
|
2691
|
+
config: { BORDER_COLOR: i, BORDER: s }
|
|
2692
|
+
} = this.ctx, { drawX: o, drawY: r } = this;
|
|
2693
|
+
e.drawRect(o, r, this.width, this.height, {
|
|
2694
|
+
borderColor: s ? i : "transparent",
|
|
2510
2695
|
fillColor: this.drawCellBgColor
|
|
2511
|
-
}), this.
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
}
|
|
2696
|
+
}), this.drawSelection(), this.drawText(), this.drawSelector();
|
|
2697
|
+
}
|
|
2698
|
+
drawText() {
|
|
2699
|
+
const {
|
|
2700
|
+
paint: e,
|
|
2701
|
+
config: { HEADER_FONT: i, CELL_PADDING: s }
|
|
2702
|
+
} = this.ctx;
|
|
2703
|
+
this.ellipsis = e.drawText(
|
|
2704
|
+
this.displayText,
|
|
2705
|
+
this.drawTextX,
|
|
2706
|
+
this.drawTextY,
|
|
2707
|
+
this.drawTextWidth,
|
|
2708
|
+
this.drawTextHeight,
|
|
2709
|
+
{
|
|
2710
|
+
font: i,
|
|
2711
|
+
padding: s,
|
|
2712
|
+
color: this.drawTextColor,
|
|
2713
|
+
align: this.align,
|
|
2714
|
+
verticalAlign: this.verticalAlign
|
|
2715
|
+
}
|
|
2716
|
+
);
|
|
2518
2717
|
}
|
|
2519
2718
|
drawSelector() {
|
|
2520
2719
|
const { ENABLE_SELECTOR: e } = this.ctx.config;
|
|
@@ -2527,16 +2726,20 @@ class Xt extends kt {
|
|
|
2527
2726
|
});
|
|
2528
2727
|
}
|
|
2529
2728
|
drawSelection() {
|
|
2729
|
+
if (this.hideHeaderSelection)
|
|
2730
|
+
return;
|
|
2530
2731
|
const { width: e, height: i, type: s } = this;
|
|
2531
|
-
if (["index-selection", "selection"].includes(s)) {
|
|
2532
|
-
const { indeterminate: o, check: r, selectable: l } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: a = 0 } = this.ctx.config
|
|
2533
|
-
let
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
this.
|
|
2538
|
-
this.
|
|
2539
|
-
this.
|
|
2732
|
+
if (["index-selection", "selection", "selection-tree", "tree-selection"].includes(s)) {
|
|
2733
|
+
const { indeterminate: o, check: r, selectable: l } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: a = 0, CELL_PADDING: h } = this.ctx.config;
|
|
2734
|
+
let d = this.drawX + (e - a) / 2, f = this.drawY + (i - a) / 2;
|
|
2735
|
+
this.drawTextX = d + a - h / 2, this.drawTextWidth = this.drawX + this.visibleWidth - this.drawTextX, (this.align === "left" || this.align === "right") && (d = this.drawX + h, this.drawTextX = d + a - h / 2, this.drawTextWidth = this.drawX + this.visibleWidth - this.drawTextX), this.verticalAlign === "top" ? f = this.drawY + h / 2 : this.verticalAlign === "bottom" && (f = this.drawY + i - a - h / 2);
|
|
2736
|
+
let x = this.ctx.icons.get("checkbox-uncheck"), u = "checkbox-uncheck";
|
|
2737
|
+
o ? (x = this.ctx.icons.get("checkbox-indeterminate"), u = "checkbox-indeterminate") : r && l ? (x = this.ctx.icons.get("checkbox-check"), u = "checkbox-check") : r && l ? (x = this.ctx.icons.get("checkbox-check-disabled"), u = "checkbox-check-disabled") : !r && l ? (x = this.ctx.icons.get("checkbox-uncheck"), u = "checkbox-uncheck") : (x = this.ctx.icons.get("checkbox-disabled"), u = "checkbox-disabled"), x && (this.drawSelectionImageX = d, this.drawSelectionImageY = f, this.drawSelectionImageWidth = a, this.drawSelectionImageHeight = a, this.drawSelectionImageName = u, this.drawSelectionImageSource = x, this.ctx.paint.drawImage(
|
|
2738
|
+
this.drawSelectionImageSource,
|
|
2739
|
+
this.drawSelectionImageX,
|
|
2740
|
+
this.drawSelectionImageY,
|
|
2741
|
+
this.drawSelectionImageWidth,
|
|
2742
|
+
this.drawSelectionImageHeight
|
|
2540
2743
|
));
|
|
2541
2744
|
}
|
|
2542
2745
|
}
|
|
@@ -2560,7 +2763,7 @@ class Xt extends kt {
|
|
|
2560
2763
|
};
|
|
2561
2764
|
}
|
|
2562
2765
|
}
|
|
2563
|
-
class
|
|
2766
|
+
class Ee {
|
|
2564
2767
|
constructor(t) {
|
|
2565
2768
|
n(this, "ctx");
|
|
2566
2769
|
n(this, "visibleHoverCell");
|
|
@@ -2592,9 +2795,9 @@ class pe {
|
|
|
2592
2795
|
return;
|
|
2593
2796
|
const e = this.ctx.getOffset(t).offsetY, i = this.ctx.getOffset(t).offsetX;
|
|
2594
2797
|
this.handleHeaderEvent(i, e, this.ctx.header.renderCellHeaders, (s) => {
|
|
2595
|
-
this.ctx.clickCellHeader = s, this.ctx.emit("cellHeaderClick", s, t), this.selectionClick(s);
|
|
2798
|
+
this.ctx.clickCellHeader = s, this.ctx.emit("cellHeaderClick", s, t), this.selectionClick(s, t);
|
|
2596
2799
|
}), this.handleBodyEvent(i, e, this.ctx.body.renderRows, (s) => {
|
|
2597
|
-
this.ctx.clickCell = s, this.ctx.emit("cellClick", s, t), this.selectionClick(s), this.treeClick(s), this.hoverIconClick(s);
|
|
2800
|
+
this.ctx.clickCell = s, this.ctx.emit("cellClick", s, t), this.selectionClick(s, t), this.treeClick(s, t), this.hoverIconClick(s);
|
|
2598
2801
|
});
|
|
2599
2802
|
}), this.ctx.on("dblclick", (t) => {
|
|
2600
2803
|
if (t.button !== 0 || this.isBusy(t))
|
|
@@ -2628,7 +2831,7 @@ class pe {
|
|
|
2628
2831
|
e,
|
|
2629
2832
|
this.ctx.body.renderRows,
|
|
2630
2833
|
(s) => {
|
|
2631
|
-
this.
|
|
2834
|
+
this.visibleHoverCell !== s && (this.ctx.emit("visibleCellMouseleave", s, t), this.visibleHoverCell = s, this.ctx.hoverCellHeader = void 0, this.ctx.emit("visibleCellHoverChange", s, t));
|
|
2632
2835
|
},
|
|
2633
2836
|
!0
|
|
2634
2837
|
), this.handleBodyEvent(i, e, this.ctx.body.renderRows, (s) => {
|
|
@@ -2644,39 +2847,45 @@ class pe {
|
|
|
2644
2847
|
*选中点击
|
|
2645
2848
|
* @param cell
|
|
2646
2849
|
*/
|
|
2647
|
-
selectionClick(t) {
|
|
2648
|
-
if (["selection", "index-selection"].includes(t.type) && this.ctx.isPointer)
|
|
2649
|
-
|
|
2650
|
-
|
|
2850
|
+
selectionClick(t, e) {
|
|
2851
|
+
if (!(["selection", "index-selection", "selection-tree", "tree-selection"].includes(t.type) && this.ctx.isPointer))
|
|
2852
|
+
return;
|
|
2853
|
+
const { offsetY: s, offsetX: o } = this.ctx.getOffset(e), r = s, l = o;
|
|
2854
|
+
if (l > t.drawSelectionImageX && l < t.drawSelectionImageX + t.drawSelectionImageWidth && r > t.drawSelectionImageY && r < t.drawSelectionImageY + t.drawSelectionImageHeight)
|
|
2855
|
+
if (t instanceof ct)
|
|
2856
|
+
t.drawSelectionImageName === "checkbox-uncheck" || t.drawSelectionImageName === "checkbox-indeterminate" ? this.ctx.database.toggleAllSelection() : t.drawSelectionImageName === "checkbox-check" && this.ctx.database.clearSelection(!0);
|
|
2651
2857
|
else {
|
|
2652
2858
|
if (!this.ctx.database.getRowSelectable(t.rowKey))
|
|
2653
2859
|
return;
|
|
2654
|
-
this.ctx.database.toggleRowSelection(t.rowKey);
|
|
2860
|
+
this.ctx.database.toggleRowSelection(t.rowKey, t.type);
|
|
2655
2861
|
}
|
|
2656
2862
|
}
|
|
2657
2863
|
/**
|
|
2658
2864
|
* 树点击
|
|
2659
2865
|
* @param cell
|
|
2660
2866
|
*/
|
|
2661
|
-
treeClick(t) {
|
|
2662
|
-
if (
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
this.ctx.database.
|
|
2679
|
-
}
|
|
2867
|
+
treeClick(t, e) {
|
|
2868
|
+
if (!(["tree", "selection-tree", "tree-selection"].includes(t.type) && this.ctx.isPointer))
|
|
2869
|
+
return;
|
|
2870
|
+
const { offsetY: s, offsetX: o } = this.ctx.getOffset(e), r = s, l = o;
|
|
2871
|
+
if (!(l > t.drawTreeImageX && l < t.drawTreeImageX + t.drawTreeImageWidth && r > t.drawTreeImageY && r < t.drawTreeImageY + t.drawTreeImageHeight))
|
|
2872
|
+
return;
|
|
2873
|
+
const a = this.ctx.database.getRowForRowKey(t.rowKey), { expand: h = !1, expandLazy: d = !1 } = a || {}, { EXPAND_LAZY: f, EXPAND_LAZY_METHOD: x } = this.ctx.config;
|
|
2874
|
+
if (f && x && !h && !d)
|
|
2875
|
+
typeof x == "function" && (this.ctx.database.expandLoading(t.rowKey, !0), x({
|
|
2876
|
+
row: t.row,
|
|
2877
|
+
rowIndex: t.rowIndex,
|
|
2878
|
+
colIndex: t.colIndex,
|
|
2879
|
+
column: t.column,
|
|
2880
|
+
value: t.getValue()
|
|
2881
|
+
}).then((w) => {
|
|
2882
|
+
this.ctx.database.setExpandChildren(t.rowKey, w), this.ctx.database.expandLoading(t.rowKey, !1), this.ctx.emit("expandChange", this.ctx.database.getExpandRowKeys());
|
|
2883
|
+
}).catch((w) => {
|
|
2884
|
+
this.ctx.database.expandLoading(t.rowKey, !1), console.error(w);
|
|
2885
|
+
}));
|
|
2886
|
+
else {
|
|
2887
|
+
const u = this.ctx.database.getIsExpand(t.rowKey);
|
|
2888
|
+
this.ctx.database.expandItem(t.rowKey, !u), this.ctx.emit("expandChange", this.ctx.database.getExpandRowKeys());
|
|
2680
2889
|
}
|
|
2681
2890
|
}
|
|
2682
2891
|
/**
|
|
@@ -2686,11 +2895,18 @@ class pe {
|
|
|
2686
2895
|
*/
|
|
2687
2896
|
imageEnterAndLeave(t, e) {
|
|
2688
2897
|
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), o = i, r = s;
|
|
2689
|
-
r > t.
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2898
|
+
if ((t instanceof $ || t instanceof ct) && r > t.drawSelectionImageX && r < t.drawSelectionImageX + t.drawSelectionImageWidth && o > t.drawSelectionImageY && o < t.drawSelectionImageY + t.drawSelectionImageHeight) {
|
|
2899
|
+
this.ctx.stageElement.style.cursor = "pointer", this.ctx.isPointer = !0, t instanceof $ && (this.ctx.database.getRowSelectable(t.rowKey) || (this.ctx.stageElement.style.cursor = "not-allowed"));
|
|
2900
|
+
return;
|
|
2901
|
+
}
|
|
2902
|
+
if (t instanceof $ && t.drawHoverImageSource && r > t.drawHoverImageX && r < t.drawHoverImageX + t.drawHoverImageWidth && o > t.drawHoverImageY && o < t.drawHoverImageY + t.drawHoverImageHeight) {
|
|
2903
|
+
this.ctx.stageElement.style.cursor = "pointer", this.ctx.isPointer = !0;
|
|
2904
|
+
return;
|
|
2905
|
+
}
|
|
2906
|
+
if (t instanceof $ && t.drawTreeImageSource && r > t.drawTreeImageX && r < t.drawTreeImageX + t.drawTreeImageWidth && o > t.drawTreeImageY && o < t.drawTreeImageY + t.drawTreeImageHeight) {
|
|
2907
|
+
this.ctx.stageElement.style.cursor = "pointer", this.ctx.isPointer = !0;
|
|
2908
|
+
return;
|
|
2909
|
+
}
|
|
2694
2910
|
}
|
|
2695
2911
|
isBusy(t) {
|
|
2696
2912
|
const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = e, o = i;
|
|
@@ -2733,7 +2949,7 @@ class pe {
|
|
|
2733
2949
|
this.resizeObserver.unobserve(this.ctx.stageElement), this.mutationObserver.disconnect();
|
|
2734
2950
|
}
|
|
2735
2951
|
}
|
|
2736
|
-
class
|
|
2952
|
+
class pe {
|
|
2737
2953
|
constructor(t, e) {
|
|
2738
2954
|
n(this, "eventBus");
|
|
2739
2955
|
n(this, "eventBrowser");
|
|
@@ -2853,10 +3069,10 @@ class Ee {
|
|
|
2853
3069
|
emptyElement: a,
|
|
2854
3070
|
contextMenuElement: h
|
|
2855
3071
|
} = t;
|
|
2856
|
-
this.containerElement = i, s.tabIndex = 0, this.stageElement = s, this.canvasElement = o, this.overlayerElement = r, this.editorElement = l, this.emptyElement = a, this.contextMenuElement = h, this.config = new
|
|
3072
|
+
this.containerElement = i, s.tabIndex = 0, this.stageElement = s, this.canvasElement = o, this.overlayerElement = r, this.editorElement = l, this.emptyElement = a, this.contextMenuElement = h, this.config = new Ct(e.config || {}), this.eventBus = new ue(), this.eventBrowser = new xe(this), this.eventTable = new Ee(this), this.paint = new ge(this.canvasElement), this.database = new de(this, e), this.history = new fe(this), this.icons = new we(this);
|
|
2857
3073
|
}
|
|
2858
3074
|
setConfig(t) {
|
|
2859
|
-
this.config = new
|
|
3075
|
+
this.config = new Ct(t);
|
|
2860
3076
|
}
|
|
2861
3077
|
setItemValueByEditor(t, e, i, s = !0, o = !0, r = !0) {
|
|
2862
3078
|
if (this.config.ENABLE_MERGE_CELL_LINK) {
|
|
@@ -2981,7 +3197,7 @@ class Ee {
|
|
|
2981
3197
|
this.eventTable.destroy(), this.eventBrowser.destroy(), this.eventBus.destroy();
|
|
2982
3198
|
}
|
|
2983
3199
|
}
|
|
2984
|
-
class
|
|
3200
|
+
class Rt {
|
|
2985
3201
|
constructor(t, e) {
|
|
2986
3202
|
n(this, "ctx");
|
|
2987
3203
|
n(this, "type");
|
|
@@ -3073,9 +3289,9 @@ class bt {
|
|
|
3073
3289
|
} = this.ctx, a = s, h = i, d = e.height, f = e.width, x = t.height, u = this.ctx.footer.height;
|
|
3074
3290
|
if (this.type === "vertical") {
|
|
3075
3291
|
this.visibleDistance = h - o - d, this.distance = x - this.visibleDistance + u, this.trackX = a - o, this.trackY = 0, this.splitPoints = [this.trackX, d, this.trackX + o, d], this.trackWidth = o, this.trackHeight = h, this.barX = this.trackX - 1 + (o - r) / 2, this.barWidth = r;
|
|
3076
|
-
const
|
|
3077
|
-
let
|
|
3078
|
-
|
|
3292
|
+
const w = this.distance ? this.visibleDistance / (x + u) : 0;
|
|
3293
|
+
let E = Math.floor(w * this.visibleDistance);
|
|
3294
|
+
E < 30 ? E = 30 : E > this.visibleDistance && (E = 0), this.barHeight = E, this.barY = d + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
3079
3295
|
} else {
|
|
3080
3296
|
this.visibleDistance = a - o, this.distance = f - this.visibleDistance, this.splitPoints = [
|
|
3081
3297
|
a - o,
|
|
@@ -3083,11 +3299,11 @@ class bt {
|
|
|
3083
3299
|
a - o,
|
|
3084
3300
|
h
|
|
3085
3301
|
];
|
|
3086
|
-
const
|
|
3087
|
-
this.trackX = 0, this.trackY = h - o +
|
|
3088
|
-
const
|
|
3089
|
-
let
|
|
3090
|
-
this.barY = this.trackY - 1 + (o - r) / 2,
|
|
3302
|
+
const w = l ? 0 : 0.5;
|
|
3303
|
+
this.trackX = 0, this.trackY = h - o + w, this.trackWidth = a, this.trackHeight = o;
|
|
3304
|
+
const E = this.distance ? this.visibleDistance / f : 0;
|
|
3305
|
+
let g = Math.floor(E * this.visibleDistance);
|
|
3306
|
+
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));
|
|
3091
3307
|
}
|
|
3092
3308
|
}
|
|
3093
3309
|
draw() {
|
|
@@ -3113,7 +3329,7 @@ class me {
|
|
|
3113
3329
|
n(this, "ctx");
|
|
3114
3330
|
n(this, "verticalScrollbar");
|
|
3115
3331
|
n(this, "horizontalScrollbar");
|
|
3116
|
-
this.ctx = t, this.verticalScrollbar = new
|
|
3332
|
+
this.ctx = t, this.verticalScrollbar = new Rt(t, "vertical"), this.horizontalScrollbar = new Rt(t, "horizontal"), this.ctx.on("wheel", (e) => this.onWheel(e)), this.ctx.on("mousedown", (e) => this.onMouseDown(e)), this.ctx.on("mousemove", (e) => this.onMouseMove(e)), this.ctx.on("mouseup", () => this.onMouseUp()), this.ctx.on("touchmove", (e) => this.onTouchmove(e)), this.ctx.on("touchstart", (e) => {
|
|
3117
3333
|
this.onTouchstart(e);
|
|
3118
3334
|
}), this.ctx.on("setScroll", (e, i) => {
|
|
3119
3335
|
this.setScroll(e, i);
|
|
@@ -3214,7 +3430,7 @@ class ye {
|
|
|
3214
3430
|
n(this, "renderFixedCellHeaders", []);
|
|
3215
3431
|
this.ctx = t, this.ctx.on(
|
|
3216
3432
|
"resetHeader",
|
|
3217
|
-
|
|
3433
|
+
At(() => {
|
|
3218
3434
|
this.init(), this.ctx.emit("draw");
|
|
3219
3435
|
}, 100)
|
|
3220
3436
|
), this.init(), this.initResizeColumn();
|
|
@@ -3224,12 +3440,12 @@ class ye {
|
|
|
3224
3440
|
config: { HEADER_HEIGHT: t, SCROLLER_TRACK_SIZE: e }
|
|
3225
3441
|
} = this.ctx, i = this.ctx.database.getColumns();
|
|
3226
3442
|
this.columns = i, this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [];
|
|
3227
|
-
const s =
|
|
3443
|
+
const s = Mt(i), o = it(i);
|
|
3228
3444
|
this.height = t * s, this.width = o.reduce((f, x) => {
|
|
3229
|
-
const u = x.width || 100, { maxWidth:
|
|
3230
|
-
return
|
|
3445
|
+
const u = x.width || 100, { maxWidth: w, minWidth: E } = x;
|
|
3446
|
+
return w && u > w ? f + w : E && u < E ? f + E : f + u;
|
|
3231
3447
|
}, 0), this.visibleHeight = this.height;
|
|
3232
|
-
const r = oe(
|
|
3448
|
+
const r = oe(Ht(i, s));
|
|
3233
3449
|
this.columnIndex = 0, this.resizeNum = 0, this.render(r, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
3234
3450
|
const l = this.ctx.containerElement.getBoundingClientRect();
|
|
3235
3451
|
this.resizeNum > 0 ? this.ctx.stageWidth = Math.floor(l.width) : this.ctx.stageWidth = Math.floor(this.width + e), this.ctx.stageElement.style.width = this.ctx.stageWidth + "px", this.visibleWidth = this.ctx.stageWidth - e;
|
|
@@ -3330,8 +3546,8 @@ class ye {
|
|
|
3330
3546
|
for (let r = 0; r < i; r++) {
|
|
3331
3547
|
const l = t[r], a = o * (l.rowspan || 0), h = o * (l.level || 0);
|
|
3332
3548
|
let { minWidth: d, maxWidth: f } = l, x = l.width || 100;
|
|
3333
|
-
d && x < d && (x = d), f && x > f && (x = f), l.children && (x =
|
|
3334
|
-
const u = new
|
|
3549
|
+
d && x < d && (x = d), f && x > f && (x = f), l.children && (x = it(l.children).reduce((E, g) => E + ((g == null ? void 0 : g.width) || 100), 0));
|
|
3550
|
+
const u = new ct(this.ctx, this.columnIndex, s, h, x, a, l);
|
|
3335
3551
|
this.ctx.database.setHeader(l.key, u), this.allCellHeaders.push(u), l.children || (this.leafCellHeaders.push(u), u.column.widthFillDisable || this.resizeNum++), l.fixed === "left" ? this.fixedLeftCellHeaders.push(u) : l.fixed === "right" ? this.fixedRightCellHeaders.push(u) : this.centerCellHeaders.push(u), !l.children && this.columnIndex++, l.children && this.render(l.children, s), s += x;
|
|
3336
3552
|
}
|
|
3337
3553
|
}
|
|
@@ -3424,7 +3640,7 @@ class Bt {
|
|
|
3424
3640
|
update() {
|
|
3425
3641
|
const { header: t } = this.ctx, e = [], i = [], s = [];
|
|
3426
3642
|
t.renderLeafCellHeaders.forEach((o) => {
|
|
3427
|
-
const r = new
|
|
3643
|
+
const r = new $(
|
|
3428
3644
|
this.ctx,
|
|
3429
3645
|
this.rowIndex,
|
|
3430
3646
|
o.colIndex,
|
|
@@ -3507,35 +3723,35 @@ class Ce {
|
|
|
3507
3723
|
if (!e.width)
|
|
3508
3724
|
return;
|
|
3509
3725
|
this.x = 0, x === "top" && o ? this.y = e.height + i.height : this.y = e.height;
|
|
3510
|
-
const { data: u, sumHeight:
|
|
3511
|
-
this.height =
|
|
3512
|
-
const
|
|
3513
|
-
!this.data.length && !l ? this.height = a : !this.data.length && l && (this.height = l - e.height -
|
|
3514
|
-
let
|
|
3515
|
-
|
|
3516
|
-
let
|
|
3517
|
-
const
|
|
3518
|
-
if (
|
|
3519
|
-
const
|
|
3520
|
-
|
|
3521
|
-
} else this.data.length && l ?
|
|
3522
|
-
|
|
3523
|
-
let
|
|
3524
|
-
o ? this.visibleHeight =
|
|
3726
|
+
const { data: u, sumHeight: w } = s.getData();
|
|
3727
|
+
this.height = w, this.data = u, this.width = e.width, this.visibleWidth = this.ctx.stageWidth - r;
|
|
3728
|
+
const E = this.ctx.footer.height;
|
|
3729
|
+
!this.data.length && !l ? this.height = a : !this.data.length && l && (this.height = l - e.height - E - r);
|
|
3730
|
+
let g = this.height + e.height + r;
|
|
3731
|
+
g += E;
|
|
3732
|
+
let p = g;
|
|
3733
|
+
const m = window.innerHeight, { top: y } = this.containerRect || this.ctx.containerElement.getBoundingClientRect();
|
|
3734
|
+
if (m > y && d && !l) {
|
|
3735
|
+
const O = m - y - f;
|
|
3736
|
+
O > e.height + r ? p = O : g > h && (p = h);
|
|
3737
|
+
} else this.data.length && l ? p = l : this.data.length && h && g > h && (p = h);
|
|
3738
|
+
p > 0 && (this.ctx.stageHeight = Math.floor(p), this.ctx.stageElement.style.height = `${this.ctx.stageHeight}px`);
|
|
3739
|
+
let b = this.ctx.stageHeight - e.height - r;
|
|
3740
|
+
o ? this.visibleHeight = b - E : this.visibleHeight = b, this.data.length || (this.height = this.visibleHeight), this.ctx.body.x = this.x, this.ctx.body.y = this.y, this.ctx.body.width = this.width, this.ctx.body.height = this.height, this.ctx.body.visibleWidth = this.visibleWidth, this.ctx.body.visibleHeight = this.visibleHeight, this.ctx.body.data = u;
|
|
3525
3741
|
const C = window.devicePixelRatio || 1, I = this.ctx.stageWidth * C, _ = this.ctx.stageHeight * C;
|
|
3526
3742
|
t.width = Math.round(I), t.height = Math.round(_);
|
|
3527
|
-
const
|
|
3743
|
+
const T = this.data.length ? "not-empty" : "empty";
|
|
3528
3744
|
this.ctx.emit("emptyChange", {
|
|
3529
|
-
isEmpty:
|
|
3530
|
-
type:
|
|
3745
|
+
isEmpty: T,
|
|
3746
|
+
type: T,
|
|
3531
3747
|
headerHeight: e.height,
|
|
3532
3748
|
bodyHeight: this.height,
|
|
3533
|
-
footerHeight:
|
|
3749
|
+
footerHeight: E,
|
|
3534
3750
|
width: this.width,
|
|
3535
|
-
height: this.data.length ? 0 : a +
|
|
3751
|
+
height: this.data.length ? 0 : a + E
|
|
3536
3752
|
});
|
|
3537
|
-
const v = Math.round(t.width / C * 1e4) / 1e4,
|
|
3538
|
-
this.ctx.canvasElement.setAttribute("style", `height:${
|
|
3753
|
+
const v = Math.round(t.width / C * 1e4) / 1e4, R = Math.round(t.height / C * 1e4) / 1e4;
|
|
3754
|
+
this.ctx.canvasElement.setAttribute("style", `height:${R}px;width:${v}px;`), this.ctx.paint.scale(C);
|
|
3539
3755
|
}
|
|
3540
3756
|
// 调整行的高度
|
|
3541
3757
|
initResizeRow() {
|
|
@@ -3576,9 +3792,9 @@ class Ce {
|
|
|
3576
3792
|
for (let f = 0; f < this.renderRows.length; f++) {
|
|
3577
3793
|
const x = this.renderRows[f];
|
|
3578
3794
|
if (o > x.y - h + x.height - 1.5 && o < x.y - h + x.height + 1.5 && o < a - 4)
|
|
3579
|
-
for (let
|
|
3580
|
-
const
|
|
3581
|
-
r >
|
|
3795
|
+
for (let w = 0; w < x.cells.length; w++) {
|
|
3796
|
+
const E = x.cells[w];
|
|
3797
|
+
r > E.drawX + 10 && r < E.drawX + E.width - 10 && E.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = x);
|
|
3582
3798
|
}
|
|
3583
3799
|
}
|
|
3584
3800
|
}
|
|
@@ -3661,8 +3877,8 @@ class Ce {
|
|
|
3661
3877
|
this.headIndex = Math.max(0, a), this.tailIndex = Math.min(this.ctx.maxRowIndex, h + 1), this.visibleRows = r.slice(this.headIndex, this.tailIndex + 1), this.ctx.body.headIndex = this.headIndex, this.ctx.body.tailIndex = this.tailIndex, this.ctx.body.visibleRows = this.visibleRows;
|
|
3662
3878
|
const d = [];
|
|
3663
3879
|
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
3664
|
-
const x = this.headIndex + f, u = this.visibleRows[f], { height:
|
|
3665
|
-
d.push(
|
|
3880
|
+
const x = this.headIndex + f, u = this.visibleRows[f], { height: w, top: E } = this.ctx.database.getPositionForRowIndex(x), g = new Bt(this.ctx, x, 0, E + this.y, t.width, w, u);
|
|
3881
|
+
d.push(g);
|
|
3666
3882
|
}
|
|
3667
3883
|
this.renderRows = d, this.ctx.body.renderRows = d;
|
|
3668
3884
|
}
|
|
@@ -3778,7 +3994,7 @@ class Re {
|
|
|
3778
3994
|
this.moveFocus(t);
|
|
3779
3995
|
}), this.ctx.on(
|
|
3780
3996
|
"mousemove",
|
|
3781
|
-
|
|
3997
|
+
At((t) => {
|
|
3782
3998
|
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;
|
|
3783
3999
|
(this.ctx.selectorMove || this.ctx.autofillMove) && (!s && !this.mousedownHeader ? this.startAdjustPosition(t) : this.stopAdjustPosition());
|
|
3784
4000
|
}, 100)
|
|
@@ -3881,15 +4097,15 @@ class Re {
|
|
|
3881
4097
|
SELECTOR_AREA_MAX_Y: d,
|
|
3882
4098
|
SELECTOR_AREA_MAX_X_OFFSET: f,
|
|
3883
4099
|
SELECTOR_AREA_MAX_Y_OFFSET: x
|
|
3884
|
-
} = this.ctx.config, u = l,
|
|
3885
|
-
let [
|
|
3886
|
-
if (
|
|
4100
|
+
} = this.ctx.config, u = l, w = a || this.ctx.maxColIndex - f, E = h, g = d || this.ctx.maxRowIndex - x;
|
|
4101
|
+
let [p, m] = o, [y, b] = r;
|
|
4102
|
+
if (p < u || m > w || y < E || b > g)
|
|
3887
4103
|
return;
|
|
3888
4104
|
if (this.ctx.stageElement.focus({ preventScroll: !0 }), this.ctx.config.ENABLE_MERGE_CELL_LINK) {
|
|
3889
4105
|
const I = this.adjustMergeCells(o, r);
|
|
3890
|
-
|
|
4106
|
+
y = I.yArr[0], b = I.yArr[1], p = I.xArr[0], m = I.xArr[1], this.ctx.onlyMergeCell = I.onlyMergeCell;
|
|
3891
4107
|
}
|
|
3892
|
-
|
|
4108
|
+
p === m && y === b ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, o = [Math.max(u, p), Math.min(w, m)], r = [Math.max(E, y), Math.min(g, b)];
|
|
3893
4109
|
const { BEFORE_SET_SELECTOR_METHOD: C } = this.ctx.config;
|
|
3894
4110
|
if (typeof C == "function") {
|
|
3895
4111
|
const _ = C({
|
|
@@ -3905,27 +4121,27 @@ class Re {
|
|
|
3905
4121
|
}
|
|
3906
4122
|
}
|
|
3907
4123
|
adjustMergeCells(t, e) {
|
|
3908
|
-
var
|
|
4124
|
+
var w;
|
|
3909
4125
|
const [i, s] = e, [o, r] = t;
|
|
3910
4126
|
let l = [], a = [];
|
|
3911
|
-
for (let
|
|
3912
|
-
for (let
|
|
3913
|
-
const
|
|
3914
|
-
|
|
4127
|
+
for (let E = 0; E <= e[1] - e[0]; E++)
|
|
4128
|
+
for (let g = 0; g <= t[1] - t[0]; g++) {
|
|
4129
|
+
const p = E + e[0], m = g + t[0], y = this.ctx.database.getVirtualBodyCell(p, m);
|
|
4130
|
+
y && ((p === i || p === s) && l.push(y), (m === o || m === r) && a.push(y));
|
|
3915
4131
|
}
|
|
3916
4132
|
const h = l.reduce(
|
|
3917
|
-
(
|
|
3918
|
-
const { yArr:
|
|
3919
|
-
return
|
|
4133
|
+
(E, g) => {
|
|
4134
|
+
const { yArr: p } = g.getSpanInfo(), [m, y] = p;
|
|
4135
|
+
return E.minY = Math.min(E.minY, m), E.maxY = Math.max(E.maxY, y), E;
|
|
3920
4136
|
},
|
|
3921
4137
|
{
|
|
3922
4138
|
minY: i,
|
|
3923
4139
|
maxY: s
|
|
3924
4140
|
}
|
|
3925
4141
|
), d = a.reduce(
|
|
3926
|
-
(
|
|
3927
|
-
const { xArr:
|
|
3928
|
-
return
|
|
4142
|
+
(E, g) => {
|
|
4143
|
+
const { xArr: p } = g.getSpanInfo(), [m, y] = p;
|
|
4144
|
+
return E.minX = Math.min(E.minX, m), E.maxX = Math.max(E.maxX, y), E;
|
|
3929
4145
|
},
|
|
3930
4146
|
{
|
|
3931
4147
|
minX: o,
|
|
@@ -3934,8 +4150,8 @@ class Re {
|
|
|
3934
4150
|
), f = [d.minX, d.maxX], x = [h.minY, h.maxY];
|
|
3935
4151
|
let u = !1;
|
|
3936
4152
|
if (d.minX !== d.maxX || h.minY !== h.maxY) {
|
|
3937
|
-
const
|
|
3938
|
-
u = (
|
|
4153
|
+
const E = JSON.stringify(f) + JSON.stringify(x), g = (w = this.ctx.focusCell) == null ? void 0 : w.getSpanInfo();
|
|
4154
|
+
u = (g && JSON.stringify(g.xArr) + JSON.stringify(g.yArr)) === E;
|
|
3939
4155
|
}
|
|
3940
4156
|
return {
|
|
3941
4157
|
xArr: f,
|
|
@@ -3977,8 +4193,8 @@ class Re {
|
|
|
3977
4193
|
SELECTOR_AREA_MAX_Y: r,
|
|
3978
4194
|
SELECTOR_AREA_MAX_X_OFFSET: l,
|
|
3979
4195
|
SELECTOR_AREA_MAX_Y_OFFSET: a
|
|
3980
|
-
} = this.ctx.config, h = i, d = s || this.ctx.maxColIndex - l, f = o, x = r || this.ctx.maxRowIndex - a, u = [h, d],
|
|
3981
|
-
this.setSelector(u,
|
|
4196
|
+
} = this.ctx.config, h = i, d = s || this.ctx.maxColIndex - l, f = o, x = r || this.ctx.maxRowIndex - a, u = [h, d], w = [f, x];
|
|
4197
|
+
this.setSelector(u, w);
|
|
3982
4198
|
}
|
|
3983
4199
|
}
|
|
3984
4200
|
selectRows(t, e = !0) {
|
|
@@ -4085,10 +4301,10 @@ class Re {
|
|
|
4085
4301
|
for (let h = 0; h <= t[1] - t[0]; h++) {
|
|
4086
4302
|
const d = a + e[0], f = h + t[0], x = this.ctx.database.getItemValueForRowIndexAndColIndex(d, f);
|
|
4087
4303
|
if (x) {
|
|
4088
|
-
const { rowKey: u, key:
|
|
4089
|
-
this.ctx.database.getReadonly(u,
|
|
4304
|
+
const { rowKey: u, key: w } = x;
|
|
4305
|
+
this.ctx.database.getReadonly(u, w) || (r.add(u), o.push({
|
|
4090
4306
|
rowKey: u,
|
|
4091
|
-
key:
|
|
4307
|
+
key: w,
|
|
4092
4308
|
value: s,
|
|
4093
4309
|
row: {}
|
|
4094
4310
|
//内部有设置
|
|
@@ -4115,39 +4331,39 @@ class Re {
|
|
|
4115
4331
|
const e = this.ctx.selector.yArr[0], i = this.ctx.selector.xArr[0], s = /* @__PURE__ */ new Set();
|
|
4116
4332
|
navigator.clipboard.readText().then(async (o) => {
|
|
4117
4333
|
let r = ne(o);
|
|
4118
|
-
const l = [i, i + r[0].length - 1], a = [e, e + r.length - 1], [h, d] = a, [f, x] = l, u = d - this.ctx.maxRowIndex,
|
|
4119
|
-
(u > 0 ||
|
|
4334
|
+
const l = [i, i + r[0].length - 1], a = [e, e + r.length - 1], [h, d] = a, [f, x] = l, u = d - this.ctx.maxRowIndex, w = x - this.ctx.maxColIndex;
|
|
4335
|
+
(u > 0 || w > 0) && this.ctx.emit("onPastedDataOverflow", {
|
|
4120
4336
|
maxY: d,
|
|
4121
4337
|
maxX: x,
|
|
4122
4338
|
minY: h,
|
|
4123
4339
|
minX: f,
|
|
4124
4340
|
overflowRowCount: u,
|
|
4125
|
-
overflowColCount:
|
|
4341
|
+
overflowColCount: w,
|
|
4126
4342
|
textArr: r
|
|
4127
4343
|
});
|
|
4128
|
-
const
|
|
4129
|
-
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(l, a) && !
|
|
4130
|
-
const
|
|
4344
|
+
const E = r.length === 1 && r[0].length === 1;
|
|
4345
|
+
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(l, a) && !E) {
|
|
4346
|
+
const y = {
|
|
4131
4347
|
code: "ERR_MERGED_CELLS_PASTE",
|
|
4132
4348
|
message: "Merged cells cannot span paste data"
|
|
4133
4349
|
};
|
|
4134
|
-
this.ctx.hasEvent("error") ? this.ctx.emit("error",
|
|
4350
|
+
this.ctx.hasEvent("error") ? this.ctx.emit("error", y) : alert(y.message);
|
|
4135
4351
|
return;
|
|
4136
4352
|
}
|
|
4137
|
-
let
|
|
4138
|
-
for (let
|
|
4139
|
-
const
|
|
4140
|
-
for (let C = 0; C <=
|
|
4141
|
-
const I =
|
|
4353
|
+
let g = [];
|
|
4354
|
+
for (let y = 0; y <= r.length - 1; y++) {
|
|
4355
|
+
const b = r[y].length;
|
|
4356
|
+
for (let C = 0; C <= b - 1; C++) {
|
|
4357
|
+
const I = y + e, _ = C + i, T = r[y][C], v = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
4142
4358
|
I,
|
|
4143
4359
|
_
|
|
4144
4360
|
);
|
|
4145
4361
|
if (v) {
|
|
4146
|
-
const { rowKey:
|
|
4147
|
-
this.ctx.database.getReadonly(
|
|
4148
|
-
rowKey:
|
|
4149
|
-
key:
|
|
4150
|
-
value:
|
|
4362
|
+
const { rowKey: R, key: S } = v;
|
|
4363
|
+
this.ctx.database.getReadonly(R, S) || (s.add(R), g.push({
|
|
4364
|
+
rowKey: R,
|
|
4365
|
+
key: S,
|
|
4366
|
+
value: T,
|
|
4151
4367
|
row: {}
|
|
4152
4368
|
//内部有设置
|
|
4153
4369
|
}));
|
|
@@ -4155,35 +4371,35 @@ class Re {
|
|
|
4155
4371
|
}
|
|
4156
4372
|
}
|
|
4157
4373
|
if (this.isCut) {
|
|
4158
|
-
const
|
|
4374
|
+
const y = this.clearSelectedData(
|
|
4159
4375
|
this.ctx.selector.xArrCopy,
|
|
4160
4376
|
this.ctx.selector.yArrCopy,
|
|
4161
4377
|
!0
|
|
4162
4378
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
4163
|
-
),
|
|
4164
|
-
|
|
4165
|
-
|
|
4379
|
+
), b = g.map((C) => `${C.rowKey}-${C.key}`);
|
|
4380
|
+
y.forEach((C) => {
|
|
4381
|
+
b.includes(`${C.rowKey}-${C.key}`) || g.unshift(C);
|
|
4166
4382
|
}), this.isCut = !1;
|
|
4167
4383
|
}
|
|
4168
|
-
if (!
|
|
4384
|
+
if (!g.length)
|
|
4169
4385
|
return;
|
|
4170
|
-
const { BEFORE_PASTE_DATA_METHOD:
|
|
4171
|
-
if (typeof
|
|
4172
|
-
const
|
|
4386
|
+
const { BEFORE_PASTE_DATA_METHOD: p } = this.ctx.config;
|
|
4387
|
+
if (typeof p == "function") {
|
|
4388
|
+
const y = p, b = g.map((C) => ({
|
|
4173
4389
|
rowKey: C.rowKey,
|
|
4174
4390
|
key: C.key,
|
|
4175
4391
|
value: C.value,
|
|
4176
4392
|
oldValue: this.ctx.database.getItemValue(C.rowKey, C.key),
|
|
4177
4393
|
row: this.ctx.database.getRowDataItemForRowKey(C.rowKey)
|
|
4178
4394
|
}));
|
|
4179
|
-
if (
|
|
4395
|
+
if (g = await y(b, l, a, r), g && !g.length)
|
|
4180
4396
|
return;
|
|
4181
4397
|
}
|
|
4182
|
-
this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(
|
|
4183
|
-
let
|
|
4184
|
-
s.forEach((
|
|
4185
|
-
|
|
4186
|
-
}), this.ctx.emit("pasteChange",
|
|
4398
|
+
this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(g, !0);
|
|
4399
|
+
let m = [];
|
|
4400
|
+
s.forEach((y) => {
|
|
4401
|
+
m.push(this.ctx.database.getRowDataItemForRowKey(y));
|
|
4402
|
+
}), this.ctx.emit("pasteChange", g, m);
|
|
4187
4403
|
}).catch((o) => {
|
|
4188
4404
|
console.error("Failed to get the clipboard content:", o);
|
|
4189
4405
|
});
|
|
@@ -4272,25 +4488,25 @@ class Re {
|
|
|
4272
4488
|
body: a,
|
|
4273
4489
|
scrollX: h,
|
|
4274
4490
|
scrollY: d,
|
|
4275
|
-
config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED: x, FOOTER_POSITION: u, ENABLE_MERGE_CELL_LINK:
|
|
4491
|
+
config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED: x, FOOTER_POSITION: u, ENABLE_MERGE_CELL_LINK: w }
|
|
4276
4492
|
} = this.ctx;
|
|
4277
4493
|
if (!i)
|
|
4278
4494
|
return;
|
|
4279
|
-
|
|
4280
|
-
const { drawX:
|
|
4281
|
-
let I = r.height -
|
|
4495
|
+
w && this.ctx.onlyMergeCell && i.updateSpanInfo();
|
|
4496
|
+
const { drawX: E, drawY: g, width: p, height: m, fixed: y } = i, b = o - E + 1, C = i.drawX + p - (e - s) + 1;
|
|
4497
|
+
let I = r.height - g, _ = m;
|
|
4282
4498
|
_ > a.visibleHeight && (_ = a.visibleHeight);
|
|
4283
|
-
let
|
|
4284
|
-
x && (u === "top" ? I = r.height + l.height -
|
|
4285
|
-
const v =
|
|
4286
|
-
let
|
|
4287
|
-
C > 0 && !
|
|
4499
|
+
let T = 0;
|
|
4500
|
+
x && (u === "top" ? I = r.height + l.height - g : T = l.visibleHeight);
|
|
4501
|
+
const v = g + _ - (t - T - f);
|
|
4502
|
+
let R = h, S = d;
|
|
4503
|
+
C > 0 && !y ? R = Math.floor(h + C) : b > 0 && !y && (R = Math.floor(h - b)), I > 0 ? S = Math.floor(d - I) : v > 0 && (S = Math.floor(d + v)), (Math.abs(h - R) > 2 || Math.abs(d - S) > 2) && (this.ctx.adjustPositioning = !0, this.ctx.setScroll(R, S), this.ctx.emit("adjustBoundaryPosition", i));
|
|
4288
4504
|
}
|
|
4289
4505
|
destroy() {
|
|
4290
4506
|
this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
|
|
4291
4507
|
}
|
|
4292
4508
|
}
|
|
4293
|
-
class
|
|
4509
|
+
class Ie {
|
|
4294
4510
|
constructor(t) {
|
|
4295
4511
|
n(this, "ctx");
|
|
4296
4512
|
n(this, "maxColRowCell");
|
|
@@ -4348,21 +4564,21 @@ class ve {
|
|
|
4348
4564
|
SELECTOR_AREA_MAX_Y: f,
|
|
4349
4565
|
SELECTOR_AREA_MAX_X_OFFSET: x,
|
|
4350
4566
|
SELECTOR_AREA_MAX_Y_OFFSET: u
|
|
4351
|
-
} = this.ctx.config,
|
|
4352
|
-
let [
|
|
4353
|
-
if (
|
|
4567
|
+
} = this.ctx.config, w = a, E = h || this.ctx.maxColIndex - x, g = d, p = f || this.ctx.maxRowIndex - u;
|
|
4568
|
+
let [m, y] = r, [b, C] = l;
|
|
4569
|
+
if (m < w || b < g)
|
|
4354
4570
|
return;
|
|
4355
|
-
r = [Math.max(
|
|
4571
|
+
r = [Math.max(w, m), Math.min(E, y)], l = [Math.max(g, b), Math.min(p, C)];
|
|
4356
4572
|
const { BEFORE_SET_AUTOFILL_METHOD: I } = this.ctx.config;
|
|
4357
4573
|
if (typeof I == "function") {
|
|
4358
|
-
const
|
|
4574
|
+
const T = I({
|
|
4359
4575
|
focusCell: this.ctx.focusCell,
|
|
4360
4576
|
xArr: r,
|
|
4361
4577
|
yArr: l
|
|
4362
4578
|
});
|
|
4363
|
-
if (!
|
|
4579
|
+
if (!T)
|
|
4364
4580
|
return;
|
|
4365
|
-
r =
|
|
4581
|
+
r = T.xArr, l = T.yArr;
|
|
4366
4582
|
}
|
|
4367
4583
|
this.ctx.autofill.xArr = r, this.ctx.autofill.yArr = l, this.ctx.emit("setAutofill", this.ctx.autofill), this.ctx.emit("draw");
|
|
4368
4584
|
}
|
|
@@ -4373,9 +4589,9 @@ class ve {
|
|
|
4373
4589
|
async autofillData() {
|
|
4374
4590
|
const t = /* @__PURE__ */ new Set(), e = this.ctx.getSelectedData(), i = /* @__PURE__ */ new Map();
|
|
4375
4591
|
for (let u = 0; u <= e.yArr[1] - e.yArr[0]; u++)
|
|
4376
|
-
for (let
|
|
4377
|
-
const
|
|
4378
|
-
i.set(`${
|
|
4592
|
+
for (let w = 0; w <= e.xArr[1] - e.xArr[0]; w++) {
|
|
4593
|
+
const E = u + e.yArr[0], g = w + e.xArr[0];
|
|
4594
|
+
i.set(`${E}-${g}`, !0);
|
|
4379
4595
|
}
|
|
4380
4596
|
const { value: s } = e, o = s[0].length, r = s.length, l = this.ctx.autofill.xArr, a = this.ctx.autofill.yArr, h = o === 1 && r === 1;
|
|
4381
4597
|
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(l, a) && !h) {
|
|
@@ -4388,14 +4604,14 @@ class ve {
|
|
|
4388
4604
|
}
|
|
4389
4605
|
let d = [];
|
|
4390
4606
|
for (let u = 0; u <= a[1] - a[0]; u++)
|
|
4391
|
-
for (let
|
|
4392
|
-
const
|
|
4393
|
-
if (
|
|
4394
|
-
const { rowKey:
|
|
4395
|
-
this.ctx.database.getReadonly(
|
|
4396
|
-
rowKey:
|
|
4607
|
+
for (let w = 0; w <= l[1] - l[0]; w++) {
|
|
4608
|
+
const E = w + l[0], g = u + a[0], p = s[u % r][w % o], m = this.ctx.database.getItemValueForRowIndexAndColIndex(g, E), y = `${g}-${E}`;
|
|
4609
|
+
if (m && !i.has(y)) {
|
|
4610
|
+
const { rowKey: b, key: C } = m;
|
|
4611
|
+
this.ctx.database.getReadonly(b, C) || (t.add(b), d.push({
|
|
4612
|
+
rowKey: b,
|
|
4397
4613
|
key: C,
|
|
4398
|
-
value:
|
|
4614
|
+
value: p,
|
|
4399
4615
|
row: {}
|
|
4400
4616
|
}));
|
|
4401
4617
|
}
|
|
@@ -4405,14 +4621,14 @@ class ve {
|
|
|
4405
4621
|
this.ctx.selector.xArr = this.ctx.autofill.xArr, this.ctx.selector.yArr = this.ctx.autofill.yArr;
|
|
4406
4622
|
const { BEFORE_AUTOFILL_DATA_METHOD: f } = this.ctx.config;
|
|
4407
4623
|
if (typeof f == "function") {
|
|
4408
|
-
const u = f,
|
|
4409
|
-
rowKey:
|
|
4410
|
-
key:
|
|
4411
|
-
value:
|
|
4412
|
-
oldValue: this.ctx.database.getItemValue(
|
|
4413
|
-
row: this.ctx.database.getRowDataItemForRowKey(
|
|
4624
|
+
const u = f, w = d.map((E) => ({
|
|
4625
|
+
rowKey: E.rowKey,
|
|
4626
|
+
key: E.key,
|
|
4627
|
+
value: E.value,
|
|
4628
|
+
oldValue: this.ctx.database.getItemValue(E.rowKey, E.key),
|
|
4629
|
+
row: this.ctx.database.getRowDataItemForRowKey(E.rowKey)
|
|
4414
4630
|
}));
|
|
4415
|
-
if (d = await u(
|
|
4631
|
+
if (d = await u(w, l, a), d && !d.length)
|
|
4416
4632
|
return;
|
|
4417
4633
|
}
|
|
4418
4634
|
this.ctx.batchSetItemValueByEditor(d, !0);
|
|
@@ -4433,10 +4649,10 @@ class ve {
|
|
|
4433
4649
|
destroy() {
|
|
4434
4650
|
}
|
|
4435
4651
|
}
|
|
4436
|
-
const
|
|
4652
|
+
const q = Math.min, G = Math.max, st = Math.round, N = (c) => ({
|
|
4437
4653
|
x: c,
|
|
4438
4654
|
y: c
|
|
4439
|
-
}),
|
|
4655
|
+
}), ve = {
|
|
4440
4656
|
left: "right",
|
|
4441
4657
|
right: "left",
|
|
4442
4658
|
bottom: "top",
|
|
@@ -4445,64 +4661,64 @@ const Z = Math.min, $ = Math.max, it = Math.round, K = (c) => ({
|
|
|
4445
4661
|
start: "end",
|
|
4446
4662
|
end: "start"
|
|
4447
4663
|
};
|
|
4448
|
-
function
|
|
4449
|
-
return
|
|
4664
|
+
function dt(c, t, e) {
|
|
4665
|
+
return G(c, q(t, e));
|
|
4450
4666
|
}
|
|
4451
|
-
function
|
|
4667
|
+
function Q(c, t) {
|
|
4452
4668
|
return typeof c == "function" ? c(t) : c;
|
|
4453
4669
|
}
|
|
4454
4670
|
function z(c) {
|
|
4455
4671
|
return c.split("-")[0];
|
|
4456
4672
|
}
|
|
4457
|
-
function
|
|
4673
|
+
function tt(c) {
|
|
4458
4674
|
return c.split("-")[1];
|
|
4459
4675
|
}
|
|
4460
|
-
function
|
|
4676
|
+
function Nt(c) {
|
|
4461
4677
|
return c === "x" ? "y" : "x";
|
|
4462
4678
|
}
|
|
4463
|
-
function
|
|
4679
|
+
function ut(c) {
|
|
4464
4680
|
return c === "y" ? "height" : "width";
|
|
4465
4681
|
}
|
|
4466
|
-
const
|
|
4682
|
+
const Se = /* @__PURE__ */ new Set(["top", "bottom"]);
|
|
4467
4683
|
function V(c) {
|
|
4468
|
-
return
|
|
4684
|
+
return Se.has(z(c)) ? "y" : "x";
|
|
4469
4685
|
}
|
|
4470
|
-
function
|
|
4471
|
-
return
|
|
4686
|
+
function gt(c) {
|
|
4687
|
+
return Nt(V(c));
|
|
4472
4688
|
}
|
|
4473
|
-
function
|
|
4689
|
+
function Te(c, t, e) {
|
|
4474
4690
|
e === void 0 && (e = !1);
|
|
4475
|
-
const i =
|
|
4691
|
+
const i = tt(c), s = gt(c), o = ut(s);
|
|
4476
4692
|
let r = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
|
|
4477
|
-
return t.reference[o] > t.floating[o] && (r =
|
|
4693
|
+
return t.reference[o] > t.floating[o] && (r = ot(r)), [r, ot(r)];
|
|
4478
4694
|
}
|
|
4479
|
-
function
|
|
4480
|
-
const t =
|
|
4481
|
-
return [
|
|
4695
|
+
function Oe(c) {
|
|
4696
|
+
const t = ot(c);
|
|
4697
|
+
return [ft(c), t, ft(t)];
|
|
4482
4698
|
}
|
|
4483
|
-
function
|
|
4699
|
+
function ft(c) {
|
|
4484
4700
|
return c.replace(/start|end/g, (t) => _e[t]);
|
|
4485
4701
|
}
|
|
4486
|
-
const
|
|
4702
|
+
const It = ["left", "right"], vt = ["right", "left"], Le = ["top", "bottom"], Ae = ["bottom", "top"];
|
|
4487
4703
|
function Me(c, t, e) {
|
|
4488
4704
|
switch (c) {
|
|
4489
4705
|
case "top":
|
|
4490
4706
|
case "bottom":
|
|
4491
|
-
return e ? t ? vt :
|
|
4707
|
+
return e ? t ? vt : It : t ? It : vt;
|
|
4492
4708
|
case "left":
|
|
4493
4709
|
case "right":
|
|
4494
|
-
return t ?
|
|
4710
|
+
return t ? Le : Ae;
|
|
4495
4711
|
default:
|
|
4496
4712
|
return [];
|
|
4497
4713
|
}
|
|
4498
4714
|
}
|
|
4499
4715
|
function He(c, t, e, i) {
|
|
4500
|
-
const s =
|
|
4716
|
+
const s = tt(c);
|
|
4501
4717
|
let o = Me(z(c), e === "start", i);
|
|
4502
|
-
return s && (o = o.map((r) => r + "-" + s), t && (o = o.concat(o.map(
|
|
4718
|
+
return s && (o = o.map((r) => r + "-" + s), t && (o = o.concat(o.map(ft)))), o;
|
|
4503
4719
|
}
|
|
4504
|
-
function
|
|
4505
|
-
return c.replace(/left|right|bottom|top/g, (t) =>
|
|
4720
|
+
function ot(c) {
|
|
4721
|
+
return c.replace(/left|right|bottom|top/g, (t) => ve[t]);
|
|
4506
4722
|
}
|
|
4507
4723
|
function De(c) {
|
|
4508
4724
|
return {
|
|
@@ -4513,7 +4729,7 @@ function De(c) {
|
|
|
4513
4729
|
...c
|
|
4514
4730
|
};
|
|
4515
4731
|
}
|
|
4516
|
-
function
|
|
4732
|
+
function Kt(c) {
|
|
4517
4733
|
return typeof c != "number" ? De(c) : {
|
|
4518
4734
|
top: c,
|
|
4519
4735
|
right: c,
|
|
@@ -4521,7 +4737,7 @@ function Nt(c) {
|
|
|
4521
4737
|
left: c
|
|
4522
4738
|
};
|
|
4523
4739
|
}
|
|
4524
|
-
function
|
|
4740
|
+
function rt(c) {
|
|
4525
4741
|
const {
|
|
4526
4742
|
x: t,
|
|
4527
4743
|
y: e,
|
|
@@ -4539,12 +4755,12 @@ function ot(c) {
|
|
|
4539
4755
|
y: e
|
|
4540
4756
|
};
|
|
4541
4757
|
}
|
|
4542
|
-
function
|
|
4758
|
+
function _t(c, t, e) {
|
|
4543
4759
|
let {
|
|
4544
4760
|
reference: i,
|
|
4545
4761
|
floating: s
|
|
4546
4762
|
} = c;
|
|
4547
|
-
const o = V(t), r =
|
|
4763
|
+
const o = V(t), r = gt(t), l = ut(r), a = z(t), h = o === "y", d = i.x + i.width / 2 - s.width / 2, f = i.y + i.height / 2 - s.height / 2, x = i[l] / 2 - s[l] / 2;
|
|
4548
4764
|
let u;
|
|
4549
4765
|
switch (a) {
|
|
4550
4766
|
case "top":
|
|
@@ -4577,7 +4793,7 @@ function It(c, t, e) {
|
|
|
4577
4793
|
y: i.y
|
|
4578
4794
|
};
|
|
4579
4795
|
}
|
|
4580
|
-
switch (
|
|
4796
|
+
switch (tt(t)) {
|
|
4581
4797
|
case "start":
|
|
4582
4798
|
u[r] -= x * (e && h ? -1 : 1);
|
|
4583
4799
|
break;
|
|
@@ -4601,17 +4817,17 @@ const ke = async (c, t, e) => {
|
|
|
4601
4817
|
}), {
|
|
4602
4818
|
x: d,
|
|
4603
4819
|
y: f
|
|
4604
|
-
} =
|
|
4605
|
-
for (let
|
|
4820
|
+
} = _t(h, i, a), x = i, u = {}, w = 0;
|
|
4821
|
+
for (let E = 0; E < l.length; E++) {
|
|
4606
4822
|
const {
|
|
4607
|
-
name:
|
|
4608
|
-
fn:
|
|
4609
|
-
} = l[
|
|
4610
|
-
x:
|
|
4611
|
-
y
|
|
4612
|
-
data:
|
|
4823
|
+
name: g,
|
|
4824
|
+
fn: p
|
|
4825
|
+
} = l[E], {
|
|
4826
|
+
x: m,
|
|
4827
|
+
y,
|
|
4828
|
+
data: b,
|
|
4613
4829
|
reset: C
|
|
4614
|
-
} = await
|
|
4830
|
+
} = await p({
|
|
4615
4831
|
x: d,
|
|
4616
4832
|
y: f,
|
|
4617
4833
|
initialPlacement: i,
|
|
@@ -4625,20 +4841,20 @@ const ke = async (c, t, e) => {
|
|
|
4625
4841
|
floating: t
|
|
4626
4842
|
}
|
|
4627
4843
|
});
|
|
4628
|
-
d =
|
|
4844
|
+
d = m ?? d, f = y ?? f, u = {
|
|
4629
4845
|
...u,
|
|
4630
|
-
[
|
|
4631
|
-
...u[
|
|
4632
|
-
...
|
|
4846
|
+
[g]: {
|
|
4847
|
+
...u[g],
|
|
4848
|
+
...b
|
|
4633
4849
|
}
|
|
4634
|
-
}, C &&
|
|
4850
|
+
}, C && w <= 50 && (w++, typeof C == "object" && (C.placement && (x = C.placement), C.rects && (h = C.rects === !0 ? await r.getElementRects({
|
|
4635
4851
|
reference: c,
|
|
4636
4852
|
floating: t,
|
|
4637
4853
|
strategy: s
|
|
4638
4854
|
}) : C.rects), {
|
|
4639
4855
|
x: d,
|
|
4640
4856
|
y: f
|
|
4641
|
-
} =
|
|
4857
|
+
} = _t(h, x, a)), E = -1);
|
|
4642
4858
|
}
|
|
4643
4859
|
return {
|
|
4644
4860
|
x: d,
|
|
@@ -4664,33 +4880,33 @@ async function Yt(c, t) {
|
|
|
4664
4880
|
elementContext: f = "floating",
|
|
4665
4881
|
altBoundary: x = !1,
|
|
4666
4882
|
padding: u = 0
|
|
4667
|
-
} =
|
|
4668
|
-
element: (e = await (o.isElement == null ? void 0 : o.isElement(
|
|
4883
|
+
} = Q(t, c), w = Kt(u), g = l[x ? f === "floating" ? "reference" : "floating" : f], p = rt(await o.getClippingRect({
|
|
4884
|
+
element: (e = await (o.isElement == null ? void 0 : o.isElement(g))) == null || e ? g : g.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(l.floating)),
|
|
4669
4885
|
boundary: h,
|
|
4670
4886
|
rootBoundary: d,
|
|
4671
4887
|
strategy: a
|
|
4672
|
-
})),
|
|
4888
|
+
})), m = f === "floating" ? {
|
|
4673
4889
|
x: i,
|
|
4674
4890
|
y: s,
|
|
4675
4891
|
width: r.floating.width,
|
|
4676
4892
|
height: r.floating.height
|
|
4677
|
-
} : r.reference,
|
|
4893
|
+
} : r.reference, y = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(l.floating)), b = await (o.isElement == null ? void 0 : o.isElement(y)) ? await (o.getScale == null ? void 0 : o.getScale(y)) || {
|
|
4678
4894
|
x: 1,
|
|
4679
4895
|
y: 1
|
|
4680
4896
|
} : {
|
|
4681
4897
|
x: 1,
|
|
4682
4898
|
y: 1
|
|
4683
|
-
}, C =
|
|
4899
|
+
}, C = rt(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
4684
4900
|
elements: l,
|
|
4685
|
-
rect:
|
|
4686
|
-
offsetParent:
|
|
4901
|
+
rect: m,
|
|
4902
|
+
offsetParent: y,
|
|
4687
4903
|
strategy: a
|
|
4688
|
-
}) :
|
|
4904
|
+
}) : m);
|
|
4689
4905
|
return {
|
|
4690
|
-
top: (
|
|
4691
|
-
bottom: (C.bottom -
|
|
4692
|
-
left: (
|
|
4693
|
-
right: (C.right -
|
|
4906
|
+
top: (p.top - C.top + w.top) / b.y,
|
|
4907
|
+
bottom: (C.bottom - p.bottom + w.bottom) / b.y,
|
|
4908
|
+
left: (p.left - C.left + w.left) / b.x,
|
|
4909
|
+
right: (C.right - p.right + w.right) / b.x
|
|
4694
4910
|
};
|
|
4695
4911
|
}
|
|
4696
4912
|
const Xe = (c) => ({
|
|
@@ -4708,21 +4924,21 @@ const Xe = (c) => ({
|
|
|
4708
4924
|
} = t, {
|
|
4709
4925
|
element: h,
|
|
4710
4926
|
padding: d = 0
|
|
4711
|
-
} =
|
|
4927
|
+
} = Q(c, t) || {};
|
|
4712
4928
|
if (h == null)
|
|
4713
4929
|
return {};
|
|
4714
|
-
const f =
|
|
4930
|
+
const f = Kt(d), x = {
|
|
4715
4931
|
x: e,
|
|
4716
4932
|
y: i
|
|
4717
|
-
}, u =
|
|
4718
|
-
let _ = I ? I[
|
|
4719
|
-
(!_ || !await (r.isElement == null ? void 0 : r.isElement(I))) && (_ = l.floating[
|
|
4720
|
-
const
|
|
4933
|
+
}, u = gt(s), w = ut(u), E = await r.getDimensions(h), g = u === "y", p = g ? "top" : "left", m = g ? "bottom" : "right", y = g ? "clientHeight" : "clientWidth", b = o.reference[w] + o.reference[u] - x[u] - o.floating[w], C = x[u] - o.reference[u], I = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(h));
|
|
4934
|
+
let _ = I ? I[y] : 0;
|
|
4935
|
+
(!_ || !await (r.isElement == null ? void 0 : r.isElement(I))) && (_ = l.floating[y] || o.floating[w]);
|
|
4936
|
+
const T = b / 2 - C / 2, v = _ / 2 - E[w] / 2 - 1, R = q(f[p], v), S = q(f[m], v), O = R, M = _ - E[w] - S, L = _ / 2 - E[w] / 2 + T, H = dt(O, L, M), Y = !a.arrow && tt(s) != null && L !== H && o.reference[w] / 2 - (L < O ? R : S) - E[w] / 2 < 0, D = Y ? L < O ? L - O : L - M : 0;
|
|
4721
4937
|
return {
|
|
4722
4938
|
[u]: x[u] + D,
|
|
4723
4939
|
data: {
|
|
4724
4940
|
[u]: H,
|
|
4725
|
-
centerOffset:
|
|
4941
|
+
centerOffset: L - H - D,
|
|
4726
4942
|
...Y && {
|
|
4727
4943
|
alignmentOffset: D
|
|
4728
4944
|
}
|
|
@@ -4748,47 +4964,47 @@ const Xe = (c) => ({
|
|
|
4748
4964
|
crossAxis: f = !0,
|
|
4749
4965
|
fallbackPlacements: x,
|
|
4750
4966
|
fallbackStrategy: u = "bestFit",
|
|
4751
|
-
fallbackAxisSideDirection:
|
|
4752
|
-
flipAlignment:
|
|
4753
|
-
...
|
|
4754
|
-
} =
|
|
4967
|
+
fallbackAxisSideDirection: w = "none",
|
|
4968
|
+
flipAlignment: E = !0,
|
|
4969
|
+
...g
|
|
4970
|
+
} = Q(c, t);
|
|
4755
4971
|
if ((e = o.arrow) != null && e.alignmentOffset)
|
|
4756
4972
|
return {};
|
|
4757
|
-
const
|
|
4758
|
-
!x && I && C.push(...He(l,
|
|
4759
|
-
const _ = [l, ...C],
|
|
4760
|
-
let
|
|
4761
|
-
if (d && v.push(
|
|
4762
|
-
const
|
|
4763
|
-
v.push(
|
|
4973
|
+
const p = z(s), m = V(l), y = z(l) === l, b = await (a.isRTL == null ? void 0 : a.isRTL(h.floating)), C = x || (y || !E ? [ot(l)] : Oe(l)), I = w !== "none";
|
|
4974
|
+
!x && I && C.push(...He(l, E, w, b));
|
|
4975
|
+
const _ = [l, ...C], T = await Yt(t, g), v = [];
|
|
4976
|
+
let R = ((i = o.flip) == null ? void 0 : i.overflows) || [];
|
|
4977
|
+
if (d && v.push(T[p]), f) {
|
|
4978
|
+
const L = Te(s, r, b);
|
|
4979
|
+
v.push(T[L[0]], T[L[1]]);
|
|
4764
4980
|
}
|
|
4765
|
-
if (
|
|
4981
|
+
if (R = [...R, {
|
|
4766
4982
|
placement: s,
|
|
4767
4983
|
overflows: v
|
|
4768
|
-
}], !v.every((
|
|
4769
|
-
var
|
|
4770
|
-
const
|
|
4771
|
-
if (H && (!(f === "alignment" ?
|
|
4984
|
+
}], !v.every((L) => L <= 0)) {
|
|
4985
|
+
var S, O;
|
|
4986
|
+
const L = (((S = o.flip) == null ? void 0 : S.index) || 0) + 1, H = _[L];
|
|
4987
|
+
if (H && (!(f === "alignment" ? m !== V(H) : !1) || // We leave the current main axis only if every placement on that axis
|
|
4772
4988
|
// overflows the main axis.
|
|
4773
|
-
|
|
4989
|
+
R.every((k) => V(k.placement) === m ? k.overflows[0] > 0 : !0)))
|
|
4774
4990
|
return {
|
|
4775
4991
|
data: {
|
|
4776
|
-
index:
|
|
4777
|
-
overflows:
|
|
4992
|
+
index: L,
|
|
4993
|
+
overflows: R
|
|
4778
4994
|
},
|
|
4779
4995
|
reset: {
|
|
4780
4996
|
placement: H
|
|
4781
4997
|
}
|
|
4782
4998
|
};
|
|
4783
|
-
let Y = (
|
|
4999
|
+
let Y = (O = R.filter((D) => D.overflows[0] <= 0).sort((D, k) => D.overflows[1] - k.overflows[1])[0]) == null ? void 0 : O.placement;
|
|
4784
5000
|
if (!Y)
|
|
4785
5001
|
switch (u) {
|
|
4786
5002
|
case "bestFit": {
|
|
4787
5003
|
var M;
|
|
4788
|
-
const D = (M =
|
|
5004
|
+
const D = (M = R.filter((k) => {
|
|
4789
5005
|
if (I) {
|
|
4790
5006
|
const W = V(k.placement);
|
|
4791
|
-
return W ===
|
|
5007
|
+
return W === m || // Create a bias to the `y` side axis due to horizontal
|
|
4792
5008
|
// reading directions favoring greater width.
|
|
4793
5009
|
W === "y";
|
|
4794
5010
|
}
|
|
@@ -4811,17 +5027,17 @@ const Xe = (c) => ({
|
|
|
4811
5027
|
return {};
|
|
4812
5028
|
}
|
|
4813
5029
|
};
|
|
4814
|
-
},
|
|
4815
|
-
async function
|
|
5030
|
+
}, Ne = /* @__PURE__ */ new Set(["left", "top"]);
|
|
5031
|
+
async function Ke(c, t) {
|
|
4816
5032
|
const {
|
|
4817
5033
|
placement: e,
|
|
4818
5034
|
platform: i,
|
|
4819
5035
|
elements: s
|
|
4820
|
-
} = c, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r = z(e), l =
|
|
5036
|
+
} = c, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r = z(e), l = tt(e), a = V(e) === "y", h = Ne.has(r) ? -1 : 1, d = o && a ? -1 : 1, f = Q(t, c);
|
|
4821
5037
|
let {
|
|
4822
5038
|
mainAxis: x,
|
|
4823
5039
|
crossAxis: u,
|
|
4824
|
-
alignmentAxis:
|
|
5040
|
+
alignmentAxis: w
|
|
4825
5041
|
} = typeof f == "number" ? {
|
|
4826
5042
|
mainAxis: f,
|
|
4827
5043
|
crossAxis: 0,
|
|
@@ -4831,7 +5047,7 @@ async function Ne(c, t) {
|
|
|
4831
5047
|
crossAxis: f.crossAxis || 0,
|
|
4832
5048
|
alignmentAxis: f.alignmentAxis
|
|
4833
5049
|
};
|
|
4834
|
-
return l && typeof
|
|
5050
|
+
return l && typeof w == "number" && (u = l === "end" ? w * -1 : w), a ? {
|
|
4835
5051
|
x: u * d,
|
|
4836
5052
|
y: x * h
|
|
4837
5053
|
} : {
|
|
@@ -4850,7 +5066,7 @@ const Ye = function(c) {
|
|
|
4850
5066
|
y: o,
|
|
4851
5067
|
placement: r,
|
|
4852
5068
|
middlewareData: l
|
|
4853
|
-
} = t, a = await
|
|
5069
|
+
} = t, a = await Ke(t, c);
|
|
4854
5070
|
return r === ((e = l.offset) == null ? void 0 : e.placement) && (i = l.arrow) != null && i.alignmentOffset ? {} : {
|
|
4855
5071
|
x: s + a.x,
|
|
4856
5072
|
y: o + a.y,
|
|
@@ -4874,41 +5090,41 @@ const Ye = function(c) {
|
|
|
4874
5090
|
mainAxis: o = !0,
|
|
4875
5091
|
crossAxis: r = !1,
|
|
4876
5092
|
limiter: l = {
|
|
4877
|
-
fn: (
|
|
5093
|
+
fn: (g) => {
|
|
4878
5094
|
let {
|
|
4879
|
-
x:
|
|
4880
|
-
y
|
|
4881
|
-
} =
|
|
5095
|
+
x: p,
|
|
5096
|
+
y: m
|
|
5097
|
+
} = g;
|
|
4882
5098
|
return {
|
|
4883
|
-
x:
|
|
4884
|
-
y
|
|
5099
|
+
x: p,
|
|
5100
|
+
y: m
|
|
4885
5101
|
};
|
|
4886
5102
|
}
|
|
4887
5103
|
},
|
|
4888
5104
|
...a
|
|
4889
|
-
} =
|
|
5105
|
+
} = Q(c, t), h = {
|
|
4890
5106
|
x: e,
|
|
4891
5107
|
y: i
|
|
4892
|
-
}, d = await Yt(t, a), f = V(z(s)), x =
|
|
4893
|
-
let u = h[x],
|
|
5108
|
+
}, d = await Yt(t, a), f = V(z(s)), x = Nt(f);
|
|
5109
|
+
let u = h[x], w = h[f];
|
|
4894
5110
|
if (o) {
|
|
4895
|
-
const
|
|
4896
|
-
u =
|
|
5111
|
+
const g = x === "y" ? "top" : "left", p = x === "y" ? "bottom" : "right", m = u + d[g], y = u - d[p];
|
|
5112
|
+
u = dt(m, u, y);
|
|
4897
5113
|
}
|
|
4898
5114
|
if (r) {
|
|
4899
|
-
const
|
|
4900
|
-
|
|
5115
|
+
const g = f === "y" ? "top" : "left", p = f === "y" ? "bottom" : "right", m = w + d[g], y = w - d[p];
|
|
5116
|
+
w = dt(m, w, y);
|
|
4901
5117
|
}
|
|
4902
|
-
const
|
|
5118
|
+
const E = l.fn({
|
|
4903
5119
|
...t,
|
|
4904
5120
|
[x]: u,
|
|
4905
|
-
[f]:
|
|
5121
|
+
[f]: w
|
|
4906
5122
|
});
|
|
4907
5123
|
return {
|
|
4908
|
-
...
|
|
5124
|
+
...E,
|
|
4909
5125
|
data: {
|
|
4910
|
-
x:
|
|
4911
|
-
y:
|
|
5126
|
+
x: E.x - e,
|
|
5127
|
+
y: E.y - i,
|
|
4912
5128
|
enabled: {
|
|
4913
5129
|
[x]: o,
|
|
4914
5130
|
[f]: r
|
|
@@ -4918,10 +5134,10 @@ const Ye = function(c) {
|
|
|
4918
5134
|
}
|
|
4919
5135
|
};
|
|
4920
5136
|
};
|
|
4921
|
-
function
|
|
5137
|
+
function nt() {
|
|
4922
5138
|
return typeof window < "u";
|
|
4923
5139
|
}
|
|
4924
|
-
function
|
|
5140
|
+
function Z(c) {
|
|
4925
5141
|
return Ft(c) ? (c.nodeName || "").toLowerCase() : "#document";
|
|
4926
5142
|
}
|
|
4927
5143
|
function A(c) {
|
|
@@ -4933,19 +5149,19 @@ function F(c) {
|
|
|
4933
5149
|
return (t = (Ft(c) ? c.ownerDocument : c.document) || window.document) == null ? void 0 : t.documentElement;
|
|
4934
5150
|
}
|
|
4935
5151
|
function Ft(c) {
|
|
4936
|
-
return
|
|
5152
|
+
return nt() ? c instanceof Node || c instanceof A(c).Node : !1;
|
|
4937
5153
|
}
|
|
4938
5154
|
function X(c) {
|
|
4939
|
-
return
|
|
5155
|
+
return nt() ? c instanceof Element || c instanceof A(c).Element : !1;
|
|
4940
5156
|
}
|
|
4941
|
-
function
|
|
4942
|
-
return
|
|
5157
|
+
function K(c) {
|
|
5158
|
+
return nt() ? c instanceof HTMLElement || c instanceof A(c).HTMLElement : !1;
|
|
4943
5159
|
}
|
|
4944
|
-
function
|
|
4945
|
-
return !
|
|
5160
|
+
function St(c) {
|
|
5161
|
+
return !nt() || typeof ShadowRoot > "u" ? !1 : c instanceof ShadowRoot || c instanceof A(c).ShadowRoot;
|
|
4946
5162
|
}
|
|
4947
5163
|
const We = /* @__PURE__ */ new Set(["inline", "contents"]);
|
|
4948
|
-
function
|
|
5164
|
+
function et(c) {
|
|
4949
5165
|
const {
|
|
4950
5166
|
overflow: t,
|
|
4951
5167
|
overflowX: e,
|
|
@@ -4956,10 +5172,10 @@ function tt(c) {
|
|
|
4956
5172
|
}
|
|
4957
5173
|
const Ve = /* @__PURE__ */ new Set(["table", "td", "th"]);
|
|
4958
5174
|
function Pe(c) {
|
|
4959
|
-
return Ve.has(
|
|
5175
|
+
return Ve.has(Z(c));
|
|
4960
5176
|
}
|
|
4961
5177
|
const ze = [":popover-open", ":modal"];
|
|
4962
|
-
function
|
|
5178
|
+
function lt(c) {
|
|
4963
5179
|
return ze.some((t) => {
|
|
4964
5180
|
try {
|
|
4965
5181
|
return c.matches(t);
|
|
@@ -4969,32 +5185,32 @@ function nt(c) {
|
|
|
4969
5185
|
});
|
|
4970
5186
|
}
|
|
4971
5187
|
const $e = ["transform", "translate", "scale", "rotate", "perspective"], Ge = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Ue = ["paint", "layout", "strict", "content"];
|
|
4972
|
-
function
|
|
4973
|
-
const t =
|
|
5188
|
+
function wt(c) {
|
|
5189
|
+
const t = Et(), e = X(c) ? B(c) : c;
|
|
4974
5190
|
return $e.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) || Ge.some((i) => (e.willChange || "").includes(i)) || Ue.some((i) => (e.contain || "").includes(i));
|
|
4975
5191
|
}
|
|
4976
5192
|
function je(c) {
|
|
4977
5193
|
let t = P(c);
|
|
4978
|
-
for (;
|
|
4979
|
-
if (
|
|
5194
|
+
for (; K(t) && !j(t); ) {
|
|
5195
|
+
if (wt(t))
|
|
4980
5196
|
return t;
|
|
4981
|
-
if (
|
|
5197
|
+
if (lt(t))
|
|
4982
5198
|
return null;
|
|
4983
5199
|
t = P(t);
|
|
4984
5200
|
}
|
|
4985
5201
|
return null;
|
|
4986
5202
|
}
|
|
4987
|
-
function
|
|
5203
|
+
function Et() {
|
|
4988
5204
|
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
4989
5205
|
}
|
|
4990
5206
|
const Ze = /* @__PURE__ */ new Set(["html", "body", "#document"]);
|
|
4991
|
-
function
|
|
4992
|
-
return Ze.has(
|
|
5207
|
+
function j(c) {
|
|
5208
|
+
return Ze.has(Z(c));
|
|
4993
5209
|
}
|
|
4994
5210
|
function B(c) {
|
|
4995
5211
|
return A(c).getComputedStyle(c);
|
|
4996
5212
|
}
|
|
4997
|
-
function
|
|
5213
|
+
function at(c) {
|
|
4998
5214
|
return X(c) ? {
|
|
4999
5215
|
scrollLeft: c.scrollLeft,
|
|
5000
5216
|
scrollTop: c.scrollTop
|
|
@@ -5004,34 +5220,34 @@ function lt(c) {
|
|
|
5004
5220
|
};
|
|
5005
5221
|
}
|
|
5006
5222
|
function P(c) {
|
|
5007
|
-
if (
|
|
5223
|
+
if (Z(c) === "html")
|
|
5008
5224
|
return c;
|
|
5009
5225
|
const t = (
|
|
5010
5226
|
// Step into the shadow DOM of the parent of a slotted node.
|
|
5011
5227
|
c.assignedSlot || // DOM Element detected.
|
|
5012
5228
|
c.parentNode || // ShadowRoot detected.
|
|
5013
|
-
|
|
5229
|
+
St(c) && c.host || // Fallback.
|
|
5014
5230
|
F(c)
|
|
5015
5231
|
);
|
|
5016
|
-
return
|
|
5232
|
+
return St(t) ? t.host : t;
|
|
5017
5233
|
}
|
|
5018
5234
|
function Wt(c) {
|
|
5019
5235
|
const t = P(c);
|
|
5020
|
-
return
|
|
5236
|
+
return j(t) ? c.ownerDocument ? c.ownerDocument.body : c.body : K(t) && et(t) ? t : Wt(t);
|
|
5021
5237
|
}
|
|
5022
5238
|
function Vt(c, t, e) {
|
|
5023
5239
|
var i;
|
|
5024
5240
|
t === void 0 && (t = []);
|
|
5025
5241
|
const s = Wt(c), o = s === ((i = c.ownerDocument) == null ? void 0 : i.body), r = A(s);
|
|
5026
|
-
return o ? (
|
|
5242
|
+
return o ? (xt(r), t.concat(r, r.visualViewport || [], et(s) ? s : [], [])) : t.concat(s, Vt(s, []));
|
|
5027
5243
|
}
|
|
5028
|
-
function
|
|
5244
|
+
function xt(c) {
|
|
5029
5245
|
return c.parent && Object.getPrototypeOf(c.parent) ? c.frameElement : null;
|
|
5030
5246
|
}
|
|
5031
5247
|
function Pt(c) {
|
|
5032
5248
|
const t = B(c);
|
|
5033
5249
|
let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
|
|
5034
|
-
const s =
|
|
5250
|
+
const s = K(c), o = s ? c.offsetWidth : e, r = s ? c.offsetHeight : i, l = st(e) !== o || st(i) !== r;
|
|
5035
5251
|
return l && (e = o, i = r), {
|
|
5036
5252
|
width: e,
|
|
5037
5253
|
height: i,
|
|
@@ -5041,25 +5257,25 @@ function Pt(c) {
|
|
|
5041
5257
|
function zt(c) {
|
|
5042
5258
|
return X(c) ? c : c.contextElement;
|
|
5043
5259
|
}
|
|
5044
|
-
function
|
|
5260
|
+
function U(c) {
|
|
5045
5261
|
const t = zt(c);
|
|
5046
|
-
if (!
|
|
5047
|
-
return
|
|
5262
|
+
if (!K(t))
|
|
5263
|
+
return N(1);
|
|
5048
5264
|
const e = t.getBoundingClientRect(), {
|
|
5049
5265
|
width: i,
|
|
5050
5266
|
height: s,
|
|
5051
5267
|
$: o
|
|
5052
5268
|
} = Pt(t);
|
|
5053
|
-
let r = (o ?
|
|
5269
|
+
let r = (o ? st(e.width) : e.width) / i, l = (o ? st(e.height) : e.height) / s;
|
|
5054
5270
|
return (!r || !Number.isFinite(r)) && (r = 1), (!l || !Number.isFinite(l)) && (l = 1), {
|
|
5055
5271
|
x: r,
|
|
5056
5272
|
y: l
|
|
5057
5273
|
};
|
|
5058
5274
|
}
|
|
5059
|
-
const qe = /* @__PURE__ */
|
|
5275
|
+
const qe = /* @__PURE__ */ N(0);
|
|
5060
5276
|
function $t(c) {
|
|
5061
5277
|
const t = A(c);
|
|
5062
|
-
return !
|
|
5278
|
+
return !Et() || !t.visualViewport ? qe : {
|
|
5063
5279
|
x: t.visualViewport.offsetLeft,
|
|
5064
5280
|
y: t.visualViewport.offsetTop
|
|
5065
5281
|
};
|
|
@@ -5067,22 +5283,22 @@ function $t(c) {
|
|
|
5067
5283
|
function Je(c, t, e) {
|
|
5068
5284
|
return t === void 0 && (t = !1), !e || t && e !== A(c) ? !1 : t;
|
|
5069
5285
|
}
|
|
5070
|
-
function
|
|
5286
|
+
function J(c, t, e, i) {
|
|
5071
5287
|
t === void 0 && (t = !1), e === void 0 && (e = !1);
|
|
5072
5288
|
const s = c.getBoundingClientRect(), o = zt(c);
|
|
5073
|
-
let r =
|
|
5074
|
-
t && (i ? X(i) && (r =
|
|
5075
|
-
const l = Je(o, e, i) ? $t(o) :
|
|
5289
|
+
let r = N(1);
|
|
5290
|
+
t && (i ? X(i) && (r = U(i)) : r = U(c));
|
|
5291
|
+
const l = Je(o, e, i) ? $t(o) : N(0);
|
|
5076
5292
|
let a = (s.left + l.x) / r.x, h = (s.top + l.y) / r.y, d = s.width / r.x, f = s.height / r.y;
|
|
5077
5293
|
if (o) {
|
|
5078
5294
|
const x = A(o), u = i && X(i) ? A(i) : i;
|
|
5079
|
-
let
|
|
5080
|
-
for (;
|
|
5081
|
-
const
|
|
5082
|
-
a *=
|
|
5295
|
+
let w = x, E = xt(w);
|
|
5296
|
+
for (; E && i && u !== w; ) {
|
|
5297
|
+
const g = U(E), p = E.getBoundingClientRect(), m = B(E), y = p.left + (E.clientLeft + parseFloat(m.paddingLeft)) * g.x, b = p.top + (E.clientTop + parseFloat(m.paddingTop)) * g.y;
|
|
5298
|
+
a *= g.x, h *= g.y, d *= g.x, f *= g.y, a += y, h += b, w = A(E), E = xt(w);
|
|
5083
5299
|
}
|
|
5084
5300
|
}
|
|
5085
|
-
return
|
|
5301
|
+
return rt({
|
|
5086
5302
|
width: d,
|
|
5087
5303
|
height: f,
|
|
5088
5304
|
x: a,
|
|
@@ -5090,8 +5306,8 @@ function q(c, t, e, i) {
|
|
|
5090
5306
|
});
|
|
5091
5307
|
}
|
|
5092
5308
|
function pt(c, t) {
|
|
5093
|
-
const e =
|
|
5094
|
-
return t ? t.left + e :
|
|
5309
|
+
const e = at(c).scrollLeft;
|
|
5310
|
+
return t ? t.left + e : J(F(c)).left + e;
|
|
5095
5311
|
}
|
|
5096
5312
|
function Gt(c, t, e) {
|
|
5097
5313
|
e === void 0 && (e = !1);
|
|
@@ -5111,19 +5327,19 @@ function Qe(c) {
|
|
|
5111
5327
|
offsetParent: i,
|
|
5112
5328
|
strategy: s
|
|
5113
5329
|
} = c;
|
|
5114
|
-
const o = s === "fixed", r = F(i), l = t ?
|
|
5330
|
+
const o = s === "fixed", r = F(i), l = t ? lt(t.floating) : !1;
|
|
5115
5331
|
if (i === r || l && o)
|
|
5116
5332
|
return e;
|
|
5117
5333
|
let a = {
|
|
5118
5334
|
scrollLeft: 0,
|
|
5119
5335
|
scrollTop: 0
|
|
5120
|
-
}, h =
|
|
5121
|
-
const d =
|
|
5122
|
-
if ((f || !f && !o) && ((
|
|
5123
|
-
const u =
|
|
5124
|
-
h =
|
|
5336
|
+
}, h = N(1);
|
|
5337
|
+
const d = N(0), f = K(i);
|
|
5338
|
+
if ((f || !f && !o) && ((Z(i) !== "body" || et(r)) && (a = at(i)), K(i))) {
|
|
5339
|
+
const u = J(i);
|
|
5340
|
+
h = U(i), d.x = u.x + i.clientLeft, d.y = u.y + i.clientTop;
|
|
5125
5341
|
}
|
|
5126
|
-
const x = r && !f && !o ? Gt(r, a, !0) :
|
|
5342
|
+
const x = r && !f && !o ? Gt(r, a, !0) : N(0);
|
|
5127
5343
|
return {
|
|
5128
5344
|
width: e.width * h.x,
|
|
5129
5345
|
height: e.height * h.y,
|
|
@@ -5135,10 +5351,10 @@ function ti(c) {
|
|
|
5135
5351
|
return Array.from(c.getClientRects());
|
|
5136
5352
|
}
|
|
5137
5353
|
function ei(c) {
|
|
5138
|
-
const t = F(c), e =
|
|
5354
|
+
const t = F(c), e = at(c), i = c.ownerDocument.body, s = G(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), o = G(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
|
|
5139
5355
|
let r = -e.scrollLeft + pt(c);
|
|
5140
5356
|
const l = -e.scrollTop;
|
|
5141
|
-
return B(i).direction === "rtl" && (r +=
|
|
5357
|
+
return B(i).direction === "rtl" && (r += G(t.clientWidth, i.clientWidth) - s), {
|
|
5142
5358
|
width: s,
|
|
5143
5359
|
height: o,
|
|
5144
5360
|
x: r,
|
|
@@ -5150,7 +5366,7 @@ function ii(c, t) {
|
|
|
5150
5366
|
let o = i.clientWidth, r = i.clientHeight, l = 0, a = 0;
|
|
5151
5367
|
if (s) {
|
|
5152
5368
|
o = s.width, r = s.height;
|
|
5153
|
-
const h =
|
|
5369
|
+
const h = Et();
|
|
5154
5370
|
(!h || h && t === "fixed") && (l = s.offsetLeft, a = s.offsetTop);
|
|
5155
5371
|
}
|
|
5156
5372
|
return {
|
|
@@ -5162,7 +5378,7 @@ function ii(c, t) {
|
|
|
5162
5378
|
}
|
|
5163
5379
|
const si = /* @__PURE__ */ new Set(["absolute", "fixed"]);
|
|
5164
5380
|
function oi(c, t) {
|
|
5165
|
-
const e =
|
|
5381
|
+
const e = J(c, !0, t === "fixed"), i = e.top + c.clientTop, s = e.left + c.clientLeft, o = K(c) ? U(c) : N(1), r = c.clientWidth * o.x, l = c.clientHeight * o.y, a = s * o.x, h = i * o.y;
|
|
5166
5382
|
return {
|
|
5167
5383
|
width: r,
|
|
5168
5384
|
height: l,
|
|
@@ -5170,7 +5386,7 @@ function oi(c, t) {
|
|
|
5170
5386
|
y: h
|
|
5171
5387
|
};
|
|
5172
5388
|
}
|
|
5173
|
-
function
|
|
5389
|
+
function Tt(c, t, e) {
|
|
5174
5390
|
let i;
|
|
5175
5391
|
if (t === "viewport")
|
|
5176
5392
|
i = ii(c, e);
|
|
@@ -5187,22 +5403,22 @@ function Ot(c, t, e) {
|
|
|
5187
5403
|
height: t.height
|
|
5188
5404
|
};
|
|
5189
5405
|
}
|
|
5190
|
-
return
|
|
5406
|
+
return rt(i);
|
|
5191
5407
|
}
|
|
5192
5408
|
function Ut(c, t) {
|
|
5193
5409
|
const e = P(c);
|
|
5194
|
-
return e === t || !X(e) ||
|
|
5410
|
+
return e === t || !X(e) || j(e) ? !1 : B(e).position === "fixed" || Ut(e, t);
|
|
5195
5411
|
}
|
|
5196
5412
|
function ri(c, t) {
|
|
5197
5413
|
const e = t.get(c);
|
|
5198
5414
|
if (e)
|
|
5199
5415
|
return e;
|
|
5200
|
-
let i = Vt(c, []).filter((l) => X(l) &&
|
|
5416
|
+
let i = Vt(c, []).filter((l) => X(l) && Z(l) !== "body"), s = null;
|
|
5201
5417
|
const o = B(c).position === "fixed";
|
|
5202
5418
|
let r = o ? P(c) : c;
|
|
5203
|
-
for (; X(r) && !
|
|
5204
|
-
const l = B(r), a =
|
|
5205
|
-
!a && l.position === "fixed" && (s = null), (o ? !a && !s : !a && l.position === "static" && !!s && si.has(s.position) ||
|
|
5419
|
+
for (; X(r) && !j(r); ) {
|
|
5420
|
+
const l = B(r), a = wt(r);
|
|
5421
|
+
!a && l.position === "fixed" && (s = null), (o ? !a && !s : !a && l.position === "static" && !!s && si.has(s.position) || et(r) && !a && Ut(c, r)) ? i = i.filter((d) => d !== r) : s = l, r = P(r);
|
|
5206
5422
|
}
|
|
5207
5423
|
return t.set(c, i), i;
|
|
5208
5424
|
}
|
|
@@ -5213,10 +5429,10 @@ function ni(c) {
|
|
|
5213
5429
|
rootBoundary: i,
|
|
5214
5430
|
strategy: s
|
|
5215
5431
|
} = c;
|
|
5216
|
-
const r = [...e === "clippingAncestors" ?
|
|
5217
|
-
const f =
|
|
5218
|
-
return h.top =
|
|
5219
|
-
},
|
|
5432
|
+
const r = [...e === "clippingAncestors" ? lt(t) ? [] : ri(t, this._c) : [].concat(e), i], l = r[0], a = r.reduce((h, d) => {
|
|
5433
|
+
const f = Tt(t, d, s);
|
|
5434
|
+
return h.top = G(f.top, h.top), h.right = q(f.right, h.right), h.bottom = q(f.bottom, h.bottom), h.left = G(f.left, h.left), h;
|
|
5435
|
+
}, Tt(t, l, s));
|
|
5220
5436
|
return {
|
|
5221
5437
|
width: a.right - a.left,
|
|
5222
5438
|
height: a.bottom - a.top,
|
|
@@ -5235,22 +5451,22 @@ function li(c) {
|
|
|
5235
5451
|
};
|
|
5236
5452
|
}
|
|
5237
5453
|
function ai(c, t, e) {
|
|
5238
|
-
const i =
|
|
5454
|
+
const i = K(t), s = F(t), o = e === "fixed", r = J(c, !0, o, t);
|
|
5239
5455
|
let l = {
|
|
5240
5456
|
scrollLeft: 0,
|
|
5241
5457
|
scrollTop: 0
|
|
5242
5458
|
};
|
|
5243
|
-
const a =
|
|
5459
|
+
const a = N(0);
|
|
5244
5460
|
function h() {
|
|
5245
5461
|
a.x = pt(s);
|
|
5246
5462
|
}
|
|
5247
5463
|
if (i || !i && !o)
|
|
5248
|
-
if ((
|
|
5249
|
-
const u =
|
|
5464
|
+
if ((Z(t) !== "body" || et(s)) && (l = at(t)), i) {
|
|
5465
|
+
const u = J(t, !0, o, t);
|
|
5250
5466
|
a.x = u.x + t.clientLeft, a.y = u.y + t.clientTop;
|
|
5251
5467
|
} else s && h();
|
|
5252
5468
|
o && !i && s && h();
|
|
5253
|
-
const d = s && !i && !o ? Gt(s, l) :
|
|
5469
|
+
const d = s && !i && !o ? Gt(s, l) : N(0), f = r.left + l.scrollLeft - a.x - d.x, x = r.top + l.scrollTop - a.y - d.y;
|
|
5254
5470
|
return {
|
|
5255
5471
|
x: f,
|
|
5256
5472
|
y: x,
|
|
@@ -5258,11 +5474,11 @@ function ai(c, t, e) {
|
|
|
5258
5474
|
height: r.height
|
|
5259
5475
|
};
|
|
5260
5476
|
}
|
|
5261
|
-
function
|
|
5477
|
+
function ht(c) {
|
|
5262
5478
|
return B(c).position === "static";
|
|
5263
5479
|
}
|
|
5264
|
-
function
|
|
5265
|
-
if (!
|
|
5480
|
+
function Ot(c, t) {
|
|
5481
|
+
if (!K(c) || B(c).position === "fixed")
|
|
5266
5482
|
return null;
|
|
5267
5483
|
if (t)
|
|
5268
5484
|
return t(c);
|
|
@@ -5271,21 +5487,21 @@ function St(c, t) {
|
|
|
5271
5487
|
}
|
|
5272
5488
|
function jt(c, t) {
|
|
5273
5489
|
const e = A(c);
|
|
5274
|
-
if (
|
|
5490
|
+
if (lt(c))
|
|
5275
5491
|
return e;
|
|
5276
|
-
if (!
|
|
5492
|
+
if (!K(c)) {
|
|
5277
5493
|
let s = P(c);
|
|
5278
|
-
for (; s && !
|
|
5279
|
-
if (X(s) && !
|
|
5494
|
+
for (; s && !j(s); ) {
|
|
5495
|
+
if (X(s) && !ht(s))
|
|
5280
5496
|
return s;
|
|
5281
5497
|
s = P(s);
|
|
5282
5498
|
}
|
|
5283
5499
|
return e;
|
|
5284
5500
|
}
|
|
5285
|
-
let i =
|
|
5286
|
-
for (; i && Pe(i) &&
|
|
5287
|
-
i =
|
|
5288
|
-
return i &&
|
|
5501
|
+
let i = Ot(c, t);
|
|
5502
|
+
for (; i && Pe(i) && ht(i); )
|
|
5503
|
+
i = Ot(i, t);
|
|
5504
|
+
return i && j(i) && ht(i) && !wt(i) ? e : i || je(c) || e;
|
|
5289
5505
|
}
|
|
5290
5506
|
const hi = async function(c) {
|
|
5291
5507
|
const t = this.getOffsetParent || jt, e = this.getDimensions, i = await e(c.floating);
|
|
@@ -5310,7 +5526,7 @@ const di = {
|
|
|
5310
5526
|
getElementRects: hi,
|
|
5311
5527
|
getClientRects: ti,
|
|
5312
5528
|
getDimensions: li,
|
|
5313
|
-
getScale:
|
|
5529
|
+
getScale: U,
|
|
5314
5530
|
isElement: X,
|
|
5315
5531
|
isRTL: ci
|
|
5316
5532
|
}, Zt = Ye, qt = Fe, Jt = Be, fi = Xe, Qt = (c, t, e) => {
|
|
@@ -5538,7 +5754,7 @@ class ui {
|
|
|
5538
5754
|
const { xArr: e, yArr: i } = this.ctx.selector;
|
|
5539
5755
|
this.selectorArrStr = JSON.stringify(e) + JSON.stringify(i);
|
|
5540
5756
|
}), this.ctx.on("cellClick", (t) => {
|
|
5541
|
-
if (this.ctx.adjustPositioning || !this.isInSelectorRange(t.rowIndex, t.colIndex))
|
|
5757
|
+
if (this.ctx.adjustPositioning || this.ctx.isPointer || !this.isInSelectorRange(t.rowIndex, t.colIndex))
|
|
5542
5758
|
return;
|
|
5543
5759
|
const { xArr: e, yArr: i } = this.ctx.selector, s = JSON.stringify(e) + JSON.stringify(i);
|
|
5544
5760
|
if (this.selectorArrStr === s && this.cellTarget) {
|
|
@@ -5698,8 +5914,8 @@ class wi {
|
|
|
5698
5914
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
5699
5915
|
} = this.ctx, { visibleWidth: o, visibleHeight: r, renderCellHeaders: l } = this.ctx.header;
|
|
5700
5916
|
let a = [], h = [], d = [];
|
|
5701
|
-
l.forEach((
|
|
5702
|
-
|
|
5917
|
+
l.forEach((g) => {
|
|
5918
|
+
g.render && (g.fixed === "left" ? h.push(g) : g.fixed === "right" ? d.push(g) : a.push(g));
|
|
5703
5919
|
});
|
|
5704
5920
|
const f = e - i, x = {
|
|
5705
5921
|
key: "left",
|
|
@@ -5723,7 +5939,7 @@ class wi {
|
|
|
5723
5939
|
height: `${r}px`
|
|
5724
5940
|
},
|
|
5725
5941
|
cells: a
|
|
5726
|
-
},
|
|
5942
|
+
}, w = {
|
|
5727
5943
|
key: "right",
|
|
5728
5944
|
style: {
|
|
5729
5945
|
position: "absolute",
|
|
@@ -5744,15 +5960,15 @@ class wi {
|
|
|
5744
5960
|
width: `${o}px`,
|
|
5745
5961
|
height: `${r}px`
|
|
5746
5962
|
},
|
|
5747
|
-
views: [x, u,
|
|
5963
|
+
views: [x, u, w]
|
|
5748
5964
|
};
|
|
5749
5965
|
}
|
|
5750
5966
|
getBody() {
|
|
5751
5967
|
const t = [], e = [], i = [];
|
|
5752
5968
|
let s = this.ctx.body.renderRows;
|
|
5753
|
-
this.ctx.config.FOOTER_FIXED || (s = s.concat(this.ctx.footer.renderRows)), s.forEach((
|
|
5754
|
-
|
|
5755
|
-
|
|
5969
|
+
this.ctx.config.FOOTER_FIXED || (s = s.concat(this.ctx.footer.renderRows)), s.forEach((g) => {
|
|
5970
|
+
g.cells.forEach((p) => {
|
|
5971
|
+
p.cellType === "footer" && (p.render = p.renderFooter), p.render && (p.fixed === "left" ? e.push(p) : p.fixed === "right" ? i.push(p) : t.push(p));
|
|
5756
5972
|
});
|
|
5757
5973
|
});
|
|
5758
5974
|
const {
|
|
@@ -5781,7 +5997,7 @@ class wi {
|
|
|
5781
5997
|
height: `${d}px`
|
|
5782
5998
|
},
|
|
5783
5999
|
cells: t
|
|
5784
|
-
},
|
|
6000
|
+
}, w = {
|
|
5785
6001
|
key: "right",
|
|
5786
6002
|
style: {
|
|
5787
6003
|
position: "absolute",
|
|
@@ -5802,14 +6018,14 @@ class wi {
|
|
|
5802
6018
|
width: `${h}px`,
|
|
5803
6019
|
height: `${d}px`
|
|
5804
6020
|
},
|
|
5805
|
-
views: [x, u,
|
|
6021
|
+
views: [x, u, w]
|
|
5806
6022
|
};
|
|
5807
6023
|
}
|
|
5808
6024
|
getFooter() {
|
|
5809
6025
|
const t = [], e = [], i = [];
|
|
5810
|
-
this.ctx.footer.renderRows.forEach((
|
|
5811
|
-
|
|
5812
|
-
|
|
6026
|
+
this.ctx.footer.renderRows.forEach((E) => {
|
|
6027
|
+
E.cells.forEach((g) => {
|
|
6028
|
+
g.cellType === "footer" && g.renderFooter && (g.render = g.renderFooter, g.fixed === "left" ? e.push(g) : g.fixed === "right" ? i.push(g) : t.push(g));
|
|
5813
6029
|
});
|
|
5814
6030
|
});
|
|
5815
6031
|
const {
|
|
@@ -5863,7 +6079,7 @@ class wi {
|
|
|
5863
6079
|
};
|
|
5864
6080
|
}
|
|
5865
6081
|
}
|
|
5866
|
-
class
|
|
6082
|
+
class Ei {
|
|
5867
6083
|
constructor(t) {
|
|
5868
6084
|
n(this, "ctx");
|
|
5869
6085
|
n(this, "contextMenuEl");
|
|
@@ -5892,8 +6108,8 @@ class pi {
|
|
|
5892
6108
|
Qt(x, this.contextMenuEl, {
|
|
5893
6109
|
placement: "right-start",
|
|
5894
6110
|
middleware: [Zt(), qt(), Jt()]
|
|
5895
|
-
}).then(({ x: u, y:
|
|
5896
|
-
this.show(u,
|
|
6111
|
+
}).then(({ x: u, y: w }) => {
|
|
6112
|
+
this.show(u, w);
|
|
5897
6113
|
});
|
|
5898
6114
|
}), this.ctx.on("click", this.hide.bind(this)), this.ctx.on("onScroll", this.hide.bind(this)), this.ctx.on("resize", this.hide.bind(this));
|
|
5899
6115
|
}
|
|
@@ -5965,14 +6181,14 @@ class yi {
|
|
|
5965
6181
|
n(this, "contextMenu");
|
|
5966
6182
|
n(this, "ctx");
|
|
5967
6183
|
this.options = e;
|
|
5968
|
-
const { overlayerElement: i, editorElement: s, emptyElement: o, contextMenuElement: r } =
|
|
6184
|
+
const { overlayerElement: i, editorElement: s, emptyElement: o, contextMenuElement: r } = this.options, l = this.createContainer(
|
|
5969
6185
|
t,
|
|
5970
6186
|
i,
|
|
5971
6187
|
s,
|
|
5972
6188
|
o,
|
|
5973
6189
|
r
|
|
5974
6190
|
);
|
|
5975
|
-
this.ctx = new
|
|
6191
|
+
this.ctx = new pe(l, this.options), this.header = new ye(this.ctx), this.footer = new be(this.ctx), this.body = new Ce(this.ctx), this.scroller = new me(this.ctx), this.selector = new Re(this.ctx), this.autofill = new Ie(this.ctx), this.tooltip = new xi(this.ctx), this.empty = new gi(this.ctx), this.editor = new ui(this.ctx), this.overlayer = new wi(this.ctx), this.contextMenu = new Ei(this.ctx), this.ctx.on("draw", () => {
|
|
5976
6192
|
this.draw();
|
|
5977
6193
|
}), this.ctx.on("drawView", () => {
|
|
5978
6194
|
this.draw(!0);
|
|
@@ -6214,8 +6430,8 @@ class yi {
|
|
|
6214
6430
|
return {
|
|
6215
6431
|
mergeColCell: he,
|
|
6216
6432
|
mergeRowCell: ae,
|
|
6217
|
-
getSpanArrByRow:
|
|
6218
|
-
getSpanObjByColumn:
|
|
6433
|
+
getSpanArrByRow: Dt,
|
|
6434
|
+
getSpanObjByColumn: kt
|
|
6219
6435
|
};
|
|
6220
6436
|
}
|
|
6221
6437
|
getColumnByKey(t) {
|