e-virt-table 0.1.2 → 0.1.3
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 +791 -783
- 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/Context.d.ts +2 -0
- package/dist/lib/Context.js +8 -1
- package/dist/lib/Context.js.map +1 -1
- package/dist/lib/EVirtTable.js +8 -3
- package/dist/lib/EVirtTable.js.map +1 -1
- package/dist/lib/Editor.js +32 -27
- package/dist/lib/Editor.js.map +1 -1
- package/dist/lib/Selector.js +1 -1
- package/dist/lib/Selector.js.map +1 -1
- package/dist/lib/types.d.ts +1 -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}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;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:10}.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,8 +39,8 @@ 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
|
|
43
|
-
return o && st(
|
|
42
|
+
var c = Function.bind.apply(s, a), h = new c();
|
|
43
|
+
return o && st(h, o.prototype), h;
|
|
44
44
|
}, dt.apply(null, arguments);
|
|
45
45
|
}
|
|
46
46
|
function ve(n) {
|
|
@@ -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), c = a.length, h = 0, f = [], d = new Promise(function(x, u) {
|
|
173
173
|
var g = function(p) {
|
|
174
|
-
if (f.push.apply(f, p),
|
|
174
|
+
if (f.push.apply(f, p), h++, h === c)
|
|
175
175
|
return i(f), f.length ? u(new Kt(f, Ct(f))) : x(s);
|
|
176
176
|
};
|
|
177
177
|
a.length || (i(f), x(s)), a.forEach(function(w) {
|
|
@@ -218,9 +218,9 @@ var Qt = function(t, e, i, s, r, o) {
|
|
|
218
218
|
t.required && (!i.hasOwnProperty(t.field) || _(e, o || t.type)) && s.push(M(r.messages.required, t.fullField));
|
|
219
219
|
}, Le = function(t, e, i, s, r) {
|
|
220
220
|
(/^\s+$/.test(e) || e === "") && s.push(M(r.messages.whitespace, t.fullField));
|
|
221
|
-
},
|
|
222
|
-
if (
|
|
223
|
-
return
|
|
221
|
+
}, ht, Me = function() {
|
|
222
|
+
if (ht)
|
|
223
|
+
return ht;
|
|
224
224
|
var n = "[a-fA-F\\d:]", t = function(E) {
|
|
225
225
|
return E && E.includeBoundaries ? "(?:(?<=\\s|^)(?=" + n + ")|(?<=" + n + ")(?=\\s|$))" : "";
|
|
226
226
|
}, e = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}", i = "[a-fA-F\\d]{1,4}", s = (`
|
|
@@ -234,16 +234,16 @@ var Qt = 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 + "$"), c = 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
|
+
c.v4 = function(m) {
|
|
241
241
|
return m && m.exact ? o : new RegExp("" + t(m) + e + t(m), "g");
|
|
242
|
-
},
|
|
242
|
+
}, c.v6 = function(m) {
|
|
243
243
|
return m && m.exact ? a : new RegExp("" + t(m) + s + t(m), "g");
|
|
244
244
|
};
|
|
245
|
-
var
|
|
246
|
-
return
|
|
245
|
+
var h = "(?:(?:[a-z]+:)?//)", f = "(?:\\S+(?::\\S*)?@)?", d = c.v4().source, x = c.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 = "(?:" + h + "|www\\.)" + f + "(?:localhost|" + d + "|" + x + "|" + u + g + w + ")" + p + y;
|
|
246
|
+
return ht = new RegExp("(?:^" + b + "$)", "i"), ht;
|
|
247
247
|
}, Pt = {
|
|
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,}))$/,
|
|
@@ -300,10 +300,10 @@ var Qt = 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", c = typeof t.max == "number", h = /[\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(
|
|
306
|
+
g && (f = e.length), u && (f = e.replace(h, "_").length), o ? f !== t.len && s.push(M(r.messages[d].len, t.fullField, t.len)) : a && !c && f < t.min ? s.push(M(r.messages[d].min, t.fullField, t.min)) : c && !a && f > t.max ? s.push(M(r.messages[d].max, t.fullField, t.max)) : a && c && (f < t.min || f > t.max) && s.push(M(r.messages[d].range, t.fullField, t.min, t.max));
|
|
307
307
|
}, j = "enum", Xe = 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
|
}, Fe = function(t, e, i, s, r) {
|
|
@@ -416,8 +416,8 @@ var Qt = 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 c;
|
|
420
|
+
e instanceof Date ? c = e : c = new Date(e), v.type(t, c, s, o, r), c && v.range(t, c.getTime(), s, o, r);
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
i(o);
|
|
@@ -425,8 +425,8 @@ var Qt = 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 = [], c = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
429
|
+
if (c) {
|
|
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);
|
|
@@ -533,9 +533,9 @@ 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
|
|
538
|
-
return
|
|
536
|
+
var a = i, c = s, h = r;
|
|
537
|
+
if (typeof c == "function" && (h = c, c = {}), !this.rules || Object.keys(this.rules).length === 0)
|
|
538
|
+
return h && h(null, a), Promise.resolve(a);
|
|
539
539
|
function f(w) {
|
|
540
540
|
var p = [], y = {};
|
|
541
541
|
function b(E) {
|
|
@@ -547,14 +547,14 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
547
547
|
}
|
|
548
548
|
for (var m = 0; m < w.length; m++)
|
|
549
549
|
b(w[m]);
|
|
550
|
-
p.length ? (y = Ct(p),
|
|
550
|
+
p.length ? (y = Ct(p), h(p, y)) : h(null, a);
|
|
551
551
|
}
|
|
552
|
-
if (
|
|
552
|
+
if (c.messages) {
|
|
553
553
|
var d = this.messages();
|
|
554
|
-
d === Rt && (d = vt()), Wt(d,
|
|
554
|
+
d === Rt && (d = vt()), Wt(d, c.messages), c.messages = d;
|
|
555
555
|
} else
|
|
556
|
-
|
|
557
|
-
var x = {}, u =
|
|
556
|
+
c.messages = this.messages();
|
|
557
|
+
var x = {}, u = c.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, c, 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
|
+
!c.suppressWarning && T.length && n.warning("async-validator:", T), T.length && y.message !== void 0 && (T = [].concat(y.message));
|
|
586
586
|
var A = T.map(Bt(y, a));
|
|
587
|
-
if (
|
|
587
|
+
if (c.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(Bt(y, a)) :
|
|
593
|
+
return y.message !== void 0 ? A = [].concat(y.message).map(Bt(y, a)) : c.error && (A = [c.error(y, M(c.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(c.messages), w.rule.options && (w.rule.options.messages = c.messages, w.rule.options.error = c.error), B.validate(w.value, w.rule.options || c, 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, c);
|
|
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, c);
|
|
616
616
|
} catch (R) {
|
|
617
|
-
console.error == null || console.error(R),
|
|
617
|
+
console.error == null || console.error(R), c.suppressValidatorError || setTimeout(function() {
|
|
618
618
|
throw R;
|
|
619
619
|
}, 0), E(R.message);
|
|
620
620
|
}
|
|
@@ -724,10 +724,10 @@ function ti(n) {
|
|
|
724
724
|
if (n.startsWith('"')) {
|
|
725
725
|
let o = 0, a = !0;
|
|
726
726
|
for (; a; ) {
|
|
727
|
-
const
|
|
728
|
-
|
|
727
|
+
const c = n.slice(0, 1);
|
|
728
|
+
c === '"' && (o += 1), r += c, 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, (c) => new Array(Math.floor(c.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,11 +790,11 @@ class ii {
|
|
|
790
790
|
t.forEach((i, s) => {
|
|
791
791
|
let r = !1;
|
|
792
792
|
Array.isArray(i.children) && (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: c, SELECTABLE_METHOD: h, CHECKBOX_KEY: f } = this.ctx.config, d = i[o], x = d ?? te();
|
|
794
794
|
this.itemRowKeyMap.set(i, x);
|
|
795
|
-
const u = i._height ||
|
|
795
|
+
const u = i._height || c, g = i._readonly;
|
|
796
796
|
let w = !0;
|
|
797
|
-
if (typeof
|
|
797
|
+
if (typeof h == "function" && (w = h), f) {
|
|
798
798
|
const p = i[f];
|
|
799
799
|
if (this.checkboxKeyMap.has(p)) {
|
|
800
800
|
const y = this.checkboxKeyMap.get(p);
|
|
@@ -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: c, hasChildren: h, 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, c && h && i(o.children);
|
|
883
883
|
});
|
|
884
884
|
};
|
|
885
885
|
this.rowIndexRowKeyMap.clear();
|
|
@@ -1002,9 +1002,9 @@ class ii {
|
|
|
1002
1002
|
let i = [];
|
|
1003
1003
|
const s = /* @__PURE__ */ new Set();
|
|
1004
1004
|
t.forEach((a) => {
|
|
1005
|
-
const { value:
|
|
1006
|
-
s.add(
|
|
1007
|
-
rowKey:
|
|
1005
|
+
const { value: c, rowKey: h, key: f } = a, { oldValue: d, newValue: x } = this.setItemValue(h, f, c);
|
|
1006
|
+
s.add(h), i.push({
|
|
1007
|
+
rowKey: h,
|
|
1008
1008
|
key: f,
|
|
1009
1009
|
oldValue: d,
|
|
1010
1010
|
newValue: x
|
|
@@ -1012,12 +1012,12 @@ class ii {
|
|
|
1012
1012
|
});
|
|
1013
1013
|
let r = [];
|
|
1014
1014
|
const o = i.map((a) => {
|
|
1015
|
-
const
|
|
1015
|
+
const c = this.ctx.database.getRowDataItemForRowKey(a.rowKey);
|
|
1016
1016
|
return {
|
|
1017
1017
|
rowKey: a.rowKey,
|
|
1018
1018
|
key: a.key,
|
|
1019
1019
|
value: a.newValue,
|
|
1020
|
-
row:
|
|
1020
|
+
row: c
|
|
1021
1021
|
};
|
|
1022
1022
|
});
|
|
1023
1023
|
return s.forEach((a) => {
|
|
@@ -1043,15 +1043,15 @@ class ii {
|
|
|
1043
1043
|
if (!this.rowKeyMap.has(t))
|
|
1044
1044
|
return {};
|
|
1045
1045
|
const { item: a } = this.rowKeyMap.get(t);
|
|
1046
|
-
let
|
|
1046
|
+
let c = a[e];
|
|
1047
1047
|
if (this.ctx.database.getReadonly(t, e))
|
|
1048
1048
|
return {
|
|
1049
|
-
oldValue:
|
|
1050
|
-
newValue:
|
|
1049
|
+
oldValue: c,
|
|
1050
|
+
newValue: c
|
|
1051
1051
|
};
|
|
1052
|
-
a[e] !== null && typeof a[e] == "object" && (
|
|
1053
|
-
const
|
|
1054
|
-
if (this.originalDataMap.has(
|
|
1052
|
+
a[e] !== null && typeof a[e] == "object" && (c = JSON.parse(JSON.stringify(a[e])));
|
|
1053
|
+
const h = `${t}_${e}`;
|
|
1054
|
+
if (this.originalDataMap.has(h) || this.originalDataMap.set(h, c), this.changedDataMap.set(h, i), a[e] = i, o) {
|
|
1055
1055
|
const f = this.ctx.database.getRowDataItemForRowKey(t), d = {
|
|
1056
1056
|
rowKey: t,
|
|
1057
1057
|
key: e,
|
|
@@ -1061,18 +1061,18 @@ class ii {
|
|
|
1061
1061
|
this.ctx.emit("change", [d], [f]), this.ctx.emit("editChange", {
|
|
1062
1062
|
rowKey: t,
|
|
1063
1063
|
key: e,
|
|
1064
|
-
oldValue:
|
|
1064
|
+
oldValue: c,
|
|
1065
1065
|
value: i,
|
|
1066
|
-
originalValue: this.originalDataMap.get(
|
|
1066
|
+
originalValue: this.originalDataMap.get(h),
|
|
1067
1067
|
row: f
|
|
1068
1068
|
});
|
|
1069
1069
|
}
|
|
1070
1070
|
return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
|
|
1071
1071
|
rowKey: t,
|
|
1072
1072
|
key: e,
|
|
1073
|
-
oldValue:
|
|
1073
|
+
oldValue: c,
|
|
1074
1074
|
value: i,
|
|
1075
|
-
originalValue: this.originalDataMap.get(
|
|
1075
|
+
originalValue: this.originalDataMap.get(h),
|
|
1076
1076
|
row: this.ctx.database.getRowDataItemForRowKey(t)
|
|
1077
1077
|
}), s && this.ctx.history.pushState({
|
|
1078
1078
|
type: "single",
|
|
@@ -1082,12 +1082,12 @@ class ii {
|
|
|
1082
1082
|
{
|
|
1083
1083
|
rowKey: t,
|
|
1084
1084
|
key: e,
|
|
1085
|
-
oldValue:
|
|
1085
|
+
oldValue: c,
|
|
1086
1086
|
newValue: i
|
|
1087
1087
|
}
|
|
1088
1088
|
]
|
|
1089
1089
|
}), r && this.ctx.emit("draw"), {
|
|
1090
|
-
oldValue:
|
|
1090
|
+
oldValue: c,
|
|
1091
1091
|
newValue: i
|
|
1092
1092
|
};
|
|
1093
1093
|
}
|
|
@@ -1114,8 +1114,8 @@ class ii {
|
|
|
1114
1114
|
return !1;
|
|
1115
1115
|
const { item: s } = this.rowKeyMap.get(t), r = s[i];
|
|
1116
1116
|
this.checkboxKeyMap.has(r) && this.checkboxKeyMap.get(r).forEach((a) => {
|
|
1117
|
-
const
|
|
1118
|
-
|
|
1117
|
+
const c = this.rowKeyMap.get(a);
|
|
1118
|
+
c.check = e;
|
|
1119
1119
|
});
|
|
1120
1120
|
}
|
|
1121
1121
|
}
|
|
@@ -1277,15 +1277,15 @@ class ii {
|
|
|
1277
1277
|
getReadonly(t, e) {
|
|
1278
1278
|
const i = this.rowKeyMap.get(t), s = this.headerMap.get(e), r = i == null ? void 0 : i.readonly, o = s == null ? void 0 : s.readonly, { CELL_READONLY_METHOD: a } = this.ctx.config;
|
|
1279
1279
|
if (typeof a == "function") {
|
|
1280
|
-
const
|
|
1280
|
+
const h = a({
|
|
1281
1281
|
row: i.item,
|
|
1282
1282
|
rowIndex: i.rowIndex,
|
|
1283
1283
|
colIndex: s.colIndex,
|
|
1284
1284
|
column: s.column,
|
|
1285
1285
|
value: this.getItemValue(t, e)
|
|
1286
1286
|
});
|
|
1287
|
-
if (
|
|
1288
|
-
return
|
|
1287
|
+
if (h !== void 0)
|
|
1288
|
+
return h;
|
|
1289
1289
|
}
|
|
1290
1290
|
return o || r;
|
|
1291
1291
|
}
|
|
@@ -1295,7 +1295,7 @@ class ii {
|
|
|
1295
1295
|
getValidator(t, e) {
|
|
1296
1296
|
return new Promise((i) => {
|
|
1297
1297
|
const s = this.rowKeyMap.get(t), r = this.headerMap.get(e), { CELL_RULES_METHOD: o } = this.ctx.config, a = r.column;
|
|
1298
|
-
let
|
|
1298
|
+
let c = a.rules;
|
|
1299
1299
|
if (typeof o == "function") {
|
|
1300
1300
|
const f = o({
|
|
1301
1301
|
row: s.item,
|
|
@@ -1304,28 +1304,28 @@ class ii {
|
|
|
1304
1304
|
column: a,
|
|
1305
1305
|
value: this.getItemValue(t, e)
|
|
1306
1306
|
});
|
|
1307
|
-
f && (
|
|
1307
|
+
f && (c = f);
|
|
1308
1308
|
}
|
|
1309
|
-
if (
|
|
1310
|
-
let
|
|
1311
|
-
if (f[e] = this.getItemValue(t, e), Array.isArray(
|
|
1312
|
-
const x =
|
|
1309
|
+
if (c) {
|
|
1310
|
+
let h = {}, f = {};
|
|
1311
|
+
if (f[e] = this.getItemValue(t, e), Array.isArray(c) && c.length) {
|
|
1312
|
+
const x = c.map((u) => ({
|
|
1313
1313
|
...u,
|
|
1314
1314
|
row: s.item,
|
|
1315
1315
|
column: a,
|
|
1316
1316
|
rowIndex: s.rowIndex,
|
|
1317
1317
|
colIndex: r.colIndex
|
|
1318
1318
|
}));
|
|
1319
|
-
|
|
1319
|
+
h[e] = x;
|
|
1320
1320
|
} else
|
|
1321
|
-
|
|
1322
|
-
...
|
|
1321
|
+
h[e] = {
|
|
1322
|
+
...c,
|
|
1323
1323
|
row: s.item,
|
|
1324
1324
|
column: a,
|
|
1325
1325
|
rowIndex: s.rowIndex,
|
|
1326
1326
|
colIndex: r.colIndex
|
|
1327
1327
|
};
|
|
1328
|
-
new nt(
|
|
1328
|
+
new nt(h).validate(f).then(() => {
|
|
1329
1329
|
this.setValidationError(t, e, []), i([]);
|
|
1330
1330
|
}).catch(({ errors: x }) => {
|
|
1331
1331
|
const u = x.map((g) => ({
|
|
@@ -1374,9 +1374,9 @@ class ii {
|
|
|
1374
1374
|
}
|
|
1375
1375
|
class si {
|
|
1376
1376
|
constructor(t) {
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1377
|
+
l(this, "ctx");
|
|
1378
|
+
l(this, "history", []);
|
|
1379
|
+
l(this, "historyIndex", -1);
|
|
1380
1380
|
this.ctx = t, this.init();
|
|
1381
1381
|
}
|
|
1382
1382
|
init() {
|
|
@@ -1431,8 +1431,8 @@ class si {
|
|
|
1431
1431
|
}
|
|
1432
1432
|
class ri {
|
|
1433
1433
|
constructor(t) {
|
|
1434
|
-
|
|
1435
|
-
|
|
1434
|
+
l(this, "eventTasks", /* @__PURE__ */ new Map());
|
|
1435
|
+
l(this, "ctx");
|
|
1436
1436
|
this.ctx = t, this.init();
|
|
1437
1437
|
}
|
|
1438
1438
|
init() {
|
|
@@ -1486,7 +1486,7 @@ class ri {
|
|
|
1486
1486
|
}
|
|
1487
1487
|
class oi {
|
|
1488
1488
|
constructor() {
|
|
1489
|
-
|
|
1489
|
+
l(this, "events", /* @__PURE__ */ new Map());
|
|
1490
1490
|
}
|
|
1491
1491
|
has(t) {
|
|
1492
1492
|
return this.events.has(t);
|
|
@@ -1524,7 +1524,7 @@ class oi {
|
|
|
1524
1524
|
}
|
|
1525
1525
|
class ni {
|
|
1526
1526
|
constructor(t) {
|
|
1527
|
-
|
|
1527
|
+
l(this, "ctx");
|
|
1528
1528
|
const e = t.getContext("2d");
|
|
1529
1529
|
if (!e) throw new Error("canvas context not found");
|
|
1530
1530
|
this.ctx = e;
|
|
@@ -1558,21 +1558,21 @@ class ni {
|
|
|
1558
1558
|
* @param {string} color - 阴影的颜色
|
|
1559
1559
|
*/
|
|
1560
1560
|
drawShadow(t, e, i, s, r) {
|
|
1561
|
-
const { fillColor: o, side: a, shadowWidth:
|
|
1561
|
+
const { fillColor: o, side: a, shadowWidth: c, colorStart: h, colorEnd: f } = r;
|
|
1562
1562
|
this.ctx.save(), o && (this.ctx.fillStyle = o, this.ctx.fillRect(t, e, i, s));
|
|
1563
1563
|
let d;
|
|
1564
1564
|
switch (a) {
|
|
1565
1565
|
case "left":
|
|
1566
|
-
d = this.ctx.createLinearGradient(t -
|
|
1566
|
+
d = this.ctx.createLinearGradient(t - c, e, t, e), d.addColorStop(0, h), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t - c, e, c, s);
|
|
1567
1567
|
break;
|
|
1568
1568
|
case "right":
|
|
1569
|
-
d = this.ctx.createLinearGradient(t + i, e, t + i +
|
|
1569
|
+
d = this.ctx.createLinearGradient(t + i, e, t + i + c, e), d.addColorStop(0, h), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t + i, e, c, s);
|
|
1570
1570
|
break;
|
|
1571
1571
|
case "top":
|
|
1572
|
-
d = this.ctx.createLinearGradient(t, e -
|
|
1572
|
+
d = this.ctx.createLinearGradient(t, e - c, t, e), d.addColorStop(0, h), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t, e - c, i, c);
|
|
1573
1573
|
break;
|
|
1574
1574
|
case "bottom":
|
|
1575
|
-
d = this.ctx.createLinearGradient(t, e + s, t, e + s +
|
|
1575
|
+
d = this.ctx.createLinearGradient(t, e + s, t, e + s + c), d.addColorStop(0, h), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t, e + s, i, c);
|
|
1576
1576
|
break;
|
|
1577
1577
|
default:
|
|
1578
1578
|
console.error("Invalid side specified for shadow");
|
|
@@ -1593,12 +1593,12 @@ class ni {
|
|
|
1593
1593
|
drawImage(t, e, i, s, r) {
|
|
1594
1594
|
this.ctx.save(), this.ctx.drawImage(t, e, i, s, r), this.ctx.restore();
|
|
1595
1595
|
}
|
|
1596
|
-
drawRect(t, e, i, s, { borderWidth: r = 1, borderColor: o, fillColor: a, radius:
|
|
1597
|
-
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),
|
|
1596
|
+
drawRect(t, e, i, s, { borderWidth: r = 1, borderColor: o, fillColor: a, radius: c = 0 } = {}) {
|
|
1597
|
+
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), c === 0)
|
|
1598
1598
|
this.ctx.rect(t - 0.5, e - 0.5, i, s);
|
|
1599
1599
|
else {
|
|
1600
|
-
const [
|
|
1601
|
-
this.ctx.moveTo(t +
|
|
1600
|
+
const [h, f, d, x] = typeof c == "number" ? [c, c, c, c] : c;
|
|
1601
|
+
this.ctx.moveTo(t + h, 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 + h, e, h);
|
|
1602
1602
|
}
|
|
1603
1603
|
a !== void 0 && this.ctx.fill(), o !== void 0 && this.ctx.stroke(), this.ctx.restore();
|
|
1604
1604
|
}
|
|
@@ -1616,16 +1616,16 @@ class ni {
|
|
|
1616
1616
|
this.ctx.save();
|
|
1617
1617
|
const {
|
|
1618
1618
|
font: a = "12px Arial",
|
|
1619
|
-
align:
|
|
1620
|
-
color:
|
|
1619
|
+
align: c = "center",
|
|
1620
|
+
color: h = "#495060",
|
|
1621
1621
|
padding: f = 0,
|
|
1622
1622
|
verticalAlign: d = "middle"
|
|
1623
1623
|
} = o;
|
|
1624
|
-
this.ctx.font = a, this.ctx.fillStyle =
|
|
1624
|
+
this.ctx.font = a, this.ctx.fillStyle = h, this.ctx.textBaseline = d, this.ctx.textAlign = c;
|
|
1625
1625
|
let x = 0;
|
|
1626
1626
|
d === "top" ? x = i + f : d === "bottom" ? x = i + r - f : x = i + (r + 1) / 2;
|
|
1627
1627
|
let u = 0;
|
|
1628
|
-
|
|
1628
|
+
c === "left" ? u = e + f : c === "right" ? u = e + s - f : u = e + s / 2;
|
|
1629
1629
|
const { _text: g, ellipsis: w } = this.handleEllipsis(t, s, f, a);
|
|
1630
1630
|
return this.ctx.fillText(g, u, x), this.ctx.restore(), w;
|
|
1631
1631
|
}
|
|
@@ -1636,12 +1636,12 @@ class ni {
|
|
|
1636
1636
|
_text: "",
|
|
1637
1637
|
ellipsis: r
|
|
1638
1638
|
};
|
|
1639
|
-
const a = this.ctx.measureText("...").width,
|
|
1640
|
-
if (
|
|
1639
|
+
const a = this.ctx.measureText("...").width, c = this.ctx.measureText(t).width;
|
|
1640
|
+
if (c && c + a >= e - i * 2) {
|
|
1641
1641
|
r = !0;
|
|
1642
|
-
let
|
|
1642
|
+
let h = 0;
|
|
1643
1643
|
for (let f = 0; f < t.length; f++)
|
|
1644
|
-
if (
|
|
1644
|
+
if (h += this.ctx.measureText(t[f]).width, h >= e - i * 2 - a) {
|
|
1645
1645
|
o = t.slice(0, f) + "...";
|
|
1646
1646
|
break;
|
|
1647
1647
|
}
|
|
@@ -1654,129 +1654,129 @@ class ni {
|
|
|
1654
1654
|
}
|
|
1655
1655
|
class $t {
|
|
1656
1656
|
constructor(t) {
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1657
|
+
l(this, "PROCESSOR_NUM", 50);
|
|
1658
|
+
l(this, "CSS_PREFIX", "e-virt-table");
|
|
1659
|
+
l(this, "ICONS", []);
|
|
1660
|
+
l(this, "ROW_KEY", "");
|
|
1661
|
+
l(this, "HEADER_FONT", "12px normal Arial");
|
|
1662
|
+
l(this, "BODY_FONT", "12px normal Arial");
|
|
1663
|
+
l(this, "BORDER_COLOR", "#e1e6eb");
|
|
1664
|
+
l(this, "WIDTH", 0);
|
|
1665
|
+
l(this, "RESIZE_MIN_WIDTH", 40);
|
|
1666
|
+
l(this, "HEIGHT", 0);
|
|
1667
|
+
l(this, "EMPTY_BODY_HEIGHT", 120);
|
|
1668
|
+
l(this, "EMPTY_CUSTOM", !1);
|
|
1669
|
+
l(this, "EMPTY_CUSTOM_STYLE", {});
|
|
1670
|
+
l(this, "EMPTY_TEXT", "暂无数据");
|
|
1671
|
+
l(this, "MAX_HEIGHT", 1e3);
|
|
1672
|
+
l(this, "BORDER_RADIUS", 8);
|
|
1673
|
+
l(this, "ENABLE_OFFSET_HEIGHT", !1);
|
|
1674
|
+
l(this, "OFFSET_HEIGHT", 0);
|
|
1675
|
+
l(this, "HEADER_HEIGHT", 36);
|
|
1676
|
+
l(this, "ENABLE_HEADER_STICKY", !1);
|
|
1677
1677
|
// 启用头部固定,需要外面实现覆盖层,或者所有表头都要是元素
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1678
|
+
l(this, "HEADER_BG_COLOR", "#F8FAFF");
|
|
1679
|
+
l(this, "BODY_BG_COLOR", "#FFF");
|
|
1680
|
+
l(this, "HEADER_TEXT_COLOR", "#1D2129");
|
|
1681
|
+
l(this, "LOADING_ICON_SVG", "");
|
|
1682
|
+
l(this, "LOADING_ICON_COLOR", "#4E5969");
|
|
1683
|
+
l(this, "EXPAND_ICON_SVG", "");
|
|
1684
|
+
l(this, "SHRINK_ICON_SVG", "");
|
|
1685
|
+
l(this, "EXPAND_ICON_COLOR", "#4E5969");
|
|
1686
|
+
l(this, "SHRINK_ICON_COLOR", "#4E5969");
|
|
1687
|
+
l(this, "ERROR_TIP_ICON_COLOR", "red");
|
|
1688
|
+
l(this, "ERROR_TIP_ICON_SIZE", 6);
|
|
1689
|
+
l(this, "EXPAND_LAZY", !0);
|
|
1690
|
+
l(this, "DEFAULT_EXPAND_ALL", !1);
|
|
1691
|
+
l(this, "CELL_WIDTH", 100);
|
|
1692
|
+
l(this, "CELL_HEIGHT", 36);
|
|
1693
|
+
l(this, "CELL_PADDING", 8);
|
|
1694
|
+
l(this, "CELL_HOVER_ICON_SIZE", 20);
|
|
1695
|
+
l(this, "SCROLLER_TRACK_SIZE", 14);
|
|
1696
|
+
l(this, "SCROLLER_SIZE", 8);
|
|
1697
|
+
l(this, "SCROLLER_COLOR", "#dee0e3");
|
|
1698
|
+
l(this, "SCROLLER_TRACK_COLOR", "#fff");
|
|
1699
|
+
l(this, "SCROLLER_FOCUS_COLOR", "#bbbec4");
|
|
1700
|
+
l(this, "SELECT_BORDER_COLOR", "rgb(82,146,247)");
|
|
1701
|
+
l(this, "SELECT_AREA_COLOR", "rgba(82,146,247,0.1)");
|
|
1702
|
+
l(this, "SELECT_BG_COLOR", "rgba(82,146,247,0.1)");
|
|
1703
|
+
l(this, "EDIT_BG_COLOR", "#fcf6ed");
|
|
1704
|
+
l(this, "CHECKBOX_KEY", "");
|
|
1705
|
+
l(this, "CHECKBOX_COLOR", "rgb(82,146,247)");
|
|
1706
|
+
l(this, "CHECKBOX_SIZE", 20);
|
|
1707
|
+
l(this, "CHECKBOX_DISABLED_SVG", "");
|
|
1708
|
+
l(this, "CHECKBOX_CHECK_SVG", "");
|
|
1709
|
+
l(this, "CHECKBOX_UNCHECK_SVG", "");
|
|
1710
|
+
l(this, "CHECKBOX_INDETERMINATE_SVG", "");
|
|
1711
|
+
l(this, "READONLY_COLOR", "#fff");
|
|
1712
|
+
l(this, "READONLY_TEXT_COLOR", "#4E5969");
|
|
1713
|
+
l(this, "ERROR_TIP_COLOR", "#ED3F14");
|
|
1714
|
+
l(this, "FOOTER_BG_COLOR", "#fafafa");
|
|
1715
|
+
l(this, "FOOTER_FIXED", !0);
|
|
1716
|
+
l(this, "CELL_FOOTER_HEIGHT", 36);
|
|
1717
|
+
l(this, "ENABLE_SELECTOR", !1);
|
|
1718
|
+
l(this, "ENABLE_EDIT_SINGLE_CLICK", !1);
|
|
1719
1719
|
// 启用单点击立马编辑
|
|
1720
|
-
|
|
1720
|
+
l(this, "ENABLE_EDIT_CLICK_SELECTOR", !0);
|
|
1721
1721
|
// 启用点击选择器编辑
|
|
1722
|
-
|
|
1722
|
+
l(this, "SELECTOR_AREA_MIN_X", 0);
|
|
1723
1723
|
// 选择器X最小范围
|
|
1724
|
-
|
|
1724
|
+
l(this, "SELECTOR_AREA_MAX_X_OFFSET", 0);
|
|
1725
1725
|
// 选择器X最大范围colMax - offset
|
|
1726
|
-
|
|
1726
|
+
l(this, "SELECTOR_AREA_MAX_X", 0);
|
|
1727
1727
|
// 选择器X最大范围,0默认最大colMax
|
|
1728
|
-
|
|
1728
|
+
l(this, "SELECTOR_AREA_MIN_Y", 0);
|
|
1729
1729
|
// 选择器Y最小范围
|
|
1730
|
-
|
|
1730
|
+
l(this, "SELECTOR_AREA_MAX_Y", 0);
|
|
1731
1731
|
// 选择器Y最大范围,0默认rowMax
|
|
1732
|
-
|
|
1732
|
+
l(this, "SELECTOR_AREA_MAX_Y_OFFSET", 0);
|
|
1733
1733
|
// 选择器Y最大范围,0默认rowMax
|
|
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
|
-
|
|
1734
|
+
l(this, "ENABLE_SELECTOR_SINGLE", !1);
|
|
1735
|
+
l(this, "ENABLE_SELECTOR_SPAN_COL", !0);
|
|
1736
|
+
l(this, "ENABLE_SELECTOR_SPAN_ROW", !0);
|
|
1737
|
+
l(this, "ENABLE_SELECTOR_ALL_ROWS", !0);
|
|
1738
|
+
l(this, "ENABLE_SELECTOR_ALL_COLS", !0);
|
|
1739
|
+
l(this, "ENABLE_AUTOFILL", !1);
|
|
1740
|
+
l(this, "ENABLE_CONTEXT_MENU", !1);
|
|
1741
|
+
l(this, "ENABLE_COPY", !0);
|
|
1742
|
+
l(this, "ENABLE_PASTER", !0);
|
|
1743
|
+
l(this, "ENABLE_RESIZE_ROW", !0);
|
|
1744
|
+
l(this, "ENABLE_RESIZE_COLUMN", !0);
|
|
1745
|
+
l(this, "RESIZE_ROW_LINE_COLOR", "#e1e6eb");
|
|
1746
|
+
l(this, "RESIZE_COLUMN_LINE_COLOR", "#e1e6eb");
|
|
1747
|
+
l(this, "RESIZE_ROW_MIN_HEIGHT", 36);
|
|
1748
|
+
l(this, "RESIZE_COLUMN_MIN_WIDTH", 40);
|
|
1749
|
+
l(this, "ENABLE_KEYBOARD", !0);
|
|
1750
|
+
l(this, "ENABLE_HISTORY", !1);
|
|
1751
|
+
l(this, "ENABLE_VALIDATOR_IMMEDIATE", !0);
|
|
1752
|
+
l(this, "HISTORY_NUM", 50);
|
|
1753
|
+
l(this, "HIGHLIGHT_HOVER_ROW", !1);
|
|
1754
|
+
l(this, "HIGHLIGHT_HOVER_ROW_COLOR", "rgba(186,203,231,0.1)");
|
|
1755
|
+
l(this, "HIGHLIGHT_SELECTED_ROW", !1);
|
|
1756
|
+
l(this, "HIGHLIGHT_SELECTED_ROW_COLOR", "rgba(82,146,247,0.1)");
|
|
1757
|
+
l(this, "TOOLTIP_BG_COLOR", "#303133");
|
|
1758
|
+
l(this, "TOOLTIP_TEXT_COLOR", "#fff");
|
|
1759
|
+
l(this, "TOOLTIP_ZINDEX", 3e3);
|
|
1760
|
+
l(this, "TOOLTIP_CUSTOM_STYLE", {});
|
|
1761
|
+
l(this, "CONTEXT_MENU", [
|
|
1762
1762
|
{ label: "复制", value: "copy" },
|
|
1763
1763
|
{ label: "剪切", value: "cut" },
|
|
1764
1764
|
{ label: "粘贴", value: "paste" },
|
|
1765
1765
|
{ label: "清空选中内容", value: "clearSelected" }
|
|
1766
1766
|
]);
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1767
|
+
l(this, "HEADER_CELL_STYLE_METHOD");
|
|
1768
|
+
l(this, "BODY_CELL_STYLE_METHOD");
|
|
1769
|
+
l(this, "FOOTER_CELL_STYLE_METHOD");
|
|
1770
|
+
l(this, "CELL_READONLY_METHOD");
|
|
1771
|
+
l(this, "CELL_FORMATTER_METHOD");
|
|
1772
|
+
l(this, "CELL_RULES_METHOD");
|
|
1773
|
+
l(this, "CELL_TYPE_METHOD");
|
|
1774
|
+
l(this, "CELL_EDITOR_TYPE_METHOD");
|
|
1775
|
+
l(this, "CELL_RENDER_METHOD");
|
|
1776
|
+
l(this, "CELL_HOVER_ICON_METHOD");
|
|
1777
|
+
l(this, "SPAN_METHOD");
|
|
1778
|
+
l(this, "SELECTABLE_METHOD");
|
|
1779
|
+
l(this, "EXPAND_LAZY_METHOD");
|
|
1780
1780
|
Object.assign(this, t);
|
|
1781
1781
|
}
|
|
1782
1782
|
init(t) {
|
|
@@ -1785,8 +1785,8 @@ class $t {
|
|
|
1785
1785
|
}
|
|
1786
1786
|
class ai {
|
|
1787
1787
|
constructor(t) {
|
|
1788
|
-
|
|
1789
|
-
|
|
1788
|
+
l(this, "ctx");
|
|
1789
|
+
l(this, "list", [
|
|
1790
1790
|
{
|
|
1791
1791
|
name: "loading",
|
|
1792
1792
|
configName: "LOADING_ICON_SVG",
|
|
@@ -1848,7 +1848,7 @@ class ai {
|
|
|
1848
1848
|
color: ""
|
|
1849
1849
|
}
|
|
1850
1850
|
]);
|
|
1851
|
-
|
|
1851
|
+
l(this, "icons", /* @__PURE__ */ new Map());
|
|
1852
1852
|
this.ctx = t, this.init();
|
|
1853
1853
|
}
|
|
1854
1854
|
async init() {
|
|
@@ -1877,15 +1877,15 @@ class ai {
|
|
|
1877
1877
|
}
|
|
1878
1878
|
async createImageFromSVG(t, e) {
|
|
1879
1879
|
const r = new DOMParser().parseFromString(t, "image/svg+xml").documentElement;
|
|
1880
|
-
e && r.querySelectorAll("*").forEach((
|
|
1881
|
-
|
|
1880
|
+
e && r.querySelectorAll("*").forEach((h) => {
|
|
1881
|
+
h.setAttribute("fill", e);
|
|
1882
1882
|
});
|
|
1883
1883
|
const o = new Image(), a = new Blob([new XMLSerializer().serializeToString(r)], {
|
|
1884
1884
|
type: "image/svg+xml"
|
|
1885
|
-
}),
|
|
1886
|
-
return o.src =
|
|
1885
|
+
}), c = URL.createObjectURL(a);
|
|
1886
|
+
return o.src = c, new Promise((h, f) => {
|
|
1887
1887
|
o.onerror = () => f(new Error("Failed to load image")), o.onload = () => {
|
|
1888
|
-
|
|
1888
|
+
h(o);
|
|
1889
1889
|
};
|
|
1890
1890
|
});
|
|
1891
1891
|
}
|
|
@@ -1895,13 +1895,13 @@ class ai {
|
|
|
1895
1895
|
}
|
|
1896
1896
|
class re {
|
|
1897
1897
|
constructor(t, e, i, s, r, o, a) {
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1898
|
+
l(this, "ctx");
|
|
1899
|
+
l(this, "x", 0);
|
|
1900
|
+
l(this, "y", 0);
|
|
1901
|
+
l(this, "width", 0);
|
|
1902
|
+
l(this, "height", 0);
|
|
1903
|
+
l(this, "fixed");
|
|
1904
|
+
l(this, "cellType");
|
|
1905
1905
|
this.ctx = t, this.x = e, this.y = i, this.width = s, this.height = r, this.fixed = o, this.cellType = a;
|
|
1906
1906
|
}
|
|
1907
1907
|
isHorizontalVisible() {
|
|
@@ -1940,56 +1940,56 @@ class re {
|
|
|
1940
1940
|
}
|
|
1941
1941
|
}
|
|
1942
1942
|
class oe extends re {
|
|
1943
|
-
constructor(e, i, s, r, o, a,
|
|
1944
|
-
super(e, r, o, a,
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key =
|
|
1943
|
+
constructor(e, i, s, r, o, a, c, h, f, d = "body") {
|
|
1944
|
+
super(e, r, o, a, c, h.fixed, d);
|
|
1945
|
+
l(this, "formatter");
|
|
1946
|
+
l(this, "hoverIconName", "");
|
|
1947
|
+
l(this, "operation", !1);
|
|
1948
|
+
l(this, "align");
|
|
1949
|
+
l(this, "verticalAlign");
|
|
1950
|
+
l(this, "fixed");
|
|
1951
|
+
l(this, "type");
|
|
1952
|
+
l(this, "editorType");
|
|
1953
|
+
l(this, "cellType");
|
|
1954
|
+
l(this, "level");
|
|
1955
|
+
l(this, "colspan", 1);
|
|
1956
|
+
l(this, "rowspan", 1);
|
|
1957
|
+
l(this, "key");
|
|
1958
|
+
l(this, "column");
|
|
1959
|
+
l(this, "rowIndex");
|
|
1960
|
+
l(this, "colIndex");
|
|
1961
|
+
l(this, "rowKey");
|
|
1962
|
+
l(this, "row");
|
|
1963
|
+
l(this, "value");
|
|
1964
|
+
l(this, "render");
|
|
1965
|
+
l(this, "renderFooter");
|
|
1966
|
+
l(this, "style", {});
|
|
1967
|
+
l(this, "rules", {});
|
|
1968
|
+
l(this, "message", "");
|
|
1969
|
+
l(this, "text", "");
|
|
1970
|
+
l(this, "displayText", "");
|
|
1971
|
+
l(this, "visibleWidth", 0);
|
|
1972
|
+
l(this, "visibleHeight", 0);
|
|
1973
|
+
l(this, "drawX", 0);
|
|
1974
|
+
l(this, "drawY", 0);
|
|
1975
|
+
l(this, "drawCellBgColor", "");
|
|
1976
|
+
l(this, "drawCellSkyBgColor", "");
|
|
1977
|
+
l(this, "drawTextColor", "");
|
|
1978
|
+
l(this, "drawTextX", 0);
|
|
1979
|
+
l(this, "drawTextY", 0);
|
|
1980
|
+
l(this, "drawImageX", 0);
|
|
1981
|
+
l(this, "drawImageY", 0);
|
|
1982
|
+
l(this, "drawImageWidth", 0);
|
|
1983
|
+
l(this, "drawImageHeight", 0);
|
|
1984
|
+
l(this, "drawImageName", "");
|
|
1985
|
+
l(this, "drawImageSource");
|
|
1986
|
+
l(this, "ellipsis", !1);
|
|
1987
|
+
l(this, "rowExpand", !1);
|
|
1988
|
+
l(this, "rowHasChildren", !1);
|
|
1989
|
+
l(this, "overflowTooltipShow", !0);
|
|
1990
|
+
l(this, "overflowTooltipMaxWidth", 500);
|
|
1991
|
+
l(this, "overflowTooltipPlacement", "top");
|
|
1992
|
+
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = h.key, this.type = h.type || "text", this.editorType = h.editorType || "text", this.cellType = d, this.align = h.align || "center", this.verticalAlign = h.verticalAlign || "middle", this.fixed = h.fixed, this.level = h.level, this.operation = h.operation || !1, this.column = h, this.rules = h.rules, this.row = f, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = h.render, this.overflowTooltipShow = h.overflowTooltipShow !== !1, this.overflowTooltipMaxWidth = h.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = h.overflowTooltipPlacement || "top", this.renderFooter = h.renderFooter, this.hoverIconName = h.hoverIconName, this.formatter = h.formatter, this.update();
|
|
1993
1993
|
}
|
|
1994
1994
|
getValidationMessage() {
|
|
1995
1995
|
const e = this.ctx.database.getValidationError(this.rowKey, this.key);
|
|
@@ -2083,13 +2083,13 @@ class oe extends re {
|
|
|
2083
2083
|
const { CELL_PADDING: e = 0 } = this.ctx.config, { rowKey: i, cellType: s } = this;
|
|
2084
2084
|
let r, o = 0, a = "";
|
|
2085
2085
|
if (this.type === "tree" && s === "body") {
|
|
2086
|
-
const
|
|
2087
|
-
if (this.rowExpand =
|
|
2086
|
+
const c = this.ctx.database.getRowForRowKey(i), { expand: h = !1, hasChildren: f = !1, expandLoading: d = !1, level: x = 0 } = c || {};
|
|
2087
|
+
if (this.rowExpand = h, this.rowHasChildren = f, d) {
|
|
2088
2088
|
const u = this.ctx.icons.get("loading");
|
|
2089
2089
|
a = "loading", r = u, o = x * 8;
|
|
2090
2090
|
} else if (f) {
|
|
2091
2091
|
const u = this.ctx.icons.get("expand"), g = this.ctx.icons.get("shrink");
|
|
2092
|
-
r =
|
|
2092
|
+
r = h ? g : u, a = h ? "shrink" : "expand", o = x * 8;
|
|
2093
2093
|
} else
|
|
2094
2094
|
o = x * 8;
|
|
2095
2095
|
if (r) {
|
|
@@ -2106,8 +2106,8 @@ class oe extends re {
|
|
|
2106
2106
|
FOOTER_CELL_STYLE_METHOD: r,
|
|
2107
2107
|
READONLY_TEXT_COLOR: o,
|
|
2108
2108
|
FOOTER_BG_COLOR: a,
|
|
2109
|
-
HIGHLIGHT_SELECTED_ROW:
|
|
2110
|
-
HIGHLIGHT_SELECTED_ROW_COLOR:
|
|
2109
|
+
HIGHLIGHT_SELECTED_ROW: c,
|
|
2110
|
+
HIGHLIGHT_SELECTED_ROW_COLOR: h,
|
|
2111
2111
|
HIGHLIGHT_HOVER_ROW: f,
|
|
2112
2112
|
HIGHLIGHT_HOVER_ROW_COLOR: d
|
|
2113
2113
|
} = this.ctx.config;
|
|
@@ -2128,7 +2128,7 @@ class oe extends re {
|
|
|
2128
2128
|
}
|
|
2129
2129
|
let x = "transparent";
|
|
2130
2130
|
const u = this.ctx.focusCell, g = this.ctx.hoverCell;
|
|
2131
|
-
f && (g == null ? void 0 : g.rowKey) === this.rowKey && (x = d),
|
|
2131
|
+
f && (g == null ? void 0 : g.rowKey) === this.rowKey && (x = d), c && (u == null ? void 0 : u.rowKey) === this.rowKey && (x = h), this.drawCellSkyBgColor = x;
|
|
2132
2132
|
let w = e, p = o;
|
|
2133
2133
|
if (["index", "index-selection", "selection"].includes(this.type)) {
|
|
2134
2134
|
this.drawCellBgColor = e, this.drawTextColor = o;
|
|
@@ -2147,24 +2147,24 @@ class oe extends re {
|
|
|
2147
2147
|
this.drawCellBgColor = w, this.drawTextColor = p;
|
|
2148
2148
|
}
|
|
2149
2149
|
updateSelection() {
|
|
2150
|
-
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type: a, rowIndex:
|
|
2150
|
+
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type: a, rowIndex: c, rowKey: h } = this;
|
|
2151
2151
|
if (!(s === 0 || r === 0) && o !== "footer" && ["index-selection", "selection"].includes(a)) {
|
|
2152
|
-
const f = this.ctx.database.getRowSelection(
|
|
2152
|
+
const f = this.ctx.database.getRowSelection(h), d = this.ctx.database.getRowSelectable(h), { CHECKBOX_SIZE: x = 0 } = this.ctx.config, u = this.drawX + (e - x) / 2, g = this.drawY + (i - x) / 2;
|
|
2153
2153
|
let w = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck";
|
|
2154
|
-
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 ===
|
|
2154
|
+
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 === c || ["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);
|
|
2155
2155
|
}
|
|
2156
2156
|
}
|
|
2157
2157
|
updateHoverIcon() {
|
|
2158
2158
|
const { CELL_HOVER_ICON_METHOD: e, CELL_HOVER_ICON_SIZE: i, CELL_PADDING: s } = this.ctx.config;
|
|
2159
2159
|
if (typeof e == "function") {
|
|
2160
|
-
const
|
|
2160
|
+
const c = e({
|
|
2161
2161
|
row: this.row,
|
|
2162
2162
|
rowIndex: this.rowIndex,
|
|
2163
2163
|
colIndex: this.colIndex,
|
|
2164
2164
|
column: this.column,
|
|
2165
2165
|
value: this.getValue()
|
|
2166
2166
|
});
|
|
2167
|
-
|
|
2167
|
+
c !== void 0 && (this.hoverIconName = c);
|
|
2168
2168
|
}
|
|
2169
2169
|
const r = this.drawX + this.width - i - s, o = this.drawY + (this.height - i) / 2;
|
|
2170
2170
|
if (this.hoverIconName && this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === this.rowIndex) {
|
|
@@ -2280,8 +2280,8 @@ class oe extends re {
|
|
|
2280
2280
|
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s } = this.ctx.config;
|
|
2281
2281
|
if (!s || !i)
|
|
2282
2282
|
return;
|
|
2283
|
-
const { xArr: r, yArr: o } = this.ctx.selector, a = r[1],
|
|
2284
|
-
|
|
2283
|
+
const { xArr: r, yArr: o } = this.ctx.selector, a = r[1], c = o[1], { colIndex: h, rowIndex: f, drawX: d, drawY: x } = this;
|
|
2284
|
+
h === a && f === c && this.ctx.paint.drawRect(d + this.width - 6, x + this.height - 6, 6, 6, {
|
|
2285
2285
|
borderColor: "#fff",
|
|
2286
2286
|
fillColor: e
|
|
2287
2287
|
});
|
|
@@ -2336,31 +2336,31 @@ class oe extends re {
|
|
|
2336
2336
|
}
|
|
2337
2337
|
drawBorder(e) {
|
|
2338
2338
|
const { drawX: i, drawY: s, width: r, rowIndex: o, colIndex: a } = this;
|
|
2339
|
-
let
|
|
2340
|
-
o === 0 && (
|
|
2339
|
+
let c = i + 0.5, h = s + 0.5, f = this.height;
|
|
2340
|
+
o === 0 && (h = this.y + 1, f = f - 1), a === this.ctx.maxColIndex && (c = c - 1);
|
|
2341
2341
|
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];
|
|
2342
|
-
a >= y && a <= b && o === m && this.ctx.paint.drawLine([
|
|
2342
|
+
a >= y && a <= b && o === m && this.ctx.paint.drawLine([c, h, c + r - 2, h], {
|
|
2343
2343
|
borderColor: w,
|
|
2344
2344
|
fillColor: p,
|
|
2345
2345
|
borderWidth: g,
|
|
2346
2346
|
lineCap: "round",
|
|
2347
2347
|
lineJoin: "round",
|
|
2348
2348
|
lineDash: u
|
|
2349
|
-
}), a >= y && a <= b && o === E && this.ctx.paint.drawLine([
|
|
2349
|
+
}), a >= y && a <= b && o === E && this.ctx.paint.drawLine([c, h + f - 1.5, c + r, h + f - 1.5], {
|
|
2350
2350
|
borderColor: w,
|
|
2351
2351
|
fillColor: p,
|
|
2352
2352
|
borderWidth: g,
|
|
2353
2353
|
lineCap: "round",
|
|
2354
2354
|
lineJoin: "round",
|
|
2355
2355
|
lineDash: u
|
|
2356
|
-
}), a === y && o >= m && o <= E && this.ctx.paint.drawLine([h,
|
|
2356
|
+
}), a === y && o >= m && o <= E && this.ctx.paint.drawLine([c, h, c, h + f - 1], {
|
|
2357
2357
|
borderColor: w,
|
|
2358
2358
|
fillColor: p,
|
|
2359
2359
|
borderWidth: g,
|
|
2360
2360
|
lineCap: "round",
|
|
2361
2361
|
lineJoin: "round",
|
|
2362
2362
|
lineDash: u
|
|
2363
|
-
}), a === b && o >= m && o <= E && this.ctx.paint.drawLine([
|
|
2363
|
+
}), a === b && o >= m && o <= E && this.ctx.paint.drawLine([c + r - 1.5, h, c + r - 1.5, h + f - 1.5], {
|
|
2364
2364
|
borderColor: w,
|
|
2365
2365
|
fillColor: p,
|
|
2366
2366
|
borderWidth: g,
|
|
@@ -2371,42 +2371,42 @@ class oe extends re {
|
|
|
2371
2371
|
}
|
|
2372
2372
|
}
|
|
2373
2373
|
class ne extends re {
|
|
2374
|
-
constructor(e, i, s, r, o, a,
|
|
2375
|
-
super(e, s, r, o, a,
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
this.ctx = e, this.x = s, this.y = r, this.width = o, this.height = a, this.colIndex = i, this.key =
|
|
2374
|
+
constructor(e, i, s, r, o, a, c) {
|
|
2375
|
+
super(e, s, r, o, a, c.fixed, "header");
|
|
2376
|
+
l(this, "align");
|
|
2377
|
+
l(this, "verticalAlign", "middle");
|
|
2378
|
+
l(this, "fixed");
|
|
2379
|
+
l(this, "widthFillDisable");
|
|
2380
|
+
l(this, "type");
|
|
2381
|
+
l(this, "operation", !1);
|
|
2382
|
+
l(this, "editorType");
|
|
2383
|
+
l(this, "level");
|
|
2384
|
+
l(this, "text");
|
|
2385
|
+
l(this, "displayText", "");
|
|
2386
|
+
l(this, "colspan");
|
|
2387
|
+
l(this, "rowspan");
|
|
2388
|
+
l(this, "key");
|
|
2389
|
+
l(this, "required", !1);
|
|
2390
|
+
l(this, "readonly", !1);
|
|
2391
|
+
l(this, "children", []);
|
|
2392
|
+
l(this, "column");
|
|
2393
|
+
l(this, "colIndex");
|
|
2394
|
+
l(this, "rowKey");
|
|
2395
|
+
l(this, "rules");
|
|
2396
|
+
l(this, "hasChildren");
|
|
2397
|
+
l(this, "render");
|
|
2398
|
+
l(this, "style", {});
|
|
2399
|
+
l(this, "drawX", 0);
|
|
2400
|
+
l(this, "drawY", 0);
|
|
2401
|
+
l(this, "drawCellBgColor", "");
|
|
2402
|
+
l(this, "drawTextColor", "");
|
|
2403
|
+
l(this, "drawImageX", 0);
|
|
2404
|
+
l(this, "drawImageY", 0);
|
|
2405
|
+
l(this, "drawImageWidth", 0);
|
|
2406
|
+
l(this, "drawImageHeight", 0);
|
|
2407
|
+
l(this, "drawImageName", "");
|
|
2408
|
+
l(this, "drawImageSource");
|
|
2409
|
+
this.ctx = e, this.x = s, this.y = r, this.width = o, this.height = a, this.colIndex = i, this.key = c.key, this.type = c.type, this.editorType = c.editorType || "text", this.align = c.align || "center", this.verticalAlign = c.verticalAlign || "middle", this.fixed = c.fixed, this.level = c.level, this.operation = c.operation || !1, this.text = c.title, this.column = c, this.colspan = c.colspan, this.widthFillDisable = c.widthFillDisable, this.rowspan = c.rowspan, this.rules = c.rules, this.readonly = c.readonly, this.required = c.required, this.rowKey = te(), this.hasChildren = c.children && c.children.length > 0 || !1, this.render = c.renderHeader;
|
|
2410
2410
|
}
|
|
2411
2411
|
/**
|
|
2412
2412
|
* 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
|
|
@@ -2426,11 +2426,11 @@ class ne extends re {
|
|
|
2426
2426
|
const { HEADER_CELL_STYLE_METHOD: e, HEADER_BG_COLOR: i, HEADER_TEXT_COLOR: s } = this.ctx.config;
|
|
2427
2427
|
let r = i, o = s;
|
|
2428
2428
|
if (typeof e == "function") {
|
|
2429
|
-
const a = e, { backgroundColor:
|
|
2429
|
+
const a = e, { backgroundColor: c, color: h } = a({
|
|
2430
2430
|
colIndex: this.colIndex,
|
|
2431
2431
|
column: this.column
|
|
2432
2432
|
}) || {};
|
|
2433
|
-
|
|
2433
|
+
c && (r = c), h && (o = h);
|
|
2434
2434
|
}
|
|
2435
2435
|
this.drawCellBgColor = r, this.drawTextColor = o;
|
|
2436
2436
|
}
|
|
@@ -2441,11 +2441,11 @@ class ne extends re {
|
|
|
2441
2441
|
const {
|
|
2442
2442
|
paint: e,
|
|
2443
2443
|
config: { BORDER_COLOR: i, CELL_PADDING: s, HEADER_FONT: r }
|
|
2444
|
-
} = this.ctx, { drawX: o, drawY: a, displayText:
|
|
2444
|
+
} = this.ctx, { drawX: o, drawY: a, displayText: c } = this;
|
|
2445
2445
|
e.drawRect(o, a, this.width, this.height, {
|
|
2446
2446
|
borderColor: i,
|
|
2447
2447
|
fillColor: this.drawCellBgColor
|
|
2448
|
-
}), e.drawText(
|
|
2448
|
+
}), e.drawText(c, o, a, this.width, this.height, {
|
|
2449
2449
|
font: r,
|
|
2450
2450
|
padding: s,
|
|
2451
2451
|
color: this.drawTextColor,
|
|
@@ -2456,9 +2456,9 @@ class ne extends re {
|
|
|
2456
2456
|
drawSelection() {
|
|
2457
2457
|
const { width: e, height: i, type: s } = this;
|
|
2458
2458
|
if (["index-selection", "selection"].includes(s)) {
|
|
2459
|
-
const { indeterminate: r, check: o, selectable: a } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE:
|
|
2459
|
+
const { indeterminate: r, check: o, selectable: a } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: c = 0 } = this.ctx.config, h = this.drawX + (e - c) / 2, f = this.drawY + (i - c) / 2;
|
|
2460
2460
|
let d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck";
|
|
2461
|
-
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 =
|
|
2461
|
+
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 = h, this.drawImageY = f, this.drawImageWidth = c, this.drawImageHeight = c, this.drawImageName = x, this.drawImageSource = d, this.ctx.paint.drawImage(
|
|
2462
2462
|
this.drawImageSource,
|
|
2463
2463
|
this.drawImageX,
|
|
2464
2464
|
this.drawImageY,
|
|
@@ -2485,11 +2485,11 @@ class ne extends re {
|
|
|
2485
2485
|
};
|
|
2486
2486
|
}
|
|
2487
2487
|
}
|
|
2488
|
-
class
|
|
2488
|
+
class li {
|
|
2489
2489
|
constructor(t) {
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2490
|
+
l(this, "ctx");
|
|
2491
|
+
l(this, "visibleHoverCell");
|
|
2492
|
+
l(this, "resizeObserver");
|
|
2493
2493
|
this.ctx = t, this.init();
|
|
2494
2494
|
}
|
|
2495
2495
|
init() {
|
|
@@ -2579,10 +2579,10 @@ class ci {
|
|
|
2579
2579
|
colIndex: t.colIndex,
|
|
2580
2580
|
column: t.column,
|
|
2581
2581
|
value: t.getValue()
|
|
2582
|
-
}).then((
|
|
2583
|
-
this.ctx.database.setExpandChildren(t.rowKey,
|
|
2584
|
-
}).catch((
|
|
2585
|
-
this.ctx.database.expandLoading(t.rowKey, !1), console.error(
|
|
2582
|
+
}).then((c) => {
|
|
2583
|
+
this.ctx.database.setExpandChildren(t.rowKey, c), this.ctx.database.expandLoading(t.rowKey, !1);
|
|
2584
|
+
}).catch((c) => {
|
|
2585
|
+
this.ctx.database.expandLoading(t.rowKey, !1), console.error(c);
|
|
2586
2586
|
}));
|
|
2587
2587
|
else {
|
|
2588
2588
|
const a = this.ctx.database.getIsExpand(t.rowKey);
|
|
@@ -2609,15 +2609,15 @@ class ci {
|
|
|
2609
2609
|
handleBodyEvent(t, e, i, s, r = !1) {
|
|
2610
2610
|
for (const o of i) {
|
|
2611
2611
|
const a = o.fixedCells.concat(o.noFixedCells);
|
|
2612
|
-
for (const
|
|
2613
|
-
const
|
|
2612
|
+
for (const c of a) {
|
|
2613
|
+
const h = c.getDrawX(), f = c.getDrawY();
|
|
2614
2614
|
if (r) {
|
|
2615
|
-
if (t >
|
|
2616
|
-
s(
|
|
2615
|
+
if (t > h && t < h + c.visibleWidth && e > f && e < f + c.visibleHeight) {
|
|
2616
|
+
s(c);
|
|
2617
2617
|
return;
|
|
2618
2618
|
}
|
|
2619
|
-
} else if (t >
|
|
2620
|
-
s(
|
|
2619
|
+
} else if (t > h && t < h + c.width && e > f && e < f + c.height) {
|
|
2620
|
+
s(c);
|
|
2621
2621
|
return;
|
|
2622
2622
|
}
|
|
2623
2623
|
}
|
|
@@ -2636,50 +2636,51 @@ class ci {
|
|
|
2636
2636
|
this.resizeObserver.unobserve(this.ctx.stageElement);
|
|
2637
2637
|
}
|
|
2638
2638
|
}
|
|
2639
|
-
class
|
|
2639
|
+
class ci {
|
|
2640
2640
|
constructor(t, e) {
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2641
|
+
l(this, "eventBus");
|
|
2642
|
+
l(this, "eventBrowser");
|
|
2643
|
+
l(this, "eventTable");
|
|
2644
|
+
l(this, "containerElement");
|
|
2645
|
+
l(this, "stageElement");
|
|
2646
|
+
l(this, "canvasElement");
|
|
2647
|
+
l(this, "overlayerElement");
|
|
2648
|
+
l(this, "editorElement");
|
|
2649
|
+
l(this, "stageWidth", 0);
|
|
2650
|
+
l(this, "stageHeight", 0);
|
|
2651
|
+
l(this, "paint");
|
|
2652
|
+
l(this, "icons");
|
|
2653
|
+
l(this, "isInsideTargetContainer", !1);
|
|
2654
|
+
l(this, "mousedown", !1);
|
|
2655
|
+
l(this, "isPointer", !1);
|
|
2656
|
+
l(this, "rowResizing", !1);
|
|
2656
2657
|
// 行调整大小中
|
|
2657
|
-
|
|
2658
|
+
l(this, "columnResizing", !1);
|
|
2658
2659
|
// 列调整大小中
|
|
2659
|
-
|
|
2660
|
+
l(this, "scrollerMove", !1);
|
|
2660
2661
|
// 滚动条移动中
|
|
2661
|
-
|
|
2662
|
+
l(this, "scrollerFocus", !1);
|
|
2662
2663
|
// 滚动条focus中
|
|
2663
|
-
|
|
2664
|
+
l(this, "autofillMove", !1);
|
|
2664
2665
|
// 自动填充移动中
|
|
2665
|
-
|
|
2666
|
+
l(this, "selectorMove", !1);
|
|
2666
2667
|
// 选择器移动中
|
|
2667
|
-
|
|
2668
|
+
l(this, "editing", !1);
|
|
2668
2669
|
// 编辑中
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2670
|
+
l(this, "scrollY", 0);
|
|
2671
|
+
l(this, "scrollX", 0);
|
|
2672
|
+
l(this, "fixedLeftWidth", 0);
|
|
2673
|
+
l(this, "fixedRightWidth", 0);
|
|
2674
|
+
l(this, "maxColIndex", 0);
|
|
2675
|
+
l(this, "maxRowIndex", 0);
|
|
2676
|
+
l(this, "hoverRow");
|
|
2677
|
+
l(this, "clickCell");
|
|
2678
|
+
l(this, "focusCell");
|
|
2679
|
+
l(this, "hoverCell");
|
|
2680
|
+
l(this, "clickCellHeader");
|
|
2681
|
+
l(this, "focusCellHeader");
|
|
2682
|
+
l(this, "hoverCellHeader");
|
|
2683
|
+
l(this, "body", {
|
|
2683
2684
|
x: 0,
|
|
2684
2685
|
y: 0,
|
|
2685
2686
|
width: 0,
|
|
@@ -2692,7 +2693,7 @@ class hi {
|
|
|
2692
2693
|
renderRows: [],
|
|
2693
2694
|
data: []
|
|
2694
2695
|
});
|
|
2695
|
-
|
|
2696
|
+
l(this, "footer", {
|
|
2696
2697
|
x: 0,
|
|
2697
2698
|
y: 0,
|
|
2698
2699
|
width: 0,
|
|
@@ -2701,7 +2702,7 @@ class hi {
|
|
|
2701
2702
|
visibleWidth: 0,
|
|
2702
2703
|
renderRows: []
|
|
2703
2704
|
});
|
|
2704
|
-
|
|
2705
|
+
l(this, "header", {
|
|
2705
2706
|
x: 0,
|
|
2706
2707
|
y: 0,
|
|
2707
2708
|
width: 0,
|
|
@@ -2716,23 +2717,23 @@ class hi {
|
|
|
2716
2717
|
fixedRightCellHeaders: [],
|
|
2717
2718
|
renderCenterCellHeaders: []
|
|
2718
2719
|
});
|
|
2719
|
-
|
|
2720
|
+
l(this, "selector", {
|
|
2720
2721
|
enable: !1,
|
|
2721
2722
|
xArr: [-1, -1],
|
|
2722
2723
|
yArr: [-1, -1],
|
|
2723
2724
|
xArrCopy: [-1, -1],
|
|
2724
2725
|
yArrCopy: [-1, -1]
|
|
2725
2726
|
});
|
|
2726
|
-
|
|
2727
|
+
l(this, "autofill", {
|
|
2727
2728
|
enable: !1,
|
|
2728
2729
|
xArr: [-1, -1],
|
|
2729
2730
|
yArr: [-1, -1]
|
|
2730
2731
|
});
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
const { containerElement: i, stageElement: s, canvasElement: r, overlayerElement: o } = t;
|
|
2735
|
-
this.containerElement = i, this.stageElement = s, this.canvasElement = r, this.overlayerElement = o, this.config = new $t(e.config || {}), this.eventBus = new oi(), this.eventBrowser = new ri(this), this.eventTable = new
|
|
2732
|
+
l(this, "database");
|
|
2733
|
+
l(this, "history");
|
|
2734
|
+
l(this, "config");
|
|
2735
|
+
const { containerElement: i, stageElement: s, canvasElement: r, overlayerElement: o, editorElement: a } = t;
|
|
2736
|
+
this.containerElement = i, this.stageElement = s, this.canvasElement = r, this.overlayerElement = o, this.editorElement = a, this.config = new $t(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);
|
|
2736
2737
|
}
|
|
2737
2738
|
setConfig(t) {
|
|
2738
2739
|
this.config = new $t(t);
|
|
@@ -2767,7 +2768,7 @@ class hi {
|
|
|
2767
2768
|
for (let r = 0; r <= e[1] - e[0]; r++) {
|
|
2768
2769
|
const o = [];
|
|
2769
2770
|
for (let a = 0; a <= i[1] - i[0]; a++) {
|
|
2770
|
-
const
|
|
2771
|
+
const c = r + e[0], h = a + i[0], f = this.database.getItemValueForRowIndexAndColIndex(c, h);
|
|
2771
2772
|
f && o.push(f.value);
|
|
2772
2773
|
}
|
|
2773
2774
|
s += `${o.join(" ")}\r`, t.push(o);
|
|
@@ -2828,29 +2829,29 @@ class hi {
|
|
|
2828
2829
|
}
|
|
2829
2830
|
class qt {
|
|
2830
2831
|
constructor(t, e) {
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2832
|
+
l(this, "ctx");
|
|
2833
|
+
l(this, "type");
|
|
2834
|
+
l(this, "isFocus", !1);
|
|
2835
|
+
l(this, "trackX", 0);
|
|
2836
|
+
l(this, "trackY", 0);
|
|
2837
|
+
l(this, "trackWidth", 0);
|
|
2838
|
+
l(this, "trackHeight", 0);
|
|
2839
|
+
l(this, "splitPoints", []);
|
|
2839
2840
|
//分割线
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2841
|
+
l(this, "barX", 0);
|
|
2842
|
+
l(this, "barY", 0);
|
|
2843
|
+
l(this, "barWidth", 0);
|
|
2844
|
+
l(this, "barHeight", 0);
|
|
2845
|
+
l(this, "distance", 0);
|
|
2845
2846
|
// 滚动条的长度
|
|
2846
|
-
|
|
2847
|
+
l(this, "visibleDistance", 0);
|
|
2847
2848
|
//可见区域的长度
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2849
|
+
l(this, "clientX", 0);
|
|
2850
|
+
l(this, "clientY", 0);
|
|
2851
|
+
l(this, "dragStart", 0);
|
|
2851
2852
|
// 拖拽开始的位置
|
|
2852
|
-
|
|
2853
|
-
|
|
2853
|
+
l(this, "isDragging", !1);
|
|
2854
|
+
l(this, "scroll", 0);
|
|
2854
2855
|
this.ctx = t, this.type = e, this.type === "vertical" ? this.scroll = this.ctx.scrollY : this.scroll = this.ctx.scrollX;
|
|
2855
2856
|
}
|
|
2856
2857
|
onWheel(t) {
|
|
@@ -2903,19 +2904,19 @@ class qt {
|
|
|
2903
2904
|
stageHeight: i,
|
|
2904
2905
|
stageWidth: s,
|
|
2905
2906
|
config: { SCROLLER_TRACK_SIZE: r = 0, SCROLLER_SIZE: o = 0 }
|
|
2906
|
-
} = this.ctx, a = s,
|
|
2907
|
+
} = this.ctx, a = s, c = i, h = e.height, f = e.width, d = t.height, x = this.ctx.footer.height;
|
|
2907
2908
|
if (this.type === "vertical") {
|
|
2908
|
-
this.visibleDistance =
|
|
2909
|
+
this.visibleDistance = c - r - h, this.distance = d - this.visibleDistance + x, this.trackX = a - r, this.trackY = 0, this.splitPoints = [this.trackX, h, this.trackX + r, h], this.trackWidth = r, this.trackHeight = c, this.barX = this.trackX - 0.5 + (r - o) / 2, this.barWidth = o;
|
|
2909
2910
|
const u = this.distance ? this.visibleDistance / d : 0;
|
|
2910
2911
|
let g = Math.floor(u * this.visibleDistance);
|
|
2911
|
-
g < 30 ? g = 30 : g > this.visibleDistance && (g = 0), this.barHeight = g, this.barY =
|
|
2912
|
+
g < 30 ? g = 30 : g > this.visibleDistance && (g = 0), this.barHeight = g, this.barY = h + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
2912
2913
|
} else {
|
|
2913
2914
|
this.visibleDistance = a - r, this.distance = f - this.visibleDistance, this.splitPoints = [
|
|
2914
2915
|
a - r,
|
|
2915
|
-
|
|
2916
|
+
c - r,
|
|
2916
2917
|
a - r,
|
|
2917
|
-
|
|
2918
|
-
], this.trackX = 0, this.trackY =
|
|
2918
|
+
c
|
|
2919
|
+
], this.trackX = 0, this.trackY = c - r, this.trackWidth = a, this.trackHeight = r;
|
|
2919
2920
|
const u = this.distance ? this.visibleDistance / f : 0;
|
|
2920
2921
|
let g = Math.floor(u * this.visibleDistance);
|
|
2921
2922
|
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));
|
|
@@ -2937,11 +2938,11 @@ class qt {
|
|
|
2937
2938
|
}), this.ctx.scrollerFocus = this.isFocus;
|
|
2938
2939
|
}
|
|
2939
2940
|
}
|
|
2940
|
-
class
|
|
2941
|
+
class hi {
|
|
2941
2942
|
constructor(t) {
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2943
|
+
l(this, "ctx");
|
|
2944
|
+
l(this, "verticalScrollbar");
|
|
2945
|
+
l(this, "horizontalScrollbar");
|
|
2945
2946
|
this.ctx = t, this.verticalScrollbar = new qt(t, "vertical"), this.horizontalScrollbar = new qt(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) => {
|
|
2946
2947
|
this.setScroll(e, i);
|
|
2947
2948
|
}), this.ctx.on("setScrollX", (e) => {
|
|
@@ -2995,41 +2996,41 @@ class li {
|
|
|
2995
2996
|
}
|
|
2996
2997
|
class di {
|
|
2997
2998
|
constructor(t) {
|
|
2998
|
-
|
|
2999
|
+
l(this, "ctx");
|
|
2999
3000
|
// 上下文
|
|
3000
|
-
|
|
3001
|
+
l(this, "x", 0);
|
|
3001
3002
|
// x坐标
|
|
3002
|
-
|
|
3003
|
+
l(this, "y", 0);
|
|
3003
3004
|
// y坐标
|
|
3004
|
-
|
|
3005
|
+
l(this, "width", 0);
|
|
3005
3006
|
// 宽度
|
|
3006
|
-
|
|
3007
|
+
l(this, "height", 0);
|
|
3007
3008
|
// 高度
|
|
3008
|
-
|
|
3009
|
+
l(this, "resizeTarget", null);
|
|
3009
3010
|
//调整表头
|
|
3010
|
-
|
|
3011
|
+
l(this, "resizeNum", 0);
|
|
3011
3012
|
// 调整列的数量
|
|
3012
|
-
|
|
3013
|
+
l(this, "isResizing", !1);
|
|
3013
3014
|
// 是否移动中
|
|
3014
|
-
|
|
3015
|
+
l(this, "clientX", 0);
|
|
3015
3016
|
// 鼠标按下时的x轴位置
|
|
3016
|
-
|
|
3017
|
+
l(this, "resizeDiff", 0);
|
|
3017
3018
|
// 是否移动中
|
|
3018
|
-
|
|
3019
|
-
|
|
3019
|
+
l(this, "columnIndex", 0);
|
|
3020
|
+
l(this, "isMouseDown", !1);
|
|
3020
3021
|
// 是否按下
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3022
|
+
l(this, "columns");
|
|
3023
|
+
l(this, "visibleLeafColumns", []);
|
|
3024
|
+
l(this, "visibleHeight", 0);
|
|
3025
|
+
l(this, "visibleWidth", 0);
|
|
3026
|
+
l(this, "allCellHeaders", []);
|
|
3027
|
+
l(this, "leafCellHeaders", []);
|
|
3028
|
+
l(this, "renderLeafCellHeaders", []);
|
|
3029
|
+
l(this, "fixedLeftCellHeaders", []);
|
|
3030
|
+
l(this, "centerCellHeaders", []);
|
|
3031
|
+
l(this, "fixedRightCellHeaders", []);
|
|
3032
|
+
l(this, "renderCenterCellHeaders", []);
|
|
3033
|
+
l(this, "renderFixedCellHeaders", []);
|
|
3033
3034
|
this.ctx = t, this.ctx.on(
|
|
3034
3035
|
"resetHeader",
|
|
3035
3036
|
ee(() => {
|
|
@@ -3048,13 +3049,13 @@ class di {
|
|
|
3048
3049
|
this.columnIndex = 0, this.resizeNum = 0, this.render(o, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
3049
3050
|
const a = this.ctx.containerElement.getBoundingClientRect();
|
|
3050
3051
|
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;
|
|
3051
|
-
const
|
|
3052
|
-
if (this.resizeNum &&
|
|
3053
|
-
const d = Math.floor(
|
|
3052
|
+
const c = this.visibleWidth - this.width;
|
|
3053
|
+
if (this.resizeNum && c > 0) {
|
|
3054
|
+
const d = Math.floor(c / this.resizeNum * 100) / 100;
|
|
3054
3055
|
this.resizeAllColumn(d);
|
|
3055
3056
|
}
|
|
3056
|
-
const
|
|
3057
|
-
this.ctx.fixedLeftWidth =
|
|
3057
|
+
const h = this.fixedLeftCellHeaders.filter((d) => !d.hasChildren);
|
|
3058
|
+
this.ctx.fixedLeftWidth = h.reduce((d, x) => d + x.width, 0);
|
|
3058
3059
|
const f = this.fixedRightCellHeaders.filter((d) => !d.hasChildren);
|
|
3059
3060
|
this.ctx.fixedRightWidth = f.reduce((d, x) => d + x.width, e), this.ctx.maxColIndex = this.leafCellHeaders.length - 1, this.ctx.header.x = this.x, this.ctx.header.y = this.y, this.ctx.header.width = this.width, this.ctx.header.height = this.height, this.ctx.header.visibleWidth = this.visibleWidth, this.ctx.header.visibleHeight = this.visibleHeight;
|
|
3060
3061
|
}
|
|
@@ -3083,9 +3084,9 @@ class di {
|
|
|
3083
3084
|
this.ctx.stageElement.style.cursor === "col-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3084
3085
|
const r = [...this.renderFixedCellHeaders, ...this.renderCenterCellHeaders];
|
|
3085
3086
|
for (const o of r) {
|
|
3086
|
-
const { offsetX: a, offsetY:
|
|
3087
|
-
|
|
3088
|
-
o.colspan <= 1 && this.ctx.isTarget() &&
|
|
3087
|
+
const { offsetX: a, offsetY: c } = this.ctx.getOffset(e), h = a, f = o.getDrawX();
|
|
3088
|
+
h > f + o.width - 5 && h < f + o.width + 4 && h < i - 4 && // 视窗中最后一列不允许调整宽
|
|
3089
|
+
o.colspan <= 1 && this.ctx.isTarget() && c <= this.height && (this.ctx.stageElement.style.cursor = "col-resize", this.resizeTarget = o);
|
|
3089
3090
|
}
|
|
3090
3091
|
}
|
|
3091
3092
|
}));
|
|
@@ -3139,10 +3140,10 @@ class di {
|
|
|
3139
3140
|
let s = e;
|
|
3140
3141
|
const { HEADER_HEIGHT: r = 0 } = this.ctx.config;
|
|
3141
3142
|
for (let o = 0; o < i; o++) {
|
|
3142
|
-
const a = t[o],
|
|
3143
|
+
const a = t[o], c = r * (a.rowspan || 1), h = r * a.level;
|
|
3143
3144
|
let f = a.width || 100;
|
|
3144
3145
|
a.children && (f = _t(a.children).reduce((u, g) => u + ((g == null ? void 0 : g.width) || 100), 0));
|
|
3145
|
-
const d = new ne(this.ctx, this.columnIndex, s,
|
|
3146
|
+
const d = new ne(this.ctx, this.columnIndex, s, h, f, c, a);
|
|
3146
3147
|
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;
|
|
3147
3148
|
}
|
|
3148
3149
|
}
|
|
@@ -3174,8 +3175,8 @@ class di {
|
|
|
3174
3175
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3175
3176
|
colorEnd: "rgba(0,0,0,0)"
|
|
3176
3177
|
}), i < Math.floor(s.width - r - 1) && e !== a) {
|
|
3177
|
-
const
|
|
3178
|
-
this.ctx.paint.drawShadow(
|
|
3178
|
+
const c = s.width - (this.x + this.width) + r - e;
|
|
3179
|
+
this.ctx.paint.drawShadow(c + 1, this.y, e, this.height, {
|
|
3179
3180
|
fillColor: o,
|
|
3180
3181
|
side: "left",
|
|
3181
3182
|
shadowWidth: 4,
|
|
@@ -3203,20 +3204,20 @@ class di {
|
|
|
3203
3204
|
}
|
|
3204
3205
|
}
|
|
3205
3206
|
class ae {
|
|
3206
|
-
constructor(t, e, i = 0, s = 0, r = 0, o = 0, a,
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
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 =
|
|
3207
|
+
constructor(t, e, i = 0, s = 0, r = 0, o = 0, a, c = "body") {
|
|
3208
|
+
l(this, "ctx");
|
|
3209
|
+
l(this, "x", 0);
|
|
3210
|
+
l(this, "y", 0);
|
|
3211
|
+
l(this, "width", 0);
|
|
3212
|
+
l(this, "height");
|
|
3213
|
+
l(this, "cells", []);
|
|
3214
|
+
l(this, "fixedCells", []);
|
|
3215
|
+
l(this, "noFixedCells", []);
|
|
3216
|
+
l(this, "rowIndex", 0);
|
|
3217
|
+
l(this, "rowKey", "");
|
|
3218
|
+
l(this, "rowType", "body");
|
|
3219
|
+
l(this, "data");
|
|
3220
|
+
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 = c, this.data = a, this.update();
|
|
3220
3221
|
}
|
|
3221
3222
|
update() {
|
|
3222
3223
|
const { header: t } = this.ctx, e = [], i = [], s = [];
|
|
@@ -3256,28 +3257,28 @@ class ae {
|
|
|
3256
3257
|
}
|
|
3257
3258
|
class fi {
|
|
3258
3259
|
constructor(t) {
|
|
3259
|
-
|
|
3260
|
+
l(this, "resizeTarget", null);
|
|
3260
3261
|
//调整行大小的目标
|
|
3261
|
-
|
|
3262
|
+
l(this, "isMouseDown", !1);
|
|
3262
3263
|
// 是否按下
|
|
3263
|
-
|
|
3264
|
+
l(this, "resizeDiff", 0);
|
|
3264
3265
|
// 是否移动中
|
|
3265
|
-
|
|
3266
|
+
l(this, "clientY", 0);
|
|
3266
3267
|
// 鼠标按下时的y轴位置
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3268
|
+
l(this, "ctx");
|
|
3269
|
+
l(this, "x", 0);
|
|
3270
|
+
l(this, "y", 0);
|
|
3271
|
+
l(this, "width", 0);
|
|
3272
|
+
l(this, "height", 0);
|
|
3273
|
+
l(this, "headIndex", 0);
|
|
3274
|
+
l(this, "tailIndex", 0);
|
|
3275
|
+
l(this, "isResizing", !1);
|
|
3275
3276
|
//是否正在调整大小
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3277
|
+
l(this, "renderRows", []);
|
|
3278
|
+
l(this, "visibleRows", []);
|
|
3279
|
+
l(this, "visibleHeight", 0);
|
|
3280
|
+
l(this, "visibleWidth", 0);
|
|
3281
|
+
l(this, "data", []);
|
|
3281
3282
|
this.ctx = t, this.init(), this.initResizeRow();
|
|
3282
3283
|
}
|
|
3283
3284
|
init() {
|
|
@@ -3290,8 +3291,8 @@ class fi {
|
|
|
3290
3291
|
SCROLLER_TRACK_SIZE: r = 0,
|
|
3291
3292
|
HEIGHT: o,
|
|
3292
3293
|
EMPTY_BODY_HEIGHT: a = 0,
|
|
3293
|
-
MAX_HEIGHT:
|
|
3294
|
-
ENABLE_OFFSET_HEIGHT:
|
|
3294
|
+
MAX_HEIGHT: c = 0,
|
|
3295
|
+
ENABLE_OFFSET_HEIGHT: h = 0,
|
|
3295
3296
|
OFFSET_HEIGHT: f = 0
|
|
3296
3297
|
}
|
|
3297
3298
|
} = this.ctx;
|
|
@@ -3317,9 +3318,9 @@ class fi {
|
|
|
3317
3318
|
let p = this.height + e.height + r;
|
|
3318
3319
|
p += g;
|
|
3319
3320
|
let y = 0;
|
|
3320
|
-
this.data.length &&
|
|
3321
|
+
this.data.length && h ? (y = window.innerHeight - u - f, y < 0 && (y = 32, console.error(
|
|
3321
3322
|
"There is an error in the height calculation ENABLE_OFFSET_HEIGHT and OFFSET_HEIGHT are invalid"
|
|
3322
|
-
))) : this.data.length && o ? y = o : this.data.length &&
|
|
3323
|
+
))) : this.data.length && o ? y = o : this.data.length && c && p > c ? y = c : y = p, y > 0 && (this.ctx.stageHeight = Math.floor(y), this.ctx.stageElement.style.height = `${this.ctx.stageHeight - 0.5}px`);
|
|
3323
3324
|
let b = this.ctx.stageHeight - e.height - r;
|
|
3324
3325
|
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;
|
|
3325
3326
|
const m = window.devicePixelRatio || 1, E = this.ctx.stageWidth * m, C = this.ctx.stageHeight * m;
|
|
@@ -3342,8 +3343,8 @@ class fi {
|
|
|
3342
3343
|
}), this.ctx.on("mousemove", (e) => {
|
|
3343
3344
|
if (this.ctx.editing) return;
|
|
3344
3345
|
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), r = i, o = s, a = e.clientY, {
|
|
3345
|
-
stageHeight:
|
|
3346
|
-
scrollY:
|
|
3346
|
+
stageHeight: c,
|
|
3347
|
+
scrollY: h,
|
|
3347
3348
|
config: { RESIZE_ROW_MIN_HEIGHT: f = 0 }
|
|
3348
3349
|
} = this.ctx;
|
|
3349
3350
|
if (this.isResizing && this.resizeTarget) {
|
|
@@ -3356,7 +3357,7 @@ class fi {
|
|
|
3356
3357
|
this.ctx.stageElement.style.cursor === "row-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3357
3358
|
for (let d = 0; d < this.renderRows.length; d++) {
|
|
3358
3359
|
const x = this.renderRows[d];
|
|
3359
|
-
if (r > x.y -
|
|
3360
|
+
if (r > x.y - h + x.height - 1.5 && r < x.y - h + x.height + 1.5 && r < c - 4)
|
|
3360
3361
|
for (let g = 0; g < x.cells.length; g++) {
|
|
3361
3362
|
const w = x.cells[g];
|
|
3362
3363
|
o > w.drawX + 10 && o < w.drawX + w.width - 10 && w.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = x);
|
|
@@ -3405,8 +3406,8 @@ class fi {
|
|
|
3405
3406
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3406
3407
|
colorEnd: "rgba(0,0,0,0)"
|
|
3407
3408
|
}), i < Math.floor(s.width - r - 1) && e !== a) {
|
|
3408
|
-
const
|
|
3409
|
-
this.ctx.paint.drawShadow(
|
|
3409
|
+
const c = s.width - (this.x + this.width) + r - e;
|
|
3410
|
+
this.ctx.paint.drawShadow(c + 1, this.y, e, this.height, {
|
|
3410
3411
|
fillColor: o,
|
|
3411
3412
|
side: "left",
|
|
3412
3413
|
shadowWidth: 4,
|
|
@@ -3430,14 +3431,14 @@ class fi {
|
|
|
3430
3431
|
const { header: t, database: e, scrollY: i } = this.ctx, s = i, { data: r, positions: o } = e.getData();
|
|
3431
3432
|
this.ctx.maxRowIndex = r.length - 1;
|
|
3432
3433
|
const a = this.binarySearch(o, s);
|
|
3433
|
-
let
|
|
3434
|
-
|
|
3435
|
-
const
|
|
3434
|
+
let c = this.binarySearch(o, s + this.visibleHeight);
|
|
3435
|
+
c === -1 && (c = r.length), this.headIndex = Math.max(0, a), this.tailIndex = Math.min(this.ctx.maxRowIndex, c + 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;
|
|
3436
|
+
const h = [];
|
|
3436
3437
|
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
3437
3438
|
const d = this.headIndex + f, x = this.visibleRows[f], { height: u, top: g } = this.ctx.database.getPositionForRowIndex(d), w = new ae(this.ctx, d, 0, g + this.y, t.width, u, x);
|
|
3438
|
-
|
|
3439
|
+
h.push(w);
|
|
3439
3440
|
}
|
|
3440
|
-
this.renderRows =
|
|
3441
|
+
this.renderRows = h, this.ctx.body.renderRows = h;
|
|
3441
3442
|
}
|
|
3442
3443
|
draw() {
|
|
3443
3444
|
this.renderRows.forEach((t) => {
|
|
@@ -3449,15 +3450,15 @@ class fi {
|
|
|
3449
3450
|
}
|
|
3450
3451
|
class xi {
|
|
3451
3452
|
constructor(t) {
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3453
|
+
l(this, "ctx");
|
|
3454
|
+
l(this, "renderRows", []);
|
|
3455
|
+
l(this, "data", []);
|
|
3456
|
+
l(this, "x", 0);
|
|
3457
|
+
l(this, "y", 0);
|
|
3458
|
+
l(this, "width", 0);
|
|
3459
|
+
l(this, "height", 0);
|
|
3460
|
+
l(this, "visibleWidth", 0);
|
|
3461
|
+
l(this, "visibleHeight", 0);
|
|
3461
3462
|
this.ctx = t, this.init();
|
|
3462
3463
|
}
|
|
3463
3464
|
init() {
|
|
@@ -3478,16 +3479,16 @@ class xi {
|
|
|
3478
3479
|
stageWidth: r,
|
|
3479
3480
|
config: { HEADER_BG_COLOR: o, SCROLLER_TRACK_SIZE: a }
|
|
3480
3481
|
} = this.ctx;
|
|
3481
|
-
let
|
|
3482
|
-
if (this.ctx.config.FOOTER_FIXED || (
|
|
3482
|
+
let c = this.y;
|
|
3483
|
+
if (this.ctx.config.FOOTER_FIXED || (c = this.y - this.ctx.scrollY), i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, c, t, this.height, {
|
|
3483
3484
|
fillColor: o,
|
|
3484
3485
|
side: "right",
|
|
3485
3486
|
shadowWidth: 4,
|
|
3486
3487
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3487
3488
|
colorEnd: "rgba(0,0,0,0)"
|
|
3488
3489
|
}), i < Math.floor(s.width - r - 1) && e !== a) {
|
|
3489
|
-
const
|
|
3490
|
-
this.ctx.paint.drawShadow(
|
|
3490
|
+
const h = s.width - (this.x + this.width) + r - e;
|
|
3491
|
+
this.ctx.paint.drawShadow(h + 1, c, e, this.height, {
|
|
3491
3492
|
fillColor: o,
|
|
3492
3493
|
side: "left",
|
|
3493
3494
|
shadowWidth: 4,
|
|
@@ -3525,16 +3526,16 @@ class xi {
|
|
|
3525
3526
|
}
|
|
3526
3527
|
class ui {
|
|
3527
3528
|
constructor(t) {
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3529
|
+
l(this, "isCut", !1);
|
|
3530
|
+
l(this, "isMultipleRow", !1);
|
|
3531
|
+
l(this, "ctx");
|
|
3532
|
+
l(this, "adjustPositionX", "");
|
|
3533
|
+
l(this, "adjustPositionY", "");
|
|
3534
|
+
l(this, "timerX", 0);
|
|
3534
3535
|
// 水平滚动定时器
|
|
3535
|
-
|
|
3536
|
+
l(this, "timerY", 0);
|
|
3536
3537
|
// 垂直滚动定时器
|
|
3537
|
-
|
|
3538
|
+
l(this, "adjustTimer", 0);
|
|
3538
3539
|
this.ctx = t, this.init();
|
|
3539
3540
|
}
|
|
3540
3541
|
init() {
|
|
@@ -3566,7 +3567,7 @@ class ui {
|
|
|
3566
3567
|
this.ctx.stageElement.style.cursor !== "pointer" && (this.ctx.isPointer || this.selectCols(t));
|
|
3567
3568
|
}), this.ctx.on("keydown", (t) => {
|
|
3568
3569
|
if (t.ctrlKey && t.code === "KeyV" || t.metaKey && t.code === "KeyV") {
|
|
3569
|
-
this.paste();
|
|
3570
|
+
t.preventDefault(), this.paste();
|
|
3570
3571
|
return;
|
|
3571
3572
|
}
|
|
3572
3573
|
if (t.ctrlKey && t.code === "KeyC" || t.metaKey && t.code === "KeyC") {
|
|
@@ -3629,12 +3630,12 @@ class ui {
|
|
|
3629
3630
|
this.ctx.mousedown && (this.ctx.selectorMove = !0), this.ctx.selector.enable = !0;
|
|
3630
3631
|
const {
|
|
3631
3632
|
SELECTOR_AREA_MIN_X: a,
|
|
3632
|
-
SELECTOR_AREA_MAX_X:
|
|
3633
|
-
SELECTOR_AREA_MIN_Y:
|
|
3633
|
+
SELECTOR_AREA_MAX_X: c,
|
|
3634
|
+
SELECTOR_AREA_MIN_Y: h,
|
|
3634
3635
|
SELECTOR_AREA_MAX_Y: f,
|
|
3635
3636
|
SELECTOR_AREA_MAX_X_OFFSET: d,
|
|
3636
3637
|
SELECTOR_AREA_MAX_Y_OFFSET: x
|
|
3637
|
-
} = this.ctx.config, u = a, g =
|
|
3638
|
+
} = this.ctx.config, u = a, g = c || this.ctx.maxColIndex - d, w = h, p = f || this.ctx.maxRowIndex - x;
|
|
3638
3639
|
let [y, b] = r, [m, E] = o;
|
|
3639
3640
|
if (y < u || b > g || m < w || E > p)
|
|
3640
3641
|
return;
|
|
@@ -3652,15 +3653,15 @@ class ui {
|
|
|
3652
3653
|
if (this.ctx.mousedown && this.ctx.focusCellHeader) {
|
|
3653
3654
|
const { colIndex: a } = this.ctx.focusCellHeader;
|
|
3654
3655
|
if (this.ctx.clearSelector(), t.colIndex >= a) {
|
|
3655
|
-
const
|
|
3656
|
-
this.setSelector(
|
|
3656
|
+
const c = [a, t.colIndex + t.colspan - 1], h = [r, o];
|
|
3657
|
+
this.setSelector(c, h);
|
|
3657
3658
|
} else {
|
|
3658
|
-
const
|
|
3659
|
-
this.setSelector(
|
|
3659
|
+
const c = [t.colIndex, a], h = [r, o];
|
|
3660
|
+
this.setSelector(c, h);
|
|
3660
3661
|
}
|
|
3661
3662
|
} else {
|
|
3662
|
-
const a = [t.colIndex, t.colIndex + t.colspan - 1],
|
|
3663
|
-
this.setSelector(a,
|
|
3663
|
+
const a = [t.colIndex, t.colIndex + t.colspan - 1], c = [r, o];
|
|
3664
|
+
this.setSelector(a, c);
|
|
3664
3665
|
}
|
|
3665
3666
|
}
|
|
3666
3667
|
selectAll() {
|
|
@@ -3674,8 +3675,8 @@ class ui {
|
|
|
3674
3675
|
SELECTOR_AREA_MIN_Y: r,
|
|
3675
3676
|
SELECTOR_AREA_MAX_Y: o,
|
|
3676
3677
|
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
3677
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
3678
|
-
} = this.ctx.config,
|
|
3678
|
+
SELECTOR_AREA_MAX_Y_OFFSET: c
|
|
3679
|
+
} = this.ctx.config, h = i, f = s || this.ctx.maxColIndex - a, d = r, x = o || this.ctx.maxRowIndex - c, u = [h, f], g = [d, x];
|
|
3679
3680
|
this.setSelector(u, g);
|
|
3680
3681
|
}
|
|
3681
3682
|
}
|
|
@@ -3685,17 +3686,17 @@ class ui {
|
|
|
3685
3686
|
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;
|
|
3686
3687
|
if (e) {
|
|
3687
3688
|
this.ctx.setFocusCell(t);
|
|
3688
|
-
const
|
|
3689
|
-
this.setSelector(
|
|
3689
|
+
const c = [a, o], h = [t.rowIndex, t.rowIndex];
|
|
3690
|
+
this.setSelector(c, h);
|
|
3690
3691
|
}
|
|
3691
3692
|
if (this.ctx.focusCell && this.ctx.mousedown) {
|
|
3692
|
-
const { rowIndex:
|
|
3693
|
-
if (t.rowIndex >=
|
|
3694
|
-
const
|
|
3695
|
-
this.setSelector(
|
|
3693
|
+
const { rowIndex: c } = this.ctx.focusCell;
|
|
3694
|
+
if (t.rowIndex >= c) {
|
|
3695
|
+
const h = [a, o], f = [c, t.rowIndex];
|
|
3696
|
+
this.setSelector(h, f);
|
|
3696
3697
|
} else {
|
|
3697
|
-
const
|
|
3698
|
-
this.setSelector(
|
|
3698
|
+
const h = [a, o], f = [t.rowIndex, c];
|
|
3699
|
+
this.setSelector(h, f);
|
|
3699
3700
|
}
|
|
3700
3701
|
}
|
|
3701
3702
|
}
|
|
@@ -3704,7 +3705,7 @@ class ui {
|
|
|
3704
3705
|
return;
|
|
3705
3706
|
const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
|
|
3706
3707
|
if (t && e && i) {
|
|
3707
|
-
const { rowIndex: s, colIndex: r } = e, o = Math.min(i.colIndex, r), a = Math.max(i.colIndex, r),
|
|
3708
|
+
const { rowIndex: s, colIndex: r } = e, o = Math.min(i.colIndex, r), a = Math.max(i.colIndex, r), c = Math.min(i.rowIndex, s), h = Math.max(i.rowIndex, s), f = [o, a], d = [c, h];
|
|
3708
3709
|
this.setSelector(f, d);
|
|
3709
3710
|
}
|
|
3710
3711
|
}
|
|
@@ -3712,7 +3713,7 @@ class ui {
|
|
|
3712
3713
|
const { focusCell: e, clickCell: i } = this.ctx;
|
|
3713
3714
|
if (e && this.isInSettingRange(e.rowIndex, e.colIndex))
|
|
3714
3715
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
3715
|
-
const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: a } = e,
|
|
3716
|
+
const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: a } = e, c = Math.min(o, s), h = Math.max(o, s), f = Math.min(a, r), d = Math.max(a, r), x = [c, h], u = [f, d];
|
|
3716
3717
|
this.setSelector(x, u);
|
|
3717
3718
|
} else {
|
|
3718
3719
|
this.ctx.emit("cellSelectedClick", e);
|
|
@@ -3749,8 +3750,8 @@ class ui {
|
|
|
3749
3750
|
let s = [];
|
|
3750
3751
|
const r = /* @__PURE__ */ new Set();
|
|
3751
3752
|
for (let a = 0; a <= e[1] - e[0]; a++)
|
|
3752
|
-
for (let
|
|
3753
|
-
const
|
|
3753
|
+
for (let c = 0; c <= t[1] - t[0]; c++) {
|
|
3754
|
+
const h = a + e[0], f = c + t[0], d = this.ctx.database.getItemValueForRowIndexAndColIndex(h, f);
|
|
3754
3755
|
if (d) {
|
|
3755
3756
|
const { rowKey: x, key: u } = d;
|
|
3756
3757
|
this.ctx.database.getReadonly(x, u) || (r.add(x), s.push({
|
|
@@ -3782,10 +3783,10 @@ class ui {
|
|
|
3782
3783
|
const e = this.ctx.selector.yArr[0], i = this.ctx.selector.xArr[0], s = /* @__PURE__ */ new Set();
|
|
3783
3784
|
navigator.clipboard.readText().then((r) => {
|
|
3784
3785
|
let o = ti(r), a = [];
|
|
3785
|
-
for (let
|
|
3786
|
-
const f = o[
|
|
3786
|
+
for (let h = 0; h <= o.length - 1; h++) {
|
|
3787
|
+
const f = o[h].length;
|
|
3787
3788
|
for (let d = 0; d <= f - 1; d++) {
|
|
3788
|
-
const x =
|
|
3789
|
+
const x = h + e, u = d + i, g = o[h][d], w = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
3789
3790
|
x,
|
|
3790
3791
|
u
|
|
3791
3792
|
);
|
|
@@ -3802,23 +3803,23 @@ class ui {
|
|
|
3802
3803
|
}
|
|
3803
3804
|
}
|
|
3804
3805
|
if (this.isCut) {
|
|
3805
|
-
const
|
|
3806
|
+
const h = this.clearSelectedData(
|
|
3806
3807
|
this.ctx.selector.xArrCopy,
|
|
3807
3808
|
this.ctx.selector.yArrCopy,
|
|
3808
3809
|
!0
|
|
3809
3810
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
3810
3811
|
), f = a.map((d) => `${d.rowKey}-${d.key}`);
|
|
3811
|
-
|
|
3812
|
+
h.forEach((d) => {
|
|
3812
3813
|
f.includes(`${d.rowKey}-${d.key}`) || a.unshift(d);
|
|
3813
3814
|
}), this.isCut = !1;
|
|
3814
3815
|
}
|
|
3815
3816
|
if (!a.length)
|
|
3816
3817
|
return;
|
|
3817
3818
|
this.ctx.database.batchSetItemValue(a, !0);
|
|
3818
|
-
let
|
|
3819
|
-
s.forEach((
|
|
3820
|
-
|
|
3821
|
-
}), this.ctx.emit("pasteChange", a,
|
|
3819
|
+
let c = [];
|
|
3820
|
+
s.forEach((h) => {
|
|
3821
|
+
c.push(this.ctx.database.getRowDataItemForRowKey(h));
|
|
3822
|
+
}), this.ctx.emit("pasteChange", a, c), this.clearCopyLine(), this.ctx.emit("drawView");
|
|
3822
3823
|
}).catch((r) => {
|
|
3823
3824
|
console.error("获取剪贴板内容失败:", r);
|
|
3824
3825
|
});
|
|
@@ -3834,7 +3835,7 @@ class ui {
|
|
|
3834
3835
|
if (!e)
|
|
3835
3836
|
return;
|
|
3836
3837
|
let { colIndex: i = 0, rowIndex: s = 0 } = e;
|
|
3837
|
-
const r = 0, o = 0, a = this.ctx.maxColIndex,
|
|
3838
|
+
const r = 0, o = 0, a = this.ctx.maxColIndex, c = this.ctx.maxRowIndex;
|
|
3838
3839
|
switch (t) {
|
|
3839
3840
|
case "LEFT":
|
|
3840
3841
|
i > r && i--;
|
|
@@ -3846,11 +3847,11 @@ class ui {
|
|
|
3846
3847
|
i < a && i++;
|
|
3847
3848
|
break;
|
|
3848
3849
|
case "BOTTOM":
|
|
3849
|
-
s <
|
|
3850
|
+
s < c && s++;
|
|
3850
3851
|
break;
|
|
3851
3852
|
}
|
|
3852
|
-
const
|
|
3853
|
-
d && (d.operation || this.isInSettingRange(d.rowIndex, d.colIndex) && (this.ctx.setFocusCell(d), this.setSelector(
|
|
3853
|
+
const h = [i, i], f = [s, s], d = this.getCell(s, i);
|
|
3854
|
+
d && (d.operation || this.isInSettingRange(d.rowIndex, d.colIndex) && (this.ctx.setFocusCell(d), this.setSelector(h, f), this.adjustBoundaryPosition(), this.ctx.emit("drawView")));
|
|
3854
3855
|
}
|
|
3855
3856
|
stopAdjustPosition() {
|
|
3856
3857
|
this.adjustPositionX = "", this.adjustPositionY = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerY && (clearInterval(this.timerY), this.timerY = 0);
|
|
@@ -3863,9 +3864,9 @@ class ui {
|
|
|
3863
3864
|
SELECTOR_AREA_MIN_Y: r,
|
|
3864
3865
|
SELECTOR_AREA_MAX_Y: o,
|
|
3865
3866
|
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
3866
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
3867
|
-
} = this.ctx.config,
|
|
3868
|
-
return !(e <
|
|
3867
|
+
SELECTOR_AREA_MAX_Y_OFFSET: c
|
|
3868
|
+
} = this.ctx.config, h = i, f = s || this.ctx.maxColIndex - a, d = r, x = o || this.ctx.maxRowIndex - c;
|
|
3869
|
+
return !(e < h || e > f || t < d || t > x);
|
|
3869
3870
|
}
|
|
3870
3871
|
/**
|
|
3871
3872
|
* 调整滚动条位置,让到达边界时自动滚动
|
|
@@ -3878,8 +3879,8 @@ class ui {
|
|
|
3878
3879
|
let a = 10 * (s === "left" ? -1 : 1);
|
|
3879
3880
|
this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
|
|
3880
3881
|
a *= 1.5;
|
|
3881
|
-
const { scrollX:
|
|
3882
|
-
(
|
|
3882
|
+
const { scrollX: c } = this.ctx, h = c + a;
|
|
3883
|
+
(h < 0 || h > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(h);
|
|
3883
3884
|
}, 100);
|
|
3884
3885
|
}
|
|
3885
3886
|
if (r && this.adjustPositionY !== r) {
|
|
@@ -3887,8 +3888,8 @@ class ui {
|
|
|
3887
3888
|
let a = 10 * (r === "top" ? -1 : 1);
|
|
3888
3889
|
this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
|
|
3889
3890
|
a *= 1.5;
|
|
3890
|
-
const { scrollY:
|
|
3891
|
-
(
|
|
3891
|
+
const { scrollY: c } = this.ctx, h = c + a;
|
|
3892
|
+
(h < 0 || h > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(h);
|
|
3892
3893
|
}, 100);
|
|
3893
3894
|
}
|
|
3894
3895
|
}
|
|
@@ -3904,8 +3905,8 @@ class ui {
|
|
|
3904
3905
|
fixedLeftWidth: r,
|
|
3905
3906
|
header: o,
|
|
3906
3907
|
footer: a,
|
|
3907
|
-
scrollX:
|
|
3908
|
-
scrollY:
|
|
3908
|
+
scrollX: c,
|
|
3909
|
+
scrollY: h
|
|
3909
3910
|
} = this.ctx;
|
|
3910
3911
|
if (!i)
|
|
3911
3912
|
return;
|
|
@@ -3914,7 +3915,7 @@ class ui {
|
|
|
3914
3915
|
d && (x = a.visibleHeight);
|
|
3915
3916
|
const u = r - i.drawX + 1, g = i.drawX + i.width - (e - s) + 1, w = o.height - i.drawY, p = i.drawY + i.height - (t - x - f);
|
|
3916
3917
|
this.adjustTimer && (clearTimeout(this.adjustTimer), this.adjustTimer = 0), this.adjustTimer = setTimeout(() => {
|
|
3917
|
-
this.ctx.editing || (g > 0 && !i.fixed ? this.ctx.setScrollX(
|
|
3918
|
+
this.ctx.editing || (g > 0 && !i.fixed ? this.ctx.setScrollX(c + g) : u > 0 && !i.fixed && this.ctx.setScrollX(c - u), w > 0 ? this.ctx.setScrollY(h - w) : p > 0 && this.ctx.setScrollY(h + p));
|
|
3918
3919
|
}, 167);
|
|
3919
3920
|
}
|
|
3920
3921
|
destroy() {
|
|
@@ -3923,14 +3924,14 @@ class ui {
|
|
|
3923
3924
|
}
|
|
3924
3925
|
class gi {
|
|
3925
3926
|
constructor(t) {
|
|
3926
|
-
|
|
3927
|
+
l(this, "ctx");
|
|
3927
3928
|
this.ctx = t, this.init();
|
|
3928
3929
|
}
|
|
3929
3930
|
init() {
|
|
3930
3931
|
this.ctx.on("cellMouseenter", (t, e) => {
|
|
3931
3932
|
this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default");
|
|
3932
|
-
const { offsetX: i, offsetY: s } = this.ctx.getOffset(e), { xArr: r, yArr: o } = this.ctx.selector, a = r[1],
|
|
3933
|
-
if (this.ctx.config.ENABLE_AUTOFILL &&
|
|
3933
|
+
const { offsetX: i, offsetY: s } = this.ctx.getOffset(e), { xArr: r, yArr: o } = this.ctx.selector, a = r[1], c = o[1], { colIndex: h, rowIndex: f, drawX: d, drawY: x, width: u, height: g } = t;
|
|
3934
|
+
if (this.ctx.config.ENABLE_AUTOFILL && h === a && f === c) {
|
|
3934
3935
|
const p = d + u - 6, y = x + g - 6;
|
|
3935
3936
|
i > p && s > y && (this.ctx.stageElement.style.cursor = "crosshair");
|
|
3936
3937
|
}
|
|
@@ -3963,22 +3964,22 @@ class gi {
|
|
|
3963
3964
|
return;
|
|
3964
3965
|
let o = t, a = e;
|
|
3965
3966
|
if (!r) {
|
|
3966
|
-
const [
|
|
3967
|
-
a = [
|
|
3967
|
+
const [c] = a;
|
|
3968
|
+
a = [c, c];
|
|
3968
3969
|
}
|
|
3969
3970
|
if (!s) {
|
|
3970
|
-
const [
|
|
3971
|
-
o = [
|
|
3971
|
+
const [c] = o;
|
|
3972
|
+
o = [c, c];
|
|
3972
3973
|
}
|
|
3973
3974
|
if (JSON.stringify(this.ctx.autofill.xArr) !== JSON.stringify(o) || JSON.stringify(this.ctx.autofill.yArr) !== JSON.stringify(a)) {
|
|
3974
3975
|
const {
|
|
3975
|
-
SELECTOR_AREA_MIN_X:
|
|
3976
|
-
SELECTOR_AREA_MAX_X:
|
|
3976
|
+
SELECTOR_AREA_MIN_X: c,
|
|
3977
|
+
SELECTOR_AREA_MAX_X: h,
|
|
3977
3978
|
SELECTOR_AREA_MIN_Y: f,
|
|
3978
3979
|
SELECTOR_AREA_MAX_Y: d,
|
|
3979
3980
|
SELECTOR_AREA_MAX_X_OFFSET: x,
|
|
3980
3981
|
SELECTOR_AREA_MAX_Y_OFFSET: u
|
|
3981
|
-
} = this.ctx.config, g =
|
|
3982
|
+
} = this.ctx.config, g = c, w = h || this.ctx.maxColIndex - x, p = f, y = d || this.ctx.maxRowIndex - u;
|
|
3982
3983
|
let [b, m] = o, [E, C] = a;
|
|
3983
3984
|
if (b < g || E < p)
|
|
3984
3985
|
return;
|
|
@@ -3995,14 +3996,14 @@ class gi {
|
|
|
3995
3996
|
const u = d + e.yArr[0], g = x + e.xArr[0];
|
|
3996
3997
|
i.set(`${u}-${g}`, !0);
|
|
3997
3998
|
}
|
|
3998
|
-
const { value: s } = e, r = s[0].length, o = s.length, a = this.ctx.autofill.xArr,
|
|
3999
|
-
let
|
|
4000
|
-
for (let d = 0; d <=
|
|
3999
|
+
const { value: s } = e, r = s[0].length, o = s.length, a = this.ctx.autofill.xArr, c = this.ctx.autofill.yArr;
|
|
4000
|
+
let h = [];
|
|
4001
|
+
for (let d = 0; d <= c[1] - c[0]; d++)
|
|
4001
4002
|
for (let x = 0; x <= a[1] - a[0]; x++) {
|
|
4002
|
-
const u = x + a[0], g = d +
|
|
4003
|
+
const u = x + a[0], g = d + c[0], w = s[d % o][x % r], p = this.ctx.database.getItemValueForRowIndexAndColIndex(g, u), y = `${g}-${u}`;
|
|
4003
4004
|
if (p && !i.has(y)) {
|
|
4004
4005
|
const { rowKey: b, key: m } = p;
|
|
4005
|
-
this.ctx.database.getReadonly(b, m) || (t.add(b),
|
|
4006
|
+
this.ctx.database.getReadonly(b, m) || (t.add(b), h.push({
|
|
4006
4007
|
rowKey: b,
|
|
4007
4008
|
key: m,
|
|
4008
4009
|
value: w,
|
|
@@ -4010,13 +4011,13 @@ class gi {
|
|
|
4010
4011
|
}));
|
|
4011
4012
|
}
|
|
4012
4013
|
}
|
|
4013
|
-
if (!
|
|
4014
|
+
if (!h.length)
|
|
4014
4015
|
return;
|
|
4015
|
-
this.ctx.database.batchSetItemValue(
|
|
4016
|
+
this.ctx.database.batchSetItemValue(h, !0);
|
|
4016
4017
|
let f = [];
|
|
4017
4018
|
t.forEach((d) => {
|
|
4018
4019
|
f.push(this.ctx.database.getRowDataItemForRowKey(d));
|
|
4019
|
-
}), this.ctx.emit("autofillChange",
|
|
4020
|
+
}), this.ctx.emit("autofillChange", h, f), this.ctx.selector.xArr = this.ctx.autofill.xArr, this.ctx.selector.yArr = this.ctx.autofill.yArr, this.ctx.emit("draw");
|
|
4020
4021
|
}
|
|
4021
4022
|
mouseenter(t) {
|
|
4022
4023
|
if (["index", "selection", "index-selection"].includes(t.type))
|
|
@@ -4051,10 +4052,10 @@ function at(n, t) {
|
|
|
4051
4052
|
function q(n) {
|
|
4052
4053
|
return n.split("-")[0];
|
|
4053
4054
|
}
|
|
4054
|
-
function
|
|
4055
|
+
function lt(n) {
|
|
4055
4056
|
return n.split("-")[1];
|
|
4056
4057
|
}
|
|
4057
|
-
function
|
|
4058
|
+
function le(n) {
|
|
4058
4059
|
return n === "x" ? "y" : "x";
|
|
4059
4060
|
}
|
|
4060
4061
|
function Lt(n) {
|
|
@@ -4064,11 +4065,11 @@ function J(n) {
|
|
|
4064
4065
|
return ["top", "bottom"].includes(q(n)) ? "y" : "x";
|
|
4065
4066
|
}
|
|
4066
4067
|
function Mt(n) {
|
|
4067
|
-
return
|
|
4068
|
+
return le(J(n));
|
|
4068
4069
|
}
|
|
4069
4070
|
function yi(n, t, e) {
|
|
4070
4071
|
e === void 0 && (e = !1);
|
|
4071
|
-
const i =
|
|
4072
|
+
const i = lt(n), s = Mt(n), r = Lt(s);
|
|
4072
4073
|
let o = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
|
|
4073
4074
|
return t.reference[r] > t.floating[r] && (o = xt(o)), [o, xt(o)];
|
|
4074
4075
|
}
|
|
@@ -4093,7 +4094,7 @@ function Ei(n, t, e) {
|
|
|
4093
4094
|
}
|
|
4094
4095
|
}
|
|
4095
4096
|
function bi(n, t, e, i) {
|
|
4096
|
-
const s =
|
|
4097
|
+
const s = lt(n);
|
|
4097
4098
|
let r = Ei(q(n), e === "start", i);
|
|
4098
4099
|
return s && (r = r.map((o) => o + "-" + s), t && (r = r.concat(r.map(Ot)))), r;
|
|
4099
4100
|
}
|
|
@@ -4109,7 +4110,7 @@ function Ci(n) {
|
|
|
4109
4110
|
...n
|
|
4110
4111
|
};
|
|
4111
4112
|
}
|
|
4112
|
-
function
|
|
4113
|
+
function ce(n) {
|
|
4113
4114
|
return typeof n != "number" ? Ci(n) : {
|
|
4114
4115
|
top: n,
|
|
4115
4116
|
right: n,
|
|
@@ -4140,9 +4141,9 @@ function Gt(n, t, e) {
|
|
|
4140
4141
|
reference: i,
|
|
4141
4142
|
floating: s
|
|
4142
4143
|
} = n;
|
|
4143
|
-
const r = J(t), o = Mt(t), a = Lt(o),
|
|
4144
|
+
const r = J(t), o = Mt(t), a = Lt(o), c = q(t), h = 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;
|
|
4144
4145
|
let u;
|
|
4145
|
-
switch (
|
|
4146
|
+
switch (c) {
|
|
4146
4147
|
case "top":
|
|
4147
4148
|
u = {
|
|
4148
4149
|
x: f,
|
|
@@ -4173,12 +4174,12 @@ function Gt(n, t, e) {
|
|
|
4173
4174
|
y: i.y
|
|
4174
4175
|
};
|
|
4175
4176
|
}
|
|
4176
|
-
switch (
|
|
4177
|
+
switch (lt(t)) {
|
|
4177
4178
|
case "start":
|
|
4178
|
-
u[o] -= x * (e &&
|
|
4179
|
+
u[o] -= x * (e && h ? -1 : 1);
|
|
4179
4180
|
break;
|
|
4180
4181
|
case "end":
|
|
4181
|
-
u[o] += x * (e &&
|
|
4182
|
+
u[o] += x * (e && h ? -1 : 1);
|
|
4182
4183
|
break;
|
|
4183
4184
|
}
|
|
4184
4185
|
return u;
|
|
@@ -4189,15 +4190,15 @@ const vi = async (n, t, e) => {
|
|
|
4189
4190
|
strategy: s = "absolute",
|
|
4190
4191
|
middleware: r = [],
|
|
4191
4192
|
platform: o
|
|
4192
|
-
} = e, a = r.filter(Boolean),
|
|
4193
|
-
let
|
|
4193
|
+
} = e, a = r.filter(Boolean), c = await (o.isRTL == null ? void 0 : o.isRTL(t));
|
|
4194
|
+
let h = await o.getElementRects({
|
|
4194
4195
|
reference: n,
|
|
4195
4196
|
floating: t,
|
|
4196
4197
|
strategy: s
|
|
4197
4198
|
}), {
|
|
4198
4199
|
x: f,
|
|
4199
4200
|
y: d
|
|
4200
|
-
} = Gt(
|
|
4201
|
+
} = Gt(h, i, c), x = i, u = {}, g = 0;
|
|
4201
4202
|
for (let w = 0; w < a.length; w++) {
|
|
4202
4203
|
const {
|
|
4203
4204
|
name: p,
|
|
@@ -4214,7 +4215,7 @@ const vi = async (n, t, e) => {
|
|
|
4214
4215
|
placement: x,
|
|
4215
4216
|
strategy: s,
|
|
4216
4217
|
middlewareData: u,
|
|
4217
|
-
rects:
|
|
4218
|
+
rects: h,
|
|
4218
4219
|
platform: o,
|
|
4219
4220
|
elements: {
|
|
4220
4221
|
reference: n,
|
|
@@ -4227,14 +4228,14 @@ const vi = async (n, t, e) => {
|
|
|
4227
4228
|
...u[p],
|
|
4228
4229
|
...E
|
|
4229
4230
|
}
|
|
4230
|
-
}, C && g <= 50 && (g++, typeof C == "object" && (C.placement && (x = C.placement), C.rects && (
|
|
4231
|
+
}, C && g <= 50 && (g++, typeof C == "object" && (C.placement && (x = C.placement), C.rects && (h = C.rects === !0 ? await o.getElementRects({
|
|
4231
4232
|
reference: n,
|
|
4232
4233
|
floating: t,
|
|
4233
4234
|
strategy: s
|
|
4234
4235
|
}) : C.rects), {
|
|
4235
4236
|
x: f,
|
|
4236
4237
|
y: d
|
|
4237
|
-
} = Gt(
|
|
4238
|
+
} = Gt(h, x, c)), w = -1);
|
|
4238
4239
|
}
|
|
4239
4240
|
return {
|
|
4240
4241
|
x: f,
|
|
@@ -4244,7 +4245,7 @@ const vi = async (n, t, e) => {
|
|
|
4244
4245
|
middlewareData: u
|
|
4245
4246
|
};
|
|
4246
4247
|
};
|
|
4247
|
-
async function
|
|
4248
|
+
async function he(n, t) {
|
|
4248
4249
|
var e;
|
|
4249
4250
|
t === void 0 && (t = {});
|
|
4250
4251
|
const {
|
|
@@ -4253,18 +4254,18 @@ async function le(n, t) {
|
|
|
4253
4254
|
platform: r,
|
|
4254
4255
|
rects: o,
|
|
4255
4256
|
elements: a,
|
|
4256
|
-
strategy:
|
|
4257
|
+
strategy: c
|
|
4257
4258
|
} = n, {
|
|
4258
|
-
boundary:
|
|
4259
|
+
boundary: h = "clippingAncestors",
|
|
4259
4260
|
rootBoundary: f = "viewport",
|
|
4260
4261
|
elementContext: d = "floating",
|
|
4261
4262
|
altBoundary: x = !1,
|
|
4262
4263
|
padding: u = 0
|
|
4263
|
-
} = at(t, n), g =
|
|
4264
|
+
} = at(t, n), g = ce(u), p = a[x ? d === "floating" ? "reference" : "floating" : d], y = ut(await r.getClippingRect({
|
|
4264
4265
|
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)),
|
|
4265
|
-
boundary:
|
|
4266
|
+
boundary: h,
|
|
4266
4267
|
rootBoundary: f,
|
|
4267
|
-
strategy:
|
|
4268
|
+
strategy: c
|
|
4268
4269
|
})), b = d === "floating" ? {
|
|
4269
4270
|
x: i,
|
|
4270
4271
|
y: s,
|
|
@@ -4280,7 +4281,7 @@ async function le(n, t) {
|
|
|
4280
4281
|
elements: a,
|
|
4281
4282
|
rect: b,
|
|
4282
4283
|
offsetParent: m,
|
|
4283
|
-
strategy:
|
|
4284
|
+
strategy: c
|
|
4284
4285
|
}) : b);
|
|
4285
4286
|
return {
|
|
4286
4287
|
top: (y.top - C.top + g.top) / E.y,
|
|
@@ -4300,20 +4301,20 @@ const Ri = (n) => ({
|
|
|
4300
4301
|
rects: r,
|
|
4301
4302
|
platform: o,
|
|
4302
4303
|
elements: a,
|
|
4303
|
-
middlewareData:
|
|
4304
|
+
middlewareData: c
|
|
4304
4305
|
} = t, {
|
|
4305
|
-
element:
|
|
4306
|
+
element: h,
|
|
4306
4307
|
padding: f = 0
|
|
4307
4308
|
} = at(n, t) || {};
|
|
4308
|
-
if (
|
|
4309
|
+
if (h == null)
|
|
4309
4310
|
return {};
|
|
4310
|
-
const d =
|
|
4311
|
+
const d = ce(f), x = {
|
|
4311
4312
|
x: e,
|
|
4312
4313
|
y: i
|
|
4313
|
-
}, u = Mt(s), g = Lt(u), w = await o.getDimensions(
|
|
4314
|
+
}, u = Mt(s), g = Lt(u), w = await o.getDimensions(h), 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(h));
|
|
4314
4315
|
let T = R ? R[m] : 0;
|
|
4315
4316
|
(!T || !await (o.isElement == null ? void 0 : o.isElement(R))) && (T = a.floating[m] || r.floating[g]);
|
|
4316
|
-
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), Y = !
|
|
4317
|
+
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), Y = !c.arrow && lt(s) != null && O !== G && r.reference[g] / 2 - (O < I ? D : B) - w[g] / 2 < 0, k = Y ? O < I ? O - I : O - S : 0;
|
|
4317
4318
|
return {
|
|
4318
4319
|
[u]: x[u] + k,
|
|
4319
4320
|
data: {
|
|
@@ -4337,8 +4338,8 @@ const Ri = (n) => ({
|
|
|
4337
4338
|
middlewareData: r,
|
|
4338
4339
|
rects: o,
|
|
4339
4340
|
initialPlacement: a,
|
|
4340
|
-
platform:
|
|
4341
|
-
elements:
|
|
4341
|
+
platform: c,
|
|
4342
|
+
elements: h
|
|
4342
4343
|
} = t, {
|
|
4343
4344
|
mainAxis: f = !0,
|
|
4344
4345
|
crossAxis: d = !0,
|
|
@@ -4350,9 +4351,9 @@ const Ri = (n) => ({
|
|
|
4350
4351
|
} = at(n, t);
|
|
4351
4352
|
if ((e = r.arrow) != null && e.alignmentOffset)
|
|
4352
4353
|
return {};
|
|
4353
|
-
const y = q(s), b = J(a), m = q(a) === a, E = await (
|
|
4354
|
+
const y = q(s), b = J(a), m = q(a) === a, E = await (c.isRTL == null ? void 0 : c.isRTL(h.floating)), C = x || (m || !w ? [xt(a)] : mi(a)), R = g !== "none";
|
|
4354
4355
|
!x && R && C.push(...bi(a, w, g, E));
|
|
4355
|
-
const T = [a, ...C], A = await
|
|
4356
|
+
const T = [a, ...C], A = await he(t, p), L = [];
|
|
4356
4357
|
let D = ((i = r.flip) == null ? void 0 : i.overflows) || [];
|
|
4357
4358
|
if (f && L.push(A[y]), d) {
|
|
4358
4359
|
const O = yi(s, o, E);
|
|
@@ -4411,7 +4412,7 @@ async function Ii(n, t) {
|
|
|
4411
4412
|
placement: e,
|
|
4412
4413
|
platform: i,
|
|
4413
4414
|
elements: s
|
|
4414
|
-
} = n, r = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), o = q(e), a =
|
|
4415
|
+
} = n, r = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), o = q(e), a = lt(e), c = J(e) === "y", h = ["left", "top"].includes(o) ? -1 : 1, f = r && c ? -1 : 1, d = at(t, n);
|
|
4415
4416
|
let {
|
|
4416
4417
|
mainAxis: x,
|
|
4417
4418
|
crossAxis: u,
|
|
@@ -4425,11 +4426,11 @@ async function Ii(n, t) {
|
|
|
4425
4426
|
crossAxis: d.crossAxis || 0,
|
|
4426
4427
|
alignmentAxis: d.alignmentAxis
|
|
4427
4428
|
};
|
|
4428
|
-
return a && typeof g == "number" && (u = a === "end" ? g * -1 : g),
|
|
4429
|
+
return a && typeof g == "number" && (u = a === "end" ? g * -1 : g), c ? {
|
|
4429
4430
|
x: u * f,
|
|
4430
|
-
y: x *
|
|
4431
|
+
y: x * h
|
|
4431
4432
|
} : {
|
|
4432
|
-
x: x *
|
|
4433
|
+
x: x * h,
|
|
4433
4434
|
y: u * f
|
|
4434
4435
|
};
|
|
4435
4436
|
}
|
|
@@ -4444,12 +4445,12 @@ const Oi = function(n) {
|
|
|
4444
4445
|
y: r,
|
|
4445
4446
|
placement: o,
|
|
4446
4447
|
middlewareData: a
|
|
4447
|
-
} = t,
|
|
4448
|
+
} = t, c = await Ii(t, n);
|
|
4448
4449
|
return o === ((e = a.offset) == null ? void 0 : e.placement) && (i = a.arrow) != null && i.alignmentOffset ? {} : {
|
|
4449
|
-
x: s +
|
|
4450
|
-
y: r +
|
|
4450
|
+
x: s + c.x,
|
|
4451
|
+
y: r + c.y,
|
|
4451
4452
|
data: {
|
|
4452
|
-
...
|
|
4453
|
+
...c,
|
|
4453
4454
|
placement: o
|
|
4454
4455
|
}
|
|
4455
4456
|
};
|
|
@@ -4479,12 +4480,12 @@ const Oi = function(n) {
|
|
|
4479
4480
|
};
|
|
4480
4481
|
}
|
|
4481
4482
|
},
|
|
4482
|
-
...
|
|
4483
|
-
} = at(n, t),
|
|
4483
|
+
...c
|
|
4484
|
+
} = at(n, t), h = {
|
|
4484
4485
|
x: e,
|
|
4485
4486
|
y: i
|
|
4486
|
-
}, f = await
|
|
4487
|
-
let u =
|
|
4487
|
+
}, f = await he(t, c), d = J(q(s)), x = le(d);
|
|
4488
|
+
let u = h[x], g = h[d];
|
|
4488
4489
|
if (r) {
|
|
4489
4490
|
const p = x === "y" ? "top" : "left", y = x === "y" ? "bottom" : "right", b = u + f[p], m = u - f[y];
|
|
4490
4491
|
u = It(b, u, m);
|
|
@@ -4538,7 +4539,7 @@ function N(n) {
|
|
|
4538
4539
|
function jt(n) {
|
|
4539
4540
|
return !gt() || typeof ShadowRoot > "u" ? !1 : n instanceof ShadowRoot || n instanceof H(n).ShadowRoot;
|
|
4540
4541
|
}
|
|
4541
|
-
function
|
|
4542
|
+
function ct(n) {
|
|
4542
4543
|
const {
|
|
4543
4544
|
overflow: t,
|
|
4544
4545
|
overflowX: e,
|
|
@@ -4606,7 +4607,7 @@ function z(n) {
|
|
|
4606
4607
|
}
|
|
4607
4608
|
function fe(n) {
|
|
4608
4609
|
const t = z(n);
|
|
4609
|
-
return Q(t) ? n.ownerDocument ? n.ownerDocument.body : n.body : N(t) &&
|
|
4610
|
+
return Q(t) ? n.ownerDocument ? n.ownerDocument.body : n.body : N(t) && ct(t) ? t : fe(t);
|
|
4610
4611
|
}
|
|
4611
4612
|
function Tt(n, t, e) {
|
|
4612
4613
|
var i;
|
|
@@ -4614,7 +4615,7 @@ function Tt(n, t, e) {
|
|
|
4614
4615
|
const s = fe(n), r = s === ((i = n.ownerDocument) == null ? void 0 : i.body), o = H(s);
|
|
4615
4616
|
if (r) {
|
|
4616
4617
|
const a = St(o);
|
|
4617
|
-
return t.concat(o, o.visualViewport || [],
|
|
4618
|
+
return t.concat(o, o.visualViewport || [], ct(s) ? s : [], a && e ? Tt(a) : []);
|
|
4618
4619
|
}
|
|
4619
4620
|
return t.concat(s, Tt(s, [], e));
|
|
4620
4621
|
}
|
|
@@ -4666,20 +4667,20 @@ function ot(n, t, e, i) {
|
|
|
4666
4667
|
let o = V(1);
|
|
4667
4668
|
t && (i ? X(i) && (o = Z(i)) : o = Z(n));
|
|
4668
4669
|
const a = Mi(r, e, i) ? ge(r) : V(0);
|
|
4669
|
-
let
|
|
4670
|
+
let c = (s.left + a.x) / o.x, h = (s.top + a.y) / o.y, f = s.width / o.x, d = s.height / o.y;
|
|
4670
4671
|
if (r) {
|
|
4671
4672
|
const x = H(r), u = i && X(i) ? H(i) : i;
|
|
4672
4673
|
let g = x, w = St(g);
|
|
4673
4674
|
for (; w && i && u !== g; ) {
|
|
4674
4675
|
const p = Z(w), y = w.getBoundingClientRect(), b = F(w), m = y.left + (w.clientLeft + parseFloat(b.paddingLeft)) * p.x, E = y.top + (w.clientTop + parseFloat(b.paddingTop)) * p.y;
|
|
4675
|
-
|
|
4676
|
+
c *= p.x, h *= p.y, f *= p.x, d *= p.y, c += m, h += E, g = H(w), w = St(g);
|
|
4676
4677
|
}
|
|
4677
4678
|
}
|
|
4678
4679
|
return ut({
|
|
4679
4680
|
width: f,
|
|
4680
4681
|
height: d,
|
|
4681
|
-
x:
|
|
4682
|
-
y:
|
|
4682
|
+
x: c,
|
|
4683
|
+
y: h
|
|
4683
4684
|
});
|
|
4684
4685
|
}
|
|
4685
4686
|
function Hi(n) {
|
|
@@ -4692,20 +4693,20 @@ function Hi(n) {
|
|
|
4692
4693
|
const r = s === "fixed", o = K(i), a = t ? wt(t.floating) : !1;
|
|
4693
4694
|
if (i === o || a && r)
|
|
4694
4695
|
return e;
|
|
4695
|
-
let
|
|
4696
|
+
let c = {
|
|
4696
4697
|
scrollLeft: 0,
|
|
4697
4698
|
scrollTop: 0
|
|
4698
|
-
},
|
|
4699
|
+
}, h = V(1);
|
|
4699
4700
|
const f = V(0), d = N(i);
|
|
4700
|
-
if ((d || !d && !r) && ((tt(i) !== "body" ||
|
|
4701
|
+
if ((d || !d && !r) && ((tt(i) !== "body" || ct(o)) && (c = pt(i)), N(i))) {
|
|
4701
4702
|
const x = ot(i);
|
|
4702
|
-
|
|
4703
|
+
h = Z(i), f.x = x.x + i.clientLeft, f.y = x.y + i.clientTop;
|
|
4703
4704
|
}
|
|
4704
4705
|
return {
|
|
4705
|
-
width: e.width *
|
|
4706
|
-
height: e.height *
|
|
4707
|
-
x: e.x *
|
|
4708
|
-
y: e.y *
|
|
4706
|
+
width: e.width * h.x,
|
|
4707
|
+
height: e.height * h.y,
|
|
4708
|
+
x: e.x * h.x - c.scrollLeft * h.x + f.x,
|
|
4709
|
+
y: e.y * h.y - c.scrollTop * h.y + f.y
|
|
4709
4710
|
};
|
|
4710
4711
|
}
|
|
4711
4712
|
function Di(n) {
|
|
@@ -4728,26 +4729,26 @@ function Xi(n) {
|
|
|
4728
4729
|
}
|
|
4729
4730
|
function Fi(n, t) {
|
|
4730
4731
|
const e = H(n), i = K(n), s = e.visualViewport;
|
|
4731
|
-
let r = i.clientWidth, o = i.clientHeight, a = 0,
|
|
4732
|
+
let r = i.clientWidth, o = i.clientHeight, a = 0, c = 0;
|
|
4732
4733
|
if (s) {
|
|
4733
4734
|
r = s.width, o = s.height;
|
|
4734
|
-
const
|
|
4735
|
-
(!
|
|
4735
|
+
const h = Dt();
|
|
4736
|
+
(!h || h && t === "fixed") && (a = s.offsetLeft, c = s.offsetTop);
|
|
4736
4737
|
}
|
|
4737
4738
|
return {
|
|
4738
4739
|
width: r,
|
|
4739
4740
|
height: o,
|
|
4740
4741
|
x: a,
|
|
4741
|
-
y:
|
|
4742
|
+
y: c
|
|
4742
4743
|
};
|
|
4743
4744
|
}
|
|
4744
4745
|
function ki(n, t) {
|
|
4745
|
-
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,
|
|
4746
|
+
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, c = s * r.x, h = i * r.y;
|
|
4746
4747
|
return {
|
|
4747
4748
|
width: o,
|
|
4748
4749
|
height: a,
|
|
4749
|
-
x:
|
|
4750
|
-
y:
|
|
4750
|
+
x: c,
|
|
4751
|
+
y: h
|
|
4751
4752
|
};
|
|
4752
4753
|
}
|
|
4753
4754
|
function Ut(n, t, e) {
|
|
@@ -4780,8 +4781,8 @@ function Ni(n, t) {
|
|
|
4780
4781
|
const r = F(n).position === "fixed";
|
|
4781
4782
|
let o = r ? z(n) : n;
|
|
4782
4783
|
for (; X(o) && !Q(o); ) {
|
|
4783
|
-
const a = F(o),
|
|
4784
|
-
!
|
|
4784
|
+
const a = F(o), c = Ht(o);
|
|
4785
|
+
!c && a.position === "fixed" && (s = null), (r ? !c && !s : !c && a.position === "static" && !!s && ["absolute", "fixed"].includes(s.position) || ct(o) && !c && we(n, o)) ? i = i.filter((f) => f !== o) : s = a, o = z(o);
|
|
4785
4786
|
}
|
|
4786
4787
|
return t.set(n, i), i;
|
|
4787
4788
|
}
|
|
@@ -4792,15 +4793,15 @@ function Yi(n) {
|
|
|
4792
4793
|
rootBoundary: i,
|
|
4793
4794
|
strategy: s
|
|
4794
4795
|
} = n;
|
|
4795
|
-
const o = [...e === "clippingAncestors" ? wt(t) ? [] : Ni(t, this._c) : [].concat(e), i], a = o[0],
|
|
4796
|
+
const o = [...e === "clippingAncestors" ? wt(t) ? [] : Ni(t, this._c) : [].concat(e), i], a = o[0], c = o.reduce((h, f) => {
|
|
4796
4797
|
const d = Ut(t, f, s);
|
|
4797
|
-
return
|
|
4798
|
+
return h.top = U(d.top, h.top), h.right = rt(d.right, h.right), h.bottom = rt(d.bottom, h.bottom), h.left = U(d.left, h.left), h;
|
|
4798
4799
|
}, Ut(t, a, s));
|
|
4799
4800
|
return {
|
|
4800
|
-
width:
|
|
4801
|
-
height:
|
|
4802
|
-
x:
|
|
4803
|
-
y:
|
|
4801
|
+
width: c.right - c.left,
|
|
4802
|
+
height: c.bottom - c.top,
|
|
4803
|
+
x: c.left,
|
|
4804
|
+
y: c.top
|
|
4804
4805
|
};
|
|
4805
4806
|
}
|
|
4806
4807
|
function Ki(n) {
|
|
@@ -4819,19 +4820,19 @@ function Bi(n, t, e) {
|
|
|
4819
4820
|
scrollLeft: 0,
|
|
4820
4821
|
scrollTop: 0
|
|
4821
4822
|
};
|
|
4822
|
-
const
|
|
4823
|
+
const c = V(0);
|
|
4823
4824
|
if (i || !i && !r)
|
|
4824
|
-
if ((tt(t) !== "body" ||
|
|
4825
|
+
if ((tt(t) !== "body" || ct(s)) && (a = pt(t)), i) {
|
|
4825
4826
|
const u = ot(t, !0, r, t);
|
|
4826
|
-
|
|
4827
|
-
} else s && (
|
|
4828
|
-
let
|
|
4827
|
+
c.x = u.x + t.clientLeft, c.y = u.y + t.clientTop;
|
|
4828
|
+
} else s && (c.x = At(s));
|
|
4829
|
+
let h = 0, f = 0;
|
|
4829
4830
|
if (s && !i && !r) {
|
|
4830
4831
|
const u = s.getBoundingClientRect();
|
|
4831
|
-
f = u.top + a.scrollTop,
|
|
4832
|
+
f = u.top + a.scrollTop, h = u.left + a.scrollLeft - // RTL <body> scrollbar.
|
|
4832
4833
|
At(s, u);
|
|
4833
4834
|
}
|
|
4834
|
-
const d = o.left + a.scrollLeft -
|
|
4835
|
+
const d = o.left + a.scrollLeft - c.x - h, x = o.top + a.scrollTop - c.y - f;
|
|
4835
4836
|
return {
|
|
4836
4837
|
x: d,
|
|
4837
4838
|
y: x,
|
|
@@ -4909,11 +4910,11 @@ const Vi = {
|
|
|
4909
4910
|
};
|
|
4910
4911
|
let $i = class {
|
|
4911
4912
|
constructor(t) {
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4913
|
+
l(this, "ctx");
|
|
4914
|
+
l(this, "enable", !1);
|
|
4915
|
+
l(this, "contentEl");
|
|
4916
|
+
l(this, "floatingEl");
|
|
4917
|
+
l(this, "arrowEl");
|
|
4917
4918
|
this.ctx = t;
|
|
4918
4919
|
const { TOOLTIP_BG_COLOR: e, TOOLTIP_TEXT_COLOR: i, TOOLTIP_ZINDEX: s, TOOLTIP_CUSTOM_STYLE: r, CSS_PREFIX: o } = this.ctx.config;
|
|
4919
4920
|
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`;
|
|
@@ -4928,7 +4929,7 @@ let $i = class {
|
|
|
4928
4929
|
borderRadius: "4px",
|
|
4929
4930
|
fontSize: "12px",
|
|
4930
4931
|
...r
|
|
4931
|
-
},
|
|
4932
|
+
}, c = {
|
|
4932
4933
|
position: "absolute",
|
|
4933
4934
|
width: "10px",
|
|
4934
4935
|
height: "10px",
|
|
@@ -4937,7 +4938,7 @@ let $i = class {
|
|
|
4937
4938
|
transform: "rotate(45deg)",
|
|
4938
4939
|
zIndex: a.zIndex
|
|
4939
4940
|
};
|
|
4940
|
-
Object.assign(this.arrowEl.style,
|
|
4941
|
+
Object.assign(this.arrowEl.style, c), Object.assign(this.floatingEl.style, a), this.floatingEl.appendChild(this.contentEl), this.floatingEl.appendChild(this.arrowEl), this.ctx.containerElement.appendChild(this.floatingEl), this.init();
|
|
4941
4942
|
}
|
|
4942
4943
|
init() {
|
|
4943
4944
|
this.ctx.on("mousemove", (t) => {
|
|
@@ -4981,10 +4982,10 @@ let $i = class {
|
|
|
4981
4982
|
placement: t.overflowTooltipPlacement,
|
|
4982
4983
|
middleware: [Ft(), kt(), Xt(6), zi({ element: this.arrowEl })]
|
|
4983
4984
|
}).then((a) => {
|
|
4984
|
-
const { x:
|
|
4985
|
+
const { x: c, y: h, placement: f, middlewareData: d } = a;
|
|
4985
4986
|
if (Object.assign(this.floatingEl.style, {
|
|
4986
|
-
top: `${
|
|
4987
|
-
left: `${
|
|
4987
|
+
top: `${h}px`,
|
|
4988
|
+
left: `${c}px`
|
|
4988
4989
|
}), d.arrow) {
|
|
4989
4990
|
const x = d.arrow;
|
|
4990
4991
|
["left", "left-start", "left-end"].includes(f) ? Object.assign(this.arrowEl.style, {
|
|
@@ -5020,11 +5021,11 @@ let $i = class {
|
|
|
5020
5021
|
};
|
|
5021
5022
|
class qi {
|
|
5022
5023
|
constructor(t) {
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5024
|
+
l(this, "editorEl");
|
|
5025
|
+
l(this, "inputEl");
|
|
5026
|
+
l(this, "enable", !1);
|
|
5027
|
+
l(this, "cellTarget", null);
|
|
5028
|
+
l(this, "ctx");
|
|
5028
5029
|
this.ctx = t, this.initTextEditor(), this.init();
|
|
5029
5030
|
}
|
|
5030
5031
|
init() {
|
|
@@ -5087,49 +5088,53 @@ class qi {
|
|
|
5087
5088
|
}
|
|
5088
5089
|
}), this.inputEl.addEventListener("input", this.autoSize.bind(this)), this.inputEl.addEventListener("blur", () => {
|
|
5089
5090
|
this.doneEdit();
|
|
5090
|
-
}), this.editorEl =
|
|
5091
|
+
}), this.editorEl = this.ctx.editorElement, this.inputEl.className = "e-virt-table-editor-textarea", this.editorEl.appendChild(this.inputEl), this.ctx.containerElement.appendChild(this.editorEl);
|
|
5091
5092
|
}
|
|
5092
5093
|
autoSize() {
|
|
5093
5094
|
const t = this.inputEl.scrollHeight;
|
|
5094
5095
|
this.inputEl.style.height = "auto", this.inputEl.style.height = `${t}px`;
|
|
5095
5096
|
}
|
|
5096
5097
|
startEditByInput(t) {
|
|
5097
|
-
if (t.editorType !== "text")
|
|
5098
|
-
return;
|
|
5099
5098
|
const e = t.getValue(), { width: i } = t, s = t.getDrawX();
|
|
5100
5099
|
let r = t.getDrawY(), { height: o } = t;
|
|
5101
5100
|
const {
|
|
5102
5101
|
config: { CELL_PADDING: a }
|
|
5103
5102
|
} = this.ctx;
|
|
5104
|
-
let
|
|
5105
|
-
|
|
5106
|
-
const
|
|
5107
|
-
this.inputEl.setSelectionRange(l, l);
|
|
5108
|
-
const { left: f, top: d } = this.ctx.containerElement.getBoundingClientRect(), x = {
|
|
5103
|
+
let c = window.innerHeight / 2;
|
|
5104
|
+
c > this.ctx.body.visibleHeight && (c = this.ctx.body.visibleHeight);
|
|
5105
|
+
const { left: h, top: f } = this.ctx.containerElement.getBoundingClientRect(), d = f + r - 1.5, x = h + s - 1.5, u = {
|
|
5109
5106
|
getBoundingClientRect: () => ({
|
|
5107
|
+
x: 0,
|
|
5108
|
+
y: 0,
|
|
5110
5109
|
width: 0,
|
|
5111
5110
|
height: 0,
|
|
5112
|
-
top: d
|
|
5113
|
-
left:
|
|
5114
|
-
right:
|
|
5115
|
-
bottom:
|
|
5116
|
-
x: s,
|
|
5117
|
-
y: r
|
|
5111
|
+
top: d,
|
|
5112
|
+
left: x,
|
|
5113
|
+
right: 0,
|
|
5114
|
+
bottom: 0
|
|
5118
5115
|
}),
|
|
5119
5116
|
contextElement: document.body
|
|
5120
5117
|
};
|
|
5121
|
-
Nt(
|
|
5118
|
+
if (Nt(u, this.editorEl, {
|
|
5122
5119
|
placement: "right-start",
|
|
5123
5120
|
middleware: [Xt(), Ft(), kt()]
|
|
5124
|
-
}).then(({ x:
|
|
5125
|
-
this.editorEl.style.left = `${
|
|
5126
|
-
}),
|
|
5121
|
+
}).then(({ x: g, y: w }) => {
|
|
5122
|
+
this.editorEl.style.left = `${g}px`, this.editorEl.style.top = `${w}px`;
|
|
5123
|
+
}), t.editorType !== "text") {
|
|
5124
|
+
this.inputEl.style.display = "none";
|
|
5125
|
+
return;
|
|
5126
|
+
}
|
|
5127
|
+
this.inputEl.style.display = "block", this.inputEl.style.minWidth = `${i - 1}px`, this.inputEl.style.minHeight = `${o - 1}px`, this.inputEl.style.maxHeight = `${c}px`, this.inputEl.style.width = `${i - 1}px`, this.inputEl.style.height = `${o - 1}px`, this.inputEl.style.padding = `${a}px`, e !== null && (this.inputEl.value = e), requestAnimationFrame(() => {
|
|
5128
|
+
this.inputEl.focus();
|
|
5129
|
+
const g = this.inputEl.value.length;
|
|
5130
|
+
this.inputEl.setSelectionRange(g, g), this.inputEl.scrollHeight > o && this.autoSize();
|
|
5131
|
+
});
|
|
5127
5132
|
}
|
|
5128
5133
|
doneEditByInput() {
|
|
5129
|
-
if (!this.cellTarget || this.cellTarget.editorType !== "text")
|
|
5134
|
+
if (!this.cellTarget || (this.editorEl.style.left = "-10000px", this.editorEl.style.top = "-10000px", this.cellTarget.editorType !== "text"))
|
|
5130
5135
|
return;
|
|
5131
5136
|
const { rowKey: t, key: e } = this.cellTarget, i = this.cellTarget.getValue(), s = this.inputEl.value;
|
|
5132
|
-
s !== i && !(s === "" && i === null) && this.ctx.database.setItemValue(t, e, s, !0, !0, !0), this.inputEl.value = ""
|
|
5137
|
+
s !== i && !(s === "" && i === null) && this.ctx.database.setItemValue(t, e, s, !0, !0, !0), this.inputEl.value = "";
|
|
5133
5138
|
}
|
|
5134
5139
|
startEdit() {
|
|
5135
5140
|
const { ENABLE_EDIT_CLICK_SELECTOR: t } = this.ctx.config;
|
|
@@ -5142,18 +5147,18 @@ class qi {
|
|
|
5142
5147
|
e && !r && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = e, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
5143
5148
|
}
|
|
5144
5149
|
editCell(t, e) {
|
|
5145
|
-
const i = this.ctx.body.renderRows.find((
|
|
5150
|
+
const i = this.ctx.body.renderRows.find((h) => h.rowIndex === t);
|
|
5146
5151
|
if (!i)
|
|
5147
5152
|
return;
|
|
5148
|
-
const s = i.cells.find((
|
|
5153
|
+
const s = i.cells.find((h) => h.colIndex === e);
|
|
5149
5154
|
if (!s)
|
|
5150
5155
|
return;
|
|
5151
5156
|
this.ctx.emit("setSelectorCell", s);
|
|
5152
5157
|
const r = this.ctx.focusCell;
|
|
5153
5158
|
if (!r || ["index", "index-selection", "selection"].includes(r.type) || this.enable)
|
|
5154
5159
|
return;
|
|
5155
|
-
const { rowKey: o, key: a } = r,
|
|
5156
|
-
r && !
|
|
5160
|
+
const { rowKey: o, key: a } = r, c = this.ctx.database.getReadonly(o, a);
|
|
5161
|
+
r && !c && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = r, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
5157
5162
|
}
|
|
5158
5163
|
doneEdit() {
|
|
5159
5164
|
this.enable && this.cellTarget && (this.ctx.emit("doneEdit", this.cellTarget), this.doneEditByInput(), this.enable = !1, this.ctx.stageElement.focus(), this.ctx.editing = !1, this.cellTarget = null, this.ctx.emit("draw"));
|
|
@@ -5165,14 +5170,14 @@ class qi {
|
|
|
5165
5170
|
}
|
|
5166
5171
|
class Gi {
|
|
5167
5172
|
constructor(t) {
|
|
5168
|
-
|
|
5169
|
-
|
|
5173
|
+
l(this, "ctx");
|
|
5174
|
+
l(this, "emptyEl");
|
|
5170
5175
|
this.ctx = t;
|
|
5171
5176
|
const { EMPTY_TEXT: e, EMPTY_CUSTOM: i, EMPTY_CUSTOM_STYLE: s, CSS_PREFIX: r } = this.ctx.config;
|
|
5172
|
-
this.emptyEl = document.createElement("div"), this.emptyEl.className = `${r}-empty`, this.emptyEl.style.display = "none", this.emptyEl.innerText = e, this.ctx.containerElement.appendChild(this.emptyEl), this.ctx.on("emptyChange", ({ type: o, headerHeight: a, bodyHeight:
|
|
5177
|
+
this.emptyEl = document.createElement("div"), this.emptyEl.className = `${r}-empty`, this.emptyEl.style.display = "none", this.emptyEl.innerText = e, this.ctx.containerElement.appendChild(this.emptyEl), this.ctx.on("emptyChange", ({ type: o, headerHeight: a, bodyHeight: c, footerHeight: h }) => {
|
|
5173
5178
|
if (i)
|
|
5174
5179
|
return;
|
|
5175
|
-
const f = a + (
|
|
5180
|
+
const f = a + (c + h) / 2, d = {
|
|
5176
5181
|
display: o === "empty" ? "block" : "none",
|
|
5177
5182
|
position: "absolute",
|
|
5178
5183
|
fontSize: "14px",
|
|
@@ -5191,7 +5196,7 @@ class Gi {
|
|
|
5191
5196
|
}
|
|
5192
5197
|
class ji {
|
|
5193
5198
|
constructor(t) {
|
|
5194
|
-
|
|
5199
|
+
l(this, "ctx");
|
|
5195
5200
|
this.ctx = t;
|
|
5196
5201
|
}
|
|
5197
5202
|
draw() {
|
|
@@ -5209,10 +5214,10 @@ class ji {
|
|
|
5209
5214
|
stageWidth: t,
|
|
5210
5215
|
stageHeight: e,
|
|
5211
5216
|
config: { SCROLLER_TRACK_SIZE: i }
|
|
5212
|
-
} = this.ctx, s = t - i, r = e - i, o = this.getHeader(), a = this.getBody(),
|
|
5213
|
-
let
|
|
5217
|
+
} = this.ctx, s = t - i, r = e - i, o = this.getHeader(), a = this.getBody(), c = this.getFooter();
|
|
5218
|
+
let h = [o, a, c];
|
|
5214
5219
|
const { FOOTER_FIXED: f } = this.ctx.config;
|
|
5215
|
-
return f || (
|
|
5220
|
+
return f || (h = [o, a]), {
|
|
5216
5221
|
style: {
|
|
5217
5222
|
position: "absolute",
|
|
5218
5223
|
left: "0px",
|
|
@@ -5224,7 +5229,7 @@ class ji {
|
|
|
5224
5229
|
zIndex: 10
|
|
5225
5230
|
},
|
|
5226
5231
|
class: "e-virt-table-overlayer",
|
|
5227
|
-
views:
|
|
5232
|
+
views: h
|
|
5228
5233
|
};
|
|
5229
5234
|
}
|
|
5230
5235
|
getHeader() {
|
|
@@ -5233,9 +5238,9 @@ class ji {
|
|
|
5233
5238
|
fixedRightWidth: e,
|
|
5234
5239
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
5235
5240
|
} = this.ctx, { visibleWidth: r, visibleHeight: o, renderCellHeaders: a } = this.ctx.header;
|
|
5236
|
-
let
|
|
5241
|
+
let c = [], h = [], f = [];
|
|
5237
5242
|
a.forEach((p) => {
|
|
5238
|
-
p.render && (p.fixed === "left" ?
|
|
5243
|
+
p.render && (p.fixed === "left" ? h.push(p) : p.fixed === "right" ? f.push(p) : c.push(p));
|
|
5239
5244
|
});
|
|
5240
5245
|
const d = e - i, x = {
|
|
5241
5246
|
key: "left",
|
|
@@ -5247,7 +5252,7 @@ class ji {
|
|
|
5247
5252
|
width: `${t}px`,
|
|
5248
5253
|
height: `${o}px`
|
|
5249
5254
|
},
|
|
5250
|
-
cells:
|
|
5255
|
+
cells: h
|
|
5251
5256
|
}, u = {
|
|
5252
5257
|
key: "center",
|
|
5253
5258
|
style: {
|
|
@@ -5258,7 +5263,7 @@ class ji {
|
|
|
5258
5263
|
width: `${r - t - d + 1}px`,
|
|
5259
5264
|
height: `${o}px`
|
|
5260
5265
|
},
|
|
5261
|
-
cells:
|
|
5266
|
+
cells: c
|
|
5262
5267
|
}, g = {
|
|
5263
5268
|
key: "right",
|
|
5264
5269
|
style: {
|
|
@@ -5294,8 +5299,8 @@ class ji {
|
|
|
5294
5299
|
const {
|
|
5295
5300
|
fixedLeftWidth: r,
|
|
5296
5301
|
fixedRightWidth: o,
|
|
5297
|
-
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX:
|
|
5298
|
-
} = this.ctx, { visibleWidth:
|
|
5302
|
+
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX: c }
|
|
5303
|
+
} = this.ctx, { visibleWidth: h, visibleHeight: f } = this.ctx.body, d = o - a, x = {
|
|
5299
5304
|
key: "left",
|
|
5300
5305
|
style: {
|
|
5301
5306
|
position: "absolute",
|
|
@@ -5313,7 +5318,7 @@ class ji {
|
|
|
5313
5318
|
top: `${0.5}px`,
|
|
5314
5319
|
left: `${r - 0.5}px`,
|
|
5315
5320
|
overflow: "hidden",
|
|
5316
|
-
width: `${
|
|
5321
|
+
width: `${h - r - d}px`,
|
|
5317
5322
|
height: `${f}px`
|
|
5318
5323
|
},
|
|
5319
5324
|
cells: t
|
|
@@ -5331,11 +5336,11 @@ class ji {
|
|
|
5331
5336
|
};
|
|
5332
5337
|
return {
|
|
5333
5338
|
type: "body",
|
|
5334
|
-
class: `${
|
|
5339
|
+
class: `${c}-overlayer-body`,
|
|
5335
5340
|
style: {
|
|
5336
5341
|
position: "relative",
|
|
5337
5342
|
overflow: "hidden",
|
|
5338
|
-
width: `${
|
|
5343
|
+
width: `${h}px`,
|
|
5339
5344
|
height: `${f}px`
|
|
5340
5345
|
},
|
|
5341
5346
|
views: [x, u, g]
|
|
@@ -5352,7 +5357,7 @@ class ji {
|
|
|
5352
5357
|
fixedLeftWidth: s,
|
|
5353
5358
|
fixedRightWidth: r,
|
|
5354
5359
|
config: { SCROLLER_TRACK_SIZE: o, CSS_PREFIX: a }
|
|
5355
|
-
} = this.ctx, { visibleWidth:
|
|
5360
|
+
} = this.ctx, { visibleWidth: c, visibleHeight: h } = this.ctx.footer, f = r - o, d = {
|
|
5356
5361
|
key: "left",
|
|
5357
5362
|
style: {
|
|
5358
5363
|
position: "absolute",
|
|
@@ -5360,7 +5365,7 @@ class ji {
|
|
|
5360
5365
|
left: `${0.5}px`,
|
|
5361
5366
|
overflow: "hidden",
|
|
5362
5367
|
width: `${s}px`,
|
|
5363
|
-
height: `${
|
|
5368
|
+
height: `${h}px`
|
|
5364
5369
|
},
|
|
5365
5370
|
cells: e
|
|
5366
5371
|
}, x = {
|
|
@@ -5370,8 +5375,8 @@ class ji {
|
|
|
5370
5375
|
top: `${0.5}px`,
|
|
5371
5376
|
left: `${s - 0.5}px`,
|
|
5372
5377
|
overflow: "hidden",
|
|
5373
|
-
width: `${
|
|
5374
|
-
height: `${
|
|
5378
|
+
width: `${c - s - f}px`,
|
|
5379
|
+
height: `${h}px`
|
|
5375
5380
|
},
|
|
5376
5381
|
cells: t
|
|
5377
5382
|
}, u = {
|
|
@@ -5382,7 +5387,7 @@ class ji {
|
|
|
5382
5387
|
right: `${0.5}px`,
|
|
5383
5388
|
overflow: "hidden",
|
|
5384
5389
|
width: `${f}px`,
|
|
5385
|
-
height: `${
|
|
5390
|
+
height: `${h}px`
|
|
5386
5391
|
},
|
|
5387
5392
|
cells: i
|
|
5388
5393
|
};
|
|
@@ -5392,8 +5397,8 @@ class ji {
|
|
|
5392
5397
|
style: {
|
|
5393
5398
|
position: "relative",
|
|
5394
5399
|
overflow: "hidden",
|
|
5395
|
-
width: `${
|
|
5396
|
-
height: `${
|
|
5400
|
+
width: `${c}px`,
|
|
5401
|
+
height: `${h}px`
|
|
5397
5402
|
},
|
|
5398
5403
|
views: [d, x, u]
|
|
5399
5404
|
};
|
|
@@ -5401,16 +5406,16 @@ class ji {
|
|
|
5401
5406
|
}
|
|
5402
5407
|
class Ui {
|
|
5403
5408
|
constructor(t) {
|
|
5404
|
-
|
|
5405
|
-
|
|
5409
|
+
l(this, "ctx");
|
|
5410
|
+
l(this, "contextMenuEl");
|
|
5406
5411
|
this.ctx = t, this.contextMenuEl = document.createElement("div"), this.createContextMenu(), this.init();
|
|
5407
5412
|
}
|
|
5408
5413
|
init() {
|
|
5409
5414
|
this.ctx.on("cellContextMenuClick", (t, e) => {
|
|
5410
5415
|
if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
|
|
5411
5416
|
e.preventDefault();
|
|
5412
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [a,
|
|
5413
|
-
|
|
5417
|
+
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [a, c] = s, { rowIndex: h, colIndex: f } = t;
|
|
5418
|
+
h >= a && h <= c && f >= r && f <= o || this.ctx.emit("setSelectorCell", t, e);
|
|
5414
5419
|
const x = {
|
|
5415
5420
|
getBoundingClientRect: () => ({
|
|
5416
5421
|
width: 0,
|
|
@@ -5484,35 +5489,38 @@ class Ui {
|
|
|
5484
5489
|
}
|
|
5485
5490
|
class Qi {
|
|
5486
5491
|
constructor(t, e) {
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5492
|
+
l(this, "options");
|
|
5493
|
+
l(this, "scroller");
|
|
5494
|
+
l(this, "header");
|
|
5495
|
+
l(this, "body");
|
|
5496
|
+
l(this, "footer");
|
|
5497
|
+
l(this, "selector");
|
|
5498
|
+
l(this, "autofill");
|
|
5499
|
+
l(this, "tooltip");
|
|
5500
|
+
l(this, "editor");
|
|
5501
|
+
l(this, "empty");
|
|
5502
|
+
l(this, "overlayer");
|
|
5503
|
+
l(this, "contextMenu");
|
|
5504
|
+
l(this, "ctx");
|
|
5500
5505
|
this.options = e;
|
|
5501
|
-
const { overlayerElement: i } = e,
|
|
5502
|
-
this.ctx = new
|
|
5506
|
+
const { overlayerElement: i, editorElement: s } = e, r = this.createContainer(t, i, s);
|
|
5507
|
+
this.ctx = new ci(r, this.options), this.header = new di(this.ctx), this.body = new fi(this.ctx), this.footer = new xi(this.ctx), this.scroller = new hi(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", () => {
|
|
5503
5508
|
this.draw();
|
|
5504
5509
|
}), this.ctx.on("drawView", () => {
|
|
5505
5510
|
this.draw(!0);
|
|
5506
5511
|
}), this.draw();
|
|
5507
5512
|
}
|
|
5508
|
-
createContainer(t, e) {
|
|
5513
|
+
createContainer(t, e, i) {
|
|
5509
5514
|
t.className = "e-virt-table-container";
|
|
5510
|
-
const
|
|
5511
|
-
|
|
5515
|
+
const s = document.createElement("div"), r = document.createElement("canvas"), o = e || document.createElement("div");
|
|
5516
|
+
s.className = "e-virt-table-stage", r.className = "e-virt-table-canvas", o.className = "e-virt-table-overlayer";
|
|
5517
|
+
const a = i || document.createElement("div");
|
|
5518
|
+
return a.className = "e-virt-table-editor", s.appendChild(r), s.appendChild(o), t.appendChild(s), {
|
|
5512
5519
|
containerElement: t,
|
|
5513
|
-
stageElement:
|
|
5514
|
-
canvasElement:
|
|
5515
|
-
overlayerElement:
|
|
5520
|
+
stageElement: s,
|
|
5521
|
+
canvasElement: r,
|
|
5522
|
+
overlayerElement: o,
|
|
5523
|
+
editorElement: a
|
|
5516
5524
|
};
|
|
5517
5525
|
}
|
|
5518
5526
|
draw(t = !1) {
|
|
@@ -5577,8 +5585,8 @@ class Qi {
|
|
|
5577
5585
|
if (t && Array.isArray(s) && s.length) {
|
|
5578
5586
|
const [r] = s;
|
|
5579
5587
|
if (Array.isArray(r) && r.length) {
|
|
5580
|
-
const [o] = r, { rowKey: a, key:
|
|
5581
|
-
this.scrollToRowkey(a), this.scrollToColkey(
|
|
5588
|
+
const [o] = r, { rowKey: a, key: c } = o;
|
|
5589
|
+
this.scrollToRowkey(a), this.scrollToColkey(c);
|
|
5582
5590
|
}
|
|
5583
5591
|
}
|
|
5584
5592
|
i(s);
|
|
@@ -5603,7 +5611,7 @@ class Qi {
|
|
|
5603
5611
|
let r = [];
|
|
5604
5612
|
for (let o = 0; o < i.length; o++)
|
|
5605
5613
|
for (let a = 0; a < s.length; a++) {
|
|
5606
|
-
const
|
|
5614
|
+
const c = this.ctx.database.getRowKeyByItem(i[o]), f = s[a].key, d = await this.ctx.database.getValidator(c, f);
|
|
5607
5615
|
Array.isArray(d) && d.length && r.push(d);
|
|
5608
5616
|
}
|
|
5609
5617
|
r.length ? (e(r), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
|