e-virt-table 1.2.27 → 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 +1043 -873
- 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 +22 -0
- 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,14 +1,14 @@
|
|
|
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) {
|
|
@@ -18,7 +18,7 @@ class re {
|
|
|
18
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,
|
|
@@ -40,7 +40,7 @@ class re {
|
|
|
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`
|
|
@@ -51,7 +51,7 @@ class re {
|
|
|
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(l = []) {
|
|
|
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(l = [], 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 he(
|
|
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((h, d) => `${h}${o[d] ?? ""}`, "") || o[t],
|
|
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 le(l, 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(l, 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(l) {
|
|
|
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(h,
|
|
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(h, a - 1,
|
|
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,7 +427,7 @@ class xt extends Yt {
|
|
|
421
427
|
rowspan: o = 1,
|
|
422
428
|
relationRowKeys: r,
|
|
423
429
|
relationColKeys: a,
|
|
424
|
-
mergeRow:
|
|
430
|
+
mergeRow: l = !1,
|
|
425
431
|
mergeCol: h = !1
|
|
426
432
|
} = i({
|
|
427
433
|
row: this.row,
|
|
@@ -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 = h, this.mergeRow =
|
|
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,40 +508,43 @@ 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
|
|
521
|
+
const l = this.ctx.database.getRowForRowKey(i), { expand: h = !1, hasChildren: d = !1, expandLoading: f = !1, level: u = 0 } = l || {};
|
|
513
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 = h ? v :
|
|
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],
|
|
@@ -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, h,
|
|
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,7 +584,7 @@ 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:
|
|
587
|
+
FOOTER_TEXT_COLOR: l,
|
|
579
588
|
FOOTER_BG_COLOR: h,
|
|
580
589
|
HIGHLIGHT_SELECTED_ROW: d,
|
|
581
590
|
HIGHLIGHT_SELECTED_ROW_COLOR: f,
|
|
@@ -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 = h,
|
|
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,12 +626,12 @@ 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
637
|
const d = this.ctx.database.getRowSelectable(h), { CHECKBOX_SIZE: f = 0, CELL_PADDING: u } = this.ctx.config;
|
|
@@ -631,19 +640,19 @@ class xt extends Yt {
|
|
|
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
649
|
const y = this.ctx.database.getTreeSelectionState(h);
|
|
641
|
-
y.indeterminate && d ? (g = this.ctx.icons.get("checkbox-indeterminate"),
|
|
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
652
|
const y = this.ctx.database.getRowSelection(h);
|
|
644
|
-
y && d ? (g = this.ctx.icons.get("checkbox-check"),
|
|
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))
|
|
@@ -661,18 +670,41 @@ class xt extends Yt {
|
|
|
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,8 +908,8 @@ 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
915
|
}), this.operation && this.rowIndex >= h && this.rowIndex <= d && this.ctx.paint.drawRect(this.drawX, this.drawY, this.visibleWidth, this.visibleHeight, {
|
|
@@ -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:
|
|
940
|
+
const { drawX: i, drawY: s, rowIndex: o, colIndex: r, height: a, width: l } = this;
|
|
905
941
|
let h = i, d = s;
|
|
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([h +
|
|
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([h +
|
|
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([h +
|
|
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([h + 1, d +
|
|
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
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,17 +1248,17 @@ class ue {
|
|
|
1189
1248
|
*/
|
|
1190
1249
|
applySingleColumnSort(t, e, i, s) {
|
|
1191
1250
|
return t.sort((o, r) => {
|
|
1192
|
-
const a = o[e],
|
|
1251
|
+
const a = o[e], l = r[e];
|
|
1193
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(
|
|
1256
|
+
const d = Number(a) || 0, f = Number(l) || 0;
|
|
1198
1257
|
h = d - f;
|
|
1199
1258
|
} else if (s === "string") {
|
|
1200
|
-
const d = String(a || ""), f = String(
|
|
1259
|
+
const d = String(a || ""), f = String(l || "");
|
|
1201
1260
|
h = d.localeCompare(f);
|
|
1202
|
-
} else s === "date" && (h = xe(a,
|
|
1261
|
+
} else s === "date" && (h = xe(a, l));
|
|
1203
1262
|
return i === "asc" ? h : -h;
|
|
1204
1263
|
});
|
|
1205
1264
|
}
|
|
@@ -1312,27 +1371,27 @@ 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 (h = h.filter((x) => !
|
|
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
|
}
|
|
@@ -1340,11 +1399,11 @@ class ue {
|
|
|
1340
1399
|
return;
|
|
1341
1400
|
const { BEFORE_VALUE_CHANGE_METHOD: d } = this.ctx.config;
|
|
1342
1401
|
s === "none" && typeof d == "function" && (h = await d(h), r = !1), h.forEach((x) => {
|
|
1343
|
-
const { value: w, rowKey: m, key: g } = 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
|
});
|
|
@@ -1376,14 +1435,14 @@ 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 h =
|
|
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
1442
|
oldValue: h,
|
|
1384
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
1447
|
this.originalDataMap.has(f) || this.originalDataMap.set(f, h);
|
|
1389
1448
|
const u = this.originalDataMap.get(f), x = this.getRowDataItemForRowKey(t);
|
|
@@ -1434,7 +1493,7 @@ class ue {
|
|
|
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,
|
|
@@ -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
|
}
|
|
@@ -1520,8 +1579,8 @@ class ue {
|
|
|
1520
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 设置选中状态
|
|
@@ -1555,19 +1614,19 @@ class ue {
|
|
|
1555
1614
|
let r = !1, a = s;
|
|
1556
1615
|
if (this.ctx.config.TREE_SELECT_MODE === "auto") {
|
|
1557
1616
|
const h = (g) => {
|
|
1558
|
-
const
|
|
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
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
1625
|
const h = (g) => {
|
|
1567
|
-
const
|
|
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
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);
|
|
@@ -1681,7 +1740,7 @@ 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,
|
|
@@ -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,9 +1875,9 @@ 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 (
|
|
1880
|
+
if (l) {
|
|
1821
1881
|
const h = {
|
|
1822
1882
|
row: s.item,
|
|
1823
1883
|
rowIndex: s.rowIndex,
|
|
@@ -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,7 +1910,7 @@ class ue {
|
|
|
1850
1910
|
row: o,
|
|
1851
1911
|
value: r,
|
|
1852
1912
|
colIndex: a,
|
|
1853
|
-
relationRowKeys:
|
|
1913
|
+
relationRowKeys: l,
|
|
1854
1914
|
relationColKeys: h,
|
|
1855
1915
|
rowspan: d,
|
|
1856
1916
|
height: f,
|
|
@@ -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,10 +2051,10 @@ 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
2060
|
this.validationErrorMap.set(o, h);
|
|
@@ -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,11 +2360,11 @@ 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 [h, d, f, u] = typeof
|
|
2367
|
+
const [h, d, f, u] = typeof l == "number" ? [l, l, l, l] : l;
|
|
2300
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();
|
|
@@ -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:
|
|
2387
|
+
align: l = "center",
|
|
2319
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 = h, this.ctx.
|
|
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
|
{
|
|
@@ -2796,15 +2953,15 @@ class Ce {
|
|
|
2796
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
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
|
};
|
|
@@ -2815,8 +2972,8 @@ class Ce {
|
|
|
2815
2972
|
}
|
|
2816
2973
|
}
|
|
2817
2974
|
class ht extends Yt {
|
|
2818
|
-
constructor(e, i, s, o, r, a,
|
|
2819
|
-
super(e, s, o, r, a, "header",
|
|
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 ht 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 ht 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 ht 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 ht 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 ht 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 ht 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 ht 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" ?
|
|
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);
|
|
2962
3118
|
let h = this.ctx.icons.get("checkbox-uncheck"), d = "checkbox-uncheck";
|
|
2963
|
-
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 =
|
|
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 ht 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, h = 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 = h, 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,6 +3188,15 @@ 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;
|
|
@@ -3150,7 +3305,7 @@ class be {
|
|
|
3150
3305
|
t.drawTreeImageHeight
|
|
3151
3306
|
))
|
|
3152
3307
|
return;
|
|
3153
|
-
const
|
|
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;
|
|
3154
3309
|
if (f && u && !h && !d)
|
|
3155
3310
|
typeof u == "function" && (this.ctx.database.expandLoading(t.rowKey, !0), u({
|
|
3156
3311
|
row: t.row,
|
|
@@ -3180,8 +3335,8 @@ class be {
|
|
|
3180
3335
|
))
|
|
3181
3336
|
return;
|
|
3182
3337
|
const a = this.ctx.database.getSortState(t.key);
|
|
3183
|
-
let
|
|
3184
|
-
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);
|
|
3185
3340
|
}
|
|
3186
3341
|
/**
|
|
3187
3342
|
* 图标进入和离开事件,包括选中,展开,提示图标等
|
|
@@ -3264,15 +3419,15 @@ class be {
|
|
|
3264
3419
|
if (this.isInsideBody(e))
|
|
3265
3420
|
for (const r of i) {
|
|
3266
3421
|
const a = r.fixedCells.concat(r.noFixedCells);
|
|
3267
|
-
for (const
|
|
3268
|
-
const h =
|
|
3422
|
+
for (const l of a) {
|
|
3423
|
+
const h = l.getDrawX(), d = l.getDrawY();
|
|
3269
3424
|
if (o) {
|
|
3270
|
-
if (t > h && t < h +
|
|
3271
|
-
s(
|
|
3425
|
+
if (t > h && t < h + l.visibleWidth && e > d && e < d + l.visibleHeight) {
|
|
3426
|
+
s(l);
|
|
3272
3427
|
return;
|
|
3273
3428
|
}
|
|
3274
|
-
} else if (t > h && t < h +
|
|
3275
|
-
s(
|
|
3429
|
+
} else if (t > h && t < h + l.width && e > d && e < d + l.height) {
|
|
3430
|
+
s(l);
|
|
3276
3431
|
return;
|
|
3277
3432
|
}
|
|
3278
3433
|
}
|
|
@@ -3294,7 +3449,7 @@ class be {
|
|
|
3294
3449
|
this.resizeObserver.unobserve(this.ctx.stageElement), this.mutationObserver.disconnect();
|
|
3295
3450
|
}
|
|
3296
3451
|
}
|
|
3297
|
-
class
|
|
3452
|
+
class Re {
|
|
3298
3453
|
constructor(t, e) {
|
|
3299
3454
|
n(this, "eventBus");
|
|
3300
3455
|
n(this, "eventBrowser");
|
|
@@ -3411,19 +3566,19 @@ class Ie {
|
|
|
3411
3566
|
canvasElement: o,
|
|
3412
3567
|
overlayerElement: r,
|
|
3413
3568
|
editorElement: a,
|
|
3414
|
-
emptyElement:
|
|
3569
|
+
emptyElement: l,
|
|
3415
3570
|
contextMenuElement: h
|
|
3416
3571
|
} = t;
|
|
3417
|
-
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);
|
|
3418
3573
|
}
|
|
3419
3574
|
setConfig(t) {
|
|
3420
|
-
this.config = new
|
|
3575
|
+
this.config = new Rt(t);
|
|
3421
3576
|
}
|
|
3422
3577
|
setItemValueByEditor(t, e, i, s = !0, o = !0, r = !0) {
|
|
3423
3578
|
if (this.config.ENABLE_MERGE_CELL_LINK) {
|
|
3424
3579
|
const a = this.database.getVirtualBodyCellByKey(t, e);
|
|
3425
3580
|
if (a && (a.mergeRow || a.mergeCol)) {
|
|
3426
|
-
const { dataList:
|
|
3581
|
+
const { dataList: l } = a.getSpanInfo(), h = l.map((d) => ({ ...d, value: i }));
|
|
3427
3582
|
this.database.batchSetItemValue(h, s, r);
|
|
3428
3583
|
return;
|
|
3429
3584
|
}
|
|
@@ -3436,9 +3591,9 @@ class Ie {
|
|
|
3436
3591
|
t.forEach((o) => {
|
|
3437
3592
|
const r = this.database.getRowIndexForRowKey(o.rowKey), a = this.database.getColIndexForKey(o.key);
|
|
3438
3593
|
if (r === void 0 || a === void 0) return;
|
|
3439
|
-
const
|
|
3440
|
-
if (
|
|
3441
|
-
const { dataList: h } =
|
|
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 }));
|
|
3442
3597
|
s.push(...d);
|
|
3443
3598
|
}
|
|
3444
3599
|
}), this.database.batchSetItemValue(s, e, i);
|
|
@@ -3483,7 +3638,7 @@ class Ie {
|
|
|
3483
3638
|
for (let o = 0; o <= e[1] - e[0]; o++) {
|
|
3484
3639
|
const r = [];
|
|
3485
3640
|
for (let a = 0; a <= i[1] - i[0]; a++) {
|
|
3486
|
-
const
|
|
3641
|
+
const l = o + e[0], h = a + i[0], d = this.database.getVirtualBodyCell(l, h);
|
|
3487
3642
|
d && (d.selectorCellValueType === "displayText" ? r.push(d.displayText) : r.push(d.getValue()));
|
|
3488
3643
|
}
|
|
3489
3644
|
s += `${r.join(" ")}\r`, t.push(r);
|
|
@@ -3604,8 +3759,8 @@ class St {
|
|
|
3604
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;
|
|
3605
3760
|
let a = 0;
|
|
3606
3761
|
if (this.type === "horizontal" ? a = s - this.clientX : a = o - this.clientY, this.isDragging && a !== 0) {
|
|
3607
|
-
let
|
|
3608
|
-
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));
|
|
3609
3764
|
}
|
|
3610
3765
|
}
|
|
3611
3766
|
isPointInElement(t, e, i, s, o, r) {
|
|
@@ -3631,21 +3786,21 @@ class St {
|
|
|
3631
3786
|
stageHeight: i,
|
|
3632
3787
|
stageWidth: s,
|
|
3633
3788
|
config: { SCROLLER_TRACK_SIZE: o = 0, SCROLLER_SIZE: r = 0, BORDER: a }
|
|
3634
|
-
} = this.ctx,
|
|
3789
|
+
} = this.ctx, l = s, h = i, d = e.height, f = e.width, u = t.height, x = this.ctx.footer.height;
|
|
3635
3790
|
if (this.type === "vertical") {
|
|
3636
|
-
this.visibleDistance = h - o - d, this.distance = u - this.visibleDistance + x, this.trackX =
|
|
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;
|
|
3637
3792
|
const w = this.distance ? this.visibleDistance / (u + x) : 0;
|
|
3638
3793
|
let m = Math.floor(w * this.visibleDistance);
|
|
3639
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));
|
|
3640
3795
|
} else {
|
|
3641
|
-
this.visibleDistance =
|
|
3642
|
-
|
|
3796
|
+
this.visibleDistance = l - o, this.distance = f - this.visibleDistance, this.splitPoints = [
|
|
3797
|
+
l - o,
|
|
3643
3798
|
h - o,
|
|
3644
|
-
|
|
3799
|
+
l - o,
|
|
3645
3800
|
h
|
|
3646
3801
|
];
|
|
3647
3802
|
const w = a ? 0 : 0.5;
|
|
3648
|
-
this.trackX = 0, this.trackY = h - o + w, this.trackWidth =
|
|
3803
|
+
this.trackX = 0, this.trackY = h - o + w, this.trackWidth = l, this.trackHeight = o;
|
|
3649
3804
|
const m = this.distance ? this.visibleDistance / f : 0;
|
|
3650
3805
|
let g = Math.floor(m * this.visibleDistance);
|
|
3651
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));
|
|
@@ -3669,7 +3824,7 @@ class St {
|
|
|
3669
3824
|
}), this.ctx.scrollerFocus = this.isFocus;
|
|
3670
3825
|
}
|
|
3671
3826
|
}
|
|
3672
|
-
class
|
|
3827
|
+
class Ie {
|
|
3673
3828
|
constructor(t) {
|
|
3674
3829
|
n(this, "ctx");
|
|
3675
3830
|
n(this, "verticalScrollbar");
|
|
@@ -3794,9 +3949,9 @@ class Se {
|
|
|
3794
3949
|
this.columnIndex = 0, this.resizeNum = 0, this.render(r, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
3795
3950
|
const a = this.ctx.containerElement.getBoundingClientRect();
|
|
3796
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;
|
|
3797
|
-
const
|
|
3798
|
-
if (this.resizeNum &&
|
|
3799
|
-
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;
|
|
3800
3955
|
this.resizeAllColumn(f);
|
|
3801
3956
|
}
|
|
3802
3957
|
const h = this.fixedLeftCellHeaders.filter((f) => !f.hasChildren);
|
|
@@ -3821,8 +3976,8 @@ class Se {
|
|
|
3821
3976
|
} = this.ctx;
|
|
3822
3977
|
if (this.isResizing && this.resizeTarget) {
|
|
3823
3978
|
const o = this.resizeTarget.width, r = this.resizeTarget.minWidth, a = this.resizeTarget.maxWidth;
|
|
3824
|
-
let
|
|
3825
|
-
|
|
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");
|
|
3826
3981
|
} else {
|
|
3827
3982
|
if (this.resizeTarget = null, this.isMouseDown)
|
|
3828
3983
|
return;
|
|
@@ -3833,9 +3988,9 @@ class Se {
|
|
|
3833
3988
|
this.ctx.stageElement.style.cursor === "col-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3834
3989
|
const o = [...this.renderFixedCellHeaders, ...this.renderCenterCellHeaders];
|
|
3835
3990
|
for (const r of o) {
|
|
3836
|
-
const { offsetX: a, offsetY:
|
|
3991
|
+
const { offsetX: a, offsetY: l } = this.ctx.getOffset(e), h = a, d = r.getDrawX();
|
|
3837
3992
|
h > d + r.width - 5 && h < d + r.width + 4 && h < i - 4 && // 视窗中最后一列不允许调整宽
|
|
3838
|
-
r.colspan <= 1 && this.ctx.isTarget(e) &&
|
|
3993
|
+
r.colspan <= 1 && this.ctx.isTarget(e) && l <= this.height && (this.ctx.stageElement.style.cursor = "col-resize", this.resizeTarget = r);
|
|
3839
3994
|
}
|
|
3840
3995
|
}
|
|
3841
3996
|
}));
|
|
@@ -3889,10 +4044,10 @@ class Se {
|
|
|
3889
4044
|
let s = e;
|
|
3890
4045
|
const { HEADER_HEIGHT: o = 0 } = this.ctx.config;
|
|
3891
4046
|
for (let r = 0; r < i; r++) {
|
|
3892
|
-
const a = t[r],
|
|
4047
|
+
const a = t[r], l = o * (a.rowspan || 0), h = o * (a.level || 0);
|
|
3893
4048
|
let { minWidth: d, maxWidth: f } = a, u = a.width || 100;
|
|
3894
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));
|
|
3895
|
-
const x = new ht(this.ctx, this.columnIndex, s, h, u,
|
|
4050
|
+
const x = new ht(this.ctx, this.columnIndex, s, h, u, l, a);
|
|
3896
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;
|
|
3897
4052
|
}
|
|
3898
4053
|
}
|
|
@@ -3924,8 +4079,8 @@ class Se {
|
|
|
3924
4079
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3925
4080
|
colorEnd: "rgba(0,0,0,0)"
|
|
3926
4081
|
}), i < Math.floor(s.width - o - 1) && e !== a) {
|
|
3927
|
-
const
|
|
3928
|
-
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, {
|
|
3929
4084
|
fillColor: r,
|
|
3930
4085
|
side: "left",
|
|
3931
4086
|
shadowWidth: 4,
|
|
@@ -3967,7 +4122,7 @@ class Se {
|
|
|
3967
4122
|
}
|
|
3968
4123
|
}
|
|
3969
4124
|
class Bt {
|
|
3970
|
-
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") {
|
|
3971
4126
|
n(this, "ctx");
|
|
3972
4127
|
n(this, "x", 0);
|
|
3973
4128
|
n(this, "y", 0);
|
|
@@ -3976,29 +4131,35 @@ class Bt {
|
|
|
3976
4131
|
n(this, "cells", []);
|
|
3977
4132
|
n(this, "fixedCells", []);
|
|
3978
4133
|
n(this, "noFixedCells", []);
|
|
4134
|
+
n(this, "calculatedHeightCells", []);
|
|
3979
4135
|
n(this, "rowIndex", 0);
|
|
3980
4136
|
n(this, "rowKey", "");
|
|
3981
4137
|
n(this, "rowType", "body");
|
|
3982
4138
|
n(this, "data");
|
|
3983
|
-
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();
|
|
3984
4141
|
}
|
|
3985
4142
|
update() {
|
|
3986
|
-
const { header: t } = this.ctx, e = [], i = [], s = [];
|
|
3987
|
-
t.renderLeafCellHeaders.forEach((
|
|
3988
|
-
const
|
|
4143
|
+
const { header: t } = this.ctx, e = [], i = [], s = [], o = [];
|
|
4144
|
+
t.renderLeafCellHeaders.forEach((r) => {
|
|
4145
|
+
const a = new xt(
|
|
3989
4146
|
this.ctx,
|
|
3990
4147
|
this.rowIndex,
|
|
3991
|
-
|
|
3992
|
-
|
|
4148
|
+
r.colIndex,
|
|
4149
|
+
r.x,
|
|
3993
4150
|
this.y,
|
|
3994
|
-
|
|
4151
|
+
r.width,
|
|
3995
4152
|
this.height,
|
|
3996
|
-
|
|
4153
|
+
r.column,
|
|
3997
4154
|
this.data,
|
|
3998
4155
|
this.rowType
|
|
3999
4156
|
);
|
|
4000
|
-
|
|
4001
|
-
}), 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;
|
|
4002
4163
|
}
|
|
4003
4164
|
drawCenter() {
|
|
4004
4165
|
this.noFixedCells.forEach((t) => {
|
|
@@ -4058,7 +4219,7 @@ class ve {
|
|
|
4058
4219
|
FOOTER_FIXED: o,
|
|
4059
4220
|
SCROLLER_TRACK_SIZE: r = 0,
|
|
4060
4221
|
HEIGHT: a,
|
|
4061
|
-
EMPTY_BODY_HEIGHT:
|
|
4222
|
+
EMPTY_BODY_HEIGHT: l = 0,
|
|
4062
4223
|
MAX_HEIGHT: h = 0,
|
|
4063
4224
|
ENABLE_OFFSET_HEIGHT: d = 0,
|
|
4064
4225
|
OFFSET_HEIGHT: f = 0,
|
|
@@ -4071,32 +4232,32 @@ class ve {
|
|
|
4071
4232
|
const { data: x, sumHeight: w } = s.getData();
|
|
4072
4233
|
this.height = w, this.data = x, this.width = e.width, this.visibleWidth = this.ctx.stageWidth - r;
|
|
4073
4234
|
const m = this.ctx.footer.height;
|
|
4074
|
-
!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);
|
|
4075
4236
|
let g = this.height + e.height + r;
|
|
4076
4237
|
g += m;
|
|
4077
|
-
let
|
|
4078
|
-
const y = window.innerHeight, { top:
|
|
4079
|
-
if (y >
|
|
4080
|
-
const
|
|
4081
|
-
|
|
4082
|
-
} else this.data.length && a ?
|
|
4083
|
-
|
|
4084
|
-
let
|
|
4085
|
-
o ? this.visibleHeight =
|
|
4086
|
-
const C = window.devicePixelRatio || 1,
|
|
4087
|
-
t.width = Math.round(
|
|
4088
|
-
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";
|
|
4089
4250
|
this.ctx.emit("emptyChange", {
|
|
4090
|
-
isEmpty:
|
|
4091
|
-
type:
|
|
4251
|
+
isEmpty: _,
|
|
4252
|
+
type: _,
|
|
4092
4253
|
headerHeight: e.height,
|
|
4093
4254
|
bodyHeight: this.height,
|
|
4094
4255
|
footerHeight: m,
|
|
4095
4256
|
width: this.width,
|
|
4096
|
-
height: this.data.length ? 0 :
|
|
4257
|
+
height: this.data.length ? 0 : l + m
|
|
4097
4258
|
});
|
|
4098
|
-
const S = Math.round(t.width / C * 1e4) / 1e4,
|
|
4099
|
-
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);
|
|
4100
4261
|
}
|
|
4101
4262
|
// 调整行的高度
|
|
4102
4263
|
initResizeRow() {
|
|
@@ -4116,14 +4277,15 @@ class ve {
|
|
|
4116
4277
|
}), this.ctx.on("mousemove", (e) => {
|
|
4117
4278
|
if (this.ctx.editing) return;
|
|
4118
4279
|
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), o = i, r = s, a = e.clientY, {
|
|
4119
|
-
stageHeight:
|
|
4280
|
+
stageHeight: l,
|
|
4120
4281
|
scrollY: h,
|
|
4121
4282
|
config: { RESIZE_ROW_MIN_HEIGHT: d = 0 }
|
|
4122
4283
|
} = this.ctx;
|
|
4123
4284
|
if (this.isResizing && this.resizeTarget) {
|
|
4124
4285
|
const f = this.resizeTarget.height;
|
|
4125
4286
|
let u = a - this.clientY;
|
|
4126
|
-
|
|
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");
|
|
4127
4289
|
} else {
|
|
4128
4290
|
if (this.resizeTarget = null, this.isMouseDown)
|
|
4129
4291
|
return;
|
|
@@ -4136,7 +4298,7 @@ class ve {
|
|
|
4136
4298
|
this.ctx.stageElement.style.cursor === "row-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
4137
4299
|
for (let f = 0; f < this.renderRows.length; f++) {
|
|
4138
4300
|
const u = this.renderRows[f];
|
|
4139
|
-
if (o > u.y - h + u.height - 1.5 && o < u.y - h + u.height + 1.5 && o <
|
|
4301
|
+
if (o > u.y - h + u.height - 1.5 && o < u.y - h + u.height + 1.5 && o < l - 4)
|
|
4140
4302
|
for (let w = 0; w < u.cells.length; w++) {
|
|
4141
4303
|
const m = u.cells[w];
|
|
4142
4304
|
r > m.drawX + 10 && r < m.drawX + m.width - 10 && m.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = u);
|
|
@@ -4185,8 +4347,8 @@ class ve {
|
|
|
4185
4347
|
colorStart: "rgba(0,0,0,0.1)",
|
|
4186
4348
|
colorEnd: "rgba(0,0,0,0)"
|
|
4187
4349
|
}), i < Math.floor(s.width - o - 1) && e !== a) {
|
|
4188
|
-
const
|
|
4189
|
-
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, {
|
|
4190
4352
|
fillColor: r,
|
|
4191
4353
|
side: "left",
|
|
4192
4354
|
shadowWidth: 4,
|
|
@@ -4214,12 +4376,12 @@ class ve {
|
|
|
4214
4376
|
config: { CELL_HEIGHT: s }
|
|
4215
4377
|
} = this.ctx, o = i, { data: r, positions: a } = e.getData();
|
|
4216
4378
|
this.ctx.maxRowIndex = r.length - 1;
|
|
4217
|
-
let
|
|
4218
|
-
if (h === -1 && (h = this.ctx.maxRowIndex),
|
|
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) {
|
|
4219
4381
|
const f = Math.floor(this.visibleHeight / s);
|
|
4220
|
-
|
|
4382
|
+
l = this.ctx.maxRowIndex - f;
|
|
4221
4383
|
}
|
|
4222
|
-
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;
|
|
4223
4385
|
const d = [];
|
|
4224
4386
|
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
4225
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);
|
|
@@ -4227,6 +4389,15 @@ class ve {
|
|
|
4227
4389
|
}
|
|
4228
4390
|
this.renderRows = d, this.ctx.body.renderRows = d;
|
|
4229
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
|
+
}
|
|
4230
4401
|
draw() {
|
|
4231
4402
|
this.renderRows.forEach((t) => {
|
|
4232
4403
|
t.drawContainer();
|
|
@@ -4236,7 +4407,7 @@ class ve {
|
|
|
4236
4407
|
t.drawFixedContainer();
|
|
4237
4408
|
}), this.renderRows.forEach((t) => {
|
|
4238
4409
|
t.drawFixed();
|
|
4239
|
-
}), this.drawTipLine();
|
|
4410
|
+
}), this.drawTipLine(), this.updateAutoHeight();
|
|
4240
4411
|
}
|
|
4241
4412
|
}
|
|
4242
4413
|
class _e {
|
|
@@ -4270,8 +4441,8 @@ class _e {
|
|
|
4270
4441
|
stageWidth: o,
|
|
4271
4442
|
config: { HEADER_BG_COLOR: r, SCROLLER_TRACK_SIZE: a }
|
|
4272
4443
|
} = this.ctx;
|
|
4273
|
-
let
|
|
4274
|
-
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, {
|
|
4275
4446
|
fillColor: r,
|
|
4276
4447
|
side: "right",
|
|
4277
4448
|
shadowWidth: 4,
|
|
@@ -4279,7 +4450,7 @@ class _e {
|
|
|
4279
4450
|
colorEnd: "rgba(0,0,0,0)"
|
|
4280
4451
|
}), i < Math.floor(s.width - o - 1) && e !== a) {
|
|
4281
4452
|
const h = s.width - (this.x + this.width) + o - e;
|
|
4282
|
-
this.ctx.paint.drawShadow(h,
|
|
4453
|
+
this.ctx.paint.drawShadow(h, l, e, this.height, {
|
|
4283
4454
|
fillColor: r,
|
|
4284
4455
|
side: "left",
|
|
4285
4456
|
shadowWidth: 4,
|
|
@@ -4437,20 +4608,20 @@ class Te {
|
|
|
4437
4608
|
this.ctx.mousedown && (this.ctx.selectorMove = !0), this.ctx.selector.enable = !0;
|
|
4438
4609
|
const {
|
|
4439
4610
|
SELECTOR_AREA_MIN_X: a,
|
|
4440
|
-
SELECTOR_AREA_MAX_X:
|
|
4611
|
+
SELECTOR_AREA_MAX_X: l,
|
|
4441
4612
|
SELECTOR_AREA_MIN_Y: h,
|
|
4442
4613
|
SELECTOR_AREA_MAX_Y: d,
|
|
4443
4614
|
SELECTOR_AREA_MAX_X_OFFSET: f,
|
|
4444
4615
|
SELECTOR_AREA_MAX_Y_OFFSET: u
|
|
4445
|
-
} = this.ctx.config, x = a, w =
|
|
4446
|
-
let [
|
|
4447
|
-
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)
|
|
4448
4619
|
return;
|
|
4449
4620
|
if (this.ctx.stageElement.focus({ preventScroll: !0 }), this.ctx.config.ENABLE_MERGE_CELL_LINK) {
|
|
4450
|
-
const
|
|
4451
|
-
|
|
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;
|
|
4452
4623
|
}
|
|
4453
|
-
|
|
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)];
|
|
4454
4625
|
const { BEFORE_SET_SELECTOR_METHOD: C } = this.ctx.config;
|
|
4455
4626
|
if (typeof C == "function") {
|
|
4456
4627
|
const v = C({
|
|
@@ -4468,25 +4639,25 @@ class Te {
|
|
|
4468
4639
|
adjustMergeCells(t, e) {
|
|
4469
4640
|
var w;
|
|
4470
4641
|
const [i, s] = e, [o, r] = t;
|
|
4471
|
-
let a = [],
|
|
4642
|
+
let a = [], l = [];
|
|
4472
4643
|
for (let m = 0; m <= e[1] - e[0]; m++)
|
|
4473
4644
|
for (let g = 0; g <= t[1] - t[0]; g++) {
|
|
4474
|
-
const
|
|
4475
|
-
|
|
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));
|
|
4476
4647
|
}
|
|
4477
4648
|
const h = a.reduce(
|
|
4478
4649
|
(m, g) => {
|
|
4479
|
-
const { yArr:
|
|
4480
|
-
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;
|
|
4481
4652
|
},
|
|
4482
4653
|
{
|
|
4483
4654
|
minY: i,
|
|
4484
4655
|
maxY: s
|
|
4485
4656
|
}
|
|
4486
|
-
), d =
|
|
4657
|
+
), d = l.reduce(
|
|
4487
4658
|
(m, g) => {
|
|
4488
|
-
const { xArr:
|
|
4489
|
-
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;
|
|
4490
4661
|
},
|
|
4491
4662
|
{
|
|
4492
4663
|
minX: o,
|
|
@@ -4515,15 +4686,15 @@ class Te {
|
|
|
4515
4686
|
if (this.ctx.mousedown && this.ctx.focusCellHeader) {
|
|
4516
4687
|
const { colIndex: a } = this.ctx.focusCellHeader;
|
|
4517
4688
|
if (this.ctx.clearSelector(), t.colIndex >= a) {
|
|
4518
|
-
const
|
|
4519
|
-
this.setSelector(
|
|
4689
|
+
const l = [a, t.colIndex + t.colspan - 1], h = [o, r];
|
|
4690
|
+
this.setSelector(l, h);
|
|
4520
4691
|
} else {
|
|
4521
|
-
const
|
|
4522
|
-
this.setSelector(
|
|
4692
|
+
const l = [t.colIndex, a], h = [o, r];
|
|
4693
|
+
this.setSelector(l, h);
|
|
4523
4694
|
}
|
|
4524
4695
|
} else {
|
|
4525
|
-
const a = [t.colIndex, t.colIndex + t.colspan - 1],
|
|
4526
|
-
this.setSelector(a,
|
|
4696
|
+
const a = [t.colIndex, t.colIndex + t.colspan - 1], l = [o, r];
|
|
4697
|
+
this.setSelector(a, l);
|
|
4527
4698
|
}
|
|
4528
4699
|
}
|
|
4529
4700
|
selectAll() {
|
|
@@ -4537,8 +4708,8 @@ class Te {
|
|
|
4537
4708
|
SELECTOR_AREA_MIN_Y: o,
|
|
4538
4709
|
SELECTOR_AREA_MAX_Y: r,
|
|
4539
4710
|
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
4540
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
4541
|
-
} = this.ctx.config, h = i, d = s || this.ctx.maxColIndex - a, f = o, u = r || this.ctx.maxRowIndex -
|
|
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];
|
|
4542
4713
|
this.setSelector(x, w);
|
|
4543
4714
|
}
|
|
4544
4715
|
}
|
|
@@ -4548,16 +4719,16 @@ class Te {
|
|
|
4548
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;
|
|
4549
4720
|
if (e) {
|
|
4550
4721
|
this.ctx.setFocusCell(t);
|
|
4551
|
-
const
|
|
4552
|
-
this.setSelector(
|
|
4722
|
+
const l = [a, r], h = [t.rowIndex, t.rowIndex];
|
|
4723
|
+
this.setSelector(l, h);
|
|
4553
4724
|
}
|
|
4554
4725
|
if (this.ctx.focusCell && this.ctx.mousedown) {
|
|
4555
|
-
const { rowIndex:
|
|
4556
|
-
if (t.rowIndex >=
|
|
4557
|
-
const h = [a, r], d = [
|
|
4726
|
+
const { rowIndex: l } = this.ctx.focusCell;
|
|
4727
|
+
if (t.rowIndex >= l) {
|
|
4728
|
+
const h = [a, r], d = [l, t.rowIndex];
|
|
4558
4729
|
this.setSelector(h, d);
|
|
4559
4730
|
} else {
|
|
4560
|
-
const h = [a, r], d = [t.rowIndex,
|
|
4731
|
+
const h = [a, r], d = [t.rowIndex, l];
|
|
4561
4732
|
this.setSelector(h, d);
|
|
4562
4733
|
}
|
|
4563
4734
|
}
|
|
@@ -4567,7 +4738,7 @@ class Te {
|
|
|
4567
4738
|
return;
|
|
4568
4739
|
const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
|
|
4569
4740
|
if (t && e && i) {
|
|
4570
|
-
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];
|
|
4571
4742
|
this.setSelector(d, f);
|
|
4572
4743
|
}
|
|
4573
4744
|
}
|
|
@@ -4577,7 +4748,7 @@ class Te {
|
|
|
4577
4748
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
4578
4749
|
if (this.ctx.config.ENABLE_SELECTOR_SINGLE)
|
|
4579
4750
|
return;
|
|
4580
|
-
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];
|
|
4581
4752
|
this.setSelector(u, x);
|
|
4582
4753
|
} else {
|
|
4583
4754
|
this.ctx.emit("cellSelectedClick", e);
|
|
@@ -4642,9 +4813,9 @@ class Te {
|
|
|
4642
4813
|
clearSelectedData(t, e, i = !1, s = null) {
|
|
4643
4814
|
let o = [];
|
|
4644
4815
|
const r = /* @__PURE__ */ new Set();
|
|
4645
|
-
for (let
|
|
4816
|
+
for (let l = 0; l <= e[1] - e[0]; l++)
|
|
4646
4817
|
for (let h = 0; h <= t[1] - t[0]; h++) {
|
|
4647
|
-
const d =
|
|
4818
|
+
const d = l + e[0], f = h + t[0], u = this.ctx.database.getItemValueForRowIndexAndColIndex(d, f);
|
|
4648
4819
|
if (u) {
|
|
4649
4820
|
const { rowKey: x, key: w } = u;
|
|
4650
4821
|
this.ctx.database.getReadonly(x, w) || (r.add(x), o.push({
|
|
@@ -4662,8 +4833,8 @@ class Te {
|
|
|
4662
4833
|
return o;
|
|
4663
4834
|
this.ctx.database.batchSetItemValue(o, !0);
|
|
4664
4835
|
let a = [];
|
|
4665
|
-
return r.forEach((
|
|
4666
|
-
a.push(this.ctx.database.getRowDataItemForRowKey(
|
|
4836
|
+
return r.forEach((l) => {
|
|
4837
|
+
a.push(this.ctx.database.getRowDataItemForRowKey(l));
|
|
4667
4838
|
}), this.ctx.emit("clearSelectedDataChange", o, a), o;
|
|
4668
4839
|
}
|
|
4669
4840
|
paste() {
|
|
@@ -4675,8 +4846,8 @@ class Te {
|
|
|
4675
4846
|
if (this.ctx.selector.enable && t) {
|
|
4676
4847
|
const e = this.ctx.selector.yArr[0], i = this.ctx.selector.xArr[0], s = /* @__PURE__ */ new Set();
|
|
4677
4848
|
navigator.clipboard.readText().then(async (o) => {
|
|
4678
|
-
let r =
|
|
4679
|
-
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;
|
|
4680
4851
|
(x > 0 || w > 0) && this.ctx.emit("onPastedDataOverflow", {
|
|
4681
4852
|
maxY: d,
|
|
4682
4853
|
maxX: u,
|
|
@@ -4687,28 +4858,28 @@ class Te {
|
|
|
4687
4858
|
textArr: r
|
|
4688
4859
|
});
|
|
4689
4860
|
const m = r.length === 1 && r[0].length === 1;
|
|
4690
|
-
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a,
|
|
4691
|
-
const
|
|
4861
|
+
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a, l) && !m) {
|
|
4862
|
+
const E = {
|
|
4692
4863
|
code: "ERR_MERGED_CELLS_PASTE",
|
|
4693
4864
|
message: "Merged cells cannot span paste data"
|
|
4694
4865
|
};
|
|
4695
|
-
this.ctx.hasEvent("error") ? this.ctx.emit("error",
|
|
4866
|
+
this.ctx.hasEvent("error") ? this.ctx.emit("error", E) : alert(E.message);
|
|
4696
4867
|
return;
|
|
4697
4868
|
}
|
|
4698
4869
|
let g = [];
|
|
4699
|
-
for (let
|
|
4700
|
-
const
|
|
4701
|
-
for (let C = 0; C <=
|
|
4702
|
-
const
|
|
4703
|
-
|
|
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,
|
|
4704
4875
|
v
|
|
4705
4876
|
);
|
|
4706
4877
|
if (S) {
|
|
4707
|
-
const { rowKey:
|
|
4708
|
-
this.ctx.database.getReadonly(
|
|
4709
|
-
rowKey:
|
|
4710
|
-
key:
|
|
4711
|
-
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: _,
|
|
4712
4883
|
row: {}
|
|
4713
4884
|
//内部有设置
|
|
4714
4885
|
}));
|
|
@@ -4716,35 +4887,35 @@ class Te {
|
|
|
4716
4887
|
}
|
|
4717
4888
|
}
|
|
4718
4889
|
if (this.isCut) {
|
|
4719
|
-
const
|
|
4890
|
+
const E = this.clearSelectedData(
|
|
4720
4891
|
this.ctx.selector.xArrCopy,
|
|
4721
4892
|
this.ctx.selector.yArrCopy,
|
|
4722
4893
|
!0
|
|
4723
4894
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
4724
|
-
),
|
|
4725
|
-
|
|
4726
|
-
|
|
4895
|
+
), R = g.map((C) => `${C.rowKey}-${C.key}`);
|
|
4896
|
+
E.forEach((C) => {
|
|
4897
|
+
R.includes(`${C.rowKey}-${C.key}`) || g.unshift(C);
|
|
4727
4898
|
}), this.isCut = !1;
|
|
4728
4899
|
}
|
|
4729
4900
|
if (!g.length)
|
|
4730
4901
|
return;
|
|
4731
|
-
const { BEFORE_PASTE_DATA_METHOD:
|
|
4732
|
-
if (typeof
|
|
4733
|
-
const
|
|
4902
|
+
const { BEFORE_PASTE_DATA_METHOD: p } = this.ctx.config;
|
|
4903
|
+
if (typeof p == "function") {
|
|
4904
|
+
const E = p, R = g.map((C) => ({
|
|
4734
4905
|
rowKey: C.rowKey,
|
|
4735
4906
|
key: C.key,
|
|
4736
4907
|
value: C.value,
|
|
4737
4908
|
oldValue: this.ctx.database.getItemValue(C.rowKey, C.key),
|
|
4738
4909
|
row: this.ctx.database.getRowDataItemForRowKey(C.rowKey)
|
|
4739
4910
|
}));
|
|
4740
|
-
if (g = await
|
|
4911
|
+
if (g = await E(R, a, l, r), g && !g.length)
|
|
4741
4912
|
return;
|
|
4742
4913
|
}
|
|
4743
4914
|
this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(g, !0);
|
|
4744
4915
|
let y = [];
|
|
4745
|
-
s.forEach((
|
|
4746
|
-
y.push(this.ctx.database.getRowDataItemForRowKey(
|
|
4747
|
-
}), 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");
|
|
4748
4919
|
}).catch((o) => {
|
|
4749
4920
|
console.error("Failed to get the clipboard content:", o);
|
|
4750
4921
|
});
|
|
@@ -4760,7 +4931,7 @@ class Te {
|
|
|
4760
4931
|
if (!e)
|
|
4761
4932
|
return;
|
|
4762
4933
|
let { colIndex: i = 0, rowIndex: s = 0 } = e;
|
|
4763
|
-
const o = 0, r = 0, a = this.ctx.maxColIndex,
|
|
4934
|
+
const o = 0, r = 0, a = this.ctx.maxColIndex, l = this.ctx.maxRowIndex;
|
|
4764
4935
|
switch (t) {
|
|
4765
4936
|
case "LEFT":
|
|
4766
4937
|
i > o && i--;
|
|
@@ -4772,7 +4943,7 @@ class Te {
|
|
|
4772
4943
|
i < a && i++;
|
|
4773
4944
|
break;
|
|
4774
4945
|
case "BOTTOM":
|
|
4775
|
-
s <
|
|
4946
|
+
s < l && s++;
|
|
4776
4947
|
break;
|
|
4777
4948
|
}
|
|
4778
4949
|
const h = [i, i], d = [s, s], f = this.getCell(s, i);
|
|
@@ -4789,8 +4960,8 @@ class Te {
|
|
|
4789
4960
|
SELECTOR_AREA_MIN_Y: o,
|
|
4790
4961
|
SELECTOR_AREA_MAX_Y: r,
|
|
4791
4962
|
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
4792
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
4793
|
-
} = this.ctx.config, h = i, d = s || this.ctx.maxColIndex - a, f = o, u = r || this.ctx.maxRowIndex -
|
|
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;
|
|
4794
4965
|
return !(e < h || e > d || t < f || t > u);
|
|
4795
4966
|
}
|
|
4796
4967
|
/**
|
|
@@ -4804,7 +4975,7 @@ class Te {
|
|
|
4804
4975
|
let a = 10 * (s === "left" ? -1 : 1);
|
|
4805
4976
|
this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
|
|
4806
4977
|
a *= 1.5;
|
|
4807
|
-
const { scrollX:
|
|
4978
|
+
const { scrollX: l } = this.ctx, h = l + a;
|
|
4808
4979
|
(h < 0 || h > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(h);
|
|
4809
4980
|
}, 100);
|
|
4810
4981
|
}
|
|
@@ -4813,7 +4984,7 @@ class Te {
|
|
|
4813
4984
|
let a = 10 * (o === "top" ? -1 : 1);
|
|
4814
4985
|
this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
|
|
4815
4986
|
a *= 1.5;
|
|
4816
|
-
const { scrollY:
|
|
4987
|
+
const { scrollY: l } = this.ctx, h = l + a;
|
|
4817
4988
|
(h < 0 || h > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(h);
|
|
4818
4989
|
}, 100);
|
|
4819
4990
|
}
|
|
@@ -4830,7 +5001,7 @@ class Te {
|
|
|
4830
5001
|
fixedLeftWidth: o,
|
|
4831
5002
|
header: r,
|
|
4832
5003
|
footer: a,
|
|
4833
|
-
body:
|
|
5004
|
+
body: l,
|
|
4834
5005
|
scrollX: h,
|
|
4835
5006
|
scrollY: d,
|
|
4836
5007
|
config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED: u, FOOTER_POSITION: x, ENABLE_MERGE_CELL_LINK: w }
|
|
@@ -4838,14 +5009,14 @@ class Te {
|
|
|
4838
5009
|
if (!i)
|
|
4839
5010
|
return;
|
|
4840
5011
|
w && this.ctx.onlyMergeCell && i.updateSpanInfo();
|
|
4841
|
-
const { drawX: m, drawY: g, width:
|
|
4842
|
-
let
|
|
4843
|
-
v >
|
|
4844
|
-
let
|
|
4845
|
-
u && (x === "top" ?
|
|
4846
|
-
const S = g + v - (t -
|
|
4847
|
-
let
|
|
4848
|
-
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));
|
|
4849
5020
|
}
|
|
4850
5021
|
destroy() {
|
|
4851
5022
|
this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
|
|
@@ -4861,7 +5032,7 @@ class Oe {
|
|
|
4861
5032
|
this.ctx.on("mousemove", (t) => {
|
|
4862
5033
|
if (this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default"), this.ctx.editing || !this.ctx.focusCell || !this.maxColRowCell)
|
|
4863
5034
|
return;
|
|
4864
|
-
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;
|
|
4865
5036
|
e > u && i > x && e < u + d && i < x + d && (this.ctx.stageElement.style.cursor = "crosshair");
|
|
4866
5037
|
}), this.ctx.on("cellMouseenter", (t) => {
|
|
4867
5038
|
const { xArr: e, yArr: i } = this.ctx.selector, s = e[1], o = i[1], { colIndex: r, rowIndex: a } = t;
|
|
@@ -4894,36 +5065,36 @@ class Oe {
|
|
|
4894
5065
|
return;
|
|
4895
5066
|
let r = t, a = e;
|
|
4896
5067
|
if (!o) {
|
|
4897
|
-
const [
|
|
4898
|
-
a = [
|
|
5068
|
+
const [l] = a;
|
|
5069
|
+
a = [l, l];
|
|
4899
5070
|
}
|
|
4900
5071
|
if (!s) {
|
|
4901
|
-
const [
|
|
4902
|
-
r = [
|
|
5072
|
+
const [l] = r;
|
|
5073
|
+
r = [l, l];
|
|
4903
5074
|
}
|
|
4904
5075
|
if (JSON.stringify(this.ctx.autofill.xArr) !== JSON.stringify(r) || JSON.stringify(this.ctx.autofill.yArr) !== JSON.stringify(a)) {
|
|
4905
5076
|
const {
|
|
4906
|
-
SELECTOR_AREA_MIN_X:
|
|
5077
|
+
SELECTOR_AREA_MIN_X: l,
|
|
4907
5078
|
SELECTOR_AREA_MAX_X: h,
|
|
4908
5079
|
SELECTOR_AREA_MIN_Y: d,
|
|
4909
5080
|
SELECTOR_AREA_MAX_Y: f,
|
|
4910
5081
|
SELECTOR_AREA_MAX_X_OFFSET: u,
|
|
4911
5082
|
SELECTOR_AREA_MAX_Y_OFFSET: x
|
|
4912
|
-
} = this.ctx.config, w =
|
|
4913
|
-
let [y,
|
|
4914
|
-
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)
|
|
4915
5086
|
return;
|
|
4916
|
-
r = [Math.max(w, y), Math.min(m,
|
|
4917
|
-
const { BEFORE_SET_AUTOFILL_METHOD:
|
|
4918
|
-
if (typeof
|
|
4919
|
-
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({
|
|
4920
5091
|
focusCell: this.ctx.focusCell,
|
|
4921
5092
|
xArr: r,
|
|
4922
5093
|
yArr: a
|
|
4923
5094
|
});
|
|
4924
|
-
if (!
|
|
5095
|
+
if (!_)
|
|
4925
5096
|
return;
|
|
4926
|
-
r =
|
|
5097
|
+
r = _.xArr, a = _.yArr;
|
|
4927
5098
|
}
|
|
4928
5099
|
this.ctx.autofill.xArr = r, this.ctx.autofill.yArr = a, this.ctx.emit("setAutofill", this.ctx.autofill), this.ctx.emit("draw");
|
|
4929
5100
|
}
|
|
@@ -4938,8 +5109,8 @@ class Oe {
|
|
|
4938
5109
|
const m = x + e.yArr[0], g = w + e.xArr[0];
|
|
4939
5110
|
i.set(`${m}-${g}`, !0);
|
|
4940
5111
|
}
|
|
4941
|
-
const { value: s } = e, o = s[0].length, r = s.length, a = this.ctx.autofill.xArr,
|
|
4942
|
-
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) {
|
|
4943
5114
|
const x = {
|
|
4944
5115
|
code: "ERR_MERGED_CELLS_AUTOFILL",
|
|
4945
5116
|
message: "Merged cells cannot span autofill data"
|
|
@@ -4948,15 +5119,15 @@ class Oe {
|
|
|
4948
5119
|
return;
|
|
4949
5120
|
}
|
|
4950
5121
|
let d = [];
|
|
4951
|
-
for (let x = 0; x <=
|
|
5122
|
+
for (let x = 0; x <= l[1] - l[0]; x++)
|
|
4952
5123
|
for (let w = 0; w <= a[1] - a[0]; w++) {
|
|
4953
|
-
const m = w + a[0], g = x +
|
|
4954
|
-
if (y && !i.has(
|
|
4955
|
-
const { rowKey:
|
|
4956
|
-
this.ctx.database.getReadonly(
|
|
4957
|
-
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,
|
|
4958
5129
|
key: C,
|
|
4959
|
-
value:
|
|
5130
|
+
value: p,
|
|
4960
5131
|
row: {}
|
|
4961
5132
|
}));
|
|
4962
5133
|
}
|
|
@@ -4973,14 +5144,14 @@ class Oe {
|
|
|
4973
5144
|
oldValue: this.ctx.database.getItemValue(m.rowKey, m.key),
|
|
4974
5145
|
row: this.ctx.database.getRowDataItemForRowKey(m.rowKey)
|
|
4975
5146
|
}));
|
|
4976
|
-
if (d = await x(w, a,
|
|
5147
|
+
if (d = await x(w, a, l), d && !d.length)
|
|
4977
5148
|
return;
|
|
4978
5149
|
}
|
|
4979
5150
|
this.ctx.batchSetItemValueByEditor(d, !0);
|
|
4980
5151
|
let u = [];
|
|
4981
5152
|
t.forEach((x) => {
|
|
4982
5153
|
u.push(this.ctx.database.getRowDataItemForRowKey(x));
|
|
4983
|
-
}), this.ctx.emit("autofillChange", d, u);
|
|
5154
|
+
}), this.ctx.emit("autofillChange", d, u), this.ctx.emit("draw");
|
|
4984
5155
|
}
|
|
4985
5156
|
mouseenter(t) {
|
|
4986
5157
|
if (["index", "selection", "index-selection"].includes(t.type))
|
|
@@ -4994,59 +5165,59 @@ class Oe {
|
|
|
4994
5165
|
destroy() {
|
|
4995
5166
|
}
|
|
4996
5167
|
}
|
|
4997
|
-
const j = Math.min, $ = Math.max, it = Math.round,
|
|
4998
|
-
x:
|
|
4999
|
-
y:
|
|
5168
|
+
const j = Math.min, $ = Math.max, it = Math.round, B = (c) => ({
|
|
5169
|
+
x: c,
|
|
5170
|
+
y: c
|
|
5000
5171
|
}), Le = {
|
|
5001
5172
|
left: "right",
|
|
5002
5173
|
right: "left",
|
|
5003
5174
|
bottom: "top",
|
|
5004
5175
|
top: "bottom"
|
|
5005
|
-
},
|
|
5176
|
+
}, Me = {
|
|
5006
5177
|
start: "end",
|
|
5007
5178
|
end: "start"
|
|
5008
5179
|
};
|
|
5009
|
-
function
|
|
5010
|
-
return $(
|
|
5180
|
+
function ct(c, t, e) {
|
|
5181
|
+
return $(c, j(t, e));
|
|
5011
5182
|
}
|
|
5012
|
-
function J(
|
|
5013
|
-
return typeof
|
|
5183
|
+
function J(c, t) {
|
|
5184
|
+
return typeof c == "function" ? c(t) : c;
|
|
5014
5185
|
}
|
|
5015
|
-
function z(
|
|
5016
|
-
return
|
|
5186
|
+
function z(c) {
|
|
5187
|
+
return c.split("-")[0];
|
|
5017
5188
|
}
|
|
5018
|
-
function Q(
|
|
5019
|
-
return
|
|
5189
|
+
function Q(c) {
|
|
5190
|
+
return c.split("-")[1];
|
|
5020
5191
|
}
|
|
5021
|
-
function Kt(
|
|
5022
|
-
return
|
|
5192
|
+
function Kt(c) {
|
|
5193
|
+
return c === "x" ? "y" : "x";
|
|
5023
5194
|
}
|
|
5024
|
-
function gt(
|
|
5025
|
-
return
|
|
5195
|
+
function gt(c) {
|
|
5196
|
+
return c === "y" ? "height" : "width";
|
|
5026
5197
|
}
|
|
5027
|
-
const
|
|
5028
|
-
function V(
|
|
5029
|
-
return
|
|
5198
|
+
const Ae = /* @__PURE__ */ new Set(["top", "bottom"]);
|
|
5199
|
+
function V(c) {
|
|
5200
|
+
return Ae.has(z(c)) ? "y" : "x";
|
|
5030
5201
|
}
|
|
5031
|
-
function wt(
|
|
5032
|
-
return Kt(V(
|
|
5202
|
+
function wt(c) {
|
|
5203
|
+
return Kt(V(c));
|
|
5033
5204
|
}
|
|
5034
|
-
function He(
|
|
5205
|
+
function He(c, t, e) {
|
|
5035
5206
|
e === void 0 && (e = !1);
|
|
5036
|
-
const i = Q(
|
|
5207
|
+
const i = Q(c), s = wt(c), o = gt(s);
|
|
5037
5208
|
let r = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
|
|
5038
5209
|
return t.reference[o] > t.floating[o] && (r = st(r)), [r, st(r)];
|
|
5039
5210
|
}
|
|
5040
|
-
function De(
|
|
5041
|
-
const t = st(
|
|
5042
|
-
return [dt(
|
|
5211
|
+
function De(c) {
|
|
5212
|
+
const t = st(c);
|
|
5213
|
+
return [dt(c), t, dt(t)];
|
|
5043
5214
|
}
|
|
5044
|
-
function dt(
|
|
5045
|
-
return
|
|
5215
|
+
function dt(c) {
|
|
5216
|
+
return c.replace(/start|end/g, (t) => Me[t]);
|
|
5046
5217
|
}
|
|
5047
5218
|
const vt = ["left", "right"], _t = ["right", "left"], Ne = ["top", "bottom"], ke = ["bottom", "top"];
|
|
5048
|
-
function Xe(
|
|
5049
|
-
switch (
|
|
5219
|
+
function Xe(c, t, e) {
|
|
5220
|
+
switch (c) {
|
|
5050
5221
|
case "top":
|
|
5051
5222
|
case "bottom":
|
|
5052
5223
|
return e ? t ? _t : vt : t ? vt : _t;
|
|
@@ -5057,38 +5228,38 @@ function Xe(l, t, e) {
|
|
|
5057
5228
|
return [];
|
|
5058
5229
|
}
|
|
5059
5230
|
}
|
|
5060
|
-
function Ye(
|
|
5061
|
-
const s = Q(
|
|
5062
|
-
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);
|
|
5063
5234
|
return s && (o = o.map((r) => r + "-" + s), t && (o = o.concat(o.map(dt)))), o;
|
|
5064
5235
|
}
|
|
5065
|
-
function st(
|
|
5066
|
-
return
|
|
5236
|
+
function st(c) {
|
|
5237
|
+
return c.replace(/left|right|bottom|top/g, (t) => Le[t]);
|
|
5067
5238
|
}
|
|
5068
|
-
function Be(
|
|
5239
|
+
function Be(c) {
|
|
5069
5240
|
return {
|
|
5070
5241
|
top: 0,
|
|
5071
5242
|
right: 0,
|
|
5072
5243
|
bottom: 0,
|
|
5073
5244
|
left: 0,
|
|
5074
|
-
...
|
|
5245
|
+
...c
|
|
5075
5246
|
};
|
|
5076
5247
|
}
|
|
5077
|
-
function
|
|
5078
|
-
return typeof
|
|
5079
|
-
top:
|
|
5080
|
-
right:
|
|
5081
|
-
bottom:
|
|
5082
|
-
left:
|
|
5248
|
+
function Ft(c) {
|
|
5249
|
+
return typeof c != "number" ? Be(c) : {
|
|
5250
|
+
top: c,
|
|
5251
|
+
right: c,
|
|
5252
|
+
bottom: c,
|
|
5253
|
+
left: c
|
|
5083
5254
|
};
|
|
5084
5255
|
}
|
|
5085
|
-
function ot(
|
|
5256
|
+
function ot(c) {
|
|
5086
5257
|
const {
|
|
5087
5258
|
x: t,
|
|
5088
5259
|
y: e,
|
|
5089
5260
|
width: i,
|
|
5090
5261
|
height: s
|
|
5091
|
-
} =
|
|
5262
|
+
} = c;
|
|
5092
5263
|
return {
|
|
5093
5264
|
width: i,
|
|
5094
5265
|
height: s,
|
|
@@ -5100,14 +5271,14 @@ function ot(l) {
|
|
|
5100
5271
|
y: e
|
|
5101
5272
|
};
|
|
5102
5273
|
}
|
|
5103
|
-
function Tt(
|
|
5274
|
+
function Tt(c, t, e) {
|
|
5104
5275
|
let {
|
|
5105
5276
|
reference: i,
|
|
5106
5277
|
floating: s
|
|
5107
|
-
} =
|
|
5108
|
-
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;
|
|
5109
5280
|
let x;
|
|
5110
|
-
switch (
|
|
5281
|
+
switch (l) {
|
|
5111
5282
|
case "top":
|
|
5112
5283
|
x = {
|
|
5113
5284
|
x: d,
|
|
@@ -5148,31 +5319,31 @@ function Tt(l, t, e) {
|
|
|
5148
5319
|
}
|
|
5149
5320
|
return x;
|
|
5150
5321
|
}
|
|
5151
|
-
const Ke = async (
|
|
5322
|
+
const Ke = async (c, t, e) => {
|
|
5152
5323
|
const {
|
|
5153
5324
|
placement: i = "bottom",
|
|
5154
5325
|
strategy: s = "absolute",
|
|
5155
5326
|
middleware: o = [],
|
|
5156
5327
|
platform: r
|
|
5157
|
-
} = e, a = o.filter(Boolean),
|
|
5328
|
+
} = e, a = o.filter(Boolean), l = await (r.isRTL == null ? void 0 : r.isRTL(t));
|
|
5158
5329
|
let h = await r.getElementRects({
|
|
5159
|
-
reference:
|
|
5330
|
+
reference: c,
|
|
5160
5331
|
floating: t,
|
|
5161
5332
|
strategy: s
|
|
5162
5333
|
}), {
|
|
5163
5334
|
x: d,
|
|
5164
5335
|
y: f
|
|
5165
|
-
} = Tt(h, i,
|
|
5336
|
+
} = Tt(h, i, l), u = i, x = {}, w = 0;
|
|
5166
5337
|
for (let m = 0; m < a.length; m++) {
|
|
5167
5338
|
const {
|
|
5168
5339
|
name: g,
|
|
5169
|
-
fn:
|
|
5340
|
+
fn: p
|
|
5170
5341
|
} = a[m], {
|
|
5171
5342
|
x: y,
|
|
5172
|
-
y:
|
|
5173
|
-
data:
|
|
5343
|
+
y: E,
|
|
5344
|
+
data: R,
|
|
5174
5345
|
reset: C
|
|
5175
|
-
} = await
|
|
5346
|
+
} = await p({
|
|
5176
5347
|
x: d,
|
|
5177
5348
|
y: f,
|
|
5178
5349
|
initialPlacement: i,
|
|
@@ -5182,24 +5353,24 @@ const Ke = async (l, t, e) => {
|
|
|
5182
5353
|
rects: h,
|
|
5183
5354
|
platform: r,
|
|
5184
5355
|
elements: {
|
|
5185
|
-
reference:
|
|
5356
|
+
reference: c,
|
|
5186
5357
|
floating: t
|
|
5187
5358
|
}
|
|
5188
5359
|
});
|
|
5189
|
-
d = y ?? d, f =
|
|
5360
|
+
d = y ?? d, f = E ?? f, x = {
|
|
5190
5361
|
...x,
|
|
5191
5362
|
[g]: {
|
|
5192
5363
|
...x[g],
|
|
5193
|
-
...
|
|
5364
|
+
...R
|
|
5194
5365
|
}
|
|
5195
5366
|
}, C && w <= 50 && (w++, typeof C == "object" && (C.placement && (u = C.placement), C.rects && (h = C.rects === !0 ? await r.getElementRects({
|
|
5196
|
-
reference:
|
|
5367
|
+
reference: c,
|
|
5197
5368
|
floating: t,
|
|
5198
5369
|
strategy: s
|
|
5199
5370
|
}) : C.rects), {
|
|
5200
5371
|
x: d,
|
|
5201
5372
|
y: f
|
|
5202
|
-
} = Tt(h, u,
|
|
5373
|
+
} = Tt(h, u, l)), m = -1);
|
|
5203
5374
|
}
|
|
5204
5375
|
return {
|
|
5205
5376
|
x: d,
|
|
@@ -5209,7 +5380,7 @@ const Ke = async (l, t, e) => {
|
|
|
5209
5380
|
middlewareData: x
|
|
5210
5381
|
};
|
|
5211
5382
|
};
|
|
5212
|
-
async function
|
|
5383
|
+
async function Wt(c, t) {
|
|
5213
5384
|
var e;
|
|
5214
5385
|
t === void 0 && (t = {});
|
|
5215
5386
|
const {
|
|
@@ -5218,24 +5389,24 @@ async function Ft(l, t) {
|
|
|
5218
5389
|
platform: o,
|
|
5219
5390
|
rects: r,
|
|
5220
5391
|
elements: a,
|
|
5221
|
-
strategy:
|
|
5222
|
-
} =
|
|
5392
|
+
strategy: l
|
|
5393
|
+
} = c, {
|
|
5223
5394
|
boundary: h = "clippingAncestors",
|
|
5224
5395
|
rootBoundary: d = "viewport",
|
|
5225
5396
|
elementContext: f = "floating",
|
|
5226
5397
|
altBoundary: u = !1,
|
|
5227
5398
|
padding: x = 0
|
|
5228
|
-
} = J(t,
|
|
5399
|
+
} = J(t, c), w = Ft(x), g = a[u ? f === "floating" ? "reference" : "floating" : f], p = ot(await o.getClippingRect({
|
|
5229
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)),
|
|
5230
5401
|
boundary: h,
|
|
5231
5402
|
rootBoundary: d,
|
|
5232
|
-
strategy:
|
|
5403
|
+
strategy: l
|
|
5233
5404
|
})), y = f === "floating" ? {
|
|
5234
5405
|
x: i,
|
|
5235
5406
|
y: s,
|
|
5236
5407
|
width: r.floating.width,
|
|
5237
5408
|
height: r.floating.height
|
|
5238
|
-
} : 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)) || {
|
|
5239
5410
|
x: 1,
|
|
5240
5411
|
y: 1
|
|
5241
5412
|
} : {
|
|
@@ -5244,19 +5415,19 @@ async function Ft(l, t) {
|
|
|
5244
5415
|
}, C = ot(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
5245
5416
|
elements: a,
|
|
5246
5417
|
rect: y,
|
|
5247
|
-
offsetParent:
|
|
5248
|
-
strategy:
|
|
5418
|
+
offsetParent: E,
|
|
5419
|
+
strategy: l
|
|
5249
5420
|
}) : y);
|
|
5250
5421
|
return {
|
|
5251
|
-
top: (
|
|
5252
|
-
bottom: (C.bottom -
|
|
5253
|
-
left: (
|
|
5254
|
-
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
|
|
5255
5426
|
};
|
|
5256
5427
|
}
|
|
5257
|
-
const
|
|
5428
|
+
const Fe = (c) => ({
|
|
5258
5429
|
name: "arrow",
|
|
5259
|
-
options:
|
|
5430
|
+
options: c,
|
|
5260
5431
|
async fn(t) {
|
|
5261
5432
|
const {
|
|
5262
5433
|
x: e,
|
|
@@ -5265,36 +5436,36 @@ const We = (l) => ({
|
|
|
5265
5436
|
rects: o,
|
|
5266
5437
|
platform: r,
|
|
5267
5438
|
elements: a,
|
|
5268
|
-
middlewareData:
|
|
5439
|
+
middlewareData: l
|
|
5269
5440
|
} = t, {
|
|
5270
5441
|
element: h,
|
|
5271
5442
|
padding: d = 0
|
|
5272
|
-
} = J(
|
|
5443
|
+
} = J(c, t) || {};
|
|
5273
5444
|
if (h == null)
|
|
5274
5445
|
return {};
|
|
5275
|
-
const f =
|
|
5446
|
+
const f = Ft(d), u = {
|
|
5276
5447
|
x: e,
|
|
5277
5448
|
y: i
|
|
5278
|
-
}, x = wt(s), w = gt(x), m = await r.getDimensions(h), g = x === "y",
|
|
5279
|
-
let v =
|
|
5280
|
-
(!v || !await (r.isElement == null ? void 0 : r.isElement(
|
|
5281
|
-
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;
|
|
5282
5453
|
return {
|
|
5283
|
-
[x]: u[x] +
|
|
5454
|
+
[x]: u[x] + N,
|
|
5284
5455
|
data: {
|
|
5285
|
-
[x]:
|
|
5286
|
-
centerOffset: L -
|
|
5287
|
-
...
|
|
5288
|
-
alignmentOffset:
|
|
5456
|
+
[x]: A,
|
|
5457
|
+
centerOffset: L - A - N,
|
|
5458
|
+
...D && {
|
|
5459
|
+
alignmentOffset: N
|
|
5289
5460
|
}
|
|
5290
5461
|
},
|
|
5291
|
-
reset:
|
|
5462
|
+
reset: D
|
|
5292
5463
|
};
|
|
5293
5464
|
}
|
|
5294
|
-
}),
|
|
5295
|
-
return
|
|
5465
|
+
}), We = function(c) {
|
|
5466
|
+
return c === void 0 && (c = {}), {
|
|
5296
5467
|
name: "flip",
|
|
5297
|
-
options:
|
|
5468
|
+
options: c,
|
|
5298
5469
|
async fn(t) {
|
|
5299
5470
|
var e, i;
|
|
5300
5471
|
const {
|
|
@@ -5302,7 +5473,7 @@ const We = (l) => ({
|
|
|
5302
5473
|
middlewareData: o,
|
|
5303
5474
|
rects: r,
|
|
5304
5475
|
initialPlacement: a,
|
|
5305
|
-
platform:
|
|
5476
|
+
platform: l,
|
|
5306
5477
|
elements: h
|
|
5307
5478
|
} = t, {
|
|
5308
5479
|
mainAxis: d = !0,
|
|
@@ -5312,60 +5483,60 @@ const We = (l) => ({
|
|
|
5312
5483
|
fallbackAxisSideDirection: w = "none",
|
|
5313
5484
|
flipAlignment: m = !0,
|
|
5314
5485
|
...g
|
|
5315
|
-
} = J(
|
|
5486
|
+
} = J(c, t);
|
|
5316
5487
|
if ((e = o.arrow) != null && e.alignmentOffset)
|
|
5317
5488
|
return {};
|
|
5318
|
-
const
|
|
5319
|
-
!u &&
|
|
5320
|
-
const v = [a, ...C],
|
|
5321
|
-
let
|
|
5322
|
-
if (d && S.push(
|
|
5323
|
-
const L = He(s, r,
|
|
5324
|
-
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]]);
|
|
5325
5496
|
}
|
|
5326
|
-
if (
|
|
5497
|
+
if (b = [...b, {
|
|
5327
5498
|
placement: s,
|
|
5328
5499
|
overflows: S
|
|
5329
5500
|
}], !S.every((L) => L <= 0)) {
|
|
5330
|
-
var
|
|
5331
|
-
const L = (((
|
|
5332
|
-
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
|
|
5333
5504
|
// overflows the main axis.
|
|
5334
|
-
|
|
5505
|
+
b.every((k) => V(k.placement) === y ? k.overflows[0] > 0 : !0)))
|
|
5335
5506
|
return {
|
|
5336
5507
|
data: {
|
|
5337
5508
|
index: L,
|
|
5338
|
-
overflows:
|
|
5509
|
+
overflows: b
|
|
5339
5510
|
},
|
|
5340
5511
|
reset: {
|
|
5341
|
-
placement:
|
|
5512
|
+
placement: A
|
|
5342
5513
|
}
|
|
5343
5514
|
};
|
|
5344
|
-
let
|
|
5345
|
-
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)
|
|
5346
5517
|
switch (x) {
|
|
5347
5518
|
case "bestFit": {
|
|
5348
5519
|
var M;
|
|
5349
|
-
const
|
|
5350
|
-
if (
|
|
5351
|
-
const
|
|
5352
|
-
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
|
|
5353
5524
|
// reading directions favoring greater width.
|
|
5354
|
-
|
|
5525
|
+
W === "y";
|
|
5355
5526
|
}
|
|
5356
5527
|
return !0;
|
|
5357
|
-
}).map((
|
|
5358
|
-
|
|
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);
|
|
5359
5530
|
break;
|
|
5360
5531
|
}
|
|
5361
5532
|
case "initialPlacement":
|
|
5362
|
-
|
|
5533
|
+
D = a;
|
|
5363
5534
|
break;
|
|
5364
5535
|
}
|
|
5365
|
-
if (s !==
|
|
5536
|
+
if (s !== D)
|
|
5366
5537
|
return {
|
|
5367
5538
|
reset: {
|
|
5368
|
-
placement:
|
|
5539
|
+
placement: D
|
|
5369
5540
|
}
|
|
5370
5541
|
};
|
|
5371
5542
|
}
|
|
@@ -5373,12 +5544,12 @@ const We = (l) => ({
|
|
|
5373
5544
|
}
|
|
5374
5545
|
};
|
|
5375
5546
|
}, Ve = /* @__PURE__ */ new Set(["left", "top"]);
|
|
5376
|
-
async function Pe(
|
|
5547
|
+
async function Pe(c, t) {
|
|
5377
5548
|
const {
|
|
5378
5549
|
placement: e,
|
|
5379
5550
|
platform: i,
|
|
5380
5551
|
elements: s
|
|
5381
|
-
} =
|
|
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);
|
|
5382
5553
|
let {
|
|
5383
5554
|
mainAxis: u,
|
|
5384
5555
|
crossAxis: x,
|
|
@@ -5392,7 +5563,7 @@ async function Pe(l, t) {
|
|
|
5392
5563
|
crossAxis: f.crossAxis || 0,
|
|
5393
5564
|
alignmentAxis: f.alignmentAxis
|
|
5394
5565
|
};
|
|
5395
|
-
return a && typeof w == "number" && (x = a === "end" ? w * -1 : w),
|
|
5566
|
+
return a && typeof w == "number" && (x = a === "end" ? w * -1 : w), l ? {
|
|
5396
5567
|
x: x * d,
|
|
5397
5568
|
y: u * h
|
|
5398
5569
|
} : {
|
|
@@ -5400,10 +5571,10 @@ async function Pe(l, t) {
|
|
|
5400
5571
|
y: x * d
|
|
5401
5572
|
};
|
|
5402
5573
|
}
|
|
5403
|
-
const ze = function(
|
|
5404
|
-
return
|
|
5574
|
+
const ze = function(c) {
|
|
5575
|
+
return c === void 0 && (c = 0), {
|
|
5405
5576
|
name: "offset",
|
|
5406
|
-
options:
|
|
5577
|
+
options: c,
|
|
5407
5578
|
async fn(t) {
|
|
5408
5579
|
var e, i;
|
|
5409
5580
|
const {
|
|
@@ -5411,21 +5582,21 @@ const ze = function(l) {
|
|
|
5411
5582
|
y: o,
|
|
5412
5583
|
placement: r,
|
|
5413
5584
|
middlewareData: a
|
|
5414
|
-
} = t,
|
|
5585
|
+
} = t, l = await Pe(t, c);
|
|
5415
5586
|
return r === ((e = a.offset) == null ? void 0 : e.placement) && (i = a.arrow) != null && i.alignmentOffset ? {} : {
|
|
5416
|
-
x: s +
|
|
5417
|
-
y: o +
|
|
5587
|
+
x: s + l.x,
|
|
5588
|
+
y: o + l.y,
|
|
5418
5589
|
data: {
|
|
5419
|
-
...
|
|
5590
|
+
...l,
|
|
5420
5591
|
placement: r
|
|
5421
5592
|
}
|
|
5422
5593
|
};
|
|
5423
5594
|
}
|
|
5424
5595
|
};
|
|
5425
|
-
}, $e = function(
|
|
5426
|
-
return
|
|
5596
|
+
}, $e = function(c) {
|
|
5597
|
+
return c === void 0 && (c = {}), {
|
|
5427
5598
|
name: "shift",
|
|
5428
|
-
options:
|
|
5599
|
+
options: c,
|
|
5429
5600
|
async fn(t) {
|
|
5430
5601
|
const {
|
|
5431
5602
|
x: e,
|
|
@@ -5437,28 +5608,28 @@ const ze = function(l) {
|
|
|
5437
5608
|
limiter: a = {
|
|
5438
5609
|
fn: (g) => {
|
|
5439
5610
|
let {
|
|
5440
|
-
x:
|
|
5611
|
+
x: p,
|
|
5441
5612
|
y
|
|
5442
5613
|
} = g;
|
|
5443
5614
|
return {
|
|
5444
|
-
x:
|
|
5615
|
+
x: p,
|
|
5445
5616
|
y
|
|
5446
5617
|
};
|
|
5447
5618
|
}
|
|
5448
5619
|
},
|
|
5449
|
-
...
|
|
5450
|
-
} = J(
|
|
5620
|
+
...l
|
|
5621
|
+
} = J(c, t), h = {
|
|
5451
5622
|
x: e,
|
|
5452
5623
|
y: i
|
|
5453
|
-
}, d = await
|
|
5624
|
+
}, d = await Wt(t, l), f = V(z(s)), u = Kt(f);
|
|
5454
5625
|
let x = h[u], w = h[f];
|
|
5455
5626
|
if (o) {
|
|
5456
|
-
const g = u === "y" ? "top" : "left",
|
|
5457
|
-
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);
|
|
5458
5629
|
}
|
|
5459
5630
|
if (r) {
|
|
5460
|
-
const g = f === "y" ? "top" : "left",
|
|
5461
|
-
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);
|
|
5462
5633
|
}
|
|
5463
5634
|
const m = a.fn({
|
|
5464
5635
|
...t,
|
|
@@ -5482,61 +5653,61 @@ const ze = function(l) {
|
|
|
5482
5653
|
function rt() {
|
|
5483
5654
|
return typeof window < "u";
|
|
5484
5655
|
}
|
|
5485
|
-
function Z(
|
|
5486
|
-
return Vt(
|
|
5656
|
+
function Z(c) {
|
|
5657
|
+
return Vt(c) ? (c.nodeName || "").toLowerCase() : "#document";
|
|
5487
5658
|
}
|
|
5488
|
-
function
|
|
5659
|
+
function H(c) {
|
|
5489
5660
|
var t;
|
|
5490
|
-
return (
|
|
5661
|
+
return (c == null || (t = c.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
5491
5662
|
}
|
|
5492
|
-
function
|
|
5663
|
+
function F(c) {
|
|
5493
5664
|
var t;
|
|
5494
|
-
return (t = (Vt(
|
|
5665
|
+
return (t = (Vt(c) ? c.ownerDocument : c.document) || window.document) == null ? void 0 : t.documentElement;
|
|
5495
5666
|
}
|
|
5496
|
-
function Vt(
|
|
5497
|
-
return rt() ?
|
|
5667
|
+
function Vt(c) {
|
|
5668
|
+
return rt() ? c instanceof Node || c instanceof H(c).Node : !1;
|
|
5498
5669
|
}
|
|
5499
|
-
function
|
|
5500
|
-
return rt() ?
|
|
5670
|
+
function X(c) {
|
|
5671
|
+
return rt() ? c instanceof Element || c instanceof H(c).Element : !1;
|
|
5501
5672
|
}
|
|
5502
|
-
function
|
|
5503
|
-
return rt() ?
|
|
5673
|
+
function K(c) {
|
|
5674
|
+
return rt() ? c instanceof HTMLElement || c instanceof H(c).HTMLElement : !1;
|
|
5504
5675
|
}
|
|
5505
|
-
function Ot(
|
|
5506
|
-
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;
|
|
5507
5678
|
}
|
|
5508
5679
|
const Ge = /* @__PURE__ */ new Set(["inline", "contents"]);
|
|
5509
|
-
function tt(
|
|
5680
|
+
function tt(c) {
|
|
5510
5681
|
const {
|
|
5511
5682
|
overflow: t,
|
|
5512
5683
|
overflowX: e,
|
|
5513
5684
|
overflowY: i,
|
|
5514
5685
|
display: s
|
|
5515
|
-
} =
|
|
5686
|
+
} = Y(c);
|
|
5516
5687
|
return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !Ge.has(s);
|
|
5517
5688
|
}
|
|
5518
5689
|
const Ue = /* @__PURE__ */ new Set(["table", "td", "th"]);
|
|
5519
|
-
function Ze(
|
|
5520
|
-
return Ue.has(Z(
|
|
5690
|
+
function Ze(c) {
|
|
5691
|
+
return Ue.has(Z(c));
|
|
5521
5692
|
}
|
|
5522
5693
|
const je = [":popover-open", ":modal"];
|
|
5523
|
-
function nt(
|
|
5694
|
+
function nt(c) {
|
|
5524
5695
|
return je.some((t) => {
|
|
5525
5696
|
try {
|
|
5526
|
-
return
|
|
5697
|
+
return c.matches(t);
|
|
5527
5698
|
} catch {
|
|
5528
5699
|
return !1;
|
|
5529
5700
|
}
|
|
5530
5701
|
});
|
|
5531
5702
|
}
|
|
5532
5703
|
const qe = ["transform", "translate", "scale", "rotate", "perspective"], Je = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Qe = ["paint", "layout", "strict", "content"];
|
|
5533
|
-
function mt(
|
|
5534
|
-
const t =
|
|
5704
|
+
function mt(c) {
|
|
5705
|
+
const t = pt(), e = X(c) ? Y(c) : c;
|
|
5535
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));
|
|
5536
5707
|
}
|
|
5537
|
-
function ti(
|
|
5538
|
-
let t = P(
|
|
5539
|
-
for (;
|
|
5708
|
+
function ti(c) {
|
|
5709
|
+
let t = P(c);
|
|
5710
|
+
for (; K(t) && !U(t); ) {
|
|
5540
5711
|
if (mt(t))
|
|
5541
5712
|
return t;
|
|
5542
5713
|
if (nt(t))
|
|
@@ -5545,67 +5716,67 @@ function ti(l) {
|
|
|
5545
5716
|
}
|
|
5546
5717
|
return null;
|
|
5547
5718
|
}
|
|
5548
|
-
function
|
|
5719
|
+
function pt() {
|
|
5549
5720
|
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
5550
5721
|
}
|
|
5551
5722
|
const ei = /* @__PURE__ */ new Set(["html", "body", "#document"]);
|
|
5552
|
-
function U(
|
|
5553
|
-
return ei.has(Z(
|
|
5723
|
+
function U(c) {
|
|
5724
|
+
return ei.has(Z(c));
|
|
5554
5725
|
}
|
|
5555
|
-
function
|
|
5556
|
-
return
|
|
5726
|
+
function Y(c) {
|
|
5727
|
+
return H(c).getComputedStyle(c);
|
|
5557
5728
|
}
|
|
5558
|
-
function at(
|
|
5559
|
-
return
|
|
5560
|
-
scrollLeft:
|
|
5561
|
-
scrollTop:
|
|
5729
|
+
function at(c) {
|
|
5730
|
+
return X(c) ? {
|
|
5731
|
+
scrollLeft: c.scrollLeft,
|
|
5732
|
+
scrollTop: c.scrollTop
|
|
5562
5733
|
} : {
|
|
5563
|
-
scrollLeft:
|
|
5564
|
-
scrollTop:
|
|
5734
|
+
scrollLeft: c.scrollX,
|
|
5735
|
+
scrollTop: c.scrollY
|
|
5565
5736
|
};
|
|
5566
5737
|
}
|
|
5567
|
-
function P(
|
|
5568
|
-
if (Z(
|
|
5569
|
-
return
|
|
5738
|
+
function P(c) {
|
|
5739
|
+
if (Z(c) === "html")
|
|
5740
|
+
return c;
|
|
5570
5741
|
const t = (
|
|
5571
5742
|
// Step into the shadow DOM of the parent of a slotted node.
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
Ot(
|
|
5575
|
-
|
|
5743
|
+
c.assignedSlot || // DOM Element detected.
|
|
5744
|
+
c.parentNode || // ShadowRoot detected.
|
|
5745
|
+
Ot(c) && c.host || // Fallback.
|
|
5746
|
+
F(c)
|
|
5576
5747
|
);
|
|
5577
5748
|
return Ot(t) ? t.host : t;
|
|
5578
5749
|
}
|
|
5579
|
-
function Pt(
|
|
5580
|
-
const t = P(
|
|
5581
|
-
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);
|
|
5582
5753
|
}
|
|
5583
|
-
function zt(
|
|
5754
|
+
function zt(c, t, e) {
|
|
5584
5755
|
var i;
|
|
5585
5756
|
t === void 0 && (t = []);
|
|
5586
|
-
const s = Pt(
|
|
5757
|
+
const s = Pt(c), o = s === ((i = c.ownerDocument) == null ? void 0 : i.body), r = H(s);
|
|
5587
5758
|
return o ? (ft(r), t.concat(r, r.visualViewport || [], tt(s) ? s : [], [])) : t.concat(s, zt(s, []));
|
|
5588
5759
|
}
|
|
5589
|
-
function ft(
|
|
5590
|
-
return
|
|
5760
|
+
function ft(c) {
|
|
5761
|
+
return c.parent && Object.getPrototypeOf(c.parent) ? c.frameElement : null;
|
|
5591
5762
|
}
|
|
5592
|
-
function $t(
|
|
5593
|
-
const t =
|
|
5763
|
+
function $t(c) {
|
|
5764
|
+
const t = Y(c);
|
|
5594
5765
|
let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
|
|
5595
|
-
const s =
|
|
5766
|
+
const s = K(c), o = s ? c.offsetWidth : e, r = s ? c.offsetHeight : i, a = it(e) !== o || it(i) !== r;
|
|
5596
5767
|
return a && (e = o, i = r), {
|
|
5597
5768
|
width: e,
|
|
5598
5769
|
height: i,
|
|
5599
5770
|
$: a
|
|
5600
5771
|
};
|
|
5601
5772
|
}
|
|
5602
|
-
function Gt(
|
|
5603
|
-
return
|
|
5773
|
+
function Gt(c) {
|
|
5774
|
+
return X(c) ? c : c.contextElement;
|
|
5604
5775
|
}
|
|
5605
|
-
function G(
|
|
5606
|
-
const t = Gt(
|
|
5607
|
-
if (!
|
|
5608
|
-
return
|
|
5776
|
+
function G(c) {
|
|
5777
|
+
const t = Gt(c);
|
|
5778
|
+
if (!K(t))
|
|
5779
|
+
return B(1);
|
|
5609
5780
|
const e = t.getBoundingClientRect(), {
|
|
5610
5781
|
width: i,
|
|
5611
5782
|
height: s,
|
|
@@ -5617,130 +5788,130 @@ function G(l) {
|
|
|
5617
5788
|
y: a
|
|
5618
5789
|
};
|
|
5619
5790
|
}
|
|
5620
|
-
const ii = /* @__PURE__ */
|
|
5621
|
-
function Ut(
|
|
5622
|
-
const t =
|
|
5623
|
-
return !
|
|
5791
|
+
const ii = /* @__PURE__ */ B(0);
|
|
5792
|
+
function Ut(c) {
|
|
5793
|
+
const t = H(c);
|
|
5794
|
+
return !pt() || !t.visualViewport ? ii : {
|
|
5624
5795
|
x: t.visualViewport.offsetLeft,
|
|
5625
5796
|
y: t.visualViewport.offsetTop
|
|
5626
5797
|
};
|
|
5627
5798
|
}
|
|
5628
|
-
function si(
|
|
5629
|
-
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;
|
|
5630
5801
|
}
|
|
5631
|
-
function q(
|
|
5802
|
+
function q(c, t, e, i) {
|
|
5632
5803
|
t === void 0 && (t = !1), e === void 0 && (e = !1);
|
|
5633
|
-
const s =
|
|
5634
|
-
let r =
|
|
5635
|
-
t && (i ?
|
|
5636
|
-
const a = si(o, e, i) ? Ut(o) :
|
|
5637
|
-
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;
|
|
5638
5809
|
if (o) {
|
|
5639
|
-
const u =
|
|
5810
|
+
const u = H(o), x = i && X(i) ? H(i) : i;
|
|
5640
5811
|
let w = u, m = ft(w);
|
|
5641
5812
|
for (; m && i && x !== w; ) {
|
|
5642
|
-
const g = G(m),
|
|
5643
|
-
|
|
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);
|
|
5644
5815
|
}
|
|
5645
5816
|
}
|
|
5646
5817
|
return ot({
|
|
5647
5818
|
width: d,
|
|
5648
5819
|
height: f,
|
|
5649
|
-
x:
|
|
5820
|
+
x: l,
|
|
5650
5821
|
y: h
|
|
5651
5822
|
});
|
|
5652
5823
|
}
|
|
5653
|
-
function
|
|
5654
|
-
const e = at(
|
|
5655
|
-
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;
|
|
5656
5827
|
}
|
|
5657
|
-
function Zt(
|
|
5828
|
+
function Zt(c, t, e) {
|
|
5658
5829
|
e === void 0 && (e = !1);
|
|
5659
|
-
const i =
|
|
5830
|
+
const i = c.getBoundingClientRect(), s = i.left + t.scrollLeft - (e ? 0 : (
|
|
5660
5831
|
// RTL <body> scrollbar.
|
|
5661
|
-
|
|
5832
|
+
Et(c, i)
|
|
5662
5833
|
)), o = i.top + t.scrollTop;
|
|
5663
5834
|
return {
|
|
5664
5835
|
x: s,
|
|
5665
5836
|
y: o
|
|
5666
5837
|
};
|
|
5667
5838
|
}
|
|
5668
|
-
function oi(
|
|
5839
|
+
function oi(c) {
|
|
5669
5840
|
let {
|
|
5670
5841
|
elements: t,
|
|
5671
5842
|
rect: e,
|
|
5672
5843
|
offsetParent: i,
|
|
5673
5844
|
strategy: s
|
|
5674
|
-
} =
|
|
5675
|
-
const o = s === "fixed", r =
|
|
5845
|
+
} = c;
|
|
5846
|
+
const o = s === "fixed", r = F(i), a = t ? nt(t.floating) : !1;
|
|
5676
5847
|
if (i === r || a && o)
|
|
5677
5848
|
return e;
|
|
5678
|
-
let
|
|
5849
|
+
let l = {
|
|
5679
5850
|
scrollLeft: 0,
|
|
5680
5851
|
scrollTop: 0
|
|
5681
|
-
}, h =
|
|
5682
|
-
const d =
|
|
5683
|
-
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))) {
|
|
5684
5855
|
const x = q(i);
|
|
5685
5856
|
h = G(i), d.x = x.x + i.clientLeft, d.y = x.y + i.clientTop;
|
|
5686
5857
|
}
|
|
5687
|
-
const u = r && !f && !o ? Zt(r,
|
|
5858
|
+
const u = r && !f && !o ? Zt(r, l, !0) : B(0);
|
|
5688
5859
|
return {
|
|
5689
5860
|
width: e.width * h.x,
|
|
5690
5861
|
height: e.height * h.y,
|
|
5691
|
-
x: e.x * h.x -
|
|
5692
|
-
y: e.y * 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
|
|
5693
5864
|
};
|
|
5694
5865
|
}
|
|
5695
|
-
function ri(
|
|
5696
|
-
return Array.from(
|
|
5866
|
+
function ri(c) {
|
|
5867
|
+
return Array.from(c.getClientRects());
|
|
5697
5868
|
}
|
|
5698
|
-
function ni(
|
|
5699
|
-
const t =
|
|
5700
|
-
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);
|
|
5701
5872
|
const a = -e.scrollTop;
|
|
5702
|
-
return
|
|
5873
|
+
return Y(i).direction === "rtl" && (r += $(t.clientWidth, i.clientWidth) - s), {
|
|
5703
5874
|
width: s,
|
|
5704
5875
|
height: o,
|
|
5705
5876
|
x: r,
|
|
5706
5877
|
y: a
|
|
5707
5878
|
};
|
|
5708
5879
|
}
|
|
5709
|
-
function ai(
|
|
5710
|
-
const e =
|
|
5711
|
-
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;
|
|
5712
5883
|
if (s) {
|
|
5713
5884
|
o = s.width, r = s.height;
|
|
5714
|
-
const h =
|
|
5715
|
-
(!h || h && t === "fixed") && (a = s.offsetLeft,
|
|
5885
|
+
const h = pt();
|
|
5886
|
+
(!h || h && t === "fixed") && (a = s.offsetLeft, l = s.offsetTop);
|
|
5716
5887
|
}
|
|
5717
5888
|
return {
|
|
5718
5889
|
width: o,
|
|
5719
5890
|
height: r,
|
|
5720
5891
|
x: a,
|
|
5721
|
-
y:
|
|
5892
|
+
y: l
|
|
5722
5893
|
};
|
|
5723
5894
|
}
|
|
5724
|
-
const
|
|
5725
|
-
function hi(
|
|
5726
|
-
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;
|
|
5727
5898
|
return {
|
|
5728
5899
|
width: r,
|
|
5729
5900
|
height: a,
|
|
5730
|
-
x:
|
|
5901
|
+
x: l,
|
|
5731
5902
|
y: h
|
|
5732
5903
|
};
|
|
5733
5904
|
}
|
|
5734
|
-
function Lt(
|
|
5905
|
+
function Lt(c, t, e) {
|
|
5735
5906
|
let i;
|
|
5736
5907
|
if (t === "viewport")
|
|
5737
|
-
i = ai(
|
|
5908
|
+
i = ai(c, e);
|
|
5738
5909
|
else if (t === "document")
|
|
5739
|
-
i = ni(
|
|
5740
|
-
else if (
|
|
5910
|
+
i = ni(F(c));
|
|
5911
|
+
else if (X(t))
|
|
5741
5912
|
i = hi(t, e);
|
|
5742
5913
|
else {
|
|
5743
|
-
const s = Ut(
|
|
5914
|
+
const s = Ut(c);
|
|
5744
5915
|
i = {
|
|
5745
5916
|
x: t.x - s.x,
|
|
5746
5917
|
y: t.y - s.y,
|
|
@@ -5750,68 +5921,68 @@ function Lt(l, t, e) {
|
|
|
5750
5921
|
}
|
|
5751
5922
|
return ot(i);
|
|
5752
5923
|
}
|
|
5753
|
-
function jt(
|
|
5754
|
-
const e = P(
|
|
5755
|
-
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);
|
|
5756
5927
|
}
|
|
5757
|
-
function
|
|
5758
|
-
const e = t.get(
|
|
5928
|
+
function ci(c, t) {
|
|
5929
|
+
const e = t.get(c);
|
|
5759
5930
|
if (e)
|
|
5760
5931
|
return e;
|
|
5761
|
-
let i = zt(
|
|
5762
|
-
const o =
|
|
5763
|
-
let r = o ? P(
|
|
5764
|
-
for (;
|
|
5765
|
-
const a =
|
|
5766
|
-
!
|
|
5767
|
-
}
|
|
5768
|
-
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;
|
|
5769
5940
|
}
|
|
5770
|
-
function di(
|
|
5941
|
+
function di(c) {
|
|
5771
5942
|
let {
|
|
5772
5943
|
element: t,
|
|
5773
5944
|
boundary: e,
|
|
5774
5945
|
rootBoundary: i,
|
|
5775
5946
|
strategy: s
|
|
5776
|
-
} =
|
|
5777
|
-
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) => {
|
|
5778
5949
|
const f = Lt(t, d, s);
|
|
5779
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;
|
|
5780
5951
|
}, Lt(t, a, s));
|
|
5781
5952
|
return {
|
|
5782
|
-
width:
|
|
5783
|
-
height:
|
|
5784
|
-
x:
|
|
5785
|
-
y:
|
|
5953
|
+
width: l.right - l.left,
|
|
5954
|
+
height: l.bottom - l.top,
|
|
5955
|
+
x: l.left,
|
|
5956
|
+
y: l.top
|
|
5786
5957
|
};
|
|
5787
5958
|
}
|
|
5788
|
-
function fi(
|
|
5959
|
+
function fi(c) {
|
|
5789
5960
|
const {
|
|
5790
5961
|
width: t,
|
|
5791
5962
|
height: e
|
|
5792
|
-
} = $t(
|
|
5963
|
+
} = $t(c);
|
|
5793
5964
|
return {
|
|
5794
5965
|
width: t,
|
|
5795
5966
|
height: e
|
|
5796
5967
|
};
|
|
5797
5968
|
}
|
|
5798
|
-
function xi(
|
|
5799
|
-
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);
|
|
5800
5971
|
let a = {
|
|
5801
5972
|
scrollLeft: 0,
|
|
5802
5973
|
scrollTop: 0
|
|
5803
5974
|
};
|
|
5804
|
-
const
|
|
5975
|
+
const l = B(0);
|
|
5805
5976
|
function h() {
|
|
5806
|
-
|
|
5977
|
+
l.x = Et(s);
|
|
5807
5978
|
}
|
|
5808
5979
|
if (i || !i && !o)
|
|
5809
5980
|
if ((Z(t) !== "body" || tt(s)) && (a = at(t)), i) {
|
|
5810
5981
|
const x = q(t, !0, o, t);
|
|
5811
|
-
|
|
5982
|
+
l.x = x.x + t.clientLeft, l.y = x.y + t.clientTop;
|
|
5812
5983
|
} else s && h();
|
|
5813
5984
|
o && !i && s && h();
|
|
5814
|
-
const d = s && !i && !o ? Zt(s, a) :
|
|
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;
|
|
5815
5986
|
return {
|
|
5816
5987
|
x: f,
|
|
5817
5988
|
y: u,
|
|
@@ -5819,39 +5990,39 @@ function xi(l, t, e) {
|
|
|
5819
5990
|
height: r.height
|
|
5820
5991
|
};
|
|
5821
5992
|
}
|
|
5822
|
-
function
|
|
5823
|
-
return
|
|
5993
|
+
function lt(c) {
|
|
5994
|
+
return Y(c).position === "static";
|
|
5824
5995
|
}
|
|
5825
|
-
function
|
|
5826
|
-
if (!
|
|
5996
|
+
function Mt(c, t) {
|
|
5997
|
+
if (!K(c) || Y(c).position === "fixed")
|
|
5827
5998
|
return null;
|
|
5828
5999
|
if (t)
|
|
5829
|
-
return t(
|
|
5830
|
-
let e =
|
|
5831
|
-
return
|
|
6000
|
+
return t(c);
|
|
6001
|
+
let e = c.offsetParent;
|
|
6002
|
+
return F(c) === e && (e = e.ownerDocument.body), e;
|
|
5832
6003
|
}
|
|
5833
|
-
function qt(
|
|
5834
|
-
const e =
|
|
5835
|
-
if (nt(
|
|
6004
|
+
function qt(c, t) {
|
|
6005
|
+
const e = H(c);
|
|
6006
|
+
if (nt(c))
|
|
5836
6007
|
return e;
|
|
5837
|
-
if (!
|
|
5838
|
-
let s = P(
|
|
6008
|
+
if (!K(c)) {
|
|
6009
|
+
let s = P(c);
|
|
5839
6010
|
for (; s && !U(s); ) {
|
|
5840
|
-
if (
|
|
6011
|
+
if (X(s) && !lt(s))
|
|
5841
6012
|
return s;
|
|
5842
6013
|
s = P(s);
|
|
5843
6014
|
}
|
|
5844
6015
|
return e;
|
|
5845
6016
|
}
|
|
5846
|
-
let i =
|
|
5847
|
-
for (; i && Ze(i) &&
|
|
5848
|
-
i =
|
|
5849
|
-
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;
|
|
5850
6021
|
}
|
|
5851
|
-
const ui = async function(
|
|
5852
|
-
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);
|
|
5853
6024
|
return {
|
|
5854
|
-
reference: xi(
|
|
6025
|
+
reference: xi(c.reference, await t(c.floating), c.strategy),
|
|
5855
6026
|
floating: {
|
|
5856
6027
|
x: 0,
|
|
5857
6028
|
y: 0,
|
|
@@ -5860,21 +6031,21 @@ const ui = async function(l) {
|
|
|
5860
6031
|
}
|
|
5861
6032
|
};
|
|
5862
6033
|
};
|
|
5863
|
-
function gi(
|
|
5864
|
-
return
|
|
6034
|
+
function gi(c) {
|
|
6035
|
+
return Y(c).direction === "rtl";
|
|
5865
6036
|
}
|
|
5866
6037
|
const wi = {
|
|
5867
6038
|
convertOffsetParentRelativeRectToViewportRelativeRect: oi,
|
|
5868
|
-
getDocumentElement:
|
|
6039
|
+
getDocumentElement: F,
|
|
5869
6040
|
getClippingRect: di,
|
|
5870
6041
|
getOffsetParent: qt,
|
|
5871
6042
|
getElementRects: ui,
|
|
5872
6043
|
getClientRects: ri,
|
|
5873
6044
|
getDimensions: fi,
|
|
5874
6045
|
getScale: G,
|
|
5875
|
-
isElement:
|
|
6046
|
+
isElement: X,
|
|
5876
6047
|
isRTL: gi
|
|
5877
|
-
}, Jt = ze, Qt = $e, te =
|
|
6048
|
+
}, Jt = ze, Qt = $e, te = We, mi = Fe, ee = (c, t, e) => {
|
|
5878
6049
|
const i = /* @__PURE__ */ new Map(), s = {
|
|
5879
6050
|
platform: wi,
|
|
5880
6051
|
...e
|
|
@@ -5882,12 +6053,12 @@ const wi = {
|
|
|
5882
6053
|
...s.platform,
|
|
5883
6054
|
_c: i
|
|
5884
6055
|
};
|
|
5885
|
-
return Ke(
|
|
6056
|
+
return Ke(c, t, {
|
|
5886
6057
|
...s,
|
|
5887
6058
|
platform: o
|
|
5888
6059
|
});
|
|
5889
6060
|
};
|
|
5890
|
-
let
|
|
6061
|
+
let pi = class {
|
|
5891
6062
|
constructor(t) {
|
|
5892
6063
|
n(this, "ctx");
|
|
5893
6064
|
n(this, "enable", !1);
|
|
@@ -5908,7 +6079,7 @@ let Ei = class {
|
|
|
5908
6079
|
borderRadius: "4px",
|
|
5909
6080
|
fontSize: "12px",
|
|
5910
6081
|
...o
|
|
5911
|
-
},
|
|
6082
|
+
}, l = {
|
|
5912
6083
|
position: "absolute",
|
|
5913
6084
|
width: "10px",
|
|
5914
6085
|
height: "10px",
|
|
@@ -5917,7 +6088,7 @@ let Ei = class {
|
|
|
5917
6088
|
transform: "rotate(45deg)",
|
|
5918
6089
|
zIndex: a.zIndex
|
|
5919
6090
|
};
|
|
5920
|
-
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();
|
|
5921
6092
|
}
|
|
5922
6093
|
init() {
|
|
5923
6094
|
this.floatingEl.addEventListener("mouseleave", () => {
|
|
@@ -5966,10 +6137,10 @@ let Ei = class {
|
|
|
5966
6137
|
placement: t.overflowTooltipPlacement,
|
|
5967
6138
|
middleware: [Qt(), te(), Jt(6), mi({ element: this.arrowEl })]
|
|
5968
6139
|
}).then((a) => {
|
|
5969
|
-
const { x:
|
|
6140
|
+
const { x: l, y: h, placement: d, middlewareData: f } = a;
|
|
5970
6141
|
if (Object.assign(this.floatingEl.style, {
|
|
5971
6142
|
top: `${h}px`,
|
|
5972
|
-
left: `${
|
|
6143
|
+
left: `${l}px`
|
|
5973
6144
|
}), f.arrow) {
|
|
5974
6145
|
const u = f.arrow;
|
|
5975
6146
|
["left", "left-start", "left-end"].includes(d) ? Object.assign(this.arrowEl.style, {
|
|
@@ -6003,7 +6174,7 @@ let Ei = class {
|
|
|
6003
6174
|
this.contentEl.remove(), this.arrowEl.remove(), this.floatingEl.remove();
|
|
6004
6175
|
}
|
|
6005
6176
|
};
|
|
6006
|
-
class
|
|
6177
|
+
class Ei {
|
|
6007
6178
|
constructor(t) {
|
|
6008
6179
|
n(this, "editorEl");
|
|
6009
6180
|
n(this, "inputEl");
|
|
@@ -6034,15 +6205,15 @@ class pi {
|
|
|
6034
6205
|
return;
|
|
6035
6206
|
if (t.code === "Escape" && this.ctx.editing) {
|
|
6036
6207
|
this.cancel = !0;
|
|
6037
|
-
const { focusCell:
|
|
6038
|
-
|
|
6208
|
+
const { focusCell: l } = this.ctx;
|
|
6209
|
+
l && (this.ctx.emit("setSelectorCell", l), this.cellTarget = l), this.doneEdit();
|
|
6039
6210
|
return;
|
|
6040
6211
|
}
|
|
6041
6212
|
if ((t.altKey || t.metaKey) && t.code === "Enter" && this.ctx.editing && this.inputEl) {
|
|
6042
6213
|
t.preventDefault();
|
|
6043
|
-
const
|
|
6214
|
+
const l = this.inputEl.selectionStart, h = this.inputEl.value.substring(0, l), d = this.inputEl.value.substring(l);
|
|
6044
6215
|
this.inputEl.value = h + `
|
|
6045
|
-
` + d, this.inputEl.selectionStart = this.inputEl.selectionEnd =
|
|
6216
|
+
` + d, this.inputEl.selectionStart = this.inputEl.selectionEnd = l + 1, this.autoSize();
|
|
6046
6217
|
return;
|
|
6047
6218
|
}
|
|
6048
6219
|
if (t.code === "Tab" && this.ctx.editing) {
|
|
@@ -6094,11 +6265,7 @@ class pi {
|
|
|
6094
6265
|
"F11",
|
|
6095
6266
|
"F12"
|
|
6096
6267
|
].includes(e) || this.startEdit(!0);
|
|
6097
|
-
}), this.ctx.on("
|
|
6098
|
-
this.cellTarget = t;
|
|
6099
|
-
const { xArr: e, yArr: i } = this.ctx.selector;
|
|
6100
|
-
this.selectorArrStr = JSON.stringify(e) + JSON.stringify(i);
|
|
6101
|
-
}), this.ctx.on("cellClick", (t) => {
|
|
6268
|
+
}), this.ctx.on("cellMouseup", (t) => {
|
|
6102
6269
|
if (this.ctx.adjustPositioning || this.ctx.isPointer || !this.isInSelectorRange(t.rowIndex, t.colIndex))
|
|
6103
6270
|
return;
|
|
6104
6271
|
const { xArr: e, yArr: i } = this.ctx.selector, s = JSON.stringify(e) + JSON.stringify(i);
|
|
@@ -6122,8 +6289,8 @@ class pi {
|
|
|
6122
6289
|
});
|
|
6123
6290
|
}
|
|
6124
6291
|
isInSelectorRange(t, e) {
|
|
6125
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a,
|
|
6126
|
-
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);
|
|
6127
6294
|
}
|
|
6128
6295
|
initTextEditor() {
|
|
6129
6296
|
this.inputEl = document.createElement("textarea"), this.inputEl.setAttribute("rows", "1"), this.inputEl.addEventListener("input", this.autoSize.bind(this)), this.inputEl.addEventListener("blur", () => {
|
|
@@ -6145,8 +6312,8 @@ class pi {
|
|
|
6145
6312
|
startEditByInput(t, e = !1) {
|
|
6146
6313
|
const i = e ? null : t.getValue(), { editorType: s } = t;
|
|
6147
6314
|
t.update(), this.ctx.config.ENABLE_MERGE_CELL_LINK && t.updateSpanInfo();
|
|
6148
|
-
let { height: o, width: r, drawY: a, drawX:
|
|
6149
|
-
this.drawX =
|
|
6315
|
+
let { height: o, width: r, drawY: a, drawX: l } = t;
|
|
6316
|
+
this.drawX = l, this.drawY = a;
|
|
6150
6317
|
const {
|
|
6151
6318
|
config: { CELL_PADDING: h },
|
|
6152
6319
|
header: d
|
|
@@ -6172,13 +6339,13 @@ class pi {
|
|
|
6172
6339
|
if (!e)
|
|
6173
6340
|
return;
|
|
6174
6341
|
const i = this.ctx.focusCell;
|
|
6175
|
-
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()))
|
|
6176
6343
|
return;
|
|
6177
6344
|
const { rowKey: o, key: r, editorType: a } = i;
|
|
6178
6345
|
if (a === "none")
|
|
6179
6346
|
return;
|
|
6180
|
-
const
|
|
6181
|
-
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));
|
|
6182
6349
|
}
|
|
6183
6350
|
editCell(t, e) {
|
|
6184
6351
|
const i = this.ctx.body.renderRows.find((h) => h.rowIndex === t);
|
|
@@ -6191,14 +6358,14 @@ class pi {
|
|
|
6191
6358
|
const o = this.ctx.focusCell;
|
|
6192
6359
|
if (!o || ["index", "index-selection", "selection"].includes(o.type) || this.enable)
|
|
6193
6360
|
return;
|
|
6194
|
-
const { rowKey: r, key: a } = o,
|
|
6195
|
-
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));
|
|
6196
6363
|
}
|
|
6197
6364
|
doneEdit() {
|
|
6198
|
-
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"));
|
|
6199
6366
|
}
|
|
6200
6367
|
clearEditor() {
|
|
6201
|
-
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");
|
|
6202
6369
|
}
|
|
6203
6370
|
destroy() {
|
|
6204
6371
|
var t;
|
|
@@ -6212,13 +6379,13 @@ class yi {
|
|
|
6212
6379
|
this.ctx = t;
|
|
6213
6380
|
const { EMPTY_TEXT: e, EMPTY_CUSTOM_STYLE: i } = this.ctx.config;
|
|
6214
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 }) => {
|
|
6215
|
-
const
|
|
6382
|
+
const l = o + (r + a) / 2, h = {
|
|
6216
6383
|
display: s === "empty" ? "block" : "none",
|
|
6217
6384
|
position: "absolute",
|
|
6218
6385
|
fontSize: "14px",
|
|
6219
6386
|
color: "#666",
|
|
6220
6387
|
left: "50%",
|
|
6221
|
-
top: `${
|
|
6388
|
+
top: `${l}px`,
|
|
6222
6389
|
transform: "translate(-50%, -50%)",
|
|
6223
6390
|
...i
|
|
6224
6391
|
};
|
|
@@ -6232,14 +6399,17 @@ class yi {
|
|
|
6232
6399
|
class Ci {
|
|
6233
6400
|
constructor(t) {
|
|
6234
6401
|
n(this, "ctx");
|
|
6235
|
-
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 });
|
|
6236
6406
|
}
|
|
6237
6407
|
draw() {
|
|
6238
6408
|
const t = this.getContainer();
|
|
6239
6409
|
this.ctx.emit("overlayerChange", t);
|
|
6240
6410
|
}
|
|
6241
6411
|
destroy() {
|
|
6242
|
-
this.ctx.emit("overlayerChange", {
|
|
6412
|
+
this.observer && this.observer.disconnect(), this.ctx.emit("overlayerChange", {
|
|
6243
6413
|
style: {},
|
|
6244
6414
|
views: []
|
|
6245
6415
|
});
|
|
@@ -6258,9 +6428,9 @@ class Ci {
|
|
|
6258
6428
|
fixedRightWidth: e,
|
|
6259
6429
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
6260
6430
|
} = this.ctx, { visibleWidth: o, visibleHeight: r, renderCellHeaders: a } = this.ctx.header;
|
|
6261
|
-
let
|
|
6431
|
+
let l = [], h = [], d = [];
|
|
6262
6432
|
a.forEach((g) => {
|
|
6263
|
-
g.render && (g.fixed === "left" ? h.push(g) : g.fixed === "right" ? d.push(g) :
|
|
6433
|
+
g.render && (g.fixed === "left" ? h.push(g) : g.fixed === "right" ? d.push(g) : l.push(g));
|
|
6264
6434
|
});
|
|
6265
6435
|
const f = e - i, u = {
|
|
6266
6436
|
key: "left",
|
|
@@ -6283,7 +6453,7 @@ class Ci {
|
|
|
6283
6453
|
width: `${o - t - f + 1}px`,
|
|
6284
6454
|
height: `${r}px`
|
|
6285
6455
|
},
|
|
6286
|
-
cells:
|
|
6456
|
+
cells: l
|
|
6287
6457
|
}, w = {
|
|
6288
6458
|
key: "right",
|
|
6289
6459
|
style: {
|
|
@@ -6312,14 +6482,14 @@ class Ci {
|
|
|
6312
6482
|
const t = [], e = [], i = [];
|
|
6313
6483
|
let s = this.ctx.body.renderRows;
|
|
6314
6484
|
this.ctx.config.FOOTER_FIXED || (s = s.concat(this.ctx.footer.renderRows)), s.forEach((g) => {
|
|
6315
|
-
g.cells.forEach((
|
|
6316
|
-
|
|
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));
|
|
6317
6487
|
});
|
|
6318
6488
|
});
|
|
6319
6489
|
const {
|
|
6320
6490
|
fixedLeftWidth: o,
|
|
6321
6491
|
fixedRightWidth: r,
|
|
6322
|
-
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX:
|
|
6492
|
+
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX: l }
|
|
6323
6493
|
} = this.ctx, { visibleWidth: h, visibleHeight: d } = this.ctx.body, f = r - a, u = {
|
|
6324
6494
|
key: "left",
|
|
6325
6495
|
style: {
|
|
@@ -6356,7 +6526,7 @@ class Ci {
|
|
|
6356
6526
|
};
|
|
6357
6527
|
return {
|
|
6358
6528
|
type: "body",
|
|
6359
|
-
class: `${
|
|
6529
|
+
class: `${l}-overlayer-body`,
|
|
6360
6530
|
style: {
|
|
6361
6531
|
position: "relative",
|
|
6362
6532
|
overflow: "hidden",
|
|
@@ -6377,7 +6547,7 @@ class Ci {
|
|
|
6377
6547
|
fixedLeftWidth: s,
|
|
6378
6548
|
fixedRightWidth: o,
|
|
6379
6549
|
config: { SCROLLER_TRACK_SIZE: r, CSS_PREFIX: a }
|
|
6380
|
-
} = this.ctx, { visibleWidth:
|
|
6550
|
+
} = this.ctx, { visibleWidth: l, visibleHeight: h } = this.ctx.footer, d = o - r, f = {
|
|
6381
6551
|
key: "left",
|
|
6382
6552
|
style: {
|
|
6383
6553
|
position: "absolute",
|
|
@@ -6395,7 +6565,7 @@ class Ci {
|
|
|
6395
6565
|
top: `${0.5}px`,
|
|
6396
6566
|
left: `${s - 0.5}px`,
|
|
6397
6567
|
overflow: "hidden",
|
|
6398
|
-
width: `${
|
|
6568
|
+
width: `${l - s - d}px`,
|
|
6399
6569
|
height: `${h}px`
|
|
6400
6570
|
},
|
|
6401
6571
|
cells: t
|
|
@@ -6417,7 +6587,7 @@ class Ci {
|
|
|
6417
6587
|
style: {
|
|
6418
6588
|
position: "relative",
|
|
6419
6589
|
overflow: "hidden",
|
|
6420
|
-
width: `${
|
|
6590
|
+
width: `${l}px`,
|
|
6421
6591
|
height: `${h}px`
|
|
6422
6592
|
},
|
|
6423
6593
|
views: [f, u, x]
|
|
@@ -6435,8 +6605,8 @@ class bi {
|
|
|
6435
6605
|
this.ctx.on("cellContextMenuClick", (t, e) => {
|
|
6436
6606
|
if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
|
|
6437
6607
|
e.preventDefault();
|
|
6438
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a,
|
|
6439
|
-
h >= a && h <=
|
|
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);
|
|
6440
6610
|
const u = {
|
|
6441
6611
|
getBoundingClientRect: () => ({
|
|
6442
6612
|
width: 0,
|
|
@@ -6533,7 +6703,7 @@ class Si {
|
|
|
6533
6703
|
o,
|
|
6534
6704
|
r
|
|
6535
6705
|
);
|
|
6536
|
-
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", () => {
|
|
6537
6707
|
this.draw();
|
|
6538
6708
|
}), this.ctx.on("drawView", () => {
|
|
6539
6709
|
this.draw(!0);
|
|
@@ -6541,16 +6711,16 @@ class Si {
|
|
|
6541
6711
|
}
|
|
6542
6712
|
createContainer(t, e, i, s, o) {
|
|
6543
6713
|
t.className = "e-virt-table-container";
|
|
6544
|
-
const r = document.createElement("div"), a = document.createElement("canvas"),
|
|
6545
|
-
r.className = "e-virt-table-stage", t.tabIndex = 0, a.className = "e-virt-table-canvas",
|
|
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";
|
|
6546
6716
|
const h = i || document.createElement("div");
|
|
6547
6717
|
h.className = "e-virt-table-editor";
|
|
6548
6718
|
const d = s, f = o;
|
|
6549
|
-
return r.appendChild(a), r.appendChild(
|
|
6719
|
+
return r.appendChild(a), r.appendChild(l), t.appendChild(r), {
|
|
6550
6720
|
containerElement: t,
|
|
6551
6721
|
stageElement: r,
|
|
6552
6722
|
canvasElement: a,
|
|
6553
|
-
overlayerElement:
|
|
6723
|
+
overlayerElement: l,
|
|
6554
6724
|
editorElement: h,
|
|
6555
6725
|
emptyElement: d,
|
|
6556
6726
|
contextMenuElement: f
|
|
@@ -6638,15 +6808,15 @@ class Si {
|
|
|
6638
6808
|
return new Promise(async (i, s) => {
|
|
6639
6809
|
let o = [];
|
|
6640
6810
|
for (let r = 0; r < t.length; r++) {
|
|
6641
|
-
const { rowKey: a, key:
|
|
6811
|
+
const { rowKey: a, key: l } = t[r], h = await this.ctx.database.getValidator(a, l);
|
|
6642
6812
|
Array.isArray(h) && h.length && o.push(h);
|
|
6643
6813
|
}
|
|
6644
6814
|
if (o.length) {
|
|
6645
6815
|
if (s(o), e) {
|
|
6646
6816
|
const [r] = o;
|
|
6647
6817
|
if (Array.isArray(r) && r.length) {
|
|
6648
|
-
const [a] = r, { rowKey:
|
|
6649
|
-
this.scrollToRowkey(
|
|
6818
|
+
const [a] = r, { rowKey: l, key: h } = a;
|
|
6819
|
+
this.scrollToRowkey(l), this.scrollToColkey(h);
|
|
6650
6820
|
}
|
|
6651
6821
|
}
|
|
6652
6822
|
this.ctx.emit("draw");
|
|
@@ -6663,12 +6833,12 @@ class Si {
|
|
|
6663
6833
|
if (t && Array.isArray(s) && s.length) {
|
|
6664
6834
|
const [o] = s;
|
|
6665
6835
|
if (Array.isArray(o) && o.length) {
|
|
6666
|
-
const [r] = o, { rowKey: a, key:
|
|
6836
|
+
const [r] = o, { rowKey: a, key: l } = r, h = this.ctx.database.getRowForRowKey(a);
|
|
6667
6837
|
if (h) {
|
|
6668
6838
|
const { parentRowKeys: d = [] } = h;
|
|
6669
6839
|
d && d.length && this.setExpandRowKeys(d, !0);
|
|
6670
6840
|
}
|
|
6671
|
-
this.scrollToRowkey(a), this.scrollToColkey(
|
|
6841
|
+
this.scrollToRowkey(a), this.scrollToColkey(l);
|
|
6672
6842
|
}
|
|
6673
6843
|
}
|
|
6674
6844
|
i(s);
|
|
@@ -6693,7 +6863,7 @@ class Si {
|
|
|
6693
6863
|
let o = [];
|
|
6694
6864
|
for (let r = 0; r < i.length; r++)
|
|
6695
6865
|
for (let a = 0; a < s.length; a++) {
|
|
6696
|
-
const
|
|
6866
|
+
const l = this.ctx.database.getRowKeyByItem(i[r]), d = s[a].key, f = await this.ctx.database.getValidator(l, d);
|
|
6697
6867
|
Array.isArray(f) && f.length && o.push(f);
|
|
6698
6868
|
}
|
|
6699
6869
|
o.length ? (e(o), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
|
|
@@ -6777,7 +6947,7 @@ class Si {
|
|
|
6777
6947
|
getUtils() {
|
|
6778
6948
|
return {
|
|
6779
6949
|
mergeColCell: de,
|
|
6780
|
-
mergeRowCell:
|
|
6950
|
+
mergeRowCell: ce,
|
|
6781
6951
|
getSpanArrByRow: kt,
|
|
6782
6952
|
getSpanObjByColumn: Xt
|
|
6783
6953
|
};
|