e-virt-table 0.1.16 → 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 +729 -711
- 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/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/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() {
|
|
@@ -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) {
|
|
@@ -2349,8 +2348,8 @@ class ee extends te {
|
|
|
2349
2348
|
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s } = this.ctx.config;
|
|
2350
2349
|
if (!s || !i)
|
|
2351
2350
|
return;
|
|
2352
|
-
const { xArr: r, yArr: o } = this.ctx.selector, a = r[1],
|
|
2353
|
-
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, {
|
|
2354
2353
|
borderColor: "#fff",
|
|
2355
2354
|
fillColor: e
|
|
2356
2355
|
});
|
|
@@ -2405,31 +2404,31 @@ class ee extends te {
|
|
|
2405
2404
|
}
|
|
2406
2405
|
drawBorder(e) {
|
|
2407
2406
|
const { drawX: i, drawY: s, width: r, rowIndex: o, colIndex: a } = this;
|
|
2408
|
-
let
|
|
2409
|
-
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);
|
|
2410
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];
|
|
2411
|
-
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], {
|
|
2412
2411
|
borderColor: w,
|
|
2413
2412
|
fillColor: p,
|
|
2414
2413
|
borderWidth: g,
|
|
2415
2414
|
lineCap: "round",
|
|
2416
2415
|
lineJoin: "round",
|
|
2417
2416
|
lineDash: u
|
|
2418
|
-
}), 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], {
|
|
2419
2418
|
borderColor: w,
|
|
2420
2419
|
fillColor: p,
|
|
2421
2420
|
borderWidth: g,
|
|
2422
2421
|
lineCap: "round",
|
|
2423
2422
|
lineJoin: "round",
|
|
2424
2423
|
lineDash: u
|
|
2425
|
-
}), 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], {
|
|
2426
2425
|
borderColor: w,
|
|
2427
2426
|
fillColor: p,
|
|
2428
2427
|
borderWidth: g,
|
|
2429
2428
|
lineCap: "round",
|
|
2430
2429
|
lineJoin: "round",
|
|
2431
2430
|
lineDash: u
|
|
2432
|
-
}), 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], {
|
|
2433
2432
|
borderColor: w,
|
|
2434
2433
|
fillColor: p,
|
|
2435
2434
|
borderWidth: g,
|
|
@@ -2440,42 +2439,42 @@ class ee extends te {
|
|
|
2440
2439
|
}
|
|
2441
2440
|
}
|
|
2442
2441
|
class ie extends te {
|
|
2443
|
-
constructor(e, i, s, r, o, a,
|
|
2444
|
-
super(e, s, r, o, a,
|
|
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
|
-
|
|
2478
|
-
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;
|
|
2479
2478
|
}
|
|
2480
2479
|
/**
|
|
2481
2480
|
* 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
|
|
@@ -2495,11 +2494,11 @@ class ie extends te {
|
|
|
2495
2494
|
const { HEADER_CELL_STYLE_METHOD: e, HEADER_BG_COLOR: i, HEADER_TEXT_COLOR: s } = this.ctx.config;
|
|
2496
2495
|
let r = i, o = s;
|
|
2497
2496
|
if (typeof e == "function") {
|
|
2498
|
-
const a = e, { backgroundColor:
|
|
2497
|
+
const a = e, { backgroundColor: h, color: c } = a({
|
|
2499
2498
|
colIndex: this.colIndex,
|
|
2500
2499
|
column: this.column
|
|
2501
2500
|
}) || {};
|
|
2502
|
-
|
|
2501
|
+
h && (r = h), c && (o = c);
|
|
2503
2502
|
}
|
|
2504
2503
|
this.drawCellBgColor = r, this.drawTextColor = o;
|
|
2505
2504
|
}
|
|
@@ -2510,11 +2509,11 @@ class ie extends te {
|
|
|
2510
2509
|
const {
|
|
2511
2510
|
paint: e,
|
|
2512
2511
|
config: { BORDER_COLOR: i, CELL_PADDING: s, HEADER_FONT: r }
|
|
2513
|
-
} = this.ctx, { drawX: o, drawY: a, displayText:
|
|
2512
|
+
} = this.ctx, { drawX: o, drawY: a, displayText: h } = this;
|
|
2514
2513
|
e.drawRect(o, a, this.width, this.height, {
|
|
2515
2514
|
borderColor: i,
|
|
2516
2515
|
fillColor: this.drawCellBgColor
|
|
2517
|
-
}), e.drawText(
|
|
2516
|
+
}), e.drawText(h, o, a, this.width, this.height, {
|
|
2518
2517
|
font: r,
|
|
2519
2518
|
padding: s,
|
|
2520
2519
|
color: this.drawTextColor,
|
|
@@ -2525,9 +2524,9 @@ class ie extends te {
|
|
|
2525
2524
|
drawSelection() {
|
|
2526
2525
|
const { width: e, height: i, type: s } = this;
|
|
2527
2526
|
if (["index-selection", "selection"].includes(s)) {
|
|
2528
|
-
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;
|
|
2529
2528
|
let d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck";
|
|
2530
|
-
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(
|
|
2531
2530
|
this.drawImageSource,
|
|
2532
2531
|
this.drawImageX,
|
|
2533
2532
|
this.drawImageY,
|
|
@@ -2556,11 +2555,11 @@ class ie extends te {
|
|
|
2556
2555
|
};
|
|
2557
2556
|
}
|
|
2558
2557
|
}
|
|
2559
|
-
class
|
|
2558
|
+
class li {
|
|
2560
2559
|
constructor(t) {
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2560
|
+
l(this, "ctx");
|
|
2561
|
+
l(this, "visibleHoverCell");
|
|
2562
|
+
l(this, "resizeObserver");
|
|
2564
2563
|
this.ctx = t, this.init();
|
|
2565
2564
|
}
|
|
2566
2565
|
init() {
|
|
@@ -2650,10 +2649,10 @@ class hi {
|
|
|
2650
2649
|
colIndex: t.colIndex,
|
|
2651
2650
|
column: t.column,
|
|
2652
2651
|
value: t.getValue()
|
|
2653
|
-
}).then((
|
|
2654
|
-
this.ctx.database.setExpandChildren(t.rowKey,
|
|
2655
|
-
}).catch((
|
|
2656
|
-
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);
|
|
2657
2656
|
}));
|
|
2658
2657
|
else {
|
|
2659
2658
|
const a = this.ctx.database.getIsExpand(t.rowKey);
|
|
@@ -2680,15 +2679,15 @@ class hi {
|
|
|
2680
2679
|
handleBodyEvent(t, e, i, s, r = !1) {
|
|
2681
2680
|
for (const o of i) {
|
|
2682
2681
|
const a = o.fixedCells.concat(o.noFixedCells);
|
|
2683
|
-
for (const
|
|
2684
|
-
const c =
|
|
2682
|
+
for (const h of a) {
|
|
2683
|
+
const c = h.getDrawX(), f = h.getDrawY();
|
|
2685
2684
|
if (r) {
|
|
2686
|
-
if (t > c && t < c +
|
|
2687
|
-
s(
|
|
2685
|
+
if (t > c && t < c + h.visibleWidth && e > f && e < f + h.visibleHeight) {
|
|
2686
|
+
s(h);
|
|
2688
2687
|
return;
|
|
2689
2688
|
}
|
|
2690
|
-
} else if (t > c && t < c +
|
|
2691
|
-
s(
|
|
2689
|
+
} else if (t > c && t < c + h.width && e > f && e < f + h.height) {
|
|
2690
|
+
s(h);
|
|
2692
2691
|
return;
|
|
2693
2692
|
}
|
|
2694
2693
|
}
|
|
@@ -2707,53 +2706,55 @@ class hi {
|
|
|
2707
2706
|
this.resizeObserver.unobserve(this.ctx.stageElement);
|
|
2708
2707
|
}
|
|
2709
2708
|
}
|
|
2710
|
-
class
|
|
2709
|
+
class hi {
|
|
2711
2710
|
constructor(t, e) {
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
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);
|
|
2728
2729
|
// 行调整大小中
|
|
2729
|
-
|
|
2730
|
+
l(this, "columnResizing", !1);
|
|
2730
2731
|
// 列调整大小中
|
|
2731
|
-
|
|
2732
|
+
l(this, "scrollerMove", !1);
|
|
2732
2733
|
// 滚动条移动中
|
|
2733
|
-
|
|
2734
|
+
l(this, "scrollerFocus", !1);
|
|
2734
2735
|
// 滚动条focus中
|
|
2735
|
-
|
|
2736
|
+
l(this, "autofillMove", !1);
|
|
2736
2737
|
// 自动填充移动中
|
|
2737
|
-
|
|
2738
|
+
l(this, "selectorMove", !1);
|
|
2738
2739
|
// 选择器移动中
|
|
2739
|
-
|
|
2740
|
+
l(this, "adjustPositioning", !1);
|
|
2740
2741
|
// 调整位置中
|
|
2741
|
-
|
|
2742
|
+
l(this, "editing", !1);
|
|
2742
2743
|
// 编辑中
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
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", {
|
|
2757
2758
|
x: 0,
|
|
2758
2759
|
y: 0,
|
|
2759
2760
|
width: 0,
|
|
@@ -2766,7 +2767,7 @@ class li {
|
|
|
2766
2767
|
renderRows: [],
|
|
2767
2768
|
data: []
|
|
2768
2769
|
});
|
|
2769
|
-
|
|
2770
|
+
l(this, "footer", {
|
|
2770
2771
|
x: 0,
|
|
2771
2772
|
y: 0,
|
|
2772
2773
|
width: 0,
|
|
@@ -2775,7 +2776,7 @@ class li {
|
|
|
2775
2776
|
visibleWidth: 0,
|
|
2776
2777
|
renderRows: []
|
|
2777
2778
|
});
|
|
2778
|
-
|
|
2779
|
+
l(this, "header", {
|
|
2779
2780
|
x: 0,
|
|
2780
2781
|
y: 0,
|
|
2781
2782
|
width: 0,
|
|
@@ -2790,23 +2791,31 @@ class li {
|
|
|
2790
2791
|
fixedRightCellHeaders: [],
|
|
2791
2792
|
renderCenterCellHeaders: []
|
|
2792
2793
|
});
|
|
2793
|
-
|
|
2794
|
+
l(this, "selector", {
|
|
2794
2795
|
enable: !1,
|
|
2795
2796
|
xArr: [-1, -1],
|
|
2796
2797
|
yArr: [-1, -1],
|
|
2797
2798
|
xArrCopy: [-1, -1],
|
|
2798
2799
|
yArrCopy: [-1, -1]
|
|
2799
2800
|
});
|
|
2800
|
-
|
|
2801
|
+
l(this, "autofill", {
|
|
2801
2802
|
enable: !1,
|
|
2802
2803
|
xArr: [-1, -1],
|
|
2803
2804
|
yArr: [-1, -1]
|
|
2804
2805
|
});
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
const {
|
|
2809
|
-
|
|
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);
|
|
2810
2819
|
}
|
|
2811
2820
|
setConfig(t) {
|
|
2812
2821
|
this.config = new Wt(t);
|
|
@@ -2841,7 +2850,7 @@ class li {
|
|
|
2841
2850
|
for (let r = 0; r <= e[1] - e[0]; r++) {
|
|
2842
2851
|
const o = [];
|
|
2843
2852
|
for (let a = 0; a <= i[1] - i[0]; a++) {
|
|
2844
|
-
const
|
|
2853
|
+
const h = r + e[0], c = a + i[0], f = this.database.getItemValueForRowIndexAndColIndex(h, c);
|
|
2845
2854
|
f && o.push(f.value);
|
|
2846
2855
|
}
|
|
2847
2856
|
s += `${o.join(" ")}\r`, t.push(o);
|
|
@@ -2903,29 +2912,29 @@ class li {
|
|
|
2903
2912
|
}
|
|
2904
2913
|
class Pt {
|
|
2905
2914
|
constructor(t, e) {
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
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", []);
|
|
2914
2923
|
//分割线
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
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);
|
|
2920
2929
|
// 滚动条的长度
|
|
2921
|
-
|
|
2930
|
+
l(this, "visibleDistance", 0);
|
|
2922
2931
|
//可见区域的长度
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2932
|
+
l(this, "clientX", 0);
|
|
2933
|
+
l(this, "clientY", 0);
|
|
2934
|
+
l(this, "dragStart", 0);
|
|
2926
2935
|
// 拖拽开始的位置
|
|
2927
|
-
|
|
2928
|
-
|
|
2936
|
+
l(this, "isDragging", !1);
|
|
2937
|
+
l(this, "scroll", 0);
|
|
2929
2938
|
this.ctx = t, this.type = e, this.type === "vertical" ? this.scroll = this.ctx.scrollY : this.scroll = this.ctx.scrollX;
|
|
2930
2939
|
}
|
|
2931
2940
|
onWheel(t) {
|
|
@@ -2981,19 +2990,19 @@ class Pt {
|
|
|
2981
2990
|
stageHeight: i,
|
|
2982
2991
|
stageWidth: s,
|
|
2983
2992
|
config: { SCROLLER_TRACK_SIZE: r = 0, SCROLLER_SIZE: o = 0 }
|
|
2984
|
-
} = 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;
|
|
2985
2994
|
if (this.type === "vertical") {
|
|
2986
|
-
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;
|
|
2987
2996
|
const u = this.distance ? this.visibleDistance / d : 0;
|
|
2988
2997
|
let g = Math.floor(u * this.visibleDistance);
|
|
2989
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));
|
|
2990
2999
|
} else {
|
|
2991
3000
|
this.visibleDistance = a - r, this.distance = f - this.visibleDistance, this.splitPoints = [
|
|
2992
3001
|
a - r,
|
|
2993
|
-
|
|
3002
|
+
h - r,
|
|
2994
3003
|
a - r,
|
|
2995
|
-
|
|
2996
|
-
], this.trackX = 0, this.trackY =
|
|
3004
|
+
h
|
|
3005
|
+
], this.trackX = 0, this.trackY = h - r, this.trackWidth = a, this.trackHeight = r;
|
|
2997
3006
|
const u = this.distance ? this.visibleDistance / f : 0;
|
|
2998
3007
|
let g = Math.floor(u * this.visibleDistance);
|
|
2999
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));
|
|
@@ -3017,9 +3026,9 @@ class Pt {
|
|
|
3017
3026
|
}
|
|
3018
3027
|
class ci {
|
|
3019
3028
|
constructor(t) {
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3029
|
+
l(this, "ctx");
|
|
3030
|
+
l(this, "verticalScrollbar");
|
|
3031
|
+
l(this, "horizontalScrollbar");
|
|
3023
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) => {
|
|
3024
3033
|
this.setScroll(e, i);
|
|
3025
3034
|
}), this.ctx.on("setScrollX", (e) => {
|
|
@@ -3073,41 +3082,41 @@ class ci {
|
|
|
3073
3082
|
}
|
|
3074
3083
|
class di {
|
|
3075
3084
|
constructor(t) {
|
|
3076
|
-
|
|
3085
|
+
l(this, "ctx");
|
|
3077
3086
|
// 上下文
|
|
3078
|
-
|
|
3087
|
+
l(this, "x", 0);
|
|
3079
3088
|
// x坐标
|
|
3080
|
-
|
|
3089
|
+
l(this, "y", 0);
|
|
3081
3090
|
// y坐标
|
|
3082
|
-
|
|
3091
|
+
l(this, "width", 0);
|
|
3083
3092
|
// 宽度
|
|
3084
|
-
|
|
3093
|
+
l(this, "height", 0);
|
|
3085
3094
|
// 高度
|
|
3086
|
-
|
|
3095
|
+
l(this, "resizeTarget", null);
|
|
3087
3096
|
//调整表头
|
|
3088
|
-
|
|
3097
|
+
l(this, "resizeNum", 0);
|
|
3089
3098
|
// 调整列的数量
|
|
3090
|
-
|
|
3099
|
+
l(this, "isResizing", !1);
|
|
3091
3100
|
// 是否移动中
|
|
3092
|
-
|
|
3101
|
+
l(this, "clientX", 0);
|
|
3093
3102
|
// 鼠标按下时的x轴位置
|
|
3094
|
-
|
|
3103
|
+
l(this, "resizeDiff", 0);
|
|
3095
3104
|
// 是否移动中
|
|
3096
|
-
|
|
3097
|
-
|
|
3105
|
+
l(this, "columnIndex", 0);
|
|
3106
|
+
l(this, "isMouseDown", !1);
|
|
3098
3107
|
// 是否按下
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
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", []);
|
|
3111
3120
|
this.ctx = t, this.ctx.on(
|
|
3112
3121
|
"resetHeader",
|
|
3113
3122
|
Zt(() => {
|
|
@@ -3126,9 +3135,9 @@ class di {
|
|
|
3126
3135
|
this.columnIndex = 0, this.resizeNum = 0, this.render(o, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
3127
3136
|
const a = this.ctx.containerElement.getBoundingClientRect();
|
|
3128
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;
|
|
3129
|
-
const
|
|
3130
|
-
if (this.resizeNum &&
|
|
3131
|
-
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;
|
|
3132
3141
|
this.resizeAllColumn(d);
|
|
3133
3142
|
}
|
|
3134
3143
|
const c = this.fixedLeftCellHeaders.filter((d) => !d.hasChildren);
|
|
@@ -3161,9 +3170,9 @@ class di {
|
|
|
3161
3170
|
this.ctx.stageElement.style.cursor === "col-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3162
3171
|
const r = [...this.renderFixedCellHeaders, ...this.renderCenterCellHeaders];
|
|
3163
3172
|
for (const o of r) {
|
|
3164
|
-
const { offsetX: a, offsetY:
|
|
3173
|
+
const { offsetX: a, offsetY: h } = this.ctx.getOffset(e), c = a, f = o.getDrawX();
|
|
3165
3174
|
c > f + o.width - 5 && c < f + o.width + 4 && c < i - 4 && // 视窗中最后一列不允许调整宽
|
|
3166
|
-
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);
|
|
3167
3176
|
}
|
|
3168
3177
|
}
|
|
3169
3178
|
}));
|
|
@@ -3217,10 +3226,10 @@ class di {
|
|
|
3217
3226
|
let s = e;
|
|
3218
3227
|
const { HEADER_HEIGHT: r = 0 } = this.ctx.config;
|
|
3219
3228
|
for (let o = 0; o < i; o++) {
|
|
3220
|
-
const a = t[o],
|
|
3229
|
+
const a = t[o], h = r * (a.rowspan || 1), c = r * a.level;
|
|
3221
3230
|
let f = a.width || 100;
|
|
3222
3231
|
a.children && (f = _t(a.children).reduce((u, g) => u + ((g == null ? void 0 : g.width) || 100), 0));
|
|
3223
|
-
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);
|
|
3224
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;
|
|
3225
3234
|
}
|
|
3226
3235
|
}
|
|
@@ -3252,8 +3261,8 @@ class di {
|
|
|
3252
3261
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3253
3262
|
colorEnd: "rgba(0,0,0,0)"
|
|
3254
3263
|
}), i < Math.floor(s.width - r - 1) && e !== a) {
|
|
3255
|
-
const
|
|
3256
|
-
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, {
|
|
3257
3266
|
fillColor: o,
|
|
3258
3267
|
side: "left",
|
|
3259
3268
|
shadowWidth: 4,
|
|
@@ -3281,20 +3290,20 @@ class di {
|
|
|
3281
3290
|
}
|
|
3282
3291
|
}
|
|
3283
3292
|
class se {
|
|
3284
|
-
constructor(t, e, i = 0, s = 0, r = 0, o = 0, a,
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
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();
|
|
3298
3307
|
}
|
|
3299
3308
|
update() {
|
|
3300
3309
|
const { header: t } = this.ctx, e = [], i = [], s = [];
|
|
@@ -3334,28 +3343,28 @@ class se {
|
|
|
3334
3343
|
}
|
|
3335
3344
|
class fi {
|
|
3336
3345
|
constructor(t) {
|
|
3337
|
-
|
|
3346
|
+
l(this, "resizeTarget", null);
|
|
3338
3347
|
//调整行大小的目标
|
|
3339
|
-
|
|
3348
|
+
l(this, "isMouseDown", !1);
|
|
3340
3349
|
// 是否按下
|
|
3341
|
-
|
|
3350
|
+
l(this, "resizeDiff", 0);
|
|
3342
3351
|
// 是否移动中
|
|
3343
|
-
|
|
3352
|
+
l(this, "clientY", 0);
|
|
3344
3353
|
// 鼠标按下时的y轴位置
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
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);
|
|
3353
3362
|
//是否正在调整大小
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3363
|
+
l(this, "renderRows", []);
|
|
3364
|
+
l(this, "visibleRows", []);
|
|
3365
|
+
l(this, "visibleHeight", 0);
|
|
3366
|
+
l(this, "visibleWidth", 0);
|
|
3367
|
+
l(this, "data", []);
|
|
3359
3368
|
this.ctx = t, this.init(), this.initResizeRow();
|
|
3360
3369
|
}
|
|
3361
3370
|
init() {
|
|
@@ -3368,7 +3377,7 @@ class fi {
|
|
|
3368
3377
|
SCROLLER_TRACK_SIZE: r = 0,
|
|
3369
3378
|
HEIGHT: o,
|
|
3370
3379
|
EMPTY_BODY_HEIGHT: a = 0,
|
|
3371
|
-
MAX_HEIGHT:
|
|
3380
|
+
MAX_HEIGHT: h = 0,
|
|
3372
3381
|
ENABLE_OFFSET_HEIGHT: c = 0,
|
|
3373
3382
|
OFFSET_HEIGHT: f = 0
|
|
3374
3383
|
}
|
|
@@ -3397,7 +3406,7 @@ class fi {
|
|
|
3397
3406
|
let y = 0;
|
|
3398
3407
|
this.data.length && c ? (y = window.innerHeight - u - f, y < 0 && (y = 32, console.error(
|
|
3399
3408
|
"There is an error in the height calculation ENABLE_OFFSET_HEIGHT and OFFSET_HEIGHT are invalid"
|
|
3400
|
-
))) : 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`);
|
|
3401
3410
|
let b = this.ctx.stageHeight - e.height - r;
|
|
3402
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;
|
|
3403
3412
|
const m = window.devicePixelRatio || 1, E = this.ctx.stageWidth * m, C = this.ctx.stageHeight * m;
|
|
@@ -3420,7 +3429,7 @@ class fi {
|
|
|
3420
3429
|
}), this.ctx.on("mousemove", (e) => {
|
|
3421
3430
|
if (this.ctx.editing) return;
|
|
3422
3431
|
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), r = i, o = s, a = e.clientY, {
|
|
3423
|
-
stageHeight:
|
|
3432
|
+
stageHeight: h,
|
|
3424
3433
|
scrollY: c,
|
|
3425
3434
|
config: { RESIZE_ROW_MIN_HEIGHT: f = 0 }
|
|
3426
3435
|
} = this.ctx;
|
|
@@ -3434,7 +3443,7 @@ class fi {
|
|
|
3434
3443
|
this.ctx.stageElement.style.cursor === "row-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3435
3444
|
for (let d = 0; d < this.renderRows.length; d++) {
|
|
3436
3445
|
const x = this.renderRows[d];
|
|
3437
|
-
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)
|
|
3438
3447
|
for (let g = 0; g < x.cells.length; g++) {
|
|
3439
3448
|
const w = x.cells[g];
|
|
3440
3449
|
o > w.drawX + 10 && o < w.drawX + w.width - 10 && w.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = x);
|
|
@@ -3483,8 +3492,8 @@ class fi {
|
|
|
3483
3492
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3484
3493
|
colorEnd: "rgba(0,0,0,0)"
|
|
3485
3494
|
}), i < Math.floor(s.width - r - 1) && e !== a) {
|
|
3486
|
-
const
|
|
3487
|
-
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, {
|
|
3488
3497
|
fillColor: o,
|
|
3489
3498
|
side: "left",
|
|
3490
3499
|
shadowWidth: 4,
|
|
@@ -3508,8 +3517,8 @@ class fi {
|
|
|
3508
3517
|
const { header: t, database: e, scrollY: i } = this.ctx, s = i, { data: r, positions: o } = e.getData();
|
|
3509
3518
|
this.ctx.maxRowIndex = r.length - 1;
|
|
3510
3519
|
const a = this.binarySearch(o, s);
|
|
3511
|
-
let
|
|
3512
|
-
|
|
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;
|
|
3513
3522
|
const c = [];
|
|
3514
3523
|
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
3515
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);
|
|
@@ -3527,15 +3536,15 @@ class fi {
|
|
|
3527
3536
|
}
|
|
3528
3537
|
class xi {
|
|
3529
3538
|
constructor(t) {
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
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);
|
|
3539
3548
|
this.ctx = t, this.init();
|
|
3540
3549
|
}
|
|
3541
3550
|
init() {
|
|
@@ -3556,8 +3565,8 @@ class xi {
|
|
|
3556
3565
|
stageWidth: r,
|
|
3557
3566
|
config: { HEADER_BG_COLOR: o, SCROLLER_TRACK_SIZE: a }
|
|
3558
3567
|
} = this.ctx;
|
|
3559
|
-
let
|
|
3560
|
-
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, {
|
|
3561
3570
|
fillColor: o,
|
|
3562
3571
|
side: "right",
|
|
3563
3572
|
shadowWidth: 4,
|
|
@@ -3565,7 +3574,7 @@ class xi {
|
|
|
3565
3574
|
colorEnd: "rgba(0,0,0,0)"
|
|
3566
3575
|
}), i < Math.floor(s.width - r - 1) && e !== a) {
|
|
3567
3576
|
const c = s.width - (this.x + this.width) + r - e;
|
|
3568
|
-
this.ctx.paint.drawShadow(c + 1,
|
|
3577
|
+
this.ctx.paint.drawShadow(c + 1, h, e, this.height, {
|
|
3569
3578
|
fillColor: o,
|
|
3570
3579
|
side: "left",
|
|
3571
3580
|
shadowWidth: 4,
|
|
@@ -3604,15 +3613,15 @@ class xi {
|
|
|
3604
3613
|
class ui {
|
|
3605
3614
|
// 垂直滚动定时器
|
|
3606
3615
|
constructor(t) {
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
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);
|
|
3614
3623
|
// 水平滚动定时器
|
|
3615
|
-
|
|
3624
|
+
l(this, "timerY", 0);
|
|
3616
3625
|
this.ctx = t, this.init();
|
|
3617
3626
|
}
|
|
3618
3627
|
init() {
|
|
@@ -3712,12 +3721,12 @@ class ui {
|
|
|
3712
3721
|
this.ctx.mousedown && (this.ctx.selectorMove = !0), this.ctx.selector.enable = !0;
|
|
3713
3722
|
const {
|
|
3714
3723
|
SELECTOR_AREA_MIN_X: a,
|
|
3715
|
-
SELECTOR_AREA_MAX_X:
|
|
3724
|
+
SELECTOR_AREA_MAX_X: h,
|
|
3716
3725
|
SELECTOR_AREA_MIN_Y: c,
|
|
3717
3726
|
SELECTOR_AREA_MAX_Y: f,
|
|
3718
3727
|
SELECTOR_AREA_MAX_X_OFFSET: d,
|
|
3719
3728
|
SELECTOR_AREA_MAX_Y_OFFSET: x
|
|
3720
|
-
} = 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;
|
|
3721
3730
|
let [y, b] = r, [m, E] = o;
|
|
3722
3731
|
if (y < u || b > g || m < w || E > p)
|
|
3723
3732
|
return;
|
|
@@ -3735,15 +3744,15 @@ class ui {
|
|
|
3735
3744
|
if (this.ctx.mousedown && this.ctx.focusCellHeader) {
|
|
3736
3745
|
const { colIndex: a } = this.ctx.focusCellHeader;
|
|
3737
3746
|
if (this.ctx.clearSelector(), t.colIndex >= a) {
|
|
3738
|
-
const
|
|
3739
|
-
this.setSelector(
|
|
3747
|
+
const h = [a, t.colIndex + t.colspan - 1], c = [r, o];
|
|
3748
|
+
this.setSelector(h, c);
|
|
3740
3749
|
} else {
|
|
3741
|
-
const
|
|
3742
|
-
this.setSelector(
|
|
3750
|
+
const h = [t.colIndex, a], c = [r, o];
|
|
3751
|
+
this.setSelector(h, c);
|
|
3743
3752
|
}
|
|
3744
3753
|
} else {
|
|
3745
|
-
const a = [t.colIndex, t.colIndex + t.colspan - 1],
|
|
3746
|
-
this.setSelector(a,
|
|
3754
|
+
const a = [t.colIndex, t.colIndex + t.colspan - 1], h = [r, o];
|
|
3755
|
+
this.setSelector(a, h);
|
|
3747
3756
|
}
|
|
3748
3757
|
}
|
|
3749
3758
|
selectAll() {
|
|
@@ -3757,8 +3766,8 @@ class ui {
|
|
|
3757
3766
|
SELECTOR_AREA_MIN_Y: r,
|
|
3758
3767
|
SELECTOR_AREA_MAX_Y: o,
|
|
3759
3768
|
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
3760
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
3761
|
-
} = 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];
|
|
3762
3771
|
this.setSelector(u, g);
|
|
3763
3772
|
}
|
|
3764
3773
|
}
|
|
@@ -3768,16 +3777,16 @@ class ui {
|
|
|
3768
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;
|
|
3769
3778
|
if (e) {
|
|
3770
3779
|
this.ctx.setFocusCell(t);
|
|
3771
|
-
const
|
|
3772
|
-
this.setSelector(
|
|
3780
|
+
const h = [a, o], c = [t.rowIndex, t.rowIndex];
|
|
3781
|
+
this.setSelector(h, c);
|
|
3773
3782
|
}
|
|
3774
3783
|
if (this.ctx.focusCell && this.ctx.mousedown) {
|
|
3775
|
-
const { rowIndex:
|
|
3776
|
-
if (t.rowIndex >=
|
|
3777
|
-
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];
|
|
3778
3787
|
this.setSelector(c, f);
|
|
3779
3788
|
} else {
|
|
3780
|
-
const c = [a, o], f = [t.rowIndex,
|
|
3789
|
+
const c = [a, o], f = [t.rowIndex, h];
|
|
3781
3790
|
this.setSelector(c, f);
|
|
3782
3791
|
}
|
|
3783
3792
|
}
|
|
@@ -3787,7 +3796,7 @@ class ui {
|
|
|
3787
3796
|
return;
|
|
3788
3797
|
const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
|
|
3789
3798
|
if (t && e && i) {
|
|
3790
|
-
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];
|
|
3791
3800
|
this.setSelector(f, d);
|
|
3792
3801
|
}
|
|
3793
3802
|
}
|
|
@@ -3795,7 +3804,7 @@ class ui {
|
|
|
3795
3804
|
const { focusCell: e, clickCell: i } = this.ctx;
|
|
3796
3805
|
if (e && this.isInSettingRange(e.rowIndex, e.colIndex))
|
|
3797
3806
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
3798
|
-
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];
|
|
3799
3808
|
this.setSelector(x, u);
|
|
3800
3809
|
} else {
|
|
3801
3810
|
this.ctx.emit("cellSelectedClick", e);
|
|
@@ -3836,8 +3845,8 @@ class ui {
|
|
|
3836
3845
|
let s = [];
|
|
3837
3846
|
const r = /* @__PURE__ */ new Set();
|
|
3838
3847
|
for (let a = 0; a <= e[1] - e[0]; a++)
|
|
3839
|
-
for (let
|
|
3840
|
-
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);
|
|
3841
3850
|
if (d) {
|
|
3842
3851
|
const { rowKey: x, key: u } = d;
|
|
3843
3852
|
this.ctx.database.getReadonly(x, u) || (r.add(x), s.push({
|
|
@@ -3901,9 +3910,9 @@ class ui {
|
|
|
3901
3910
|
}
|
|
3902
3911
|
if (!a.length)
|
|
3903
3912
|
return;
|
|
3904
|
-
const { BEFORE_PASTE_CHANGE_METHOD:
|
|
3905
|
-
if (typeof
|
|
3906
|
-
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) => ({
|
|
3907
3916
|
rowKey: x.rowKey,
|
|
3908
3917
|
key: x.key,
|
|
3909
3918
|
value: x.value,
|
|
@@ -3932,7 +3941,7 @@ class ui {
|
|
|
3932
3941
|
if (!e)
|
|
3933
3942
|
return;
|
|
3934
3943
|
let { colIndex: i = 0, rowIndex: s = 0 } = e;
|
|
3935
|
-
const r = 0, o = 0, a = this.ctx.maxColIndex,
|
|
3944
|
+
const r = 0, o = 0, a = this.ctx.maxColIndex, h = this.ctx.maxRowIndex;
|
|
3936
3945
|
switch (t) {
|
|
3937
3946
|
case "LEFT":
|
|
3938
3947
|
i > r && i--;
|
|
@@ -3944,7 +3953,7 @@ class ui {
|
|
|
3944
3953
|
i < a && i++;
|
|
3945
3954
|
break;
|
|
3946
3955
|
case "BOTTOM":
|
|
3947
|
-
s <
|
|
3956
|
+
s < h && s++;
|
|
3948
3957
|
break;
|
|
3949
3958
|
}
|
|
3950
3959
|
const c = [i, i], f = [s, s], d = this.getCell(s, i);
|
|
@@ -3961,8 +3970,8 @@ class ui {
|
|
|
3961
3970
|
SELECTOR_AREA_MIN_Y: r,
|
|
3962
3971
|
SELECTOR_AREA_MAX_Y: o,
|
|
3963
3972
|
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
3964
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
3965
|
-
} = 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;
|
|
3966
3975
|
return !(e < c || e > f || t < d || t > x);
|
|
3967
3976
|
}
|
|
3968
3977
|
/**
|
|
@@ -3976,7 +3985,7 @@ class ui {
|
|
|
3976
3985
|
let a = 10 * (s === "left" ? -1 : 1);
|
|
3977
3986
|
this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
|
|
3978
3987
|
a *= 1.5;
|
|
3979
|
-
const { scrollX:
|
|
3988
|
+
const { scrollX: h } = this.ctx, c = h + a;
|
|
3980
3989
|
(c < 0 || c > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(c);
|
|
3981
3990
|
}, 100);
|
|
3982
3991
|
}
|
|
@@ -3985,7 +3994,7 @@ class ui {
|
|
|
3985
3994
|
let a = 10 * (r === "top" ? -1 : 1);
|
|
3986
3995
|
this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
|
|
3987
3996
|
a *= 1.5;
|
|
3988
|
-
const { scrollY:
|
|
3997
|
+
const { scrollY: h } = this.ctx, c = h + a;
|
|
3989
3998
|
(c < 0 || c > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(c);
|
|
3990
3999
|
}, 100);
|
|
3991
4000
|
}
|
|
@@ -4002,7 +4011,7 @@ class ui {
|
|
|
4002
4011
|
fixedLeftWidth: r,
|
|
4003
4012
|
header: o,
|
|
4004
4013
|
footer: a,
|
|
4005
|
-
body:
|
|
4014
|
+
body: h,
|
|
4006
4015
|
scrollX: c,
|
|
4007
4016
|
scrollY: f,
|
|
4008
4017
|
config: { SCROLLER_TRACK_SIZE: d, FOOTER_FIXED: x }
|
|
@@ -4011,7 +4020,7 @@ class ui {
|
|
|
4011
4020
|
return;
|
|
4012
4021
|
const u = r - i.drawX + 1, g = i.drawX + i.width - (e - s) + 1, w = o.height - i.drawY;
|
|
4013
4022
|
let p = i.height;
|
|
4014
|
-
p >
|
|
4023
|
+
p > h.visibleHeight && (p = h.visibleHeight);
|
|
4015
4024
|
let y = 0;
|
|
4016
4025
|
x && (y = a.visibleHeight);
|
|
4017
4026
|
const b = i.drawY + p - (t - y - d);
|
|
@@ -4024,14 +4033,14 @@ class ui {
|
|
|
4024
4033
|
}
|
|
4025
4034
|
class gi {
|
|
4026
4035
|
constructor(t) {
|
|
4027
|
-
|
|
4036
|
+
l(this, "ctx");
|
|
4028
4037
|
this.ctx = t, this.init();
|
|
4029
4038
|
}
|
|
4030
4039
|
init() {
|
|
4031
4040
|
this.ctx.on("cellMouseenter", (t, e) => {
|
|
4032
4041
|
this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default");
|
|
4033
|
-
const { offsetX: i, offsetY: s } = this.ctx.getOffset(e), { xArr: r, yArr: o } = this.ctx.selector, a = r[1],
|
|
4034
|
-
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) {
|
|
4035
4044
|
const p = d + u - 6, y = x + g - 6;
|
|
4036
4045
|
i > p && s > y && (this.ctx.stageElement.style.cursor = "crosshair");
|
|
4037
4046
|
}
|
|
@@ -4064,22 +4073,22 @@ class gi {
|
|
|
4064
4073
|
return;
|
|
4065
4074
|
let o = t, a = e;
|
|
4066
4075
|
if (!r) {
|
|
4067
|
-
const [
|
|
4068
|
-
a = [
|
|
4076
|
+
const [h] = a;
|
|
4077
|
+
a = [h, h];
|
|
4069
4078
|
}
|
|
4070
4079
|
if (!s) {
|
|
4071
|
-
const [
|
|
4072
|
-
o = [
|
|
4080
|
+
const [h] = o;
|
|
4081
|
+
o = [h, h];
|
|
4073
4082
|
}
|
|
4074
4083
|
if (JSON.stringify(this.ctx.autofill.xArr) !== JSON.stringify(o) || JSON.stringify(this.ctx.autofill.yArr) !== JSON.stringify(a)) {
|
|
4075
4084
|
const {
|
|
4076
|
-
SELECTOR_AREA_MIN_X:
|
|
4085
|
+
SELECTOR_AREA_MIN_X: h,
|
|
4077
4086
|
SELECTOR_AREA_MAX_X: c,
|
|
4078
4087
|
SELECTOR_AREA_MIN_Y: f,
|
|
4079
4088
|
SELECTOR_AREA_MAX_Y: d,
|
|
4080
4089
|
SELECTOR_AREA_MAX_X_OFFSET: x,
|
|
4081
4090
|
SELECTOR_AREA_MAX_Y_OFFSET: u
|
|
4082
|
-
} = this.ctx.config, g =
|
|
4091
|
+
} = this.ctx.config, g = h, w = c || this.ctx.maxColIndex - x, p = f, y = d || this.ctx.maxRowIndex - u;
|
|
4083
4092
|
let [b, m] = o, [E, C] = a;
|
|
4084
4093
|
if (b < g || E < p)
|
|
4085
4094
|
return;
|
|
@@ -4096,11 +4105,11 @@ class gi {
|
|
|
4096
4105
|
const g = x + e.yArr[0], w = u + e.xArr[0];
|
|
4097
4106
|
i.set(`${g}-${w}`, !0);
|
|
4098
4107
|
}
|
|
4099
|
-
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;
|
|
4100
4109
|
let c = [];
|
|
4101
|
-
for (let x = 0; x <=
|
|
4110
|
+
for (let x = 0; x <= h[1] - h[0]; x++)
|
|
4102
4111
|
for (let u = 0; u <= a[1] - a[0]; u++) {
|
|
4103
|
-
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}`;
|
|
4104
4113
|
if (y && !i.has(b)) {
|
|
4105
4114
|
const { rowKey: m, key: E } = y;
|
|
4106
4115
|
this.ctx.database.getReadonly(m, E) || (t.add(m), c.push({
|
|
@@ -4163,7 +4172,7 @@ function at(n, t) {
|
|
|
4163
4172
|
function q(n) {
|
|
4164
4173
|
return n.split("-")[0];
|
|
4165
4174
|
}
|
|
4166
|
-
function
|
|
4175
|
+
function lt(n) {
|
|
4167
4176
|
return n.split("-")[1];
|
|
4168
4177
|
}
|
|
4169
4178
|
function re(n) {
|
|
@@ -4180,7 +4189,7 @@ function Mt(n) {
|
|
|
4180
4189
|
}
|
|
4181
4190
|
function yi(n, t, e) {
|
|
4182
4191
|
e === void 0 && (e = !1);
|
|
4183
|
-
const i =
|
|
4192
|
+
const i = lt(n), s = Mt(n), r = Lt(s);
|
|
4184
4193
|
let o = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
|
|
4185
4194
|
return t.reference[r] > t.floating[r] && (o = xt(o)), [o, xt(o)];
|
|
4186
4195
|
}
|
|
@@ -4205,7 +4214,7 @@ function Ei(n, t, e) {
|
|
|
4205
4214
|
}
|
|
4206
4215
|
}
|
|
4207
4216
|
function bi(n, t, e, i) {
|
|
4208
|
-
const s =
|
|
4217
|
+
const s = lt(n);
|
|
4209
4218
|
let r = Ei(q(n), e === "start", i);
|
|
4210
4219
|
return s && (r = r.map((o) => o + "-" + s), t && (r = r.concat(r.map(Ot)))), r;
|
|
4211
4220
|
}
|
|
@@ -4252,9 +4261,9 @@ function Vt(n, t, e) {
|
|
|
4252
4261
|
reference: i,
|
|
4253
4262
|
floating: s
|
|
4254
4263
|
} = n;
|
|
4255
|
-
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;
|
|
4256
4265
|
let u;
|
|
4257
|
-
switch (
|
|
4266
|
+
switch (h) {
|
|
4258
4267
|
case "top":
|
|
4259
4268
|
u = {
|
|
4260
4269
|
x: f,
|
|
@@ -4285,7 +4294,7 @@ function Vt(n, t, e) {
|
|
|
4285
4294
|
y: i.y
|
|
4286
4295
|
};
|
|
4287
4296
|
}
|
|
4288
|
-
switch (
|
|
4297
|
+
switch (lt(t)) {
|
|
4289
4298
|
case "start":
|
|
4290
4299
|
u[o] -= x * (e && c ? -1 : 1);
|
|
4291
4300
|
break;
|
|
@@ -4301,7 +4310,7 @@ const vi = async (n, t, e) => {
|
|
|
4301
4310
|
strategy: s = "absolute",
|
|
4302
4311
|
middleware: r = [],
|
|
4303
4312
|
platform: o
|
|
4304
|
-
} = e, a = r.filter(Boolean),
|
|
4313
|
+
} = e, a = r.filter(Boolean), h = await (o.isRTL == null ? void 0 : o.isRTL(t));
|
|
4305
4314
|
let c = await o.getElementRects({
|
|
4306
4315
|
reference: n,
|
|
4307
4316
|
floating: t,
|
|
@@ -4309,7 +4318,7 @@ const vi = async (n, t, e) => {
|
|
|
4309
4318
|
}), {
|
|
4310
4319
|
x: f,
|
|
4311
4320
|
y: d
|
|
4312
|
-
} = Vt(c, i,
|
|
4321
|
+
} = Vt(c, i, h), x = i, u = {}, g = 0;
|
|
4313
4322
|
for (let w = 0; w < a.length; w++) {
|
|
4314
4323
|
const {
|
|
4315
4324
|
name: p,
|
|
@@ -4346,7 +4355,7 @@ const vi = async (n, t, e) => {
|
|
|
4346
4355
|
}) : C.rects), {
|
|
4347
4356
|
x: f,
|
|
4348
4357
|
y: d
|
|
4349
|
-
} = Vt(c, x,
|
|
4358
|
+
} = Vt(c, x, h)), w = -1);
|
|
4350
4359
|
}
|
|
4351
4360
|
return {
|
|
4352
4361
|
x: f,
|
|
@@ -4365,7 +4374,7 @@ async function ne(n, t) {
|
|
|
4365
4374
|
platform: r,
|
|
4366
4375
|
rects: o,
|
|
4367
4376
|
elements: a,
|
|
4368
|
-
strategy:
|
|
4377
|
+
strategy: h
|
|
4369
4378
|
} = n, {
|
|
4370
4379
|
boundary: c = "clippingAncestors",
|
|
4371
4380
|
rootBoundary: f = "viewport",
|
|
@@ -4376,7 +4385,7 @@ async function ne(n, t) {
|
|
|
4376
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)),
|
|
4377
4386
|
boundary: c,
|
|
4378
4387
|
rootBoundary: f,
|
|
4379
|
-
strategy:
|
|
4388
|
+
strategy: h
|
|
4380
4389
|
})), b = d === "floating" ? {
|
|
4381
4390
|
x: i,
|
|
4382
4391
|
y: s,
|
|
@@ -4392,7 +4401,7 @@ async function ne(n, t) {
|
|
|
4392
4401
|
elements: a,
|
|
4393
4402
|
rect: b,
|
|
4394
4403
|
offsetParent: m,
|
|
4395
|
-
strategy:
|
|
4404
|
+
strategy: h
|
|
4396
4405
|
}) : b);
|
|
4397
4406
|
return {
|
|
4398
4407
|
top: (y.top - C.top + g.top) / E.y,
|
|
@@ -4412,7 +4421,7 @@ const Ri = (n) => ({
|
|
|
4412
4421
|
rects: r,
|
|
4413
4422
|
platform: o,
|
|
4414
4423
|
elements: a,
|
|
4415
|
-
middlewareData:
|
|
4424
|
+
middlewareData: h
|
|
4416
4425
|
} = t, {
|
|
4417
4426
|
element: c,
|
|
4418
4427
|
padding: f = 0
|
|
@@ -4425,17 +4434,17 @@ const Ri = (n) => ({
|
|
|
4425
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));
|
|
4426
4435
|
let T = R ? R[m] : 0;
|
|
4427
4436
|
(!T || !await (o.isElement == null ? void 0 : o.isElement(R))) && (T = a.floating[m] || r.floating[g]);
|
|
4428
|
-
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;
|
|
4429
4438
|
return {
|
|
4430
4439
|
[u]: x[u] + k,
|
|
4431
4440
|
data: {
|
|
4432
4441
|
[u]: G,
|
|
4433
4442
|
centerOffset: O - G - k,
|
|
4434
|
-
...
|
|
4443
|
+
...K && {
|
|
4435
4444
|
alignmentOffset: k
|
|
4436
4445
|
}
|
|
4437
4446
|
},
|
|
4438
|
-
reset:
|
|
4447
|
+
reset: K
|
|
4439
4448
|
};
|
|
4440
4449
|
}
|
|
4441
4450
|
}), _i = function(n) {
|
|
@@ -4449,7 +4458,7 @@ const Ri = (n) => ({
|
|
|
4449
4458
|
middlewareData: r,
|
|
4450
4459
|
rects: o,
|
|
4451
4460
|
initialPlacement: a,
|
|
4452
|
-
platform:
|
|
4461
|
+
platform: h,
|
|
4453
4462
|
elements: c
|
|
4454
4463
|
} = t, {
|
|
4455
4464
|
mainAxis: f = !0,
|
|
@@ -4462,7 +4471,7 @@ const Ri = (n) => ({
|
|
|
4462
4471
|
} = at(n, t);
|
|
4463
4472
|
if ((e = r.arrow) != null && e.alignmentOffset)
|
|
4464
4473
|
return {};
|
|
4465
|
-
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";
|
|
4466
4475
|
!x && R && C.push(...bi(a, w, g, E));
|
|
4467
4476
|
const T = [a, ...C], A = await ne(t, p), L = [];
|
|
4468
4477
|
let D = ((i = r.flip) == null ? void 0 : i.overflows) || [];
|
|
@@ -4486,8 +4495,8 @@ const Ri = (n) => ({
|
|
|
4486
4495
|
placement: G
|
|
4487
4496
|
}
|
|
4488
4497
|
};
|
|
4489
|
-
let
|
|
4490
|
-
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)
|
|
4491
4500
|
switch (u) {
|
|
4492
4501
|
case "bestFit": {
|
|
4493
4502
|
var S;
|
|
@@ -4500,17 +4509,17 @@ const Ri = (n) => ({
|
|
|
4500
4509
|
}
|
|
4501
4510
|
return !0;
|
|
4502
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];
|
|
4503
|
-
k && (
|
|
4512
|
+
k && (K = k);
|
|
4504
4513
|
break;
|
|
4505
4514
|
}
|
|
4506
4515
|
case "initialPlacement":
|
|
4507
|
-
|
|
4516
|
+
K = a;
|
|
4508
4517
|
break;
|
|
4509
4518
|
}
|
|
4510
|
-
if (s !==
|
|
4519
|
+
if (s !== K)
|
|
4511
4520
|
return {
|
|
4512
4521
|
reset: {
|
|
4513
|
-
placement:
|
|
4522
|
+
placement: K
|
|
4514
4523
|
}
|
|
4515
4524
|
};
|
|
4516
4525
|
}
|
|
@@ -4523,7 +4532,7 @@ async function Ii(n, t) {
|
|
|
4523
4532
|
placement: e,
|
|
4524
4533
|
platform: i,
|
|
4525
4534
|
elements: s
|
|
4526
|
-
} = 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);
|
|
4527
4536
|
let {
|
|
4528
4537
|
mainAxis: x,
|
|
4529
4538
|
crossAxis: u,
|
|
@@ -4537,7 +4546,7 @@ async function Ii(n, t) {
|
|
|
4537
4546
|
crossAxis: d.crossAxis || 0,
|
|
4538
4547
|
alignmentAxis: d.alignmentAxis
|
|
4539
4548
|
};
|
|
4540
|
-
return a && typeof g == "number" && (u = a === "end" ? g * -1 : g),
|
|
4549
|
+
return a && typeof g == "number" && (u = a === "end" ? g * -1 : g), h ? {
|
|
4541
4550
|
x: u * f,
|
|
4542
4551
|
y: x * c
|
|
4543
4552
|
} : {
|
|
@@ -4556,12 +4565,12 @@ const Oi = function(n) {
|
|
|
4556
4565
|
y: r,
|
|
4557
4566
|
placement: o,
|
|
4558
4567
|
middlewareData: a
|
|
4559
|
-
} = t,
|
|
4568
|
+
} = t, h = await Ii(t, n);
|
|
4560
4569
|
return o === ((e = a.offset) == null ? void 0 : e.placement) && (i = a.arrow) != null && i.alignmentOffset ? {} : {
|
|
4561
|
-
x: s +
|
|
4562
|
-
y: r +
|
|
4570
|
+
x: s + h.x,
|
|
4571
|
+
y: r + h.y,
|
|
4563
4572
|
data: {
|
|
4564
|
-
...
|
|
4573
|
+
...h,
|
|
4565
4574
|
placement: o
|
|
4566
4575
|
}
|
|
4567
4576
|
};
|
|
@@ -4591,11 +4600,11 @@ const Oi = function(n) {
|
|
|
4591
4600
|
};
|
|
4592
4601
|
}
|
|
4593
4602
|
},
|
|
4594
|
-
...
|
|
4603
|
+
...h
|
|
4595
4604
|
} = at(n, t), c = {
|
|
4596
4605
|
x: e,
|
|
4597
4606
|
y: i
|
|
4598
|
-
}, f = await ne(t,
|
|
4607
|
+
}, f = await ne(t, h), d = J(q(s)), x = re(d);
|
|
4599
4608
|
let u = c[x], g = c[d];
|
|
4600
4609
|
if (r) {
|
|
4601
4610
|
const p = x === "y" ? "top" : "left", y = x === "y" ? "bottom" : "right", b = u + f[p], m = u - f[y];
|
|
@@ -4634,7 +4643,7 @@ function H(n) {
|
|
|
4634
4643
|
var t;
|
|
4635
4644
|
return (n == null || (t = n.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
4636
4645
|
}
|
|
4637
|
-
function
|
|
4646
|
+
function Y(n) {
|
|
4638
4647
|
var t;
|
|
4639
4648
|
return (t = (ae(n) ? n.ownerDocument : n.document) || window.document) == null ? void 0 : t.documentElement;
|
|
4640
4649
|
}
|
|
@@ -4650,7 +4659,7 @@ function N(n) {
|
|
|
4650
4659
|
function zt(n) {
|
|
4651
4660
|
return !gt() || typeof ShadowRoot > "u" ? !1 : n instanceof ShadowRoot || n instanceof H(n).ShadowRoot;
|
|
4652
4661
|
}
|
|
4653
|
-
function
|
|
4662
|
+
function ht(n) {
|
|
4654
4663
|
const {
|
|
4655
4664
|
overflow: t,
|
|
4656
4665
|
overflowX: e,
|
|
@@ -4712,28 +4721,28 @@ function z(n) {
|
|
|
4712
4721
|
n.assignedSlot || // DOM Element detected.
|
|
4713
4722
|
n.parentNode || // ShadowRoot detected.
|
|
4714
4723
|
zt(n) && n.host || // Fallback.
|
|
4715
|
-
|
|
4724
|
+
Y(n)
|
|
4716
4725
|
);
|
|
4717
4726
|
return zt(t) ? t.host : t;
|
|
4718
4727
|
}
|
|
4719
|
-
function
|
|
4728
|
+
function le(n) {
|
|
4720
4729
|
const t = z(n);
|
|
4721
|
-
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);
|
|
4722
4731
|
}
|
|
4723
4732
|
function Tt(n, t, e) {
|
|
4724
4733
|
var i;
|
|
4725
4734
|
t === void 0 && (t = []), e === void 0 && (e = !0);
|
|
4726
|
-
const s =
|
|
4735
|
+
const s = le(n), r = s === ((i = n.ownerDocument) == null ? void 0 : i.body), o = H(s);
|
|
4727
4736
|
if (r) {
|
|
4728
4737
|
const a = St(o);
|
|
4729
|
-
return t.concat(o, o.visualViewport || [],
|
|
4738
|
+
return t.concat(o, o.visualViewport || [], ht(s) ? s : [], a && e ? Tt(a) : []);
|
|
4730
4739
|
}
|
|
4731
4740
|
return t.concat(s, Tt(s, [], e));
|
|
4732
4741
|
}
|
|
4733
4742
|
function St(n) {
|
|
4734
4743
|
return n.parent && Object.getPrototypeOf(n.parent) ? n.frameElement : null;
|
|
4735
4744
|
}
|
|
4736
|
-
function
|
|
4745
|
+
function he(n) {
|
|
4737
4746
|
const t = X(n);
|
|
4738
4747
|
let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
|
|
4739
4748
|
const s = N(n), r = s ? n.offsetWidth : e, o = s ? n.offsetHeight : i, a = ft(e) !== r || ft(i) !== o;
|
|
@@ -4754,7 +4763,7 @@ function Z(n) {
|
|
|
4754
4763
|
width: i,
|
|
4755
4764
|
height: s,
|
|
4756
4765
|
$: r
|
|
4757
|
-
} =
|
|
4766
|
+
} = he(t);
|
|
4758
4767
|
let o = (r ? ft(e.width) : e.width) / i, a = (r ? ft(e.height) : e.height) / s;
|
|
4759
4768
|
return (!o || !Number.isFinite(o)) && (o = 1), (!a || !Number.isFinite(a)) && (a = 1), {
|
|
4760
4769
|
x: o,
|
|
@@ -4778,19 +4787,19 @@ function ot(n, t, e, i) {
|
|
|
4778
4787
|
let o = V(1);
|
|
4779
4788
|
t && (i ? F(i) && (o = Z(i)) : o = Z(n));
|
|
4780
4789
|
const a = Mi(r, e, i) ? de(r) : V(0);
|
|
4781
|
-
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;
|
|
4782
4791
|
if (r) {
|
|
4783
4792
|
const x = H(r), u = i && F(i) ? H(i) : i;
|
|
4784
4793
|
let g = x, w = St(g);
|
|
4785
4794
|
for (; w && i && u !== g; ) {
|
|
4786
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;
|
|
4787
|
-
|
|
4796
|
+
h *= p.x, c *= p.y, f *= p.x, d *= p.y, h += m, c += E, g = H(w), w = St(g);
|
|
4788
4797
|
}
|
|
4789
4798
|
}
|
|
4790
4799
|
return ut({
|
|
4791
4800
|
width: f,
|
|
4792
4801
|
height: d,
|
|
4793
|
-
x:
|
|
4802
|
+
x: h,
|
|
4794
4803
|
y: c
|
|
4795
4804
|
});
|
|
4796
4805
|
}
|
|
@@ -4801,23 +4810,23 @@ function Hi(n) {
|
|
|
4801
4810
|
offsetParent: i,
|
|
4802
4811
|
strategy: s
|
|
4803
4812
|
} = n;
|
|
4804
|
-
const r = s === "fixed", o =
|
|
4813
|
+
const r = s === "fixed", o = Y(i), a = t ? wt(t.floating) : !1;
|
|
4805
4814
|
if (i === o || a && r)
|
|
4806
4815
|
return e;
|
|
4807
|
-
let
|
|
4816
|
+
let h = {
|
|
4808
4817
|
scrollLeft: 0,
|
|
4809
4818
|
scrollTop: 0
|
|
4810
4819
|
}, c = V(1);
|
|
4811
4820
|
const f = V(0), d = N(i);
|
|
4812
|
-
if ((d || !d && !r) && ((tt(i) !== "body" ||
|
|
4821
|
+
if ((d || !d && !r) && ((tt(i) !== "body" || ht(o)) && (h = pt(i)), N(i))) {
|
|
4813
4822
|
const x = ot(i);
|
|
4814
4823
|
c = Z(i), f.x = x.x + i.clientLeft, f.y = x.y + i.clientTop;
|
|
4815
4824
|
}
|
|
4816
4825
|
return {
|
|
4817
4826
|
width: e.width * c.x,
|
|
4818
4827
|
height: e.height * c.y,
|
|
4819
|
-
x: e.x * c.x -
|
|
4820
|
-
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
|
|
4821
4830
|
};
|
|
4822
4831
|
}
|
|
4823
4832
|
function Di(n) {
|
|
@@ -4825,10 +4834,10 @@ function Di(n) {
|
|
|
4825
4834
|
}
|
|
4826
4835
|
function At(n, t) {
|
|
4827
4836
|
const e = pt(n).scrollLeft;
|
|
4828
|
-
return t ? t.left + e : ot(
|
|
4837
|
+
return t ? t.left + e : ot(Y(n)).left + e;
|
|
4829
4838
|
}
|
|
4830
4839
|
function Fi(n) {
|
|
4831
|
-
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);
|
|
4832
4841
|
let o = -e.scrollLeft + At(n);
|
|
4833
4842
|
const a = -e.scrollTop;
|
|
4834
4843
|
return X(i).direction === "rtl" && (o += U(t.clientWidth, i.clientWidth) - s), {
|
|
@@ -4839,26 +4848,26 @@ function Fi(n) {
|
|
|
4839
4848
|
};
|
|
4840
4849
|
}
|
|
4841
4850
|
function Xi(n, t) {
|
|
4842
|
-
const e = H(n), i =
|
|
4843
|
-
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;
|
|
4844
4853
|
if (s) {
|
|
4845
4854
|
r = s.width, o = s.height;
|
|
4846
4855
|
const c = Dt();
|
|
4847
|
-
(!c || c && t === "fixed") && (a = s.offsetLeft,
|
|
4856
|
+
(!c || c && t === "fixed") && (a = s.offsetLeft, h = s.offsetTop);
|
|
4848
4857
|
}
|
|
4849
4858
|
return {
|
|
4850
4859
|
width: r,
|
|
4851
4860
|
height: o,
|
|
4852
4861
|
x: a,
|
|
4853
|
-
y:
|
|
4862
|
+
y: h
|
|
4854
4863
|
};
|
|
4855
4864
|
}
|
|
4856
4865
|
function ki(n, t) {
|
|
4857
|
-
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;
|
|
4858
4867
|
return {
|
|
4859
4868
|
width: o,
|
|
4860
4869
|
height: a,
|
|
4861
|
-
x:
|
|
4870
|
+
x: h,
|
|
4862
4871
|
y: c
|
|
4863
4872
|
};
|
|
4864
4873
|
}
|
|
@@ -4867,7 +4876,7 @@ function $t(n, t, e) {
|
|
|
4867
4876
|
if (t === "viewport")
|
|
4868
4877
|
i = Xi(n, e);
|
|
4869
4878
|
else if (t === "document")
|
|
4870
|
-
i = Fi(
|
|
4879
|
+
i = Fi(Y(n));
|
|
4871
4880
|
else if (F(t))
|
|
4872
4881
|
i = ki(t, e);
|
|
4873
4882
|
else {
|
|
@@ -4892,58 +4901,58 @@ function Ni(n, t) {
|
|
|
4892
4901
|
const r = X(n).position === "fixed";
|
|
4893
4902
|
let o = r ? z(n) : n;
|
|
4894
4903
|
for (; F(o) && !Q(o); ) {
|
|
4895
|
-
const a = X(o),
|
|
4896
|
-
!
|
|
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);
|
|
4897
4906
|
}
|
|
4898
4907
|
return t.set(n, i), i;
|
|
4899
4908
|
}
|
|
4900
|
-
function
|
|
4909
|
+
function Ki(n) {
|
|
4901
4910
|
let {
|
|
4902
4911
|
element: t,
|
|
4903
4912
|
boundary: e,
|
|
4904
4913
|
rootBoundary: i,
|
|
4905
4914
|
strategy: s
|
|
4906
4915
|
} = n;
|
|
4907
|
-
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) => {
|
|
4908
4917
|
const d = $t(t, f, s);
|
|
4909
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;
|
|
4910
4919
|
}, $t(t, a, s));
|
|
4911
4920
|
return {
|
|
4912
|
-
width:
|
|
4913
|
-
height:
|
|
4914
|
-
x:
|
|
4915
|
-
y:
|
|
4921
|
+
width: h.right - h.left,
|
|
4922
|
+
height: h.bottom - h.top,
|
|
4923
|
+
x: h.left,
|
|
4924
|
+
y: h.top
|
|
4916
4925
|
};
|
|
4917
4926
|
}
|
|
4918
|
-
function
|
|
4927
|
+
function Yi(n) {
|
|
4919
4928
|
const {
|
|
4920
4929
|
width: t,
|
|
4921
4930
|
height: e
|
|
4922
|
-
} =
|
|
4931
|
+
} = he(n);
|
|
4923
4932
|
return {
|
|
4924
4933
|
width: t,
|
|
4925
4934
|
height: e
|
|
4926
4935
|
};
|
|
4927
4936
|
}
|
|
4928
4937
|
function Bi(n, t, e) {
|
|
4929
|
-
const i = N(t), s =
|
|
4938
|
+
const i = N(t), s = Y(t), r = e === "fixed", o = ot(n, !0, r, t);
|
|
4930
4939
|
let a = {
|
|
4931
4940
|
scrollLeft: 0,
|
|
4932
4941
|
scrollTop: 0
|
|
4933
4942
|
};
|
|
4934
|
-
const
|
|
4943
|
+
const h = V(0);
|
|
4935
4944
|
if (i || !i && !r)
|
|
4936
|
-
if ((tt(t) !== "body" ||
|
|
4945
|
+
if ((tt(t) !== "body" || ht(s)) && (a = pt(t)), i) {
|
|
4937
4946
|
const u = ot(t, !0, r, t);
|
|
4938
|
-
|
|
4939
|
-
} else s && (
|
|
4947
|
+
h.x = u.x + t.clientLeft, h.y = u.y + t.clientTop;
|
|
4948
|
+
} else s && (h.x = At(s));
|
|
4940
4949
|
let c = 0, f = 0;
|
|
4941
4950
|
if (s && !i && !r) {
|
|
4942
4951
|
const u = s.getBoundingClientRect();
|
|
4943
4952
|
f = u.top + a.scrollTop, c = u.left + a.scrollLeft - // RTL <body> scrollbar.
|
|
4944
4953
|
At(s, u);
|
|
4945
4954
|
}
|
|
4946
|
-
const d = o.left + a.scrollLeft -
|
|
4955
|
+
const d = o.left + a.scrollLeft - h.x - c, x = o.top + a.scrollTop - h.y - f;
|
|
4947
4956
|
return {
|
|
4948
4957
|
x: d,
|
|
4949
4958
|
y: x,
|
|
@@ -4960,7 +4969,7 @@ function qt(n, t) {
|
|
|
4960
4969
|
if (t)
|
|
4961
4970
|
return t(n);
|
|
4962
4971
|
let e = n.offsetParent;
|
|
4963
|
-
return
|
|
4972
|
+
return Y(n) === e && (e = e.ownerDocument.body), e;
|
|
4964
4973
|
}
|
|
4965
4974
|
function xe(n, t) {
|
|
4966
4975
|
const e = H(n);
|
|
@@ -4997,12 +5006,12 @@ function Pi(n) {
|
|
|
4997
5006
|
}
|
|
4998
5007
|
const Vi = {
|
|
4999
5008
|
convertOffsetParentRelativeRectToViewportRelativeRect: Hi,
|
|
5000
|
-
getDocumentElement:
|
|
5001
|
-
getClippingRect:
|
|
5009
|
+
getDocumentElement: Y,
|
|
5010
|
+
getClippingRect: Ki,
|
|
5002
5011
|
getOffsetParent: xe,
|
|
5003
5012
|
getElementRects: Wi,
|
|
5004
5013
|
getClientRects: Di,
|
|
5005
|
-
getDimensions:
|
|
5014
|
+
getDimensions: Yi,
|
|
5006
5015
|
getScale: Z,
|
|
5007
5016
|
isElement: F,
|
|
5008
5017
|
isRTL: Pi
|
|
@@ -5021,11 +5030,11 @@ const Vi = {
|
|
|
5021
5030
|
};
|
|
5022
5031
|
let $i = class {
|
|
5023
5032
|
constructor(t) {
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5033
|
+
l(this, "ctx");
|
|
5034
|
+
l(this, "enable", !1);
|
|
5035
|
+
l(this, "contentEl");
|
|
5036
|
+
l(this, "floatingEl");
|
|
5037
|
+
l(this, "arrowEl");
|
|
5029
5038
|
this.ctx = t;
|
|
5030
5039
|
const { TOOLTIP_BG_COLOR: e, TOOLTIP_TEXT_COLOR: i, TOOLTIP_ZINDEX: s, TOOLTIP_CUSTOM_STYLE: r, CSS_PREFIX: o } = this.ctx.config;
|
|
5031
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`;
|
|
@@ -5040,7 +5049,7 @@ let $i = class {
|
|
|
5040
5049
|
borderRadius: "4px",
|
|
5041
5050
|
fontSize: "12px",
|
|
5042
5051
|
...r
|
|
5043
|
-
},
|
|
5052
|
+
}, h = {
|
|
5044
5053
|
position: "absolute",
|
|
5045
5054
|
width: "10px",
|
|
5046
5055
|
height: "10px",
|
|
@@ -5049,7 +5058,7 @@ let $i = class {
|
|
|
5049
5058
|
transform: "rotate(45deg)",
|
|
5050
5059
|
zIndex: a.zIndex
|
|
5051
5060
|
};
|
|
5052
|
-
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();
|
|
5053
5062
|
}
|
|
5054
5063
|
init() {
|
|
5055
5064
|
this.ctx.on("mousemove", (t) => {
|
|
@@ -5093,10 +5102,10 @@ let $i = class {
|
|
|
5093
5102
|
placement: t.overflowTooltipPlacement,
|
|
5094
5103
|
middleware: [ge(), we(), ue(6), zi({ element: this.arrowEl })]
|
|
5095
5104
|
}).then((a) => {
|
|
5096
|
-
const { x:
|
|
5105
|
+
const { x: h, y: c, placement: f, middlewareData: d } = a;
|
|
5097
5106
|
if (Object.assign(this.floatingEl.style, {
|
|
5098
5107
|
top: `${c}px`,
|
|
5099
|
-
left: `${
|
|
5108
|
+
left: `${h}px`
|
|
5100
5109
|
}), d.arrow) {
|
|
5101
5110
|
const x = d.arrow;
|
|
5102
5111
|
["left", "left-start", "left-end"].includes(f) ? Object.assign(this.arrowEl.style, {
|
|
@@ -5132,13 +5141,13 @@ let $i = class {
|
|
|
5132
5141
|
};
|
|
5133
5142
|
class qi {
|
|
5134
5143
|
constructor(t) {
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
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);
|
|
5142
5151
|
this.ctx = t, this.initTextEditor(), this.init();
|
|
5143
5152
|
}
|
|
5144
5153
|
init() {
|
|
@@ -5223,12 +5232,12 @@ class qi {
|
|
|
5223
5232
|
this.drawX = r, this.drawY = o;
|
|
5224
5233
|
let { height: a } = t;
|
|
5225
5234
|
const {
|
|
5226
|
-
config: { CELL_PADDING:
|
|
5235
|
+
config: { CELL_PADDING: h },
|
|
5227
5236
|
header: c
|
|
5228
5237
|
} = this.ctx;
|
|
5229
5238
|
let f = this.ctx.body.visibleHeight;
|
|
5230
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") {
|
|
5231
|
-
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();
|
|
5232
5241
|
const d = this.inputEl.value.length;
|
|
5233
5242
|
this.inputEl.setSelectionRange(d, d);
|
|
5234
5243
|
} else
|
|
@@ -5262,8 +5271,8 @@ class qi {
|
|
|
5262
5271
|
const r = this.ctx.focusCell;
|
|
5263
5272
|
if (!r || ["index", "index-selection", "selection"].includes(r.type) || this.enable)
|
|
5264
5273
|
return;
|
|
5265
|
-
const { rowKey: o, key: a } = r,
|
|
5266
|
-
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));
|
|
5267
5276
|
}
|
|
5268
5277
|
doneEdit() {
|
|
5269
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"));
|
|
@@ -5275,24 +5284,22 @@ class qi {
|
|
|
5275
5284
|
}
|
|
5276
5285
|
class Gi {
|
|
5277
5286
|
constructor(t) {
|
|
5278
|
-
|
|
5279
|
-
|
|
5287
|
+
l(this, "ctx");
|
|
5288
|
+
l(this, "emptyEl");
|
|
5280
5289
|
this.ctx = t;
|
|
5281
|
-
const { EMPTY_TEXT: e,
|
|
5282
|
-
this.emptyEl = document.createElement("div"), this.emptyEl.
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
const f = a + (l + c) / 2, d = {
|
|
5286
|
-
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",
|
|
5287
5294
|
position: "absolute",
|
|
5288
5295
|
fontSize: "14px",
|
|
5289
5296
|
color: "#666",
|
|
5290
5297
|
left: "50%",
|
|
5291
|
-
top: `${
|
|
5298
|
+
top: `${h}px`,
|
|
5292
5299
|
transform: "translate(-50%, -50%)",
|
|
5293
|
-
...
|
|
5300
|
+
...i
|
|
5294
5301
|
};
|
|
5295
|
-
Object.assign(this.emptyEl.style,
|
|
5302
|
+
Object.assign(this.emptyEl.style, c);
|
|
5296
5303
|
});
|
|
5297
5304
|
}
|
|
5298
5305
|
destroy() {
|
|
@@ -5301,7 +5308,7 @@ class Gi {
|
|
|
5301
5308
|
}
|
|
5302
5309
|
class ji {
|
|
5303
5310
|
constructor(t) {
|
|
5304
|
-
|
|
5311
|
+
l(this, "ctx");
|
|
5305
5312
|
this.ctx = t;
|
|
5306
5313
|
}
|
|
5307
5314
|
draw() {
|
|
@@ -5328,9 +5335,9 @@ class ji {
|
|
|
5328
5335
|
fixedRightWidth: e,
|
|
5329
5336
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
5330
5337
|
} = this.ctx, { visibleWidth: r, visibleHeight: o, renderCellHeaders: a } = this.ctx.header;
|
|
5331
|
-
let
|
|
5338
|
+
let h = [], c = [], f = [];
|
|
5332
5339
|
a.forEach((p) => {
|
|
5333
|
-
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));
|
|
5334
5341
|
});
|
|
5335
5342
|
const d = e - i, x = {
|
|
5336
5343
|
key: "left",
|
|
@@ -5353,7 +5360,7 @@ class ji {
|
|
|
5353
5360
|
width: `${r - t - d + 1}px`,
|
|
5354
5361
|
height: `${o}px`
|
|
5355
5362
|
},
|
|
5356
|
-
cells:
|
|
5363
|
+
cells: h
|
|
5357
5364
|
}, g = {
|
|
5358
5365
|
key: "right",
|
|
5359
5366
|
style: {
|
|
@@ -5389,7 +5396,7 @@ class ji {
|
|
|
5389
5396
|
const {
|
|
5390
5397
|
fixedLeftWidth: r,
|
|
5391
5398
|
fixedRightWidth: o,
|
|
5392
|
-
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX:
|
|
5399
|
+
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX: h }
|
|
5393
5400
|
} = this.ctx, { visibleWidth: c, visibleHeight: f } = this.ctx.body, d = o - a, x = {
|
|
5394
5401
|
key: "left",
|
|
5395
5402
|
style: {
|
|
@@ -5426,7 +5433,7 @@ class ji {
|
|
|
5426
5433
|
};
|
|
5427
5434
|
return {
|
|
5428
5435
|
type: "body",
|
|
5429
|
-
class: `${
|
|
5436
|
+
class: `${h}-overlayer-body`,
|
|
5430
5437
|
style: {
|
|
5431
5438
|
position: "relative",
|
|
5432
5439
|
overflow: "hidden",
|
|
@@ -5447,7 +5454,7 @@ class ji {
|
|
|
5447
5454
|
fixedLeftWidth: s,
|
|
5448
5455
|
fixedRightWidth: r,
|
|
5449
5456
|
config: { SCROLLER_TRACK_SIZE: o, CSS_PREFIX: a }
|
|
5450
|
-
} = this.ctx, { visibleWidth:
|
|
5457
|
+
} = this.ctx, { visibleWidth: h, visibleHeight: c } = this.ctx.footer, f = r - o, d = {
|
|
5451
5458
|
key: "left",
|
|
5452
5459
|
style: {
|
|
5453
5460
|
position: "absolute",
|
|
@@ -5465,7 +5472,7 @@ class ji {
|
|
|
5465
5472
|
top: `${0.5}px`,
|
|
5466
5473
|
left: `${s - 0.5}px`,
|
|
5467
5474
|
overflow: "hidden",
|
|
5468
|
-
width: `${
|
|
5475
|
+
width: `${h - s - f}px`,
|
|
5469
5476
|
height: `${c}px`
|
|
5470
5477
|
},
|
|
5471
5478
|
cells: t
|
|
@@ -5487,7 +5494,7 @@ class ji {
|
|
|
5487
5494
|
style: {
|
|
5488
5495
|
position: "relative",
|
|
5489
5496
|
overflow: "hidden",
|
|
5490
|
-
width: `${
|
|
5497
|
+
width: `${h}px`,
|
|
5491
5498
|
height: `${c}px`
|
|
5492
5499
|
},
|
|
5493
5500
|
views: [d, x, u]
|
|
@@ -5496,16 +5503,17 @@ class ji {
|
|
|
5496
5503
|
}
|
|
5497
5504
|
class Ui {
|
|
5498
5505
|
constructor(t) {
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
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();
|
|
5502
5510
|
}
|
|
5503
5511
|
init() {
|
|
5504
5512
|
this.ctx.on("cellContextMenuClick", (t, e) => {
|
|
5505
5513
|
if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
|
|
5506
5514
|
e.preventDefault();
|
|
5507
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [a,
|
|
5508
|
-
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);
|
|
5509
5517
|
const x = {
|
|
5510
5518
|
getBoundingClientRect: () => ({
|
|
5511
5519
|
width: 0,
|
|
@@ -5529,7 +5537,7 @@ class Ui {
|
|
|
5529
5537
|
}
|
|
5530
5538
|
//创建右键菜单,绑定子项点击事件
|
|
5531
5539
|
createContextMenu() {
|
|
5532
|
-
|
|
5540
|
+
if (this.contextMenuEl.className = "e-virt-table-context-menu", this.ctx.containerElement.appendChild(this.contextMenuEl), this.coustom) return;
|
|
5533
5541
|
const { CONTEXT_MENU: t } = this.ctx.config;
|
|
5534
5542
|
this.createContextMenuItems(t, (e) => {
|
|
5535
5543
|
switch (e.value) {
|
|
@@ -5551,7 +5559,7 @@ class Ui {
|
|
|
5551
5559
|
}
|
|
5552
5560
|
//创建右键菜单子项元素
|
|
5553
5561
|
createContextMenuItems(t, e) {
|
|
5554
|
-
t.forEach((i) => {
|
|
5562
|
+
this.contextMenuEl.replaceChildren(), t.forEach((i) => {
|
|
5555
5563
|
const s = document.createElement("div");
|
|
5556
5564
|
s.className = "e-virt-table-context-menu-item", s.innerText = i.label, i.event ? s.onclick = () => {
|
|
5557
5565
|
i.event && i.event(), e(i);
|
|
@@ -5579,38 +5587,48 @@ class Ui {
|
|
|
5579
5587
|
}
|
|
5580
5588
|
class Qi {
|
|
5581
5589
|
constructor(t, e) {
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
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");
|
|
5595
5603
|
this.options = e;
|
|
5596
|
-
const { overlayerElement: i, editorElement: s } = e,
|
|
5597
|
-
|
|
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", () => {
|
|
5598
5612
|
this.draw();
|
|
5599
5613
|
}), this.ctx.on("drawView", () => {
|
|
5600
5614
|
this.draw(!0);
|
|
5601
5615
|
}), this.draw();
|
|
5602
5616
|
}
|
|
5603
|
-
createContainer(t, e, i) {
|
|
5617
|
+
createContainer(t, e, i, s, r) {
|
|
5604
5618
|
t.className = "e-virt-table-container";
|
|
5605
|
-
const
|
|
5606
|
-
|
|
5607
|
-
const
|
|
5608
|
-
|
|
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), {
|
|
5609
5625
|
containerElement: t,
|
|
5610
|
-
stageElement:
|
|
5611
|
-
canvasElement:
|
|
5612
|
-
overlayerElement:
|
|
5613
|
-
editorElement:
|
|
5626
|
+
stageElement: o,
|
|
5627
|
+
canvasElement: a,
|
|
5628
|
+
overlayerElement: h,
|
|
5629
|
+
editorElement: c,
|
|
5630
|
+
emptyElement: f,
|
|
5631
|
+
contextMenuElement: d
|
|
5614
5632
|
};
|
|
5615
5633
|
}
|
|
5616
5634
|
draw(t = !1) {
|
|
@@ -5675,8 +5693,8 @@ class Qi {
|
|
|
5675
5693
|
if (t && Array.isArray(s) && s.length) {
|
|
5676
5694
|
const [r] = s;
|
|
5677
5695
|
if (Array.isArray(r) && r.length) {
|
|
5678
|
-
const [o] = r, { rowKey: a, key:
|
|
5679
|
-
this.scrollToRowkey(a), this.scrollToColkey(
|
|
5696
|
+
const [o] = r, { rowKey: a, key: h } = o;
|
|
5697
|
+
this.scrollToRowkey(a), this.scrollToColkey(h);
|
|
5680
5698
|
}
|
|
5681
5699
|
}
|
|
5682
5700
|
i(s);
|
|
@@ -5701,7 +5719,7 @@ class Qi {
|
|
|
5701
5719
|
let r = [];
|
|
5702
5720
|
for (let o = 0; o < i.length; o++)
|
|
5703
5721
|
for (let a = 0; a < s.length; a++) {
|
|
5704
|
-
const
|
|
5722
|
+
const h = this.ctx.database.getRowKeyByItem(i[o]), f = s[a].key, d = await this.ctx.database.getValidator(h, f);
|
|
5705
5723
|
Array.isArray(d) && d.length && r.push(d);
|
|
5706
5724
|
}
|
|
5707
5725
|
r.length ? (e(r), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
|