e-virt-table 0.1.15 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +738 -716
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Cell.d.ts +1 -0
- package/dist/lib/Cell.js +1 -0
- package/dist/lib/Cell.js.map +1 -1
- package/dist/lib/CellHeader.d.ts +1 -0
- package/dist/lib/CellHeader.js +1 -0
- package/dist/lib/CellHeader.js.map +1 -1
- package/dist/lib/Config.d.ts +0 -1
- package/dist/lib/Config.js +0 -6
- package/dist/lib/Config.js.map +1 -1
- package/dist/lib/Context.d.ts +4 -0
- package/dist/lib/Context.js +15 -1
- package/dist/lib/Context.js.map +1 -1
- package/dist/lib/ContextMenu.d.ts +1 -0
- package/dist/lib/ContextMenu.js +18 -2
- package/dist/lib/ContextMenu.js.map +1 -1
- package/dist/lib/EVirtTable.js +7 -3
- package/dist/lib/EVirtTable.js.map +1 -1
- package/dist/lib/Empty.js +9 -8
- package/dist/lib/Empty.js.map +1 -1
- package/dist/lib/EventBrowser.js +0 -2
- package/dist/lib/EventBrowser.js.map +1 -1
- package/dist/lib/Selector.d.ts +1 -0
- package/dist/lib/Selector.js +9 -1
- package/dist/lib/Selector.js.map +1 -1
- package/dist/lib/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(":root{--e-virt-table-color-white: #fff;--e-virt-table-color-black: #000000;--e-virt-table-color-primary: rgb(82, 146, 247);--e-virt-table-text-color-primary: #333;--e-virt-table-text-color-regular: #666;--e-virt-table-text-color-secondary: #999;--e-virt-table-box-shadow: 0 2px 12px 0 #0000001a;--e-virt-table-editor-bg-color: #fff;--e-virt-table-border-color: #e1e6eb}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;z-index:10;border-radius:8px;border:1px solid var(--e-virt-table-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(--e-virt-table-editor-bg-color);border:2px solid var(--e-virt-table-color-primary);box-sizing:border-box;box-shadow:var(--e-virt-table-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(--e-virt-table-color-white);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--e-virt-table-text-color-regular);background-color:var(--e-virt-table-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--e-virt-table-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(--e-virt-table-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--e-virt-table-color-primary);background-color:#f5f7fa}")),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
2
|
var me = Object.defineProperty;
|
|
3
3
|
var Ee = (n, t, e) => t in n ? me(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
4
|
-
var
|
|
4
|
+
var l = (n, t, e) => Ee(n, typeof t != "symbol" ? t + "" : t, e);
|
|
5
5
|
function $() {
|
|
6
6
|
return $ = Object.assign ? Object.assign.bind() : function(n) {
|
|
7
7
|
for (var t = 1; t < arguments.length; t++) {
|
|
@@ -39,7 +39,7 @@ function dt(n, t, e) {
|
|
|
39
39
|
return Ce() ? dt = Reflect.construct.bind() : dt = function(s, r, o) {
|
|
40
40
|
var a = [null];
|
|
41
41
|
a.push.apply(a, r);
|
|
42
|
-
var
|
|
42
|
+
var h = Function.bind.apply(s, a), c = new h();
|
|
43
43
|
return o && st(c, o.prototype), c;
|
|
44
44
|
}, dt.apply(null, arguments);
|
|
45
45
|
}
|
|
@@ -169,9 +169,9 @@ function Te(n, t, e, i, s) {
|
|
|
169
169
|
return x;
|
|
170
170
|
}), r;
|
|
171
171
|
}
|
|
172
|
-
var o = t.firstFields === !0 ? Object.keys(n) : t.firstFields || [], a = Object.keys(n),
|
|
172
|
+
var o = t.firstFields === !0 ? Object.keys(n) : t.firstFields || [], a = Object.keys(n), h = a.length, c = 0, f = [], d = new Promise(function(x, u) {
|
|
173
173
|
var g = function(p) {
|
|
174
|
-
if (f.push.apply(f, p), c++, c ===
|
|
174
|
+
if (f.push.apply(f, p), c++, c === h)
|
|
175
175
|
return i(f), f.length ? u(new Xt(f, Ct(f))) : x(s);
|
|
176
176
|
};
|
|
177
177
|
a.length || (i(f), x(s)), a.forEach(function(w) {
|
|
@@ -234,17 +234,17 @@ var jt = function(t, e, i, s, r, o) {
|
|
|
234
234
|
(?:` + i + ":){1}(?:(?::" + i + "){0,4}:" + e + "|(?::" + i + `){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
|
|
235
235
|
(?::(?:(?::` + i + "){0,5}:" + e + "|(?::" + i + `){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
|
|
236
236
|
)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
|
|
237
|
-
`).replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(), r = new RegExp("(?:^" + e + "$)|(?:^" + s + "$)"), o = new RegExp("^" + e + "$"), a = new RegExp("^" + s + "$"),
|
|
237
|
+
`).replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(), r = new RegExp("(?:^" + e + "$)|(?:^" + s + "$)"), o = new RegExp("^" + e + "$"), a = new RegExp("^" + s + "$"), h = function(E) {
|
|
238
238
|
return E && E.exact ? r : new RegExp("(?:" + t(E) + e + t(E) + ")|(?:" + t(E) + s + t(E) + ")", "g");
|
|
239
239
|
};
|
|
240
|
-
|
|
240
|
+
h.v4 = function(m) {
|
|
241
241
|
return m && m.exact ? o : new RegExp("" + t(m) + e + t(m), "g");
|
|
242
|
-
},
|
|
242
|
+
}, h.v6 = function(m) {
|
|
243
243
|
return m && m.exact ? a : new RegExp("" + t(m) + s + t(m), "g");
|
|
244
244
|
};
|
|
245
|
-
var c = "(?:(?:[a-z]+:)?//)", f = "(?:\\S+(?::\\S*)?@)?", d =
|
|
245
|
+
var c = "(?:(?:[a-z]+:)?//)", f = "(?:\\S+(?::\\S*)?@)?", d = h.v4().source, x = h.v6().source, u = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)", g = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*", w = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))", p = "(?::\\d{2,5})?", y = '(?:[/?#][^\\s"]*)?', b = "(?:" + c + "|www\\.)" + f + "(?:localhost|" + d + "|" + x + "|" + u + g + w + ")" + p + y;
|
|
246
246
|
return ct = new RegExp("(?:^" + b + "$)", "i"), ct;
|
|
247
|
-
},
|
|
247
|
+
}, Kt = {
|
|
248
248
|
// http://emailregex.com/
|
|
249
249
|
email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,
|
|
250
250
|
// url: new RegExp(
|
|
@@ -284,13 +284,13 @@ var jt = function(t, e, i, s, r, o) {
|
|
|
284
284
|
return typeof t == "function";
|
|
285
285
|
},
|
|
286
286
|
email: function(t) {
|
|
287
|
-
return typeof t == "string" && t.length <= 320 && !!t.match(
|
|
287
|
+
return typeof t == "string" && t.length <= 320 && !!t.match(Kt.email);
|
|
288
288
|
},
|
|
289
289
|
url: function(t) {
|
|
290
290
|
return typeof t == "string" && t.length <= 2048 && !!t.match(Me());
|
|
291
291
|
},
|
|
292
292
|
hex: function(t) {
|
|
293
|
-
return typeof t == "string" && !!t.match(
|
|
293
|
+
return typeof t == "string" && !!t.match(Kt.hex);
|
|
294
294
|
}
|
|
295
295
|
}, He = function(t, e, i, s, r) {
|
|
296
296
|
if (t.required && e === void 0) {
|
|
@@ -300,10 +300,10 @@ var jt = function(t, e, i, s, r, o) {
|
|
|
300
300
|
var o = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"], a = t.type;
|
|
301
301
|
o.indexOf(a) > -1 ? et[a](e) || s.push(M(r.messages.types[a], t.fullField, t.type)) : a && typeof e !== t.type && s.push(M(r.messages.types[a], t.fullField, t.type));
|
|
302
302
|
}, De = function(t, e, i, s, r) {
|
|
303
|
-
var o = typeof t.len == "number", a = typeof t.min == "number",
|
|
303
|
+
var o = typeof t.len == "number", a = typeof t.min == "number", h = typeof t.max == "number", c = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, f = e, d = null, x = typeof e == "number", u = typeof e == "string", g = Array.isArray(e);
|
|
304
304
|
if (x ? d = "number" : u ? d = "string" : g && (d = "array"), !d)
|
|
305
305
|
return !1;
|
|
306
|
-
g && (f = e.length), u && (f = e.replace(c, "_").length), o ? f !== t.len && s.push(M(r.messages[d].len, t.fullField, t.len)) : a && !
|
|
306
|
+
g && (f = e.length), u && (f = e.replace(c, "_").length), o ? f !== t.len && s.push(M(r.messages[d].len, t.fullField, t.len)) : a && !h && f < t.min ? s.push(M(r.messages[d].min, t.fullField, t.min)) : h && !a && f > t.max ? s.push(M(r.messages[d].max, t.fullField, t.max)) : a && h && (f < t.min || f > t.max) && s.push(M(r.messages[d].range, t.fullField, t.min, t.max));
|
|
307
307
|
}, j = "enum", Fe = function(t, e, i, s, r) {
|
|
308
308
|
t[j] = Array.isArray(t[j]) ? t[j] : [], t[j].indexOf(e) === -1 && s.push(M(r.messages[j], t.fullField, t[j].join(", ")));
|
|
309
309
|
}, Xe = function(t, e, i, s, r) {
|
|
@@ -338,7 +338,7 @@ var jt = function(t, e, i, s, r, o) {
|
|
|
338
338
|
v.required(t, e, s, o, r), e !== void 0 && v.type(t, e, s, o, r);
|
|
339
339
|
}
|
|
340
340
|
i(o);
|
|
341
|
-
},
|
|
341
|
+
}, Ke = function(t, e, i, s, r) {
|
|
342
342
|
var o = [], a = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
343
343
|
if (a) {
|
|
344
344
|
if (e === "" && (e = void 0), _(e) && !t.required)
|
|
@@ -346,7 +346,7 @@ var jt = function(t, e, i, s, r, o) {
|
|
|
346
346
|
v.required(t, e, s, o, r), e !== void 0 && (v.type(t, e, s, o, r), v.range(t, e, s, o, r));
|
|
347
347
|
}
|
|
348
348
|
i(o);
|
|
349
|
-
},
|
|
349
|
+
}, Ye = function(t, e, i, s, r) {
|
|
350
350
|
var o = [], a = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
351
351
|
if (a) {
|
|
352
352
|
if (_(e) && !t.required)
|
|
@@ -416,8 +416,8 @@ var jt = function(t, e, i, s, r, o) {
|
|
|
416
416
|
if (_(e, "date") && !t.required)
|
|
417
417
|
return i();
|
|
418
418
|
if (v.required(t, e, s, o, r), !_(e, "date")) {
|
|
419
|
-
var
|
|
420
|
-
e instanceof Date ?
|
|
419
|
+
var h;
|
|
420
|
+
e instanceof Date ? h = e : h = new Date(e), v.type(t, h, s, o, r), h && v.range(t, h.getTime(), s, o, r);
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
i(o);
|
|
@@ -425,8 +425,8 @@ var jt = function(t, e, i, s, r, o) {
|
|
|
425
425
|
var o = [], a = Array.isArray(e) ? "array" : typeof e;
|
|
426
426
|
v.required(t, e, s, o, r, a), i(o);
|
|
427
427
|
}, yt = function(t, e, i, s, r) {
|
|
428
|
-
var o = t.type, a = [],
|
|
429
|
-
if (
|
|
428
|
+
var o = t.type, a = [], h = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
429
|
+
if (h) {
|
|
430
430
|
if (_(e, o) && !t.required)
|
|
431
431
|
return i();
|
|
432
432
|
v.required(t, e, s, a, r, o), _(e, o) || v.type(t, e, s, a, r);
|
|
@@ -443,8 +443,8 @@ var jt = function(t, e, i, s, r, o) {
|
|
|
443
443
|
}, it = {
|
|
444
444
|
string: ke,
|
|
445
445
|
method: Ne,
|
|
446
|
-
number:
|
|
447
|
-
boolean:
|
|
446
|
+
number: Ke,
|
|
447
|
+
boolean: Ye,
|
|
448
448
|
regexp: Be,
|
|
449
449
|
integer: We,
|
|
450
450
|
float: Pe,
|
|
@@ -533,8 +533,8 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
533
533
|
var o = this;
|
|
534
534
|
s === void 0 && (s = {}), r === void 0 && (r = function() {
|
|
535
535
|
});
|
|
536
|
-
var a = i,
|
|
537
|
-
if (typeof
|
|
536
|
+
var a = i, h = s, c = r;
|
|
537
|
+
if (typeof h == "function" && (c = h, h = {}), !this.rules || Object.keys(this.rules).length === 0)
|
|
538
538
|
return c && c(null, a), Promise.resolve(a);
|
|
539
539
|
function f(w) {
|
|
540
540
|
var p = [], y = {};
|
|
@@ -549,12 +549,12 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
549
549
|
b(w[m]);
|
|
550
550
|
p.length ? (y = Ct(p), c(p, y)) : c(null, a);
|
|
551
551
|
}
|
|
552
|
-
if (
|
|
552
|
+
if (h.messages) {
|
|
553
553
|
var d = this.messages();
|
|
554
|
-
d === Rt && (d = vt()), Nt(d,
|
|
554
|
+
d === Rt && (d = vt()), Nt(d, h.messages), h.messages = d;
|
|
555
555
|
} else
|
|
556
|
-
|
|
557
|
-
var x = {}, u =
|
|
556
|
+
h.messages = this.messages();
|
|
557
|
+
var x = {}, u = h.keys || Object.keys(this.rules);
|
|
558
558
|
u.forEach(function(w) {
|
|
559
559
|
var p = o.rules[w], y = a[w];
|
|
560
560
|
p.forEach(function(b) {
|
|
@@ -570,7 +570,7 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
570
570
|
});
|
|
571
571
|
});
|
|
572
572
|
var g = {};
|
|
573
|
-
return Te(x,
|
|
573
|
+
return Te(x, h, function(w, p) {
|
|
574
574
|
var y = w.rule, b = (y.type === "object" || y.type === "array") && (typeof y.fields == "object" || typeof y.defaultField == "object");
|
|
575
575
|
b = b && (y.required || !y.required && w.value), y.field = w.field;
|
|
576
576
|
function m(R, T) {
|
|
@@ -582,15 +582,15 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
582
582
|
function E(R) {
|
|
583
583
|
R === void 0 && (R = []);
|
|
584
584
|
var T = Array.isArray(R) ? R : [R];
|
|
585
|
-
!
|
|
585
|
+
!h.suppressWarning && T.length && n.warning("async-validator:", T), T.length && y.message !== void 0 && (T = [].concat(y.message));
|
|
586
586
|
var A = T.map(kt(y, a));
|
|
587
|
-
if (
|
|
587
|
+
if (h.first && A.length)
|
|
588
588
|
return g[y.field] = 1, p(A);
|
|
589
589
|
if (!b)
|
|
590
590
|
p(A);
|
|
591
591
|
else {
|
|
592
592
|
if (y.required && !w.value)
|
|
593
|
-
return y.message !== void 0 ? A = [].concat(y.message).map(kt(y, a)) :
|
|
593
|
+
return y.message !== void 0 ? A = [].concat(y.message).map(kt(y, a)) : h.error && (A = [h.error(y, M(h.messages.required, y.field))]), p(A);
|
|
594
594
|
var L = {};
|
|
595
595
|
y.defaultField && Object.keys(w.value).map(function(I) {
|
|
596
596
|
L[I] = y.defaultField;
|
|
@@ -601,7 +601,7 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
601
601
|
D[I] = O.map(m.bind(null, I));
|
|
602
602
|
});
|
|
603
603
|
var B = new n(D);
|
|
604
|
-
B.messages(
|
|
604
|
+
B.messages(h.messages), w.rule.options && (w.rule.options.messages = h.messages, w.rule.options.error = h.error), B.validate(w.value, w.rule.options || h, function(I) {
|
|
605
605
|
var S = [];
|
|
606
606
|
A && A.length && S.push.apply(S, A), I && I.length && S.push.apply(S, I), p(S.length ? S : null);
|
|
607
607
|
});
|
|
@@ -609,12 +609,12 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
609
609
|
}
|
|
610
610
|
var C;
|
|
611
611
|
if (y.asyncValidator)
|
|
612
|
-
C = y.asyncValidator(y, w.value, E, w.source,
|
|
612
|
+
C = y.asyncValidator(y, w.value, E, w.source, h);
|
|
613
613
|
else if (y.validator) {
|
|
614
614
|
try {
|
|
615
|
-
C = y.validator(y, w.value, E, w.source,
|
|
615
|
+
C = y.validator(y, w.value, E, w.source, h);
|
|
616
616
|
} catch (R) {
|
|
617
|
-
console.error == null || console.error(R),
|
|
617
|
+
console.error == null || console.error(R), h.suppressValidatorError || setTimeout(function() {
|
|
618
618
|
throw R;
|
|
619
619
|
}, 0), E(R.message);
|
|
620
620
|
}
|
|
@@ -708,7 +708,7 @@ function _t(n = []) {
|
|
|
708
708
|
e.children ? t = t.concat(_t(e.children)) : t.push(e);
|
|
709
709
|
}), t;
|
|
710
710
|
}
|
|
711
|
-
const
|
|
711
|
+
const Yt = /^(\r\n|\n\r|\r|\n)/, Qe = /^[^\t\r\n]+/, Bt = /^\t/;
|
|
712
712
|
function ti(n) {
|
|
713
713
|
let t = [[""]];
|
|
714
714
|
if (n.length === 0)
|
|
@@ -717,17 +717,17 @@ function ti(n) {
|
|
|
717
717
|
for (; n.length > 0 && s !== n.length; )
|
|
718
718
|
if (s = n.length, n.match(Bt))
|
|
719
719
|
n = n.replace(Bt, ""), e += 1, t[i][e] = "";
|
|
720
|
-
else if (n.match(
|
|
721
|
-
n = n.replace(
|
|
720
|
+
else if (n.match(Yt))
|
|
721
|
+
n = n.replace(Yt, ""), e = 0, i += 1, t[i] = [""];
|
|
722
722
|
else {
|
|
723
723
|
let r = "";
|
|
724
724
|
if (n.startsWith('"')) {
|
|
725
725
|
let o = 0, a = !0;
|
|
726
726
|
for (; a; ) {
|
|
727
|
-
const
|
|
728
|
-
|
|
727
|
+
const h = n.slice(0, 1);
|
|
728
|
+
h === '"' && (o += 1), r += h, n = n.slice(1), (n.length === 0 || n.match(/^[\t\r\n]/) && o % 2 === 0) && (a = !1);
|
|
729
729
|
}
|
|
730
|
-
r = r.replace(/^"/, "").replace(/"$/, "").replace(/["]*/g, (
|
|
730
|
+
r = r.replace(/^"/, "").replace(/"$/, "").replace(/["]*/g, (h) => new Array(Math.floor(h.length / 2)).fill('"').join(""));
|
|
731
731
|
} else {
|
|
732
732
|
const o = n.match(Qe);
|
|
733
733
|
r = o ? o[0] : "", n = n.slice(r.length);
|
|
@@ -750,24 +750,24 @@ function ei(n) {
|
|
|
750
750
|
class ii {
|
|
751
751
|
//虚拟滚动位置
|
|
752
752
|
constructor(t, e) {
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
753
|
+
l(this, "loading", !1);
|
|
754
|
+
l(this, "ctx");
|
|
755
|
+
l(this, "data");
|
|
756
|
+
l(this, "columns");
|
|
757
|
+
l(this, "footerData", []);
|
|
758
|
+
l(this, "rowKeyMap", /* @__PURE__ */ new Map());
|
|
759
|
+
l(this, "colIndexKeyMap", /* @__PURE__ */ new Map());
|
|
760
|
+
l(this, "headerMap", /* @__PURE__ */ new Map());
|
|
761
|
+
l(this, "rowIndexRowKeyMap", /* @__PURE__ */ new Map());
|
|
762
|
+
l(this, "checkboxKeyMap", /* @__PURE__ */ new Map());
|
|
763
|
+
l(this, "originalDataMap", /* @__PURE__ */ new Map());
|
|
764
|
+
l(this, "changedDataMap", /* @__PURE__ */ new Map());
|
|
765
|
+
l(this, "validationErrorMap", /* @__PURE__ */ new Map());
|
|
766
|
+
l(this, "itemRowKeyMap", /* @__PURE__ */ new WeakMap());
|
|
767
|
+
l(this, "bufferData", []);
|
|
768
|
+
l(this, "sumHeight", 0);
|
|
769
|
+
l(this, "filterMethod");
|
|
770
|
+
l(this, "positions", []);
|
|
771
771
|
this.ctx = t;
|
|
772
772
|
const { data: i = [], columns: s = [], footerData: r = [] } = e;
|
|
773
773
|
this.data = i, this.footerData = r, this.columns = s, this.setLoading(!0), this.init();
|
|
@@ -790,9 +790,9 @@ class ii {
|
|
|
790
790
|
t.forEach((i, s) => {
|
|
791
791
|
let r = i._hasChildren || !1;
|
|
792
792
|
Array.isArray(i.children) && i.children.length && (r = !0, this.initData(i.children, e + 1));
|
|
793
|
-
const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: a, CELL_HEIGHT:
|
|
793
|
+
const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: a, CELL_HEIGHT: h, SELECTABLE_METHOD: c, CHECKBOX_KEY: f } = this.ctx.config, d = i[o], x = d != null ? `${d}` : Ut();
|
|
794
794
|
this.itemRowKeyMap.set(i, x);
|
|
795
|
-
const u = i._height ||
|
|
795
|
+
const u = i._height || h, g = i._readonly;
|
|
796
796
|
let w = !0;
|
|
797
797
|
if (typeof c == "function" && (w = c), f) {
|
|
798
798
|
const p = i[f];
|
|
@@ -874,12 +874,12 @@ class ii {
|
|
|
874
874
|
const i = (r) => {
|
|
875
875
|
r.forEach((o) => {
|
|
876
876
|
t.push(o);
|
|
877
|
-
const a = this.itemRowKeyMap.get(o), { expand:
|
|
877
|
+
const a = this.itemRowKeyMap.get(o), { expand: h, hasChildren: c, height: f } = this.rowKeyMap.get(a), d = this.sumHeight;
|
|
878
878
|
this.sumHeight += f, this.rowIndexRowKeyMap.set(e, a), this.positions.push({
|
|
879
879
|
top: d,
|
|
880
880
|
height: f,
|
|
881
881
|
bottom: this.sumHeight
|
|
882
|
-
}), e += 1,
|
|
882
|
+
}), e += 1, h && c && i(o.children);
|
|
883
883
|
});
|
|
884
884
|
};
|
|
885
885
|
this.rowIndexRowKeyMap.clear();
|
|
@@ -1035,7 +1035,7 @@ class ii {
|
|
|
1035
1035
|
});
|
|
1036
1036
|
});
|
|
1037
1037
|
let a = [];
|
|
1038
|
-
const
|
|
1038
|
+
const h = i.map((f) => {
|
|
1039
1039
|
const d = this.ctx.database.getRowDataItemForRowKey(f.rowKey);
|
|
1040
1040
|
return {
|
|
1041
1041
|
rowKey: f.rowKey,
|
|
@@ -1047,10 +1047,10 @@ class ii {
|
|
|
1047
1047
|
s.forEach((f) => {
|
|
1048
1048
|
a.push(this.ctx.database.getRowDataItemForRowKey(f));
|
|
1049
1049
|
});
|
|
1050
|
-
const c =
|
|
1050
|
+
const c = h.map(({ rowKey: f, key: d }) => this.getValidator(f, d));
|
|
1051
1051
|
Promise.all(c).then(() => {
|
|
1052
1052
|
this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
|
|
1053
|
-
}), this.ctx.emit("change",
|
|
1053
|
+
}), this.ctx.emit("change", h, a), e && this.ctx.history.pushState({
|
|
1054
1054
|
changeList: i,
|
|
1055
1055
|
scrollX: this.ctx.scrollX,
|
|
1056
1056
|
scrollY: this.ctx.scrollY,
|
|
@@ -1071,15 +1071,15 @@ class ii {
|
|
|
1071
1071
|
if (!this.rowKeyMap.has(t))
|
|
1072
1072
|
return {};
|
|
1073
1073
|
const { item: a } = this.rowKeyMap.get(t);
|
|
1074
|
-
let
|
|
1074
|
+
let h = a[e];
|
|
1075
1075
|
if (this.ctx.database.getReadonly(t, e))
|
|
1076
1076
|
return {
|
|
1077
|
-
oldValue:
|
|
1078
|
-
newValue:
|
|
1077
|
+
oldValue: h,
|
|
1078
|
+
newValue: h
|
|
1079
1079
|
};
|
|
1080
|
-
a[e] !== null && typeof a[e] == "object" && (
|
|
1080
|
+
a[e] !== null && typeof a[e] == "object" && (h = JSON.parse(JSON.stringify(a[e])));
|
|
1081
1081
|
const c = `${t}_${e}`;
|
|
1082
|
-
this.originalDataMap.has(c) || this.originalDataMap.set(c,
|
|
1082
|
+
this.originalDataMap.has(c) || this.originalDataMap.set(c, h);
|
|
1083
1083
|
const f = this.originalDataMap.get(c);
|
|
1084
1084
|
let d = i;
|
|
1085
1085
|
if (o) {
|
|
@@ -1108,7 +1108,7 @@ class ii {
|
|
|
1108
1108
|
}), this.ctx.emit("change", [g], [u]), this.ctx.emit("editChange", {
|
|
1109
1109
|
rowKey: t,
|
|
1110
1110
|
key: e,
|
|
1111
|
-
oldValue:
|
|
1111
|
+
oldValue: h,
|
|
1112
1112
|
value: d,
|
|
1113
1113
|
originalValue: f,
|
|
1114
1114
|
row: u
|
|
@@ -1118,7 +1118,7 @@ class ii {
|
|
|
1118
1118
|
return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
|
|
1119
1119
|
rowKey: t,
|
|
1120
1120
|
key: e,
|
|
1121
|
-
oldValue:
|
|
1121
|
+
oldValue: h,
|
|
1122
1122
|
value: d,
|
|
1123
1123
|
originalValue: this.originalDataMap.get(c),
|
|
1124
1124
|
row: this.ctx.database.getRowDataItemForRowKey(t)
|
|
@@ -1130,12 +1130,12 @@ class ii {
|
|
|
1130
1130
|
{
|
|
1131
1131
|
rowKey: t,
|
|
1132
1132
|
key: e,
|
|
1133
|
-
oldValue:
|
|
1133
|
+
oldValue: h,
|
|
1134
1134
|
newValue: d
|
|
1135
1135
|
}
|
|
1136
1136
|
]
|
|
1137
1137
|
}), r && this.ctx.emit("draw"), {
|
|
1138
|
-
oldValue:
|
|
1138
|
+
oldValue: h,
|
|
1139
1139
|
newValue: d
|
|
1140
1140
|
};
|
|
1141
1141
|
}
|
|
@@ -1162,8 +1162,8 @@ class ii {
|
|
|
1162
1162
|
return !1;
|
|
1163
1163
|
const { item: s } = this.rowKeyMap.get(t), r = s[i];
|
|
1164
1164
|
this.checkboxKeyMap.has(r) && this.checkboxKeyMap.get(r).forEach((a) => {
|
|
1165
|
-
const
|
|
1166
|
-
|
|
1165
|
+
const h = this.rowKeyMap.get(a);
|
|
1166
|
+
h.check = e;
|
|
1167
1167
|
});
|
|
1168
1168
|
}
|
|
1169
1169
|
}
|
|
@@ -1346,7 +1346,7 @@ class ii {
|
|
|
1346
1346
|
getValidator(t, e) {
|
|
1347
1347
|
return new Promise((i) => {
|
|
1348
1348
|
const s = this.rowKeyMap.get(t), r = this.headerMap.get(e), { BODY_CELL_RULES_METHOD: o } = this.ctx.config, a = r.column;
|
|
1349
|
-
let
|
|
1349
|
+
let h = a.rules;
|
|
1350
1350
|
if (typeof o == "function") {
|
|
1351
1351
|
const f = o({
|
|
1352
1352
|
row: s.item,
|
|
@@ -1355,12 +1355,12 @@ class ii {
|
|
|
1355
1355
|
column: a,
|
|
1356
1356
|
value: this.getItemValue(t, e)
|
|
1357
1357
|
});
|
|
1358
|
-
f && (
|
|
1358
|
+
f && (h = f);
|
|
1359
1359
|
}
|
|
1360
|
-
if (
|
|
1360
|
+
if (h) {
|
|
1361
1361
|
let c = {}, f = {};
|
|
1362
|
-
if (f[e] = this.getItemValue(t, e), Array.isArray(
|
|
1363
|
-
const x =
|
|
1362
|
+
if (f[e] = this.getItemValue(t, e), Array.isArray(h) && h.length) {
|
|
1363
|
+
const x = h.map((u) => ({
|
|
1364
1364
|
...u,
|
|
1365
1365
|
row: s.item,
|
|
1366
1366
|
column: a,
|
|
@@ -1370,7 +1370,7 @@ class ii {
|
|
|
1370
1370
|
c[e] = x;
|
|
1371
1371
|
} else
|
|
1372
1372
|
c[e] = {
|
|
1373
|
-
...
|
|
1373
|
+
...h,
|
|
1374
1374
|
row: s.item,
|
|
1375
1375
|
column: a,
|
|
1376
1376
|
rowIndex: s.rowIndex,
|
|
@@ -1429,9 +1429,9 @@ class ii {
|
|
|
1429
1429
|
}
|
|
1430
1430
|
class si {
|
|
1431
1431
|
constructor(t) {
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1432
|
+
l(this, "ctx");
|
|
1433
|
+
l(this, "history", []);
|
|
1434
|
+
l(this, "historyIndex", -1);
|
|
1435
1435
|
this.ctx = t, this.init();
|
|
1436
1436
|
}
|
|
1437
1437
|
init() {
|
|
@@ -1486,8 +1486,8 @@ class si {
|
|
|
1486
1486
|
}
|
|
1487
1487
|
class ri {
|
|
1488
1488
|
constructor(t) {
|
|
1489
|
-
|
|
1490
|
-
|
|
1489
|
+
l(this, "eventTasks", /* @__PURE__ */ new Map());
|
|
1490
|
+
l(this, "ctx");
|
|
1491
1491
|
this.ctx = t, this.init();
|
|
1492
1492
|
}
|
|
1493
1493
|
init() {
|
|
@@ -1502,10 +1502,10 @@ class ri {
|
|
|
1502
1502
|
this.ctx.emit("resetHeader", t), this.ctx.emit("resize", t);
|
|
1503
1503
|
}
|
|
1504
1504
|
handleMouseDown(t) {
|
|
1505
|
-
t.
|
|
1505
|
+
t.button === 0 && (this.ctx.mousedown = !0), this.ctx.emit("mousedown", t);
|
|
1506
1506
|
}
|
|
1507
1507
|
handleMousemove(t) {
|
|
1508
|
-
|
|
1508
|
+
this.ctx.emit("mousemove", t);
|
|
1509
1509
|
}
|
|
1510
1510
|
handleMouseUp(t) {
|
|
1511
1511
|
t.button === 0 && (this.ctx.mousedown = !1), this.ctx.emit("mouseup", t);
|
|
@@ -1541,7 +1541,7 @@ class ri {
|
|
|
1541
1541
|
}
|
|
1542
1542
|
class oi {
|
|
1543
1543
|
constructor() {
|
|
1544
|
-
|
|
1544
|
+
l(this, "events", /* @__PURE__ */ new Map());
|
|
1545
1545
|
}
|
|
1546
1546
|
has(t) {
|
|
1547
1547
|
return this.events.has(t);
|
|
@@ -1579,7 +1579,7 @@ class oi {
|
|
|
1579
1579
|
}
|
|
1580
1580
|
class ni {
|
|
1581
1581
|
constructor(t) {
|
|
1582
|
-
|
|
1582
|
+
l(this, "ctx");
|
|
1583
1583
|
const e = t.getContext("2d");
|
|
1584
1584
|
if (!e) throw new Error("canvas context not found");
|
|
1585
1585
|
this.ctx = e;
|
|
@@ -1613,21 +1613,21 @@ class ni {
|
|
|
1613
1613
|
* @param {string} color - 阴影的颜色
|
|
1614
1614
|
*/
|
|
1615
1615
|
drawShadow(t, e, i, s, r) {
|
|
1616
|
-
const { fillColor: o, side: a, shadowWidth:
|
|
1616
|
+
const { fillColor: o, side: a, shadowWidth: h, colorStart: c, colorEnd: f } = r;
|
|
1617
1617
|
this.ctx.save(), o && (this.ctx.fillStyle = o, this.ctx.fillRect(t, e, i, s));
|
|
1618
1618
|
let d;
|
|
1619
1619
|
switch (a) {
|
|
1620
1620
|
case "left":
|
|
1621
|
-
d = this.ctx.createLinearGradient(t -
|
|
1621
|
+
d = this.ctx.createLinearGradient(t - h, e, t, e), d.addColorStop(0, c), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t - h, e, h, s);
|
|
1622
1622
|
break;
|
|
1623
1623
|
case "right":
|
|
1624
|
-
d = this.ctx.createLinearGradient(t + i, e, t + i +
|
|
1624
|
+
d = this.ctx.createLinearGradient(t + i, e, t + i + h, e), d.addColorStop(0, c), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t + i, e, h, s);
|
|
1625
1625
|
break;
|
|
1626
1626
|
case "top":
|
|
1627
|
-
d = this.ctx.createLinearGradient(t, e -
|
|
1627
|
+
d = this.ctx.createLinearGradient(t, e - h, t, e), d.addColorStop(0, c), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t, e - h, i, h);
|
|
1628
1628
|
break;
|
|
1629
1629
|
case "bottom":
|
|
1630
|
-
d = this.ctx.createLinearGradient(t, e + s, t, e + s +
|
|
1630
|
+
d = this.ctx.createLinearGradient(t, e + s, t, e + s + h), d.addColorStop(0, c), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t, e + s, i, h);
|
|
1631
1631
|
break;
|
|
1632
1632
|
default:
|
|
1633
1633
|
console.error("Invalid side specified for shadow");
|
|
@@ -1648,11 +1648,11 @@ class ni {
|
|
|
1648
1648
|
drawImage(t, e, i, s, r) {
|
|
1649
1649
|
this.ctx.save(), this.ctx.drawImage(t, e, i, s, r), this.ctx.restore();
|
|
1650
1650
|
}
|
|
1651
|
-
drawRect(t, e, i, s, { borderWidth: r = 1, borderColor: o, fillColor: a, radius:
|
|
1652
|
-
if (this.ctx.save(), this.ctx.beginPath(), a !== void 0 && (this.ctx.fillStyle = a), o !== void 0 && (this.ctx.lineWidth = r, this.ctx.strokeStyle = o),
|
|
1651
|
+
drawRect(t, e, i, s, { borderWidth: r = 1, borderColor: o, fillColor: a, radius: h = 0 } = {}) {
|
|
1652
|
+
if (this.ctx.save(), this.ctx.beginPath(), a !== void 0 && (this.ctx.fillStyle = a), o !== void 0 && (this.ctx.lineWidth = r, this.ctx.strokeStyle = o), h === 0)
|
|
1653
1653
|
this.ctx.rect(t - 0.5, e - 0.5, i, s);
|
|
1654
1654
|
else {
|
|
1655
|
-
const [c, f, d, x] = typeof
|
|
1655
|
+
const [c, f, d, x] = typeof h == "number" ? [h, h, h, h] : h;
|
|
1656
1656
|
this.ctx.moveTo(t + c, e), this.ctx.arcTo(t + i, e, t + i, e + f, f), this.ctx.arcTo(t + i, e + s, t + i - d, e + s, d), this.ctx.arcTo(t, e + s, t, e + s - x, x), this.ctx.arcTo(t, e, t + c, e, c);
|
|
1657
1657
|
}
|
|
1658
1658
|
a !== void 0 && this.ctx.fill(), o !== void 0 && this.ctx.stroke(), this.ctx.restore();
|
|
@@ -1671,16 +1671,16 @@ class ni {
|
|
|
1671
1671
|
this.ctx.save();
|
|
1672
1672
|
const {
|
|
1673
1673
|
font: a = "12px Arial",
|
|
1674
|
-
align:
|
|
1674
|
+
align: h = "center",
|
|
1675
1675
|
color: c = "#495060",
|
|
1676
1676
|
padding: f = 0,
|
|
1677
1677
|
verticalAlign: d = "middle"
|
|
1678
1678
|
} = o;
|
|
1679
|
-
this.ctx.font = a, this.ctx.fillStyle = c, this.ctx.textBaseline = d, this.ctx.textAlign =
|
|
1679
|
+
this.ctx.font = a, this.ctx.fillStyle = c, this.ctx.textBaseline = d, this.ctx.textAlign = h;
|
|
1680
1680
|
let x = 0;
|
|
1681
1681
|
d === "top" ? x = i + f : d === "bottom" ? x = i + r - f : x = i + (r + 1) / 2;
|
|
1682
1682
|
let u = 0;
|
|
1683
|
-
|
|
1683
|
+
h === "left" ? u = e + f : h === "right" ? u = e + s - f : u = e + s / 2;
|
|
1684
1684
|
const { _text: g, ellipsis: w } = this.handleEllipsis(t, s, f, a);
|
|
1685
1685
|
return this.ctx.fillText(g, u, x), this.ctx.restore(), w;
|
|
1686
1686
|
}
|
|
@@ -1691,8 +1691,8 @@ class ni {
|
|
|
1691
1691
|
_text: "",
|
|
1692
1692
|
ellipsis: r
|
|
1693
1693
|
};
|
|
1694
|
-
const a = this.ctx.measureText("...").width,
|
|
1695
|
-
if (
|
|
1694
|
+
const a = this.ctx.measureText("...").width, h = this.ctx.measureText(t).width;
|
|
1695
|
+
if (h && h + a >= e - i * 2) {
|
|
1696
1696
|
r = !0;
|
|
1697
1697
|
let c = 0;
|
|
1698
1698
|
for (let f = 0; f < t.length; f++)
|
|
@@ -1709,132 +1709,131 @@ class ni {
|
|
|
1709
1709
|
}
|
|
1710
1710
|
class Wt {
|
|
1711
1711
|
constructor(t) {
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
h(this, "ENABLE_HEADER_STICKY", !1);
|
|
1712
|
+
l(this, "PROCESSOR_NUM", 50);
|
|
1713
|
+
l(this, "CSS_PREFIX", "e-virt-table");
|
|
1714
|
+
l(this, "ICONS", []);
|
|
1715
|
+
l(this, "ROW_KEY", "");
|
|
1716
|
+
l(this, "HEADER_FONT", "12px normal Arial");
|
|
1717
|
+
l(this, "BODY_FONT", "12px normal Arial");
|
|
1718
|
+
l(this, "BORDER_COLOR", "#e1e6eb");
|
|
1719
|
+
l(this, "WIDTH", 0);
|
|
1720
|
+
l(this, "RESIZE_MIN_WIDTH", 40);
|
|
1721
|
+
l(this, "HEIGHT", 0);
|
|
1722
|
+
l(this, "EMPTY_BODY_HEIGHT", 120);
|
|
1723
|
+
l(this, "EMPTY_CUSTOM_STYLE", {});
|
|
1724
|
+
l(this, "EMPTY_TEXT", "暂无数据");
|
|
1725
|
+
l(this, "MAX_HEIGHT", 1e3);
|
|
1726
|
+
l(this, "BORDER_RADIUS", 8);
|
|
1727
|
+
l(this, "ENABLE_OFFSET_HEIGHT", !1);
|
|
1728
|
+
l(this, "OFFSET_HEIGHT", 0);
|
|
1729
|
+
l(this, "HEADER_HEIGHT", 36);
|
|
1730
|
+
l(this, "ENABLE_HEADER_STICKY", !1);
|
|
1732
1731
|
// 启用头部固定,需要外面实现覆盖层,或者所有表头都要是元素
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1732
|
+
l(this, "HEADER_BG_COLOR", "#F8FAFF");
|
|
1733
|
+
l(this, "BODY_BG_COLOR", "#FFF");
|
|
1734
|
+
l(this, "HEADER_TEXT_COLOR", "#1D2129");
|
|
1735
|
+
l(this, "LOADING_ICON_SVG", "");
|
|
1736
|
+
l(this, "LOADING_ICON_COLOR", "#4E5969");
|
|
1737
|
+
l(this, "EXPAND_ICON_SVG", "");
|
|
1738
|
+
l(this, "SHRINK_ICON_SVG", "");
|
|
1739
|
+
l(this, "EXPAND_ICON_COLOR", "#4E5969");
|
|
1740
|
+
l(this, "SHRINK_ICON_COLOR", "#4E5969");
|
|
1741
|
+
l(this, "ERROR_TIP_ICON_COLOR", "red");
|
|
1742
|
+
l(this, "ERROR_TIP_ICON_SIZE", 6);
|
|
1743
|
+
l(this, "EXPAND_LAZY", !0);
|
|
1744
|
+
l(this, "DEFAULT_EXPAND_ALL", !1);
|
|
1745
|
+
l(this, "CELL_WIDTH", 100);
|
|
1746
|
+
l(this, "CELL_HEIGHT", 36);
|
|
1747
|
+
l(this, "CELL_PADDING", 8);
|
|
1748
|
+
l(this, "CELL_HOVER_ICON_SIZE", 20);
|
|
1749
|
+
l(this, "SCROLLER_TRACK_SIZE", 14);
|
|
1750
|
+
l(this, "SCROLLER_SIZE", 8);
|
|
1751
|
+
l(this, "SCROLLER_COLOR", "#dee0e3");
|
|
1752
|
+
l(this, "SCROLLER_TRACK_COLOR", "#fff");
|
|
1753
|
+
l(this, "SCROLLER_FOCUS_COLOR", "#bbbec4");
|
|
1754
|
+
l(this, "SELECT_BORDER_COLOR", "rgb(82,146,247)");
|
|
1755
|
+
l(this, "SELECT_AREA_COLOR", "rgba(82,146,247,0.1)");
|
|
1756
|
+
l(this, "SELECT_BG_COLOR", "rgba(82,146,247,0.1)");
|
|
1757
|
+
l(this, "EDIT_BG_COLOR", "#fcf6ed");
|
|
1758
|
+
l(this, "CHECKBOX_KEY", "");
|
|
1759
|
+
l(this, "CHECKBOX_COLOR", "rgb(82,146,247)");
|
|
1760
|
+
l(this, "CHECKBOX_SIZE", 20);
|
|
1761
|
+
l(this, "CHECKBOX_DISABLED_SVG", "");
|
|
1762
|
+
l(this, "CHECKBOX_CHECK_SVG", "");
|
|
1763
|
+
l(this, "CHECKBOX_UNCHECK_SVG", "");
|
|
1764
|
+
l(this, "CHECKBOX_INDETERMINATE_SVG", "");
|
|
1765
|
+
l(this, "READONLY_COLOR", "#fff");
|
|
1766
|
+
l(this, "READONLY_TEXT_COLOR", "#4E5969");
|
|
1767
|
+
l(this, "ERROR_TIP_COLOR", "#ED3F14");
|
|
1768
|
+
l(this, "FOOTER_BG_COLOR", "#fafafa");
|
|
1769
|
+
l(this, "FOOTER_FIXED", !0);
|
|
1770
|
+
l(this, "CELL_FOOTER_HEIGHT", 36);
|
|
1771
|
+
l(this, "ENABLE_SELECTOR", !1);
|
|
1772
|
+
l(this, "ENABLE_EDIT_SINGLE_CLICK", !1);
|
|
1774
1773
|
// 启用单点击立马编辑
|
|
1775
|
-
|
|
1774
|
+
l(this, "ENABLE_EDIT_CLICK_SELECTOR", !0);
|
|
1776
1775
|
// 启用点击选择器编辑
|
|
1777
|
-
|
|
1776
|
+
l(this, "SELECTOR_AREA_MIN_X", 0);
|
|
1778
1777
|
// 选择器X最小范围
|
|
1779
|
-
|
|
1778
|
+
l(this, "SELECTOR_AREA_MAX_X_OFFSET", 0);
|
|
1780
1779
|
// 选择器X最大范围colMax - offset
|
|
1781
|
-
|
|
1780
|
+
l(this, "SELECTOR_AREA_MAX_X", 0);
|
|
1782
1781
|
// 选择器X最大范围,0默认最大colMax
|
|
1783
|
-
|
|
1782
|
+
l(this, "SELECTOR_AREA_MIN_Y", 0);
|
|
1784
1783
|
// 选择器Y最小范围
|
|
1785
|
-
|
|
1784
|
+
l(this, "SELECTOR_AREA_MAX_Y", 0);
|
|
1786
1785
|
// 选择器Y最大范围,0默认rowMax
|
|
1787
|
-
|
|
1786
|
+
l(this, "SELECTOR_AREA_MAX_Y_OFFSET", 0);
|
|
1788
1787
|
// 选择器Y最大范围,0默认rowMax
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1788
|
+
l(this, "ENABLE_SELECTOR_SINGLE", !1);
|
|
1789
|
+
l(this, "ENABLE_SELECTOR_SPAN_COL", !0);
|
|
1790
|
+
l(this, "ENABLE_SELECTOR_SPAN_ROW", !0);
|
|
1791
|
+
l(this, "ENABLE_SELECTOR_ALL_ROWS", !0);
|
|
1792
|
+
l(this, "ENABLE_SELECTOR_ALL_COLS", !0);
|
|
1793
|
+
l(this, "ENABLE_AUTOFILL", !1);
|
|
1794
|
+
l(this, "ENABLE_CONTEXT_MENU", !1);
|
|
1795
|
+
l(this, "ENABLE_COPY", !0);
|
|
1796
|
+
l(this, "ENABLE_PASTER", !0);
|
|
1797
|
+
l(this, "ENABLE_RESIZE_ROW", !0);
|
|
1798
|
+
l(this, "ENABLE_RESIZE_COLUMN", !0);
|
|
1799
|
+
l(this, "RESIZE_ROW_LINE_COLOR", "#e1e6eb");
|
|
1800
|
+
l(this, "RESIZE_COLUMN_LINE_COLOR", "#e1e6eb");
|
|
1801
|
+
l(this, "RESIZE_ROW_MIN_HEIGHT", 36);
|
|
1802
|
+
l(this, "RESIZE_COLUMN_MIN_WIDTH", 40);
|
|
1803
|
+
l(this, "ENABLE_KEYBOARD", !0);
|
|
1804
|
+
l(this, "ENABLE_HISTORY", !1);
|
|
1805
|
+
l(this, "ENABLE_VALIDATOR_IMMEDIATE", !0);
|
|
1806
|
+
l(this, "HISTORY_NUM", 50);
|
|
1807
|
+
l(this, "HIGHLIGHT_HOVER_ROW", !1);
|
|
1808
|
+
l(this, "HIGHLIGHT_HOVER_ROW_COLOR", "rgba(186,203,231,0.1)");
|
|
1809
|
+
l(this, "HIGHLIGHT_SELECTED_ROW", !1);
|
|
1810
|
+
l(this, "HIGHLIGHT_SELECTED_ROW_COLOR", "rgba(82,146,247,0.1)");
|
|
1811
|
+
l(this, "TOOLTIP_BG_COLOR", "#303133");
|
|
1812
|
+
l(this, "TOOLTIP_TEXT_COLOR", "#fff");
|
|
1813
|
+
l(this, "TOOLTIP_ZINDEX", 3e3);
|
|
1814
|
+
l(this, "TOOLTIP_CUSTOM_STYLE", {});
|
|
1815
|
+
l(this, "CONTEXT_MENU", [
|
|
1817
1816
|
{ label: "复制", value: "copy" },
|
|
1818
1817
|
{ label: "剪切", value: "cut" },
|
|
1819
1818
|
{ label: "粘贴", value: "paste" },
|
|
1820
1819
|
{ label: "清空选中内容", value: "clearSelected" }
|
|
1821
1820
|
]);
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1821
|
+
l(this, "HEADER_CELL_STYLE_METHOD");
|
|
1822
|
+
l(this, "BODY_CELL_STYLE_METHOD");
|
|
1823
|
+
l(this, "FOOTER_CELL_STYLE_METHOD");
|
|
1824
|
+
l(this, "BODY_CELL_READONLY_METHOD");
|
|
1825
|
+
l(this, "BODY_CELL_FORMATTER_METHOD");
|
|
1826
|
+
l(this, "BODY_CELL_RULES_METHOD");
|
|
1827
|
+
l(this, "BODY_CELL_TYPE_METHOD");
|
|
1828
|
+
l(this, "BODY_CELL_EDITOR_TYPE_METHOD");
|
|
1829
|
+
l(this, "BODY_CELL_RENDER_METHOD");
|
|
1830
|
+
l(this, "BODY_CELL_HOVER_ICON_METHOD");
|
|
1831
|
+
l(this, "SPAN_METHOD");
|
|
1832
|
+
l(this, "SELECTABLE_METHOD");
|
|
1833
|
+
l(this, "EXPAND_LAZY_METHOD");
|
|
1834
|
+
l(this, "BEFORE_VALUE_CHANGE_METHOD");
|
|
1835
|
+
l(this, "BEFORE_PASTE_CHANGE_METHOD");
|
|
1836
|
+
l(this, "BEFORE_AUTOFILL_CHANGE_METHOD");
|
|
1838
1837
|
Object.assign(this, t);
|
|
1839
1838
|
}
|
|
1840
1839
|
init(t) {
|
|
@@ -1843,8 +1842,8 @@ class Wt {
|
|
|
1843
1842
|
}
|
|
1844
1843
|
class ai {
|
|
1845
1844
|
constructor(t) {
|
|
1846
|
-
|
|
1847
|
-
|
|
1845
|
+
l(this, "ctx");
|
|
1846
|
+
l(this, "list", [
|
|
1848
1847
|
{
|
|
1849
1848
|
name: "loading",
|
|
1850
1849
|
configName: "LOADING_ICON_SVG",
|
|
@@ -1906,7 +1905,7 @@ class ai {
|
|
|
1906
1905
|
color: ""
|
|
1907
1906
|
}
|
|
1908
1907
|
]);
|
|
1909
|
-
|
|
1908
|
+
l(this, "icons", /* @__PURE__ */ new Map());
|
|
1910
1909
|
this.ctx = t, this.init();
|
|
1911
1910
|
}
|
|
1912
1911
|
async init() {
|
|
@@ -1940,8 +1939,8 @@ class ai {
|
|
|
1940
1939
|
});
|
|
1941
1940
|
const o = new Image(), a = new Blob([new XMLSerializer().serializeToString(r)], {
|
|
1942
1941
|
type: "image/svg+xml"
|
|
1943
|
-
}),
|
|
1944
|
-
return o.src =
|
|
1942
|
+
}), h = URL.createObjectURL(a);
|
|
1943
|
+
return o.src = h, new Promise((c, f) => {
|
|
1945
1944
|
o.onerror = () => f(new Error("Failed to load image")), o.onload = () => {
|
|
1946
1945
|
c(o);
|
|
1947
1946
|
};
|
|
@@ -1953,13 +1952,13 @@ class ai {
|
|
|
1953
1952
|
}
|
|
1954
1953
|
class te {
|
|
1955
1954
|
constructor(t, e, i, s, r, o, a) {
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1955
|
+
l(this, "ctx");
|
|
1956
|
+
l(this, "x", 0);
|
|
1957
|
+
l(this, "y", 0);
|
|
1958
|
+
l(this, "width", 0);
|
|
1959
|
+
l(this, "height", 0);
|
|
1960
|
+
l(this, "fixed");
|
|
1961
|
+
l(this, "cellType");
|
|
1963
1962
|
this.ctx = t, this.x = e, this.y = i, this.width = s, this.height = r, this.fixed = o, this.cellType = a;
|
|
1964
1963
|
}
|
|
1965
1964
|
isHorizontalVisible() {
|
|
@@ -1998,57 +1997,57 @@ class te {
|
|
|
1998
1997
|
}
|
|
1999
1998
|
}
|
|
2000
1999
|
class ee extends te {
|
|
2001
|
-
constructor(e, i, s, r, o, a,
|
|
2002
|
-
super(e, r, o, a,
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2000
|
+
constructor(e, i, s, r, o, a, h, c, f, d = "body") {
|
|
2001
|
+
super(e, r, o, a, h, c.fixed, d);
|
|
2002
|
+
l(this, "formatter");
|
|
2003
|
+
l(this, "formatterFooter");
|
|
2004
|
+
l(this, "hoverIconName", "");
|
|
2005
|
+
l(this, "operation", !1);
|
|
2006
|
+
l(this, "align");
|
|
2007
|
+
l(this, "verticalAlign");
|
|
2008
|
+
l(this, "fixed");
|
|
2009
|
+
l(this, "type");
|
|
2010
|
+
l(this, "editorType");
|
|
2011
|
+
l(this, "cellType");
|
|
2012
|
+
l(this, "level");
|
|
2013
|
+
l(this, "colspan", 1);
|
|
2014
|
+
l(this, "rowspan", 1);
|
|
2015
|
+
l(this, "key");
|
|
2016
|
+
l(this, "column");
|
|
2017
|
+
l(this, "rowIndex");
|
|
2018
|
+
l(this, "colIndex");
|
|
2019
|
+
l(this, "rowKey");
|
|
2020
|
+
l(this, "row");
|
|
2021
|
+
l(this, "value");
|
|
2022
|
+
l(this, "render");
|
|
2023
|
+
l(this, "renderFooter");
|
|
2024
|
+
l(this, "style", {});
|
|
2025
|
+
l(this, "rules", {});
|
|
2026
|
+
l(this, "message", "");
|
|
2027
|
+
l(this, "text", "");
|
|
2028
|
+
l(this, "displayText", "");
|
|
2029
|
+
l(this, "visibleWidth", 0);
|
|
2030
|
+
l(this, "visibleHeight", 0);
|
|
2031
|
+
l(this, "isHasChanged", !1);
|
|
2032
|
+
l(this, "drawX", 0);
|
|
2033
|
+
l(this, "drawY", 0);
|
|
2034
|
+
l(this, "drawCellBgColor", "");
|
|
2035
|
+
l(this, "drawCellSkyBgColor", "");
|
|
2036
|
+
l(this, "drawTextColor", "");
|
|
2037
|
+
l(this, "drawTextX", 0);
|
|
2038
|
+
l(this, "drawTextY", 0);
|
|
2039
|
+
l(this, "drawImageX", 0);
|
|
2040
|
+
l(this, "drawImageY", 0);
|
|
2041
|
+
l(this, "drawImageWidth", 0);
|
|
2042
|
+
l(this, "drawImageHeight", 0);
|
|
2043
|
+
l(this, "drawImageName", "");
|
|
2044
|
+
l(this, "drawImageSource");
|
|
2045
|
+
l(this, "ellipsis", !1);
|
|
2046
|
+
l(this, "rowExpand", !1);
|
|
2047
|
+
l(this, "rowHasChildren", !1);
|
|
2048
|
+
l(this, "overflowTooltipShow", !0);
|
|
2049
|
+
l(this, "overflowTooltipMaxWidth", 500);
|
|
2050
|
+
l(this, "overflowTooltipPlacement", "top");
|
|
2052
2051
|
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = c.key, this.type = c.type || "text", this.editorType = c.editorType || "text", this.cellType = d, this.align = c.align || "center", this.verticalAlign = c.verticalAlign || "middle", this.fixed = c.fixed, this.level = c.level, this.operation = c.operation || !1, this.column = c, this.rules = c.rules, this.row = f, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = c.render, this.overflowTooltipShow = c.overflowTooltipShow !== !1, this.overflowTooltipMaxWidth = c.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = c.overflowTooltipPlacement || "top", this.renderFooter = c.renderFooter, this.hoverIconName = c.hoverIconName, this.formatter = c.formatter, this.formatterFooter = c.formatterFooter, this.update();
|
|
2053
2052
|
}
|
|
2054
2053
|
getValidationMessage() {
|
|
@@ -2143,7 +2142,7 @@ class ee extends te {
|
|
|
2143
2142
|
const { CELL_PADDING: e = 0 } = this.ctx.config, { rowKey: i, cellType: s } = this;
|
|
2144
2143
|
let r, o = 0, a = "";
|
|
2145
2144
|
if (this.type === "tree" && s === "body") {
|
|
2146
|
-
const
|
|
2145
|
+
const h = this.ctx.database.getRowForRowKey(i), { expand: c = !1, hasChildren: f = !1, expandLoading: d = !1, level: x = 0 } = h || {};
|
|
2147
2146
|
if (this.rowExpand = c, this.rowHasChildren = f, d) {
|
|
2148
2147
|
const u = this.ctx.icons.get("loading");
|
|
2149
2148
|
a = "loading", r = u, o = x * 8;
|
|
@@ -2166,7 +2165,7 @@ class ee extends te {
|
|
|
2166
2165
|
FOOTER_CELL_STYLE_METHOD: r,
|
|
2167
2166
|
READONLY_TEXT_COLOR: o,
|
|
2168
2167
|
FOOTER_BG_COLOR: a,
|
|
2169
|
-
HIGHLIGHT_SELECTED_ROW:
|
|
2168
|
+
HIGHLIGHT_SELECTED_ROW: h,
|
|
2170
2169
|
HIGHLIGHT_SELECTED_ROW_COLOR: c,
|
|
2171
2170
|
HIGHLIGHT_HOVER_ROW: f,
|
|
2172
2171
|
HIGHLIGHT_HOVER_ROW_COLOR: d
|
|
@@ -2188,7 +2187,7 @@ class ee extends te {
|
|
|
2188
2187
|
}
|
|
2189
2188
|
let x = "transparent";
|
|
2190
2189
|
const u = this.ctx.focusCell, g = this.ctx.hoverCell;
|
|
2191
|
-
f && (g == null ? void 0 : g.rowKey) === this.rowKey && (x = d),
|
|
2190
|
+
f && (g == null ? void 0 : g.rowKey) === this.rowKey && (x = d), h && (u == null ? void 0 : u.rowKey) === this.rowKey && (x = c), this.drawCellSkyBgColor = x;
|
|
2192
2191
|
let w = e, p = o;
|
|
2193
2192
|
if (["index", "index-selection", "selection"].includes(this.type)) {
|
|
2194
2193
|
this.drawCellBgColor = e, this.drawTextColor = o;
|
|
@@ -2208,24 +2207,24 @@ class ee extends te {
|
|
|
2208
2207
|
this.drawCellBgColor = w, this.drawTextColor = p;
|
|
2209
2208
|
}
|
|
2210
2209
|
updateSelection() {
|
|
2211
|
-
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type: a, rowIndex:
|
|
2210
|
+
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type: a, rowIndex: h, rowKey: c } = this;
|
|
2212
2211
|
if (!(s === 0 || r === 0) && o !== "footer" && ["index-selection", "selection"].includes(a)) {
|
|
2213
2212
|
const f = this.ctx.database.getRowSelection(c), d = this.ctx.database.getRowSelectable(c), { CHECKBOX_SIZE: x = 0 } = this.ctx.config, u = this.drawX + (e - x) / 2, g = this.drawY + (i - x) / 2;
|
|
2214
2213
|
let w = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck";
|
|
2215
|
-
f && d ? (w = this.ctx.icons.get("checkbox-check"), p = "checkbox-check") : f && d ? (w = this.ctx.icons.get("checkbox-check-disabled"), p = "checkbox-check-disabled") : !f && d ? (w = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck") : (w = this.ctx.icons.get("checkbox-disabled"), p = "checkbox-disabled"), w && a == "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex ===
|
|
2214
|
+
f && d ? (w = this.ctx.icons.get("checkbox-check"), p = "checkbox-check") : f && d ? (w = this.ctx.icons.get("checkbox-check-disabled"), p = "checkbox-check-disabled") : !f && d ? (w = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck") : (w = this.ctx.icons.get("checkbox-disabled"), p = "checkbox-disabled"), w && a == "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === h || ["checkbox-disabled", "checkbox-check"].includes(p)) && (this.drawImageX = u, this.drawImageY = g, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = p, this.drawImageSource = w) : w && a === "selection" && (this.drawImageX = u, this.drawImageY = g, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = p, this.drawImageSource = w);
|
|
2216
2215
|
}
|
|
2217
2216
|
}
|
|
2218
2217
|
updateHoverIcon() {
|
|
2219
2218
|
const { BODY_CELL_HOVER_ICON_METHOD: e, CELL_HOVER_ICON_SIZE: i, CELL_PADDING: s } = this.ctx.config;
|
|
2220
2219
|
if (typeof e == "function") {
|
|
2221
|
-
const
|
|
2220
|
+
const h = e({
|
|
2222
2221
|
row: this.row,
|
|
2223
2222
|
rowIndex: this.rowIndex,
|
|
2224
2223
|
colIndex: this.colIndex,
|
|
2225
2224
|
column: this.column,
|
|
2226
2225
|
value: this.getValue()
|
|
2227
2226
|
});
|
|
2228
|
-
|
|
2227
|
+
h !== void 0 && (this.hoverIconName = h);
|
|
2229
2228
|
}
|
|
2230
2229
|
const r = this.drawX + this.width - i - s, o = this.drawY + (this.height - i) / 2;
|
|
2231
2230
|
if (this.hoverIconName && this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === this.rowIndex) {
|
|
@@ -2285,7 +2284,8 @@ class ee extends te {
|
|
|
2285
2284
|
top: i,
|
|
2286
2285
|
width: `${this.visibleWidth}px`,
|
|
2287
2286
|
height: `${this.visibleHeight}px`,
|
|
2288
|
-
pointerEvents: "initial"
|
|
2287
|
+
pointerEvents: "initial",
|
|
2288
|
+
userSelect: "none"
|
|
2289
2289
|
};
|
|
2290
2290
|
}
|
|
2291
2291
|
draw() {
|
|
@@ -2348,8 +2348,8 @@ class ee extends te {
|
|
|
2348
2348
|
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s } = this.ctx.config;
|
|
2349
2349
|
if (!s || !i)
|
|
2350
2350
|
return;
|
|
2351
|
-
const { xArr: r, yArr: o } = this.ctx.selector, a = r[1],
|
|
2352
|
-
c === a && f ===
|
|
2351
|
+
const { xArr: r, yArr: o } = this.ctx.selector, a = r[1], h = o[1], { colIndex: c, rowIndex: f, drawX: d, drawY: x } = this;
|
|
2352
|
+
c === a && f === h && this.ctx.paint.drawRect(d + this.width - 6, x + this.height - 6, 6, 6, {
|
|
2353
2353
|
borderColor: "#fff",
|
|
2354
2354
|
fillColor: e
|
|
2355
2355
|
});
|
|
@@ -2404,31 +2404,31 @@ class ee extends te {
|
|
|
2404
2404
|
}
|
|
2405
2405
|
drawBorder(e) {
|
|
2406
2406
|
const { drawX: i, drawY: s, width: r, rowIndex: o, colIndex: a } = this;
|
|
2407
|
-
let
|
|
2408
|
-
o === 0 && (c = this.y + 1, f = f - 1), a === this.ctx.maxColIndex && (
|
|
2407
|
+
let h = i + 0.5, c = s + 0.5, f = this.height;
|
|
2408
|
+
o === 0 && (c = this.y + 1, f = f - 1), a === this.ctx.maxColIndex && (h = h - 1);
|
|
2409
2409
|
const { xArr: d, yArr: x, lineDash: u = [], borderWidth: g = 1, borderColor: w, fillColor: p } = e, y = d[0], b = d[1], m = x[0], E = x[1];
|
|
2410
|
-
a >= y && a <= b && o === m && this.ctx.paint.drawLine([
|
|
2410
|
+
a >= y && a <= b && o === m && this.ctx.paint.drawLine([h, c, h + r - 2, c], {
|
|
2411
2411
|
borderColor: w,
|
|
2412
2412
|
fillColor: p,
|
|
2413
2413
|
borderWidth: g,
|
|
2414
2414
|
lineCap: "round",
|
|
2415
2415
|
lineJoin: "round",
|
|
2416
2416
|
lineDash: u
|
|
2417
|
-
}), a >= y && a <= b && o === E && this.ctx.paint.drawLine([
|
|
2417
|
+
}), a >= y && a <= b && o === E && this.ctx.paint.drawLine([h, c + f - 1.5, h + r, c + f - 1.5], {
|
|
2418
2418
|
borderColor: w,
|
|
2419
2419
|
fillColor: p,
|
|
2420
2420
|
borderWidth: g,
|
|
2421
2421
|
lineCap: "round",
|
|
2422
2422
|
lineJoin: "round",
|
|
2423
2423
|
lineDash: u
|
|
2424
|
-
}), a === y && o >= m && o <= E && this.ctx.paint.drawLine([
|
|
2424
|
+
}), a === y && o >= m && o <= E && this.ctx.paint.drawLine([h, c, h, c + f - 1], {
|
|
2425
2425
|
borderColor: w,
|
|
2426
2426
|
fillColor: p,
|
|
2427
2427
|
borderWidth: g,
|
|
2428
2428
|
lineCap: "round",
|
|
2429
2429
|
lineJoin: "round",
|
|
2430
2430
|
lineDash: u
|
|
2431
|
-
}), a === b && o >= m && o <= E && this.ctx.paint.drawLine([
|
|
2431
|
+
}), a === b && o >= m && o <= E && this.ctx.paint.drawLine([h + r - 1.5, c, h + r - 1.5, c + f - 1.5], {
|
|
2432
2432
|
borderColor: w,
|
|
2433
2433
|
fillColor: p,
|
|
2434
2434
|
borderWidth: g,
|
|
@@ -2439,42 +2439,42 @@ class ee extends te {
|
|
|
2439
2439
|
}
|
|
2440
2440
|
}
|
|
2441
2441
|
class ie extends te {
|
|
2442
|
-
constructor(e, i, s, r, o, a,
|
|
2443
|
-
super(e, s, r, o, a,
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
this.ctx = e, this.x = s, this.y = r, this.width = o, this.height = a, this.colIndex = i, this.key =
|
|
2442
|
+
constructor(e, i, s, r, o, a, h) {
|
|
2443
|
+
super(e, s, r, o, a, h.fixed, "header");
|
|
2444
|
+
l(this, "align");
|
|
2445
|
+
l(this, "verticalAlign", "middle");
|
|
2446
|
+
l(this, "fixed");
|
|
2447
|
+
l(this, "widthFillDisable");
|
|
2448
|
+
l(this, "type");
|
|
2449
|
+
l(this, "operation", !1);
|
|
2450
|
+
l(this, "editorType");
|
|
2451
|
+
l(this, "level");
|
|
2452
|
+
l(this, "text");
|
|
2453
|
+
l(this, "displayText", "");
|
|
2454
|
+
l(this, "colspan");
|
|
2455
|
+
l(this, "rowspan");
|
|
2456
|
+
l(this, "key");
|
|
2457
|
+
l(this, "required", !1);
|
|
2458
|
+
l(this, "readonly", !1);
|
|
2459
|
+
l(this, "children", []);
|
|
2460
|
+
l(this, "column");
|
|
2461
|
+
l(this, "colIndex");
|
|
2462
|
+
l(this, "rowKey");
|
|
2463
|
+
l(this, "rules");
|
|
2464
|
+
l(this, "hasChildren");
|
|
2465
|
+
l(this, "render");
|
|
2466
|
+
l(this, "style", {});
|
|
2467
|
+
l(this, "drawX", 0);
|
|
2468
|
+
l(this, "drawY", 0);
|
|
2469
|
+
l(this, "drawCellBgColor", "");
|
|
2470
|
+
l(this, "drawTextColor", "");
|
|
2471
|
+
l(this, "drawImageX", 0);
|
|
2472
|
+
l(this, "drawImageY", 0);
|
|
2473
|
+
l(this, "drawImageWidth", 0);
|
|
2474
|
+
l(this, "drawImageHeight", 0);
|
|
2475
|
+
l(this, "drawImageName", "");
|
|
2476
|
+
l(this, "drawImageSource");
|
|
2477
|
+
this.ctx = e, this.x = s, this.y = r, this.width = o, this.height = a, this.colIndex = i, this.key = h.key, this.type = h.type, this.editorType = h.editorType || "text", this.align = h.align || "center", this.verticalAlign = h.verticalAlign || "middle", this.fixed = h.fixed, this.level = h.level, this.operation = h.operation || !1, this.text = h.title, this.column = h, this.colspan = h.colspan, this.widthFillDisable = h.widthFillDisable, this.rowspan = h.rowspan, this.rules = h.rules, this.readonly = h.readonly, this.required = h.required, this.rowKey = Ut(), this.hasChildren = h.children && h.children.length > 0 || !1, this.render = h.renderHeader;
|
|
2478
2478
|
}
|
|
2479
2479
|
/**
|
|
2480
2480
|
* 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
|
|
@@ -2494,11 +2494,11 @@ class ie extends te {
|
|
|
2494
2494
|
const { HEADER_CELL_STYLE_METHOD: e, HEADER_BG_COLOR: i, HEADER_TEXT_COLOR: s } = this.ctx.config;
|
|
2495
2495
|
let r = i, o = s;
|
|
2496
2496
|
if (typeof e == "function") {
|
|
2497
|
-
const a = e, { backgroundColor:
|
|
2497
|
+
const a = e, { backgroundColor: h, color: c } = a({
|
|
2498
2498
|
colIndex: this.colIndex,
|
|
2499
2499
|
column: this.column
|
|
2500
2500
|
}) || {};
|
|
2501
|
-
|
|
2501
|
+
h && (r = h), c && (o = c);
|
|
2502
2502
|
}
|
|
2503
2503
|
this.drawCellBgColor = r, this.drawTextColor = o;
|
|
2504
2504
|
}
|
|
@@ -2509,11 +2509,11 @@ class ie extends te {
|
|
|
2509
2509
|
const {
|
|
2510
2510
|
paint: e,
|
|
2511
2511
|
config: { BORDER_COLOR: i, CELL_PADDING: s, HEADER_FONT: r }
|
|
2512
|
-
} = this.ctx, { drawX: o, drawY: a, displayText:
|
|
2512
|
+
} = this.ctx, { drawX: o, drawY: a, displayText: h } = this;
|
|
2513
2513
|
e.drawRect(o, a, this.width, this.height, {
|
|
2514
2514
|
borderColor: i,
|
|
2515
2515
|
fillColor: this.drawCellBgColor
|
|
2516
|
-
}), e.drawText(
|
|
2516
|
+
}), e.drawText(h, o, a, this.width, this.height, {
|
|
2517
2517
|
font: r,
|
|
2518
2518
|
padding: s,
|
|
2519
2519
|
color: this.drawTextColor,
|
|
@@ -2524,9 +2524,9 @@ class ie extends te {
|
|
|
2524
2524
|
drawSelection() {
|
|
2525
2525
|
const { width: e, height: i, type: s } = this;
|
|
2526
2526
|
if (["index-selection", "selection"].includes(s)) {
|
|
2527
|
-
const { indeterminate: r, check: o, selectable: a } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE:
|
|
2527
|
+
const { indeterminate: r, check: o, selectable: a } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: h = 0 } = this.ctx.config, c = this.drawX + (e - h) / 2, f = this.drawY + (i - h) / 2;
|
|
2528
2528
|
let d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck";
|
|
2529
|
-
r ? (d = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : o && a ? (d = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : o && a ? (d = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !o && a ? (d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck") : (d = this.ctx.icons.get("checkbox-disabled"), x = "checkbox-disabled"), d && (this.drawImageX = c, this.drawImageY = f, this.drawImageWidth =
|
|
2529
|
+
r ? (d = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : o && a ? (d = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : o && a ? (d = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !o && a ? (d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck") : (d = this.ctx.icons.get("checkbox-disabled"), x = "checkbox-disabled"), d && (this.drawImageX = c, this.drawImageY = f, this.drawImageWidth = h, this.drawImageHeight = h, this.drawImageName = x, this.drawImageSource = d, this.ctx.paint.drawImage(
|
|
2530
2530
|
this.drawImageSource,
|
|
2531
2531
|
this.drawImageX,
|
|
2532
2532
|
this.drawImageY,
|
|
@@ -2550,15 +2550,16 @@ class ie extends te {
|
|
|
2550
2550
|
top: `${this.drawY + 1}px`,
|
|
2551
2551
|
width: `${this.width}px`,
|
|
2552
2552
|
height: `${this.height - 2}px`,
|
|
2553
|
-
pointerEvents: "initial"
|
|
2553
|
+
pointerEvents: "initial",
|
|
2554
|
+
userSelect: "none"
|
|
2554
2555
|
};
|
|
2555
2556
|
}
|
|
2556
2557
|
}
|
|
2557
|
-
class
|
|
2558
|
+
class li {
|
|
2558
2559
|
constructor(t) {
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2560
|
+
l(this, "ctx");
|
|
2561
|
+
l(this, "visibleHoverCell");
|
|
2562
|
+
l(this, "resizeObserver");
|
|
2562
2563
|
this.ctx = t, this.init();
|
|
2563
2564
|
}
|
|
2564
2565
|
init() {
|
|
@@ -2648,10 +2649,10 @@ class hi {
|
|
|
2648
2649
|
colIndex: t.colIndex,
|
|
2649
2650
|
column: t.column,
|
|
2650
2651
|
value: t.getValue()
|
|
2651
|
-
}).then((
|
|
2652
|
-
this.ctx.database.setExpandChildren(t.rowKey,
|
|
2653
|
-
}).catch((
|
|
2654
|
-
this.ctx.database.expandLoading(t.rowKey, !1), console.error(
|
|
2652
|
+
}).then((h) => {
|
|
2653
|
+
this.ctx.database.setExpandChildren(t.rowKey, h), this.ctx.database.expandLoading(t.rowKey, !1), this.ctx.emit("expandChange", this.ctx.database.getExpandRowKeys());
|
|
2654
|
+
}).catch((h) => {
|
|
2655
|
+
this.ctx.database.expandLoading(t.rowKey, !1), console.error(h);
|
|
2655
2656
|
}));
|
|
2656
2657
|
else {
|
|
2657
2658
|
const a = this.ctx.database.getIsExpand(t.rowKey);
|
|
@@ -2678,15 +2679,15 @@ class hi {
|
|
|
2678
2679
|
handleBodyEvent(t, e, i, s, r = !1) {
|
|
2679
2680
|
for (const o of i) {
|
|
2680
2681
|
const a = o.fixedCells.concat(o.noFixedCells);
|
|
2681
|
-
for (const
|
|
2682
|
-
const c =
|
|
2682
|
+
for (const h of a) {
|
|
2683
|
+
const c = h.getDrawX(), f = h.getDrawY();
|
|
2683
2684
|
if (r) {
|
|
2684
|
-
if (t > c && t < c +
|
|
2685
|
-
s(
|
|
2685
|
+
if (t > c && t < c + h.visibleWidth && e > f && e < f + h.visibleHeight) {
|
|
2686
|
+
s(h);
|
|
2686
2687
|
return;
|
|
2687
2688
|
}
|
|
2688
|
-
} else if (t > c && t < c +
|
|
2689
|
-
s(
|
|
2689
|
+
} else if (t > c && t < c + h.width && e > f && e < f + h.height) {
|
|
2690
|
+
s(h);
|
|
2690
2691
|
return;
|
|
2691
2692
|
}
|
|
2692
2693
|
}
|
|
@@ -2705,53 +2706,55 @@ class hi {
|
|
|
2705
2706
|
this.resizeObserver.unobserve(this.ctx.stageElement);
|
|
2706
2707
|
}
|
|
2707
2708
|
}
|
|
2708
|
-
class
|
|
2709
|
+
class hi {
|
|
2709
2710
|
constructor(t, e) {
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2711
|
+
l(this, "eventBus");
|
|
2712
|
+
l(this, "eventBrowser");
|
|
2713
|
+
l(this, "eventTable");
|
|
2714
|
+
l(this, "containerElement");
|
|
2715
|
+
l(this, "stageElement");
|
|
2716
|
+
l(this, "canvasElement");
|
|
2717
|
+
l(this, "overlayerElement");
|
|
2718
|
+
l(this, "editorElement");
|
|
2719
|
+
l(this, "emptyElement");
|
|
2720
|
+
l(this, "contextMenuElement");
|
|
2721
|
+
l(this, "stageWidth", 0);
|
|
2722
|
+
l(this, "stageHeight", 0);
|
|
2723
|
+
l(this, "paint");
|
|
2724
|
+
l(this, "icons");
|
|
2725
|
+
l(this, "isInsideTargetContainer", !1);
|
|
2726
|
+
l(this, "mousedown", !1);
|
|
2727
|
+
l(this, "isPointer", !1);
|
|
2728
|
+
l(this, "rowResizing", !1);
|
|
2726
2729
|
// 行调整大小中
|
|
2727
|
-
|
|
2730
|
+
l(this, "columnResizing", !1);
|
|
2728
2731
|
// 列调整大小中
|
|
2729
|
-
|
|
2732
|
+
l(this, "scrollerMove", !1);
|
|
2730
2733
|
// 滚动条移动中
|
|
2731
|
-
|
|
2734
|
+
l(this, "scrollerFocus", !1);
|
|
2732
2735
|
// 滚动条focus中
|
|
2733
|
-
|
|
2736
|
+
l(this, "autofillMove", !1);
|
|
2734
2737
|
// 自动填充移动中
|
|
2735
|
-
|
|
2738
|
+
l(this, "selectorMove", !1);
|
|
2736
2739
|
// 选择器移动中
|
|
2737
|
-
|
|
2740
|
+
l(this, "adjustPositioning", !1);
|
|
2738
2741
|
// 调整位置中
|
|
2739
|
-
|
|
2742
|
+
l(this, "editing", !1);
|
|
2740
2743
|
// 编辑中
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2744
|
+
l(this, "scrollY", 0);
|
|
2745
|
+
l(this, "scrollX", 0);
|
|
2746
|
+
l(this, "fixedLeftWidth", 0);
|
|
2747
|
+
l(this, "fixedRightWidth", 0);
|
|
2748
|
+
l(this, "maxColIndex", 0);
|
|
2749
|
+
l(this, "maxRowIndex", 0);
|
|
2750
|
+
l(this, "hoverRow");
|
|
2751
|
+
l(this, "clickCell");
|
|
2752
|
+
l(this, "focusCell");
|
|
2753
|
+
l(this, "hoverCell");
|
|
2754
|
+
l(this, "clickCellHeader");
|
|
2755
|
+
l(this, "focusCellHeader");
|
|
2756
|
+
l(this, "hoverCellHeader");
|
|
2757
|
+
l(this, "body", {
|
|
2755
2758
|
x: 0,
|
|
2756
2759
|
y: 0,
|
|
2757
2760
|
width: 0,
|
|
@@ -2764,7 +2767,7 @@ class li {
|
|
|
2764
2767
|
renderRows: [],
|
|
2765
2768
|
data: []
|
|
2766
2769
|
});
|
|
2767
|
-
|
|
2770
|
+
l(this, "footer", {
|
|
2768
2771
|
x: 0,
|
|
2769
2772
|
y: 0,
|
|
2770
2773
|
width: 0,
|
|
@@ -2773,7 +2776,7 @@ class li {
|
|
|
2773
2776
|
visibleWidth: 0,
|
|
2774
2777
|
renderRows: []
|
|
2775
2778
|
});
|
|
2776
|
-
|
|
2779
|
+
l(this, "header", {
|
|
2777
2780
|
x: 0,
|
|
2778
2781
|
y: 0,
|
|
2779
2782
|
width: 0,
|
|
@@ -2788,23 +2791,31 @@ class li {
|
|
|
2788
2791
|
fixedRightCellHeaders: [],
|
|
2789
2792
|
renderCenterCellHeaders: []
|
|
2790
2793
|
});
|
|
2791
|
-
|
|
2794
|
+
l(this, "selector", {
|
|
2792
2795
|
enable: !1,
|
|
2793
2796
|
xArr: [-1, -1],
|
|
2794
2797
|
yArr: [-1, -1],
|
|
2795
2798
|
xArrCopy: [-1, -1],
|
|
2796
2799
|
yArrCopy: [-1, -1]
|
|
2797
2800
|
});
|
|
2798
|
-
|
|
2801
|
+
l(this, "autofill", {
|
|
2799
2802
|
enable: !1,
|
|
2800
2803
|
xArr: [-1, -1],
|
|
2801
2804
|
yArr: [-1, -1]
|
|
2802
2805
|
});
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
const {
|
|
2807
|
-
|
|
2806
|
+
l(this, "database");
|
|
2807
|
+
l(this, "history");
|
|
2808
|
+
l(this, "config");
|
|
2809
|
+
const {
|
|
2810
|
+
containerElement: i,
|
|
2811
|
+
stageElement: s,
|
|
2812
|
+
canvasElement: r,
|
|
2813
|
+
overlayerElement: o,
|
|
2814
|
+
editorElement: a,
|
|
2815
|
+
emptyElement: h,
|
|
2816
|
+
contextMenuElement: c
|
|
2817
|
+
} = t;
|
|
2818
|
+
this.containerElement = i, s.tabIndex = 0, this.stageElement = s, this.canvasElement = r, this.overlayerElement = o, this.editorElement = a, this.emptyElement = h, this.contextMenuElement = c, this.config = new Wt(e.config || {}), this.eventBus = new oi(), this.eventBrowser = new ri(this), this.eventTable = new li(this), this.paint = new ni(this.canvasElement), this.database = new ii(this, e), this.history = new si(this), this.icons = new ai(this);
|
|
2808
2819
|
}
|
|
2809
2820
|
setConfig(t) {
|
|
2810
2821
|
this.config = new Wt(t);
|
|
@@ -2839,7 +2850,7 @@ class li {
|
|
|
2839
2850
|
for (let r = 0; r <= e[1] - e[0]; r++) {
|
|
2840
2851
|
const o = [];
|
|
2841
2852
|
for (let a = 0; a <= i[1] - i[0]; a++) {
|
|
2842
|
-
const
|
|
2853
|
+
const h = r + e[0], c = a + i[0], f = this.database.getItemValueForRowIndexAndColIndex(h, c);
|
|
2843
2854
|
f && o.push(f.value);
|
|
2844
2855
|
}
|
|
2845
2856
|
s += `${o.join(" ")}\r`, t.push(o);
|
|
@@ -2901,29 +2912,29 @@ class li {
|
|
|
2901
2912
|
}
|
|
2902
2913
|
class Pt {
|
|
2903
2914
|
constructor(t, e) {
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2915
|
+
l(this, "ctx");
|
|
2916
|
+
l(this, "type");
|
|
2917
|
+
l(this, "isFocus", !1);
|
|
2918
|
+
l(this, "trackX", 0);
|
|
2919
|
+
l(this, "trackY", 0);
|
|
2920
|
+
l(this, "trackWidth", 0);
|
|
2921
|
+
l(this, "trackHeight", 0);
|
|
2922
|
+
l(this, "splitPoints", []);
|
|
2912
2923
|
//分割线
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2924
|
+
l(this, "barX", 0);
|
|
2925
|
+
l(this, "barY", 0);
|
|
2926
|
+
l(this, "barWidth", 0);
|
|
2927
|
+
l(this, "barHeight", 0);
|
|
2928
|
+
l(this, "distance", 0);
|
|
2918
2929
|
// 滚动条的长度
|
|
2919
|
-
|
|
2930
|
+
l(this, "visibleDistance", 0);
|
|
2920
2931
|
//可见区域的长度
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2932
|
+
l(this, "clientX", 0);
|
|
2933
|
+
l(this, "clientY", 0);
|
|
2934
|
+
l(this, "dragStart", 0);
|
|
2924
2935
|
// 拖拽开始的位置
|
|
2925
|
-
|
|
2926
|
-
|
|
2936
|
+
l(this, "isDragging", !1);
|
|
2937
|
+
l(this, "scroll", 0);
|
|
2927
2938
|
this.ctx = t, this.type = e, this.type === "vertical" ? this.scroll = this.ctx.scrollY : this.scroll = this.ctx.scrollX;
|
|
2928
2939
|
}
|
|
2929
2940
|
onWheel(t) {
|
|
@@ -2979,19 +2990,19 @@ class Pt {
|
|
|
2979
2990
|
stageHeight: i,
|
|
2980
2991
|
stageWidth: s,
|
|
2981
2992
|
config: { SCROLLER_TRACK_SIZE: r = 0, SCROLLER_SIZE: o = 0 }
|
|
2982
|
-
} = this.ctx, a = s,
|
|
2993
|
+
} = this.ctx, a = s, h = i, c = e.height, f = e.width, d = t.height, x = this.ctx.footer.height;
|
|
2983
2994
|
if (this.type === "vertical") {
|
|
2984
|
-
this.visibleDistance =
|
|
2995
|
+
this.visibleDistance = h - r - c, this.distance = d - this.visibleDistance + x, this.trackX = a - r, this.trackY = 0, this.splitPoints = [this.trackX, c, this.trackX + r, c], this.trackWidth = r, this.trackHeight = h, this.barX = this.trackX - 0.5 + (r - o) / 2, this.barWidth = o;
|
|
2985
2996
|
const u = this.distance ? this.visibleDistance / d : 0;
|
|
2986
2997
|
let g = Math.floor(u * this.visibleDistance);
|
|
2987
2998
|
g < 30 ? g = 30 : g > this.visibleDistance && (g = 0), this.barHeight = g, this.barY = c + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
2988
2999
|
} else {
|
|
2989
3000
|
this.visibleDistance = a - r, this.distance = f - this.visibleDistance, this.splitPoints = [
|
|
2990
3001
|
a - r,
|
|
2991
|
-
|
|
3002
|
+
h - r,
|
|
2992
3003
|
a - r,
|
|
2993
|
-
|
|
2994
|
-
], this.trackX = 0, this.trackY =
|
|
3004
|
+
h
|
|
3005
|
+
], this.trackX = 0, this.trackY = h - r, this.trackWidth = a, this.trackHeight = r;
|
|
2995
3006
|
const u = this.distance ? this.visibleDistance / f : 0;
|
|
2996
3007
|
let g = Math.floor(u * this.visibleDistance);
|
|
2997
3008
|
this.barY = this.trackY - 0.5 + (r - o) / 2, g < 30 ? g = 30 : g >= this.visibleDistance && (g = 0), this.barWidth = g, this.barHeight = o, this.barX = this.scroll / this.distance * (this.visibleDistance - this.barWidth), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
@@ -3015,9 +3026,9 @@ class Pt {
|
|
|
3015
3026
|
}
|
|
3016
3027
|
class ci {
|
|
3017
3028
|
constructor(t) {
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3029
|
+
l(this, "ctx");
|
|
3030
|
+
l(this, "verticalScrollbar");
|
|
3031
|
+
l(this, "horizontalScrollbar");
|
|
3021
3032
|
this.ctx = t, this.verticalScrollbar = new Pt(t, "vertical"), this.horizontalScrollbar = new Pt(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("setScroll", (e, i) => {
|
|
3022
3033
|
this.setScroll(e, i);
|
|
3023
3034
|
}), this.ctx.on("setScrollX", (e) => {
|
|
@@ -3071,41 +3082,41 @@ class ci {
|
|
|
3071
3082
|
}
|
|
3072
3083
|
class di {
|
|
3073
3084
|
constructor(t) {
|
|
3074
|
-
|
|
3085
|
+
l(this, "ctx");
|
|
3075
3086
|
// 上下文
|
|
3076
|
-
|
|
3087
|
+
l(this, "x", 0);
|
|
3077
3088
|
// x坐标
|
|
3078
|
-
|
|
3089
|
+
l(this, "y", 0);
|
|
3079
3090
|
// y坐标
|
|
3080
|
-
|
|
3091
|
+
l(this, "width", 0);
|
|
3081
3092
|
// 宽度
|
|
3082
|
-
|
|
3093
|
+
l(this, "height", 0);
|
|
3083
3094
|
// 高度
|
|
3084
|
-
|
|
3095
|
+
l(this, "resizeTarget", null);
|
|
3085
3096
|
//调整表头
|
|
3086
|
-
|
|
3097
|
+
l(this, "resizeNum", 0);
|
|
3087
3098
|
// 调整列的数量
|
|
3088
|
-
|
|
3099
|
+
l(this, "isResizing", !1);
|
|
3089
3100
|
// 是否移动中
|
|
3090
|
-
|
|
3101
|
+
l(this, "clientX", 0);
|
|
3091
3102
|
// 鼠标按下时的x轴位置
|
|
3092
|
-
|
|
3103
|
+
l(this, "resizeDiff", 0);
|
|
3093
3104
|
// 是否移动中
|
|
3094
|
-
|
|
3095
|
-
|
|
3105
|
+
l(this, "columnIndex", 0);
|
|
3106
|
+
l(this, "isMouseDown", !1);
|
|
3096
3107
|
// 是否按下
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3108
|
+
l(this, "columns");
|
|
3109
|
+
l(this, "visibleLeafColumns", []);
|
|
3110
|
+
l(this, "visibleHeight", 0);
|
|
3111
|
+
l(this, "visibleWidth", 0);
|
|
3112
|
+
l(this, "allCellHeaders", []);
|
|
3113
|
+
l(this, "leafCellHeaders", []);
|
|
3114
|
+
l(this, "renderLeafCellHeaders", []);
|
|
3115
|
+
l(this, "fixedLeftCellHeaders", []);
|
|
3116
|
+
l(this, "centerCellHeaders", []);
|
|
3117
|
+
l(this, "fixedRightCellHeaders", []);
|
|
3118
|
+
l(this, "renderCenterCellHeaders", []);
|
|
3119
|
+
l(this, "renderFixedCellHeaders", []);
|
|
3109
3120
|
this.ctx = t, this.ctx.on(
|
|
3110
3121
|
"resetHeader",
|
|
3111
3122
|
Zt(() => {
|
|
@@ -3124,9 +3135,9 @@ class di {
|
|
|
3124
3135
|
this.columnIndex = 0, this.resizeNum = 0, this.render(o, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
3125
3136
|
const a = this.ctx.containerElement.getBoundingClientRect();
|
|
3126
3137
|
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 - 0.5 + "px", this.visibleWidth = this.ctx.stageWidth - e;
|
|
3127
|
-
const
|
|
3128
|
-
if (this.resizeNum &&
|
|
3129
|
-
const d = Math.floor(
|
|
3138
|
+
const h = this.visibleWidth - this.width;
|
|
3139
|
+
if (this.resizeNum && h > 0) {
|
|
3140
|
+
const d = Math.floor(h / this.resizeNum * 100) / 100;
|
|
3130
3141
|
this.resizeAllColumn(d);
|
|
3131
3142
|
}
|
|
3132
3143
|
const c = this.fixedLeftCellHeaders.filter((d) => !d.hasChildren);
|
|
@@ -3159,9 +3170,9 @@ class di {
|
|
|
3159
3170
|
this.ctx.stageElement.style.cursor === "col-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3160
3171
|
const r = [...this.renderFixedCellHeaders, ...this.renderCenterCellHeaders];
|
|
3161
3172
|
for (const o of r) {
|
|
3162
|
-
const { offsetX: a, offsetY:
|
|
3173
|
+
const { offsetX: a, offsetY: h } = this.ctx.getOffset(e), c = a, f = o.getDrawX();
|
|
3163
3174
|
c > f + o.width - 5 && c < f + o.width + 4 && c < i - 4 && // 视窗中最后一列不允许调整宽
|
|
3164
|
-
o.colspan <= 1 && this.ctx.isTarget() &&
|
|
3175
|
+
o.colspan <= 1 && this.ctx.isTarget() && h <= this.height && (this.ctx.stageElement.style.cursor = "col-resize", this.resizeTarget = o);
|
|
3165
3176
|
}
|
|
3166
3177
|
}
|
|
3167
3178
|
}));
|
|
@@ -3215,10 +3226,10 @@ class di {
|
|
|
3215
3226
|
let s = e;
|
|
3216
3227
|
const { HEADER_HEIGHT: r = 0 } = this.ctx.config;
|
|
3217
3228
|
for (let o = 0; o < i; o++) {
|
|
3218
|
-
const a = t[o],
|
|
3229
|
+
const a = t[o], h = r * (a.rowspan || 1), c = r * a.level;
|
|
3219
3230
|
let f = a.width || 100;
|
|
3220
3231
|
a.children && (f = _t(a.children).reduce((u, g) => u + ((g == null ? void 0 : g.width) || 100), 0));
|
|
3221
|
-
const d = new ie(this.ctx, this.columnIndex, s, c, f,
|
|
3232
|
+
const d = new ie(this.ctx, this.columnIndex, s, c, f, h, a);
|
|
3222
3233
|
this.ctx.database.setHeader(a.key, d), this.allCellHeaders.push(d), a.children || (this.leafCellHeaders.push(d), d.column.widthFillDisable || this.resizeNum++), a.fixed === "left" ? this.fixedLeftCellHeaders.push(d) : a.fixed === "right" ? this.fixedRightCellHeaders.push(d) : this.centerCellHeaders.push(d), !a.children && this.columnIndex++, a.children && this.render(a.children, s), s += f;
|
|
3223
3234
|
}
|
|
3224
3235
|
}
|
|
@@ -3250,8 +3261,8 @@ class di {
|
|
|
3250
3261
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3251
3262
|
colorEnd: "rgba(0,0,0,0)"
|
|
3252
3263
|
}), i < Math.floor(s.width - r - 1) && e !== a) {
|
|
3253
|
-
const
|
|
3254
|
-
this.ctx.paint.drawShadow(
|
|
3264
|
+
const h = s.width - (this.x + this.width) + r - e;
|
|
3265
|
+
this.ctx.paint.drawShadow(h + 1, this.y, e, this.height, {
|
|
3255
3266
|
fillColor: o,
|
|
3256
3267
|
side: "left",
|
|
3257
3268
|
shadowWidth: 4,
|
|
@@ -3279,20 +3290,20 @@ class di {
|
|
|
3279
3290
|
}
|
|
3280
3291
|
}
|
|
3281
3292
|
class se {
|
|
3282
|
-
constructor(t, e, i = 0, s = 0, r = 0, o = 0, a,
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
this.ctx = t, this.x = i, this.y = s, this.width = r, this.height = o, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e), this.rowType =
|
|
3293
|
+
constructor(t, e, i = 0, s = 0, r = 0, o = 0, a, h = "body") {
|
|
3294
|
+
l(this, "ctx");
|
|
3295
|
+
l(this, "x", 0);
|
|
3296
|
+
l(this, "y", 0);
|
|
3297
|
+
l(this, "width", 0);
|
|
3298
|
+
l(this, "height");
|
|
3299
|
+
l(this, "cells", []);
|
|
3300
|
+
l(this, "fixedCells", []);
|
|
3301
|
+
l(this, "noFixedCells", []);
|
|
3302
|
+
l(this, "rowIndex", 0);
|
|
3303
|
+
l(this, "rowKey", "");
|
|
3304
|
+
l(this, "rowType", "body");
|
|
3305
|
+
l(this, "data");
|
|
3306
|
+
this.ctx = t, this.x = i, this.y = s, this.width = r, this.height = o, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e), this.rowType = h, this.data = a, this.update();
|
|
3296
3307
|
}
|
|
3297
3308
|
update() {
|
|
3298
3309
|
const { header: t } = this.ctx, e = [], i = [], s = [];
|
|
@@ -3332,28 +3343,28 @@ class se {
|
|
|
3332
3343
|
}
|
|
3333
3344
|
class fi {
|
|
3334
3345
|
constructor(t) {
|
|
3335
|
-
|
|
3346
|
+
l(this, "resizeTarget", null);
|
|
3336
3347
|
//调整行大小的目标
|
|
3337
|
-
|
|
3348
|
+
l(this, "isMouseDown", !1);
|
|
3338
3349
|
// 是否按下
|
|
3339
|
-
|
|
3350
|
+
l(this, "resizeDiff", 0);
|
|
3340
3351
|
// 是否移动中
|
|
3341
|
-
|
|
3352
|
+
l(this, "clientY", 0);
|
|
3342
3353
|
// 鼠标按下时的y轴位置
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3354
|
+
l(this, "ctx");
|
|
3355
|
+
l(this, "x", 0);
|
|
3356
|
+
l(this, "y", 0);
|
|
3357
|
+
l(this, "width", 0);
|
|
3358
|
+
l(this, "height", 0);
|
|
3359
|
+
l(this, "headIndex", 0);
|
|
3360
|
+
l(this, "tailIndex", 0);
|
|
3361
|
+
l(this, "isResizing", !1);
|
|
3351
3362
|
//是否正在调整大小
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3363
|
+
l(this, "renderRows", []);
|
|
3364
|
+
l(this, "visibleRows", []);
|
|
3365
|
+
l(this, "visibleHeight", 0);
|
|
3366
|
+
l(this, "visibleWidth", 0);
|
|
3367
|
+
l(this, "data", []);
|
|
3357
3368
|
this.ctx = t, this.init(), this.initResizeRow();
|
|
3358
3369
|
}
|
|
3359
3370
|
init() {
|
|
@@ -3366,7 +3377,7 @@ class fi {
|
|
|
3366
3377
|
SCROLLER_TRACK_SIZE: r = 0,
|
|
3367
3378
|
HEIGHT: o,
|
|
3368
3379
|
EMPTY_BODY_HEIGHT: a = 0,
|
|
3369
|
-
MAX_HEIGHT:
|
|
3380
|
+
MAX_HEIGHT: h = 0,
|
|
3370
3381
|
ENABLE_OFFSET_HEIGHT: c = 0,
|
|
3371
3382
|
OFFSET_HEIGHT: f = 0
|
|
3372
3383
|
}
|
|
@@ -3395,7 +3406,7 @@ class fi {
|
|
|
3395
3406
|
let y = 0;
|
|
3396
3407
|
this.data.length && c ? (y = window.innerHeight - u - f, y < 0 && (y = 32, console.error(
|
|
3397
3408
|
"There is an error in the height calculation ENABLE_OFFSET_HEIGHT and OFFSET_HEIGHT are invalid"
|
|
3398
|
-
))) : this.data.length && o ? y = o : this.data.length &&
|
|
3409
|
+
))) : this.data.length && o ? y = o : this.data.length && h && p > h ? y = h : y = p, y > 0 && (this.ctx.stageHeight = Math.floor(y), this.ctx.stageElement.style.height = `${this.ctx.stageHeight - 0.5}px`);
|
|
3399
3410
|
let b = this.ctx.stageHeight - e.height - r;
|
|
3400
3411
|
s ? this.visibleHeight = b - g : this.visibleHeight = b, 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 = d;
|
|
3401
3412
|
const m = window.devicePixelRatio || 1, E = this.ctx.stageWidth * m, C = this.ctx.stageHeight * m;
|
|
@@ -3418,7 +3429,7 @@ class fi {
|
|
|
3418
3429
|
}), this.ctx.on("mousemove", (e) => {
|
|
3419
3430
|
if (this.ctx.editing) return;
|
|
3420
3431
|
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), r = i, o = s, a = e.clientY, {
|
|
3421
|
-
stageHeight:
|
|
3432
|
+
stageHeight: h,
|
|
3422
3433
|
scrollY: c,
|
|
3423
3434
|
config: { RESIZE_ROW_MIN_HEIGHT: f = 0 }
|
|
3424
3435
|
} = this.ctx;
|
|
@@ -3432,7 +3443,7 @@ class fi {
|
|
|
3432
3443
|
this.ctx.stageElement.style.cursor === "row-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3433
3444
|
for (let d = 0; d < this.renderRows.length; d++) {
|
|
3434
3445
|
const x = this.renderRows[d];
|
|
3435
|
-
if (r > x.y - c + x.height - 1.5 && r < x.y - c + x.height + 1.5 && r <
|
|
3446
|
+
if (r > x.y - c + x.height - 1.5 && r < x.y - c + x.height + 1.5 && r < h - 4)
|
|
3436
3447
|
for (let g = 0; g < x.cells.length; g++) {
|
|
3437
3448
|
const w = x.cells[g];
|
|
3438
3449
|
o > w.drawX + 10 && o < w.drawX + w.width - 10 && w.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = x);
|
|
@@ -3481,8 +3492,8 @@ class fi {
|
|
|
3481
3492
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3482
3493
|
colorEnd: "rgba(0,0,0,0)"
|
|
3483
3494
|
}), i < Math.floor(s.width - r - 1) && e !== a) {
|
|
3484
|
-
const
|
|
3485
|
-
this.ctx.paint.drawShadow(
|
|
3495
|
+
const h = s.width - (this.x + this.width) + r - e;
|
|
3496
|
+
this.ctx.paint.drawShadow(h + 1, this.y, e, this.height, {
|
|
3486
3497
|
fillColor: o,
|
|
3487
3498
|
side: "left",
|
|
3488
3499
|
shadowWidth: 4,
|
|
@@ -3506,8 +3517,8 @@ class fi {
|
|
|
3506
3517
|
const { header: t, database: e, scrollY: i } = this.ctx, s = i, { data: r, positions: o } = e.getData();
|
|
3507
3518
|
this.ctx.maxRowIndex = r.length - 1;
|
|
3508
3519
|
const a = this.binarySearch(o, s);
|
|
3509
|
-
let
|
|
3510
|
-
|
|
3520
|
+
let h = this.binarySearch(o, s + this.visibleHeight);
|
|
3521
|
+
h === -1 && (h = r.length), this.headIndex = Math.max(0, a), this.tailIndex = Math.min(this.ctx.maxRowIndex, h + 1), this.visibleRows = r.slice(this.headIndex, this.tailIndex + 1), this.ctx.body.headIndex = this.headIndex, this.ctx.body.tailIndex = this.tailIndex, this.ctx.body.visibleRows = this.visibleRows;
|
|
3511
3522
|
const c = [];
|
|
3512
3523
|
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
3513
3524
|
const d = this.headIndex + f, x = this.visibleRows[f], { height: u, top: g } = this.ctx.database.getPositionForRowIndex(d), w = new se(this.ctx, d, 0, g + this.y, t.width, u, x);
|
|
@@ -3525,15 +3536,15 @@ class fi {
|
|
|
3525
3536
|
}
|
|
3526
3537
|
class xi {
|
|
3527
3538
|
constructor(t) {
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3539
|
+
l(this, "ctx");
|
|
3540
|
+
l(this, "renderRows", []);
|
|
3541
|
+
l(this, "data", []);
|
|
3542
|
+
l(this, "x", 0);
|
|
3543
|
+
l(this, "y", 0);
|
|
3544
|
+
l(this, "width", 0);
|
|
3545
|
+
l(this, "height", 0);
|
|
3546
|
+
l(this, "visibleWidth", 0);
|
|
3547
|
+
l(this, "visibleHeight", 0);
|
|
3537
3548
|
this.ctx = t, this.init();
|
|
3538
3549
|
}
|
|
3539
3550
|
init() {
|
|
@@ -3554,8 +3565,8 @@ class xi {
|
|
|
3554
3565
|
stageWidth: r,
|
|
3555
3566
|
config: { HEADER_BG_COLOR: o, SCROLLER_TRACK_SIZE: a }
|
|
3556
3567
|
} = this.ctx;
|
|
3557
|
-
let
|
|
3558
|
-
if (this.ctx.config.FOOTER_FIXED || (
|
|
3568
|
+
let h = this.y;
|
|
3569
|
+
if (this.ctx.config.FOOTER_FIXED || (h = this.y - this.ctx.scrollY), i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, h, t, this.height, {
|
|
3559
3570
|
fillColor: o,
|
|
3560
3571
|
side: "right",
|
|
3561
3572
|
shadowWidth: 4,
|
|
@@ -3563,7 +3574,7 @@ class xi {
|
|
|
3563
3574
|
colorEnd: "rgba(0,0,0,0)"
|
|
3564
3575
|
}), i < Math.floor(s.width - r - 1) && e !== a) {
|
|
3565
3576
|
const c = s.width - (this.x + this.width) + r - e;
|
|
3566
|
-
this.ctx.paint.drawShadow(c + 1,
|
|
3577
|
+
this.ctx.paint.drawShadow(c + 1, h, e, this.height, {
|
|
3567
3578
|
fillColor: o,
|
|
3568
3579
|
side: "left",
|
|
3569
3580
|
shadowWidth: 4,
|
|
@@ -3602,14 +3613,15 @@ class xi {
|
|
|
3602
3613
|
class ui {
|
|
3603
3614
|
// 垂直滚动定时器
|
|
3604
3615
|
constructor(t) {
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3616
|
+
l(this, "isCut", !1);
|
|
3617
|
+
l(this, "isMultipleRow", !1);
|
|
3618
|
+
l(this, "mousedownHeader", !1);
|
|
3619
|
+
l(this, "ctx");
|
|
3620
|
+
l(this, "adjustPositionX", "");
|
|
3621
|
+
l(this, "adjustPositionY", "");
|
|
3622
|
+
l(this, "timerX", 0);
|
|
3611
3623
|
// 水平滚动定时器
|
|
3612
|
-
|
|
3624
|
+
l(this, "timerY", 0);
|
|
3613
3625
|
this.ctx = t, this.init();
|
|
3614
3626
|
}
|
|
3615
3627
|
init() {
|
|
@@ -3617,7 +3629,7 @@ class ui {
|
|
|
3617
3629
|
"mousemove",
|
|
3618
3630
|
Zt((t) => {
|
|
3619
3631
|
const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = this.ctx.isTarget() && i > 0 && i < this.ctx.body.visibleWidth && e > this.ctx.header.visibleHeight && e < this.ctx.header.visibleHeight + this.ctx.body.visibleHeight;
|
|
3620
|
-
(this.ctx.selectorMove || this.ctx.autofillMove) && (s ? this.
|
|
3632
|
+
(this.ctx.selectorMove || this.ctx.autofillMove) && (!s && !this.mousedownHeader ? this.startAdjustPosition(t) : this.stopAdjustPosition());
|
|
3621
3633
|
}, 100)
|
|
3622
3634
|
), this.ctx.on("cellHoverChange", (t) => {
|
|
3623
3635
|
if (!this.ctx.autofillMove) {
|
|
@@ -3636,13 +3648,14 @@ class ui {
|
|
|
3636
3648
|
this.isMultipleRow = !1, this.click(e.shiftKey);
|
|
3637
3649
|
}
|
|
3638
3650
|
}), this.ctx.on("mouseup", () => {
|
|
3651
|
+
this.mousedownHeader = !1;
|
|
3639
3652
|
const t = setTimeout(() => {
|
|
3640
3653
|
this.ctx.adjustPositioning = !1, clearTimeout(t);
|
|
3641
3654
|
}, 0);
|
|
3642
3655
|
}), this.ctx.on("cellHeaderHoverChange", (t) => {
|
|
3643
3656
|
this.ctx.mousedown && this.selectCols(t);
|
|
3644
3657
|
}), this.ctx.on("cellHeaderMousedown", (t) => {
|
|
3645
|
-
this.ctx.stageElement.style.cursor !== "pointer" && (this.ctx.isPointer || this.selectCols(t));
|
|
3658
|
+
this.ctx.stageElement.style.cursor !== "pointer" && (this.ctx.isPointer || (this.mousedownHeader = !0, this.selectCols(t)));
|
|
3646
3659
|
}), this.ctx.on("keydown", (t) => {
|
|
3647
3660
|
if (t.ctrlKey && t.code === "KeyV" || t.metaKey && t.code === "KeyV") {
|
|
3648
3661
|
t.preventDefault(), this.paste();
|
|
@@ -3708,12 +3721,12 @@ class ui {
|
|
|
3708
3721
|
this.ctx.mousedown && (this.ctx.selectorMove = !0), this.ctx.selector.enable = !0;
|
|
3709
3722
|
const {
|
|
3710
3723
|
SELECTOR_AREA_MIN_X: a,
|
|
3711
|
-
SELECTOR_AREA_MAX_X:
|
|
3724
|
+
SELECTOR_AREA_MAX_X: h,
|
|
3712
3725
|
SELECTOR_AREA_MIN_Y: c,
|
|
3713
3726
|
SELECTOR_AREA_MAX_Y: f,
|
|
3714
3727
|
SELECTOR_AREA_MAX_X_OFFSET: d,
|
|
3715
3728
|
SELECTOR_AREA_MAX_Y_OFFSET: x
|
|
3716
|
-
} = this.ctx.config, u = a, g =
|
|
3729
|
+
} = this.ctx.config, u = a, g = h || this.ctx.maxColIndex - d, w = c, p = f || this.ctx.maxRowIndex - x;
|
|
3717
3730
|
let [y, b] = r, [m, E] = o;
|
|
3718
3731
|
if (y < u || b > g || m < w || E > p)
|
|
3719
3732
|
return;
|
|
@@ -3731,15 +3744,15 @@ class ui {
|
|
|
3731
3744
|
if (this.ctx.mousedown && this.ctx.focusCellHeader) {
|
|
3732
3745
|
const { colIndex: a } = this.ctx.focusCellHeader;
|
|
3733
3746
|
if (this.ctx.clearSelector(), t.colIndex >= a) {
|
|
3734
|
-
const
|
|
3735
|
-
this.setSelector(
|
|
3747
|
+
const h = [a, t.colIndex + t.colspan - 1], c = [r, o];
|
|
3748
|
+
this.setSelector(h, c);
|
|
3736
3749
|
} else {
|
|
3737
|
-
const
|
|
3738
|
-
this.setSelector(
|
|
3750
|
+
const h = [t.colIndex, a], c = [r, o];
|
|
3751
|
+
this.setSelector(h, c);
|
|
3739
3752
|
}
|
|
3740
3753
|
} else {
|
|
3741
|
-
const a = [t.colIndex, t.colIndex + t.colspan - 1],
|
|
3742
|
-
this.setSelector(a,
|
|
3754
|
+
const a = [t.colIndex, t.colIndex + t.colspan - 1], h = [r, o];
|
|
3755
|
+
this.setSelector(a, h);
|
|
3743
3756
|
}
|
|
3744
3757
|
}
|
|
3745
3758
|
selectAll() {
|
|
@@ -3753,8 +3766,8 @@ class ui {
|
|
|
3753
3766
|
SELECTOR_AREA_MIN_Y: r,
|
|
3754
3767
|
SELECTOR_AREA_MAX_Y: o,
|
|
3755
3768
|
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
3756
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
3757
|
-
} = this.ctx.config, c = i, f = s || this.ctx.maxColIndex - a, d = r, x = o || this.ctx.maxRowIndex -
|
|
3769
|
+
SELECTOR_AREA_MAX_Y_OFFSET: h
|
|
3770
|
+
} = this.ctx.config, c = i, f = s || this.ctx.maxColIndex - a, d = r, x = o || this.ctx.maxRowIndex - h, u = [c, f], g = [d, x];
|
|
3758
3771
|
this.setSelector(u, g);
|
|
3759
3772
|
}
|
|
3760
3773
|
}
|
|
@@ -3764,16 +3777,16 @@ class ui {
|
|
|
3764
3777
|
const { SELECTOR_AREA_MIN_X: i, SELECTOR_AREA_MAX_X: s, SELECTOR_AREA_MAX_X_OFFSET: r } = this.ctx.config, o = s || this.ctx.maxColIndex - r, a = i;
|
|
3765
3778
|
if (e) {
|
|
3766
3779
|
this.ctx.setFocusCell(t);
|
|
3767
|
-
const
|
|
3768
|
-
this.setSelector(
|
|
3780
|
+
const h = [a, o], c = [t.rowIndex, t.rowIndex];
|
|
3781
|
+
this.setSelector(h, c);
|
|
3769
3782
|
}
|
|
3770
3783
|
if (this.ctx.focusCell && this.ctx.mousedown) {
|
|
3771
|
-
const { rowIndex:
|
|
3772
|
-
if (t.rowIndex >=
|
|
3773
|
-
const c = [a, o], f = [
|
|
3784
|
+
const { rowIndex: h } = this.ctx.focusCell;
|
|
3785
|
+
if (t.rowIndex >= h) {
|
|
3786
|
+
const c = [a, o], f = [h, t.rowIndex];
|
|
3774
3787
|
this.setSelector(c, f);
|
|
3775
3788
|
} else {
|
|
3776
|
-
const c = [a, o], f = [t.rowIndex,
|
|
3789
|
+
const c = [a, o], f = [t.rowIndex, h];
|
|
3777
3790
|
this.setSelector(c, f);
|
|
3778
3791
|
}
|
|
3779
3792
|
}
|
|
@@ -3783,7 +3796,7 @@ class ui {
|
|
|
3783
3796
|
return;
|
|
3784
3797
|
const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
|
|
3785
3798
|
if (t && e && i) {
|
|
3786
|
-
const { rowIndex: s, colIndex: r } = e, o = Math.min(i.colIndex, r), a = Math.max(i.colIndex, r),
|
|
3799
|
+
const { rowIndex: s, colIndex: r } = e, o = Math.min(i.colIndex, r), a = Math.max(i.colIndex, r), h = Math.min(i.rowIndex, s), c = Math.max(i.rowIndex, s), f = [o, a], d = [h, c];
|
|
3787
3800
|
this.setSelector(f, d);
|
|
3788
3801
|
}
|
|
3789
3802
|
}
|
|
@@ -3791,7 +3804,7 @@ class ui {
|
|
|
3791
3804
|
const { focusCell: e, clickCell: i } = this.ctx;
|
|
3792
3805
|
if (e && this.isInSettingRange(e.rowIndex, e.colIndex))
|
|
3793
3806
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
3794
|
-
const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: a } = e,
|
|
3807
|
+
const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: a } = e, h = Math.min(o, s), c = Math.max(o, s), f = Math.min(a, r), d = Math.max(a, r), x = [h, c], u = [f, d];
|
|
3795
3808
|
this.setSelector(x, u);
|
|
3796
3809
|
} else {
|
|
3797
3810
|
this.ctx.emit("cellSelectedClick", e);
|
|
@@ -3832,8 +3845,8 @@ class ui {
|
|
|
3832
3845
|
let s = [];
|
|
3833
3846
|
const r = /* @__PURE__ */ new Set();
|
|
3834
3847
|
for (let a = 0; a <= e[1] - e[0]; a++)
|
|
3835
|
-
for (let
|
|
3836
|
-
const c = a + e[0], f =
|
|
3848
|
+
for (let h = 0; h <= t[1] - t[0]; h++) {
|
|
3849
|
+
const c = a + e[0], f = h + t[0], d = this.ctx.database.getItemValueForRowIndexAndColIndex(c, f);
|
|
3837
3850
|
if (d) {
|
|
3838
3851
|
const { rowKey: x, key: u } = d;
|
|
3839
3852
|
this.ctx.database.getReadonly(x, u) || (r.add(x), s.push({
|
|
@@ -3897,9 +3910,9 @@ class ui {
|
|
|
3897
3910
|
}
|
|
3898
3911
|
if (!a.length)
|
|
3899
3912
|
return;
|
|
3900
|
-
const { BEFORE_PASTE_CHANGE_METHOD:
|
|
3901
|
-
if (typeof
|
|
3902
|
-
const f =
|
|
3913
|
+
const { BEFORE_PASTE_CHANGE_METHOD: h } = this.ctx.config;
|
|
3914
|
+
if (typeof h == "function") {
|
|
3915
|
+
const f = h, d = a.map((x) => ({
|
|
3903
3916
|
rowKey: x.rowKey,
|
|
3904
3917
|
key: x.key,
|
|
3905
3918
|
value: x.value,
|
|
@@ -3928,7 +3941,7 @@ class ui {
|
|
|
3928
3941
|
if (!e)
|
|
3929
3942
|
return;
|
|
3930
3943
|
let { colIndex: i = 0, rowIndex: s = 0 } = e;
|
|
3931
|
-
const r = 0, o = 0, a = this.ctx.maxColIndex,
|
|
3944
|
+
const r = 0, o = 0, a = this.ctx.maxColIndex, h = this.ctx.maxRowIndex;
|
|
3932
3945
|
switch (t) {
|
|
3933
3946
|
case "LEFT":
|
|
3934
3947
|
i > r && i--;
|
|
@@ -3940,7 +3953,7 @@ class ui {
|
|
|
3940
3953
|
i < a && i++;
|
|
3941
3954
|
break;
|
|
3942
3955
|
case "BOTTOM":
|
|
3943
|
-
s <
|
|
3956
|
+
s < h && s++;
|
|
3944
3957
|
break;
|
|
3945
3958
|
}
|
|
3946
3959
|
const c = [i, i], f = [s, s], d = this.getCell(s, i);
|
|
@@ -3957,8 +3970,8 @@ class ui {
|
|
|
3957
3970
|
SELECTOR_AREA_MIN_Y: r,
|
|
3958
3971
|
SELECTOR_AREA_MAX_Y: o,
|
|
3959
3972
|
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
3960
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
3961
|
-
} = this.ctx.config, c = i, f = s || this.ctx.maxColIndex - a, d = r, x = o || this.ctx.maxRowIndex -
|
|
3973
|
+
SELECTOR_AREA_MAX_Y_OFFSET: h
|
|
3974
|
+
} = this.ctx.config, c = i, f = s || this.ctx.maxColIndex - a, d = r, x = o || this.ctx.maxRowIndex - h;
|
|
3962
3975
|
return !(e < c || e > f || t < d || t > x);
|
|
3963
3976
|
}
|
|
3964
3977
|
/**
|
|
@@ -3972,7 +3985,7 @@ class ui {
|
|
|
3972
3985
|
let a = 10 * (s === "left" ? -1 : 1);
|
|
3973
3986
|
this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
|
|
3974
3987
|
a *= 1.5;
|
|
3975
|
-
const { scrollX:
|
|
3988
|
+
const { scrollX: h } = this.ctx, c = h + a;
|
|
3976
3989
|
(c < 0 || c > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(c);
|
|
3977
3990
|
}, 100);
|
|
3978
3991
|
}
|
|
@@ -3981,7 +3994,7 @@ class ui {
|
|
|
3981
3994
|
let a = 10 * (r === "top" ? -1 : 1);
|
|
3982
3995
|
this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
|
|
3983
3996
|
a *= 1.5;
|
|
3984
|
-
const { scrollY:
|
|
3997
|
+
const { scrollY: h } = this.ctx, c = h + a;
|
|
3985
3998
|
(c < 0 || c > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(c);
|
|
3986
3999
|
}, 100);
|
|
3987
4000
|
}
|
|
@@ -3998,7 +4011,7 @@ class ui {
|
|
|
3998
4011
|
fixedLeftWidth: r,
|
|
3999
4012
|
header: o,
|
|
4000
4013
|
footer: a,
|
|
4001
|
-
body:
|
|
4014
|
+
body: h,
|
|
4002
4015
|
scrollX: c,
|
|
4003
4016
|
scrollY: f,
|
|
4004
4017
|
config: { SCROLLER_TRACK_SIZE: d, FOOTER_FIXED: x }
|
|
@@ -4007,7 +4020,7 @@ class ui {
|
|
|
4007
4020
|
return;
|
|
4008
4021
|
const u = r - i.drawX + 1, g = i.drawX + i.width - (e - s) + 1, w = o.height - i.drawY;
|
|
4009
4022
|
let p = i.height;
|
|
4010
|
-
p >
|
|
4023
|
+
p > h.visibleHeight && (p = h.visibleHeight);
|
|
4011
4024
|
let y = 0;
|
|
4012
4025
|
x && (y = a.visibleHeight);
|
|
4013
4026
|
const b = i.drawY + p - (t - y - d);
|
|
@@ -4020,14 +4033,14 @@ class ui {
|
|
|
4020
4033
|
}
|
|
4021
4034
|
class gi {
|
|
4022
4035
|
constructor(t) {
|
|
4023
|
-
|
|
4036
|
+
l(this, "ctx");
|
|
4024
4037
|
this.ctx = t, this.init();
|
|
4025
4038
|
}
|
|
4026
4039
|
init() {
|
|
4027
4040
|
this.ctx.on("cellMouseenter", (t, e) => {
|
|
4028
4041
|
this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default");
|
|
4029
|
-
const { offsetX: i, offsetY: s } = this.ctx.getOffset(e), { xArr: r, yArr: o } = this.ctx.selector, a = r[1],
|
|
4030
|
-
if (this.ctx.config.ENABLE_AUTOFILL && c === a && f ===
|
|
4042
|
+
const { offsetX: i, offsetY: s } = this.ctx.getOffset(e), { xArr: r, yArr: o } = this.ctx.selector, a = r[1], h = o[1], { colIndex: c, rowIndex: f, drawX: d, drawY: x, width: u, height: g } = t;
|
|
4043
|
+
if (this.ctx.config.ENABLE_AUTOFILL && c === a && f === h) {
|
|
4031
4044
|
const p = d + u - 6, y = x + g - 6;
|
|
4032
4045
|
i > p && s > y && (this.ctx.stageElement.style.cursor = "crosshair");
|
|
4033
4046
|
}
|
|
@@ -4060,22 +4073,22 @@ class gi {
|
|
|
4060
4073
|
return;
|
|
4061
4074
|
let o = t, a = e;
|
|
4062
4075
|
if (!r) {
|
|
4063
|
-
const [
|
|
4064
|
-
a = [
|
|
4076
|
+
const [h] = a;
|
|
4077
|
+
a = [h, h];
|
|
4065
4078
|
}
|
|
4066
4079
|
if (!s) {
|
|
4067
|
-
const [
|
|
4068
|
-
o = [
|
|
4080
|
+
const [h] = o;
|
|
4081
|
+
o = [h, h];
|
|
4069
4082
|
}
|
|
4070
4083
|
if (JSON.stringify(this.ctx.autofill.xArr) !== JSON.stringify(o) || JSON.stringify(this.ctx.autofill.yArr) !== JSON.stringify(a)) {
|
|
4071
4084
|
const {
|
|
4072
|
-
SELECTOR_AREA_MIN_X:
|
|
4085
|
+
SELECTOR_AREA_MIN_X: h,
|
|
4073
4086
|
SELECTOR_AREA_MAX_X: c,
|
|
4074
4087
|
SELECTOR_AREA_MIN_Y: f,
|
|
4075
4088
|
SELECTOR_AREA_MAX_Y: d,
|
|
4076
4089
|
SELECTOR_AREA_MAX_X_OFFSET: x,
|
|
4077
4090
|
SELECTOR_AREA_MAX_Y_OFFSET: u
|
|
4078
|
-
} = this.ctx.config, g =
|
|
4091
|
+
} = this.ctx.config, g = h, w = c || this.ctx.maxColIndex - x, p = f, y = d || this.ctx.maxRowIndex - u;
|
|
4079
4092
|
let [b, m] = o, [E, C] = a;
|
|
4080
4093
|
if (b < g || E < p)
|
|
4081
4094
|
return;
|
|
@@ -4092,11 +4105,11 @@ class gi {
|
|
|
4092
4105
|
const g = x + e.yArr[0], w = u + e.xArr[0];
|
|
4093
4106
|
i.set(`${g}-${w}`, !0);
|
|
4094
4107
|
}
|
|
4095
|
-
const { value: s } = e, r = s[0].length, o = s.length, a = this.ctx.autofill.xArr,
|
|
4108
|
+
const { value: s } = e, r = s[0].length, o = s.length, a = this.ctx.autofill.xArr, h = this.ctx.autofill.yArr;
|
|
4096
4109
|
let c = [];
|
|
4097
|
-
for (let x = 0; x <=
|
|
4110
|
+
for (let x = 0; x <= h[1] - h[0]; x++)
|
|
4098
4111
|
for (let u = 0; u <= a[1] - a[0]; u++) {
|
|
4099
|
-
const g = u + a[0], w = x +
|
|
4112
|
+
const g = u + a[0], w = x + h[0], p = s[x % o][u % r], y = this.ctx.database.getItemValueForRowIndexAndColIndex(w, g), b = `${w}-${g}`;
|
|
4100
4113
|
if (y && !i.has(b)) {
|
|
4101
4114
|
const { rowKey: m, key: E } = y;
|
|
4102
4115
|
this.ctx.database.getReadonly(m, E) || (t.add(m), c.push({
|
|
@@ -4159,7 +4172,7 @@ function at(n, t) {
|
|
|
4159
4172
|
function q(n) {
|
|
4160
4173
|
return n.split("-")[0];
|
|
4161
4174
|
}
|
|
4162
|
-
function
|
|
4175
|
+
function lt(n) {
|
|
4163
4176
|
return n.split("-")[1];
|
|
4164
4177
|
}
|
|
4165
4178
|
function re(n) {
|
|
@@ -4176,7 +4189,7 @@ function Mt(n) {
|
|
|
4176
4189
|
}
|
|
4177
4190
|
function yi(n, t, e) {
|
|
4178
4191
|
e === void 0 && (e = !1);
|
|
4179
|
-
const i =
|
|
4192
|
+
const i = lt(n), s = Mt(n), r = Lt(s);
|
|
4180
4193
|
let o = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
|
|
4181
4194
|
return t.reference[r] > t.floating[r] && (o = xt(o)), [o, xt(o)];
|
|
4182
4195
|
}
|
|
@@ -4201,7 +4214,7 @@ function Ei(n, t, e) {
|
|
|
4201
4214
|
}
|
|
4202
4215
|
}
|
|
4203
4216
|
function bi(n, t, e, i) {
|
|
4204
|
-
const s =
|
|
4217
|
+
const s = lt(n);
|
|
4205
4218
|
let r = Ei(q(n), e === "start", i);
|
|
4206
4219
|
return s && (r = r.map((o) => o + "-" + s), t && (r = r.concat(r.map(Ot)))), r;
|
|
4207
4220
|
}
|
|
@@ -4248,9 +4261,9 @@ function Vt(n, t, e) {
|
|
|
4248
4261
|
reference: i,
|
|
4249
4262
|
floating: s
|
|
4250
4263
|
} = n;
|
|
4251
|
-
const r = J(t), o = Mt(t), a = Lt(o),
|
|
4264
|
+
const r = J(t), o = Mt(t), a = Lt(o), h = q(t), c = r === "y", f = i.x + i.width / 2 - s.width / 2, d = i.y + i.height / 2 - s.height / 2, x = i[a] / 2 - s[a] / 2;
|
|
4252
4265
|
let u;
|
|
4253
|
-
switch (
|
|
4266
|
+
switch (h) {
|
|
4254
4267
|
case "top":
|
|
4255
4268
|
u = {
|
|
4256
4269
|
x: f,
|
|
@@ -4281,7 +4294,7 @@ function Vt(n, t, e) {
|
|
|
4281
4294
|
y: i.y
|
|
4282
4295
|
};
|
|
4283
4296
|
}
|
|
4284
|
-
switch (
|
|
4297
|
+
switch (lt(t)) {
|
|
4285
4298
|
case "start":
|
|
4286
4299
|
u[o] -= x * (e && c ? -1 : 1);
|
|
4287
4300
|
break;
|
|
@@ -4297,7 +4310,7 @@ const vi = async (n, t, e) => {
|
|
|
4297
4310
|
strategy: s = "absolute",
|
|
4298
4311
|
middleware: r = [],
|
|
4299
4312
|
platform: o
|
|
4300
|
-
} = e, a = r.filter(Boolean),
|
|
4313
|
+
} = e, a = r.filter(Boolean), h = await (o.isRTL == null ? void 0 : o.isRTL(t));
|
|
4301
4314
|
let c = await o.getElementRects({
|
|
4302
4315
|
reference: n,
|
|
4303
4316
|
floating: t,
|
|
@@ -4305,7 +4318,7 @@ const vi = async (n, t, e) => {
|
|
|
4305
4318
|
}), {
|
|
4306
4319
|
x: f,
|
|
4307
4320
|
y: d
|
|
4308
|
-
} = Vt(c, i,
|
|
4321
|
+
} = Vt(c, i, h), x = i, u = {}, g = 0;
|
|
4309
4322
|
for (let w = 0; w < a.length; w++) {
|
|
4310
4323
|
const {
|
|
4311
4324
|
name: p,
|
|
@@ -4342,7 +4355,7 @@ const vi = async (n, t, e) => {
|
|
|
4342
4355
|
}) : C.rects), {
|
|
4343
4356
|
x: f,
|
|
4344
4357
|
y: d
|
|
4345
|
-
} = Vt(c, x,
|
|
4358
|
+
} = Vt(c, x, h)), w = -1);
|
|
4346
4359
|
}
|
|
4347
4360
|
return {
|
|
4348
4361
|
x: f,
|
|
@@ -4361,7 +4374,7 @@ async function ne(n, t) {
|
|
|
4361
4374
|
platform: r,
|
|
4362
4375
|
rects: o,
|
|
4363
4376
|
elements: a,
|
|
4364
|
-
strategy:
|
|
4377
|
+
strategy: h
|
|
4365
4378
|
} = n, {
|
|
4366
4379
|
boundary: c = "clippingAncestors",
|
|
4367
4380
|
rootBoundary: f = "viewport",
|
|
@@ -4372,7 +4385,7 @@ async function ne(n, t) {
|
|
|
4372
4385
|
element: (e = await (r.isElement == null ? void 0 : r.isElement(p))) == null || e ? p : p.contextElement || await (r.getDocumentElement == null ? void 0 : r.getDocumentElement(a.floating)),
|
|
4373
4386
|
boundary: c,
|
|
4374
4387
|
rootBoundary: f,
|
|
4375
|
-
strategy:
|
|
4388
|
+
strategy: h
|
|
4376
4389
|
})), b = d === "floating" ? {
|
|
4377
4390
|
x: i,
|
|
4378
4391
|
y: s,
|
|
@@ -4388,7 +4401,7 @@ async function ne(n, t) {
|
|
|
4388
4401
|
elements: a,
|
|
4389
4402
|
rect: b,
|
|
4390
4403
|
offsetParent: m,
|
|
4391
|
-
strategy:
|
|
4404
|
+
strategy: h
|
|
4392
4405
|
}) : b);
|
|
4393
4406
|
return {
|
|
4394
4407
|
top: (y.top - C.top + g.top) / E.y,
|
|
@@ -4408,7 +4421,7 @@ const Ri = (n) => ({
|
|
|
4408
4421
|
rects: r,
|
|
4409
4422
|
platform: o,
|
|
4410
4423
|
elements: a,
|
|
4411
|
-
middlewareData:
|
|
4424
|
+
middlewareData: h
|
|
4412
4425
|
} = t, {
|
|
4413
4426
|
element: c,
|
|
4414
4427
|
padding: f = 0
|
|
@@ -4421,17 +4434,17 @@ const Ri = (n) => ({
|
|
|
4421
4434
|
}, u = Mt(s), g = Lt(u), w = await o.getDimensions(c), p = u === "y", y = p ? "top" : "left", b = p ? "bottom" : "right", m = p ? "clientHeight" : "clientWidth", E = r.reference[g] + r.reference[u] - x[u] - r.floating[g], C = x[u] - r.reference[u], R = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(c));
|
|
4422
4435
|
let T = R ? R[m] : 0;
|
|
4423
4436
|
(!T || !await (o.isElement == null ? void 0 : o.isElement(R))) && (T = a.floating[m] || r.floating[g]);
|
|
4424
|
-
const A = E / 2 - C / 2, L = T / 2 - w[g] / 2 - 1, D = rt(d[y], L), B = rt(d[b], L), I = D, S = T - w[g] - B, O = T / 2 - w[g] / 2 + A, G = It(I, O, S),
|
|
4437
|
+
const A = E / 2 - C / 2, L = T / 2 - w[g] / 2 - 1, D = rt(d[y], L), B = rt(d[b], L), I = D, S = T - w[g] - B, O = T / 2 - w[g] / 2 + A, G = It(I, O, S), K = !h.arrow && lt(s) != null && O !== G && r.reference[g] / 2 - (O < I ? D : B) - w[g] / 2 < 0, k = K ? O < I ? O - I : O - S : 0;
|
|
4425
4438
|
return {
|
|
4426
4439
|
[u]: x[u] + k,
|
|
4427
4440
|
data: {
|
|
4428
4441
|
[u]: G,
|
|
4429
4442
|
centerOffset: O - G - k,
|
|
4430
|
-
...
|
|
4443
|
+
...K && {
|
|
4431
4444
|
alignmentOffset: k
|
|
4432
4445
|
}
|
|
4433
4446
|
},
|
|
4434
|
-
reset:
|
|
4447
|
+
reset: K
|
|
4435
4448
|
};
|
|
4436
4449
|
}
|
|
4437
4450
|
}), _i = function(n) {
|
|
@@ -4445,7 +4458,7 @@ const Ri = (n) => ({
|
|
|
4445
4458
|
middlewareData: r,
|
|
4446
4459
|
rects: o,
|
|
4447
4460
|
initialPlacement: a,
|
|
4448
|
-
platform:
|
|
4461
|
+
platform: h,
|
|
4449
4462
|
elements: c
|
|
4450
4463
|
} = t, {
|
|
4451
4464
|
mainAxis: f = !0,
|
|
@@ -4458,7 +4471,7 @@ const Ri = (n) => ({
|
|
|
4458
4471
|
} = at(n, t);
|
|
4459
4472
|
if ((e = r.arrow) != null && e.alignmentOffset)
|
|
4460
4473
|
return {};
|
|
4461
|
-
const y = q(s), b = J(a), m = q(a) === a, E = await (
|
|
4474
|
+
const y = q(s), b = J(a), m = q(a) === a, E = await (h.isRTL == null ? void 0 : h.isRTL(c.floating)), C = x || (m || !w ? [xt(a)] : mi(a)), R = g !== "none";
|
|
4462
4475
|
!x && R && C.push(...bi(a, w, g, E));
|
|
4463
4476
|
const T = [a, ...C], A = await ne(t, p), L = [];
|
|
4464
4477
|
let D = ((i = r.flip) == null ? void 0 : i.overflows) || [];
|
|
@@ -4482,8 +4495,8 @@ const Ri = (n) => ({
|
|
|
4482
4495
|
placement: G
|
|
4483
4496
|
}
|
|
4484
4497
|
};
|
|
4485
|
-
let
|
|
4486
|
-
if (!
|
|
4498
|
+
let K = (I = D.filter((k) => k.overflows[0] <= 0).sort((k, W) => k.overflows[1] - W.overflows[1])[0]) == null ? void 0 : I.placement;
|
|
4499
|
+
if (!K)
|
|
4487
4500
|
switch (u) {
|
|
4488
4501
|
case "bestFit": {
|
|
4489
4502
|
var S;
|
|
@@ -4496,17 +4509,17 @@ const Ri = (n) => ({
|
|
|
4496
4509
|
}
|
|
4497
4510
|
return !0;
|
|
4498
4511
|
}).map((W) => [W.placement, W.overflows.filter((P) => P > 0).reduce((P, ye) => P + ye, 0)]).sort((W, P) => W[1] - P[1])[0]) == null ? void 0 : S[0];
|
|
4499
|
-
k && (
|
|
4512
|
+
k && (K = k);
|
|
4500
4513
|
break;
|
|
4501
4514
|
}
|
|
4502
4515
|
case "initialPlacement":
|
|
4503
|
-
|
|
4516
|
+
K = a;
|
|
4504
4517
|
break;
|
|
4505
4518
|
}
|
|
4506
|
-
if (s !==
|
|
4519
|
+
if (s !== K)
|
|
4507
4520
|
return {
|
|
4508
4521
|
reset: {
|
|
4509
|
-
placement:
|
|
4522
|
+
placement: K
|
|
4510
4523
|
}
|
|
4511
4524
|
};
|
|
4512
4525
|
}
|
|
@@ -4519,7 +4532,7 @@ async function Ii(n, t) {
|
|
|
4519
4532
|
placement: e,
|
|
4520
4533
|
platform: i,
|
|
4521
4534
|
elements: s
|
|
4522
|
-
} = n, r = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), o = q(e), a =
|
|
4535
|
+
} = n, r = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), o = q(e), a = lt(e), h = J(e) === "y", c = ["left", "top"].includes(o) ? -1 : 1, f = r && h ? -1 : 1, d = at(t, n);
|
|
4523
4536
|
let {
|
|
4524
4537
|
mainAxis: x,
|
|
4525
4538
|
crossAxis: u,
|
|
@@ -4533,7 +4546,7 @@ async function Ii(n, t) {
|
|
|
4533
4546
|
crossAxis: d.crossAxis || 0,
|
|
4534
4547
|
alignmentAxis: d.alignmentAxis
|
|
4535
4548
|
};
|
|
4536
|
-
return a && typeof g == "number" && (u = a === "end" ? g * -1 : g),
|
|
4549
|
+
return a && typeof g == "number" && (u = a === "end" ? g * -1 : g), h ? {
|
|
4537
4550
|
x: u * f,
|
|
4538
4551
|
y: x * c
|
|
4539
4552
|
} : {
|
|
@@ -4552,12 +4565,12 @@ const Oi = function(n) {
|
|
|
4552
4565
|
y: r,
|
|
4553
4566
|
placement: o,
|
|
4554
4567
|
middlewareData: a
|
|
4555
|
-
} = t,
|
|
4568
|
+
} = t, h = await Ii(t, n);
|
|
4556
4569
|
return o === ((e = a.offset) == null ? void 0 : e.placement) && (i = a.arrow) != null && i.alignmentOffset ? {} : {
|
|
4557
|
-
x: s +
|
|
4558
|
-
y: r +
|
|
4570
|
+
x: s + h.x,
|
|
4571
|
+
y: r + h.y,
|
|
4559
4572
|
data: {
|
|
4560
|
-
...
|
|
4573
|
+
...h,
|
|
4561
4574
|
placement: o
|
|
4562
4575
|
}
|
|
4563
4576
|
};
|
|
@@ -4587,11 +4600,11 @@ const Oi = function(n) {
|
|
|
4587
4600
|
};
|
|
4588
4601
|
}
|
|
4589
4602
|
},
|
|
4590
|
-
...
|
|
4603
|
+
...h
|
|
4591
4604
|
} = at(n, t), c = {
|
|
4592
4605
|
x: e,
|
|
4593
4606
|
y: i
|
|
4594
|
-
}, f = await ne(t,
|
|
4607
|
+
}, f = await ne(t, h), d = J(q(s)), x = re(d);
|
|
4595
4608
|
let u = c[x], g = c[d];
|
|
4596
4609
|
if (r) {
|
|
4597
4610
|
const p = x === "y" ? "top" : "left", y = x === "y" ? "bottom" : "right", b = u + f[p], m = u - f[y];
|
|
@@ -4630,7 +4643,7 @@ function H(n) {
|
|
|
4630
4643
|
var t;
|
|
4631
4644
|
return (n == null || (t = n.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
4632
4645
|
}
|
|
4633
|
-
function
|
|
4646
|
+
function Y(n) {
|
|
4634
4647
|
var t;
|
|
4635
4648
|
return (t = (ae(n) ? n.ownerDocument : n.document) || window.document) == null ? void 0 : t.documentElement;
|
|
4636
4649
|
}
|
|
@@ -4646,7 +4659,7 @@ function N(n) {
|
|
|
4646
4659
|
function zt(n) {
|
|
4647
4660
|
return !gt() || typeof ShadowRoot > "u" ? !1 : n instanceof ShadowRoot || n instanceof H(n).ShadowRoot;
|
|
4648
4661
|
}
|
|
4649
|
-
function
|
|
4662
|
+
function ht(n) {
|
|
4650
4663
|
const {
|
|
4651
4664
|
overflow: t,
|
|
4652
4665
|
overflowX: e,
|
|
@@ -4708,28 +4721,28 @@ function z(n) {
|
|
|
4708
4721
|
n.assignedSlot || // DOM Element detected.
|
|
4709
4722
|
n.parentNode || // ShadowRoot detected.
|
|
4710
4723
|
zt(n) && n.host || // Fallback.
|
|
4711
|
-
|
|
4724
|
+
Y(n)
|
|
4712
4725
|
);
|
|
4713
4726
|
return zt(t) ? t.host : t;
|
|
4714
4727
|
}
|
|
4715
|
-
function
|
|
4728
|
+
function le(n) {
|
|
4716
4729
|
const t = z(n);
|
|
4717
|
-
return Q(t) ? n.ownerDocument ? n.ownerDocument.body : n.body : N(t) &&
|
|
4730
|
+
return Q(t) ? n.ownerDocument ? n.ownerDocument.body : n.body : N(t) && ht(t) ? t : le(t);
|
|
4718
4731
|
}
|
|
4719
4732
|
function Tt(n, t, e) {
|
|
4720
4733
|
var i;
|
|
4721
4734
|
t === void 0 && (t = []), e === void 0 && (e = !0);
|
|
4722
|
-
const s =
|
|
4735
|
+
const s = le(n), r = s === ((i = n.ownerDocument) == null ? void 0 : i.body), o = H(s);
|
|
4723
4736
|
if (r) {
|
|
4724
4737
|
const a = St(o);
|
|
4725
|
-
return t.concat(o, o.visualViewport || [],
|
|
4738
|
+
return t.concat(o, o.visualViewport || [], ht(s) ? s : [], a && e ? Tt(a) : []);
|
|
4726
4739
|
}
|
|
4727
4740
|
return t.concat(s, Tt(s, [], e));
|
|
4728
4741
|
}
|
|
4729
4742
|
function St(n) {
|
|
4730
4743
|
return n.parent && Object.getPrototypeOf(n.parent) ? n.frameElement : null;
|
|
4731
4744
|
}
|
|
4732
|
-
function
|
|
4745
|
+
function he(n) {
|
|
4733
4746
|
const t = X(n);
|
|
4734
4747
|
let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
|
|
4735
4748
|
const s = N(n), r = s ? n.offsetWidth : e, o = s ? n.offsetHeight : i, a = ft(e) !== r || ft(i) !== o;
|
|
@@ -4750,7 +4763,7 @@ function Z(n) {
|
|
|
4750
4763
|
width: i,
|
|
4751
4764
|
height: s,
|
|
4752
4765
|
$: r
|
|
4753
|
-
} =
|
|
4766
|
+
} = he(t);
|
|
4754
4767
|
let o = (r ? ft(e.width) : e.width) / i, a = (r ? ft(e.height) : e.height) / s;
|
|
4755
4768
|
return (!o || !Number.isFinite(o)) && (o = 1), (!a || !Number.isFinite(a)) && (a = 1), {
|
|
4756
4769
|
x: o,
|
|
@@ -4774,19 +4787,19 @@ function ot(n, t, e, i) {
|
|
|
4774
4787
|
let o = V(1);
|
|
4775
4788
|
t && (i ? F(i) && (o = Z(i)) : o = Z(n));
|
|
4776
4789
|
const a = Mi(r, e, i) ? de(r) : V(0);
|
|
4777
|
-
let
|
|
4790
|
+
let h = (s.left + a.x) / o.x, c = (s.top + a.y) / o.y, f = s.width / o.x, d = s.height / o.y;
|
|
4778
4791
|
if (r) {
|
|
4779
4792
|
const x = H(r), u = i && F(i) ? H(i) : i;
|
|
4780
4793
|
let g = x, w = St(g);
|
|
4781
4794
|
for (; w && i && u !== g; ) {
|
|
4782
4795
|
const p = Z(w), y = w.getBoundingClientRect(), b = X(w), m = y.left + (w.clientLeft + parseFloat(b.paddingLeft)) * p.x, E = y.top + (w.clientTop + parseFloat(b.paddingTop)) * p.y;
|
|
4783
|
-
|
|
4796
|
+
h *= p.x, c *= p.y, f *= p.x, d *= p.y, h += m, c += E, g = H(w), w = St(g);
|
|
4784
4797
|
}
|
|
4785
4798
|
}
|
|
4786
4799
|
return ut({
|
|
4787
4800
|
width: f,
|
|
4788
4801
|
height: d,
|
|
4789
|
-
x:
|
|
4802
|
+
x: h,
|
|
4790
4803
|
y: c
|
|
4791
4804
|
});
|
|
4792
4805
|
}
|
|
@@ -4797,23 +4810,23 @@ function Hi(n) {
|
|
|
4797
4810
|
offsetParent: i,
|
|
4798
4811
|
strategy: s
|
|
4799
4812
|
} = n;
|
|
4800
|
-
const r = s === "fixed", o =
|
|
4813
|
+
const r = s === "fixed", o = Y(i), a = t ? wt(t.floating) : !1;
|
|
4801
4814
|
if (i === o || a && r)
|
|
4802
4815
|
return e;
|
|
4803
|
-
let
|
|
4816
|
+
let h = {
|
|
4804
4817
|
scrollLeft: 0,
|
|
4805
4818
|
scrollTop: 0
|
|
4806
4819
|
}, c = V(1);
|
|
4807
4820
|
const f = V(0), d = N(i);
|
|
4808
|
-
if ((d || !d && !r) && ((tt(i) !== "body" ||
|
|
4821
|
+
if ((d || !d && !r) && ((tt(i) !== "body" || ht(o)) && (h = pt(i)), N(i))) {
|
|
4809
4822
|
const x = ot(i);
|
|
4810
4823
|
c = Z(i), f.x = x.x + i.clientLeft, f.y = x.y + i.clientTop;
|
|
4811
4824
|
}
|
|
4812
4825
|
return {
|
|
4813
4826
|
width: e.width * c.x,
|
|
4814
4827
|
height: e.height * c.y,
|
|
4815
|
-
x: e.x * c.x -
|
|
4816
|
-
y: e.y * c.y -
|
|
4828
|
+
x: e.x * c.x - h.scrollLeft * c.x + f.x,
|
|
4829
|
+
y: e.y * c.y - h.scrollTop * c.y + f.y
|
|
4817
4830
|
};
|
|
4818
4831
|
}
|
|
4819
4832
|
function Di(n) {
|
|
@@ -4821,10 +4834,10 @@ function Di(n) {
|
|
|
4821
4834
|
}
|
|
4822
4835
|
function At(n, t) {
|
|
4823
4836
|
const e = pt(n).scrollLeft;
|
|
4824
|
-
return t ? t.left + e : ot(
|
|
4837
|
+
return t ? t.left + e : ot(Y(n)).left + e;
|
|
4825
4838
|
}
|
|
4826
4839
|
function Fi(n) {
|
|
4827
|
-
const t =
|
|
4840
|
+
const t = Y(n), e = pt(n), i = n.ownerDocument.body, s = U(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), r = U(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
|
|
4828
4841
|
let o = -e.scrollLeft + At(n);
|
|
4829
4842
|
const a = -e.scrollTop;
|
|
4830
4843
|
return X(i).direction === "rtl" && (o += U(t.clientWidth, i.clientWidth) - s), {
|
|
@@ -4835,26 +4848,26 @@ function Fi(n) {
|
|
|
4835
4848
|
};
|
|
4836
4849
|
}
|
|
4837
4850
|
function Xi(n, t) {
|
|
4838
|
-
const e = H(n), i =
|
|
4839
|
-
let r = i.clientWidth, o = i.clientHeight, a = 0,
|
|
4851
|
+
const e = H(n), i = Y(n), s = e.visualViewport;
|
|
4852
|
+
let r = i.clientWidth, o = i.clientHeight, a = 0, h = 0;
|
|
4840
4853
|
if (s) {
|
|
4841
4854
|
r = s.width, o = s.height;
|
|
4842
4855
|
const c = Dt();
|
|
4843
|
-
(!c || c && t === "fixed") && (a = s.offsetLeft,
|
|
4856
|
+
(!c || c && t === "fixed") && (a = s.offsetLeft, h = s.offsetTop);
|
|
4844
4857
|
}
|
|
4845
4858
|
return {
|
|
4846
4859
|
width: r,
|
|
4847
4860
|
height: o,
|
|
4848
4861
|
x: a,
|
|
4849
|
-
y:
|
|
4862
|
+
y: h
|
|
4850
4863
|
};
|
|
4851
4864
|
}
|
|
4852
4865
|
function ki(n, t) {
|
|
4853
|
-
const e = ot(n, !0, t === "fixed"), i = e.top + n.clientTop, s = e.left + n.clientLeft, r = N(n) ? Z(n) : V(1), o = n.clientWidth * r.x, a = n.clientHeight * r.y,
|
|
4866
|
+
const e = ot(n, !0, t === "fixed"), i = e.top + n.clientTop, s = e.left + n.clientLeft, r = N(n) ? Z(n) : V(1), o = n.clientWidth * r.x, a = n.clientHeight * r.y, h = s * r.x, c = i * r.y;
|
|
4854
4867
|
return {
|
|
4855
4868
|
width: o,
|
|
4856
4869
|
height: a,
|
|
4857
|
-
x:
|
|
4870
|
+
x: h,
|
|
4858
4871
|
y: c
|
|
4859
4872
|
};
|
|
4860
4873
|
}
|
|
@@ -4863,7 +4876,7 @@ function $t(n, t, e) {
|
|
|
4863
4876
|
if (t === "viewport")
|
|
4864
4877
|
i = Xi(n, e);
|
|
4865
4878
|
else if (t === "document")
|
|
4866
|
-
i = Fi(
|
|
4879
|
+
i = Fi(Y(n));
|
|
4867
4880
|
else if (F(t))
|
|
4868
4881
|
i = ki(t, e);
|
|
4869
4882
|
else {
|
|
@@ -4888,58 +4901,58 @@ function Ni(n, t) {
|
|
|
4888
4901
|
const r = X(n).position === "fixed";
|
|
4889
4902
|
let o = r ? z(n) : n;
|
|
4890
4903
|
for (; F(o) && !Q(o); ) {
|
|
4891
|
-
const a = X(o),
|
|
4892
|
-
!
|
|
4904
|
+
const a = X(o), h = Ht(o);
|
|
4905
|
+
!h && a.position === "fixed" && (s = null), (r ? !h && !s : !h && a.position === "static" && !!s && ["absolute", "fixed"].includes(s.position) || ht(o) && !h && fe(n, o)) ? i = i.filter((f) => f !== o) : s = a, o = z(o);
|
|
4893
4906
|
}
|
|
4894
4907
|
return t.set(n, i), i;
|
|
4895
4908
|
}
|
|
4896
|
-
function
|
|
4909
|
+
function Ki(n) {
|
|
4897
4910
|
let {
|
|
4898
4911
|
element: t,
|
|
4899
4912
|
boundary: e,
|
|
4900
4913
|
rootBoundary: i,
|
|
4901
4914
|
strategy: s
|
|
4902
4915
|
} = n;
|
|
4903
|
-
const o = [...e === "clippingAncestors" ? wt(t) ? [] : Ni(t, this._c) : [].concat(e), i], a = o[0],
|
|
4916
|
+
const o = [...e === "clippingAncestors" ? wt(t) ? [] : Ni(t, this._c) : [].concat(e), i], a = o[0], h = o.reduce((c, f) => {
|
|
4904
4917
|
const d = $t(t, f, s);
|
|
4905
4918
|
return c.top = U(d.top, c.top), c.right = rt(d.right, c.right), c.bottom = rt(d.bottom, c.bottom), c.left = U(d.left, c.left), c;
|
|
4906
4919
|
}, $t(t, a, s));
|
|
4907
4920
|
return {
|
|
4908
|
-
width:
|
|
4909
|
-
height:
|
|
4910
|
-
x:
|
|
4911
|
-
y:
|
|
4921
|
+
width: h.right - h.left,
|
|
4922
|
+
height: h.bottom - h.top,
|
|
4923
|
+
x: h.left,
|
|
4924
|
+
y: h.top
|
|
4912
4925
|
};
|
|
4913
4926
|
}
|
|
4914
|
-
function
|
|
4927
|
+
function Yi(n) {
|
|
4915
4928
|
const {
|
|
4916
4929
|
width: t,
|
|
4917
4930
|
height: e
|
|
4918
|
-
} =
|
|
4931
|
+
} = he(n);
|
|
4919
4932
|
return {
|
|
4920
4933
|
width: t,
|
|
4921
4934
|
height: e
|
|
4922
4935
|
};
|
|
4923
4936
|
}
|
|
4924
4937
|
function Bi(n, t, e) {
|
|
4925
|
-
const i = N(t), s =
|
|
4938
|
+
const i = N(t), s = Y(t), r = e === "fixed", o = ot(n, !0, r, t);
|
|
4926
4939
|
let a = {
|
|
4927
4940
|
scrollLeft: 0,
|
|
4928
4941
|
scrollTop: 0
|
|
4929
4942
|
};
|
|
4930
|
-
const
|
|
4943
|
+
const h = V(0);
|
|
4931
4944
|
if (i || !i && !r)
|
|
4932
|
-
if ((tt(t) !== "body" ||
|
|
4945
|
+
if ((tt(t) !== "body" || ht(s)) && (a = pt(t)), i) {
|
|
4933
4946
|
const u = ot(t, !0, r, t);
|
|
4934
|
-
|
|
4935
|
-
} else s && (
|
|
4947
|
+
h.x = u.x + t.clientLeft, h.y = u.y + t.clientTop;
|
|
4948
|
+
} else s && (h.x = At(s));
|
|
4936
4949
|
let c = 0, f = 0;
|
|
4937
4950
|
if (s && !i && !r) {
|
|
4938
4951
|
const u = s.getBoundingClientRect();
|
|
4939
4952
|
f = u.top + a.scrollTop, c = u.left + a.scrollLeft - // RTL <body> scrollbar.
|
|
4940
4953
|
At(s, u);
|
|
4941
4954
|
}
|
|
4942
|
-
const d = o.left + a.scrollLeft -
|
|
4955
|
+
const d = o.left + a.scrollLeft - h.x - c, x = o.top + a.scrollTop - h.y - f;
|
|
4943
4956
|
return {
|
|
4944
4957
|
x: d,
|
|
4945
4958
|
y: x,
|
|
@@ -4956,7 +4969,7 @@ function qt(n, t) {
|
|
|
4956
4969
|
if (t)
|
|
4957
4970
|
return t(n);
|
|
4958
4971
|
let e = n.offsetParent;
|
|
4959
|
-
return
|
|
4972
|
+
return Y(n) === e && (e = e.ownerDocument.body), e;
|
|
4960
4973
|
}
|
|
4961
4974
|
function xe(n, t) {
|
|
4962
4975
|
const e = H(n);
|
|
@@ -4993,12 +5006,12 @@ function Pi(n) {
|
|
|
4993
5006
|
}
|
|
4994
5007
|
const Vi = {
|
|
4995
5008
|
convertOffsetParentRelativeRectToViewportRelativeRect: Hi,
|
|
4996
|
-
getDocumentElement:
|
|
4997
|
-
getClippingRect:
|
|
5009
|
+
getDocumentElement: Y,
|
|
5010
|
+
getClippingRect: Ki,
|
|
4998
5011
|
getOffsetParent: xe,
|
|
4999
5012
|
getElementRects: Wi,
|
|
5000
5013
|
getClientRects: Di,
|
|
5001
|
-
getDimensions:
|
|
5014
|
+
getDimensions: Yi,
|
|
5002
5015
|
getScale: Z,
|
|
5003
5016
|
isElement: F,
|
|
5004
5017
|
isRTL: Pi
|
|
@@ -5017,11 +5030,11 @@ const Vi = {
|
|
|
5017
5030
|
};
|
|
5018
5031
|
let $i = class {
|
|
5019
5032
|
constructor(t) {
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5033
|
+
l(this, "ctx");
|
|
5034
|
+
l(this, "enable", !1);
|
|
5035
|
+
l(this, "contentEl");
|
|
5036
|
+
l(this, "floatingEl");
|
|
5037
|
+
l(this, "arrowEl");
|
|
5025
5038
|
this.ctx = t;
|
|
5026
5039
|
const { TOOLTIP_BG_COLOR: e, TOOLTIP_TEXT_COLOR: i, TOOLTIP_ZINDEX: s, TOOLTIP_CUSTOM_STYLE: r, CSS_PREFIX: o } = this.ctx.config;
|
|
5027
5040
|
this.contentEl = document.createElement("div"), this.arrowEl = document.createElement("div"), this.floatingEl = document.createElement("div"), this.floatingEl.className = `${o}-tooltip`, this.contentEl.className = `${o}-tooltip-content`, this.arrowEl.className = `${o}-tooltip-arrow`;
|
|
@@ -5036,7 +5049,7 @@ let $i = class {
|
|
|
5036
5049
|
borderRadius: "4px",
|
|
5037
5050
|
fontSize: "12px",
|
|
5038
5051
|
...r
|
|
5039
|
-
},
|
|
5052
|
+
}, h = {
|
|
5040
5053
|
position: "absolute",
|
|
5041
5054
|
width: "10px",
|
|
5042
5055
|
height: "10px",
|
|
@@ -5045,7 +5058,7 @@ let $i = class {
|
|
|
5045
5058
|
transform: "rotate(45deg)",
|
|
5046
5059
|
zIndex: a.zIndex
|
|
5047
5060
|
};
|
|
5048
|
-
Object.assign(this.arrowEl.style,
|
|
5061
|
+
Object.assign(this.arrowEl.style, h), Object.assign(this.floatingEl.style, a), this.floatingEl.appendChild(this.contentEl), this.floatingEl.appendChild(this.arrowEl), this.ctx.containerElement.appendChild(this.floatingEl), this.init();
|
|
5049
5062
|
}
|
|
5050
5063
|
init() {
|
|
5051
5064
|
this.ctx.on("mousemove", (t) => {
|
|
@@ -5089,10 +5102,10 @@ let $i = class {
|
|
|
5089
5102
|
placement: t.overflowTooltipPlacement,
|
|
5090
5103
|
middleware: [ge(), we(), ue(6), zi({ element: this.arrowEl })]
|
|
5091
5104
|
}).then((a) => {
|
|
5092
|
-
const { x:
|
|
5105
|
+
const { x: h, y: c, placement: f, middlewareData: d } = a;
|
|
5093
5106
|
if (Object.assign(this.floatingEl.style, {
|
|
5094
5107
|
top: `${c}px`,
|
|
5095
|
-
left: `${
|
|
5108
|
+
left: `${h}px`
|
|
5096
5109
|
}), d.arrow) {
|
|
5097
5110
|
const x = d.arrow;
|
|
5098
5111
|
["left", "left-start", "left-end"].includes(f) ? Object.assign(this.arrowEl.style, {
|
|
@@ -5128,13 +5141,13 @@ let $i = class {
|
|
|
5128
5141
|
};
|
|
5129
5142
|
class qi {
|
|
5130
5143
|
constructor(t) {
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5144
|
+
l(this, "editorEl");
|
|
5145
|
+
l(this, "inputEl");
|
|
5146
|
+
l(this, "enable", !1);
|
|
5147
|
+
l(this, "cellTarget", null);
|
|
5148
|
+
l(this, "ctx");
|
|
5149
|
+
l(this, "drawY", 0);
|
|
5150
|
+
l(this, "drawX", 0);
|
|
5138
5151
|
this.ctx = t, this.initTextEditor(), this.init();
|
|
5139
5152
|
}
|
|
5140
5153
|
init() {
|
|
@@ -5219,12 +5232,12 @@ class qi {
|
|
|
5219
5232
|
this.drawX = r, this.drawY = o;
|
|
5220
5233
|
let { height: a } = t;
|
|
5221
5234
|
const {
|
|
5222
|
-
config: { CELL_PADDING:
|
|
5235
|
+
config: { CELL_PADDING: h },
|
|
5223
5236
|
header: c
|
|
5224
5237
|
} = this.ctx;
|
|
5225
5238
|
let f = this.ctx.body.visibleHeight;
|
|
5226
5239
|
if (a > f && (a = f), this.editorEl.style.left = `${r - 1}px`, this.editorEl.style.top = `${o - 1}px`, this.editorEl.style.bottom = "auto", this.editorEl.style.maxHeight = `${f}px`, s === "text") {
|
|
5227
|
-
this.inputEl.style.display = "block", this.inputEl.style.minWidth = `${i - 1}px`, this.inputEl.style.minHeight = `${a - 1}px`, this.inputEl.style.maxHeight = `${f}px`, this.inputEl.style.width = `${i - 1}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${
|
|
5240
|
+
this.inputEl.style.display = "block", this.inputEl.style.minWidth = `${i - 1}px`, this.inputEl.style.minHeight = `${a - 1}px`, this.inputEl.style.maxHeight = `${f}px`, this.inputEl.style.width = `${i - 1}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${h}px`, e !== null && (this.inputEl.value = e), this.inputEl.focus();
|
|
5228
5241
|
const d = this.inputEl.value.length;
|
|
5229
5242
|
this.inputEl.setSelectionRange(d, d);
|
|
5230
5243
|
} else
|
|
@@ -5258,8 +5271,8 @@ class qi {
|
|
|
5258
5271
|
const r = this.ctx.focusCell;
|
|
5259
5272
|
if (!r || ["index", "index-selection", "selection"].includes(r.type) || this.enable)
|
|
5260
5273
|
return;
|
|
5261
|
-
const { rowKey: o, key: a } = r,
|
|
5262
|
-
r && !
|
|
5274
|
+
const { rowKey: o, key: a } = r, h = this.ctx.database.getReadonly(o, a);
|
|
5275
|
+
r && !h && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = r, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
5263
5276
|
}
|
|
5264
5277
|
doneEdit() {
|
|
5265
5278
|
this.enable && (this.doneEditByInput(), this.ctx.emit("doneEdit", this.cellTarget), this.enable = !1, this.ctx.stageElement.focus(), this.ctx.editing = !1, this.ctx.emit("draw"));
|
|
@@ -5271,24 +5284,22 @@ class qi {
|
|
|
5271
5284
|
}
|
|
5272
5285
|
class Gi {
|
|
5273
5286
|
constructor(t) {
|
|
5274
|
-
|
|
5275
|
-
|
|
5287
|
+
l(this, "ctx");
|
|
5288
|
+
l(this, "emptyEl");
|
|
5276
5289
|
this.ctx = t;
|
|
5277
|
-
const { EMPTY_TEXT: e,
|
|
5278
|
-
this.emptyEl = document.createElement("div"), this.emptyEl.
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
const f = a + (l + c) / 2, d = {
|
|
5282
|
-
display: o === "empty" ? "block" : "none",
|
|
5290
|
+
const { EMPTY_TEXT: e, EMPTY_CUSTOM_STYLE: i } = this.ctx.config;
|
|
5291
|
+
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: r, bodyHeight: o, footerHeight: a }) => {
|
|
5292
|
+
const h = r + (o + a) / 2, c = {
|
|
5293
|
+
display: s === "empty" ? "block" : "none",
|
|
5283
5294
|
position: "absolute",
|
|
5284
5295
|
fontSize: "14px",
|
|
5285
5296
|
color: "#666",
|
|
5286
5297
|
left: "50%",
|
|
5287
|
-
top: `${
|
|
5298
|
+
top: `${h}px`,
|
|
5288
5299
|
transform: "translate(-50%, -50%)",
|
|
5289
|
-
...
|
|
5300
|
+
...i
|
|
5290
5301
|
};
|
|
5291
|
-
Object.assign(this.emptyEl.style,
|
|
5302
|
+
Object.assign(this.emptyEl.style, c);
|
|
5292
5303
|
});
|
|
5293
5304
|
}
|
|
5294
5305
|
destroy() {
|
|
@@ -5297,7 +5308,7 @@ class Gi {
|
|
|
5297
5308
|
}
|
|
5298
5309
|
class ji {
|
|
5299
5310
|
constructor(t) {
|
|
5300
|
-
|
|
5311
|
+
l(this, "ctx");
|
|
5301
5312
|
this.ctx = t;
|
|
5302
5313
|
}
|
|
5303
5314
|
draw() {
|
|
@@ -5324,9 +5335,9 @@ class ji {
|
|
|
5324
5335
|
fixedRightWidth: e,
|
|
5325
5336
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
5326
5337
|
} = this.ctx, { visibleWidth: r, visibleHeight: o, renderCellHeaders: a } = this.ctx.header;
|
|
5327
|
-
let
|
|
5338
|
+
let h = [], c = [], f = [];
|
|
5328
5339
|
a.forEach((p) => {
|
|
5329
|
-
p.render && (p.fixed === "left" ? c.push(p) : p.fixed === "right" ? f.push(p) :
|
|
5340
|
+
p.render && (p.fixed === "left" ? c.push(p) : p.fixed === "right" ? f.push(p) : h.push(p));
|
|
5330
5341
|
});
|
|
5331
5342
|
const d = e - i, x = {
|
|
5332
5343
|
key: "left",
|
|
@@ -5349,7 +5360,7 @@ class ji {
|
|
|
5349
5360
|
width: `${r - t - d + 1}px`,
|
|
5350
5361
|
height: `${o}px`
|
|
5351
5362
|
},
|
|
5352
|
-
cells:
|
|
5363
|
+
cells: h
|
|
5353
5364
|
}, g = {
|
|
5354
5365
|
key: "right",
|
|
5355
5366
|
style: {
|
|
@@ -5385,7 +5396,7 @@ class ji {
|
|
|
5385
5396
|
const {
|
|
5386
5397
|
fixedLeftWidth: r,
|
|
5387
5398
|
fixedRightWidth: o,
|
|
5388
|
-
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX:
|
|
5399
|
+
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX: h }
|
|
5389
5400
|
} = this.ctx, { visibleWidth: c, visibleHeight: f } = this.ctx.body, d = o - a, x = {
|
|
5390
5401
|
key: "left",
|
|
5391
5402
|
style: {
|
|
@@ -5422,7 +5433,7 @@ class ji {
|
|
|
5422
5433
|
};
|
|
5423
5434
|
return {
|
|
5424
5435
|
type: "body",
|
|
5425
|
-
class: `${
|
|
5436
|
+
class: `${h}-overlayer-body`,
|
|
5426
5437
|
style: {
|
|
5427
5438
|
position: "relative",
|
|
5428
5439
|
overflow: "hidden",
|
|
@@ -5443,7 +5454,7 @@ class ji {
|
|
|
5443
5454
|
fixedLeftWidth: s,
|
|
5444
5455
|
fixedRightWidth: r,
|
|
5445
5456
|
config: { SCROLLER_TRACK_SIZE: o, CSS_PREFIX: a }
|
|
5446
|
-
} = this.ctx, { visibleWidth:
|
|
5457
|
+
} = this.ctx, { visibleWidth: h, visibleHeight: c } = this.ctx.footer, f = r - o, d = {
|
|
5447
5458
|
key: "left",
|
|
5448
5459
|
style: {
|
|
5449
5460
|
position: "absolute",
|
|
@@ -5461,7 +5472,7 @@ class ji {
|
|
|
5461
5472
|
top: `${0.5}px`,
|
|
5462
5473
|
left: `${s - 0.5}px`,
|
|
5463
5474
|
overflow: "hidden",
|
|
5464
|
-
width: `${
|
|
5475
|
+
width: `${h - s - f}px`,
|
|
5465
5476
|
height: `${c}px`
|
|
5466
5477
|
},
|
|
5467
5478
|
cells: t
|
|
@@ -5483,7 +5494,7 @@ class ji {
|
|
|
5483
5494
|
style: {
|
|
5484
5495
|
position: "relative",
|
|
5485
5496
|
overflow: "hidden",
|
|
5486
|
-
width: `${
|
|
5497
|
+
width: `${h}px`,
|
|
5487
5498
|
height: `${c}px`
|
|
5488
5499
|
},
|
|
5489
5500
|
views: [d, x, u]
|
|
@@ -5492,16 +5503,17 @@ class ji {
|
|
|
5492
5503
|
}
|
|
5493
5504
|
class Ui {
|
|
5494
5505
|
constructor(t) {
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
this
|
|
5506
|
+
l(this, "ctx");
|
|
5507
|
+
l(this, "contextMenuEl");
|
|
5508
|
+
l(this, "coustom", !1);
|
|
5509
|
+
this.ctx = t, this.ctx.contextMenuElement ? (this.coustom = !0, this.contextMenuEl = this.ctx.contextMenuElement) : (this.coustom = !1, this.contextMenuEl = document.createElement("div")), this.createContextMenu(), this.init();
|
|
5498
5510
|
}
|
|
5499
5511
|
init() {
|
|
5500
5512
|
this.ctx.on("cellContextMenuClick", (t, e) => {
|
|
5501
5513
|
if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
|
|
5502
5514
|
e.preventDefault();
|
|
5503
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [a,
|
|
5504
|
-
c >= a && c <=
|
|
5515
|
+
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [a, h] = s, { rowIndex: c, colIndex: f } = t;
|
|
5516
|
+
c >= a && c <= h && f >= r && f <= o || this.ctx.emit("setSelectorCell", t, e);
|
|
5505
5517
|
const x = {
|
|
5506
5518
|
getBoundingClientRect: () => ({
|
|
5507
5519
|
width: 0,
|
|
@@ -5525,7 +5537,7 @@ class Ui {
|
|
|
5525
5537
|
}
|
|
5526
5538
|
//创建右键菜单,绑定子项点击事件
|
|
5527
5539
|
createContextMenu() {
|
|
5528
|
-
|
|
5540
|
+
if (this.contextMenuEl.className = "e-virt-table-context-menu", this.ctx.containerElement.appendChild(this.contextMenuEl), this.coustom) return;
|
|
5529
5541
|
const { CONTEXT_MENU: t } = this.ctx.config;
|
|
5530
5542
|
this.createContextMenuItems(t, (e) => {
|
|
5531
5543
|
switch (e.value) {
|
|
@@ -5547,7 +5559,7 @@ class Ui {
|
|
|
5547
5559
|
}
|
|
5548
5560
|
//创建右键菜单子项元素
|
|
5549
5561
|
createContextMenuItems(t, e) {
|
|
5550
|
-
t.forEach((i) => {
|
|
5562
|
+
this.contextMenuEl.replaceChildren(), t.forEach((i) => {
|
|
5551
5563
|
const s = document.createElement("div");
|
|
5552
5564
|
s.className = "e-virt-table-context-menu-item", s.innerText = i.label, i.event ? s.onclick = () => {
|
|
5553
5565
|
i.event && i.event(), e(i);
|
|
@@ -5575,38 +5587,48 @@ class Ui {
|
|
|
5575
5587
|
}
|
|
5576
5588
|
class Qi {
|
|
5577
5589
|
constructor(t, e) {
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5590
|
+
l(this, "options");
|
|
5591
|
+
l(this, "scroller");
|
|
5592
|
+
l(this, "header");
|
|
5593
|
+
l(this, "body");
|
|
5594
|
+
l(this, "footer");
|
|
5595
|
+
l(this, "selector");
|
|
5596
|
+
l(this, "autofill");
|
|
5597
|
+
l(this, "tooltip");
|
|
5598
|
+
l(this, "editor");
|
|
5599
|
+
l(this, "empty");
|
|
5600
|
+
l(this, "overlayer");
|
|
5601
|
+
l(this, "contextMenu");
|
|
5602
|
+
l(this, "ctx");
|
|
5591
5603
|
this.options = e;
|
|
5592
|
-
const { overlayerElement: i, editorElement: s } = e,
|
|
5593
|
-
|
|
5604
|
+
const { overlayerElement: i, editorElement: s, emptyElement: r, contextMenuElement: o } = e, a = this.createContainer(
|
|
5605
|
+
t,
|
|
5606
|
+
i,
|
|
5607
|
+
s,
|
|
5608
|
+
r,
|
|
5609
|
+
o
|
|
5610
|
+
);
|
|
5611
|
+
this.ctx = new hi(a, this.options), this.header = new di(this.ctx), this.body = new fi(this.ctx), this.footer = new xi(this.ctx), this.scroller = new ci(this.ctx), this.selector = new ui(this.ctx), this.autofill = new gi(this.ctx), this.tooltip = new $i(this.ctx), this.empty = new Gi(this.ctx), this.editor = new qi(this.ctx), this.overlayer = new ji(this.ctx), this.contextMenu = new Ui(this.ctx), this.ctx.on("draw", () => {
|
|
5594
5612
|
this.draw();
|
|
5595
5613
|
}), this.ctx.on("drawView", () => {
|
|
5596
5614
|
this.draw(!0);
|
|
5597
5615
|
}), this.draw();
|
|
5598
5616
|
}
|
|
5599
|
-
createContainer(t, e, i) {
|
|
5617
|
+
createContainer(t, e, i, s, r) {
|
|
5600
5618
|
t.className = "e-virt-table-container";
|
|
5601
|
-
const
|
|
5602
|
-
|
|
5603
|
-
const
|
|
5604
|
-
|
|
5619
|
+
const o = document.createElement("div"), a = document.createElement("canvas"), h = e || document.createElement("div");
|
|
5620
|
+
o.className = "e-virt-table-stage", a.className = "e-virt-table-canvas", h.className = "e-virt-table-overlayer";
|
|
5621
|
+
const c = i || document.createElement("div");
|
|
5622
|
+
c.className = "e-virt-table-editor";
|
|
5623
|
+
const f = s, d = r;
|
|
5624
|
+
return o.appendChild(a), o.appendChild(h), t.appendChild(o), {
|
|
5605
5625
|
containerElement: t,
|
|
5606
|
-
stageElement:
|
|
5607
|
-
canvasElement:
|
|
5608
|
-
overlayerElement:
|
|
5609
|
-
editorElement:
|
|
5626
|
+
stageElement: o,
|
|
5627
|
+
canvasElement: a,
|
|
5628
|
+
overlayerElement: h,
|
|
5629
|
+
editorElement: c,
|
|
5630
|
+
emptyElement: f,
|
|
5631
|
+
contextMenuElement: d
|
|
5610
5632
|
};
|
|
5611
5633
|
}
|
|
5612
5634
|
draw(t = !1) {
|
|
@@ -5671,8 +5693,8 @@ class Qi {
|
|
|
5671
5693
|
if (t && Array.isArray(s) && s.length) {
|
|
5672
5694
|
const [r] = s;
|
|
5673
5695
|
if (Array.isArray(r) && r.length) {
|
|
5674
|
-
const [o] = r, { rowKey: a, key:
|
|
5675
|
-
this.scrollToRowkey(a), this.scrollToColkey(
|
|
5696
|
+
const [o] = r, { rowKey: a, key: h } = o;
|
|
5697
|
+
this.scrollToRowkey(a), this.scrollToColkey(h);
|
|
5676
5698
|
}
|
|
5677
5699
|
}
|
|
5678
5700
|
i(s);
|
|
@@ -5697,7 +5719,7 @@ class Qi {
|
|
|
5697
5719
|
let r = [];
|
|
5698
5720
|
for (let o = 0; o < i.length; o++)
|
|
5699
5721
|
for (let a = 0; a < s.length; a++) {
|
|
5700
|
-
const
|
|
5722
|
+
const h = this.ctx.database.getRowKeyByItem(i[o]), f = s[a].key, d = await this.ctx.database.getValidator(h, f);
|
|
5701
5723
|
Array.isArray(d) && d.length && r.push(d);
|
|
5702
5724
|
}
|
|
5703
5725
|
r.length ? (e(r), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
|