e-virt-table 1.2.20 → 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 +1066 -834
- 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/Validator.js +3 -3
- package/dist/lib/Validator.js.map +1 -1
- package/dist/lib/types.d.ts +7 -3
- package/package.json +59 -57
package/dist/index.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode(":root{--evt-header-font: 12px normal Arial;--evt-body-font: 12px normal Arial;--evt-color-white: #fff;--evt-color-black: #000000;--evt-color-primary: rgb(82, 146, 247);--evt-text-color-primary: #333;--evt-text-color-regular: #666;--evt-text-color-secondary: #999;--evt-box-shadow: 0 2px 12px 0 #0000001a;--evt-editor-bg-color: #fff;--evt-editor-text-color: #333;--evt-border-color: #e1e6eb;--evt-stripe-color: #fafafa;--evt-placeholder-color: #cdd0dc;--evt-header-bg-color: #f8faff;--evt-body-bg-color: #fff;--evt-header-text-color: #1d2129;--evt-body-text-color: #4e5969;--evt-footer-text-color: #4e5969;--evt-loading-icon-color: #4e5969;--evt-expand-icon-color: #4e5969;--evt-shrink-icon-color: #4e5969;--evt-error-tip-icon-color: red;--evt-cell-hover-icon-bg-color: #fff;--evt-cell-hover-icon-border-color: #dde0ea;--evt-scroller-color: #dee0e3;--evt-scroller-track-color: #fff;--evt-scroller-focus-color: #bbbec4;--evt-select-border-color: var(--evt-color-primary);--evt-select-area-color: rgba(82, 146, 247, .1);--evt-select-row-col-bg-color: transparent;--evt-autofill-point-border-color: #fff;--evt-edit-bg-color: #fcf6ed;--evt-checkbox-color: var(--evt-color-primary);--evt-readonly-color: #fff;--evt-readonly-text-color: var(--evt-body-text-color);--evt-error-tip-color: #ed3f14;--evt-footer-bg-color: #fafafa;--evt-highlight-hover-row-color: rgba(186, 203, 231, .1);--evt-highlight-selected-row-color: rgba(82, 146, 247, .1);--evt-tooltip-bg-color: #303133;--evt-tooltip-text-color: #fff;--evt-resize-row-line-color: #e1e6eb;--evt-resize-column-line-color: #e1e6eb}.dark{--evt-border-color: #363637;--evt-header-bg-color: #141414;--evt-body-bg-color: #141414;--evt-header-text-color: #a3a6ad;--evt-scroller-color: #414243;--evt-scroller-track-color: #141414;--evt-scroller-focus-color: #a3a6ad;--evt-edit-bg-color: #141414;--evt-readonly-text-color: #cfd3dc;--evt-footer-bg-color: #262727;--evt-autofill-point-border-color: #fff;--evt-editor-bg-color: #434343;--evt-editor-text-color: #cfd3dc}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;box-sizing:border-box;z-index:10;border-radius:8px;border:1px solid var(--evt-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;border:none;outline:none;z-index:10}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--evt-editor-bg-color);border:2px solid var(--evt-color-primary);box-sizing:border-box;box-shadow:var(--evt-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:absolute;left:0;top:0;overflow:hidden;z-index:100;pointer-events:none}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--evt-editor-bg-color);color:var(--evt-editor-text-color);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--evt-text-color-regular);background-color:var(--evt-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--evt-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:8px 24px;color:var(--evt-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--evt-color-primary);background-color:#f5f7fa}")),document.head.appendChild(o)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var n = (c, t, e) =>
|
|
5
|
-
class
|
|
2
|
+
var ee = Object.defineProperty;
|
|
3
|
+
var ie = (c, t, e) => t in c ? ee(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
|
|
4
|
+
var n = (c, t, e) => ie(c, typeof t != "symbol" ? t + "" : t, e);
|
|
5
|
+
class se {
|
|
6
6
|
constructor(t) {
|
|
7
7
|
n(this, "rules");
|
|
8
8
|
this.rules = t;
|
|
@@ -11,8 +11,6 @@ class te {
|
|
|
11
11
|
const e = [], { column: i, row: s, key: o, rowKey: r, colIndex: l, rowIndex: a, value: h, field: d, fieldValue: f } = t;
|
|
12
12
|
Array.isArray(this.rules) || (this.rules = [this.rules]);
|
|
13
13
|
for (const x of this.rules) {
|
|
14
|
-
if (!x.required && (h == null || h === ""))
|
|
15
|
-
return e;
|
|
16
14
|
if (x.validator) {
|
|
17
15
|
const u = {
|
|
18
16
|
field: d,
|
|
@@ -26,13 +24,15 @@ class te {
|
|
|
26
24
|
rowKey: r,
|
|
27
25
|
...x
|
|
28
26
|
};
|
|
29
|
-
x.validator(u, h, (
|
|
30
|
-
|
|
27
|
+
x.validator(u, h, (w) => {
|
|
28
|
+
w && e.push({
|
|
31
29
|
...u,
|
|
32
|
-
message:
|
|
30
|
+
message: w
|
|
33
31
|
});
|
|
34
32
|
});
|
|
35
33
|
}
|
|
34
|
+
if (!x.required && (h == null || h === ""))
|
|
35
|
+
return e;
|
|
36
36
|
x.pattern && !x.pattern.test(h) && e.push({
|
|
37
37
|
value: h,
|
|
38
38
|
column: i,
|
|
@@ -60,13 +60,13 @@ class te {
|
|
|
60
60
|
return e;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function Lt() {
|
|
64
64
|
return "xxxxxxxxxxxxxxxxxx".replace(/[x]/g, function(c) {
|
|
65
65
|
const t = Math.random() * 16 | 0;
|
|
66
66
|
return (c === "x" ? t : t & 3 | 8).toString(16);
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function 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,10 +75,10 @@ function Lt(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
|
-
function
|
|
81
|
+
function oe(c = []) {
|
|
82
82
|
let t = [], e = [], i = [];
|
|
83
83
|
return c.forEach((s) => {
|
|
84
84
|
s.fixed === "left" ? t.push(s) : s.fixed === "right" ? i.push(s) : e.push(s);
|
|
@@ -88,14 +88,14 @@ function ee(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,14 +115,14 @@ function At(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 mt = /^(\r\n|\n\r|\r|\n)/,
|
|
125
|
-
function
|
|
124
|
+
const mt = /^(\r\n|\n\r|\r|\n)/, re = /^[^\t\r\n]+/, yt = /^\t/;
|
|
125
|
+
function ne(c) {
|
|
126
126
|
let t = [[""]];
|
|
127
127
|
if (c.length === 0)
|
|
128
128
|
return t;
|
|
@@ -142,14 +142,14 @@ function se(c) {
|
|
|
142
142
|
}
|
|
143
143
|
o = o.replace(/^"/, "").replace(/"$/, "").replace(/["]*/g, (a) => new Array(Math.floor(a.length / 2)).fill('"').join(""));
|
|
144
144
|
} else {
|
|
145
|
-
const r = c.match(
|
|
145
|
+
const r = c.match(re);
|
|
146
146
|
o = r ? r[0] : "", c = c.slice(o.length);
|
|
147
147
|
}
|
|
148
148
|
t[i][e] = o;
|
|
149
149
|
}
|
|
150
150
|
return Array.isArray(t) && t.length > 1 && t[t.length - 1].length === 1 && t[t.length - 1][0] === "" && (t = t.slice(0, t.length - 1)), t;
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function le(c) {
|
|
153
153
|
let t, e, i, s, o = "", r;
|
|
154
154
|
for (t = 0, e = c.length; t < e; t += 1) {
|
|
155
155
|
for (s = c[t].length, i = 0; i < s; i += 1)
|
|
@@ -160,7 +160,7 @@ function oe(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,15 +172,15 @@ function Mt(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) => {
|
|
179
179
|
r === 0 ? (e = o.key, i = o.key, s[o.key] = 1) : c[o.key] === c[e] ? (s[o.key] = 0, s[i] += 1) : (s[o.key] = 1, e = o.key, i = o.key);
|
|
180
180
|
}), s;
|
|
181
181
|
}
|
|
182
|
-
function
|
|
183
|
-
const { visibleRows: i, rowIndex: s, headIndex: o } = c, r =
|
|
182
|
+
function ae(c, t, e = []) {
|
|
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,
|
|
@@ -193,10 +193,10 @@ function re(c, t, e = []) {
|
|
|
193
193
|
mergeRow: !0
|
|
194
194
|
};
|
|
195
195
|
}
|
|
196
|
-
function
|
|
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,
|
|
@@ -210,11 +210,11 @@ function ne(c, t = []) {
|
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
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 Dt {
|
|
|
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 ut extends Dt {
|
|
|
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 ut extends Dt {
|
|
|
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 ut extends Dt {
|
|
|
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 ut extends Dt {
|
|
|
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 ut extends Dt {
|
|
|
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
|
|
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 &&
|
|
493
|
-
let C = e,
|
|
494
|
-
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (C = i,
|
|
495
|
-
const _ = s, { backgroundColor:
|
|
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;
|
|
509
|
+
let C = e, I = l;
|
|
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 ut extends Dt {
|
|
|
500
516
|
isHasChanged: this.isHasChanged,
|
|
501
517
|
value: this.getValue()
|
|
502
518
|
}) || {};
|
|
503
|
-
|
|
519
|
+
T && (C = T), v && (I = v);
|
|
504
520
|
}
|
|
505
|
-
this.drawCellBgColor = C, this.drawTextColor =
|
|
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 ut extends Dt {
|
|
|
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 ut extends Dt {
|
|
|
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 ut extends Dt {
|
|
|
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 ut extends Dt {
|
|
|
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 ut extends Dt {
|
|
|
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 ===
|
|
768
|
-
this.ctx.paint.drawLine([h +
|
|
769
|
-
borderColor:
|
|
770
|
-
fillColor:
|
|
771
|
-
borderWidth:
|
|
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;
|
|
808
|
+
this.ctx.paint.drawLine([h + I, d + 1, h + a - C, d + 1], {
|
|
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 ===
|
|
779
|
-
this.ctx.paint.drawLine([h + a - 1, d + C, h + a - 1, d + l -
|
|
780
|
-
borderColor:
|
|
781
|
-
fillColor:
|
|
782
|
-
borderWidth:
|
|
817
|
+
if (r === m && o >= y && o <= b) {
|
|
818
|
+
const C = o === y ? 1 : 0, I = o === b ? 1 : 0;
|
|
819
|
+
this.ctx.paint.drawLine([h + a - 1, d + C, h + a - 1, d + l - I], {
|
|
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 ===
|
|
790
|
-
this.ctx.paint.drawLine([h +
|
|
791
|
-
borderColor:
|
|
792
|
-
fillColor:
|
|
793
|
-
borderWidth:
|
|
828
|
+
if (r >= p && r <= m && o === b) {
|
|
829
|
+
const C = r === m ? 1 : 0, I = r === p ? 1 : 0;
|
|
830
|
+
this.ctx.paint.drawLine([h + I, d + l - 1, h + a - C, d + l - 1], {
|
|
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 ===
|
|
801
|
-
this.ctx.paint.drawLine([h + 1, d +
|
|
802
|
-
borderColor:
|
|
803
|
-
fillColor:
|
|
804
|
-
borderWidth:
|
|
839
|
+
if (r === p && o >= y && o <= b) {
|
|
840
|
+
const C = o === b ? 1 : 0, I = o === y ? 1 : 0;
|
|
841
|
+
this.ctx.paint.drawLine([h + 1, d + I, h + 1, d + l - C], {
|
|
842
|
+
borderColor: E,
|
|
843
|
+
fillColor: g,
|
|
844
|
+
borderWidth: w,
|
|
805
845
|
lineCap: "round",
|
|
806
846
|
lineJoin: "round",
|
|
807
847
|
lineDash: u
|
|
@@ -809,7 +849,7 @@ class ut extends Dt {
|
|
|
809
849
|
}
|
|
810
850
|
}
|
|
811
851
|
}
|
|
812
|
-
class
|
|
852
|
+
class de {
|
|
813
853
|
//虚拟滚动位置
|
|
814
854
|
constructor(t, e) {
|
|
815
855
|
n(this, "loading", !1);
|
|
@@ -846,7 +886,7 @@ class ae {
|
|
|
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 ae {
|
|
|
867
907
|
*/
|
|
868
908
|
initData(t, e = 0, i = []) {
|
|
869
909
|
t.forEach((s, o) => {
|
|
870
|
-
var
|
|
871
|
-
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}` :
|
|
910
|
+
var p;
|
|
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 ae {
|
|
|
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 ae {
|
|
|
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 ae {
|
|
|
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 ae {
|
|
|
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 ae {
|
|
|
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 ae {
|
|
|
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)
|
|
1278
1318
|
return;
|
|
1279
|
-
|
|
1280
|
-
const
|
|
1281
|
-
this.ctx.emit("selectionChange",
|
|
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)
|
|
1352
|
+
return;
|
|
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 ae {
|
|
|
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 ae {
|
|
|
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 ae {
|
|
|
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 ae {
|
|
|
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 = {
|
|
@@ -1512,7 +1661,7 @@ class ae {
|
|
|
1512
1661
|
value: this.getItemValue(t, e),
|
|
1513
1662
|
field: e,
|
|
1514
1663
|
fieldValue: this.getItemValue(t, e)
|
|
1515
|
-
}, f = new
|
|
1664
|
+
}, f = new se(a).validate(h);
|
|
1516
1665
|
this.setValidationError(t, e, f), i(f);
|
|
1517
1666
|
} else
|
|
1518
1667
|
this.clearValidationError(t, e), i([]);
|
|
@@ -1540,8 +1689,8 @@ class ae {
|
|
|
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 ae {
|
|
|
1562
1711
|
}
|
|
1563
1712
|
]
|
|
1564
1713
|
};
|
|
1565
|
-
let
|
|
1566
|
-
if (d !== 1 &&
|
|
1567
|
-
|
|
1568
|
-
const
|
|
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
|
|
1575
|
-
return `${M}${
|
|
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) ?? "";
|
|
1724
|
+
return `${M}${H}`;
|
|
1576
1725
|
}, "");
|
|
1577
|
-
if (
|
|
1578
|
-
|
|
1726
|
+
if (v === O)
|
|
1727
|
+
g = R;
|
|
1579
1728
|
else
|
|
1580
1729
|
break;
|
|
1581
1730
|
}
|
|
1582
|
-
for (let
|
|
1583
|
-
const
|
|
1584
|
-
const
|
|
1585
|
-
return `${M}${
|
|
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) ?? "";
|
|
1734
|
+
return `${M}${H}`;
|
|
1586
1735
|
}, "");
|
|
1587
|
-
if (
|
|
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
|
-
for (let
|
|
1611
|
-
const
|
|
1612
|
-
if (!
|
|
1759
|
+
for (let v = l - 1; v >= 0; v--) {
|
|
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
|
-
for (let
|
|
1621
|
-
const
|
|
1622
|
-
if (!
|
|
1769
|
+
for (let v = l; v <= this.ctx.maxColIndex; v++) {
|
|
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
|
|
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
|
-
|
|
1783
|
+
I += R.width || 100;
|
|
1635
1784
|
}
|
|
1636
|
-
for (let
|
|
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
|
-
offsetLeft:
|
|
1657
|
-
dataList:
|
|
1805
|
+
offsetLeft: I,
|
|
1806
|
+
dataList: b
|
|
1658
1807
|
};
|
|
1659
1808
|
}
|
|
1660
1809
|
setLoading(t) {
|
|
@@ -1698,7 +1847,7 @@ class ae {
|
|
|
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,8 +1866,23 @@ class ae {
|
|
|
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
|
-
class
|
|
1885
|
+
class fe {
|
|
1722
1886
|
constructor(t) {
|
|
1723
1887
|
n(this, "ctx");
|
|
1724
1888
|
n(this, "history", []);
|
|
@@ -1773,7 +1937,7 @@ class he {
|
|
|
1773
1937
|
this.history = [], this.historyIndex = -1;
|
|
1774
1938
|
}
|
|
1775
1939
|
}
|
|
1776
|
-
class
|
|
1940
|
+
class xe {
|
|
1777
1941
|
constructor(t) {
|
|
1778
1942
|
n(this, "eventTasks", /* @__PURE__ */ new Map());
|
|
1779
1943
|
n(this, "ctx");
|
|
@@ -1849,7 +2013,7 @@ class ce {
|
|
|
1849
2013
|
t.removeEventListener(e, i), this.eventTasks.delete(e);
|
|
1850
2014
|
}
|
|
1851
2015
|
}
|
|
1852
|
-
class
|
|
2016
|
+
class ue {
|
|
1853
2017
|
constructor() {
|
|
1854
2018
|
n(this, "events", /* @__PURE__ */ new Map());
|
|
1855
2019
|
}
|
|
@@ -1887,7 +2051,7 @@ class de {
|
|
|
1887
2051
|
this.events.clear();
|
|
1888
2052
|
}
|
|
1889
2053
|
}
|
|
1890
|
-
class
|
|
2054
|
+
class ge {
|
|
1891
2055
|
constructor(t) {
|
|
1892
2056
|
n(this, "ctx");
|
|
1893
2057
|
const e = t.getContext("2d");
|
|
@@ -1991,8 +2155,8 @@ class fe {
|
|
|
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 fe {
|
|
|
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;
|
|
@@ -2088,6 +2258,10 @@ class Ct {
|
|
|
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 Ct {
|
|
|
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
|
/** 启用点击选择器编辑 */
|
|
@@ -2286,14 +2466,14 @@ class Ct {
|
|
|
2286
2466
|
let t = {};
|
|
2287
2467
|
Object.keys(this).forEach((e) => {
|
|
2288
2468
|
if (e.endsWith("_COLOR") || e.endsWith("_FONT")) {
|
|
2289
|
-
const i = `--evt-${e.toLocaleLowerCase().replace(/_/g, "-")}`, s =
|
|
2469
|
+
const i = `--evt-${e.toLocaleLowerCase().replace(/_/g, "-")}`, s = ce(i);
|
|
2290
2470
|
t[e] = s;
|
|
2291
2471
|
}
|
|
2292
2472
|
}), Object.assign(this, t, this._config);
|
|
2293
2473
|
}
|
|
2294
2474
|
}
|
|
2295
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
|
-
class
|
|
2476
|
+
class we {
|
|
2297
2477
|
constructor(t) {
|
|
2298
2478
|
n(this, "ctx");
|
|
2299
2479
|
n(this, "list", [
|
|
@@ -2426,10 +2606,11 @@ class xe {
|
|
|
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 kt extends Dt {
|
|
|
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 kt extends Dt {
|
|
|
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 kt extends Dt {
|
|
|
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 kt extends Dt {
|
|
|
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 ue {
|
|
|
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 ue {
|
|
|
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 ue {
|
|
|
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 ue {
|
|
|
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 ue {
|
|
|
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,7 +3069,7 @@ class ge {
|
|
|
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 Ct(e.config || {}), this.eventBus = 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
3075
|
this.config = new Ct(t);
|
|
@@ -3073,9 +3289,9 @@ class Rt {
|
|
|
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 Rt {
|
|
|
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() {
|
|
@@ -3108,7 +3324,7 @@ class Rt {
|
|
|
3108
3324
|
}), this.ctx.scrollerFocus = this.isFocus;
|
|
3109
3325
|
}
|
|
3110
3326
|
}
|
|
3111
|
-
class
|
|
3327
|
+
class me {
|
|
3112
3328
|
constructor(t) {
|
|
3113
3329
|
n(this, "ctx");
|
|
3114
3330
|
n(this, "verticalScrollbar");
|
|
@@ -3175,7 +3391,7 @@ class we {
|
|
|
3175
3391
|
this.setScrollY(o - e.visibleHeight / 2);
|
|
3176
3392
|
}
|
|
3177
3393
|
}
|
|
3178
|
-
class
|
|
3394
|
+
class ye {
|
|
3179
3395
|
constructor(t) {
|
|
3180
3396
|
n(this, "ctx");
|
|
3181
3397
|
// 上下文
|
|
@@ -3214,7 +3430,7 @@ class pe {
|
|
|
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 pe {
|
|
|
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 =
|
|
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 pe {
|
|
|
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
|
}
|
|
@@ -3405,7 +3621,7 @@ class pe {
|
|
|
3405
3621
|
}), this.drawTipLine(), this.drawBottomLine();
|
|
3406
3622
|
}
|
|
3407
3623
|
}
|
|
3408
|
-
class
|
|
3624
|
+
class Bt {
|
|
3409
3625
|
constructor(t, e, i = 0, s = 0, o = 0, r = 0, l, a = "body") {
|
|
3410
3626
|
n(this, "ctx");
|
|
3411
3627
|
n(this, "x", 0);
|
|
@@ -3424,7 +3640,7 @@ class Xt {
|
|
|
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,
|
|
@@ -3460,7 +3676,7 @@ class Xt {
|
|
|
3460
3676
|
});
|
|
3461
3677
|
}
|
|
3462
3678
|
}
|
|
3463
|
-
class
|
|
3679
|
+
class Ce {
|
|
3464
3680
|
constructor(t) {
|
|
3465
3681
|
n(this, "resizeTarget", null);
|
|
3466
3682
|
//调整行大小的目标
|
|
@@ -3507,35 +3723,35 @@ class Ee {
|
|
|
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 =
|
|
3525
|
-
const C = window.devicePixelRatio || 1,
|
|
3526
|
-
t.width = Math.round(
|
|
3527
|
-
const
|
|
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;
|
|
3741
|
+
const C = window.devicePixelRatio || 1, I = this.ctx.stageWidth * C, _ = this.ctx.stageHeight * C;
|
|
3742
|
+
t.width = Math.round(I), t.height = Math.round(_);
|
|
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
|
|
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 Ee {
|
|
|
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 Ee {
|
|
|
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
|
}
|
|
@@ -3678,7 +3894,7 @@ class Ee {
|
|
|
3678
3894
|
}), this.drawTipLine();
|
|
3679
3895
|
}
|
|
3680
3896
|
}
|
|
3681
|
-
class
|
|
3897
|
+
class be {
|
|
3682
3898
|
constructor(t) {
|
|
3683
3899
|
n(this, "ctx");
|
|
3684
3900
|
n(this, "renderRows", []);
|
|
@@ -3733,7 +3949,7 @@ class me {
|
|
|
3733
3949
|
let e = this.y;
|
|
3734
3950
|
const i = [];
|
|
3735
3951
|
this.data.forEach((s, o) => {
|
|
3736
|
-
const r = new
|
|
3952
|
+
const r = new Bt(this.ctx, o, 0, e, this.width, t, s, "footer");
|
|
3737
3953
|
e += t, i.push(r);
|
|
3738
3954
|
}), this.renderRows = i, this.ctx.footer.renderRows = this.renderRows;
|
|
3739
3955
|
}
|
|
@@ -3759,7 +3975,7 @@ class me {
|
|
|
3759
3975
|
}), this.drawTopLine();
|
|
3760
3976
|
}
|
|
3761
3977
|
}
|
|
3762
|
-
class
|
|
3978
|
+
class Re {
|
|
3763
3979
|
// 垂直滚动定时器
|
|
3764
3980
|
constructor(t) {
|
|
3765
3981
|
n(this, "isCut", !1);
|
|
@@ -3778,7 +3994,7 @@ class ye {
|
|
|
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 ye {
|
|
|
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
|
-
const
|
|
3890
|
-
|
|
4105
|
+
const I = this.adjustMergeCells(o, r);
|
|
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 ye {
|
|
|
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 ye {
|
|
|
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 ye {
|
|
|
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) {
|
|
@@ -4069,7 +4285,7 @@ class ye {
|
|
|
4069
4285
|
return;
|
|
4070
4286
|
t = l.data;
|
|
4071
4287
|
}
|
|
4072
|
-
const o =
|
|
4288
|
+
const o = le(t);
|
|
4073
4289
|
navigator.clipboard ? navigator.clipboard.writeText(o).then(() => {
|
|
4074
4290
|
this.ctx.selector.xArrCopy = this.ctx.selector.xArr.slice(), this.ctx.selector.yArrCopy = this.ctx.selector.yArr.slice(), this.ctx.emit("copyChange", {
|
|
4075
4291
|
xArr: this.ctx.selector.xArrCopy,
|
|
@@ -4085,10 +4301,10 @@ class ye {
|
|
|
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
|
//内部有设置
|
|
@@ -4114,40 +4330,40 @@ class ye {
|
|
|
4114
4330
|
if (this.ctx.selector.enable && t) {
|
|
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
|
-
let r =
|
|
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 ||
|
|
4333
|
+
let r = ne(o);
|
|
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
|
|
4142
|
-
|
|
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(
|
|
4358
|
+
I,
|
|
4143
4359
|
_
|
|
4144
4360
|
);
|
|
4145
|
-
if (
|
|
4146
|
-
const { rowKey:
|
|
4147
|
-
this.ctx.database.getReadonly(
|
|
4148
|
-
rowKey:
|
|
4149
|
-
key:
|
|
4150
|
-
value:
|
|
4361
|
+
if (v) {
|
|
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 ye {
|
|
|
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 ye {
|
|
|
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
|
|
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" ?
|
|
4285
|
-
const
|
|
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 Ce {
|
|
|
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(
|
|
4356
|
-
const { BEFORE_SET_AUTOFILL_METHOD:
|
|
4357
|
-
if (typeof
|
|
4358
|
-
const
|
|
4571
|
+
r = [Math.max(w, m), Math.min(E, y)], l = [Math.max(g, b), Math.min(p, C)];
|
|
4572
|
+
const { BEFORE_SET_AUTOFILL_METHOD: I } = this.ctx.config;
|
|
4573
|
+
if (typeof I == "function") {
|
|
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 Ce {
|
|
|
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 Ce {
|
|
|
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 Ce {
|
|
|
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,77 +4649,78 @@ class Ce {
|
|
|
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",
|
|
4443
4659
|
top: "bottom"
|
|
4444
|
-
},
|
|
4660
|
+
}, _e = {
|
|
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
|
-
function
|
|
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
|
-
|
|
4467
|
-
|
|
4682
|
+
const Se = /* @__PURE__ */ new Set(["top", "bottom"]);
|
|
4683
|
+
function V(c) {
|
|
4684
|
+
return Se.has(z(c)) ? "y" : "x";
|
|
4468
4685
|
}
|
|
4469
|
-
function
|
|
4470
|
-
return
|
|
4686
|
+
function gt(c) {
|
|
4687
|
+
return Nt(V(c));
|
|
4471
4688
|
}
|
|
4472
|
-
function
|
|
4689
|
+
function Te(c, t, e) {
|
|
4473
4690
|
e === void 0 && (e = !1);
|
|
4474
|
-
const i =
|
|
4691
|
+
const i = tt(c), s = gt(c), o = ut(s);
|
|
4475
4692
|
let r = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
|
|
4476
|
-
return t.reference[o] > t.floating[o] && (r =
|
|
4693
|
+
return t.reference[o] > t.floating[o] && (r = ot(r)), [r, ot(r)];
|
|
4477
4694
|
}
|
|
4478
|
-
function
|
|
4479
|
-
const t =
|
|
4480
|
-
return [
|
|
4695
|
+
function Oe(c) {
|
|
4696
|
+
const t = ot(c);
|
|
4697
|
+
return [ft(c), t, ft(t)];
|
|
4481
4698
|
}
|
|
4482
|
-
function
|
|
4483
|
-
return c.replace(/start|end/g, (t) =>
|
|
4699
|
+
function ft(c) {
|
|
4700
|
+
return c.replace(/start|end/g, (t) => _e[t]);
|
|
4484
4701
|
}
|
|
4485
|
-
|
|
4486
|
-
|
|
4702
|
+
const It = ["left", "right"], vt = ["right", "left"], Le = ["top", "bottom"], Ae = ["bottom", "top"];
|
|
4703
|
+
function Me(c, t, e) {
|
|
4487
4704
|
switch (c) {
|
|
4488
4705
|
case "top":
|
|
4489
4706
|
case "bottom":
|
|
4490
|
-
return e ? t ?
|
|
4707
|
+
return e ? t ? vt : It : t ? It : vt;
|
|
4491
4708
|
case "left":
|
|
4492
4709
|
case "right":
|
|
4493
|
-
return t ?
|
|
4710
|
+
return t ? Le : Ae;
|
|
4494
4711
|
default:
|
|
4495
4712
|
return [];
|
|
4496
4713
|
}
|
|
4497
4714
|
}
|
|
4498
|
-
function
|
|
4499
|
-
const s =
|
|
4500
|
-
let o =
|
|
4501
|
-
return s && (o = o.map((r) => r + "-" + s), t && (o = o.concat(o.map(
|
|
4715
|
+
function He(c, t, e, i) {
|
|
4716
|
+
const s = tt(c);
|
|
4717
|
+
let o = Me(z(c), e === "start", i);
|
|
4718
|
+
return s && (o = o.map((r) => r + "-" + s), t && (o = o.concat(o.map(ft)))), o;
|
|
4502
4719
|
}
|
|
4503
|
-
function
|
|
4504
|
-
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]);
|
|
4505
4722
|
}
|
|
4506
|
-
function
|
|
4723
|
+
function De(c) {
|
|
4507
4724
|
return {
|
|
4508
4725
|
top: 0,
|
|
4509
4726
|
right: 0,
|
|
@@ -4513,14 +4730,14 @@ function Se(c) {
|
|
|
4513
4730
|
};
|
|
4514
4731
|
}
|
|
4515
4732
|
function Kt(c) {
|
|
4516
|
-
return typeof c != "number" ?
|
|
4733
|
+
return typeof c != "number" ? De(c) : {
|
|
4517
4734
|
top: c,
|
|
4518
4735
|
right: c,
|
|
4519
4736
|
bottom: c,
|
|
4520
4737
|
left: c
|
|
4521
4738
|
};
|
|
4522
4739
|
}
|
|
4523
|
-
function
|
|
4740
|
+
function rt(c) {
|
|
4524
4741
|
const {
|
|
4525
4742
|
x: t,
|
|
4526
4743
|
y: e,
|
|
@@ -4538,12 +4755,12 @@ function ot(c) {
|
|
|
4538
4755
|
y: e
|
|
4539
4756
|
};
|
|
4540
4757
|
}
|
|
4541
|
-
function
|
|
4758
|
+
function _t(c, t, e) {
|
|
4542
4759
|
let {
|
|
4543
4760
|
reference: i,
|
|
4544
4761
|
floating: s
|
|
4545
4762
|
} = c;
|
|
4546
|
-
const o =
|
|
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;
|
|
4547
4764
|
let u;
|
|
4548
4765
|
switch (a) {
|
|
4549
4766
|
case "top":
|
|
@@ -4576,7 +4793,7 @@ function It(c, t, e) {
|
|
|
4576
4793
|
y: i.y
|
|
4577
4794
|
};
|
|
4578
4795
|
}
|
|
4579
|
-
switch (
|
|
4796
|
+
switch (tt(t)) {
|
|
4580
4797
|
case "start":
|
|
4581
4798
|
u[r] -= x * (e && h ? -1 : 1);
|
|
4582
4799
|
break;
|
|
@@ -4586,7 +4803,7 @@ function It(c, t, e) {
|
|
|
4586
4803
|
}
|
|
4587
4804
|
return u;
|
|
4588
4805
|
}
|
|
4589
|
-
const
|
|
4806
|
+
const ke = async (c, t, e) => {
|
|
4590
4807
|
const {
|
|
4591
4808
|
placement: i = "bottom",
|
|
4592
4809
|
strategy: s = "absolute",
|
|
@@ -4600,17 +4817,17 @@ const Le = async (c, t, e) => {
|
|
|
4600
4817
|
}), {
|
|
4601
4818
|
x: d,
|
|
4602
4819
|
y: f
|
|
4603
|
-
} =
|
|
4604
|
-
for (let
|
|
4820
|
+
} = _t(h, i, a), x = i, u = {}, w = 0;
|
|
4821
|
+
for (let E = 0; E < l.length; E++) {
|
|
4605
4822
|
const {
|
|
4606
|
-
name:
|
|
4607
|
-
fn:
|
|
4608
|
-
} = l[
|
|
4609
|
-
x:
|
|
4610
|
-
y
|
|
4611
|
-
data:
|
|
4823
|
+
name: g,
|
|
4824
|
+
fn: p
|
|
4825
|
+
} = l[E], {
|
|
4826
|
+
x: m,
|
|
4827
|
+
y,
|
|
4828
|
+
data: b,
|
|
4612
4829
|
reset: C
|
|
4613
|
-
} = await
|
|
4830
|
+
} = await p({
|
|
4614
4831
|
x: d,
|
|
4615
4832
|
y: f,
|
|
4616
4833
|
initialPlacement: i,
|
|
@@ -4624,20 +4841,20 @@ const Le = async (c, t, e) => {
|
|
|
4624
4841
|
floating: t
|
|
4625
4842
|
}
|
|
4626
4843
|
});
|
|
4627
|
-
d =
|
|
4844
|
+
d = m ?? d, f = y ?? f, u = {
|
|
4628
4845
|
...u,
|
|
4629
|
-
[
|
|
4630
|
-
...u[
|
|
4631
|
-
...
|
|
4846
|
+
[g]: {
|
|
4847
|
+
...u[g],
|
|
4848
|
+
...b
|
|
4632
4849
|
}
|
|
4633
|
-
}, C &&
|
|
4850
|
+
}, C && w <= 50 && (w++, typeof C == "object" && (C.placement && (x = C.placement), C.rects && (h = C.rects === !0 ? await r.getElementRects({
|
|
4634
4851
|
reference: c,
|
|
4635
4852
|
floating: t,
|
|
4636
4853
|
strategy: s
|
|
4637
4854
|
}) : C.rects), {
|
|
4638
4855
|
x: d,
|
|
4639
4856
|
y: f
|
|
4640
|
-
} =
|
|
4857
|
+
} = _t(h, x, a)), E = -1);
|
|
4641
4858
|
}
|
|
4642
4859
|
return {
|
|
4643
4860
|
x: d,
|
|
@@ -4647,7 +4864,7 @@ const Le = async (c, t, e) => {
|
|
|
4647
4864
|
middlewareData: u
|
|
4648
4865
|
};
|
|
4649
4866
|
};
|
|
4650
|
-
async function
|
|
4867
|
+
async function Yt(c, t) {
|
|
4651
4868
|
var e;
|
|
4652
4869
|
t === void 0 && (t = {});
|
|
4653
4870
|
const {
|
|
@@ -4663,36 +4880,36 @@ async function Nt(c, t) {
|
|
|
4663
4880
|
elementContext: f = "floating",
|
|
4664
4881
|
altBoundary: x = !1,
|
|
4665
4882
|
padding: u = 0
|
|
4666
|
-
} =
|
|
4667
|
-
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)),
|
|
4668
4885
|
boundary: h,
|
|
4669
4886
|
rootBoundary: d,
|
|
4670
4887
|
strategy: a
|
|
4671
|
-
})),
|
|
4888
|
+
})), m = f === "floating" ? {
|
|
4672
4889
|
x: i,
|
|
4673
4890
|
y: s,
|
|
4674
4891
|
width: r.floating.width,
|
|
4675
4892
|
height: r.floating.height
|
|
4676
|
-
} : 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)) || {
|
|
4677
4894
|
x: 1,
|
|
4678
4895
|
y: 1
|
|
4679
4896
|
} : {
|
|
4680
4897
|
x: 1,
|
|
4681
4898
|
y: 1
|
|
4682
|
-
}, C =
|
|
4899
|
+
}, C = rt(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
4683
4900
|
elements: l,
|
|
4684
|
-
rect:
|
|
4685
|
-
offsetParent:
|
|
4901
|
+
rect: m,
|
|
4902
|
+
offsetParent: y,
|
|
4686
4903
|
strategy: a
|
|
4687
|
-
}) :
|
|
4904
|
+
}) : m);
|
|
4688
4905
|
return {
|
|
4689
|
-
top: (
|
|
4690
|
-
bottom: (C.bottom -
|
|
4691
|
-
left: (
|
|
4692
|
-
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
|
|
4693
4910
|
};
|
|
4694
4911
|
}
|
|
4695
|
-
const
|
|
4912
|
+
const Xe = (c) => ({
|
|
4696
4913
|
name: "arrow",
|
|
4697
4914
|
options: c,
|
|
4698
4915
|
async fn(t) {
|
|
@@ -4707,29 +4924,29 @@ const Te = (c) => ({
|
|
|
4707
4924
|
} = t, {
|
|
4708
4925
|
element: h,
|
|
4709
4926
|
padding: d = 0
|
|
4710
|
-
} =
|
|
4927
|
+
} = Q(c, t) || {};
|
|
4711
4928
|
if (h == null)
|
|
4712
4929
|
return {};
|
|
4713
4930
|
const f = Kt(d), x = {
|
|
4714
4931
|
x: e,
|
|
4715
4932
|
y: i
|
|
4716
|
-
}, u =
|
|
4717
|
-
let _ =
|
|
4718
|
-
(!_ || !await (r.isElement == null ? void 0 : r.isElement(
|
|
4719
|
-
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;
|
|
4720
4937
|
return {
|
|
4721
|
-
[u]: x[u] +
|
|
4938
|
+
[u]: x[u] + D,
|
|
4722
4939
|
data: {
|
|
4723
|
-
[u]:
|
|
4724
|
-
centerOffset:
|
|
4725
|
-
...
|
|
4726
|
-
alignmentOffset:
|
|
4940
|
+
[u]: H,
|
|
4941
|
+
centerOffset: L - H - D,
|
|
4942
|
+
...Y && {
|
|
4943
|
+
alignmentOffset: D
|
|
4727
4944
|
}
|
|
4728
4945
|
},
|
|
4729
|
-
reset:
|
|
4946
|
+
reset: Y
|
|
4730
4947
|
};
|
|
4731
4948
|
}
|
|
4732
|
-
}),
|
|
4949
|
+
}), Be = function(c) {
|
|
4733
4950
|
return c === void 0 && (c = {}), {
|
|
4734
4951
|
name: "flip",
|
|
4735
4952
|
options: c,
|
|
@@ -4747,78 +4964,80 @@ const Te = (c) => ({
|
|
|
4747
4964
|
crossAxis: f = !0,
|
|
4748
4965
|
fallbackPlacements: x,
|
|
4749
4966
|
fallbackStrategy: u = "bestFit",
|
|
4750
|
-
fallbackAxisSideDirection:
|
|
4751
|
-
flipAlignment:
|
|
4752
|
-
...
|
|
4753
|
-
} =
|
|
4967
|
+
fallbackAxisSideDirection: w = "none",
|
|
4968
|
+
flipAlignment: E = !0,
|
|
4969
|
+
...g
|
|
4970
|
+
} = Q(c, t);
|
|
4754
4971
|
if ((e = o.arrow) != null && e.alignmentOffset)
|
|
4755
4972
|
return {};
|
|
4756
|
-
const
|
|
4757
|
-
!x &&
|
|
4758
|
-
const _ = [l, ...C],
|
|
4759
|
-
let
|
|
4760
|
-
if (d &&
|
|
4761
|
-
const
|
|
4762
|
-
|
|
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]]);
|
|
4763
4980
|
}
|
|
4764
|
-
if (
|
|
4981
|
+
if (R = [...R, {
|
|
4765
4982
|
placement: s,
|
|
4766
|
-
overflows:
|
|
4767
|
-
}], !
|
|
4768
|
-
var
|
|
4769
|
-
const
|
|
4770
|
-
if (
|
|
4983
|
+
overflows: v
|
|
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
|
|
4988
|
+
// overflows the main axis.
|
|
4989
|
+
R.every((k) => V(k.placement) === m ? k.overflows[0] > 0 : !0)))
|
|
4771
4990
|
return {
|
|
4772
4991
|
data: {
|
|
4773
|
-
index:
|
|
4774
|
-
overflows:
|
|
4992
|
+
index: L,
|
|
4993
|
+
overflows: R
|
|
4775
4994
|
},
|
|
4776
4995
|
reset: {
|
|
4777
|
-
placement:
|
|
4996
|
+
placement: H
|
|
4778
4997
|
}
|
|
4779
4998
|
};
|
|
4780
|
-
let
|
|
4781
|
-
if (!
|
|
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;
|
|
5000
|
+
if (!Y)
|
|
4782
5001
|
switch (u) {
|
|
4783
5002
|
case "bestFit": {
|
|
4784
5003
|
var M;
|
|
4785
|
-
const
|
|
4786
|
-
if (
|
|
4787
|
-
const
|
|
4788
|
-
return
|
|
5004
|
+
const D = (M = R.filter((k) => {
|
|
5005
|
+
if (I) {
|
|
5006
|
+
const W = V(k.placement);
|
|
5007
|
+
return W === m || // Create a bias to the `y` side axis due to horizontal
|
|
4789
5008
|
// reading directions favoring greater width.
|
|
4790
|
-
|
|
5009
|
+
W === "y";
|
|
4791
5010
|
}
|
|
4792
5011
|
return !0;
|
|
4793
|
-
}).map((
|
|
4794
|
-
|
|
5012
|
+
}).map((k) => [k.placement, k.overflows.filter((W) => W > 0).reduce((W, te) => W + te, 0)]).sort((k, W) => k[1] - W[1])[0]) == null ? void 0 : M[0];
|
|
5013
|
+
D && (Y = D);
|
|
4795
5014
|
break;
|
|
4796
5015
|
}
|
|
4797
5016
|
case "initialPlacement":
|
|
4798
|
-
|
|
5017
|
+
Y = l;
|
|
4799
5018
|
break;
|
|
4800
5019
|
}
|
|
4801
|
-
if (s !==
|
|
5020
|
+
if (s !== Y)
|
|
4802
5021
|
return {
|
|
4803
5022
|
reset: {
|
|
4804
|
-
placement:
|
|
5023
|
+
placement: Y
|
|
4805
5024
|
}
|
|
4806
5025
|
};
|
|
4807
5026
|
}
|
|
4808
5027
|
return {};
|
|
4809
5028
|
}
|
|
4810
5029
|
};
|
|
4811
|
-
};
|
|
4812
|
-
async function
|
|
5030
|
+
}, Ne = /* @__PURE__ */ new Set(["left", "top"]);
|
|
5031
|
+
async function Ke(c, t) {
|
|
4813
5032
|
const {
|
|
4814
5033
|
placement: e,
|
|
4815
5034
|
platform: i,
|
|
4816
5035
|
elements: s
|
|
4817
|
-
} = c, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r =
|
|
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);
|
|
4818
5037
|
let {
|
|
4819
5038
|
mainAxis: x,
|
|
4820
5039
|
crossAxis: u,
|
|
4821
|
-
alignmentAxis:
|
|
5040
|
+
alignmentAxis: w
|
|
4822
5041
|
} = typeof f == "number" ? {
|
|
4823
5042
|
mainAxis: f,
|
|
4824
5043
|
crossAxis: 0,
|
|
@@ -4828,7 +5047,7 @@ async function Me(c, t) {
|
|
|
4828
5047
|
crossAxis: f.crossAxis || 0,
|
|
4829
5048
|
alignmentAxis: f.alignmentAxis
|
|
4830
5049
|
};
|
|
4831
|
-
return l && typeof
|
|
5050
|
+
return l && typeof w == "number" && (u = l === "end" ? w * -1 : w), a ? {
|
|
4832
5051
|
x: u * d,
|
|
4833
5052
|
y: x * h
|
|
4834
5053
|
} : {
|
|
@@ -4836,7 +5055,7 @@ async function Me(c, t) {
|
|
|
4836
5055
|
y: u * d
|
|
4837
5056
|
};
|
|
4838
5057
|
}
|
|
4839
|
-
const
|
|
5058
|
+
const Ye = function(c) {
|
|
4840
5059
|
return c === void 0 && (c = 0), {
|
|
4841
5060
|
name: "offset",
|
|
4842
5061
|
options: c,
|
|
@@ -4847,7 +5066,7 @@ const He = function(c) {
|
|
|
4847
5066
|
y: o,
|
|
4848
5067
|
placement: r,
|
|
4849
5068
|
middlewareData: l
|
|
4850
|
-
} = t, a = await
|
|
5069
|
+
} = t, a = await Ke(t, c);
|
|
4851
5070
|
return r === ((e = l.offset) == null ? void 0 : e.placement) && (i = l.arrow) != null && i.alignmentOffset ? {} : {
|
|
4852
5071
|
x: s + a.x,
|
|
4853
5072
|
y: o + a.y,
|
|
@@ -4858,7 +5077,7 @@ const He = function(c) {
|
|
|
4858
5077
|
};
|
|
4859
5078
|
}
|
|
4860
5079
|
};
|
|
4861
|
-
},
|
|
5080
|
+
}, Fe = function(c) {
|
|
4862
5081
|
return c === void 0 && (c = {}), {
|
|
4863
5082
|
name: "shift",
|
|
4864
5083
|
options: c,
|
|
@@ -4871,41 +5090,41 @@ const He = function(c) {
|
|
|
4871
5090
|
mainAxis: o = !0,
|
|
4872
5091
|
crossAxis: r = !1,
|
|
4873
5092
|
limiter: l = {
|
|
4874
|
-
fn: (
|
|
5093
|
+
fn: (g) => {
|
|
4875
5094
|
let {
|
|
4876
|
-
x:
|
|
4877
|
-
y
|
|
4878
|
-
} =
|
|
5095
|
+
x: p,
|
|
5096
|
+
y: m
|
|
5097
|
+
} = g;
|
|
4879
5098
|
return {
|
|
4880
|
-
x:
|
|
4881
|
-
y
|
|
5099
|
+
x: p,
|
|
5100
|
+
y: m
|
|
4882
5101
|
};
|
|
4883
5102
|
}
|
|
4884
5103
|
},
|
|
4885
5104
|
...a
|
|
4886
|
-
} =
|
|
5105
|
+
} = Q(c, t), h = {
|
|
4887
5106
|
x: e,
|
|
4888
5107
|
y: i
|
|
4889
|
-
}, d = await
|
|
4890
|
-
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];
|
|
4891
5110
|
if (o) {
|
|
4892
|
-
const
|
|
4893
|
-
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);
|
|
4894
5113
|
}
|
|
4895
5114
|
if (r) {
|
|
4896
|
-
const
|
|
4897
|
-
|
|
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);
|
|
4898
5117
|
}
|
|
4899
|
-
const
|
|
5118
|
+
const E = l.fn({
|
|
4900
5119
|
...t,
|
|
4901
5120
|
[x]: u,
|
|
4902
|
-
[f]:
|
|
5121
|
+
[f]: w
|
|
4903
5122
|
});
|
|
4904
5123
|
return {
|
|
4905
|
-
...
|
|
5124
|
+
...E,
|
|
4906
5125
|
data: {
|
|
4907
|
-
x:
|
|
4908
|
-
y:
|
|
5126
|
+
x: E.x - e,
|
|
5127
|
+
y: E.y - i,
|
|
4909
5128
|
enabled: {
|
|
4910
5129
|
[x]: o,
|
|
4911
5130
|
[f]: r
|
|
@@ -4915,46 +5134,49 @@ const He = function(c) {
|
|
|
4915
5134
|
}
|
|
4916
5135
|
};
|
|
4917
5136
|
};
|
|
4918
|
-
function
|
|
5137
|
+
function nt() {
|
|
4919
5138
|
return typeof window < "u";
|
|
4920
5139
|
}
|
|
4921
|
-
function
|
|
4922
|
-
return
|
|
5140
|
+
function Z(c) {
|
|
5141
|
+
return Ft(c) ? (c.nodeName || "").toLowerCase() : "#document";
|
|
4923
5142
|
}
|
|
4924
5143
|
function A(c) {
|
|
4925
5144
|
var t;
|
|
4926
5145
|
return (c == null || (t = c.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
4927
5146
|
}
|
|
4928
|
-
function
|
|
5147
|
+
function F(c) {
|
|
4929
5148
|
var t;
|
|
4930
|
-
return (t = (
|
|
5149
|
+
return (t = (Ft(c) ? c.ownerDocument : c.document) || window.document) == null ? void 0 : t.documentElement;
|
|
4931
5150
|
}
|
|
4932
|
-
function
|
|
4933
|
-
return
|
|
5151
|
+
function Ft(c) {
|
|
5152
|
+
return nt() ? c instanceof Node || c instanceof A(c).Node : !1;
|
|
4934
5153
|
}
|
|
4935
|
-
function
|
|
4936
|
-
return
|
|
5154
|
+
function X(c) {
|
|
5155
|
+
return nt() ? c instanceof Element || c instanceof A(c).Element : !1;
|
|
4937
5156
|
}
|
|
4938
|
-
function
|
|
4939
|
-
return
|
|
5157
|
+
function K(c) {
|
|
5158
|
+
return nt() ? c instanceof HTMLElement || c instanceof A(c).HTMLElement : !1;
|
|
4940
5159
|
}
|
|
4941
|
-
function
|
|
4942
|
-
return !
|
|
5160
|
+
function St(c) {
|
|
5161
|
+
return !nt() || typeof ShadowRoot > "u" ? !1 : c instanceof ShadowRoot || c instanceof A(c).ShadowRoot;
|
|
4943
5162
|
}
|
|
4944
|
-
|
|
5163
|
+
const We = /* @__PURE__ */ new Set(["inline", "contents"]);
|
|
5164
|
+
function et(c) {
|
|
4945
5165
|
const {
|
|
4946
5166
|
overflow: t,
|
|
4947
5167
|
overflowX: e,
|
|
4948
5168
|
overflowY: i,
|
|
4949
5169
|
display: s
|
|
4950
|
-
} =
|
|
4951
|
-
return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !
|
|
5170
|
+
} = B(c);
|
|
5171
|
+
return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !We.has(s);
|
|
4952
5172
|
}
|
|
4953
|
-
|
|
4954
|
-
|
|
5173
|
+
const Ve = /* @__PURE__ */ new Set(["table", "td", "th"]);
|
|
5174
|
+
function Pe(c) {
|
|
5175
|
+
return Ve.has(Z(c));
|
|
4955
5176
|
}
|
|
4956
|
-
|
|
4957
|
-
|
|
5177
|
+
const ze = [":popover-open", ":modal"];
|
|
5178
|
+
function lt(c) {
|
|
5179
|
+
return ze.some((t) => {
|
|
4958
5180
|
try {
|
|
4959
5181
|
return c.matches(t);
|
|
4960
5182
|
} catch {
|
|
@@ -4962,32 +5184,34 @@ function nt(c) {
|
|
|
4962
5184
|
}
|
|
4963
5185
|
});
|
|
4964
5186
|
}
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
5187
|
+
const $e = ["transform", "translate", "scale", "rotate", "perspective"], Ge = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Ue = ["paint", "layout", "strict", "content"];
|
|
5188
|
+
function wt(c) {
|
|
5189
|
+
const t = Et(), e = X(c) ? B(c) : c;
|
|
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));
|
|
4968
5191
|
}
|
|
4969
|
-
function
|
|
4970
|
-
let t =
|
|
4971
|
-
for (;
|
|
4972
|
-
if (
|
|
5192
|
+
function je(c) {
|
|
5193
|
+
let t = P(c);
|
|
5194
|
+
for (; K(t) && !j(t); ) {
|
|
5195
|
+
if (wt(t))
|
|
4973
5196
|
return t;
|
|
4974
|
-
if (
|
|
5197
|
+
if (lt(t))
|
|
4975
5198
|
return null;
|
|
4976
|
-
t =
|
|
5199
|
+
t = P(t);
|
|
4977
5200
|
}
|
|
4978
5201
|
return null;
|
|
4979
5202
|
}
|
|
4980
5203
|
function Et() {
|
|
4981
5204
|
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
4982
5205
|
}
|
|
4983
|
-
|
|
4984
|
-
|
|
5206
|
+
const Ze = /* @__PURE__ */ new Set(["html", "body", "#document"]);
|
|
5207
|
+
function j(c) {
|
|
5208
|
+
return Ze.has(Z(c));
|
|
4985
5209
|
}
|
|
4986
|
-
function
|
|
5210
|
+
function B(c) {
|
|
4987
5211
|
return A(c).getComputedStyle(c);
|
|
4988
5212
|
}
|
|
4989
|
-
function
|
|
4990
|
-
return
|
|
5213
|
+
function at(c) {
|
|
5214
|
+
return X(c) ? {
|
|
4991
5215
|
scrollLeft: c.scrollLeft,
|
|
4992
5216
|
scrollTop: c.scrollTop
|
|
4993
5217
|
} : {
|
|
@@ -4995,142 +5219,150 @@ function lt(c) {
|
|
|
4995
5219
|
scrollTop: c.scrollY
|
|
4996
5220
|
};
|
|
4997
5221
|
}
|
|
4998
|
-
function
|
|
4999
|
-
if (
|
|
5222
|
+
function P(c) {
|
|
5223
|
+
if (Z(c) === "html")
|
|
5000
5224
|
return c;
|
|
5001
5225
|
const t = (
|
|
5002
5226
|
// Step into the shadow DOM of the parent of a slotted node.
|
|
5003
5227
|
c.assignedSlot || // DOM Element detected.
|
|
5004
5228
|
c.parentNode || // ShadowRoot detected.
|
|
5005
|
-
|
|
5006
|
-
|
|
5229
|
+
St(c) && c.host || // Fallback.
|
|
5230
|
+
F(c)
|
|
5007
5231
|
);
|
|
5008
|
-
return
|
|
5232
|
+
return St(t) ? t.host : t;
|
|
5009
5233
|
}
|
|
5010
|
-
function
|
|
5011
|
-
const t =
|
|
5012
|
-
return
|
|
5234
|
+
function Wt(c) {
|
|
5235
|
+
const t = P(c);
|
|
5236
|
+
return j(t) ? c.ownerDocument ? c.ownerDocument.body : c.body : K(t) && et(t) ? t : Wt(t);
|
|
5013
5237
|
}
|
|
5014
|
-
function
|
|
5238
|
+
function Vt(c, t, e) {
|
|
5015
5239
|
var i;
|
|
5016
|
-
t === void 0 && (t = [])
|
|
5017
|
-
const s =
|
|
5018
|
-
|
|
5019
|
-
const l = ft(r);
|
|
5020
|
-
return t.concat(r, r.visualViewport || [], tt(s) ? s : [], l && e ? dt(l) : []);
|
|
5021
|
-
}
|
|
5022
|
-
return t.concat(s, dt(s, [], e));
|
|
5240
|
+
t === void 0 && (t = []);
|
|
5241
|
+
const s = Wt(c), o = s === ((i = c.ownerDocument) == null ? void 0 : i.body), r = A(s);
|
|
5242
|
+
return o ? (xt(r), t.concat(r, r.visualViewport || [], et(s) ? s : [], [])) : t.concat(s, Vt(s, []));
|
|
5023
5243
|
}
|
|
5024
|
-
function
|
|
5244
|
+
function xt(c) {
|
|
5025
5245
|
return c.parent && Object.getPrototypeOf(c.parent) ? c.frameElement : null;
|
|
5026
5246
|
}
|
|
5027
|
-
function
|
|
5028
|
-
const t =
|
|
5247
|
+
function Pt(c) {
|
|
5248
|
+
const t = B(c);
|
|
5029
5249
|
let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
|
|
5030
|
-
const s =
|
|
5250
|
+
const s = K(c), o = s ? c.offsetWidth : e, r = s ? c.offsetHeight : i, l = st(e) !== o || st(i) !== r;
|
|
5031
5251
|
return l && (e = o, i = r), {
|
|
5032
5252
|
width: e,
|
|
5033
5253
|
height: i,
|
|
5034
5254
|
$: l
|
|
5035
5255
|
};
|
|
5036
5256
|
}
|
|
5037
|
-
function
|
|
5038
|
-
return
|
|
5257
|
+
function zt(c) {
|
|
5258
|
+
return X(c) ? c : c.contextElement;
|
|
5039
5259
|
}
|
|
5040
|
-
function
|
|
5041
|
-
const t =
|
|
5042
|
-
if (!
|
|
5043
|
-
return
|
|
5260
|
+
function U(c) {
|
|
5261
|
+
const t = zt(c);
|
|
5262
|
+
if (!K(t))
|
|
5263
|
+
return N(1);
|
|
5044
5264
|
const e = t.getBoundingClientRect(), {
|
|
5045
5265
|
width: i,
|
|
5046
5266
|
height: s,
|
|
5047
5267
|
$: o
|
|
5048
|
-
} =
|
|
5049
|
-
let r = (o ?
|
|
5268
|
+
} = Pt(t);
|
|
5269
|
+
let r = (o ? st(e.width) : e.width) / i, l = (o ? st(e.height) : e.height) / s;
|
|
5050
5270
|
return (!r || !Number.isFinite(r)) && (r = 1), (!l || !Number.isFinite(l)) && (l = 1), {
|
|
5051
5271
|
x: r,
|
|
5052
5272
|
y: l
|
|
5053
5273
|
};
|
|
5054
5274
|
}
|
|
5055
|
-
const
|
|
5056
|
-
function
|
|
5275
|
+
const qe = /* @__PURE__ */ N(0);
|
|
5276
|
+
function $t(c) {
|
|
5057
5277
|
const t = A(c);
|
|
5058
|
-
return !Et() || !t.visualViewport ?
|
|
5278
|
+
return !Et() || !t.visualViewport ? qe : {
|
|
5059
5279
|
x: t.visualViewport.offsetLeft,
|
|
5060
5280
|
y: t.visualViewport.offsetTop
|
|
5061
5281
|
};
|
|
5062
5282
|
}
|
|
5063
|
-
function
|
|
5283
|
+
function Je(c, t, e) {
|
|
5064
5284
|
return t === void 0 && (t = !1), !e || t && e !== A(c) ? !1 : t;
|
|
5065
5285
|
}
|
|
5066
|
-
function
|
|
5286
|
+
function J(c, t, e, i) {
|
|
5067
5287
|
t === void 0 && (t = !1), e === void 0 && (e = !1);
|
|
5068
|
-
const s = c.getBoundingClientRect(), o =
|
|
5069
|
-
let r =
|
|
5070
|
-
t && (i ?
|
|
5071
|
-
const l =
|
|
5288
|
+
const s = c.getBoundingClientRect(), o = zt(c);
|
|
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);
|
|
5072
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;
|
|
5073
5293
|
if (o) {
|
|
5074
|
-
const x = A(o), u = i &&
|
|
5075
|
-
let
|
|
5076
|
-
for (;
|
|
5077
|
-
const
|
|
5078
|
-
a *=
|
|
5294
|
+
const x = A(o), u = i && X(i) ? A(i) : i;
|
|
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);
|
|
5079
5299
|
}
|
|
5080
5300
|
}
|
|
5081
|
-
return
|
|
5301
|
+
return rt({
|
|
5082
5302
|
width: d,
|
|
5083
5303
|
height: f,
|
|
5084
5304
|
x: a,
|
|
5085
5305
|
y: h
|
|
5086
5306
|
});
|
|
5087
5307
|
}
|
|
5088
|
-
function
|
|
5308
|
+
function pt(c, t) {
|
|
5309
|
+
const e = at(c).scrollLeft;
|
|
5310
|
+
return t ? t.left + e : J(F(c)).left + e;
|
|
5311
|
+
}
|
|
5312
|
+
function Gt(c, t, e) {
|
|
5313
|
+
e === void 0 && (e = !1);
|
|
5314
|
+
const i = c.getBoundingClientRect(), s = i.left + t.scrollLeft - (e ? 0 : (
|
|
5315
|
+
// RTL <body> scrollbar.
|
|
5316
|
+
pt(c, i)
|
|
5317
|
+
)), o = i.top + t.scrollTop;
|
|
5318
|
+
return {
|
|
5319
|
+
x: s,
|
|
5320
|
+
y: o
|
|
5321
|
+
};
|
|
5322
|
+
}
|
|
5323
|
+
function Qe(c) {
|
|
5089
5324
|
let {
|
|
5090
5325
|
elements: t,
|
|
5091
5326
|
rect: e,
|
|
5092
5327
|
offsetParent: i,
|
|
5093
5328
|
strategy: s
|
|
5094
5329
|
} = c;
|
|
5095
|
-
const o = s === "fixed", r =
|
|
5330
|
+
const o = s === "fixed", r = F(i), l = t ? lt(t.floating) : !1;
|
|
5096
5331
|
if (i === r || l && o)
|
|
5097
5332
|
return e;
|
|
5098
5333
|
let a = {
|
|
5099
5334
|
scrollLeft: 0,
|
|
5100
5335
|
scrollTop: 0
|
|
5101
|
-
}, h =
|
|
5102
|
-
const d =
|
|
5103
|
-
if ((f || !f && !o) && ((
|
|
5104
|
-
const
|
|
5105
|
-
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;
|
|
5106
5341
|
}
|
|
5342
|
+
const x = r && !f && !o ? Gt(r, a, !0) : N(0);
|
|
5107
5343
|
return {
|
|
5108
5344
|
width: e.width * h.x,
|
|
5109
5345
|
height: e.height * h.y,
|
|
5110
|
-
x: e.x * h.x - a.scrollLeft * h.x + d.x,
|
|
5111
|
-
y: e.y * h.y - a.scrollTop * h.y + d.y
|
|
5346
|
+
x: e.x * h.x - a.scrollLeft * h.x + d.x + x.x,
|
|
5347
|
+
y: e.y * h.y - a.scrollTop * h.y + d.y + x.y
|
|
5112
5348
|
};
|
|
5113
5349
|
}
|
|
5114
|
-
function
|
|
5350
|
+
function ti(c) {
|
|
5115
5351
|
return Array.from(c.getClientRects());
|
|
5116
5352
|
}
|
|
5117
|
-
function
|
|
5118
|
-
const e =
|
|
5119
|
-
|
|
5120
|
-
}
|
|
5121
|
-
function Fe(c) {
|
|
5122
|
-
const t = N(c), e = lt(c), i = c.ownerDocument.body, s = z(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), o = z(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
|
|
5123
|
-
let r = -e.scrollLeft + xt(c);
|
|
5353
|
+
function ei(c) {
|
|
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);
|
|
5355
|
+
let r = -e.scrollLeft + pt(c);
|
|
5124
5356
|
const l = -e.scrollTop;
|
|
5125
|
-
return
|
|
5357
|
+
return B(i).direction === "rtl" && (r += G(t.clientWidth, i.clientWidth) - s), {
|
|
5126
5358
|
width: s,
|
|
5127
5359
|
height: o,
|
|
5128
5360
|
x: r,
|
|
5129
5361
|
y: l
|
|
5130
5362
|
};
|
|
5131
5363
|
}
|
|
5132
|
-
function
|
|
5133
|
-
const e = A(c), i =
|
|
5364
|
+
function ii(c, t) {
|
|
5365
|
+
const e = A(c), i = F(c), s = e.visualViewport;
|
|
5134
5366
|
let o = i.clientWidth, r = i.clientHeight, l = 0, a = 0;
|
|
5135
5367
|
if (s) {
|
|
5136
5368
|
o = s.width, r = s.height;
|
|
@@ -5144,8 +5376,9 @@ function We(c, t) {
|
|
|
5144
5376
|
y: a
|
|
5145
5377
|
};
|
|
5146
5378
|
}
|
|
5147
|
-
|
|
5148
|
-
|
|
5379
|
+
const si = /* @__PURE__ */ new Set(["absolute", "fixed"]);
|
|
5380
|
+
function oi(c, t) {
|
|
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;
|
|
5149
5382
|
return {
|
|
5150
5383
|
width: r,
|
|
5151
5384
|
height: l,
|
|
@@ -5153,52 +5386,53 @@ function Ve(c, t) {
|
|
|
5153
5386
|
y: h
|
|
5154
5387
|
};
|
|
5155
5388
|
}
|
|
5156
|
-
function
|
|
5389
|
+
function Tt(c, t, e) {
|
|
5157
5390
|
let i;
|
|
5158
5391
|
if (t === "viewport")
|
|
5159
|
-
i =
|
|
5392
|
+
i = ii(c, e);
|
|
5160
5393
|
else if (t === "document")
|
|
5161
|
-
i =
|
|
5162
|
-
else if (
|
|
5163
|
-
i =
|
|
5394
|
+
i = ei(F(c));
|
|
5395
|
+
else if (X(t))
|
|
5396
|
+
i = oi(t, e);
|
|
5164
5397
|
else {
|
|
5165
|
-
const s =
|
|
5398
|
+
const s = $t(c);
|
|
5166
5399
|
i = {
|
|
5167
|
-
...t,
|
|
5168
5400
|
x: t.x - s.x,
|
|
5169
|
-
y: t.y - s.y
|
|
5401
|
+
y: t.y - s.y,
|
|
5402
|
+
width: t.width,
|
|
5403
|
+
height: t.height
|
|
5170
5404
|
};
|
|
5171
5405
|
}
|
|
5172
|
-
return
|
|
5406
|
+
return rt(i);
|
|
5173
5407
|
}
|
|
5174
|
-
function
|
|
5175
|
-
const e =
|
|
5176
|
-
return e === t || !
|
|
5408
|
+
function Ut(c, t) {
|
|
5409
|
+
const e = P(c);
|
|
5410
|
+
return e === t || !X(e) || j(e) ? !1 : B(e).position === "fixed" || Ut(e, t);
|
|
5177
5411
|
}
|
|
5178
|
-
function
|
|
5412
|
+
function ri(c, t) {
|
|
5179
5413
|
const e = t.get(c);
|
|
5180
5414
|
if (e)
|
|
5181
5415
|
return e;
|
|
5182
|
-
let i =
|
|
5183
|
-
const o =
|
|
5184
|
-
let r = o ?
|
|
5185
|
-
for (;
|
|
5186
|
-
const l =
|
|
5187
|
-
!a && l.position === "fixed" && (s = null), (o ? !a && !s : !a && l.position === "static" && !!s &&
|
|
5416
|
+
let i = Vt(c, []).filter((l) => X(l) && Z(l) !== "body"), s = null;
|
|
5417
|
+
const o = B(c).position === "fixed";
|
|
5418
|
+
let r = o ? P(c) : c;
|
|
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);
|
|
5188
5422
|
}
|
|
5189
5423
|
return t.set(c, i), i;
|
|
5190
5424
|
}
|
|
5191
|
-
function
|
|
5425
|
+
function ni(c) {
|
|
5192
5426
|
let {
|
|
5193
5427
|
element: t,
|
|
5194
5428
|
boundary: e,
|
|
5195
5429
|
rootBoundary: i,
|
|
5196
5430
|
strategy: s
|
|
5197
5431
|
} = c;
|
|
5198
|
-
const r = [...e === "clippingAncestors" ?
|
|
5199
|
-
const f =
|
|
5200
|
-
return h.top =
|
|
5201
|
-
},
|
|
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));
|
|
5202
5436
|
return {
|
|
5203
5437
|
width: a.right - a.left,
|
|
5204
5438
|
height: a.bottom - a.top,
|
|
@@ -5206,35 +5440,33 @@ function ze(c) {
|
|
|
5206
5440
|
y: a.top
|
|
5207
5441
|
};
|
|
5208
5442
|
}
|
|
5209
|
-
function
|
|
5443
|
+
function li(c) {
|
|
5210
5444
|
const {
|
|
5211
5445
|
width: t,
|
|
5212
5446
|
height: e
|
|
5213
|
-
} =
|
|
5447
|
+
} = Pt(c);
|
|
5214
5448
|
return {
|
|
5215
5449
|
width: t,
|
|
5216
5450
|
height: e
|
|
5217
5451
|
};
|
|
5218
5452
|
}
|
|
5219
|
-
function
|
|
5220
|
-
const i =
|
|
5453
|
+
function ai(c, t, e) {
|
|
5454
|
+
const i = K(t), s = F(t), o = e === "fixed", r = J(c, !0, o, t);
|
|
5221
5455
|
let l = {
|
|
5222
5456
|
scrollLeft: 0,
|
|
5223
5457
|
scrollTop: 0
|
|
5224
5458
|
};
|
|
5225
|
-
const a =
|
|
5459
|
+
const a = N(0);
|
|
5460
|
+
function h() {
|
|
5461
|
+
a.x = pt(s);
|
|
5462
|
+
}
|
|
5226
5463
|
if (i || !i && !o)
|
|
5227
|
-
if ((
|
|
5228
|
-
const u =
|
|
5464
|
+
if ((Z(t) !== "body" || et(s)) && (l = at(t)), i) {
|
|
5465
|
+
const u = J(t, !0, o, t);
|
|
5229
5466
|
a.x = u.x + t.clientLeft, a.y = u.y + t.clientTop;
|
|
5230
|
-
} else s && (
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
const u = s.getBoundingClientRect();
|
|
5234
|
-
d = u.top + l.scrollTop, h = u.left + l.scrollLeft - // RTL <body> scrollbar.
|
|
5235
|
-
xt(s, u);
|
|
5236
|
-
}
|
|
5237
|
-
const f = r.left + l.scrollLeft - a.x - h, x = r.top + l.scrollTop - a.y - d;
|
|
5467
|
+
} else s && h();
|
|
5468
|
+
o && !i && s && h();
|
|
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;
|
|
5238
5470
|
return {
|
|
5239
5471
|
x: f,
|
|
5240
5472
|
y: x,
|
|
@@ -5242,39 +5474,39 @@ function Ge(c, t, e) {
|
|
|
5242
5474
|
height: r.height
|
|
5243
5475
|
};
|
|
5244
5476
|
}
|
|
5245
|
-
function
|
|
5246
|
-
return
|
|
5477
|
+
function ht(c) {
|
|
5478
|
+
return B(c).position === "static";
|
|
5247
5479
|
}
|
|
5248
5480
|
function Ot(c, t) {
|
|
5249
|
-
if (!
|
|
5481
|
+
if (!K(c) || B(c).position === "fixed")
|
|
5250
5482
|
return null;
|
|
5251
5483
|
if (t)
|
|
5252
5484
|
return t(c);
|
|
5253
5485
|
let e = c.offsetParent;
|
|
5254
|
-
return
|
|
5486
|
+
return F(c) === e && (e = e.ownerDocument.body), e;
|
|
5255
5487
|
}
|
|
5256
|
-
function
|
|
5488
|
+
function jt(c, t) {
|
|
5257
5489
|
const e = A(c);
|
|
5258
|
-
if (
|
|
5490
|
+
if (lt(c))
|
|
5259
5491
|
return e;
|
|
5260
|
-
if (!
|
|
5261
|
-
let s =
|
|
5262
|
-
for (; s && !
|
|
5263
|
-
if (
|
|
5492
|
+
if (!K(c)) {
|
|
5493
|
+
let s = P(c);
|
|
5494
|
+
for (; s && !j(s); ) {
|
|
5495
|
+
if (X(s) && !ht(s))
|
|
5264
5496
|
return s;
|
|
5265
|
-
s =
|
|
5497
|
+
s = P(s);
|
|
5266
5498
|
}
|
|
5267
5499
|
return e;
|
|
5268
5500
|
}
|
|
5269
5501
|
let i = Ot(c, t);
|
|
5270
|
-
for (; i &&
|
|
5502
|
+
for (; i && Pe(i) && ht(i); )
|
|
5271
5503
|
i = Ot(i, t);
|
|
5272
|
-
return i &&
|
|
5504
|
+
return i && j(i) && ht(i) && !wt(i) ? e : i || je(c) || e;
|
|
5273
5505
|
}
|
|
5274
|
-
const
|
|
5275
|
-
const t = this.getOffsetParent ||
|
|
5506
|
+
const hi = async function(c) {
|
|
5507
|
+
const t = this.getOffsetParent || jt, e = this.getDimensions, i = await e(c.floating);
|
|
5276
5508
|
return {
|
|
5277
|
-
reference:
|
|
5509
|
+
reference: ai(c.reference, await t(c.floating), c.strategy),
|
|
5278
5510
|
floating: {
|
|
5279
5511
|
x: 0,
|
|
5280
5512
|
y: 0,
|
|
@@ -5283,34 +5515,34 @@ const Ue = async function(c) {
|
|
|
5283
5515
|
}
|
|
5284
5516
|
};
|
|
5285
5517
|
};
|
|
5286
|
-
function
|
|
5287
|
-
return
|
|
5518
|
+
function ci(c) {
|
|
5519
|
+
return B(c).direction === "rtl";
|
|
5288
5520
|
}
|
|
5289
|
-
const
|
|
5290
|
-
convertOffsetParentRelativeRectToViewportRelativeRect:
|
|
5291
|
-
getDocumentElement:
|
|
5292
|
-
getClippingRect:
|
|
5293
|
-
getOffsetParent:
|
|
5294
|
-
getElementRects:
|
|
5295
|
-
getClientRects:
|
|
5296
|
-
getDimensions:
|
|
5297
|
-
getScale:
|
|
5298
|
-
isElement:
|
|
5299
|
-
isRTL:
|
|
5300
|
-
},
|
|
5521
|
+
const di = {
|
|
5522
|
+
convertOffsetParentRelativeRectToViewportRelativeRect: Qe,
|
|
5523
|
+
getDocumentElement: F,
|
|
5524
|
+
getClippingRect: ni,
|
|
5525
|
+
getOffsetParent: jt,
|
|
5526
|
+
getElementRects: hi,
|
|
5527
|
+
getClientRects: ti,
|
|
5528
|
+
getDimensions: li,
|
|
5529
|
+
getScale: U,
|
|
5530
|
+
isElement: X,
|
|
5531
|
+
isRTL: ci
|
|
5532
|
+
}, Zt = Ye, qt = Fe, Jt = Be, fi = Xe, Qt = (c, t, e) => {
|
|
5301
5533
|
const i = /* @__PURE__ */ new Map(), s = {
|
|
5302
|
-
platform:
|
|
5534
|
+
platform: di,
|
|
5303
5535
|
...e
|
|
5304
5536
|
}, o = {
|
|
5305
5537
|
...s.platform,
|
|
5306
5538
|
_c: i
|
|
5307
5539
|
};
|
|
5308
|
-
return
|
|
5540
|
+
return ke(c, t, {
|
|
5309
5541
|
...s,
|
|
5310
5542
|
platform: o
|
|
5311
5543
|
});
|
|
5312
5544
|
};
|
|
5313
|
-
let
|
|
5545
|
+
let xi = class {
|
|
5314
5546
|
constructor(t) {
|
|
5315
5547
|
n(this, "ctx");
|
|
5316
5548
|
n(this, "enable", !1);
|
|
@@ -5372,7 +5604,7 @@ let Je = class {
|
|
|
5372
5604
|
return;
|
|
5373
5605
|
this.enable = !0, this.contentEl.style.maxWidth = `${t.overflowTooltipMaxWidth || 500}px`, this.contentEl.style.minWidth = "100px", this.contentEl.style.width = "100%", this.contentEl.style.display = "inline-block", this.contentEl.style.wordBreak = "break-all", this.contentEl.style.lineHeight = "1.5", this.contentEl.innerText = e;
|
|
5374
5606
|
const s = t.drawX + i.x, o = t.drawY + i.y;
|
|
5375
|
-
|
|
5607
|
+
Qt({
|
|
5376
5608
|
getBoundingClientRect() {
|
|
5377
5609
|
return {
|
|
5378
5610
|
width: t.visibleWidth,
|
|
@@ -5387,7 +5619,7 @@ let Je = class {
|
|
|
5387
5619
|
}
|
|
5388
5620
|
}, this.floatingEl, {
|
|
5389
5621
|
placement: t.overflowTooltipPlacement,
|
|
5390
|
-
middleware: [
|
|
5622
|
+
middleware: [qt(), Jt(), Zt(6), fi({ element: this.arrowEl })]
|
|
5391
5623
|
}).then((l) => {
|
|
5392
5624
|
const { x: a, y: h, placement: d, middlewareData: f } = l;
|
|
5393
5625
|
if (Object.assign(this.floatingEl.style, {
|
|
@@ -5426,7 +5658,7 @@ let Je = class {
|
|
|
5426
5658
|
this.contentEl.remove(), this.arrowEl.remove(), this.floatingEl.remove();
|
|
5427
5659
|
}
|
|
5428
5660
|
};
|
|
5429
|
-
class
|
|
5661
|
+
class ui {
|
|
5430
5662
|
constructor(t) {
|
|
5431
5663
|
n(this, "editorEl");
|
|
5432
5664
|
n(this, "inputEl");
|
|
@@ -5522,7 +5754,7 @@ class Qe {
|
|
|
5522
5754
|
const { xArr: e, yArr: i } = this.ctx.selector;
|
|
5523
5755
|
this.selectorArrStr = JSON.stringify(e) + JSON.stringify(i);
|
|
5524
5756
|
}), this.ctx.on("cellClick", (t) => {
|
|
5525
|
-
if (this.ctx.adjustPositioning || !this.isInSelectorRange(t.rowIndex, t.colIndex))
|
|
5757
|
+
if (this.ctx.adjustPositioning || this.ctx.isPointer || !this.isInSelectorRange(t.rowIndex, t.colIndex))
|
|
5526
5758
|
return;
|
|
5527
5759
|
const { xArr: e, yArr: i } = this.ctx.selector, s = JSON.stringify(e) + JSON.stringify(i);
|
|
5528
5760
|
if (this.selectorArrStr === s && this.cellTarget) {
|
|
@@ -5628,7 +5860,7 @@ class Qe {
|
|
|
5628
5860
|
(t = this.editorEl) == null || t.remove();
|
|
5629
5861
|
}
|
|
5630
5862
|
}
|
|
5631
|
-
class
|
|
5863
|
+
class gi {
|
|
5632
5864
|
constructor(t) {
|
|
5633
5865
|
n(this, "ctx");
|
|
5634
5866
|
n(this, "emptyEl");
|
|
@@ -5652,7 +5884,7 @@ class ti {
|
|
|
5652
5884
|
this.emptyEl.remove();
|
|
5653
5885
|
}
|
|
5654
5886
|
}
|
|
5655
|
-
class
|
|
5887
|
+
class wi {
|
|
5656
5888
|
constructor(t) {
|
|
5657
5889
|
n(this, "ctx");
|
|
5658
5890
|
this.ctx = t;
|
|
@@ -5682,8 +5914,8 @@ class ei {
|
|
|
5682
5914
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
5683
5915
|
} = this.ctx, { visibleWidth: o, visibleHeight: r, renderCellHeaders: l } = this.ctx.header;
|
|
5684
5916
|
let a = [], h = [], d = [];
|
|
5685
|
-
l.forEach((
|
|
5686
|
-
|
|
5917
|
+
l.forEach((g) => {
|
|
5918
|
+
g.render && (g.fixed === "left" ? h.push(g) : g.fixed === "right" ? d.push(g) : a.push(g));
|
|
5687
5919
|
});
|
|
5688
5920
|
const f = e - i, x = {
|
|
5689
5921
|
key: "left",
|
|
@@ -5707,7 +5939,7 @@ class ei {
|
|
|
5707
5939
|
height: `${r}px`
|
|
5708
5940
|
},
|
|
5709
5941
|
cells: a
|
|
5710
|
-
},
|
|
5942
|
+
}, w = {
|
|
5711
5943
|
key: "right",
|
|
5712
5944
|
style: {
|
|
5713
5945
|
position: "absolute",
|
|
@@ -5728,15 +5960,15 @@ class ei {
|
|
|
5728
5960
|
width: `${o}px`,
|
|
5729
5961
|
height: `${r}px`
|
|
5730
5962
|
},
|
|
5731
|
-
views: [x, u,
|
|
5963
|
+
views: [x, u, w]
|
|
5732
5964
|
};
|
|
5733
5965
|
}
|
|
5734
5966
|
getBody() {
|
|
5735
5967
|
const t = [], e = [], i = [];
|
|
5736
5968
|
let s = this.ctx.body.renderRows;
|
|
5737
|
-
this.ctx.config.FOOTER_FIXED || (s = s.concat(this.ctx.footer.renderRows)), s.forEach((
|
|
5738
|
-
|
|
5739
|
-
|
|
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));
|
|
5740
5972
|
});
|
|
5741
5973
|
});
|
|
5742
5974
|
const {
|
|
@@ -5765,7 +5997,7 @@ class ei {
|
|
|
5765
5997
|
height: `${d}px`
|
|
5766
5998
|
},
|
|
5767
5999
|
cells: t
|
|
5768
|
-
},
|
|
6000
|
+
}, w = {
|
|
5769
6001
|
key: "right",
|
|
5770
6002
|
style: {
|
|
5771
6003
|
position: "absolute",
|
|
@@ -5786,14 +6018,14 @@ class ei {
|
|
|
5786
6018
|
width: `${h}px`,
|
|
5787
6019
|
height: `${d}px`
|
|
5788
6020
|
},
|
|
5789
|
-
views: [x, u,
|
|
6021
|
+
views: [x, u, w]
|
|
5790
6022
|
};
|
|
5791
6023
|
}
|
|
5792
6024
|
getFooter() {
|
|
5793
6025
|
const t = [], e = [], i = [];
|
|
5794
|
-
this.ctx.footer.renderRows.forEach((
|
|
5795
|
-
|
|
5796
|
-
|
|
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));
|
|
5797
6029
|
});
|
|
5798
6030
|
});
|
|
5799
6031
|
const {
|
|
@@ -5847,7 +6079,7 @@ class ei {
|
|
|
5847
6079
|
};
|
|
5848
6080
|
}
|
|
5849
6081
|
}
|
|
5850
|
-
class
|
|
6082
|
+
class Ei {
|
|
5851
6083
|
constructor(t) {
|
|
5852
6084
|
n(this, "ctx");
|
|
5853
6085
|
n(this, "contextMenuEl");
|
|
@@ -5873,11 +6105,11 @@ class ii {
|
|
|
5873
6105
|
}),
|
|
5874
6106
|
contextElement: document.body
|
|
5875
6107
|
};
|
|
5876
|
-
|
|
6108
|
+
Qt(x, this.contextMenuEl, {
|
|
5877
6109
|
placement: "right-start",
|
|
5878
|
-
middleware: [
|
|
5879
|
-
}).then(({ x: u, y:
|
|
5880
|
-
this.show(u,
|
|
6110
|
+
middleware: [Zt(), qt(), Jt()]
|
|
6111
|
+
}).then(({ x: u, y: w }) => {
|
|
6112
|
+
this.show(u, w);
|
|
5881
6113
|
});
|
|
5882
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));
|
|
5883
6115
|
}
|
|
@@ -5933,7 +6165,7 @@ class ii {
|
|
|
5933
6165
|
this.contextMenuEl.remove();
|
|
5934
6166
|
}
|
|
5935
6167
|
}
|
|
5936
|
-
class
|
|
6168
|
+
class yi {
|
|
5937
6169
|
constructor(t, e) {
|
|
5938
6170
|
n(this, "options");
|
|
5939
6171
|
n(this, "scroller");
|
|
@@ -5949,14 +6181,14 @@ class ri {
|
|
|
5949
6181
|
n(this, "contextMenu");
|
|
5950
6182
|
n(this, "ctx");
|
|
5951
6183
|
this.options = e;
|
|
5952
|
-
const { overlayerElement: i, editorElement: s, emptyElement: o, contextMenuElement: r } =
|
|
6184
|
+
const { overlayerElement: i, editorElement: s, emptyElement: o, contextMenuElement: r } = this.options, l = this.createContainer(
|
|
5953
6185
|
t,
|
|
5954
6186
|
i,
|
|
5955
6187
|
s,
|
|
5956
6188
|
o,
|
|
5957
6189
|
r
|
|
5958
6190
|
);
|
|
5959
|
-
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", () => {
|
|
5960
6192
|
this.draw();
|
|
5961
6193
|
}), this.ctx.on("drawView", () => {
|
|
5962
6194
|
this.draw(!0);
|
|
@@ -6196,10 +6428,10 @@ class ri {
|
|
|
6196
6428
|
}
|
|
6197
6429
|
getUtils() {
|
|
6198
6430
|
return {
|
|
6199
|
-
mergeColCell:
|
|
6200
|
-
mergeRowCell:
|
|
6201
|
-
getSpanArrByRow:
|
|
6202
|
-
getSpanObjByColumn:
|
|
6431
|
+
mergeColCell: he,
|
|
6432
|
+
mergeRowCell: ae,
|
|
6433
|
+
getSpanArrByRow: Dt,
|
|
6434
|
+
getSpanObjByColumn: kt
|
|
6203
6435
|
};
|
|
6204
6436
|
}
|
|
6205
6437
|
getColumnByKey(t) {
|
|
@@ -6214,6 +6446,6 @@ class ri {
|
|
|
6214
6446
|
}
|
|
6215
6447
|
}
|
|
6216
6448
|
export {
|
|
6217
|
-
|
|
6449
|
+
yi as default
|
|
6218
6450
|
};
|
|
6219
6451
|
//# sourceMappingURL=index.es.js.map
|