e-virt-table 1.2.31 → 1.2.33
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 +5 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1136 -1091
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +5 -5
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Autofill.js +6 -0
- package/dist/lib/Autofill.js.map +1 -1
- package/dist/lib/Body.js +15 -4
- package/dist/lib/Body.js.map +1 -1
- package/dist/lib/Cell.js +1 -1
- package/dist/lib/Cell.js.map +1 -1
- package/dist/lib/CellHeader.d.ts +1 -1
- package/dist/lib/CellHeader.js +8 -4
- package/dist/lib/CellHeader.js.map +1 -1
- package/dist/lib/Config.d.ts +21 -2
- package/dist/lib/Config.js +71 -7
- package/dist/lib/Config.js.map +1 -1
- package/dist/lib/Context.d.ts +7 -0
- package/dist/lib/Context.js +32 -1
- package/dist/lib/Context.js.map +1 -1
- package/dist/lib/Database.d.ts +0 -3
- package/dist/lib/Database.js +0 -15
- package/dist/lib/Database.js.map +1 -1
- package/dist/lib/EVirtTable.d.ts +1 -0
- package/dist/lib/EVirtTable.js +16 -1
- package/dist/lib/EVirtTable.js.map +1 -1
- package/dist/lib/EventTable.js +3 -0
- package/dist/lib/EventTable.js.map +1 -1
- package/dist/lib/Header.js +9 -4
- package/dist/lib/Header.js.map +1 -1
- package/dist/lib/Icons.d.ts +8 -0
- package/dist/lib/Icons.js +17 -17
- package/dist/lib/Icons.js.map +1 -1
- package/dist/lib/Loading.d.ts +9 -0
- package/dist/lib/Loading.js +50 -0
- package/dist/lib/Loading.js.map +1 -0
- package/dist/lib/Paint.js +16 -22
- package/dist/lib/Paint.js.map +1 -1
- package/dist/lib/Scroller.d.ts +10 -0
- package/dist/lib/Scroller.js +125 -0
- package/dist/lib/Scroller.js.map +1 -1
- package/dist/lib/Selector.d.ts +0 -10
- package/dist/lib/Selector.js +27 -133
- package/dist/lib/Selector.js.map +1 -1
- package/dist/lib/types.d.ts +3 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var n = (c, t, e) =>
|
|
5
|
-
class
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(":root{--evt-header-font: 12px normal Arial;--evt-body-font: 12px normal Arial;--evt-color-white: #fff;--evt-color-black: #000000;--evt-color-primary: rgb(82, 146, 247);--evt-text-color-primary: #333;--evt-text-color-regular: #666;--evt-text-color-secondary: #999;--evt-box-shadow: 0 2px 12px 0 #0000001a;--evt-editor-bg-color: #fff;--evt-editor-text-color: #333;--evt-border-color: #e1e6eb;--evt-stripe-color: #fafafa;--evt-placeholder-color: #cdd0dc;--evt-header-bg-color: #f8faff;--evt-body-bg-color: #fff;--evt-header-text-color: #1d2129;--evt-body-text-color: #4e5969;--evt-footer-text-color: #4e5969;--evt-loading-icon-color: #4e5969;--evt-expand-icon-color: #4e5969;--evt-shrink-icon-color: #4e5969;--evt-error-tip-icon-color: red;--evt-required-color: #F56C6C;--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-checkbox-uncheck-color: #dde0ea;--evt-checkbox-disabled-color: #f1f2f4;--evt-checkbox-check-disabled-color: #dde0ea;--evt-icon-edit-color: #4e5969;--evt-icon-select-color: #4e5969;--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}.e-virt-table-loading{display:none;position:absolute;left:0;top:0;right:0;bottom:0;width:100%;height:100%;z-index:2000;background-color:#fff6;display:flex;align-items:center;justify-content:center}.e-virt-table-loading-spinner{opacity:1;display:flex;flex-direction:column;align-items:center;justify-content:center}.e-virt-table-loading-spinner svg{color:var(--evt-text-color-regular);animation:rotate 1s linear infinite}@keyframes rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.e-virt-table-loading-text{margin:0;font-size:12px;color:var(--evt-text-color-regular)}")),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
|
+
var oe = Object.defineProperty;
|
|
3
|
+
var re = (c, t, e) => t in c ? oe(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
|
|
4
|
+
var n = (c, t, e) => re(c, typeof t != "symbol" ? t + "" : t, e);
|
|
5
|
+
class ne {
|
|
6
6
|
constructor(t) {
|
|
7
7
|
n(this, "rules");
|
|
8
8
|
this.rules = t;
|
|
9
9
|
}
|
|
10
10
|
validate(t) {
|
|
11
|
-
const e = [], { column: i, row: s, key: o, rowKey: r, colIndex: a, rowIndex:
|
|
11
|
+
const e = [], { column: i, row: s, key: o, rowKey: r, colIndex: a, rowIndex: l, value: h, field: d, fieldValue: f } = t;
|
|
12
12
|
Array.isArray(this.rules) || (this.rules = [this.rules]);
|
|
13
13
|
for (const u of this.rules) {
|
|
14
14
|
if (u.validator) {
|
|
15
15
|
const x = {
|
|
16
16
|
field: d,
|
|
17
17
|
fieldValue: f,
|
|
18
|
-
value:
|
|
18
|
+
value: h,
|
|
19
19
|
column: i,
|
|
20
20
|
colIndex: a,
|
|
21
|
-
rowIndex:
|
|
21
|
+
rowIndex: l,
|
|
22
22
|
row: s,
|
|
23
23
|
key: o,
|
|
24
24
|
rowKey: r,
|
|
25
25
|
...u
|
|
26
26
|
};
|
|
27
|
-
u.validator(x,
|
|
27
|
+
u.validator(x, h, (w) => {
|
|
28
28
|
w && e.push({
|
|
29
29
|
...x,
|
|
30
30
|
message: w
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
if (!u.required && (
|
|
34
|
+
if (!u.required && (h == null || h === ""))
|
|
35
35
|
return e;
|
|
36
|
-
u.pattern && !u.pattern.test(
|
|
37
|
-
value:
|
|
36
|
+
u.pattern && !u.pattern.test(h) && e.push({
|
|
37
|
+
value: h,
|
|
38
38
|
column: i,
|
|
39
39
|
row: s,
|
|
40
40
|
key: o,
|
|
41
41
|
rowKey: r,
|
|
42
42
|
colIndex: a,
|
|
43
|
-
rowIndex:
|
|
43
|
+
rowIndex: l,
|
|
44
44
|
field: d,
|
|
45
45
|
fieldValue: f,
|
|
46
46
|
message: u.message || `${o} is pattern validation error`
|
|
47
|
-
}), u.required && (
|
|
48
|
-
value:
|
|
47
|
+
}), u.required && (h == null || h === "") && e.push({
|
|
48
|
+
value: h,
|
|
49
49
|
column: i,
|
|
50
50
|
row: s,
|
|
51
51
|
key: o,
|
|
52
52
|
rowKey: r,
|
|
53
53
|
colIndex: a,
|
|
54
|
-
rowIndex:
|
|
54
|
+
rowIndex: l,
|
|
55
55
|
field: d,
|
|
56
56
|
fieldValue: f,
|
|
57
57
|
message: u.message || `${o} is required`
|
|
@@ -60,7 +60,7 @@ class re {
|
|
|
60
60
|
return e;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function Dt() {
|
|
64
64
|
return "xxxxxxxxxxxxxxxxxx".replace(/[x]/g, function(c) {
|
|
65
65
|
const t = Math.random() * 16 | 0;
|
|
66
66
|
return (c === "x" ? t : t & 3 | 8).toString(16);
|
|
@@ -75,10 +75,10 @@ function Z(c, t) {
|
|
|
75
75
|
}, a - r));
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
return c.length ? c.map((t) =>
|
|
78
|
+
function Nt(c = []) {
|
|
79
|
+
return c.length ? c.map((t) => Nt(t.children) + 1).sort((t, e) => e - t)[0] : 0;
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function ae(c = []) {
|
|
82
82
|
let t = [], e = [], i = [];
|
|
83
83
|
return c.forEach((s) => {
|
|
84
84
|
s.fixed === "left" ? t.push(s) : s.fixed === "right" ? i.push(s) : e.push(s);
|
|
@@ -88,14 +88,14 @@ function ne(c = []) {
|
|
|
88
88
|
...i.sort((s, o) => (s.sort ?? 0) - (o.sort ?? 0))
|
|
89
89
|
];
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function kt(c = [], t = 1, e = 0) {
|
|
92
92
|
return c.map((i) => {
|
|
93
93
|
if (i.children) {
|
|
94
94
|
let s = 0, o = i.fixed;
|
|
95
95
|
i.children.forEach((a) => {
|
|
96
96
|
a.fixed = o;
|
|
97
97
|
});
|
|
98
|
-
const r =
|
|
98
|
+
const r = kt(i.children, t - 1, e + 1);
|
|
99
99
|
return r && r.forEach((a) => {
|
|
100
100
|
s += a.colspan ?? 0;
|
|
101
101
|
}), {
|
|
@@ -121,7 +121,7 @@ function it(c = []) {
|
|
|
121
121
|
e.children ? t = t.concat(it(e.children)) : t.push(e);
|
|
122
122
|
}), t;
|
|
123
123
|
}
|
|
124
|
-
const Ct = /^(\r\n|\n\r|\r|\n)/,
|
|
124
|
+
const Ct = /^(\r\n|\n\r|\r|\n)/, le = /^[^\t\r\n]+/, bt = /^\t/;
|
|
125
125
|
function he(c) {
|
|
126
126
|
let t = [[""]];
|
|
127
127
|
if (c.length === 0)
|
|
@@ -137,19 +137,19 @@ function he(c) {
|
|
|
137
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 = c.match(
|
|
145
|
+
const r = c.match(le);
|
|
146
146
|
o = r ? r[0] : "", c = c.slice(o.length);
|
|
147
147
|
}
|
|
148
148
|
t[i][e] = o;
|
|
149
149
|
}
|
|
150
150
|
return Array.isArray(t) && t.length > 1 && t[t.length - 1].length === 1 && t[t.length - 1][0] === "" && (t = t.slice(0, t.length - 1)), t;
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function ce(c) {
|
|
153
153
|
let t, e, i, s, o = "", r;
|
|
154
154
|
for (t = 0, e = c.length; t < e; t += 1) {
|
|
155
155
|
for (s = c[t].length, i = 0; i < s; i += 1)
|
|
@@ -160,27 +160,27 @@ function le(c) {
|
|
|
160
160
|
}
|
|
161
161
|
return o;
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function Xt(c, t, e = []) {
|
|
164
164
|
let i = 0;
|
|
165
165
|
const s = [];
|
|
166
166
|
return c.forEach((o, r) => {
|
|
167
167
|
if (r === 0)
|
|
168
168
|
s.push(1);
|
|
169
169
|
else {
|
|
170
|
-
const a = e.reduce((
|
|
171
|
-
a ===
|
|
170
|
+
const a = e.reduce((h, d) => `${h}${o[d] ?? ""}`, "") || o[t], l = e.reduce((h, d) => `${h}${c[r - 1][d] ?? ""}`, "") || c[r - 1][t];
|
|
171
|
+
a === l ? (s[i] += 1, s.push(0)) : (s.push(1), i = r);
|
|
172
172
|
}
|
|
173
173
|
}), s;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function Yt(c, t) {
|
|
176
176
|
let e = "", i = "";
|
|
177
177
|
const s = {};
|
|
178
178
|
return t.forEach((o, r) => {
|
|
179
179
|
r === 0 ? (e = o.key, i = o.key, s[o.key] = 1) : c[o.key] === c[e] ? (s[o.key] = 0, s[i] += 1) : (s[o.key] = 1, e = o.key, i = o.key);
|
|
180
180
|
}), s;
|
|
181
181
|
}
|
|
182
|
-
function
|
|
183
|
-
const { visibleRows: i, rowIndex: s, headIndex: o } = c, r =
|
|
182
|
+
function de(c, t, e = []) {
|
|
183
|
+
const { visibleRows: i, rowIndex: s, headIndex: o } = c, r = Xt(i, t, e);
|
|
184
184
|
return r[s - o] === 0 ? {
|
|
185
185
|
rowspan: 0,
|
|
186
186
|
colspan: 0,
|
|
@@ -193,10 +193,10 @@ function ce(c, t, e = []) {
|
|
|
193
193
|
mergeRow: !0
|
|
194
194
|
};
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function fe(c, t = []) {
|
|
197
197
|
const { column: e, row: i, visibleLeafColumns: s } = c, o = s.filter((r) => t.includes(r.key));
|
|
198
198
|
if (t.includes(e.key)) {
|
|
199
|
-
const r =
|
|
199
|
+
const r = Yt(i, o);
|
|
200
200
|
return r[e.key] === 0 ? {
|
|
201
201
|
rowspan: 0,
|
|
202
202
|
colspan: 0,
|
|
@@ -210,11 +210,11 @@ function de(c, t = []) {
|
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function xe(c, t = document.documentElement) {
|
|
214
214
|
const e = c.startsWith("--") ? c : `--${c}`;
|
|
215
215
|
return getComputedStyle(t).getPropertyValue(e).trim();
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function It(c) {
|
|
218
218
|
if (!c) return /* @__PURE__ */ new Date(0);
|
|
219
219
|
if (typeof c == "number")
|
|
220
220
|
return new Date(c);
|
|
@@ -252,27 +252,27 @@ function Rt(c) {
|
|
|
252
252
|
if (o) {
|
|
253
253
|
const r = o.slice(1).map(Number);
|
|
254
254
|
if (s.source.includes("YYYY-MM-DD") || s.source.includes("YYYY/MM/DD") || s.source.includes("YYYY.MM.DD")) {
|
|
255
|
-
const [a,
|
|
256
|
-
return new Date(a,
|
|
255
|
+
const [a, l, h, d = 0, f = 0, u = 0] = r;
|
|
256
|
+
return new Date(a, l - 1, h, d, f, u);
|
|
257
257
|
} else if (s.source.includes("DD-MM-YYYY") || s.source.includes("DD/MM/YYYY") || s.source.includes("DD.MM.YYYY")) {
|
|
258
|
-
const [a,
|
|
259
|
-
return new Date(
|
|
258
|
+
const [a, l, h, d = 0, f = 0, u = 0] = r;
|
|
259
|
+
return new Date(h, l - 1, a, d, f, u);
|
|
260
260
|
} else if (s.source.includes("MM-DD-YYYY") || s.source.includes("MM/DD/YYYY") || s.source.includes("MM.DD.YYYY")) {
|
|
261
|
-
const [a,
|
|
262
|
-
return new Date(
|
|
261
|
+
const [a, l, h, d = 0, f = 0, u = 0] = r;
|
|
262
|
+
return new Date(h, a - 1, l, d, f, u);
|
|
263
263
|
} else if (s.source.includes("YYYYMMDD")) {
|
|
264
|
-
const [a,
|
|
265
|
-
return new Date(a,
|
|
264
|
+
const [a, l, h] = r;
|
|
265
|
+
return new Date(a, l - 1, h);
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
return /* @__PURE__ */ new Date(NaN);
|
|
270
270
|
}
|
|
271
|
-
function
|
|
272
|
-
const e =
|
|
271
|
+
function ue(c, t) {
|
|
272
|
+
const e = It(c), i = It(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
|
-
class
|
|
275
|
+
class Bt {
|
|
276
276
|
constructor(t, e, i, s, o, r, a) {
|
|
277
277
|
n(this, "ctx");
|
|
278
278
|
n(this, "x", 0);
|
|
@@ -318,9 +318,9 @@ class Yt {
|
|
|
318
318
|
getRightFixedX() {
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
class ut extends
|
|
322
|
-
constructor(e, i, s, o, r, a,
|
|
323
|
-
super(e, o, r, a,
|
|
321
|
+
class ut extends Bt {
|
|
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", "");
|
|
@@ -401,7 +401,7 @@ class ut extends Yt {
|
|
|
401
401
|
n(this, "overflowTooltipMaxWidth", 500);
|
|
402
402
|
n(this, "overflowTooltipPlacement", "top");
|
|
403
403
|
n(this, "maxLineClamp", "auto");
|
|
404
|
-
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key =
|
|
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 !== void 0 ? 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();
|
|
405
405
|
}
|
|
406
406
|
setWidthHeight(e, i) {
|
|
407
407
|
this.width = e, this.height = i;
|
|
@@ -427,8 +427,8 @@ class ut extends Yt {
|
|
|
427
427
|
rowspan: o = 1,
|
|
428
428
|
relationRowKeys: r,
|
|
429
429
|
relationColKeys: a,
|
|
430
|
-
mergeRow:
|
|
431
|
-
mergeCol:
|
|
430
|
+
mergeRow: l = !1,
|
|
431
|
+
mergeCol: h = !1
|
|
432
432
|
} = i({
|
|
433
433
|
row: this.row,
|
|
434
434
|
rowIndex: this.rowIndex,
|
|
@@ -441,7 +441,7 @@ class ut extends Yt {
|
|
|
441
441
|
visibleLeafColumns: this.ctx.header.visibleLeafColumns,
|
|
442
442
|
rows: this.ctx.body.data
|
|
443
443
|
}) || {};
|
|
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 =
|
|
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);
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
447
|
updateSpanInfo() {
|
|
@@ -519,48 +519,48 @@ class ut extends Yt {
|
|
|
519
519
|
let o, r = 0, a = "";
|
|
520
520
|
if (!(["tree", "selection-tree", "tree-selection"].includes(this.type) && s === "body"))
|
|
521
521
|
return;
|
|
522
|
-
const
|
|
523
|
-
this.rowExpand =
|
|
524
|
-
const { TREE_INDENT: x = 16, CHECKBOX_SIZE: w, TREE_ICON_SIZE:
|
|
522
|
+
const l = this.ctx.database.getRowForRowKey(i), { expand: h = !1, hasChildren: d = !1, expandLoading: f = !1, level: u = 0 } = l || {};
|
|
523
|
+
this.rowExpand = h, this.rowHasChildren = d;
|
|
524
|
+
const { TREE_INDENT: x = 16, CHECKBOX_SIZE: w, TREE_ICON_SIZE: E } = this.ctx.config;
|
|
525
525
|
if (r = u * x, f) {
|
|
526
|
-
const
|
|
527
|
-
a = "loading", o =
|
|
526
|
+
const R = this.ctx.icons.get("loading");
|
|
527
|
+
a = "loading", o = R;
|
|
528
528
|
} else if (d) {
|
|
529
|
-
const
|
|
530
|
-
o =
|
|
529
|
+
const R = this.ctx.icons.get("expand"), _ = this.ctx.icons.get("shrink");
|
|
530
|
+
o = h ? _ : R, a = h ? "shrink" : "expand";
|
|
531
531
|
}
|
|
532
|
-
let g =
|
|
532
|
+
let g = E, m = E, y = this.drawX;
|
|
533
533
|
(this.align === "center" || this.align === "right") && (y = this.drawX + (this.visibleWidth - g - 2 * e) / 2, this.align = "left");
|
|
534
|
-
let
|
|
535
|
-
this.type === "selection-tree" ? (
|
|
534
|
+
let p = y + r + e, b = this.drawY + (this.visibleHeight - m) / 2, C = r + this.drawX + g - 0.5;
|
|
535
|
+
this.type === "selection-tree" ? (p = r + this.drawSelectionImageX + this.drawSelectionImageWidth, C = p + g - e / 2) : this.type === "tree-selection" ? C = p + w + g - e / 2 : C = p + g - e / 2, this.drawTextX = C, this.drawTextWidth = this.drawX + this.visibleWidth - C, !(p + g + e > this.drawX + this.visibleWidth) && (b + m + e > this.drawY + this.visibleHeight || (this.drawTreeImageX = p, this.drawTreeImageY = b, this.drawTreeImageWidth = g, this.drawTreeImageHeight = m, o ? (this.drawTreeImageName = a, this.drawTreeImageSource = o) : (this.drawTreeImageName = "", this.drawTreeImageSource = void 0)));
|
|
536
536
|
}
|
|
537
537
|
drawTreeLine() {
|
|
538
538
|
const { TREE_LINE: e, TREE_INDENT: i = 16, TREE_ICON_SIZE: s = 16, TREE_LINE_COLOR: o = "#e1e6eb" } = this.ctx.config;
|
|
539
539
|
if (!e || this.cellType !== "body" || !["tree", "selection-tree", "tree-selection"].includes(this.type) || this.rowspan === 0 || this.colspan === 0) return;
|
|
540
|
-
const r = this.ctx.database.getRowForRowKey(this.rowKey) || {}, a = r.level ?? 0,
|
|
540
|
+
const r = this.ctx.database.getRowForRowKey(this.rowKey) || {}, a = r.level ?? 0, l = this.drawTreeImageX + this.drawTreeImageWidth / 2, h = this.drawTreeImageY + this.drawTreeImageHeight / 2;
|
|
541
541
|
let d = this.drawTreeImageX - a * i;
|
|
542
542
|
const f = Array.isArray(r.parentRowKeys) ? r.parentRowKeys : [];
|
|
543
543
|
if (a > 0) {
|
|
544
544
|
for (let g = 0; g < a - 1; g += 1) {
|
|
545
|
-
const
|
|
546
|
-
if (!!(
|
|
547
|
-
const
|
|
548
|
-
this.ctx.paint.drawLine([
|
|
545
|
+
const m = f[g + 1];
|
|
546
|
+
if (!!(m ? this.ctx.database.getRowForRowKey(m) || {} : {}).isLastChild) continue;
|
|
547
|
+
const b = Math.round(this.drawTreeImageX - (a - g) * i + s / 2);
|
|
548
|
+
this.ctx.paint.drawLine([b, this.drawY, b, this.drawY + this.visibleHeight], {
|
|
549
549
|
borderColor: o,
|
|
550
550
|
borderWidth: 1,
|
|
551
551
|
lineDash: [4, 4],
|
|
552
552
|
lineDashOffset: 0
|
|
553
553
|
});
|
|
554
554
|
}
|
|
555
|
-
const u = Math.round(this.drawTreeImageX - i + s / 2), w = !!r.isLastChild ?
|
|
555
|
+
const u = Math.round(this.drawTreeImageX - i + s / 2), w = !!r.isLastChild ? h : this.drawY + this.visibleHeight;
|
|
556
556
|
this.ctx.paint.drawLine([u, this.drawY, u, w], {
|
|
557
557
|
borderColor: o,
|
|
558
558
|
borderWidth: 1,
|
|
559
559
|
lineDash: [4, 4],
|
|
560
560
|
lineDashOffset: 0
|
|
561
561
|
});
|
|
562
|
-
const
|
|
563
|
-
this.ctx.paint.drawLine([
|
|
562
|
+
const E = Math.round(d + (a - 1) * i + s / 2);
|
|
563
|
+
this.ctx.paint.drawLine([E, h, l, h], {
|
|
564
564
|
borderColor: o,
|
|
565
565
|
borderWidth: 1,
|
|
566
566
|
lineDash: [4, 4],
|
|
@@ -569,7 +569,7 @@ class ut extends Yt {
|
|
|
569
569
|
}
|
|
570
570
|
if (r.hasChildren && r.expand) {
|
|
571
571
|
const u = this.drawTreeImageY + this.drawTreeImageHeight, x = this.drawY + this.visibleHeight;
|
|
572
|
-
this.ctx.paint.drawLine([
|
|
572
|
+
this.ctx.paint.drawLine([l, u, l, x], {
|
|
573
573
|
borderColor: o,
|
|
574
574
|
borderWidth: 1,
|
|
575
575
|
lineDash: [4, 4],
|
|
@@ -585,41 +585,41 @@ class ut extends Yt {
|
|
|
585
585
|
FOOTER_CELL_STYLE_METHOD: o,
|
|
586
586
|
READONLY_TEXT_COLOR: r,
|
|
587
587
|
BODY_TEXT_COLOR: a,
|
|
588
|
-
FOOTER_TEXT_COLOR:
|
|
589
|
-
FOOTER_BG_COLOR:
|
|
588
|
+
FOOTER_TEXT_COLOR: l,
|
|
589
|
+
FOOTER_BG_COLOR: h,
|
|
590
590
|
HIGHLIGHT_SELECTED_ROW: d,
|
|
591
591
|
HIGHLIGHT_SELECTED_ROW_COLOR: f,
|
|
592
592
|
HIGHLIGHT_HOVER_ROW: u,
|
|
593
593
|
HIGHLIGHT_HOVER_ROW_COLOR: x,
|
|
594
594
|
STRIPE: w,
|
|
595
|
-
STRIPE_COLOR:
|
|
595
|
+
STRIPE_COLOR: E
|
|
596
596
|
} = this.ctx.config;
|
|
597
597
|
if (this.cellType === "footer") {
|
|
598
|
-
let
|
|
598
|
+
let _ = h, T = l;
|
|
599
599
|
if (typeof o == "function") {
|
|
600
|
-
const
|
|
600
|
+
const S = o, { backgroundColor: I, color: v } = S({
|
|
601
601
|
row: this.row,
|
|
602
602
|
rowIndex: this.rowIndex,
|
|
603
603
|
colIndex: this.colIndex,
|
|
604
604
|
column: this.column,
|
|
605
605
|
value: this.getValue()
|
|
606
606
|
}) || {};
|
|
607
|
-
|
|
607
|
+
I && (_ = I), v && (T = v);
|
|
608
608
|
}
|
|
609
|
-
this.drawCellSkyBgColor = "transparent", this.drawCellBgColor =
|
|
609
|
+
this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = _, this.drawTextColor = T;
|
|
610
610
|
return;
|
|
611
611
|
}
|
|
612
612
|
let g = "transparent";
|
|
613
|
-
const
|
|
614
|
-
let
|
|
613
|
+
const m = this.ctx.hoverCell, y = this.ctx.currentCell;
|
|
614
|
+
let p = this.rowIndex, b = this.rowIndex;
|
|
615
615
|
if (this.rowspan !== 1 && (u || d)) {
|
|
616
|
-
const
|
|
617
|
-
|
|
616
|
+
const _ = this.getSpanInfo(), { yArr: T } = _;
|
|
617
|
+
p = T[0], b = T[1];
|
|
618
618
|
}
|
|
619
|
-
u &&
|
|
620
|
-
let C = e,
|
|
621
|
-
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (C = i,
|
|
622
|
-
const
|
|
619
|
+
u && m && (m.rowKey === this.rowKey && (g = x), m.rowIndex >= p && m.rowIndex <= b && (g = x)), d && y && (y.rowKey === this.rowKey && (g = f), y.rowIndex >= p && y.rowIndex <= b && (g = f)), this.drawCellSkyBgColor = g;
|
|
620
|
+
let C = e, R = a;
|
|
621
|
+
if (this.ctx.database.getReadonly(this.rowKey, this.key) || (C = i, R = r), w && (this.rowIndex % 2 ? C = E : C = e), typeof s == "function") {
|
|
622
|
+
const _ = s, { backgroundColor: T, color: S } = _({
|
|
623
623
|
row: this.row,
|
|
624
624
|
rowIndex: this.rowIndex,
|
|
625
625
|
colIndex: this.colIndex,
|
|
@@ -627,60 +627,60 @@ class ut extends Yt {
|
|
|
627
627
|
isHasChanged: this.isHasChanged,
|
|
628
628
|
value: this.getValue()
|
|
629
629
|
}) || {};
|
|
630
|
-
|
|
630
|
+
T && (C = T), S && (R = S);
|
|
631
631
|
}
|
|
632
|
-
this.drawCellBgColor = C, this.drawTextColor =
|
|
632
|
+
this.drawCellBgColor = C, this.drawTextColor = R;
|
|
633
633
|
}
|
|
634
634
|
updateSelection() {
|
|
635
|
-
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: a, rowIndex:
|
|
635
|
+
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: a, rowIndex: l, rowKey: h } = this;
|
|
636
636
|
if (s === 0 || o === 0 || r === "footer" || !["index-selection", "selection", "selection-tree", "tree-selection"].includes(a))
|
|
637
637
|
return;
|
|
638
|
-
const d = this.ctx.database.getRowSelectable(
|
|
638
|
+
const d = this.ctx.database.getRowSelectable(h), { CHECKBOX_SIZE: f = 0, CELL_PADDING: u } = this.ctx.config;
|
|
639
639
|
let x = this.drawX + u;
|
|
640
640
|
(this.align === "center" || this.align === "right") && (x = this.drawX + (e - f) / 2);
|
|
641
|
-
let w = x,
|
|
641
|
+
let w = x, E = this.drawY + (i - f) / 2;
|
|
642
642
|
if (a !== "selection-tree") {
|
|
643
643
|
if (a === "tree-selection") {
|
|
644
|
-
const { TREE_INDENT: y = 16, TREE_ICON_SIZE:
|
|
645
|
-
w = x +
|
|
644
|
+
const { TREE_INDENT: y = 16, TREE_ICON_SIZE: p } = this.ctx.config, b = this.ctx.database.getRowForRowKey(h), { level: C = 0 } = b || {}, R = C * y;
|
|
645
|
+
w = x + p + R;
|
|
646
646
|
}
|
|
647
647
|
}
|
|
648
|
-
let g = this.ctx.icons.get("checkbox-uncheck"),
|
|
648
|
+
let g = this.ctx.icons.get("checkbox-uncheck"), m = "checkbox-uncheck";
|
|
649
649
|
if (a === "selection-tree" || a === "tree-selection") {
|
|
650
|
-
const y = this.ctx.database.getTreeSelectionState(
|
|
651
|
-
y.indeterminate && d ? (g = this.ctx.icons.get("checkbox-indeterminate"),
|
|
650
|
+
const y = this.ctx.database.getTreeSelectionState(h);
|
|
651
|
+
y.indeterminate && d ? (g = this.ctx.icons.get("checkbox-indeterminate"), m = "checkbox-indeterminate") : y.checked && d ? (g = this.ctx.icons.get("checkbox-check"), m = "checkbox-check") : !y.checked && d ? (g = this.ctx.icons.get("checkbox-uncheck"), m = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), m = "checkbox-disabled");
|
|
652
652
|
} else {
|
|
653
|
-
const y = this.ctx.database.getRowSelection(
|
|
654
|
-
y && d ? (g = this.ctx.icons.get("checkbox-check"),
|
|
653
|
+
const y = this.ctx.database.getRowSelection(h);
|
|
654
|
+
y && d ? (g = this.ctx.icons.get("checkbox-check"), m = "checkbox-check") : y && !d ? (g = this.ctx.icons.get("checkbox-check-disabled"), m = "checkbox-check-disabled") : !y && d ? (g = this.ctx.icons.get("checkbox-uncheck"), m = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), m = "checkbox-disabled");
|
|
655
655
|
}
|
|
656
|
-
w + f + u > this.drawX + this.visibleWidth ||
|
|
656
|
+
w + f + u > this.drawX + this.visibleWidth || E + f + u > this.drawY + this.visibleHeight || (a === "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === l || ["checkbox-disabled", "checkbox-check"].includes(m)) && (this.drawSelectionImageX = w, this.drawSelectionImageY = E, this.drawSelectionImageWidth = f, this.drawSelectionImageHeight = f, this.drawSelectionImageName = m, this.drawSelectionImageSource = g) : (this.drawSelectionImageX = w, this.drawSelectionImageY = E, this.drawSelectionImageWidth = f, this.drawSelectionImageHeight = f, this.drawSelectionImageName = m, this.drawSelectionImageSource = g));
|
|
657
657
|
}
|
|
658
658
|
updateHoverIcon() {
|
|
659
659
|
if (this.ctx.database.getReadonly(this.rowKey, this.key))
|
|
660
660
|
return;
|
|
661
661
|
const { BODY_CELL_HOVER_ICON_METHOD: i, CELL_HOVER_ICON_SIZE: s, CELL_PADDING: o, ENABLE_MERGE_CELL_LINK: r } = this.ctx.config;
|
|
662
662
|
if (typeof i == "function") {
|
|
663
|
-
const
|
|
663
|
+
const h = i({
|
|
664
664
|
row: this.row,
|
|
665
665
|
rowIndex: this.rowIndex,
|
|
666
666
|
colIndex: this.colIndex,
|
|
667
667
|
column: this.column,
|
|
668
668
|
value: this.getValue()
|
|
669
669
|
});
|
|
670
|
-
|
|
670
|
+
h !== void 0 && (this.hoverIconName = h);
|
|
671
671
|
}
|
|
672
672
|
const { hoverCell: a } = this.ctx;
|
|
673
673
|
if (this.hoverIconName && !this.ctx.editing && a) {
|
|
674
|
-
let
|
|
675
|
-
if (a.rowKey === this.rowKey && (
|
|
674
|
+
let l = 0, h = 0;
|
|
675
|
+
if (a.rowKey === this.rowKey && (l = this.drawX + this.width - s - o, h = this.drawY + (this.height - s) / 2), this.rowspan !== 1 && r) {
|
|
676
676
|
const f = this.getSpanInfo(), { yArr: u } = f, x = u[0], w = u[1];
|
|
677
677
|
if (a.rowIndex >= x && a.rowIndex <= w) {
|
|
678
|
-
const { width:
|
|
679
|
-
|
|
678
|
+
const { width: E, height: g, offsetTop: m, offsetLeft: y } = f;
|
|
679
|
+
l = this.drawX - y + E - s - o, h = this.drawY - m + (g - s) / 2;
|
|
680
680
|
}
|
|
681
681
|
}
|
|
682
682
|
const d = this.ctx.icons.get(this.hoverIconName);
|
|
683
|
-
this.drawHoverImageX =
|
|
683
|
+
this.drawHoverImageX = l, this.drawHoverImageY = h, this.drawHoverImageWidth = s, this.drawHoverImageHeight = s, this.drawHoverImageName = this.hoverIconName, this.drawHoverImageSource = d;
|
|
684
684
|
}
|
|
685
685
|
}
|
|
686
686
|
/**
|
|
@@ -803,10 +803,10 @@ class ut extends Yt {
|
|
|
803
803
|
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s, AUTOFILL_POINT_BORDER_COLOR: o } = this.ctx.config;
|
|
804
804
|
if (!s || !i || this.ctx.editing)
|
|
805
805
|
return;
|
|
806
|
-
const { xArr: r, yArr: a } = this.ctx.selector,
|
|
807
|
-
if (d ===
|
|
808
|
-
const
|
|
809
|
-
this.ctx.paint.drawRect(u + this.width -
|
|
806
|
+
const { xArr: r, yArr: a } = this.ctx.selector, l = r[1], h = a[1], { colIndex: d, rowIndex: f, drawX: u, drawY: x } = this;
|
|
807
|
+
if (d === l && f === h) {
|
|
808
|
+
const E = d === this.ctx.maxColIndex || f === this.ctx.maxRowIndex || d === this.ctx.lastCenterColIndex ? 6 : 4;
|
|
809
|
+
this.ctx.paint.drawRect(u + this.width - E, x + this.height - E, 6, 6, {
|
|
810
810
|
borderColor: o,
|
|
811
811
|
fillColor: e
|
|
812
812
|
});
|
|
@@ -831,8 +831,8 @@ class ut extends Yt {
|
|
|
831
831
|
}
|
|
832
832
|
drawText() {
|
|
833
833
|
const { CELL_PADDING: e, BODY_FONT: i, PLACEHOLDER_COLOR: s, CELL_LINE_HEIGHT: o } = this.ctx.config, { placeholder: r } = this.column;
|
|
834
|
-
let a = this.displayText,
|
|
835
|
-
if (!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,
|
|
834
|
+
let a = this.displayText, l = this.drawTextColor;
|
|
835
|
+
if (!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), ["", null, void 0].includes(a))
|
|
836
836
|
return !1;
|
|
837
837
|
typeof a != "string" && (a = `${a}`);
|
|
838
838
|
const d = `${a}_${this.drawTextWidth}`;
|
|
@@ -847,7 +847,7 @@ class ut extends Yt {
|
|
|
847
847
|
padding: e,
|
|
848
848
|
align: this.align,
|
|
849
849
|
verticalAlign: this.verticalAlign,
|
|
850
|
-
color:
|
|
850
|
+
color: l,
|
|
851
851
|
autoRowHeight: this.autoRowHeight,
|
|
852
852
|
lineHeight: o,
|
|
853
853
|
maxLineClamp: this.maxLineClamp,
|
|
@@ -918,11 +918,11 @@ class ut extends Yt {
|
|
|
918
918
|
fillColor: "transparent",
|
|
919
919
|
borderWidth: 1
|
|
920
920
|
});
|
|
921
|
-
const [a,
|
|
922
|
-
!(a ===
|
|
921
|
+
const [a, l] = i, [h, d] = s;
|
|
922
|
+
!(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, {
|
|
923
923
|
borderColor: "transparent",
|
|
924
924
|
fillColor: this.ctx.config.SELECT_AREA_COLOR || "rgba(82,146,247,0.1)"
|
|
925
|
-
}), this.operation && this.rowIndex >=
|
|
925
|
+
}), this.operation && this.rowIndex >= h && this.rowIndex <= d && this.ctx.paint.drawRect(this.drawX, this.drawY, this.visibleWidth, this.visibleHeight, {
|
|
926
926
|
borderColor: "transparent",
|
|
927
927
|
fillColor: this.ctx.config.SELECT_ROW_COL_BG_COLOR || "transparent"
|
|
928
928
|
});
|
|
@@ -947,13 +947,13 @@ class ut extends Yt {
|
|
|
947
947
|
});
|
|
948
948
|
}
|
|
949
949
|
drawBorder(e) {
|
|
950
|
-
const { drawX: i, drawY: s, rowIndex: o, colIndex: r, height: a, width:
|
|
951
|
-
let
|
|
952
|
-
const { xArr: f, yArr: u, lineDash: x = [], borderWidth: w = 1, borderColor:
|
|
953
|
-
if (r >=
|
|
954
|
-
const C = r === y ? 1 : 0,
|
|
955
|
-
this.ctx.paint.drawLine([
|
|
956
|
-
borderColor:
|
|
950
|
+
const { drawX: i, drawY: s, rowIndex: o, colIndex: r, height: a, width: l } = this;
|
|
951
|
+
let h = i, d = s;
|
|
952
|
+
const { xArr: f, yArr: u, lineDash: x = [], borderWidth: w = 1, borderColor: E, fillColor: g } = e, m = f[0], y = f[1], p = u[0], b = u[1];
|
|
953
|
+
if (r >= m && r <= y && o === p) {
|
|
954
|
+
const C = r === y ? 1 : 0, R = r === m ? 1 : 0;
|
|
955
|
+
this.ctx.paint.drawLine([h + R, d + 1, h + l - C, d + 1], {
|
|
956
|
+
borderColor: E,
|
|
957
957
|
fillColor: g,
|
|
958
958
|
borderWidth: w,
|
|
959
959
|
lineCap: "round",
|
|
@@ -961,10 +961,10 @@ class ut extends Yt {
|
|
|
961
961
|
lineDash: x
|
|
962
962
|
});
|
|
963
963
|
}
|
|
964
|
-
if (r === y && o >=
|
|
965
|
-
const C = o ===
|
|
966
|
-
this.ctx.paint.drawLine([
|
|
967
|
-
borderColor:
|
|
964
|
+
if (r === y && o >= p && o <= b) {
|
|
965
|
+
const C = o === p ? 1 : 0, R = o === b ? 1 : 0;
|
|
966
|
+
this.ctx.paint.drawLine([h + l - 1, d + C, h + l - 1, d + a - R], {
|
|
967
|
+
borderColor: E,
|
|
968
968
|
fillColor: g,
|
|
969
969
|
borderWidth: w,
|
|
970
970
|
lineCap: "round",
|
|
@@ -972,10 +972,10 @@ class ut extends Yt {
|
|
|
972
972
|
lineDash: x
|
|
973
973
|
});
|
|
974
974
|
}
|
|
975
|
-
if (r >=
|
|
976
|
-
const C = r === y ? 1 : 0,
|
|
977
|
-
this.ctx.paint.drawLine([
|
|
978
|
-
borderColor:
|
|
975
|
+
if (r >= m && r <= y && o === b) {
|
|
976
|
+
const C = r === y ? 1 : 0, R = r === m ? 1 : 0;
|
|
977
|
+
this.ctx.paint.drawLine([h + R, d + a - 1, h + l - C, d + a - 1], {
|
|
978
|
+
borderColor: E,
|
|
979
979
|
fillColor: g,
|
|
980
980
|
borderWidth: w,
|
|
981
981
|
lineCap: "round",
|
|
@@ -983,10 +983,10 @@ class ut extends Yt {
|
|
|
983
983
|
lineDash: x
|
|
984
984
|
});
|
|
985
985
|
}
|
|
986
|
-
if (r ===
|
|
987
|
-
const C = o ===
|
|
988
|
-
this.ctx.paint.drawLine([
|
|
989
|
-
borderColor:
|
|
986
|
+
if (r === m && o >= p && o <= b) {
|
|
987
|
+
const C = o === b ? 1 : 0, R = o === p ? 1 : 0;
|
|
988
|
+
this.ctx.paint.drawLine([h + 1, d + R, h + 1, d + a - C], {
|
|
989
|
+
borderColor: E,
|
|
990
990
|
fillColor: g,
|
|
991
991
|
borderWidth: w,
|
|
992
992
|
lineCap: "round",
|
|
@@ -996,9 +996,8 @@ class ut extends Yt {
|
|
|
996
996
|
}
|
|
997
997
|
}
|
|
998
998
|
}
|
|
999
|
-
class
|
|
999
|
+
class ge {
|
|
1000
1000
|
constructor(t, e) {
|
|
1001
|
-
n(this, "loading", !1);
|
|
1002
1001
|
n(this, "ctx");
|
|
1003
1002
|
n(this, "data");
|
|
1004
1003
|
n(this, "columns");
|
|
@@ -1030,7 +1029,7 @@ class ue {
|
|
|
1030
1029
|
n(this, "sortState", /* @__PURE__ */ new Map());
|
|
1031
1030
|
this.ctx = t;
|
|
1032
1031
|
const { data: i = [], columns: s = [], footerData: o = [] } = e;
|
|
1033
|
-
this.data = i, this.footerData = o, this.columns = s, this.
|
|
1032
|
+
this.data = i, this.footerData = o, this.columns = s, this.init();
|
|
1034
1033
|
}
|
|
1035
1034
|
// 初始化默认不忽略清空改变值和校验map
|
|
1036
1035
|
init(t = !0) {
|
|
@@ -1058,26 +1057,26 @@ class ue {
|
|
|
1058
1057
|
const s = t.length;
|
|
1059
1058
|
t.forEach((o, r) => {
|
|
1060
1059
|
var y;
|
|
1061
|
-
const { ROW_KEY: a = "", DEFAULT_EXPAND_ALL:
|
|
1060
|
+
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}` : Dt();
|
|
1062
1061
|
this.itemRowKeyMap.set(o, x);
|
|
1063
|
-
const w = o._height ||
|
|
1062
|
+
const w = o._height || h, E = o._readonly;
|
|
1064
1063
|
let g = !0;
|
|
1065
1064
|
if (typeof d == "function" && (g = d), f) {
|
|
1066
|
-
const
|
|
1067
|
-
if (this.checkboxKeyMap.has(
|
|
1068
|
-
const
|
|
1069
|
-
|
|
1065
|
+
const p = o[f];
|
|
1066
|
+
if (this.checkboxKeyMap.has(p)) {
|
|
1067
|
+
const b = this.checkboxKeyMap.get(p) || [];
|
|
1068
|
+
b.push(x), this.checkboxKeyMap.set(p, b);
|
|
1070
1069
|
} else
|
|
1071
|
-
this.checkboxKeyMap.set(
|
|
1070
|
+
this.checkboxKeyMap.set(p, [x]);
|
|
1072
1071
|
}
|
|
1073
1072
|
this.selectionMap.set(x, {
|
|
1074
1073
|
key: f ? o[f] : x,
|
|
1075
1074
|
row: o,
|
|
1076
1075
|
check: ((y = this.selectionMap.get(x)) == null ? void 0 : y.check) || !1
|
|
1077
1076
|
});
|
|
1078
|
-
const
|
|
1079
|
-
this.expandMap.set(x,
|
|
1080
|
-
readonly:
|
|
1077
|
+
const m = l || this.expandMap.get(x) || o._expand || !1;
|
|
1078
|
+
this.expandMap.set(x, m), this.rowKeyMap.set(x, {
|
|
1079
|
+
readonly: E,
|
|
1081
1080
|
index: r,
|
|
1082
1081
|
rowIndex: r,
|
|
1083
1082
|
level: e,
|
|
@@ -1085,7 +1084,7 @@ class ue {
|
|
|
1085
1084
|
calculatedHeight: -1,
|
|
1086
1085
|
check: !1,
|
|
1087
1086
|
selectable: g,
|
|
1088
|
-
expand:
|
|
1087
|
+
expand: m,
|
|
1089
1088
|
expandLazy: !1,
|
|
1090
1089
|
hasChildren: o._hasChildren || (Array.isArray(o.children) ? o.children.length > 0 : !1),
|
|
1091
1090
|
expandLoading: !1,
|
|
@@ -1157,7 +1156,7 @@ class ue {
|
|
|
1157
1156
|
this.columns = t, this.clearBufferData();
|
|
1158
1157
|
}
|
|
1159
1158
|
setData(t) {
|
|
1160
|
-
this.data = t, this.
|
|
1159
|
+
this.data = t, this.init();
|
|
1161
1160
|
}
|
|
1162
1161
|
/**
|
|
1163
1162
|
* 统一转化数据,给画body使用,包括过滤树状等,统一入口
|
|
@@ -1175,13 +1174,13 @@ class ue {
|
|
|
1175
1174
|
const i = (o) => {
|
|
1176
1175
|
o.forEach((r) => {
|
|
1177
1176
|
t.push(r);
|
|
1178
|
-
const a = this.itemRowKeyMap.get(r), { expand:
|
|
1177
|
+
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);
|
|
1179
1178
|
this.sumHeight += x, this.rowIndexRowKeyMap.set(e, a), this.rowKeyRowIndexMap.set(a, e), this.positions.push({
|
|
1180
1179
|
top: u,
|
|
1181
1180
|
height: x,
|
|
1182
1181
|
bottom: this.sumHeight,
|
|
1183
1182
|
calculatedHeight: f
|
|
1184
|
-
}), e += 1,
|
|
1183
|
+
}), e += 1, l && h && i(r.children);
|
|
1185
1184
|
});
|
|
1186
1185
|
};
|
|
1187
1186
|
this.rowIndexRowKeyMap.clear(), this.rowKeyRowIndexMap.clear();
|
|
@@ -1258,18 +1257,18 @@ class ue {
|
|
|
1258
1257
|
*/
|
|
1259
1258
|
applySingleColumnSort(t, e, i, s) {
|
|
1260
1259
|
return t.sort((o, r) => {
|
|
1261
|
-
const a = o[e],
|
|
1262
|
-
let
|
|
1260
|
+
const a = o[e], l = r[e];
|
|
1261
|
+
let h = 0;
|
|
1263
1262
|
if (typeof s == "function")
|
|
1264
|
-
|
|
1263
|
+
h = s(o, r);
|
|
1265
1264
|
else if (s === "number") {
|
|
1266
|
-
const d = Number(a) || 0, f = Number(
|
|
1267
|
-
|
|
1265
|
+
const d = Number(a) || 0, f = Number(l) || 0;
|
|
1266
|
+
h = d - f;
|
|
1268
1267
|
} else if (s === "string") {
|
|
1269
|
-
const d = String(a || ""), f = String(
|
|
1270
|
-
|
|
1271
|
-
} else s === "date" && (
|
|
1272
|
-
return i === "asc" ?
|
|
1268
|
+
const d = String(a || ""), f = String(l || "");
|
|
1269
|
+
h = d.localeCompare(f);
|
|
1270
|
+
} else s === "date" && (h = ue(a, l));
|
|
1271
|
+
return i === "asc" ? h : -h;
|
|
1273
1272
|
});
|
|
1274
1273
|
}
|
|
1275
1274
|
/**
|
|
@@ -1381,39 +1380,39 @@ class ue {
|
|
|
1381
1380
|
async batchSetItemValue(t, e = !1, i = !0, s = "none") {
|
|
1382
1381
|
let o = [], r = i;
|
|
1383
1382
|
const a = /* @__PURE__ */ new Set();
|
|
1384
|
-
let
|
|
1385
|
-
const { rowKey: w, key:
|
|
1386
|
-
let g = x.value,
|
|
1387
|
-
const y = this.getRowDataItemForRowKey(w),
|
|
1388
|
-
return (
|
|
1383
|
+
let l = [], h = t.map((x) => {
|
|
1384
|
+
const { rowKey: w, key: E } = x;
|
|
1385
|
+
let g = x.value, m = g;
|
|
1386
|
+
const y = this.getRowDataItemForRowKey(w), p = this.getItemValue(w, E), b = this.getVirtualBodyCellByKey(w, E);
|
|
1387
|
+
return (b == null ? void 0 : b.type) === "number" && (["", void 0, null].includes(g) ? m = null : /^-?\d+(\.\d+)?$/.test(`${g}`) ? m = Number(g) : (m = p, l.push({
|
|
1389
1388
|
...x,
|
|
1390
|
-
value:
|
|
1391
|
-
oldValue:
|
|
1389
|
+
value: m,
|
|
1390
|
+
oldValue: p,
|
|
1392
1391
|
row: y
|
|
1393
1392
|
}))), {
|
|
1394
1393
|
...x,
|
|
1395
|
-
value:
|
|
1396
|
-
oldValue:
|
|
1394
|
+
value: m,
|
|
1395
|
+
oldValue: p,
|
|
1397
1396
|
row: y
|
|
1398
1397
|
};
|
|
1399
1398
|
});
|
|
1400
|
-
if (
|
|
1399
|
+
if (h = h.filter((x) => !l.some((w) => x.rowKey === w.rowKey && x.key === w.key)), l.length) {
|
|
1401
1400
|
const x = {
|
|
1402
1401
|
code: "ERR_BATCH_SET_NUMBER_VALUE",
|
|
1403
1402
|
message: "Assignment failed, not a numeric type",
|
|
1404
|
-
data:
|
|
1403
|
+
data: l
|
|
1405
1404
|
};
|
|
1406
1405
|
this.ctx.emit("error", x);
|
|
1407
1406
|
}
|
|
1408
|
-
if (
|
|
1407
|
+
if (h = h.filter((x) => x.oldValue !== x.value), !h.length)
|
|
1409
1408
|
return;
|
|
1410
1409
|
const { BEFORE_VALUE_CHANGE_METHOD: d } = this.ctx.config;
|
|
1411
|
-
s === "none" && typeof d == "function" && (
|
|
1412
|
-
const { value: w, rowKey:
|
|
1413
|
-
a.add(
|
|
1414
|
-
rowKey:
|
|
1410
|
+
s === "none" && typeof d == "function" && (h = await d(h), r = !1), h.forEach((x) => {
|
|
1411
|
+
const { value: w, rowKey: E, key: g } = x, m = this.getItemValue(E, g);
|
|
1412
|
+
a.add(E), this.setItemValue(E, g, w, !1, !1, !1, r), o.push({
|
|
1413
|
+
rowKey: E,
|
|
1415
1414
|
key: g,
|
|
1416
|
-
oldValue:
|
|
1415
|
+
oldValue: m,
|
|
1417
1416
|
newValue: w
|
|
1418
1417
|
});
|
|
1419
1418
|
});
|
|
@@ -1421,10 +1420,10 @@ class ue {
|
|
|
1421
1420
|
a.forEach((x) => {
|
|
1422
1421
|
f.push(this.ctx.database.getRowDataItemForRowKey(x));
|
|
1423
1422
|
});
|
|
1424
|
-
const u =
|
|
1423
|
+
const u = h.map(({ rowKey: x, key: w }) => this.getValidator(x, w));
|
|
1425
1424
|
Promise.all(u).then(() => {
|
|
1426
1425
|
this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
|
|
1427
|
-
}), this.ctx.emit("change",
|
|
1426
|
+
}), this.ctx.emit("change", h, f), e && this.ctx.history.pushState({
|
|
1428
1427
|
changeList: o,
|
|
1429
1428
|
scrollX: this.ctx.scrollX,
|
|
1430
1429
|
scrollY: this.ctx.scrollY,
|
|
@@ -1445,16 +1444,16 @@ class ue {
|
|
|
1445
1444
|
async setItemValue(t, e, i, s = !1, o = !1, r = !1, a = !0) {
|
|
1446
1445
|
if (!this.rowKeyMap.has(t))
|
|
1447
1446
|
return {};
|
|
1448
|
-
const { item:
|
|
1449
|
-
let
|
|
1447
|
+
const { item: l } = this.rowKeyMap.get(t);
|
|
1448
|
+
let h = l[e], d = i;
|
|
1450
1449
|
if (a && this.ctx.database.getReadonly(t, e))
|
|
1451
1450
|
return {
|
|
1452
|
-
oldValue:
|
|
1453
|
-
newValue:
|
|
1451
|
+
oldValue: h,
|
|
1452
|
+
newValue: h
|
|
1454
1453
|
};
|
|
1455
|
-
|
|
1454
|
+
l[e] !== null && typeof l[e] == "object" && (h = JSON.parse(JSON.stringify(l[e])));
|
|
1456
1455
|
const f = `${t}_${e}`;
|
|
1457
|
-
this.originalDataMap.has(f) || this.originalDataMap.set(f,
|
|
1456
|
+
this.originalDataMap.has(f) || this.originalDataMap.set(f, h);
|
|
1458
1457
|
const u = this.originalDataMap.get(f), x = this.getRowDataItemForRowKey(t);
|
|
1459
1458
|
if (r) {
|
|
1460
1459
|
const w = this.getVirtualBodyCellByKey(t, e);
|
|
@@ -1464,7 +1463,7 @@ class ue {
|
|
|
1464
1463
|
else if (/^-?\d+(\.\d+)?$/.test(`${i}`))
|
|
1465
1464
|
d = Number(i);
|
|
1466
1465
|
else {
|
|
1467
|
-
d =
|
|
1466
|
+
d = h;
|
|
1468
1467
|
const g = {
|
|
1469
1468
|
code: "ERR_SET_NUMBER_VALUE",
|
|
1470
1469
|
message: "Assignment failed, not a numeric type",
|
|
@@ -1473,46 +1472,46 @@ class ue {
|
|
|
1473
1472
|
rowKey: t,
|
|
1474
1473
|
key: e,
|
|
1475
1474
|
value: d,
|
|
1476
|
-
oldValue:
|
|
1475
|
+
oldValue: h,
|
|
1477
1476
|
row: x
|
|
1478
1477
|
}
|
|
1479
1478
|
]
|
|
1480
1479
|
};
|
|
1481
1480
|
this.ctx.emit("error", g);
|
|
1482
1481
|
}
|
|
1483
|
-
if (d ===
|
|
1482
|
+
if (d === h)
|
|
1484
1483
|
return {
|
|
1485
|
-
oldValue:
|
|
1486
|
-
newValue:
|
|
1484
|
+
oldValue: h,
|
|
1485
|
+
newValue: h
|
|
1487
1486
|
};
|
|
1488
|
-
let
|
|
1487
|
+
let E = [
|
|
1489
1488
|
{
|
|
1490
1489
|
rowKey: t,
|
|
1491
1490
|
key: e,
|
|
1492
1491
|
value: d,
|
|
1493
|
-
oldValue:
|
|
1492
|
+
oldValue: h,
|
|
1494
1493
|
row: x
|
|
1495
1494
|
}
|
|
1496
1495
|
];
|
|
1497
|
-
this.batchSetItemValue(
|
|
1496
|
+
this.batchSetItemValue(E, s, !1), this.ctx.emit("editChange", {
|
|
1498
1497
|
rowKey: t,
|
|
1499
1498
|
key: e,
|
|
1500
|
-
oldValue:
|
|
1499
|
+
oldValue: h,
|
|
1501
1500
|
value: d,
|
|
1502
1501
|
originalValue: u,
|
|
1503
1502
|
row: x
|
|
1504
1503
|
});
|
|
1505
1504
|
} else
|
|
1506
|
-
this.changedDataMap.set(f, d),
|
|
1505
|
+
this.changedDataMap.set(f, d), l[e] = d;
|
|
1507
1506
|
return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
|
|
1508
1507
|
rowKey: t,
|
|
1509
1508
|
key: e,
|
|
1510
|
-
oldValue:
|
|
1509
|
+
oldValue: h,
|
|
1511
1510
|
value: d,
|
|
1512
1511
|
originalValue: this.originalDataMap.get(f),
|
|
1513
1512
|
row: x
|
|
1514
1513
|
}), o && this.ctx.emit("draw"), {
|
|
1515
|
-
oldValue:
|
|
1514
|
+
oldValue: h,
|
|
1516
1515
|
newValue: d
|
|
1517
1516
|
};
|
|
1518
1517
|
}
|
|
@@ -1539,8 +1538,8 @@ class ue {
|
|
|
1539
1538
|
return !1;
|
|
1540
1539
|
const { item: s } = this.rowKeyMap.get(t), o = s[i];
|
|
1541
1540
|
this.checkboxKeyMap.has(o) && (this.checkboxKeyMap.get(o) || []).forEach((a) => {
|
|
1542
|
-
const
|
|
1543
|
-
|
|
1541
|
+
const l = this.selectionMap.get(a);
|
|
1542
|
+
l && (l.check = e);
|
|
1544
1543
|
});
|
|
1545
1544
|
}
|
|
1546
1545
|
}
|
|
@@ -1586,11 +1585,11 @@ class ue {
|
|
|
1586
1585
|
const e = this.getTreeParent(t);
|
|
1587
1586
|
if (!e)
|
|
1588
1587
|
return;
|
|
1589
|
-
const s = this.getTreeChildren(e).map((
|
|
1588
|
+
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;
|
|
1590
1589
|
let a = !1;
|
|
1591
1590
|
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));
|
|
1592
|
-
const
|
|
1593
|
-
|
|
1591
|
+
const l = this.selectionMap.get(e);
|
|
1592
|
+
l && l.check !== a && (l.check = a, this.setRowSelectionByCheckboxKey(e, a), this.updateParentTreeSelection(e));
|
|
1594
1593
|
}
|
|
1595
1594
|
/**
|
|
1596
1595
|
* 根据rowKey 设置选中状态
|
|
@@ -1623,23 +1622,23 @@ class ue {
|
|
|
1623
1622
|
return { checked: s, indeterminate: !1 };
|
|
1624
1623
|
let r = !1, a = s;
|
|
1625
1624
|
if (this.ctx.config.TREE_SELECT_MODE === "auto") {
|
|
1626
|
-
const
|
|
1627
|
-
const
|
|
1625
|
+
const h = (g) => {
|
|
1626
|
+
const m = this.getTreeChildren(g);
|
|
1628
1627
|
let y = [];
|
|
1629
|
-
for (const
|
|
1630
|
-
y.push(
|
|
1628
|
+
for (const p of m)
|
|
1629
|
+
y.push(p), y.push(...h(p));
|
|
1631
1630
|
return y;
|
|
1632
|
-
}, f =
|
|
1631
|
+
}, f = h(t).map((g) => this.selectionMap.get(g)), u = f.filter((g) => g == null ? void 0 : g.check).length, x = f.length, w = u > 0;
|
|
1633
1632
|
r = w && !(u === x), a = s || w, s && x > 0 && u === 0 && (a = !1, r = !1);
|
|
1634
1633
|
} else if (this.ctx.config.TREE_SELECT_MODE === "cautious") {
|
|
1635
|
-
const
|
|
1636
|
-
const
|
|
1634
|
+
const h = (g) => {
|
|
1635
|
+
const m = this.getTreeChildren(g);
|
|
1637
1636
|
let y = [];
|
|
1638
|
-
for (const
|
|
1639
|
-
y.push(
|
|
1637
|
+
for (const p of m)
|
|
1638
|
+
y.push(p), y.push(...h(p));
|
|
1640
1639
|
return y;
|
|
1641
|
-
}, f =
|
|
1642
|
-
r = w && !
|
|
1640
|
+
}, f = h(t).map((g) => this.selectionMap.get(g)), u = f.filter((g) => g == null ? void 0 : g.check).length, x = f.length, w = u > 0, E = u === x;
|
|
1641
|
+
r = w && !E, a = s || E, s && x > 0 && u === 0 && (a = !1, r = !1);
|
|
1643
1642
|
} else this.ctx.config.TREE_SELECT_MODE === "strictly" && (r = !1, a = s);
|
|
1644
1643
|
return { checked: a, indeterminate: r };
|
|
1645
1644
|
}
|
|
@@ -1665,9 +1664,9 @@ class ue {
|
|
|
1665
1664
|
for (const a of o.children) {
|
|
1666
1665
|
if (this.getRowKeyByItem(a) === s)
|
|
1667
1666
|
return r;
|
|
1668
|
-
const
|
|
1669
|
-
if (
|
|
1670
|
-
return
|
|
1667
|
+
const h = e(o.children, s);
|
|
1668
|
+
if (h)
|
|
1669
|
+
return h;
|
|
1671
1670
|
}
|
|
1672
1671
|
}
|
|
1673
1672
|
return null;
|
|
@@ -1742,23 +1741,23 @@ class ue {
|
|
|
1742
1741
|
let s = 0, o = 0;
|
|
1743
1742
|
const r = this.selectionMap.size, a = Array.from(this.selectionMap.values()).some((u) => u.check);
|
|
1744
1743
|
this.rowKeyMap.forEach((u, x) => {
|
|
1745
|
-
var
|
|
1746
|
-
(
|
|
1744
|
+
var E;
|
|
1745
|
+
(E = this.selectionMap.get(x)) != null && E.check && (s += 1);
|
|
1747
1746
|
let w = u.selectable;
|
|
1748
1747
|
typeof w == "function" && (w = w({
|
|
1749
1748
|
row: u.item,
|
|
1750
1749
|
rowIndex: u.rowIndex
|
|
1751
1750
|
})), w && (o += 1);
|
|
1752
1751
|
});
|
|
1753
|
-
const
|
|
1752
|
+
const l = r > i && s === 0 && a, h = o && o > s && s > 0 || l, d = o !== 0, f = !!o && o === s;
|
|
1754
1753
|
return this.bufferCheckState = {
|
|
1755
1754
|
buffer: !0,
|
|
1756
1755
|
check: f,
|
|
1757
|
-
indeterminate:
|
|
1756
|
+
indeterminate: h,
|
|
1758
1757
|
selectable: d
|
|
1759
1758
|
}, {
|
|
1760
1759
|
check: f,
|
|
1761
|
-
indeterminate:
|
|
1760
|
+
indeterminate: h,
|
|
1762
1761
|
selectable: d
|
|
1763
1762
|
};
|
|
1764
1763
|
}
|
|
@@ -1850,9 +1849,9 @@ class ue {
|
|
|
1850
1849
|
const s = this.rowKeyMap.get(t), o = this.headerMap.get(e);
|
|
1851
1850
|
if (!s || !o)
|
|
1852
1851
|
return !0;
|
|
1853
|
-
const r = s.readonly, a = o.readonly, { BODY_CELL_READONLY_METHOD:
|
|
1854
|
-
if (typeof
|
|
1855
|
-
const d =
|
|
1852
|
+
const r = s.readonly, a = o.readonly, { BODY_CELL_READONLY_METHOD: l } = this.ctx.config;
|
|
1853
|
+
if (typeof l == "function" && o) {
|
|
1854
|
+
const d = l({
|
|
1856
1855
|
row: s.item,
|
|
1857
1856
|
rowIndex: s.rowIndex,
|
|
1858
1857
|
colIndex: o.colIndex,
|
|
@@ -1876,7 +1875,7 @@ class ue {
|
|
|
1876
1875
|
if (o === void 0)
|
|
1877
1876
|
return i([]);
|
|
1878
1877
|
const a = o.column;
|
|
1879
|
-
let
|
|
1878
|
+
let l = a.rules;
|
|
1880
1879
|
if (typeof r == "function") {
|
|
1881
1880
|
const d = r({
|
|
1882
1881
|
row: s.item,
|
|
@@ -1885,10 +1884,10 @@ class ue {
|
|
|
1885
1884
|
column: a,
|
|
1886
1885
|
value: this.getItemValue(t, e)
|
|
1887
1886
|
});
|
|
1888
|
-
d && (
|
|
1887
|
+
d && (l = d);
|
|
1889
1888
|
}
|
|
1890
|
-
if (
|
|
1891
|
-
const
|
|
1889
|
+
if (l) {
|
|
1890
|
+
const h = {
|
|
1892
1891
|
row: s.item,
|
|
1893
1892
|
rowIndex: s.rowIndex,
|
|
1894
1893
|
colIndex: o.colIndex,
|
|
@@ -1898,7 +1897,7 @@ class ue {
|
|
|
1898
1897
|
value: this.getItemValue(t, e),
|
|
1899
1898
|
field: e,
|
|
1900
1899
|
fieldValue: this.getItemValue(t, e)
|
|
1901
|
-
}, f = new
|
|
1900
|
+
}, f = new ne(l).validate(h);
|
|
1902
1901
|
this.setValidationError(t, e, f), i(f);
|
|
1903
1902
|
} else
|
|
1904
1903
|
this.clearValidationError(t, e), i([]);
|
|
@@ -1920,14 +1919,14 @@ class ue {
|
|
|
1920
1919
|
row: o,
|
|
1921
1920
|
value: r,
|
|
1922
1921
|
colIndex: a,
|
|
1923
|
-
relationRowKeys:
|
|
1924
|
-
relationColKeys:
|
|
1922
|
+
relationRowKeys: l,
|
|
1923
|
+
relationColKeys: h,
|
|
1925
1924
|
rowspan: d,
|
|
1926
1925
|
height: f,
|
|
1927
1926
|
width: u,
|
|
1928
1927
|
colspan: x,
|
|
1929
1928
|
mergeRow: w,
|
|
1930
|
-
mergeCol:
|
|
1929
|
+
mergeCol: E
|
|
1931
1930
|
} = t;
|
|
1932
1931
|
if (d === 1 && x === 1)
|
|
1933
1932
|
return {
|
|
@@ -1948,112 +1947,106 @@ class ue {
|
|
|
1948
1947
|
}
|
|
1949
1948
|
]
|
|
1950
1949
|
};
|
|
1951
|
-
let g = e,
|
|
1950
|
+
let g = e, m = e, y = a, p = a, b = [], C = 0, R = 0, _ = 0, T = 0;
|
|
1952
1951
|
if (d !== 1 && w) {
|
|
1953
|
-
|
|
1954
|
-
const
|
|
1955
|
-
const
|
|
1956
|
-
return `${
|
|
1952
|
+
T = u;
|
|
1953
|
+
const S = l.reduce((I, v) => {
|
|
1954
|
+
const O = this.getItemValue(s, v) ?? "";
|
|
1955
|
+
return `${I}${O}`;
|
|
1957
1956
|
}, "");
|
|
1958
|
-
for (let
|
|
1959
|
-
const
|
|
1960
|
-
const
|
|
1961
|
-
return `${
|
|
1957
|
+
for (let I = e - 1; I >= 0; I--) {
|
|
1958
|
+
const v = this.rowIndexRowKeyMap.get(I) || "", O = l.reduce((A, L) => {
|
|
1959
|
+
const M = this.getItemValue(v, L) ?? "";
|
|
1960
|
+
return `${A}${M}`;
|
|
1962
1961
|
}, "");
|
|
1963
|
-
if (
|
|
1964
|
-
g =
|
|
1962
|
+
if (S === O)
|
|
1963
|
+
g = I;
|
|
1965
1964
|
else
|
|
1966
1965
|
break;
|
|
1967
1966
|
}
|
|
1968
|
-
for (let
|
|
1969
|
-
const
|
|
1970
|
-
const
|
|
1971
|
-
return `${
|
|
1967
|
+
for (let I = e; I <= this.ctx.maxRowIndex; I++) {
|
|
1968
|
+
const v = this.rowIndexRowKeyMap.get(I) || "", O = l.reduce((A, L) => {
|
|
1969
|
+
const M = this.getItemValue(v, L) ?? "";
|
|
1970
|
+
return `${A}${M}`;
|
|
1972
1971
|
}, "");
|
|
1973
|
-
if (
|
|
1974
|
-
|
|
1972
|
+
if (S === O)
|
|
1973
|
+
m = I;
|
|
1975
1974
|
else
|
|
1976
1975
|
break;
|
|
1977
1976
|
}
|
|
1978
|
-
for (let
|
|
1979
|
-
const { height:
|
|
1980
|
-
C +=
|
|
1977
|
+
for (let I = g; I < e; I++) {
|
|
1978
|
+
const { height: v } = this.positions[I];
|
|
1979
|
+
C += v;
|
|
1981
1980
|
}
|
|
1982
|
-
for (let
|
|
1983
|
-
const { height:
|
|
1984
|
-
|
|
1985
|
-
const
|
|
1986
|
-
|
|
1987
|
-
rowKey:
|
|
1981
|
+
for (let I = g; I <= m; I++) {
|
|
1982
|
+
const { height: v } = this.positions[I];
|
|
1983
|
+
_ += v;
|
|
1984
|
+
const O = this.rowIndexRowKeyMap.get(I) || "", { item: A } = this.rowKeyMap.get(O), L = this.getItemValue(O, i);
|
|
1985
|
+
b.push({
|
|
1986
|
+
rowKey: O,
|
|
1988
1987
|
key: i,
|
|
1989
1988
|
value: L,
|
|
1990
|
-
row:
|
|
1989
|
+
row: A
|
|
1991
1990
|
});
|
|
1992
1991
|
}
|
|
1993
1992
|
}
|
|
1994
|
-
if (x !== 1 &&
|
|
1995
|
-
|
|
1996
|
-
for (let
|
|
1997
|
-
const
|
|
1998
|
-
if (!
|
|
1993
|
+
if (x !== 1 && E) {
|
|
1994
|
+
_ = f;
|
|
1995
|
+
for (let S = a - 1; S >= 0; S--) {
|
|
1996
|
+
const I = this.getColumnByColIndex(S);
|
|
1997
|
+
if (!I)
|
|
1999
1998
|
break;
|
|
2000
|
-
const
|
|
2001
|
-
if (
|
|
2002
|
-
y =
|
|
1999
|
+
const v = this.getItemValue(s, i), O = this.getItemValue(s, I.key);
|
|
2000
|
+
if (v === O && h.includes(I.key))
|
|
2001
|
+
y = S;
|
|
2003
2002
|
else
|
|
2004
2003
|
break;
|
|
2005
2004
|
}
|
|
2006
|
-
for (let
|
|
2007
|
-
const
|
|
2008
|
-
if (!
|
|
2005
|
+
for (let S = a; S <= this.ctx.maxColIndex; S++) {
|
|
2006
|
+
const I = this.getColumnByColIndex(S);
|
|
2007
|
+
if (!I)
|
|
2009
2008
|
break;
|
|
2010
|
-
const
|
|
2011
|
-
if (
|
|
2012
|
-
|
|
2009
|
+
const v = this.getItemValue(s, i), O = this.getItemValue(s, I.key);
|
|
2010
|
+
if (v === O && h.includes(I.key))
|
|
2011
|
+
p = S;
|
|
2013
2012
|
else
|
|
2014
2013
|
break;
|
|
2015
2014
|
}
|
|
2016
|
-
for (let
|
|
2017
|
-
const
|
|
2018
|
-
if (!
|
|
2015
|
+
for (let S = y; S < a; S++) {
|
|
2016
|
+
const I = this.getColumnByColIndex(S);
|
|
2017
|
+
if (!I)
|
|
2019
2018
|
break;
|
|
2020
|
-
|
|
2019
|
+
R += I.width || 100;
|
|
2021
2020
|
}
|
|
2022
|
-
for (let
|
|
2023
|
-
const
|
|
2024
|
-
if (!
|
|
2021
|
+
for (let S = y; S <= p; S++) {
|
|
2022
|
+
const I = this.getColumnByColIndex(S);
|
|
2023
|
+
if (!I)
|
|
2025
2024
|
break;
|
|
2026
|
-
|
|
2025
|
+
T += I.width || 100, b.push({
|
|
2027
2026
|
rowKey: s,
|
|
2028
|
-
key:
|
|
2029
|
-
value: this.getItemValue(s,
|
|
2027
|
+
key: I.key,
|
|
2028
|
+
value: this.getItemValue(s, I.key),
|
|
2030
2029
|
row: o
|
|
2031
2030
|
});
|
|
2032
2031
|
}
|
|
2033
2032
|
}
|
|
2034
2033
|
return {
|
|
2035
|
-
xArr: [y,
|
|
2036
|
-
yArr: [g,
|
|
2034
|
+
xArr: [y, p],
|
|
2035
|
+
yArr: [g, m],
|
|
2037
2036
|
rowspan: d,
|
|
2038
2037
|
colspan: x,
|
|
2039
|
-
height:
|
|
2040
|
-
width:
|
|
2038
|
+
height: _,
|
|
2039
|
+
width: T,
|
|
2041
2040
|
offsetTop: C,
|
|
2042
|
-
offsetLeft:
|
|
2043
|
-
dataList:
|
|
2041
|
+
offsetLeft: R,
|
|
2042
|
+
dataList: b
|
|
2044
2043
|
};
|
|
2045
2044
|
}
|
|
2046
|
-
setLoading(t) {
|
|
2047
|
-
this.loading = t, this.ctx.emit("loadingChange", t);
|
|
2048
|
-
}
|
|
2049
|
-
getLoading() {
|
|
2050
|
-
return this.loading;
|
|
2051
|
-
}
|
|
2052
2045
|
setValidationErrorByRowIndex(t, e, i) {
|
|
2053
2046
|
const s = this.rowIndexRowKeyMap.get(t), o = `${s}_${e}`, r = this.getRowForRowIndex(t), a = this.getColumnByKey(e);
|
|
2054
2047
|
if (!s || !a || !r)
|
|
2055
2048
|
return;
|
|
2056
|
-
const
|
|
2049
|
+
const l = this.getItemValue(s, e), h = [
|
|
2057
2050
|
{
|
|
2058
2051
|
key: e,
|
|
2059
2052
|
rowKey: s,
|
|
@@ -2061,13 +2054,13 @@ class ue {
|
|
|
2061
2054
|
colIndex: a.colIndex,
|
|
2062
2055
|
column: a.column,
|
|
2063
2056
|
row: r,
|
|
2064
|
-
value:
|
|
2057
|
+
value: l,
|
|
2065
2058
|
message: i,
|
|
2066
2059
|
field: e,
|
|
2067
|
-
fieldValue:
|
|
2060
|
+
fieldValue: l
|
|
2068
2061
|
}
|
|
2069
2062
|
];
|
|
2070
|
-
this.validationErrorMap.set(o,
|
|
2063
|
+
this.validationErrorMap.set(o, h);
|
|
2071
2064
|
}
|
|
2072
2065
|
setValidationError(t, e, i) {
|
|
2073
2066
|
const s = `${t}_${e}`;
|
|
@@ -2129,7 +2122,7 @@ class ue {
|
|
|
2129
2122
|
return this.overlayerAutoHeightMap.get(i) || 0;
|
|
2130
2123
|
}
|
|
2131
2124
|
}
|
|
2132
|
-
class
|
|
2125
|
+
class we {
|
|
2133
2126
|
constructor(t) {
|
|
2134
2127
|
n(this, "ctx");
|
|
2135
2128
|
n(this, "history", []);
|
|
@@ -2184,7 +2177,7 @@ class ge {
|
|
|
2184
2177
|
this.history = [], this.historyIndex = -1;
|
|
2185
2178
|
}
|
|
2186
2179
|
}
|
|
2187
|
-
class
|
|
2180
|
+
class Ee {
|
|
2188
2181
|
constructor(t) {
|
|
2189
2182
|
n(this, "eventTasks", /* @__PURE__ */ new Map());
|
|
2190
2183
|
n(this, "ctx");
|
|
@@ -2338,21 +2331,21 @@ class pe {
|
|
|
2338
2331
|
* @param {string} color - 阴影的颜色
|
|
2339
2332
|
*/
|
|
2340
2333
|
drawShadow(t, e, i, s, o) {
|
|
2341
|
-
const { fillColor: r, side: a, shadowWidth:
|
|
2334
|
+
const { fillColor: r, side: a, shadowWidth: l, colorStart: h, colorEnd: d } = o;
|
|
2342
2335
|
this.ctx.save(), r && (this.ctx.fillStyle = r, this.ctx.fillRect(t, e, i, s));
|
|
2343
2336
|
let f;
|
|
2344
2337
|
switch (a) {
|
|
2345
2338
|
case "left":
|
|
2346
|
-
f = this.ctx.createLinearGradient(t -
|
|
2339
|
+
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);
|
|
2347
2340
|
break;
|
|
2348
2341
|
case "right":
|
|
2349
|
-
f = this.ctx.createLinearGradient(t + i, e, t + i +
|
|
2342
|
+
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);
|
|
2350
2343
|
break;
|
|
2351
2344
|
case "top":
|
|
2352
|
-
f = this.ctx.createLinearGradient(t, e -
|
|
2345
|
+
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);
|
|
2353
2346
|
break;
|
|
2354
2347
|
case "bottom":
|
|
2355
|
-
f = this.ctx.createLinearGradient(t, e + s, t, e + s +
|
|
2348
|
+
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);
|
|
2356
2349
|
break;
|
|
2357
2350
|
default:
|
|
2358
2351
|
console.error("Invalid side specified for shadow");
|
|
@@ -2374,12 +2367,12 @@ class pe {
|
|
|
2374
2367
|
drawImage(t, e, i, s, o) {
|
|
2375
2368
|
this.ctx.save(), this.ctx.drawImage(t, e, i, s, o), this.ctx.restore();
|
|
2376
2369
|
}
|
|
2377
|
-
drawRect(t, e, i, s, { borderWidth: o = 1, borderColor: r, fillColor: a, radius:
|
|
2378
|
-
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),
|
|
2370
|
+
drawRect(t, e, i, s, { borderWidth: o = 1, borderColor: r, fillColor: a, radius: l = 0 } = {}) {
|
|
2371
|
+
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)
|
|
2379
2372
|
this.ctx.rect(t - 0.5, e - 0.5, i, s);
|
|
2380
2373
|
else {
|
|
2381
|
-
const [
|
|
2382
|
-
this.ctx.moveTo(t +
|
|
2374
|
+
const [h, d, f, u] = typeof l == "number" ? [l, l, l, l] : l;
|
|
2375
|
+
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);
|
|
2383
2376
|
}
|
|
2384
2377
|
a !== void 0 && this.ctx.fill(), r !== void 0 && this.ctx.stroke(), this.ctx.restore();
|
|
2385
2378
|
}
|
|
@@ -2394,58 +2387,57 @@ class pe {
|
|
|
2394
2387
|
* @returns 是否溢出
|
|
2395
2388
|
*/
|
|
2396
2389
|
drawText(t = "", e, i, s, o, r = {}) {
|
|
2397
|
-
var
|
|
2390
|
+
var I;
|
|
2398
2391
|
this.ctx.save();
|
|
2399
2392
|
const {
|
|
2400
2393
|
font: a = "12px Arial",
|
|
2401
|
-
align:
|
|
2402
|
-
color:
|
|
2394
|
+
align: l = "center",
|
|
2395
|
+
color: h = "#495060",
|
|
2403
2396
|
padding: d = 0,
|
|
2404
2397
|
verticalAlign: f = "middle",
|
|
2405
2398
|
maxLineClamp: u = 1,
|
|
2406
2399
|
autoRowHeight: x = !1,
|
|
2407
2400
|
offsetLeft: w = 0,
|
|
2408
|
-
offsetRight:
|
|
2401
|
+
offsetRight: E = 0
|
|
2409
2402
|
} = r;
|
|
2410
|
-
this.ctx.font = a, this.ctx.fillStyle =
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
u === "auto" && x ? S = I.length : typeof u == "number" && u < C ? S = u : (u === 1 && !x && (I = [t], S = 1), u === "auto" && C === 1 && (I = [t], S = 1));
|
|
2403
|
+
if (this.ctx.font = a, this.ctx.fillStyle = h, this.ctx.textAlign = l, ["", null, void 0].includes(t))
|
|
2404
|
+
return this.ctx.restore(), !1;
|
|
2405
|
+
const m = parseInt(((I = a.match(/\d+/)) == null ? void 0 : I[0]) || "12") * (r.lineHeight || 1.2), y = s - d * 2 - w - E;
|
|
2406
|
+
let p = !1;
|
|
2407
|
+
const b = Math.round((o - 2 * d) / m);
|
|
2408
|
+
let C = this.wrapText(t, y, r.cacheTextKey), R = Math.min(C.length, Math.max(b, 1));
|
|
2409
|
+
u === "auto" && x ? R = C.length : typeof u == "number" && u < R && u !== 1 ? R = u : (u === 1 && (C = [t], R = 1), u === "auto" && b === 1 && (C = [t], R = 1));
|
|
2418
2410
|
let _ = i + d;
|
|
2419
|
-
const
|
|
2420
|
-
f === "middle" ? _ = i + (o -
|
|
2421
|
-
let
|
|
2422
|
-
|
|
2423
|
-
for (let
|
|
2424
|
-
const
|
|
2425
|
-
if (this.ctx.textBaseline = "top",
|
|
2426
|
-
const { _text:
|
|
2427
|
-
this.ctx.fillText(
|
|
2411
|
+
const T = Math.round(R * m);
|
|
2412
|
+
f === "middle" ? _ = i + (o - T) / 2 : f === "bottom" && (_ = i + o - T - d);
|
|
2413
|
+
let S = e + d + w;
|
|
2414
|
+
l === "center" ? S = e + s / 2 : l === "right" && (S = e + s - d - E);
|
|
2415
|
+
for (let v = 0; v < C.length; v++) {
|
|
2416
|
+
const O = C[v], A = _ + v * m;
|
|
2417
|
+
if (this.ctx.textBaseline = "top", v === R - 1) {
|
|
2418
|
+
const M = C.slice(v).join(""), { _text: D, ellipsis: H } = this.handleEllipsis(M, s, d, a);
|
|
2419
|
+
this.ctx.fillText(D, S, A), p = H;
|
|
2428
2420
|
break;
|
|
2429
2421
|
}
|
|
2430
|
-
this.ctx.fillText(
|
|
2422
|
+
this.ctx.fillText(O, S, A);
|
|
2431
2423
|
}
|
|
2432
|
-
if (r.textCallback &&
|
|
2433
|
-
const
|
|
2434
|
-
let
|
|
2435
|
-
|
|
2436
|
-
const
|
|
2437
|
-
x:
|
|
2424
|
+
if (r.textCallback && C.length) {
|
|
2425
|
+
const v = C.reduce((D, H) => Math.max(D, this.ctx.measureText(H).width), 0), O = Math.round(v);
|
|
2426
|
+
let A = S, L = S + O;
|
|
2427
|
+
l === "center" ? (A = S - O / 2, L = S + O / 2) : l === "right" && (A = S - O, L = S);
|
|
2428
|
+
const M = {
|
|
2429
|
+
x: S,
|
|
2438
2430
|
y: _,
|
|
2439
|
-
width:
|
|
2440
|
-
height:
|
|
2441
|
-
left:
|
|
2431
|
+
width: O,
|
|
2432
|
+
height: T,
|
|
2433
|
+
left: A,
|
|
2442
2434
|
right: L,
|
|
2443
2435
|
top: _,
|
|
2444
|
-
bottom: _ +
|
|
2436
|
+
bottom: _ + T
|
|
2445
2437
|
};
|
|
2446
|
-
r.textCallback(
|
|
2438
|
+
r.textCallback(M);
|
|
2447
2439
|
}
|
|
2448
|
-
return this.ctx.restore(),
|
|
2440
|
+
return this.ctx.restore(), p;
|
|
2449
2441
|
}
|
|
2450
2442
|
/**
|
|
2451
2443
|
* 将文本按宽度换行
|
|
@@ -2464,20 +2456,13 @@ class pe {
|
|
|
2464
2456
|
s.push("");
|
|
2465
2457
|
continue;
|
|
2466
2458
|
}
|
|
2467
|
-
const
|
|
2468
|
-
let
|
|
2469
|
-
for (const d of
|
|
2470
|
-
const f =
|
|
2471
|
-
this.ctx.measureText(f).width <= e ?
|
|
2472
|
-
}
|
|
2473
|
-
l && s.push(l);
|
|
2474
|
-
}
|
|
2475
|
-
if (s.length >= 1) {
|
|
2476
|
-
const a = s[s.length - 1], { ellipsis: h } = this.handleEllipsis(a, e, 0, this.ctx.font);
|
|
2477
|
-
if (h) {
|
|
2478
|
-
const l = a.slice(0, -1);
|
|
2479
|
-
s[s.length - 1] = l, s.push(a.slice(-1));
|
|
2459
|
+
const l = a.split("");
|
|
2460
|
+
let h = "";
|
|
2461
|
+
for (const d of l) {
|
|
2462
|
+
const f = h + d;
|
|
2463
|
+
this.ctx.measureText(f).width <= e ? h = f : h ? (s.push(h), h = d) : (s.push(d), h = "");
|
|
2480
2464
|
}
|
|
2465
|
+
h && s.push(h);
|
|
2481
2466
|
}
|
|
2482
2467
|
const r = s.length > 0 ? s : [""];
|
|
2483
2468
|
return i && this.textCacheMap.set(i, r), r;
|
|
@@ -2490,19 +2475,19 @@ class pe {
|
|
|
2490
2475
|
* @returns 计算出的高度
|
|
2491
2476
|
*/
|
|
2492
2477
|
calculateTextHeight(t = "", e, i = {}) {
|
|
2493
|
-
var
|
|
2478
|
+
var E;
|
|
2494
2479
|
const {
|
|
2495
2480
|
font: s = "12px Arial",
|
|
2496
2481
|
padding: o = 0,
|
|
2497
2482
|
align: r = "center",
|
|
2498
2483
|
color: a = "#495060",
|
|
2499
|
-
maxLineClamp:
|
|
2500
|
-
cacheTextKey:
|
|
2484
|
+
maxLineClamp: l = 1,
|
|
2485
|
+
cacheTextKey: h = ""
|
|
2501
2486
|
} = i;
|
|
2502
2487
|
this.ctx.save(), this.ctx.font = s, this.ctx.fillStyle = a, this.ctx.textAlign = r;
|
|
2503
|
-
const d = parseInt(((
|
|
2488
|
+
const d = parseInt(((E = s.match(/\d+/)) == null ? void 0 : E[0]) || "12"), f = d * (i.lineHeight || 1.2), u = e - o * 2, x = this.wrapText(t, u, h);
|
|
2504
2489
|
let w = 1;
|
|
2505
|
-
return
|
|
2490
|
+
return l === "auto" ? w = x.length : x.length > l ? w = l : w = x.length, this.ctx.restore(), Math.max(Math.floor(w * f + o * 2), Math.floor(d + o * 2));
|
|
2506
2491
|
}
|
|
2507
2492
|
handleEllipsis(t, e, i = 0, s = "12px Arial") {
|
|
2508
2493
|
this.ctx.save();
|
|
@@ -2518,12 +2503,12 @@ class pe {
|
|
|
2518
2503
|
_text: "",
|
|
2519
2504
|
ellipsis: !0
|
|
2520
2505
|
};
|
|
2521
|
-
const
|
|
2522
|
-
if (
|
|
2506
|
+
const l = this.ctx.measureText(t).width, h = e - i * 2;
|
|
2507
|
+
if (l && l >= h) {
|
|
2523
2508
|
o = !0;
|
|
2524
2509
|
let d = 0;
|
|
2525
2510
|
for (let f = 0; f < t.length; f++)
|
|
2526
|
-
if (d += this.ctx.measureText(t[f]).width, d >=
|
|
2511
|
+
if (d += this.ctx.measureText(t[f]).width, d >= h - a) {
|
|
2527
2512
|
r = t.slice(0, f) + "...", o = !0;
|
|
2528
2513
|
break;
|
|
2529
2514
|
}
|
|
@@ -2534,7 +2519,7 @@ class pe {
|
|
|
2534
2519
|
};
|
|
2535
2520
|
}
|
|
2536
2521
|
}
|
|
2537
|
-
class
|
|
2522
|
+
class Rt {
|
|
2538
2523
|
constructor(t) {
|
|
2539
2524
|
n(this, "_config", {});
|
|
2540
2525
|
/** CSS 类名前缀 */
|
|
@@ -2561,8 +2546,6 @@ class It {
|
|
|
2561
2546
|
n(this, "BORDER_COLOR", "#e1e6eb");
|
|
2562
2547
|
/** 宽度为 0 表示自适应100% */
|
|
2563
2548
|
n(this, "WIDTH", 0);
|
|
2564
|
-
/** 最小可调整宽度 */
|
|
2565
|
-
n(this, "RESIZE_MIN_WIDTH", 40);
|
|
2566
2549
|
/** 高度,为 0 表示自适应 */
|
|
2567
2550
|
n(this, "HEIGHT", 0);
|
|
2568
2551
|
/** 占位文本颜色 */
|
|
@@ -2573,6 +2556,8 @@ class It {
|
|
|
2573
2556
|
n(this, "EMPTY_CUSTOM_STYLE", {});
|
|
2574
2557
|
/** 空数据文本 */
|
|
2575
2558
|
n(this, "EMPTY_TEXT", "暂无数据");
|
|
2559
|
+
/** 加载文本 */
|
|
2560
|
+
n(this, "LOADING_TEXT", "加载中...");
|
|
2576
2561
|
/** 最大高度,为 0 表示自适应高度根据 HEIGHT */
|
|
2577
2562
|
n(this, "MAX_HEIGHT", 1e3);
|
|
2578
2563
|
/** 区域边框圆角 */
|
|
@@ -2591,6 +2576,8 @@ class It {
|
|
|
2591
2576
|
n(this, "BODY_BG_COLOR", "#FFF");
|
|
2592
2577
|
/** 表头文本颜色 */
|
|
2593
2578
|
n(this, "HEADER_TEXT_COLOR", "#1D2129");
|
|
2579
|
+
/** 必填*颜色 */
|
|
2580
|
+
n(this, "REQUIRED_COLOR", "#F56C6C");
|
|
2594
2581
|
/** body文本颜色 */
|
|
2595
2582
|
n(this, "BODY_TEXT_COLOR", "#4E5969");
|
|
2596
2583
|
/** footer文本颜色 */
|
|
@@ -2605,6 +2592,7 @@ class It {
|
|
|
2605
2592
|
n(this, "SHRINK_ICON_SVG", "");
|
|
2606
2593
|
/** 展开图标颜色 */
|
|
2607
2594
|
n(this, "EXPAND_ICON_COLOR", "#4E5969");
|
|
2595
|
+
/** 收缩图标颜色 */
|
|
2608
2596
|
n(this, "SHRINK_ICON_COLOR", "#4E5969");
|
|
2609
2597
|
/** 错误提示颜色 */
|
|
2610
2598
|
n(this, "ERROR_TIP_ICON_COLOR", "red");
|
|
@@ -2658,12 +2646,28 @@ class It {
|
|
|
2658
2646
|
n(this, "CHECKBOX_SIZE", 20);
|
|
2659
2647
|
/** 选择框禁用图标 */
|
|
2660
2648
|
n(this, "CHECKBOX_DISABLED_SVG", "");
|
|
2649
|
+
/** 选择框禁用图标颜色 */
|
|
2650
|
+
n(this, "CHECKBOX_DISABLED_COLOR", "#F1F2F4");
|
|
2661
2651
|
/** 选择框选中图标 */
|
|
2662
2652
|
n(this, "CHECKBOX_CHECK_SVG", "");
|
|
2663
2653
|
/** 选择框未中图标 */
|
|
2664
2654
|
n(this, "CHECKBOX_UNCHECK_SVG", "");
|
|
2655
|
+
/** 选择框未中图标颜色 */
|
|
2656
|
+
n(this, "CHECKBOX_UNCHECK_COLOR", "#DDE0EA");
|
|
2665
2657
|
/** 选择框半选中图标 */
|
|
2666
2658
|
n(this, "CHECKBOX_INDETERMINATE_SVG", "");
|
|
2659
|
+
/** 选择框选中禁用图标 */
|
|
2660
|
+
n(this, "CHECKBOX_CHECK_DISABLED_SVG", "");
|
|
2661
|
+
/** 选择框选中禁用图标颜色 */
|
|
2662
|
+
n(this, "CHECKBOX_CHECK_DISABLED_COLOR", "#DDE0EA");
|
|
2663
|
+
/** 编辑图标 */
|
|
2664
|
+
n(this, "ICON_EDIT_SVG", "");
|
|
2665
|
+
/** 编辑图标颜色 */
|
|
2666
|
+
n(this, "ICON_EDIT_COLOR", "#4E5969");
|
|
2667
|
+
/** 选择图标 */
|
|
2668
|
+
n(this, "ICON_SELECT_SVG", "");
|
|
2669
|
+
/** 选择图标颜色 */
|
|
2670
|
+
n(this, "ICON_SELECT_COLOR", "#4E5969");
|
|
2667
2671
|
/** 启用严格排序,即不支持多列排序 */
|
|
2668
2672
|
n(this, "SORT_STRICTLY", !0);
|
|
2669
2673
|
/** 排序升序图标 */
|
|
@@ -2836,14 +2840,14 @@ class It {
|
|
|
2836
2840
|
let t = {};
|
|
2837
2841
|
Object.keys(this).forEach((e) => {
|
|
2838
2842
|
if (e.endsWith("_COLOR") || e.endsWith("_FONT")) {
|
|
2839
|
-
const i = `--evt-${e.toLocaleLowerCase().replace(/_/g, "-")}`, s =
|
|
2843
|
+
const i = `--evt-${e.toLocaleLowerCase().replace(/_/g, "-")}`, s = xe(i);
|
|
2840
2844
|
s && (t[e] = s);
|
|
2841
2845
|
}
|
|
2842
2846
|
}), Object.assign(this, t, this._config);
|
|
2843
2847
|
}
|
|
2844
2848
|
}
|
|
2845
|
-
const
|
|
2846
|
-
class
|
|
2849
|
+
const St = '<svg t="1722595535853" 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="M640 128H384c-170.496 0-256 85.504-256 256v256c0 170.496 85.504 256 256 256h256c170.496 0 256-85.504 256-256V384c0-170.496-85.504-256-256-256z m67.584 302.592c-2.048 4.608-4.608 8.704-8.192 12.288L506.88 634.88c-3.584 3.584-7.68 6.144-12.288 8.192-4.608 2.048-9.728 3.072-14.848 3.072s-10.24-1.024-14.848-3.072c-4.608-2.048-8.704-4.608-12.288-8.192l-96.256-96.256c-3.584-3.584-6.144-7.68-8.192-12.288-2.048-4.608-3.072-9.728-3.072-14.848 0-2.56 0-5.12 1.024-7.68 0.512-2.56 1.024-5.12 2.048-7.168 1.024-2.56 2.048-4.608 3.584-6.656 1.536-2.048 3.072-4.096 4.608-5.632 1.536-2.048 3.584-3.584 5.632-4.608 2.048-1.536 4.096-2.56 6.656-3.584 2.56-1.024 4.608-1.536 7.168-2.048 2.56-0.512 5.12-0.512 7.68-0.512 5.12 0 10.24 1.024 14.848 3.072 4.608 2.048 8.704 4.608 12.288 8.192l69.12 68.608L645.12 389.12c3.584-3.584 7.68-6.144 12.288-8.192 4.608-2.048 9.728-3.072 14.848-3.072 2.56 0 5.12 0 7.68 0.512s5.12 1.024 7.168 2.048c2.56 1.024 4.608 2.048 6.656 3.584 2.048 1.536 4.096 3.072 5.632 4.608 1.536 1.536 3.584 3.584 4.608 5.632 1.536 2.048 2.56 4.096 3.584 6.656 1.024 2.56 1.536 4.608 2.048 7.168 0.512 2.56 1.024 5.12 1.024 7.68 0 5.12-1.024 10.24-3.072 14.848z" p-id="4552"></path></svg>', _t = '<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>', gt = '<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>', ye = gt.replace('fill="currentColor" p-id="2016"', 'fill="#bec4c7" p-id="2016"'), Ce = gt.replace('fill="currentColor" p-id="2015"', 'fill="#bec4c7" p-id="2015"');
|
|
2850
|
+
class be {
|
|
2847
2851
|
constructor(t) {
|
|
2848
2852
|
n(this, "ctx");
|
|
2849
2853
|
n(this, "list", [
|
|
@@ -2863,29 +2867,23 @@ class Ce {
|
|
|
2863
2867
|
},
|
|
2864
2868
|
{
|
|
2865
2869
|
name: "shrink",
|
|
2866
|
-
configName: "
|
|
2870
|
+
configName: "SHRINK_ICON_SVG",
|
|
2867
2871
|
configColorName: "SHRINK_ICON_COLOR",
|
|
2868
|
-
svg:
|
|
2872
|
+
svg: _t,
|
|
2869
2873
|
color: "#4E5969"
|
|
2870
2874
|
},
|
|
2871
2875
|
{
|
|
2872
2876
|
name: "checkbox-uncheck",
|
|
2873
2877
|
configName: "CHECKBOX_UNCHECK_SVG",
|
|
2874
|
-
|
|
2878
|
+
configColorName: "CHECKBOX_UNCHECK_COLOR",
|
|
2879
|
+
svg: '<svg t="1722595639920" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4708" width="32" height="32"><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z m64 0q0 79.552 56.256 135.744Q304.448 832 384 832h256q79.552 0 135.744-56.256Q832 719.552 832 640V384q0-79.552-56.256-135.744Q719.552 192 640 192H384q-79.552 0-135.744 56.256Q192 304.448 192 384v256z" p-id="4709"></path></svg>',
|
|
2875
2880
|
color: ""
|
|
2876
2881
|
},
|
|
2877
2882
|
{
|
|
2878
2883
|
name: "checkbox-check",
|
|
2879
2884
|
configName: "CHECKBOX_CHECK_SVG",
|
|
2880
2885
|
configColorName: "CHECKBOX_COLOR",
|
|
2881
|
-
svg:
|
|
2882
|
-
color: "rgb(82,146,247)"
|
|
2883
|
-
},
|
|
2884
|
-
{
|
|
2885
|
-
name: "checkbox-hover",
|
|
2886
|
-
configName: "CHECKBOX_UNCHECK_SVG",
|
|
2887
|
-
configColorName: "CHECKBOX_COLOR",
|
|
2888
|
-
svg: '<svg t="1722595639920" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4708" width="32" height="32"><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z m64 0q0 79.552 56.256 135.744Q304.448 832 384 832h256q79.552 0 135.744-56.256Q832 719.552 832 640V384q0-79.552-56.256-135.744Q719.552 192 640 192H384q-79.552 0-135.744 56.256Q192 304.448 192 384v256z" fill="#DDE0EA" p-id="4709"></path></svg>',
|
|
2886
|
+
svg: St,
|
|
2889
2887
|
color: "rgb(82,146,247)"
|
|
2890
2888
|
},
|
|
2891
2889
|
{
|
|
@@ -2897,41 +2895,43 @@ class Ce {
|
|
|
2897
2895
|
},
|
|
2898
2896
|
{
|
|
2899
2897
|
name: "checkbox-check-disabled",
|
|
2900
|
-
configName: "
|
|
2901
|
-
svg:
|
|
2898
|
+
configName: "CHECKBOX_CHECK_DISABLED_SVG",
|
|
2899
|
+
svg: St,
|
|
2902
2900
|
color: "#DDE0EA"
|
|
2903
2901
|
},
|
|
2904
2902
|
{
|
|
2905
2903
|
name: "checkbox-disabled",
|
|
2906
2904
|
configName: "CHECKBOX_DISABLED_SVG",
|
|
2907
|
-
|
|
2908
|
-
|
|
2905
|
+
configColorName: "CHECKBOX_DISABLED_COLOR",
|
|
2906
|
+
svg: '<svg t="1722595946663" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4865" width="32" height="32"><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z" p-id="4866"></path><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z m64 0q0 79.552 56.256 135.744Q304.448 832 384 832h256q79.552 0 135.744-56.256Q832 719.552 832 640V384q0-79.552-56.256-135.744Q719.552 192 640 192H384q-79.552 0-135.744 56.256Q192 304.448 192 384v256z" fill="#DDE0EA" p-id="4867"></path></svg>',
|
|
2907
|
+
color: "#F1F2F4"
|
|
2909
2908
|
},
|
|
2910
2909
|
{
|
|
2911
2910
|
name: "icon-edit",
|
|
2912
|
-
configName: "
|
|
2911
|
+
configName: "ICON_EDIT_SVG",
|
|
2912
|
+
configColorName: "ICON_EDIT_COLOR",
|
|
2913
2913
|
svg: '<svg t="1744798692576" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6606" width="200" height="200"><path d="M855.296 894.528H168.768v-76.8h686.528v76.8z m38.4-38.4q0 3.84-0.768 7.488-0.704 3.712-2.176 7.232-1.472 3.52-3.52 6.656-2.112 3.136-4.8 5.76-2.688 2.688-5.824 4.8-3.2 2.112-6.656 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.52-1.472-6.656-3.584-3.136-2.112-5.76-4.736-2.688-2.688-4.8-5.824-2.112-3.2-3.584-6.656-1.408-3.52-2.176-7.232-0.704-3.648-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.136 4.736-5.76 2.688-2.752 5.824-4.8 3.2-2.112 6.656-3.584 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.472 6.656 3.584 3.2 2.048 5.76 4.736 2.752 2.688 4.864 5.824 2.048 3.2 3.52 6.656 1.472 3.456 2.176 7.168 0.768 3.712 0.768 7.488z m-686.528 0q0 3.84-0.768 7.488-0.704 3.712-2.176 7.232-1.472 3.52-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.736-2.688-2.688-4.8-5.824-2.112-3.2-3.584-6.656-1.408-3.52-2.176-7.232-0.704-3.648-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.136 4.736-5.76 2.688-2.752 5.824-4.8 3.2-2.112 6.656-3.584 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.472 6.656 3.584 3.2 2.048 5.824 4.736 2.688 2.688 4.8 5.824 2.048 3.2 3.52 6.656 1.472 3.456 2.176 7.168 0.768 3.712 0.768 7.488zM652.032 211.2l-369.92 370.368v89.344h90.048l369.664-369.856L652.032 211.2z m-54.4-54.272q22.528-22.528 54.4-22.528 31.808 0 54.336 22.528l89.792 89.856q22.464 22.464 22.464 54.272t-22.464 54.272l-369.664 369.856q-22.464 22.528-54.336 22.528H282.24q-31.808 0-54.336-22.528-22.464-22.464-22.464-54.272V581.568q0-31.808 22.4-54.272l369.92-370.368z" p-id="6607"></path></svg>',
|
|
2914
2914
|
color: "#4E5969"
|
|
2915
2915
|
},
|
|
2916
2916
|
{
|
|
2917
2917
|
name: "icon-select",
|
|
2918
|
-
configName: "
|
|
2919
|
-
configColorName: "
|
|
2920
|
-
svg:
|
|
2918
|
+
configName: "ICON_SELECT_SVG",
|
|
2919
|
+
configColorName: "ICON_SELECT_COLOR",
|
|
2920
|
+
svg: _t,
|
|
2921
2921
|
color: "#4E5969"
|
|
2922
2922
|
},
|
|
2923
2923
|
{
|
|
2924
2924
|
name: "sort-asc",
|
|
2925
2925
|
configName: "SORT_ASC_ICON_SVG",
|
|
2926
2926
|
configColorName: "SORT_ICON_COLOR",
|
|
2927
|
-
svg:
|
|
2927
|
+
svg: ye,
|
|
2928
2928
|
color: "rgb(82,146,247)"
|
|
2929
2929
|
},
|
|
2930
2930
|
{
|
|
2931
2931
|
name: "sort-desc",
|
|
2932
2932
|
configName: "SORT_DESC_ICON_SVG",
|
|
2933
2933
|
configColorName: "SORT_ICON_COLOR",
|
|
2934
|
-
svg:
|
|
2934
|
+
svg: Ce,
|
|
2935
2935
|
color: "rgb(82,146,247)"
|
|
2936
2936
|
},
|
|
2937
2937
|
{
|
|
@@ -2974,32 +2974,35 @@ class Ce {
|
|
|
2974
2974
|
}
|
|
2975
2975
|
async createImageFromSVG(t, e, i = !1) {
|
|
2976
2976
|
const r = new DOMParser().parseFromString(t, "image/svg+xml").documentElement;
|
|
2977
|
-
e && r.querySelectorAll("*").forEach((
|
|
2978
|
-
const d =
|
|
2979
|
-
(d === "currentColor" || d === null) &&
|
|
2977
|
+
e && r.querySelectorAll("*").forEach((h) => {
|
|
2978
|
+
const d = h.getAttribute("fill");
|
|
2979
|
+
(d === "currentColor" || d === null) && h.setAttribute("fill", e);
|
|
2980
2980
|
});
|
|
2981
2981
|
const a = new Image();
|
|
2982
|
-
let
|
|
2982
|
+
let l = "";
|
|
2983
2983
|
if (i) {
|
|
2984
|
-
const
|
|
2984
|
+
const h = new Blob([new XMLSerializer().serializeToString(r)], {
|
|
2985
2985
|
type: "image/svg+xml"
|
|
2986
2986
|
});
|
|
2987
|
-
|
|
2987
|
+
l = URL.createObjectURL(h);
|
|
2988
2988
|
} else
|
|
2989
|
-
|
|
2990
|
-
return a.src =
|
|
2989
|
+
l = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(r));
|
|
2990
|
+
return a.src = l, new Promise((h, d) => {
|
|
2991
2991
|
a.onerror = () => d(new Error("Failed to load image:" + t)), a.onload = () => {
|
|
2992
|
-
|
|
2992
|
+
h(a);
|
|
2993
2993
|
};
|
|
2994
2994
|
});
|
|
2995
2995
|
}
|
|
2996
2996
|
get(t) {
|
|
2997
2997
|
return this.icons.get(t);
|
|
2998
2998
|
}
|
|
2999
|
+
getSvg(t) {
|
|
3000
|
+
return this.list.find((e) => e.name === t);
|
|
3001
|
+
}
|
|
2999
3002
|
}
|
|
3000
|
-
class ct extends
|
|
3001
|
-
constructor(e, i, s, o, r, a,
|
|
3002
|
-
super(e, s, o, r, a, "header",
|
|
3003
|
+
class ct extends Bt {
|
|
3004
|
+
constructor(e, i, s, o, r, a, l) {
|
|
3005
|
+
super(e, s, o, r, a, "header", l.fixed);
|
|
3003
3006
|
n(this, "align");
|
|
3004
3007
|
n(this, "hideHeaderSelection", !1);
|
|
3005
3008
|
n(this, "verticalAlign", "middle");
|
|
@@ -3036,7 +3039,7 @@ class ct extends Yt {
|
|
|
3036
3039
|
n(this, "sortDescIconName", "sort-desc");
|
|
3037
3040
|
n(this, "visibleWidth", 0);
|
|
3038
3041
|
n(this, "visibleHeight", 0);
|
|
3039
|
-
n(this, "
|
|
3042
|
+
n(this, "maxLineClampHeader", "auto");
|
|
3040
3043
|
n(this, "domDataset", {});
|
|
3041
3044
|
n(this, "drawTextX", 0);
|
|
3042
3045
|
n(this, "drawTextY", 0);
|
|
@@ -3057,7 +3060,7 @@ class ct extends Yt {
|
|
|
3057
3060
|
n(this, "drawSortImageHeight", 0);
|
|
3058
3061
|
n(this, "drawSortImageName", "");
|
|
3059
3062
|
n(this, "drawSortImageSource");
|
|
3060
|
-
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 =
|
|
3063
|
+
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 = Dt(), this.overflowTooltipShow = l.overflowTooltipHeaderShow !== !1, this.hasChildren = l.children && l.children.length > 0 || !1, this.render = l.renderHeader, this.maxLineClampHeader = l.maxLineClampHeader || "auto";
|
|
3061
3064
|
}
|
|
3062
3065
|
/**
|
|
3063
3066
|
* 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
|
|
@@ -3077,11 +3080,11 @@ class ct extends Yt {
|
|
|
3077
3080
|
const { HEADER_CELL_STYLE_METHOD: e, HEADER_BG_COLOR: i, HEADER_TEXT_COLOR: s } = this.ctx.config;
|
|
3078
3081
|
let o = i, r = s;
|
|
3079
3082
|
if (typeof e == "function") {
|
|
3080
|
-
const a = e, { backgroundColor:
|
|
3083
|
+
const a = e, { backgroundColor: l, color: h } = a({
|
|
3081
3084
|
colIndex: this.colIndex,
|
|
3082
3085
|
column: this.column
|
|
3083
3086
|
}) || {};
|
|
3084
|
-
|
|
3087
|
+
l && (o = l), h && (r = h);
|
|
3085
3088
|
}
|
|
3086
3089
|
this.drawCellBgColor = o, this.drawTextColor = r;
|
|
3087
3090
|
}
|
|
@@ -3104,8 +3107,8 @@ class ct extends Yt {
|
|
|
3104
3107
|
drawText() {
|
|
3105
3108
|
const {
|
|
3106
3109
|
paint: e,
|
|
3107
|
-
config: { HEADER_FONT: i, CELL_PADDING: s }
|
|
3108
|
-
} = this.ctx,
|
|
3110
|
+
config: { HEADER_FONT: i, CELL_PADDING: s, REQUIRED_COLOR: o }
|
|
3111
|
+
} = this.ctx, r = `${this.displayText}_${this.drawTextWidth}`;
|
|
3109
3112
|
this.ellipsis = e.drawText(
|
|
3110
3113
|
this.displayText,
|
|
3111
3114
|
this.drawTextX,
|
|
@@ -3118,27 +3121,20 @@ class ct extends Yt {
|
|
|
3118
3121
|
color: this.drawTextColor,
|
|
3119
3122
|
align: this.align,
|
|
3120
3123
|
verticalAlign: this.verticalAlign,
|
|
3121
|
-
maxLineClamp: this.
|
|
3124
|
+
maxLineClamp: this.maxLineClampHeader,
|
|
3122
3125
|
offsetRight: this.column.sortBy ? 16 : 0,
|
|
3123
3126
|
// 排序图标占位
|
|
3124
3127
|
offsetLeft: this.required ? 12 : 0,
|
|
3125
3128
|
// 必填星号占位
|
|
3126
|
-
cacheTextKey:
|
|
3127
|
-
textCallback: (
|
|
3128
|
-
this.column.sortBy && (this.drawSortImageX =
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
color: "red",
|
|
3136
|
-
font: "18px Arial",
|
|
3137
|
-
align: "center",
|
|
3138
|
-
verticalAlign: "middle",
|
|
3139
|
-
padding: 0
|
|
3140
|
-
}
|
|
3141
|
-
);
|
|
3129
|
+
cacheTextKey: r,
|
|
3130
|
+
textCallback: (a) => {
|
|
3131
|
+
this.column.sortBy && (this.drawSortImageX = a.right + 4, this.drawSortImageY = a.top + (a.height - 16) / 2), this.required && e.drawText("*", a.left - 18, a.top + (a.height - 12) / 2, 24, 24, {
|
|
3132
|
+
color: o,
|
|
3133
|
+
font: "18px Arial",
|
|
3134
|
+
align: "center",
|
|
3135
|
+
verticalAlign: "middle",
|
|
3136
|
+
padding: 0
|
|
3137
|
+
});
|
|
3142
3138
|
}
|
|
3143
3139
|
}
|
|
3144
3140
|
);
|
|
@@ -3156,10 +3152,10 @@ class ct extends Yt {
|
|
|
3156
3152
|
drawSelection() {
|
|
3157
3153
|
if (!this.hideHeaderSelection && ["index-selection", "selection", "selection-tree", "tree-selection"].includes(this.type)) {
|
|
3158
3154
|
const { indeterminate: e, check: i, selectable: s } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: o = 0, CELL_PADDING: r } = this.ctx.config;
|
|
3159
|
-
let a = this.drawX + (this.width - o) / 2,
|
|
3160
|
-
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" ?
|
|
3161
|
-
let
|
|
3162
|
-
e ? (
|
|
3155
|
+
let a = this.drawX + (this.width - o) / 2, l = this.drawY + (this.height - o) / 2;
|
|
3156
|
+
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);
|
|
3157
|
+
let h = this.ctx.icons.get("checkbox-uncheck"), d = "checkbox-uncheck";
|
|
3158
|
+
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(
|
|
3163
3159
|
this.drawSelectionImageSource,
|
|
3164
3160
|
this.drawSelectionImageX,
|
|
3165
3161
|
this.drawSelectionImageY,
|
|
@@ -3185,7 +3181,7 @@ class ct extends Yt {
|
|
|
3185
3181
|
));
|
|
3186
3182
|
}
|
|
3187
3183
|
getText() {
|
|
3188
|
-
return this.render ? "" : `${this.text}`;
|
|
3184
|
+
return this.render || ["", null, void 0].includes(this.text) ? "" : `${this.text}`;
|
|
3189
3185
|
}
|
|
3190
3186
|
/**
|
|
3191
3187
|
* 获取样式
|
|
@@ -3204,7 +3200,7 @@ class ct extends Yt {
|
|
|
3204
3200
|
};
|
|
3205
3201
|
}
|
|
3206
3202
|
}
|
|
3207
|
-
class
|
|
3203
|
+
class Ie {
|
|
3208
3204
|
constructor(t) {
|
|
3209
3205
|
n(this, "ctx");
|
|
3210
3206
|
n(this, "visibleHoverCell");
|
|
@@ -3348,8 +3344,8 @@ class be {
|
|
|
3348
3344
|
t.drawTreeImageHeight
|
|
3349
3345
|
))
|
|
3350
3346
|
return;
|
|
3351
|
-
const
|
|
3352
|
-
if (f && u && !
|
|
3347
|
+
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;
|
|
3348
|
+
if (f && u && !h && !d)
|
|
3353
3349
|
typeof u == "function" && (this.ctx.database.expandLoading(t.rowKey, !0), u({
|
|
3354
3350
|
row: t.row,
|
|
3355
3351
|
rowIndex: t.rowIndex,
|
|
@@ -3378,8 +3374,8 @@ class be {
|
|
|
3378
3374
|
))
|
|
3379
3375
|
return;
|
|
3380
3376
|
const a = this.ctx.database.getSortState(t.key);
|
|
3381
|
-
let
|
|
3382
|
-
a.direction === "none" ?
|
|
3377
|
+
let l;
|
|
3378
|
+
a.direction === "none" ? l = "asc" : a.direction === "asc" ? l = "desc" : l = "none", this.ctx.database.setSortState(t.key, l);
|
|
3383
3379
|
}
|
|
3384
3380
|
/**
|
|
3385
3381
|
* 图标进入和离开事件,包括选中,展开,提示图标等
|
|
@@ -3453,7 +3449,7 @@ class be {
|
|
|
3453
3449
|
}
|
|
3454
3450
|
isBusy(t) {
|
|
3455
3451
|
const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = e, o = i;
|
|
3456
|
-
if (!this.ctx.isTarget(t) || this.ctx.stageElement.style.cursor === "row-resize" || this.ctx.stageElement.style.cursor === "col-resize" || this.ctx.columnResizing || this.ctx.rowResizing)
|
|
3452
|
+
if (this.ctx.loading || !this.ctx.isTarget(t) || this.ctx.stageElement.style.cursor === "row-resize" || this.ctx.stageElement.style.cursor === "col-resize" || this.ctx.columnResizing || this.ctx.rowResizing)
|
|
3457
3453
|
return !0;
|
|
3458
3454
|
const { SCROLLER_TRACK_SIZE: r } = this.ctx.config;
|
|
3459
3455
|
return !!(this.ctx.scrollerMove || this.ctx.scrollerFocus || s > this.ctx.stageHeight - r || o > this.ctx.stageWidth - r);
|
|
@@ -3462,15 +3458,15 @@ class be {
|
|
|
3462
3458
|
if (this.isInsideBody(e))
|
|
3463
3459
|
for (const r of i) {
|
|
3464
3460
|
const a = r.fixedCells.concat(r.noFixedCells);
|
|
3465
|
-
for (const
|
|
3466
|
-
const
|
|
3461
|
+
for (const l of a) {
|
|
3462
|
+
const h = l.getDrawX(), d = l.getDrawY();
|
|
3467
3463
|
if (o) {
|
|
3468
|
-
if (t >
|
|
3469
|
-
s(
|
|
3464
|
+
if (t > h && t < h + l.visibleWidth && e > d && e < d + l.visibleHeight) {
|
|
3465
|
+
s(l);
|
|
3470
3466
|
return;
|
|
3471
3467
|
}
|
|
3472
|
-
} else if (t >
|
|
3473
|
-
s(
|
|
3468
|
+
} else if (t > h && t < h + l.width && e > d && e < d + l.height) {
|
|
3469
|
+
s(l);
|
|
3474
3470
|
return;
|
|
3475
3471
|
}
|
|
3476
3472
|
}
|
|
@@ -3504,6 +3500,7 @@ class Re {
|
|
|
3504
3500
|
n(this, "editorElement");
|
|
3505
3501
|
n(this, "emptyElement");
|
|
3506
3502
|
n(this, "contextMenuElement");
|
|
3503
|
+
n(this, "loadingElement");
|
|
3507
3504
|
n(this, "stageWidth", 0);
|
|
3508
3505
|
n(this, "stageHeight", 0);
|
|
3509
3506
|
n(this, "paint");
|
|
@@ -3524,10 +3521,16 @@ class Re {
|
|
|
3524
3521
|
// 自动填充移动中
|
|
3525
3522
|
n(this, "selectorMove", !1);
|
|
3526
3523
|
// 选择器移动中
|
|
3524
|
+
n(this, "selectColsIng", !1);
|
|
3525
|
+
// 选择列中
|
|
3526
|
+
n(this, "selectRowsIng", !1);
|
|
3527
|
+
// 选择行中
|
|
3527
3528
|
n(this, "adjustPositioning", !1);
|
|
3528
3529
|
// 调整位置中
|
|
3529
3530
|
n(this, "editing", !1);
|
|
3530
3531
|
// 编辑中
|
|
3532
|
+
n(this, "loading", !1);
|
|
3533
|
+
// 加载中
|
|
3531
3534
|
n(this, "onlyMergeCell", !1);
|
|
3532
3535
|
// 只有合并单元格
|
|
3533
3536
|
n(this, "selectOnlyOne", !1);
|
|
@@ -3610,20 +3613,21 @@ class Re {
|
|
|
3610
3613
|
canvasElement: o,
|
|
3611
3614
|
overlayerElement: r,
|
|
3612
3615
|
editorElement: a,
|
|
3613
|
-
emptyElement:
|
|
3614
|
-
|
|
3616
|
+
emptyElement: l,
|
|
3617
|
+
loadingElement: h,
|
|
3618
|
+
contextMenuElement: d
|
|
3615
3619
|
} = t;
|
|
3616
|
-
this.containerElement = i, s.tabIndex = 0, this.stageElement = s, this.canvasElement = o, this.overlayerElement = r, this.editorElement = a, this.emptyElement = h, this.contextMenuElement =
|
|
3620
|
+
this.containerElement = i, s.tabIndex = 0, this.stageElement = s, this.canvasElement = o, this.overlayerElement = r, this.editorElement = a, this.emptyElement = l, this.loadingElement = h, this.contextMenuElement = d, this.config = new Rt(e.config || {}), this.eventBus = new me(), this.eventBrowser = new Ee(this), this.eventTable = new Ie(this), this.paint = new pe(this.canvasElement), this.database = new ge(this, e), this.history = new we(this), this.icons = new be(this);
|
|
3617
3621
|
}
|
|
3618
3622
|
setConfig(t) {
|
|
3619
|
-
this.config = new
|
|
3623
|
+
this.config = new Rt(t);
|
|
3620
3624
|
}
|
|
3621
3625
|
setItemValueByEditor(t, e, i, s = !0, o = !0, r = !0) {
|
|
3622
3626
|
if (this.config.ENABLE_MERGE_CELL_LINK) {
|
|
3623
3627
|
const a = this.database.getVirtualBodyCellByKey(t, e);
|
|
3624
3628
|
if (a && (a.mergeRow || a.mergeCol)) {
|
|
3625
|
-
const { dataList:
|
|
3626
|
-
this.database.batchSetItemValue(
|
|
3629
|
+
const { dataList: l } = a.getSpanInfo(), h = l.map((d) => ({ ...d, value: i }));
|
|
3630
|
+
this.database.batchSetItemValue(h, s, r);
|
|
3627
3631
|
return;
|
|
3628
3632
|
}
|
|
3629
3633
|
}
|
|
@@ -3635,9 +3639,9 @@ class Re {
|
|
|
3635
3639
|
t.forEach((o) => {
|
|
3636
3640
|
const r = this.database.getRowIndexForRowKey(o.rowKey), a = this.database.getColIndexForKey(o.key);
|
|
3637
3641
|
if (r === void 0 || a === void 0) return;
|
|
3638
|
-
const
|
|
3639
|
-
if (
|
|
3640
|
-
const { dataList:
|
|
3642
|
+
const l = this.database.getVirtualBodyCell(r, a);
|
|
3643
|
+
if (l) {
|
|
3644
|
+
const { dataList: h } = l.getSpanInfo(), d = h.map((f) => ({ ...f, value: o.value }));
|
|
3641
3645
|
s.push(...d);
|
|
3642
3646
|
}
|
|
3643
3647
|
}), this.database.batchSetItemValue(s, e, i);
|
|
@@ -3682,7 +3686,7 @@ class Re {
|
|
|
3682
3686
|
for (let o = 0; o <= e[1] - e[0]; o++) {
|
|
3683
3687
|
const r = [];
|
|
3684
3688
|
for (let a = 0; a <= i[1] - i[0]; a++) {
|
|
3685
|
-
const
|
|
3689
|
+
const l = o + e[0], h = a + i[0], d = this.database.getVirtualBodyCell(l, h);
|
|
3686
3690
|
d && (d.selectorCellValueType === "displayText" ? r.push(d.displayText) : r.push(d.getValue()));
|
|
3687
3691
|
}
|
|
3688
3692
|
s += `${r.join(" ")}\r`, t.push(r);
|
|
@@ -3712,6 +3716,12 @@ class Re {
|
|
|
3712
3716
|
const s = this.body.height - this.body.visibleHeight + i;
|
|
3713
3717
|
e < 0 ? e = 0 : e > s && (e = s), this.emit("setScrollY", e);
|
|
3714
3718
|
}
|
|
3719
|
+
startAdjustPosition(t) {
|
|
3720
|
+
this.emit("startAdjustPosition", t);
|
|
3721
|
+
}
|
|
3722
|
+
stopAdjustPosition() {
|
|
3723
|
+
this.emit("stopAdjustPosition");
|
|
3724
|
+
}
|
|
3715
3725
|
isTarget(t) {
|
|
3716
3726
|
return !!this.containerElement.contains(t.target);
|
|
3717
3727
|
}
|
|
@@ -3741,7 +3751,7 @@ class Re {
|
|
|
3741
3751
|
this.eventTable.destroy(), this.eventBrowser.destroy(), this.eventBus.destroy();
|
|
3742
3752
|
}
|
|
3743
3753
|
}
|
|
3744
|
-
class
|
|
3754
|
+
class vt {
|
|
3745
3755
|
constructor(t, e) {
|
|
3746
3756
|
n(this, "ctx");
|
|
3747
3757
|
n(this, "type");
|
|
@@ -3803,8 +3813,8 @@ class St {
|
|
|
3803
3813
|
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;
|
|
3804
3814
|
let a = 0;
|
|
3805
3815
|
if (this.type === "horizontal" ? a = s - this.clientX : a = o - this.clientY, this.isDragging && a !== 0) {
|
|
3806
|
-
let
|
|
3807
|
-
this.type === "vertical" ?
|
|
3816
|
+
let l = 0;
|
|
3817
|
+
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));
|
|
3808
3818
|
}
|
|
3809
3819
|
}
|
|
3810
3820
|
isPointInElement(t, e, i, s, o, r) {
|
|
@@ -3830,23 +3840,23 @@ class St {
|
|
|
3830
3840
|
stageHeight: i,
|
|
3831
3841
|
stageWidth: s,
|
|
3832
3842
|
config: { SCROLLER_TRACK_SIZE: o = 0, SCROLLER_SIZE: r = 0, BORDER: a }
|
|
3833
|
-
} = this.ctx,
|
|
3843
|
+
} = this.ctx, l = s, h = i, d = e.height, f = e.width, u = t.height, x = this.ctx.footer.height;
|
|
3834
3844
|
if (this.type === "vertical") {
|
|
3835
|
-
this.visibleDistance =
|
|
3845
|
+
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;
|
|
3836
3846
|
const w = this.distance ? this.visibleDistance / (u + x) : 0;
|
|
3837
|
-
let
|
|
3838
|
-
|
|
3847
|
+
let E = Math.floor(w * this.visibleDistance);
|
|
3848
|
+
E < 30 ? E = 30 : E > this.visibleDistance && (E = 0), this.barHeight = E, this.barY = d + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
3839
3849
|
} else {
|
|
3840
|
-
this.visibleDistance =
|
|
3841
|
-
h - o,
|
|
3850
|
+
this.visibleDistance = l - o, this.distance = f - this.visibleDistance, this.splitPoints = [
|
|
3842
3851
|
l - o,
|
|
3843
3852
|
h - o,
|
|
3844
|
-
l
|
|
3853
|
+
l - o,
|
|
3854
|
+
h
|
|
3845
3855
|
];
|
|
3846
3856
|
const w = a ? 0 : 0.5;
|
|
3847
|
-
this.trackX = 0, this.trackY =
|
|
3848
|
-
const
|
|
3849
|
-
let g = Math.floor(
|
|
3857
|
+
this.trackX = 0, this.trackY = h - o + w, this.trackWidth = l, this.trackHeight = o;
|
|
3858
|
+
const E = this.distance ? this.visibleDistance / f : 0;
|
|
3859
|
+
let g = Math.floor(E * this.visibleDistance);
|
|
3850
3860
|
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));
|
|
3851
3861
|
}
|
|
3852
3862
|
}
|
|
@@ -3868,12 +3878,20 @@ class St {
|
|
|
3868
3878
|
}), this.ctx.scrollerFocus = this.isFocus;
|
|
3869
3879
|
}
|
|
3870
3880
|
}
|
|
3871
|
-
class
|
|
3881
|
+
class Se {
|
|
3882
|
+
// 垂直滚动定时器
|
|
3872
3883
|
constructor(t) {
|
|
3873
3884
|
n(this, "ctx");
|
|
3874
3885
|
n(this, "verticalScrollbar");
|
|
3875
3886
|
n(this, "horizontalScrollbar");
|
|
3876
|
-
|
|
3887
|
+
n(this, "mousedownHeader", !1);
|
|
3888
|
+
// 是否点击了表头,点击头部处理滚动条调整位置
|
|
3889
|
+
n(this, "adjustPositionX", "");
|
|
3890
|
+
n(this, "adjustPositionY", "");
|
|
3891
|
+
n(this, "timerX", 0);
|
|
3892
|
+
// 水平滚动定时器
|
|
3893
|
+
n(this, "timerY", 0);
|
|
3894
|
+
this.ctx = t, this.verticalScrollbar = new vt(t, "vertical"), this.horizontalScrollbar = new vt(t, "horizontal"), this.ctx.on("wheel", (e) => this.onWheel(e)), this.ctx.on("mousedown", (e) => this.onMouseDown(e)), this.ctx.on("mousemove", (e) => this.onMouseMove(e)), this.ctx.on("mouseup", () => this.onMouseUp()), this.ctx.on("touchmove", (e) => this.onTouchmove(e)), this.ctx.on("touchstart", (e) => {
|
|
3877
3895
|
this.onTouchstart(e);
|
|
3878
3896
|
}), this.ctx.on("setScroll", (e, i) => {
|
|
3879
3897
|
this.setScroll(e, i);
|
|
@@ -3881,6 +3899,12 @@ class Ie {
|
|
|
3881
3899
|
this.setScrollX(e);
|
|
3882
3900
|
}), this.ctx.on("setScrollY", (e) => {
|
|
3883
3901
|
this.setScrollY(e);
|
|
3902
|
+
}), this.ctx.on("cellHeaderMousedown", () => {
|
|
3903
|
+
this.mousedownHeader = !0;
|
|
3904
|
+
}), this.ctx.on("startAdjustPosition", (e) => {
|
|
3905
|
+
this.startAdjustPosition(e);
|
|
3906
|
+
}), this.ctx.on("stopAdjustPosition", () => {
|
|
3907
|
+
this.stopAdjustPosition();
|
|
3884
3908
|
});
|
|
3885
3909
|
}
|
|
3886
3910
|
onWheel(t) {
|
|
@@ -3899,7 +3923,7 @@ class Ie {
|
|
|
3899
3923
|
this.verticalScrollbar.onMouseMove(t), this.horizontalScrollbar.onMouseMove(t), this.draw();
|
|
3900
3924
|
}
|
|
3901
3925
|
onMouseUp() {
|
|
3902
|
-
this.verticalScrollbar.onMouseUp(), this.horizontalScrollbar.onMouseUp(), this.ctx.scrollerMove = !1;
|
|
3926
|
+
this.mousedownHeader = !1, this.verticalScrollbar.onMouseUp(), this.horizontalScrollbar.onMouseUp(), this.ctx.scrollerMove = !1;
|
|
3903
3927
|
}
|
|
3904
3928
|
draw() {
|
|
3905
3929
|
this.verticalScrollbar.draw(), this.horizontalScrollbar.draw();
|
|
@@ -3934,8 +3958,37 @@ class Ie {
|
|
|
3934
3958
|
const { top: o } = i.getPositionForRowIndex(s);
|
|
3935
3959
|
this.setScrollY(o - e.visibleHeight / 2);
|
|
3936
3960
|
}
|
|
3961
|
+
/**
|
|
3962
|
+
* 调整滚动条位置,让到达边界时自动滚动
|
|
3963
|
+
*/
|
|
3964
|
+
startAdjustPosition(t) {
|
|
3965
|
+
var r, a;
|
|
3966
|
+
const { offsetX: e, offsetY: i } = this.ctx.getOffset(t);
|
|
3967
|
+
let s = "", o = "";
|
|
3968
|
+
if (((r = this.ctx.focusCell) == null ? void 0 : r.fixed) !== "left" && e < this.ctx.fixedLeftWidth ? s = "left" : ((a = this.ctx.focusCell) == null ? void 0 : a.fixed) !== "right" && e > this.ctx.body.visibleWidth - this.ctx.fixedRightWidth ? s = "right" : (s = "", this.stopAdjustPosition(!0, !1)), !this.mousedownHeader && i < this.ctx.header.visibleHeight ? o = "top" : i > this.ctx.header.visibleHeight + this.ctx.body.visibleHeight ? o = "bottom" : (o = "", this.stopAdjustPosition(!1, !0)), s && this.adjustPositionX !== s) {
|
|
3969
|
+
this.adjustPositionX = s;
|
|
3970
|
+
let h = 10 * (s === "left" ? -1 : 1);
|
|
3971
|
+
this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
|
|
3972
|
+
h *= 1.5;
|
|
3973
|
+
const { scrollX: d } = this.ctx, f = d + h;
|
|
3974
|
+
(f < 0 || f > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(f);
|
|
3975
|
+
}, 100);
|
|
3976
|
+
}
|
|
3977
|
+
if (o && this.adjustPositionY !== o) {
|
|
3978
|
+
this.adjustPositionY = o;
|
|
3979
|
+
let h = 10 * (o === "top" ? -1 : 1);
|
|
3980
|
+
this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
|
|
3981
|
+
h *= 1.5;
|
|
3982
|
+
const { scrollY: d } = this.ctx, f = d + h;
|
|
3983
|
+
(f < 0 || f > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(f);
|
|
3984
|
+
}, 100);
|
|
3985
|
+
}
|
|
3986
|
+
}
|
|
3987
|
+
stopAdjustPosition(t = !0, e = !0) {
|
|
3988
|
+
t && (this.adjustPositionX = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0)), e && (this.adjustPositionY = "", this.timerY && (clearInterval(this.timerY), this.timerY = 0));
|
|
3989
|
+
}
|
|
3937
3990
|
}
|
|
3938
|
-
class
|
|
3991
|
+
class _e {
|
|
3939
3992
|
constructor(t) {
|
|
3940
3993
|
n(this, "ctx");
|
|
3941
3994
|
// 上下文
|
|
@@ -3984,60 +4037,57 @@ class ve {
|
|
|
3984
4037
|
config: { HEADER_HEIGHT: t, SCROLLER_TRACK_SIZE: e }
|
|
3985
4038
|
} = this.ctx, i = this.ctx.database.getColumns();
|
|
3986
4039
|
this.columns = i, this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [];
|
|
3987
|
-
const s =
|
|
4040
|
+
const s = Nt(i), o = it(i);
|
|
3988
4041
|
this.height = t * s, this.width = o.reduce((f, u) => {
|
|
3989
|
-
const x = u.width || 100, { maxWidth: w, minWidth:
|
|
3990
|
-
return w && x > w ? f + w :
|
|
4042
|
+
const x = u.width || 100, { maxWidth: w, minWidth: E } = u;
|
|
4043
|
+
return w && x > w ? f + w : E && x < E ? f + E : f + x;
|
|
3991
4044
|
}, 0), this.visibleHeight = this.height;
|
|
3992
|
-
const r =
|
|
4045
|
+
const r = ae(kt(i, s));
|
|
3993
4046
|
this.columnIndex = 0, this.resizeNum = 0, this.render(r, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
3994
4047
|
const a = this.ctx.containerElement.getBoundingClientRect();
|
|
3995
4048
|
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;
|
|
3996
|
-
const
|
|
3997
|
-
if (this.resizeNum &&
|
|
3998
|
-
const f = Math.floor(
|
|
4049
|
+
const l = this.visibleWidth - this.width;
|
|
4050
|
+
if (this.resizeNum && l > 0) {
|
|
4051
|
+
const f = Math.floor(l / this.resizeNum * 100) / 100;
|
|
3999
4052
|
this.resizeAllColumn(f);
|
|
4000
4053
|
}
|
|
4001
|
-
const
|
|
4002
|
-
this.ctx.fixedLeftWidth =
|
|
4054
|
+
const h = this.fixedLeftCellHeaders.filter((f) => !f.hasChildren);
|
|
4055
|
+
this.ctx.fixedLeftWidth = h.reduce((f, u) => f + u.width, 0);
|
|
4003
4056
|
const d = this.fixedRightCellHeaders.filter((f) => !f.hasChildren);
|
|
4004
4057
|
this.ctx.fixedRightWidth = d.reduce((f, u) => f + u.width, e), this.ctx.maxColIndex = this.leafCellHeaders.length - 1, this.ctx.header.x = this.x, this.ctx.header.y = this.y, this.ctx.header.width = this.width, this.ctx.header.height = this.height, this.ctx.header.visibleWidth = this.visibleWidth, this.ctx.header.visibleHeight = this.visibleHeight;
|
|
4005
4058
|
}
|
|
4006
4059
|
// 调整表头的宽度
|
|
4007
4060
|
initResizeColumn() {
|
|
4008
|
-
|
|
4009
|
-
config
|
|
4010
|
-
} = this.ctx;
|
|
4011
|
-
t && (this.ctx.on("mousedown", (e) => {
|
|
4012
|
-
this.ctx.isTarget(e) && (this.clientX = e.clientX, this.resizeTarget ? (this.isResizing = !0, this.ctx.columnResizing = !0) : this.isResizing = !1, this.isMouseDown = !0);
|
|
4061
|
+
this.ctx.on("mousedown", (t) => {
|
|
4062
|
+
this.ctx.config.ENABLE_RESIZE_COLUMN && this.ctx.isTarget(t) && (this.clientX = t.clientX, this.resizeTarget ? (this.isResizing = !0, this.ctx.columnResizing = !0) : this.isResizing = !1, this.isMouseDown = !0);
|
|
4013
4063
|
}), this.ctx.on("mouseup", () => {
|
|
4014
|
-
this.isMouseDown = !1, this.resizeDiff !== 0 && this.resizeTarget && this.resizeColumn(this.resizeTarget, this.resizeDiff), this.resizeTarget = null, this.isResizing = !1, this.isMouseDown = !1, this.ctx.columnResizing = !1, this.clientX = 0, this.resizeDiff = 0;
|
|
4015
|
-
}), this.ctx.on("mousemove", (
|
|
4016
|
-
if (this.ctx.editing) return;
|
|
4064
|
+
this.ctx.config.ENABLE_RESIZE_COLUMN && (this.isMouseDown = !1, this.resizeDiff !== 0 && this.resizeTarget && this.resizeColumn(this.resizeTarget, this.resizeDiff), this.resizeTarget = null, this.isResizing = !1, this.isMouseDown = !1, this.ctx.columnResizing = !1, this.clientX = 0, this.resizeDiff = 0);
|
|
4065
|
+
}), this.ctx.on("mousemove", (t) => {
|
|
4066
|
+
if (!this.ctx.config.ENABLE_RESIZE_COLUMN || this.ctx.editing) return;
|
|
4017
4067
|
const {
|
|
4018
|
-
stageWidth:
|
|
4019
|
-
config: { RESIZE_COLUMN_MIN_WIDTH:
|
|
4068
|
+
stageWidth: e,
|
|
4069
|
+
config: { RESIZE_COLUMN_MIN_WIDTH: i }
|
|
4020
4070
|
} = this.ctx;
|
|
4021
4071
|
if (this.isResizing && this.resizeTarget) {
|
|
4022
|
-
const
|
|
4023
|
-
let
|
|
4024
|
-
|
|
4072
|
+
const s = this.resizeTarget.width, o = this.resizeTarget.minWidth, r = this.resizeTarget.maxWidth;
|
|
4073
|
+
let a = t.clientX - this.clientX;
|
|
4074
|
+
a + s < i && (a = -(s - i)), o && a + s < o && (a = -(s - o)), r && a + s > r && (a = r - s), this.resizeDiff = a, this.ctx.emit("draw");
|
|
4025
4075
|
} else {
|
|
4026
4076
|
if (this.resizeTarget = null, this.isMouseDown)
|
|
4027
4077
|
return;
|
|
4028
|
-
if (
|
|
4078
|
+
if (t.offsetX < 0 || t.offsetX > this.visibleWidth) {
|
|
4029
4079
|
this.ctx.stageElement.style.cursor === "col-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
4030
4080
|
return;
|
|
4031
4081
|
}
|
|
4032
4082
|
this.ctx.stageElement.style.cursor === "col-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
4033
|
-
const
|
|
4034
|
-
for (const
|
|
4035
|
-
const { offsetX:
|
|
4036
|
-
l >
|
|
4037
|
-
|
|
4083
|
+
const s = [...this.renderFixedCellHeaders, ...this.renderCenterCellHeaders];
|
|
4084
|
+
for (const o of s) {
|
|
4085
|
+
const { offsetX: r, offsetY: a } = this.ctx.getOffset(t), l = r, h = o.getDrawX();
|
|
4086
|
+
l > h + o.width - 5 && l < h + o.width + 4 && l < e - 4 && // 视窗中最后一列不允许调整宽
|
|
4087
|
+
o.colspan <= 1 && this.ctx.isTarget(t) && a <= this.height && (this.ctx.stageElement.style.cursor = "col-resize", this.resizeTarget = o);
|
|
4038
4088
|
}
|
|
4039
4089
|
}
|
|
4040
|
-
})
|
|
4090
|
+
});
|
|
4041
4091
|
}
|
|
4042
4092
|
resizeColumn(t, e) {
|
|
4043
4093
|
const i = (o) => {
|
|
@@ -4088,10 +4138,10 @@ class ve {
|
|
|
4088
4138
|
let s = e;
|
|
4089
4139
|
const { HEADER_HEIGHT: o = 0 } = this.ctx.config;
|
|
4090
4140
|
for (let r = 0; r < i; r++) {
|
|
4091
|
-
const a = t[r],
|
|
4141
|
+
const a = t[r], l = o * (a.rowspan || 0), h = o * (a.level || 0);
|
|
4092
4142
|
let { minWidth: d, maxWidth: f } = a, u = a.width || 100;
|
|
4093
|
-
d && u < d && (u = d), f && u > f && (u = f), a.children && (u = it(a.children).reduce((
|
|
4094
|
-
const x = new ct(this.ctx, this.columnIndex, s,
|
|
4143
|
+
d && u < d && (u = d), f && u > f && (u = f), a.children && (u = it(a.children).reduce((E, g) => E + ((g == null ? void 0 : g.width) || 100), 0));
|
|
4144
|
+
const x = new ct(this.ctx, this.columnIndex, s, h, u, l, a);
|
|
4095
4145
|
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;
|
|
4096
4146
|
}
|
|
4097
4147
|
}
|
|
@@ -4123,8 +4173,8 @@ class ve {
|
|
|
4123
4173
|
colorStart: "rgba(0,0,0,0.1)",
|
|
4124
4174
|
colorEnd: "rgba(0,0,0,0)"
|
|
4125
4175
|
}), i < Math.floor(s.width - o - 1) && e !== a) {
|
|
4126
|
-
const
|
|
4127
|
-
this.ctx.paint.drawShadow(
|
|
4176
|
+
const l = s.width - (this.x + this.width) + o - e;
|
|
4177
|
+
this.ctx.paint.drawShadow(l, this.y, e, this.height, {
|
|
4128
4178
|
fillColor: r,
|
|
4129
4179
|
side: "left",
|
|
4130
4180
|
shadowWidth: 4,
|
|
@@ -4165,8 +4215,8 @@ class ve {
|
|
|
4165
4215
|
}), this.drawTipLine(), this.drawBottomLine();
|
|
4166
4216
|
}
|
|
4167
4217
|
}
|
|
4168
|
-
class
|
|
4169
|
-
constructor(t, e, i = 0, s = 0, o = 0, r = 0, a,
|
|
4218
|
+
class Kt {
|
|
4219
|
+
constructor(t, e, i = 0, s = 0, o = 0, r = 0, a, l = "body") {
|
|
4170
4220
|
n(this, "ctx");
|
|
4171
4221
|
n(this, "x", 0);
|
|
4172
4222
|
n(this, "y", 0);
|
|
@@ -4181,7 +4231,7 @@ class Bt {
|
|
|
4181
4231
|
n(this, "rowType", "body");
|
|
4182
4232
|
n(this, "data");
|
|
4183
4233
|
n(this, "calculatedHeight", -1);
|
|
4184
|
-
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 =
|
|
4234
|
+
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();
|
|
4185
4235
|
}
|
|
4186
4236
|
update() {
|
|
4187
4237
|
const { header: t } = this.ctx, e = [], i = [], s = [], o = [];
|
|
@@ -4226,7 +4276,7 @@ class Bt {
|
|
|
4226
4276
|
});
|
|
4227
4277
|
}
|
|
4228
4278
|
}
|
|
4229
|
-
class
|
|
4279
|
+
class ve {
|
|
4230
4280
|
constructor(t) {
|
|
4231
4281
|
n(this, "resizeTarget", null);
|
|
4232
4282
|
//调整行大小的目标
|
|
@@ -4263,8 +4313,8 @@ class Se {
|
|
|
4263
4313
|
FOOTER_FIXED: o,
|
|
4264
4314
|
SCROLLER_TRACK_SIZE: r = 0,
|
|
4265
4315
|
HEIGHT: a,
|
|
4266
|
-
EMPTY_BODY_HEIGHT:
|
|
4267
|
-
MAX_HEIGHT:
|
|
4316
|
+
EMPTY_BODY_HEIGHT: l = 0,
|
|
4317
|
+
MAX_HEIGHT: h = 0,
|
|
4268
4318
|
ENABLE_OFFSET_HEIGHT: d = 0,
|
|
4269
4319
|
OFFSET_HEIGHT: f = 0,
|
|
4270
4320
|
FOOTER_POSITION: u
|
|
@@ -4275,81 +4325,78 @@ class Se {
|
|
|
4275
4325
|
this.x = 0, u === "top" && o ? this.y = e.height + i.height : this.y = e.height;
|
|
4276
4326
|
const { data: x, sumHeight: w } = s.getData();
|
|
4277
4327
|
this.height = w, this.data = x, this.width = e.width, this.visibleWidth = this.ctx.stageWidth - r;
|
|
4278
|
-
const
|
|
4279
|
-
!this.data.length && !a ? this.height =
|
|
4328
|
+
const E = this.ctx.footer.height;
|
|
4329
|
+
!this.data.length && !a ? this.height = l : !this.data.length && a && (this.height = a - e.height - E - r);
|
|
4280
4330
|
let g = this.height + e.height + r;
|
|
4281
|
-
g +=
|
|
4282
|
-
let
|
|
4283
|
-
const y = window.innerHeight, { top:
|
|
4284
|
-
if (y >
|
|
4285
|
-
const
|
|
4286
|
-
|
|
4287
|
-
} else this.data.length && a ?
|
|
4288
|
-
|
|
4289
|
-
let
|
|
4290
|
-
o ? this.visibleHeight =
|
|
4291
|
-
const C = window.devicePixelRatio || 1,
|
|
4292
|
-
t.width = Math.round(
|
|
4293
|
-
const
|
|
4331
|
+
g += E;
|
|
4332
|
+
let m = g;
|
|
4333
|
+
const y = window.innerHeight, { top: p } = this.containerRect || this.ctx.containerElement.getBoundingClientRect();
|
|
4334
|
+
if (y > p && d && !a) {
|
|
4335
|
+
const O = y - p - f;
|
|
4336
|
+
O > e.height + r ? m = O : g > h && (m = h);
|
|
4337
|
+
} else this.data.length && a ? m = a : this.data.length && h && g > h && (m = h);
|
|
4338
|
+
m > 0 && (this.ctx.stageHeight = Math.floor(m), this.ctx.stageElement.style.height = `${this.ctx.stageHeight}px`);
|
|
4339
|
+
let b = this.ctx.stageHeight - e.height - r;
|
|
4340
|
+
o ? this.visibleHeight = b - E : this.visibleHeight = b, this.data.length || (this.height = this.visibleHeight), this.ctx.body.x = this.x, this.ctx.body.y = this.y, this.ctx.body.width = this.width, this.ctx.body.height = this.height, this.ctx.body.visibleWidth = this.visibleWidth, this.ctx.body.visibleHeight = this.visibleHeight, this.ctx.body.data = x;
|
|
4341
|
+
const C = window.devicePixelRatio || 1, R = this.ctx.stageWidth * C, _ = this.ctx.stageHeight * C;
|
|
4342
|
+
t.width = Math.round(R), t.height = Math.round(_);
|
|
4343
|
+
const T = this.data.length ? "not-empty" : "empty";
|
|
4294
4344
|
this.ctx.emit("emptyChange", {
|
|
4295
|
-
isEmpty:
|
|
4296
|
-
type:
|
|
4345
|
+
isEmpty: T,
|
|
4346
|
+
type: T,
|
|
4297
4347
|
headerHeight: e.height,
|
|
4298
4348
|
bodyHeight: this.height,
|
|
4299
|
-
footerHeight:
|
|
4349
|
+
footerHeight: E,
|
|
4300
4350
|
width: this.width,
|
|
4301
|
-
height: this.data.length ? 0 :
|
|
4351
|
+
height: this.data.length ? 0 : l + E
|
|
4302
4352
|
});
|
|
4303
|
-
const
|
|
4304
|
-
this.ctx.canvasElement.setAttribute("style", `height:${
|
|
4353
|
+
const S = Math.round(t.width / C * 1e4) / 1e4, I = Math.round(t.height / C * 1e4) / 1e4;
|
|
4354
|
+
this.ctx.canvasElement.setAttribute("style", `height:${I}px;width:${S}px;`), this.ctx.paint.scale(C);
|
|
4305
4355
|
}
|
|
4306
4356
|
// 调整行的高度
|
|
4307
4357
|
initResizeRow() {
|
|
4308
|
-
|
|
4309
|
-
config
|
|
4310
|
-
} = this.ctx;
|
|
4311
|
-
t && (this.ctx.on("resize", () => {
|
|
4312
|
-
this.containerRect = this.ctx.containerElement.getBoundingClientRect();
|
|
4358
|
+
this.ctx.on("resize", () => {
|
|
4359
|
+
this.ctx.config.ENABLE_RESIZE_ROW && (this.containerRect = this.ctx.containerElement.getBoundingClientRect());
|
|
4313
4360
|
}), this.ctx.on("resizeObserver", () => {
|
|
4314
|
-
this.containerRect = this.ctx.containerElement.getBoundingClientRect();
|
|
4361
|
+
this.ctx.config.ENABLE_RESIZE_ROW && (this.containerRect = this.ctx.containerElement.getBoundingClientRect());
|
|
4315
4362
|
}), this.ctx.on("mouseup", () => {
|
|
4316
|
-
this.isMouseDown = !1, this.resizeDiff !== 0 && this.resizeTarget && this.resizeRow(this.resizeTarget, this.resizeDiff), this.resizeTarget = null, this.resizeDiff = 0, this.isResizing = !1, setTimeout(() => {
|
|
4363
|
+
this.ctx.config.ENABLE_RESIZE_ROW && (this.isMouseDown = !1, this.resizeDiff !== 0 && this.resizeTarget && this.resizeRow(this.resizeTarget, this.resizeDiff), this.resizeTarget = null, this.resizeDiff = 0, this.isResizing = !1, setTimeout(() => {
|
|
4317
4364
|
this.ctx.rowResizing = !1;
|
|
4318
|
-
}, 0), this.clientY = 0;
|
|
4319
|
-
}), this.ctx.on("mousedown", (
|
|
4320
|
-
this.ctx.isTarget(
|
|
4321
|
-
}), this.ctx.on("mousemove", (
|
|
4322
|
-
if (this.ctx.editing) return;
|
|
4323
|
-
const { offsetY:
|
|
4324
|
-
stageHeight:
|
|
4365
|
+
}, 0), this.clientY = 0);
|
|
4366
|
+
}), this.ctx.on("mousedown", (t) => {
|
|
4367
|
+
this.ctx.config.ENABLE_RESIZE_ROW && this.ctx.isTarget(t) && (this.clientY = t.clientY, this.resizeTarget ? (this.isResizing = !0, this.ctx.rowResizing = !0) : (this.isResizing = !1, this.ctx.rowResizing = !1), this.isMouseDown = !0);
|
|
4368
|
+
}), this.ctx.on("mousemove", (t) => {
|
|
4369
|
+
if (!this.ctx.config.ENABLE_RESIZE_ROW || this.ctx.editing) return;
|
|
4370
|
+
const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = e, o = i, r = t.clientY, {
|
|
4371
|
+
stageHeight: a,
|
|
4325
4372
|
scrollY: l,
|
|
4326
|
-
config: { RESIZE_ROW_MIN_HEIGHT:
|
|
4373
|
+
config: { RESIZE_ROW_MIN_HEIGHT: h = 0 }
|
|
4327
4374
|
} = this.ctx;
|
|
4328
4375
|
if (this.isResizing && this.resizeTarget) {
|
|
4329
|
-
const
|
|
4330
|
-
let
|
|
4331
|
-
const { calculatedHeight:
|
|
4332
|
-
|
|
4376
|
+
const d = this.resizeTarget.height;
|
|
4377
|
+
let f = r - this.clientY;
|
|
4378
|
+
const { calculatedHeight: u } = this.resizeTarget, x = u === -1 ? h : u;
|
|
4379
|
+
f + d < x && (f = -(d - x)), this.resizeDiff = f, this.ctx.emit("draw");
|
|
4333
4380
|
} else {
|
|
4334
4381
|
if (this.resizeTarget = null, this.isMouseDown)
|
|
4335
4382
|
return;
|
|
4336
|
-
if (
|
|
4383
|
+
if (o < 0 || o > this.ctx.body.visibleWidth || s < 0 || s > this.ctx.header.visibleHeight + this.ctx.body.visibleHeight) {
|
|
4337
4384
|
this.ctx.stageElement.style.cursor === "row-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
4338
4385
|
return;
|
|
4339
4386
|
}
|
|
4340
4387
|
if (this.ctx.stageElement.style.cursor === "crosshair")
|
|
4341
4388
|
return;
|
|
4342
4389
|
this.ctx.stageElement.style.cursor === "row-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
4343
|
-
for (let
|
|
4344
|
-
const
|
|
4345
|
-
if (
|
|
4346
|
-
for (let
|
|
4347
|
-
const
|
|
4348
|
-
|
|
4390
|
+
for (let d = 0; d < this.renderRows.length; d++) {
|
|
4391
|
+
const f = this.renderRows[d];
|
|
4392
|
+
if (s > f.y - l + f.height - 1.5 && s < f.y - l + f.height + 1.5 && s < a - 4)
|
|
4393
|
+
for (let x = 0; x < f.cells.length; x++) {
|
|
4394
|
+
const w = f.cells[x];
|
|
4395
|
+
o > w.drawX + 10 && o < w.drawX + w.width - 10 && w.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = f);
|
|
4349
4396
|
}
|
|
4350
4397
|
}
|
|
4351
4398
|
}
|
|
4352
|
-
})
|
|
4399
|
+
});
|
|
4353
4400
|
}
|
|
4354
4401
|
resizeRow(t, e) {
|
|
4355
4402
|
const { rowIndex: i, height: s, rowKey: o, data: r } = t;
|
|
@@ -4391,8 +4438,8 @@ class Se {
|
|
|
4391
4438
|
colorStart: "rgba(0,0,0,0.1)",
|
|
4392
4439
|
colorEnd: "rgba(0,0,0,0)"
|
|
4393
4440
|
}), i < Math.floor(s.width - o - 1) && e !== a) {
|
|
4394
|
-
const
|
|
4395
|
-
this.ctx.paint.drawShadow(
|
|
4441
|
+
const l = s.width - (this.x + this.width) + o - e;
|
|
4442
|
+
this.ctx.paint.drawShadow(l, this.y, e, this.height, {
|
|
4396
4443
|
fillColor: r,
|
|
4397
4444
|
side: "left",
|
|
4398
4445
|
shadowWidth: 4,
|
|
@@ -4420,15 +4467,15 @@ class Se {
|
|
|
4420
4467
|
config: { CELL_HEIGHT: s }
|
|
4421
4468
|
} = this.ctx, o = i, { data: r, positions: a } = e.getData();
|
|
4422
4469
|
this.ctx.maxRowIndex = r.length - 1;
|
|
4423
|
-
let
|
|
4424
|
-
if (
|
|
4470
|
+
let l = this.binarySearch(a, o), h = this.binarySearch(a, o + this.visibleHeight);
|
|
4471
|
+
if (h === -1 && (h = this.ctx.maxRowIndex), l === -1 && h === this.ctx.maxRowIndex) {
|
|
4425
4472
|
const f = Math.floor(this.visibleHeight / s);
|
|
4426
|
-
|
|
4473
|
+
l = this.ctx.maxRowIndex - f;
|
|
4427
4474
|
}
|
|
4428
|
-
this.headIndex = Math.max(0,
|
|
4475
|
+
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;
|
|
4429
4476
|
const d = [];
|
|
4430
4477
|
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
4431
|
-
const u = this.headIndex + f, x = this.visibleRows[f], { height: w, top:
|
|
4478
|
+
const u = this.headIndex + f, x = this.visibleRows[f], { height: w, top: E } = this.ctx.database.getPositionForRowIndex(u), g = new Kt(this.ctx, u, 0, E + this.y, t.width, w, x);
|
|
4432
4479
|
d.push(g);
|
|
4433
4480
|
}
|
|
4434
4481
|
this.renderRows = d, this.ctx.body.renderRows = d;
|
|
@@ -4458,7 +4505,7 @@ class Se {
|
|
|
4458
4505
|
}), this.drawTipLine();
|
|
4459
4506
|
}
|
|
4460
4507
|
}
|
|
4461
|
-
class
|
|
4508
|
+
class Te {
|
|
4462
4509
|
constructor(t) {
|
|
4463
4510
|
n(this, "ctx");
|
|
4464
4511
|
n(this, "renderRows", []);
|
|
@@ -4489,16 +4536,16 @@ class _e {
|
|
|
4489
4536
|
stageWidth: o,
|
|
4490
4537
|
config: { HEADER_BG_COLOR: r, SCROLLER_TRACK_SIZE: a }
|
|
4491
4538
|
} = this.ctx;
|
|
4492
|
-
let
|
|
4493
|
-
if (this.ctx.config.FOOTER_FIXED || (
|
|
4539
|
+
let l = this.y;
|
|
4540
|
+
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, {
|
|
4494
4541
|
fillColor: r,
|
|
4495
4542
|
side: "right",
|
|
4496
4543
|
shadowWidth: 4,
|
|
4497
4544
|
colorStart: "rgba(0,0,0,0.1)",
|
|
4498
4545
|
colorEnd: "rgba(0,0,0,0)"
|
|
4499
4546
|
}), i < Math.floor(s.width - o - 1) && e !== a) {
|
|
4500
|
-
const
|
|
4501
|
-
this.ctx.paint.drawShadow(
|
|
4547
|
+
const h = s.width - (this.x + this.width) + o - e;
|
|
4548
|
+
this.ctx.paint.drawShadow(h, l, e, this.height, {
|
|
4502
4549
|
fillColor: r,
|
|
4503
4550
|
side: "left",
|
|
4504
4551
|
shadowWidth: 4,
|
|
@@ -4513,7 +4560,7 @@ class _e {
|
|
|
4513
4560
|
let e = this.y;
|
|
4514
4561
|
const i = [];
|
|
4515
4562
|
this.data.forEach((s, o) => {
|
|
4516
|
-
const r = new
|
|
4563
|
+
const r = new Kt(this.ctx, o, 0, e, this.width, t, s, "footer");
|
|
4517
4564
|
e += t, i.push(r);
|
|
4518
4565
|
}), this.renderRows = i, this.ctx.footer.renderRows = this.renderRows;
|
|
4519
4566
|
}
|
|
@@ -4539,18 +4586,11 @@ class _e {
|
|
|
4539
4586
|
}), this.drawTopLine();
|
|
4540
4587
|
}
|
|
4541
4588
|
}
|
|
4542
|
-
class
|
|
4543
|
-
// 垂直滚动定时器
|
|
4589
|
+
class Oe {
|
|
4544
4590
|
constructor(t) {
|
|
4545
4591
|
n(this, "isCut", !1);
|
|
4546
4592
|
n(this, "isMultipleRow", !1);
|
|
4547
|
-
n(this, "mousedownHeader", !1);
|
|
4548
4593
|
n(this, "ctx");
|
|
4549
|
-
n(this, "adjustPositionX", "");
|
|
4550
|
-
n(this, "adjustPositionY", "");
|
|
4551
|
-
n(this, "timerX", 0);
|
|
4552
|
-
// 水平滚动定时器
|
|
4553
|
-
n(this, "timerY", 0);
|
|
4554
4594
|
this.ctx = t, this.init();
|
|
4555
4595
|
}
|
|
4556
4596
|
init() {
|
|
@@ -4559,8 +4599,7 @@ class Te {
|
|
|
4559
4599
|
}), this.ctx.on(
|
|
4560
4600
|
"mousemove",
|
|
4561
4601
|
Z((t) => {
|
|
4562
|
-
|
|
4563
|
-
(this.ctx.selectorMove || this.ctx.autofillMove) && (!s && !this.mousedownHeader ? this.startAdjustPosition(t) : this.stopAdjustPosition());
|
|
4602
|
+
this.ctx.selectorMove && this.ctx.startAdjustPosition(t);
|
|
4564
4603
|
}, 100)
|
|
4565
4604
|
), this.ctx.on("cellHoverChange", (t) => {
|
|
4566
4605
|
if (!this.ctx.autofillMove) {
|
|
@@ -4579,7 +4618,7 @@ class Te {
|
|
|
4579
4618
|
}
|
|
4580
4619
|
window.getComputedStyle(e.target).userSelect !== "text" && e.preventDefault(), this.isMultipleRow = !1, this.click(e.shiftKey), this.ctx.emit("selectorClick", t);
|
|
4581
4620
|
}), this.ctx.on("mouseup", () => {
|
|
4582
|
-
this.
|
|
4621
|
+
this.ctx.selectorMove = !1, this.ctx.stopAdjustPosition();
|
|
4583
4622
|
const t = setTimeout(() => {
|
|
4584
4623
|
this.ctx.adjustPositioning = !1, clearTimeout(t);
|
|
4585
4624
|
}, 0);
|
|
@@ -4588,7 +4627,7 @@ class Te {
|
|
|
4588
4627
|
}), this.ctx.on("cellHeaderMousedown", (t, e) => {
|
|
4589
4628
|
if (this.ctx.stageElement.style.cursor === "pointer" || this.ctx.isPointer)
|
|
4590
4629
|
return;
|
|
4591
|
-
window.getComputedStyle(e.target).userSelect !== "text" && e.preventDefault(), this.
|
|
4630
|
+
window.getComputedStyle(e.target).userSelect !== "text" && e.preventDefault(), this.selectCols(t);
|
|
4592
4631
|
}), this.ctx.on("keydown", (t) => {
|
|
4593
4632
|
if (!this.ctx.editing) {
|
|
4594
4633
|
if (t.ctrlKey && t.code === "KeyV" || t.metaKey && t.code === "KeyV") {
|
|
@@ -4637,8 +4676,6 @@ class Te {
|
|
|
4637
4676
|
this.isCut = !0, this.copy();
|
|
4638
4677
|
}), this.ctx.on("setSelectorCell", (t) => {
|
|
4639
4678
|
this.ctx.setFocusCell(t), this.click();
|
|
4640
|
-
}), this.ctx.on("mouseup", () => {
|
|
4641
|
-
this.ctx.selectorMove = !1, this.stopAdjustPosition();
|
|
4642
4679
|
});
|
|
4643
4680
|
}
|
|
4644
4681
|
setSelector(t, e) {
|
|
@@ -4656,66 +4693,72 @@ class Te {
|
|
|
4656
4693
|
this.ctx.mousedown && (this.ctx.selectorMove = !0), this.ctx.selector.enable = !0;
|
|
4657
4694
|
const {
|
|
4658
4695
|
SELECTOR_AREA_MIN_X: a,
|
|
4659
|
-
SELECTOR_AREA_MAX_X:
|
|
4660
|
-
SELECTOR_AREA_MIN_Y:
|
|
4696
|
+
SELECTOR_AREA_MAX_X: l,
|
|
4697
|
+
SELECTOR_AREA_MIN_Y: h,
|
|
4661
4698
|
SELECTOR_AREA_MAX_Y: d,
|
|
4662
4699
|
SELECTOR_AREA_MAX_X_OFFSET: f,
|
|
4663
4700
|
SELECTOR_AREA_MAX_Y_OFFSET: u
|
|
4664
|
-
} = this.ctx.config, x = a, w =
|
|
4665
|
-
let [
|
|
4666
|
-
if (
|
|
4701
|
+
} = this.ctx.config, x = a, w = l || this.ctx.maxColIndex - f, E = h, g = d || this.ctx.maxRowIndex - u;
|
|
4702
|
+
let [m, y] = o, [p, b] = r;
|
|
4703
|
+
if (m < x || y > w || p < E || b > g)
|
|
4667
4704
|
return;
|
|
4668
4705
|
if (this.ctx.stageElement.focus({ preventScroll: !0 }), this.ctx.config.ENABLE_MERGE_CELL_LINK) {
|
|
4669
|
-
const
|
|
4670
|
-
|
|
4706
|
+
const R = this.adjustMergeCells(o, r);
|
|
4707
|
+
p = R.yArr[0], b = R.yArr[1], m = R.xArr[0], y = R.xArr[1], this.ctx.onlyMergeCell = R.onlyMergeCell;
|
|
4671
4708
|
}
|
|
4672
|
-
|
|
4709
|
+
m === y && p === b ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, o = [Math.max(x, m), Math.min(w, y)], r = [Math.max(E, p), Math.min(g, b)];
|
|
4673
4710
|
const { BEFORE_SET_SELECTOR_METHOD: C } = this.ctx.config;
|
|
4674
4711
|
if (typeof C == "function") {
|
|
4675
|
-
const
|
|
4712
|
+
const _ = C({
|
|
4676
4713
|
focusCell: this.ctx.focusCell,
|
|
4677
4714
|
xArr: o,
|
|
4678
4715
|
yArr: r
|
|
4679
4716
|
});
|
|
4680
|
-
if (!
|
|
4717
|
+
if (!_)
|
|
4681
4718
|
return;
|
|
4682
|
-
o =
|
|
4719
|
+
o = _.xArr, r = _.yArr;
|
|
4683
4720
|
}
|
|
4684
|
-
this.ctx.selector.xArr = o, this.ctx.selector.yArr = r, this.ctx.emit("setSelector", this.ctx.selector), this.ctx.emit("drawView");
|
|
4721
|
+
this.ctx.selector.xArr = o, this.ctx.selector.yArr = r, b === this.ctx.maxRowIndex && p === 0 ? this.ctx.selectColsIng = !0 : this.ctx.selectColsIng = !1, y === this.ctx.maxColIndex && m === 0 ? this.ctx.selectRowsIng = !0 : this.ctx.selectRowsIng = !1, this.ctx.emit("setSelector", this.ctx.selector), this.ctx.emit("drawView");
|
|
4685
4722
|
}
|
|
4686
4723
|
}
|
|
4687
4724
|
adjustMergeCells(t, e) {
|
|
4688
4725
|
var w;
|
|
4689
4726
|
const [i, s] = e, [o, r] = t;
|
|
4690
|
-
|
|
4691
|
-
|
|
4727
|
+
if (s === this.ctx.maxRowIndex && i === 0 || r === this.ctx.maxColIndex && o === 0)
|
|
4728
|
+
return {
|
|
4729
|
+
xArr: t,
|
|
4730
|
+
yArr: e,
|
|
4731
|
+
onlyMergeCell: !1
|
|
4732
|
+
};
|
|
4733
|
+
let a = [], l = [];
|
|
4734
|
+
for (let E = 0; E <= e[1] - e[0]; E++)
|
|
4692
4735
|
for (let g = 0; g <= t[1] - t[0]; g++) {
|
|
4693
|
-
const
|
|
4694
|
-
|
|
4736
|
+
const m = E + e[0], y = g + t[0], p = this.ctx.database.getVirtualBodyCell(m, y);
|
|
4737
|
+
p && ((m === i || m === s) && a.push(p), (y === o || y === r) && l.push(p));
|
|
4695
4738
|
}
|
|
4696
|
-
const
|
|
4697
|
-
(
|
|
4698
|
-
const { yArr:
|
|
4699
|
-
return
|
|
4739
|
+
const h = a.reduce(
|
|
4740
|
+
(E, g) => {
|
|
4741
|
+
const { yArr: m } = g.getSpanInfo(), [y, p] = m;
|
|
4742
|
+
return E.minY = Math.min(E.minY, y), E.maxY = Math.max(E.maxY, p), E;
|
|
4700
4743
|
},
|
|
4701
4744
|
{
|
|
4702
4745
|
minY: i,
|
|
4703
4746
|
maxY: s
|
|
4704
4747
|
}
|
|
4705
|
-
), d =
|
|
4706
|
-
(
|
|
4707
|
-
const { xArr:
|
|
4708
|
-
return
|
|
4748
|
+
), d = l.reduce(
|
|
4749
|
+
(E, g) => {
|
|
4750
|
+
const { xArr: m } = g.getSpanInfo(), [y, p] = m;
|
|
4751
|
+
return E.minX = Math.min(E.minX, y), E.maxX = Math.max(E.maxX, p), E;
|
|
4709
4752
|
},
|
|
4710
4753
|
{
|
|
4711
4754
|
minX: o,
|
|
4712
4755
|
maxX: r
|
|
4713
4756
|
}
|
|
4714
|
-
), f = [d.minX, d.maxX], u = [
|
|
4757
|
+
), f = [d.minX, d.maxX], u = [h.minY, h.maxY];
|
|
4715
4758
|
let x = !1;
|
|
4716
|
-
if (d.minX !== d.maxX ||
|
|
4717
|
-
const
|
|
4718
|
-
x = (g && JSON.stringify(g.xArr) + JSON.stringify(g.yArr)) ===
|
|
4759
|
+
if (d.minX !== d.maxX || h.minY !== h.maxY) {
|
|
4760
|
+
const E = JSON.stringify(f) + JSON.stringify(u), g = (w = this.ctx.focusCell) == null ? void 0 : w.getSpanInfo();
|
|
4761
|
+
x = (g && JSON.stringify(g.xArr) + JSON.stringify(g.yArr)) === E;
|
|
4719
4762
|
}
|
|
4720
4763
|
return {
|
|
4721
4764
|
xArr: f,
|
|
@@ -4734,15 +4777,15 @@ class Te {
|
|
|
4734
4777
|
if (this.ctx.mousedown && this.ctx.focusCellHeader) {
|
|
4735
4778
|
const { colIndex: a } = this.ctx.focusCellHeader;
|
|
4736
4779
|
if (this.ctx.clearSelector(), t.colIndex >= a) {
|
|
4737
|
-
const
|
|
4738
|
-
this.setSelector(
|
|
4780
|
+
const l = [a, t.colIndex + t.colspan - 1], h = [o, r];
|
|
4781
|
+
this.setSelector(l, h);
|
|
4739
4782
|
} else {
|
|
4740
|
-
const
|
|
4741
|
-
this.setSelector(
|
|
4783
|
+
const l = [t.colIndex, a], h = [o, r];
|
|
4784
|
+
this.setSelector(l, h);
|
|
4742
4785
|
}
|
|
4743
4786
|
} else {
|
|
4744
|
-
const a = [t.colIndex, t.colIndex + t.colspan - 1],
|
|
4745
|
-
this.setSelector(a,
|
|
4787
|
+
const a = [t.colIndex, t.colIndex + t.colspan - 1], l = [o, r];
|
|
4788
|
+
this.setSelector(a, l);
|
|
4746
4789
|
}
|
|
4747
4790
|
}
|
|
4748
4791
|
selectAll() {
|
|
@@ -4756,8 +4799,8 @@ class Te {
|
|
|
4756
4799
|
SELECTOR_AREA_MIN_Y: o,
|
|
4757
4800
|
SELECTOR_AREA_MAX_Y: r,
|
|
4758
4801
|
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
4759
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
4760
|
-
} = this.ctx.config,
|
|
4802
|
+
SELECTOR_AREA_MAX_Y_OFFSET: l
|
|
4803
|
+
} = 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];
|
|
4761
4804
|
this.setSelector(x, w);
|
|
4762
4805
|
}
|
|
4763
4806
|
}
|
|
@@ -4767,17 +4810,17 @@ class Te {
|
|
|
4767
4810
|
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;
|
|
4768
4811
|
if (e) {
|
|
4769
4812
|
this.ctx.setFocusCell(t);
|
|
4770
|
-
const
|
|
4771
|
-
this.setSelector(
|
|
4813
|
+
const l = [a, r], h = [t.rowIndex, t.rowIndex];
|
|
4814
|
+
this.setSelector(l, h);
|
|
4772
4815
|
}
|
|
4773
4816
|
if (this.ctx.focusCell && this.ctx.mousedown) {
|
|
4774
|
-
const { rowIndex:
|
|
4775
|
-
if (t.rowIndex >=
|
|
4776
|
-
const
|
|
4777
|
-
this.setSelector(
|
|
4817
|
+
const { rowIndex: l } = this.ctx.focusCell;
|
|
4818
|
+
if (t.rowIndex >= l) {
|
|
4819
|
+
const h = [a, r], d = [l, t.rowIndex];
|
|
4820
|
+
this.setSelector(h, d);
|
|
4778
4821
|
} else {
|
|
4779
|
-
const
|
|
4780
|
-
this.setSelector(
|
|
4822
|
+
const h = [a, r], d = [t.rowIndex, l];
|
|
4823
|
+
this.setSelector(h, d);
|
|
4781
4824
|
}
|
|
4782
4825
|
}
|
|
4783
4826
|
}
|
|
@@ -4786,7 +4829,7 @@ class Te {
|
|
|
4786
4829
|
return;
|
|
4787
4830
|
const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
|
|
4788
4831
|
if (t && e && i) {
|
|
4789
|
-
const { rowIndex: s, colIndex: o } = e, r = Math.min(i.colIndex, o), a = Math.max(i.colIndex, o),
|
|
4832
|
+
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];
|
|
4790
4833
|
this.setSelector(d, f);
|
|
4791
4834
|
}
|
|
4792
4835
|
}
|
|
@@ -4796,7 +4839,7 @@ class Te {
|
|
|
4796
4839
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
4797
4840
|
if (this.ctx.config.ENABLE_SELECTOR_SINGLE)
|
|
4798
4841
|
return;
|
|
4799
|
-
const { colIndex: s, rowIndex: o } = i, { colIndex: r, rowIndex: a } = e,
|
|
4842
|
+
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];
|
|
4800
4843
|
this.setSelector(u, x);
|
|
4801
4844
|
} else {
|
|
4802
4845
|
this.ctx.emit("cellSelectedClick", e);
|
|
@@ -4849,7 +4892,7 @@ class Te {
|
|
|
4849
4892
|
return;
|
|
4850
4893
|
t = a.data;
|
|
4851
4894
|
}
|
|
4852
|
-
const o =
|
|
4895
|
+
const o = ce(t);
|
|
4853
4896
|
navigator.clipboard ? navigator.clipboard.writeText(o).then(() => {
|
|
4854
4897
|
this.ctx.selector.xArrCopy = this.ctx.selector.xArr.slice(), this.ctx.selector.yArrCopy = this.ctx.selector.yArr.slice(), this.ctx.emit("copyChange", {
|
|
4855
4898
|
xArr: this.ctx.selector.xArrCopy,
|
|
@@ -4861,9 +4904,9 @@ class Te {
|
|
|
4861
4904
|
clearSelectedData(t, e, i = !1, s = null) {
|
|
4862
4905
|
let o = [];
|
|
4863
4906
|
const r = /* @__PURE__ */ new Set();
|
|
4864
|
-
for (let
|
|
4865
|
-
for (let
|
|
4866
|
-
const d =
|
|
4907
|
+
for (let l = 0; l <= e[1] - e[0]; l++)
|
|
4908
|
+
for (let h = 0; h <= t[1] - t[0]; h++) {
|
|
4909
|
+
const d = l + e[0], f = h + t[0], u = this.ctx.database.getItemValueForRowIndexAndColIndex(d, f);
|
|
4867
4910
|
if (u) {
|
|
4868
4911
|
const { rowKey: x, key: w } = u;
|
|
4869
4912
|
this.ctx.database.getReadonly(x, w) || (r.add(x), o.push({
|
|
@@ -4881,8 +4924,8 @@ class Te {
|
|
|
4881
4924
|
return o;
|
|
4882
4925
|
this.ctx.database.batchSetItemValue(o, !0);
|
|
4883
4926
|
let a = [];
|
|
4884
|
-
return r.forEach((
|
|
4885
|
-
a.push(this.ctx.database.getRowDataItemForRowKey(
|
|
4927
|
+
return r.forEach((l) => {
|
|
4928
|
+
a.push(this.ctx.database.getRowDataItemForRowKey(l));
|
|
4886
4929
|
}), this.ctx.emit("clearSelectedDataChange", o, a), o;
|
|
4887
4930
|
}
|
|
4888
4931
|
paste() {
|
|
@@ -4895,39 +4938,39 @@ class Te {
|
|
|
4895
4938
|
const e = this.ctx.selector.yArr[0], i = this.ctx.selector.xArr[0], s = /* @__PURE__ */ new Set();
|
|
4896
4939
|
navigator.clipboard.readText().then(async (o) => {
|
|
4897
4940
|
let r = he(o);
|
|
4898
|
-
const a = [i, i + r[0].length - 1],
|
|
4941
|
+
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;
|
|
4899
4942
|
(x > 0 || w > 0) && this.ctx.emit("onPastedDataOverflow", {
|
|
4900
4943
|
maxY: d,
|
|
4901
4944
|
maxX: u,
|
|
4902
|
-
minY:
|
|
4945
|
+
minY: h,
|
|
4903
4946
|
minX: f,
|
|
4904
4947
|
overflowRowCount: x,
|
|
4905
4948
|
overflowColCount: w,
|
|
4906
4949
|
textArr: r
|
|
4907
4950
|
});
|
|
4908
|
-
const
|
|
4909
|
-
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a,
|
|
4910
|
-
const
|
|
4951
|
+
const E = r.length === 1 && r[0].length === 1;
|
|
4952
|
+
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a, l) && !E) {
|
|
4953
|
+
const p = {
|
|
4911
4954
|
code: "ERR_MERGED_CELLS_PASTE",
|
|
4912
4955
|
message: "Merged cells cannot span paste data"
|
|
4913
4956
|
};
|
|
4914
|
-
this.ctx.hasEvent("error") ? this.ctx.emit("error",
|
|
4957
|
+
this.ctx.hasEvent("error") ? this.ctx.emit("error", p) : alert(p.message);
|
|
4915
4958
|
return;
|
|
4916
4959
|
}
|
|
4917
4960
|
let g = [];
|
|
4918
|
-
for (let
|
|
4919
|
-
const
|
|
4920
|
-
for (let C = 0; C <=
|
|
4921
|
-
const
|
|
4922
|
-
|
|
4923
|
-
|
|
4961
|
+
for (let p = 0; p <= r.length - 1; p++) {
|
|
4962
|
+
const b = r[p].length;
|
|
4963
|
+
for (let C = 0; C <= b - 1; C++) {
|
|
4964
|
+
const R = p + e, _ = C + i, T = r[p][C], S = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
4965
|
+
R,
|
|
4966
|
+
_
|
|
4924
4967
|
);
|
|
4925
|
-
if (
|
|
4926
|
-
const { rowKey:
|
|
4927
|
-
this.ctx.database.getReadonly(
|
|
4928
|
-
rowKey:
|
|
4929
|
-
key:
|
|
4930
|
-
value:
|
|
4968
|
+
if (S) {
|
|
4969
|
+
const { rowKey: I, key: v } = S;
|
|
4970
|
+
this.ctx.database.getReadonly(I, v) || (s.add(I), g.push({
|
|
4971
|
+
rowKey: I,
|
|
4972
|
+
key: v,
|
|
4973
|
+
value: T,
|
|
4931
4974
|
row: {}
|
|
4932
4975
|
//内部有设置
|
|
4933
4976
|
}));
|
|
@@ -4935,34 +4978,34 @@ class Te {
|
|
|
4935
4978
|
}
|
|
4936
4979
|
}
|
|
4937
4980
|
if (this.isCut) {
|
|
4938
|
-
const
|
|
4981
|
+
const p = this.clearSelectedData(
|
|
4939
4982
|
this.ctx.selector.xArrCopy,
|
|
4940
4983
|
this.ctx.selector.yArrCopy,
|
|
4941
4984
|
!0
|
|
4942
4985
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
4943
|
-
),
|
|
4944
|
-
|
|
4945
|
-
|
|
4986
|
+
), b = g.map((C) => `${C.rowKey}-${C.key}`);
|
|
4987
|
+
p.forEach((C) => {
|
|
4988
|
+
b.includes(`${C.rowKey}-${C.key}`) || g.unshift(C);
|
|
4946
4989
|
}), this.isCut = !1;
|
|
4947
4990
|
}
|
|
4948
4991
|
if (!g.length)
|
|
4949
4992
|
return;
|
|
4950
|
-
const { BEFORE_PASTE_DATA_METHOD:
|
|
4951
|
-
if (typeof
|
|
4952
|
-
const
|
|
4993
|
+
const { BEFORE_PASTE_DATA_METHOD: m } = this.ctx.config;
|
|
4994
|
+
if (typeof m == "function") {
|
|
4995
|
+
const p = m, b = g.map((C) => ({
|
|
4953
4996
|
rowKey: C.rowKey,
|
|
4954
4997
|
key: C.key,
|
|
4955
4998
|
value: C.value,
|
|
4956
4999
|
oldValue: this.ctx.database.getItemValue(C.rowKey, C.key),
|
|
4957
5000
|
row: this.ctx.database.getRowDataItemForRowKey(C.rowKey)
|
|
4958
5001
|
}));
|
|
4959
|
-
if (g = await
|
|
5002
|
+
if (g = await p(b, a, l, r), g && !g.length)
|
|
4960
5003
|
return;
|
|
4961
5004
|
}
|
|
4962
5005
|
this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(g, !0);
|
|
4963
5006
|
let y = [];
|
|
4964
|
-
s.forEach((
|
|
4965
|
-
y.push(this.ctx.database.getRowDataItemForRowKey(
|
|
5007
|
+
s.forEach((p) => {
|
|
5008
|
+
y.push(this.ctx.database.getRowDataItemForRowKey(p));
|
|
4966
5009
|
}), this.ctx.emit("pasteChange", g, y), this.ctx.emit("draw");
|
|
4967
5010
|
}).catch((o) => {
|
|
4968
5011
|
console.error("Failed to get the clipboard content:", o);
|
|
@@ -4979,7 +5022,7 @@ class Te {
|
|
|
4979
5022
|
if (!e)
|
|
4980
5023
|
return;
|
|
4981
5024
|
let { colIndex: i = 0, rowIndex: s = 0 } = e;
|
|
4982
|
-
const o = 0, r = 0, a = this.ctx.maxColIndex,
|
|
5025
|
+
const o = 0, r = 0, a = this.ctx.maxColIndex, l = this.ctx.maxRowIndex;
|
|
4983
5026
|
switch (t) {
|
|
4984
5027
|
case "LEFT":
|
|
4985
5028
|
i > o && i--;
|
|
@@ -4991,14 +5034,11 @@ class Te {
|
|
|
4991
5034
|
i < a && i++;
|
|
4992
5035
|
break;
|
|
4993
5036
|
case "BOTTOM":
|
|
4994
|
-
s <
|
|
5037
|
+
s < l && s++;
|
|
4995
5038
|
break;
|
|
4996
5039
|
}
|
|
4997
|
-
const
|
|
4998
|
-
f && (f.operation || this.isInSettingRange(f.rowIndex, f.colIndex) && (this.ctx.setFocusCell(f), this.setSelector(
|
|
4999
|
-
}
|
|
5000
|
-
stopAdjustPosition() {
|
|
5001
|
-
this.adjustPositionX = "", this.adjustPositionY = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerY && (clearInterval(this.timerY), this.timerY = 0);
|
|
5040
|
+
const h = [i, i], d = [s, s], f = this.getCell(s, i);
|
|
5041
|
+
f && (f.operation || this.isInSettingRange(f.rowIndex, f.colIndex) && (this.ctx.setFocusCell(f), this.setSelector(h, d), this.adjustBoundaryPosition(), this.ctx.emit("moveFocus", f), this.ctx.emit("draw")));
|
|
5002
5042
|
}
|
|
5003
5043
|
// 判断是否在设置范围内
|
|
5004
5044
|
isInSettingRange(t, e) {
|
|
@@ -5008,34 +5048,9 @@ class Te {
|
|
|
5008
5048
|
SELECTOR_AREA_MIN_Y: o,
|
|
5009
5049
|
SELECTOR_AREA_MAX_Y: r,
|
|
5010
5050
|
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
5011
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
5012
|
-
} = this.ctx.config,
|
|
5013
|
-
return !(e <
|
|
5014
|
-
}
|
|
5015
|
-
/**
|
|
5016
|
-
* 调整滚动条位置,让到达边界时自动滚动
|
|
5017
|
-
*/
|
|
5018
|
-
startAdjustPosition(t) {
|
|
5019
|
-
const { offsetX: e, offsetY: i } = this.ctx.getOffset(t);
|
|
5020
|
-
let s = "", o = "";
|
|
5021
|
-
if (e < 0 ? s = "left" : e > this.ctx.body.visibleWidth && (s = "right"), i < this.ctx.header.visibleHeight ? o = "top" : i > this.ctx.header.visibleHeight + this.ctx.body.visibleHeight && (o = "bottom"), s && this.adjustPositionX !== s) {
|
|
5022
|
-
this.adjustPositionX = s;
|
|
5023
|
-
let a = 10 * (s === "left" ? -1 : 1);
|
|
5024
|
-
this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
|
|
5025
|
-
a *= 1.5;
|
|
5026
|
-
const { scrollX: h } = this.ctx, l = h + a;
|
|
5027
|
-
(l < 0 || l > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(l);
|
|
5028
|
-
}, 100);
|
|
5029
|
-
}
|
|
5030
|
-
if (o && this.adjustPositionY !== o) {
|
|
5031
|
-
this.adjustPositionY = o;
|
|
5032
|
-
let a = 10 * (o === "top" ? -1 : 1);
|
|
5033
|
-
this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
|
|
5034
|
-
a *= 1.5;
|
|
5035
|
-
const { scrollY: h } = this.ctx, l = h + a;
|
|
5036
|
-
(l < 0 || l > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(l);
|
|
5037
|
-
}, 100);
|
|
5038
|
-
}
|
|
5051
|
+
SELECTOR_AREA_MAX_Y_OFFSET: l
|
|
5052
|
+
} = this.ctx.config, h = i, d = s || this.ctx.maxColIndex - a, f = o, u = r || this.ctx.maxRowIndex - l;
|
|
5053
|
+
return !(e < h || e > d || t < f || t > u);
|
|
5039
5054
|
}
|
|
5040
5055
|
/**
|
|
5041
5056
|
* 调整滚动条位置,让焦点单元格始终出现在可视区域内
|
|
@@ -5049,28 +5064,27 @@ class Te {
|
|
|
5049
5064
|
fixedLeftWidth: o,
|
|
5050
5065
|
header: r,
|
|
5051
5066
|
footer: a,
|
|
5052
|
-
body:
|
|
5053
|
-
scrollX:
|
|
5067
|
+
body: l,
|
|
5068
|
+
scrollX: h,
|
|
5054
5069
|
scrollY: d,
|
|
5055
5070
|
config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED: u, FOOTER_POSITION: x, ENABLE_MERGE_CELL_LINK: w }
|
|
5056
5071
|
} = this.ctx;
|
|
5057
5072
|
if (!i)
|
|
5058
5073
|
return;
|
|
5059
5074
|
w && this.ctx.onlyMergeCell && i.updateSpanInfo();
|
|
5060
|
-
const { drawX:
|
|
5061
|
-
let
|
|
5062
|
-
|
|
5063
|
-
let
|
|
5064
|
-
u && (x === "top" ?
|
|
5065
|
-
const
|
|
5066
|
-
let
|
|
5067
|
-
C > 0 && !
|
|
5075
|
+
const { drawX: E, drawY: g, width: m, height: y, fixed: p } = i, b = o - E + 1, C = i.drawX + m - (e - s) + 1;
|
|
5076
|
+
let R = r.height - g, _ = y;
|
|
5077
|
+
_ > l.visibleHeight && (_ = l.visibleHeight);
|
|
5078
|
+
let T = 0;
|
|
5079
|
+
u && (x === "top" ? R = r.height + a.height - g : T = a.visibleHeight);
|
|
5080
|
+
const S = g + _ - (t - T - f);
|
|
5081
|
+
let I = h, v = d;
|
|
5082
|
+
C > 0 && !p ? I = Math.floor(h + C) : b > 0 && !p && (I = Math.floor(h - b)), R > 0 ? v = Math.floor(d - R) : S > 0 && (v = Math.floor(d + S)), (Math.abs(h - I) > 2 || Math.abs(d - v) > 2) && (this.ctx.adjustPositioning = !0, this.ctx.setScroll(I, v), this.ctx.emit("adjustBoundaryPosition", i));
|
|
5068
5083
|
}
|
|
5069
5084
|
destroy() {
|
|
5070
|
-
this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
|
|
5071
5085
|
}
|
|
5072
5086
|
}
|
|
5073
|
-
class
|
|
5087
|
+
class Le {
|
|
5074
5088
|
constructor(t) {
|
|
5075
5089
|
n(this, "ctx");
|
|
5076
5090
|
n(this, "maxColRowCell");
|
|
@@ -5080,15 +5094,15 @@ class Oe {
|
|
|
5080
5094
|
this.ctx.on("mousemove", (t) => {
|
|
5081
5095
|
if (this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default"), this.ctx.editing || !this.ctx.focusCell || !this.maxColRowCell)
|
|
5082
5096
|
return;
|
|
5083
|
-
const { offsetX: e, offsetY: i } = this.ctx.getOffset(t), { colIndex: s, rowIndex: o, drawX: r, drawY: a, width:
|
|
5084
|
-
e > u && i > x && e < u + d && i < x + d && (this.ctx.stageElement.style.cursor = "crosshair");
|
|
5097
|
+
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;
|
|
5098
|
+
e > u && i > x && e < u + d && i < x + d && (this.ctx.stageElement.style.cursor = "crosshair"), this.ctx.autofillMove && this.ctx.startAdjustPosition(t);
|
|
5085
5099
|
}), this.ctx.on("cellMouseenter", (t) => {
|
|
5086
5100
|
const { xArr: e, yArr: i } = this.ctx.selector, s = e[1], o = i[1], { colIndex: r, rowIndex: a } = t;
|
|
5087
5101
|
this.ctx.config.ENABLE_AUTOFILL && r === s && a === o && (this.maxColRowCell = t), this.mouseenter(t);
|
|
5088
5102
|
}), this.ctx.on("mousedown", () => {
|
|
5089
5103
|
this.ctx.stageElement.style.cursor === "crosshair" && this.setMousedown();
|
|
5090
5104
|
}), this.ctx.on("mouseup", () => {
|
|
5091
|
-
this.setMouseUp();
|
|
5105
|
+
this.setMouseUp(), this.ctx.stopAdjustPosition();
|
|
5092
5106
|
});
|
|
5093
5107
|
}
|
|
5094
5108
|
/**
|
|
@@ -5113,36 +5127,36 @@ class Oe {
|
|
|
5113
5127
|
return;
|
|
5114
5128
|
let r = t, a = e;
|
|
5115
5129
|
if (!o) {
|
|
5116
|
-
const [
|
|
5117
|
-
a = [
|
|
5130
|
+
const [l] = a;
|
|
5131
|
+
a = [l, l];
|
|
5118
5132
|
}
|
|
5119
5133
|
if (!s) {
|
|
5120
|
-
const [
|
|
5121
|
-
r = [
|
|
5134
|
+
const [l] = r;
|
|
5135
|
+
r = [l, l];
|
|
5122
5136
|
}
|
|
5123
5137
|
if (JSON.stringify(this.ctx.autofill.xArr) !== JSON.stringify(r) || JSON.stringify(this.ctx.autofill.yArr) !== JSON.stringify(a)) {
|
|
5124
5138
|
const {
|
|
5125
|
-
SELECTOR_AREA_MIN_X:
|
|
5126
|
-
SELECTOR_AREA_MAX_X:
|
|
5139
|
+
SELECTOR_AREA_MIN_X: l,
|
|
5140
|
+
SELECTOR_AREA_MAX_X: h,
|
|
5127
5141
|
SELECTOR_AREA_MIN_Y: d,
|
|
5128
5142
|
SELECTOR_AREA_MAX_Y: f,
|
|
5129
5143
|
SELECTOR_AREA_MAX_X_OFFSET: u,
|
|
5130
5144
|
SELECTOR_AREA_MAX_Y_OFFSET: x
|
|
5131
|
-
} = this.ctx.config, w =
|
|
5132
|
-
let [y,
|
|
5133
|
-
if (y < w ||
|
|
5145
|
+
} = this.ctx.config, w = l, E = h || this.ctx.maxColIndex - u, g = d, m = f || this.ctx.maxRowIndex - x;
|
|
5146
|
+
let [y, p] = r, [b, C] = a;
|
|
5147
|
+
if (y < w || b < g)
|
|
5134
5148
|
return;
|
|
5135
|
-
r = [Math.max(w, y), Math.min(
|
|
5136
|
-
const { BEFORE_SET_AUTOFILL_METHOD:
|
|
5137
|
-
if (typeof
|
|
5138
|
-
const
|
|
5149
|
+
r = [Math.max(w, y), Math.min(E, p)], a = [Math.max(g, b), Math.min(m, C)];
|
|
5150
|
+
const { BEFORE_SET_AUTOFILL_METHOD: R } = this.ctx.config;
|
|
5151
|
+
if (typeof R == "function") {
|
|
5152
|
+
const T = R({
|
|
5139
5153
|
focusCell: this.ctx.focusCell,
|
|
5140
5154
|
xArr: r,
|
|
5141
5155
|
yArr: a
|
|
5142
5156
|
});
|
|
5143
|
-
if (!
|
|
5157
|
+
if (!T)
|
|
5144
5158
|
return;
|
|
5145
|
-
r =
|
|
5159
|
+
r = T.xArr, a = T.yArr;
|
|
5146
5160
|
}
|
|
5147
5161
|
this.ctx.autofill.xArr = r, this.ctx.autofill.yArr = a, this.ctx.emit("setAutofill", this.ctx.autofill), this.ctx.emit("draw");
|
|
5148
5162
|
}
|
|
@@ -5154,11 +5168,11 @@ class Oe {
|
|
|
5154
5168
|
const t = /* @__PURE__ */ new Set(), e = this.ctx.getSelectedData(), i = /* @__PURE__ */ new Map();
|
|
5155
5169
|
for (let x = 0; x <= e.yArr[1] - e.yArr[0]; x++)
|
|
5156
5170
|
for (let w = 0; w <= e.xArr[1] - e.xArr[0]; w++) {
|
|
5157
|
-
const
|
|
5158
|
-
i.set(`${
|
|
5171
|
+
const E = x + e.yArr[0], g = w + e.xArr[0];
|
|
5172
|
+
i.set(`${E}-${g}`, !0);
|
|
5159
5173
|
}
|
|
5160
|
-
const { value: s } = e, o = s[0].length, r = s.length, a = this.ctx.autofill.xArr,
|
|
5161
|
-
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a,
|
|
5174
|
+
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;
|
|
5175
|
+
if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a, l) && !h) {
|
|
5162
5176
|
const x = {
|
|
5163
5177
|
code: "ERR_MERGED_CELLS_AUTOFILL",
|
|
5164
5178
|
message: "Merged cells cannot span autofill data"
|
|
@@ -5167,15 +5181,15 @@ class Oe {
|
|
|
5167
5181
|
return;
|
|
5168
5182
|
}
|
|
5169
5183
|
let d = [];
|
|
5170
|
-
for (let x = 0; x <=
|
|
5184
|
+
for (let x = 0; x <= l[1] - l[0]; x++)
|
|
5171
5185
|
for (let w = 0; w <= a[1] - a[0]; w++) {
|
|
5172
|
-
const
|
|
5173
|
-
if (y && !i.has(
|
|
5174
|
-
const { rowKey:
|
|
5175
|
-
this.ctx.database.getReadonly(
|
|
5176
|
-
rowKey:
|
|
5186
|
+
const E = w + a[0], g = x + l[0], m = s[x % r][w % o], y = this.ctx.database.getItemValueForRowIndexAndColIndex(g, E), p = `${g}-${E}`;
|
|
5187
|
+
if (y && !i.has(p)) {
|
|
5188
|
+
const { rowKey: b, key: C } = y;
|
|
5189
|
+
this.ctx.database.getReadonly(b, C) || (t.add(b), d.push({
|
|
5190
|
+
rowKey: b,
|
|
5177
5191
|
key: C,
|
|
5178
|
-
value:
|
|
5192
|
+
value: m,
|
|
5179
5193
|
row: {}
|
|
5180
5194
|
}));
|
|
5181
5195
|
}
|
|
@@ -5185,14 +5199,14 @@ class Oe {
|
|
|
5185
5199
|
this.ctx.selector.xArr = this.ctx.autofill.xArr, this.ctx.selector.yArr = this.ctx.autofill.yArr;
|
|
5186
5200
|
const { BEFORE_AUTOFILL_DATA_METHOD: f } = this.ctx.config;
|
|
5187
5201
|
if (typeof f == "function") {
|
|
5188
|
-
const x = f, w = d.map((
|
|
5189
|
-
rowKey:
|
|
5190
|
-
key:
|
|
5191
|
-
value:
|
|
5192
|
-
oldValue: this.ctx.database.getItemValue(
|
|
5193
|
-
row: this.ctx.database.getRowDataItemForRowKey(
|
|
5202
|
+
const x = f, w = d.map((E) => ({
|
|
5203
|
+
rowKey: E.rowKey,
|
|
5204
|
+
key: E.key,
|
|
5205
|
+
value: E.value,
|
|
5206
|
+
oldValue: this.ctx.database.getItemValue(E.rowKey, E.key),
|
|
5207
|
+
row: this.ctx.database.getRowDataItemForRowKey(E.rowKey)
|
|
5194
5208
|
}));
|
|
5195
|
-
if (d = await x(w, a,
|
|
5209
|
+
if (d = await x(w, a, l), d && !d.length)
|
|
5196
5210
|
return;
|
|
5197
5211
|
}
|
|
5198
5212
|
this.ctx.batchSetItemValueByEditor(d, !0);
|
|
@@ -5213,10 +5227,10 @@ class Oe {
|
|
|
5213
5227
|
destroy() {
|
|
5214
5228
|
}
|
|
5215
5229
|
}
|
|
5216
|
-
const
|
|
5230
|
+
const q = Math.min, $ = Math.max, st = Math.round, B = (c) => ({
|
|
5217
5231
|
x: c,
|
|
5218
5232
|
y: c
|
|
5219
|
-
}),
|
|
5233
|
+
}), Ae = {
|
|
5220
5234
|
left: "right",
|
|
5221
5235
|
right: "left",
|
|
5222
5236
|
bottom: "top",
|
|
@@ -5226,7 +5240,7 @@ const j = Math.min, $ = Math.max, st = Math.round, B = (c) => ({
|
|
|
5226
5240
|
end: "start"
|
|
5227
5241
|
};
|
|
5228
5242
|
function dt(c, t, e) {
|
|
5229
|
-
return $(c,
|
|
5243
|
+
return $(c, q(t, e));
|
|
5230
5244
|
}
|
|
5231
5245
|
function Q(c, t) {
|
|
5232
5246
|
return typeof c == "function" ? c(t) : c;
|
|
@@ -5237,54 +5251,54 @@ function z(c) {
|
|
|
5237
5251
|
function tt(c) {
|
|
5238
5252
|
return c.split("-")[1];
|
|
5239
5253
|
}
|
|
5240
|
-
function
|
|
5254
|
+
function Wt(c) {
|
|
5241
5255
|
return c === "x" ? "y" : "x";
|
|
5242
5256
|
}
|
|
5243
5257
|
function wt(c) {
|
|
5244
5258
|
return c === "y" ? "height" : "width";
|
|
5245
5259
|
}
|
|
5246
|
-
const
|
|
5260
|
+
const He = /* @__PURE__ */ new Set(["top", "bottom"]);
|
|
5247
5261
|
function V(c) {
|
|
5248
|
-
return
|
|
5262
|
+
return He.has(z(c)) ? "y" : "x";
|
|
5249
5263
|
}
|
|
5250
|
-
function
|
|
5251
|
-
return
|
|
5264
|
+
function Et(c) {
|
|
5265
|
+
return Wt(V(c));
|
|
5252
5266
|
}
|
|
5253
|
-
function
|
|
5267
|
+
function De(c, t, e) {
|
|
5254
5268
|
e === void 0 && (e = !1);
|
|
5255
|
-
const i = tt(c), s =
|
|
5269
|
+
const i = tt(c), s = Et(c), o = wt(s);
|
|
5256
5270
|
let r = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
|
|
5257
5271
|
return t.reference[o] > t.floating[o] && (r = ot(r)), [r, ot(r)];
|
|
5258
5272
|
}
|
|
5259
|
-
function
|
|
5273
|
+
function Ne(c) {
|
|
5260
5274
|
const t = ot(c);
|
|
5261
5275
|
return [ft(c), t, ft(t)];
|
|
5262
5276
|
}
|
|
5263
5277
|
function ft(c) {
|
|
5264
5278
|
return c.replace(/start|end/g, (t) => Me[t]);
|
|
5265
5279
|
}
|
|
5266
|
-
const
|
|
5267
|
-
function
|
|
5280
|
+
const Tt = ["left", "right"], Ot = ["right", "left"], ke = ["top", "bottom"], Xe = ["bottom", "top"];
|
|
5281
|
+
function Ye(c, t, e) {
|
|
5268
5282
|
switch (c) {
|
|
5269
5283
|
case "top":
|
|
5270
5284
|
case "bottom":
|
|
5271
|
-
return e ? t ?
|
|
5285
|
+
return e ? t ? Ot : Tt : t ? Tt : Ot;
|
|
5272
5286
|
case "left":
|
|
5273
5287
|
case "right":
|
|
5274
|
-
return t ?
|
|
5288
|
+
return t ? ke : Xe;
|
|
5275
5289
|
default:
|
|
5276
5290
|
return [];
|
|
5277
5291
|
}
|
|
5278
5292
|
}
|
|
5279
|
-
function
|
|
5293
|
+
function Be(c, t, e, i) {
|
|
5280
5294
|
const s = tt(c);
|
|
5281
|
-
let o =
|
|
5295
|
+
let o = Ye(z(c), e === "start", i);
|
|
5282
5296
|
return s && (o = o.map((r) => r + "-" + s), t && (o = o.concat(o.map(ft)))), o;
|
|
5283
5297
|
}
|
|
5284
5298
|
function ot(c) {
|
|
5285
|
-
return c.replace(/left|right|bottom|top/g, (t) =>
|
|
5299
|
+
return c.replace(/left|right|bottom|top/g, (t) => Ae[t]);
|
|
5286
5300
|
}
|
|
5287
|
-
function
|
|
5301
|
+
function Ke(c) {
|
|
5288
5302
|
return {
|
|
5289
5303
|
top: 0,
|
|
5290
5304
|
right: 0,
|
|
@@ -5293,8 +5307,8 @@ function Be(c) {
|
|
|
5293
5307
|
...c
|
|
5294
5308
|
};
|
|
5295
5309
|
}
|
|
5296
|
-
function
|
|
5297
|
-
return typeof c != "number" ?
|
|
5310
|
+
function Ft(c) {
|
|
5311
|
+
return typeof c != "number" ? Ke(c) : {
|
|
5298
5312
|
top: c,
|
|
5299
5313
|
right: c,
|
|
5300
5314
|
bottom: c,
|
|
@@ -5319,14 +5333,14 @@ function rt(c) {
|
|
|
5319
5333
|
y: e
|
|
5320
5334
|
};
|
|
5321
5335
|
}
|
|
5322
|
-
function
|
|
5336
|
+
function Lt(c, t, e) {
|
|
5323
5337
|
let {
|
|
5324
5338
|
reference: i,
|
|
5325
5339
|
floating: s
|
|
5326
5340
|
} = c;
|
|
5327
|
-
const o = V(t), r =
|
|
5341
|
+
const o = V(t), r = Et(t), a = wt(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;
|
|
5328
5342
|
let x;
|
|
5329
|
-
switch (
|
|
5343
|
+
switch (l) {
|
|
5330
5344
|
case "top":
|
|
5331
5345
|
x = {
|
|
5332
5346
|
x: d,
|
|
@@ -5359,66 +5373,66 @@ function Ot(c, t, e) {
|
|
|
5359
5373
|
}
|
|
5360
5374
|
switch (tt(t)) {
|
|
5361
5375
|
case "start":
|
|
5362
|
-
x[r] -= u * (e &&
|
|
5376
|
+
x[r] -= u * (e && h ? -1 : 1);
|
|
5363
5377
|
break;
|
|
5364
5378
|
case "end":
|
|
5365
|
-
x[r] += u * (e &&
|
|
5379
|
+
x[r] += u * (e && h ? -1 : 1);
|
|
5366
5380
|
break;
|
|
5367
5381
|
}
|
|
5368
5382
|
return x;
|
|
5369
5383
|
}
|
|
5370
|
-
const
|
|
5384
|
+
const We = async (c, t, e) => {
|
|
5371
5385
|
const {
|
|
5372
5386
|
placement: i = "bottom",
|
|
5373
5387
|
strategy: s = "absolute",
|
|
5374
5388
|
middleware: o = [],
|
|
5375
5389
|
platform: r
|
|
5376
|
-
} = e, a = o.filter(Boolean),
|
|
5377
|
-
let
|
|
5390
|
+
} = e, a = o.filter(Boolean), l = await (r.isRTL == null ? void 0 : r.isRTL(t));
|
|
5391
|
+
let h = await r.getElementRects({
|
|
5378
5392
|
reference: c,
|
|
5379
5393
|
floating: t,
|
|
5380
5394
|
strategy: s
|
|
5381
5395
|
}), {
|
|
5382
5396
|
x: d,
|
|
5383
5397
|
y: f
|
|
5384
|
-
} =
|
|
5385
|
-
for (let
|
|
5398
|
+
} = Lt(h, i, l), u = i, x = {}, w = 0;
|
|
5399
|
+
for (let E = 0; E < a.length; E++) {
|
|
5386
5400
|
const {
|
|
5387
5401
|
name: g,
|
|
5388
|
-
fn:
|
|
5389
|
-
} = a[
|
|
5402
|
+
fn: m
|
|
5403
|
+
} = a[E], {
|
|
5390
5404
|
x: y,
|
|
5391
|
-
y:
|
|
5392
|
-
data:
|
|
5405
|
+
y: p,
|
|
5406
|
+
data: b,
|
|
5393
5407
|
reset: C
|
|
5394
|
-
} = await
|
|
5408
|
+
} = await m({
|
|
5395
5409
|
x: d,
|
|
5396
5410
|
y: f,
|
|
5397
5411
|
initialPlacement: i,
|
|
5398
5412
|
placement: u,
|
|
5399
5413
|
strategy: s,
|
|
5400
5414
|
middlewareData: x,
|
|
5401
|
-
rects:
|
|
5415
|
+
rects: h,
|
|
5402
5416
|
platform: r,
|
|
5403
5417
|
elements: {
|
|
5404
5418
|
reference: c,
|
|
5405
5419
|
floating: t
|
|
5406
5420
|
}
|
|
5407
5421
|
});
|
|
5408
|
-
d = y ?? d, f =
|
|
5422
|
+
d = y ?? d, f = p ?? f, x = {
|
|
5409
5423
|
...x,
|
|
5410
5424
|
[g]: {
|
|
5411
5425
|
...x[g],
|
|
5412
|
-
...
|
|
5426
|
+
...b
|
|
5413
5427
|
}
|
|
5414
|
-
}, C && w <= 50 && (w++, typeof C == "object" && (C.placement && (u = C.placement), C.rects && (
|
|
5428
|
+
}, C && w <= 50 && (w++, typeof C == "object" && (C.placement && (u = C.placement), C.rects && (h = C.rects === !0 ? await r.getElementRects({
|
|
5415
5429
|
reference: c,
|
|
5416
5430
|
floating: t,
|
|
5417
5431
|
strategy: s
|
|
5418
5432
|
}) : C.rects), {
|
|
5419
5433
|
x: d,
|
|
5420
5434
|
y: f
|
|
5421
|
-
} =
|
|
5435
|
+
} = Lt(h, u, l)), E = -1);
|
|
5422
5436
|
}
|
|
5423
5437
|
return {
|
|
5424
5438
|
x: d,
|
|
@@ -5428,7 +5442,7 @@ const Ke = async (c, t, e) => {
|
|
|
5428
5442
|
middlewareData: x
|
|
5429
5443
|
};
|
|
5430
5444
|
};
|
|
5431
|
-
async function
|
|
5445
|
+
async function Vt(c, t) {
|
|
5432
5446
|
var e;
|
|
5433
5447
|
t === void 0 && (t = {});
|
|
5434
5448
|
const {
|
|
@@ -5437,24 +5451,24 @@ async function Ft(c, t) {
|
|
|
5437
5451
|
platform: o,
|
|
5438
5452
|
rects: r,
|
|
5439
5453
|
elements: a,
|
|
5440
|
-
strategy:
|
|
5454
|
+
strategy: l
|
|
5441
5455
|
} = c, {
|
|
5442
|
-
boundary:
|
|
5456
|
+
boundary: h = "clippingAncestors",
|
|
5443
5457
|
rootBoundary: d = "viewport",
|
|
5444
5458
|
elementContext: f = "floating",
|
|
5445
5459
|
altBoundary: u = !1,
|
|
5446
5460
|
padding: x = 0
|
|
5447
|
-
} = Q(t, c), w =
|
|
5461
|
+
} = Q(t, c), w = Ft(x), g = a[u ? f === "floating" ? "reference" : "floating" : f], m = rt(await o.getClippingRect({
|
|
5448
5462
|
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)),
|
|
5449
|
-
boundary:
|
|
5463
|
+
boundary: h,
|
|
5450
5464
|
rootBoundary: d,
|
|
5451
|
-
strategy:
|
|
5465
|
+
strategy: l
|
|
5452
5466
|
})), y = f === "floating" ? {
|
|
5453
5467
|
x: i,
|
|
5454
5468
|
y: s,
|
|
5455
5469
|
width: r.floating.width,
|
|
5456
5470
|
height: r.floating.height
|
|
5457
|
-
} : r.reference,
|
|
5471
|
+
} : r.reference, p = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(a.floating)), b = await (o.isElement == null ? void 0 : o.isElement(p)) ? await (o.getScale == null ? void 0 : o.getScale(p)) || {
|
|
5458
5472
|
x: 1,
|
|
5459
5473
|
y: 1
|
|
5460
5474
|
} : {
|
|
@@ -5463,17 +5477,17 @@ async function Ft(c, t) {
|
|
|
5463
5477
|
}, C = rt(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
5464
5478
|
elements: a,
|
|
5465
5479
|
rect: y,
|
|
5466
|
-
offsetParent:
|
|
5467
|
-
strategy:
|
|
5480
|
+
offsetParent: p,
|
|
5481
|
+
strategy: l
|
|
5468
5482
|
}) : y);
|
|
5469
5483
|
return {
|
|
5470
|
-
top: (
|
|
5471
|
-
bottom: (C.bottom -
|
|
5472
|
-
left: (
|
|
5473
|
-
right: (C.right -
|
|
5484
|
+
top: (m.top - C.top + w.top) / b.y,
|
|
5485
|
+
bottom: (C.bottom - m.bottom + w.bottom) / b.y,
|
|
5486
|
+
left: (m.left - C.left + w.left) / b.x,
|
|
5487
|
+
right: (C.right - m.right + w.right) / b.x
|
|
5474
5488
|
};
|
|
5475
5489
|
}
|
|
5476
|
-
const
|
|
5490
|
+
const Fe = (c) => ({
|
|
5477
5491
|
name: "arrow",
|
|
5478
5492
|
options: c,
|
|
5479
5493
|
async fn(t) {
|
|
@@ -5484,33 +5498,33 @@ const We = (c) => ({
|
|
|
5484
5498
|
rects: o,
|
|
5485
5499
|
platform: r,
|
|
5486
5500
|
elements: a,
|
|
5487
|
-
middlewareData:
|
|
5501
|
+
middlewareData: l
|
|
5488
5502
|
} = t, {
|
|
5489
|
-
element:
|
|
5503
|
+
element: h,
|
|
5490
5504
|
padding: d = 0
|
|
5491
5505
|
} = Q(c, t) || {};
|
|
5492
|
-
if (
|
|
5506
|
+
if (h == null)
|
|
5493
5507
|
return {};
|
|
5494
|
-
const f =
|
|
5508
|
+
const f = Ft(d), u = {
|
|
5495
5509
|
x: e,
|
|
5496
5510
|
y: i
|
|
5497
|
-
}, x =
|
|
5498
|
-
let
|
|
5499
|
-
(!
|
|
5500
|
-
const
|
|
5511
|
+
}, x = Et(s), w = wt(x), E = await r.getDimensions(h), g = x === "y", m = g ? "top" : "left", y = g ? "bottom" : "right", p = g ? "clientHeight" : "clientWidth", b = o.reference[w] + o.reference[x] - u[x] - o.floating[w], C = u[x] - o.reference[x], R = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(h));
|
|
5512
|
+
let _ = R ? R[p] : 0;
|
|
5513
|
+
(!_ || !await (r.isElement == null ? void 0 : r.isElement(R))) && (_ = a.floating[p] || o.floating[w]);
|
|
5514
|
+
const T = b / 2 - C / 2, S = _ / 2 - E[w] / 2 - 1, I = q(f[m], S), v = q(f[y], S), O = I, A = _ - E[w] - v, L = _ / 2 - E[w] / 2 + T, M = dt(O, L, A), D = !l.arrow && tt(s) != null && L !== M && o.reference[w] / 2 - (L < O ? I : v) - E[w] / 2 < 0, H = D ? L < O ? L - O : L - A : 0;
|
|
5501
5515
|
return {
|
|
5502
|
-
[x]: u[x] +
|
|
5516
|
+
[x]: u[x] + H,
|
|
5503
5517
|
data: {
|
|
5504
|
-
[x]:
|
|
5505
|
-
centerOffset: L -
|
|
5518
|
+
[x]: M,
|
|
5519
|
+
centerOffset: L - M - H,
|
|
5506
5520
|
...D && {
|
|
5507
|
-
alignmentOffset:
|
|
5521
|
+
alignmentOffset: H
|
|
5508
5522
|
}
|
|
5509
5523
|
},
|
|
5510
5524
|
reset: D
|
|
5511
5525
|
};
|
|
5512
5526
|
}
|
|
5513
|
-
}),
|
|
5527
|
+
}), Ve = function(c) {
|
|
5514
5528
|
return c === void 0 && (c = {}), {
|
|
5515
5529
|
name: "flip",
|
|
5516
5530
|
options: c,
|
|
@@ -5521,60 +5535,60 @@ const We = (c) => ({
|
|
|
5521
5535
|
middlewareData: o,
|
|
5522
5536
|
rects: r,
|
|
5523
5537
|
initialPlacement: a,
|
|
5524
|
-
platform:
|
|
5525
|
-
elements:
|
|
5538
|
+
platform: l,
|
|
5539
|
+
elements: h
|
|
5526
5540
|
} = t, {
|
|
5527
5541
|
mainAxis: d = !0,
|
|
5528
5542
|
crossAxis: f = !0,
|
|
5529
5543
|
fallbackPlacements: u,
|
|
5530
5544
|
fallbackStrategy: x = "bestFit",
|
|
5531
5545
|
fallbackAxisSideDirection: w = "none",
|
|
5532
|
-
flipAlignment:
|
|
5546
|
+
flipAlignment: E = !0,
|
|
5533
5547
|
...g
|
|
5534
5548
|
} = Q(c, t);
|
|
5535
5549
|
if ((e = o.arrow) != null && e.alignmentOffset)
|
|
5536
5550
|
return {};
|
|
5537
|
-
const
|
|
5538
|
-
!u &&
|
|
5539
|
-
const
|
|
5540
|
-
let
|
|
5541
|
-
if (d &&
|
|
5542
|
-
const L =
|
|
5543
|
-
|
|
5551
|
+
const m = z(s), y = V(a), p = z(a) === a, b = await (l.isRTL == null ? void 0 : l.isRTL(h.floating)), C = u || (p || !E ? [ot(a)] : Ne(a)), R = w !== "none";
|
|
5552
|
+
!u && R && C.push(...Be(a, E, w, b));
|
|
5553
|
+
const _ = [a, ...C], T = await Vt(t, g), S = [];
|
|
5554
|
+
let I = ((i = o.flip) == null ? void 0 : i.overflows) || [];
|
|
5555
|
+
if (d && S.push(T[m]), f) {
|
|
5556
|
+
const L = De(s, r, b);
|
|
5557
|
+
S.push(T[L[0]], T[L[1]]);
|
|
5544
5558
|
}
|
|
5545
|
-
if (
|
|
5559
|
+
if (I = [...I, {
|
|
5546
5560
|
placement: s,
|
|
5547
|
-
overflows:
|
|
5548
|
-
}], !
|
|
5549
|
-
var
|
|
5550
|
-
const L = (((
|
|
5551
|
-
if (
|
|
5561
|
+
overflows: S
|
|
5562
|
+
}], !S.every((L) => L <= 0)) {
|
|
5563
|
+
var v, O;
|
|
5564
|
+
const L = (((v = o.flip) == null ? void 0 : v.index) || 0) + 1, M = _[L];
|
|
5565
|
+
if (M && (!(f === "alignment" ? y !== V(M) : !1) || // We leave the current main axis only if every placement on that axis
|
|
5552
5566
|
// overflows the main axis.
|
|
5553
|
-
|
|
5567
|
+
I.every((k) => V(k.placement) === y ? k.overflows[0] > 0 : !0)))
|
|
5554
5568
|
return {
|
|
5555
5569
|
data: {
|
|
5556
5570
|
index: L,
|
|
5557
|
-
overflows:
|
|
5571
|
+
overflows: I
|
|
5558
5572
|
},
|
|
5559
5573
|
reset: {
|
|
5560
|
-
placement:
|
|
5574
|
+
placement: M
|
|
5561
5575
|
}
|
|
5562
5576
|
};
|
|
5563
|
-
let D = (
|
|
5577
|
+
let D = (O = I.filter((H) => H.overflows[0] <= 0).sort((H, k) => H.overflows[1] - k.overflows[1])[0]) == null ? void 0 : O.placement;
|
|
5564
5578
|
if (!D)
|
|
5565
5579
|
switch (x) {
|
|
5566
5580
|
case "bestFit": {
|
|
5567
|
-
var
|
|
5568
|
-
const
|
|
5569
|
-
if (
|
|
5581
|
+
var A;
|
|
5582
|
+
const H = (A = I.filter((k) => {
|
|
5583
|
+
if (R) {
|
|
5570
5584
|
const F = V(k.placement);
|
|
5571
5585
|
return F === y || // Create a bias to the `y` side axis due to horizontal
|
|
5572
5586
|
// reading directions favoring greater width.
|
|
5573
5587
|
F === "y";
|
|
5574
5588
|
}
|
|
5575
5589
|
return !0;
|
|
5576
|
-
}).map((k) => [k.placement, k.overflows.filter((F) => F > 0).reduce((F,
|
|
5577
|
-
|
|
5590
|
+
}).map((k) => [k.placement, k.overflows.filter((F) => F > 0).reduce((F, se) => F + se, 0)]).sort((k, F) => k[1] - F[1])[0]) == null ? void 0 : A[0];
|
|
5591
|
+
H && (D = H);
|
|
5578
5592
|
break;
|
|
5579
5593
|
}
|
|
5580
5594
|
case "initialPlacement":
|
|
@@ -5591,13 +5605,13 @@ const We = (c) => ({
|
|
|
5591
5605
|
return {};
|
|
5592
5606
|
}
|
|
5593
5607
|
};
|
|
5594
|
-
},
|
|
5595
|
-
async function
|
|
5608
|
+
}, Pe = /* @__PURE__ */ new Set(["left", "top"]);
|
|
5609
|
+
async function ze(c, t) {
|
|
5596
5610
|
const {
|
|
5597
5611
|
placement: e,
|
|
5598
5612
|
platform: i,
|
|
5599
5613
|
elements: s
|
|
5600
|
-
} = c, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r = z(e), a = tt(e),
|
|
5614
|
+
} = c, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r = z(e), a = tt(e), l = V(e) === "y", h = Pe.has(r) ? -1 : 1, d = o && l ? -1 : 1, f = Q(t, c);
|
|
5601
5615
|
let {
|
|
5602
5616
|
mainAxis: u,
|
|
5603
5617
|
crossAxis: x,
|
|
@@ -5611,15 +5625,15 @@ async function Pe(c, t) {
|
|
|
5611
5625
|
crossAxis: f.crossAxis || 0,
|
|
5612
5626
|
alignmentAxis: f.alignmentAxis
|
|
5613
5627
|
};
|
|
5614
|
-
return a && typeof w == "number" && (x = a === "end" ? w * -1 : w),
|
|
5628
|
+
return a && typeof w == "number" && (x = a === "end" ? w * -1 : w), l ? {
|
|
5615
5629
|
x: x * d,
|
|
5616
|
-
y: u *
|
|
5630
|
+
y: u * h
|
|
5617
5631
|
} : {
|
|
5618
|
-
x: u *
|
|
5632
|
+
x: u * h,
|
|
5619
5633
|
y: x * d
|
|
5620
5634
|
};
|
|
5621
5635
|
}
|
|
5622
|
-
const
|
|
5636
|
+
const $e = function(c) {
|
|
5623
5637
|
return c === void 0 && (c = 0), {
|
|
5624
5638
|
name: "offset",
|
|
5625
5639
|
options: c,
|
|
@@ -5630,18 +5644,18 @@ const ze = function(c) {
|
|
|
5630
5644
|
y: o,
|
|
5631
5645
|
placement: r,
|
|
5632
5646
|
middlewareData: a
|
|
5633
|
-
} = t,
|
|
5647
|
+
} = t, l = await ze(t, c);
|
|
5634
5648
|
return r === ((e = a.offset) == null ? void 0 : e.placement) && (i = a.arrow) != null && i.alignmentOffset ? {} : {
|
|
5635
|
-
x: s +
|
|
5636
|
-
y: o +
|
|
5649
|
+
x: s + l.x,
|
|
5650
|
+
y: o + l.y,
|
|
5637
5651
|
data: {
|
|
5638
|
-
...
|
|
5652
|
+
...l,
|
|
5639
5653
|
placement: r
|
|
5640
5654
|
}
|
|
5641
5655
|
};
|
|
5642
5656
|
}
|
|
5643
5657
|
};
|
|
5644
|
-
},
|
|
5658
|
+
}, Ge = function(c) {
|
|
5645
5659
|
return c === void 0 && (c = {}), {
|
|
5646
5660
|
name: "shift",
|
|
5647
5661
|
options: c,
|
|
@@ -5656,39 +5670,39 @@ const ze = function(c) {
|
|
|
5656
5670
|
limiter: a = {
|
|
5657
5671
|
fn: (g) => {
|
|
5658
5672
|
let {
|
|
5659
|
-
x:
|
|
5673
|
+
x: m,
|
|
5660
5674
|
y
|
|
5661
5675
|
} = g;
|
|
5662
5676
|
return {
|
|
5663
|
-
x:
|
|
5677
|
+
x: m,
|
|
5664
5678
|
y
|
|
5665
5679
|
};
|
|
5666
5680
|
}
|
|
5667
5681
|
},
|
|
5668
|
-
...
|
|
5669
|
-
} = Q(c, t),
|
|
5682
|
+
...l
|
|
5683
|
+
} = Q(c, t), h = {
|
|
5670
5684
|
x: e,
|
|
5671
5685
|
y: i
|
|
5672
|
-
}, d = await
|
|
5673
|
-
let x =
|
|
5686
|
+
}, d = await Vt(t, l), f = V(z(s)), u = Wt(f);
|
|
5687
|
+
let x = h[u], w = h[f];
|
|
5674
5688
|
if (o) {
|
|
5675
|
-
const g = u === "y" ? "top" : "left",
|
|
5676
|
-
x = dt(y, x,
|
|
5689
|
+
const g = u === "y" ? "top" : "left", m = u === "y" ? "bottom" : "right", y = x + d[g], p = x - d[m];
|
|
5690
|
+
x = dt(y, x, p);
|
|
5677
5691
|
}
|
|
5678
5692
|
if (r) {
|
|
5679
|
-
const g = f === "y" ? "top" : "left",
|
|
5680
|
-
w = dt(y, w,
|
|
5693
|
+
const g = f === "y" ? "top" : "left", m = f === "y" ? "bottom" : "right", y = w + d[g], p = w - d[m];
|
|
5694
|
+
w = dt(y, w, p);
|
|
5681
5695
|
}
|
|
5682
|
-
const
|
|
5696
|
+
const E = a.fn({
|
|
5683
5697
|
...t,
|
|
5684
5698
|
[u]: x,
|
|
5685
5699
|
[f]: w
|
|
5686
5700
|
});
|
|
5687
5701
|
return {
|
|
5688
|
-
...
|
|
5702
|
+
...E,
|
|
5689
5703
|
data: {
|
|
5690
|
-
x:
|
|
5691
|
-
y:
|
|
5704
|
+
x: E.x - e,
|
|
5705
|
+
y: E.y - i,
|
|
5692
5706
|
enabled: {
|
|
5693
5707
|
[u]: o,
|
|
5694
5708
|
[f]: r
|
|
@@ -5701,30 +5715,30 @@ const ze = function(c) {
|
|
|
5701
5715
|
function nt() {
|
|
5702
5716
|
return typeof window < "u";
|
|
5703
5717
|
}
|
|
5704
|
-
function
|
|
5705
|
-
return
|
|
5718
|
+
function j(c) {
|
|
5719
|
+
return Pt(c) ? (c.nodeName || "").toLowerCase() : "#document";
|
|
5706
5720
|
}
|
|
5707
|
-
function
|
|
5721
|
+
function N(c) {
|
|
5708
5722
|
var t;
|
|
5709
5723
|
return (c == null || (t = c.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
5710
5724
|
}
|
|
5711
5725
|
function W(c) {
|
|
5712
5726
|
var t;
|
|
5713
|
-
return (t = (
|
|
5727
|
+
return (t = (Pt(c) ? c.ownerDocument : c.document) || window.document) == null ? void 0 : t.documentElement;
|
|
5714
5728
|
}
|
|
5715
|
-
function
|
|
5716
|
-
return nt() ? c instanceof Node || c instanceof
|
|
5729
|
+
function Pt(c) {
|
|
5730
|
+
return nt() ? c instanceof Node || c instanceof N(c).Node : !1;
|
|
5717
5731
|
}
|
|
5718
5732
|
function X(c) {
|
|
5719
|
-
return nt() ? c instanceof Element || c instanceof
|
|
5733
|
+
return nt() ? c instanceof Element || c instanceof N(c).Element : !1;
|
|
5720
5734
|
}
|
|
5721
5735
|
function K(c) {
|
|
5722
|
-
return nt() ? c instanceof HTMLElement || c instanceof
|
|
5736
|
+
return nt() ? c instanceof HTMLElement || c instanceof N(c).HTMLElement : !1;
|
|
5723
5737
|
}
|
|
5724
|
-
function
|
|
5725
|
-
return !nt() || typeof ShadowRoot > "u" ? !1 : c instanceof ShadowRoot || c instanceof
|
|
5738
|
+
function At(c) {
|
|
5739
|
+
return !nt() || typeof ShadowRoot > "u" ? !1 : c instanceof ShadowRoot || c instanceof N(c).ShadowRoot;
|
|
5726
5740
|
}
|
|
5727
|
-
const
|
|
5741
|
+
const Ue = /* @__PURE__ */ new Set(["inline", "contents"]);
|
|
5728
5742
|
function et(c) {
|
|
5729
5743
|
const {
|
|
5730
5744
|
overflow: t,
|
|
@@ -5732,15 +5746,15 @@ function et(c) {
|
|
|
5732
5746
|
overflowY: i,
|
|
5733
5747
|
display: s
|
|
5734
5748
|
} = Y(c);
|
|
5735
|
-
return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !
|
|
5749
|
+
return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !Ue.has(s);
|
|
5736
5750
|
}
|
|
5737
|
-
const
|
|
5738
|
-
function
|
|
5739
|
-
return
|
|
5751
|
+
const je = /* @__PURE__ */ new Set(["table", "td", "th"]);
|
|
5752
|
+
function Ze(c) {
|
|
5753
|
+
return je.has(j(c));
|
|
5740
5754
|
}
|
|
5741
|
-
const
|
|
5755
|
+
const qe = [":popover-open", ":modal"];
|
|
5742
5756
|
function at(c) {
|
|
5743
|
-
return
|
|
5757
|
+
return qe.some((t) => {
|
|
5744
5758
|
try {
|
|
5745
5759
|
return c.matches(t);
|
|
5746
5760
|
} catch {
|
|
@@ -5748,15 +5762,15 @@ function at(c) {
|
|
|
5748
5762
|
}
|
|
5749
5763
|
});
|
|
5750
5764
|
}
|
|
5751
|
-
const
|
|
5752
|
-
function
|
|
5753
|
-
const t =
|
|
5754
|
-
return
|
|
5765
|
+
const Je = ["transform", "translate", "scale", "rotate", "perspective"], Qe = ["transform", "translate", "scale", "rotate", "perspective", "filter"], ti = ["paint", "layout", "strict", "content"];
|
|
5766
|
+
function mt(c) {
|
|
5767
|
+
const t = pt(), e = X(c) ? Y(c) : c;
|
|
5768
|
+
return Je.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) || Qe.some((i) => (e.willChange || "").includes(i)) || ti.some((i) => (e.contain || "").includes(i));
|
|
5755
5769
|
}
|
|
5756
|
-
function
|
|
5770
|
+
function ei(c) {
|
|
5757
5771
|
let t = P(c);
|
|
5758
5772
|
for (; K(t) && !U(t); ) {
|
|
5759
|
-
if (
|
|
5773
|
+
if (mt(t))
|
|
5760
5774
|
return t;
|
|
5761
5775
|
if (at(t))
|
|
5762
5776
|
return null;
|
|
@@ -5764,17 +5778,17 @@ function ti(c) {
|
|
|
5764
5778
|
}
|
|
5765
5779
|
return null;
|
|
5766
5780
|
}
|
|
5767
|
-
function
|
|
5781
|
+
function pt() {
|
|
5768
5782
|
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
5769
5783
|
}
|
|
5770
|
-
const
|
|
5784
|
+
const ii = /* @__PURE__ */ new Set(["html", "body", "#document"]);
|
|
5771
5785
|
function U(c) {
|
|
5772
|
-
return
|
|
5786
|
+
return ii.has(j(c));
|
|
5773
5787
|
}
|
|
5774
5788
|
function Y(c) {
|
|
5775
|
-
return
|
|
5789
|
+
return N(c).getComputedStyle(c);
|
|
5776
5790
|
}
|
|
5777
|
-
function
|
|
5791
|
+
function lt(c) {
|
|
5778
5792
|
return X(c) ? {
|
|
5779
5793
|
scrollLeft: c.scrollLeft,
|
|
5780
5794
|
scrollTop: c.scrollTop
|
|
@@ -5784,31 +5798,31 @@ function ht(c) {
|
|
|
5784
5798
|
};
|
|
5785
5799
|
}
|
|
5786
5800
|
function P(c) {
|
|
5787
|
-
if (
|
|
5801
|
+
if (j(c) === "html")
|
|
5788
5802
|
return c;
|
|
5789
5803
|
const t = (
|
|
5790
5804
|
// Step into the shadow DOM of the parent of a slotted node.
|
|
5791
5805
|
c.assignedSlot || // DOM Element detected.
|
|
5792
5806
|
c.parentNode || // ShadowRoot detected.
|
|
5793
|
-
|
|
5807
|
+
At(c) && c.host || // Fallback.
|
|
5794
5808
|
W(c)
|
|
5795
5809
|
);
|
|
5796
|
-
return
|
|
5810
|
+
return At(t) ? t.host : t;
|
|
5797
5811
|
}
|
|
5798
|
-
function
|
|
5812
|
+
function zt(c) {
|
|
5799
5813
|
const t = P(c);
|
|
5800
|
-
return U(t) ? c.ownerDocument ? c.ownerDocument.body : c.body : K(t) && et(t) ? t :
|
|
5814
|
+
return U(t) ? c.ownerDocument ? c.ownerDocument.body : c.body : K(t) && et(t) ? t : zt(t);
|
|
5801
5815
|
}
|
|
5802
|
-
function
|
|
5816
|
+
function $t(c, t, e) {
|
|
5803
5817
|
var i;
|
|
5804
5818
|
t === void 0 && (t = []);
|
|
5805
|
-
const s =
|
|
5806
|
-
return o ? (xt(r), t.concat(r, r.visualViewport || [], et(s) ? s : [], [])) : t.concat(s,
|
|
5819
|
+
const s = zt(c), o = s === ((i = c.ownerDocument) == null ? void 0 : i.body), r = N(s);
|
|
5820
|
+
return o ? (xt(r), t.concat(r, r.visualViewport || [], et(s) ? s : [], [])) : t.concat(s, $t(s, []));
|
|
5807
5821
|
}
|
|
5808
5822
|
function xt(c) {
|
|
5809
5823
|
return c.parent && Object.getPrototypeOf(c.parent) ? c.frameElement : null;
|
|
5810
5824
|
}
|
|
5811
|
-
function
|
|
5825
|
+
function Gt(c) {
|
|
5812
5826
|
const t = Y(c);
|
|
5813
5827
|
let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
|
|
5814
5828
|
const s = K(c), o = s ? c.offsetWidth : e, r = s ? c.offsetHeight : i, a = st(e) !== o || st(i) !== r;
|
|
@@ -5818,62 +5832,62 @@ function $t(c) {
|
|
|
5818
5832
|
$: a
|
|
5819
5833
|
};
|
|
5820
5834
|
}
|
|
5821
|
-
function
|
|
5835
|
+
function Ut(c) {
|
|
5822
5836
|
return X(c) ? c : c.contextElement;
|
|
5823
5837
|
}
|
|
5824
5838
|
function G(c) {
|
|
5825
|
-
const t =
|
|
5839
|
+
const t = Ut(c);
|
|
5826
5840
|
if (!K(t))
|
|
5827
5841
|
return B(1);
|
|
5828
5842
|
const e = t.getBoundingClientRect(), {
|
|
5829
5843
|
width: i,
|
|
5830
5844
|
height: s,
|
|
5831
5845
|
$: o
|
|
5832
|
-
} =
|
|
5846
|
+
} = Gt(t);
|
|
5833
5847
|
let r = (o ? st(e.width) : e.width) / i, a = (o ? st(e.height) : e.height) / s;
|
|
5834
5848
|
return (!r || !Number.isFinite(r)) && (r = 1), (!a || !Number.isFinite(a)) && (a = 1), {
|
|
5835
5849
|
x: r,
|
|
5836
5850
|
y: a
|
|
5837
5851
|
};
|
|
5838
5852
|
}
|
|
5839
|
-
const
|
|
5840
|
-
function
|
|
5841
|
-
const t =
|
|
5842
|
-
return !
|
|
5853
|
+
const si = /* @__PURE__ */ B(0);
|
|
5854
|
+
function jt(c) {
|
|
5855
|
+
const t = N(c);
|
|
5856
|
+
return !pt() || !t.visualViewport ? si : {
|
|
5843
5857
|
x: t.visualViewport.offsetLeft,
|
|
5844
5858
|
y: t.visualViewport.offsetTop
|
|
5845
5859
|
};
|
|
5846
5860
|
}
|
|
5847
|
-
function
|
|
5848
|
-
return t === void 0 && (t = !1), !e || t && e !==
|
|
5861
|
+
function oi(c, t, e) {
|
|
5862
|
+
return t === void 0 && (t = !1), !e || t && e !== N(c) ? !1 : t;
|
|
5849
5863
|
}
|
|
5850
5864
|
function J(c, t, e, i) {
|
|
5851
5865
|
t === void 0 && (t = !1), e === void 0 && (e = !1);
|
|
5852
|
-
const s = c.getBoundingClientRect(), o =
|
|
5866
|
+
const s = c.getBoundingClientRect(), o = Ut(c);
|
|
5853
5867
|
let r = B(1);
|
|
5854
5868
|
t && (i ? X(i) && (r = G(i)) : r = G(c));
|
|
5855
|
-
const a =
|
|
5856
|
-
let
|
|
5869
|
+
const a = oi(o, e, i) ? jt(o) : B(0);
|
|
5870
|
+
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;
|
|
5857
5871
|
if (o) {
|
|
5858
|
-
const u =
|
|
5859
|
-
let w = u,
|
|
5860
|
-
for (;
|
|
5861
|
-
const g = G(
|
|
5862
|
-
|
|
5872
|
+
const u = N(o), x = i && X(i) ? N(i) : i;
|
|
5873
|
+
let w = u, E = xt(w);
|
|
5874
|
+
for (; E && i && x !== w; ) {
|
|
5875
|
+
const g = G(E), m = E.getBoundingClientRect(), y = Y(E), p = m.left + (E.clientLeft + parseFloat(y.paddingLeft)) * g.x, b = m.top + (E.clientTop + parseFloat(y.paddingTop)) * g.y;
|
|
5876
|
+
l *= g.x, h *= g.y, d *= g.x, f *= g.y, l += p, h += b, w = N(E), E = xt(w);
|
|
5863
5877
|
}
|
|
5864
5878
|
}
|
|
5865
5879
|
return rt({
|
|
5866
5880
|
width: d,
|
|
5867
5881
|
height: f,
|
|
5868
|
-
x:
|
|
5869
|
-
y:
|
|
5882
|
+
x: l,
|
|
5883
|
+
y: h
|
|
5870
5884
|
});
|
|
5871
5885
|
}
|
|
5872
5886
|
function yt(c, t) {
|
|
5873
|
-
const e =
|
|
5887
|
+
const e = lt(c).scrollLeft;
|
|
5874
5888
|
return t ? t.left + e : J(W(c)).left + e;
|
|
5875
5889
|
}
|
|
5876
|
-
function
|
|
5890
|
+
function Zt(c, t, e) {
|
|
5877
5891
|
e === void 0 && (e = !1);
|
|
5878
5892
|
const i = c.getBoundingClientRect(), s = i.left + t.scrollLeft - (e ? 0 : (
|
|
5879
5893
|
// RTL <body> scrollbar.
|
|
@@ -5884,7 +5898,7 @@ function qt(c, t, e) {
|
|
|
5884
5898
|
y: o
|
|
5885
5899
|
};
|
|
5886
5900
|
}
|
|
5887
|
-
function
|
|
5901
|
+
function ri(c) {
|
|
5888
5902
|
let {
|
|
5889
5903
|
elements: t,
|
|
5890
5904
|
rect: e,
|
|
@@ -5894,28 +5908,28 @@ function oi(c) {
|
|
|
5894
5908
|
const o = s === "fixed", r = W(i), a = t ? at(t.floating) : !1;
|
|
5895
5909
|
if (i === r || a && o)
|
|
5896
5910
|
return e;
|
|
5897
|
-
let
|
|
5911
|
+
let l = {
|
|
5898
5912
|
scrollLeft: 0,
|
|
5899
5913
|
scrollTop: 0
|
|
5900
|
-
},
|
|
5914
|
+
}, h = B(1);
|
|
5901
5915
|
const d = B(0), f = K(i);
|
|
5902
|
-
if ((f || !f && !o) && ((
|
|
5916
|
+
if ((f || !f && !o) && ((j(i) !== "body" || et(r)) && (l = lt(i)), K(i))) {
|
|
5903
5917
|
const x = J(i);
|
|
5904
|
-
|
|
5918
|
+
h = G(i), d.x = x.x + i.clientLeft, d.y = x.y + i.clientTop;
|
|
5905
5919
|
}
|
|
5906
|
-
const u = r && !f && !o ?
|
|
5920
|
+
const u = r && !f && !o ? Zt(r, l, !0) : B(0);
|
|
5907
5921
|
return {
|
|
5908
|
-
width: e.width *
|
|
5909
|
-
height: e.height *
|
|
5910
|
-
x: e.x *
|
|
5911
|
-
y: e.y *
|
|
5922
|
+
width: e.width * h.x,
|
|
5923
|
+
height: e.height * h.y,
|
|
5924
|
+
x: e.x * h.x - l.scrollLeft * h.x + d.x + u.x,
|
|
5925
|
+
y: e.y * h.y - l.scrollTop * h.y + d.y + u.y
|
|
5912
5926
|
};
|
|
5913
5927
|
}
|
|
5914
|
-
function
|
|
5928
|
+
function ni(c) {
|
|
5915
5929
|
return Array.from(c.getClientRects());
|
|
5916
5930
|
}
|
|
5917
|
-
function
|
|
5918
|
-
const t = W(c), e =
|
|
5931
|
+
function ai(c) {
|
|
5932
|
+
const t = W(c), e = lt(c), i = c.ownerDocument.body, s = $(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), o = $(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
|
|
5919
5933
|
let r = -e.scrollLeft + yt(c);
|
|
5920
5934
|
const a = -e.scrollTop;
|
|
5921
5935
|
return Y(i).direction === "rtl" && (r += $(t.clientWidth, i.clientWidth) - s), {
|
|
@@ -5925,41 +5939,41 @@ function ni(c) {
|
|
|
5925
5939
|
y: a
|
|
5926
5940
|
};
|
|
5927
5941
|
}
|
|
5928
|
-
function
|
|
5929
|
-
const e =
|
|
5930
|
-
let o = i.clientWidth, r = i.clientHeight, a = 0,
|
|
5942
|
+
function li(c, t) {
|
|
5943
|
+
const e = N(c), i = W(c), s = e.visualViewport;
|
|
5944
|
+
let o = i.clientWidth, r = i.clientHeight, a = 0, l = 0;
|
|
5931
5945
|
if (s) {
|
|
5932
5946
|
o = s.width, r = s.height;
|
|
5933
|
-
const
|
|
5934
|
-
(!
|
|
5947
|
+
const h = pt();
|
|
5948
|
+
(!h || h && t === "fixed") && (a = s.offsetLeft, l = s.offsetTop);
|
|
5935
5949
|
}
|
|
5936
5950
|
return {
|
|
5937
5951
|
width: o,
|
|
5938
5952
|
height: r,
|
|
5939
5953
|
x: a,
|
|
5940
|
-
y:
|
|
5954
|
+
y: l
|
|
5941
5955
|
};
|
|
5942
5956
|
}
|
|
5943
5957
|
const hi = /* @__PURE__ */ new Set(["absolute", "fixed"]);
|
|
5944
|
-
function
|
|
5945
|
-
const e = J(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,
|
|
5958
|
+
function ci(c, t) {
|
|
5959
|
+
const e = J(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;
|
|
5946
5960
|
return {
|
|
5947
5961
|
width: r,
|
|
5948
5962
|
height: a,
|
|
5949
|
-
x:
|
|
5950
|
-
y:
|
|
5963
|
+
x: l,
|
|
5964
|
+
y: h
|
|
5951
5965
|
};
|
|
5952
5966
|
}
|
|
5953
5967
|
function Mt(c, t, e) {
|
|
5954
5968
|
let i;
|
|
5955
5969
|
if (t === "viewport")
|
|
5956
|
-
i =
|
|
5970
|
+
i = li(c, e);
|
|
5957
5971
|
else if (t === "document")
|
|
5958
|
-
i =
|
|
5972
|
+
i = ai(W(c));
|
|
5959
5973
|
else if (X(t))
|
|
5960
|
-
i =
|
|
5974
|
+
i = ci(t, e);
|
|
5961
5975
|
else {
|
|
5962
|
-
const s =
|
|
5976
|
+
const s = jt(c);
|
|
5963
5977
|
i = {
|
|
5964
5978
|
x: t.x - s.x,
|
|
5965
5979
|
y: t.y - s.y,
|
|
@@ -5969,68 +5983,68 @@ function Mt(c, t, e) {
|
|
|
5969
5983
|
}
|
|
5970
5984
|
return rt(i);
|
|
5971
5985
|
}
|
|
5972
|
-
function
|
|
5986
|
+
function qt(c, t) {
|
|
5973
5987
|
const e = P(c);
|
|
5974
|
-
return e === t || !X(e) || U(e) ? !1 : Y(e).position === "fixed" ||
|
|
5988
|
+
return e === t || !X(e) || U(e) ? !1 : Y(e).position === "fixed" || qt(e, t);
|
|
5975
5989
|
}
|
|
5976
|
-
function
|
|
5990
|
+
function di(c, t) {
|
|
5977
5991
|
const e = t.get(c);
|
|
5978
5992
|
if (e)
|
|
5979
5993
|
return e;
|
|
5980
|
-
let i =
|
|
5994
|
+
let i = $t(c, []).filter((a) => X(a) && j(a) !== "body"), s = null;
|
|
5981
5995
|
const o = Y(c).position === "fixed";
|
|
5982
5996
|
let r = o ? P(c) : c;
|
|
5983
5997
|
for (; X(r) && !U(r); ) {
|
|
5984
|
-
const a = Y(r),
|
|
5985
|
-
!
|
|
5998
|
+
const a = Y(r), l = mt(r);
|
|
5999
|
+
!l && a.position === "fixed" && (s = null), (o ? !l && !s : !l && a.position === "static" && !!s && hi.has(s.position) || et(r) && !l && qt(c, r)) ? i = i.filter((d) => d !== r) : s = a, r = P(r);
|
|
5986
6000
|
}
|
|
5987
6001
|
return t.set(c, i), i;
|
|
5988
6002
|
}
|
|
5989
|
-
function
|
|
6003
|
+
function fi(c) {
|
|
5990
6004
|
let {
|
|
5991
6005
|
element: t,
|
|
5992
6006
|
boundary: e,
|
|
5993
6007
|
rootBoundary: i,
|
|
5994
6008
|
strategy: s
|
|
5995
6009
|
} = c;
|
|
5996
|
-
const r = [...e === "clippingAncestors" ? at(t) ? [] :
|
|
6010
|
+
const r = [...e === "clippingAncestors" ? at(t) ? [] : di(t, this._c) : [].concat(e), i], a = r[0], l = r.reduce((h, d) => {
|
|
5997
6011
|
const f = Mt(t, d, s);
|
|
5998
|
-
return
|
|
6012
|
+
return h.top = $(f.top, h.top), h.right = q(f.right, h.right), h.bottom = q(f.bottom, h.bottom), h.left = $(f.left, h.left), h;
|
|
5999
6013
|
}, Mt(t, a, s));
|
|
6000
6014
|
return {
|
|
6001
|
-
width:
|
|
6002
|
-
height:
|
|
6003
|
-
x:
|
|
6004
|
-
y:
|
|
6015
|
+
width: l.right - l.left,
|
|
6016
|
+
height: l.bottom - l.top,
|
|
6017
|
+
x: l.left,
|
|
6018
|
+
y: l.top
|
|
6005
6019
|
};
|
|
6006
6020
|
}
|
|
6007
|
-
function
|
|
6021
|
+
function xi(c) {
|
|
6008
6022
|
const {
|
|
6009
6023
|
width: t,
|
|
6010
6024
|
height: e
|
|
6011
|
-
} =
|
|
6025
|
+
} = Gt(c);
|
|
6012
6026
|
return {
|
|
6013
6027
|
width: t,
|
|
6014
6028
|
height: e
|
|
6015
6029
|
};
|
|
6016
6030
|
}
|
|
6017
|
-
function
|
|
6031
|
+
function ui(c, t, e) {
|
|
6018
6032
|
const i = K(t), s = W(t), o = e === "fixed", r = J(c, !0, o, t);
|
|
6019
6033
|
let a = {
|
|
6020
6034
|
scrollLeft: 0,
|
|
6021
6035
|
scrollTop: 0
|
|
6022
6036
|
};
|
|
6023
|
-
const
|
|
6024
|
-
function
|
|
6025
|
-
|
|
6037
|
+
const l = B(0);
|
|
6038
|
+
function h() {
|
|
6039
|
+
l.x = yt(s);
|
|
6026
6040
|
}
|
|
6027
6041
|
if (i || !i && !o)
|
|
6028
|
-
if ((
|
|
6042
|
+
if ((j(t) !== "body" || et(s)) && (a = lt(t)), i) {
|
|
6029
6043
|
const x = J(t, !0, o, t);
|
|
6030
|
-
|
|
6031
|
-
} else s &&
|
|
6032
|
-
o && !i && s &&
|
|
6033
|
-
const d = s && !i && !o ?
|
|
6044
|
+
l.x = x.x + t.clientLeft, l.y = x.y + t.clientTop;
|
|
6045
|
+
} else s && h();
|
|
6046
|
+
o && !i && s && h();
|
|
6047
|
+
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;
|
|
6034
6048
|
return {
|
|
6035
6049
|
x: f,
|
|
6036
6050
|
y: u,
|
|
@@ -6038,10 +6052,10 @@ function xi(c, t, e) {
|
|
|
6038
6052
|
height: r.height
|
|
6039
6053
|
};
|
|
6040
6054
|
}
|
|
6041
|
-
function
|
|
6055
|
+
function ht(c) {
|
|
6042
6056
|
return Y(c).position === "static";
|
|
6043
6057
|
}
|
|
6044
|
-
function
|
|
6058
|
+
function Ht(c, t) {
|
|
6045
6059
|
if (!K(c) || Y(c).position === "fixed")
|
|
6046
6060
|
return null;
|
|
6047
6061
|
if (t)
|
|
@@ -6049,28 +6063,28 @@ function At(c, t) {
|
|
|
6049
6063
|
let e = c.offsetParent;
|
|
6050
6064
|
return W(c) === e && (e = e.ownerDocument.body), e;
|
|
6051
6065
|
}
|
|
6052
|
-
function
|
|
6053
|
-
const e =
|
|
6066
|
+
function Jt(c, t) {
|
|
6067
|
+
const e = N(c);
|
|
6054
6068
|
if (at(c))
|
|
6055
6069
|
return e;
|
|
6056
6070
|
if (!K(c)) {
|
|
6057
6071
|
let s = P(c);
|
|
6058
6072
|
for (; s && !U(s); ) {
|
|
6059
|
-
if (X(s) && !
|
|
6073
|
+
if (X(s) && !ht(s))
|
|
6060
6074
|
return s;
|
|
6061
6075
|
s = P(s);
|
|
6062
6076
|
}
|
|
6063
6077
|
return e;
|
|
6064
6078
|
}
|
|
6065
|
-
let i =
|
|
6066
|
-
for (; i &&
|
|
6067
|
-
i =
|
|
6068
|
-
return i && U(i) &&
|
|
6079
|
+
let i = Ht(c, t);
|
|
6080
|
+
for (; i && Ze(i) && ht(i); )
|
|
6081
|
+
i = Ht(i, t);
|
|
6082
|
+
return i && U(i) && ht(i) && !mt(i) ? e : i || ei(c) || e;
|
|
6069
6083
|
}
|
|
6070
|
-
const
|
|
6071
|
-
const t = this.getOffsetParent ||
|
|
6084
|
+
const gi = async function(c) {
|
|
6085
|
+
const t = this.getOffsetParent || Jt, e = this.getDimensions, i = await e(c.floating);
|
|
6072
6086
|
return {
|
|
6073
|
-
reference:
|
|
6087
|
+
reference: ui(c.reference, await t(c.floating), c.strategy),
|
|
6074
6088
|
floating: {
|
|
6075
6089
|
x: 0,
|
|
6076
6090
|
y: 0,
|
|
@@ -6079,29 +6093,29 @@ const ui = async function(c) {
|
|
|
6079
6093
|
}
|
|
6080
6094
|
};
|
|
6081
6095
|
};
|
|
6082
|
-
function
|
|
6096
|
+
function wi(c) {
|
|
6083
6097
|
return Y(c).direction === "rtl";
|
|
6084
6098
|
}
|
|
6085
|
-
const
|
|
6086
|
-
convertOffsetParentRelativeRectToViewportRelativeRect:
|
|
6099
|
+
const Ei = {
|
|
6100
|
+
convertOffsetParentRelativeRectToViewportRelativeRect: ri,
|
|
6087
6101
|
getDocumentElement: W,
|
|
6088
|
-
getClippingRect:
|
|
6089
|
-
getOffsetParent:
|
|
6090
|
-
getElementRects:
|
|
6091
|
-
getClientRects:
|
|
6092
|
-
getDimensions:
|
|
6102
|
+
getClippingRect: fi,
|
|
6103
|
+
getOffsetParent: Jt,
|
|
6104
|
+
getElementRects: gi,
|
|
6105
|
+
getClientRects: ni,
|
|
6106
|
+
getDimensions: xi,
|
|
6093
6107
|
getScale: G,
|
|
6094
6108
|
isElement: X,
|
|
6095
|
-
isRTL:
|
|
6096
|
-
},
|
|
6109
|
+
isRTL: wi
|
|
6110
|
+
}, Qt = $e, te = Ge, ee = Ve, mi = Fe, ie = (c, t, e) => {
|
|
6097
6111
|
const i = /* @__PURE__ */ new Map(), s = {
|
|
6098
|
-
platform:
|
|
6112
|
+
platform: Ei,
|
|
6099
6113
|
...e
|
|
6100
6114
|
}, o = {
|
|
6101
6115
|
...s.platform,
|
|
6102
6116
|
_c: i
|
|
6103
6117
|
};
|
|
6104
|
-
return
|
|
6118
|
+
return We(c, t, {
|
|
6105
6119
|
...s,
|
|
6106
6120
|
platform: o
|
|
6107
6121
|
});
|
|
@@ -6127,7 +6141,7 @@ let pi = class {
|
|
|
6127
6141
|
borderRadius: "4px",
|
|
6128
6142
|
fontSize: "12px",
|
|
6129
6143
|
...o
|
|
6130
|
-
},
|
|
6144
|
+
}, l = {
|
|
6131
6145
|
position: "absolute",
|
|
6132
6146
|
width: "10px",
|
|
6133
6147
|
height: "10px",
|
|
@@ -6136,7 +6150,7 @@ let pi = class {
|
|
|
6136
6150
|
transform: "rotate(45deg)",
|
|
6137
6151
|
zIndex: a.zIndex
|
|
6138
6152
|
};
|
|
6139
|
-
Object.assign(this.arrowEl.style,
|
|
6153
|
+
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();
|
|
6140
6154
|
}
|
|
6141
6155
|
init() {
|
|
6142
6156
|
this.floatingEl.addEventListener("mouseleave", () => {
|
|
@@ -6168,7 +6182,7 @@ let pi = class {
|
|
|
6168
6182
|
return;
|
|
6169
6183
|
this.enable = !0, this.contentEl.style.maxWidth = `${t.overflowTooltipMaxWidth || 500}px`, this.contentEl.style.minWidth = "100px", this.contentEl.style.width = "100%", this.contentEl.style.display = "inline-block", this.contentEl.style.wordBreak = "break-all", this.contentEl.style.lineHeight = "1.5", this.contentEl.innerText = e;
|
|
6170
6184
|
const s = t.drawX + i.x, o = t.drawY + i.y;
|
|
6171
|
-
|
|
6185
|
+
ie({
|
|
6172
6186
|
getBoundingClientRect() {
|
|
6173
6187
|
return {
|
|
6174
6188
|
width: t.visibleWidth,
|
|
@@ -6183,12 +6197,12 @@ let pi = class {
|
|
|
6183
6197
|
}
|
|
6184
6198
|
}, this.floatingEl, {
|
|
6185
6199
|
placement: t.overflowTooltipPlacement,
|
|
6186
|
-
middleware: [
|
|
6200
|
+
middleware: [te(), ee(), Qt(6), mi({ element: this.arrowEl })]
|
|
6187
6201
|
}).then((a) => {
|
|
6188
|
-
const { x:
|
|
6202
|
+
const { x: l, y: h, placement: d, middlewareData: f } = a;
|
|
6189
6203
|
if (Object.assign(this.floatingEl.style, {
|
|
6190
|
-
top: `${
|
|
6191
|
-
left: `${
|
|
6204
|
+
top: `${h}px`,
|
|
6205
|
+
left: `${l}px`
|
|
6192
6206
|
}), f.arrow) {
|
|
6193
6207
|
const u = f.arrow;
|
|
6194
6208
|
["left", "left-start", "left-end"].includes(d) ? Object.assign(this.arrowEl.style, {
|
|
@@ -6222,7 +6236,7 @@ let pi = class {
|
|
|
6222
6236
|
this.contentEl.remove(), this.arrowEl.remove(), this.floatingEl.remove();
|
|
6223
6237
|
}
|
|
6224
6238
|
};
|
|
6225
|
-
class
|
|
6239
|
+
class yi {
|
|
6226
6240
|
constructor(t) {
|
|
6227
6241
|
n(this, "editorEl");
|
|
6228
6242
|
n(this, "inputEl");
|
|
@@ -6253,15 +6267,15 @@ class Ei {
|
|
|
6253
6267
|
return;
|
|
6254
6268
|
if (t.code === "Escape" && this.ctx.editing) {
|
|
6255
6269
|
this.cancel = !0;
|
|
6256
|
-
const { focusCell:
|
|
6257
|
-
|
|
6270
|
+
const { focusCell: l } = this.ctx;
|
|
6271
|
+
l && (this.ctx.emit("setSelectorCell", l), this.cellTarget = l), this.doneEdit();
|
|
6258
6272
|
return;
|
|
6259
6273
|
}
|
|
6260
6274
|
if ((t.altKey || t.metaKey) && t.code === "Enter" && this.ctx.editing && this.inputEl) {
|
|
6261
6275
|
t.preventDefault();
|
|
6262
|
-
const
|
|
6263
|
-
this.inputEl.value =
|
|
6264
|
-
` + d, this.inputEl.selectionStart = this.inputEl.selectionEnd =
|
|
6276
|
+
const l = this.inputEl.selectionStart, h = this.inputEl.value.substring(0, l), d = this.inputEl.value.substring(l);
|
|
6277
|
+
this.inputEl.value = h + `
|
|
6278
|
+
` + d, this.inputEl.selectionStart = this.inputEl.selectionEnd = l + 1, this.autoSize();
|
|
6265
6279
|
return;
|
|
6266
6280
|
}
|
|
6267
6281
|
if (t.code === "Tab" && this.ctx.editing) {
|
|
@@ -6337,8 +6351,8 @@ class Ei {
|
|
|
6337
6351
|
});
|
|
6338
6352
|
}
|
|
6339
6353
|
isInSelectorRange(t, e) {
|
|
6340
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a,
|
|
6341
|
-
return !(e < o || e > r || t < a || t >
|
|
6354
|
+
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a, l] = s;
|
|
6355
|
+
return !(e < o || e > r || t < a || t > l);
|
|
6342
6356
|
}
|
|
6343
6357
|
initTextEditor() {
|
|
6344
6358
|
this.inputEl = document.createElement("textarea"), this.inputEl.setAttribute("rows", "1"), this.inputEl.addEventListener("input", this.autoSize.bind(this)), this.inputEl.addEventListener("blur", () => {
|
|
@@ -6360,15 +6374,15 @@ class Ei {
|
|
|
6360
6374
|
startEditByInput(t, e = !1) {
|
|
6361
6375
|
const i = e ? null : t.getValue(), { editorType: s } = t;
|
|
6362
6376
|
t.update(), this.ctx.config.ENABLE_MERGE_CELL_LINK && t.updateSpanInfo();
|
|
6363
|
-
let { height: o, width: r, drawY: a, drawX:
|
|
6364
|
-
this.drawX =
|
|
6377
|
+
let { height: o, width: r, drawY: a, drawX: l } = t;
|
|
6378
|
+
this.drawX = l, this.drawY = a;
|
|
6365
6379
|
const {
|
|
6366
|
-
config: { CELL_PADDING:
|
|
6380
|
+
config: { CELL_PADDING: h },
|
|
6367
6381
|
header: d
|
|
6368
6382
|
} = this.ctx;
|
|
6369
6383
|
let f = this.ctx.body.visibleHeight;
|
|
6370
6384
|
if (o > f && (o = f), this.editorEl.style.display = "inline-block", this.editorEl.style.left = `${this.drawX - 1}px`, this.editorEl.style.top = `${this.drawY - 1}px`, this.editorEl.style.bottom = "auto", this.editorEl.style.maxHeight = `${f}px`, s === "text") {
|
|
6371
|
-
this.inputEl.style.display = "block", this.inputEl.style.minWidth = `${r - 1}px`, this.inputEl.style.minHeight = `${o - 1}px`, this.inputEl.style.maxHeight = `${f}px`, this.inputEl.style.width = `${r - 1}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${
|
|
6385
|
+
this.inputEl.style.display = "block", this.inputEl.style.minWidth = `${r - 1}px`, this.inputEl.style.minHeight = `${o - 1}px`, this.inputEl.style.maxHeight = `${f}px`, this.inputEl.style.width = `${r - 1}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${h}px`, i !== null && (this.inputEl.value = i), this.inputEl.focus({ preventScroll: !0 });
|
|
6372
6386
|
const u = this.inputEl.value.length;
|
|
6373
6387
|
this.inputEl.setSelectionRange(u, u);
|
|
6374
6388
|
} else
|
|
@@ -6392,22 +6406,22 @@ class Ei {
|
|
|
6392
6406
|
const { rowKey: o, key: r, editorType: a } = i;
|
|
6393
6407
|
if (a === "none")
|
|
6394
6408
|
return;
|
|
6395
|
-
const
|
|
6396
|
-
i && !
|
|
6409
|
+
const l = this.ctx.database.getReadonly(o, r);
|
|
6410
|
+
i && !l && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = i, this.startEditByInput(this.cellTarget, t), this.ctx.emit("startEdit", this.cellTarget));
|
|
6397
6411
|
}
|
|
6398
6412
|
editCell(t, e) {
|
|
6399
|
-
const i = this.ctx.body.renderRows.find((
|
|
6413
|
+
const i = this.ctx.body.renderRows.find((h) => h.rowIndex === t);
|
|
6400
6414
|
if (!i)
|
|
6401
6415
|
return;
|
|
6402
|
-
const s = i.cells.find((
|
|
6416
|
+
const s = i.cells.find((h) => h.colIndex === e);
|
|
6403
6417
|
if (!s)
|
|
6404
6418
|
return;
|
|
6405
6419
|
this.ctx.emit("setSelectorCell", s);
|
|
6406
6420
|
const o = this.ctx.focusCell;
|
|
6407
6421
|
if (!o || ["index", "index-selection", "selection"].includes(o.type) || this.enable)
|
|
6408
6422
|
return;
|
|
6409
|
-
const { rowKey: r, key: a } = o,
|
|
6410
|
-
o && !
|
|
6423
|
+
const { rowKey: r, key: a } = o, l = this.ctx.database.getReadonly(r, a);
|
|
6424
|
+
o && !l && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = o, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
6411
6425
|
}
|
|
6412
6426
|
doneEdit() {
|
|
6413
6427
|
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"));
|
|
@@ -6420,31 +6434,31 @@ class Ei {
|
|
|
6420
6434
|
(t = this.editorEl) == null || t.remove();
|
|
6421
6435
|
}
|
|
6422
6436
|
}
|
|
6423
|
-
class
|
|
6437
|
+
let Ci = class {
|
|
6424
6438
|
constructor(t) {
|
|
6425
6439
|
n(this, "ctx");
|
|
6426
6440
|
n(this, "emptyEl");
|
|
6427
6441
|
this.ctx = t;
|
|
6428
6442
|
const { EMPTY_TEXT: e, EMPTY_CUSTOM_STYLE: i } = this.ctx.config;
|
|
6429
6443
|
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 }) => {
|
|
6430
|
-
const
|
|
6444
|
+
const l = o + (r + a) / 2, h = {
|
|
6431
6445
|
display: s === "empty" ? "block" : "none",
|
|
6432
6446
|
position: "absolute",
|
|
6433
6447
|
fontSize: "14px",
|
|
6434
6448
|
color: "#666",
|
|
6435
6449
|
left: "50%",
|
|
6436
|
-
top: `${
|
|
6450
|
+
top: `${l}px`,
|
|
6437
6451
|
transform: "translate(-50%, -50%)",
|
|
6438
6452
|
...i
|
|
6439
6453
|
};
|
|
6440
|
-
Object.assign(this.emptyEl.style,
|
|
6454
|
+
Object.assign(this.emptyEl.style, h);
|
|
6441
6455
|
});
|
|
6442
6456
|
}
|
|
6443
6457
|
destroy() {
|
|
6444
6458
|
this.emptyEl.remove();
|
|
6445
6459
|
}
|
|
6446
|
-
}
|
|
6447
|
-
class
|
|
6460
|
+
};
|
|
6461
|
+
class bi {
|
|
6448
6462
|
constructor(t) {
|
|
6449
6463
|
n(this, "ctx");
|
|
6450
6464
|
n(this, "observer");
|
|
@@ -6452,11 +6466,11 @@ class Ci {
|
|
|
6452
6466
|
Z(() => {
|
|
6453
6467
|
const e = this.ctx.overlayerElement.querySelectorAll('[data-auto-height="true"]'), i = /* @__PURE__ */ new Map();
|
|
6454
6468
|
e.forEach((r) => {
|
|
6455
|
-
const a = Number(r.getAttribute("data-row-index")),
|
|
6456
|
-
if (isNaN(a) || isNaN(
|
|
6469
|
+
const a = Number(r.getAttribute("data-row-index")), l = Number(r.getAttribute("data-col-index"));
|
|
6470
|
+
if (isNaN(a) || isNaN(l) || !(r instanceof HTMLElement) || r.offsetWidth === 0)
|
|
6457
6471
|
return;
|
|
6458
|
-
const
|
|
6459
|
-
i.set(
|
|
6472
|
+
const h = `${a}_${l}`;
|
|
6473
|
+
i.set(h, Math.round(r.offsetHeight));
|
|
6460
6474
|
});
|
|
6461
6475
|
const s = this.ctx.database.getOverlayerAutoHeightMap();
|
|
6462
6476
|
if (!this.arerMapsEqual(s, i)) {
|
|
@@ -6497,9 +6511,9 @@ class Ci {
|
|
|
6497
6511
|
fixedRightWidth: e,
|
|
6498
6512
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
6499
6513
|
} = this.ctx, { visibleWidth: o, visibleHeight: r, renderCellHeaders: a } = this.ctx.header;
|
|
6500
|
-
let
|
|
6514
|
+
let l = [], h = [], d = [];
|
|
6501
6515
|
a.forEach((g) => {
|
|
6502
|
-
g.render && (g.fixed === "left" ?
|
|
6516
|
+
g.render && (g.fixed === "left" ? h.push(g) : g.fixed === "right" ? d.push(g) : l.push(g));
|
|
6503
6517
|
});
|
|
6504
6518
|
const f = e - i, u = {
|
|
6505
6519
|
key: "left",
|
|
@@ -6511,7 +6525,7 @@ class Ci {
|
|
|
6511
6525
|
width: `${t}px`,
|
|
6512
6526
|
height: `${r}px`
|
|
6513
6527
|
},
|
|
6514
|
-
cells:
|
|
6528
|
+
cells: h
|
|
6515
6529
|
}, x = {
|
|
6516
6530
|
key: "center",
|
|
6517
6531
|
style: {
|
|
@@ -6522,7 +6536,7 @@ class Ci {
|
|
|
6522
6536
|
width: `${o - t - f + 1}px`,
|
|
6523
6537
|
height: `${r}px`
|
|
6524
6538
|
},
|
|
6525
|
-
cells:
|
|
6539
|
+
cells: l
|
|
6526
6540
|
}, w = {
|
|
6527
6541
|
key: "right",
|
|
6528
6542
|
style: {
|
|
@@ -6551,15 +6565,15 @@ class Ci {
|
|
|
6551
6565
|
const t = [], e = [], i = [];
|
|
6552
6566
|
let s = this.ctx.body.renderRows;
|
|
6553
6567
|
this.ctx.config.FOOTER_FIXED || (s = s.concat(this.ctx.footer.renderRows)), s.forEach((g) => {
|
|
6554
|
-
g.cells.forEach((
|
|
6555
|
-
|
|
6568
|
+
g.cells.forEach((m) => {
|
|
6569
|
+
m.cellType === "footer" && (m.render = m.renderFooter), m.render && (m.fixed === "left" ? e.push(m) : m.fixed === "right" ? i.push(m) : t.push(m));
|
|
6556
6570
|
});
|
|
6557
6571
|
});
|
|
6558
6572
|
const {
|
|
6559
6573
|
fixedLeftWidth: o,
|
|
6560
6574
|
fixedRightWidth: r,
|
|
6561
|
-
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX:
|
|
6562
|
-
} = this.ctx, { visibleWidth:
|
|
6575
|
+
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX: l }
|
|
6576
|
+
} = this.ctx, { visibleWidth: h, visibleHeight: d } = this.ctx.body, f = r - a, u = {
|
|
6563
6577
|
key: "left",
|
|
6564
6578
|
style: {
|
|
6565
6579
|
position: "absolute",
|
|
@@ -6577,7 +6591,7 @@ class Ci {
|
|
|
6577
6591
|
top: `${0.5}px`,
|
|
6578
6592
|
left: `${o - 0.5}px`,
|
|
6579
6593
|
overflow: "hidden",
|
|
6580
|
-
width: `${
|
|
6594
|
+
width: `${h - o - f}px`,
|
|
6581
6595
|
height: `${d}px`
|
|
6582
6596
|
},
|
|
6583
6597
|
cells: t
|
|
@@ -6595,11 +6609,11 @@ class Ci {
|
|
|
6595
6609
|
};
|
|
6596
6610
|
return {
|
|
6597
6611
|
type: "body",
|
|
6598
|
-
class: `${
|
|
6612
|
+
class: `${l}-overlayer-body`,
|
|
6599
6613
|
style: {
|
|
6600
6614
|
position: "relative",
|
|
6601
6615
|
overflow: "hidden",
|
|
6602
|
-
width: `${
|
|
6616
|
+
width: `${h}px`,
|
|
6603
6617
|
height: `${d}px`
|
|
6604
6618
|
},
|
|
6605
6619
|
views: [u, x, w]
|
|
@@ -6607,8 +6621,8 @@ class Ci {
|
|
|
6607
6621
|
}
|
|
6608
6622
|
getFooter() {
|
|
6609
6623
|
const t = [], e = [], i = [];
|
|
6610
|
-
this.ctx.footer.renderRows.forEach((
|
|
6611
|
-
|
|
6624
|
+
this.ctx.footer.renderRows.forEach((E) => {
|
|
6625
|
+
E.cells.forEach((g) => {
|
|
6612
6626
|
g.cellType === "footer" && g.renderFooter && (g.render = g.renderFooter, g.fixed === "left" ? e.push(g) : g.fixed === "right" ? i.push(g) : t.push(g));
|
|
6613
6627
|
});
|
|
6614
6628
|
});
|
|
@@ -6616,7 +6630,7 @@ class Ci {
|
|
|
6616
6630
|
fixedLeftWidth: s,
|
|
6617
6631
|
fixedRightWidth: o,
|
|
6618
6632
|
config: { SCROLLER_TRACK_SIZE: r, CSS_PREFIX: a }
|
|
6619
|
-
} = this.ctx, { visibleWidth:
|
|
6633
|
+
} = this.ctx, { visibleWidth: l, visibleHeight: h } = this.ctx.footer, d = o - r, f = {
|
|
6620
6634
|
key: "left",
|
|
6621
6635
|
style: {
|
|
6622
6636
|
position: "absolute",
|
|
@@ -6624,7 +6638,7 @@ class Ci {
|
|
|
6624
6638
|
left: `${0.5}px`,
|
|
6625
6639
|
overflow: "hidden",
|
|
6626
6640
|
width: `${s}px`,
|
|
6627
|
-
height: `${
|
|
6641
|
+
height: `${h}px`
|
|
6628
6642
|
},
|
|
6629
6643
|
cells: e
|
|
6630
6644
|
}, u = {
|
|
@@ -6634,8 +6648,8 @@ class Ci {
|
|
|
6634
6648
|
top: `${0.5}px`,
|
|
6635
6649
|
left: `${s - 0.5}px`,
|
|
6636
6650
|
overflow: "hidden",
|
|
6637
|
-
width: `${
|
|
6638
|
-
height: `${
|
|
6651
|
+
width: `${l - s - d}px`,
|
|
6652
|
+
height: `${h}px`
|
|
6639
6653
|
},
|
|
6640
6654
|
cells: t
|
|
6641
6655
|
}, x = {
|
|
@@ -6646,7 +6660,7 @@ class Ci {
|
|
|
6646
6660
|
right: `${0.5}px`,
|
|
6647
6661
|
overflow: "hidden",
|
|
6648
6662
|
width: `${d}px`,
|
|
6649
|
-
height: `${
|
|
6663
|
+
height: `${h}px`
|
|
6650
6664
|
},
|
|
6651
6665
|
cells: i
|
|
6652
6666
|
};
|
|
@@ -6656,14 +6670,14 @@ class Ci {
|
|
|
6656
6670
|
style: {
|
|
6657
6671
|
position: "relative",
|
|
6658
6672
|
overflow: "hidden",
|
|
6659
|
-
width: `${
|
|
6660
|
-
height: `${
|
|
6673
|
+
width: `${l}px`,
|
|
6674
|
+
height: `${h}px`
|
|
6661
6675
|
},
|
|
6662
6676
|
views: [f, u, x]
|
|
6663
6677
|
};
|
|
6664
6678
|
}
|
|
6665
6679
|
}
|
|
6666
|
-
class
|
|
6680
|
+
class Ii {
|
|
6667
6681
|
constructor(t) {
|
|
6668
6682
|
n(this, "ctx");
|
|
6669
6683
|
n(this, "contextMenuEl");
|
|
@@ -6674,8 +6688,8 @@ class bi {
|
|
|
6674
6688
|
this.ctx.on("cellContextMenuClick", (t, e) => {
|
|
6675
6689
|
if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
|
|
6676
6690
|
e.preventDefault();
|
|
6677
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a,
|
|
6678
|
-
|
|
6691
|
+
const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a, l] = s, { rowIndex: h, colIndex: d } = t;
|
|
6692
|
+
h >= a && h <= l && d >= o && d <= r || this.ctx.emit("setSelectorCell", t, e);
|
|
6679
6693
|
const u = {
|
|
6680
6694
|
getBoundingClientRect: () => ({
|
|
6681
6695
|
width: 0,
|
|
@@ -6689,9 +6703,9 @@ class bi {
|
|
|
6689
6703
|
}),
|
|
6690
6704
|
contextElement: document.body
|
|
6691
6705
|
};
|
|
6692
|
-
|
|
6706
|
+
ie(u, this.contextMenuEl, {
|
|
6693
6707
|
placement: "right-start",
|
|
6694
|
-
middleware: [
|
|
6708
|
+
middleware: [Qt(), te(), ee()]
|
|
6695
6709
|
}).then(({ x, y: w }) => {
|
|
6696
6710
|
this.show(x, w);
|
|
6697
6711
|
});
|
|
@@ -6749,7 +6763,37 @@ class bi {
|
|
|
6749
6763
|
this.contextMenuEl.remove();
|
|
6750
6764
|
}
|
|
6751
6765
|
}
|
|
6752
|
-
class
|
|
6766
|
+
class Ri {
|
|
6767
|
+
constructor(t) {
|
|
6768
|
+
n(this, "ctx");
|
|
6769
|
+
n(this, "loadingEl");
|
|
6770
|
+
if (this.ctx = t, this.ctx.loadingElement)
|
|
6771
|
+
this.loadingEl = this.ctx.loadingElement;
|
|
6772
|
+
else {
|
|
6773
|
+
this.loadingEl = document.createElement("div");
|
|
6774
|
+
const e = document.createElement("div");
|
|
6775
|
+
e.className = "e-virt-table-loading-spinner";
|
|
6776
|
+
const i = this.ctx.icons.getSvg("loading");
|
|
6777
|
+
if (i) {
|
|
6778
|
+
const a = new DOMParser().parseFromString(i.svg, "image/svg+xml").documentElement;
|
|
6779
|
+
e.appendChild(a);
|
|
6780
|
+
}
|
|
6781
|
+
const s = document.createElement("p");
|
|
6782
|
+
s.className = "e-virt-table-loading-text", s.innerText = this.ctx.config.LOADING_TEXT, e.appendChild(s), this.loadingEl.appendChild(e);
|
|
6783
|
+
}
|
|
6784
|
+
this.loadingEl.className = "e-virt-table-loading", this.loadingEl.style.display = "none", this.ctx.containerElement.appendChild(this.loadingEl);
|
|
6785
|
+
}
|
|
6786
|
+
show() {
|
|
6787
|
+
this.loadingEl.style.display = "flex";
|
|
6788
|
+
}
|
|
6789
|
+
hide() {
|
|
6790
|
+
this.loadingEl.style.display = "none";
|
|
6791
|
+
}
|
|
6792
|
+
destroy() {
|
|
6793
|
+
this.loadingEl.remove();
|
|
6794
|
+
}
|
|
6795
|
+
}
|
|
6796
|
+
class Ti {
|
|
6753
6797
|
constructor(t, e) {
|
|
6754
6798
|
n(this, "options");
|
|
6755
6799
|
n(this, "scroller");
|
|
@@ -6763,6 +6807,7 @@ class vi {
|
|
|
6763
6807
|
n(this, "empty");
|
|
6764
6808
|
n(this, "overlayer");
|
|
6765
6809
|
n(this, "contextMenu");
|
|
6810
|
+
n(this, "loading");
|
|
6766
6811
|
n(this, "ctx");
|
|
6767
6812
|
this.options = e;
|
|
6768
6813
|
const { overlayerElement: i, editorElement: s, emptyElement: o, contextMenuElement: r } = this.options, a = this.createContainer(
|
|
@@ -6772,7 +6817,7 @@ class vi {
|
|
|
6772
6817
|
o,
|
|
6773
6818
|
r
|
|
6774
6819
|
);
|
|
6775
|
-
this.ctx = new Re(a, this.options), this.header = new
|
|
6820
|
+
this.ctx = new Re(a, this.options), this.header = new _e(this.ctx), this.footer = new Te(this.ctx), this.body = new ve(this.ctx), this.scroller = new Se(this.ctx), this.selector = new Oe(this.ctx), this.autofill = new Le(this.ctx), this.tooltip = new pi(this.ctx), this.empty = new Ci(this.ctx), this.editor = new yi(this.ctx), this.overlayer = new bi(this.ctx), this.contextMenu = new Ii(this.ctx), this.loading = new Ri(this.ctx), this.ctx.on(
|
|
6776
6821
|
"draw",
|
|
6777
6822
|
Z(
|
|
6778
6823
|
() => {
|
|
@@ -6792,17 +6837,17 @@ class vi {
|
|
|
6792
6837
|
}
|
|
6793
6838
|
createContainer(t, e, i, s, o) {
|
|
6794
6839
|
t.className = "e-virt-table-container";
|
|
6795
|
-
const r = document.createElement("div"), a = document.createElement("canvas"),
|
|
6796
|
-
r.className = "e-virt-table-stage", t.tabIndex = 0, a.className = "e-virt-table-canvas",
|
|
6797
|
-
const
|
|
6798
|
-
|
|
6840
|
+
const r = document.createElement("div"), a = document.createElement("canvas"), l = e || document.createElement("div");
|
|
6841
|
+
r.className = "e-virt-table-stage", t.tabIndex = 0, a.className = "e-virt-table-canvas", l.className = "e-virt-table-overlayer";
|
|
6842
|
+
const h = i || document.createElement("div");
|
|
6843
|
+
h.className = "e-virt-table-editor";
|
|
6799
6844
|
const d = s, f = o;
|
|
6800
|
-
return r.appendChild(a), r.appendChild(
|
|
6845
|
+
return r.appendChild(a), r.appendChild(l), t.appendChild(r), {
|
|
6801
6846
|
containerElement: t,
|
|
6802
6847
|
stageElement: r,
|
|
6803
6848
|
canvasElement: a,
|
|
6804
|
-
overlayerElement:
|
|
6805
|
-
editorElement:
|
|
6849
|
+
overlayerElement: l,
|
|
6850
|
+
editorElement: h,
|
|
6806
6851
|
emptyElement: d,
|
|
6807
6852
|
contextMenuElement: f
|
|
6808
6853
|
};
|
|
@@ -6830,7 +6875,7 @@ class vi {
|
|
|
6830
6875
|
this.ctx.database.setFooterData(t), this.ctx.emit("draw");
|
|
6831
6876
|
}
|
|
6832
6877
|
setLoading(t) {
|
|
6833
|
-
this.ctx.
|
|
6878
|
+
this.ctx.loading = t, t ? this.loading.show() : this.loading.hide();
|
|
6834
6879
|
}
|
|
6835
6880
|
on(t, e) {
|
|
6836
6881
|
this.ctx.on(t, e);
|
|
@@ -6894,15 +6939,15 @@ class vi {
|
|
|
6894
6939
|
return new Promise(async (i, s) => {
|
|
6895
6940
|
let o = [];
|
|
6896
6941
|
for (let r = 0; r < t.length; r++) {
|
|
6897
|
-
const { rowKey: a, key:
|
|
6898
|
-
Array.isArray(
|
|
6942
|
+
const { rowKey: a, key: l } = t[r], h = await this.ctx.database.getValidator(a, l);
|
|
6943
|
+
Array.isArray(h) && h.length && o.push(h);
|
|
6899
6944
|
}
|
|
6900
6945
|
if (o.length) {
|
|
6901
6946
|
if (s(o), e) {
|
|
6902
6947
|
const [r] = o;
|
|
6903
6948
|
if (Array.isArray(r) && r.length) {
|
|
6904
|
-
const [a] = r, { rowKey:
|
|
6905
|
-
this.scrollToRowkey(
|
|
6949
|
+
const [a] = r, { rowKey: l, key: h } = a;
|
|
6950
|
+
this.scrollToRowkey(l), this.scrollToColkey(h);
|
|
6906
6951
|
}
|
|
6907
6952
|
}
|
|
6908
6953
|
this.ctx.emit("draw");
|
|
@@ -6919,12 +6964,12 @@ class vi {
|
|
|
6919
6964
|
if (t && Array.isArray(s) && s.length) {
|
|
6920
6965
|
const [o] = s;
|
|
6921
6966
|
if (Array.isArray(o) && o.length) {
|
|
6922
|
-
const [r] = o, { rowKey: a, key:
|
|
6923
|
-
if (
|
|
6924
|
-
const { parentRowKeys: d = [] } =
|
|
6967
|
+
const [r] = o, { rowKey: a, key: l } = r, h = this.ctx.database.getRowForRowKey(a);
|
|
6968
|
+
if (h) {
|
|
6969
|
+
const { parentRowKeys: d = [] } = h;
|
|
6925
6970
|
d && d.length && this.setExpandRowKeys(d, !0);
|
|
6926
6971
|
}
|
|
6927
|
-
this.scrollToRowkey(a), this.scrollToColkey(
|
|
6972
|
+
this.scrollToRowkey(a), this.scrollToColkey(l);
|
|
6928
6973
|
}
|
|
6929
6974
|
}
|
|
6930
6975
|
i(s);
|
|
@@ -6949,7 +6994,7 @@ class vi {
|
|
|
6949
6994
|
let o = [];
|
|
6950
6995
|
for (let r = 0; r < i.length; r++)
|
|
6951
6996
|
for (let a = 0; a < s.length; a++) {
|
|
6952
|
-
const
|
|
6997
|
+
const l = this.ctx.database.getRowKeyByItem(i[r]), d = s[a].key, f = await this.ctx.database.getValidator(l, d);
|
|
6953
6998
|
Array.isArray(f) && f.length && o.push(f);
|
|
6954
6999
|
}
|
|
6955
7000
|
o.length ? (e(o), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
|
|
@@ -7032,10 +7077,10 @@ class vi {
|
|
|
7032
7077
|
}
|
|
7033
7078
|
getUtils() {
|
|
7034
7079
|
return {
|
|
7035
|
-
mergeColCell:
|
|
7036
|
-
mergeRowCell:
|
|
7037
|
-
getSpanArrByRow:
|
|
7038
|
-
getSpanObjByColumn:
|
|
7080
|
+
mergeColCell: fe,
|
|
7081
|
+
mergeRowCell: de,
|
|
7082
|
+
getSpanArrByRow: Xt,
|
|
7083
|
+
getSpanObjByColumn: Yt
|
|
7039
7084
|
};
|
|
7040
7085
|
}
|
|
7041
7086
|
getColumnByKey(t) {
|
|
@@ -7046,10 +7091,10 @@ class vi {
|
|
|
7046
7091
|
* 销毁
|
|
7047
7092
|
*/
|
|
7048
7093
|
destroy() {
|
|
7049
|
-
this.overlayer.destroy(), this.empty.destroy(), this.editor.destroy(), this.tooltip.destroy(), this.selector.destroy(), this.autofill.destroy(), this.contextMenu.destroy(), this.ctx.destroy(), this.ctx.containerElement.remove();
|
|
7094
|
+
this.overlayer.destroy(), this.empty.destroy(), this.editor.destroy(), this.tooltip.destroy(), this.selector.destroy(), this.autofill.destroy(), this.contextMenu.destroy(), this.loading.destroy(), this.ctx.destroy(), this.ctx.containerElement.remove();
|
|
7050
7095
|
}
|
|
7051
7096
|
}
|
|
7052
7097
|
export {
|
|
7053
|
-
|
|
7098
|
+
Ti as default
|
|
7054
7099
|
};
|
|
7055
7100
|
//# sourceMappingURL=index.es.js.map
|