e-virt-table 1.2.21 → 1.2.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1417 -1148
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Cell.d.ts +21 -6
- package/dist/lib/Cell.js +329 -92
- 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 +18 -1
- package/dist/lib/Config.js +55 -1
- package/dist/lib/Config.js.map +1 -1
- package/dist/lib/Database.d.ts +18 -1
- package/dist/lib/Database.js +312 -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.d.ts +1 -0
- package/dist/lib/Paint.js +8 -1
- package/dist/lib/Paint.js.map +1 -1
- package/dist/lib/types.d.ts +7 -3
- package/package.json +59 -57
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.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;--evt-tree-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(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
2
|
var ee = Object.defineProperty;
|
|
3
3
|
var ie = (c, t, e) => t in c ? ee(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
|
|
4
4
|
var n = (c, t, e) => ie(c, typeof t != "symbol" ? t + "" : t, e);
|
|
@@ -8,53 +8,53 @@ class se {
|
|
|
8
8
|
this.rules = t;
|
|
9
9
|
}
|
|
10
10
|
validate(t) {
|
|
11
|
-
const e = [], { column: i, row: s, key: o, rowKey: r, colIndex:
|
|
11
|
+
const e = [], { column: i, row: s, key: o, rowKey: r, colIndex: a, rowIndex: l, value: h, field: d, fieldValue: f } = t;
|
|
12
12
|
Array.isArray(this.rules) || (this.rules = [this.rules]);
|
|
13
|
-
for (const
|
|
14
|
-
if (
|
|
15
|
-
const
|
|
13
|
+
for (const u of this.rules) {
|
|
14
|
+
if (u.validator) {
|
|
15
|
+
const x = {
|
|
16
16
|
field: d,
|
|
17
17
|
fieldValue: f,
|
|
18
18
|
value: h,
|
|
19
19
|
column: i,
|
|
20
|
-
colIndex:
|
|
21
|
-
rowIndex:
|
|
20
|
+
colIndex: a,
|
|
21
|
+
rowIndex: l,
|
|
22
22
|
row: s,
|
|
23
23
|
key: o,
|
|
24
24
|
rowKey: r,
|
|
25
|
-
...
|
|
25
|
+
...u
|
|
26
26
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
...
|
|
30
|
-
message:
|
|
27
|
+
u.validator(x, h, (w) => {
|
|
28
|
+
w && e.push({
|
|
29
|
+
...x,
|
|
30
|
+
message: w
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
if (!
|
|
34
|
+
if (!u.required && (h == null || h === ""))
|
|
35
35
|
return e;
|
|
36
|
-
|
|
36
|
+
u.pattern && !u.pattern.test(h) && e.push({
|
|
37
37
|
value: h,
|
|
38
38
|
column: i,
|
|
39
39
|
row: s,
|
|
40
40
|
key: o,
|
|
41
41
|
rowKey: r,
|
|
42
|
-
colIndex:
|
|
43
|
-
rowIndex:
|
|
42
|
+
colIndex: a,
|
|
43
|
+
rowIndex: l,
|
|
44
44
|
field: d,
|
|
45
45
|
fieldValue: f,
|
|
46
|
-
message:
|
|
47
|
-
}),
|
|
46
|
+
message: u.message || `${o} is pattern validation error`
|
|
47
|
+
}), u.required && (h == null || h === "") && e.push({
|
|
48
48
|
value: h,
|
|
49
49
|
column: i,
|
|
50
50
|
row: s,
|
|
51
51
|
key: o,
|
|
52
52
|
rowKey: r,
|
|
53
|
-
colIndex:
|
|
54
|
-
rowIndex:
|
|
53
|
+
colIndex: a,
|
|
54
|
+
rowIndex: l,
|
|
55
55
|
field: d,
|
|
56
56
|
fieldValue: f,
|
|
57
|
-
message:
|
|
57
|
+
message: u.message || `${o} is required`
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
return e;
|
|
@@ -66,7 +66,7 @@ function Lt() {
|
|
|
66
66
|
return (c === "x" ? t : t & 3 | 8).toString(16);
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function At(c, t) {
|
|
70
70
|
let e = 0, i;
|
|
71
71
|
return function(...s) {
|
|
72
72
|
const o = (/* @__PURE__ */ new Date()).getTime(), r = o - e;
|
|
@@ -75,8 +75,8 @@ function Tt(c, t) {
|
|
|
75
75
|
}, t - r));
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
return c.length ? c.map((t) =>
|
|
78
|
+
function Mt(c = []) {
|
|
79
|
+
return c.length ? c.map((t) => Mt(t.children) + 1).sort((t, e) => e - t)[0] : 0;
|
|
80
80
|
}
|
|
81
81
|
function oe(c = []) {
|
|
82
82
|
let t = [], e = [], i = [];
|
|
@@ -88,16 +88,16 @@ function oe(c = []) {
|
|
|
88
88
|
...i.sort((s, o) => (s.sort ?? 0) - (o.sort ?? 0))
|
|
89
89
|
];
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function Ht(c = [], t = 1, e = 0) {
|
|
92
92
|
return c.map((i) => {
|
|
93
93
|
if (i.children) {
|
|
94
94
|
let s = 0, o = i.fixed;
|
|
95
|
-
i.children.forEach((
|
|
96
|
-
|
|
95
|
+
i.children.forEach((a) => {
|
|
96
|
+
a.fixed = o;
|
|
97
97
|
});
|
|
98
|
-
const r =
|
|
99
|
-
return r && r.forEach((
|
|
100
|
-
s +=
|
|
98
|
+
const r = Ht(i.children, t - 1, e + 1);
|
|
99
|
+
return r && r.forEach((a) => {
|
|
100
|
+
s += a.colspan ?? 0;
|
|
101
101
|
}), {
|
|
102
102
|
...i,
|
|
103
103
|
width: i.width,
|
|
@@ -115,32 +115,32 @@ function Mt(c = [], t = 1, e = 0) {
|
|
|
115
115
|
};
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function it(c = []) {
|
|
119
119
|
let t = [];
|
|
120
120
|
return c.forEach((e) => {
|
|
121
|
-
e.children ? t = t.concat(
|
|
121
|
+
e.children ? t = t.concat(it(e.children)) : t.push(e);
|
|
122
122
|
}), t;
|
|
123
123
|
}
|
|
124
|
-
const
|
|
124
|
+
const mt = /^(\r\n|\n\r|\r|\n)/, re = /^[^\t\r\n]+/, yt = /^\t/;
|
|
125
125
|
function ne(c) {
|
|
126
126
|
let t = [[""]];
|
|
127
127
|
if (c.length === 0)
|
|
128
128
|
return t;
|
|
129
129
|
let e = 0, i = 0, s;
|
|
130
130
|
for (; c.length > 0 && s !== c.length; )
|
|
131
|
-
if (s = c.length, c.match(
|
|
132
|
-
c = c.replace(
|
|
133
|
-
else if (c.match(
|
|
134
|
-
c = c.replace(
|
|
131
|
+
if (s = c.length, c.match(yt))
|
|
132
|
+
c = c.replace(yt, ""), e += 1, t[i][e] = "";
|
|
133
|
+
else if (c.match(mt))
|
|
134
|
+
c = c.replace(mt, ""), e = 0, i += 1, t[i] = [""];
|
|
135
135
|
else {
|
|
136
136
|
let o = "";
|
|
137
137
|
if (c.startsWith('"')) {
|
|
138
|
-
let r = 0,
|
|
139
|
-
for (;
|
|
140
|
-
const
|
|
141
|
-
|
|
138
|
+
let r = 0, a = !0;
|
|
139
|
+
for (; a; ) {
|
|
140
|
+
const l = c.slice(0, 1);
|
|
141
|
+
l === '"' && (r += 1), o += l, c = c.slice(1), (c.length === 0 || c.match(/^[\t\r\n]/) && r % 2 === 0) && (a = !1);
|
|
142
142
|
}
|
|
143
|
-
o = o.replace(/^"/, "").replace(/"$/, "").replace(/["]*/g, (
|
|
143
|
+
o = o.replace(/^"/, "").replace(/"$/, "").replace(/["]*/g, (l) => new Array(Math.floor(l.length / 2)).fill('"').join(""));
|
|
144
144
|
} else {
|
|
145
145
|
const r = c.match(re);
|
|
146
146
|
o = r ? r[0] : "", c = c.slice(o.length);
|
|
@@ -149,7 +149,7 @@ function ne(c) {
|
|
|
149
149
|
}
|
|
150
150
|
return Array.isArray(t) && t.length > 1 && t[t.length - 1].length === 1 && t[t.length - 1][0] === "" && (t = t.slice(0, t.length - 1)), t;
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function ae(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,27 +160,27 @@ function le(c) {
|
|
|
160
160
|
}
|
|
161
161
|
return o;
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function Dt(c, t, e = []) {
|
|
164
164
|
let i = 0;
|
|
165
165
|
const s = [];
|
|
166
166
|
return c.forEach((o, r) => {
|
|
167
167
|
if (r === 0)
|
|
168
168
|
s.push(1);
|
|
169
169
|
else {
|
|
170
|
-
const
|
|
171
|
-
|
|
170
|
+
const a = e.reduce((h, d) => `${h}${o[d] ?? ""}`, "") || o[t], l = e.reduce((h, d) => `${h}${c[r - 1][d] ?? ""}`, "") || c[r - 1][t];
|
|
171
|
+
a === l ? (s[i] += 1, s.push(0)) : (s.push(1), i = r);
|
|
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 le(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,
|
|
@@ -196,7 +196,7 @@ function ae(c, t, e = []) {
|
|
|
196
196
|
function he(c, t = []) {
|
|
197
197
|
const { column: e, row: i, visibleLeafColumns: s } = c, o = s.filter((r) => t.includes(r.key));
|
|
198
198
|
if (t.includes(e.key)) {
|
|
199
|
-
const r =
|
|
199
|
+
const r = kt(i, o);
|
|
200
200
|
return r[e.key] === 0 ? {
|
|
201
201
|
rowspan: 0,
|
|
202
202
|
colspan: 0,
|
|
@@ -214,8 +214,8 @@ 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
|
|
218
|
-
constructor(t, e, i, s, o, r,
|
|
217
|
+
class Xt {
|
|
218
|
+
constructor(t, e, i, s, o, r, a) {
|
|
219
219
|
n(this, "ctx");
|
|
220
220
|
n(this, "x", 0);
|
|
221
221
|
n(this, "y", 0);
|
|
@@ -223,7 +223,7 @@ class kt {
|
|
|
223
223
|
n(this, "height", 0);
|
|
224
224
|
n(this, "fixed");
|
|
225
225
|
n(this, "cellType");
|
|
226
|
-
this.ctx = t, this.x = e, this.y = i, this.width = s, this.height = o, this.fixed =
|
|
226
|
+
this.ctx = t, this.x = e, this.y = i, this.width = s, this.height = o, this.fixed = a, this.cellType = r;
|
|
227
227
|
}
|
|
228
228
|
isHorizontalVisible() {
|
|
229
229
|
if (this.fixed)
|
|
@@ -260,9 +260,9 @@ class kt {
|
|
|
260
260
|
getRightFixedX() {
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
|
-
class
|
|
264
|
-
constructor(e, i, s, o, r,
|
|
265
|
-
super(e, o, r,
|
|
263
|
+
class $ extends Xt {
|
|
264
|
+
constructor(e, i, s, o, r, a, l, h, d, f = "body") {
|
|
265
|
+
super(e, o, r, a, l, f, h.fixed);
|
|
266
266
|
n(this, "formatter");
|
|
267
267
|
n(this, "formatterFooter");
|
|
268
268
|
n(this, "hoverIconName", "");
|
|
@@ -307,12 +307,29 @@ class ft extends kt {
|
|
|
307
307
|
n(this, "drawTextColor", "");
|
|
308
308
|
n(this, "drawTextX", 0);
|
|
309
309
|
n(this, "drawTextY", 0);
|
|
310
|
-
n(this, "
|
|
311
|
-
n(this, "
|
|
312
|
-
|
|
313
|
-
n(this, "
|
|
314
|
-
n(this, "
|
|
315
|
-
n(this, "
|
|
310
|
+
n(this, "drawTextWidth", 0);
|
|
311
|
+
n(this, "drawTextHeight", 0);
|
|
312
|
+
// 画tree图标
|
|
313
|
+
n(this, "drawTreeImageX", 0);
|
|
314
|
+
n(this, "drawTreeImageY", 0);
|
|
315
|
+
n(this, "drawTreeImageWidth", 0);
|
|
316
|
+
n(this, "drawTreeImageHeight", 0);
|
|
317
|
+
n(this, "drawTreeImageName", "");
|
|
318
|
+
n(this, "drawTreeImageSource");
|
|
319
|
+
// 画selection图标
|
|
320
|
+
n(this, "drawSelectionImageX", 0);
|
|
321
|
+
n(this, "drawSelectionImageY", 0);
|
|
322
|
+
n(this, "drawSelectionImageWidth", 0);
|
|
323
|
+
n(this, "drawSelectionImageHeight", 0);
|
|
324
|
+
n(this, "drawSelectionImageName", "");
|
|
325
|
+
n(this, "drawSelectionImageSource");
|
|
326
|
+
// 画hover图标
|
|
327
|
+
n(this, "drawHoverImageX", 0);
|
|
328
|
+
n(this, "drawHoverImageY", 0);
|
|
329
|
+
n(this, "drawHoverImageWidth", 0);
|
|
330
|
+
n(this, "drawHoverImageHeight", 0);
|
|
331
|
+
n(this, "drawHoverImageName", "");
|
|
332
|
+
n(this, "drawHoverImageSource");
|
|
316
333
|
n(this, "ellipsis", !1);
|
|
317
334
|
n(this, "rowExpand", !1);
|
|
318
335
|
n(this, "rowHasChildren", !1);
|
|
@@ -320,7 +337,7 @@ class ft extends kt {
|
|
|
320
337
|
n(this, "selectorCellValueType", "value");
|
|
321
338
|
n(this, "overflowTooltipMaxWidth", 500);
|
|
322
339
|
n(this, "overflowTooltipPlacement", "top");
|
|
323
|
-
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = h.key, this.type = h.type || "", this.editorType = h.editorType || "text", this.selectorCellValueType = h.selectorCellValueType || this.ctx.config.SELECTOR_CELL_VALUE_TYPE || "value", this.editorProps = h.editorProps || {}, this.cellType = f, this.align = h.align ||
|
|
340
|
+
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = h.key, this.type = h.type || "", this.editorType = h.editorType || "text", this.selectorCellValueType = h.selectorCellValueType || this.ctx.config.SELECTOR_CELL_VALUE_TYPE || "value", this.editorProps = h.editorProps || {}, this.cellType = f, this.align = h.align || this.ctx.config.COLUMNS_ALIGN, this.verticalAlign = h.verticalAlign || this.ctx.config.COLUMNS_VERTICAL_ALIGN, this.fixed = h.fixed, this.level = h.level || 0, this.operation = h.operation || !1, this.column = h, this.rules = h.rules || [], this.row = d, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = h.render, this.overflowTooltipShow = h.overflowTooltipShow !== !1, this.overflowTooltipMaxWidth = h.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = h.overflowTooltipPlacement || "top", this.renderFooter = h.renderFooter, this.hoverIconName = h.hoverIconName, this.formatter = h.formatter, this.formatterFooter = h.formatterFooter, this.update();
|
|
324
341
|
}
|
|
325
342
|
setWidthHeight(e, i) {
|
|
326
343
|
this.width = e, this.height = i;
|
|
@@ -334,7 +351,7 @@ class ft extends kt {
|
|
|
334
351
|
return this.message;
|
|
335
352
|
}
|
|
336
353
|
update() {
|
|
337
|
-
this.drawX = this.getDrawX(), this.drawY = this.getDrawY(), this.drawTextX = this.drawX, this.drawTextY = this.drawY, this.isHasChanged = this.ctx.database.isHasChangedData(this.rowKey, this.key), this.updateSpan(), this.updateStyle(), this.updateType(), this.updateHoverIcon(), this.updateSelection(), this.updateTree(), this.updateEditor(), this.updateRender(), this.getValidationMessage(), this.updateContainer(), this.text = this.getText(), this.displayText = this.getDisplayText();
|
|
354
|
+
this.drawX = this.getDrawX(), this.drawY = this.getDrawY(), this.drawTextX = this.drawX, this.drawTextY = this.drawY, this.isHasChanged = this.ctx.database.isHasChangedData(this.rowKey, this.key), this.updateSpan(), this.drawTextWidth = this.visibleWidth, this.drawTextHeight = this.visibleHeight, this.updateStyle(), this.updateType(), this.updateHoverIcon(), this.updateSelection(), this.updateTree(), this.updateEditor(), this.updateRender(), this.getValidationMessage(), this.updateContainer(), this.text = this.getText(), this.displayText = this.getDisplayText();
|
|
338
355
|
}
|
|
339
356
|
updateSpan() {
|
|
340
357
|
if (this.cellType === "footer")
|
|
@@ -345,8 +362,8 @@ class ft extends kt {
|
|
|
345
362
|
colspan: s = 1,
|
|
346
363
|
rowspan: o = 1,
|
|
347
364
|
relationRowKeys: r,
|
|
348
|
-
relationColKeys:
|
|
349
|
-
mergeRow:
|
|
365
|
+
relationColKeys: a,
|
|
366
|
+
mergeRow: l = !1,
|
|
350
367
|
mergeCol: h = !1
|
|
351
368
|
} = i({
|
|
352
369
|
row: this.row,
|
|
@@ -360,7 +377,7 @@ class ft extends kt {
|
|
|
360
377
|
visibleLeafColumns: this.ctx.header.visibleLeafColumns,
|
|
361
378
|
rows: this.ctx.body.data
|
|
362
379
|
}) || {};
|
|
363
|
-
Array.isArray(r) && r.length > 0 ? this.relationRowKeys = r : this.relationRowKeys = [this.key], Array.isArray(
|
|
380
|
+
Array.isArray(r) && r.length > 0 ? this.relationRowKeys = r : this.relationRowKeys = [this.key], Array.isArray(a) && a.length > 0 ? this.relationColKeys = a : this.relationColKeys = [this.key], this.mergeCol = h, this.mergeRow = l, this.colspan = s, this.rowspan = o, this.visibleWidth = this.getWidthByColIndexColSpan(this.colIndex, this.colspan), this.visibleHeight = this.ctx.database.getHeightByRowIndexRowSpan(this.rowIndex, this.rowspan);
|
|
364
381
|
}
|
|
365
382
|
}
|
|
366
383
|
updateSpanInfo() {
|
|
@@ -431,23 +448,65 @@ class ft extends kt {
|
|
|
431
448
|
}
|
|
432
449
|
updateTree() {
|
|
433
450
|
const { CELL_PADDING: e = 0 } = this.ctx.config, { rowKey: i, cellType: s } = this;
|
|
434
|
-
let o, r = 0,
|
|
435
|
-
if (
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
451
|
+
let o, r = 0, a = "";
|
|
452
|
+
if (!(["tree", "selection-tree", "tree-selection"].includes(this.type) && s === "body"))
|
|
453
|
+
return;
|
|
454
|
+
const l = this.ctx.database.getRowForRowKey(i), { expand: h = !1, hasChildren: d = !1, expandLoading: f = !1, level: u = 0 } = l || {};
|
|
455
|
+
this.rowExpand = h, this.rowHasChildren = d;
|
|
456
|
+
const { TREE_INDENT: x = 16, CHECKBOX_SIZE: w, TREE_ICON_SIZE: E } = this.ctx.config;
|
|
457
|
+
if (r = u * x, f) {
|
|
458
|
+
const I = this.ctx.icons.get("loading");
|
|
459
|
+
a = "loading", o = I;
|
|
460
|
+
} else if (d) {
|
|
461
|
+
const I = this.ctx.icons.get("expand"), _ = this.ctx.icons.get("shrink");
|
|
462
|
+
o = h ? _ : I, a = h ? "shrink" : "expand";
|
|
463
|
+
}
|
|
464
|
+
let g = E, p = E, y = this.drawX;
|
|
465
|
+
(this.align === "center" || this.align === "right") && (y = this.drawX + (this.visibleWidth - g - 2 * e) / 2, this.align = "left");
|
|
466
|
+
let m = y + r + e, b = this.drawY + (this.visibleHeight - p) / 2, C = r + this.drawX + g - 0.5;
|
|
467
|
+
this.type === "selection-tree" ? (m = r + this.drawSelectionImageX + this.drawSelectionImageWidth, C = m + g - e / 2) : this.type === "tree-selection" ? C = m + w + g - e / 2 : C = m + g - e / 2, this.drawTextX = C, this.drawTextWidth = this.drawX + this.visibleWidth - C, !(m + g + e > this.drawX + this.visibleWidth) && (b + p + e > this.drawY + this.visibleHeight || (this.drawTreeImageX = m, this.drawTreeImageY = b, this.drawTreeImageWidth = g, this.drawTreeImageHeight = p, o ? (this.drawTreeImageName = a, this.drawTreeImageSource = o) : (this.drawTreeImageName = "", this.drawTreeImageSource = void 0)));
|
|
468
|
+
}
|
|
469
|
+
drawTreeLine() {
|
|
470
|
+
const { TREE_LINE: e, TREE_INDENT: i = 16, TREE_ICON_SIZE: s = 16, TREE_LINE_COLOR: o = "#e1e6eb" } = this.ctx.config;
|
|
471
|
+
if (!e || this.cellType !== "body" || !["tree", "selection-tree", "tree-selection"].includes(this.type) || this.rowspan === 0 || this.colspan === 0) return;
|
|
472
|
+
const r = this.ctx.database.getRowForRowKey(this.rowKey) || {}, a = r.level ?? 0, l = this.drawTreeImageX + this.drawTreeImageWidth / 2, h = this.drawTreeImageY + this.drawTreeImageHeight / 2;
|
|
473
|
+
let d = this.drawTreeImageX - a * i;
|
|
474
|
+
const f = Array.isArray(r.parentRowKeys) ? r.parentRowKeys : [];
|
|
475
|
+
if (a > 0) {
|
|
476
|
+
for (let g = 0; g < a - 1; g += 1) {
|
|
477
|
+
const p = f[g + 1];
|
|
478
|
+
if (!!(p ? this.ctx.database.getRowForRowKey(p) || {} : {}).isLastChild) continue;
|
|
479
|
+
const b = Math.round(this.drawTreeImageX - (a - g) * i + s / 2);
|
|
480
|
+
this.ctx.paint.drawLine([b, this.drawY, b, this.drawY + this.visibleHeight], {
|
|
481
|
+
borderColor: o,
|
|
482
|
+
borderWidth: 1,
|
|
483
|
+
lineDash: [4, 4],
|
|
484
|
+
lineDashOffset: 0
|
|
485
|
+
});
|
|
449
486
|
}
|
|
450
|
-
this.
|
|
487
|
+
const u = Math.round(this.drawTreeImageX - i + s / 2), w = !!r.isLastChild ? h : this.drawY + this.visibleHeight;
|
|
488
|
+
this.ctx.paint.drawLine([u, this.drawY, u, w], {
|
|
489
|
+
borderColor: o,
|
|
490
|
+
borderWidth: 1,
|
|
491
|
+
lineDash: [4, 4],
|
|
492
|
+
lineDashOffset: 0
|
|
493
|
+
});
|
|
494
|
+
const E = Math.round(d + (a - 1) * i + s / 2);
|
|
495
|
+
this.ctx.paint.drawLine([E, h, l, h], {
|
|
496
|
+
borderColor: o,
|
|
497
|
+
borderWidth: 1,
|
|
498
|
+
lineDash: [4, 4],
|
|
499
|
+
lineDashOffset: 0
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
if (r.hasChildren && r.expand) {
|
|
503
|
+
const u = this.drawTreeImageY + this.drawTreeImageHeight, x = u + Math.min(this.visibleHeight / 2, Math.max(8, s / 2));
|
|
504
|
+
this.ctx.paint.drawLine([l, u, l, x], {
|
|
505
|
+
borderColor: o,
|
|
506
|
+
borderWidth: 1,
|
|
507
|
+
lineDash: [4, 4],
|
|
508
|
+
lineDashOffset: 0
|
|
509
|
+
});
|
|
451
510
|
}
|
|
452
511
|
}
|
|
453
512
|
updateContainer() {
|
|
@@ -457,42 +516,42 @@ class ft extends kt {
|
|
|
457
516
|
BODY_CELL_STYLE_METHOD: s,
|
|
458
517
|
FOOTER_CELL_STYLE_METHOD: o,
|
|
459
518
|
READONLY_TEXT_COLOR: r,
|
|
460
|
-
BODY_TEXT_COLOR:
|
|
461
|
-
FOOTER_TEXT_COLOR:
|
|
519
|
+
BODY_TEXT_COLOR: a,
|
|
520
|
+
FOOTER_TEXT_COLOR: l,
|
|
462
521
|
FOOTER_BG_COLOR: h,
|
|
463
522
|
HIGHLIGHT_SELECTED_ROW: d,
|
|
464
523
|
HIGHLIGHT_SELECTED_ROW_COLOR: f,
|
|
465
|
-
HIGHLIGHT_HOVER_ROW:
|
|
466
|
-
HIGHLIGHT_HOVER_ROW_COLOR:
|
|
467
|
-
STRIPE:
|
|
468
|
-
STRIPE_COLOR:
|
|
524
|
+
HIGHLIGHT_HOVER_ROW: u,
|
|
525
|
+
HIGHLIGHT_HOVER_ROW_COLOR: x,
|
|
526
|
+
STRIPE: w,
|
|
527
|
+
STRIPE_COLOR: E
|
|
469
528
|
} = this.ctx.config;
|
|
470
529
|
if (this.cellType === "footer") {
|
|
471
|
-
let _ = h,
|
|
530
|
+
let _ = h, T = l;
|
|
472
531
|
if (typeof o == "function") {
|
|
473
|
-
const v = o, { backgroundColor:
|
|
532
|
+
const v = o, { backgroundColor: R, color: S } = v({
|
|
474
533
|
row: this.row,
|
|
475
534
|
rowIndex: this.rowIndex,
|
|
476
535
|
colIndex: this.colIndex,
|
|
477
536
|
column: this.column,
|
|
478
537
|
value: this.getValue()
|
|
479
538
|
}) || {};
|
|
480
|
-
|
|
539
|
+
R && (_ = R), S && (T = S);
|
|
481
540
|
}
|
|
482
|
-
this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = _, this.drawTextColor =
|
|
541
|
+
this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = _, this.drawTextColor = T;
|
|
483
542
|
return;
|
|
484
543
|
}
|
|
485
|
-
let
|
|
486
|
-
const
|
|
487
|
-
let m = this.rowIndex,
|
|
488
|
-
if (this.rowspan !== 1 && (
|
|
489
|
-
const _ = this.getSpanInfo(), { yArr:
|
|
490
|
-
m =
|
|
544
|
+
let g = "transparent";
|
|
545
|
+
const p = this.ctx.hoverCell, y = this.ctx.currentCell;
|
|
546
|
+
let m = this.rowIndex, b = this.rowIndex;
|
|
547
|
+
if (this.rowspan !== 1 && (u || d)) {
|
|
548
|
+
const _ = this.getSpanInfo(), { yArr: T } = _;
|
|
549
|
+
m = T[0], b = T[1];
|
|
491
550
|
}
|
|
492
|
-
|
|
493
|
-
let C = e, I =
|
|
494
|
-
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (C = i, I = r),
|
|
495
|
-
const _ = s, { backgroundColor:
|
|
551
|
+
u && p && (p.rowKey === this.rowKey && (g = x), p.rowIndex >= m && p.rowIndex <= b && (g = x)), d && y && (y.rowKey === this.rowKey && (g = f), y.rowIndex >= m && y.rowIndex <= b && (g = f)), this.drawCellSkyBgColor = g;
|
|
552
|
+
let C = e, I = a;
|
|
553
|
+
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (C = i, I = r), w && (this.rowIndex % 2 ? C = E : C = e), typeof s == "function") {
|
|
554
|
+
const _ = s, { backgroundColor: T, color: v } = _({
|
|
496
555
|
row: this.row,
|
|
497
556
|
rowIndex: this.rowIndex,
|
|
498
557
|
colIndex: this.colIndex,
|
|
@@ -500,17 +559,33 @@ class ft extends kt {
|
|
|
500
559
|
isHasChanged: this.isHasChanged,
|
|
501
560
|
value: this.getValue()
|
|
502
561
|
}) || {};
|
|
503
|
-
|
|
562
|
+
T && (C = T), v && (I = v);
|
|
504
563
|
}
|
|
505
564
|
this.drawCellBgColor = C, this.drawTextColor = I;
|
|
506
565
|
}
|
|
507
566
|
updateSelection() {
|
|
508
|
-
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type:
|
|
509
|
-
if (
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
567
|
+
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: a, rowIndex: l, rowKey: h } = this;
|
|
568
|
+
if (s === 0 || o === 0 || r === "footer" || !["index-selection", "selection", "selection-tree", "tree-selection"].includes(a))
|
|
569
|
+
return;
|
|
570
|
+
const d = this.ctx.database.getRowSelectable(h), { CHECKBOX_SIZE: f = 0, CELL_PADDING: u } = this.ctx.config;
|
|
571
|
+
let x = this.drawX + u;
|
|
572
|
+
(this.align === "center" || this.align === "right") && (x = this.drawX + (e - f) / 2);
|
|
573
|
+
let w = x, E = this.drawY + (i - f) / 2;
|
|
574
|
+
if (a !== "selection-tree") {
|
|
575
|
+
if (a === "tree-selection") {
|
|
576
|
+
const { TREE_INDENT: y = 16, TREE_ICON_SIZE: m } = this.ctx.config, b = this.ctx.database.getRowForRowKey(h), { level: C = 0 } = b || {}, I = C * y;
|
|
577
|
+
w = x + m + I;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
let g = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck";
|
|
581
|
+
if (a === "selection-tree" || a === "tree-selection") {
|
|
582
|
+
const y = this.ctx.database.getTreeSelectionState(h);
|
|
583
|
+
y.indeterminate && d ? (g = this.ctx.icons.get("checkbox-indeterminate"), p = "checkbox-indeterminate") : y.checked && d ? (g = this.ctx.icons.get("checkbox-check"), p = "checkbox-check") : !y.checked && d ? (g = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), p = "checkbox-disabled");
|
|
584
|
+
} else {
|
|
585
|
+
const y = this.ctx.database.getRowSelection(h);
|
|
586
|
+
y && d ? (g = this.ctx.icons.get("checkbox-check"), p = "checkbox-check") : y && !d ? (g = this.ctx.icons.get("checkbox-check-disabled"), p = "checkbox-check-disabled") : !y && d ? (g = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), p = "checkbox-disabled");
|
|
513
587
|
}
|
|
588
|
+
w + f + u > this.drawX + this.visibleWidth || E + f + u > this.drawY + this.visibleHeight || (a === "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === l || ["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
589
|
}
|
|
515
590
|
updateHoverIcon() {
|
|
516
591
|
if (this.ctx.database.getReadonly(this.rowKey, this.key))
|
|
@@ -526,18 +601,18 @@ class ft extends kt {
|
|
|
526
601
|
});
|
|
527
602
|
h !== void 0 && (this.hoverIconName = h);
|
|
528
603
|
}
|
|
529
|
-
const { hoverCell:
|
|
530
|
-
if (this.hoverIconName && !this.ctx.editing &&
|
|
531
|
-
let
|
|
532
|
-
if (
|
|
533
|
-
const f = this.getSpanInfo(), { yArr:
|
|
534
|
-
if (
|
|
535
|
-
const { width:
|
|
536
|
-
|
|
604
|
+
const { hoverCell: a } = this.ctx;
|
|
605
|
+
if (this.hoverIconName && !this.ctx.editing && a) {
|
|
606
|
+
let l = 0, h = 0;
|
|
607
|
+
if (a.rowKey === this.rowKey && (l = this.drawX + this.width - s - o, h = this.drawY + (this.height - s) / 2), this.rowspan !== 1 && r) {
|
|
608
|
+
const f = this.getSpanInfo(), { yArr: u } = f, x = u[0], w = u[1];
|
|
609
|
+
if (a.rowIndex >= x && a.rowIndex <= w) {
|
|
610
|
+
const { width: E, height: g, offsetTop: p, offsetLeft: y } = f;
|
|
611
|
+
l = this.drawX - y + E - s - o, h = this.drawY - p + (g - s) / 2;
|
|
537
612
|
}
|
|
538
613
|
}
|
|
539
614
|
const d = this.ctx.icons.get(this.hoverIconName);
|
|
540
|
-
this.
|
|
615
|
+
this.drawHoverImageX = l, this.drawHoverImageY = h, this.drawHoverImageWidth = s, this.drawHoverImageHeight = s, this.drawHoverImageName = this.hoverIconName, this.drawHoverImageSource = d;
|
|
541
616
|
}
|
|
542
617
|
}
|
|
543
618
|
// 过去跨度配置
|
|
@@ -549,7 +624,7 @@ class ft extends kt {
|
|
|
549
624
|
* @returns
|
|
550
625
|
*/
|
|
551
626
|
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.
|
|
627
|
+
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
628
|
}
|
|
554
629
|
/**
|
|
555
630
|
* 获取文本
|
|
@@ -632,17 +707,17 @@ class ft extends kt {
|
|
|
632
707
|
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s, AUTOFILL_POINT_BORDER_COLOR: o } = this.ctx.config;
|
|
633
708
|
if (!s || !i || this.ctx.editing)
|
|
634
709
|
return;
|
|
635
|
-
const { xArr: r, yArr:
|
|
636
|
-
if (d ===
|
|
637
|
-
const
|
|
638
|
-
this.ctx.paint.drawRect(
|
|
710
|
+
const { xArr: r, yArr: a } = this.ctx.selector, l = r[1], h = a[1], { colIndex: d, rowIndex: f, drawX: u, drawY: x } = this;
|
|
711
|
+
if (d === l && f === h) {
|
|
712
|
+
const E = d === this.ctx.maxColIndex || f === this.ctx.maxRowIndex || d === this.ctx.lastCenterColIndex ? 6 : 4;
|
|
713
|
+
this.ctx.paint.drawRect(u + this.width - E, x + this.height - E, 6, 6, {
|
|
639
714
|
borderColor: o,
|
|
640
715
|
fillColor: e
|
|
641
716
|
});
|
|
642
717
|
}
|
|
643
718
|
}
|
|
644
719
|
draw() {
|
|
645
|
-
this.drawText(), this.drawImage(), this.drawSelector(), this.drawAutofillPiont(), this.drawErrorTip();
|
|
720
|
+
this.drawTreeLine(), this.drawText(), this.drawImage(), this.drawSelector(), this.drawAutofillPiont(), this.drawErrorTip();
|
|
646
721
|
}
|
|
647
722
|
/**
|
|
648
723
|
* 根据列的索引获取列的宽度
|
|
@@ -659,47 +734,55 @@ class ft extends kt {
|
|
|
659
734
|
return s;
|
|
660
735
|
}
|
|
661
736
|
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, {
|
|
737
|
+
const { CELL_PADDING: e, BODY_FONT: i, PLACEHOLDER_COLOR: s } = this.ctx.config, { ellipsis: o } = this.ctx.paint.handleEllipsis(
|
|
738
|
+
this.displayText,
|
|
739
|
+
this.drawTextWidth,
|
|
740
|
+
e,
|
|
741
|
+
i
|
|
742
|
+
);
|
|
743
|
+
this.ellipsis = o;
|
|
744
|
+
const { placeholder: r } = this.column;
|
|
745
|
+
let a = this.displayText, l = this.drawTextColor;
|
|
746
|
+
return !this.ctx.database.getReadonly(this.rowKey, this.key) && r && ["", null, void 0].includes(this.text) && this.cellType === "body" && !(this.rowspan === 0 || this.colspan === 0) && (a = r, l = s), this.ctx.paint.drawText(a, this.drawTextX, this.drawTextY, this.drawTextWidth, this.drawTextHeight, {
|
|
673
747
|
font: i,
|
|
674
748
|
padding: e,
|
|
675
749
|
align: this.align,
|
|
676
750
|
verticalAlign: this.verticalAlign,
|
|
677
|
-
color:
|
|
751
|
+
color: l
|
|
678
752
|
});
|
|
679
753
|
}
|
|
680
754
|
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
|
-
|
|
755
|
+
if (this.drawSelectionImageSource && this.ctx.paint.drawImage(
|
|
756
|
+
this.drawSelectionImageSource,
|
|
757
|
+
this.drawSelectionImageX,
|
|
758
|
+
this.drawSelectionImageY,
|
|
759
|
+
this.drawSelectionImageWidth,
|
|
760
|
+
this.drawSelectionImageHeight
|
|
761
|
+
), this.drawTreeImageSource && this.ctx.paint.drawImage(
|
|
762
|
+
this.drawTreeImageSource,
|
|
763
|
+
this.drawTreeImageX,
|
|
764
|
+
this.drawTreeImageY,
|
|
765
|
+
this.drawTreeImageWidth,
|
|
766
|
+
this.drawTreeImageHeight
|
|
767
|
+
), this.drawHoverImageSource) {
|
|
768
|
+
const { CELL_HOVER_ICON_BG_COLOR: e, CELL_HOVER_ICON_BORDER_COLOR: i } = this.ctx.config;
|
|
769
|
+
this.ctx.paint.drawRect(
|
|
770
|
+
this.drawHoverImageX - 2,
|
|
771
|
+
this.drawHoverImageY - 2,
|
|
772
|
+
this.drawHoverImageWidth + 4,
|
|
773
|
+
this.drawHoverImageHeight + 4,
|
|
774
|
+
{
|
|
775
|
+
borderColor: i,
|
|
776
|
+
radius: 4,
|
|
777
|
+
borderWidth: 1,
|
|
778
|
+
fillColor: e
|
|
779
|
+
}
|
|
780
|
+
), this.ctx.paint.drawImage(
|
|
781
|
+
this.drawHoverImageSource,
|
|
782
|
+
this.drawHoverImageX,
|
|
783
|
+
this.drawHoverImageY,
|
|
784
|
+
this.drawHoverImageWidth,
|
|
785
|
+
this.drawHoverImageHeight
|
|
703
786
|
);
|
|
704
787
|
}
|
|
705
788
|
}
|
|
@@ -731,8 +814,8 @@ class ft extends kt {
|
|
|
731
814
|
fillColor: "transparent",
|
|
732
815
|
borderWidth: 1
|
|
733
816
|
});
|
|
734
|
-
const [
|
|
735
|
-
!(
|
|
817
|
+
const [a, l] = i, [h, d] = s;
|
|
818
|
+
!(a === l && h === d) && this.colIndex >= a && this.colIndex <= l && this.rowIndex >= h && this.rowIndex <= d && this.ctx.paint.drawRect(this.drawX, this.drawY, this.width, this.height, {
|
|
736
819
|
borderColor: "transparent",
|
|
737
820
|
fillColor: this.ctx.config.SELECT_AREA_COLOR || "rgba(82,146,247,0.1)"
|
|
738
821
|
}), this.operation && this.rowIndex >= h && this.rowIndex <= d && this.ctx.paint.drawRect(this.drawX, this.drawY, this.visibleWidth, this.visibleHeight, {
|
|
@@ -743,7 +826,7 @@ class ft extends kt {
|
|
|
743
826
|
drawErrorTip() {
|
|
744
827
|
if (this.cellType === "footer" || !this.message || this.rowspan === 0 || this.colspan === 0)
|
|
745
828
|
return;
|
|
746
|
-
const { ERROR_TIP_ICON_SIZE: e, ERROR_TIP_COLOR: i } = this.ctx.config, { width: s } = this, o = this.drawX, r = this.drawY,
|
|
829
|
+
const { ERROR_TIP_ICON_SIZE: e, ERROR_TIP_COLOR: i } = this.ctx.config, { width: s } = this, o = this.drawX, r = this.drawY, a = [
|
|
747
830
|
o + s - e - 0.5,
|
|
748
831
|
r,
|
|
749
832
|
o + s - 0.5,
|
|
@@ -751,7 +834,7 @@ class ft extends kt {
|
|
|
751
834
|
o + s - 0.5,
|
|
752
835
|
r + e
|
|
753
836
|
];
|
|
754
|
-
this.ctx.paint.drawLine(
|
|
837
|
+
this.ctx.paint.drawLine(a, {
|
|
755
838
|
borderColor: i,
|
|
756
839
|
fillColor: i,
|
|
757
840
|
borderWidth: 1,
|
|
@@ -760,51 +843,51 @@ class ft extends kt {
|
|
|
760
843
|
});
|
|
761
844
|
}
|
|
762
845
|
drawBorder(e) {
|
|
763
|
-
const { drawX: i, drawY: s, rowIndex: o, colIndex: r, height:
|
|
846
|
+
const { drawX: i, drawY: s, rowIndex: o, colIndex: r, height: a, width: l } = this;
|
|
764
847
|
let h = i, d = s;
|
|
765
|
-
const { xArr: f, yArr:
|
|
766
|
-
if (r >=
|
|
767
|
-
const C = r === y ? 1 : 0, I = r ===
|
|
768
|
-
this.ctx.paint.drawLine([h + I, d + 1, h +
|
|
769
|
-
borderColor:
|
|
770
|
-
fillColor:
|
|
771
|
-
borderWidth:
|
|
848
|
+
const { xArr: f, yArr: u, lineDash: x = [], borderWidth: w = 1, borderColor: E, fillColor: g } = e, p = f[0], y = f[1], m = u[0], b = u[1];
|
|
849
|
+
if (r >= p && r <= y && o === m) {
|
|
850
|
+
const C = r === y ? 1 : 0, I = r === p ? 1 : 0;
|
|
851
|
+
this.ctx.paint.drawLine([h + I, d + 1, h + l - C, d + 1], {
|
|
852
|
+
borderColor: E,
|
|
853
|
+
fillColor: g,
|
|
854
|
+
borderWidth: w,
|
|
772
855
|
lineCap: "round",
|
|
773
856
|
lineJoin: "round",
|
|
774
|
-
lineDash:
|
|
857
|
+
lineDash: x
|
|
775
858
|
});
|
|
776
859
|
}
|
|
777
|
-
if (r === y && o >= m && o <=
|
|
778
|
-
const C = o === m ? 1 : 0, I = o ===
|
|
779
|
-
this.ctx.paint.drawLine([h +
|
|
780
|
-
borderColor:
|
|
781
|
-
fillColor:
|
|
782
|
-
borderWidth:
|
|
860
|
+
if (r === y && o >= m && o <= b) {
|
|
861
|
+
const C = o === m ? 1 : 0, I = o === b ? 1 : 0;
|
|
862
|
+
this.ctx.paint.drawLine([h + l - 1, d + C, h + l - 1, d + a - I], {
|
|
863
|
+
borderColor: E,
|
|
864
|
+
fillColor: g,
|
|
865
|
+
borderWidth: w,
|
|
783
866
|
lineCap: "round",
|
|
784
867
|
lineJoin: "round",
|
|
785
|
-
lineDash:
|
|
868
|
+
lineDash: x
|
|
786
869
|
});
|
|
787
870
|
}
|
|
788
|
-
if (r >=
|
|
789
|
-
const C = r === y ? 1 : 0, I = r ===
|
|
790
|
-
this.ctx.paint.drawLine([h + I, d +
|
|
791
|
-
borderColor:
|
|
792
|
-
fillColor:
|
|
793
|
-
borderWidth:
|
|
871
|
+
if (r >= p && r <= y && o === b) {
|
|
872
|
+
const C = r === y ? 1 : 0, I = r === p ? 1 : 0;
|
|
873
|
+
this.ctx.paint.drawLine([h + I, d + a - 1, h + l - C, d + a - 1], {
|
|
874
|
+
borderColor: E,
|
|
875
|
+
fillColor: g,
|
|
876
|
+
borderWidth: w,
|
|
794
877
|
lineCap: "round",
|
|
795
878
|
lineJoin: "round",
|
|
796
|
-
lineDash:
|
|
879
|
+
lineDash: x
|
|
797
880
|
});
|
|
798
881
|
}
|
|
799
|
-
if (r ===
|
|
800
|
-
const C = o ===
|
|
801
|
-
this.ctx.paint.drawLine([h + 1, d + I, h + 1, d +
|
|
802
|
-
borderColor:
|
|
803
|
-
fillColor:
|
|
804
|
-
borderWidth:
|
|
882
|
+
if (r === p && o >= m && o <= b) {
|
|
883
|
+
const C = o === b ? 1 : 0, I = o === m ? 1 : 0;
|
|
884
|
+
this.ctx.paint.drawLine([h + 1, d + I, h + 1, d + a - C], {
|
|
885
|
+
borderColor: E,
|
|
886
|
+
fillColor: g,
|
|
887
|
+
borderWidth: w,
|
|
805
888
|
lineCap: "round",
|
|
806
889
|
lineJoin: "round",
|
|
807
|
-
lineDash:
|
|
890
|
+
lineDash: x
|
|
808
891
|
});
|
|
809
892
|
}
|
|
810
893
|
}
|
|
@@ -846,7 +929,7 @@ class de {
|
|
|
846
929
|
// 初始化默认不忽略清空改变值和校验map
|
|
847
930
|
init(t = !0) {
|
|
848
931
|
this.clearBufferData(), this.rowKeyMap.clear(), this.checkboxKeyMap.clear(), this.colIndexKeyMap.clear(), this.rowIndexRowKeyMap.clear(), this.rowKeyRowIndexMap.clear();
|
|
849
|
-
const e = this.getColumns(), i =
|
|
932
|
+
const e = this.getColumns(), i = it(e);
|
|
850
933
|
if (this.ctx.hasSelection = i.some((s) => s.type === "selection"), this.ctx.hasTree = i.some((s) => s.type === "tree"), t) {
|
|
851
934
|
this.originalDataMap.clear(), this.changedDataMap.clear(), this.validationErrorMap.clear();
|
|
852
935
|
const { ROW_KEY: s } = this.ctx.config;
|
|
@@ -866,41 +949,44 @@ class de {
|
|
|
866
949
|
* @param level
|
|
867
950
|
*/
|
|
868
951
|
initData(t, e = 0, i = []) {
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
this.
|
|
873
|
-
|
|
952
|
+
const s = t.length;
|
|
953
|
+
t.forEach((o, r) => {
|
|
954
|
+
var y;
|
|
955
|
+
const { ROW_KEY: a = "", DEFAULT_EXPAND_ALL: l, CELL_HEIGHT: h, SELECTABLE_METHOD: d, CHECKBOX_KEY: f } = this.ctx.config, u = o[a], x = u != null ? `${u}` : Lt();
|
|
956
|
+
this.itemRowKeyMap.set(o, x);
|
|
957
|
+
const w = o._height || h, E = o._readonly;
|
|
874
958
|
let g = !0;
|
|
875
|
-
if (typeof
|
|
876
|
-
const
|
|
877
|
-
if (this.checkboxKeyMap.has(
|
|
878
|
-
const
|
|
879
|
-
|
|
959
|
+
if (typeof d == "function" && (g = d), f) {
|
|
960
|
+
const m = o[f];
|
|
961
|
+
if (this.checkboxKeyMap.has(m)) {
|
|
962
|
+
const b = this.checkboxKeyMap.get(m) || [];
|
|
963
|
+
b.push(x), this.checkboxKeyMap.set(m, b);
|
|
880
964
|
} else
|
|
881
|
-
this.checkboxKeyMap.set(
|
|
965
|
+
this.checkboxKeyMap.set(m, [x]);
|
|
882
966
|
}
|
|
883
967
|
this.selectionMap.set(x, {
|
|
884
|
-
key:
|
|
885
|
-
row:
|
|
886
|
-
check: ((
|
|
968
|
+
key: f ? o[f] : x,
|
|
969
|
+
row: o,
|
|
970
|
+
check: ((y = this.selectionMap.get(x)) == null ? void 0 : y.check) || !1
|
|
887
971
|
});
|
|
888
|
-
const
|
|
889
|
-
this.expandMap.set(x,
|
|
890
|
-
readonly:
|
|
891
|
-
index:
|
|
892
|
-
rowIndex:
|
|
972
|
+
const p = l || this.expandMap.get(x) || o._expand || !1;
|
|
973
|
+
this.expandMap.set(x, p), this.rowKeyMap.set(x, {
|
|
974
|
+
readonly: E,
|
|
975
|
+
index: r,
|
|
976
|
+
rowIndex: r,
|
|
893
977
|
level: e,
|
|
894
|
-
height:
|
|
978
|
+
height: w,
|
|
895
979
|
check: !1,
|
|
896
980
|
selectable: g,
|
|
897
|
-
expand:
|
|
981
|
+
expand: p,
|
|
898
982
|
expandLazy: !1,
|
|
899
|
-
hasChildren:
|
|
983
|
+
hasChildren: o._hasChildren || (Array.isArray(o.children) ? o.children.length > 0 : !1),
|
|
900
984
|
expandLoading: !1,
|
|
901
|
-
item:
|
|
902
|
-
parentRowKeys: i
|
|
903
|
-
|
|
985
|
+
item: o,
|
|
986
|
+
parentRowKeys: i,
|
|
987
|
+
parentRowKey: i[i.length - 1] || "",
|
|
988
|
+
isLastChild: r === s - 1
|
|
989
|
+
}), Array.isArray(o.children) && o.children.length && this.initData(o.children, e + 1, [...i, x]);
|
|
904
990
|
});
|
|
905
991
|
}
|
|
906
992
|
/**
|
|
@@ -962,12 +1048,12 @@ class de {
|
|
|
962
1048
|
const i = (o) => {
|
|
963
1049
|
o.forEach((r) => {
|
|
964
1050
|
t.push(r);
|
|
965
|
-
const
|
|
966
|
-
this.sumHeight += d, this.rowIndexRowKeyMap.set(e,
|
|
1051
|
+
const a = this.itemRowKeyMap.get(r), { expand: l, hasChildren: h, height: d } = this.rowKeyMap.get(a), f = this.sumHeight;
|
|
1052
|
+
this.sumHeight += d, this.rowIndexRowKeyMap.set(e, a), this.rowKeyRowIndexMap.set(a, e), this.positions.push({
|
|
967
1053
|
top: f,
|
|
968
1054
|
height: d,
|
|
969
1055
|
bottom: this.sumHeight
|
|
970
|
-
}), e += 1,
|
|
1056
|
+
}), e += 1, l && h && i(r.children);
|
|
971
1057
|
});
|
|
972
1058
|
};
|
|
973
1059
|
this.rowIndexRowKeyMap.clear(), this.rowKeyRowIndexMap.clear();
|
|
@@ -1104,49 +1190,49 @@ class de {
|
|
|
1104
1190
|
*/
|
|
1105
1191
|
async batchSetItemValue(t, e = !1, i = !0, s = "none") {
|
|
1106
1192
|
let o = [], r = i;
|
|
1107
|
-
const
|
|
1108
|
-
let
|
|
1109
|
-
const { rowKey:
|
|
1110
|
-
let
|
|
1111
|
-
const y = this.getRowDataItemForRowKey(
|
|
1112
|
-
return (
|
|
1113
|
-
...
|
|
1114
|
-
value:
|
|
1193
|
+
const a = /* @__PURE__ */ new Set();
|
|
1194
|
+
let l = [], h = t.map((x) => {
|
|
1195
|
+
const { rowKey: w, key: E } = x;
|
|
1196
|
+
let g = x.value, p = g;
|
|
1197
|
+
const y = this.getRowDataItemForRowKey(w), m = this.getItemValue(w, E), b = this.getVirtualBodyCellByKey(w, E);
|
|
1198
|
+
return (b == null ? void 0 : b.type) === "number" && (["", void 0, null].includes(g) ? p = null : /^-?\d+(\.\d+)?$/.test(`${g}`) ? p = Number(g) : (p = m, l.push({
|
|
1199
|
+
...x,
|
|
1200
|
+
value: p,
|
|
1115
1201
|
oldValue: m,
|
|
1116
1202
|
row: y
|
|
1117
1203
|
}))), {
|
|
1118
|
-
...
|
|
1119
|
-
value:
|
|
1204
|
+
...x,
|
|
1205
|
+
value: p,
|
|
1120
1206
|
oldValue: m,
|
|
1121
1207
|
row: y
|
|
1122
1208
|
};
|
|
1123
1209
|
});
|
|
1124
|
-
if (h = h.filter((
|
|
1125
|
-
const
|
|
1210
|
+
if (h = h.filter((x) => !l.some((w) => x.rowKey === w.rowKey && x.key === w.key)), l.length) {
|
|
1211
|
+
const x = {
|
|
1126
1212
|
code: "ERR_BATCH_SET_NUMBER_VALUE",
|
|
1127
1213
|
message: "Assignment failed, not a numeric type",
|
|
1128
|
-
data:
|
|
1214
|
+
data: l
|
|
1129
1215
|
};
|
|
1130
|
-
this.ctx.emit("error",
|
|
1216
|
+
this.ctx.emit("error", x);
|
|
1131
1217
|
}
|
|
1132
1218
|
if (!h.length)
|
|
1133
1219
|
return;
|
|
1134
1220
|
const { BEFORE_VALUE_CHANGE_METHOD: d } = this.ctx.config;
|
|
1135
|
-
s === "none" && typeof d == "function" && (h = await d(h), r = !1), h.forEach((
|
|
1136
|
-
const { value:
|
|
1137
|
-
|
|
1138
|
-
rowKey:
|
|
1139
|
-
key:
|
|
1140
|
-
oldValue:
|
|
1141
|
-
newValue:
|
|
1221
|
+
s === "none" && typeof d == "function" && (h = await d(h), r = !1), h.forEach((x) => {
|
|
1222
|
+
const { value: w, rowKey: E, key: g } = x, p = this.getItemValue(E, g);
|
|
1223
|
+
a.add(E), this.setItemValue(E, g, w, !1, !1, !1, r), o.push({
|
|
1224
|
+
rowKey: E,
|
|
1225
|
+
key: g,
|
|
1226
|
+
oldValue: p,
|
|
1227
|
+
newValue: w
|
|
1142
1228
|
});
|
|
1143
1229
|
});
|
|
1144
1230
|
let f = [];
|
|
1145
|
-
|
|
1146
|
-
f.push(this.ctx.database.getRowDataItemForRowKey(
|
|
1231
|
+
a.forEach((x) => {
|
|
1232
|
+
f.push(this.ctx.database.getRowDataItemForRowKey(x));
|
|
1147
1233
|
});
|
|
1148
|
-
const
|
|
1149
|
-
Promise.all(
|
|
1234
|
+
const u = h.map(({ rowKey: x, key: w }) => this.getValidator(x, w));
|
|
1235
|
+
Promise.all(u).then(() => {
|
|
1150
1236
|
this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
|
|
1151
1237
|
}), this.ctx.emit("change", h, f), e && this.ctx.history.pushState({
|
|
1152
1238
|
changeList: o,
|
|
@@ -1166,30 +1252,30 @@ class de {
|
|
|
1166
1252
|
* @param checkReadonly 是否检查只读
|
|
1167
1253
|
* @returns
|
|
1168
1254
|
*/
|
|
1169
|
-
async setItemValue(t, e, i, s = !1, o = !1, r = !1,
|
|
1255
|
+
async setItemValue(t, e, i, s = !1, o = !1, r = !1, a = !0) {
|
|
1170
1256
|
if (!this.rowKeyMap.has(t))
|
|
1171
1257
|
return {};
|
|
1172
|
-
const { item:
|
|
1173
|
-
let h =
|
|
1174
|
-
if (
|
|
1258
|
+
const { item: l } = this.rowKeyMap.get(t);
|
|
1259
|
+
let h = l[e], d = i;
|
|
1260
|
+
if (a && this.ctx.database.getReadonly(t, e))
|
|
1175
1261
|
return {
|
|
1176
1262
|
oldValue: h,
|
|
1177
1263
|
newValue: h
|
|
1178
1264
|
};
|
|
1179
|
-
|
|
1265
|
+
l[e] !== null && typeof l[e] == "object" && (h = JSON.parse(JSON.stringify(l[e])));
|
|
1180
1266
|
const f = `${t}_${e}`;
|
|
1181
1267
|
this.originalDataMap.has(f) || this.originalDataMap.set(f, h);
|
|
1182
|
-
const
|
|
1268
|
+
const u = this.originalDataMap.get(f), x = this.getRowDataItemForRowKey(t);
|
|
1183
1269
|
if (r) {
|
|
1184
|
-
const
|
|
1185
|
-
if ((
|
|
1270
|
+
const w = this.getVirtualBodyCellByKey(t, e);
|
|
1271
|
+
if ((w == null ? void 0 : w.type) === "number")
|
|
1186
1272
|
if (["", void 0, null].includes(i))
|
|
1187
1273
|
d = null;
|
|
1188
1274
|
else if (/^-?\d+(\.\d+)?$/.test(`${i}`))
|
|
1189
1275
|
d = Number(i);
|
|
1190
1276
|
else {
|
|
1191
1277
|
d = h;
|
|
1192
|
-
const
|
|
1278
|
+
const g = {
|
|
1193
1279
|
code: "ERR_SET_NUMBER_VALUE",
|
|
1194
1280
|
message: "Assignment failed, not a numeric type",
|
|
1195
1281
|
data: [
|
|
@@ -1198,43 +1284,43 @@ class de {
|
|
|
1198
1284
|
key: e,
|
|
1199
1285
|
value: d,
|
|
1200
1286
|
oldValue: h,
|
|
1201
|
-
row:
|
|
1287
|
+
row: x
|
|
1202
1288
|
}
|
|
1203
1289
|
]
|
|
1204
1290
|
};
|
|
1205
|
-
this.ctx.emit("error",
|
|
1291
|
+
this.ctx.emit("error", g);
|
|
1206
1292
|
}
|
|
1207
1293
|
if (d === h)
|
|
1208
1294
|
return {
|
|
1209
1295
|
oldValue: h,
|
|
1210
1296
|
newValue: h
|
|
1211
1297
|
};
|
|
1212
|
-
let
|
|
1298
|
+
let E = [
|
|
1213
1299
|
{
|
|
1214
1300
|
rowKey: t,
|
|
1215
1301
|
key: e,
|
|
1216
1302
|
value: d,
|
|
1217
1303
|
oldValue: h,
|
|
1218
|
-
row:
|
|
1304
|
+
row: x
|
|
1219
1305
|
}
|
|
1220
1306
|
];
|
|
1221
|
-
this.batchSetItemValue(
|
|
1307
|
+
this.batchSetItemValue(E, s, !1), this.ctx.emit("editChange", {
|
|
1222
1308
|
rowKey: t,
|
|
1223
1309
|
key: e,
|
|
1224
1310
|
oldValue: h,
|
|
1225
1311
|
value: d,
|
|
1226
|
-
originalValue:
|
|
1227
|
-
row:
|
|
1312
|
+
originalValue: u,
|
|
1313
|
+
row: x
|
|
1228
1314
|
});
|
|
1229
1315
|
} else
|
|
1230
|
-
this.changedDataMap.set(f, d),
|
|
1316
|
+
this.changedDataMap.set(f, d), l[e] = d;
|
|
1231
1317
|
return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
|
|
1232
1318
|
rowKey: t,
|
|
1233
1319
|
key: e,
|
|
1234
1320
|
oldValue: h,
|
|
1235
1321
|
value: d,
|
|
1236
1322
|
originalValue: this.originalDataMap.get(f),
|
|
1237
|
-
row:
|
|
1323
|
+
row: x
|
|
1238
1324
|
}), o && this.ctx.emit("draw"), {
|
|
1239
1325
|
oldValue: h,
|
|
1240
1326
|
newValue: d
|
|
@@ -1262,9 +1348,9 @@ class de {
|
|
|
1262
1348
|
if (!this.rowKeyMap.has(t))
|
|
1263
1349
|
return !1;
|
|
1264
1350
|
const { item: s } = this.rowKeyMap.get(t), o = s[i];
|
|
1265
|
-
this.checkboxKeyMap.has(o) && (this.checkboxKeyMap.get(o) || []).forEach((
|
|
1266
|
-
const
|
|
1267
|
-
|
|
1351
|
+
this.checkboxKeyMap.has(o) && (this.checkboxKeyMap.get(o) || []).forEach((a) => {
|
|
1352
|
+
const l = this.selectionMap.get(a);
|
|
1353
|
+
l && (l.check = e);
|
|
1268
1354
|
});
|
|
1269
1355
|
}
|
|
1270
1356
|
}
|
|
@@ -1272,13 +1358,49 @@ class de {
|
|
|
1272
1358
|
* 根据rowKey 取反选中
|
|
1273
1359
|
* @param rowKey
|
|
1274
1360
|
*/
|
|
1275
|
-
toggleRowSelection(t) {
|
|
1276
|
-
const
|
|
1277
|
-
if (!
|
|
1361
|
+
toggleRowSelection(t, e) {
|
|
1362
|
+
const i = this.rowKeyMap.get(t), s = this.selectionMap.get(t);
|
|
1363
|
+
if (!s)
|
|
1364
|
+
return;
|
|
1365
|
+
e === "selection-tree" || e === "tree-selection" ? this.toggleTreeSelection(t) : (s.check = !s.check, this.setRowSelectionByCheckboxKey(t, s.check)), this.ctx.emit("toggleRowSelection", i);
|
|
1366
|
+
const o = this.getSelectionRows();
|
|
1367
|
+
this.ctx.emit("selectionChange", o), this.bufferCheckState.buffer = !1, this.ctx.emit("draw");
|
|
1368
|
+
}
|
|
1369
|
+
// 切换树形选择状态
|
|
1370
|
+
toggleTreeSelection(t) {
|
|
1371
|
+
const e = this.getTreeSelectionState(t), i = this.ctx.config.TREE_SELECT_MODE;
|
|
1372
|
+
if (i === "auto")
|
|
1373
|
+
e.checked && !e.indeterminate ? (this.setRowSelection(t, !1, !1), this.clearTreeSelectionRecursive(t)) : (this.setRowSelection(t, !0, !1), this.selectTreeSelectionRecursive(t));
|
|
1374
|
+
else if (i === "cautious")
|
|
1375
|
+
e.checked && !e.indeterminate ? (this.setRowSelection(t, !1, !1), this.clearTreeSelectionRecursive(t)) : (this.setRowSelection(t, !0, !1), this.selectTreeSelectionRecursive(t));
|
|
1376
|
+
else if (i === "strictly") {
|
|
1377
|
+
const s = this.selectionMap.get(t);
|
|
1378
|
+
s && (s.check = !s.check, this.setRowSelectionByCheckboxKey(t, s.check));
|
|
1379
|
+
}
|
|
1380
|
+
this.ctx.emit("selectionChange", this.getSelectionRows()), this.ctx.emit("draw");
|
|
1381
|
+
}
|
|
1382
|
+
// 递归选中树形选择
|
|
1383
|
+
selectTreeSelectionRecursive(t) {
|
|
1384
|
+
this.getTreeChildren(t).forEach((i) => {
|
|
1385
|
+
this.setRowSelection(i, !0, !1), this.selectTreeSelectionRecursive(i);
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
// 递归取消树形选择
|
|
1389
|
+
clearTreeSelectionRecursive(t) {
|
|
1390
|
+
this.getTreeChildren(t).forEach((i) => {
|
|
1391
|
+
this.setRowSelection(i, !1, !1), this.clearTreeSelectionRecursive(i);
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
// 向上递归更新父项状态
|
|
1395
|
+
updateParentTreeSelection(t) {
|
|
1396
|
+
const e = this.getTreeParent(t);
|
|
1397
|
+
if (!e)
|
|
1278
1398
|
return;
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
this.ctx.
|
|
1399
|
+
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;
|
|
1400
|
+
let a = !1;
|
|
1401
|
+
r > 0 && (o === 0 ? a = !1 : o === r || this.ctx.config.TREE_SELECT_MODE === "auto" ? a = !0 : this.ctx.config.TREE_SELECT_MODE === "cautious" && (a = !1));
|
|
1402
|
+
const l = this.selectionMap.get(e);
|
|
1403
|
+
l && l.check !== a && (l.check = a, this.setRowSelectionByCheckboxKey(e, a), this.updateParentTreeSelection(e));
|
|
1282
1404
|
}
|
|
1283
1405
|
/**
|
|
1284
1406
|
* 根据rowKey 设置选中状态
|
|
@@ -1286,7 +1408,7 @@ class de {
|
|
|
1286
1408
|
*/
|
|
1287
1409
|
setRowSelection(t, e, i = !0) {
|
|
1288
1410
|
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")));
|
|
1411
|
+
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
1412
|
}
|
|
1291
1413
|
getSelectionRows() {
|
|
1292
1414
|
let t = [];
|
|
@@ -1302,6 +1424,66 @@ class de {
|
|
|
1302
1424
|
const e = this.selectionMap.get(t);
|
|
1303
1425
|
return e ? e.check : !1;
|
|
1304
1426
|
}
|
|
1427
|
+
// 获取树形选择状态
|
|
1428
|
+
getTreeSelectionState(t) {
|
|
1429
|
+
if (!this.getRowForRowKey(t))
|
|
1430
|
+
return { checked: !1, indeterminate: !1 };
|
|
1431
|
+
const i = this.selectionMap.get(t), s = (i == null ? void 0 : i.check) || !1;
|
|
1432
|
+
if (this.getTreeChildren(t).length === 0)
|
|
1433
|
+
return { checked: s, indeterminate: !1 };
|
|
1434
|
+
let r = !1, a = s;
|
|
1435
|
+
if (this.ctx.config.TREE_SELECT_MODE === "auto") {
|
|
1436
|
+
const h = (g) => {
|
|
1437
|
+
const p = this.getTreeChildren(g);
|
|
1438
|
+
let y = [];
|
|
1439
|
+
for (const m of p)
|
|
1440
|
+
y.push(m), y.push(...h(m));
|
|
1441
|
+
return y;
|
|
1442
|
+
}, f = h(t).map((g) => this.selectionMap.get(g)), u = f.filter((g) => g == null ? void 0 : g.check).length, x = f.length, w = u > 0;
|
|
1443
|
+
r = w && !(u === x), a = s || w, s && x > 0 && u === 0 && (a = !1, r = !1);
|
|
1444
|
+
} else if (this.ctx.config.TREE_SELECT_MODE === "cautious") {
|
|
1445
|
+
const h = (g) => {
|
|
1446
|
+
const p = this.getTreeChildren(g);
|
|
1447
|
+
let y = [];
|
|
1448
|
+
for (const m of p)
|
|
1449
|
+
y.push(m), y.push(...h(m));
|
|
1450
|
+
return y;
|
|
1451
|
+
}, f = h(t).map((g) => this.selectionMap.get(g)), u = f.filter((g) => g == null ? void 0 : g.check).length, x = f.length, w = u > 0, E = u === x;
|
|
1452
|
+
r = w && !E, a = s || E, s && x > 0 && u === 0 && (a = !1, r = !1);
|
|
1453
|
+
} else this.ctx.config.TREE_SELECT_MODE === "strictly" && (r = !1, a = s);
|
|
1454
|
+
return { checked: a, indeterminate: r };
|
|
1455
|
+
}
|
|
1456
|
+
// 获取树形子节点
|
|
1457
|
+
getTreeChildren(t) {
|
|
1458
|
+
const e = this.getRowForRowKey(t);
|
|
1459
|
+
if (!e || !e.item || !e.item.children)
|
|
1460
|
+
return [];
|
|
1461
|
+
const i = [], s = (o) => {
|
|
1462
|
+
for (const r of o) {
|
|
1463
|
+
const a = this.getRowKeyByItem(r);
|
|
1464
|
+
a && i.push(a), r.children && r.children.length > 0 && s(r.children);
|
|
1465
|
+
}
|
|
1466
|
+
};
|
|
1467
|
+
return s(e.item.children), i;
|
|
1468
|
+
}
|
|
1469
|
+
// 获取树形父节点
|
|
1470
|
+
getTreeParent(t) {
|
|
1471
|
+
const e = (i, s) => {
|
|
1472
|
+
for (const o of i) {
|
|
1473
|
+
const r = this.getRowKeyByItem(o);
|
|
1474
|
+
if (o.children)
|
|
1475
|
+
for (const a of o.children) {
|
|
1476
|
+
if (this.getRowKeyByItem(a) === s)
|
|
1477
|
+
return r;
|
|
1478
|
+
const h = e(o.children, s);
|
|
1479
|
+
if (h)
|
|
1480
|
+
return h;
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
return null;
|
|
1484
|
+
};
|
|
1485
|
+
return e(this.data, t);
|
|
1486
|
+
}
|
|
1305
1487
|
/**
|
|
1306
1488
|
* 根据rowKey 获取选中状态
|
|
1307
1489
|
* @param rowKey
|
|
@@ -1318,32 +1500,45 @@ class de {
|
|
|
1318
1500
|
* @param rowKey
|
|
1319
1501
|
*/
|
|
1320
1502
|
toggleAllSelection() {
|
|
1321
|
-
this.rowKeyMap.forEach((
|
|
1322
|
-
let
|
|
1323
|
-
typeof
|
|
1324
|
-
row:
|
|
1325
|
-
rowIndex:
|
|
1326
|
-
})),
|
|
1503
|
+
this.ctx.config.TREE_SELECT_MODE === "auto" || this.ctx.config.TREE_SELECT_MODE === "cautious" ? this.rowKeyMap.forEach((i, s) => {
|
|
1504
|
+
let o = i.selectable;
|
|
1505
|
+
if (typeof o == "function" && (o = o({
|
|
1506
|
+
row: i.item,
|
|
1507
|
+
rowIndex: i.rowIndex
|
|
1508
|
+
})), o) {
|
|
1509
|
+
const r = this.selectionMap.get(s);
|
|
1510
|
+
r && (r.check = !0, this.setRowSelectionByCheckboxKey(s, !0));
|
|
1511
|
+
}
|
|
1512
|
+
}) : this.rowKeyMap.forEach((i, s) => {
|
|
1513
|
+
let o = i.selectable;
|
|
1514
|
+
typeof o == "function" && (o = o({
|
|
1515
|
+
row: i.item,
|
|
1516
|
+
rowIndex: i.rowIndex
|
|
1517
|
+
})), o && this.setRowSelection(s, !0, !1);
|
|
1327
1518
|
});
|
|
1328
|
-
const
|
|
1329
|
-
this.ctx.emit("toggleAllSelection",
|
|
1519
|
+
const e = this.getSelectionRows();
|
|
1520
|
+
this.ctx.emit("toggleAllSelection", e), this.ctx.emit("selectionChange", e), this.bufferCheckState.buffer = !1, this.ctx.emit("draw");
|
|
1330
1521
|
}
|
|
1331
1522
|
/**
|
|
1332
1523
|
* 清除选中
|
|
1333
1524
|
* @param rowKey
|
|
1334
1525
|
*/
|
|
1335
1526
|
clearSelection(t = !1) {
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
this.
|
|
1527
|
+
const e = this.ctx.config.TREE_SELECT_MODE === "auto" || this.ctx.config.TREE_SELECT_MODE === "cautious";
|
|
1528
|
+
t ? e ? this.rowKeyMap.forEach((s, o) => {
|
|
1529
|
+
const r = this.selectionMap.get(o);
|
|
1530
|
+
r && (r.check = !1, this.setRowSelectionByCheckboxKey(o, !1));
|
|
1531
|
+
}) : this.rowKeyMap.forEach((s, o) => {
|
|
1532
|
+
this.setRowSelection(o, !1, !1);
|
|
1533
|
+
}) : (this.selectionMap.clear(), this.rowKeyMap.forEach((s, o) => {
|
|
1534
|
+
this.selectionMap.set(o, {
|
|
1340
1535
|
check: !1,
|
|
1341
|
-
row:
|
|
1342
|
-
key:
|
|
1536
|
+
row: s.item,
|
|
1537
|
+
key: o
|
|
1343
1538
|
});
|
|
1344
1539
|
}));
|
|
1345
|
-
const
|
|
1346
|
-
this.ctx.emit("clearSelection"), this.ctx.emit("selectionChange",
|
|
1540
|
+
const i = this.getSelectionRows();
|
|
1541
|
+
this.ctx.emit("clearSelection"), this.ctx.emit("selectionChange", i), this.bufferCheckState.buffer = !1, this.ctx.emit("draw");
|
|
1347
1542
|
}
|
|
1348
1543
|
/**
|
|
1349
1544
|
* 获取选中状态,表头用
|
|
@@ -1355,17 +1550,17 @@ class de {
|
|
|
1355
1550
|
return e;
|
|
1356
1551
|
const i = this.rowKeyMap.size;
|
|
1357
1552
|
let s = 0, o = 0;
|
|
1358
|
-
const r = this.selectionMap.size,
|
|
1359
|
-
this.rowKeyMap.forEach((
|
|
1360
|
-
var
|
|
1361
|
-
(
|
|
1362
|
-
let
|
|
1363
|
-
typeof
|
|
1364
|
-
row:
|
|
1365
|
-
rowIndex:
|
|
1366
|
-
})),
|
|
1553
|
+
const r = this.selectionMap.size, a = Array.from(this.selectionMap.values()).some((u) => u.check);
|
|
1554
|
+
this.rowKeyMap.forEach((u, x) => {
|
|
1555
|
+
var E;
|
|
1556
|
+
(E = this.selectionMap.get(x)) != null && E.check && (s += 1);
|
|
1557
|
+
let w = u.selectable;
|
|
1558
|
+
typeof w == "function" && (w = w({
|
|
1559
|
+
row: u.item,
|
|
1560
|
+
rowIndex: u.rowIndex
|
|
1561
|
+
})), w && (o += 1);
|
|
1367
1562
|
});
|
|
1368
|
-
const
|
|
1563
|
+
const l = r > i && s === 0 && a, h = o && o > s && s > 0 || l, d = o !== 0, f = !!o && o === s;
|
|
1369
1564
|
return this.bufferCheckState = {
|
|
1370
1565
|
buffer: !0,
|
|
1371
1566
|
check: f,
|
|
@@ -1464,9 +1659,9 @@ class de {
|
|
|
1464
1659
|
const s = this.rowKeyMap.get(t), o = this.headerMap.get(e);
|
|
1465
1660
|
if (!s || !o)
|
|
1466
1661
|
return !0;
|
|
1467
|
-
const r = s.readonly,
|
|
1468
|
-
if (typeof
|
|
1469
|
-
const d =
|
|
1662
|
+
const r = s.readonly, a = o.readonly, { BODY_CELL_READONLY_METHOD: l } = this.ctx.config;
|
|
1663
|
+
if (typeof l == "function" && o) {
|
|
1664
|
+
const d = l({
|
|
1470
1665
|
row: s.item,
|
|
1471
1666
|
rowIndex: s.rowIndex,
|
|
1472
1667
|
colIndex: o.colIndex,
|
|
@@ -1476,7 +1671,7 @@ class de {
|
|
|
1476
1671
|
if (d !== void 0)
|
|
1477
1672
|
return d;
|
|
1478
1673
|
}
|
|
1479
|
-
return
|
|
1674
|
+
return a || r;
|
|
1480
1675
|
}
|
|
1481
1676
|
clearValidate() {
|
|
1482
1677
|
this.validationErrorMap.clear();
|
|
@@ -1489,30 +1684,30 @@ class de {
|
|
|
1489
1684
|
const s = this.rowKeyMap.get(t), o = this.headerMap.get(e), { BODY_CELL_RULES_METHOD: r } = this.ctx.config;
|
|
1490
1685
|
if (o === void 0)
|
|
1491
1686
|
return i([]);
|
|
1492
|
-
const
|
|
1493
|
-
let
|
|
1687
|
+
const a = o.column;
|
|
1688
|
+
let l = a.rules;
|
|
1494
1689
|
if (typeof r == "function") {
|
|
1495
1690
|
const d = r({
|
|
1496
1691
|
row: s.item,
|
|
1497
1692
|
rowIndex: s.rowIndex,
|
|
1498
1693
|
colIndex: o.colIndex,
|
|
1499
|
-
column:
|
|
1694
|
+
column: a,
|
|
1500
1695
|
value: this.getItemValue(t, e)
|
|
1501
1696
|
});
|
|
1502
|
-
d && (
|
|
1697
|
+
d && (l = d);
|
|
1503
1698
|
}
|
|
1504
|
-
if (
|
|
1699
|
+
if (l) {
|
|
1505
1700
|
const h = {
|
|
1506
1701
|
row: s.item,
|
|
1507
1702
|
rowIndex: s.rowIndex,
|
|
1508
1703
|
colIndex: o.colIndex,
|
|
1509
|
-
column:
|
|
1704
|
+
column: a,
|
|
1510
1705
|
key: e,
|
|
1511
1706
|
rowKey: t,
|
|
1512
1707
|
value: this.getItemValue(t, e),
|
|
1513
1708
|
field: e,
|
|
1514
1709
|
fieldValue: this.getItemValue(t, e)
|
|
1515
|
-
}, f = new se(
|
|
1710
|
+
}, f = new se(l).validate(h);
|
|
1516
1711
|
this.setValidationError(t, e, f), i(f);
|
|
1517
1712
|
} else
|
|
1518
1713
|
this.clearValidationError(t, e), i([]);
|
|
@@ -1533,24 +1728,24 @@ class de {
|
|
|
1533
1728
|
rowKey: s,
|
|
1534
1729
|
row: o,
|
|
1535
1730
|
value: r,
|
|
1536
|
-
colIndex:
|
|
1537
|
-
relationRowKeys:
|
|
1731
|
+
colIndex: a,
|
|
1732
|
+
relationRowKeys: l,
|
|
1538
1733
|
relationColKeys: h,
|
|
1539
1734
|
rowspan: d,
|
|
1540
1735
|
height: f,
|
|
1541
|
-
width:
|
|
1542
|
-
colspan:
|
|
1543
|
-
mergeRow:
|
|
1544
|
-
mergeCol:
|
|
1736
|
+
width: u,
|
|
1737
|
+
colspan: x,
|
|
1738
|
+
mergeRow: w,
|
|
1739
|
+
mergeCol: E
|
|
1545
1740
|
} = t;
|
|
1546
|
-
if (d === 1 &&
|
|
1741
|
+
if (d === 1 && x === 1)
|
|
1547
1742
|
return {
|
|
1548
|
-
xArr: [
|
|
1743
|
+
xArr: [a, a],
|
|
1549
1744
|
yArr: [e, e],
|
|
1550
1745
|
rowspan: d,
|
|
1551
|
-
colspan:
|
|
1746
|
+
colspan: x,
|
|
1552
1747
|
height: f,
|
|
1553
|
-
width:
|
|
1748
|
+
width: u,
|
|
1554
1749
|
offsetTop: 0,
|
|
1555
1750
|
offsetLeft: 0,
|
|
1556
1751
|
dataList: [
|
|
@@ -1562,99 +1757,99 @@ class de {
|
|
|
1562
1757
|
}
|
|
1563
1758
|
]
|
|
1564
1759
|
};
|
|
1565
|
-
let
|
|
1566
|
-
if (d !== 1 &&
|
|
1567
|
-
|
|
1568
|
-
const v =
|
|
1569
|
-
const
|
|
1570
|
-
return `${
|
|
1760
|
+
let g = e, p = e, y = a, m = a, b = [], C = 0, I = 0, _ = 0, T = 0;
|
|
1761
|
+
if (d !== 1 && w) {
|
|
1762
|
+
T = u;
|
|
1763
|
+
const v = l.reduce((R, S) => {
|
|
1764
|
+
const O = this.getItemValue(s, S) ?? "";
|
|
1765
|
+
return `${R}${O}`;
|
|
1571
1766
|
}, "");
|
|
1572
|
-
for (let
|
|
1573
|
-
const
|
|
1574
|
-
const H = this.getItemValue(
|
|
1767
|
+
for (let R = e - 1; R >= 0; R--) {
|
|
1768
|
+
const S = this.rowIndexRowKeyMap.get(R) || "", O = l.reduce((M, L) => {
|
|
1769
|
+
const H = this.getItemValue(S, L) ?? "";
|
|
1575
1770
|
return `${M}${H}`;
|
|
1576
1771
|
}, "");
|
|
1577
|
-
if (v ===
|
|
1578
|
-
|
|
1772
|
+
if (v === O)
|
|
1773
|
+
g = R;
|
|
1579
1774
|
else
|
|
1580
1775
|
break;
|
|
1581
1776
|
}
|
|
1582
|
-
for (let
|
|
1583
|
-
const
|
|
1584
|
-
const H = this.getItemValue(
|
|
1777
|
+
for (let R = e; R <= this.ctx.maxRowIndex; R++) {
|
|
1778
|
+
const S = this.rowIndexRowKeyMap.get(R) || "", O = l.reduce((M, L) => {
|
|
1779
|
+
const H = this.getItemValue(S, L) ?? "";
|
|
1585
1780
|
return `${M}${H}`;
|
|
1586
1781
|
}, "");
|
|
1587
|
-
if (v ===
|
|
1588
|
-
|
|
1782
|
+
if (v === O)
|
|
1783
|
+
p = R;
|
|
1589
1784
|
else
|
|
1590
1785
|
break;
|
|
1591
1786
|
}
|
|
1592
|
-
for (let
|
|
1593
|
-
const { height:
|
|
1594
|
-
C +=
|
|
1787
|
+
for (let R = g; R < e; R++) {
|
|
1788
|
+
const { height: S } = this.positions[R];
|
|
1789
|
+
C += S;
|
|
1595
1790
|
}
|
|
1596
|
-
for (let
|
|
1597
|
-
const { height:
|
|
1598
|
-
_ +=
|
|
1599
|
-
const
|
|
1600
|
-
|
|
1601
|
-
rowKey:
|
|
1791
|
+
for (let R = g; R <= p; R++) {
|
|
1792
|
+
const { height: S } = this.positions[R];
|
|
1793
|
+
_ += S;
|
|
1794
|
+
const O = this.rowIndexRowKeyMap.get(R) || "", { item: M } = this.rowKeyMap.get(O), L = this.getItemValue(O, i);
|
|
1795
|
+
b.push({
|
|
1796
|
+
rowKey: O,
|
|
1602
1797
|
key: i,
|
|
1603
|
-
value:
|
|
1798
|
+
value: L,
|
|
1604
1799
|
row: M
|
|
1605
1800
|
});
|
|
1606
1801
|
}
|
|
1607
1802
|
}
|
|
1608
|
-
if (
|
|
1803
|
+
if (x !== 1 && E) {
|
|
1609
1804
|
_ = f;
|
|
1610
|
-
for (let v =
|
|
1611
|
-
const
|
|
1612
|
-
if (!
|
|
1805
|
+
for (let v = a - 1; v >= 0; v--) {
|
|
1806
|
+
const R = this.getColumnByColIndex(v);
|
|
1807
|
+
if (!R)
|
|
1613
1808
|
break;
|
|
1614
|
-
const
|
|
1615
|
-
if (
|
|
1809
|
+
const S = this.getItemValue(s, i), O = this.getItemValue(s, R.key);
|
|
1810
|
+
if (S === O && h.includes(R.key))
|
|
1616
1811
|
y = v;
|
|
1617
1812
|
else
|
|
1618
1813
|
break;
|
|
1619
1814
|
}
|
|
1620
|
-
for (let v =
|
|
1621
|
-
const
|
|
1622
|
-
if (!
|
|
1815
|
+
for (let v = a; v <= this.ctx.maxColIndex; v++) {
|
|
1816
|
+
const R = this.getColumnByColIndex(v);
|
|
1817
|
+
if (!R)
|
|
1623
1818
|
break;
|
|
1624
|
-
const
|
|
1625
|
-
if (
|
|
1819
|
+
const S = this.getItemValue(s, i), O = this.getItemValue(s, R.key);
|
|
1820
|
+
if (S === O && h.includes(R.key))
|
|
1626
1821
|
m = v;
|
|
1627
1822
|
else
|
|
1628
1823
|
break;
|
|
1629
1824
|
}
|
|
1630
|
-
for (let v = y; v <
|
|
1631
|
-
const
|
|
1632
|
-
if (!
|
|
1825
|
+
for (let v = y; v < a; v++) {
|
|
1826
|
+
const R = this.getColumnByColIndex(v);
|
|
1827
|
+
if (!R)
|
|
1633
1828
|
break;
|
|
1634
|
-
I +=
|
|
1829
|
+
I += R.width || 100;
|
|
1635
1830
|
}
|
|
1636
1831
|
for (let v = y; v <= m; v++) {
|
|
1637
|
-
const
|
|
1638
|
-
if (!
|
|
1832
|
+
const R = this.getColumnByColIndex(v);
|
|
1833
|
+
if (!R)
|
|
1639
1834
|
break;
|
|
1640
|
-
|
|
1835
|
+
T += R.width || 100, b.push({
|
|
1641
1836
|
rowKey: s,
|
|
1642
|
-
key:
|
|
1643
|
-
value: this.getItemValue(s,
|
|
1837
|
+
key: R.key,
|
|
1838
|
+
value: this.getItemValue(s, R.key),
|
|
1644
1839
|
row: o
|
|
1645
1840
|
});
|
|
1646
1841
|
}
|
|
1647
1842
|
}
|
|
1648
1843
|
return {
|
|
1649
1844
|
xArr: [y, m],
|
|
1650
|
-
yArr: [
|
|
1845
|
+
yArr: [g, p],
|
|
1651
1846
|
rowspan: d,
|
|
1652
|
-
colspan:
|
|
1847
|
+
colspan: x,
|
|
1653
1848
|
height: _,
|
|
1654
|
-
width:
|
|
1849
|
+
width: T,
|
|
1655
1850
|
offsetTop: C,
|
|
1656
1851
|
offsetLeft: I,
|
|
1657
|
-
dataList:
|
|
1852
|
+
dataList: b
|
|
1658
1853
|
};
|
|
1659
1854
|
}
|
|
1660
1855
|
setLoading(t) {
|
|
@@ -1664,21 +1859,21 @@ class de {
|
|
|
1664
1859
|
return this.loading;
|
|
1665
1860
|
}
|
|
1666
1861
|
setValidationErrorByRowIndex(t, e, i) {
|
|
1667
|
-
const s = this.rowIndexRowKeyMap.get(t), o = `${s}_${e}`, r = this.getRowForRowIndex(t),
|
|
1668
|
-
if (!s || !
|
|
1862
|
+
const s = this.rowIndexRowKeyMap.get(t), o = `${s}_${e}`, r = this.getRowForRowIndex(t), a = this.getColumnByKey(e);
|
|
1863
|
+
if (!s || !a || !r)
|
|
1669
1864
|
return;
|
|
1670
|
-
const
|
|
1865
|
+
const l = this.getItemValue(s, e), h = [
|
|
1671
1866
|
{
|
|
1672
1867
|
key: e,
|
|
1673
1868
|
rowKey: s,
|
|
1674
1869
|
rowIndex: t,
|
|
1675
|
-
colIndex:
|
|
1676
|
-
column:
|
|
1870
|
+
colIndex: a.colIndex,
|
|
1871
|
+
column: a.column,
|
|
1677
1872
|
row: r,
|
|
1678
|
-
value:
|
|
1873
|
+
value: l,
|
|
1679
1874
|
message: i,
|
|
1680
1875
|
field: e,
|
|
1681
|
-
fieldValue:
|
|
1876
|
+
fieldValue: l
|
|
1682
1877
|
}
|
|
1683
1878
|
];
|
|
1684
1879
|
this.validationErrorMap.set(o, h);
|
|
@@ -1698,7 +1893,7 @@ class de {
|
|
|
1698
1893
|
// 获取虚拟单元格,只针对可见的
|
|
1699
1894
|
getVirtualBodyCell(t, e) {
|
|
1700
1895
|
const i = this.getColumnByColIndex(e), s = this.getRowForRowIndex(t);
|
|
1701
|
-
return !i || !s ? void 0 : new
|
|
1896
|
+
return !i || !s ? void 0 : new $(this.ctx, t, e, 0, 0, 0, 0, i, s.item, "body");
|
|
1702
1897
|
}
|
|
1703
1898
|
getVirtualBodyCellByKey(t, e) {
|
|
1704
1899
|
const i = this.getRowIndexForRowKey(t), s = this.getColIndexForKey(e);
|
|
@@ -1717,6 +1912,21 @@ class de {
|
|
|
1717
1912
|
}
|
|
1718
1913
|
return i;
|
|
1719
1914
|
}
|
|
1915
|
+
/**
|
|
1916
|
+
* 计算树形数据的最大深度
|
|
1917
|
+
* @param data 树形数据
|
|
1918
|
+
* @param currentDepth 当前深度
|
|
1919
|
+
* @returns 最大深度
|
|
1920
|
+
*/
|
|
1921
|
+
calculateMaxTreeDepth(t, e = 0) {
|
|
1922
|
+
let i = e;
|
|
1923
|
+
return t.forEach((s) => {
|
|
1924
|
+
if (Array.isArray(s.children) && s.children.length > 0) {
|
|
1925
|
+
const o = this.calculateMaxTreeDepth(s.children, e + 1);
|
|
1926
|
+
i = Math.max(i, o);
|
|
1927
|
+
}
|
|
1928
|
+
}), i;
|
|
1929
|
+
}
|
|
1720
1930
|
}
|
|
1721
1931
|
class fe {
|
|
1722
1932
|
constructor(t) {
|
|
@@ -1923,21 +2133,21 @@ class ge {
|
|
|
1923
2133
|
* @param {string} color - 阴影的颜色
|
|
1924
2134
|
*/
|
|
1925
2135
|
drawShadow(t, e, i, s, o) {
|
|
1926
|
-
const { fillColor: r, side:
|
|
2136
|
+
const { fillColor: r, side: a, shadowWidth: l, colorStart: h, colorEnd: d } = o;
|
|
1927
2137
|
this.ctx.save(), r && (this.ctx.fillStyle = r, this.ctx.fillRect(t, e, i, s));
|
|
1928
2138
|
let f;
|
|
1929
|
-
switch (
|
|
2139
|
+
switch (a) {
|
|
1930
2140
|
case "left":
|
|
1931
|
-
f = this.ctx.createLinearGradient(t -
|
|
2141
|
+
f = this.ctx.createLinearGradient(t - l, e, t, e), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t - l, e, l, s);
|
|
1932
2142
|
break;
|
|
1933
2143
|
case "right":
|
|
1934
|
-
f = this.ctx.createLinearGradient(t + i, e, t + i +
|
|
2144
|
+
f = this.ctx.createLinearGradient(t + i, e, t + i + l, e), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t + i, e, l, s);
|
|
1935
2145
|
break;
|
|
1936
2146
|
case "top":
|
|
1937
|
-
f = this.ctx.createLinearGradient(t, e -
|
|
2147
|
+
f = this.ctx.createLinearGradient(t, e - l, t, e), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t, e - l, i, l);
|
|
1938
2148
|
break;
|
|
1939
2149
|
case "bottom":
|
|
1940
|
-
f = this.ctx.createLinearGradient(t, e + s, t, e + s +
|
|
2150
|
+
f = this.ctx.createLinearGradient(t, e + s, t, e + s + l), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t, e + s, i, l);
|
|
1941
2151
|
break;
|
|
1942
2152
|
default:
|
|
1943
2153
|
console.error("Invalid side specified for shadow");
|
|
@@ -1953,19 +2163,19 @@ class ge {
|
|
|
1953
2163
|
this.ctx.beginPath(), this.ctx.moveTo(t[0] - 0.5, t[1] - 0.5);
|
|
1954
2164
|
for (let o = 2; o < t.length; o += 2)
|
|
1955
2165
|
this.ctx.lineTo(t[o] - 0.5, t[o + 1] - 0.5);
|
|
1956
|
-
this.ctx.strokeStyle = i, this.ctx.lineWidth = s, e.lineDash && (this.ctx.lineDashOffset =
|
|
2166
|
+
this.ctx.strokeStyle = i, this.ctx.lineWidth = s, e.lineDash && (this.ctx.lineDashOffset = e.lineDashOffset ?? 0, this.ctx.setLineDash(e.lineDash)), e.fillColor && (this.ctx.fillStyle = e.fillColor, this.ctx.fill()), e.borderColor && (this.ctx.strokeStyle = e.borderColor), this.ctx.stroke(), this.ctx.closePath(), this.ctx.restore();
|
|
1957
2167
|
}
|
|
1958
2168
|
drawImage(t, e, i, s, o) {
|
|
1959
2169
|
this.ctx.save(), this.ctx.drawImage(t, e, i, s, o), this.ctx.restore();
|
|
1960
2170
|
}
|
|
1961
|
-
drawRect(t, e, i, s, { borderWidth: o = 1, borderColor: r, fillColor:
|
|
1962
|
-
if (this.ctx.save(), this.ctx.beginPath(),
|
|
2171
|
+
drawRect(t, e, i, s, { borderWidth: o = 1, borderColor: r, fillColor: a, radius: l = 0 } = {}) {
|
|
2172
|
+
if (this.ctx.save(), this.ctx.beginPath(), a !== void 0 && (this.ctx.fillStyle = a), r !== void 0 && (this.ctx.lineWidth = o, this.ctx.strokeStyle = r), l === 0)
|
|
1963
2173
|
this.ctx.rect(t - 0.5, e - 0.5, i, s);
|
|
1964
2174
|
else {
|
|
1965
|
-
const [h, d, f,
|
|
1966
|
-
this.ctx.moveTo(t + h, e), this.ctx.arcTo(t + i, e, t + i, e + d, d), this.ctx.arcTo(t + i, e + s, t + i - f, e + s, f), this.ctx.arcTo(t, e + s, t, e + s -
|
|
2175
|
+
const [h, d, f, u] = typeof l == "number" ? [l, l, l, l] : l;
|
|
2176
|
+
this.ctx.moveTo(t + h, e), this.ctx.arcTo(t + i, e, t + i, e + d, d), this.ctx.arcTo(t + i, e + s, t + i - f, e + s, f), this.ctx.arcTo(t, e + s, t, e + s - u, u), this.ctx.arcTo(t, e, t + h, e, h);
|
|
1967
2177
|
}
|
|
1968
|
-
|
|
2178
|
+
a !== void 0 && this.ctx.fill(), r !== void 0 && this.ctx.stroke(), this.ctx.restore();
|
|
1969
2179
|
}
|
|
1970
2180
|
/**
|
|
1971
2181
|
* 画文本
|
|
@@ -1980,19 +2190,19 @@ class ge {
|
|
|
1980
2190
|
drawText(t = "", e, i, s, o, r = {}) {
|
|
1981
2191
|
this.ctx.save();
|
|
1982
2192
|
const {
|
|
1983
|
-
font:
|
|
1984
|
-
align:
|
|
2193
|
+
font: a = "12px Arial",
|
|
2194
|
+
align: l = "center",
|
|
1985
2195
|
color: h = "#495060",
|
|
1986
2196
|
padding: d = 0,
|
|
1987
2197
|
verticalAlign: f = "middle"
|
|
1988
2198
|
} = r;
|
|
1989
|
-
this.ctx.font =
|
|
1990
|
-
let x = 0;
|
|
1991
|
-
f === "top" ? x = i + d : f === "bottom" ? x = i + o - d : x = i + (o + 1) / 2;
|
|
2199
|
+
this.ctx.font = a, this.ctx.fillStyle = h, this.ctx.textBaseline = f, this.ctx.textAlign = l;
|
|
1992
2200
|
let u = 0;
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
2201
|
+
f === "top" ? u = i + d : f === "bottom" ? u = i + o - d : u = i + (o + 1) / 2;
|
|
2202
|
+
let x = 0;
|
|
2203
|
+
l === "left" ? x = e + d : l === "right" ? x = e + s - d : x = e + s / 2;
|
|
2204
|
+
const { _text: w, ellipsis: E } = this.handleEllipsis(t, s, d, a);
|
|
2205
|
+
return this.ctx.fillText(w, x, u), this.ctx.restore(), E;
|
|
1996
2206
|
}
|
|
1997
2207
|
handleEllipsis(t, e, i = 0, s = "12px Arial") {
|
|
1998
2208
|
let o = !1, r = t;
|
|
@@ -2001,12 +2211,18 @@ class ge {
|
|
|
2001
2211
|
_text: "",
|
|
2002
2212
|
ellipsis: o
|
|
2003
2213
|
};
|
|
2004
|
-
const
|
|
2005
|
-
if (
|
|
2214
|
+
const a = this.ctx.measureText("...").width;
|
|
2215
|
+
if (e <= a + i * 2)
|
|
2216
|
+
return {
|
|
2217
|
+
_text: "",
|
|
2218
|
+
ellipsis: !0
|
|
2219
|
+
};
|
|
2220
|
+
const l = this.ctx.measureText(t).width;
|
|
2221
|
+
if (l && l + a >= e - i * 2) {
|
|
2006
2222
|
o = !0;
|
|
2007
2223
|
let h = 0;
|
|
2008
2224
|
for (let d = 0; d < t.length; d++)
|
|
2009
|
-
if (h += this.ctx.measureText(t[d]).width, h >= e - i * 2 -
|
|
2225
|
+
if (h += this.ctx.measureText(t[d]).width, h >= e - i * 2 - a) {
|
|
2010
2226
|
r = t.slice(0, d) + "...";
|
|
2011
2227
|
break;
|
|
2012
2228
|
}
|
|
@@ -2017,7 +2233,7 @@ class ge {
|
|
|
2017
2233
|
};
|
|
2018
2234
|
}
|
|
2019
2235
|
}
|
|
2020
|
-
class
|
|
2236
|
+
class Ct {
|
|
2021
2237
|
constructor(t) {
|
|
2022
2238
|
n(this, "_config", {});
|
|
2023
2239
|
/** CSS 类名前缀 */
|
|
@@ -2058,8 +2274,11 @@ class yt {
|
|
|
2058
2274
|
n(this, "MAX_HEIGHT", 1e3);
|
|
2059
2275
|
/** 区域边框圆角 */
|
|
2060
2276
|
n(this, "BORDER_RADIUS", 8);
|
|
2277
|
+
/** 启用偏移高度内部计算表格高度 */
|
|
2061
2278
|
n(this, "ENABLE_OFFSET_HEIGHT", !1);
|
|
2279
|
+
/** 偏移高度 */
|
|
2062
2280
|
n(this, "OFFSET_HEIGHT", 0);
|
|
2281
|
+
/** 表头高度 */
|
|
2063
2282
|
n(this, "HEADER_HEIGHT", 36);
|
|
2064
2283
|
/** 启用头部固定,需要外面实现覆盖层,或者所有表头都要是元素 */
|
|
2065
2284
|
n(this, "ENABLE_HEADER_STICKY", !1);
|
|
@@ -2088,6 +2307,10 @@ class yt {
|
|
|
2088
2307
|
n(this, "ERROR_TIP_ICON_COLOR", "red");
|
|
2089
2308
|
/** 错误提示图标大小 */
|
|
2090
2309
|
n(this, "ERROR_TIP_ICON_SIZE", 6);
|
|
2310
|
+
/** 所有列对齐方式 */
|
|
2311
|
+
n(this, "COLUMNS_ALIGN", "left");
|
|
2312
|
+
/** 所有列垂直对齐方式 */
|
|
2313
|
+
n(this, "COLUMNS_VERTICAL_ALIGN", "middle");
|
|
2091
2314
|
/** 是否开启懒加载 */
|
|
2092
2315
|
n(this, "EXPAND_LAZY", !0);
|
|
2093
2316
|
/** 默认展开全部 */
|
|
@@ -2154,6 +2377,16 @@ class yt {
|
|
|
2154
2377
|
n(this, "CELL_FOOTER_HEIGHT", 36);
|
|
2155
2378
|
/** 启用选择器 */
|
|
2156
2379
|
n(this, "ENABLE_SELECTOR", !0);
|
|
2380
|
+
/** 树形选择模式 */
|
|
2381
|
+
n(this, "TREE_SELECT_MODE", "auto");
|
|
2382
|
+
/** 树形缩进宽度 */
|
|
2383
|
+
n(this, "TREE_INDENT", 20);
|
|
2384
|
+
/** 树形图标大小 */
|
|
2385
|
+
n(this, "TREE_ICON_SIZE", 20);
|
|
2386
|
+
/**树形划线 */
|
|
2387
|
+
n(this, "TREE_LINE", !1);
|
|
2388
|
+
/** 树形划线颜色 */
|
|
2389
|
+
n(this, "TREE_LINE_COLOR", "#e1e6eb");
|
|
2157
2390
|
/** 启用单点击立马编辑 */
|
|
2158
2391
|
n(this, "ENABLE_EDIT_SINGLE_CLICK", !1);
|
|
2159
2392
|
/** 启用点击选择器编辑 */
|
|
@@ -2287,12 +2520,12 @@ class yt {
|
|
|
2287
2520
|
Object.keys(this).forEach((e) => {
|
|
2288
2521
|
if (e.endsWith("_COLOR") || e.endsWith("_FONT")) {
|
|
2289
2522
|
const i = `--evt-${e.toLocaleLowerCase().replace(/_/g, "-")}`, s = ce(i);
|
|
2290
|
-
t[e] = s;
|
|
2523
|
+
s && (t[e] = s);
|
|
2291
2524
|
}
|
|
2292
2525
|
}), Object.assign(this, t, this._config);
|
|
2293
2526
|
}
|
|
2294
2527
|
}
|
|
2295
|
-
const
|
|
2528
|
+
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
2529
|
class we {
|
|
2297
2530
|
constructor(t) {
|
|
2298
2531
|
n(this, "ctx");
|
|
@@ -2315,7 +2548,7 @@ class we {
|
|
|
2315
2548
|
name: "shrink",
|
|
2316
2549
|
configName: "CHECKBOX_UNCHECK_SVG",
|
|
2317
2550
|
configColorName: "SHRINK_ICON_COLOR",
|
|
2318
|
-
svg:
|
|
2551
|
+
svg: bt,
|
|
2319
2552
|
color: "#4E5969"
|
|
2320
2553
|
},
|
|
2321
2554
|
{
|
|
@@ -2367,7 +2600,7 @@ class we {
|
|
|
2367
2600
|
name: "icon-select",
|
|
2368
2601
|
configName: "CHECKBOX_UNCHECK_SVG",
|
|
2369
2602
|
configColorName: "SHRINK_ICON_COLOR",
|
|
2370
|
-
svg:
|
|
2603
|
+
svg: bt,
|
|
2371
2604
|
color: "#4E5969"
|
|
2372
2605
|
}
|
|
2373
2606
|
]);
|
|
@@ -2380,15 +2613,15 @@ class we {
|
|
|
2380
2613
|
const i = this.list[e];
|
|
2381
2614
|
let s = i.color, o = i.svg;
|
|
2382
2615
|
if (i.configColorName) {
|
|
2383
|
-
const
|
|
2384
|
-
|
|
2616
|
+
const a = this.ctx.config[i.configColorName];
|
|
2617
|
+
a && (s = a);
|
|
2385
2618
|
}
|
|
2386
2619
|
if (i.configName) {
|
|
2387
|
-
const
|
|
2388
|
-
|
|
2620
|
+
const a = this.ctx.config[i.configName];
|
|
2621
|
+
a && (o = a);
|
|
2389
2622
|
}
|
|
2390
|
-
const r = this.createImageFromSVG(o, s).then((
|
|
2391
|
-
this.icons.set(i.name,
|
|
2623
|
+
const r = this.createImageFromSVG(o, s).then((a) => {
|
|
2624
|
+
this.icons.set(i.name, a);
|
|
2392
2625
|
});
|
|
2393
2626
|
t.push(r);
|
|
2394
2627
|
}
|
|
@@ -2407,18 +2640,18 @@ class we {
|
|
|
2407
2640
|
e && r.querySelectorAll("*").forEach((h) => {
|
|
2408
2641
|
h.setAttribute("fill", e);
|
|
2409
2642
|
});
|
|
2410
|
-
const
|
|
2411
|
-
let
|
|
2643
|
+
const a = new Image();
|
|
2644
|
+
let l = "";
|
|
2412
2645
|
if (i) {
|
|
2413
2646
|
const h = new Blob([new XMLSerializer().serializeToString(r)], {
|
|
2414
2647
|
type: "image/svg+xml"
|
|
2415
2648
|
});
|
|
2416
|
-
|
|
2649
|
+
l = URL.createObjectURL(h);
|
|
2417
2650
|
} else
|
|
2418
|
-
|
|
2419
|
-
return
|
|
2420
|
-
|
|
2421
|
-
h(
|
|
2651
|
+
l = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(r));
|
|
2652
|
+
return a.src = l, new Promise((h, d) => {
|
|
2653
|
+
a.onerror = () => d(new Error("Failed to load image")), a.onload = () => {
|
|
2654
|
+
h(a);
|
|
2422
2655
|
};
|
|
2423
2656
|
});
|
|
2424
2657
|
}
|
|
@@ -2426,10 +2659,11 @@ class we {
|
|
|
2426
2659
|
return this.icons.get(t);
|
|
2427
2660
|
}
|
|
2428
2661
|
}
|
|
2429
|
-
class
|
|
2430
|
-
constructor(e, i, s, o, r,
|
|
2431
|
-
super(e, s, o, r,
|
|
2662
|
+
class ct extends Xt {
|
|
2663
|
+
constructor(e, i, s, o, r, a, l) {
|
|
2664
|
+
super(e, s, o, r, a, "header", l.fixed);
|
|
2432
2665
|
n(this, "align");
|
|
2666
|
+
n(this, "hideHeaderSelection", !1);
|
|
2433
2667
|
n(this, "verticalAlign", "middle");
|
|
2434
2668
|
n(this, "fixed");
|
|
2435
2669
|
n(this, "minWidth");
|
|
@@ -2461,15 +2695,19 @@ class Xt extends kt {
|
|
|
2461
2695
|
n(this, "drawY", 0);
|
|
2462
2696
|
n(this, "visibleWidth", 0);
|
|
2463
2697
|
n(this, "visibleHeight", 0);
|
|
2698
|
+
n(this, "drawTextX", 0);
|
|
2699
|
+
n(this, "drawTextY", 0);
|
|
2700
|
+
n(this, "drawTextWidth", 0);
|
|
2701
|
+
n(this, "drawTextHeight", 0);
|
|
2464
2702
|
n(this, "drawCellBgColor", "");
|
|
2465
2703
|
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 =
|
|
2704
|
+
n(this, "drawSelectionImageX", 0);
|
|
2705
|
+
n(this, "drawSelectionImageY", 0);
|
|
2706
|
+
n(this, "drawSelectionImageWidth", 0);
|
|
2707
|
+
n(this, "drawSelectionImageHeight", 0);
|
|
2708
|
+
n(this, "drawSelectionImageName", "");
|
|
2709
|
+
n(this, "drawSelectionImageSource");
|
|
2710
|
+
this.ctx = e, this.x = s, this.y = o, this.width = r, this.height = a, this.visibleWidth = r, this.visibleHeight = a, this.colIndex = i, this.key = l.key, this.minWidth = l.minWidth, this.maxWidth = l.maxWidth, this.type = l.type || "", this.editorType = l.editorType || "text", this.hideHeaderSelection = l.hideHeaderSelection || !1, this.align = l.headerAlign || l.align || this.ctx.config.COLUMNS_ALIGN, this.verticalAlign = l.headerVerticalAlign || l.verticalAlign || this.ctx.config.COLUMNS_VERTICAL_ALIGN, this.fixed = l.fixed, this.level = l.level || 0, this.operation = l.operation || !1, this.text = l.title, this.column = l, this.colspan = l.colspan || 1, this.widthFillDisable = l.widthFillDisable || !1, this.rowspan = l.rowspan || 1, this.rules = l.rules, this.readonly = l.readonly || !1, this.required = l.required || !1, this.rowKey = Lt(), this.overflowTooltipShow = l.overflowTooltipHeaderShow !== !1, this.hasChildren = l.children && l.children.length > 0 || !1, this.render = l.renderHeader;
|
|
2473
2711
|
}
|
|
2474
2712
|
/**
|
|
2475
2713
|
* 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
|
|
@@ -2489,32 +2727,46 @@ class Xt extends kt {
|
|
|
2489
2727
|
const { HEADER_CELL_STYLE_METHOD: e, HEADER_BG_COLOR: i, HEADER_TEXT_COLOR: s } = this.ctx.config;
|
|
2490
2728
|
let o = i, r = s;
|
|
2491
2729
|
if (typeof e == "function") {
|
|
2492
|
-
const
|
|
2730
|
+
const a = e, { backgroundColor: l, color: h } = a({
|
|
2493
2731
|
colIndex: this.colIndex,
|
|
2494
2732
|
column: this.column
|
|
2495
2733
|
}) || {};
|
|
2496
|
-
|
|
2734
|
+
l && (o = l), h && (r = h);
|
|
2497
2735
|
}
|
|
2498
2736
|
this.drawCellBgColor = o, this.drawTextColor = r;
|
|
2499
2737
|
}
|
|
2500
2738
|
update() {
|
|
2501
|
-
this.updateContainer(), this.displayText = this.getText(), this.drawX = this.getDrawX(), this.drawY = this.getDrawY(), this.updateStyle();
|
|
2739
|
+
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
2740
|
}
|
|
2503
2741
|
draw() {
|
|
2504
2742
|
const {
|
|
2505
2743
|
paint: e,
|
|
2506
|
-
config: { BORDER_COLOR: i,
|
|
2507
|
-
} = this.ctx, { drawX:
|
|
2508
|
-
e.drawRect(
|
|
2509
|
-
borderColor:
|
|
2744
|
+
config: { BORDER_COLOR: i, BORDER: s }
|
|
2745
|
+
} = this.ctx, { drawX: o, drawY: r } = this;
|
|
2746
|
+
e.drawRect(o, r, this.width, this.height, {
|
|
2747
|
+
borderColor: s ? i : "transparent",
|
|
2510
2748
|
fillColor: this.drawCellBgColor
|
|
2511
|
-
}), this.
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
}
|
|
2749
|
+
}), this.drawSelection(), this.drawText(), this.drawSelector();
|
|
2750
|
+
}
|
|
2751
|
+
drawText() {
|
|
2752
|
+
const {
|
|
2753
|
+
paint: e,
|
|
2754
|
+
config: { HEADER_FONT: i, CELL_PADDING: s }
|
|
2755
|
+
} = this.ctx;
|
|
2756
|
+
this.ellipsis = e.drawText(
|
|
2757
|
+
this.displayText,
|
|
2758
|
+
this.drawTextX,
|
|
2759
|
+
this.drawTextY,
|
|
2760
|
+
this.drawTextWidth,
|
|
2761
|
+
this.drawTextHeight,
|
|
2762
|
+
{
|
|
2763
|
+
font: i,
|
|
2764
|
+
padding: s,
|
|
2765
|
+
color: this.drawTextColor,
|
|
2766
|
+
align: this.align,
|
|
2767
|
+
verticalAlign: this.verticalAlign
|
|
2768
|
+
}
|
|
2769
|
+
);
|
|
2518
2770
|
}
|
|
2519
2771
|
drawSelector() {
|
|
2520
2772
|
const { ENABLE_SELECTOR: e } = this.ctx.config;
|
|
@@ -2527,16 +2779,20 @@ class Xt extends kt {
|
|
|
2527
2779
|
});
|
|
2528
2780
|
}
|
|
2529
2781
|
drawSelection() {
|
|
2782
|
+
if (this.hideHeaderSelection)
|
|
2783
|
+
return;
|
|
2530
2784
|
const { width: e, height: i, type: s } = this;
|
|
2531
|
-
if (["index-selection", "selection"].includes(s)) {
|
|
2532
|
-
const { indeterminate: o, check: r, selectable:
|
|
2533
|
-
let
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
this.
|
|
2538
|
-
this.
|
|
2539
|
-
this.
|
|
2785
|
+
if (["index-selection", "selection", "selection-tree", "tree-selection"].includes(s)) {
|
|
2786
|
+
const { indeterminate: o, check: r, selectable: a } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: l = 0, CELL_PADDING: h } = this.ctx.config;
|
|
2787
|
+
let d = this.drawX + (e - l) / 2, f = this.drawY + (i - l) / 2;
|
|
2788
|
+
this.drawTextX = d + l - h / 2, this.drawTextWidth = this.drawX + this.visibleWidth - this.drawTextX, (this.align === "left" || this.align === "right") && (d = this.drawX + h, this.drawTextX = d + l - 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 - l - h / 2);
|
|
2789
|
+
let u = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck";
|
|
2790
|
+
o ? (u = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : r && a ? (u = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : r && a ? (u = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !r && a ? (u = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck") : (u = this.ctx.icons.get("checkbox-disabled"), x = "checkbox-disabled"), u && (this.drawSelectionImageX = d, this.drawSelectionImageY = f, this.drawSelectionImageWidth = l, this.drawSelectionImageHeight = l, this.drawSelectionImageName = x, this.drawSelectionImageSource = u, this.ctx.paint.drawImage(
|
|
2791
|
+
this.drawSelectionImageSource,
|
|
2792
|
+
this.drawSelectionImageX,
|
|
2793
|
+
this.drawSelectionImageY,
|
|
2794
|
+
this.drawSelectionImageWidth,
|
|
2795
|
+
this.drawSelectionImageHeight
|
|
2540
2796
|
));
|
|
2541
2797
|
}
|
|
2542
2798
|
}
|
|
@@ -2560,7 +2816,7 @@ class Xt extends kt {
|
|
|
2560
2816
|
};
|
|
2561
2817
|
}
|
|
2562
2818
|
}
|
|
2563
|
-
class
|
|
2819
|
+
class Ee {
|
|
2564
2820
|
constructor(t) {
|
|
2565
2821
|
n(this, "ctx");
|
|
2566
2822
|
n(this, "visibleHoverCell");
|
|
@@ -2592,9 +2848,9 @@ class pe {
|
|
|
2592
2848
|
return;
|
|
2593
2849
|
const e = this.ctx.getOffset(t).offsetY, i = this.ctx.getOffset(t).offsetX;
|
|
2594
2850
|
this.handleHeaderEvent(i, e, this.ctx.header.renderCellHeaders, (s) => {
|
|
2595
|
-
this.ctx.clickCellHeader = s, this.ctx.emit("cellHeaderClick", s, t), this.selectionClick(s);
|
|
2851
|
+
this.ctx.clickCellHeader = s, this.ctx.emit("cellHeaderClick", s, t), this.selectionClick(s, t);
|
|
2596
2852
|
}), 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);
|
|
2853
|
+
this.ctx.clickCell = s, this.ctx.emit("cellClick", s, t), this.selectionClick(s, t), this.treeClick(s, t), this.hoverIconClick(s);
|
|
2598
2854
|
});
|
|
2599
2855
|
}), this.ctx.on("dblclick", (t) => {
|
|
2600
2856
|
if (t.button !== 0 || this.isBusy(t))
|
|
@@ -2628,7 +2884,7 @@ class pe {
|
|
|
2628
2884
|
e,
|
|
2629
2885
|
this.ctx.body.renderRows,
|
|
2630
2886
|
(s) => {
|
|
2631
|
-
this.
|
|
2887
|
+
this.visibleHoverCell !== s && (this.ctx.emit("visibleCellMouseleave", s, t), this.visibleHoverCell = s, this.ctx.hoverCellHeader = void 0, this.ctx.emit("visibleCellHoverChange", s, t));
|
|
2632
2888
|
},
|
|
2633
2889
|
!0
|
|
2634
2890
|
), this.handleBodyEvent(i, e, this.ctx.body.renderRows, (s) => {
|
|
@@ -2644,39 +2900,45 @@ class pe {
|
|
|
2644
2900
|
*选中点击
|
|
2645
2901
|
* @param cell
|
|
2646
2902
|
*/
|
|
2647
|
-
selectionClick(t) {
|
|
2648
|
-
if (["selection", "index-selection"].includes(t.type) && this.ctx.isPointer)
|
|
2649
|
-
|
|
2650
|
-
|
|
2903
|
+
selectionClick(t, e) {
|
|
2904
|
+
if (!(["selection", "index-selection", "selection-tree", "tree-selection"].includes(t.type) && this.ctx.isPointer))
|
|
2905
|
+
return;
|
|
2906
|
+
const { offsetY: s, offsetX: o } = this.ctx.getOffset(e), r = s, a = o;
|
|
2907
|
+
if (a > t.drawSelectionImageX && a < t.drawSelectionImageX + t.drawSelectionImageWidth && r > t.drawSelectionImageY && r < t.drawSelectionImageY + t.drawSelectionImageHeight)
|
|
2908
|
+
if (t instanceof ct)
|
|
2909
|
+
t.drawSelectionImageName === "checkbox-uncheck" || t.drawSelectionImageName === "checkbox-indeterminate" ? this.ctx.database.toggleAllSelection() : t.drawSelectionImageName === "checkbox-check" && this.ctx.database.clearSelection(!0);
|
|
2651
2910
|
else {
|
|
2652
2911
|
if (!this.ctx.database.getRowSelectable(t.rowKey))
|
|
2653
2912
|
return;
|
|
2654
|
-
this.ctx.database.toggleRowSelection(t.rowKey);
|
|
2913
|
+
this.ctx.database.toggleRowSelection(t.rowKey, t.type);
|
|
2655
2914
|
}
|
|
2656
2915
|
}
|
|
2657
2916
|
/**
|
|
2658
2917
|
* 树点击
|
|
2659
2918
|
* @param cell
|
|
2660
2919
|
*/
|
|
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
|
-
}
|
|
2920
|
+
treeClick(t, e) {
|
|
2921
|
+
if (!(["tree", "selection-tree", "tree-selection"].includes(t.type) && this.ctx.isPointer))
|
|
2922
|
+
return;
|
|
2923
|
+
const { offsetY: s, offsetX: o } = this.ctx.getOffset(e), r = s, a = o;
|
|
2924
|
+
if (!(a > t.drawTreeImageX && a < t.drawTreeImageX + t.drawTreeImageWidth && r > t.drawTreeImageY && r < t.drawTreeImageY + t.drawTreeImageHeight))
|
|
2925
|
+
return;
|
|
2926
|
+
const l = this.ctx.database.getRowForRowKey(t.rowKey), { expand: h = !1, expandLazy: d = !1 } = l || {}, { EXPAND_LAZY: f, EXPAND_LAZY_METHOD: u } = this.ctx.config;
|
|
2927
|
+
if (f && u && !h && !d)
|
|
2928
|
+
typeof u == "function" && (this.ctx.database.expandLoading(t.rowKey, !0), u({
|
|
2929
|
+
row: t.row,
|
|
2930
|
+
rowIndex: t.rowIndex,
|
|
2931
|
+
colIndex: t.colIndex,
|
|
2932
|
+
column: t.column,
|
|
2933
|
+
value: t.getValue()
|
|
2934
|
+
}).then((w) => {
|
|
2935
|
+
this.ctx.database.setExpandChildren(t.rowKey, w), this.ctx.database.expandLoading(t.rowKey, !1), this.ctx.emit("expandChange", this.ctx.database.getExpandRowKeys());
|
|
2936
|
+
}).catch((w) => {
|
|
2937
|
+
this.ctx.database.expandLoading(t.rowKey, !1), console.error(w);
|
|
2938
|
+
}));
|
|
2939
|
+
else {
|
|
2940
|
+
const x = this.ctx.database.getIsExpand(t.rowKey);
|
|
2941
|
+
this.ctx.database.expandItem(t.rowKey, !x), this.ctx.emit("expandChange", this.ctx.database.getExpandRowKeys());
|
|
2680
2942
|
}
|
|
2681
2943
|
}
|
|
2682
2944
|
/**
|
|
@@ -2686,11 +2948,18 @@ class pe {
|
|
|
2686
2948
|
*/
|
|
2687
2949
|
imageEnterAndLeave(t, e) {
|
|
2688
2950
|
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), o = i, r = s;
|
|
2689
|
-
r > t.
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2951
|
+
if ((t instanceof $ || t instanceof ct) && r > t.drawSelectionImageX && r < t.drawSelectionImageX + t.drawSelectionImageWidth && o > t.drawSelectionImageY && o < t.drawSelectionImageY + t.drawSelectionImageHeight) {
|
|
2952
|
+
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"));
|
|
2953
|
+
return;
|
|
2954
|
+
}
|
|
2955
|
+
if (t instanceof $ && t.drawHoverImageSource && r > t.drawHoverImageX && r < t.drawHoverImageX + t.drawHoverImageWidth && o > t.drawHoverImageY && o < t.drawHoverImageY + t.drawHoverImageHeight) {
|
|
2956
|
+
this.ctx.stageElement.style.cursor = "pointer", this.ctx.isPointer = !0;
|
|
2957
|
+
return;
|
|
2958
|
+
}
|
|
2959
|
+
if (t instanceof $ && t.drawTreeImageSource && r > t.drawTreeImageX && r < t.drawTreeImageX + t.drawTreeImageWidth && o > t.drawTreeImageY && o < t.drawTreeImageY + t.drawTreeImageHeight) {
|
|
2960
|
+
this.ctx.stageElement.style.cursor = "pointer", this.ctx.isPointer = !0;
|
|
2961
|
+
return;
|
|
2962
|
+
}
|
|
2694
2963
|
}
|
|
2695
2964
|
isBusy(t) {
|
|
2696
2965
|
const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = e, o = i;
|
|
@@ -2702,16 +2971,16 @@ class pe {
|
|
|
2702
2971
|
handleBodyEvent(t, e, i, s, o = !1) {
|
|
2703
2972
|
if (this.isInsideBody(e))
|
|
2704
2973
|
for (const r of i) {
|
|
2705
|
-
const
|
|
2706
|
-
for (const
|
|
2707
|
-
const h =
|
|
2974
|
+
const a = r.fixedCells.concat(r.noFixedCells);
|
|
2975
|
+
for (const l of a) {
|
|
2976
|
+
const h = l.getDrawX(), d = l.getDrawY();
|
|
2708
2977
|
if (o) {
|
|
2709
|
-
if (t > h && t < h +
|
|
2710
|
-
s(
|
|
2978
|
+
if (t > h && t < h + l.visibleWidth && e > d && e < d + l.visibleHeight) {
|
|
2979
|
+
s(l);
|
|
2711
2980
|
return;
|
|
2712
2981
|
}
|
|
2713
|
-
} else if (t > h && t < h +
|
|
2714
|
-
s(
|
|
2982
|
+
} else if (t > h && t < h + l.width && e > d && e < d + l.height) {
|
|
2983
|
+
s(l);
|
|
2715
2984
|
return;
|
|
2716
2985
|
}
|
|
2717
2986
|
}
|
|
@@ -2719,8 +2988,8 @@ class pe {
|
|
|
2719
2988
|
}
|
|
2720
2989
|
handleHeaderEvent(t, e, i, s) {
|
|
2721
2990
|
for (const o of i) {
|
|
2722
|
-
const r = o.getDrawX(),
|
|
2723
|
-
if (t > r && t < r + o.width && e >
|
|
2991
|
+
const r = o.getDrawX(), a = o.getDrawY();
|
|
2992
|
+
if (t > r && t < r + o.width && e > a && e < a + o.height) {
|
|
2724
2993
|
s(o);
|
|
2725
2994
|
return;
|
|
2726
2995
|
}
|
|
@@ -2733,7 +3002,7 @@ class pe {
|
|
|
2733
3002
|
this.resizeObserver.unobserve(this.ctx.stageElement), this.mutationObserver.disconnect();
|
|
2734
3003
|
}
|
|
2735
3004
|
}
|
|
2736
|
-
class
|
|
3005
|
+
class pe {
|
|
2737
3006
|
constructor(t, e) {
|
|
2738
3007
|
n(this, "eventBus");
|
|
2739
3008
|
n(this, "eventBrowser");
|
|
@@ -2849,20 +3118,20 @@ class Ee {
|
|
|
2849
3118
|
stageElement: s,
|
|
2850
3119
|
canvasElement: o,
|
|
2851
3120
|
overlayerElement: r,
|
|
2852
|
-
editorElement:
|
|
2853
|
-
emptyElement:
|
|
3121
|
+
editorElement: a,
|
|
3122
|
+
emptyElement: l,
|
|
2854
3123
|
contextMenuElement: h
|
|
2855
3124
|
} = t;
|
|
2856
|
-
this.containerElement = i, s.tabIndex = 0, this.stageElement = s, this.canvasElement = o, this.overlayerElement = r, this.editorElement =
|
|
3125
|
+
this.containerElement = i, s.tabIndex = 0, this.stageElement = s, this.canvasElement = o, this.overlayerElement = r, this.editorElement = a, this.emptyElement = l, 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
3126
|
}
|
|
2858
3127
|
setConfig(t) {
|
|
2859
|
-
this.config = new
|
|
3128
|
+
this.config = new Ct(t);
|
|
2860
3129
|
}
|
|
2861
3130
|
setItemValueByEditor(t, e, i, s = !0, o = !0, r = !0) {
|
|
2862
3131
|
if (this.config.ENABLE_MERGE_CELL_LINK) {
|
|
2863
|
-
const
|
|
2864
|
-
if (
|
|
2865
|
-
const { dataList:
|
|
3132
|
+
const a = this.database.getVirtualBodyCellByKey(t, e);
|
|
3133
|
+
if (a && (a.mergeRow || a.mergeCol)) {
|
|
3134
|
+
const { dataList: l } = a.getSpanInfo(), h = l.map((d) => ({ ...d, value: i }));
|
|
2866
3135
|
this.database.batchSetItemValue(h, s, r);
|
|
2867
3136
|
return;
|
|
2868
3137
|
}
|
|
@@ -2873,11 +3142,11 @@ class Ee {
|
|
|
2873
3142
|
if (this.config.ENABLE_MERGE_CELL_LINK) {
|
|
2874
3143
|
const s = [];
|
|
2875
3144
|
t.forEach((o) => {
|
|
2876
|
-
const r = this.database.getRowIndexForRowKey(o.rowKey),
|
|
2877
|
-
if (r === void 0 ||
|
|
2878
|
-
const
|
|
2879
|
-
if (
|
|
2880
|
-
const { dataList: h } =
|
|
3145
|
+
const r = this.database.getRowIndexForRowKey(o.rowKey), a = this.database.getColIndexForKey(o.key);
|
|
3146
|
+
if (r === void 0 || a === void 0) return;
|
|
3147
|
+
const l = this.database.getVirtualBodyCell(r, a);
|
|
3148
|
+
if (l) {
|
|
3149
|
+
const { dataList: h } = l.getSpanInfo(), d = h.map((f) => ({ ...f, value: o.value }));
|
|
2881
3150
|
s.push(...d);
|
|
2882
3151
|
}
|
|
2883
3152
|
}), this.database.batchSetItemValue(s, e, i);
|
|
@@ -2921,8 +3190,8 @@ class Ee {
|
|
|
2921
3190
|
let s = "";
|
|
2922
3191
|
for (let o = 0; o <= e[1] - e[0]; o++) {
|
|
2923
3192
|
const r = [];
|
|
2924
|
-
for (let
|
|
2925
|
-
const
|
|
3193
|
+
for (let a = 0; a <= i[1] - i[0]; a++) {
|
|
3194
|
+
const l = o + e[0], h = a + i[0], d = this.database.getVirtualBodyCell(l, h);
|
|
2926
3195
|
d && (d.selectorCellValueType === "displayText" ? r.push(d.displayText) : r.push(d.getValue()));
|
|
2927
3196
|
}
|
|
2928
3197
|
s += `${r.join(" ")}\r`, t.push(r);
|
|
@@ -2981,7 +3250,7 @@ class Ee {
|
|
|
2981
3250
|
this.eventTable.destroy(), this.eventBrowser.destroy(), this.eventBus.destroy();
|
|
2982
3251
|
}
|
|
2983
3252
|
}
|
|
2984
|
-
class
|
|
3253
|
+
class Rt {
|
|
2985
3254
|
constructor(t, e) {
|
|
2986
3255
|
n(this, "ctx");
|
|
2987
3256
|
n(this, "type");
|
|
@@ -3041,10 +3310,10 @@ class bt {
|
|
|
3041
3310
|
onMouseMove(t) {
|
|
3042
3311
|
const { offsetX: e, offsetY: i, clientX: s, clientY: o, buttons: r } = t;
|
|
3043
3312
|
if (this.isOnScrollbar(e, i) && t.target === this.ctx.canvasElement ? this.isFocus = !0 : this.isFocus = !1, r === 0 || s == this.clientX && o == this.clientY) return;
|
|
3044
|
-
let
|
|
3045
|
-
if (this.type === "horizontal" ?
|
|
3046
|
-
let
|
|
3047
|
-
this.type === "vertical" ?
|
|
3313
|
+
let a = 0;
|
|
3314
|
+
if (this.type === "horizontal" ? a = s - this.clientX : a = o - this.clientY, this.isDragging && a !== 0) {
|
|
3315
|
+
let l = 0;
|
|
3316
|
+
this.type === "vertical" ? l = this.dragStart + a / (this.visibleDistance - this.barHeight) * this.distance : l = this.dragStart + a / (this.visibleDistance - this.barWidth) * this.distance, this.scroll = Math.max(0, Math.min(l, this.distance));
|
|
3048
3317
|
}
|
|
3049
3318
|
}
|
|
3050
3319
|
isPointInElement(t, e, i, s, o, r) {
|
|
@@ -3069,25 +3338,25 @@ class bt {
|
|
|
3069
3338
|
header: e,
|
|
3070
3339
|
stageHeight: i,
|
|
3071
3340
|
stageWidth: s,
|
|
3072
|
-
config: { SCROLLER_TRACK_SIZE: o = 0, SCROLLER_SIZE: r = 0, BORDER:
|
|
3073
|
-
} = this.ctx,
|
|
3341
|
+
config: { SCROLLER_TRACK_SIZE: o = 0, SCROLLER_SIZE: r = 0, BORDER: a }
|
|
3342
|
+
} = this.ctx, l = s, h = i, d = e.height, f = e.width, u = t.height, x = this.ctx.footer.height;
|
|
3074
3343
|
if (this.type === "vertical") {
|
|
3075
|
-
this.visibleDistance = h - o - d, this.distance =
|
|
3076
|
-
const
|
|
3077
|
-
let
|
|
3078
|
-
|
|
3344
|
+
this.visibleDistance = h - o - d, this.distance = u - this.visibleDistance + x, this.trackX = l - o, this.trackY = 0, this.splitPoints = [this.trackX, d, this.trackX + o, d], this.trackWidth = o, this.trackHeight = h, this.barX = this.trackX - 1 + (o - r) / 2, this.barWidth = r;
|
|
3345
|
+
const w = this.distance ? this.visibleDistance / (u + x) : 0;
|
|
3346
|
+
let E = Math.floor(w * this.visibleDistance);
|
|
3347
|
+
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
3348
|
} else {
|
|
3080
|
-
this.visibleDistance =
|
|
3081
|
-
|
|
3349
|
+
this.visibleDistance = l - o, this.distance = f - this.visibleDistance, this.splitPoints = [
|
|
3350
|
+
l - o,
|
|
3082
3351
|
h - o,
|
|
3083
|
-
|
|
3352
|
+
l - o,
|
|
3084
3353
|
h
|
|
3085
3354
|
];
|
|
3086
|
-
const
|
|
3087
|
-
this.trackX = 0, this.trackY = h - o +
|
|
3088
|
-
const
|
|
3089
|
-
let
|
|
3090
|
-
this.barY = this.trackY - 1 + (o - r) / 2,
|
|
3355
|
+
const w = a ? 0 : 0.5;
|
|
3356
|
+
this.trackX = 0, this.trackY = h - o + w, this.trackWidth = l, this.trackHeight = o;
|
|
3357
|
+
const E = this.distance ? this.visibleDistance / f : 0;
|
|
3358
|
+
let g = Math.floor(E * this.visibleDistance);
|
|
3359
|
+
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
3360
|
}
|
|
3092
3361
|
}
|
|
3093
3362
|
draw() {
|
|
@@ -3113,7 +3382,7 @@ class me {
|
|
|
3113
3382
|
n(this, "ctx");
|
|
3114
3383
|
n(this, "verticalScrollbar");
|
|
3115
3384
|
n(this, "horizontalScrollbar");
|
|
3116
|
-
this.ctx = t, this.verticalScrollbar = new
|
|
3385
|
+
this.ctx = t, this.verticalScrollbar = new Rt(t, "vertical"), this.horizontalScrollbar = new Rt(t, "horizontal"), this.ctx.on("wheel", (e) => this.onWheel(e)), this.ctx.on("mousedown", (e) => this.onMouseDown(e)), this.ctx.on("mousemove", (e) => this.onMouseMove(e)), this.ctx.on("mouseup", () => this.onMouseUp()), this.ctx.on("touchmove", (e) => this.onTouchmove(e)), this.ctx.on("touchstart", (e) => {
|
|
3117
3386
|
this.onTouchstart(e);
|
|
3118
3387
|
}), this.ctx.on("setScroll", (e, i) => {
|
|
3119
3388
|
this.setScroll(e, i);
|
|
@@ -3214,7 +3483,7 @@ class ye {
|
|
|
3214
3483
|
n(this, "renderFixedCellHeaders", []);
|
|
3215
3484
|
this.ctx = t, this.ctx.on(
|
|
3216
3485
|
"resetHeader",
|
|
3217
|
-
|
|
3486
|
+
At(() => {
|
|
3218
3487
|
this.init(), this.ctx.emit("draw");
|
|
3219
3488
|
}, 100)
|
|
3220
3489
|
), this.init(), this.initResizeColumn();
|
|
@@ -3224,24 +3493,24 @@ class ye {
|
|
|
3224
3493
|
config: { HEADER_HEIGHT: t, SCROLLER_TRACK_SIZE: e }
|
|
3225
3494
|
} = this.ctx, i = this.ctx.database.getColumns();
|
|
3226
3495
|
this.columns = i, this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [];
|
|
3227
|
-
const s =
|
|
3228
|
-
this.height = t * s, this.width = o.reduce((f,
|
|
3229
|
-
const
|
|
3230
|
-
return
|
|
3496
|
+
const s = Mt(i), o = it(i);
|
|
3497
|
+
this.height = t * s, this.width = o.reduce((f, u) => {
|
|
3498
|
+
const x = u.width || 100, { maxWidth: w, minWidth: E } = u;
|
|
3499
|
+
return w && x > w ? f + w : E && x < E ? f + E : f + x;
|
|
3231
3500
|
}, 0), this.visibleHeight = this.height;
|
|
3232
|
-
const r = oe(
|
|
3501
|
+
const r = oe(Ht(i, s));
|
|
3233
3502
|
this.columnIndex = 0, this.resizeNum = 0, this.render(r, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
3234
|
-
const
|
|
3235
|
-
this.resizeNum > 0 ? this.ctx.stageWidth = Math.floor(
|
|
3236
|
-
const
|
|
3237
|
-
if (this.resizeNum &&
|
|
3238
|
-
const f = Math.floor(
|
|
3503
|
+
const a = this.ctx.containerElement.getBoundingClientRect();
|
|
3504
|
+
this.resizeNum > 0 ? this.ctx.stageWidth = Math.floor(a.width) : this.ctx.stageWidth = Math.floor(this.width + e), this.ctx.stageElement.style.width = this.ctx.stageWidth + "px", this.visibleWidth = this.ctx.stageWidth - e;
|
|
3505
|
+
const l = this.visibleWidth - this.width;
|
|
3506
|
+
if (this.resizeNum && l > 0) {
|
|
3507
|
+
const f = Math.floor(l / this.resizeNum * 100) / 100;
|
|
3239
3508
|
this.resizeAllColumn(f);
|
|
3240
3509
|
}
|
|
3241
3510
|
const h = this.fixedLeftCellHeaders.filter((f) => !f.hasChildren);
|
|
3242
|
-
this.ctx.fixedLeftWidth = h.reduce((f,
|
|
3511
|
+
this.ctx.fixedLeftWidth = h.reduce((f, u) => f + u.width, 0);
|
|
3243
3512
|
const d = this.fixedRightCellHeaders.filter((f) => !f.hasChildren);
|
|
3244
|
-
this.ctx.fixedRightWidth = d.reduce((f,
|
|
3513
|
+
this.ctx.fixedRightWidth = d.reduce((f, u) => f + u.width, e), this.ctx.maxColIndex = this.leafCellHeaders.length - 1, this.ctx.header.x = this.x, this.ctx.header.y = this.y, this.ctx.header.width = this.width, this.ctx.header.height = this.height, this.ctx.header.visibleWidth = this.visibleWidth, this.ctx.header.visibleHeight = this.visibleHeight;
|
|
3245
3514
|
}
|
|
3246
3515
|
// 调整表头的宽度
|
|
3247
3516
|
initResizeColumn() {
|
|
@@ -3259,9 +3528,9 @@ class ye {
|
|
|
3259
3528
|
config: { RESIZE_COLUMN_MIN_WIDTH: s }
|
|
3260
3529
|
} = this.ctx;
|
|
3261
3530
|
if (this.isResizing && this.resizeTarget) {
|
|
3262
|
-
const o = this.resizeTarget.width, r = this.resizeTarget.minWidth,
|
|
3263
|
-
let
|
|
3264
|
-
|
|
3531
|
+
const o = this.resizeTarget.width, r = this.resizeTarget.minWidth, a = this.resizeTarget.maxWidth;
|
|
3532
|
+
let l = e.clientX - this.clientX;
|
|
3533
|
+
l + o < s && (l = -(o - s)), r && l + o < r && (l = -(o - r)), a && l + o > a && (l = a - o), this.resizeDiff = l, this.ctx.emit("draw");
|
|
3265
3534
|
} else {
|
|
3266
3535
|
if (this.resizeTarget = null, this.isMouseDown)
|
|
3267
3536
|
return;
|
|
@@ -3272,9 +3541,9 @@ class ye {
|
|
|
3272
3541
|
this.ctx.stageElement.style.cursor === "col-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3273
3542
|
const o = [...this.renderFixedCellHeaders, ...this.renderCenterCellHeaders];
|
|
3274
3543
|
for (const r of o) {
|
|
3275
|
-
const { offsetX:
|
|
3544
|
+
const { offsetX: a, offsetY: l } = this.ctx.getOffset(e), h = a, d = r.getDrawX();
|
|
3276
3545
|
h > d + r.width - 5 && h < d + r.width + 4 && h < i - 4 && // 视窗中最后一列不允许调整宽
|
|
3277
|
-
r.colspan <= 1 && this.ctx.isTarget(e) &&
|
|
3546
|
+
r.colspan <= 1 && this.ctx.isTarget(e) && l <= this.height && (this.ctx.stageElement.style.cursor = "col-resize", this.resizeTarget = r);
|
|
3278
3547
|
}
|
|
3279
3548
|
}
|
|
3280
3549
|
}));
|
|
@@ -3283,8 +3552,8 @@ class ye {
|
|
|
3283
3552
|
const i = (o) => {
|
|
3284
3553
|
o.forEach((r) => {
|
|
3285
3554
|
if (r.children && r.children.length > 0 && i(r.children), r.key === t.key) {
|
|
3286
|
-
const
|
|
3287
|
-
r.width =
|
|
3555
|
+
const a = r.width || 100;
|
|
3556
|
+
r.width = a + e;
|
|
3288
3557
|
}
|
|
3289
3558
|
});
|
|
3290
3559
|
};
|
|
@@ -3328,11 +3597,11 @@ class ye {
|
|
|
3328
3597
|
let s = e;
|
|
3329
3598
|
const { HEADER_HEIGHT: o = 0 } = this.ctx.config;
|
|
3330
3599
|
for (let r = 0; r < i; r++) {
|
|
3331
|
-
const
|
|
3332
|
-
let { minWidth: d, maxWidth: f } =
|
|
3333
|
-
d &&
|
|
3334
|
-
const
|
|
3335
|
-
this.ctx.database.setHeader(
|
|
3600
|
+
const a = t[r], l = o * (a.rowspan || 0), h = o * (a.level || 0);
|
|
3601
|
+
let { minWidth: d, maxWidth: f } = a, u = a.width || 100;
|
|
3602
|
+
d && u < d && (u = d), f && u > f && (u = f), a.children && (u = it(a.children).reduce((E, g) => E + ((g == null ? void 0 : g.width) || 100), 0));
|
|
3603
|
+
const x = new ct(this.ctx, this.columnIndex, s, h, u, l, a);
|
|
3604
|
+
this.ctx.database.setHeader(a.key, x), this.allCellHeaders.push(x), a.children || (this.leafCellHeaders.push(x), x.column.widthFillDisable || this.resizeNum++), a.fixed === "left" ? this.fixedLeftCellHeaders.push(x) : a.fixed === "right" ? this.fixedRightCellHeaders.push(x) : this.centerCellHeaders.push(x), !a.children && this.columnIndex++, a.children && this.render(a.children, s), s += u;
|
|
3336
3605
|
}
|
|
3337
3606
|
}
|
|
3338
3607
|
drawTipLine() {
|
|
@@ -3354,7 +3623,7 @@ class ye {
|
|
|
3354
3623
|
scrollX: i,
|
|
3355
3624
|
header: s,
|
|
3356
3625
|
stageWidth: o,
|
|
3357
|
-
config: { HEADER_BG_COLOR: r, SCROLLER_TRACK_SIZE:
|
|
3626
|
+
config: { HEADER_BG_COLOR: r, SCROLLER_TRACK_SIZE: a }
|
|
3358
3627
|
} = this.ctx;
|
|
3359
3628
|
if (i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, this.y, t, this.height, {
|
|
3360
3629
|
fillColor: r,
|
|
@@ -3362,9 +3631,9 @@ class ye {
|
|
|
3362
3631
|
shadowWidth: 4,
|
|
3363
3632
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3364
3633
|
colorEnd: "rgba(0,0,0,0)"
|
|
3365
|
-
}), i < Math.floor(s.width - o - 1) && e !==
|
|
3366
|
-
const
|
|
3367
|
-
this.ctx.paint.drawShadow(
|
|
3634
|
+
}), i < Math.floor(s.width - o - 1) && e !== a) {
|
|
3635
|
+
const l = s.width - (this.x + this.width) + o - e;
|
|
3636
|
+
this.ctx.paint.drawShadow(l, this.y, e, this.height, {
|
|
3368
3637
|
fillColor: r,
|
|
3369
3638
|
side: "left",
|
|
3370
3639
|
shadowWidth: 4,
|
|
@@ -3405,8 +3674,8 @@ class ye {
|
|
|
3405
3674
|
}), this.drawTipLine(), this.drawBottomLine();
|
|
3406
3675
|
}
|
|
3407
3676
|
}
|
|
3408
|
-
class
|
|
3409
|
-
constructor(t, e, i = 0, s = 0, o = 0, r = 0,
|
|
3677
|
+
class Nt {
|
|
3678
|
+
constructor(t, e, i = 0, s = 0, o = 0, r = 0, a, l = "body") {
|
|
3410
3679
|
n(this, "ctx");
|
|
3411
3680
|
n(this, "x", 0);
|
|
3412
3681
|
n(this, "y", 0);
|
|
@@ -3419,12 +3688,12 @@ class Bt {
|
|
|
3419
3688
|
n(this, "rowKey", "");
|
|
3420
3689
|
n(this, "rowType", "body");
|
|
3421
3690
|
n(this, "data");
|
|
3422
|
-
this.ctx = t, this.x = i, this.y = s, this.width = o, this.height = r, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e) || "", this.rowType =
|
|
3691
|
+
this.ctx = t, this.x = i, this.y = s, this.width = o, this.height = r, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e) || "", this.rowType = l, this.data = a, this.update();
|
|
3423
3692
|
}
|
|
3424
3693
|
update() {
|
|
3425
3694
|
const { header: t } = this.ctx, e = [], i = [], s = [];
|
|
3426
3695
|
t.renderLeafCellHeaders.forEach((o) => {
|
|
3427
|
-
const r = new
|
|
3696
|
+
const r = new $(
|
|
3428
3697
|
this.ctx,
|
|
3429
3698
|
this.rowIndex,
|
|
3430
3699
|
o.colIndex,
|
|
@@ -3496,46 +3765,46 @@ class Ce {
|
|
|
3496
3765
|
config: {
|
|
3497
3766
|
FOOTER_FIXED: o,
|
|
3498
3767
|
SCROLLER_TRACK_SIZE: r = 0,
|
|
3499
|
-
HEIGHT:
|
|
3500
|
-
EMPTY_BODY_HEIGHT:
|
|
3768
|
+
HEIGHT: a,
|
|
3769
|
+
EMPTY_BODY_HEIGHT: l = 0,
|
|
3501
3770
|
MAX_HEIGHT: h = 0,
|
|
3502
3771
|
ENABLE_OFFSET_HEIGHT: d = 0,
|
|
3503
3772
|
OFFSET_HEIGHT: f = 0,
|
|
3504
|
-
FOOTER_POSITION:
|
|
3773
|
+
FOOTER_POSITION: u
|
|
3505
3774
|
}
|
|
3506
3775
|
} = this.ctx;
|
|
3507
3776
|
if (!e.width)
|
|
3508
3777
|
return;
|
|
3509
|
-
this.x = 0,
|
|
3510
|
-
const { data:
|
|
3511
|
-
this.height =
|
|
3512
|
-
const
|
|
3513
|
-
!this.data.length && !
|
|
3514
|
-
let
|
|
3515
|
-
|
|
3516
|
-
let
|
|
3778
|
+
this.x = 0, u === "top" && o ? this.y = e.height + i.height : this.y = e.height;
|
|
3779
|
+
const { data: x, sumHeight: w } = s.getData();
|
|
3780
|
+
this.height = w, this.data = x, this.width = e.width, this.visibleWidth = this.ctx.stageWidth - r;
|
|
3781
|
+
const E = this.ctx.footer.height;
|
|
3782
|
+
!this.data.length && !a ? this.height = l : !this.data.length && a && (this.height = a - e.height - E - r);
|
|
3783
|
+
let g = this.height + e.height + r;
|
|
3784
|
+
g += E;
|
|
3785
|
+
let p = g;
|
|
3517
3786
|
const y = window.innerHeight, { top: m } = this.containerRect || this.ctx.containerElement.getBoundingClientRect();
|
|
3518
|
-
if (y > m && d && !
|
|
3519
|
-
const
|
|
3520
|
-
|
|
3521
|
-
} else this.data.length &&
|
|
3522
|
-
|
|
3523
|
-
let
|
|
3524
|
-
o ? this.visibleHeight =
|
|
3787
|
+
if (y > m && d && !a) {
|
|
3788
|
+
const O = y - m - f;
|
|
3789
|
+
O > e.height + r ? p = O : g > h && (p = h);
|
|
3790
|
+
} else this.data.length && a ? p = a : this.data.length && h && g > h && (p = h);
|
|
3791
|
+
p > 0 && (this.ctx.stageHeight = Math.floor(p), this.ctx.stageElement.style.height = `${this.ctx.stageHeight}px`);
|
|
3792
|
+
let b = this.ctx.stageHeight - e.height - r;
|
|
3793
|
+
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 = x;
|
|
3525
3794
|
const C = window.devicePixelRatio || 1, I = this.ctx.stageWidth * C, _ = this.ctx.stageHeight * C;
|
|
3526
3795
|
t.width = Math.round(I), t.height = Math.round(_);
|
|
3527
|
-
const
|
|
3796
|
+
const T = this.data.length ? "not-empty" : "empty";
|
|
3528
3797
|
this.ctx.emit("emptyChange", {
|
|
3529
|
-
isEmpty:
|
|
3530
|
-
type:
|
|
3798
|
+
isEmpty: T,
|
|
3799
|
+
type: T,
|
|
3531
3800
|
headerHeight: e.height,
|
|
3532
3801
|
bodyHeight: this.height,
|
|
3533
|
-
footerHeight:
|
|
3802
|
+
footerHeight: E,
|
|
3534
3803
|
width: this.width,
|
|
3535
|
-
height: this.data.length ? 0 :
|
|
3804
|
+
height: this.data.length ? 0 : l + E
|
|
3536
3805
|
});
|
|
3537
|
-
const v = Math.round(t.width / C * 1e4) / 1e4,
|
|
3538
|
-
this.ctx.canvasElement.setAttribute("style", `height:${
|
|
3806
|
+
const v = Math.round(t.width / C * 1e4) / 1e4, R = Math.round(t.height / C * 1e4) / 1e4;
|
|
3807
|
+
this.ctx.canvasElement.setAttribute("style", `height:${R}px;width:${v}px;`), this.ctx.paint.scale(C);
|
|
3539
3808
|
}
|
|
3540
3809
|
// 调整行的高度
|
|
3541
3810
|
initResizeRow() {
|
|
@@ -3554,15 +3823,15 @@ class Ce {
|
|
|
3554
3823
|
this.ctx.isTarget(e) && (this.clientY = e.clientY, this.resizeTarget ? (this.isResizing = !0, this.ctx.rowResizing = !0) : (this.isResizing = !1, this.ctx.rowResizing = !1), this.isMouseDown = !0);
|
|
3555
3824
|
}), this.ctx.on("mousemove", (e) => {
|
|
3556
3825
|
if (this.ctx.editing) return;
|
|
3557
|
-
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), o = i, r = s,
|
|
3558
|
-
stageHeight:
|
|
3826
|
+
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), o = i, r = s, a = e.clientY, {
|
|
3827
|
+
stageHeight: l,
|
|
3559
3828
|
scrollY: h,
|
|
3560
3829
|
config: { RESIZE_ROW_MIN_HEIGHT: d = 0 }
|
|
3561
3830
|
} = this.ctx;
|
|
3562
3831
|
if (this.isResizing && this.resizeTarget) {
|
|
3563
3832
|
const f = this.resizeTarget.height;
|
|
3564
|
-
let
|
|
3565
|
-
|
|
3833
|
+
let u = a - this.clientY;
|
|
3834
|
+
u + f < d && (u = -(f - d)), this.resizeDiff = u, this.ctx.emit("draw");
|
|
3566
3835
|
} else {
|
|
3567
3836
|
if (this.resizeTarget = null, this.isMouseDown)
|
|
3568
3837
|
return;
|
|
@@ -3574,11 +3843,11 @@ class Ce {
|
|
|
3574
3843
|
return;
|
|
3575
3844
|
this.ctx.stageElement.style.cursor === "row-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3576
3845
|
for (let f = 0; f < this.renderRows.length; f++) {
|
|
3577
|
-
const
|
|
3578
|
-
if (o >
|
|
3579
|
-
for (let
|
|
3580
|
-
const
|
|
3581
|
-
r >
|
|
3846
|
+
const u = this.renderRows[f];
|
|
3847
|
+
if (o > u.y - h + u.height - 1.5 && o < u.y - h + u.height + 1.5 && o < l - 4)
|
|
3848
|
+
for (let w = 0; w < u.cells.length; w++) {
|
|
3849
|
+
const E = u.cells[w];
|
|
3850
|
+
r > E.drawX + 10 && r < E.drawX + E.width - 10 && E.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = u);
|
|
3582
3851
|
}
|
|
3583
3852
|
}
|
|
3584
3853
|
}
|
|
@@ -3601,8 +3870,8 @@ class Ce {
|
|
|
3601
3870
|
stageWidth: t,
|
|
3602
3871
|
scrollY: e,
|
|
3603
3872
|
config: { RESIZE_ROW_LINE_COLOR: i }
|
|
3604
|
-
} = this.ctx, s = this.resizeTarget.y - e, o = this.resizeTarget.height, r = s + o + this.resizeDiff - 0.5,
|
|
3605
|
-
this.ctx.paint.drawLine(
|
|
3873
|
+
} = this.ctx, s = this.resizeTarget.y - e, o = this.resizeTarget.height, r = s + o + this.resizeDiff - 0.5, a = [0, r - 0.5, t, r - 0.5];
|
|
3874
|
+
this.ctx.paint.drawLine(a, {
|
|
3606
3875
|
borderColor: i,
|
|
3607
3876
|
borderWidth: 1
|
|
3608
3877
|
});
|
|
@@ -3615,7 +3884,7 @@ class Ce {
|
|
|
3615
3884
|
scrollX: i,
|
|
3616
3885
|
header: s,
|
|
3617
3886
|
stageWidth: o,
|
|
3618
|
-
config: { HEADER_BG_COLOR: r, SCROLLER_TRACK_SIZE:
|
|
3887
|
+
config: { HEADER_BG_COLOR: r, SCROLLER_TRACK_SIZE: a }
|
|
3619
3888
|
} = this.ctx;
|
|
3620
3889
|
if (i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, this.y, t, this.height, {
|
|
3621
3890
|
fillColor: r,
|
|
@@ -3623,9 +3892,9 @@ class Ce {
|
|
|
3623
3892
|
shadowWidth: 4,
|
|
3624
3893
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3625
3894
|
colorEnd: "rgba(0,0,0,0)"
|
|
3626
|
-
}), i < Math.floor(s.width - o - 1) && e !==
|
|
3627
|
-
const
|
|
3628
|
-
this.ctx.paint.drawShadow(
|
|
3895
|
+
}), i < Math.floor(s.width - o - 1) && e !== a) {
|
|
3896
|
+
const l = s.width - (this.x + this.width) + o - e;
|
|
3897
|
+
this.ctx.paint.drawShadow(l, this.y, e, this.height, {
|
|
3629
3898
|
fillColor: r,
|
|
3630
3899
|
side: "left",
|
|
3631
3900
|
shadowWidth: 4,
|
|
@@ -3637,10 +3906,10 @@ class Ce {
|
|
|
3637
3906
|
binarySearch(t, e) {
|
|
3638
3907
|
let i = 0, s = t.length - 1, o = -1;
|
|
3639
3908
|
for (; i <= s; ) {
|
|
3640
|
-
let r = Math.floor((i + s) / 2),
|
|
3641
|
-
if (
|
|
3909
|
+
let r = Math.floor((i + s) / 2), a = t[r].bottom;
|
|
3910
|
+
if (a === e)
|
|
3642
3911
|
return r;
|
|
3643
|
-
|
|
3912
|
+
a < e ? i = r + 1 : (o = r, s = r - 1);
|
|
3644
3913
|
}
|
|
3645
3914
|
return o;
|
|
3646
3915
|
}
|
|
@@ -3651,18 +3920,18 @@ class Ce {
|
|
|
3651
3920
|
database: e,
|
|
3652
3921
|
scrollY: i,
|
|
3653
3922
|
config: { CELL_HEIGHT: s }
|
|
3654
|
-
} = this.ctx, o = i, { data: r, positions:
|
|
3923
|
+
} = this.ctx, o = i, { data: r, positions: a } = e.getData();
|
|
3655
3924
|
this.ctx.maxRowIndex = r.length - 1;
|
|
3656
|
-
let
|
|
3657
|
-
if (h === -1 && (h = this.ctx.maxRowIndex),
|
|
3925
|
+
let l = this.binarySearch(a, o), h = this.binarySearch(a, o + this.visibleHeight);
|
|
3926
|
+
if (h === -1 && (h = this.ctx.maxRowIndex), l === -1 && h === this.ctx.maxRowIndex) {
|
|
3658
3927
|
const f = Math.floor(this.visibleHeight / s);
|
|
3659
|
-
|
|
3928
|
+
l = this.ctx.maxRowIndex - f;
|
|
3660
3929
|
}
|
|
3661
|
-
this.headIndex = Math.max(0,
|
|
3930
|
+
this.headIndex = Math.max(0, l), this.tailIndex = Math.min(this.ctx.maxRowIndex, h + 1), this.visibleRows = r.slice(this.headIndex, this.tailIndex + 1), this.ctx.body.headIndex = this.headIndex, this.ctx.body.tailIndex = this.tailIndex, this.ctx.body.visibleRows = this.visibleRows;
|
|
3662
3931
|
const d = [];
|
|
3663
3932
|
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
3664
|
-
const
|
|
3665
|
-
d.push(
|
|
3933
|
+
const u = this.headIndex + f, x = this.visibleRows[f], { height: w, top: E } = this.ctx.database.getPositionForRowIndex(u), g = new Nt(this.ctx, u, 0, E + this.y, t.width, w, x);
|
|
3934
|
+
d.push(g);
|
|
3666
3935
|
}
|
|
3667
3936
|
this.renderRows = d, this.ctx.body.renderRows = d;
|
|
3668
3937
|
}
|
|
@@ -3698,7 +3967,7 @@ class be {
|
|
|
3698
3967
|
body: e,
|
|
3699
3968
|
config: { CELL_FOOTER_HEIGHT: i, FOOTER_FIXED: s, SCROLLER_TRACK_SIZE: o, FOOTER_POSITION: r }
|
|
3700
3969
|
} = this.ctx;
|
|
3701
|
-
this.width = t.width, this.visibleWidth = t.visibleWidth, this.height = this.data.reduce((
|
|
3970
|
+
this.width = t.width, this.visibleWidth = t.visibleWidth, this.height = this.data.reduce((a) => a + i, 0), this.visibleHeight = this.height, s ? r === "top" ? this.y = this.ctx.header.height : this.y = this.ctx.stageHeight - this.height - o : this.y = e.y + e.height, this.ctx.footer.x = this.x, this.ctx.footer.y = this.y, this.ctx.footer.height = this.height, this.ctx.footer.width = this.width, this.ctx.footer.visibleWidth = this.visibleWidth, this.ctx.footer.visibleHeight = this.visibleHeight;
|
|
3702
3971
|
}
|
|
3703
3972
|
drawFixedShadow() {
|
|
3704
3973
|
const {
|
|
@@ -3707,18 +3976,18 @@ class be {
|
|
|
3707
3976
|
scrollX: i,
|
|
3708
3977
|
header: s,
|
|
3709
3978
|
stageWidth: o,
|
|
3710
|
-
config: { HEADER_BG_COLOR: r, SCROLLER_TRACK_SIZE:
|
|
3979
|
+
config: { HEADER_BG_COLOR: r, SCROLLER_TRACK_SIZE: a }
|
|
3711
3980
|
} = this.ctx;
|
|
3712
|
-
let
|
|
3713
|
-
if (this.ctx.config.FOOTER_FIXED || (
|
|
3981
|
+
let l = this.y;
|
|
3982
|
+
if (this.ctx.config.FOOTER_FIXED || (l = this.y - this.ctx.scrollY), i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, l, t, this.height, {
|
|
3714
3983
|
fillColor: r,
|
|
3715
3984
|
side: "right",
|
|
3716
3985
|
shadowWidth: 4,
|
|
3717
3986
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3718
3987
|
colorEnd: "rgba(0,0,0,0)"
|
|
3719
|
-
}), i < Math.floor(s.width - o - 1) && e !==
|
|
3988
|
+
}), i < Math.floor(s.width - o - 1) && e !== a) {
|
|
3720
3989
|
const h = s.width - (this.x + this.width) + o - e;
|
|
3721
|
-
this.ctx.paint.drawShadow(h,
|
|
3990
|
+
this.ctx.paint.drawShadow(h, l, e, this.height, {
|
|
3722
3991
|
fillColor: r,
|
|
3723
3992
|
side: "left",
|
|
3724
3993
|
shadowWidth: 4,
|
|
@@ -3733,7 +4002,7 @@ class be {
|
|
|
3733
4002
|
let e = this.y;
|
|
3734
4003
|
const i = [];
|
|
3735
4004
|
this.data.forEach((s, o) => {
|
|
3736
|
-
const r = new
|
|
4005
|
+
const r = new Nt(this.ctx, o, 0, e, this.width, t, s, "footer");
|
|
3737
4006
|
e += t, i.push(r);
|
|
3738
4007
|
}), this.renderRows = i, this.ctx.footer.renderRows = this.renderRows;
|
|
3739
4008
|
}
|
|
@@ -3778,7 +4047,7 @@ class Re {
|
|
|
3778
4047
|
this.moveFocus(t);
|
|
3779
4048
|
}), this.ctx.on(
|
|
3780
4049
|
"mousemove",
|
|
3781
|
-
|
|
4050
|
+
At((t) => {
|
|
3782
4051
|
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
4052
|
(this.ctx.selectorMove || this.ctx.autofillMove) && (!s && !this.mousedownHeader ? this.startAdjustPosition(t) : this.stopAdjustPosition());
|
|
3784
4053
|
}, 100)
|
|
@@ -3865,31 +4134,31 @@ class Re {
|
|
|
3865
4134
|
const { ENABLE_SELECTOR_SPAN_COL: i, ENABLE_SELECTOR_SPAN_ROW: s } = this.ctx.config;
|
|
3866
4135
|
let o = t, r = e;
|
|
3867
4136
|
if (!s) {
|
|
3868
|
-
const [
|
|
3869
|
-
r = [
|
|
4137
|
+
const [a] = r;
|
|
4138
|
+
r = [a, a];
|
|
3870
4139
|
}
|
|
3871
4140
|
if (!i) {
|
|
3872
|
-
const [
|
|
3873
|
-
o = [
|
|
4141
|
+
const [a] = o;
|
|
4142
|
+
o = [a, a];
|
|
3874
4143
|
}
|
|
3875
4144
|
if (JSON.stringify(this.ctx.selector.xArr) !== JSON.stringify(o) || JSON.stringify(this.ctx.selector.yArr) !== JSON.stringify(r)) {
|
|
3876
4145
|
this.ctx.mousedown && (this.ctx.selectorMove = !0), this.ctx.selector.enable = !0;
|
|
3877
4146
|
const {
|
|
3878
|
-
SELECTOR_AREA_MIN_X:
|
|
3879
|
-
SELECTOR_AREA_MAX_X:
|
|
4147
|
+
SELECTOR_AREA_MIN_X: a,
|
|
4148
|
+
SELECTOR_AREA_MAX_X: l,
|
|
3880
4149
|
SELECTOR_AREA_MIN_Y: h,
|
|
3881
4150
|
SELECTOR_AREA_MAX_Y: d,
|
|
3882
4151
|
SELECTOR_AREA_MAX_X_OFFSET: f,
|
|
3883
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
3884
|
-
} = this.ctx.config,
|
|
3885
|
-
let [
|
|
3886
|
-
if (
|
|
4152
|
+
SELECTOR_AREA_MAX_Y_OFFSET: u
|
|
4153
|
+
} = this.ctx.config, x = a, w = l || this.ctx.maxColIndex - f, E = h, g = d || this.ctx.maxRowIndex - u;
|
|
4154
|
+
let [p, y] = o, [m, b] = r;
|
|
4155
|
+
if (p < x || y > w || m < E || b > g)
|
|
3887
4156
|
return;
|
|
3888
4157
|
if (this.ctx.stageElement.focus({ preventScroll: !0 }), this.ctx.config.ENABLE_MERGE_CELL_LINK) {
|
|
3889
4158
|
const I = this.adjustMergeCells(o, r);
|
|
3890
|
-
m = I.yArr[0],
|
|
4159
|
+
m = I.yArr[0], b = I.yArr[1], p = I.xArr[0], y = I.xArr[1], this.ctx.onlyMergeCell = I.onlyMergeCell;
|
|
3891
4160
|
}
|
|
3892
|
-
|
|
4161
|
+
p === y && m === b ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, o = [Math.max(x, p), Math.min(w, y)], r = [Math.max(E, m), Math.min(g, b)];
|
|
3893
4162
|
const { BEFORE_SET_SELECTOR_METHOD: C } = this.ctx.config;
|
|
3894
4163
|
if (typeof C == "function") {
|
|
3895
4164
|
const _ = C({
|
|
@@ -3905,42 +4174,42 @@ class Re {
|
|
|
3905
4174
|
}
|
|
3906
4175
|
}
|
|
3907
4176
|
adjustMergeCells(t, e) {
|
|
3908
|
-
var
|
|
4177
|
+
var w;
|
|
3909
4178
|
const [i, s] = e, [o, r] = t;
|
|
3910
|
-
let
|
|
3911
|
-
for (let
|
|
3912
|
-
for (let
|
|
3913
|
-
const
|
|
3914
|
-
m && ((
|
|
4179
|
+
let a = [], l = [];
|
|
4180
|
+
for (let E = 0; E <= e[1] - e[0]; E++)
|
|
4181
|
+
for (let g = 0; g <= t[1] - t[0]; g++) {
|
|
4182
|
+
const p = E + e[0], y = g + t[0], m = this.ctx.database.getVirtualBodyCell(p, y);
|
|
4183
|
+
m && ((p === i || p === s) && a.push(m), (y === o || y === r) && l.push(m));
|
|
3915
4184
|
}
|
|
3916
|
-
const h =
|
|
3917
|
-
(
|
|
3918
|
-
const { yArr:
|
|
3919
|
-
return
|
|
4185
|
+
const h = a.reduce(
|
|
4186
|
+
(E, g) => {
|
|
4187
|
+
const { yArr: p } = g.getSpanInfo(), [y, m] = p;
|
|
4188
|
+
return E.minY = Math.min(E.minY, y), E.maxY = Math.max(E.maxY, m), E;
|
|
3920
4189
|
},
|
|
3921
4190
|
{
|
|
3922
4191
|
minY: i,
|
|
3923
4192
|
maxY: s
|
|
3924
4193
|
}
|
|
3925
|
-
), d =
|
|
3926
|
-
(
|
|
3927
|
-
const { xArr:
|
|
3928
|
-
return
|
|
4194
|
+
), d = l.reduce(
|
|
4195
|
+
(E, g) => {
|
|
4196
|
+
const { xArr: p } = g.getSpanInfo(), [y, m] = p;
|
|
4197
|
+
return E.minX = Math.min(E.minX, y), E.maxX = Math.max(E.maxX, m), E;
|
|
3929
4198
|
},
|
|
3930
4199
|
{
|
|
3931
4200
|
minX: o,
|
|
3932
4201
|
maxX: r
|
|
3933
4202
|
}
|
|
3934
|
-
), f = [d.minX, d.maxX],
|
|
3935
|
-
let
|
|
4203
|
+
), f = [d.minX, d.maxX], u = [h.minY, h.maxY];
|
|
4204
|
+
let x = !1;
|
|
3936
4205
|
if (d.minX !== d.maxX || h.minY !== h.maxY) {
|
|
3937
|
-
const
|
|
3938
|
-
|
|
4206
|
+
const E = JSON.stringify(f) + JSON.stringify(u), g = (w = this.ctx.focusCell) == null ? void 0 : w.getSpanInfo();
|
|
4207
|
+
x = (g && JSON.stringify(g.xArr) + JSON.stringify(g.yArr)) === E;
|
|
3939
4208
|
}
|
|
3940
4209
|
return {
|
|
3941
4210
|
xArr: f,
|
|
3942
|
-
yArr:
|
|
3943
|
-
onlyMergeCell:
|
|
4211
|
+
yArr: u,
|
|
4212
|
+
onlyMergeCell: x
|
|
3944
4213
|
};
|
|
3945
4214
|
}
|
|
3946
4215
|
selectCols(t) {
|
|
@@ -3952,17 +4221,17 @@ class Re {
|
|
|
3952
4221
|
}
|
|
3953
4222
|
const { SELECTOR_AREA_MIN_Y: e, SELECTOR_AREA_MAX_Y: i, SELECTOR_AREA_MAX_Y_OFFSET: s } = this.ctx.config, o = e, r = i || this.ctx.maxRowIndex - s;
|
|
3954
4223
|
if (this.ctx.mousedown && this.ctx.focusCellHeader) {
|
|
3955
|
-
const { colIndex:
|
|
3956
|
-
if (this.ctx.clearSelector(), t.colIndex >=
|
|
3957
|
-
const
|
|
3958
|
-
this.setSelector(
|
|
4224
|
+
const { colIndex: a } = this.ctx.focusCellHeader;
|
|
4225
|
+
if (this.ctx.clearSelector(), t.colIndex >= a) {
|
|
4226
|
+
const l = [a, t.colIndex + t.colspan - 1], h = [o, r];
|
|
4227
|
+
this.setSelector(l, h);
|
|
3959
4228
|
} else {
|
|
3960
|
-
const
|
|
3961
|
-
this.setSelector(
|
|
4229
|
+
const l = [t.colIndex, a], h = [o, r];
|
|
4230
|
+
this.setSelector(l, h);
|
|
3962
4231
|
}
|
|
3963
4232
|
} else {
|
|
3964
|
-
const
|
|
3965
|
-
this.setSelector(
|
|
4233
|
+
const a = [t.colIndex, t.colIndex + t.colspan - 1], l = [o, r];
|
|
4234
|
+
this.setSelector(a, l);
|
|
3966
4235
|
}
|
|
3967
4236
|
}
|
|
3968
4237
|
selectAll() {
|
|
@@ -3975,28 +4244,28 @@ class Re {
|
|
|
3975
4244
|
SELECTOR_AREA_MAX_X: s,
|
|
3976
4245
|
SELECTOR_AREA_MIN_Y: o,
|
|
3977
4246
|
SELECTOR_AREA_MAX_Y: r,
|
|
3978
|
-
SELECTOR_AREA_MAX_X_OFFSET:
|
|
3979
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
3980
|
-
} = this.ctx.config, h = i, d = s || this.ctx.maxColIndex -
|
|
3981
|
-
this.setSelector(
|
|
4247
|
+
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
4248
|
+
SELECTOR_AREA_MAX_Y_OFFSET: l
|
|
4249
|
+
} = this.ctx.config, h = i, d = s || this.ctx.maxColIndex - a, f = o, u = r || this.ctx.maxRowIndex - l, x = [h, d], w = [f, u];
|
|
4250
|
+
this.setSelector(x, w);
|
|
3982
4251
|
}
|
|
3983
4252
|
}
|
|
3984
4253
|
selectRows(t, e = !0) {
|
|
3985
4254
|
if (this.ctx.config.ENABLE_SELECTOR_SINGLE || !this.ctx.config.ENABLE_SELECTOR_ALL_COLS || this.ctx.autofillMove || this.ctx.editing)
|
|
3986
4255
|
return;
|
|
3987
|
-
const { SELECTOR_AREA_MIN_X: i, SELECTOR_AREA_MAX_X: s, SELECTOR_AREA_MAX_X_OFFSET: o } = this.ctx.config, r = s || this.ctx.maxColIndex - o,
|
|
4256
|
+
const { SELECTOR_AREA_MIN_X: i, SELECTOR_AREA_MAX_X: s, SELECTOR_AREA_MAX_X_OFFSET: o } = this.ctx.config, r = s || this.ctx.maxColIndex - o, a = i;
|
|
3988
4257
|
if (e) {
|
|
3989
4258
|
this.ctx.setFocusCell(t);
|
|
3990
|
-
const
|
|
3991
|
-
this.setSelector(
|
|
4259
|
+
const l = [a, r], h = [t.rowIndex, t.rowIndex];
|
|
4260
|
+
this.setSelector(l, h);
|
|
3992
4261
|
}
|
|
3993
4262
|
if (this.ctx.focusCell && this.ctx.mousedown) {
|
|
3994
|
-
const { rowIndex:
|
|
3995
|
-
if (t.rowIndex >=
|
|
3996
|
-
const h = [
|
|
4263
|
+
const { rowIndex: l } = this.ctx.focusCell;
|
|
4264
|
+
if (t.rowIndex >= l) {
|
|
4265
|
+
const h = [a, r], d = [l, t.rowIndex];
|
|
3997
4266
|
this.setSelector(h, d);
|
|
3998
4267
|
} else {
|
|
3999
|
-
const h = [
|
|
4268
|
+
const h = [a, r], d = [t.rowIndex, l];
|
|
4000
4269
|
this.setSelector(h, d);
|
|
4001
4270
|
}
|
|
4002
4271
|
}
|
|
@@ -4006,7 +4275,7 @@ class Re {
|
|
|
4006
4275
|
return;
|
|
4007
4276
|
const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
|
|
4008
4277
|
if (t && e && i) {
|
|
4009
|
-
const { rowIndex: s, colIndex: o } = e, r = Math.min(i.colIndex, o),
|
|
4278
|
+
const { rowIndex: s, colIndex: o } = e, r = Math.min(i.colIndex, o), a = Math.max(i.colIndex, o), l = Math.min(i.rowIndex, s), h = Math.max(i.rowIndex, s), d = [r, a], f = [l, h];
|
|
4010
4279
|
this.setSelector(d, f);
|
|
4011
4280
|
}
|
|
4012
4281
|
}
|
|
@@ -4016,8 +4285,8 @@ class Re {
|
|
|
4016
4285
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
4017
4286
|
if (this.ctx.config.ENABLE_SELECTOR_SINGLE)
|
|
4018
4287
|
return;
|
|
4019
|
-
const { colIndex: s, rowIndex: o } = i, { colIndex: r, rowIndex:
|
|
4020
|
-
this.setSelector(
|
|
4288
|
+
const { colIndex: s, rowIndex: o } = i, { colIndex: r, rowIndex: a } = e, l = Math.min(r, s), h = Math.max(r, s), d = Math.min(a, o), f = Math.max(a, o), u = [l, h], x = [d, f];
|
|
4289
|
+
this.setSelector(u, x);
|
|
4021
4290
|
} else {
|
|
4022
4291
|
this.ctx.emit("cellSelectedClick", e);
|
|
4023
4292
|
const s = [e.colIndex, e.colIndex], o = [e.rowIndex, e.rowIndex];
|
|
@@ -4059,17 +4328,17 @@ class Re {
|
|
|
4059
4328
|
}
|
|
4060
4329
|
const { BEFORE_COPY_METHOD: s } = this.ctx.config;
|
|
4061
4330
|
if (typeof s == "function") {
|
|
4062
|
-
const
|
|
4331
|
+
const a = s({
|
|
4063
4332
|
focusCell: this.ctx.focusCell,
|
|
4064
4333
|
data: t,
|
|
4065
4334
|
xArr: e,
|
|
4066
4335
|
yArr: i
|
|
4067
4336
|
});
|
|
4068
|
-
if (!
|
|
4337
|
+
if (!a)
|
|
4069
4338
|
return;
|
|
4070
|
-
t =
|
|
4339
|
+
t = a.data;
|
|
4071
4340
|
}
|
|
4072
|
-
const o =
|
|
4341
|
+
const o = ae(t);
|
|
4073
4342
|
navigator.clipboard ? navigator.clipboard.writeText(o).then(() => {
|
|
4074
4343
|
this.ctx.selector.xArrCopy = this.ctx.selector.xArr.slice(), this.ctx.selector.yArrCopy = this.ctx.selector.yArr.slice(), this.ctx.emit("copyChange", {
|
|
4075
4344
|
xArr: this.ctx.selector.xArrCopy,
|
|
@@ -4081,14 +4350,14 @@ class Re {
|
|
|
4081
4350
|
clearSelectedData(t, e, i = !1, s = null) {
|
|
4082
4351
|
let o = [];
|
|
4083
4352
|
const r = /* @__PURE__ */ new Set();
|
|
4084
|
-
for (let
|
|
4353
|
+
for (let l = 0; l <= e[1] - e[0]; l++)
|
|
4085
4354
|
for (let h = 0; h <= t[1] - t[0]; h++) {
|
|
4086
|
-
const d =
|
|
4087
|
-
if (
|
|
4088
|
-
const { rowKey:
|
|
4089
|
-
this.ctx.database.getReadonly(
|
|
4090
|
-
rowKey:
|
|
4091
|
-
key:
|
|
4355
|
+
const d = l + e[0], f = h + t[0], u = this.ctx.database.getItemValueForRowIndexAndColIndex(d, f);
|
|
4356
|
+
if (u) {
|
|
4357
|
+
const { rowKey: x, key: w } = u;
|
|
4358
|
+
this.ctx.database.getReadonly(x, w) || (r.add(x), o.push({
|
|
4359
|
+
rowKey: x,
|
|
4360
|
+
key: w,
|
|
4092
4361
|
value: s,
|
|
4093
4362
|
row: {}
|
|
4094
4363
|
//内部有设置
|
|
@@ -4100,10 +4369,10 @@ class Re {
|
|
|
4100
4369
|
if (i)
|
|
4101
4370
|
return o;
|
|
4102
4371
|
this.ctx.database.batchSetItemValue(o, !0);
|
|
4103
|
-
let
|
|
4104
|
-
return r.forEach((
|
|
4105
|
-
|
|
4106
|
-
}), this.ctx.emit("clearSelectedDataChange", o,
|
|
4372
|
+
let a = [];
|
|
4373
|
+
return r.forEach((l) => {
|
|
4374
|
+
a.push(this.ctx.database.getRowDataItemForRowKey(l));
|
|
4375
|
+
}), this.ctx.emit("clearSelectedDataChange", o, a), o;
|
|
4107
4376
|
}
|
|
4108
4377
|
paste() {
|
|
4109
4378
|
if (!navigator.clipboard) {
|
|
@@ -4115,18 +4384,18 @@ class Re {
|
|
|
4115
4384
|
const e = this.ctx.selector.yArr[0], i = this.ctx.selector.xArr[0], s = /* @__PURE__ */ new Set();
|
|
4116
4385
|
navigator.clipboard.readText().then(async (o) => {
|
|
4117
4386
|
let r = ne(o);
|
|
4118
|
-
const
|
|
4119
|
-
(
|
|
4387
|
+
const a = [i, i + r[0].length - 1], l = [e, e + r.length - 1], [h, d] = l, [f, u] = a, x = d - this.ctx.maxRowIndex, w = u - this.ctx.maxColIndex;
|
|
4388
|
+
(x > 0 || w > 0) && this.ctx.emit("onPastedDataOverflow", {
|
|
4120
4389
|
maxY: d,
|
|
4121
|
-
maxX:
|
|
4390
|
+
maxX: u,
|
|
4122
4391
|
minY: h,
|
|
4123
4392
|
minX: f,
|
|
4124
|
-
overflowRowCount:
|
|
4125
|
-
overflowColCount:
|
|
4393
|
+
overflowRowCount: x,
|
|
4394
|
+
overflowColCount: w,
|
|
4126
4395
|
textArr: r
|
|
4127
4396
|
});
|
|
4128
|
-
const
|
|
4129
|
-
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(
|
|
4397
|
+
const E = r.length === 1 && r[0].length === 1;
|
|
4398
|
+
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a, l) && !E) {
|
|
4130
4399
|
const m = {
|
|
4131
4400
|
code: "ERR_MERGED_CELLS_PASTE",
|
|
4132
4401
|
message: "Merged cells cannot span paste data"
|
|
@@ -4134,20 +4403,20 @@ class Re {
|
|
|
4134
4403
|
this.ctx.hasEvent("error") ? this.ctx.emit("error", m) : alert(m.message);
|
|
4135
4404
|
return;
|
|
4136
4405
|
}
|
|
4137
|
-
let
|
|
4406
|
+
let g = [];
|
|
4138
4407
|
for (let m = 0; m <= r.length - 1; m++) {
|
|
4139
|
-
const
|
|
4140
|
-
for (let C = 0; C <=
|
|
4141
|
-
const I = m + e, _ = C + i,
|
|
4408
|
+
const b = r[m].length;
|
|
4409
|
+
for (let C = 0; C <= b - 1; C++) {
|
|
4410
|
+
const I = m + e, _ = C + i, T = r[m][C], v = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
4142
4411
|
I,
|
|
4143
4412
|
_
|
|
4144
4413
|
);
|
|
4145
4414
|
if (v) {
|
|
4146
|
-
const { rowKey:
|
|
4147
|
-
this.ctx.database.getReadonly(
|
|
4148
|
-
rowKey:
|
|
4149
|
-
key:
|
|
4150
|
-
value:
|
|
4415
|
+
const { rowKey: R, key: S } = v;
|
|
4416
|
+
this.ctx.database.getReadonly(R, S) || (s.add(R), g.push({
|
|
4417
|
+
rowKey: R,
|
|
4418
|
+
key: S,
|
|
4419
|
+
value: T,
|
|
4151
4420
|
row: {}
|
|
4152
4421
|
//内部有设置
|
|
4153
4422
|
}));
|
|
@@ -4160,30 +4429,30 @@ class Re {
|
|
|
4160
4429
|
this.ctx.selector.yArrCopy,
|
|
4161
4430
|
!0
|
|
4162
4431
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
4163
|
-
),
|
|
4432
|
+
), b = g.map((C) => `${C.rowKey}-${C.key}`);
|
|
4164
4433
|
m.forEach((C) => {
|
|
4165
|
-
|
|
4434
|
+
b.includes(`${C.rowKey}-${C.key}`) || g.unshift(C);
|
|
4166
4435
|
}), this.isCut = !1;
|
|
4167
4436
|
}
|
|
4168
|
-
if (!
|
|
4437
|
+
if (!g.length)
|
|
4169
4438
|
return;
|
|
4170
|
-
const { BEFORE_PASTE_DATA_METHOD:
|
|
4171
|
-
if (typeof
|
|
4172
|
-
const m =
|
|
4439
|
+
const { BEFORE_PASTE_DATA_METHOD: p } = this.ctx.config;
|
|
4440
|
+
if (typeof p == "function") {
|
|
4441
|
+
const m = p, b = g.map((C) => ({
|
|
4173
4442
|
rowKey: C.rowKey,
|
|
4174
4443
|
key: C.key,
|
|
4175
4444
|
value: C.value,
|
|
4176
4445
|
oldValue: this.ctx.database.getItemValue(C.rowKey, C.key),
|
|
4177
4446
|
row: this.ctx.database.getRowDataItemForRowKey(C.rowKey)
|
|
4178
4447
|
}));
|
|
4179
|
-
if (
|
|
4448
|
+
if (g = await m(b, a, l, r), g && !g.length)
|
|
4180
4449
|
return;
|
|
4181
4450
|
}
|
|
4182
|
-
this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(
|
|
4451
|
+
this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(g, !0);
|
|
4183
4452
|
let y = [];
|
|
4184
4453
|
s.forEach((m) => {
|
|
4185
4454
|
y.push(this.ctx.database.getRowDataItemForRowKey(m));
|
|
4186
|
-
}), this.ctx.emit("pasteChange",
|
|
4455
|
+
}), this.ctx.emit("pasteChange", g, y);
|
|
4187
4456
|
}).catch((o) => {
|
|
4188
4457
|
console.error("Failed to get the clipboard content:", o);
|
|
4189
4458
|
});
|
|
@@ -4199,7 +4468,7 @@ class Re {
|
|
|
4199
4468
|
if (!e)
|
|
4200
4469
|
return;
|
|
4201
4470
|
let { colIndex: i = 0, rowIndex: s = 0 } = e;
|
|
4202
|
-
const o = 0, r = 0,
|
|
4471
|
+
const o = 0, r = 0, a = this.ctx.maxColIndex, l = this.ctx.maxRowIndex;
|
|
4203
4472
|
switch (t) {
|
|
4204
4473
|
case "LEFT":
|
|
4205
4474
|
i > o && i--;
|
|
@@ -4208,10 +4477,10 @@ class Re {
|
|
|
4208
4477
|
s > r && s--;
|
|
4209
4478
|
break;
|
|
4210
4479
|
case "RIGHT":
|
|
4211
|
-
i <
|
|
4480
|
+
i < a && i++;
|
|
4212
4481
|
break;
|
|
4213
4482
|
case "BOTTOM":
|
|
4214
|
-
s <
|
|
4483
|
+
s < l && s++;
|
|
4215
4484
|
break;
|
|
4216
4485
|
}
|
|
4217
4486
|
const h = [i, i], d = [s, s], f = this.getCell(s, i);
|
|
@@ -4227,10 +4496,10 @@ class Re {
|
|
|
4227
4496
|
SELECTOR_AREA_MAX_X: s,
|
|
4228
4497
|
SELECTOR_AREA_MIN_Y: o,
|
|
4229
4498
|
SELECTOR_AREA_MAX_Y: r,
|
|
4230
|
-
SELECTOR_AREA_MAX_X_OFFSET:
|
|
4231
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
4232
|
-
} = this.ctx.config, h = i, d = s || this.ctx.maxColIndex -
|
|
4233
|
-
return !(e < h || e > d || t < f || t >
|
|
4499
|
+
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
4500
|
+
SELECTOR_AREA_MAX_Y_OFFSET: l
|
|
4501
|
+
} = this.ctx.config, h = i, d = s || this.ctx.maxColIndex - a, f = o, u = r || this.ctx.maxRowIndex - l;
|
|
4502
|
+
return !(e < h || e > d || t < f || t > u);
|
|
4234
4503
|
}
|
|
4235
4504
|
/**
|
|
4236
4505
|
* 调整滚动条位置,让到达边界时自动滚动
|
|
@@ -4240,19 +4509,19 @@ class Re {
|
|
|
4240
4509
|
let s = "", o = "";
|
|
4241
4510
|
if (e < 0 ? s = "left" : e > this.ctx.body.visibleWidth && (s = "right"), i < this.ctx.header.visibleHeight ? o = "top" : i > this.ctx.header.visibleHeight + this.ctx.body.visibleHeight && (o = "bottom"), s && this.adjustPositionX !== s) {
|
|
4242
4511
|
this.adjustPositionX = s;
|
|
4243
|
-
let
|
|
4512
|
+
let a = 10 * (s === "left" ? -1 : 1);
|
|
4244
4513
|
this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
|
|
4245
|
-
|
|
4246
|
-
const { scrollX:
|
|
4514
|
+
a *= 1.5;
|
|
4515
|
+
const { scrollX: l } = this.ctx, h = l + a;
|
|
4247
4516
|
(h < 0 || h > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(h);
|
|
4248
4517
|
}, 100);
|
|
4249
4518
|
}
|
|
4250
4519
|
if (o && this.adjustPositionY !== o) {
|
|
4251
4520
|
this.adjustPositionY = o;
|
|
4252
|
-
let
|
|
4521
|
+
let a = 10 * (o === "top" ? -1 : 1);
|
|
4253
4522
|
this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
|
|
4254
|
-
|
|
4255
|
-
const { scrollY:
|
|
4523
|
+
a *= 1.5;
|
|
4524
|
+
const { scrollY: l } = this.ctx, h = l + a;
|
|
4256
4525
|
(h < 0 || h > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(h);
|
|
4257
4526
|
}, 100);
|
|
4258
4527
|
}
|
|
@@ -4268,29 +4537,29 @@ class Re {
|
|
|
4268
4537
|
fixedRightWidth: s,
|
|
4269
4538
|
fixedLeftWidth: o,
|
|
4270
4539
|
header: r,
|
|
4271
|
-
footer:
|
|
4272
|
-
body:
|
|
4540
|
+
footer: a,
|
|
4541
|
+
body: l,
|
|
4273
4542
|
scrollX: h,
|
|
4274
4543
|
scrollY: d,
|
|
4275
|
-
config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED:
|
|
4544
|
+
config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED: u, FOOTER_POSITION: x, ENABLE_MERGE_CELL_LINK: w }
|
|
4276
4545
|
} = this.ctx;
|
|
4277
4546
|
if (!i)
|
|
4278
4547
|
return;
|
|
4279
|
-
|
|
4280
|
-
const { drawX:
|
|
4281
|
-
let I = r.height -
|
|
4282
|
-
_ >
|
|
4283
|
-
let
|
|
4284
|
-
|
|
4285
|
-
const v =
|
|
4286
|
-
let
|
|
4287
|
-
C > 0 && !m ?
|
|
4548
|
+
w && this.ctx.onlyMergeCell && i.updateSpanInfo();
|
|
4549
|
+
const { drawX: E, drawY: g, width: p, height: y, fixed: m } = i, b = o - E + 1, C = i.drawX + p - (e - s) + 1;
|
|
4550
|
+
let I = r.height - g, _ = y;
|
|
4551
|
+
_ > l.visibleHeight && (_ = l.visibleHeight);
|
|
4552
|
+
let T = 0;
|
|
4553
|
+
u && (x === "top" ? I = r.height + a.height - g : T = a.visibleHeight);
|
|
4554
|
+
const v = g + _ - (t - T - f);
|
|
4555
|
+
let R = h, S = d;
|
|
4556
|
+
C > 0 && !m ? R = Math.floor(h + C) : b > 0 && !m && (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
4557
|
}
|
|
4289
4558
|
destroy() {
|
|
4290
4559
|
this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
|
|
4291
4560
|
}
|
|
4292
4561
|
}
|
|
4293
|
-
class
|
|
4562
|
+
class Ie {
|
|
4294
4563
|
constructor(t) {
|
|
4295
4564
|
n(this, "ctx");
|
|
4296
4565
|
n(this, "maxColRowCell");
|
|
@@ -4300,11 +4569,11 @@ class ve {
|
|
|
4300
4569
|
this.ctx.on("mousemove", (t) => {
|
|
4301
4570
|
if (this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default"), this.ctx.editing || !this.ctx.focusCell || !this.maxColRowCell)
|
|
4302
4571
|
return;
|
|
4303
|
-
const { offsetX: e, offsetY: i } = this.ctx.getOffset(t), { colIndex: s, rowIndex: o, drawX: r, drawY:
|
|
4304
|
-
e >
|
|
4572
|
+
const { offsetX: e, offsetY: i } = this.ctx.getOffset(t), { colIndex: s, rowIndex: o, drawX: r, drawY: a, width: l, height: h } = this.maxColRowCell, d = 6, f = s === this.ctx.maxColIndex || o === this.ctx.maxRowIndex ? 0 : 2, u = r + l - d + f, x = a + h - d + f;
|
|
4573
|
+
e > u && i > x && e < u + d && i < x + d && (this.ctx.stageElement.style.cursor = "crosshair");
|
|
4305
4574
|
}), this.ctx.on("cellMouseenter", (t) => {
|
|
4306
|
-
const { xArr: e, yArr: i } = this.ctx.selector, s = e[1], o = i[1], { colIndex: r, rowIndex:
|
|
4307
|
-
this.ctx.config.ENABLE_AUTOFILL && r === s &&
|
|
4575
|
+
const { xArr: e, yArr: i } = this.ctx.selector, s = e[1], o = i[1], { colIndex: r, rowIndex: a } = t;
|
|
4576
|
+
this.ctx.config.ENABLE_AUTOFILL && r === s && a === o && (this.maxColRowCell = t), this.mouseenter(t);
|
|
4308
4577
|
}), this.ctx.on("mousedown", () => {
|
|
4309
4578
|
this.ctx.stageElement.style.cursor === "crosshair" && this.setMousedown();
|
|
4310
4579
|
}), this.ctx.on("mouseup", () => {
|
|
@@ -4331,40 +4600,40 @@ class ve {
|
|
|
4331
4600
|
const { ENABLE_AUTOFILL: i, ENABLE_SELECTOR_SPAN_COL: s, ENABLE_SELECTOR_SPAN_ROW: o } = this.ctx.config;
|
|
4332
4601
|
if (!i)
|
|
4333
4602
|
return;
|
|
4334
|
-
let r = t,
|
|
4603
|
+
let r = t, a = e;
|
|
4335
4604
|
if (!o) {
|
|
4336
|
-
const [
|
|
4337
|
-
|
|
4605
|
+
const [l] = a;
|
|
4606
|
+
a = [l, l];
|
|
4338
4607
|
}
|
|
4339
4608
|
if (!s) {
|
|
4340
|
-
const [
|
|
4341
|
-
r = [
|
|
4609
|
+
const [l] = r;
|
|
4610
|
+
r = [l, l];
|
|
4342
4611
|
}
|
|
4343
|
-
if (JSON.stringify(this.ctx.autofill.xArr) !== JSON.stringify(r) || JSON.stringify(this.ctx.autofill.yArr) !== JSON.stringify(
|
|
4612
|
+
if (JSON.stringify(this.ctx.autofill.xArr) !== JSON.stringify(r) || JSON.stringify(this.ctx.autofill.yArr) !== JSON.stringify(a)) {
|
|
4344
4613
|
const {
|
|
4345
|
-
SELECTOR_AREA_MIN_X:
|
|
4614
|
+
SELECTOR_AREA_MIN_X: l,
|
|
4346
4615
|
SELECTOR_AREA_MAX_X: h,
|
|
4347
4616
|
SELECTOR_AREA_MIN_Y: d,
|
|
4348
4617
|
SELECTOR_AREA_MAX_Y: f,
|
|
4349
|
-
SELECTOR_AREA_MAX_X_OFFSET:
|
|
4350
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
4351
|
-
} = this.ctx.config,
|
|
4352
|
-
let [y, m] = r, [
|
|
4353
|
-
if (y <
|
|
4618
|
+
SELECTOR_AREA_MAX_X_OFFSET: u,
|
|
4619
|
+
SELECTOR_AREA_MAX_Y_OFFSET: x
|
|
4620
|
+
} = this.ctx.config, w = l, E = h || this.ctx.maxColIndex - u, g = d, p = f || this.ctx.maxRowIndex - x;
|
|
4621
|
+
let [y, m] = r, [b, C] = a;
|
|
4622
|
+
if (y < w || b < g)
|
|
4354
4623
|
return;
|
|
4355
|
-
r = [Math.max(
|
|
4624
|
+
r = [Math.max(w, y), Math.min(E, m)], a = [Math.max(g, b), Math.min(p, C)];
|
|
4356
4625
|
const { BEFORE_SET_AUTOFILL_METHOD: I } = this.ctx.config;
|
|
4357
4626
|
if (typeof I == "function") {
|
|
4358
|
-
const
|
|
4627
|
+
const T = I({
|
|
4359
4628
|
focusCell: this.ctx.focusCell,
|
|
4360
4629
|
xArr: r,
|
|
4361
|
-
yArr:
|
|
4630
|
+
yArr: a
|
|
4362
4631
|
});
|
|
4363
|
-
if (!
|
|
4632
|
+
if (!T)
|
|
4364
4633
|
return;
|
|
4365
|
-
r =
|
|
4634
|
+
r = T.xArr, a = T.yArr;
|
|
4366
4635
|
}
|
|
4367
|
-
this.ctx.autofill.xArr = r, this.ctx.autofill.yArr =
|
|
4636
|
+
this.ctx.autofill.xArr = r, this.ctx.autofill.yArr = a, this.ctx.emit("setAutofill", this.ctx.autofill), this.ctx.emit("draw");
|
|
4368
4637
|
}
|
|
4369
4638
|
}
|
|
4370
4639
|
/**
|
|
@@ -4372,30 +4641,30 @@ class ve {
|
|
|
4372
4641
|
*/
|
|
4373
4642
|
async autofillData() {
|
|
4374
4643
|
const t = /* @__PURE__ */ new Set(), e = this.ctx.getSelectedData(), i = /* @__PURE__ */ new Map();
|
|
4375
|
-
for (let
|
|
4376
|
-
for (let
|
|
4377
|
-
const
|
|
4378
|
-
i.set(`${
|
|
4644
|
+
for (let x = 0; x <= e.yArr[1] - e.yArr[0]; x++)
|
|
4645
|
+
for (let w = 0; w <= e.xArr[1] - e.xArr[0]; w++) {
|
|
4646
|
+
const E = x + e.yArr[0], g = w + e.xArr[0];
|
|
4647
|
+
i.set(`${E}-${g}`, !0);
|
|
4379
4648
|
}
|
|
4380
|
-
const { value: s } = e, o = s[0].length, r = s.length,
|
|
4381
|
-
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(
|
|
4382
|
-
const
|
|
4649
|
+
const { value: s } = e, o = s[0].length, r = s.length, a = this.ctx.autofill.xArr, l = this.ctx.autofill.yArr, h = o === 1 && r === 1;
|
|
4650
|
+
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a, l) && !h) {
|
|
4651
|
+
const x = {
|
|
4383
4652
|
code: "ERR_MERGED_CELLS_AUTOFILL",
|
|
4384
4653
|
message: "Merged cells cannot span autofill data"
|
|
4385
4654
|
};
|
|
4386
|
-
this.ctx.hasEvent("error") ? this.ctx.emit("error",
|
|
4655
|
+
this.ctx.hasEvent("error") ? this.ctx.emit("error", x) : alert(x.message);
|
|
4387
4656
|
return;
|
|
4388
4657
|
}
|
|
4389
4658
|
let d = [];
|
|
4390
|
-
for (let
|
|
4391
|
-
for (let
|
|
4392
|
-
const
|
|
4659
|
+
for (let x = 0; x <= l[1] - l[0]; x++)
|
|
4660
|
+
for (let w = 0; w <= a[1] - a[0]; w++) {
|
|
4661
|
+
const E = w + a[0], g = x + l[0], p = s[x % r][w % o], y = this.ctx.database.getItemValueForRowIndexAndColIndex(g, E), m = `${g}-${E}`;
|
|
4393
4662
|
if (y && !i.has(m)) {
|
|
4394
|
-
const { rowKey:
|
|
4395
|
-
this.ctx.database.getReadonly(
|
|
4396
|
-
rowKey:
|
|
4663
|
+
const { rowKey: b, key: C } = y;
|
|
4664
|
+
this.ctx.database.getReadonly(b, C) || (t.add(b), d.push({
|
|
4665
|
+
rowKey: b,
|
|
4397
4666
|
key: C,
|
|
4398
|
-
value:
|
|
4667
|
+
value: p,
|
|
4399
4668
|
row: {}
|
|
4400
4669
|
}));
|
|
4401
4670
|
}
|
|
@@ -4405,38 +4674,38 @@ class ve {
|
|
|
4405
4674
|
this.ctx.selector.xArr = this.ctx.autofill.xArr, this.ctx.selector.yArr = this.ctx.autofill.yArr;
|
|
4406
4675
|
const { BEFORE_AUTOFILL_DATA_METHOD: f } = this.ctx.config;
|
|
4407
4676
|
if (typeof f == "function") {
|
|
4408
|
-
const
|
|
4409
|
-
rowKey:
|
|
4410
|
-
key:
|
|
4411
|
-
value:
|
|
4412
|
-
oldValue: this.ctx.database.getItemValue(
|
|
4413
|
-
row: this.ctx.database.getRowDataItemForRowKey(
|
|
4677
|
+
const x = f, w = d.map((E) => ({
|
|
4678
|
+
rowKey: E.rowKey,
|
|
4679
|
+
key: E.key,
|
|
4680
|
+
value: E.value,
|
|
4681
|
+
oldValue: this.ctx.database.getItemValue(E.rowKey, E.key),
|
|
4682
|
+
row: this.ctx.database.getRowDataItemForRowKey(E.rowKey)
|
|
4414
4683
|
}));
|
|
4415
|
-
if (d = await
|
|
4684
|
+
if (d = await x(w, a, l), d && !d.length)
|
|
4416
4685
|
return;
|
|
4417
4686
|
}
|
|
4418
4687
|
this.ctx.batchSetItemValueByEditor(d, !0);
|
|
4419
|
-
let
|
|
4420
|
-
t.forEach((
|
|
4421
|
-
|
|
4422
|
-
}), this.ctx.emit("autofillChange", d,
|
|
4688
|
+
let u = [];
|
|
4689
|
+
t.forEach((x) => {
|
|
4690
|
+
u.push(this.ctx.database.getRowDataItemForRowKey(x));
|
|
4691
|
+
}), this.ctx.emit("autofillChange", d, u);
|
|
4423
4692
|
}
|
|
4424
4693
|
mouseenter(t) {
|
|
4425
4694
|
if (["index", "selection", "index-selection"].includes(t.type))
|
|
4426
4695
|
return;
|
|
4427
4696
|
const { selector: e, autofill: i } = this.ctx;
|
|
4428
4697
|
if (this.ctx.mousedown && e.enable && i.enable) {
|
|
4429
|
-
const { rowIndex: s, colIndex: o } = t, r = e.xArr.slice(),
|
|
4430
|
-
s >= e.yArr[0] && s <= e.yArr[1] ? o > e.xArr[1] ? r.splice(1, 1, o) : o < e.xArr[0] && r.splice(0, 1, o) : s > e.yArr[1] ?
|
|
4698
|
+
const { rowIndex: s, colIndex: o } = t, r = e.xArr.slice(), a = e.yArr.slice();
|
|
4699
|
+
s >= e.yArr[0] && s <= e.yArr[1] ? o > e.xArr[1] ? r.splice(1, 1, o) : o < e.xArr[0] && r.splice(0, 1, o) : s > e.yArr[1] ? a.splice(1, 1, s) : s < e.yArr[0] && a.splice(0, 1, s), this.setAutofill(r, a);
|
|
4431
4700
|
}
|
|
4432
4701
|
}
|
|
4433
4702
|
destroy() {
|
|
4434
4703
|
}
|
|
4435
4704
|
}
|
|
4436
|
-
const
|
|
4705
|
+
const q = Math.min, G = Math.max, st = Math.round, B = (c) => ({
|
|
4437
4706
|
x: c,
|
|
4438
4707
|
y: c
|
|
4439
|
-
}),
|
|
4708
|
+
}), ve = {
|
|
4440
4709
|
left: "right",
|
|
4441
4710
|
right: "left",
|
|
4442
4711
|
bottom: "top",
|
|
@@ -4445,64 +4714,64 @@ const Z = Math.min, $ = Math.max, it = Math.round, K = (c) => ({
|
|
|
4445
4714
|
start: "end",
|
|
4446
4715
|
end: "start"
|
|
4447
4716
|
};
|
|
4448
|
-
function
|
|
4449
|
-
return
|
|
4717
|
+
function dt(c, t, e) {
|
|
4718
|
+
return G(c, q(t, e));
|
|
4450
4719
|
}
|
|
4451
|
-
function
|
|
4720
|
+
function Q(c, t) {
|
|
4452
4721
|
return typeof c == "function" ? c(t) : c;
|
|
4453
4722
|
}
|
|
4454
4723
|
function z(c) {
|
|
4455
4724
|
return c.split("-")[0];
|
|
4456
4725
|
}
|
|
4457
|
-
function
|
|
4726
|
+
function tt(c) {
|
|
4458
4727
|
return c.split("-")[1];
|
|
4459
4728
|
}
|
|
4460
|
-
function
|
|
4729
|
+
function Bt(c) {
|
|
4461
4730
|
return c === "x" ? "y" : "x";
|
|
4462
4731
|
}
|
|
4463
|
-
function
|
|
4732
|
+
function ut(c) {
|
|
4464
4733
|
return c === "y" ? "height" : "width";
|
|
4465
4734
|
}
|
|
4466
|
-
const
|
|
4735
|
+
const Se = /* @__PURE__ */ new Set(["top", "bottom"]);
|
|
4467
4736
|
function V(c) {
|
|
4468
|
-
return
|
|
4737
|
+
return Se.has(z(c)) ? "y" : "x";
|
|
4469
4738
|
}
|
|
4470
|
-
function
|
|
4471
|
-
return
|
|
4739
|
+
function gt(c) {
|
|
4740
|
+
return Bt(V(c));
|
|
4472
4741
|
}
|
|
4473
|
-
function
|
|
4742
|
+
function Te(c, t, e) {
|
|
4474
4743
|
e === void 0 && (e = !1);
|
|
4475
|
-
const i =
|
|
4744
|
+
const i = tt(c), s = gt(c), o = ut(s);
|
|
4476
4745
|
let r = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
|
|
4477
|
-
return t.reference[o] > t.floating[o] && (r =
|
|
4746
|
+
return t.reference[o] > t.floating[o] && (r = ot(r)), [r, ot(r)];
|
|
4478
4747
|
}
|
|
4479
|
-
function
|
|
4480
|
-
const t =
|
|
4481
|
-
return [
|
|
4748
|
+
function Oe(c) {
|
|
4749
|
+
const t = ot(c);
|
|
4750
|
+
return [ft(c), t, ft(t)];
|
|
4482
4751
|
}
|
|
4483
|
-
function
|
|
4752
|
+
function ft(c) {
|
|
4484
4753
|
return c.replace(/start|end/g, (t) => _e[t]);
|
|
4485
4754
|
}
|
|
4486
|
-
const
|
|
4755
|
+
const It = ["left", "right"], vt = ["right", "left"], Le = ["top", "bottom"], Ae = ["bottom", "top"];
|
|
4487
4756
|
function Me(c, t, e) {
|
|
4488
4757
|
switch (c) {
|
|
4489
4758
|
case "top":
|
|
4490
4759
|
case "bottom":
|
|
4491
|
-
return e ? t ? vt :
|
|
4760
|
+
return e ? t ? vt : It : t ? It : vt;
|
|
4492
4761
|
case "left":
|
|
4493
4762
|
case "right":
|
|
4494
|
-
return t ?
|
|
4763
|
+
return t ? Le : Ae;
|
|
4495
4764
|
default:
|
|
4496
4765
|
return [];
|
|
4497
4766
|
}
|
|
4498
4767
|
}
|
|
4499
4768
|
function He(c, t, e, i) {
|
|
4500
|
-
const s =
|
|
4769
|
+
const s = tt(c);
|
|
4501
4770
|
let o = Me(z(c), e === "start", i);
|
|
4502
|
-
return s && (o = o.map((r) => r + "-" + s), t && (o = o.concat(o.map(
|
|
4771
|
+
return s && (o = o.map((r) => r + "-" + s), t && (o = o.concat(o.map(ft)))), o;
|
|
4503
4772
|
}
|
|
4504
|
-
function
|
|
4505
|
-
return c.replace(/left|right|bottom|top/g, (t) =>
|
|
4773
|
+
function ot(c) {
|
|
4774
|
+
return c.replace(/left|right|bottom|top/g, (t) => ve[t]);
|
|
4506
4775
|
}
|
|
4507
4776
|
function De(c) {
|
|
4508
4777
|
return {
|
|
@@ -4513,7 +4782,7 @@ function De(c) {
|
|
|
4513
4782
|
...c
|
|
4514
4783
|
};
|
|
4515
4784
|
}
|
|
4516
|
-
function
|
|
4785
|
+
function Kt(c) {
|
|
4517
4786
|
return typeof c != "number" ? De(c) : {
|
|
4518
4787
|
top: c,
|
|
4519
4788
|
right: c,
|
|
@@ -4521,7 +4790,7 @@ function Nt(c) {
|
|
|
4521
4790
|
left: c
|
|
4522
4791
|
};
|
|
4523
4792
|
}
|
|
4524
|
-
function
|
|
4793
|
+
function rt(c) {
|
|
4525
4794
|
const {
|
|
4526
4795
|
x: t,
|
|
4527
4796
|
y: e,
|
|
@@ -4539,53 +4808,53 @@ function ot(c) {
|
|
|
4539
4808
|
y: e
|
|
4540
4809
|
};
|
|
4541
4810
|
}
|
|
4542
|
-
function
|
|
4811
|
+
function _t(c, t, e) {
|
|
4543
4812
|
let {
|
|
4544
4813
|
reference: i,
|
|
4545
4814
|
floating: s
|
|
4546
4815
|
} = c;
|
|
4547
|
-
const o = V(t), r =
|
|
4548
|
-
let
|
|
4549
|
-
switch (
|
|
4816
|
+
const o = V(t), r = gt(t), a = ut(r), l = z(t), h = o === "y", d = i.x + i.width / 2 - s.width / 2, f = i.y + i.height / 2 - s.height / 2, u = i[a] / 2 - s[a] / 2;
|
|
4817
|
+
let x;
|
|
4818
|
+
switch (l) {
|
|
4550
4819
|
case "top":
|
|
4551
|
-
|
|
4820
|
+
x = {
|
|
4552
4821
|
x: d,
|
|
4553
4822
|
y: i.y - s.height
|
|
4554
4823
|
};
|
|
4555
4824
|
break;
|
|
4556
4825
|
case "bottom":
|
|
4557
|
-
|
|
4826
|
+
x = {
|
|
4558
4827
|
x: d,
|
|
4559
4828
|
y: i.y + i.height
|
|
4560
4829
|
};
|
|
4561
4830
|
break;
|
|
4562
4831
|
case "right":
|
|
4563
|
-
|
|
4832
|
+
x = {
|
|
4564
4833
|
x: i.x + i.width,
|
|
4565
4834
|
y: f
|
|
4566
4835
|
};
|
|
4567
4836
|
break;
|
|
4568
4837
|
case "left":
|
|
4569
|
-
|
|
4838
|
+
x = {
|
|
4570
4839
|
x: i.x - s.width,
|
|
4571
4840
|
y: f
|
|
4572
4841
|
};
|
|
4573
4842
|
break;
|
|
4574
4843
|
default:
|
|
4575
|
-
|
|
4844
|
+
x = {
|
|
4576
4845
|
x: i.x,
|
|
4577
4846
|
y: i.y
|
|
4578
4847
|
};
|
|
4579
4848
|
}
|
|
4580
|
-
switch (
|
|
4849
|
+
switch (tt(t)) {
|
|
4581
4850
|
case "start":
|
|
4582
|
-
|
|
4851
|
+
x[r] -= u * (e && h ? -1 : 1);
|
|
4583
4852
|
break;
|
|
4584
4853
|
case "end":
|
|
4585
|
-
|
|
4854
|
+
x[r] += u * (e && h ? -1 : 1);
|
|
4586
4855
|
break;
|
|
4587
4856
|
}
|
|
4588
|
-
return
|
|
4857
|
+
return x;
|
|
4589
4858
|
}
|
|
4590
4859
|
const ke = async (c, t, e) => {
|
|
4591
4860
|
const {
|
|
@@ -4593,7 +4862,7 @@ const ke = async (c, t, e) => {
|
|
|
4593
4862
|
strategy: s = "absolute",
|
|
4594
4863
|
middleware: o = [],
|
|
4595
4864
|
platform: r
|
|
4596
|
-
} = e,
|
|
4865
|
+
} = e, a = o.filter(Boolean), l = await (r.isRTL == null ? void 0 : r.isRTL(t));
|
|
4597
4866
|
let h = await r.getElementRects({
|
|
4598
4867
|
reference: c,
|
|
4599
4868
|
floating: t,
|
|
@@ -4601,23 +4870,23 @@ const ke = async (c, t, e) => {
|
|
|
4601
4870
|
}), {
|
|
4602
4871
|
x: d,
|
|
4603
4872
|
y: f
|
|
4604
|
-
} =
|
|
4605
|
-
for (let
|
|
4873
|
+
} = _t(h, i, l), u = i, x = {}, w = 0;
|
|
4874
|
+
for (let E = 0; E < a.length; E++) {
|
|
4606
4875
|
const {
|
|
4607
|
-
name:
|
|
4608
|
-
fn:
|
|
4609
|
-
} =
|
|
4876
|
+
name: g,
|
|
4877
|
+
fn: p
|
|
4878
|
+
} = a[E], {
|
|
4610
4879
|
x: y,
|
|
4611
4880
|
y: m,
|
|
4612
|
-
data:
|
|
4881
|
+
data: b,
|
|
4613
4882
|
reset: C
|
|
4614
|
-
} = await
|
|
4883
|
+
} = await p({
|
|
4615
4884
|
x: d,
|
|
4616
4885
|
y: f,
|
|
4617
4886
|
initialPlacement: i,
|
|
4618
|
-
placement:
|
|
4887
|
+
placement: u,
|
|
4619
4888
|
strategy: s,
|
|
4620
|
-
middlewareData:
|
|
4889
|
+
middlewareData: x,
|
|
4621
4890
|
rects: h,
|
|
4622
4891
|
platform: r,
|
|
4623
4892
|
elements: {
|
|
@@ -4625,27 +4894,27 @@ const ke = async (c, t, e) => {
|
|
|
4625
4894
|
floating: t
|
|
4626
4895
|
}
|
|
4627
4896
|
});
|
|
4628
|
-
d = y ?? d, f = m ?? f,
|
|
4629
|
-
...
|
|
4630
|
-
[
|
|
4631
|
-
...
|
|
4632
|
-
...
|
|
4897
|
+
d = y ?? d, f = m ?? f, x = {
|
|
4898
|
+
...x,
|
|
4899
|
+
[g]: {
|
|
4900
|
+
...x[g],
|
|
4901
|
+
...b
|
|
4633
4902
|
}
|
|
4634
|
-
}, C &&
|
|
4903
|
+
}, C && w <= 50 && (w++, typeof C == "object" && (C.placement && (u = C.placement), C.rects && (h = C.rects === !0 ? await r.getElementRects({
|
|
4635
4904
|
reference: c,
|
|
4636
4905
|
floating: t,
|
|
4637
4906
|
strategy: s
|
|
4638
4907
|
}) : C.rects), {
|
|
4639
4908
|
x: d,
|
|
4640
4909
|
y: f
|
|
4641
|
-
} =
|
|
4910
|
+
} = _t(h, u, l)), E = -1);
|
|
4642
4911
|
}
|
|
4643
4912
|
return {
|
|
4644
4913
|
x: d,
|
|
4645
4914
|
y: f,
|
|
4646
|
-
placement:
|
|
4915
|
+
placement: u,
|
|
4647
4916
|
strategy: s,
|
|
4648
|
-
middlewareData:
|
|
4917
|
+
middlewareData: x
|
|
4649
4918
|
};
|
|
4650
4919
|
};
|
|
4651
4920
|
async function Yt(c, t) {
|
|
@@ -4656,41 +4925,41 @@ async function Yt(c, t) {
|
|
|
4656
4925
|
y: s,
|
|
4657
4926
|
platform: o,
|
|
4658
4927
|
rects: r,
|
|
4659
|
-
elements:
|
|
4660
|
-
strategy:
|
|
4928
|
+
elements: a,
|
|
4929
|
+
strategy: l
|
|
4661
4930
|
} = c, {
|
|
4662
4931
|
boundary: h = "clippingAncestors",
|
|
4663
4932
|
rootBoundary: d = "viewport",
|
|
4664
4933
|
elementContext: f = "floating",
|
|
4665
|
-
altBoundary:
|
|
4666
|
-
padding:
|
|
4667
|
-
} =
|
|
4668
|
-
element: (e = await (o.isElement == null ? void 0 : o.isElement(
|
|
4934
|
+
altBoundary: u = !1,
|
|
4935
|
+
padding: x = 0
|
|
4936
|
+
} = Q(t, c), w = Kt(x), g = a[u ? f === "floating" ? "reference" : "floating" : f], p = rt(await o.getClippingRect({
|
|
4937
|
+
element: (e = await (o.isElement == null ? void 0 : o.isElement(g))) == null || e ? g : g.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(a.floating)),
|
|
4669
4938
|
boundary: h,
|
|
4670
4939
|
rootBoundary: d,
|
|
4671
|
-
strategy:
|
|
4940
|
+
strategy: l
|
|
4672
4941
|
})), y = f === "floating" ? {
|
|
4673
4942
|
x: i,
|
|
4674
4943
|
y: s,
|
|
4675
4944
|
width: r.floating.width,
|
|
4676
4945
|
height: r.floating.height
|
|
4677
|
-
} : r.reference, m = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(
|
|
4946
|
+
} : r.reference, m = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(a.floating)), b = await (o.isElement == null ? void 0 : o.isElement(m)) ? await (o.getScale == null ? void 0 : o.getScale(m)) || {
|
|
4678
4947
|
x: 1,
|
|
4679
4948
|
y: 1
|
|
4680
4949
|
} : {
|
|
4681
4950
|
x: 1,
|
|
4682
4951
|
y: 1
|
|
4683
|
-
}, C =
|
|
4684
|
-
elements:
|
|
4952
|
+
}, C = rt(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
4953
|
+
elements: a,
|
|
4685
4954
|
rect: y,
|
|
4686
4955
|
offsetParent: m,
|
|
4687
|
-
strategy:
|
|
4956
|
+
strategy: l
|
|
4688
4957
|
}) : y);
|
|
4689
4958
|
return {
|
|
4690
|
-
top: (
|
|
4691
|
-
bottom: (C.bottom -
|
|
4692
|
-
left: (
|
|
4693
|
-
right: (C.right -
|
|
4959
|
+
top: (p.top - C.top + w.top) / b.y,
|
|
4960
|
+
bottom: (C.bottom - p.bottom + w.bottom) / b.y,
|
|
4961
|
+
left: (p.left - C.left + w.left) / b.x,
|
|
4962
|
+
right: (C.right - p.right + w.right) / b.x
|
|
4694
4963
|
};
|
|
4695
4964
|
}
|
|
4696
4965
|
const Xe = (c) => ({
|
|
@@ -4703,26 +4972,26 @@ const Xe = (c) => ({
|
|
|
4703
4972
|
placement: s,
|
|
4704
4973
|
rects: o,
|
|
4705
4974
|
platform: r,
|
|
4706
|
-
elements:
|
|
4707
|
-
middlewareData:
|
|
4975
|
+
elements: a,
|
|
4976
|
+
middlewareData: l
|
|
4708
4977
|
} = t, {
|
|
4709
4978
|
element: h,
|
|
4710
4979
|
padding: d = 0
|
|
4711
|
-
} =
|
|
4980
|
+
} = Q(c, t) || {};
|
|
4712
4981
|
if (h == null)
|
|
4713
4982
|
return {};
|
|
4714
|
-
const f =
|
|
4983
|
+
const f = Kt(d), u = {
|
|
4715
4984
|
x: e,
|
|
4716
4985
|
y: i
|
|
4717
|
-
},
|
|
4986
|
+
}, x = gt(s), w = ut(x), E = await r.getDimensions(h), g = x === "y", p = g ? "top" : "left", y = g ? "bottom" : "right", m = g ? "clientHeight" : "clientWidth", b = o.reference[w] + o.reference[x] - u[x] - o.floating[w], C = u[x] - o.reference[x], I = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(h));
|
|
4718
4987
|
let _ = I ? I[m] : 0;
|
|
4719
|
-
(!_ || !await (r.isElement == null ? void 0 : r.isElement(I))) && (_ =
|
|
4720
|
-
const
|
|
4988
|
+
(!_ || !await (r.isElement == null ? void 0 : r.isElement(I))) && (_ = a.floating[m] || o.floating[w]);
|
|
4989
|
+
const T = b / 2 - C / 2, v = _ / 2 - E[w] / 2 - 1, R = q(f[p], v), S = q(f[y], v), O = R, M = _ - E[w] - S, L = _ / 2 - E[w] / 2 + T, H = dt(O, L, M), Y = !l.arrow && tt(s) != null && L !== H && o.reference[w] / 2 - (L < O ? R : S) - E[w] / 2 < 0, D = Y ? L < O ? L - O : L - M : 0;
|
|
4721
4990
|
return {
|
|
4722
|
-
[
|
|
4991
|
+
[x]: u[x] + D,
|
|
4723
4992
|
data: {
|
|
4724
|
-
[
|
|
4725
|
-
centerOffset:
|
|
4993
|
+
[x]: H,
|
|
4994
|
+
centerOffset: L - H - D,
|
|
4726
4995
|
...Y && {
|
|
4727
4996
|
alignmentOffset: D
|
|
4728
4997
|
}
|
|
@@ -4730,7 +4999,7 @@ const Xe = (c) => ({
|
|
|
4730
4999
|
reset: Y
|
|
4731
5000
|
};
|
|
4732
5001
|
}
|
|
4733
|
-
}),
|
|
5002
|
+
}), Ne = function(c) {
|
|
4734
5003
|
return c === void 0 && (c = {}), {
|
|
4735
5004
|
name: "flip",
|
|
4736
5005
|
options: c,
|
|
@@ -4740,52 +5009,52 @@ const Xe = (c) => ({
|
|
|
4740
5009
|
placement: s,
|
|
4741
5010
|
middlewareData: o,
|
|
4742
5011
|
rects: r,
|
|
4743
|
-
initialPlacement:
|
|
4744
|
-
platform:
|
|
5012
|
+
initialPlacement: a,
|
|
5013
|
+
platform: l,
|
|
4745
5014
|
elements: h
|
|
4746
5015
|
} = t, {
|
|
4747
5016
|
mainAxis: d = !0,
|
|
4748
5017
|
crossAxis: f = !0,
|
|
4749
|
-
fallbackPlacements:
|
|
4750
|
-
fallbackStrategy:
|
|
4751
|
-
fallbackAxisSideDirection:
|
|
4752
|
-
flipAlignment:
|
|
4753
|
-
...
|
|
4754
|
-
} =
|
|
5018
|
+
fallbackPlacements: u,
|
|
5019
|
+
fallbackStrategy: x = "bestFit",
|
|
5020
|
+
fallbackAxisSideDirection: w = "none",
|
|
5021
|
+
flipAlignment: E = !0,
|
|
5022
|
+
...g
|
|
5023
|
+
} = Q(c, t);
|
|
4755
5024
|
if ((e = o.arrow) != null && e.alignmentOffset)
|
|
4756
5025
|
return {};
|
|
4757
|
-
const
|
|
4758
|
-
!
|
|
4759
|
-
const _ = [
|
|
4760
|
-
let
|
|
4761
|
-
if (d && v.push(
|
|
4762
|
-
const
|
|
4763
|
-
v.push(
|
|
5026
|
+
const p = z(s), y = V(a), m = z(a) === a, b = await (l.isRTL == null ? void 0 : l.isRTL(h.floating)), C = u || (m || !E ? [ot(a)] : Oe(a)), I = w !== "none";
|
|
5027
|
+
!u && I && C.push(...He(a, E, w, b));
|
|
5028
|
+
const _ = [a, ...C], T = await Yt(t, g), v = [];
|
|
5029
|
+
let R = ((i = o.flip) == null ? void 0 : i.overflows) || [];
|
|
5030
|
+
if (d && v.push(T[p]), f) {
|
|
5031
|
+
const L = Te(s, r, b);
|
|
5032
|
+
v.push(T[L[0]], T[L[1]]);
|
|
4764
5033
|
}
|
|
4765
|
-
if (
|
|
5034
|
+
if (R = [...R, {
|
|
4766
5035
|
placement: s,
|
|
4767
5036
|
overflows: v
|
|
4768
|
-
}], !v.every((
|
|
4769
|
-
var
|
|
4770
|
-
const
|
|
5037
|
+
}], !v.every((L) => L <= 0)) {
|
|
5038
|
+
var S, O;
|
|
5039
|
+
const L = (((S = o.flip) == null ? void 0 : S.index) || 0) + 1, H = _[L];
|
|
4771
5040
|
if (H && (!(f === "alignment" ? y !== V(H) : !1) || // We leave the current main axis only if every placement on that axis
|
|
4772
5041
|
// overflows the main axis.
|
|
4773
|
-
|
|
5042
|
+
R.every((k) => V(k.placement) === y ? k.overflows[0] > 0 : !0)))
|
|
4774
5043
|
return {
|
|
4775
5044
|
data: {
|
|
4776
|
-
index:
|
|
4777
|
-
overflows:
|
|
5045
|
+
index: L,
|
|
5046
|
+
overflows: R
|
|
4778
5047
|
},
|
|
4779
5048
|
reset: {
|
|
4780
5049
|
placement: H
|
|
4781
5050
|
}
|
|
4782
5051
|
};
|
|
4783
|
-
let Y = (
|
|
5052
|
+
let Y = (O = R.filter((D) => D.overflows[0] <= 0).sort((D, k) => D.overflows[1] - k.overflows[1])[0]) == null ? void 0 : O.placement;
|
|
4784
5053
|
if (!Y)
|
|
4785
|
-
switch (
|
|
5054
|
+
switch (x) {
|
|
4786
5055
|
case "bestFit": {
|
|
4787
5056
|
var M;
|
|
4788
|
-
const D = (M =
|
|
5057
|
+
const D = (M = R.filter((k) => {
|
|
4789
5058
|
if (I) {
|
|
4790
5059
|
const W = V(k.placement);
|
|
4791
5060
|
return W === y || // Create a bias to the `y` side axis due to horizontal
|
|
@@ -4798,7 +5067,7 @@ const Xe = (c) => ({
|
|
|
4798
5067
|
break;
|
|
4799
5068
|
}
|
|
4800
5069
|
case "initialPlacement":
|
|
4801
|
-
Y =
|
|
5070
|
+
Y = a;
|
|
4802
5071
|
break;
|
|
4803
5072
|
}
|
|
4804
5073
|
if (s !== Y)
|
|
@@ -4811,17 +5080,17 @@ const Xe = (c) => ({
|
|
|
4811
5080
|
return {};
|
|
4812
5081
|
}
|
|
4813
5082
|
};
|
|
4814
|
-
},
|
|
4815
|
-
async function
|
|
5083
|
+
}, Be = /* @__PURE__ */ new Set(["left", "top"]);
|
|
5084
|
+
async function Ke(c, t) {
|
|
4816
5085
|
const {
|
|
4817
5086
|
placement: e,
|
|
4818
5087
|
platform: i,
|
|
4819
5088
|
elements: s
|
|
4820
|
-
} = c, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r = z(e),
|
|
5089
|
+
} = c, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r = z(e), a = tt(e), l = V(e) === "y", h = Be.has(r) ? -1 : 1, d = o && l ? -1 : 1, f = Q(t, c);
|
|
4821
5090
|
let {
|
|
4822
|
-
mainAxis:
|
|
4823
|
-
crossAxis:
|
|
4824
|
-
alignmentAxis:
|
|
5091
|
+
mainAxis: u,
|
|
5092
|
+
crossAxis: x,
|
|
5093
|
+
alignmentAxis: w
|
|
4825
5094
|
} = typeof f == "number" ? {
|
|
4826
5095
|
mainAxis: f,
|
|
4827
5096
|
crossAxis: 0,
|
|
@@ -4831,12 +5100,12 @@ async function Ne(c, t) {
|
|
|
4831
5100
|
crossAxis: f.crossAxis || 0,
|
|
4832
5101
|
alignmentAxis: f.alignmentAxis
|
|
4833
5102
|
};
|
|
4834
|
-
return
|
|
4835
|
-
x:
|
|
4836
|
-
y:
|
|
5103
|
+
return a && typeof w == "number" && (x = a === "end" ? w * -1 : w), l ? {
|
|
5104
|
+
x: x * d,
|
|
5105
|
+
y: u * h
|
|
4837
5106
|
} : {
|
|
4838
|
-
x:
|
|
4839
|
-
y:
|
|
5107
|
+
x: u * h,
|
|
5108
|
+
y: x * d
|
|
4840
5109
|
};
|
|
4841
5110
|
}
|
|
4842
5111
|
const Ye = function(c) {
|
|
@@ -4849,13 +5118,13 @@ const Ye = function(c) {
|
|
|
4849
5118
|
x: s,
|
|
4850
5119
|
y: o,
|
|
4851
5120
|
placement: r,
|
|
4852
|
-
middlewareData:
|
|
4853
|
-
} = t,
|
|
4854
|
-
return r === ((e =
|
|
4855
|
-
x: s +
|
|
4856
|
-
y: o +
|
|
5121
|
+
middlewareData: a
|
|
5122
|
+
} = t, l = await Ke(t, c);
|
|
5123
|
+
return r === ((e = a.offset) == null ? void 0 : e.placement) && (i = a.arrow) != null && i.alignmentOffset ? {} : {
|
|
5124
|
+
x: s + l.x,
|
|
5125
|
+
y: o + l.y,
|
|
4857
5126
|
data: {
|
|
4858
|
-
...
|
|
5127
|
+
...l,
|
|
4859
5128
|
placement: r
|
|
4860
5129
|
}
|
|
4861
5130
|
};
|
|
@@ -4873,44 +5142,44 @@ const Ye = function(c) {
|
|
|
4873
5142
|
} = t, {
|
|
4874
5143
|
mainAxis: o = !0,
|
|
4875
5144
|
crossAxis: r = !1,
|
|
4876
|
-
limiter:
|
|
4877
|
-
fn: (
|
|
5145
|
+
limiter: a = {
|
|
5146
|
+
fn: (g) => {
|
|
4878
5147
|
let {
|
|
4879
|
-
x:
|
|
5148
|
+
x: p,
|
|
4880
5149
|
y
|
|
4881
|
-
} =
|
|
5150
|
+
} = g;
|
|
4882
5151
|
return {
|
|
4883
|
-
x:
|
|
5152
|
+
x: p,
|
|
4884
5153
|
y
|
|
4885
5154
|
};
|
|
4886
5155
|
}
|
|
4887
5156
|
},
|
|
4888
|
-
...
|
|
4889
|
-
} =
|
|
5157
|
+
...l
|
|
5158
|
+
} = Q(c, t), h = {
|
|
4890
5159
|
x: e,
|
|
4891
5160
|
y: i
|
|
4892
|
-
}, d = await Yt(t,
|
|
4893
|
-
let
|
|
5161
|
+
}, d = await Yt(t, l), f = V(z(s)), u = Bt(f);
|
|
5162
|
+
let x = h[u], w = h[f];
|
|
4894
5163
|
if (o) {
|
|
4895
|
-
const
|
|
4896
|
-
|
|
5164
|
+
const g = u === "y" ? "top" : "left", p = u === "y" ? "bottom" : "right", y = x + d[g], m = x - d[p];
|
|
5165
|
+
x = dt(y, x, m);
|
|
4897
5166
|
}
|
|
4898
5167
|
if (r) {
|
|
4899
|
-
const
|
|
4900
|
-
|
|
5168
|
+
const g = f === "y" ? "top" : "left", p = f === "y" ? "bottom" : "right", y = w + d[g], m = w - d[p];
|
|
5169
|
+
w = dt(y, w, m);
|
|
4901
5170
|
}
|
|
4902
|
-
const
|
|
5171
|
+
const E = a.fn({
|
|
4903
5172
|
...t,
|
|
4904
|
-
[
|
|
4905
|
-
[f]:
|
|
5173
|
+
[u]: x,
|
|
5174
|
+
[f]: w
|
|
4906
5175
|
});
|
|
4907
5176
|
return {
|
|
4908
|
-
...
|
|
5177
|
+
...E,
|
|
4909
5178
|
data: {
|
|
4910
|
-
x:
|
|
4911
|
-
y:
|
|
5179
|
+
x: E.x - e,
|
|
5180
|
+
y: E.y - i,
|
|
4912
5181
|
enabled: {
|
|
4913
|
-
[
|
|
5182
|
+
[u]: o,
|
|
4914
5183
|
[f]: r
|
|
4915
5184
|
}
|
|
4916
5185
|
}
|
|
@@ -4918,10 +5187,10 @@ const Ye = function(c) {
|
|
|
4918
5187
|
}
|
|
4919
5188
|
};
|
|
4920
5189
|
};
|
|
4921
|
-
function
|
|
5190
|
+
function nt() {
|
|
4922
5191
|
return typeof window < "u";
|
|
4923
5192
|
}
|
|
4924
|
-
function
|
|
5193
|
+
function Z(c) {
|
|
4925
5194
|
return Ft(c) ? (c.nodeName || "").toLowerCase() : "#document";
|
|
4926
5195
|
}
|
|
4927
5196
|
function A(c) {
|
|
@@ -4933,33 +5202,33 @@ function F(c) {
|
|
|
4933
5202
|
return (t = (Ft(c) ? c.ownerDocument : c.document) || window.document) == null ? void 0 : t.documentElement;
|
|
4934
5203
|
}
|
|
4935
5204
|
function Ft(c) {
|
|
4936
|
-
return
|
|
5205
|
+
return nt() ? c instanceof Node || c instanceof A(c).Node : !1;
|
|
4937
5206
|
}
|
|
4938
5207
|
function X(c) {
|
|
4939
|
-
return
|
|
5208
|
+
return nt() ? c instanceof Element || c instanceof A(c).Element : !1;
|
|
4940
5209
|
}
|
|
4941
|
-
function
|
|
4942
|
-
return
|
|
5210
|
+
function K(c) {
|
|
5211
|
+
return nt() ? c instanceof HTMLElement || c instanceof A(c).HTMLElement : !1;
|
|
4943
5212
|
}
|
|
4944
|
-
function
|
|
4945
|
-
return !
|
|
5213
|
+
function St(c) {
|
|
5214
|
+
return !nt() || typeof ShadowRoot > "u" ? !1 : c instanceof ShadowRoot || c instanceof A(c).ShadowRoot;
|
|
4946
5215
|
}
|
|
4947
5216
|
const We = /* @__PURE__ */ new Set(["inline", "contents"]);
|
|
4948
|
-
function
|
|
5217
|
+
function et(c) {
|
|
4949
5218
|
const {
|
|
4950
5219
|
overflow: t,
|
|
4951
5220
|
overflowX: e,
|
|
4952
5221
|
overflowY: i,
|
|
4953
5222
|
display: s
|
|
4954
|
-
} =
|
|
5223
|
+
} = N(c);
|
|
4955
5224
|
return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !We.has(s);
|
|
4956
5225
|
}
|
|
4957
5226
|
const Ve = /* @__PURE__ */ new Set(["table", "td", "th"]);
|
|
4958
5227
|
function Pe(c) {
|
|
4959
|
-
return Ve.has(
|
|
5228
|
+
return Ve.has(Z(c));
|
|
4960
5229
|
}
|
|
4961
5230
|
const ze = [":popover-open", ":modal"];
|
|
4962
|
-
function
|
|
5231
|
+
function at(c) {
|
|
4963
5232
|
return ze.some((t) => {
|
|
4964
5233
|
try {
|
|
4965
5234
|
return c.matches(t);
|
|
@@ -4969,29 +5238,29 @@ function nt(c) {
|
|
|
4969
5238
|
});
|
|
4970
5239
|
}
|
|
4971
5240
|
const $e = ["transform", "translate", "scale", "rotate", "perspective"], Ge = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Ue = ["paint", "layout", "strict", "content"];
|
|
4972
|
-
function
|
|
4973
|
-
const t =
|
|
5241
|
+
function wt(c) {
|
|
5242
|
+
const t = Et(), e = X(c) ? N(c) : c;
|
|
4974
5243
|
return $e.some((i) => e[i] ? e[i] !== "none" : !1) || (e.containerType ? e.containerType !== "normal" : !1) || !t && (e.backdropFilter ? e.backdropFilter !== "none" : !1) || !t && (e.filter ? e.filter !== "none" : !1) || Ge.some((i) => (e.willChange || "").includes(i)) || Ue.some((i) => (e.contain || "").includes(i));
|
|
4975
5244
|
}
|
|
4976
5245
|
function je(c) {
|
|
4977
5246
|
let t = P(c);
|
|
4978
|
-
for (;
|
|
4979
|
-
if (
|
|
5247
|
+
for (; K(t) && !j(t); ) {
|
|
5248
|
+
if (wt(t))
|
|
4980
5249
|
return t;
|
|
4981
|
-
if (
|
|
5250
|
+
if (at(t))
|
|
4982
5251
|
return null;
|
|
4983
5252
|
t = P(t);
|
|
4984
5253
|
}
|
|
4985
5254
|
return null;
|
|
4986
5255
|
}
|
|
4987
|
-
function
|
|
5256
|
+
function Et() {
|
|
4988
5257
|
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
4989
5258
|
}
|
|
4990
5259
|
const Ze = /* @__PURE__ */ new Set(["html", "body", "#document"]);
|
|
4991
|
-
function
|
|
4992
|
-
return Ze.has(
|
|
5260
|
+
function j(c) {
|
|
5261
|
+
return Ze.has(Z(c));
|
|
4993
5262
|
}
|
|
4994
|
-
function
|
|
5263
|
+
function N(c) {
|
|
4995
5264
|
return A(c).getComputedStyle(c);
|
|
4996
5265
|
}
|
|
4997
5266
|
function lt(c) {
|
|
@@ -5004,62 +5273,62 @@ function lt(c) {
|
|
|
5004
5273
|
};
|
|
5005
5274
|
}
|
|
5006
5275
|
function P(c) {
|
|
5007
|
-
if (
|
|
5276
|
+
if (Z(c) === "html")
|
|
5008
5277
|
return c;
|
|
5009
5278
|
const t = (
|
|
5010
5279
|
// Step into the shadow DOM of the parent of a slotted node.
|
|
5011
5280
|
c.assignedSlot || // DOM Element detected.
|
|
5012
5281
|
c.parentNode || // ShadowRoot detected.
|
|
5013
|
-
|
|
5282
|
+
St(c) && c.host || // Fallback.
|
|
5014
5283
|
F(c)
|
|
5015
5284
|
);
|
|
5016
|
-
return
|
|
5285
|
+
return St(t) ? t.host : t;
|
|
5017
5286
|
}
|
|
5018
5287
|
function Wt(c) {
|
|
5019
5288
|
const t = P(c);
|
|
5020
|
-
return
|
|
5289
|
+
return j(t) ? c.ownerDocument ? c.ownerDocument.body : c.body : K(t) && et(t) ? t : Wt(t);
|
|
5021
5290
|
}
|
|
5022
5291
|
function Vt(c, t, e) {
|
|
5023
5292
|
var i;
|
|
5024
5293
|
t === void 0 && (t = []);
|
|
5025
5294
|
const s = Wt(c), o = s === ((i = c.ownerDocument) == null ? void 0 : i.body), r = A(s);
|
|
5026
|
-
return o ? (
|
|
5295
|
+
return o ? (xt(r), t.concat(r, r.visualViewport || [], et(s) ? s : [], [])) : t.concat(s, Vt(s, []));
|
|
5027
5296
|
}
|
|
5028
|
-
function
|
|
5297
|
+
function xt(c) {
|
|
5029
5298
|
return c.parent && Object.getPrototypeOf(c.parent) ? c.frameElement : null;
|
|
5030
5299
|
}
|
|
5031
5300
|
function Pt(c) {
|
|
5032
|
-
const t =
|
|
5301
|
+
const t = N(c);
|
|
5033
5302
|
let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
|
|
5034
|
-
const s =
|
|
5035
|
-
return
|
|
5303
|
+
const s = K(c), o = s ? c.offsetWidth : e, r = s ? c.offsetHeight : i, a = st(e) !== o || st(i) !== r;
|
|
5304
|
+
return a && (e = o, i = r), {
|
|
5036
5305
|
width: e,
|
|
5037
5306
|
height: i,
|
|
5038
|
-
$:
|
|
5307
|
+
$: a
|
|
5039
5308
|
};
|
|
5040
5309
|
}
|
|
5041
5310
|
function zt(c) {
|
|
5042
5311
|
return X(c) ? c : c.contextElement;
|
|
5043
5312
|
}
|
|
5044
|
-
function
|
|
5313
|
+
function U(c) {
|
|
5045
5314
|
const t = zt(c);
|
|
5046
|
-
if (!
|
|
5047
|
-
return
|
|
5315
|
+
if (!K(t))
|
|
5316
|
+
return B(1);
|
|
5048
5317
|
const e = t.getBoundingClientRect(), {
|
|
5049
5318
|
width: i,
|
|
5050
5319
|
height: s,
|
|
5051
5320
|
$: o
|
|
5052
5321
|
} = Pt(t);
|
|
5053
|
-
let r = (o ?
|
|
5054
|
-
return (!r || !Number.isFinite(r)) && (r = 1), (!
|
|
5322
|
+
let r = (o ? st(e.width) : e.width) / i, a = (o ? st(e.height) : e.height) / s;
|
|
5323
|
+
return (!r || !Number.isFinite(r)) && (r = 1), (!a || !Number.isFinite(a)) && (a = 1), {
|
|
5055
5324
|
x: r,
|
|
5056
|
-
y:
|
|
5325
|
+
y: a
|
|
5057
5326
|
};
|
|
5058
5327
|
}
|
|
5059
|
-
const qe = /* @__PURE__ */
|
|
5328
|
+
const qe = /* @__PURE__ */ B(0);
|
|
5060
5329
|
function $t(c) {
|
|
5061
5330
|
const t = A(c);
|
|
5062
|
-
return !
|
|
5331
|
+
return !Et() || !t.visualViewport ? qe : {
|
|
5063
5332
|
x: t.visualViewport.offsetLeft,
|
|
5064
5333
|
y: t.visualViewport.offsetTop
|
|
5065
5334
|
};
|
|
@@ -5067,31 +5336,31 @@ function $t(c) {
|
|
|
5067
5336
|
function Je(c, t, e) {
|
|
5068
5337
|
return t === void 0 && (t = !1), !e || t && e !== A(c) ? !1 : t;
|
|
5069
5338
|
}
|
|
5070
|
-
function
|
|
5339
|
+
function J(c, t, e, i) {
|
|
5071
5340
|
t === void 0 && (t = !1), e === void 0 && (e = !1);
|
|
5072
5341
|
const s = c.getBoundingClientRect(), o = zt(c);
|
|
5073
|
-
let r =
|
|
5074
|
-
t && (i ? X(i) && (r =
|
|
5075
|
-
const
|
|
5076
|
-
let
|
|
5342
|
+
let r = B(1);
|
|
5343
|
+
t && (i ? X(i) && (r = U(i)) : r = U(c));
|
|
5344
|
+
const a = Je(o, e, i) ? $t(o) : B(0);
|
|
5345
|
+
let l = (s.left + a.x) / r.x, h = (s.top + a.y) / r.y, d = s.width / r.x, f = s.height / r.y;
|
|
5077
5346
|
if (o) {
|
|
5078
|
-
const
|
|
5079
|
-
let
|
|
5080
|
-
for (;
|
|
5081
|
-
const
|
|
5082
|
-
|
|
5347
|
+
const u = A(o), x = i && X(i) ? A(i) : i;
|
|
5348
|
+
let w = u, E = xt(w);
|
|
5349
|
+
for (; E && i && x !== w; ) {
|
|
5350
|
+
const g = U(E), p = E.getBoundingClientRect(), y = N(E), m = p.left + (E.clientLeft + parseFloat(y.paddingLeft)) * g.x, b = p.top + (E.clientTop + parseFloat(y.paddingTop)) * g.y;
|
|
5351
|
+
l *= g.x, h *= g.y, d *= g.x, f *= g.y, l += m, h += b, w = A(E), E = xt(w);
|
|
5083
5352
|
}
|
|
5084
5353
|
}
|
|
5085
|
-
return
|
|
5354
|
+
return rt({
|
|
5086
5355
|
width: d,
|
|
5087
5356
|
height: f,
|
|
5088
|
-
x:
|
|
5357
|
+
x: l,
|
|
5089
5358
|
y: h
|
|
5090
5359
|
});
|
|
5091
5360
|
}
|
|
5092
5361
|
function pt(c, t) {
|
|
5093
5362
|
const e = lt(c).scrollLeft;
|
|
5094
|
-
return t ? t.left + e :
|
|
5363
|
+
return t ? t.left + e : J(F(c)).left + e;
|
|
5095
5364
|
}
|
|
5096
5365
|
function Gt(c, t, e) {
|
|
5097
5366
|
e === void 0 && (e = !1);
|
|
@@ -5111,66 +5380,66 @@ function Qe(c) {
|
|
|
5111
5380
|
offsetParent: i,
|
|
5112
5381
|
strategy: s
|
|
5113
5382
|
} = c;
|
|
5114
|
-
const o = s === "fixed", r = F(i),
|
|
5115
|
-
if (i === r ||
|
|
5383
|
+
const o = s === "fixed", r = F(i), a = t ? at(t.floating) : !1;
|
|
5384
|
+
if (i === r || a && o)
|
|
5116
5385
|
return e;
|
|
5117
|
-
let
|
|
5386
|
+
let l = {
|
|
5118
5387
|
scrollLeft: 0,
|
|
5119
5388
|
scrollTop: 0
|
|
5120
|
-
}, h =
|
|
5121
|
-
const d =
|
|
5122
|
-
if ((f || !f && !o) && ((
|
|
5123
|
-
const
|
|
5124
|
-
h =
|
|
5389
|
+
}, h = B(1);
|
|
5390
|
+
const d = B(0), f = K(i);
|
|
5391
|
+
if ((f || !f && !o) && ((Z(i) !== "body" || et(r)) && (l = lt(i)), K(i))) {
|
|
5392
|
+
const x = J(i);
|
|
5393
|
+
h = U(i), d.x = x.x + i.clientLeft, d.y = x.y + i.clientTop;
|
|
5125
5394
|
}
|
|
5126
|
-
const
|
|
5395
|
+
const u = r && !f && !o ? Gt(r, l, !0) : B(0);
|
|
5127
5396
|
return {
|
|
5128
5397
|
width: e.width * h.x,
|
|
5129
5398
|
height: e.height * h.y,
|
|
5130
|
-
x: e.x * h.x -
|
|
5131
|
-
y: e.y * h.y -
|
|
5399
|
+
x: e.x * h.x - l.scrollLeft * h.x + d.x + u.x,
|
|
5400
|
+
y: e.y * h.y - l.scrollTop * h.y + d.y + u.y
|
|
5132
5401
|
};
|
|
5133
5402
|
}
|
|
5134
5403
|
function ti(c) {
|
|
5135
5404
|
return Array.from(c.getClientRects());
|
|
5136
5405
|
}
|
|
5137
5406
|
function ei(c) {
|
|
5138
|
-
const t = F(c), e = lt(c), i = c.ownerDocument.body, s =
|
|
5407
|
+
const t = F(c), e = lt(c), i = c.ownerDocument.body, s = G(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), o = G(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
|
|
5139
5408
|
let r = -e.scrollLeft + pt(c);
|
|
5140
|
-
const
|
|
5141
|
-
return
|
|
5409
|
+
const a = -e.scrollTop;
|
|
5410
|
+
return N(i).direction === "rtl" && (r += G(t.clientWidth, i.clientWidth) - s), {
|
|
5142
5411
|
width: s,
|
|
5143
5412
|
height: o,
|
|
5144
5413
|
x: r,
|
|
5145
|
-
y:
|
|
5414
|
+
y: a
|
|
5146
5415
|
};
|
|
5147
5416
|
}
|
|
5148
5417
|
function ii(c, t) {
|
|
5149
5418
|
const e = A(c), i = F(c), s = e.visualViewport;
|
|
5150
|
-
let o = i.clientWidth, r = i.clientHeight,
|
|
5419
|
+
let o = i.clientWidth, r = i.clientHeight, a = 0, l = 0;
|
|
5151
5420
|
if (s) {
|
|
5152
5421
|
o = s.width, r = s.height;
|
|
5153
|
-
const h =
|
|
5154
|
-
(!h || h && t === "fixed") && (
|
|
5422
|
+
const h = Et();
|
|
5423
|
+
(!h || h && t === "fixed") && (a = s.offsetLeft, l = s.offsetTop);
|
|
5155
5424
|
}
|
|
5156
5425
|
return {
|
|
5157
5426
|
width: o,
|
|
5158
5427
|
height: r,
|
|
5159
|
-
x:
|
|
5160
|
-
y:
|
|
5428
|
+
x: a,
|
|
5429
|
+
y: l
|
|
5161
5430
|
};
|
|
5162
5431
|
}
|
|
5163
5432
|
const si = /* @__PURE__ */ new Set(["absolute", "fixed"]);
|
|
5164
5433
|
function oi(c, t) {
|
|
5165
|
-
const e =
|
|
5434
|
+
const e = J(c, !0, t === "fixed"), i = e.top + c.clientTop, s = e.left + c.clientLeft, o = K(c) ? U(c) : B(1), r = c.clientWidth * o.x, a = c.clientHeight * o.y, l = s * o.x, h = i * o.y;
|
|
5166
5435
|
return {
|
|
5167
5436
|
width: r,
|
|
5168
|
-
height:
|
|
5169
|
-
x:
|
|
5437
|
+
height: a,
|
|
5438
|
+
x: l,
|
|
5170
5439
|
y: h
|
|
5171
5440
|
};
|
|
5172
5441
|
}
|
|
5173
|
-
function
|
|
5442
|
+
function Tt(c, t, e) {
|
|
5174
5443
|
let i;
|
|
5175
5444
|
if (t === "viewport")
|
|
5176
5445
|
i = ii(c, e);
|
|
@@ -5187,22 +5456,22 @@ function Ot(c, t, e) {
|
|
|
5187
5456
|
height: t.height
|
|
5188
5457
|
};
|
|
5189
5458
|
}
|
|
5190
|
-
return
|
|
5459
|
+
return rt(i);
|
|
5191
5460
|
}
|
|
5192
5461
|
function Ut(c, t) {
|
|
5193
5462
|
const e = P(c);
|
|
5194
|
-
return e === t || !X(e) ||
|
|
5463
|
+
return e === t || !X(e) || j(e) ? !1 : N(e).position === "fixed" || Ut(e, t);
|
|
5195
5464
|
}
|
|
5196
5465
|
function ri(c, t) {
|
|
5197
5466
|
const e = t.get(c);
|
|
5198
5467
|
if (e)
|
|
5199
5468
|
return e;
|
|
5200
|
-
let i = Vt(c, []).filter((
|
|
5201
|
-
const o =
|
|
5469
|
+
let i = Vt(c, []).filter((a) => X(a) && Z(a) !== "body"), s = null;
|
|
5470
|
+
const o = N(c).position === "fixed";
|
|
5202
5471
|
let r = o ? P(c) : c;
|
|
5203
|
-
for (; X(r) && !
|
|
5204
|
-
const
|
|
5205
|
-
!
|
|
5472
|
+
for (; X(r) && !j(r); ) {
|
|
5473
|
+
const a = N(r), l = wt(r);
|
|
5474
|
+
!l && a.position === "fixed" && (s = null), (o ? !l && !s : !l && a.position === "static" && !!s && si.has(s.position) || et(r) && !l && Ut(c, r)) ? i = i.filter((d) => d !== r) : s = a, r = P(r);
|
|
5206
5475
|
}
|
|
5207
5476
|
return t.set(c, i), i;
|
|
5208
5477
|
}
|
|
@@ -5213,18 +5482,18 @@ function ni(c) {
|
|
|
5213
5482
|
rootBoundary: i,
|
|
5214
5483
|
strategy: s
|
|
5215
5484
|
} = c;
|
|
5216
|
-
const r = [...e === "clippingAncestors" ?
|
|
5217
|
-
const f =
|
|
5218
|
-
return h.top =
|
|
5219
|
-
},
|
|
5485
|
+
const r = [...e === "clippingAncestors" ? at(t) ? [] : ri(t, this._c) : [].concat(e), i], a = r[0], l = r.reduce((h, d) => {
|
|
5486
|
+
const f = Tt(t, d, s);
|
|
5487
|
+
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;
|
|
5488
|
+
}, Tt(t, a, s));
|
|
5220
5489
|
return {
|
|
5221
|
-
width:
|
|
5222
|
-
height:
|
|
5223
|
-
x:
|
|
5224
|
-
y:
|
|
5490
|
+
width: l.right - l.left,
|
|
5491
|
+
height: l.bottom - l.top,
|
|
5492
|
+
x: l.left,
|
|
5493
|
+
y: l.top
|
|
5225
5494
|
};
|
|
5226
5495
|
}
|
|
5227
|
-
function
|
|
5496
|
+
function ai(c) {
|
|
5228
5497
|
const {
|
|
5229
5498
|
width: t,
|
|
5230
5499
|
height: e
|
|
@@ -5234,35 +5503,35 @@ function li(c) {
|
|
|
5234
5503
|
height: e
|
|
5235
5504
|
};
|
|
5236
5505
|
}
|
|
5237
|
-
function
|
|
5238
|
-
const i =
|
|
5239
|
-
let
|
|
5506
|
+
function li(c, t, e) {
|
|
5507
|
+
const i = K(t), s = F(t), o = e === "fixed", r = J(c, !0, o, t);
|
|
5508
|
+
let a = {
|
|
5240
5509
|
scrollLeft: 0,
|
|
5241
5510
|
scrollTop: 0
|
|
5242
5511
|
};
|
|
5243
|
-
const
|
|
5512
|
+
const l = B(0);
|
|
5244
5513
|
function h() {
|
|
5245
|
-
|
|
5514
|
+
l.x = pt(s);
|
|
5246
5515
|
}
|
|
5247
5516
|
if (i || !i && !o)
|
|
5248
|
-
if ((
|
|
5249
|
-
const
|
|
5250
|
-
|
|
5517
|
+
if ((Z(t) !== "body" || et(s)) && (a = lt(t)), i) {
|
|
5518
|
+
const x = J(t, !0, o, t);
|
|
5519
|
+
l.x = x.x + t.clientLeft, l.y = x.y + t.clientTop;
|
|
5251
5520
|
} else s && h();
|
|
5252
5521
|
o && !i && s && h();
|
|
5253
|
-
const d = s && !i && !o ? Gt(s,
|
|
5522
|
+
const d = s && !i && !o ? Gt(s, a) : B(0), f = r.left + a.scrollLeft - l.x - d.x, u = r.top + a.scrollTop - l.y - d.y;
|
|
5254
5523
|
return {
|
|
5255
5524
|
x: f,
|
|
5256
|
-
y:
|
|
5525
|
+
y: u,
|
|
5257
5526
|
width: r.width,
|
|
5258
5527
|
height: r.height
|
|
5259
5528
|
};
|
|
5260
5529
|
}
|
|
5261
|
-
function
|
|
5262
|
-
return
|
|
5530
|
+
function ht(c) {
|
|
5531
|
+
return N(c).position === "static";
|
|
5263
5532
|
}
|
|
5264
|
-
function
|
|
5265
|
-
if (!
|
|
5533
|
+
function Ot(c, t) {
|
|
5534
|
+
if (!K(c) || N(c).position === "fixed")
|
|
5266
5535
|
return null;
|
|
5267
5536
|
if (t)
|
|
5268
5537
|
return t(c);
|
|
@@ -5271,26 +5540,26 @@ function St(c, t) {
|
|
|
5271
5540
|
}
|
|
5272
5541
|
function jt(c, t) {
|
|
5273
5542
|
const e = A(c);
|
|
5274
|
-
if (
|
|
5543
|
+
if (at(c))
|
|
5275
5544
|
return e;
|
|
5276
|
-
if (!
|
|
5545
|
+
if (!K(c)) {
|
|
5277
5546
|
let s = P(c);
|
|
5278
|
-
for (; s && !
|
|
5279
|
-
if (X(s) && !
|
|
5547
|
+
for (; s && !j(s); ) {
|
|
5548
|
+
if (X(s) && !ht(s))
|
|
5280
5549
|
return s;
|
|
5281
5550
|
s = P(s);
|
|
5282
5551
|
}
|
|
5283
5552
|
return e;
|
|
5284
5553
|
}
|
|
5285
|
-
let i =
|
|
5286
|
-
for (; i && Pe(i) &&
|
|
5287
|
-
i =
|
|
5288
|
-
return i &&
|
|
5554
|
+
let i = Ot(c, t);
|
|
5555
|
+
for (; i && Pe(i) && ht(i); )
|
|
5556
|
+
i = Ot(i, t);
|
|
5557
|
+
return i && j(i) && ht(i) && !wt(i) ? e : i || je(c) || e;
|
|
5289
5558
|
}
|
|
5290
5559
|
const hi = async function(c) {
|
|
5291
5560
|
const t = this.getOffsetParent || jt, e = this.getDimensions, i = await e(c.floating);
|
|
5292
5561
|
return {
|
|
5293
|
-
reference:
|
|
5562
|
+
reference: li(c.reference, await t(c.floating), c.strategy),
|
|
5294
5563
|
floating: {
|
|
5295
5564
|
x: 0,
|
|
5296
5565
|
y: 0,
|
|
@@ -5300,7 +5569,7 @@ const hi = async function(c) {
|
|
|
5300
5569
|
};
|
|
5301
5570
|
};
|
|
5302
5571
|
function ci(c) {
|
|
5303
|
-
return
|
|
5572
|
+
return N(c).direction === "rtl";
|
|
5304
5573
|
}
|
|
5305
5574
|
const di = {
|
|
5306
5575
|
convertOffsetParentRelativeRectToViewportRelativeRect: Qe,
|
|
@@ -5309,11 +5578,11 @@ const di = {
|
|
|
5309
5578
|
getOffsetParent: jt,
|
|
5310
5579
|
getElementRects: hi,
|
|
5311
5580
|
getClientRects: ti,
|
|
5312
|
-
getDimensions:
|
|
5313
|
-
getScale:
|
|
5581
|
+
getDimensions: ai,
|
|
5582
|
+
getScale: U,
|
|
5314
5583
|
isElement: X,
|
|
5315
5584
|
isRTL: ci
|
|
5316
|
-
}, Zt = Ye, qt = Fe, Jt =
|
|
5585
|
+
}, Zt = Ye, qt = Fe, Jt = Ne, fi = Xe, Qt = (c, t, e) => {
|
|
5317
5586
|
const i = /* @__PURE__ */ new Map(), s = {
|
|
5318
5587
|
platform: di,
|
|
5319
5588
|
...e
|
|
@@ -5336,7 +5605,7 @@ let xi = class {
|
|
|
5336
5605
|
this.ctx = t;
|
|
5337
5606
|
const { TOOLTIP_BG_COLOR: e, TOOLTIP_TEXT_COLOR: i, TOOLTIP_ZINDEX: s, TOOLTIP_CUSTOM_STYLE: o, CSS_PREFIX: r } = this.ctx.config;
|
|
5338
5607
|
this.contentEl = document.createElement("div"), this.arrowEl = document.createElement("div"), this.floatingEl = document.createElement("div"), this.floatingEl.className = `${r}-tooltip`, this.contentEl.className = `${r}-tooltip-content`, this.arrowEl.className = `${r}-tooltip-arrow`;
|
|
5339
|
-
const
|
|
5608
|
+
const a = {
|
|
5340
5609
|
display: "none",
|
|
5341
5610
|
position: "absolute",
|
|
5342
5611
|
background: e,
|
|
@@ -5347,16 +5616,16 @@ let xi = class {
|
|
|
5347
5616
|
borderRadius: "4px",
|
|
5348
5617
|
fontSize: "12px",
|
|
5349
5618
|
...o
|
|
5350
|
-
},
|
|
5619
|
+
}, l = {
|
|
5351
5620
|
position: "absolute",
|
|
5352
5621
|
width: "10px",
|
|
5353
5622
|
height: "10px",
|
|
5354
|
-
background:
|
|
5355
|
-
backgroundColor:
|
|
5623
|
+
background: a.background,
|
|
5624
|
+
backgroundColor: a.backgroundColor,
|
|
5356
5625
|
transform: "rotate(45deg)",
|
|
5357
|
-
zIndex:
|
|
5626
|
+
zIndex: a.zIndex
|
|
5358
5627
|
};
|
|
5359
|
-
Object.assign(this.arrowEl.style,
|
|
5628
|
+
Object.assign(this.arrowEl.style, l), Object.assign(this.floatingEl.style, a), this.floatingEl.appendChild(this.contentEl), this.floatingEl.appendChild(this.arrowEl), this.ctx.containerElement.appendChild(this.floatingEl), this.init();
|
|
5360
5629
|
}
|
|
5361
5630
|
init() {
|
|
5362
5631
|
this.floatingEl.addEventListener("mouseleave", () => {
|
|
@@ -5404,32 +5673,32 @@ let xi = class {
|
|
|
5404
5673
|
}, this.floatingEl, {
|
|
5405
5674
|
placement: t.overflowTooltipPlacement,
|
|
5406
5675
|
middleware: [qt(), Jt(), Zt(6), fi({ element: this.arrowEl })]
|
|
5407
|
-
}).then((
|
|
5408
|
-
const { x:
|
|
5676
|
+
}).then((a) => {
|
|
5677
|
+
const { x: l, y: h, placement: d, middlewareData: f } = a;
|
|
5409
5678
|
if (Object.assign(this.floatingEl.style, {
|
|
5410
5679
|
top: `${h}px`,
|
|
5411
|
-
left: `${
|
|
5680
|
+
left: `${l}px`
|
|
5412
5681
|
}), f.arrow) {
|
|
5413
|
-
const
|
|
5682
|
+
const u = f.arrow;
|
|
5414
5683
|
["left", "left-start", "left-end"].includes(d) ? Object.assign(this.arrowEl.style, {
|
|
5415
|
-
top: `${
|
|
5684
|
+
top: `${u.y}px`,
|
|
5416
5685
|
bottom: "",
|
|
5417
5686
|
left: "",
|
|
5418
5687
|
right: "-5px"
|
|
5419
5688
|
}) : ["right", "right-start", "right-end"].includes(d) ? Object.assign(this.arrowEl.style, {
|
|
5420
|
-
top: `${
|
|
5689
|
+
top: `${u.y}px`,
|
|
5421
5690
|
bottom: "",
|
|
5422
5691
|
left: "-5px",
|
|
5423
5692
|
right: ""
|
|
5424
5693
|
}) : ["bottom", "bottom-start", "bottom-end"].includes(d) ? Object.assign(this.arrowEl.style, {
|
|
5425
5694
|
top: "-5px",
|
|
5426
5695
|
bottom: "",
|
|
5427
|
-
left: `${
|
|
5696
|
+
left: `${u.x}px`,
|
|
5428
5697
|
right: ""
|
|
5429
5698
|
}) : ["top", "top-start", "top-end"].includes(d) && Object.assign(this.arrowEl.style, {
|
|
5430
5699
|
top: "",
|
|
5431
5700
|
bottom: "-5px",
|
|
5432
|
-
left: `${
|
|
5701
|
+
left: `${u.x}px`,
|
|
5433
5702
|
right: ""
|
|
5434
5703
|
});
|
|
5435
5704
|
}
|
|
@@ -5473,15 +5742,15 @@ class ui {
|
|
|
5473
5742
|
return;
|
|
5474
5743
|
if (t.code === "Escape" && this.ctx.editing) {
|
|
5475
5744
|
this.cancel = !0;
|
|
5476
|
-
const { focusCell:
|
|
5477
|
-
|
|
5745
|
+
const { focusCell: l } = this.ctx;
|
|
5746
|
+
l && (this.ctx.emit("setSelectorCell", l), this.cellTarget = l), this.doneEdit();
|
|
5478
5747
|
return;
|
|
5479
5748
|
}
|
|
5480
5749
|
if ((t.altKey || t.metaKey) && t.code === "Enter" && this.ctx.editing && this.inputEl) {
|
|
5481
5750
|
t.preventDefault();
|
|
5482
|
-
const
|
|
5751
|
+
const l = this.inputEl.selectionStart, h = this.inputEl.value.substring(0, l), d = this.inputEl.value.substring(l);
|
|
5483
5752
|
this.inputEl.value = h + `
|
|
5484
|
-
` + d, this.inputEl.selectionStart = this.inputEl.selectionEnd =
|
|
5753
|
+
` + d, this.inputEl.selectionStart = this.inputEl.selectionEnd = l + 1, this.autoSize();
|
|
5485
5754
|
return;
|
|
5486
5755
|
}
|
|
5487
5756
|
if (t.code === "Tab" && this.ctx.editing) {
|
|
@@ -5538,7 +5807,7 @@ class ui {
|
|
|
5538
5807
|
const { xArr: e, yArr: i } = this.ctx.selector;
|
|
5539
5808
|
this.selectorArrStr = JSON.stringify(e) + JSON.stringify(i);
|
|
5540
5809
|
}), this.ctx.on("cellClick", (t) => {
|
|
5541
|
-
if (this.ctx.adjustPositioning || !this.isInSelectorRange(t.rowIndex, t.colIndex))
|
|
5810
|
+
if (this.ctx.adjustPositioning || this.ctx.isPointer || !this.isInSelectorRange(t.rowIndex, t.colIndex))
|
|
5542
5811
|
return;
|
|
5543
5812
|
const { xArr: e, yArr: i } = this.ctx.selector, s = JSON.stringify(e) + JSON.stringify(i);
|
|
5544
5813
|
if (this.selectorArrStr === s && this.cellTarget) {
|
|
@@ -5561,8 +5830,8 @@ class ui {
|
|
|
5561
5830
|
});
|
|
5562
5831
|
}
|
|
5563
5832
|
isInSelectorRange(t, e) {
|
|
5564
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [
|
|
5565
|
-
return !(e < o || e > r || t <
|
|
5833
|
+
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a, l] = s;
|
|
5834
|
+
return !(e < o || e > r || t < a || t > l);
|
|
5566
5835
|
}
|
|
5567
5836
|
initTextEditor() {
|
|
5568
5837
|
this.inputEl = document.createElement("textarea"), this.inputEl.setAttribute("rows", "1"), this.inputEl.addEventListener("input", this.autoSize.bind(this)), this.inputEl.addEventListener("blur", () => {
|
|
@@ -5578,14 +5847,14 @@ class ui {
|
|
|
5578
5847
|
footer: s,
|
|
5579
5848
|
header: o,
|
|
5580
5849
|
config: { SCROLLER_TRACK_SIZE: r }
|
|
5581
|
-
} = this.ctx,
|
|
5582
|
-
this.editorEl.style.bottom = "auto", this.drawY < o.height && (this.editorEl.style.top = `${o.height - 1}px`), this.drawY + t >
|
|
5850
|
+
} = this.ctx, a = i - s.height - r;
|
|
5851
|
+
this.editorEl.style.bottom = "auto", this.drawY < o.height && (this.editorEl.style.top = `${o.height - 1}px`), this.drawY + t > a && (this.editorEl.style.left = `${this.drawX - 1}px`, this.editorEl.style.top = "auto", this.editorEl.style.bottom = `${i - a}px`), this.inputEl.style.height = `${t}px`;
|
|
5583
5852
|
}
|
|
5584
5853
|
startEditByInput(t, e = !1) {
|
|
5585
5854
|
const i = e ? null : t.getValue(), { editorType: s } = t;
|
|
5586
5855
|
t.update(), this.ctx.config.ENABLE_MERGE_CELL_LINK && t.updateSpanInfo();
|
|
5587
|
-
let { height: o, width: r, drawY:
|
|
5588
|
-
this.drawX =
|
|
5856
|
+
let { height: o, width: r, drawY: a, drawX: l } = t;
|
|
5857
|
+
this.drawX = l, this.drawY = a;
|
|
5589
5858
|
const {
|
|
5590
5859
|
config: { CELL_PADDING: h },
|
|
5591
5860
|
header: d
|
|
@@ -5593,8 +5862,8 @@ class ui {
|
|
|
5593
5862
|
let f = this.ctx.body.visibleHeight;
|
|
5594
5863
|
if (o > f && (o = f), this.editorEl.style.display = "inline-block", this.editorEl.style.left = `${this.drawX - 1}px`, this.editorEl.style.top = `${this.drawY - 1}px`, this.editorEl.style.bottom = "auto", this.editorEl.style.maxHeight = `${f}px`, s === "text") {
|
|
5595
5864
|
this.inputEl.style.display = "block", this.inputEl.style.minWidth = `${r - 1}px`, this.inputEl.style.minHeight = `${o - 1}px`, this.inputEl.style.maxHeight = `${f}px`, this.inputEl.style.width = `${r - 1}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${h}px`, i !== null && (this.inputEl.value = i), this.inputEl.focus({ preventScroll: !0 });
|
|
5596
|
-
const
|
|
5597
|
-
this.inputEl.setSelectionRange(
|
|
5865
|
+
const u = this.inputEl.value.length;
|
|
5866
|
+
this.inputEl.setSelectionRange(u, u);
|
|
5598
5867
|
} else
|
|
5599
5868
|
this.inputEl.style.display = "none";
|
|
5600
5869
|
(this.inputEl.scrollHeight > o || this.drawY < d.height) && this.autoSize();
|
|
@@ -5613,11 +5882,11 @@ class ui {
|
|
|
5613
5882
|
const i = this.ctx.focusCell;
|
|
5614
5883
|
if (!i || ["index", "index-selection", "selection"].includes(i.type) || this.enable || (this.ctx.emit("drawView"), !(i.isVerticalVisible() && i.isHorizontalVisible())))
|
|
5615
5884
|
return;
|
|
5616
|
-
const { rowKey: o, key: r, editorType:
|
|
5617
|
-
if (
|
|
5885
|
+
const { rowKey: o, key: r, editorType: a } = i;
|
|
5886
|
+
if (a === "none")
|
|
5618
5887
|
return;
|
|
5619
|
-
const
|
|
5620
|
-
i && !
|
|
5888
|
+
const l = this.ctx.database.getReadonly(o, r);
|
|
5889
|
+
i && !l && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = i, this.startEditByInput(this.cellTarget, t), this.ctx.emit("startEdit", this.cellTarget));
|
|
5621
5890
|
}
|
|
5622
5891
|
editCell(t, e) {
|
|
5623
5892
|
const i = this.ctx.body.renderRows.find((h) => h.rowIndex === t);
|
|
@@ -5630,8 +5899,8 @@ class ui {
|
|
|
5630
5899
|
const o = this.ctx.focusCell;
|
|
5631
5900
|
if (!o || ["index", "index-selection", "selection"].includes(o.type) || this.enable)
|
|
5632
5901
|
return;
|
|
5633
|
-
const { rowKey: r, key:
|
|
5634
|
-
o && !
|
|
5902
|
+
const { rowKey: r, key: a } = o, l = this.ctx.database.getReadonly(r, a);
|
|
5903
|
+
o && !l && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = o, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
5635
5904
|
}
|
|
5636
5905
|
doneEdit() {
|
|
5637
5906
|
this.enable && (this.doneEditByInput(), this.ctx.emit("doneEdit", this.cellTarget), this.enable = !1, this.ctx.editing = !1, this.ctx.containerElement.focus({ preventScroll: !0 }), this.editorEl.style.display = "none", this.ctx.emit("drawView"));
|
|
@@ -5650,14 +5919,14 @@ class gi {
|
|
|
5650
5919
|
n(this, "emptyEl");
|
|
5651
5920
|
this.ctx = t;
|
|
5652
5921
|
const { EMPTY_TEXT: e, EMPTY_CUSTOM_STYLE: i } = this.ctx.config;
|
|
5653
|
-
this.ctx.emptyElement ? this.emptyEl = this.ctx.emptyElement : (this.emptyEl = document.createElement("div"), this.emptyEl.innerText = e), this.emptyEl.className = "e-virt-table-empty", this.emptyEl.style.display = "none", this.ctx.containerElement.appendChild(this.emptyEl), this.ctx.on("emptyChange", ({ type: s, headerHeight: o, bodyHeight: r, footerHeight:
|
|
5654
|
-
const
|
|
5922
|
+
this.ctx.emptyElement ? this.emptyEl = this.ctx.emptyElement : (this.emptyEl = document.createElement("div"), this.emptyEl.innerText = e), this.emptyEl.className = "e-virt-table-empty", this.emptyEl.style.display = "none", this.ctx.containerElement.appendChild(this.emptyEl), this.ctx.on("emptyChange", ({ type: s, headerHeight: o, bodyHeight: r, footerHeight: a }) => {
|
|
5923
|
+
const l = o + (r + a) / 2, h = {
|
|
5655
5924
|
display: s === "empty" ? "block" : "none",
|
|
5656
5925
|
position: "absolute",
|
|
5657
5926
|
fontSize: "14px",
|
|
5658
5927
|
color: "#666",
|
|
5659
5928
|
left: "50%",
|
|
5660
|
-
top: `${
|
|
5929
|
+
top: `${l}px`,
|
|
5661
5930
|
transform: "translate(-50%, -50%)",
|
|
5662
5931
|
...i
|
|
5663
5932
|
};
|
|
@@ -5696,12 +5965,12 @@ class wi {
|
|
|
5696
5965
|
fixedLeftWidth: t,
|
|
5697
5966
|
fixedRightWidth: e,
|
|
5698
5967
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
5699
|
-
} = this.ctx, { visibleWidth: o, visibleHeight: r, renderCellHeaders:
|
|
5700
|
-
let
|
|
5701
|
-
|
|
5702
|
-
|
|
5968
|
+
} = this.ctx, { visibleWidth: o, visibleHeight: r, renderCellHeaders: a } = this.ctx.header;
|
|
5969
|
+
let l = [], h = [], d = [];
|
|
5970
|
+
a.forEach((g) => {
|
|
5971
|
+
g.render && (g.fixed === "left" ? h.push(g) : g.fixed === "right" ? d.push(g) : l.push(g));
|
|
5703
5972
|
});
|
|
5704
|
-
const f = e - i,
|
|
5973
|
+
const f = e - i, u = {
|
|
5705
5974
|
key: "left",
|
|
5706
5975
|
style: {
|
|
5707
5976
|
position: "absolute",
|
|
@@ -5712,7 +5981,7 @@ class wi {
|
|
|
5712
5981
|
height: `${r}px`
|
|
5713
5982
|
},
|
|
5714
5983
|
cells: h
|
|
5715
|
-
},
|
|
5984
|
+
}, x = {
|
|
5716
5985
|
key: "center",
|
|
5717
5986
|
style: {
|
|
5718
5987
|
position: "absolute",
|
|
@@ -5722,8 +5991,8 @@ class wi {
|
|
|
5722
5991
|
width: `${o - t - f + 1}px`,
|
|
5723
5992
|
height: `${r}px`
|
|
5724
5993
|
},
|
|
5725
|
-
cells:
|
|
5726
|
-
},
|
|
5994
|
+
cells: l
|
|
5995
|
+
}, w = {
|
|
5727
5996
|
key: "right",
|
|
5728
5997
|
style: {
|
|
5729
5998
|
position: "absolute",
|
|
@@ -5744,22 +6013,22 @@ class wi {
|
|
|
5744
6013
|
width: `${o}px`,
|
|
5745
6014
|
height: `${r}px`
|
|
5746
6015
|
},
|
|
5747
|
-
views: [
|
|
6016
|
+
views: [u, x, w]
|
|
5748
6017
|
};
|
|
5749
6018
|
}
|
|
5750
6019
|
getBody() {
|
|
5751
6020
|
const t = [], e = [], i = [];
|
|
5752
6021
|
let s = this.ctx.body.renderRows;
|
|
5753
|
-
this.ctx.config.FOOTER_FIXED || (s = s.concat(this.ctx.footer.renderRows)), s.forEach((
|
|
5754
|
-
|
|
5755
|
-
|
|
6022
|
+
this.ctx.config.FOOTER_FIXED || (s = s.concat(this.ctx.footer.renderRows)), s.forEach((g) => {
|
|
6023
|
+
g.cells.forEach((p) => {
|
|
6024
|
+
p.cellType === "footer" && (p.render = p.renderFooter), p.render && (p.fixed === "left" ? e.push(p) : p.fixed === "right" ? i.push(p) : t.push(p));
|
|
5756
6025
|
});
|
|
5757
6026
|
});
|
|
5758
6027
|
const {
|
|
5759
6028
|
fixedLeftWidth: o,
|
|
5760
6029
|
fixedRightWidth: r,
|
|
5761
|
-
config: { SCROLLER_TRACK_SIZE:
|
|
5762
|
-
} = this.ctx, { visibleWidth: h, visibleHeight: d } = this.ctx.body, f = r -
|
|
6030
|
+
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX: l }
|
|
6031
|
+
} = this.ctx, { visibleWidth: h, visibleHeight: d } = this.ctx.body, f = r - a, u = {
|
|
5763
6032
|
key: "left",
|
|
5764
6033
|
style: {
|
|
5765
6034
|
position: "absolute",
|
|
@@ -5770,7 +6039,7 @@ class wi {
|
|
|
5770
6039
|
height: `${d}px`
|
|
5771
6040
|
},
|
|
5772
6041
|
cells: e
|
|
5773
|
-
},
|
|
6042
|
+
}, x = {
|
|
5774
6043
|
key: "center",
|
|
5775
6044
|
style: {
|
|
5776
6045
|
position: "absolute",
|
|
@@ -5781,7 +6050,7 @@ class wi {
|
|
|
5781
6050
|
height: `${d}px`
|
|
5782
6051
|
},
|
|
5783
6052
|
cells: t
|
|
5784
|
-
},
|
|
6053
|
+
}, w = {
|
|
5785
6054
|
key: "right",
|
|
5786
6055
|
style: {
|
|
5787
6056
|
position: "absolute",
|
|
@@ -5795,28 +6064,28 @@ class wi {
|
|
|
5795
6064
|
};
|
|
5796
6065
|
return {
|
|
5797
6066
|
type: "body",
|
|
5798
|
-
class: `${
|
|
6067
|
+
class: `${l}-overlayer-body`,
|
|
5799
6068
|
style: {
|
|
5800
6069
|
position: "relative",
|
|
5801
6070
|
overflow: "hidden",
|
|
5802
6071
|
width: `${h}px`,
|
|
5803
6072
|
height: `${d}px`
|
|
5804
6073
|
},
|
|
5805
|
-
views: [
|
|
6074
|
+
views: [u, x, w]
|
|
5806
6075
|
};
|
|
5807
6076
|
}
|
|
5808
6077
|
getFooter() {
|
|
5809
6078
|
const t = [], e = [], i = [];
|
|
5810
|
-
this.ctx.footer.renderRows.forEach((
|
|
5811
|
-
|
|
5812
|
-
|
|
6079
|
+
this.ctx.footer.renderRows.forEach((E) => {
|
|
6080
|
+
E.cells.forEach((g) => {
|
|
6081
|
+
g.cellType === "footer" && g.renderFooter && (g.render = g.renderFooter, g.fixed === "left" ? e.push(g) : g.fixed === "right" ? i.push(g) : t.push(g));
|
|
5813
6082
|
});
|
|
5814
6083
|
});
|
|
5815
6084
|
const {
|
|
5816
6085
|
fixedLeftWidth: s,
|
|
5817
6086
|
fixedRightWidth: o,
|
|
5818
|
-
config: { SCROLLER_TRACK_SIZE: r, CSS_PREFIX:
|
|
5819
|
-
} = this.ctx, { visibleWidth:
|
|
6087
|
+
config: { SCROLLER_TRACK_SIZE: r, CSS_PREFIX: a }
|
|
6088
|
+
} = this.ctx, { visibleWidth: l, visibleHeight: h } = this.ctx.footer, d = o - r, f = {
|
|
5820
6089
|
key: "left",
|
|
5821
6090
|
style: {
|
|
5822
6091
|
position: "absolute",
|
|
@@ -5827,18 +6096,18 @@ class wi {
|
|
|
5827
6096
|
height: `${h}px`
|
|
5828
6097
|
},
|
|
5829
6098
|
cells: e
|
|
5830
|
-
},
|
|
6099
|
+
}, u = {
|
|
5831
6100
|
key: "center",
|
|
5832
6101
|
style: {
|
|
5833
6102
|
position: "absolute",
|
|
5834
6103
|
top: `${0.5}px`,
|
|
5835
6104
|
left: `${s - 0.5}px`,
|
|
5836
6105
|
overflow: "hidden",
|
|
5837
|
-
width: `${
|
|
6106
|
+
width: `${l - s - d}px`,
|
|
5838
6107
|
height: `${h}px`
|
|
5839
6108
|
},
|
|
5840
6109
|
cells: t
|
|
5841
|
-
},
|
|
6110
|
+
}, x = {
|
|
5842
6111
|
key: "right",
|
|
5843
6112
|
style: {
|
|
5844
6113
|
position: "absolute",
|
|
@@ -5852,18 +6121,18 @@ class wi {
|
|
|
5852
6121
|
};
|
|
5853
6122
|
return {
|
|
5854
6123
|
type: "footer",
|
|
5855
|
-
class: `${
|
|
6124
|
+
class: `${a}-overlayer-footer`,
|
|
5856
6125
|
style: {
|
|
5857
6126
|
position: "relative",
|
|
5858
6127
|
overflow: "hidden",
|
|
5859
|
-
width: `${
|
|
6128
|
+
width: `${l}px`,
|
|
5860
6129
|
height: `${h}px`
|
|
5861
6130
|
},
|
|
5862
|
-
views: [f,
|
|
6131
|
+
views: [f, u, x]
|
|
5863
6132
|
};
|
|
5864
6133
|
}
|
|
5865
6134
|
}
|
|
5866
|
-
class
|
|
6135
|
+
class Ei {
|
|
5867
6136
|
constructor(t) {
|
|
5868
6137
|
n(this, "ctx");
|
|
5869
6138
|
n(this, "contextMenuEl");
|
|
@@ -5874,9 +6143,9 @@ class pi {
|
|
|
5874
6143
|
this.ctx.on("cellContextMenuClick", (t, e) => {
|
|
5875
6144
|
if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
|
|
5876
6145
|
e.preventDefault();
|
|
5877
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [
|
|
5878
|
-
h >=
|
|
5879
|
-
const
|
|
6146
|
+
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a, l] = s, { rowIndex: h, colIndex: d } = t;
|
|
6147
|
+
h >= a && h <= l && d >= o && d <= r || this.ctx.emit("setSelectorCell", t, e);
|
|
6148
|
+
const u = {
|
|
5880
6149
|
getBoundingClientRect: () => ({
|
|
5881
6150
|
width: 0,
|
|
5882
6151
|
height: 0,
|
|
@@ -5889,11 +6158,11 @@ class pi {
|
|
|
5889
6158
|
}),
|
|
5890
6159
|
contextElement: document.body
|
|
5891
6160
|
};
|
|
5892
|
-
Qt(
|
|
6161
|
+
Qt(u, this.contextMenuEl, {
|
|
5893
6162
|
placement: "right-start",
|
|
5894
6163
|
middleware: [Zt(), qt(), Jt()]
|
|
5895
|
-
}).then(({ x
|
|
5896
|
-
this.show(
|
|
6164
|
+
}).then(({ x, y: w }) => {
|
|
6165
|
+
this.show(x, w);
|
|
5897
6166
|
});
|
|
5898
6167
|
}), this.ctx.on("click", this.hide.bind(this)), this.ctx.on("onScroll", this.hide.bind(this)), this.ctx.on("resize", this.hide.bind(this));
|
|
5899
6168
|
}
|
|
@@ -5965,14 +6234,14 @@ class yi {
|
|
|
5965
6234
|
n(this, "contextMenu");
|
|
5966
6235
|
n(this, "ctx");
|
|
5967
6236
|
this.options = e;
|
|
5968
|
-
const { overlayerElement: i, editorElement: s, emptyElement: o, contextMenuElement: r } =
|
|
6237
|
+
const { overlayerElement: i, editorElement: s, emptyElement: o, contextMenuElement: r } = this.options, a = this.createContainer(
|
|
5969
6238
|
t,
|
|
5970
6239
|
i,
|
|
5971
6240
|
s,
|
|
5972
6241
|
o,
|
|
5973
6242
|
r
|
|
5974
6243
|
);
|
|
5975
|
-
this.ctx = new
|
|
6244
|
+
this.ctx = new pe(a, this.options), this.header = new ye(this.ctx), this.footer = new be(this.ctx), this.body = new Ce(this.ctx), this.scroller = new me(this.ctx), this.selector = new Re(this.ctx), this.autofill = new Ie(this.ctx), this.tooltip = new xi(this.ctx), this.empty = new gi(this.ctx), this.editor = new ui(this.ctx), this.overlayer = new wi(this.ctx), this.contextMenu = new Ei(this.ctx), this.ctx.on("draw", () => {
|
|
5976
6245
|
this.draw();
|
|
5977
6246
|
}), this.ctx.on("drawView", () => {
|
|
5978
6247
|
this.draw(!0);
|
|
@@ -5980,16 +6249,16 @@ class yi {
|
|
|
5980
6249
|
}
|
|
5981
6250
|
createContainer(t, e, i, s, o) {
|
|
5982
6251
|
t.className = "e-virt-table-container";
|
|
5983
|
-
const r = document.createElement("div"),
|
|
5984
|
-
r.className = "e-virt-table-stage", t.tabIndex = 0,
|
|
6252
|
+
const r = document.createElement("div"), a = document.createElement("canvas"), l = e || document.createElement("div");
|
|
6253
|
+
r.className = "e-virt-table-stage", t.tabIndex = 0, a.className = "e-virt-table-canvas", l.className = "e-virt-table-overlayer";
|
|
5985
6254
|
const h = i || document.createElement("div");
|
|
5986
6255
|
h.className = "e-virt-table-editor";
|
|
5987
6256
|
const d = s, f = o;
|
|
5988
|
-
return r.appendChild(
|
|
6257
|
+
return r.appendChild(a), r.appendChild(l), t.appendChild(r), {
|
|
5989
6258
|
containerElement: t,
|
|
5990
6259
|
stageElement: r,
|
|
5991
|
-
canvasElement:
|
|
5992
|
-
overlayerElement:
|
|
6260
|
+
canvasElement: a,
|
|
6261
|
+
overlayerElement: l,
|
|
5993
6262
|
editorElement: h,
|
|
5994
6263
|
emptyElement: d,
|
|
5995
6264
|
contextMenuElement: f
|
|
@@ -6077,15 +6346,15 @@ class yi {
|
|
|
6077
6346
|
return new Promise(async (i, s) => {
|
|
6078
6347
|
let o = [];
|
|
6079
6348
|
for (let r = 0; r < t.length; r++) {
|
|
6080
|
-
const { rowKey:
|
|
6349
|
+
const { rowKey: a, key: l } = t[r], h = await this.ctx.database.getValidator(a, l);
|
|
6081
6350
|
Array.isArray(h) && h.length && o.push(h);
|
|
6082
6351
|
}
|
|
6083
6352
|
if (o.length) {
|
|
6084
6353
|
if (s(o), e) {
|
|
6085
6354
|
const [r] = o;
|
|
6086
6355
|
if (Array.isArray(r) && r.length) {
|
|
6087
|
-
const [
|
|
6088
|
-
this.scrollToRowkey(
|
|
6356
|
+
const [a] = r, { rowKey: l, key: h } = a;
|
|
6357
|
+
this.scrollToRowkey(l), this.scrollToColkey(h);
|
|
6089
6358
|
}
|
|
6090
6359
|
}
|
|
6091
6360
|
this.ctx.emit("draw");
|
|
@@ -6102,12 +6371,12 @@ class yi {
|
|
|
6102
6371
|
if (t && Array.isArray(s) && s.length) {
|
|
6103
6372
|
const [o] = s;
|
|
6104
6373
|
if (Array.isArray(o) && o.length) {
|
|
6105
|
-
const [r] = o, { rowKey:
|
|
6374
|
+
const [r] = o, { rowKey: a, key: l } = r, h = this.ctx.database.getRowForRowKey(a);
|
|
6106
6375
|
if (h) {
|
|
6107
6376
|
const { parentRowKeys: d = [] } = h;
|
|
6108
6377
|
d && d.length && this.setExpandRowKeys(d, !0);
|
|
6109
6378
|
}
|
|
6110
|
-
this.scrollToRowkey(
|
|
6379
|
+
this.scrollToRowkey(a), this.scrollToColkey(l);
|
|
6111
6380
|
}
|
|
6112
6381
|
}
|
|
6113
6382
|
i(s);
|
|
@@ -6131,8 +6400,8 @@ class yi {
|
|
|
6131
6400
|
const i = this.ctx.database.getAllRowsData(), s = this.ctx.header.leafCellHeaders;
|
|
6132
6401
|
let o = [];
|
|
6133
6402
|
for (let r = 0; r < i.length; r++)
|
|
6134
|
-
for (let
|
|
6135
|
-
const
|
|
6403
|
+
for (let a = 0; a < s.length; a++) {
|
|
6404
|
+
const l = this.ctx.database.getRowKeyByItem(i[r]), d = s[a].key, f = await this.ctx.database.getValidator(l, d);
|
|
6136
6405
|
Array.isArray(f) && f.length && o.push(f);
|
|
6137
6406
|
}
|
|
6138
6407
|
o.length ? (e(o), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
|
|
@@ -6213,9 +6482,9 @@ class yi {
|
|
|
6213
6482
|
getUtils() {
|
|
6214
6483
|
return {
|
|
6215
6484
|
mergeColCell: he,
|
|
6216
|
-
mergeRowCell:
|
|
6217
|
-
getSpanArrByRow:
|
|
6218
|
-
getSpanObjByColumn:
|
|
6485
|
+
mergeRowCell: le,
|
|
6486
|
+
getSpanArrByRow: Dt,
|
|
6487
|
+
getSpanObjByColumn: kt
|
|
6219
6488
|
};
|
|
6220
6489
|
}
|
|
6221
6490
|
getColumnByKey(t) {
|