e-virt-table 1.2.26 → 1.2.28
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 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1195 -1011
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +4 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Autofill.js +2 -0
- package/dist/lib/Autofill.js.map +1 -1
- package/dist/lib/Body.d.ts +1 -0
- package/dist/lib/Body.js +16 -2
- package/dist/lib/Body.js.map +1 -1
- package/dist/lib/Cell.d.ts +10 -1
- package/dist/lib/Cell.js +85 -6
- package/dist/lib/Cell.js.map +1 -1
- package/dist/lib/CellHeader.d.ts +2 -2
- package/dist/lib/CellHeader.js +15 -64
- package/dist/lib/CellHeader.js.map +1 -1
- package/dist/lib/Config.d.ts +4 -0
- package/dist/lib/Config.js +14 -0
- package/dist/lib/Config.js.map +1 -1
- package/dist/lib/Database.d.ts +11 -0
- package/dist/lib/Database.js +64 -3
- package/dist/lib/Database.js.map +1 -1
- package/dist/lib/EVirtTable.js.map +1 -1
- package/dist/lib/Editor.js +5 -10
- package/dist/lib/Editor.js.map +1 -1
- package/dist/lib/EventTable.js +28 -1
- package/dist/lib/EventTable.js.map +1 -1
- package/dist/lib/Overlayer.d.ts +1 -0
- package/dist/lib/Overlayer.js +18 -0
- package/dist/lib/Overlayer.js.map +1 -1
- package/dist/lib/Paint.d.ts +32 -2
- package/dist/lib/Paint.js +180 -22
- package/dist/lib/Paint.js.map +1 -1
- package/dist/lib/Row.d.ts +3 -0
- package/dist/lib/Row.js +24 -0
- package/dist/lib/Row.js.map +1 -1
- package/dist/lib/Selector.js +1 -0
- package/dist/lib/Selector.js.map +1 -1
- package/dist/lib/types.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode(":root{--evt-header-font: 12px normal Arial;--evt-body-font: 12px normal Arial;--evt-color-white: #fff;--evt-color-black: #000000;--evt-color-primary: rgb(82, 146, 247);--evt-text-color-primary: #333;--evt-text-color-regular: #666;--evt-text-color-secondary: #999;--evt-box-shadow: 0 2px 12px 0 #0000001a;--evt-editor-bg-color: #fff;--evt-editor-text-color: #333;--evt-border-color: #e1e6eb;--evt-stripe-color: #fafafa;--evt-placeholder-color: #cdd0dc;--evt-header-bg-color: #f8faff;--evt-body-bg-color: #fff;--evt-header-text-color: #1d2129;--evt-body-text-color: #4e5969;--evt-footer-text-color: #4e5969;--evt-loading-icon-color: #4e5969;--evt-expand-icon-color: #4e5969;--evt-shrink-icon-color: #4e5969;--evt-error-tip-icon-color: red;--evt-cell-hover-icon-bg-color: #fff;--evt-cell-hover-icon-border-color: #dde0ea;--evt-scroller-color: #dee0e3;--evt-scroller-track-color: #fff;--evt-scroller-focus-color: #bbbec4;--evt-select-border-color: var(--evt-color-primary);--evt-select-area-color: rgba(82, 146, 247, .1);--evt-select-row-col-bg-color: transparent;--evt-autofill-point-border-color: #fff;--evt-edit-bg-color: #fcf6ed;--evt-checkbox-color: var(--evt-color-primary);--evt-readonly-color: #fff;--evt-readonly-text-color: var(--evt-body-text-color);--evt-error-tip-color: #ed3f14;--evt-footer-bg-color: #fafafa;--evt-highlight-hover-row-color: rgba(186, 203, 231, .1);--evt-highlight-selected-row-color: rgba(82, 146, 247, .1);--evt-tooltip-bg-color: #303133;--evt-tooltip-text-color: #fff;--evt-resize-row-line-color: #e1e6eb;--evt-resize-column-line-color: #e1e6eb;--evt-tree-line-color: #e1e6eb;--evt-sort-icon-color: rgb(82, 146, 247)}.dark{--evt-border-color: #363637;--evt-header-bg-color: #141414;--evt-body-bg-color: #141414;--evt-header-text-color: #a3a6ad;--evt-scroller-color: #414243;--evt-scroller-track-color: #141414;--evt-scroller-focus-color: #a3a6ad;--evt-edit-bg-color: #141414;--evt-readonly-text-color: #cfd3dc;--evt-footer-bg-color: #262727;--evt-autofill-point-border-color: #fff;--evt-editor-bg-color: #434343;--evt-editor-text-color: #cfd3dc}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;box-sizing:border-box;z-index:10;border-radius:8px;border:1px solid var(--evt-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;border:none;outline:none;z-index:10}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--evt-editor-bg-color);border:2px solid var(--evt-color-primary);box-sizing:border-box;box-shadow:var(--evt-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:absolute;left:0;top:0;overflow:hidden;z-index:100;pointer-events:none}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--evt-editor-bg-color);color:var(--evt-editor-text-color);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--evt-text-color-regular);background-color:var(--evt-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--evt-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:8px 24px;color:var(--evt-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--evt-color-primary);background-color:#f5f7fa}")),document.head.appendChild(o)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
2
|
var se = Object.defineProperty;
|
|
3
|
-
var oe = (
|
|
4
|
-
var n = (
|
|
3
|
+
var oe = (c, t, e) => t in c ? se(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
|
|
4
|
+
var n = (c, t, e) => oe(c, typeof t != "symbol" ? t + "" : t, e);
|
|
5
5
|
class re {
|
|
6
6
|
constructor(t) {
|
|
7
7
|
n(this, "rules");
|
|
8
8
|
this.rules = t;
|
|
9
9
|
}
|
|
10
10
|
validate(t) {
|
|
11
|
-
const e = [], { column: i, row: s, key: o, rowKey: r, colIndex: a, rowIndex:
|
|
11
|
+
const e = [], { column: i, row: s, key: o, rowKey: r, colIndex: a, rowIndex: l, value: h, field: d, fieldValue: f } = t;
|
|
12
12
|
Array.isArray(this.rules) || (this.rules = [this.rules]);
|
|
13
13
|
for (const u of this.rules) {
|
|
14
14
|
if (u.validator) {
|
|
15
15
|
const x = {
|
|
16
16
|
field: d,
|
|
17
17
|
fieldValue: f,
|
|
18
|
-
value:
|
|
18
|
+
value: h,
|
|
19
19
|
column: i,
|
|
20
20
|
colIndex: a,
|
|
21
|
-
rowIndex:
|
|
21
|
+
rowIndex: l,
|
|
22
22
|
row: s,
|
|
23
23
|
key: o,
|
|
24
24
|
rowKey: r,
|
|
25
25
|
...u
|
|
26
26
|
};
|
|
27
|
-
u.validator(x,
|
|
27
|
+
u.validator(x, h, (w) => {
|
|
28
28
|
w && e.push({
|
|
29
29
|
...x,
|
|
30
30
|
message: w
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
if (!u.required && (
|
|
34
|
+
if (!u.required && (h == null || h === ""))
|
|
35
35
|
return e;
|
|
36
|
-
u.pattern && !u.pattern.test(
|
|
37
|
-
value:
|
|
36
|
+
u.pattern && !u.pattern.test(h) && e.push({
|
|
37
|
+
value: h,
|
|
38
38
|
column: i,
|
|
39
39
|
row: s,
|
|
40
40
|
key: o,
|
|
41
41
|
rowKey: r,
|
|
42
42
|
colIndex: a,
|
|
43
|
-
rowIndex:
|
|
43
|
+
rowIndex: l,
|
|
44
44
|
field: d,
|
|
45
45
|
fieldValue: f,
|
|
46
46
|
message: u.message || `${o} is pattern validation error`
|
|
47
|
-
}), u.required && (
|
|
48
|
-
value:
|
|
47
|
+
}), u.required && (h == null || h === "") && e.push({
|
|
48
|
+
value: h,
|
|
49
49
|
column: i,
|
|
50
50
|
row: s,
|
|
51
51
|
key: o,
|
|
52
52
|
rowKey: r,
|
|
53
53
|
colIndex: a,
|
|
54
|
-
rowIndex:
|
|
54
|
+
rowIndex: l,
|
|
55
55
|
field: d,
|
|
56
56
|
fieldValue: f,
|
|
57
57
|
message: u.message || `${o} is required`
|
|
@@ -60,27 +60,27 @@ class re {
|
|
|
60
60
|
return e;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
return "xxxxxxxxxxxxxxxxxx".replace(/[x]/g, function(
|
|
63
|
+
function At() {
|
|
64
|
+
return "xxxxxxxxxxxxxxxxxx".replace(/[x]/g, function(c) {
|
|
65
65
|
const t = Math.random() * 16 | 0;
|
|
66
|
-
return (
|
|
66
|
+
return (c === "x" ? t : t & 3 | 8).toString(16);
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
function Ht(
|
|
69
|
+
function Ht(c, t) {
|
|
70
70
|
let e = 0, i;
|
|
71
71
|
return function(...s) {
|
|
72
72
|
const o = (/* @__PURE__ */ new Date()).getTime(), r = o - e;
|
|
73
|
-
!e || r >= t ? (
|
|
74
|
-
|
|
73
|
+
!e || r >= t ? (c.apply(this, s), e = o) : i || (i = setTimeout(() => {
|
|
74
|
+
c.apply(this, s), e = (/* @__PURE__ */ new Date()).getTime(), i = void 0;
|
|
75
75
|
}, t - r));
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
function Dt(
|
|
79
|
-
return
|
|
78
|
+
function Dt(c = []) {
|
|
79
|
+
return c.length ? c.map((t) => Dt(t.children) + 1).sort((t, e) => e - t)[0] : 0;
|
|
80
80
|
}
|
|
81
|
-
function ne(
|
|
81
|
+
function ne(c = []) {
|
|
82
82
|
let t = [], e = [], i = [];
|
|
83
|
-
return
|
|
83
|
+
return c.forEach((s) => {
|
|
84
84
|
s.fixed === "left" ? t.push(s) : s.fixed === "right" ? i.push(s) : e.push(s);
|
|
85
85
|
}), [
|
|
86
86
|
...t.sort((s, o) => (s.sort ?? 0) - (o.sort ?? 0)),
|
|
@@ -88,8 +88,8 @@ function ne(h = []) {
|
|
|
88
88
|
...i.sort((s, o) => (s.sort ?? 0) - (o.sort ?? 0))
|
|
89
89
|
];
|
|
90
90
|
}
|
|
91
|
-
function Nt(
|
|
92
|
-
return
|
|
91
|
+
function Nt(c = [], t = 1, e = 0) {
|
|
92
|
+
return c.map((i) => {
|
|
93
93
|
if (i.children) {
|
|
94
94
|
let s = 0, o = i.fixed;
|
|
95
95
|
i.children.forEach((a) => {
|
|
@@ -115,72 +115,72 @@ function Nt(h = [], t = 1, e = 0) {
|
|
|
115
115
|
};
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
|
-
function et(
|
|
118
|
+
function et(c = []) {
|
|
119
119
|
let t = [];
|
|
120
|
-
return
|
|
120
|
+
return c.forEach((e) => {
|
|
121
121
|
e.children ? t = t.concat(et(e.children)) : t.push(e);
|
|
122
122
|
}), t;
|
|
123
123
|
}
|
|
124
124
|
const yt = /^(\r\n|\n\r|\r|\n)/, ae = /^[^\t\r\n]+/, Ct = /^\t/;
|
|
125
|
-
function
|
|
125
|
+
function le(c) {
|
|
126
126
|
let t = [[""]];
|
|
127
|
-
if (
|
|
127
|
+
if (c.length === 0)
|
|
128
128
|
return t;
|
|
129
129
|
let e = 0, i = 0, s;
|
|
130
|
-
for (;
|
|
131
|
-
if (s =
|
|
132
|
-
|
|
133
|
-
else if (
|
|
134
|
-
|
|
130
|
+
for (; c.length > 0 && s !== c.length; )
|
|
131
|
+
if (s = c.length, c.match(Ct))
|
|
132
|
+
c = c.replace(Ct, ""), e += 1, t[i][e] = "";
|
|
133
|
+
else if (c.match(yt))
|
|
134
|
+
c = c.replace(yt, ""), e = 0, i += 1, t[i] = [""];
|
|
135
135
|
else {
|
|
136
136
|
let o = "";
|
|
137
|
-
if (
|
|
137
|
+
if (c.startsWith('"')) {
|
|
138
138
|
let r = 0, a = !0;
|
|
139
139
|
for (; a; ) {
|
|
140
|
-
const
|
|
141
|
-
|
|
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
|
-
const r =
|
|
146
|
-
o = r ? r[0] : "",
|
|
145
|
+
const r = c.match(ae);
|
|
146
|
+
o = r ? r[0] : "", c = c.slice(o.length);
|
|
147
147
|
}
|
|
148
148
|
t[i][e] = o;
|
|
149
149
|
}
|
|
150
150
|
return Array.isArray(t) && t.length > 1 && t[t.length - 1].length === 1 && t[t.length - 1][0] === "" && (t = t.slice(0, t.length - 1)), t;
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function he(c) {
|
|
153
153
|
let t, e, i, s, o = "", r;
|
|
154
|
-
for (t = 0, e =
|
|
155
|
-
for (s =
|
|
156
|
-
i > 0 && (o += " "), r =
|
|
154
|
+
for (t = 0, e = c.length; t < e; t += 1) {
|
|
155
|
+
for (s = c[t].length, i = 0; i < s; i += 1)
|
|
156
|
+
i > 0 && (o += " "), r = c[t][i], typeof r == "string" ? r.indexOf(`
|
|
157
157
|
`) > -1 ? o += `"${r.replace(/"/g, '""')}"` : o += r : r == null ? o += "" : o += r;
|
|
158
158
|
t !== e - 1 && (o += `
|
|
159
159
|
`);
|
|
160
160
|
}
|
|
161
161
|
return o;
|
|
162
162
|
}
|
|
163
|
-
function kt(
|
|
163
|
+
function kt(c, t, e = []) {
|
|
164
164
|
let i = 0;
|
|
165
165
|
const s = [];
|
|
166
|
-
return
|
|
166
|
+
return c.forEach((o, r) => {
|
|
167
167
|
if (r === 0)
|
|
168
168
|
s.push(1);
|
|
169
169
|
else {
|
|
170
|
-
const a = e.reduce((
|
|
171
|
-
a ===
|
|
170
|
+
const a = e.reduce((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 Xt(
|
|
175
|
+
function Xt(c, t) {
|
|
176
176
|
let e = "", i = "";
|
|
177
177
|
const s = {};
|
|
178
178
|
return t.forEach((o, r) => {
|
|
179
|
-
r === 0 ? (e = o.key, i = o.key, s[o.key] = 1) :
|
|
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 } =
|
|
182
|
+
function ce(c, t, e = []) {
|
|
183
|
+
const { visibleRows: i, rowIndex: s, headIndex: o } = c, r = kt(i, t, e);
|
|
184
184
|
return r[s - o] === 0 ? {
|
|
185
185
|
rowspan: 0,
|
|
186
186
|
colspan: 0,
|
|
@@ -193,8 +193,8 @@ function he(h, t, e = []) {
|
|
|
193
193
|
mergeRow: !0
|
|
194
194
|
};
|
|
195
195
|
}
|
|
196
|
-
function de(
|
|
197
|
-
const { column: e, row: i, visibleLeafColumns: s } =
|
|
196
|
+
function de(c, t = []) {
|
|
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
199
|
const r = Xt(i, o);
|
|
200
200
|
return r[e.key] === 0 ? {
|
|
@@ -210,15 +210,15 @@ function de(h, t = []) {
|
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
|
-
function fe(
|
|
214
|
-
const e =
|
|
213
|
+
function fe(c, t = document.documentElement) {
|
|
214
|
+
const e = c.startsWith("--") ? c : `--${c}`;
|
|
215
215
|
return getComputedStyle(t).getPropertyValue(e).trim();
|
|
216
216
|
}
|
|
217
|
-
function bt(
|
|
218
|
-
if (!
|
|
219
|
-
if (typeof
|
|
220
|
-
return new Date(
|
|
221
|
-
const t = String(
|
|
217
|
+
function bt(c) {
|
|
218
|
+
if (!c) return /* @__PURE__ */ new Date(0);
|
|
219
|
+
if (typeof c == "number")
|
|
220
|
+
return new Date(c);
|
|
221
|
+
const t = String(c).trim(), e = new Date(t);
|
|
222
222
|
if (!isNaN(e.getTime()))
|
|
223
223
|
return e;
|
|
224
224
|
const i = [
|
|
@@ -252,24 +252,24 @@ function bt(h) {
|
|
|
252
252
|
if (o) {
|
|
253
253
|
const r = o.slice(1).map(Number);
|
|
254
254
|
if (s.source.includes("YYYY-MM-DD") || s.source.includes("YYYY/MM/DD") || s.source.includes("YYYY.MM.DD")) {
|
|
255
|
-
const [a,
|
|
256
|
-
return new Date(a,
|
|
255
|
+
const [a, l, h, d = 0, f = 0, u = 0] = r;
|
|
256
|
+
return new Date(a, l - 1, h, d, f, u);
|
|
257
257
|
} else if (s.source.includes("DD-MM-YYYY") || s.source.includes("DD/MM/YYYY") || s.source.includes("DD.MM.YYYY")) {
|
|
258
|
-
const [a,
|
|
259
|
-
return new Date(
|
|
258
|
+
const [a, l, h, d = 0, f = 0, u = 0] = r;
|
|
259
|
+
return new Date(h, l - 1, a, d, f, u);
|
|
260
260
|
} else if (s.source.includes("MM-DD-YYYY") || s.source.includes("MM/DD/YYYY") || s.source.includes("MM.DD.YYYY")) {
|
|
261
|
-
const [a,
|
|
262
|
-
return new Date(
|
|
261
|
+
const [a, l, h, d = 0, f = 0, u = 0] = r;
|
|
262
|
+
return new Date(h, a - 1, l, d, f, u);
|
|
263
263
|
} else if (s.source.includes("YYYYMMDD")) {
|
|
264
|
-
const [a,
|
|
265
|
-
return new Date(a,
|
|
264
|
+
const [a, l, h] = r;
|
|
265
|
+
return new Date(a, l - 1, h);
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
return /* @__PURE__ */ new Date(NaN);
|
|
270
270
|
}
|
|
271
|
-
function xe(
|
|
272
|
-
const e = bt(
|
|
271
|
+
function xe(c, t) {
|
|
272
|
+
const e = bt(c), i = bt(t);
|
|
273
273
|
return isNaN(e.getTime()) && isNaN(i.getTime()) ? 0 : isNaN(e.getTime()) ? -1 : isNaN(i.getTime()) ? 1 : e.getTime() - i.getTime();
|
|
274
274
|
}
|
|
275
275
|
class Yt {
|
|
@@ -319,8 +319,8 @@ class Yt {
|
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
321
|
class xt extends Yt {
|
|
322
|
-
constructor(e, i, s, o, r, a,
|
|
323
|
-
super(e, o, r, a,
|
|
322
|
+
constructor(e, i, s, o, r, a, l, h, d, f = "body") {
|
|
323
|
+
super(e, o, r, a, l, f, h.fixed);
|
|
324
324
|
n(this, "formatter");
|
|
325
325
|
n(this, "formatterFooter");
|
|
326
326
|
n(this, "hoverIconName", "");
|
|
@@ -351,6 +351,7 @@ class xt extends Yt {
|
|
|
351
351
|
n(this, "render");
|
|
352
352
|
n(this, "renderFooter");
|
|
353
353
|
n(this, "style", {});
|
|
354
|
+
n(this, "domDataset", {});
|
|
354
355
|
n(this, "rules", []);
|
|
355
356
|
n(this, "message", "");
|
|
356
357
|
n(this, "text", "");
|
|
@@ -388,6 +389,10 @@ class xt extends Yt {
|
|
|
388
389
|
n(this, "drawHoverImageHeight", 0);
|
|
389
390
|
n(this, "drawHoverImageName", "");
|
|
390
391
|
n(this, "drawHoverImageSource");
|
|
392
|
+
n(this, "autoRowHeight", !1);
|
|
393
|
+
// 是否启用行高自适应
|
|
394
|
+
n(this, "calculatedHeight", 0);
|
|
395
|
+
// 计算出的自适应高度
|
|
391
396
|
n(this, "ellipsis", !1);
|
|
392
397
|
n(this, "rowExpand", !1);
|
|
393
398
|
n(this, "rowHasChildren", !1);
|
|
@@ -395,7 +400,8 @@ class xt extends Yt {
|
|
|
395
400
|
n(this, "selectorCellValueType", "value");
|
|
396
401
|
n(this, "overflowTooltipMaxWidth", 500);
|
|
397
402
|
n(this, "overflowTooltipPlacement", "top");
|
|
398
|
-
this
|
|
403
|
+
n(this, "maxLineClamp", "auto");
|
|
404
|
+
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = h.key, this.type = h.type || "", this.editorType = h.editorType || "text", this.selectorCellValueType = h.selectorCellValueType || this.ctx.config.SELECTOR_CELL_VALUE_TYPE || "value", this.editorProps = h.editorProps || {}, this.cellType = f, this.align = h.align || this.ctx.config.COLUMNS_ALIGN, this.verticalAlign = h.verticalAlign || this.ctx.config.COLUMNS_VERTICAL_ALIGN, this.fixed = h.fixed, this.level = h.level || 0, this.operation = h.operation || !1, this.column = h, this.rules = h.rules || [], this.row = d, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = h.render, this.overflowTooltipShow = h.overflowTooltipShow !== !1, this.autoRowHeight = h.autoRowHeight || this.ctx.config.AUTO_ROW_HEIGHT, this.overflowTooltipMaxWidth = h.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = h.overflowTooltipPlacement || "top", this.renderFooter = h.renderFooter, this.hoverIconName = h.hoverIconName, this.formatter = h.formatter, this.formatterFooter = h.formatterFooter, this.maxLineClamp = h.maxLineClamp || "auto", this.update();
|
|
399
405
|
}
|
|
400
406
|
setWidthHeight(e, i) {
|
|
401
407
|
this.width = e, this.height = i;
|
|
@@ -421,8 +427,8 @@ class xt extends Yt {
|
|
|
421
427
|
rowspan: o = 1,
|
|
422
428
|
relationRowKeys: r,
|
|
423
429
|
relationColKeys: a,
|
|
424
|
-
mergeRow:
|
|
425
|
-
mergeCol:
|
|
430
|
+
mergeRow: l = !1,
|
|
431
|
+
mergeCol: h = !1
|
|
426
432
|
} = i({
|
|
427
433
|
row: this.row,
|
|
428
434
|
rowIndex: this.rowIndex,
|
|
@@ -435,7 +441,7 @@ class xt extends Yt {
|
|
|
435
441
|
visibleLeafColumns: this.ctx.header.visibleLeafColumns,
|
|
436
442
|
rows: this.ctx.body.data
|
|
437
443
|
}) || {};
|
|
438
|
-
Array.isArray(r) && r.length > 0 ? this.relationRowKeys = r : this.relationRowKeys = [this.key], Array.isArray(a) && a.length > 0 ? this.relationColKeys = a : this.relationColKeys = [this.key], this.mergeCol =
|
|
444
|
+
Array.isArray(r) && r.length > 0 ? this.relationRowKeys = r : this.relationRowKeys = [this.key], Array.isArray(a) && a.length > 0 ? this.relationColKeys = a : this.relationColKeys = [this.key], this.mergeCol = 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);
|
|
439
445
|
}
|
|
440
446
|
}
|
|
441
447
|
updateSpanInfo() {
|
|
@@ -502,47 +508,50 @@ class xt extends Yt {
|
|
|
502
508
|
* 更新样式
|
|
503
509
|
*/
|
|
504
510
|
updateStyle() {
|
|
505
|
-
this.
|
|
511
|
+
this.autoRowHeight && (this.domDataset = {
|
|
512
|
+
autoHeight: !0,
|
|
513
|
+
rowIndex: this.rowIndex
|
|
514
|
+
}), this.style = this.getOverlayerViewsStyle();
|
|
506
515
|
}
|
|
507
516
|
updateTree() {
|
|
508
517
|
const { CELL_PADDING: e = 0 } = this.ctx.config, { rowKey: i, cellType: s } = this;
|
|
509
518
|
let o, r = 0, a = "";
|
|
510
519
|
if (!(["tree", "selection-tree", "tree-selection"].includes(this.type) && s === "body"))
|
|
511
520
|
return;
|
|
512
|
-
const
|
|
513
|
-
this.rowExpand =
|
|
521
|
+
const l = this.ctx.database.getRowForRowKey(i), { expand: h = !1, hasChildren: d = !1, expandLoading: f = !1, level: u = 0 } = l || {};
|
|
522
|
+
this.rowExpand = h, this.rowHasChildren = d;
|
|
514
523
|
const { TREE_INDENT: x = 16, CHECKBOX_SIZE: w, TREE_ICON_SIZE: m } = this.ctx.config;
|
|
515
524
|
if (r = u * x, f) {
|
|
516
|
-
const
|
|
517
|
-
a = "loading", o =
|
|
525
|
+
const I = this.ctx.icons.get("loading");
|
|
526
|
+
a = "loading", o = I;
|
|
518
527
|
} else if (d) {
|
|
519
|
-
const
|
|
520
|
-
o =
|
|
528
|
+
const I = this.ctx.icons.get("expand"), v = this.ctx.icons.get("shrink");
|
|
529
|
+
o = h ? v : I, a = h ? "shrink" : "expand";
|
|
521
530
|
}
|
|
522
|
-
let g = m,
|
|
531
|
+
let g = m, p = m, y = this.drawX;
|
|
523
532
|
(this.align === "center" || this.align === "right") && (y = this.drawX + (this.visibleWidth - g - 2 * e) / 2, this.align = "left");
|
|
524
|
-
let
|
|
525
|
-
this.type === "selection-tree" ? (
|
|
533
|
+
let E = y + r + e, R = this.drawY + (this.visibleHeight - p) / 2, C = r + this.drawX + g - 0.5;
|
|
534
|
+
this.type === "selection-tree" ? (E = r + this.drawSelectionImageX + this.drawSelectionImageWidth, C = E + g - e / 2) : this.type === "tree-selection" ? C = E + w + g - e / 2 : C = E + g - e / 2, this.drawTextX = C, this.drawTextWidth = this.drawX + this.visibleWidth - C, !(E + g + e > this.drawX + this.visibleWidth) && (R + p + e > this.drawY + this.visibleHeight || (this.drawTreeImageX = E, this.drawTreeImageY = R, this.drawTreeImageWidth = g, this.drawTreeImageHeight = p, o ? (this.drawTreeImageName = a, this.drawTreeImageSource = o) : (this.drawTreeImageName = "", this.drawTreeImageSource = void 0)));
|
|
526
535
|
}
|
|
527
536
|
drawTreeLine() {
|
|
528
537
|
const { TREE_LINE: e, TREE_INDENT: i = 16, TREE_ICON_SIZE: s = 16, TREE_LINE_COLOR: o = "#e1e6eb" } = this.ctx.config;
|
|
529
538
|
if (!e || this.cellType !== "body" || !["tree", "selection-tree", "tree-selection"].includes(this.type) || this.rowspan === 0 || this.colspan === 0) return;
|
|
530
|
-
const r = this.ctx.database.getRowForRowKey(this.rowKey) || {}, a = r.level ?? 0,
|
|
539
|
+
const r = this.ctx.database.getRowForRowKey(this.rowKey) || {}, a = r.level ?? 0, l = this.drawTreeImageX + this.drawTreeImageWidth / 2, h = this.drawTreeImageY + this.drawTreeImageHeight / 2;
|
|
531
540
|
let d = this.drawTreeImageX - a * i;
|
|
532
541
|
const f = Array.isArray(r.parentRowKeys) ? r.parentRowKeys : [];
|
|
533
542
|
if (a > 0) {
|
|
534
543
|
for (let g = 0; g < a - 1; g += 1) {
|
|
535
|
-
const
|
|
536
|
-
if (!!(
|
|
537
|
-
const
|
|
538
|
-
this.ctx.paint.drawLine([
|
|
544
|
+
const p = f[g + 1];
|
|
545
|
+
if (!!(p ? this.ctx.database.getRowForRowKey(p) || {} : {}).isLastChild) continue;
|
|
546
|
+
const R = Math.round(this.drawTreeImageX - (a - g) * i + s / 2);
|
|
547
|
+
this.ctx.paint.drawLine([R, this.drawY, R, this.drawY + this.visibleHeight], {
|
|
539
548
|
borderColor: o,
|
|
540
549
|
borderWidth: 1,
|
|
541
550
|
lineDash: [4, 4],
|
|
542
551
|
lineDashOffset: 0
|
|
543
552
|
});
|
|
544
553
|
}
|
|
545
|
-
const u = Math.round(this.drawTreeImageX - i + s / 2), w = !!r.isLastChild ?
|
|
554
|
+
const u = Math.round(this.drawTreeImageX - i + s / 2), w = !!r.isLastChild ? h : this.drawY + this.visibleHeight;
|
|
546
555
|
this.ctx.paint.drawLine([u, this.drawY, u, w], {
|
|
547
556
|
borderColor: o,
|
|
548
557
|
borderWidth: 1,
|
|
@@ -550,7 +559,7 @@ class xt extends Yt {
|
|
|
550
559
|
lineDashOffset: 0
|
|
551
560
|
});
|
|
552
561
|
const m = Math.round(d + (a - 1) * i + s / 2);
|
|
553
|
-
this.ctx.paint.drawLine([m,
|
|
562
|
+
this.ctx.paint.drawLine([m, h, l, h], {
|
|
554
563
|
borderColor: o,
|
|
555
564
|
borderWidth: 1,
|
|
556
565
|
lineDash: [4, 4],
|
|
@@ -558,8 +567,8 @@ class xt extends Yt {
|
|
|
558
567
|
});
|
|
559
568
|
}
|
|
560
569
|
if (r.hasChildren && r.expand) {
|
|
561
|
-
const u = this.drawTreeImageY + this.drawTreeImageHeight, x =
|
|
562
|
-
this.ctx.paint.drawLine([
|
|
570
|
+
const u = this.drawTreeImageY + this.drawTreeImageHeight, x = this.drawY + this.visibleHeight;
|
|
571
|
+
this.ctx.paint.drawLine([l, u, l, x], {
|
|
563
572
|
borderColor: o,
|
|
564
573
|
borderWidth: 1,
|
|
565
574
|
lineDash: [4, 4],
|
|
@@ -575,8 +584,8 @@ class xt extends Yt {
|
|
|
575
584
|
FOOTER_CELL_STYLE_METHOD: o,
|
|
576
585
|
READONLY_TEXT_COLOR: r,
|
|
577
586
|
BODY_TEXT_COLOR: a,
|
|
578
|
-
FOOTER_TEXT_COLOR:
|
|
579
|
-
FOOTER_BG_COLOR:
|
|
587
|
+
FOOTER_TEXT_COLOR: l,
|
|
588
|
+
FOOTER_BG_COLOR: h,
|
|
580
589
|
HIGHLIGHT_SELECTED_ROW: d,
|
|
581
590
|
HIGHLIGHT_SELECTED_ROW_COLOR: f,
|
|
582
591
|
HIGHLIGHT_HOVER_ROW: u,
|
|
@@ -585,31 +594,31 @@ class xt extends Yt {
|
|
|
585
594
|
STRIPE_COLOR: m
|
|
586
595
|
} = this.ctx.config;
|
|
587
596
|
if (this.cellType === "footer") {
|
|
588
|
-
let v =
|
|
597
|
+
let v = h, _ = l;
|
|
589
598
|
if (typeof o == "function") {
|
|
590
|
-
const S = o, { backgroundColor:
|
|
599
|
+
const S = o, { backgroundColor: b, color: O } = S({
|
|
591
600
|
row: this.row,
|
|
592
601
|
rowIndex: this.rowIndex,
|
|
593
602
|
colIndex: this.colIndex,
|
|
594
603
|
column: this.column,
|
|
595
604
|
value: this.getValue()
|
|
596
605
|
}) || {};
|
|
597
|
-
|
|
606
|
+
b && (v = b), O && (_ = O);
|
|
598
607
|
}
|
|
599
|
-
this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = v, this.drawTextColor =
|
|
608
|
+
this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = v, this.drawTextColor = _;
|
|
600
609
|
return;
|
|
601
610
|
}
|
|
602
611
|
let g = "transparent";
|
|
603
|
-
const
|
|
604
|
-
let
|
|
612
|
+
const p = this.ctx.hoverCell, y = this.ctx.currentCell;
|
|
613
|
+
let E = this.rowIndex, R = this.rowIndex;
|
|
605
614
|
if (this.rowspan !== 1 && (u || d)) {
|
|
606
|
-
const v = this.getSpanInfo(), { yArr:
|
|
607
|
-
|
|
615
|
+
const v = this.getSpanInfo(), { yArr: _ } = v;
|
|
616
|
+
E = _[0], R = _[1];
|
|
608
617
|
}
|
|
609
|
-
u &&
|
|
610
|
-
let C = e,
|
|
611
|
-
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (C = i,
|
|
612
|
-
const v = s, { backgroundColor:
|
|
618
|
+
u && p && (p.rowKey === this.rowKey && (g = x), p.rowIndex >= E && p.rowIndex <= R && (g = x)), d && y && (y.rowKey === this.rowKey && (g = f), y.rowIndex >= E && y.rowIndex <= R && (g = f)), this.drawCellSkyBgColor = g;
|
|
619
|
+
let C = e, I = a;
|
|
620
|
+
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (C = i, I = r), w && (this.rowIndex % 2 ? C = m : C = e), typeof s == "function") {
|
|
621
|
+
const v = s, { backgroundColor: _, color: S } = v({
|
|
613
622
|
row: this.row,
|
|
614
623
|
rowIndex: this.rowIndex,
|
|
615
624
|
colIndex: this.colIndex,
|
|
@@ -617,62 +626,85 @@ class xt extends Yt {
|
|
|
617
626
|
isHasChanged: this.isHasChanged,
|
|
618
627
|
value: this.getValue()
|
|
619
628
|
}) || {};
|
|
620
|
-
|
|
629
|
+
_ && (C = _), S && (I = S);
|
|
621
630
|
}
|
|
622
|
-
this.drawCellBgColor = C, this.drawTextColor =
|
|
631
|
+
this.drawCellBgColor = C, this.drawTextColor = I;
|
|
623
632
|
}
|
|
624
633
|
updateSelection() {
|
|
625
|
-
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: a, rowIndex:
|
|
634
|
+
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: a, rowIndex: l, rowKey: h } = this;
|
|
626
635
|
if (s === 0 || o === 0 || r === "footer" || !["index-selection", "selection", "selection-tree", "tree-selection"].includes(a))
|
|
627
636
|
return;
|
|
628
|
-
const d = this.ctx.database.getRowSelectable(
|
|
637
|
+
const d = this.ctx.database.getRowSelectable(h), { CHECKBOX_SIZE: f = 0, CELL_PADDING: u } = this.ctx.config;
|
|
629
638
|
let x = this.drawX + u;
|
|
630
639
|
(this.align === "center" || this.align === "right") && (x = this.drawX + (e - f) / 2);
|
|
631
640
|
let w = x, m = this.drawY + (i - f) / 2;
|
|
632
641
|
if (a !== "selection-tree") {
|
|
633
642
|
if (a === "tree-selection") {
|
|
634
|
-
const { TREE_INDENT: y = 16, TREE_ICON_SIZE:
|
|
635
|
-
w = x +
|
|
643
|
+
const { TREE_INDENT: y = 16, TREE_ICON_SIZE: E } = this.ctx.config, R = this.ctx.database.getRowForRowKey(h), { level: C = 0 } = R || {}, I = C * y;
|
|
644
|
+
w = x + E + I;
|
|
636
645
|
}
|
|
637
646
|
}
|
|
638
|
-
let g = this.ctx.icons.get("checkbox-uncheck"),
|
|
647
|
+
let g = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck";
|
|
639
648
|
if (a === "selection-tree" || a === "tree-selection") {
|
|
640
|
-
const y = this.ctx.database.getTreeSelectionState(
|
|
641
|
-
y.indeterminate && d ? (g = this.ctx.icons.get("checkbox-indeterminate"),
|
|
649
|
+
const y = this.ctx.database.getTreeSelectionState(h);
|
|
650
|
+
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");
|
|
642
651
|
} else {
|
|
643
|
-
const y = this.ctx.database.getRowSelection(
|
|
644
|
-
y && d ? (g = this.ctx.icons.get("checkbox-check"),
|
|
652
|
+
const y = this.ctx.database.getRowSelection(h);
|
|
653
|
+
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");
|
|
645
654
|
}
|
|
646
|
-
w + f + u > this.drawX + this.visibleWidth || m + f + u > this.drawY + this.visibleHeight || (a === "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex ===
|
|
655
|
+
w + f + u > this.drawX + this.visibleWidth || m + f + u > this.drawY + this.visibleHeight || (a === "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === l || ["checkbox-disabled", "checkbox-check"].includes(p)) && (this.drawSelectionImageX = w, this.drawSelectionImageY = m, this.drawSelectionImageWidth = f, this.drawSelectionImageHeight = f, this.drawSelectionImageName = p, this.drawSelectionImageSource = g) : (this.drawSelectionImageX = w, this.drawSelectionImageY = m, this.drawSelectionImageWidth = f, this.drawSelectionImageHeight = f, this.drawSelectionImageName = p, this.drawSelectionImageSource = g));
|
|
647
656
|
}
|
|
648
657
|
updateHoverIcon() {
|
|
649
658
|
if (this.ctx.database.getReadonly(this.rowKey, this.key))
|
|
650
659
|
return;
|
|
651
660
|
const { BODY_CELL_HOVER_ICON_METHOD: i, CELL_HOVER_ICON_SIZE: s, CELL_PADDING: o, ENABLE_MERGE_CELL_LINK: r } = this.ctx.config;
|
|
652
661
|
if (typeof i == "function") {
|
|
653
|
-
const
|
|
662
|
+
const h = i({
|
|
654
663
|
row: this.row,
|
|
655
664
|
rowIndex: this.rowIndex,
|
|
656
665
|
colIndex: this.colIndex,
|
|
657
666
|
column: this.column,
|
|
658
667
|
value: this.getValue()
|
|
659
668
|
});
|
|
660
|
-
|
|
669
|
+
h !== void 0 && (this.hoverIconName = h);
|
|
661
670
|
}
|
|
662
671
|
const { hoverCell: a } = this.ctx;
|
|
663
672
|
if (this.hoverIconName && !this.ctx.editing && a) {
|
|
664
|
-
let
|
|
665
|
-
if (a.rowKey === this.rowKey && (
|
|
673
|
+
let l = 0, h = 0;
|
|
674
|
+
if (a.rowKey === this.rowKey && (l = this.drawX + this.width - s - o, h = this.drawY + (this.height - s) / 2), this.rowspan !== 1 && r) {
|
|
666
675
|
const f = this.getSpanInfo(), { yArr: u } = f, x = u[0], w = u[1];
|
|
667
676
|
if (a.rowIndex >= x && a.rowIndex <= w) {
|
|
668
|
-
const { width: m, height: g, offsetTop:
|
|
669
|
-
|
|
677
|
+
const { width: m, height: g, offsetTop: p, offsetLeft: y } = f;
|
|
678
|
+
l = this.drawX - y + m - s - o, h = this.drawY - p + (g - s) / 2;
|
|
670
679
|
}
|
|
671
680
|
}
|
|
672
681
|
const d = this.ctx.icons.get(this.hoverIconName);
|
|
673
|
-
this.drawHoverImageX =
|
|
682
|
+
this.drawHoverImageX = l, this.drawHoverImageY = h, this.drawHoverImageWidth = s, this.drawHoverImageHeight = s, this.drawHoverImageName = this.hoverIconName, this.drawHoverImageSource = d;
|
|
674
683
|
}
|
|
675
684
|
}
|
|
685
|
+
/**
|
|
686
|
+
* 获取自动高度
|
|
687
|
+
* @returns
|
|
688
|
+
*/
|
|
689
|
+
getAutoHeight() {
|
|
690
|
+
if (this.cellType !== "body" || !this.autoRowHeight || this.rowspan === 0)
|
|
691
|
+
return -1;
|
|
692
|
+
if (this.render)
|
|
693
|
+
return this.ctx.database.getOverlayerAutoHeightByRowIndex(this.rowIndex);
|
|
694
|
+
if (!(this.displayText && typeof this.displayText == "string"))
|
|
695
|
+
return -1;
|
|
696
|
+
const { BODY_FONT: e, CELL_PADDING: i, CELL_LINE_HEIGHT: s } = this.ctx.config, o = this.ctx.paint.calculateTextHeight(this.displayText, this.drawTextWidth, {
|
|
697
|
+
font: e,
|
|
698
|
+
padding: i,
|
|
699
|
+
align: this.align,
|
|
700
|
+
verticalAlign: this.verticalAlign,
|
|
701
|
+
color: this.drawTextColor,
|
|
702
|
+
autoRowHeight: this.autoRowHeight,
|
|
703
|
+
lineHeight: s,
|
|
704
|
+
maxLineClamp: this.maxLineClamp
|
|
705
|
+
});
|
|
706
|
+
return this.rowspan > 1 ? Math.round(o - (this.visibleHeight - this.height)) : Math.round(o);
|
|
707
|
+
}
|
|
676
708
|
// 过去跨度配置
|
|
677
709
|
getSpanInfo() {
|
|
678
710
|
return this.ctx.database.getSpanInfo(this);
|
|
@@ -732,7 +764,8 @@ class xt extends Yt {
|
|
|
732
764
|
left: e,
|
|
733
765
|
top: i,
|
|
734
766
|
width: `${this.visibleWidth}px`,
|
|
735
|
-
height: `${this.visibleHeight}px`,
|
|
767
|
+
height: this.autoRowHeight ? "auto" : `${this.visibleHeight}px`,
|
|
768
|
+
// minHeight: `${this.visibleHeight}px`,
|
|
736
769
|
pointerEvents: "initial",
|
|
737
770
|
userSelect: "none"
|
|
738
771
|
};
|
|
@@ -765,8 +798,8 @@ class xt extends Yt {
|
|
|
765
798
|
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s, AUTOFILL_POINT_BORDER_COLOR: o } = this.ctx.config;
|
|
766
799
|
if (!s || !i || this.ctx.editing)
|
|
767
800
|
return;
|
|
768
|
-
const { xArr: r, yArr: a } = this.ctx.selector,
|
|
769
|
-
if (d ===
|
|
801
|
+
const { xArr: r, yArr: a } = this.ctx.selector, l = r[1], h = a[1], { colIndex: d, rowIndex: f, drawX: u, drawY: x } = this;
|
|
802
|
+
if (d === l && f === h) {
|
|
770
803
|
const m = d === this.ctx.maxColIndex || f === this.ctx.maxRowIndex || d === this.ctx.lastCenterColIndex ? 6 : 4;
|
|
771
804
|
this.ctx.paint.drawRect(u + this.width - m, x + this.height - m, 6, 6, {
|
|
772
805
|
borderColor: o,
|
|
@@ -792,22 +825,25 @@ class xt extends Yt {
|
|
|
792
825
|
return s;
|
|
793
826
|
}
|
|
794
827
|
drawText() {
|
|
795
|
-
const { CELL_PADDING: e, BODY_FONT: i, PLACEHOLDER_COLOR: s } = this.ctx.config, {
|
|
796
|
-
|
|
828
|
+
const { CELL_PADDING: e, BODY_FONT: i, PLACEHOLDER_COLOR: s, CELL_LINE_HEIGHT: o } = this.ctx.config, { placeholder: r } = this.column;
|
|
829
|
+
let a = this.displayText, l = this.drawTextColor;
|
|
830
|
+
return !this.ctx.database.getReadonly(this.rowKey, this.key) && r && ["", null, void 0].includes(this.text) && this.cellType === "body" && !(this.rowspan === 0 || this.colspan === 0) && (a = r, l = s), a ? (this.ellipsis = this.ctx.paint.drawText(
|
|
831
|
+
a,
|
|
832
|
+
this.drawTextX,
|
|
833
|
+
this.drawTextY,
|
|
797
834
|
this.drawTextWidth,
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
});
|
|
835
|
+
this.drawTextHeight,
|
|
836
|
+
{
|
|
837
|
+
font: i,
|
|
838
|
+
padding: e,
|
|
839
|
+
align: this.align,
|
|
840
|
+
verticalAlign: this.verticalAlign,
|
|
841
|
+
color: l,
|
|
842
|
+
autoRowHeight: this.autoRowHeight,
|
|
843
|
+
lineHeight: o,
|
|
844
|
+
maxLineClamp: this.maxLineClamp
|
|
845
|
+
}
|
|
846
|
+
), this.ellipsis) : !1;
|
|
811
847
|
}
|
|
812
848
|
drawImage() {
|
|
813
849
|
if (this.drawSelectionImageSource && this.ctx.paint.drawImage(
|
|
@@ -872,11 +908,11 @@ class xt extends Yt {
|
|
|
872
908
|
fillColor: "transparent",
|
|
873
909
|
borderWidth: 1
|
|
874
910
|
});
|
|
875
|
-
const [a,
|
|
876
|
-
!(a ===
|
|
911
|
+
const [a, l] = i, [h, d] = s;
|
|
912
|
+
!(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, {
|
|
877
913
|
borderColor: "transparent",
|
|
878
914
|
fillColor: this.ctx.config.SELECT_AREA_COLOR || "rgba(82,146,247,0.1)"
|
|
879
|
-
}), this.operation && this.rowIndex >=
|
|
915
|
+
}), this.operation && this.rowIndex >= h && this.rowIndex <= d && this.ctx.paint.drawRect(this.drawX, this.drawY, this.visibleWidth, this.visibleHeight, {
|
|
880
916
|
borderColor: "transparent",
|
|
881
917
|
fillColor: this.ctx.config.SELECT_ROW_COL_BG_COLOR || "transparent"
|
|
882
918
|
});
|
|
@@ -901,12 +937,12 @@ class xt extends Yt {
|
|
|
901
937
|
});
|
|
902
938
|
}
|
|
903
939
|
drawBorder(e) {
|
|
904
|
-
const { drawX: i, drawY: s, rowIndex: o, colIndex: r, height: a, width:
|
|
905
|
-
let
|
|
906
|
-
const { xArr: f, yArr: u, lineDash: x = [], borderWidth: w = 1, borderColor: m, fillColor: g } = e,
|
|
907
|
-
if (r >=
|
|
908
|
-
const C = r === y ? 1 : 0,
|
|
909
|
-
this.ctx.paint.drawLine([
|
|
940
|
+
const { drawX: i, drawY: s, rowIndex: o, colIndex: r, height: a, width: l } = this;
|
|
941
|
+
let h = i, d = s;
|
|
942
|
+
const { xArr: f, yArr: u, lineDash: x = [], borderWidth: w = 1, borderColor: m, fillColor: g } = e, p = f[0], y = f[1], E = u[0], R = u[1];
|
|
943
|
+
if (r >= p && r <= y && o === E) {
|
|
944
|
+
const C = r === y ? 1 : 0, I = r === p ? 1 : 0;
|
|
945
|
+
this.ctx.paint.drawLine([h + I, d + 1, h + l - C, d + 1], {
|
|
910
946
|
borderColor: m,
|
|
911
947
|
fillColor: g,
|
|
912
948
|
borderWidth: w,
|
|
@@ -915,9 +951,9 @@ class xt extends Yt {
|
|
|
915
951
|
lineDash: x
|
|
916
952
|
});
|
|
917
953
|
}
|
|
918
|
-
if (r === y && o >=
|
|
919
|
-
const C = o ===
|
|
920
|
-
this.ctx.paint.drawLine([
|
|
954
|
+
if (r === y && o >= E && o <= R) {
|
|
955
|
+
const C = o === E ? 1 : 0, I = o === R ? 1 : 0;
|
|
956
|
+
this.ctx.paint.drawLine([h + l - 1, d + C, h + l - 1, d + a - I], {
|
|
921
957
|
borderColor: m,
|
|
922
958
|
fillColor: g,
|
|
923
959
|
borderWidth: w,
|
|
@@ -926,9 +962,9 @@ class xt extends Yt {
|
|
|
926
962
|
lineDash: x
|
|
927
963
|
});
|
|
928
964
|
}
|
|
929
|
-
if (r >=
|
|
930
|
-
const C = r === y ? 1 : 0,
|
|
931
|
-
this.ctx.paint.drawLine([
|
|
965
|
+
if (r >= p && r <= y && o === R) {
|
|
966
|
+
const C = r === y ? 1 : 0, I = r === p ? 1 : 0;
|
|
967
|
+
this.ctx.paint.drawLine([h + I, d + a - 1, h + l - C, d + a - 1], {
|
|
932
968
|
borderColor: m,
|
|
933
969
|
fillColor: g,
|
|
934
970
|
borderWidth: w,
|
|
@@ -937,9 +973,9 @@ class xt extends Yt {
|
|
|
937
973
|
lineDash: x
|
|
938
974
|
});
|
|
939
975
|
}
|
|
940
|
-
if (r ===
|
|
941
|
-
const C = o ===
|
|
942
|
-
this.ctx.paint.drawLine([
|
|
976
|
+
if (r === p && o >= E && o <= R) {
|
|
977
|
+
const C = o === R ? 1 : 0, I = o === E ? 1 : 0;
|
|
978
|
+
this.ctx.paint.drawLine([h + 1, d + I, h + 1, d + a - C], {
|
|
943
979
|
borderColor: m,
|
|
944
980
|
fillColor: g,
|
|
945
981
|
borderWidth: w,
|
|
@@ -970,6 +1006,7 @@ class ue {
|
|
|
970
1006
|
n(this, "validationErrorMap", /* @__PURE__ */ new Map());
|
|
971
1007
|
n(this, "itemRowKeyMap", /* @__PURE__ */ new WeakMap());
|
|
972
1008
|
n(this, "bufferData", []);
|
|
1009
|
+
n(this, "overlayerAutoHeightMap", /* @__PURE__ */ new Map());
|
|
973
1010
|
n(this, "bufferCheckState", {
|
|
974
1011
|
buffer: !1,
|
|
975
1012
|
check: !1,
|
|
@@ -1011,33 +1048,34 @@ class ue {
|
|
|
1011
1048
|
const s = t.length;
|
|
1012
1049
|
t.forEach((o, r) => {
|
|
1013
1050
|
var y;
|
|
1014
|
-
const { ROW_KEY: a = "", DEFAULT_EXPAND_ALL:
|
|
1051
|
+
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}` : At();
|
|
1015
1052
|
this.itemRowKeyMap.set(o, x);
|
|
1016
|
-
const w = o._height ||
|
|
1053
|
+
const w = o._height || h, m = o._readonly;
|
|
1017
1054
|
let g = !0;
|
|
1018
1055
|
if (typeof d == "function" && (g = d), f) {
|
|
1019
|
-
const
|
|
1020
|
-
if (this.checkboxKeyMap.has(
|
|
1021
|
-
const
|
|
1022
|
-
|
|
1056
|
+
const E = o[f];
|
|
1057
|
+
if (this.checkboxKeyMap.has(E)) {
|
|
1058
|
+
const R = this.checkboxKeyMap.get(E) || [];
|
|
1059
|
+
R.push(x), this.checkboxKeyMap.set(E, R);
|
|
1023
1060
|
} else
|
|
1024
|
-
this.checkboxKeyMap.set(
|
|
1061
|
+
this.checkboxKeyMap.set(E, [x]);
|
|
1025
1062
|
}
|
|
1026
1063
|
this.selectionMap.set(x, {
|
|
1027
1064
|
key: f ? o[f] : x,
|
|
1028
1065
|
row: o,
|
|
1029
1066
|
check: ((y = this.selectionMap.get(x)) == null ? void 0 : y.check) || !1
|
|
1030
1067
|
});
|
|
1031
|
-
const
|
|
1032
|
-
this.expandMap.set(x,
|
|
1068
|
+
const p = l || this.expandMap.get(x) || o._expand || !1;
|
|
1069
|
+
this.expandMap.set(x, p), this.rowKeyMap.set(x, {
|
|
1033
1070
|
readonly: m,
|
|
1034
1071
|
index: r,
|
|
1035
1072
|
rowIndex: r,
|
|
1036
1073
|
level: e,
|
|
1037
1074
|
height: w,
|
|
1075
|
+
calculatedHeight: -1,
|
|
1038
1076
|
check: !1,
|
|
1039
1077
|
selectable: g,
|
|
1040
|
-
expand:
|
|
1078
|
+
expand: p,
|
|
1041
1079
|
expandLazy: !1,
|
|
1042
1080
|
hasChildren: o._hasChildren || (Array.isArray(o.children) ? o.children.length > 0 : !1),
|
|
1043
1081
|
expandLoading: !1,
|
|
@@ -1060,6 +1098,26 @@ class ue {
|
|
|
1060
1098
|
const s = this.rowKeyMap.get(i);
|
|
1061
1099
|
s.height = e, s.item._height = e, this.clearBufferData();
|
|
1062
1100
|
}
|
|
1101
|
+
// 批量设置行高度
|
|
1102
|
+
setBatchRowHeight(t) {
|
|
1103
|
+
t.forEach(({ rowIndex: e, height: i }) => {
|
|
1104
|
+
const s = this.rowIndexRowKeyMap.get(e);
|
|
1105
|
+
if (s) {
|
|
1106
|
+
const o = this.rowKeyMap.get(s);
|
|
1107
|
+
o.height = i, o.item._height = i;
|
|
1108
|
+
}
|
|
1109
|
+
}), this.clearBufferData();
|
|
1110
|
+
}
|
|
1111
|
+
// 批量设置计算行高度
|
|
1112
|
+
setBatchCalculatedRowHeight(t) {
|
|
1113
|
+
t.every(({ height: i, rowIndex: s }) => this.getPositionForRowIndex(s).calculatedHeight === i) || (t.forEach(({ rowIndex: i, height: s }) => {
|
|
1114
|
+
const o = this.rowIndexRowKeyMap.get(i);
|
|
1115
|
+
if (o) {
|
|
1116
|
+
const r = this.rowKeyMap.get(o);
|
|
1117
|
+
r.calculatedHeight = s;
|
|
1118
|
+
}
|
|
1119
|
+
}), this.clearBufferData(), this.getData(), this.ctx.emit("draw"));
|
|
1120
|
+
}
|
|
1063
1121
|
/**
|
|
1064
1122
|
* 获取所有行数据(平铺)
|
|
1065
1123
|
* @returns 获取转化平铺数据
|
|
@@ -1107,12 +1165,13 @@ class ue {
|
|
|
1107
1165
|
const i = (o) => {
|
|
1108
1166
|
o.forEach((r) => {
|
|
1109
1167
|
t.push(r);
|
|
1110
|
-
const a = this.itemRowKeyMap.get(r), { expand:
|
|
1111
|
-
this.sumHeight +=
|
|
1112
|
-
top:
|
|
1113
|
-
height:
|
|
1114
|
-
bottom: this.sumHeight
|
|
1115
|
-
|
|
1168
|
+
const a = this.itemRowKeyMap.get(r), { expand: l, hasChildren: h, height: d, calculatedHeight: f } = this.rowKeyMap.get(a), u = this.sumHeight, x = Math.max(f, d);
|
|
1169
|
+
this.sumHeight += x, this.rowIndexRowKeyMap.set(e, a), this.rowKeyRowIndexMap.set(a, e), this.positions.push({
|
|
1170
|
+
top: u,
|
|
1171
|
+
height: x,
|
|
1172
|
+
bottom: this.sumHeight,
|
|
1173
|
+
calculatedHeight: f
|
|
1174
|
+
}), e += 1, l && h && i(r.children);
|
|
1116
1175
|
});
|
|
1117
1176
|
};
|
|
1118
1177
|
this.rowIndexRowKeyMap.clear(), this.rowKeyRowIndexMap.clear();
|
|
@@ -1189,18 +1248,18 @@ class ue {
|
|
|
1189
1248
|
*/
|
|
1190
1249
|
applySingleColumnSort(t, e, i, s) {
|
|
1191
1250
|
return t.sort((o, r) => {
|
|
1192
|
-
const a = o[e],
|
|
1193
|
-
let
|
|
1251
|
+
const a = o[e], l = r[e];
|
|
1252
|
+
let h = 0;
|
|
1194
1253
|
if (typeof s == "function")
|
|
1195
|
-
|
|
1254
|
+
h = s(o, r);
|
|
1196
1255
|
else if (s === "number") {
|
|
1197
|
-
const d = Number(a) || 0, f = Number(
|
|
1198
|
-
|
|
1256
|
+
const d = Number(a) || 0, f = Number(l) || 0;
|
|
1257
|
+
h = d - f;
|
|
1199
1258
|
} else if (s === "string") {
|
|
1200
|
-
const d = String(a || ""), f = String(
|
|
1201
|
-
|
|
1202
|
-
} else s === "date" && (
|
|
1203
|
-
return i === "asc" ?
|
|
1259
|
+
const d = String(a || ""), f = String(l || "");
|
|
1260
|
+
h = d.localeCompare(f);
|
|
1261
|
+
} else s === "date" && (h = xe(a, l));
|
|
1262
|
+
return i === "asc" ? h : -h;
|
|
1204
1263
|
});
|
|
1205
1264
|
}
|
|
1206
1265
|
/**
|
|
@@ -1312,39 +1371,39 @@ class ue {
|
|
|
1312
1371
|
async batchSetItemValue(t, e = !1, i = !0, s = "none") {
|
|
1313
1372
|
let o = [], r = i;
|
|
1314
1373
|
const a = /* @__PURE__ */ new Set();
|
|
1315
|
-
let
|
|
1374
|
+
let l = [], h = t.map((x) => {
|
|
1316
1375
|
const { rowKey: w, key: m } = x;
|
|
1317
|
-
let g = x.value,
|
|
1318
|
-
const y = this.getRowDataItemForRowKey(w),
|
|
1319
|
-
return (
|
|
1376
|
+
let g = x.value, p = g;
|
|
1377
|
+
const y = this.getRowDataItemForRowKey(w), E = this.getItemValue(w, m), R = this.getVirtualBodyCellByKey(w, m);
|
|
1378
|
+
return (R == null ? void 0 : R.type) === "number" && (["", void 0, null].includes(g) ? p = null : /^-?\d+(\.\d+)?$/.test(`${g}`) ? p = Number(g) : (p = E, l.push({
|
|
1320
1379
|
...x,
|
|
1321
|
-
value:
|
|
1322
|
-
oldValue:
|
|
1380
|
+
value: p,
|
|
1381
|
+
oldValue: E,
|
|
1323
1382
|
row: y
|
|
1324
1383
|
}))), {
|
|
1325
1384
|
...x,
|
|
1326
|
-
value:
|
|
1327
|
-
oldValue:
|
|
1385
|
+
value: p,
|
|
1386
|
+
oldValue: E,
|
|
1328
1387
|
row: y
|
|
1329
1388
|
};
|
|
1330
1389
|
});
|
|
1331
|
-
if (
|
|
1390
|
+
if (h = h.filter((x) => !l.some((w) => x.rowKey === w.rowKey && x.key === w.key)), l.length) {
|
|
1332
1391
|
const x = {
|
|
1333
1392
|
code: "ERR_BATCH_SET_NUMBER_VALUE",
|
|
1334
1393
|
message: "Assignment failed, not a numeric type",
|
|
1335
|
-
data:
|
|
1394
|
+
data: l
|
|
1336
1395
|
};
|
|
1337
1396
|
this.ctx.emit("error", x);
|
|
1338
1397
|
}
|
|
1339
|
-
if (
|
|
1398
|
+
if (h = h.filter((x) => x.oldValue !== x.value), !h.length)
|
|
1340
1399
|
return;
|
|
1341
1400
|
const { BEFORE_VALUE_CHANGE_METHOD: d } = this.ctx.config;
|
|
1342
|
-
s === "none" && typeof d == "function" && (
|
|
1343
|
-
const { value: w, rowKey: m, key: g } = x,
|
|
1401
|
+
s === "none" && typeof d == "function" && (h = await d(h), r = !1), h.forEach((x) => {
|
|
1402
|
+
const { value: w, rowKey: m, key: g } = x, p = this.getItemValue(m, g);
|
|
1344
1403
|
a.add(m), this.setItemValue(m, g, w, !1, !1, !1, r), o.push({
|
|
1345
1404
|
rowKey: m,
|
|
1346
1405
|
key: g,
|
|
1347
|
-
oldValue:
|
|
1406
|
+
oldValue: p,
|
|
1348
1407
|
newValue: w
|
|
1349
1408
|
});
|
|
1350
1409
|
});
|
|
@@ -1352,10 +1411,10 @@ class ue {
|
|
|
1352
1411
|
a.forEach((x) => {
|
|
1353
1412
|
f.push(this.ctx.database.getRowDataItemForRowKey(x));
|
|
1354
1413
|
});
|
|
1355
|
-
const u =
|
|
1414
|
+
const u = h.map(({ rowKey: x, key: w }) => this.getValidator(x, w));
|
|
1356
1415
|
Promise.all(u).then(() => {
|
|
1357
1416
|
this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
|
|
1358
|
-
}), this.ctx.emit("change",
|
|
1417
|
+
}), this.ctx.emit("change", h, f), e && this.ctx.history.pushState({
|
|
1359
1418
|
changeList: o,
|
|
1360
1419
|
scrollX: this.ctx.scrollX,
|
|
1361
1420
|
scrollY: this.ctx.scrollY,
|
|
@@ -1376,16 +1435,16 @@ class ue {
|
|
|
1376
1435
|
async setItemValue(t, e, i, s = !1, o = !1, r = !1, a = !0) {
|
|
1377
1436
|
if (!this.rowKeyMap.has(t))
|
|
1378
1437
|
return {};
|
|
1379
|
-
const { item:
|
|
1380
|
-
let
|
|
1438
|
+
const { item: l } = this.rowKeyMap.get(t);
|
|
1439
|
+
let h = l[e], d = i;
|
|
1381
1440
|
if (a && this.ctx.database.getReadonly(t, e))
|
|
1382
1441
|
return {
|
|
1383
|
-
oldValue:
|
|
1384
|
-
newValue:
|
|
1442
|
+
oldValue: h,
|
|
1443
|
+
newValue: h
|
|
1385
1444
|
};
|
|
1386
|
-
|
|
1445
|
+
l[e] !== null && typeof l[e] == "object" && (h = JSON.parse(JSON.stringify(l[e])));
|
|
1387
1446
|
const f = `${t}_${e}`;
|
|
1388
|
-
this.originalDataMap.has(f) || this.originalDataMap.set(f,
|
|
1447
|
+
this.originalDataMap.has(f) || this.originalDataMap.set(f, h);
|
|
1389
1448
|
const u = this.originalDataMap.get(f), x = this.getRowDataItemForRowKey(t);
|
|
1390
1449
|
if (r) {
|
|
1391
1450
|
const w = this.getVirtualBodyCellByKey(t, e);
|
|
@@ -1395,7 +1454,7 @@ class ue {
|
|
|
1395
1454
|
else if (/^-?\d+(\.\d+)?$/.test(`${i}`))
|
|
1396
1455
|
d = Number(i);
|
|
1397
1456
|
else {
|
|
1398
|
-
d =
|
|
1457
|
+
d = h;
|
|
1399
1458
|
const g = {
|
|
1400
1459
|
code: "ERR_SET_NUMBER_VALUE",
|
|
1401
1460
|
message: "Assignment failed, not a numeric type",
|
|
@@ -1404,46 +1463,46 @@ class ue {
|
|
|
1404
1463
|
rowKey: t,
|
|
1405
1464
|
key: e,
|
|
1406
1465
|
value: d,
|
|
1407
|
-
oldValue:
|
|
1466
|
+
oldValue: h,
|
|
1408
1467
|
row: x
|
|
1409
1468
|
}
|
|
1410
1469
|
]
|
|
1411
1470
|
};
|
|
1412
1471
|
this.ctx.emit("error", g);
|
|
1413
1472
|
}
|
|
1414
|
-
if (d ===
|
|
1473
|
+
if (d === h)
|
|
1415
1474
|
return {
|
|
1416
|
-
oldValue:
|
|
1417
|
-
newValue:
|
|
1475
|
+
oldValue: h,
|
|
1476
|
+
newValue: h
|
|
1418
1477
|
};
|
|
1419
1478
|
let m = [
|
|
1420
1479
|
{
|
|
1421
1480
|
rowKey: t,
|
|
1422
1481
|
key: e,
|
|
1423
1482
|
value: d,
|
|
1424
|
-
oldValue:
|
|
1483
|
+
oldValue: h,
|
|
1425
1484
|
row: x
|
|
1426
1485
|
}
|
|
1427
1486
|
];
|
|
1428
1487
|
this.batchSetItemValue(m, s, !1), this.ctx.emit("editChange", {
|
|
1429
1488
|
rowKey: t,
|
|
1430
1489
|
key: e,
|
|
1431
|
-
oldValue:
|
|
1490
|
+
oldValue: h,
|
|
1432
1491
|
value: d,
|
|
1433
1492
|
originalValue: u,
|
|
1434
1493
|
row: x
|
|
1435
1494
|
});
|
|
1436
1495
|
} else
|
|
1437
|
-
this.changedDataMap.set(f, d),
|
|
1496
|
+
this.changedDataMap.set(f, d), l[e] = d;
|
|
1438
1497
|
return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
|
|
1439
1498
|
rowKey: t,
|
|
1440
1499
|
key: e,
|
|
1441
|
-
oldValue:
|
|
1500
|
+
oldValue: h,
|
|
1442
1501
|
value: d,
|
|
1443
1502
|
originalValue: this.originalDataMap.get(f),
|
|
1444
1503
|
row: x
|
|
1445
1504
|
}), o && this.ctx.emit("draw"), {
|
|
1446
|
-
oldValue:
|
|
1505
|
+
oldValue: h,
|
|
1447
1506
|
newValue: d
|
|
1448
1507
|
};
|
|
1449
1508
|
}
|
|
@@ -1470,8 +1529,8 @@ class ue {
|
|
|
1470
1529
|
return !1;
|
|
1471
1530
|
const { item: s } = this.rowKeyMap.get(t), o = s[i];
|
|
1472
1531
|
this.checkboxKeyMap.has(o) && (this.checkboxKeyMap.get(o) || []).forEach((a) => {
|
|
1473
|
-
const
|
|
1474
|
-
|
|
1532
|
+
const l = this.selectionMap.get(a);
|
|
1533
|
+
l && (l.check = e);
|
|
1475
1534
|
});
|
|
1476
1535
|
}
|
|
1477
1536
|
}
|
|
@@ -1517,11 +1576,11 @@ class ue {
|
|
|
1517
1576
|
const e = this.getTreeParent(t);
|
|
1518
1577
|
if (!e)
|
|
1519
1578
|
return;
|
|
1520
|
-
const s = this.getTreeChildren(e).map((
|
|
1579
|
+
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;
|
|
1521
1580
|
let a = !1;
|
|
1522
1581
|
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));
|
|
1523
|
-
const
|
|
1524
|
-
|
|
1582
|
+
const l = this.selectionMap.get(e);
|
|
1583
|
+
l && l.check !== a && (l.check = a, this.setRowSelectionByCheckboxKey(e, a), this.updateParentTreeSelection(e));
|
|
1525
1584
|
}
|
|
1526
1585
|
/**
|
|
1527
1586
|
* 根据rowKey 设置选中状态
|
|
@@ -1554,22 +1613,22 @@ class ue {
|
|
|
1554
1613
|
return { checked: s, indeterminate: !1 };
|
|
1555
1614
|
let r = !1, a = s;
|
|
1556
1615
|
if (this.ctx.config.TREE_SELECT_MODE === "auto") {
|
|
1557
|
-
const
|
|
1558
|
-
const
|
|
1616
|
+
const h = (g) => {
|
|
1617
|
+
const p = this.getTreeChildren(g);
|
|
1559
1618
|
let y = [];
|
|
1560
|
-
for (const
|
|
1561
|
-
y.push(
|
|
1619
|
+
for (const E of p)
|
|
1620
|
+
y.push(E), y.push(...h(E));
|
|
1562
1621
|
return y;
|
|
1563
|
-
}, f =
|
|
1622
|
+
}, 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;
|
|
1564
1623
|
r = w && !(u === x), a = s || w, s && x > 0 && u === 0 && (a = !1, r = !1);
|
|
1565
1624
|
} else if (this.ctx.config.TREE_SELECT_MODE === "cautious") {
|
|
1566
|
-
const
|
|
1567
|
-
const
|
|
1625
|
+
const h = (g) => {
|
|
1626
|
+
const p = this.getTreeChildren(g);
|
|
1568
1627
|
let y = [];
|
|
1569
|
-
for (const
|
|
1570
|
-
y.push(
|
|
1628
|
+
for (const E of p)
|
|
1629
|
+
y.push(E), y.push(...h(E));
|
|
1571
1630
|
return y;
|
|
1572
|
-
}, f =
|
|
1631
|
+
}, 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, m = u === x;
|
|
1573
1632
|
r = w && !m, a = s || m, s && x > 0 && u === 0 && (a = !1, r = !1);
|
|
1574
1633
|
} else this.ctx.config.TREE_SELECT_MODE === "strictly" && (r = !1, a = s);
|
|
1575
1634
|
return { checked: a, indeterminate: r };
|
|
@@ -1596,9 +1655,9 @@ class ue {
|
|
|
1596
1655
|
for (const a of o.children) {
|
|
1597
1656
|
if (this.getRowKeyByItem(a) === s)
|
|
1598
1657
|
return r;
|
|
1599
|
-
const
|
|
1600
|
-
if (
|
|
1601
|
-
return
|
|
1658
|
+
const h = e(o.children, s);
|
|
1659
|
+
if (h)
|
|
1660
|
+
return h;
|
|
1602
1661
|
}
|
|
1603
1662
|
}
|
|
1604
1663
|
return null;
|
|
@@ -1681,15 +1740,15 @@ class ue {
|
|
|
1681
1740
|
rowIndex: u.rowIndex
|
|
1682
1741
|
})), w && (o += 1);
|
|
1683
1742
|
});
|
|
1684
|
-
const
|
|
1743
|
+
const l = r > i && s === 0 && a, h = o && o > s && s > 0 || l, d = o !== 0, f = !!o && o === s;
|
|
1685
1744
|
return this.bufferCheckState = {
|
|
1686
1745
|
buffer: !0,
|
|
1687
1746
|
check: f,
|
|
1688
|
-
indeterminate:
|
|
1747
|
+
indeterminate: h,
|
|
1689
1748
|
selectable: d
|
|
1690
1749
|
}, {
|
|
1691
1750
|
check: f,
|
|
1692
|
-
indeterminate:
|
|
1751
|
+
indeterminate: h,
|
|
1693
1752
|
selectable: d
|
|
1694
1753
|
};
|
|
1695
1754
|
}
|
|
@@ -1767,7 +1826,8 @@ class ue {
|
|
|
1767
1826
|
return t < this.positions.length ? this.positions[t] : {
|
|
1768
1827
|
height: 0,
|
|
1769
1828
|
top: 0,
|
|
1770
|
-
bottom: 0
|
|
1829
|
+
bottom: 0,
|
|
1830
|
+
calculatedHeight: 0
|
|
1771
1831
|
};
|
|
1772
1832
|
}
|
|
1773
1833
|
setHeader(t, e) {
|
|
@@ -1780,9 +1840,9 @@ class ue {
|
|
|
1780
1840
|
const s = this.rowKeyMap.get(t), o = this.headerMap.get(e);
|
|
1781
1841
|
if (!s || !o)
|
|
1782
1842
|
return !0;
|
|
1783
|
-
const r = s.readonly, a = o.readonly, { BODY_CELL_READONLY_METHOD:
|
|
1784
|
-
if (typeof
|
|
1785
|
-
const d =
|
|
1843
|
+
const r = s.readonly, a = o.readonly, { BODY_CELL_READONLY_METHOD: l } = this.ctx.config;
|
|
1844
|
+
if (typeof l == "function" && o) {
|
|
1845
|
+
const d = l({
|
|
1786
1846
|
row: s.item,
|
|
1787
1847
|
rowIndex: s.rowIndex,
|
|
1788
1848
|
colIndex: o.colIndex,
|
|
@@ -1806,7 +1866,7 @@ class ue {
|
|
|
1806
1866
|
if (o === void 0)
|
|
1807
1867
|
return i([]);
|
|
1808
1868
|
const a = o.column;
|
|
1809
|
-
let
|
|
1869
|
+
let l = a.rules;
|
|
1810
1870
|
if (typeof r == "function") {
|
|
1811
1871
|
const d = r({
|
|
1812
1872
|
row: s.item,
|
|
@@ -1815,10 +1875,10 @@ class ue {
|
|
|
1815
1875
|
column: a,
|
|
1816
1876
|
value: this.getItemValue(t, e)
|
|
1817
1877
|
});
|
|
1818
|
-
d && (
|
|
1878
|
+
d && (l = d);
|
|
1819
1879
|
}
|
|
1820
|
-
if (
|
|
1821
|
-
const
|
|
1880
|
+
if (l) {
|
|
1881
|
+
const h = {
|
|
1822
1882
|
row: s.item,
|
|
1823
1883
|
rowIndex: s.rowIndex,
|
|
1824
1884
|
colIndex: o.colIndex,
|
|
@@ -1828,7 +1888,7 @@ class ue {
|
|
|
1828
1888
|
value: this.getItemValue(t, e),
|
|
1829
1889
|
field: e,
|
|
1830
1890
|
fieldValue: this.getItemValue(t, e)
|
|
1831
|
-
}, f = new re(
|
|
1891
|
+
}, f = new re(l).validate(h);
|
|
1832
1892
|
this.setValidationError(t, e, f), i(f);
|
|
1833
1893
|
} else
|
|
1834
1894
|
this.clearValidationError(t, e), i([]);
|
|
@@ -1850,8 +1910,8 @@ class ue {
|
|
|
1850
1910
|
row: o,
|
|
1851
1911
|
value: r,
|
|
1852
1912
|
colIndex: a,
|
|
1853
|
-
relationRowKeys:
|
|
1854
|
-
relationColKeys:
|
|
1913
|
+
relationRowKeys: l,
|
|
1914
|
+
relationColKeys: h,
|
|
1855
1915
|
rowspan: d,
|
|
1856
1916
|
height: f,
|
|
1857
1917
|
width: u,
|
|
@@ -1878,43 +1938,43 @@ class ue {
|
|
|
1878
1938
|
}
|
|
1879
1939
|
]
|
|
1880
1940
|
};
|
|
1881
|
-
let g = e,
|
|
1941
|
+
let g = e, p = e, y = a, E = a, R = [], C = 0, I = 0, v = 0, _ = 0;
|
|
1882
1942
|
if (d !== 1 && w) {
|
|
1883
|
-
|
|
1884
|
-
const S =
|
|
1885
|
-
const
|
|
1886
|
-
return `${
|
|
1943
|
+
_ = u;
|
|
1944
|
+
const S = l.reduce((b, O) => {
|
|
1945
|
+
const T = this.getItemValue(s, O) ?? "";
|
|
1946
|
+
return `${b}${T}`;
|
|
1887
1947
|
}, "");
|
|
1888
|
-
for (let
|
|
1889
|
-
const
|
|
1890
|
-
const
|
|
1891
|
-
return `${M}${
|
|
1948
|
+
for (let b = e - 1; b >= 0; b--) {
|
|
1949
|
+
const O = this.rowIndexRowKeyMap.get(b) || "", T = l.reduce((M, L) => {
|
|
1950
|
+
const A = this.getItemValue(O, L) ?? "";
|
|
1951
|
+
return `${M}${A}`;
|
|
1892
1952
|
}, "");
|
|
1893
|
-
if (S ===
|
|
1894
|
-
g =
|
|
1953
|
+
if (S === T)
|
|
1954
|
+
g = b;
|
|
1895
1955
|
else
|
|
1896
1956
|
break;
|
|
1897
1957
|
}
|
|
1898
|
-
for (let
|
|
1899
|
-
const
|
|
1900
|
-
const
|
|
1901
|
-
return `${M}${
|
|
1958
|
+
for (let b = e; b <= this.ctx.maxRowIndex; b++) {
|
|
1959
|
+
const O = this.rowIndexRowKeyMap.get(b) || "", T = l.reduce((M, L) => {
|
|
1960
|
+
const A = this.getItemValue(O, L) ?? "";
|
|
1961
|
+
return `${M}${A}`;
|
|
1902
1962
|
}, "");
|
|
1903
|
-
if (S ===
|
|
1904
|
-
|
|
1963
|
+
if (S === T)
|
|
1964
|
+
p = b;
|
|
1905
1965
|
else
|
|
1906
1966
|
break;
|
|
1907
1967
|
}
|
|
1908
|
-
for (let
|
|
1909
|
-
const { height:
|
|
1910
|
-
C +=
|
|
1968
|
+
for (let b = g; b < e; b++) {
|
|
1969
|
+
const { height: O } = this.positions[b];
|
|
1970
|
+
C += O;
|
|
1911
1971
|
}
|
|
1912
|
-
for (let
|
|
1913
|
-
const { height:
|
|
1914
|
-
v +=
|
|
1915
|
-
const
|
|
1916
|
-
|
|
1917
|
-
rowKey:
|
|
1972
|
+
for (let b = g; b <= p; b++) {
|
|
1973
|
+
const { height: O } = this.positions[b];
|
|
1974
|
+
v += O;
|
|
1975
|
+
const T = this.rowIndexRowKeyMap.get(b) || "", { item: M } = this.rowKeyMap.get(T), L = this.getItemValue(T, i);
|
|
1976
|
+
R.push({
|
|
1977
|
+
rowKey: T,
|
|
1918
1978
|
key: i,
|
|
1919
1979
|
value: L,
|
|
1920
1980
|
row: M
|
|
@@ -1924,53 +1984,53 @@ class ue {
|
|
|
1924
1984
|
if (x !== 1 && m) {
|
|
1925
1985
|
v = f;
|
|
1926
1986
|
for (let S = a - 1; S >= 0; S--) {
|
|
1927
|
-
const
|
|
1928
|
-
if (!
|
|
1987
|
+
const b = this.getColumnByColIndex(S);
|
|
1988
|
+
if (!b)
|
|
1929
1989
|
break;
|
|
1930
|
-
const
|
|
1931
|
-
if (
|
|
1990
|
+
const O = this.getItemValue(s, i), T = this.getItemValue(s, b.key);
|
|
1991
|
+
if (O === T && h.includes(b.key))
|
|
1932
1992
|
y = S;
|
|
1933
1993
|
else
|
|
1934
1994
|
break;
|
|
1935
1995
|
}
|
|
1936
1996
|
for (let S = a; S <= this.ctx.maxColIndex; S++) {
|
|
1937
|
-
const
|
|
1938
|
-
if (!
|
|
1997
|
+
const b = this.getColumnByColIndex(S);
|
|
1998
|
+
if (!b)
|
|
1939
1999
|
break;
|
|
1940
|
-
const
|
|
1941
|
-
if (
|
|
1942
|
-
|
|
2000
|
+
const O = this.getItemValue(s, i), T = this.getItemValue(s, b.key);
|
|
2001
|
+
if (O === T && h.includes(b.key))
|
|
2002
|
+
E = S;
|
|
1943
2003
|
else
|
|
1944
2004
|
break;
|
|
1945
2005
|
}
|
|
1946
2006
|
for (let S = y; S < a; S++) {
|
|
1947
|
-
const
|
|
1948
|
-
if (!
|
|
2007
|
+
const b = this.getColumnByColIndex(S);
|
|
2008
|
+
if (!b)
|
|
1949
2009
|
break;
|
|
1950
|
-
|
|
2010
|
+
I += b.width || 100;
|
|
1951
2011
|
}
|
|
1952
|
-
for (let S = y; S <=
|
|
1953
|
-
const
|
|
1954
|
-
if (!
|
|
2012
|
+
for (let S = y; S <= E; S++) {
|
|
2013
|
+
const b = this.getColumnByColIndex(S);
|
|
2014
|
+
if (!b)
|
|
1955
2015
|
break;
|
|
1956
|
-
|
|
2016
|
+
_ += b.width || 100, R.push({
|
|
1957
2017
|
rowKey: s,
|
|
1958
|
-
key:
|
|
1959
|
-
value: this.getItemValue(s,
|
|
2018
|
+
key: b.key,
|
|
2019
|
+
value: this.getItemValue(s, b.key),
|
|
1960
2020
|
row: o
|
|
1961
2021
|
});
|
|
1962
2022
|
}
|
|
1963
2023
|
}
|
|
1964
2024
|
return {
|
|
1965
|
-
xArr: [y,
|
|
1966
|
-
yArr: [g,
|
|
2025
|
+
xArr: [y, E],
|
|
2026
|
+
yArr: [g, p],
|
|
1967
2027
|
rowspan: d,
|
|
1968
2028
|
colspan: x,
|
|
1969
2029
|
height: v,
|
|
1970
|
-
width:
|
|
2030
|
+
width: _,
|
|
1971
2031
|
offsetTop: C,
|
|
1972
|
-
offsetLeft:
|
|
1973
|
-
dataList:
|
|
2032
|
+
offsetLeft: I,
|
|
2033
|
+
dataList: R
|
|
1974
2034
|
};
|
|
1975
2035
|
}
|
|
1976
2036
|
setLoading(t) {
|
|
@@ -1983,7 +2043,7 @@ class ue {
|
|
|
1983
2043
|
const s = this.rowIndexRowKeyMap.get(t), o = `${s}_${e}`, r = this.getRowForRowIndex(t), a = this.getColumnByKey(e);
|
|
1984
2044
|
if (!s || !a || !r)
|
|
1985
2045
|
return;
|
|
1986
|
-
const
|
|
2046
|
+
const l = this.getItemValue(s, e), h = [
|
|
1987
2047
|
{
|
|
1988
2048
|
key: e,
|
|
1989
2049
|
rowKey: s,
|
|
@@ -1991,13 +2051,13 @@ class ue {
|
|
|
1991
2051
|
colIndex: a.colIndex,
|
|
1992
2052
|
column: a.column,
|
|
1993
2053
|
row: r,
|
|
1994
|
-
value:
|
|
2054
|
+
value: l,
|
|
1995
2055
|
message: i,
|
|
1996
2056
|
field: e,
|
|
1997
|
-
fieldValue:
|
|
2057
|
+
fieldValue: l
|
|
1998
2058
|
}
|
|
1999
2059
|
];
|
|
2000
|
-
this.validationErrorMap.set(o,
|
|
2060
|
+
this.validationErrorMap.set(o, h);
|
|
2001
2061
|
}
|
|
2002
2062
|
setValidationError(t, e, i) {
|
|
2003
2063
|
const s = `${t}_${e}`;
|
|
@@ -2048,6 +2108,16 @@ class ue {
|
|
|
2048
2108
|
}
|
|
2049
2109
|
}), i;
|
|
2050
2110
|
}
|
|
2111
|
+
updateOverlayerAutoHeightMap() {
|
|
2112
|
+
const t = this.ctx.overlayerElement.querySelectorAll('[data-auto-height="true"]'), e = /* @__PURE__ */ new Map();
|
|
2113
|
+
t.forEach((i) => {
|
|
2114
|
+
const s = Number(i.getAttribute("data-row-index"));
|
|
2115
|
+
isNaN(s) || e.set(s, i.clientHeight);
|
|
2116
|
+
}), this.overlayerAutoHeightMap = e;
|
|
2117
|
+
}
|
|
2118
|
+
getOverlayerAutoHeightByRowIndex(t) {
|
|
2119
|
+
return this.overlayerAutoHeightMap.get(t) || -1;
|
|
2120
|
+
}
|
|
2051
2121
|
}
|
|
2052
2122
|
class ge {
|
|
2053
2123
|
constructor(t) {
|
|
@@ -2218,7 +2288,7 @@ class me {
|
|
|
2218
2288
|
this.events.clear();
|
|
2219
2289
|
}
|
|
2220
2290
|
}
|
|
2221
|
-
class
|
|
2291
|
+
class pe {
|
|
2222
2292
|
constructor(t) {
|
|
2223
2293
|
n(this, "ctx");
|
|
2224
2294
|
const e = t.getContext("2d");
|
|
@@ -2228,9 +2298,6 @@ class Ee {
|
|
|
2228
2298
|
scale(t) {
|
|
2229
2299
|
this.ctx.setTransform(1, 0, 0, 1, 0, 0), this.ctx.scale(t, t);
|
|
2230
2300
|
}
|
|
2231
|
-
measureTextWidth(t, e) {
|
|
2232
|
-
return this.ctx.font = e, this.ctx.measureText(t).width;
|
|
2233
|
-
}
|
|
2234
2301
|
save() {
|
|
2235
2302
|
this.ctx.save();
|
|
2236
2303
|
}
|
|
@@ -2257,26 +2324,27 @@ class Ee {
|
|
|
2257
2324
|
* @param {string} color - 阴影的颜色
|
|
2258
2325
|
*/
|
|
2259
2326
|
drawShadow(t, e, i, s, o) {
|
|
2260
|
-
const { fillColor: r, side: a, shadowWidth:
|
|
2327
|
+
const { fillColor: r, side: a, shadowWidth: l, colorStart: h, colorEnd: d } = o;
|
|
2261
2328
|
this.ctx.save(), r && (this.ctx.fillStyle = r, this.ctx.fillRect(t, e, i, s));
|
|
2262
2329
|
let f;
|
|
2263
2330
|
switch (a) {
|
|
2264
2331
|
case "left":
|
|
2265
|
-
f = this.ctx.createLinearGradient(t -
|
|
2332
|
+
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);
|
|
2266
2333
|
break;
|
|
2267
2334
|
case "right":
|
|
2268
|
-
f = this.ctx.createLinearGradient(t + i, e, t + i +
|
|
2335
|
+
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);
|
|
2269
2336
|
break;
|
|
2270
2337
|
case "top":
|
|
2271
|
-
f = this.ctx.createLinearGradient(t, e -
|
|
2338
|
+
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);
|
|
2272
2339
|
break;
|
|
2273
2340
|
case "bottom":
|
|
2274
|
-
f = this.ctx.createLinearGradient(t, e + s, t, e + s +
|
|
2341
|
+
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);
|
|
2275
2342
|
break;
|
|
2276
2343
|
default:
|
|
2277
2344
|
console.error("Invalid side specified for shadow");
|
|
2278
2345
|
break;
|
|
2279
2346
|
}
|
|
2347
|
+
this.ctx.restore();
|
|
2280
2348
|
}
|
|
2281
2349
|
// 绘制线条
|
|
2282
2350
|
drawLine(t, e) {
|
|
@@ -2292,12 +2360,12 @@ class Ee {
|
|
|
2292
2360
|
drawImage(t, e, i, s, o) {
|
|
2293
2361
|
this.ctx.save(), this.ctx.drawImage(t, e, i, s, o), this.ctx.restore();
|
|
2294
2362
|
}
|
|
2295
|
-
drawRect(t, e, i, s, { borderWidth: o = 1, borderColor: r, fillColor: a, radius:
|
|
2296
|
-
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),
|
|
2363
|
+
drawRect(t, e, i, s, { borderWidth: o = 1, borderColor: r, fillColor: a, radius: l = 0 } = {}) {
|
|
2364
|
+
if (this.ctx.save(), this.ctx.beginPath(), a !== void 0 && (this.ctx.fillStyle = a), r !== void 0 && (this.ctx.lineWidth = o, this.ctx.strokeStyle = r), l === 0)
|
|
2297
2365
|
this.ctx.rect(t - 0.5, e - 0.5, i, s);
|
|
2298
2366
|
else {
|
|
2299
|
-
const [
|
|
2300
|
-
this.ctx.moveTo(t +
|
|
2367
|
+
const [h, d, f, u] = typeof l == "number" ? [l, l, l, l] : l;
|
|
2368
|
+
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);
|
|
2301
2369
|
}
|
|
2302
2370
|
a !== void 0 && this.ctx.fill(), r !== void 0 && this.ctx.stroke(), this.ctx.restore();
|
|
2303
2371
|
}
|
|
@@ -2312,52 +2380,137 @@ class Ee {
|
|
|
2312
2380
|
* @returns 是否溢出
|
|
2313
2381
|
*/
|
|
2314
2382
|
drawText(t = "", e, i, s, o, r = {}) {
|
|
2383
|
+
var O;
|
|
2315
2384
|
this.ctx.save();
|
|
2316
2385
|
const {
|
|
2317
2386
|
font: a = "12px Arial",
|
|
2318
|
-
align:
|
|
2319
|
-
color:
|
|
2387
|
+
align: l = "center",
|
|
2388
|
+
color: h = "#495060",
|
|
2320
2389
|
padding: d = 0,
|
|
2321
|
-
verticalAlign: f = "middle"
|
|
2390
|
+
verticalAlign: f = "middle",
|
|
2391
|
+
maxLineClamp: u = 1,
|
|
2392
|
+
autoRowHeight: x = !1,
|
|
2393
|
+
offsetLeft: w = 0,
|
|
2394
|
+
offsetRight: m = 0
|
|
2322
2395
|
} = r;
|
|
2323
|
-
this.ctx.font = a, this.ctx.fillStyle =
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
const
|
|
2329
|
-
|
|
2396
|
+
this.ctx.font = a, this.ctx.fillStyle = h, this.ctx.textAlign = l;
|
|
2397
|
+
const p = parseInt(((O = a.match(/\d+/)) == null ? void 0 : O[0]) || "12") * (r.lineHeight || 1.2), y = s - d * 2 - w - m, E = this.ctx.measureText("...").width;
|
|
2398
|
+
let R = !1;
|
|
2399
|
+
if (s <= E + d * 2 + w + m)
|
|
2400
|
+
return this.ctx.restore(), R = !0, R;
|
|
2401
|
+
const C = Math.round((o - 2 * d) / p);
|
|
2402
|
+
let I = this.wrapText(t, y), v = Math.min(I.length, Math.max(C, 1));
|
|
2403
|
+
u === "auto" && x ? v = I.length : typeof u == "number" && u < C ? v = u : (u === 1 && !x && (I = [t], v = 1), u === "auto" && C === 1 && (I = [t], v = 1));
|
|
2404
|
+
let _ = i + d;
|
|
2405
|
+
const S = Math.round(v * p);
|
|
2406
|
+
f === "middle" ? _ = i + (o - S) / 2 : f === "bottom" && (_ = i + o - S - d);
|
|
2407
|
+
let b = e + d + w;
|
|
2408
|
+
l === "center" ? b = e + (s - w - m) / 2 : l === "right" && (b = e + s - d - m);
|
|
2409
|
+
for (let T = 0; T < I.length; T++) {
|
|
2410
|
+
const M = I[T], L = _ + T * p;
|
|
2411
|
+
if (this.ctx.textBaseline = "top", T === v - 1) {
|
|
2412
|
+
const { _text: A, ellipsis: D } = this.handleEllipsis(M, s, d, a);
|
|
2413
|
+
this.ctx.fillText(A, b, L), R = D;
|
|
2414
|
+
break;
|
|
2415
|
+
}
|
|
2416
|
+
this.ctx.fillText(M, b, L);
|
|
2417
|
+
}
|
|
2418
|
+
if (r.textCallback && I.length) {
|
|
2419
|
+
const T = Math.round(this.ctx.measureText(I[0]).width);
|
|
2420
|
+
let M = b, L = b + T;
|
|
2421
|
+
l === "center" ? (M = b - T / 2, L = b + T / 2) : l === "right" && (M = b - T, L = b);
|
|
2422
|
+
const A = {
|
|
2423
|
+
x: b,
|
|
2424
|
+
y: _,
|
|
2425
|
+
width: T,
|
|
2426
|
+
height: S,
|
|
2427
|
+
left: M,
|
|
2428
|
+
right: L,
|
|
2429
|
+
top: _,
|
|
2430
|
+
bottom: _ + S
|
|
2431
|
+
};
|
|
2432
|
+
r.textCallback(A);
|
|
2433
|
+
}
|
|
2434
|
+
return this.ctx.restore(), R;
|
|
2435
|
+
}
|
|
2436
|
+
/**
|
|
2437
|
+
* 将文本按宽度换行
|
|
2438
|
+
* @param text
|
|
2439
|
+
* @param maxWidth
|
|
2440
|
+
* @returns
|
|
2441
|
+
*/
|
|
2442
|
+
wrapText(t, e) {
|
|
2443
|
+
if (!t) return [""];
|
|
2444
|
+
const i = [], s = t.split(`
|
|
2445
|
+
`);
|
|
2446
|
+
for (const o of s) {
|
|
2447
|
+
if (o === "") {
|
|
2448
|
+
i.push("");
|
|
2449
|
+
continue;
|
|
2450
|
+
}
|
|
2451
|
+
const r = o.split("");
|
|
2452
|
+
let a = "";
|
|
2453
|
+
for (const l of r) {
|
|
2454
|
+
const h = a + l;
|
|
2455
|
+
this.ctx.measureText(h).width <= e ? a = h : a ? (i.push(a), a = l) : (i.push(l), a = "");
|
|
2456
|
+
}
|
|
2457
|
+
a && i.push(a);
|
|
2458
|
+
}
|
|
2459
|
+
if (i.length >= 1) {
|
|
2460
|
+
const o = i[i.length - 1], { ellipsis: r } = this.handleEllipsis(o, e, 0, this.ctx.font);
|
|
2461
|
+
if (r) {
|
|
2462
|
+
const a = o.slice(0, -1);
|
|
2463
|
+
i[i.length - 1] = a, i.push(o.slice(-1));
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
return i.length > 0 ? i : [""];
|
|
2467
|
+
}
|
|
2468
|
+
/**
|
|
2469
|
+
* 计算文本自适应高度
|
|
2470
|
+
* @param text
|
|
2471
|
+
* @param width
|
|
2472
|
+
* @param options
|
|
2473
|
+
* @returns 计算出的高度
|
|
2474
|
+
*/
|
|
2475
|
+
calculateTextHeight(t = "", e, i = {}) {
|
|
2476
|
+
var w;
|
|
2477
|
+
const { font: s = "12px Arial", padding: o = 0, align: r = "center", color: a = "#495060", maxLineClamp: l = 1 } = i;
|
|
2478
|
+
this.ctx.save(), this.ctx.font = s, this.ctx.fillStyle = a, this.ctx.textAlign = r;
|
|
2479
|
+
const h = parseInt(((w = s.match(/\d+/)) == null ? void 0 : w[0]) || "12"), d = h * (i.lineHeight || 1.2), f = e - o * 2, u = this.wrapText(t, f);
|
|
2480
|
+
let x = 1;
|
|
2481
|
+
return l === "auto" ? x = u.length : u.length > l ? x = l : x = u.length, this.ctx.restore(), Math.max(Math.floor(x * d + o * 2), Math.floor(h + o * 2));
|
|
2330
2482
|
}
|
|
2331
2483
|
handleEllipsis(t, e, i = 0, s = "12px Arial") {
|
|
2484
|
+
this.ctx.save();
|
|
2332
2485
|
let o = !1, r = t;
|
|
2333
2486
|
if (this.ctx.font = s, t == null || t === "")
|
|
2334
|
-
return {
|
|
2487
|
+
return this.ctx.restore(), {
|
|
2335
2488
|
_text: "",
|
|
2336
2489
|
ellipsis: o
|
|
2337
2490
|
};
|
|
2338
2491
|
const a = this.ctx.measureText("...").width;
|
|
2339
2492
|
if (e <= a + i * 2)
|
|
2340
|
-
return {
|
|
2493
|
+
return this.ctx.restore(), {
|
|
2341
2494
|
_text: "",
|
|
2342
2495
|
ellipsis: !0
|
|
2343
2496
|
};
|
|
2344
|
-
const
|
|
2345
|
-
if (
|
|
2497
|
+
const l = this.ctx.measureText(t).width, h = e - i * 2;
|
|
2498
|
+
if (l && l + a >= h) {
|
|
2346
2499
|
o = !0;
|
|
2347
|
-
let
|
|
2348
|
-
for (let
|
|
2349
|
-
if (
|
|
2350
|
-
r = t.slice(0,
|
|
2500
|
+
let d = 0;
|
|
2501
|
+
for (let f = 0; f < t.length; f++)
|
|
2502
|
+
if (d += this.ctx.measureText(t[f]).width, d >= h - a) {
|
|
2503
|
+
r = t.slice(0, f) + "...", o = !0;
|
|
2351
2504
|
break;
|
|
2352
2505
|
}
|
|
2353
2506
|
}
|
|
2354
|
-
return {
|
|
2507
|
+
return this.ctx.restore(), {
|
|
2355
2508
|
_text: r,
|
|
2356
2509
|
ellipsis: o
|
|
2357
2510
|
};
|
|
2358
2511
|
}
|
|
2359
2512
|
}
|
|
2360
|
-
class
|
|
2513
|
+
class Rt {
|
|
2361
2514
|
constructor(t) {
|
|
2362
2515
|
n(this, "_config", {});
|
|
2363
2516
|
/** CSS 类名前缀 */
|
|
@@ -2604,6 +2757,10 @@ class It {
|
|
|
2604
2757
|
{ label: "粘贴", value: "paste" },
|
|
2605
2758
|
{ label: "清空选中内容", value: "clearSelected" }
|
|
2606
2759
|
]);
|
|
2760
|
+
/** 格子多行文本行高,isAutoRowHeight才会生效 */
|
|
2761
|
+
n(this, "CELL_LINE_HEIGHT", 1.3);
|
|
2762
|
+
/** 全局自动行高 */
|
|
2763
|
+
n(this, "AUTO_ROW_HEIGHT", !1);
|
|
2607
2764
|
/** header 格子样式 */
|
|
2608
2765
|
n(this, "HEADER_CELL_STYLE_METHOD");
|
|
2609
2766
|
/** body 格子样式 */
|
|
@@ -2659,7 +2816,7 @@ class It {
|
|
|
2659
2816
|
}), Object.assign(this, t, this._config);
|
|
2660
2817
|
}
|
|
2661
2818
|
}
|
|
2662
|
-
const
|
|
2819
|
+
const It = '<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>', ut = '<svg t="1755138507987" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5079" width="200" height="200"><path d="M512 938.688a42.688 42.688 0 0 1-35.072-18.432l-192-277.312A42.56 42.56 0 0 1 320 576h384a42.752 42.752 0 0 1 35.072 66.944l-192 277.312a42.688 42.688 0 0 1-35.072 18.432" fill="currentColor" p-id="2016"></path><path d="M704 448H320a42.752 42.752 0 0 1-35.072-66.944l192-277.312c16-23.04 54.208-23.04 70.144 0l192 277.312A42.56 42.56 0 0 1 704 448" fill="currentColor" p-id="2015"></path></svg>', Ee = ut.replace('fill="currentColor" p-id="2016"', 'fill="#bec4c7" p-id="2016"'), ye = ut.replace('fill="currentColor" p-id="2015"', 'fill="#bec4c7" p-id="2015"');
|
|
2663
2820
|
class Ce {
|
|
2664
2821
|
constructor(t) {
|
|
2665
2822
|
n(this, "ctx");
|
|
@@ -2682,7 +2839,7 @@ class Ce {
|
|
|
2682
2839
|
name: "shrink",
|
|
2683
2840
|
configName: "CHECKBOX_UNCHECK_SVG",
|
|
2684
2841
|
configColorName: "SHRINK_ICON_COLOR",
|
|
2685
|
-
svg:
|
|
2842
|
+
svg: It,
|
|
2686
2843
|
color: "#4E5969"
|
|
2687
2844
|
},
|
|
2688
2845
|
{
|
|
@@ -2734,14 +2891,14 @@ class Ce {
|
|
|
2734
2891
|
name: "icon-select",
|
|
2735
2892
|
configName: "CHECKBOX_UNCHECK_SVG",
|
|
2736
2893
|
configColorName: "SHRINK_ICON_COLOR",
|
|
2737
|
-
svg:
|
|
2894
|
+
svg: It,
|
|
2738
2895
|
color: "#4E5969"
|
|
2739
2896
|
},
|
|
2740
2897
|
{
|
|
2741
2898
|
name: "sort-asc",
|
|
2742
2899
|
configName: "SORT_ASC_ICON_SVG",
|
|
2743
2900
|
configColorName: "SORT_ICON_COLOR",
|
|
2744
|
-
svg:
|
|
2901
|
+
svg: Ee,
|
|
2745
2902
|
color: "rgb(82,146,247)"
|
|
2746
2903
|
},
|
|
2747
2904
|
{
|
|
@@ -2791,22 +2948,22 @@ class Ce {
|
|
|
2791
2948
|
}
|
|
2792
2949
|
async createImageFromSVG(t, e, i = !1) {
|
|
2793
2950
|
const r = new DOMParser().parseFromString(t, "image/svg+xml").documentElement;
|
|
2794
|
-
e && r.querySelectorAll("*").forEach((
|
|
2795
|
-
const d =
|
|
2796
|
-
(d === "currentColor" || d === null) &&
|
|
2951
|
+
e && r.querySelectorAll("*").forEach((h) => {
|
|
2952
|
+
const d = h.getAttribute("fill");
|
|
2953
|
+
(d === "currentColor" || d === null) && h.setAttribute("fill", e);
|
|
2797
2954
|
});
|
|
2798
2955
|
const a = new Image();
|
|
2799
|
-
let
|
|
2956
|
+
let l = "";
|
|
2800
2957
|
if (i) {
|
|
2801
|
-
const
|
|
2958
|
+
const h = new Blob([new XMLSerializer().serializeToString(r)], {
|
|
2802
2959
|
type: "image/svg+xml"
|
|
2803
2960
|
});
|
|
2804
|
-
|
|
2961
|
+
l = URL.createObjectURL(h);
|
|
2805
2962
|
} else
|
|
2806
|
-
|
|
2807
|
-
return a.src =
|
|
2963
|
+
l = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(r));
|
|
2964
|
+
return a.src = l, new Promise((h, d) => {
|
|
2808
2965
|
a.onerror = () => d(new Error("Failed to load image:" + t)), a.onload = () => {
|
|
2809
|
-
|
|
2966
|
+
h(a);
|
|
2810
2967
|
};
|
|
2811
2968
|
});
|
|
2812
2969
|
}
|
|
@@ -2814,9 +2971,9 @@ class Ce {
|
|
|
2814
2971
|
return this.icons.get(t);
|
|
2815
2972
|
}
|
|
2816
2973
|
}
|
|
2817
|
-
class
|
|
2818
|
-
constructor(e, i, s, o, r, a,
|
|
2819
|
-
super(e, s, o, r, a, "header",
|
|
2974
|
+
class ht extends Yt {
|
|
2975
|
+
constructor(e, i, s, o, r, a, l) {
|
|
2976
|
+
super(e, s, o, r, a, "header", l.fixed);
|
|
2820
2977
|
n(this, "align");
|
|
2821
2978
|
n(this, "hideHeaderSelection", !1);
|
|
2822
2979
|
n(this, "verticalAlign", "middle");
|
|
@@ -2853,6 +3010,7 @@ class lt extends Yt {
|
|
|
2853
3010
|
n(this, "sortDescIconName", "sort-desc");
|
|
2854
3011
|
n(this, "visibleWidth", 0);
|
|
2855
3012
|
n(this, "visibleHeight", 0);
|
|
3013
|
+
n(this, "maxLineClamp", "auto");
|
|
2856
3014
|
n(this, "drawTextX", 0);
|
|
2857
3015
|
n(this, "drawTextY", 0);
|
|
2858
3016
|
n(this, "drawTextWidth", 0);
|
|
@@ -2872,7 +3030,7 @@ class lt extends Yt {
|
|
|
2872
3030
|
n(this, "drawSortImageHeight", 0);
|
|
2873
3031
|
n(this, "drawSortImageName", "");
|
|
2874
3032
|
n(this, "drawSortImageSource");
|
|
2875
|
-
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 =
|
|
3033
|
+
this.ctx = e, this.x = s, this.y = o, this.width = r, this.height = a, this.visibleWidth = r, this.visibleHeight = a, this.colIndex = i, this.key = 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.sortIconName = l.sortIconName || "sort-default", this.sortAscIconName = l.sortAscIconName || "sort-asc", this.sortDescIconName = l.sortDescIconName || "sort-desc", this.rowKey = At(), this.overflowTooltipShow = l.overflowTooltipHeaderShow !== !1, this.hasChildren = l.children && l.children.length > 0 || !1, this.render = l.renderHeader;
|
|
2876
3034
|
}
|
|
2877
3035
|
/**
|
|
2878
3036
|
* 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
|
|
@@ -2892,11 +3050,11 @@ class lt extends Yt {
|
|
|
2892
3050
|
const { HEADER_CELL_STYLE_METHOD: e, HEADER_BG_COLOR: i, HEADER_TEXT_COLOR: s } = this.ctx.config;
|
|
2893
3051
|
let o = i, r = s;
|
|
2894
3052
|
if (typeof e == "function") {
|
|
2895
|
-
const a = e, { backgroundColor:
|
|
3053
|
+
const a = e, { backgroundColor: l, color: h } = a({
|
|
2896
3054
|
colIndex: this.colIndex,
|
|
2897
3055
|
column: this.column
|
|
2898
3056
|
}) || {};
|
|
2899
|
-
|
|
3057
|
+
l && (o = l), h && (r = h);
|
|
2900
3058
|
}
|
|
2901
3059
|
this.drawCellBgColor = o, this.drawTextColor = r;
|
|
2902
3060
|
}
|
|
@@ -2904,7 +3062,7 @@ class lt extends Yt {
|
|
|
2904
3062
|
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();
|
|
2905
3063
|
}
|
|
2906
3064
|
draw() {
|
|
2907
|
-
this.drawEdge(), this.drawSelection(), this.
|
|
3065
|
+
this.drawEdge(), this.drawSelection(), this.drawText(), this.drawSelector(), this.drawSortIcon();
|
|
2908
3066
|
}
|
|
2909
3067
|
drawEdge() {
|
|
2910
3068
|
const {
|
|
@@ -2916,14 +3074,6 @@ class lt extends Yt {
|
|
|
2916
3074
|
fillColor: this.drawCellBgColor
|
|
2917
3075
|
});
|
|
2918
3076
|
}
|
|
2919
|
-
recalculateTextPosition() {
|
|
2920
|
-
let e = this.drawX, i = this.width;
|
|
2921
|
-
if (["selection", "index-selection", "selection-tree", "tree-selection"].includes(this.type)) {
|
|
2922
|
-
const { CHECKBOX_SIZE: s } = this.ctx.config;
|
|
2923
|
-
this.align === "left" || this.align === "right" ? (e = this.drawX + s + 4, i = this.width - e + this.drawX) : (e = this.drawX + (this.width - s) / 2 + s + 1, i = this.width - e + this.drawX);
|
|
2924
|
-
}
|
|
2925
|
-
this.column.sortBy && (this.align === "right" ? (i = this.width - this.ctx.config.CELL_PADDING - 16 - 4, e = this.drawX + this.ctx.config.CELL_PADDING) : this.align === "center" && this.ctx.paint.measureTextWidth(this.displayText, this.ctx.config.HEADER_FONT) + 16 + 4 > this.width - this.ctx.config.CELL_PADDING * 2 && (i = this.width - this.ctx.config.CELL_PADDING * 2 - 16 - 4)), this.drawTextX = e, this.drawTextWidth = i;
|
|
2926
|
-
}
|
|
2927
3077
|
drawText() {
|
|
2928
3078
|
const {
|
|
2929
3079
|
paint: e,
|
|
@@ -2940,7 +3090,13 @@ class lt extends Yt {
|
|
|
2940
3090
|
padding: s,
|
|
2941
3091
|
color: this.drawTextColor,
|
|
2942
3092
|
align: this.align,
|
|
2943
|
-
verticalAlign: this.verticalAlign
|
|
3093
|
+
verticalAlign: this.verticalAlign,
|
|
3094
|
+
maxLineClamp: this.maxLineClamp,
|
|
3095
|
+
offsetRight: this.column.sortBy ? 16 : 0,
|
|
3096
|
+
// 排序图标占位
|
|
3097
|
+
textCallback: (o) => {
|
|
3098
|
+
this.column.sortBy && (this.drawSortImageX = o.right + 4, this.drawSortImageY = o.top + (o.height - 16) / 2);
|
|
3099
|
+
}
|
|
2944
3100
|
}
|
|
2945
3101
|
);
|
|
2946
3102
|
}
|
|
@@ -2957,10 +3113,10 @@ class lt extends Yt {
|
|
|
2957
3113
|
drawSelection() {
|
|
2958
3114
|
if (!this.hideHeaderSelection && ["index-selection", "selection", "selection-tree", "tree-selection"].includes(this.type)) {
|
|
2959
3115
|
const { indeterminate: e, check: i, selectable: s } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: o = 0, CELL_PADDING: r } = this.ctx.config;
|
|
2960
|
-
let a = this.drawX + (this.width - o) / 2,
|
|
2961
|
-
this.drawTextX = a + o - r / 2, this.drawTextWidth = this.drawX + this.visibleWidth - this.drawTextX, (this.align === "left" || this.align === "right") && (a = this.drawX + r, this.drawTextX = a + o - r / 2, this.drawTextWidth = this.drawX + this.visibleWidth - this.drawTextX), this.verticalAlign === "top" ?
|
|
2962
|
-
let
|
|
2963
|
-
e ? (
|
|
3116
|
+
let a = this.drawX + (this.width - o) / 2, l = this.drawY + (this.height - o) / 2;
|
|
3117
|
+
this.drawTextX = a + o - r / 2, this.drawTextWidth = this.drawX + this.visibleWidth - this.drawTextX, (this.align === "left" || this.align === "right") && (a = this.drawX + r, this.drawTextX = a + o - r / 2, this.drawTextWidth = this.drawX + this.visibleWidth - this.drawTextX), this.verticalAlign === "top" ? l = this.drawY + r / 2 : this.verticalAlign === "bottom" && (l = this.drawY + this.height - o - r / 2);
|
|
3118
|
+
let h = this.ctx.icons.get("checkbox-uncheck"), d = "checkbox-uncheck";
|
|
3119
|
+
e ? (h = this.ctx.icons.get("checkbox-indeterminate"), d = "checkbox-indeterminate") : i && s ? (h = this.ctx.icons.get("checkbox-check"), d = "checkbox-check") : i && !s ? (h = this.ctx.icons.get("checkbox-check-disabled"), d = "checkbox-check-disabled") : !i && s ? (h = this.ctx.icons.get("checkbox-uncheck"), d = "checkbox-uncheck") : (h = this.ctx.icons.get("checkbox-disabled"), d = "checkbox-disabled"), h && (this.drawSelectionImageX = a, this.drawSelectionImageY = l, this.drawSelectionImageWidth = o, this.drawSelectionImageHeight = o, this.drawSelectionImageName = d, this.drawSelectionImageSource = h, this.ctx.paint.drawImage(
|
|
2964
3120
|
this.drawSelectionImageSource,
|
|
2965
3121
|
this.drawSelectionImageX,
|
|
2966
3122
|
this.drawSelectionImageY,
|
|
@@ -2972,28 +3128,18 @@ class lt extends Yt {
|
|
|
2972
3128
|
drawSortIcon() {
|
|
2973
3129
|
if (!this.column.sortBy)
|
|
2974
3130
|
return;
|
|
2975
|
-
const
|
|
2976
|
-
let
|
|
2977
|
-
const
|
|
2978
|
-
|
|
2979
|
-
const
|
|
2980
|
-
|
|
2981
|
-
return;
|
|
2982
|
-
let c = 0, l = this.drawY + (this.height - i) / 2;
|
|
2983
|
-
if (this.align === "left") {
|
|
2984
|
-
const d = this.ctx.paint.measureTextWidth(this.displayText, this.ctx.config.HEADER_FONT);
|
|
2985
|
-
c = this.drawX + e + d + s;
|
|
2986
|
-
} else if (this.align === "center") {
|
|
2987
|
-
const d = this.ctx.paint.measureTextWidth(this.displayText, this.ctx.config.HEADER_FONT);
|
|
2988
|
-
c = this.drawX + this.width / 2 - d / 2 + d + s;
|
|
2989
|
-
} else this.align === "right" && (c = this.drawX + this.width - e - i);
|
|
2990
|
-
this.drawSortImageX = c, this.drawSortImageY = l, this.drawSortImageWidth = i, this.drawSortImageHeight = i, this.drawSortImageName = o, this.drawSortImageSource = a, this.ctx.paint.drawImage(
|
|
3131
|
+
const e = 16;
|
|
3132
|
+
let i = this.sortIconName;
|
|
3133
|
+
const s = this.ctx.database.getSortState(this.key);
|
|
3134
|
+
s.direction === "asc" ? i = this.sortAscIconName : s.direction === "desc" && (i = this.sortDescIconName);
|
|
3135
|
+
const o = this.ctx.icons.get(i);
|
|
3136
|
+
o && (this.drawSortImageWidth = e, this.drawSortImageHeight = e, this.drawSortImageName = i, this.drawSortImageSource = o, this.ctx.paint.drawImage(
|
|
2991
3137
|
this.drawSortImageSource,
|
|
2992
3138
|
this.drawSortImageX,
|
|
2993
3139
|
this.drawSortImageY,
|
|
2994
3140
|
this.drawSortImageWidth,
|
|
2995
3141
|
this.drawSortImageHeight
|
|
2996
|
-
);
|
|
3142
|
+
));
|
|
2997
3143
|
}
|
|
2998
3144
|
getText() {
|
|
2999
3145
|
return this.render ? "" : this.text;
|
|
@@ -3042,15 +3188,38 @@ class be {
|
|
|
3042
3188
|
}), this.handleBodyEvent(o, s, this.ctx.body.renderRows, (r) => {
|
|
3043
3189
|
this.ctx.setFocusCell(r), this.ctx.emit("cellMousedown", r, t);
|
|
3044
3190
|
});
|
|
3191
|
+
}), this.ctx.on("mouseup", (t) => {
|
|
3192
|
+
if (t.button !== 0 || this.isBusy(t))
|
|
3193
|
+
return;
|
|
3194
|
+
const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = e, o = i;
|
|
3195
|
+
this.handleHeaderEvent(o, s, this.ctx.header.renderCellHeaders, (r) => {
|
|
3196
|
+
this.ctx.focusCellHeader = r, this.ctx.emit("cellHeaderMouseup", r, t);
|
|
3197
|
+
}), this.handleBodyEvent(o, s, this.ctx.body.renderRows, (r) => {
|
|
3198
|
+
this.ctx.setFocusCell(r), this.ctx.emit("cellMouseup", r, t);
|
|
3199
|
+
});
|
|
3045
3200
|
}), this.ctx.on("click", (t) => {
|
|
3046
3201
|
if (t.button !== 0 || this.isBusy(t))
|
|
3047
3202
|
return;
|
|
3048
3203
|
const e = this.ctx.getOffset(t).offsetY, i = this.ctx.getOffset(t).offsetX;
|
|
3049
3204
|
this.handleHeaderEvent(i, e, this.ctx.header.renderCellHeaders, (s) => {
|
|
3050
3205
|
this.ctx.clickCellHeader = s, this.ctx.emit("cellHeaderClick", s, t), this.selectionClick(s, t), this.sortClick(s, t);
|
|
3051
|
-
}), this.handleBodyEvent(
|
|
3052
|
-
|
|
3053
|
-
|
|
3206
|
+
}), this.handleBodyEvent(
|
|
3207
|
+
i,
|
|
3208
|
+
e,
|
|
3209
|
+
this.ctx.body.renderRows,
|
|
3210
|
+
(s) => {
|
|
3211
|
+
this.ctx.clickCell = s, this.ctx.emit("cellClick", s, t), this.selectionClick(s, t), this.treeClick(s, t);
|
|
3212
|
+
},
|
|
3213
|
+
!0
|
|
3214
|
+
), this.handleBodyEvent(
|
|
3215
|
+
i,
|
|
3216
|
+
e,
|
|
3217
|
+
this.ctx.body.renderRows,
|
|
3218
|
+
(s) => {
|
|
3219
|
+
this.hoverIconClick(s);
|
|
3220
|
+
},
|
|
3221
|
+
!1
|
|
3222
|
+
);
|
|
3054
3223
|
}), this.ctx.on("dblclick", (t) => {
|
|
3055
3224
|
if (t.button !== 0 || this.isBusy(t))
|
|
3056
3225
|
return;
|
|
@@ -3083,7 +3252,7 @@ class be {
|
|
|
3083
3252
|
e,
|
|
3084
3253
|
this.ctx.body.renderRows,
|
|
3085
3254
|
(s) => {
|
|
3086
|
-
this.visibleHoverCell !== s && (this.ctx.emit("visibleCellMouseleave", s, t), this.visibleHoverCell = s, this.ctx.hoverCellHeader = void 0, this.ctx.emit("visibleCellHoverChange", s, t));
|
|
3255
|
+
this.imageEnterAndLeave(s, t), this.visibleHoverCell !== s && (this.ctx.emit("visibleCellMouseleave", s, t), this.visibleHoverCell = s, this.ctx.hoverCellHeader = void 0, this.ctx.emit("visibleCellHoverChange", s, t));
|
|
3087
3256
|
},
|
|
3088
3257
|
!0
|
|
3089
3258
|
), this.handleBodyEvent(i, e, this.ctx.body.renderRows, (s) => {
|
|
@@ -3111,7 +3280,7 @@ class be {
|
|
|
3111
3280
|
t.drawSelectionImageWidth,
|
|
3112
3281
|
t.drawSelectionImageHeight
|
|
3113
3282
|
))
|
|
3114
|
-
if (t instanceof
|
|
3283
|
+
if (t instanceof ht)
|
|
3115
3284
|
t.drawSelectionImageName === "checkbox-uncheck" || t.drawSelectionImageName === "checkbox-indeterminate" ? this.ctx.database.toggleAllSelection() : t.drawSelectionImageName === "checkbox-check" && this.ctx.database.clearSelection(!0);
|
|
3116
3285
|
else {
|
|
3117
3286
|
if (!this.ctx.database.getRowSelectable(t.rowKey))
|
|
@@ -3136,8 +3305,8 @@ class be {
|
|
|
3136
3305
|
t.drawTreeImageHeight
|
|
3137
3306
|
))
|
|
3138
3307
|
return;
|
|
3139
|
-
const
|
|
3140
|
-
if (f && u && !
|
|
3308
|
+
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;
|
|
3309
|
+
if (f && u && !h && !d)
|
|
3141
3310
|
typeof u == "function" && (this.ctx.database.expandLoading(t.rowKey, !0), u({
|
|
3142
3311
|
row: t.row,
|
|
3143
3312
|
rowIndex: t.rowIndex,
|
|
@@ -3166,8 +3335,8 @@ class be {
|
|
|
3166
3335
|
))
|
|
3167
3336
|
return;
|
|
3168
3337
|
const a = this.ctx.database.getSortState(t.key);
|
|
3169
|
-
let
|
|
3170
|
-
a.direction === "none" ?
|
|
3338
|
+
let l;
|
|
3339
|
+
a.direction === "none" ? l = "asc" : a.direction === "asc" ? l = "desc" : l = "none", this.ctx.database.setSortState(t.key, l);
|
|
3171
3340
|
}
|
|
3172
3341
|
/**
|
|
3173
3342
|
* 图标进入和离开事件,包括选中,展开,提示图标等
|
|
@@ -3176,7 +3345,7 @@ class be {
|
|
|
3176
3345
|
*/
|
|
3177
3346
|
imageEnterAndLeave(t, e) {
|
|
3178
3347
|
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), o = i, r = s;
|
|
3179
|
-
if (t instanceof
|
|
3348
|
+
if (t instanceof ht) {
|
|
3180
3349
|
if (t.drawSelectionImageSource && this.isInsideElement(
|
|
3181
3350
|
r,
|
|
3182
3351
|
o,
|
|
@@ -3250,15 +3419,15 @@ class be {
|
|
|
3250
3419
|
if (this.isInsideBody(e))
|
|
3251
3420
|
for (const r of i) {
|
|
3252
3421
|
const a = r.fixedCells.concat(r.noFixedCells);
|
|
3253
|
-
for (const
|
|
3254
|
-
const
|
|
3422
|
+
for (const l of a) {
|
|
3423
|
+
const h = l.getDrawX(), d = l.getDrawY();
|
|
3255
3424
|
if (o) {
|
|
3256
|
-
if (t >
|
|
3257
|
-
s(
|
|
3425
|
+
if (t > h && t < h + l.visibleWidth && e > d && e < d + l.visibleHeight) {
|
|
3426
|
+
s(l);
|
|
3258
3427
|
return;
|
|
3259
3428
|
}
|
|
3260
|
-
} else if (t >
|
|
3261
|
-
s(
|
|
3429
|
+
} else if (t > h && t < h + l.width && e > d && e < d + l.height) {
|
|
3430
|
+
s(l);
|
|
3262
3431
|
return;
|
|
3263
3432
|
}
|
|
3264
3433
|
}
|
|
@@ -3280,7 +3449,7 @@ class be {
|
|
|
3280
3449
|
this.resizeObserver.unobserve(this.ctx.stageElement), this.mutationObserver.disconnect();
|
|
3281
3450
|
}
|
|
3282
3451
|
}
|
|
3283
|
-
class
|
|
3452
|
+
class Re {
|
|
3284
3453
|
constructor(t, e) {
|
|
3285
3454
|
n(this, "eventBus");
|
|
3286
3455
|
n(this, "eventBrowser");
|
|
@@ -3397,20 +3566,20 @@ class Ie {
|
|
|
3397
3566
|
canvasElement: o,
|
|
3398
3567
|
overlayerElement: r,
|
|
3399
3568
|
editorElement: a,
|
|
3400
|
-
emptyElement:
|
|
3401
|
-
contextMenuElement:
|
|
3569
|
+
emptyElement: l,
|
|
3570
|
+
contextMenuElement: h
|
|
3402
3571
|
} = t;
|
|
3403
|
-
this.containerElement = i, s.tabIndex = 0, this.stageElement = s, this.canvasElement = o, this.overlayerElement = r, this.editorElement = a, this.emptyElement =
|
|
3572
|
+
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 Rt(e.config || {}), this.eventBus = new me(), this.eventBrowser = new we(this), this.eventTable = new be(this), this.paint = new pe(this.canvasElement), this.database = new ue(this, e), this.history = new ge(this), this.icons = new Ce(this);
|
|
3404
3573
|
}
|
|
3405
3574
|
setConfig(t) {
|
|
3406
|
-
this.config = new
|
|
3575
|
+
this.config = new Rt(t);
|
|
3407
3576
|
}
|
|
3408
3577
|
setItemValueByEditor(t, e, i, s = !0, o = !0, r = !0) {
|
|
3409
3578
|
if (this.config.ENABLE_MERGE_CELL_LINK) {
|
|
3410
3579
|
const a = this.database.getVirtualBodyCellByKey(t, e);
|
|
3411
3580
|
if (a && (a.mergeRow || a.mergeCol)) {
|
|
3412
|
-
const { dataList:
|
|
3413
|
-
this.database.batchSetItemValue(
|
|
3581
|
+
const { dataList: l } = a.getSpanInfo(), h = l.map((d) => ({ ...d, value: i }));
|
|
3582
|
+
this.database.batchSetItemValue(h, s, r);
|
|
3414
3583
|
return;
|
|
3415
3584
|
}
|
|
3416
3585
|
}
|
|
@@ -3422,9 +3591,9 @@ class Ie {
|
|
|
3422
3591
|
t.forEach((o) => {
|
|
3423
3592
|
const r = this.database.getRowIndexForRowKey(o.rowKey), a = this.database.getColIndexForKey(o.key);
|
|
3424
3593
|
if (r === void 0 || a === void 0) return;
|
|
3425
|
-
const
|
|
3426
|
-
if (
|
|
3427
|
-
const { dataList:
|
|
3594
|
+
const l = this.database.getVirtualBodyCell(r, a);
|
|
3595
|
+
if (l) {
|
|
3596
|
+
const { dataList: h } = l.getSpanInfo(), d = h.map((f) => ({ ...f, value: o.value }));
|
|
3428
3597
|
s.push(...d);
|
|
3429
3598
|
}
|
|
3430
3599
|
}), this.database.batchSetItemValue(s, e, i);
|
|
@@ -3469,7 +3638,7 @@ class Ie {
|
|
|
3469
3638
|
for (let o = 0; o <= e[1] - e[0]; o++) {
|
|
3470
3639
|
const r = [];
|
|
3471
3640
|
for (let a = 0; a <= i[1] - i[0]; a++) {
|
|
3472
|
-
const
|
|
3641
|
+
const l = o + e[0], h = a + i[0], d = this.database.getVirtualBodyCell(l, h);
|
|
3473
3642
|
d && (d.selectorCellValueType === "displayText" ? r.push(d.displayText) : r.push(d.getValue()));
|
|
3474
3643
|
}
|
|
3475
3644
|
s += `${r.join(" ")}\r`, t.push(r);
|
|
@@ -3590,8 +3759,8 @@ class St {
|
|
|
3590
3759
|
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;
|
|
3591
3760
|
let a = 0;
|
|
3592
3761
|
if (this.type === "horizontal" ? a = s - this.clientX : a = o - this.clientY, this.isDragging && a !== 0) {
|
|
3593
|
-
let
|
|
3594
|
-
this.type === "vertical" ?
|
|
3762
|
+
let l = 0;
|
|
3763
|
+
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));
|
|
3595
3764
|
}
|
|
3596
3765
|
}
|
|
3597
3766
|
isPointInElement(t, e, i, s, o, r) {
|
|
@@ -3617,21 +3786,21 @@ class St {
|
|
|
3617
3786
|
stageHeight: i,
|
|
3618
3787
|
stageWidth: s,
|
|
3619
3788
|
config: { SCROLLER_TRACK_SIZE: o = 0, SCROLLER_SIZE: r = 0, BORDER: a }
|
|
3620
|
-
} = this.ctx,
|
|
3789
|
+
} = this.ctx, l = s, h = i, d = e.height, f = e.width, u = t.height, x = this.ctx.footer.height;
|
|
3621
3790
|
if (this.type === "vertical") {
|
|
3622
|
-
this.visibleDistance =
|
|
3791
|
+
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;
|
|
3623
3792
|
const w = this.distance ? this.visibleDistance / (u + x) : 0;
|
|
3624
3793
|
let m = Math.floor(w * this.visibleDistance);
|
|
3625
3794
|
m < 30 ? m = 30 : m > this.visibleDistance && (m = 0), this.barHeight = m, this.barY = d + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
3626
3795
|
} else {
|
|
3627
|
-
this.visibleDistance =
|
|
3628
|
-
|
|
3796
|
+
this.visibleDistance = l - o, this.distance = f - this.visibleDistance, this.splitPoints = [
|
|
3797
|
+
l - o,
|
|
3798
|
+
h - o,
|
|
3629
3799
|
l - o,
|
|
3630
|
-
|
|
3631
|
-
l
|
|
3800
|
+
h
|
|
3632
3801
|
];
|
|
3633
3802
|
const w = a ? 0 : 0.5;
|
|
3634
|
-
this.trackX = 0, this.trackY =
|
|
3803
|
+
this.trackX = 0, this.trackY = h - o + w, this.trackWidth = l, this.trackHeight = o;
|
|
3635
3804
|
const m = this.distance ? this.visibleDistance / f : 0;
|
|
3636
3805
|
let g = Math.floor(m * this.visibleDistance);
|
|
3637
3806
|
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));
|
|
@@ -3655,7 +3824,7 @@ class St {
|
|
|
3655
3824
|
}), this.ctx.scrollerFocus = this.isFocus;
|
|
3656
3825
|
}
|
|
3657
3826
|
}
|
|
3658
|
-
class
|
|
3827
|
+
class Ie {
|
|
3659
3828
|
constructor(t) {
|
|
3660
3829
|
n(this, "ctx");
|
|
3661
3830
|
n(this, "verticalScrollbar");
|
|
@@ -3780,13 +3949,13 @@ class Se {
|
|
|
3780
3949
|
this.columnIndex = 0, this.resizeNum = 0, this.render(r, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
3781
3950
|
const a = this.ctx.containerElement.getBoundingClientRect();
|
|
3782
3951
|
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;
|
|
3783
|
-
const
|
|
3784
|
-
if (this.resizeNum &&
|
|
3785
|
-
const f = Math.floor(
|
|
3952
|
+
const l = this.visibleWidth - this.width;
|
|
3953
|
+
if (this.resizeNum && l > 0) {
|
|
3954
|
+
const f = Math.floor(l / this.resizeNum * 100) / 100;
|
|
3786
3955
|
this.resizeAllColumn(f);
|
|
3787
3956
|
}
|
|
3788
|
-
const
|
|
3789
|
-
this.ctx.fixedLeftWidth =
|
|
3957
|
+
const h = this.fixedLeftCellHeaders.filter((f) => !f.hasChildren);
|
|
3958
|
+
this.ctx.fixedLeftWidth = h.reduce((f, u) => f + u.width, 0);
|
|
3790
3959
|
const d = this.fixedRightCellHeaders.filter((f) => !f.hasChildren);
|
|
3791
3960
|
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;
|
|
3792
3961
|
}
|
|
@@ -3807,8 +3976,8 @@ class Se {
|
|
|
3807
3976
|
} = this.ctx;
|
|
3808
3977
|
if (this.isResizing && this.resizeTarget) {
|
|
3809
3978
|
const o = this.resizeTarget.width, r = this.resizeTarget.minWidth, a = this.resizeTarget.maxWidth;
|
|
3810
|
-
let
|
|
3811
|
-
|
|
3979
|
+
let l = e.clientX - this.clientX;
|
|
3980
|
+
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");
|
|
3812
3981
|
} else {
|
|
3813
3982
|
if (this.resizeTarget = null, this.isMouseDown)
|
|
3814
3983
|
return;
|
|
@@ -3819,9 +3988,9 @@ class Se {
|
|
|
3819
3988
|
this.ctx.stageElement.style.cursor === "col-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3820
3989
|
const o = [...this.renderFixedCellHeaders, ...this.renderCenterCellHeaders];
|
|
3821
3990
|
for (const r of o) {
|
|
3822
|
-
const { offsetX: a, offsetY:
|
|
3823
|
-
|
|
3824
|
-
r.colspan <= 1 && this.ctx.isTarget(e) &&
|
|
3991
|
+
const { offsetX: a, offsetY: l } = this.ctx.getOffset(e), h = a, d = r.getDrawX();
|
|
3992
|
+
h > d + r.width - 5 && h < d + r.width + 4 && h < i - 4 && // 视窗中最后一列不允许调整宽
|
|
3993
|
+
r.colspan <= 1 && this.ctx.isTarget(e) && l <= this.height && (this.ctx.stageElement.style.cursor = "col-resize", this.resizeTarget = r);
|
|
3825
3994
|
}
|
|
3826
3995
|
}
|
|
3827
3996
|
}));
|
|
@@ -3875,10 +4044,10 @@ class Se {
|
|
|
3875
4044
|
let s = e;
|
|
3876
4045
|
const { HEADER_HEIGHT: o = 0 } = this.ctx.config;
|
|
3877
4046
|
for (let r = 0; r < i; r++) {
|
|
3878
|
-
const a = t[r],
|
|
4047
|
+
const a = t[r], l = o * (a.rowspan || 0), h = o * (a.level || 0);
|
|
3879
4048
|
let { minWidth: d, maxWidth: f } = a, u = a.width || 100;
|
|
3880
4049
|
d && u < d && (u = d), f && u > f && (u = f), a.children && (u = et(a.children).reduce((m, g) => m + ((g == null ? void 0 : g.width) || 100), 0));
|
|
3881
|
-
const x = new
|
|
4050
|
+
const x = new ht(this.ctx, this.columnIndex, s, h, u, l, a);
|
|
3882
4051
|
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;
|
|
3883
4052
|
}
|
|
3884
4053
|
}
|
|
@@ -3910,8 +4079,8 @@ class Se {
|
|
|
3910
4079
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3911
4080
|
colorEnd: "rgba(0,0,0,0)"
|
|
3912
4081
|
}), i < Math.floor(s.width - o - 1) && e !== a) {
|
|
3913
|
-
const
|
|
3914
|
-
this.ctx.paint.drawShadow(
|
|
4082
|
+
const l = s.width - (this.x + this.width) + o - e;
|
|
4083
|
+
this.ctx.paint.drawShadow(l, this.y, e, this.height, {
|
|
3915
4084
|
fillColor: r,
|
|
3916
4085
|
side: "left",
|
|
3917
4086
|
shadowWidth: 4,
|
|
@@ -3953,7 +4122,7 @@ class Se {
|
|
|
3953
4122
|
}
|
|
3954
4123
|
}
|
|
3955
4124
|
class Bt {
|
|
3956
|
-
constructor(t, e, i = 0, s = 0, o = 0, r = 0, a,
|
|
4125
|
+
constructor(t, e, i = 0, s = 0, o = 0, r = 0, a, l = "body") {
|
|
3957
4126
|
n(this, "ctx");
|
|
3958
4127
|
n(this, "x", 0);
|
|
3959
4128
|
n(this, "y", 0);
|
|
@@ -3962,29 +4131,35 @@ class Bt {
|
|
|
3962
4131
|
n(this, "cells", []);
|
|
3963
4132
|
n(this, "fixedCells", []);
|
|
3964
4133
|
n(this, "noFixedCells", []);
|
|
4134
|
+
n(this, "calculatedHeightCells", []);
|
|
3965
4135
|
n(this, "rowIndex", 0);
|
|
3966
4136
|
n(this, "rowKey", "");
|
|
3967
4137
|
n(this, "rowType", "body");
|
|
3968
4138
|
n(this, "data");
|
|
3969
|
-
this
|
|
4139
|
+
n(this, "calculatedHeight", -1);
|
|
4140
|
+
this.ctx = t, this.x = i, this.y = s, this.width = o, this.height = r, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e) || "", this.rowType = l, this.data = a, this.update();
|
|
3970
4141
|
}
|
|
3971
4142
|
update() {
|
|
3972
|
-
const { header: t } = this.ctx, e = [], i = [], s = [];
|
|
3973
|
-
t.renderLeafCellHeaders.forEach((
|
|
3974
|
-
const
|
|
4143
|
+
const { header: t } = this.ctx, e = [], i = [], s = [], o = [];
|
|
4144
|
+
t.renderLeafCellHeaders.forEach((r) => {
|
|
4145
|
+
const a = new xt(
|
|
3975
4146
|
this.ctx,
|
|
3976
4147
|
this.rowIndex,
|
|
3977
|
-
|
|
3978
|
-
|
|
4148
|
+
r.colIndex,
|
|
4149
|
+
r.x,
|
|
3979
4150
|
this.y,
|
|
3980
|
-
|
|
4151
|
+
r.width,
|
|
3981
4152
|
this.height,
|
|
3982
|
-
|
|
4153
|
+
r.column,
|
|
3983
4154
|
this.data,
|
|
3984
4155
|
this.rowType
|
|
3985
4156
|
);
|
|
3986
|
-
|
|
3987
|
-
}), this.cells = e, this.fixedCells = i, this.noFixedCells = s;
|
|
4157
|
+
a.fixed ? i.push(a) : s.push(a), e.push(a), a.autoRowHeight && o.push(a);
|
|
4158
|
+
}), this.cells = e, this.calculatedHeightCells = o, this.fixedCells = i, this.noFixedCells = s, this.calculatedHeight = this.getCalculatedHeight();
|
|
4159
|
+
}
|
|
4160
|
+
getCalculatedHeight() {
|
|
4161
|
+
const t = this.calculatedHeightCells.map((e) => e.getAutoHeight());
|
|
4162
|
+
return t.length ? Math.max(...t) : -1;
|
|
3988
4163
|
}
|
|
3989
4164
|
drawCenter() {
|
|
3990
4165
|
this.noFixedCells.forEach((t) => {
|
|
@@ -4044,8 +4219,8 @@ class ve {
|
|
|
4044
4219
|
FOOTER_FIXED: o,
|
|
4045
4220
|
SCROLLER_TRACK_SIZE: r = 0,
|
|
4046
4221
|
HEIGHT: a,
|
|
4047
|
-
EMPTY_BODY_HEIGHT:
|
|
4048
|
-
MAX_HEIGHT:
|
|
4222
|
+
EMPTY_BODY_HEIGHT: l = 0,
|
|
4223
|
+
MAX_HEIGHT: h = 0,
|
|
4049
4224
|
ENABLE_OFFSET_HEIGHT: d = 0,
|
|
4050
4225
|
OFFSET_HEIGHT: f = 0,
|
|
4051
4226
|
FOOTER_POSITION: u
|
|
@@ -4057,32 +4232,32 @@ class ve {
|
|
|
4057
4232
|
const { data: x, sumHeight: w } = s.getData();
|
|
4058
4233
|
this.height = w, this.data = x, this.width = e.width, this.visibleWidth = this.ctx.stageWidth - r;
|
|
4059
4234
|
const m = this.ctx.footer.height;
|
|
4060
|
-
!this.data.length && !a ? this.height =
|
|
4235
|
+
!this.data.length && !a ? this.height = l : !this.data.length && a && (this.height = a - e.height - m - r);
|
|
4061
4236
|
let g = this.height + e.height + r;
|
|
4062
4237
|
g += m;
|
|
4063
|
-
let
|
|
4064
|
-
const y = window.innerHeight, { top:
|
|
4065
|
-
if (y >
|
|
4066
|
-
const
|
|
4067
|
-
|
|
4068
|
-
} else this.data.length && a ?
|
|
4069
|
-
|
|
4070
|
-
let
|
|
4071
|
-
o ? this.visibleHeight =
|
|
4072
|
-
const C = window.devicePixelRatio || 1,
|
|
4073
|
-
t.width = Math.round(
|
|
4074
|
-
const
|
|
4238
|
+
let p = g;
|
|
4239
|
+
const y = window.innerHeight, { top: E } = this.containerRect || this.ctx.containerElement.getBoundingClientRect();
|
|
4240
|
+
if (y > E && d && !a) {
|
|
4241
|
+
const T = y - E - f;
|
|
4242
|
+
T > e.height + r ? p = T : g > h && (p = h);
|
|
4243
|
+
} else this.data.length && a ? p = a : this.data.length && h && g > h && (p = h);
|
|
4244
|
+
p > 0 && (this.ctx.stageHeight = Math.floor(p), this.ctx.stageElement.style.height = `${this.ctx.stageHeight}px`);
|
|
4245
|
+
let R = this.ctx.stageHeight - e.height - r;
|
|
4246
|
+
o ? this.visibleHeight = R - m : this.visibleHeight = R, this.data.length || (this.height = this.visibleHeight), this.ctx.body.x = this.x, this.ctx.body.y = this.y, this.ctx.body.width = this.width, this.ctx.body.height = this.height, this.ctx.body.visibleWidth = this.visibleWidth, this.ctx.body.visibleHeight = this.visibleHeight, this.ctx.body.data = x;
|
|
4247
|
+
const C = window.devicePixelRatio || 1, I = this.ctx.stageWidth * C, v = this.ctx.stageHeight * C;
|
|
4248
|
+
t.width = Math.round(I), t.height = Math.round(v);
|
|
4249
|
+
const _ = this.data.length ? "not-empty" : "empty";
|
|
4075
4250
|
this.ctx.emit("emptyChange", {
|
|
4076
|
-
isEmpty:
|
|
4077
|
-
type:
|
|
4251
|
+
isEmpty: _,
|
|
4252
|
+
type: _,
|
|
4078
4253
|
headerHeight: e.height,
|
|
4079
4254
|
bodyHeight: this.height,
|
|
4080
4255
|
footerHeight: m,
|
|
4081
4256
|
width: this.width,
|
|
4082
|
-
height: this.data.length ? 0 :
|
|
4257
|
+
height: this.data.length ? 0 : l + m
|
|
4083
4258
|
});
|
|
4084
|
-
const S = Math.round(t.width / C * 1e4) / 1e4,
|
|
4085
|
-
this.ctx.canvasElement.setAttribute("style", `height:${
|
|
4259
|
+
const S = Math.round(t.width / C * 1e4) / 1e4, b = Math.round(t.height / C * 1e4) / 1e4;
|
|
4260
|
+
this.ctx.canvasElement.setAttribute("style", `height:${b}px;width:${S}px;`), this.ctx.paint.scale(C);
|
|
4086
4261
|
}
|
|
4087
4262
|
// 调整行的高度
|
|
4088
4263
|
initResizeRow() {
|
|
@@ -4102,14 +4277,15 @@ class ve {
|
|
|
4102
4277
|
}), this.ctx.on("mousemove", (e) => {
|
|
4103
4278
|
if (this.ctx.editing) return;
|
|
4104
4279
|
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), o = i, r = s, a = e.clientY, {
|
|
4105
|
-
stageHeight:
|
|
4106
|
-
scrollY:
|
|
4280
|
+
stageHeight: l,
|
|
4281
|
+
scrollY: h,
|
|
4107
4282
|
config: { RESIZE_ROW_MIN_HEIGHT: d = 0 }
|
|
4108
4283
|
} = this.ctx;
|
|
4109
4284
|
if (this.isResizing && this.resizeTarget) {
|
|
4110
4285
|
const f = this.resizeTarget.height;
|
|
4111
4286
|
let u = a - this.clientY;
|
|
4112
|
-
|
|
4287
|
+
const { calculatedHeight: x } = this.resizeTarget, w = x === -1 ? d : x;
|
|
4288
|
+
u + f < w && (u = -(f - w)), this.resizeDiff = u, this.ctx.emit("draw");
|
|
4113
4289
|
} else {
|
|
4114
4290
|
if (this.resizeTarget = null, this.isMouseDown)
|
|
4115
4291
|
return;
|
|
@@ -4122,7 +4298,7 @@ class ve {
|
|
|
4122
4298
|
this.ctx.stageElement.style.cursor === "row-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
4123
4299
|
for (let f = 0; f < this.renderRows.length; f++) {
|
|
4124
4300
|
const u = this.renderRows[f];
|
|
4125
|
-
if (o > u.y -
|
|
4301
|
+
if (o > u.y - h + u.height - 1.5 && o < u.y - h + u.height + 1.5 && o < l - 4)
|
|
4126
4302
|
for (let w = 0; w < u.cells.length; w++) {
|
|
4127
4303
|
const m = u.cells[w];
|
|
4128
4304
|
r > m.drawX + 10 && r < m.drawX + m.width - 10 && m.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = u);
|
|
@@ -4171,8 +4347,8 @@ class ve {
|
|
|
4171
4347
|
colorStart: "rgba(0,0,0,0.1)",
|
|
4172
4348
|
colorEnd: "rgba(0,0,0,0)"
|
|
4173
4349
|
}), i < Math.floor(s.width - o - 1) && e !== a) {
|
|
4174
|
-
const
|
|
4175
|
-
this.ctx.paint.drawShadow(
|
|
4350
|
+
const l = s.width - (this.x + this.width) + o - e;
|
|
4351
|
+
this.ctx.paint.drawShadow(l, this.y, e, this.height, {
|
|
4176
4352
|
fillColor: r,
|
|
4177
4353
|
side: "left",
|
|
4178
4354
|
shadowWidth: 4,
|
|
@@ -4200,12 +4376,12 @@ class ve {
|
|
|
4200
4376
|
config: { CELL_HEIGHT: s }
|
|
4201
4377
|
} = this.ctx, o = i, { data: r, positions: a } = e.getData();
|
|
4202
4378
|
this.ctx.maxRowIndex = r.length - 1;
|
|
4203
|
-
let
|
|
4204
|
-
if (
|
|
4379
|
+
let l = this.binarySearch(a, o), h = this.binarySearch(a, o + this.visibleHeight);
|
|
4380
|
+
if (h === -1 && (h = this.ctx.maxRowIndex), l === -1 && h === this.ctx.maxRowIndex) {
|
|
4205
4381
|
const f = Math.floor(this.visibleHeight / s);
|
|
4206
|
-
|
|
4382
|
+
l = this.ctx.maxRowIndex - f;
|
|
4207
4383
|
}
|
|
4208
|
-
this.headIndex = Math.max(0,
|
|
4384
|
+
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;
|
|
4209
4385
|
const d = [];
|
|
4210
4386
|
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
4211
4387
|
const u = this.headIndex + f, x = this.visibleRows[f], { height: w, top: m } = this.ctx.database.getPositionForRowIndex(u), g = new Bt(this.ctx, u, 0, m + this.y, t.width, w, x);
|
|
@@ -4213,6 +4389,15 @@ class ve {
|
|
|
4213
4389
|
}
|
|
4214
4390
|
this.renderRows = d, this.ctx.body.renderRows = d;
|
|
4215
4391
|
}
|
|
4392
|
+
updateAutoHeight() {
|
|
4393
|
+
const t = this.ctx.body.renderRows;
|
|
4394
|
+
this.ctx.database.updateOverlayerAutoHeightMap();
|
|
4395
|
+
const e = t.map((i) => ({
|
|
4396
|
+
height: i.calculatedHeight,
|
|
4397
|
+
rowIndex: i.rowIndex
|
|
4398
|
+
}));
|
|
4399
|
+
this.ctx.database.setBatchCalculatedRowHeight(e);
|
|
4400
|
+
}
|
|
4216
4401
|
draw() {
|
|
4217
4402
|
this.renderRows.forEach((t) => {
|
|
4218
4403
|
t.drawContainer();
|
|
@@ -4222,7 +4407,7 @@ class ve {
|
|
|
4222
4407
|
t.drawFixedContainer();
|
|
4223
4408
|
}), this.renderRows.forEach((t) => {
|
|
4224
4409
|
t.drawFixed();
|
|
4225
|
-
}), this.drawTipLine();
|
|
4410
|
+
}), this.drawTipLine(), this.updateAutoHeight();
|
|
4226
4411
|
}
|
|
4227
4412
|
}
|
|
4228
4413
|
class _e {
|
|
@@ -4256,16 +4441,16 @@ class _e {
|
|
|
4256
4441
|
stageWidth: o,
|
|
4257
4442
|
config: { HEADER_BG_COLOR: r, SCROLLER_TRACK_SIZE: a }
|
|
4258
4443
|
} = this.ctx;
|
|
4259
|
-
let
|
|
4260
|
-
if (this.ctx.config.FOOTER_FIXED || (
|
|
4444
|
+
let l = this.y;
|
|
4445
|
+
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, {
|
|
4261
4446
|
fillColor: r,
|
|
4262
4447
|
side: "right",
|
|
4263
4448
|
shadowWidth: 4,
|
|
4264
4449
|
colorStart: "rgba(0,0,0,0.1)",
|
|
4265
4450
|
colorEnd: "rgba(0,0,0,0)"
|
|
4266
4451
|
}), i < Math.floor(s.width - o - 1) && e !== a) {
|
|
4267
|
-
const
|
|
4268
|
-
this.ctx.paint.drawShadow(
|
|
4452
|
+
const h = s.width - (this.x + this.width) + o - e;
|
|
4453
|
+
this.ctx.paint.drawShadow(h, l, e, this.height, {
|
|
4269
4454
|
fillColor: r,
|
|
4270
4455
|
side: "left",
|
|
4271
4456
|
shadowWidth: 4,
|
|
@@ -4423,20 +4608,20 @@ class Te {
|
|
|
4423
4608
|
this.ctx.mousedown && (this.ctx.selectorMove = !0), this.ctx.selector.enable = !0;
|
|
4424
4609
|
const {
|
|
4425
4610
|
SELECTOR_AREA_MIN_X: a,
|
|
4426
|
-
SELECTOR_AREA_MAX_X:
|
|
4427
|
-
SELECTOR_AREA_MIN_Y:
|
|
4611
|
+
SELECTOR_AREA_MAX_X: l,
|
|
4612
|
+
SELECTOR_AREA_MIN_Y: h,
|
|
4428
4613
|
SELECTOR_AREA_MAX_Y: d,
|
|
4429
4614
|
SELECTOR_AREA_MAX_X_OFFSET: f,
|
|
4430
4615
|
SELECTOR_AREA_MAX_Y_OFFSET: u
|
|
4431
|
-
} = this.ctx.config, x = a, w =
|
|
4432
|
-
let [
|
|
4433
|
-
if (
|
|
4616
|
+
} = this.ctx.config, x = a, w = l || this.ctx.maxColIndex - f, m = h, g = d || this.ctx.maxRowIndex - u;
|
|
4617
|
+
let [p, y] = o, [E, R] = r;
|
|
4618
|
+
if (p < x || y > w || E < m || R > g)
|
|
4434
4619
|
return;
|
|
4435
4620
|
if (this.ctx.stageElement.focus({ preventScroll: !0 }), this.ctx.config.ENABLE_MERGE_CELL_LINK) {
|
|
4436
|
-
const
|
|
4437
|
-
|
|
4621
|
+
const I = this.adjustMergeCells(o, r);
|
|
4622
|
+
E = I.yArr[0], R = I.yArr[1], p = I.xArr[0], y = I.xArr[1], this.ctx.onlyMergeCell = I.onlyMergeCell;
|
|
4438
4623
|
}
|
|
4439
|
-
|
|
4624
|
+
p === y && E === R ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, o = [Math.max(x, p), Math.min(w, y)], r = [Math.max(m, E), Math.min(g, R)];
|
|
4440
4625
|
const { BEFORE_SET_SELECTOR_METHOD: C } = this.ctx.config;
|
|
4441
4626
|
if (typeof C == "function") {
|
|
4442
4627
|
const v = C({
|
|
@@ -4454,33 +4639,33 @@ class Te {
|
|
|
4454
4639
|
adjustMergeCells(t, e) {
|
|
4455
4640
|
var w;
|
|
4456
4641
|
const [i, s] = e, [o, r] = t;
|
|
4457
|
-
let a = [],
|
|
4642
|
+
let a = [], l = [];
|
|
4458
4643
|
for (let m = 0; m <= e[1] - e[0]; m++)
|
|
4459
4644
|
for (let g = 0; g <= t[1] - t[0]; g++) {
|
|
4460
|
-
const
|
|
4461
|
-
|
|
4645
|
+
const p = m + e[0], y = g + t[0], E = this.ctx.database.getVirtualBodyCell(p, y);
|
|
4646
|
+
E && ((p === i || p === s) && a.push(E), (y === o || y === r) && l.push(E));
|
|
4462
4647
|
}
|
|
4463
|
-
const
|
|
4648
|
+
const h = a.reduce(
|
|
4464
4649
|
(m, g) => {
|
|
4465
|
-
const { yArr:
|
|
4466
|
-
return m.minY = Math.min(m.minY, y), m.maxY = Math.max(m.maxY,
|
|
4650
|
+
const { yArr: p } = g.getSpanInfo(), [y, E] = p;
|
|
4651
|
+
return m.minY = Math.min(m.minY, y), m.maxY = Math.max(m.maxY, E), m;
|
|
4467
4652
|
},
|
|
4468
4653
|
{
|
|
4469
4654
|
minY: i,
|
|
4470
4655
|
maxY: s
|
|
4471
4656
|
}
|
|
4472
|
-
), d =
|
|
4657
|
+
), d = l.reduce(
|
|
4473
4658
|
(m, g) => {
|
|
4474
|
-
const { xArr:
|
|
4475
|
-
return m.minX = Math.min(m.minX, y), m.maxX = Math.max(m.maxX,
|
|
4659
|
+
const { xArr: p } = g.getSpanInfo(), [y, E] = p;
|
|
4660
|
+
return m.minX = Math.min(m.minX, y), m.maxX = Math.max(m.maxX, E), m;
|
|
4476
4661
|
},
|
|
4477
4662
|
{
|
|
4478
4663
|
minX: o,
|
|
4479
4664
|
maxX: r
|
|
4480
4665
|
}
|
|
4481
|
-
), f = [d.minX, d.maxX], u = [
|
|
4666
|
+
), f = [d.minX, d.maxX], u = [h.minY, h.maxY];
|
|
4482
4667
|
let x = !1;
|
|
4483
|
-
if (d.minX !== d.maxX ||
|
|
4668
|
+
if (d.minX !== d.maxX || h.minY !== h.maxY) {
|
|
4484
4669
|
const m = JSON.stringify(f) + JSON.stringify(u), g = (w = this.ctx.focusCell) == null ? void 0 : w.getSpanInfo();
|
|
4485
4670
|
x = (g && JSON.stringify(g.xArr) + JSON.stringify(g.yArr)) === m;
|
|
4486
4671
|
}
|
|
@@ -4501,15 +4686,15 @@ class Te {
|
|
|
4501
4686
|
if (this.ctx.mousedown && this.ctx.focusCellHeader) {
|
|
4502
4687
|
const { colIndex: a } = this.ctx.focusCellHeader;
|
|
4503
4688
|
if (this.ctx.clearSelector(), t.colIndex >= a) {
|
|
4504
|
-
const
|
|
4505
|
-
this.setSelector(
|
|
4689
|
+
const l = [a, t.colIndex + t.colspan - 1], h = [o, r];
|
|
4690
|
+
this.setSelector(l, h);
|
|
4506
4691
|
} else {
|
|
4507
|
-
const
|
|
4508
|
-
this.setSelector(
|
|
4692
|
+
const l = [t.colIndex, a], h = [o, r];
|
|
4693
|
+
this.setSelector(l, h);
|
|
4509
4694
|
}
|
|
4510
4695
|
} else {
|
|
4511
|
-
const a = [t.colIndex, t.colIndex + t.colspan - 1],
|
|
4512
|
-
this.setSelector(a,
|
|
4696
|
+
const a = [t.colIndex, t.colIndex + t.colspan - 1], l = [o, r];
|
|
4697
|
+
this.setSelector(a, l);
|
|
4513
4698
|
}
|
|
4514
4699
|
}
|
|
4515
4700
|
selectAll() {
|
|
@@ -4523,8 +4708,8 @@ class Te {
|
|
|
4523
4708
|
SELECTOR_AREA_MIN_Y: o,
|
|
4524
4709
|
SELECTOR_AREA_MAX_Y: r,
|
|
4525
4710
|
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
4526
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
4527
|
-
} = this.ctx.config,
|
|
4711
|
+
SELECTOR_AREA_MAX_Y_OFFSET: l
|
|
4712
|
+
} = 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];
|
|
4528
4713
|
this.setSelector(x, w);
|
|
4529
4714
|
}
|
|
4530
4715
|
}
|
|
@@ -4534,17 +4719,17 @@ class Te {
|
|
|
4534
4719
|
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;
|
|
4535
4720
|
if (e) {
|
|
4536
4721
|
this.ctx.setFocusCell(t);
|
|
4537
|
-
const
|
|
4538
|
-
this.setSelector(
|
|
4722
|
+
const l = [a, r], h = [t.rowIndex, t.rowIndex];
|
|
4723
|
+
this.setSelector(l, h);
|
|
4539
4724
|
}
|
|
4540
4725
|
if (this.ctx.focusCell && this.ctx.mousedown) {
|
|
4541
|
-
const { rowIndex:
|
|
4542
|
-
if (t.rowIndex >=
|
|
4543
|
-
const
|
|
4544
|
-
this.setSelector(
|
|
4726
|
+
const { rowIndex: l } = this.ctx.focusCell;
|
|
4727
|
+
if (t.rowIndex >= l) {
|
|
4728
|
+
const h = [a, r], d = [l, t.rowIndex];
|
|
4729
|
+
this.setSelector(h, d);
|
|
4545
4730
|
} else {
|
|
4546
|
-
const
|
|
4547
|
-
this.setSelector(
|
|
4731
|
+
const h = [a, r], d = [t.rowIndex, l];
|
|
4732
|
+
this.setSelector(h, d);
|
|
4548
4733
|
}
|
|
4549
4734
|
}
|
|
4550
4735
|
}
|
|
@@ -4553,7 +4738,7 @@ class Te {
|
|
|
4553
4738
|
return;
|
|
4554
4739
|
const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
|
|
4555
4740
|
if (t && e && i) {
|
|
4556
|
-
const { rowIndex: s, colIndex: o } = e, r = Math.min(i.colIndex, o), a = Math.max(i.colIndex, o),
|
|
4741
|
+
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];
|
|
4557
4742
|
this.setSelector(d, f);
|
|
4558
4743
|
}
|
|
4559
4744
|
}
|
|
@@ -4563,7 +4748,7 @@ class Te {
|
|
|
4563
4748
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
4564
4749
|
if (this.ctx.config.ENABLE_SELECTOR_SINGLE)
|
|
4565
4750
|
return;
|
|
4566
|
-
const { colIndex: s, rowIndex: o } = i, { colIndex: r, rowIndex: a } = e,
|
|
4751
|
+
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];
|
|
4567
4752
|
this.setSelector(u, x);
|
|
4568
4753
|
} else {
|
|
4569
4754
|
this.ctx.emit("cellSelectedClick", e);
|
|
@@ -4616,7 +4801,7 @@ class Te {
|
|
|
4616
4801
|
return;
|
|
4617
4802
|
t = a.data;
|
|
4618
4803
|
}
|
|
4619
|
-
const o =
|
|
4804
|
+
const o = he(t);
|
|
4620
4805
|
navigator.clipboard ? navigator.clipboard.writeText(o).then(() => {
|
|
4621
4806
|
this.ctx.selector.xArrCopy = this.ctx.selector.xArr.slice(), this.ctx.selector.yArrCopy = this.ctx.selector.yArr.slice(), this.ctx.emit("copyChange", {
|
|
4622
4807
|
xArr: this.ctx.selector.xArrCopy,
|
|
@@ -4628,9 +4813,9 @@ class Te {
|
|
|
4628
4813
|
clearSelectedData(t, e, i = !1, s = null) {
|
|
4629
4814
|
let o = [];
|
|
4630
4815
|
const r = /* @__PURE__ */ new Set();
|
|
4631
|
-
for (let
|
|
4632
|
-
for (let
|
|
4633
|
-
const d =
|
|
4816
|
+
for (let l = 0; l <= e[1] - e[0]; l++)
|
|
4817
|
+
for (let h = 0; h <= t[1] - t[0]; h++) {
|
|
4818
|
+
const d = l + e[0], f = h + t[0], u = this.ctx.database.getItemValueForRowIndexAndColIndex(d, f);
|
|
4634
4819
|
if (u) {
|
|
4635
4820
|
const { rowKey: x, key: w } = u;
|
|
4636
4821
|
this.ctx.database.getReadonly(x, w) || (r.add(x), o.push({
|
|
@@ -4648,8 +4833,8 @@ class Te {
|
|
|
4648
4833
|
return o;
|
|
4649
4834
|
this.ctx.database.batchSetItemValue(o, !0);
|
|
4650
4835
|
let a = [];
|
|
4651
|
-
return r.forEach((
|
|
4652
|
-
a.push(this.ctx.database.getRowDataItemForRowKey(
|
|
4836
|
+
return r.forEach((l) => {
|
|
4837
|
+
a.push(this.ctx.database.getRowDataItemForRowKey(l));
|
|
4653
4838
|
}), this.ctx.emit("clearSelectedDataChange", o, a), o;
|
|
4654
4839
|
}
|
|
4655
4840
|
paste() {
|
|
@@ -4661,40 +4846,40 @@ class Te {
|
|
|
4661
4846
|
if (this.ctx.selector.enable && t) {
|
|
4662
4847
|
const e = this.ctx.selector.yArr[0], i = this.ctx.selector.xArr[0], s = /* @__PURE__ */ new Set();
|
|
4663
4848
|
navigator.clipboard.readText().then(async (o) => {
|
|
4664
|
-
let r =
|
|
4665
|
-
const a = [i, i + r[0].length - 1],
|
|
4849
|
+
let r = le(o);
|
|
4850
|
+
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;
|
|
4666
4851
|
(x > 0 || w > 0) && this.ctx.emit("onPastedDataOverflow", {
|
|
4667
4852
|
maxY: d,
|
|
4668
4853
|
maxX: u,
|
|
4669
|
-
minY:
|
|
4854
|
+
minY: h,
|
|
4670
4855
|
minX: f,
|
|
4671
4856
|
overflowRowCount: x,
|
|
4672
4857
|
overflowColCount: w,
|
|
4673
4858
|
textArr: r
|
|
4674
4859
|
});
|
|
4675
4860
|
const m = r.length === 1 && r[0].length === 1;
|
|
4676
|
-
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a,
|
|
4677
|
-
const
|
|
4861
|
+
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a, l) && !m) {
|
|
4862
|
+
const E = {
|
|
4678
4863
|
code: "ERR_MERGED_CELLS_PASTE",
|
|
4679
4864
|
message: "Merged cells cannot span paste data"
|
|
4680
4865
|
};
|
|
4681
|
-
this.ctx.hasEvent("error") ? this.ctx.emit("error",
|
|
4866
|
+
this.ctx.hasEvent("error") ? this.ctx.emit("error", E) : alert(E.message);
|
|
4682
4867
|
return;
|
|
4683
4868
|
}
|
|
4684
4869
|
let g = [];
|
|
4685
|
-
for (let
|
|
4686
|
-
const
|
|
4687
|
-
for (let C = 0; C <=
|
|
4688
|
-
const
|
|
4689
|
-
|
|
4870
|
+
for (let E = 0; E <= r.length - 1; E++) {
|
|
4871
|
+
const R = r[E].length;
|
|
4872
|
+
for (let C = 0; C <= R - 1; C++) {
|
|
4873
|
+
const I = E + e, v = C + i, _ = r[E][C], S = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
4874
|
+
I,
|
|
4690
4875
|
v
|
|
4691
4876
|
);
|
|
4692
4877
|
if (S) {
|
|
4693
|
-
const { rowKey:
|
|
4694
|
-
this.ctx.database.getReadonly(
|
|
4695
|
-
rowKey:
|
|
4696
|
-
key:
|
|
4697
|
-
value:
|
|
4878
|
+
const { rowKey: b, key: O } = S;
|
|
4879
|
+
this.ctx.database.getReadonly(b, O) || (s.add(b), g.push({
|
|
4880
|
+
rowKey: b,
|
|
4881
|
+
key: O,
|
|
4882
|
+
value: _,
|
|
4698
4883
|
row: {}
|
|
4699
4884
|
//内部有设置
|
|
4700
4885
|
}));
|
|
@@ -4702,35 +4887,35 @@ class Te {
|
|
|
4702
4887
|
}
|
|
4703
4888
|
}
|
|
4704
4889
|
if (this.isCut) {
|
|
4705
|
-
const
|
|
4890
|
+
const E = this.clearSelectedData(
|
|
4706
4891
|
this.ctx.selector.xArrCopy,
|
|
4707
4892
|
this.ctx.selector.yArrCopy,
|
|
4708
4893
|
!0
|
|
4709
4894
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
4710
|
-
),
|
|
4711
|
-
|
|
4712
|
-
|
|
4895
|
+
), R = g.map((C) => `${C.rowKey}-${C.key}`);
|
|
4896
|
+
E.forEach((C) => {
|
|
4897
|
+
R.includes(`${C.rowKey}-${C.key}`) || g.unshift(C);
|
|
4713
4898
|
}), this.isCut = !1;
|
|
4714
4899
|
}
|
|
4715
4900
|
if (!g.length)
|
|
4716
4901
|
return;
|
|
4717
|
-
const { BEFORE_PASTE_DATA_METHOD:
|
|
4718
|
-
if (typeof
|
|
4719
|
-
const
|
|
4902
|
+
const { BEFORE_PASTE_DATA_METHOD: p } = this.ctx.config;
|
|
4903
|
+
if (typeof p == "function") {
|
|
4904
|
+
const E = p, R = g.map((C) => ({
|
|
4720
4905
|
rowKey: C.rowKey,
|
|
4721
4906
|
key: C.key,
|
|
4722
4907
|
value: C.value,
|
|
4723
4908
|
oldValue: this.ctx.database.getItemValue(C.rowKey, C.key),
|
|
4724
4909
|
row: this.ctx.database.getRowDataItemForRowKey(C.rowKey)
|
|
4725
4910
|
}));
|
|
4726
|
-
if (g = await
|
|
4911
|
+
if (g = await E(R, a, l, r), g && !g.length)
|
|
4727
4912
|
return;
|
|
4728
4913
|
}
|
|
4729
4914
|
this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(g, !0);
|
|
4730
4915
|
let y = [];
|
|
4731
|
-
s.forEach((
|
|
4732
|
-
y.push(this.ctx.database.getRowDataItemForRowKey(
|
|
4733
|
-
}), this.ctx.emit("pasteChange", g, y);
|
|
4916
|
+
s.forEach((E) => {
|
|
4917
|
+
y.push(this.ctx.database.getRowDataItemForRowKey(E));
|
|
4918
|
+
}), this.ctx.emit("pasteChange", g, y), this.ctx.emit("draw");
|
|
4734
4919
|
}).catch((o) => {
|
|
4735
4920
|
console.error("Failed to get the clipboard content:", o);
|
|
4736
4921
|
});
|
|
@@ -4746,7 +4931,7 @@ class Te {
|
|
|
4746
4931
|
if (!e)
|
|
4747
4932
|
return;
|
|
4748
4933
|
let { colIndex: i = 0, rowIndex: s = 0 } = e;
|
|
4749
|
-
const o = 0, r = 0, a = this.ctx.maxColIndex,
|
|
4934
|
+
const o = 0, r = 0, a = this.ctx.maxColIndex, l = this.ctx.maxRowIndex;
|
|
4750
4935
|
switch (t) {
|
|
4751
4936
|
case "LEFT":
|
|
4752
4937
|
i > o && i--;
|
|
@@ -4758,11 +4943,11 @@ class Te {
|
|
|
4758
4943
|
i < a && i++;
|
|
4759
4944
|
break;
|
|
4760
4945
|
case "BOTTOM":
|
|
4761
|
-
s <
|
|
4946
|
+
s < l && s++;
|
|
4762
4947
|
break;
|
|
4763
4948
|
}
|
|
4764
|
-
const
|
|
4765
|
-
f && (f.operation || this.isInSettingRange(f.rowIndex, f.colIndex) && (this.ctx.setFocusCell(f), this.setSelector(
|
|
4949
|
+
const h = [i, i], d = [s, s], f = this.getCell(s, i);
|
|
4950
|
+
f && (f.operation || this.isInSettingRange(f.rowIndex, f.colIndex) && (this.ctx.setFocusCell(f), this.setSelector(h, d), this.adjustBoundaryPosition(), this.ctx.emit("moveFocus", f), this.ctx.emit("draw")));
|
|
4766
4951
|
}
|
|
4767
4952
|
stopAdjustPosition() {
|
|
4768
4953
|
this.adjustPositionX = "", this.adjustPositionY = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerY && (clearInterval(this.timerY), this.timerY = 0);
|
|
@@ -4775,9 +4960,9 @@ class Te {
|
|
|
4775
4960
|
SELECTOR_AREA_MIN_Y: o,
|
|
4776
4961
|
SELECTOR_AREA_MAX_Y: r,
|
|
4777
4962
|
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
4778
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
4779
|
-
} = this.ctx.config,
|
|
4780
|
-
return !(e <
|
|
4963
|
+
SELECTOR_AREA_MAX_Y_OFFSET: l
|
|
4964
|
+
} = this.ctx.config, h = i, d = s || this.ctx.maxColIndex - a, f = o, u = r || this.ctx.maxRowIndex - l;
|
|
4965
|
+
return !(e < h || e > d || t < f || t > u);
|
|
4781
4966
|
}
|
|
4782
4967
|
/**
|
|
4783
4968
|
* 调整滚动条位置,让到达边界时自动滚动
|
|
@@ -4790,8 +4975,8 @@ class Te {
|
|
|
4790
4975
|
let a = 10 * (s === "left" ? -1 : 1);
|
|
4791
4976
|
this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
|
|
4792
4977
|
a *= 1.5;
|
|
4793
|
-
const { scrollX:
|
|
4794
|
-
(
|
|
4978
|
+
const { scrollX: l } = this.ctx, h = l + a;
|
|
4979
|
+
(h < 0 || h > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(h);
|
|
4795
4980
|
}, 100);
|
|
4796
4981
|
}
|
|
4797
4982
|
if (o && this.adjustPositionY !== o) {
|
|
@@ -4799,8 +4984,8 @@ class Te {
|
|
|
4799
4984
|
let a = 10 * (o === "top" ? -1 : 1);
|
|
4800
4985
|
this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
|
|
4801
4986
|
a *= 1.5;
|
|
4802
|
-
const { scrollY:
|
|
4803
|
-
(
|
|
4987
|
+
const { scrollY: l } = this.ctx, h = l + a;
|
|
4988
|
+
(h < 0 || h > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(h);
|
|
4804
4989
|
}, 100);
|
|
4805
4990
|
}
|
|
4806
4991
|
}
|
|
@@ -4816,22 +5001,22 @@ class Te {
|
|
|
4816
5001
|
fixedLeftWidth: o,
|
|
4817
5002
|
header: r,
|
|
4818
5003
|
footer: a,
|
|
4819
|
-
body:
|
|
4820
|
-
scrollX:
|
|
5004
|
+
body: l,
|
|
5005
|
+
scrollX: h,
|
|
4821
5006
|
scrollY: d,
|
|
4822
5007
|
config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED: u, FOOTER_POSITION: x, ENABLE_MERGE_CELL_LINK: w }
|
|
4823
5008
|
} = this.ctx;
|
|
4824
5009
|
if (!i)
|
|
4825
5010
|
return;
|
|
4826
5011
|
w && this.ctx.onlyMergeCell && i.updateSpanInfo();
|
|
4827
|
-
const { drawX: m, drawY: g, width:
|
|
4828
|
-
let
|
|
4829
|
-
v >
|
|
4830
|
-
let
|
|
4831
|
-
u && (x === "top" ?
|
|
4832
|
-
const S = g + v - (t -
|
|
4833
|
-
let
|
|
4834
|
-
C > 0 && !
|
|
5012
|
+
const { drawX: m, drawY: g, width: p, height: y, fixed: E } = i, R = o - m + 1, C = i.drawX + p - (e - s) + 1;
|
|
5013
|
+
let I = r.height - g, v = y;
|
|
5014
|
+
v > l.visibleHeight && (v = l.visibleHeight);
|
|
5015
|
+
let _ = 0;
|
|
5016
|
+
u && (x === "top" ? I = r.height + a.height - g : _ = a.visibleHeight);
|
|
5017
|
+
const S = g + v - (t - _ - f);
|
|
5018
|
+
let b = h, O = d;
|
|
5019
|
+
C > 0 && !E ? b = Math.floor(h + C) : R > 0 && !E && (b = Math.floor(h - R)), I > 0 ? O = Math.floor(d - I) : S > 0 && (O = Math.floor(d + S)), (Math.abs(h - b) > 2 || Math.abs(d - O) > 2) && (this.ctx.adjustPositioning = !0, this.ctx.setScroll(b, O), this.ctx.emit("adjustBoundaryPosition", i));
|
|
4835
5020
|
}
|
|
4836
5021
|
destroy() {
|
|
4837
5022
|
this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
|
|
@@ -4847,7 +5032,7 @@ class Oe {
|
|
|
4847
5032
|
this.ctx.on("mousemove", (t) => {
|
|
4848
5033
|
if (this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default"), this.ctx.editing || !this.ctx.focusCell || !this.maxColRowCell)
|
|
4849
5034
|
return;
|
|
4850
|
-
const { offsetX: e, offsetY: i } = this.ctx.getOffset(t), { colIndex: s, rowIndex: o, drawX: r, drawY: a, width:
|
|
5035
|
+
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;
|
|
4851
5036
|
e > u && i > x && e < u + d && i < x + d && (this.ctx.stageElement.style.cursor = "crosshair");
|
|
4852
5037
|
}), this.ctx.on("cellMouseenter", (t) => {
|
|
4853
5038
|
const { xArr: e, yArr: i } = this.ctx.selector, s = e[1], o = i[1], { colIndex: r, rowIndex: a } = t;
|
|
@@ -4880,36 +5065,36 @@ class Oe {
|
|
|
4880
5065
|
return;
|
|
4881
5066
|
let r = t, a = e;
|
|
4882
5067
|
if (!o) {
|
|
4883
|
-
const [
|
|
4884
|
-
a = [
|
|
5068
|
+
const [l] = a;
|
|
5069
|
+
a = [l, l];
|
|
4885
5070
|
}
|
|
4886
5071
|
if (!s) {
|
|
4887
|
-
const [
|
|
4888
|
-
r = [
|
|
5072
|
+
const [l] = r;
|
|
5073
|
+
r = [l, l];
|
|
4889
5074
|
}
|
|
4890
5075
|
if (JSON.stringify(this.ctx.autofill.xArr) !== JSON.stringify(r) || JSON.stringify(this.ctx.autofill.yArr) !== JSON.stringify(a)) {
|
|
4891
5076
|
const {
|
|
4892
|
-
SELECTOR_AREA_MIN_X:
|
|
4893
|
-
SELECTOR_AREA_MAX_X:
|
|
5077
|
+
SELECTOR_AREA_MIN_X: l,
|
|
5078
|
+
SELECTOR_AREA_MAX_X: h,
|
|
4894
5079
|
SELECTOR_AREA_MIN_Y: d,
|
|
4895
5080
|
SELECTOR_AREA_MAX_Y: f,
|
|
4896
5081
|
SELECTOR_AREA_MAX_X_OFFSET: u,
|
|
4897
5082
|
SELECTOR_AREA_MAX_Y_OFFSET: x
|
|
4898
|
-
} = this.ctx.config, w =
|
|
4899
|
-
let [y,
|
|
4900
|
-
if (y < w ||
|
|
5083
|
+
} = this.ctx.config, w = l, m = h || this.ctx.maxColIndex - u, g = d, p = f || this.ctx.maxRowIndex - x;
|
|
5084
|
+
let [y, E] = r, [R, C] = a;
|
|
5085
|
+
if (y < w || R < g)
|
|
4901
5086
|
return;
|
|
4902
|
-
r = [Math.max(w, y), Math.min(m,
|
|
4903
|
-
const { BEFORE_SET_AUTOFILL_METHOD:
|
|
4904
|
-
if (typeof
|
|
4905
|
-
const
|
|
5087
|
+
r = [Math.max(w, y), Math.min(m, E)], a = [Math.max(g, R), Math.min(p, C)];
|
|
5088
|
+
const { BEFORE_SET_AUTOFILL_METHOD: I } = this.ctx.config;
|
|
5089
|
+
if (typeof I == "function") {
|
|
5090
|
+
const _ = I({
|
|
4906
5091
|
focusCell: this.ctx.focusCell,
|
|
4907
5092
|
xArr: r,
|
|
4908
5093
|
yArr: a
|
|
4909
5094
|
});
|
|
4910
|
-
if (!
|
|
5095
|
+
if (!_)
|
|
4911
5096
|
return;
|
|
4912
|
-
r =
|
|
5097
|
+
r = _.xArr, a = _.yArr;
|
|
4913
5098
|
}
|
|
4914
5099
|
this.ctx.autofill.xArr = r, this.ctx.autofill.yArr = a, this.ctx.emit("setAutofill", this.ctx.autofill), this.ctx.emit("draw");
|
|
4915
5100
|
}
|
|
@@ -4924,8 +5109,8 @@ class Oe {
|
|
|
4924
5109
|
const m = x + e.yArr[0], g = w + e.xArr[0];
|
|
4925
5110
|
i.set(`${m}-${g}`, !0);
|
|
4926
5111
|
}
|
|
4927
|
-
const { value: s } = e, o = s[0].length, r = s.length, a = this.ctx.autofill.xArr,
|
|
4928
|
-
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a,
|
|
5112
|
+
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;
|
|
5113
|
+
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a, l) && !h) {
|
|
4929
5114
|
const x = {
|
|
4930
5115
|
code: "ERR_MERGED_CELLS_AUTOFILL",
|
|
4931
5116
|
message: "Merged cells cannot span autofill data"
|
|
@@ -4934,15 +5119,15 @@ class Oe {
|
|
|
4934
5119
|
return;
|
|
4935
5120
|
}
|
|
4936
5121
|
let d = [];
|
|
4937
|
-
for (let x = 0; x <=
|
|
5122
|
+
for (let x = 0; x <= l[1] - l[0]; x++)
|
|
4938
5123
|
for (let w = 0; w <= a[1] - a[0]; w++) {
|
|
4939
|
-
const m = w + a[0], g = x +
|
|
4940
|
-
if (y && !i.has(
|
|
4941
|
-
const { rowKey:
|
|
4942
|
-
this.ctx.database.getReadonly(
|
|
4943
|
-
rowKey:
|
|
5124
|
+
const m = w + a[0], g = x + l[0], p = s[x % r][w % o], y = this.ctx.database.getItemValueForRowIndexAndColIndex(g, m), E = `${g}-${m}`;
|
|
5125
|
+
if (y && !i.has(E)) {
|
|
5126
|
+
const { rowKey: R, key: C } = y;
|
|
5127
|
+
this.ctx.database.getReadonly(R, C) || (t.add(R), d.push({
|
|
5128
|
+
rowKey: R,
|
|
4944
5129
|
key: C,
|
|
4945
|
-
value:
|
|
5130
|
+
value: p,
|
|
4946
5131
|
row: {}
|
|
4947
5132
|
}));
|
|
4948
5133
|
}
|
|
@@ -4959,14 +5144,14 @@ class Oe {
|
|
|
4959
5144
|
oldValue: this.ctx.database.getItemValue(m.rowKey, m.key),
|
|
4960
5145
|
row: this.ctx.database.getRowDataItemForRowKey(m.rowKey)
|
|
4961
5146
|
}));
|
|
4962
|
-
if (d = await x(w, a,
|
|
5147
|
+
if (d = await x(w, a, l), d && !d.length)
|
|
4963
5148
|
return;
|
|
4964
5149
|
}
|
|
4965
5150
|
this.ctx.batchSetItemValueByEditor(d, !0);
|
|
4966
5151
|
let u = [];
|
|
4967
5152
|
t.forEach((x) => {
|
|
4968
5153
|
u.push(this.ctx.database.getRowDataItemForRowKey(x));
|
|
4969
|
-
}), this.ctx.emit("autofillChange", d, u);
|
|
5154
|
+
}), this.ctx.emit("autofillChange", d, u), this.ctx.emit("draw");
|
|
4970
5155
|
}
|
|
4971
5156
|
mouseenter(t) {
|
|
4972
5157
|
if (["index", "selection", "index-selection"].includes(t.type))
|
|
@@ -4980,59 +5165,59 @@ class Oe {
|
|
|
4980
5165
|
destroy() {
|
|
4981
5166
|
}
|
|
4982
5167
|
}
|
|
4983
|
-
const j = Math.min, $ = Math.max, it = Math.round,
|
|
4984
|
-
x:
|
|
4985
|
-
y:
|
|
5168
|
+
const j = Math.min, $ = Math.max, it = Math.round, B = (c) => ({
|
|
5169
|
+
x: c,
|
|
5170
|
+
y: c
|
|
4986
5171
|
}), Le = {
|
|
4987
5172
|
left: "right",
|
|
4988
5173
|
right: "left",
|
|
4989
5174
|
bottom: "top",
|
|
4990
5175
|
top: "bottom"
|
|
4991
|
-
},
|
|
5176
|
+
}, Me = {
|
|
4992
5177
|
start: "end",
|
|
4993
5178
|
end: "start"
|
|
4994
5179
|
};
|
|
4995
|
-
function
|
|
4996
|
-
return $(
|
|
5180
|
+
function ct(c, t, e) {
|
|
5181
|
+
return $(c, j(t, e));
|
|
4997
5182
|
}
|
|
4998
|
-
function J(
|
|
4999
|
-
return typeof
|
|
5183
|
+
function J(c, t) {
|
|
5184
|
+
return typeof c == "function" ? c(t) : c;
|
|
5000
5185
|
}
|
|
5001
|
-
function z(
|
|
5002
|
-
return
|
|
5186
|
+
function z(c) {
|
|
5187
|
+
return c.split("-")[0];
|
|
5003
5188
|
}
|
|
5004
|
-
function Q(
|
|
5005
|
-
return
|
|
5189
|
+
function Q(c) {
|
|
5190
|
+
return c.split("-")[1];
|
|
5006
5191
|
}
|
|
5007
|
-
function Kt(
|
|
5008
|
-
return
|
|
5192
|
+
function Kt(c) {
|
|
5193
|
+
return c === "x" ? "y" : "x";
|
|
5009
5194
|
}
|
|
5010
|
-
function gt(
|
|
5011
|
-
return
|
|
5195
|
+
function gt(c) {
|
|
5196
|
+
return c === "y" ? "height" : "width";
|
|
5012
5197
|
}
|
|
5013
|
-
const
|
|
5014
|
-
function V(
|
|
5015
|
-
return
|
|
5198
|
+
const Ae = /* @__PURE__ */ new Set(["top", "bottom"]);
|
|
5199
|
+
function V(c) {
|
|
5200
|
+
return Ae.has(z(c)) ? "y" : "x";
|
|
5016
5201
|
}
|
|
5017
|
-
function wt(
|
|
5018
|
-
return Kt(V(
|
|
5202
|
+
function wt(c) {
|
|
5203
|
+
return Kt(V(c));
|
|
5019
5204
|
}
|
|
5020
|
-
function He(
|
|
5205
|
+
function He(c, t, e) {
|
|
5021
5206
|
e === void 0 && (e = !1);
|
|
5022
|
-
const i = Q(
|
|
5207
|
+
const i = Q(c), s = wt(c), o = gt(s);
|
|
5023
5208
|
let r = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
|
|
5024
5209
|
return t.reference[o] > t.floating[o] && (r = st(r)), [r, st(r)];
|
|
5025
5210
|
}
|
|
5026
|
-
function De(
|
|
5027
|
-
const t = st(
|
|
5028
|
-
return [dt(
|
|
5211
|
+
function De(c) {
|
|
5212
|
+
const t = st(c);
|
|
5213
|
+
return [dt(c), t, dt(t)];
|
|
5029
5214
|
}
|
|
5030
|
-
function dt(
|
|
5031
|
-
return
|
|
5215
|
+
function dt(c) {
|
|
5216
|
+
return c.replace(/start|end/g, (t) => Me[t]);
|
|
5032
5217
|
}
|
|
5033
5218
|
const vt = ["left", "right"], _t = ["right", "left"], Ne = ["top", "bottom"], ke = ["bottom", "top"];
|
|
5034
|
-
function Xe(
|
|
5035
|
-
switch (
|
|
5219
|
+
function Xe(c, t, e) {
|
|
5220
|
+
switch (c) {
|
|
5036
5221
|
case "top":
|
|
5037
5222
|
case "bottom":
|
|
5038
5223
|
return e ? t ? _t : vt : t ? vt : _t;
|
|
@@ -5043,38 +5228,38 @@ function Xe(h, t, e) {
|
|
|
5043
5228
|
return [];
|
|
5044
5229
|
}
|
|
5045
5230
|
}
|
|
5046
|
-
function Ye(
|
|
5047
|
-
const s = Q(
|
|
5048
|
-
let o = Xe(z(
|
|
5231
|
+
function Ye(c, t, e, i) {
|
|
5232
|
+
const s = Q(c);
|
|
5233
|
+
let o = Xe(z(c), e === "start", i);
|
|
5049
5234
|
return s && (o = o.map((r) => r + "-" + s), t && (o = o.concat(o.map(dt)))), o;
|
|
5050
5235
|
}
|
|
5051
|
-
function st(
|
|
5052
|
-
return
|
|
5236
|
+
function st(c) {
|
|
5237
|
+
return c.replace(/left|right|bottom|top/g, (t) => Le[t]);
|
|
5053
5238
|
}
|
|
5054
|
-
function Be(
|
|
5239
|
+
function Be(c) {
|
|
5055
5240
|
return {
|
|
5056
5241
|
top: 0,
|
|
5057
5242
|
right: 0,
|
|
5058
5243
|
bottom: 0,
|
|
5059
5244
|
left: 0,
|
|
5060
|
-
...
|
|
5245
|
+
...c
|
|
5061
5246
|
};
|
|
5062
5247
|
}
|
|
5063
|
-
function
|
|
5064
|
-
return typeof
|
|
5065
|
-
top:
|
|
5066
|
-
right:
|
|
5067
|
-
bottom:
|
|
5068
|
-
left:
|
|
5248
|
+
function Ft(c) {
|
|
5249
|
+
return typeof c != "number" ? Be(c) : {
|
|
5250
|
+
top: c,
|
|
5251
|
+
right: c,
|
|
5252
|
+
bottom: c,
|
|
5253
|
+
left: c
|
|
5069
5254
|
};
|
|
5070
5255
|
}
|
|
5071
|
-
function ot(
|
|
5256
|
+
function ot(c) {
|
|
5072
5257
|
const {
|
|
5073
5258
|
x: t,
|
|
5074
5259
|
y: e,
|
|
5075
5260
|
width: i,
|
|
5076
5261
|
height: s
|
|
5077
|
-
} =
|
|
5262
|
+
} = c;
|
|
5078
5263
|
return {
|
|
5079
5264
|
width: i,
|
|
5080
5265
|
height: s,
|
|
@@ -5086,14 +5271,14 @@ function ot(h) {
|
|
|
5086
5271
|
y: e
|
|
5087
5272
|
};
|
|
5088
5273
|
}
|
|
5089
|
-
function Tt(
|
|
5274
|
+
function Tt(c, t, e) {
|
|
5090
5275
|
let {
|
|
5091
5276
|
reference: i,
|
|
5092
5277
|
floating: s
|
|
5093
|
-
} =
|
|
5094
|
-
const o = V(t), r = wt(t), a = gt(r),
|
|
5278
|
+
} = c;
|
|
5279
|
+
const o = V(t), r = wt(t), a = gt(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;
|
|
5095
5280
|
let x;
|
|
5096
|
-
switch (
|
|
5281
|
+
switch (l) {
|
|
5097
5282
|
case "top":
|
|
5098
5283
|
x = {
|
|
5099
5284
|
x: d,
|
|
@@ -5126,66 +5311,66 @@ function Tt(h, t, e) {
|
|
|
5126
5311
|
}
|
|
5127
5312
|
switch (Q(t)) {
|
|
5128
5313
|
case "start":
|
|
5129
|
-
x[r] -= u * (e &&
|
|
5314
|
+
x[r] -= u * (e && h ? -1 : 1);
|
|
5130
5315
|
break;
|
|
5131
5316
|
case "end":
|
|
5132
|
-
x[r] += u * (e &&
|
|
5317
|
+
x[r] += u * (e && h ? -1 : 1);
|
|
5133
5318
|
break;
|
|
5134
5319
|
}
|
|
5135
5320
|
return x;
|
|
5136
5321
|
}
|
|
5137
|
-
const Ke = async (
|
|
5322
|
+
const Ke = async (c, t, e) => {
|
|
5138
5323
|
const {
|
|
5139
5324
|
placement: i = "bottom",
|
|
5140
5325
|
strategy: s = "absolute",
|
|
5141
5326
|
middleware: o = [],
|
|
5142
5327
|
platform: r
|
|
5143
|
-
} = e, a = o.filter(Boolean),
|
|
5144
|
-
let
|
|
5145
|
-
reference:
|
|
5328
|
+
} = e, a = o.filter(Boolean), l = await (r.isRTL == null ? void 0 : r.isRTL(t));
|
|
5329
|
+
let h = await r.getElementRects({
|
|
5330
|
+
reference: c,
|
|
5146
5331
|
floating: t,
|
|
5147
5332
|
strategy: s
|
|
5148
5333
|
}), {
|
|
5149
5334
|
x: d,
|
|
5150
5335
|
y: f
|
|
5151
|
-
} = Tt(
|
|
5336
|
+
} = Tt(h, i, l), u = i, x = {}, w = 0;
|
|
5152
5337
|
for (let m = 0; m < a.length; m++) {
|
|
5153
5338
|
const {
|
|
5154
5339
|
name: g,
|
|
5155
|
-
fn:
|
|
5340
|
+
fn: p
|
|
5156
5341
|
} = a[m], {
|
|
5157
5342
|
x: y,
|
|
5158
|
-
y:
|
|
5159
|
-
data:
|
|
5343
|
+
y: E,
|
|
5344
|
+
data: R,
|
|
5160
5345
|
reset: C
|
|
5161
|
-
} = await
|
|
5346
|
+
} = await p({
|
|
5162
5347
|
x: d,
|
|
5163
5348
|
y: f,
|
|
5164
5349
|
initialPlacement: i,
|
|
5165
5350
|
placement: u,
|
|
5166
5351
|
strategy: s,
|
|
5167
5352
|
middlewareData: x,
|
|
5168
|
-
rects:
|
|
5353
|
+
rects: h,
|
|
5169
5354
|
platform: r,
|
|
5170
5355
|
elements: {
|
|
5171
|
-
reference:
|
|
5356
|
+
reference: c,
|
|
5172
5357
|
floating: t
|
|
5173
5358
|
}
|
|
5174
5359
|
});
|
|
5175
|
-
d = y ?? d, f =
|
|
5360
|
+
d = y ?? d, f = E ?? f, x = {
|
|
5176
5361
|
...x,
|
|
5177
5362
|
[g]: {
|
|
5178
5363
|
...x[g],
|
|
5179
|
-
...
|
|
5364
|
+
...R
|
|
5180
5365
|
}
|
|
5181
|
-
}, C && w <= 50 && (w++, typeof C == "object" && (C.placement && (u = C.placement), C.rects && (
|
|
5182
|
-
reference:
|
|
5366
|
+
}, C && w <= 50 && (w++, typeof C == "object" && (C.placement && (u = C.placement), C.rects && (h = C.rects === !0 ? await r.getElementRects({
|
|
5367
|
+
reference: c,
|
|
5183
5368
|
floating: t,
|
|
5184
5369
|
strategy: s
|
|
5185
5370
|
}) : C.rects), {
|
|
5186
5371
|
x: d,
|
|
5187
5372
|
y: f
|
|
5188
|
-
} = Tt(
|
|
5373
|
+
} = Tt(h, u, l)), m = -1);
|
|
5189
5374
|
}
|
|
5190
5375
|
return {
|
|
5191
5376
|
x: d,
|
|
@@ -5195,7 +5380,7 @@ const Ke = async (h, t, e) => {
|
|
|
5195
5380
|
middlewareData: x
|
|
5196
5381
|
};
|
|
5197
5382
|
};
|
|
5198
|
-
async function
|
|
5383
|
+
async function Wt(c, t) {
|
|
5199
5384
|
var e;
|
|
5200
5385
|
t === void 0 && (t = {});
|
|
5201
5386
|
const {
|
|
@@ -5204,24 +5389,24 @@ async function Ft(h, t) {
|
|
|
5204
5389
|
platform: o,
|
|
5205
5390
|
rects: r,
|
|
5206
5391
|
elements: a,
|
|
5207
|
-
strategy:
|
|
5208
|
-
} =
|
|
5209
|
-
boundary:
|
|
5392
|
+
strategy: l
|
|
5393
|
+
} = c, {
|
|
5394
|
+
boundary: h = "clippingAncestors",
|
|
5210
5395
|
rootBoundary: d = "viewport",
|
|
5211
5396
|
elementContext: f = "floating",
|
|
5212
5397
|
altBoundary: u = !1,
|
|
5213
5398
|
padding: x = 0
|
|
5214
|
-
} = J(t,
|
|
5399
|
+
} = J(t, c), w = Ft(x), g = a[u ? f === "floating" ? "reference" : "floating" : f], p = ot(await o.getClippingRect({
|
|
5215
5400
|
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)),
|
|
5216
|
-
boundary:
|
|
5401
|
+
boundary: h,
|
|
5217
5402
|
rootBoundary: d,
|
|
5218
|
-
strategy:
|
|
5403
|
+
strategy: l
|
|
5219
5404
|
})), y = f === "floating" ? {
|
|
5220
5405
|
x: i,
|
|
5221
5406
|
y: s,
|
|
5222
5407
|
width: r.floating.width,
|
|
5223
5408
|
height: r.floating.height
|
|
5224
|
-
} : r.reference,
|
|
5409
|
+
} : r.reference, E = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(a.floating)), R = await (o.isElement == null ? void 0 : o.isElement(E)) ? await (o.getScale == null ? void 0 : o.getScale(E)) || {
|
|
5225
5410
|
x: 1,
|
|
5226
5411
|
y: 1
|
|
5227
5412
|
} : {
|
|
@@ -5230,19 +5415,19 @@ async function Ft(h, t) {
|
|
|
5230
5415
|
}, C = ot(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
5231
5416
|
elements: a,
|
|
5232
5417
|
rect: y,
|
|
5233
|
-
offsetParent:
|
|
5234
|
-
strategy:
|
|
5418
|
+
offsetParent: E,
|
|
5419
|
+
strategy: l
|
|
5235
5420
|
}) : y);
|
|
5236
5421
|
return {
|
|
5237
|
-
top: (
|
|
5238
|
-
bottom: (C.bottom -
|
|
5239
|
-
left: (
|
|
5240
|
-
right: (C.right -
|
|
5422
|
+
top: (p.top - C.top + w.top) / R.y,
|
|
5423
|
+
bottom: (C.bottom - p.bottom + w.bottom) / R.y,
|
|
5424
|
+
left: (p.left - C.left + w.left) / R.x,
|
|
5425
|
+
right: (C.right - p.right + w.right) / R.x
|
|
5241
5426
|
};
|
|
5242
5427
|
}
|
|
5243
|
-
const
|
|
5428
|
+
const Fe = (c) => ({
|
|
5244
5429
|
name: "arrow",
|
|
5245
|
-
options:
|
|
5430
|
+
options: c,
|
|
5246
5431
|
async fn(t) {
|
|
5247
5432
|
const {
|
|
5248
5433
|
x: e,
|
|
@@ -5251,36 +5436,36 @@ const We = (h) => ({
|
|
|
5251
5436
|
rects: o,
|
|
5252
5437
|
platform: r,
|
|
5253
5438
|
elements: a,
|
|
5254
|
-
middlewareData:
|
|
5439
|
+
middlewareData: l
|
|
5255
5440
|
} = t, {
|
|
5256
|
-
element:
|
|
5441
|
+
element: h,
|
|
5257
5442
|
padding: d = 0
|
|
5258
|
-
} = J(
|
|
5259
|
-
if (
|
|
5443
|
+
} = J(c, t) || {};
|
|
5444
|
+
if (h == null)
|
|
5260
5445
|
return {};
|
|
5261
|
-
const f =
|
|
5446
|
+
const f = Ft(d), u = {
|
|
5262
5447
|
x: e,
|
|
5263
5448
|
y: i
|
|
5264
|
-
}, x = wt(s), w = gt(x), m = await r.getDimensions(
|
|
5265
|
-
let v =
|
|
5266
|
-
(!v || !await (r.isElement == null ? void 0 : r.isElement(
|
|
5267
|
-
const
|
|
5449
|
+
}, x = wt(s), w = gt(x), m = await r.getDimensions(h), g = x === "y", p = g ? "top" : "left", y = g ? "bottom" : "right", E = g ? "clientHeight" : "clientWidth", R = o.reference[w] + o.reference[x] - u[x] - o.floating[w], C = u[x] - o.reference[x], I = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(h));
|
|
5450
|
+
let v = I ? I[E] : 0;
|
|
5451
|
+
(!v || !await (r.isElement == null ? void 0 : r.isElement(I))) && (v = a.floating[E] || o.floating[w]);
|
|
5452
|
+
const _ = R / 2 - C / 2, S = v / 2 - m[w] / 2 - 1, b = j(f[p], S), O = j(f[y], S), T = b, M = v - m[w] - O, L = v / 2 - m[w] / 2 + _, A = ct(T, L, M), D = !l.arrow && Q(s) != null && L !== A && o.reference[w] / 2 - (L < T ? b : O) - m[w] / 2 < 0, N = D ? L < T ? L - T : L - M : 0;
|
|
5268
5453
|
return {
|
|
5269
|
-
[x]: u[x] +
|
|
5454
|
+
[x]: u[x] + N,
|
|
5270
5455
|
data: {
|
|
5271
|
-
[x]:
|
|
5272
|
-
centerOffset: L -
|
|
5273
|
-
...
|
|
5274
|
-
alignmentOffset:
|
|
5456
|
+
[x]: A,
|
|
5457
|
+
centerOffset: L - A - N,
|
|
5458
|
+
...D && {
|
|
5459
|
+
alignmentOffset: N
|
|
5275
5460
|
}
|
|
5276
5461
|
},
|
|
5277
|
-
reset:
|
|
5462
|
+
reset: D
|
|
5278
5463
|
};
|
|
5279
5464
|
}
|
|
5280
|
-
}),
|
|
5281
|
-
return
|
|
5465
|
+
}), We = function(c) {
|
|
5466
|
+
return c === void 0 && (c = {}), {
|
|
5282
5467
|
name: "flip",
|
|
5283
|
-
options:
|
|
5468
|
+
options: c,
|
|
5284
5469
|
async fn(t) {
|
|
5285
5470
|
var e, i;
|
|
5286
5471
|
const {
|
|
@@ -5288,8 +5473,8 @@ const We = (h) => ({
|
|
|
5288
5473
|
middlewareData: o,
|
|
5289
5474
|
rects: r,
|
|
5290
5475
|
initialPlacement: a,
|
|
5291
|
-
platform:
|
|
5292
|
-
elements:
|
|
5476
|
+
platform: l,
|
|
5477
|
+
elements: h
|
|
5293
5478
|
} = t, {
|
|
5294
5479
|
mainAxis: d = !0,
|
|
5295
5480
|
crossAxis: f = !0,
|
|
@@ -5298,60 +5483,60 @@ const We = (h) => ({
|
|
|
5298
5483
|
fallbackAxisSideDirection: w = "none",
|
|
5299
5484
|
flipAlignment: m = !0,
|
|
5300
5485
|
...g
|
|
5301
|
-
} = J(
|
|
5486
|
+
} = J(c, t);
|
|
5302
5487
|
if ((e = o.arrow) != null && e.alignmentOffset)
|
|
5303
5488
|
return {};
|
|
5304
|
-
const
|
|
5305
|
-
!u &&
|
|
5306
|
-
const v = [a, ...C],
|
|
5307
|
-
let
|
|
5308
|
-
if (d && S.push(
|
|
5309
|
-
const L = He(s, r,
|
|
5310
|
-
S.push(
|
|
5489
|
+
const p = z(s), y = V(a), E = z(a) === a, R = await (l.isRTL == null ? void 0 : l.isRTL(h.floating)), C = u || (E || !m ? [st(a)] : De(a)), I = w !== "none";
|
|
5490
|
+
!u && I && C.push(...Ye(a, m, w, R));
|
|
5491
|
+
const v = [a, ...C], _ = await Wt(t, g), S = [];
|
|
5492
|
+
let b = ((i = o.flip) == null ? void 0 : i.overflows) || [];
|
|
5493
|
+
if (d && S.push(_[p]), f) {
|
|
5494
|
+
const L = He(s, r, R);
|
|
5495
|
+
S.push(_[L[0]], _[L[1]]);
|
|
5311
5496
|
}
|
|
5312
|
-
if (
|
|
5497
|
+
if (b = [...b, {
|
|
5313
5498
|
placement: s,
|
|
5314
5499
|
overflows: S
|
|
5315
5500
|
}], !S.every((L) => L <= 0)) {
|
|
5316
|
-
var
|
|
5317
|
-
const L = (((
|
|
5318
|
-
if (
|
|
5501
|
+
var O, T;
|
|
5502
|
+
const L = (((O = o.flip) == null ? void 0 : O.index) || 0) + 1, A = v[L];
|
|
5503
|
+
if (A && (!(f === "alignment" ? y !== V(A) : !1) || // We leave the current main axis only if every placement on that axis
|
|
5319
5504
|
// overflows the main axis.
|
|
5320
|
-
|
|
5505
|
+
b.every((k) => V(k.placement) === y ? k.overflows[0] > 0 : !0)))
|
|
5321
5506
|
return {
|
|
5322
5507
|
data: {
|
|
5323
5508
|
index: L,
|
|
5324
|
-
overflows:
|
|
5509
|
+
overflows: b
|
|
5325
5510
|
},
|
|
5326
5511
|
reset: {
|
|
5327
|
-
placement:
|
|
5512
|
+
placement: A
|
|
5328
5513
|
}
|
|
5329
5514
|
};
|
|
5330
|
-
let
|
|
5331
|
-
if (!
|
|
5515
|
+
let D = (T = b.filter((N) => N.overflows[0] <= 0).sort((N, k) => N.overflows[1] - k.overflows[1])[0]) == null ? void 0 : T.placement;
|
|
5516
|
+
if (!D)
|
|
5332
5517
|
switch (x) {
|
|
5333
5518
|
case "bestFit": {
|
|
5334
5519
|
var M;
|
|
5335
|
-
const
|
|
5336
|
-
if (
|
|
5337
|
-
const
|
|
5338
|
-
return
|
|
5520
|
+
const N = (M = b.filter((k) => {
|
|
5521
|
+
if (I) {
|
|
5522
|
+
const W = V(k.placement);
|
|
5523
|
+
return W === y || // Create a bias to the `y` side axis due to horizontal
|
|
5339
5524
|
// reading directions favoring greater width.
|
|
5340
|
-
|
|
5525
|
+
W === "y";
|
|
5341
5526
|
}
|
|
5342
5527
|
return !0;
|
|
5343
|
-
}).map((
|
|
5344
|
-
|
|
5528
|
+
}).map((k) => [k.placement, k.overflows.filter((W) => W > 0).reduce((W, ie) => W + ie, 0)]).sort((k, W) => k[1] - W[1])[0]) == null ? void 0 : M[0];
|
|
5529
|
+
N && (D = N);
|
|
5345
5530
|
break;
|
|
5346
5531
|
}
|
|
5347
5532
|
case "initialPlacement":
|
|
5348
|
-
|
|
5533
|
+
D = a;
|
|
5349
5534
|
break;
|
|
5350
5535
|
}
|
|
5351
|
-
if (s !==
|
|
5536
|
+
if (s !== D)
|
|
5352
5537
|
return {
|
|
5353
5538
|
reset: {
|
|
5354
|
-
placement:
|
|
5539
|
+
placement: D
|
|
5355
5540
|
}
|
|
5356
5541
|
};
|
|
5357
5542
|
}
|
|
@@ -5359,12 +5544,12 @@ const We = (h) => ({
|
|
|
5359
5544
|
}
|
|
5360
5545
|
};
|
|
5361
5546
|
}, Ve = /* @__PURE__ */ new Set(["left", "top"]);
|
|
5362
|
-
async function Pe(
|
|
5547
|
+
async function Pe(c, t) {
|
|
5363
5548
|
const {
|
|
5364
5549
|
placement: e,
|
|
5365
5550
|
platform: i,
|
|
5366
5551
|
elements: s
|
|
5367
|
-
} =
|
|
5552
|
+
} = c, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r = z(e), a = Q(e), l = V(e) === "y", h = Ve.has(r) ? -1 : 1, d = o && l ? -1 : 1, f = J(t, c);
|
|
5368
5553
|
let {
|
|
5369
5554
|
mainAxis: u,
|
|
5370
5555
|
crossAxis: x,
|
|
@@ -5378,18 +5563,18 @@ async function Pe(h, t) {
|
|
|
5378
5563
|
crossAxis: f.crossAxis || 0,
|
|
5379
5564
|
alignmentAxis: f.alignmentAxis
|
|
5380
5565
|
};
|
|
5381
|
-
return a && typeof w == "number" && (x = a === "end" ? w * -1 : w),
|
|
5566
|
+
return a && typeof w == "number" && (x = a === "end" ? w * -1 : w), l ? {
|
|
5382
5567
|
x: x * d,
|
|
5383
|
-
y: u *
|
|
5568
|
+
y: u * h
|
|
5384
5569
|
} : {
|
|
5385
|
-
x: u *
|
|
5570
|
+
x: u * h,
|
|
5386
5571
|
y: x * d
|
|
5387
5572
|
};
|
|
5388
5573
|
}
|
|
5389
|
-
const ze = function(
|
|
5390
|
-
return
|
|
5574
|
+
const ze = function(c) {
|
|
5575
|
+
return c === void 0 && (c = 0), {
|
|
5391
5576
|
name: "offset",
|
|
5392
|
-
options:
|
|
5577
|
+
options: c,
|
|
5393
5578
|
async fn(t) {
|
|
5394
5579
|
var e, i;
|
|
5395
5580
|
const {
|
|
@@ -5397,21 +5582,21 @@ const ze = function(h) {
|
|
|
5397
5582
|
y: o,
|
|
5398
5583
|
placement: r,
|
|
5399
5584
|
middlewareData: a
|
|
5400
|
-
} = t,
|
|
5585
|
+
} = t, l = await Pe(t, c);
|
|
5401
5586
|
return r === ((e = a.offset) == null ? void 0 : e.placement) && (i = a.arrow) != null && i.alignmentOffset ? {} : {
|
|
5402
|
-
x: s +
|
|
5403
|
-
y: o +
|
|
5587
|
+
x: s + l.x,
|
|
5588
|
+
y: o + l.y,
|
|
5404
5589
|
data: {
|
|
5405
|
-
...
|
|
5590
|
+
...l,
|
|
5406
5591
|
placement: r
|
|
5407
5592
|
}
|
|
5408
5593
|
};
|
|
5409
5594
|
}
|
|
5410
5595
|
};
|
|
5411
|
-
}, $e = function(
|
|
5412
|
-
return
|
|
5596
|
+
}, $e = function(c) {
|
|
5597
|
+
return c === void 0 && (c = {}), {
|
|
5413
5598
|
name: "shift",
|
|
5414
|
-
options:
|
|
5599
|
+
options: c,
|
|
5415
5600
|
async fn(t) {
|
|
5416
5601
|
const {
|
|
5417
5602
|
x: e,
|
|
@@ -5423,28 +5608,28 @@ const ze = function(h) {
|
|
|
5423
5608
|
limiter: a = {
|
|
5424
5609
|
fn: (g) => {
|
|
5425
5610
|
let {
|
|
5426
|
-
x:
|
|
5611
|
+
x: p,
|
|
5427
5612
|
y
|
|
5428
5613
|
} = g;
|
|
5429
5614
|
return {
|
|
5430
|
-
x:
|
|
5615
|
+
x: p,
|
|
5431
5616
|
y
|
|
5432
5617
|
};
|
|
5433
5618
|
}
|
|
5434
5619
|
},
|
|
5435
|
-
...
|
|
5436
|
-
} = J(
|
|
5620
|
+
...l
|
|
5621
|
+
} = J(c, t), h = {
|
|
5437
5622
|
x: e,
|
|
5438
5623
|
y: i
|
|
5439
|
-
}, d = await
|
|
5440
|
-
let x =
|
|
5624
|
+
}, d = await Wt(t, l), f = V(z(s)), u = Kt(f);
|
|
5625
|
+
let x = h[u], w = h[f];
|
|
5441
5626
|
if (o) {
|
|
5442
|
-
const g = u === "y" ? "top" : "left",
|
|
5443
|
-
x =
|
|
5627
|
+
const g = u === "y" ? "top" : "left", p = u === "y" ? "bottom" : "right", y = x + d[g], E = x - d[p];
|
|
5628
|
+
x = ct(y, x, E);
|
|
5444
5629
|
}
|
|
5445
5630
|
if (r) {
|
|
5446
|
-
const g = f === "y" ? "top" : "left",
|
|
5447
|
-
w =
|
|
5631
|
+
const g = f === "y" ? "top" : "left", p = f === "y" ? "bottom" : "right", y = w + d[g], E = w - d[p];
|
|
5632
|
+
w = ct(y, w, E);
|
|
5448
5633
|
}
|
|
5449
5634
|
const m = a.fn({
|
|
5450
5635
|
...t,
|
|
@@ -5468,61 +5653,61 @@ const ze = function(h) {
|
|
|
5468
5653
|
function rt() {
|
|
5469
5654
|
return typeof window < "u";
|
|
5470
5655
|
}
|
|
5471
|
-
function Z(
|
|
5472
|
-
return Vt(
|
|
5656
|
+
function Z(c) {
|
|
5657
|
+
return Vt(c) ? (c.nodeName || "").toLowerCase() : "#document";
|
|
5473
5658
|
}
|
|
5474
|
-
function
|
|
5659
|
+
function H(c) {
|
|
5475
5660
|
var t;
|
|
5476
|
-
return (
|
|
5661
|
+
return (c == null || (t = c.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
5477
5662
|
}
|
|
5478
|
-
function
|
|
5663
|
+
function F(c) {
|
|
5479
5664
|
var t;
|
|
5480
|
-
return (t = (Vt(
|
|
5665
|
+
return (t = (Vt(c) ? c.ownerDocument : c.document) || window.document) == null ? void 0 : t.documentElement;
|
|
5481
5666
|
}
|
|
5482
|
-
function Vt(
|
|
5483
|
-
return rt() ?
|
|
5667
|
+
function Vt(c) {
|
|
5668
|
+
return rt() ? c instanceof Node || c instanceof H(c).Node : !1;
|
|
5484
5669
|
}
|
|
5485
|
-
function
|
|
5486
|
-
return rt() ?
|
|
5670
|
+
function X(c) {
|
|
5671
|
+
return rt() ? c instanceof Element || c instanceof H(c).Element : !1;
|
|
5487
5672
|
}
|
|
5488
|
-
function
|
|
5489
|
-
return rt() ?
|
|
5673
|
+
function K(c) {
|
|
5674
|
+
return rt() ? c instanceof HTMLElement || c instanceof H(c).HTMLElement : !1;
|
|
5490
5675
|
}
|
|
5491
|
-
function Ot(
|
|
5492
|
-
return !rt() || typeof ShadowRoot > "u" ? !1 :
|
|
5676
|
+
function Ot(c) {
|
|
5677
|
+
return !rt() || typeof ShadowRoot > "u" ? !1 : c instanceof ShadowRoot || c instanceof H(c).ShadowRoot;
|
|
5493
5678
|
}
|
|
5494
5679
|
const Ge = /* @__PURE__ */ new Set(["inline", "contents"]);
|
|
5495
|
-
function tt(
|
|
5680
|
+
function tt(c) {
|
|
5496
5681
|
const {
|
|
5497
5682
|
overflow: t,
|
|
5498
5683
|
overflowX: e,
|
|
5499
5684
|
overflowY: i,
|
|
5500
5685
|
display: s
|
|
5501
|
-
} =
|
|
5686
|
+
} = Y(c);
|
|
5502
5687
|
return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !Ge.has(s);
|
|
5503
5688
|
}
|
|
5504
5689
|
const Ue = /* @__PURE__ */ new Set(["table", "td", "th"]);
|
|
5505
|
-
function Ze(
|
|
5506
|
-
return Ue.has(Z(
|
|
5690
|
+
function Ze(c) {
|
|
5691
|
+
return Ue.has(Z(c));
|
|
5507
5692
|
}
|
|
5508
5693
|
const je = [":popover-open", ":modal"];
|
|
5509
|
-
function nt(
|
|
5694
|
+
function nt(c) {
|
|
5510
5695
|
return je.some((t) => {
|
|
5511
5696
|
try {
|
|
5512
|
-
return
|
|
5697
|
+
return c.matches(t);
|
|
5513
5698
|
} catch {
|
|
5514
5699
|
return !1;
|
|
5515
5700
|
}
|
|
5516
5701
|
});
|
|
5517
5702
|
}
|
|
5518
5703
|
const qe = ["transform", "translate", "scale", "rotate", "perspective"], Je = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Qe = ["paint", "layout", "strict", "content"];
|
|
5519
|
-
function mt(
|
|
5520
|
-
const t =
|
|
5704
|
+
function mt(c) {
|
|
5705
|
+
const t = pt(), e = X(c) ? Y(c) : c;
|
|
5521
5706
|
return qe.some((i) => e[i] ? e[i] !== "none" : !1) || (e.containerType ? e.containerType !== "normal" : !1) || !t && (e.backdropFilter ? e.backdropFilter !== "none" : !1) || !t && (e.filter ? e.filter !== "none" : !1) || Je.some((i) => (e.willChange || "").includes(i)) || Qe.some((i) => (e.contain || "").includes(i));
|
|
5522
5707
|
}
|
|
5523
|
-
function ti(
|
|
5524
|
-
let t = P(
|
|
5525
|
-
for (;
|
|
5708
|
+
function ti(c) {
|
|
5709
|
+
let t = P(c);
|
|
5710
|
+
for (; K(t) && !U(t); ) {
|
|
5526
5711
|
if (mt(t))
|
|
5527
5712
|
return t;
|
|
5528
5713
|
if (nt(t))
|
|
@@ -5531,67 +5716,67 @@ function ti(h) {
|
|
|
5531
5716
|
}
|
|
5532
5717
|
return null;
|
|
5533
5718
|
}
|
|
5534
|
-
function
|
|
5719
|
+
function pt() {
|
|
5535
5720
|
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
5536
5721
|
}
|
|
5537
5722
|
const ei = /* @__PURE__ */ new Set(["html", "body", "#document"]);
|
|
5538
|
-
function U(
|
|
5539
|
-
return ei.has(Z(
|
|
5723
|
+
function U(c) {
|
|
5724
|
+
return ei.has(Z(c));
|
|
5540
5725
|
}
|
|
5541
|
-
function
|
|
5542
|
-
return
|
|
5726
|
+
function Y(c) {
|
|
5727
|
+
return H(c).getComputedStyle(c);
|
|
5543
5728
|
}
|
|
5544
|
-
function at(
|
|
5545
|
-
return
|
|
5546
|
-
scrollLeft:
|
|
5547
|
-
scrollTop:
|
|
5729
|
+
function at(c) {
|
|
5730
|
+
return X(c) ? {
|
|
5731
|
+
scrollLeft: c.scrollLeft,
|
|
5732
|
+
scrollTop: c.scrollTop
|
|
5548
5733
|
} : {
|
|
5549
|
-
scrollLeft:
|
|
5550
|
-
scrollTop:
|
|
5734
|
+
scrollLeft: c.scrollX,
|
|
5735
|
+
scrollTop: c.scrollY
|
|
5551
5736
|
};
|
|
5552
5737
|
}
|
|
5553
|
-
function P(
|
|
5554
|
-
if (Z(
|
|
5555
|
-
return
|
|
5738
|
+
function P(c) {
|
|
5739
|
+
if (Z(c) === "html")
|
|
5740
|
+
return c;
|
|
5556
5741
|
const t = (
|
|
5557
5742
|
// Step into the shadow DOM of the parent of a slotted node.
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
Ot(
|
|
5561
|
-
|
|
5743
|
+
c.assignedSlot || // DOM Element detected.
|
|
5744
|
+
c.parentNode || // ShadowRoot detected.
|
|
5745
|
+
Ot(c) && c.host || // Fallback.
|
|
5746
|
+
F(c)
|
|
5562
5747
|
);
|
|
5563
5748
|
return Ot(t) ? t.host : t;
|
|
5564
5749
|
}
|
|
5565
|
-
function Pt(
|
|
5566
|
-
const t = P(
|
|
5567
|
-
return U(t) ?
|
|
5750
|
+
function Pt(c) {
|
|
5751
|
+
const t = P(c);
|
|
5752
|
+
return U(t) ? c.ownerDocument ? c.ownerDocument.body : c.body : K(t) && tt(t) ? t : Pt(t);
|
|
5568
5753
|
}
|
|
5569
|
-
function zt(
|
|
5754
|
+
function zt(c, t, e) {
|
|
5570
5755
|
var i;
|
|
5571
5756
|
t === void 0 && (t = []);
|
|
5572
|
-
const s = Pt(
|
|
5757
|
+
const s = Pt(c), o = s === ((i = c.ownerDocument) == null ? void 0 : i.body), r = H(s);
|
|
5573
5758
|
return o ? (ft(r), t.concat(r, r.visualViewport || [], tt(s) ? s : [], [])) : t.concat(s, zt(s, []));
|
|
5574
5759
|
}
|
|
5575
|
-
function ft(
|
|
5576
|
-
return
|
|
5760
|
+
function ft(c) {
|
|
5761
|
+
return c.parent && Object.getPrototypeOf(c.parent) ? c.frameElement : null;
|
|
5577
5762
|
}
|
|
5578
|
-
function $t(
|
|
5579
|
-
const t =
|
|
5763
|
+
function $t(c) {
|
|
5764
|
+
const t = Y(c);
|
|
5580
5765
|
let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
|
|
5581
|
-
const s =
|
|
5766
|
+
const s = K(c), o = s ? c.offsetWidth : e, r = s ? c.offsetHeight : i, a = it(e) !== o || it(i) !== r;
|
|
5582
5767
|
return a && (e = o, i = r), {
|
|
5583
5768
|
width: e,
|
|
5584
5769
|
height: i,
|
|
5585
5770
|
$: a
|
|
5586
5771
|
};
|
|
5587
5772
|
}
|
|
5588
|
-
function Gt(
|
|
5589
|
-
return
|
|
5773
|
+
function Gt(c) {
|
|
5774
|
+
return X(c) ? c : c.contextElement;
|
|
5590
5775
|
}
|
|
5591
|
-
function G(
|
|
5592
|
-
const t = Gt(
|
|
5593
|
-
if (!
|
|
5594
|
-
return
|
|
5776
|
+
function G(c) {
|
|
5777
|
+
const t = Gt(c);
|
|
5778
|
+
if (!K(t))
|
|
5779
|
+
return B(1);
|
|
5595
5780
|
const e = t.getBoundingClientRect(), {
|
|
5596
5781
|
width: i,
|
|
5597
5782
|
height: s,
|
|
@@ -5603,130 +5788,130 @@ function G(h) {
|
|
|
5603
5788
|
y: a
|
|
5604
5789
|
};
|
|
5605
5790
|
}
|
|
5606
|
-
const ii = /* @__PURE__ */
|
|
5607
|
-
function Ut(
|
|
5608
|
-
const t =
|
|
5609
|
-
return !
|
|
5791
|
+
const ii = /* @__PURE__ */ B(0);
|
|
5792
|
+
function Ut(c) {
|
|
5793
|
+
const t = H(c);
|
|
5794
|
+
return !pt() || !t.visualViewport ? ii : {
|
|
5610
5795
|
x: t.visualViewport.offsetLeft,
|
|
5611
5796
|
y: t.visualViewport.offsetTop
|
|
5612
5797
|
};
|
|
5613
5798
|
}
|
|
5614
|
-
function si(
|
|
5615
|
-
return t === void 0 && (t = !1), !e || t && e !==
|
|
5799
|
+
function si(c, t, e) {
|
|
5800
|
+
return t === void 0 && (t = !1), !e || t && e !== H(c) ? !1 : t;
|
|
5616
5801
|
}
|
|
5617
|
-
function q(
|
|
5802
|
+
function q(c, t, e, i) {
|
|
5618
5803
|
t === void 0 && (t = !1), e === void 0 && (e = !1);
|
|
5619
|
-
const s =
|
|
5620
|
-
let r =
|
|
5621
|
-
t && (i ?
|
|
5622
|
-
const a = si(o, e, i) ? Ut(o) :
|
|
5623
|
-
let
|
|
5804
|
+
const s = c.getBoundingClientRect(), o = Gt(c);
|
|
5805
|
+
let r = B(1);
|
|
5806
|
+
t && (i ? X(i) && (r = G(i)) : r = G(c));
|
|
5807
|
+
const a = si(o, e, i) ? Ut(o) : B(0);
|
|
5808
|
+
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;
|
|
5624
5809
|
if (o) {
|
|
5625
|
-
const u =
|
|
5810
|
+
const u = H(o), x = i && X(i) ? H(i) : i;
|
|
5626
5811
|
let w = u, m = ft(w);
|
|
5627
5812
|
for (; m && i && x !== w; ) {
|
|
5628
|
-
const g = G(m),
|
|
5629
|
-
|
|
5813
|
+
const g = G(m), p = m.getBoundingClientRect(), y = Y(m), E = p.left + (m.clientLeft + parseFloat(y.paddingLeft)) * g.x, R = p.top + (m.clientTop + parseFloat(y.paddingTop)) * g.y;
|
|
5814
|
+
l *= g.x, h *= g.y, d *= g.x, f *= g.y, l += E, h += R, w = H(m), m = ft(w);
|
|
5630
5815
|
}
|
|
5631
5816
|
}
|
|
5632
5817
|
return ot({
|
|
5633
5818
|
width: d,
|
|
5634
5819
|
height: f,
|
|
5635
|
-
x:
|
|
5636
|
-
y:
|
|
5820
|
+
x: l,
|
|
5821
|
+
y: h
|
|
5637
5822
|
});
|
|
5638
5823
|
}
|
|
5639
|
-
function
|
|
5640
|
-
const e = at(
|
|
5641
|
-
return t ? t.left + e : q(
|
|
5824
|
+
function Et(c, t) {
|
|
5825
|
+
const e = at(c).scrollLeft;
|
|
5826
|
+
return t ? t.left + e : q(F(c)).left + e;
|
|
5642
5827
|
}
|
|
5643
|
-
function Zt(
|
|
5828
|
+
function Zt(c, t, e) {
|
|
5644
5829
|
e === void 0 && (e = !1);
|
|
5645
|
-
const i =
|
|
5830
|
+
const i = c.getBoundingClientRect(), s = i.left + t.scrollLeft - (e ? 0 : (
|
|
5646
5831
|
// RTL <body> scrollbar.
|
|
5647
|
-
|
|
5832
|
+
Et(c, i)
|
|
5648
5833
|
)), o = i.top + t.scrollTop;
|
|
5649
5834
|
return {
|
|
5650
5835
|
x: s,
|
|
5651
5836
|
y: o
|
|
5652
5837
|
};
|
|
5653
5838
|
}
|
|
5654
|
-
function oi(
|
|
5839
|
+
function oi(c) {
|
|
5655
5840
|
let {
|
|
5656
5841
|
elements: t,
|
|
5657
5842
|
rect: e,
|
|
5658
5843
|
offsetParent: i,
|
|
5659
5844
|
strategy: s
|
|
5660
|
-
} =
|
|
5661
|
-
const o = s === "fixed", r =
|
|
5845
|
+
} = c;
|
|
5846
|
+
const o = s === "fixed", r = F(i), a = t ? nt(t.floating) : !1;
|
|
5662
5847
|
if (i === r || a && o)
|
|
5663
5848
|
return e;
|
|
5664
|
-
let
|
|
5849
|
+
let l = {
|
|
5665
5850
|
scrollLeft: 0,
|
|
5666
5851
|
scrollTop: 0
|
|
5667
|
-
},
|
|
5668
|
-
const d =
|
|
5669
|
-
if ((f || !f && !o) && ((Z(i) !== "body" || tt(r)) && (
|
|
5852
|
+
}, h = B(1);
|
|
5853
|
+
const d = B(0), f = K(i);
|
|
5854
|
+
if ((f || !f && !o) && ((Z(i) !== "body" || tt(r)) && (l = at(i)), K(i))) {
|
|
5670
5855
|
const x = q(i);
|
|
5671
|
-
|
|
5856
|
+
h = G(i), d.x = x.x + i.clientLeft, d.y = x.y + i.clientTop;
|
|
5672
5857
|
}
|
|
5673
|
-
const u = r && !f && !o ? Zt(r,
|
|
5858
|
+
const u = r && !f && !o ? Zt(r, l, !0) : B(0);
|
|
5674
5859
|
return {
|
|
5675
|
-
width: e.width *
|
|
5676
|
-
height: e.height *
|
|
5677
|
-
x: e.x *
|
|
5678
|
-
y: e.y *
|
|
5860
|
+
width: e.width * h.x,
|
|
5861
|
+
height: e.height * h.y,
|
|
5862
|
+
x: e.x * h.x - l.scrollLeft * h.x + d.x + u.x,
|
|
5863
|
+
y: e.y * h.y - l.scrollTop * h.y + d.y + u.y
|
|
5679
5864
|
};
|
|
5680
5865
|
}
|
|
5681
|
-
function ri(
|
|
5682
|
-
return Array.from(
|
|
5866
|
+
function ri(c) {
|
|
5867
|
+
return Array.from(c.getClientRects());
|
|
5683
5868
|
}
|
|
5684
|
-
function ni(
|
|
5685
|
-
const t =
|
|
5686
|
-
let r = -e.scrollLeft +
|
|
5869
|
+
function ni(c) {
|
|
5870
|
+
const t = F(c), e = at(c), i = c.ownerDocument.body, s = $(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), o = $(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
|
|
5871
|
+
let r = -e.scrollLeft + Et(c);
|
|
5687
5872
|
const a = -e.scrollTop;
|
|
5688
|
-
return
|
|
5873
|
+
return Y(i).direction === "rtl" && (r += $(t.clientWidth, i.clientWidth) - s), {
|
|
5689
5874
|
width: s,
|
|
5690
5875
|
height: o,
|
|
5691
5876
|
x: r,
|
|
5692
5877
|
y: a
|
|
5693
5878
|
};
|
|
5694
5879
|
}
|
|
5695
|
-
function ai(
|
|
5696
|
-
const e =
|
|
5697
|
-
let o = i.clientWidth, r = i.clientHeight, a = 0,
|
|
5880
|
+
function ai(c, t) {
|
|
5881
|
+
const e = H(c), i = F(c), s = e.visualViewport;
|
|
5882
|
+
let o = i.clientWidth, r = i.clientHeight, a = 0, l = 0;
|
|
5698
5883
|
if (s) {
|
|
5699
5884
|
o = s.width, r = s.height;
|
|
5700
|
-
const
|
|
5701
|
-
(!
|
|
5885
|
+
const h = pt();
|
|
5886
|
+
(!h || h && t === "fixed") && (a = s.offsetLeft, l = s.offsetTop);
|
|
5702
5887
|
}
|
|
5703
5888
|
return {
|
|
5704
5889
|
width: o,
|
|
5705
5890
|
height: r,
|
|
5706
5891
|
x: a,
|
|
5707
|
-
y:
|
|
5892
|
+
y: l
|
|
5708
5893
|
};
|
|
5709
5894
|
}
|
|
5710
|
-
const
|
|
5711
|
-
function
|
|
5712
|
-
const e = q(
|
|
5895
|
+
const li = /* @__PURE__ */ new Set(["absolute", "fixed"]);
|
|
5896
|
+
function hi(c, t) {
|
|
5897
|
+
const e = q(c, !0, t === "fixed"), i = e.top + c.clientTop, s = e.left + c.clientLeft, o = K(c) ? G(c) : B(1), r = c.clientWidth * o.x, a = c.clientHeight * o.y, l = s * o.x, h = i * o.y;
|
|
5713
5898
|
return {
|
|
5714
5899
|
width: r,
|
|
5715
5900
|
height: a,
|
|
5716
|
-
x:
|
|
5717
|
-
y:
|
|
5901
|
+
x: l,
|
|
5902
|
+
y: h
|
|
5718
5903
|
};
|
|
5719
5904
|
}
|
|
5720
|
-
function Lt(
|
|
5905
|
+
function Lt(c, t, e) {
|
|
5721
5906
|
let i;
|
|
5722
5907
|
if (t === "viewport")
|
|
5723
|
-
i = ai(
|
|
5908
|
+
i = ai(c, e);
|
|
5724
5909
|
else if (t === "document")
|
|
5725
|
-
i = ni(
|
|
5726
|
-
else if (
|
|
5727
|
-
i =
|
|
5910
|
+
i = ni(F(c));
|
|
5911
|
+
else if (X(t))
|
|
5912
|
+
i = hi(t, e);
|
|
5728
5913
|
else {
|
|
5729
|
-
const s = Ut(
|
|
5914
|
+
const s = Ut(c);
|
|
5730
5915
|
i = {
|
|
5731
5916
|
x: t.x - s.x,
|
|
5732
5917
|
y: t.y - s.y,
|
|
@@ -5736,68 +5921,68 @@ function Lt(h, t, e) {
|
|
|
5736
5921
|
}
|
|
5737
5922
|
return ot(i);
|
|
5738
5923
|
}
|
|
5739
|
-
function jt(
|
|
5740
|
-
const e = P(
|
|
5741
|
-
return e === t || !
|
|
5924
|
+
function jt(c, t) {
|
|
5925
|
+
const e = P(c);
|
|
5926
|
+
return e === t || !X(e) || U(e) ? !1 : Y(e).position === "fixed" || jt(e, t);
|
|
5742
5927
|
}
|
|
5743
|
-
function
|
|
5744
|
-
const e = t.get(
|
|
5928
|
+
function ci(c, t) {
|
|
5929
|
+
const e = t.get(c);
|
|
5745
5930
|
if (e)
|
|
5746
5931
|
return e;
|
|
5747
|
-
let i = zt(
|
|
5748
|
-
const o =
|
|
5749
|
-
let r = o ? P(
|
|
5750
|
-
for (;
|
|
5751
|
-
const a =
|
|
5752
|
-
!
|
|
5753
|
-
}
|
|
5754
|
-
return t.set(
|
|
5932
|
+
let i = zt(c, []).filter((a) => X(a) && Z(a) !== "body"), s = null;
|
|
5933
|
+
const o = Y(c).position === "fixed";
|
|
5934
|
+
let r = o ? P(c) : c;
|
|
5935
|
+
for (; X(r) && !U(r); ) {
|
|
5936
|
+
const a = Y(r), l = mt(r);
|
|
5937
|
+
!l && a.position === "fixed" && (s = null), (o ? !l && !s : !l && a.position === "static" && !!s && li.has(s.position) || tt(r) && !l && jt(c, r)) ? i = i.filter((d) => d !== r) : s = a, r = P(r);
|
|
5938
|
+
}
|
|
5939
|
+
return t.set(c, i), i;
|
|
5755
5940
|
}
|
|
5756
|
-
function di(
|
|
5941
|
+
function di(c) {
|
|
5757
5942
|
let {
|
|
5758
5943
|
element: t,
|
|
5759
5944
|
boundary: e,
|
|
5760
5945
|
rootBoundary: i,
|
|
5761
5946
|
strategy: s
|
|
5762
|
-
} =
|
|
5763
|
-
const r = [...e === "clippingAncestors" ? nt(t) ? [] :
|
|
5947
|
+
} = c;
|
|
5948
|
+
const r = [...e === "clippingAncestors" ? nt(t) ? [] : ci(t, this._c) : [].concat(e), i], a = r[0], l = r.reduce((h, d) => {
|
|
5764
5949
|
const f = Lt(t, d, s);
|
|
5765
|
-
return
|
|
5950
|
+
return h.top = $(f.top, h.top), h.right = j(f.right, h.right), h.bottom = j(f.bottom, h.bottom), h.left = $(f.left, h.left), h;
|
|
5766
5951
|
}, Lt(t, a, s));
|
|
5767
5952
|
return {
|
|
5768
|
-
width:
|
|
5769
|
-
height:
|
|
5770
|
-
x:
|
|
5771
|
-
y:
|
|
5953
|
+
width: l.right - l.left,
|
|
5954
|
+
height: l.bottom - l.top,
|
|
5955
|
+
x: l.left,
|
|
5956
|
+
y: l.top
|
|
5772
5957
|
};
|
|
5773
5958
|
}
|
|
5774
|
-
function fi(
|
|
5959
|
+
function fi(c) {
|
|
5775
5960
|
const {
|
|
5776
5961
|
width: t,
|
|
5777
5962
|
height: e
|
|
5778
|
-
} = $t(
|
|
5963
|
+
} = $t(c);
|
|
5779
5964
|
return {
|
|
5780
5965
|
width: t,
|
|
5781
5966
|
height: e
|
|
5782
5967
|
};
|
|
5783
5968
|
}
|
|
5784
|
-
function xi(
|
|
5785
|
-
const i =
|
|
5969
|
+
function xi(c, t, e) {
|
|
5970
|
+
const i = K(t), s = F(t), o = e === "fixed", r = q(c, !0, o, t);
|
|
5786
5971
|
let a = {
|
|
5787
5972
|
scrollLeft: 0,
|
|
5788
5973
|
scrollTop: 0
|
|
5789
5974
|
};
|
|
5790
|
-
const
|
|
5791
|
-
function
|
|
5792
|
-
|
|
5975
|
+
const l = B(0);
|
|
5976
|
+
function h() {
|
|
5977
|
+
l.x = Et(s);
|
|
5793
5978
|
}
|
|
5794
5979
|
if (i || !i && !o)
|
|
5795
5980
|
if ((Z(t) !== "body" || tt(s)) && (a = at(t)), i) {
|
|
5796
5981
|
const x = q(t, !0, o, t);
|
|
5797
|
-
|
|
5798
|
-
} else s &&
|
|
5799
|
-
o && !i && s &&
|
|
5800
|
-
const d = s && !i && !o ? Zt(s, a) :
|
|
5982
|
+
l.x = x.x + t.clientLeft, l.y = x.y + t.clientTop;
|
|
5983
|
+
} else s && h();
|
|
5984
|
+
o && !i && s && h();
|
|
5985
|
+
const d = s && !i && !o ? Zt(s, a) : B(0), f = r.left + a.scrollLeft - l.x - d.x, u = r.top + a.scrollTop - l.y - d.y;
|
|
5801
5986
|
return {
|
|
5802
5987
|
x: f,
|
|
5803
5988
|
y: u,
|
|
@@ -5805,39 +5990,39 @@ function xi(h, t, e) {
|
|
|
5805
5990
|
height: r.height
|
|
5806
5991
|
};
|
|
5807
5992
|
}
|
|
5808
|
-
function
|
|
5809
|
-
return
|
|
5993
|
+
function lt(c) {
|
|
5994
|
+
return Y(c).position === "static";
|
|
5810
5995
|
}
|
|
5811
|
-
function
|
|
5812
|
-
if (!
|
|
5996
|
+
function Mt(c, t) {
|
|
5997
|
+
if (!K(c) || Y(c).position === "fixed")
|
|
5813
5998
|
return null;
|
|
5814
5999
|
if (t)
|
|
5815
|
-
return t(
|
|
5816
|
-
let e =
|
|
5817
|
-
return
|
|
6000
|
+
return t(c);
|
|
6001
|
+
let e = c.offsetParent;
|
|
6002
|
+
return F(c) === e && (e = e.ownerDocument.body), e;
|
|
5818
6003
|
}
|
|
5819
|
-
function qt(
|
|
5820
|
-
const e =
|
|
5821
|
-
if (nt(
|
|
6004
|
+
function qt(c, t) {
|
|
6005
|
+
const e = H(c);
|
|
6006
|
+
if (nt(c))
|
|
5822
6007
|
return e;
|
|
5823
|
-
if (!
|
|
5824
|
-
let s = P(
|
|
6008
|
+
if (!K(c)) {
|
|
6009
|
+
let s = P(c);
|
|
5825
6010
|
for (; s && !U(s); ) {
|
|
5826
|
-
if (
|
|
6011
|
+
if (X(s) && !lt(s))
|
|
5827
6012
|
return s;
|
|
5828
6013
|
s = P(s);
|
|
5829
6014
|
}
|
|
5830
6015
|
return e;
|
|
5831
6016
|
}
|
|
5832
|
-
let i =
|
|
5833
|
-
for (; i && Ze(i) &&
|
|
5834
|
-
i =
|
|
5835
|
-
return i && U(i) &&
|
|
6017
|
+
let i = Mt(c, t);
|
|
6018
|
+
for (; i && Ze(i) && lt(i); )
|
|
6019
|
+
i = Mt(i, t);
|
|
6020
|
+
return i && U(i) && lt(i) && !mt(i) ? e : i || ti(c) || e;
|
|
5836
6021
|
}
|
|
5837
|
-
const ui = async function(
|
|
5838
|
-
const t = this.getOffsetParent || qt, e = this.getDimensions, i = await e(
|
|
6022
|
+
const ui = async function(c) {
|
|
6023
|
+
const t = this.getOffsetParent || qt, e = this.getDimensions, i = await e(c.floating);
|
|
5839
6024
|
return {
|
|
5840
|
-
reference: xi(
|
|
6025
|
+
reference: xi(c.reference, await t(c.floating), c.strategy),
|
|
5841
6026
|
floating: {
|
|
5842
6027
|
x: 0,
|
|
5843
6028
|
y: 0,
|
|
@@ -5846,21 +6031,21 @@ const ui = async function(h) {
|
|
|
5846
6031
|
}
|
|
5847
6032
|
};
|
|
5848
6033
|
};
|
|
5849
|
-
function gi(
|
|
5850
|
-
return
|
|
6034
|
+
function gi(c) {
|
|
6035
|
+
return Y(c).direction === "rtl";
|
|
5851
6036
|
}
|
|
5852
6037
|
const wi = {
|
|
5853
6038
|
convertOffsetParentRelativeRectToViewportRelativeRect: oi,
|
|
5854
|
-
getDocumentElement:
|
|
6039
|
+
getDocumentElement: F,
|
|
5855
6040
|
getClippingRect: di,
|
|
5856
6041
|
getOffsetParent: qt,
|
|
5857
6042
|
getElementRects: ui,
|
|
5858
6043
|
getClientRects: ri,
|
|
5859
6044
|
getDimensions: fi,
|
|
5860
6045
|
getScale: G,
|
|
5861
|
-
isElement:
|
|
6046
|
+
isElement: X,
|
|
5862
6047
|
isRTL: gi
|
|
5863
|
-
}, Jt = ze, Qt = $e, te =
|
|
6048
|
+
}, Jt = ze, Qt = $e, te = We, mi = Fe, ee = (c, t, e) => {
|
|
5864
6049
|
const i = /* @__PURE__ */ new Map(), s = {
|
|
5865
6050
|
platform: wi,
|
|
5866
6051
|
...e
|
|
@@ -5868,12 +6053,12 @@ const wi = {
|
|
|
5868
6053
|
...s.platform,
|
|
5869
6054
|
_c: i
|
|
5870
6055
|
};
|
|
5871
|
-
return Ke(
|
|
6056
|
+
return Ke(c, t, {
|
|
5872
6057
|
...s,
|
|
5873
6058
|
platform: o
|
|
5874
6059
|
});
|
|
5875
6060
|
};
|
|
5876
|
-
let
|
|
6061
|
+
let pi = class {
|
|
5877
6062
|
constructor(t) {
|
|
5878
6063
|
n(this, "ctx");
|
|
5879
6064
|
n(this, "enable", !1);
|
|
@@ -5894,7 +6079,7 @@ let Ei = class {
|
|
|
5894
6079
|
borderRadius: "4px",
|
|
5895
6080
|
fontSize: "12px",
|
|
5896
6081
|
...o
|
|
5897
|
-
},
|
|
6082
|
+
}, l = {
|
|
5898
6083
|
position: "absolute",
|
|
5899
6084
|
width: "10px",
|
|
5900
6085
|
height: "10px",
|
|
@@ -5903,7 +6088,7 @@ let Ei = class {
|
|
|
5903
6088
|
transform: "rotate(45deg)",
|
|
5904
6089
|
zIndex: a.zIndex
|
|
5905
6090
|
};
|
|
5906
|
-
Object.assign(this.arrowEl.style,
|
|
6091
|
+
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();
|
|
5907
6092
|
}
|
|
5908
6093
|
init() {
|
|
5909
6094
|
this.floatingEl.addEventListener("mouseleave", () => {
|
|
@@ -5952,10 +6137,10 @@ let Ei = class {
|
|
|
5952
6137
|
placement: t.overflowTooltipPlacement,
|
|
5953
6138
|
middleware: [Qt(), te(), Jt(6), mi({ element: this.arrowEl })]
|
|
5954
6139
|
}).then((a) => {
|
|
5955
|
-
const { x:
|
|
6140
|
+
const { x: l, y: h, placement: d, middlewareData: f } = a;
|
|
5956
6141
|
if (Object.assign(this.floatingEl.style, {
|
|
5957
|
-
top: `${
|
|
5958
|
-
left: `${
|
|
6142
|
+
top: `${h}px`,
|
|
6143
|
+
left: `${l}px`
|
|
5959
6144
|
}), f.arrow) {
|
|
5960
6145
|
const u = f.arrow;
|
|
5961
6146
|
["left", "left-start", "left-end"].includes(d) ? Object.assign(this.arrowEl.style, {
|
|
@@ -5989,7 +6174,7 @@ let Ei = class {
|
|
|
5989
6174
|
this.contentEl.remove(), this.arrowEl.remove(), this.floatingEl.remove();
|
|
5990
6175
|
}
|
|
5991
6176
|
};
|
|
5992
|
-
class
|
|
6177
|
+
class Ei {
|
|
5993
6178
|
constructor(t) {
|
|
5994
6179
|
n(this, "editorEl");
|
|
5995
6180
|
n(this, "inputEl");
|
|
@@ -6020,15 +6205,15 @@ class pi {
|
|
|
6020
6205
|
return;
|
|
6021
6206
|
if (t.code === "Escape" && this.ctx.editing) {
|
|
6022
6207
|
this.cancel = !0;
|
|
6023
|
-
const { focusCell:
|
|
6024
|
-
|
|
6208
|
+
const { focusCell: l } = this.ctx;
|
|
6209
|
+
l && (this.ctx.emit("setSelectorCell", l), this.cellTarget = l), this.doneEdit();
|
|
6025
6210
|
return;
|
|
6026
6211
|
}
|
|
6027
6212
|
if ((t.altKey || t.metaKey) && t.code === "Enter" && this.ctx.editing && this.inputEl) {
|
|
6028
6213
|
t.preventDefault();
|
|
6029
|
-
const
|
|
6030
|
-
this.inputEl.value =
|
|
6031
|
-
` + d, this.inputEl.selectionStart = this.inputEl.selectionEnd =
|
|
6214
|
+
const l = this.inputEl.selectionStart, h = this.inputEl.value.substring(0, l), d = this.inputEl.value.substring(l);
|
|
6215
|
+
this.inputEl.value = h + `
|
|
6216
|
+
` + d, this.inputEl.selectionStart = this.inputEl.selectionEnd = l + 1, this.autoSize();
|
|
6032
6217
|
return;
|
|
6033
6218
|
}
|
|
6034
6219
|
if (t.code === "Tab" && this.ctx.editing) {
|
|
@@ -6080,11 +6265,7 @@ class pi {
|
|
|
6080
6265
|
"F11",
|
|
6081
6266
|
"F12"
|
|
6082
6267
|
].includes(e) || this.startEdit(!0);
|
|
6083
|
-
}), this.ctx.on("
|
|
6084
|
-
this.cellTarget = t;
|
|
6085
|
-
const { xArr: e, yArr: i } = this.ctx.selector;
|
|
6086
|
-
this.selectorArrStr = JSON.stringify(e) + JSON.stringify(i);
|
|
6087
|
-
}), this.ctx.on("cellClick", (t) => {
|
|
6268
|
+
}), this.ctx.on("cellMouseup", (t) => {
|
|
6088
6269
|
if (this.ctx.adjustPositioning || this.ctx.isPointer || !this.isInSelectorRange(t.rowIndex, t.colIndex))
|
|
6089
6270
|
return;
|
|
6090
6271
|
const { xArr: e, yArr: i } = this.ctx.selector, s = JSON.stringify(e) + JSON.stringify(i);
|
|
@@ -6108,8 +6289,8 @@ class pi {
|
|
|
6108
6289
|
});
|
|
6109
6290
|
}
|
|
6110
6291
|
isInSelectorRange(t, e) {
|
|
6111
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a,
|
|
6112
|
-
return !(e < o || e > r || t < a || t >
|
|
6292
|
+
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a, l] = s;
|
|
6293
|
+
return !(e < o || e > r || t < a || t > l);
|
|
6113
6294
|
}
|
|
6114
6295
|
initTextEditor() {
|
|
6115
6296
|
this.inputEl = document.createElement("textarea"), this.inputEl.setAttribute("rows", "1"), this.inputEl.addEventListener("input", this.autoSize.bind(this)), this.inputEl.addEventListener("blur", () => {
|
|
@@ -6131,15 +6312,15 @@ class pi {
|
|
|
6131
6312
|
startEditByInput(t, e = !1) {
|
|
6132
6313
|
const i = e ? null : t.getValue(), { editorType: s } = t;
|
|
6133
6314
|
t.update(), this.ctx.config.ENABLE_MERGE_CELL_LINK && t.updateSpanInfo();
|
|
6134
|
-
let { height: o, width: r, drawY: a, drawX:
|
|
6135
|
-
this.drawX =
|
|
6315
|
+
let { height: o, width: r, drawY: a, drawX: l } = t;
|
|
6316
|
+
this.drawX = l, this.drawY = a;
|
|
6136
6317
|
const {
|
|
6137
|
-
config: { CELL_PADDING:
|
|
6318
|
+
config: { CELL_PADDING: h },
|
|
6138
6319
|
header: d
|
|
6139
6320
|
} = this.ctx;
|
|
6140
6321
|
let f = this.ctx.body.visibleHeight;
|
|
6141
6322
|
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") {
|
|
6142
|
-
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 = `${
|
|
6323
|
+
this.inputEl.style.display = "block", this.inputEl.style.minWidth = `${r - 1}px`, this.inputEl.style.minHeight = `${o - 1}px`, this.inputEl.style.maxHeight = `${f}px`, this.inputEl.style.width = `${r - 1}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${h}px`, i !== null && (this.inputEl.value = i), this.inputEl.focus({ preventScroll: !0 });
|
|
6143
6324
|
const u = this.inputEl.value.length;
|
|
6144
6325
|
this.inputEl.setSelectionRange(u, u);
|
|
6145
6326
|
} else
|
|
@@ -6158,33 +6339,33 @@ class pi {
|
|
|
6158
6339
|
if (!e)
|
|
6159
6340
|
return;
|
|
6160
6341
|
const i = this.ctx.focusCell;
|
|
6161
|
-
if (!i || ["index", "index-selection", "selection"].includes(i.type) || this.enable ||
|
|
6342
|
+
if (!i || ["index", "index-selection", "selection"].includes(i.type) || this.enable || !(i.isVerticalVisible() && i.isHorizontalVisible()))
|
|
6162
6343
|
return;
|
|
6163
6344
|
const { rowKey: o, key: r, editorType: a } = i;
|
|
6164
6345
|
if (a === "none")
|
|
6165
6346
|
return;
|
|
6166
|
-
const
|
|
6167
|
-
i && !
|
|
6347
|
+
const l = this.ctx.database.getReadonly(o, r);
|
|
6348
|
+
i && !l && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = i, this.startEditByInput(this.cellTarget, t), this.ctx.emit("startEdit", this.cellTarget));
|
|
6168
6349
|
}
|
|
6169
6350
|
editCell(t, e) {
|
|
6170
|
-
const i = this.ctx.body.renderRows.find((
|
|
6351
|
+
const i = this.ctx.body.renderRows.find((h) => h.rowIndex === t);
|
|
6171
6352
|
if (!i)
|
|
6172
6353
|
return;
|
|
6173
|
-
const s = i.cells.find((
|
|
6354
|
+
const s = i.cells.find((h) => h.colIndex === e);
|
|
6174
6355
|
if (!s)
|
|
6175
6356
|
return;
|
|
6176
6357
|
this.ctx.emit("setSelectorCell", s);
|
|
6177
6358
|
const o = this.ctx.focusCell;
|
|
6178
6359
|
if (!o || ["index", "index-selection", "selection"].includes(o.type) || this.enable)
|
|
6179
6360
|
return;
|
|
6180
|
-
const { rowKey: r, key: a } = o,
|
|
6181
|
-
o && !
|
|
6361
|
+
const { rowKey: r, key: a } = o, l = this.ctx.database.getReadonly(r, a);
|
|
6362
|
+
o && !l && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = o, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
6182
6363
|
}
|
|
6183
6364
|
doneEdit() {
|
|
6184
|
-
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("
|
|
6365
|
+
this.enable && (this.doneEditByInput(), this.ctx.emit("doneEdit", this.cellTarget), this.enable = !1, this.ctx.editing = !1, this.ctx.containerElement.focus({ preventScroll: !0 }), this.editorEl.style.display = "none", this.ctx.emit("draw"));
|
|
6185
6366
|
}
|
|
6186
6367
|
clearEditor() {
|
|
6187
|
-
this.doneEdit(), this.cellTarget = null, this.selectorArrStr = "", this.ctx.clearSelector(), this.ctx.focusCell = void 0, this.ctx.emit("
|
|
6368
|
+
this.doneEdit(), this.cellTarget = null, this.selectorArrStr = "", this.ctx.clearSelector(), this.ctx.focusCell = void 0, this.ctx.emit("draw");
|
|
6188
6369
|
}
|
|
6189
6370
|
destroy() {
|
|
6190
6371
|
var t;
|
|
@@ -6198,17 +6379,17 @@ class yi {
|
|
|
6198
6379
|
this.ctx = t;
|
|
6199
6380
|
const { EMPTY_TEXT: e, EMPTY_CUSTOM_STYLE: i } = this.ctx.config;
|
|
6200
6381
|
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 }) => {
|
|
6201
|
-
const
|
|
6382
|
+
const l = o + (r + a) / 2, h = {
|
|
6202
6383
|
display: s === "empty" ? "block" : "none",
|
|
6203
6384
|
position: "absolute",
|
|
6204
6385
|
fontSize: "14px",
|
|
6205
6386
|
color: "#666",
|
|
6206
6387
|
left: "50%",
|
|
6207
|
-
top: `${
|
|
6388
|
+
top: `${l}px`,
|
|
6208
6389
|
transform: "translate(-50%, -50%)",
|
|
6209
6390
|
...i
|
|
6210
6391
|
};
|
|
6211
|
-
Object.assign(this.emptyEl.style,
|
|
6392
|
+
Object.assign(this.emptyEl.style, h);
|
|
6212
6393
|
});
|
|
6213
6394
|
}
|
|
6214
6395
|
destroy() {
|
|
@@ -6218,14 +6399,17 @@ class yi {
|
|
|
6218
6399
|
class Ci {
|
|
6219
6400
|
constructor(t) {
|
|
6220
6401
|
n(this, "ctx");
|
|
6221
|
-
this
|
|
6402
|
+
n(this, "observer");
|
|
6403
|
+
this.ctx = t, this.observer = new MutationObserver(() => {
|
|
6404
|
+
this.ctx.overlayerElement.querySelectorAll('[data-auto-height="true"]').length > 0 && this.ctx.emit("drawView");
|
|
6405
|
+
}), this.observer.observe(this.ctx.overlayerElement, { childList: !0, subtree: !0 });
|
|
6222
6406
|
}
|
|
6223
6407
|
draw() {
|
|
6224
6408
|
const t = this.getContainer();
|
|
6225
6409
|
this.ctx.emit("overlayerChange", t);
|
|
6226
6410
|
}
|
|
6227
6411
|
destroy() {
|
|
6228
|
-
this.ctx.emit("overlayerChange", {
|
|
6412
|
+
this.observer && this.observer.disconnect(), this.ctx.emit("overlayerChange", {
|
|
6229
6413
|
style: {},
|
|
6230
6414
|
views: []
|
|
6231
6415
|
});
|
|
@@ -6244,9 +6428,9 @@ class Ci {
|
|
|
6244
6428
|
fixedRightWidth: e,
|
|
6245
6429
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
6246
6430
|
} = this.ctx, { visibleWidth: o, visibleHeight: r, renderCellHeaders: a } = this.ctx.header;
|
|
6247
|
-
let
|
|
6431
|
+
let l = [], h = [], d = [];
|
|
6248
6432
|
a.forEach((g) => {
|
|
6249
|
-
g.render && (g.fixed === "left" ?
|
|
6433
|
+
g.render && (g.fixed === "left" ? h.push(g) : g.fixed === "right" ? d.push(g) : l.push(g));
|
|
6250
6434
|
});
|
|
6251
6435
|
const f = e - i, u = {
|
|
6252
6436
|
key: "left",
|
|
@@ -6258,7 +6442,7 @@ class Ci {
|
|
|
6258
6442
|
width: `${t}px`,
|
|
6259
6443
|
height: `${r}px`
|
|
6260
6444
|
},
|
|
6261
|
-
cells:
|
|
6445
|
+
cells: h
|
|
6262
6446
|
}, x = {
|
|
6263
6447
|
key: "center",
|
|
6264
6448
|
style: {
|
|
@@ -6269,7 +6453,7 @@ class Ci {
|
|
|
6269
6453
|
width: `${o - t - f + 1}px`,
|
|
6270
6454
|
height: `${r}px`
|
|
6271
6455
|
},
|
|
6272
|
-
cells:
|
|
6456
|
+
cells: l
|
|
6273
6457
|
}, w = {
|
|
6274
6458
|
key: "right",
|
|
6275
6459
|
style: {
|
|
@@ -6298,15 +6482,15 @@ class Ci {
|
|
|
6298
6482
|
const t = [], e = [], i = [];
|
|
6299
6483
|
let s = this.ctx.body.renderRows;
|
|
6300
6484
|
this.ctx.config.FOOTER_FIXED || (s = s.concat(this.ctx.footer.renderRows)), s.forEach((g) => {
|
|
6301
|
-
g.cells.forEach((
|
|
6302
|
-
|
|
6485
|
+
g.cells.forEach((p) => {
|
|
6486
|
+
p.cellType === "footer" && (p.render = p.renderFooter), p.render && (p.fixed === "left" ? e.push(p) : p.fixed === "right" ? i.push(p) : t.push(p));
|
|
6303
6487
|
});
|
|
6304
6488
|
});
|
|
6305
6489
|
const {
|
|
6306
6490
|
fixedLeftWidth: o,
|
|
6307
6491
|
fixedRightWidth: r,
|
|
6308
|
-
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX:
|
|
6309
|
-
} = this.ctx, { visibleWidth:
|
|
6492
|
+
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX: l }
|
|
6493
|
+
} = this.ctx, { visibleWidth: h, visibleHeight: d } = this.ctx.body, f = r - a, u = {
|
|
6310
6494
|
key: "left",
|
|
6311
6495
|
style: {
|
|
6312
6496
|
position: "absolute",
|
|
@@ -6324,7 +6508,7 @@ class Ci {
|
|
|
6324
6508
|
top: `${0.5}px`,
|
|
6325
6509
|
left: `${o - 0.5}px`,
|
|
6326
6510
|
overflow: "hidden",
|
|
6327
|
-
width: `${
|
|
6511
|
+
width: `${h - o - f}px`,
|
|
6328
6512
|
height: `${d}px`
|
|
6329
6513
|
},
|
|
6330
6514
|
cells: t
|
|
@@ -6342,11 +6526,11 @@ class Ci {
|
|
|
6342
6526
|
};
|
|
6343
6527
|
return {
|
|
6344
6528
|
type: "body",
|
|
6345
|
-
class: `${
|
|
6529
|
+
class: `${l}-overlayer-body`,
|
|
6346
6530
|
style: {
|
|
6347
6531
|
position: "relative",
|
|
6348
6532
|
overflow: "hidden",
|
|
6349
|
-
width: `${
|
|
6533
|
+
width: `${h}px`,
|
|
6350
6534
|
height: `${d}px`
|
|
6351
6535
|
},
|
|
6352
6536
|
views: [u, x, w]
|
|
@@ -6363,7 +6547,7 @@ class Ci {
|
|
|
6363
6547
|
fixedLeftWidth: s,
|
|
6364
6548
|
fixedRightWidth: o,
|
|
6365
6549
|
config: { SCROLLER_TRACK_SIZE: r, CSS_PREFIX: a }
|
|
6366
|
-
} = this.ctx, { visibleWidth:
|
|
6550
|
+
} = this.ctx, { visibleWidth: l, visibleHeight: h } = this.ctx.footer, d = o - r, f = {
|
|
6367
6551
|
key: "left",
|
|
6368
6552
|
style: {
|
|
6369
6553
|
position: "absolute",
|
|
@@ -6371,7 +6555,7 @@ class Ci {
|
|
|
6371
6555
|
left: `${0.5}px`,
|
|
6372
6556
|
overflow: "hidden",
|
|
6373
6557
|
width: `${s}px`,
|
|
6374
|
-
height: `${
|
|
6558
|
+
height: `${h}px`
|
|
6375
6559
|
},
|
|
6376
6560
|
cells: e
|
|
6377
6561
|
}, u = {
|
|
@@ -6381,8 +6565,8 @@ class Ci {
|
|
|
6381
6565
|
top: `${0.5}px`,
|
|
6382
6566
|
left: `${s - 0.5}px`,
|
|
6383
6567
|
overflow: "hidden",
|
|
6384
|
-
width: `${
|
|
6385
|
-
height: `${
|
|
6568
|
+
width: `${l - s - d}px`,
|
|
6569
|
+
height: `${h}px`
|
|
6386
6570
|
},
|
|
6387
6571
|
cells: t
|
|
6388
6572
|
}, x = {
|
|
@@ -6393,7 +6577,7 @@ class Ci {
|
|
|
6393
6577
|
right: `${0.5}px`,
|
|
6394
6578
|
overflow: "hidden",
|
|
6395
6579
|
width: `${d}px`,
|
|
6396
|
-
height: `${
|
|
6580
|
+
height: `${h}px`
|
|
6397
6581
|
},
|
|
6398
6582
|
cells: i
|
|
6399
6583
|
};
|
|
@@ -6403,8 +6587,8 @@ class Ci {
|
|
|
6403
6587
|
style: {
|
|
6404
6588
|
position: "relative",
|
|
6405
6589
|
overflow: "hidden",
|
|
6406
|
-
width: `${
|
|
6407
|
-
height: `${
|
|
6590
|
+
width: `${l}px`,
|
|
6591
|
+
height: `${h}px`
|
|
6408
6592
|
},
|
|
6409
6593
|
views: [f, u, x]
|
|
6410
6594
|
};
|
|
@@ -6421,8 +6605,8 @@ class bi {
|
|
|
6421
6605
|
this.ctx.on("cellContextMenuClick", (t, e) => {
|
|
6422
6606
|
if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
|
|
6423
6607
|
e.preventDefault();
|
|
6424
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a,
|
|
6425
|
-
|
|
6608
|
+
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a, l] = s, { rowIndex: h, colIndex: d } = t;
|
|
6609
|
+
h >= a && h <= l && d >= o && d <= r || this.ctx.emit("setSelectorCell", t, e);
|
|
6426
6610
|
const u = {
|
|
6427
6611
|
getBoundingClientRect: () => ({
|
|
6428
6612
|
width: 0,
|
|
@@ -6519,7 +6703,7 @@ class Si {
|
|
|
6519
6703
|
o,
|
|
6520
6704
|
r
|
|
6521
6705
|
);
|
|
6522
|
-
this.ctx = new
|
|
6706
|
+
this.ctx = new Re(a, this.options), this.header = new Se(this.ctx), this.footer = new _e(this.ctx), this.body = new ve(this.ctx), this.scroller = new Ie(this.ctx), this.selector = new Te(this.ctx), this.autofill = new Oe(this.ctx), this.tooltip = new pi(this.ctx), this.empty = new yi(this.ctx), this.editor = new Ei(this.ctx), this.overlayer = new Ci(this.ctx), this.contextMenu = new bi(this.ctx), this.ctx.on("draw", () => {
|
|
6523
6707
|
this.draw();
|
|
6524
6708
|
}), this.ctx.on("drawView", () => {
|
|
6525
6709
|
this.draw(!0);
|
|
@@ -6527,17 +6711,17 @@ class Si {
|
|
|
6527
6711
|
}
|
|
6528
6712
|
createContainer(t, e, i, s, o) {
|
|
6529
6713
|
t.className = "e-virt-table-container";
|
|
6530
|
-
const r = document.createElement("div"), a = document.createElement("canvas"),
|
|
6531
|
-
r.className = "e-virt-table-stage", t.tabIndex = 0, a.className = "e-virt-table-canvas",
|
|
6532
|
-
const
|
|
6533
|
-
|
|
6714
|
+
const r = document.createElement("div"), a = document.createElement("canvas"), l = e || document.createElement("div");
|
|
6715
|
+
r.className = "e-virt-table-stage", t.tabIndex = 0, a.className = "e-virt-table-canvas", l.className = "e-virt-table-overlayer";
|
|
6716
|
+
const h = i || document.createElement("div");
|
|
6717
|
+
h.className = "e-virt-table-editor";
|
|
6534
6718
|
const d = s, f = o;
|
|
6535
|
-
return r.appendChild(a), r.appendChild(
|
|
6719
|
+
return r.appendChild(a), r.appendChild(l), t.appendChild(r), {
|
|
6536
6720
|
containerElement: t,
|
|
6537
6721
|
stageElement: r,
|
|
6538
6722
|
canvasElement: a,
|
|
6539
|
-
overlayerElement:
|
|
6540
|
-
editorElement:
|
|
6723
|
+
overlayerElement: l,
|
|
6724
|
+
editorElement: h,
|
|
6541
6725
|
emptyElement: d,
|
|
6542
6726
|
contextMenuElement: f
|
|
6543
6727
|
};
|
|
@@ -6624,15 +6808,15 @@ class Si {
|
|
|
6624
6808
|
return new Promise(async (i, s) => {
|
|
6625
6809
|
let o = [];
|
|
6626
6810
|
for (let r = 0; r < t.length; r++) {
|
|
6627
|
-
const { rowKey: a, key:
|
|
6628
|
-
Array.isArray(
|
|
6811
|
+
const { rowKey: a, key: l } = t[r], h = await this.ctx.database.getValidator(a, l);
|
|
6812
|
+
Array.isArray(h) && h.length && o.push(h);
|
|
6629
6813
|
}
|
|
6630
6814
|
if (o.length) {
|
|
6631
6815
|
if (s(o), e) {
|
|
6632
6816
|
const [r] = o;
|
|
6633
6817
|
if (Array.isArray(r) && r.length) {
|
|
6634
|
-
const [a] = r, { rowKey:
|
|
6635
|
-
this.scrollToRowkey(
|
|
6818
|
+
const [a] = r, { rowKey: l, key: h } = a;
|
|
6819
|
+
this.scrollToRowkey(l), this.scrollToColkey(h);
|
|
6636
6820
|
}
|
|
6637
6821
|
}
|
|
6638
6822
|
this.ctx.emit("draw");
|
|
@@ -6649,12 +6833,12 @@ class Si {
|
|
|
6649
6833
|
if (t && Array.isArray(s) && s.length) {
|
|
6650
6834
|
const [o] = s;
|
|
6651
6835
|
if (Array.isArray(o) && o.length) {
|
|
6652
|
-
const [r] = o, { rowKey: a, key:
|
|
6653
|
-
if (
|
|
6654
|
-
const { parentRowKeys: d = [] } =
|
|
6836
|
+
const [r] = o, { rowKey: a, key: l } = r, h = this.ctx.database.getRowForRowKey(a);
|
|
6837
|
+
if (h) {
|
|
6838
|
+
const { parentRowKeys: d = [] } = h;
|
|
6655
6839
|
d && d.length && this.setExpandRowKeys(d, !0);
|
|
6656
6840
|
}
|
|
6657
|
-
this.scrollToRowkey(a), this.scrollToColkey(
|
|
6841
|
+
this.scrollToRowkey(a), this.scrollToColkey(l);
|
|
6658
6842
|
}
|
|
6659
6843
|
}
|
|
6660
6844
|
i(s);
|
|
@@ -6679,7 +6863,7 @@ class Si {
|
|
|
6679
6863
|
let o = [];
|
|
6680
6864
|
for (let r = 0; r < i.length; r++)
|
|
6681
6865
|
for (let a = 0; a < s.length; a++) {
|
|
6682
|
-
const
|
|
6866
|
+
const l = this.ctx.database.getRowKeyByItem(i[r]), d = s[a].key, f = await this.ctx.database.getValidator(l, d);
|
|
6683
6867
|
Array.isArray(f) && f.length && o.push(f);
|
|
6684
6868
|
}
|
|
6685
6869
|
o.length ? (e(o), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
|
|
@@ -6763,7 +6947,7 @@ class Si {
|
|
|
6763
6947
|
getUtils() {
|
|
6764
6948
|
return {
|
|
6765
6949
|
mergeColCell: de,
|
|
6766
|
-
mergeRowCell:
|
|
6950
|
+
mergeRowCell: ce,
|
|
6767
6951
|
getSpanArrByRow: kt,
|
|
6768
6952
|
getSpanObjByColumn: Xt
|
|
6769
6953
|
};
|