e-virt-table 0.1.19 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +729 -728
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Cell.d.ts +1 -1
- package/dist/lib/Cell.js.map +1 -1
- package/dist/lib/CellHeader.d.ts +1 -0
- package/dist/lib/CellHeader.js +6 -0
- package/dist/lib/CellHeader.js.map +1 -1
- package/dist/lib/Editor.js +4 -3
- package/dist/lib/Editor.js.map +1 -1
- package/dist/lib/History.d.ts +2 -2
- package/dist/lib/History.js +8 -6
- package/dist/lib/History.js.map +1 -1
- package/dist/lib/Scroller.js +1 -0
- package/dist/lib/Scroller.js.map +1 -1
- package/dist/lib/Selector.js +7 -1
- package/dist/lib/Selector.js.map +1 -1
- package/dist/lib/Tooltip.js +1 -0
- package/dist/lib/Tooltip.js.map +1 -1
- package/dist/lib/types.d.ts +4 -3
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(":root{--e-virt-table-color-white: #fff;--e-virt-table-color-black: #000000;--e-virt-table-color-primary: rgb(82, 146, 247);--e-virt-table-text-color-primary: #333;--e-virt-table-text-color-regular: #666;--e-virt-table-text-color-secondary: #999;--e-virt-table-box-shadow: 0 2px 12px 0 #0000001a;--e-virt-table-editor-bg-color: #fff;--e-virt-table-border-color: #e1e6eb}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;z-index:10;border-radius:8px;border:1px solid var(--e-virt-table-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;border:none;outline:none;z-index:10}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--e-virt-table-editor-bg-color);border:2px solid var(--e-virt-table-color-primary);box-sizing:border-box;box-shadow:var(--e-virt-table-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:absolute;left:0;top:0;overflow:hidden;z-index:100;pointer-events:none}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--e-virt-table-color-white);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--e-virt-table-text-color-regular);background-color:var(--e-virt-table-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--e-virt-table-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:8px 24px;color:var(--e-virt-table-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--e-virt-table-color-primary);background-color:#f5f7fa}")),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
2
|
var me = Object.defineProperty;
|
|
3
3
|
var Ee = (n, t, e) => t in n ? me(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
4
|
-
var
|
|
4
|
+
var l = (n, t, e) => Ee(n, typeof t != "symbol" ? t + "" : t, e);
|
|
5
5
|
function $() {
|
|
6
6
|
return $ = Object.assign ? Object.assign.bind() : function(n) {
|
|
7
7
|
for (var t = 1; t < arguments.length; t++) {
|
|
@@ -39,7 +39,7 @@ function dt(n, t, e) {
|
|
|
39
39
|
return Ce() ? dt = Reflect.construct.bind() : dt = function(s, r, o) {
|
|
40
40
|
var a = [null];
|
|
41
41
|
a.push.apply(a, r);
|
|
42
|
-
var
|
|
42
|
+
var h = Function.bind.apply(s, a), c = new h();
|
|
43
43
|
return o && st(c, o.prototype), c;
|
|
44
44
|
}, dt.apply(null, arguments);
|
|
45
45
|
}
|
|
@@ -169,9 +169,9 @@ function Te(n, t, e, i, s) {
|
|
|
169
169
|
return x;
|
|
170
170
|
}), r;
|
|
171
171
|
}
|
|
172
|
-
var o = t.firstFields === !0 ? Object.keys(n) : t.firstFields || [], a = Object.keys(n),
|
|
172
|
+
var o = t.firstFields === !0 ? Object.keys(n) : t.firstFields || [], a = Object.keys(n), h = a.length, c = 0, f = [], d = new Promise(function(x, u) {
|
|
173
173
|
var g = function(p) {
|
|
174
|
-
if (f.push.apply(f, p), c++, c ===
|
|
174
|
+
if (f.push.apply(f, p), c++, c === h)
|
|
175
175
|
return i(f), f.length ? u(new Xt(f, Ct(f))) : x(s);
|
|
176
176
|
};
|
|
177
177
|
a.length || (i(f), x(s)), a.forEach(function(w) {
|
|
@@ -234,15 +234,15 @@ var jt = function(t, e, i, s, r, o) {
|
|
|
234
234
|
(?:` + i + ":){1}(?:(?::" + i + "){0,4}:" + e + "|(?::" + i + `){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
|
|
235
235
|
(?::(?:(?::` + i + "){0,5}:" + e + "|(?::" + i + `){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
|
|
236
236
|
)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
|
|
237
|
-
`).replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(), r = new RegExp("(?:^" + e + "$)|(?:^" + s + "$)"), o = new RegExp("^" + e + "$"), a = new RegExp("^" + s + "$"),
|
|
237
|
+
`).replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(), r = new RegExp("(?:^" + e + "$)|(?:^" + s + "$)"), o = new RegExp("^" + e + "$"), a = new RegExp("^" + s + "$"), h = function(E) {
|
|
238
238
|
return E && E.exact ? r : new RegExp("(?:" + t(E) + e + t(E) + ")|(?:" + t(E) + s + t(E) + ")", "g");
|
|
239
239
|
};
|
|
240
|
-
|
|
240
|
+
h.v4 = function(m) {
|
|
241
241
|
return m && m.exact ? o : new RegExp("" + t(m) + e + t(m), "g");
|
|
242
|
-
},
|
|
242
|
+
}, h.v6 = function(m) {
|
|
243
243
|
return m && m.exact ? a : new RegExp("" + t(m) + s + t(m), "g");
|
|
244
244
|
};
|
|
245
|
-
var c = "(?:(?:[a-z]+:)?//)", f = "(?:\\S+(?::\\S*)?@)?", d =
|
|
245
|
+
var c = "(?:(?:[a-z]+:)?//)", f = "(?:\\S+(?::\\S*)?@)?", d = h.v4().source, x = h.v6().source, u = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)", g = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*", w = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))", p = "(?::\\d{2,5})?", y = '(?:[/?#][^\\s"]*)?', b = "(?:" + c + "|www\\.)" + f + "(?:localhost|" + d + "|" + x + "|" + u + g + w + ")" + p + y;
|
|
246
246
|
return ct = new RegExp("(?:^" + b + "$)", "i"), ct;
|
|
247
247
|
}, Kt = {
|
|
248
248
|
// http://emailregex.com/
|
|
@@ -300,10 +300,10 @@ var jt = function(t, e, i, s, r, o) {
|
|
|
300
300
|
var o = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"], a = t.type;
|
|
301
301
|
o.indexOf(a) > -1 ? et[a](e) || s.push(M(r.messages.types[a], t.fullField, t.type)) : a && typeof e !== t.type && s.push(M(r.messages.types[a], t.fullField, t.type));
|
|
302
302
|
}, De = function(t, e, i, s, r) {
|
|
303
|
-
var o = typeof t.len == "number", a = typeof t.min == "number",
|
|
303
|
+
var o = typeof t.len == "number", a = typeof t.min == "number", h = typeof t.max == "number", c = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, f = e, d = null, x = typeof e == "number", u = typeof e == "string", g = Array.isArray(e);
|
|
304
304
|
if (x ? d = "number" : u ? d = "string" : g && (d = "array"), !d)
|
|
305
305
|
return !1;
|
|
306
|
-
g && (f = e.length), u && (f = e.replace(c, "_").length), o ? f !== t.len && s.push(M(r.messages[d].len, t.fullField, t.len)) : a && !
|
|
306
|
+
g && (f = e.length), u && (f = e.replace(c, "_").length), o ? f !== t.len && s.push(M(r.messages[d].len, t.fullField, t.len)) : a && !h && f < t.min ? s.push(M(r.messages[d].min, t.fullField, t.min)) : h && !a && f > t.max ? s.push(M(r.messages[d].max, t.fullField, t.max)) : a && h && (f < t.min || f > t.max) && s.push(M(r.messages[d].range, t.fullField, t.min, t.max));
|
|
307
307
|
}, j = "enum", Fe = function(t, e, i, s, r) {
|
|
308
308
|
t[j] = Array.isArray(t[j]) ? t[j] : [], t[j].indexOf(e) === -1 && s.push(M(r.messages[j], t.fullField, t[j].join(", ")));
|
|
309
309
|
}, Xe = function(t, e, i, s, r) {
|
|
@@ -416,8 +416,8 @@ var jt = function(t, e, i, s, r, o) {
|
|
|
416
416
|
if (_(e, "date") && !t.required)
|
|
417
417
|
return i();
|
|
418
418
|
if (v.required(t, e, s, o, r), !_(e, "date")) {
|
|
419
|
-
var
|
|
420
|
-
e instanceof Date ?
|
|
419
|
+
var h;
|
|
420
|
+
e instanceof Date ? h = e : h = new Date(e), v.type(t, h, s, o, r), h && v.range(t, h.getTime(), s, o, r);
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
i(o);
|
|
@@ -425,8 +425,8 @@ var jt = function(t, e, i, s, r, o) {
|
|
|
425
425
|
var o = [], a = Array.isArray(e) ? "array" : typeof e;
|
|
426
426
|
v.required(t, e, s, o, r, a), i(o);
|
|
427
427
|
}, yt = function(t, e, i, s, r) {
|
|
428
|
-
var o = t.type, a = [],
|
|
429
|
-
if (
|
|
428
|
+
var o = t.type, a = [], h = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
429
|
+
if (h) {
|
|
430
430
|
if (_(e, o) && !t.required)
|
|
431
431
|
return i();
|
|
432
432
|
v.required(t, e, s, a, r, o), _(e, o) || v.type(t, e, s, a, r);
|
|
@@ -533,8 +533,8 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
533
533
|
var o = this;
|
|
534
534
|
s === void 0 && (s = {}), r === void 0 && (r = function() {
|
|
535
535
|
});
|
|
536
|
-
var a = i,
|
|
537
|
-
if (typeof
|
|
536
|
+
var a = i, h = s, c = r;
|
|
537
|
+
if (typeof h == "function" && (c = h, h = {}), !this.rules || Object.keys(this.rules).length === 0)
|
|
538
538
|
return c && c(null, a), Promise.resolve(a);
|
|
539
539
|
function f(w) {
|
|
540
540
|
var p = [], y = {};
|
|
@@ -549,12 +549,12 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
549
549
|
b(w[m]);
|
|
550
550
|
p.length ? (y = Ct(p), c(p, y)) : c(null, a);
|
|
551
551
|
}
|
|
552
|
-
if (
|
|
552
|
+
if (h.messages) {
|
|
553
553
|
var d = this.messages();
|
|
554
|
-
d === Rt && (d = vt()), Nt(d,
|
|
554
|
+
d === Rt && (d = vt()), Nt(d, h.messages), h.messages = d;
|
|
555
555
|
} else
|
|
556
|
-
|
|
557
|
-
var x = {}, u =
|
|
556
|
+
h.messages = this.messages();
|
|
557
|
+
var x = {}, u = h.keys || Object.keys(this.rules);
|
|
558
558
|
u.forEach(function(w) {
|
|
559
559
|
var p = o.rules[w], y = a[w];
|
|
560
560
|
p.forEach(function(b) {
|
|
@@ -570,7 +570,7 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
570
570
|
});
|
|
571
571
|
});
|
|
572
572
|
var g = {};
|
|
573
|
-
return Te(x,
|
|
573
|
+
return Te(x, h, function(w, p) {
|
|
574
574
|
var y = w.rule, b = (y.type === "object" || y.type === "array") && (typeof y.fields == "object" || typeof y.defaultField == "object");
|
|
575
575
|
b = b && (y.required || !y.required && w.value), y.field = w.field;
|
|
576
576
|
function m(R, T) {
|
|
@@ -582,15 +582,15 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
582
582
|
function E(R) {
|
|
583
583
|
R === void 0 && (R = []);
|
|
584
584
|
var T = Array.isArray(R) ? R : [R];
|
|
585
|
-
!
|
|
585
|
+
!h.suppressWarning && T.length && n.warning("async-validator:", T), T.length && y.message !== void 0 && (T = [].concat(y.message));
|
|
586
586
|
var A = T.map(kt(y, a));
|
|
587
|
-
if (
|
|
587
|
+
if (h.first && A.length)
|
|
588
588
|
return g[y.field] = 1, p(A);
|
|
589
589
|
if (!b)
|
|
590
590
|
p(A);
|
|
591
591
|
else {
|
|
592
592
|
if (y.required && !w.value)
|
|
593
|
-
return y.message !== void 0 ? A = [].concat(y.message).map(kt(y, a)) :
|
|
593
|
+
return y.message !== void 0 ? A = [].concat(y.message).map(kt(y, a)) : h.error && (A = [h.error(y, M(h.messages.required, y.field))]), p(A);
|
|
594
594
|
var L = {};
|
|
595
595
|
y.defaultField && Object.keys(w.value).map(function(I) {
|
|
596
596
|
L[I] = y.defaultField;
|
|
@@ -601,7 +601,7 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
601
601
|
D[I] = O.map(m.bind(null, I));
|
|
602
602
|
});
|
|
603
603
|
var B = new n(D);
|
|
604
|
-
B.messages(
|
|
604
|
+
B.messages(h.messages), w.rule.options && (w.rule.options.messages = h.messages, w.rule.options.error = h.error), B.validate(w.value, w.rule.options || h, function(I) {
|
|
605
605
|
var S = [];
|
|
606
606
|
A && A.length && S.push.apply(S, A), I && I.length && S.push.apply(S, I), p(S.length ? S : null);
|
|
607
607
|
});
|
|
@@ -609,12 +609,12 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
609
609
|
}
|
|
610
610
|
var C;
|
|
611
611
|
if (y.asyncValidator)
|
|
612
|
-
C = y.asyncValidator(y, w.value, E, w.source,
|
|
612
|
+
C = y.asyncValidator(y, w.value, E, w.source, h);
|
|
613
613
|
else if (y.validator) {
|
|
614
614
|
try {
|
|
615
|
-
C = y.validator(y, w.value, E, w.source,
|
|
615
|
+
C = y.validator(y, w.value, E, w.source, h);
|
|
616
616
|
} catch (R) {
|
|
617
|
-
console.error == null || console.error(R),
|
|
617
|
+
console.error == null || console.error(R), h.suppressValidatorError || setTimeout(function() {
|
|
618
618
|
throw R;
|
|
619
619
|
}, 0), E(R.message);
|
|
620
620
|
}
|
|
@@ -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 h = n.slice(0, 1);
|
|
728
|
+
h === '"' && (o += 1), r += h, n = n.slice(1), (n.length === 0 || n.match(/^[\t\r\n]/) && o % 2 === 0) && (a = !1);
|
|
729
729
|
}
|
|
730
|
-
r = r.replace(/^"/, "").replace(/"$/, "").replace(/["]*/g, (
|
|
730
|
+
r = r.replace(/^"/, "").replace(/"$/, "").replace(/["]*/g, (h) => new Array(Math.floor(h.length / 2)).fill('"').join(""));
|
|
731
731
|
} else {
|
|
732
732
|
const o = n.match(Qe);
|
|
733
733
|
r = o ? o[0] : "", n = n.slice(r.length);
|
|
@@ -750,24 +750,24 @@ function ei(n) {
|
|
|
750
750
|
class ii {
|
|
751
751
|
//虚拟滚动位置
|
|
752
752
|
constructor(t, e) {
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
753
|
+
l(this, "loading", !1);
|
|
754
|
+
l(this, "ctx");
|
|
755
|
+
l(this, "data");
|
|
756
|
+
l(this, "columns");
|
|
757
|
+
l(this, "footerData", []);
|
|
758
|
+
l(this, "rowKeyMap", /* @__PURE__ */ new Map());
|
|
759
|
+
l(this, "colIndexKeyMap", /* @__PURE__ */ new Map());
|
|
760
|
+
l(this, "headerMap", /* @__PURE__ */ new Map());
|
|
761
|
+
l(this, "rowIndexRowKeyMap", /* @__PURE__ */ new Map());
|
|
762
|
+
l(this, "checkboxKeyMap", /* @__PURE__ */ new Map());
|
|
763
|
+
l(this, "originalDataMap", /* @__PURE__ */ new Map());
|
|
764
|
+
l(this, "changedDataMap", /* @__PURE__ */ new Map());
|
|
765
|
+
l(this, "validationErrorMap", /* @__PURE__ */ new Map());
|
|
766
|
+
l(this, "itemRowKeyMap", /* @__PURE__ */ new WeakMap());
|
|
767
|
+
l(this, "bufferData", []);
|
|
768
|
+
l(this, "sumHeight", 0);
|
|
769
|
+
l(this, "filterMethod");
|
|
770
|
+
l(this, "positions", []);
|
|
771
771
|
this.ctx = t;
|
|
772
772
|
const { data: i = [], columns: s = [], footerData: r = [] } = e;
|
|
773
773
|
this.data = i, this.footerData = r, this.columns = s, this.setLoading(!0), this.init();
|
|
@@ -790,9 +790,9 @@ class ii {
|
|
|
790
790
|
t.forEach((i, s) => {
|
|
791
791
|
let r = i._hasChildren || !1;
|
|
792
792
|
Array.isArray(i.children) && i.children.length && (r = !0, this.initData(i.children, e + 1));
|
|
793
|
-
const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: a, CELL_HEIGHT:
|
|
793
|
+
const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: a, CELL_HEIGHT: h, SELECTABLE_METHOD: c, CHECKBOX_KEY: f } = this.ctx.config, d = i[o], x = d != null ? `${d}` : Ut();
|
|
794
794
|
this.itemRowKeyMap.set(i, x);
|
|
795
|
-
const u = i._height ||
|
|
795
|
+
const u = i._height || h, g = i._readonly;
|
|
796
796
|
let w = !0;
|
|
797
797
|
if (typeof c == "function" && (w = c), f) {
|
|
798
798
|
const p = i[f];
|
|
@@ -874,12 +874,12 @@ class ii {
|
|
|
874
874
|
const i = (r) => {
|
|
875
875
|
r.forEach((o) => {
|
|
876
876
|
t.push(o);
|
|
877
|
-
const a = this.itemRowKeyMap.get(o), { expand:
|
|
877
|
+
const a = this.itemRowKeyMap.get(o), { expand: h, hasChildren: c, height: f } = this.rowKeyMap.get(a), d = this.sumHeight;
|
|
878
878
|
this.sumHeight += f, this.rowIndexRowKeyMap.set(e, a), this.positions.push({
|
|
879
879
|
top: d,
|
|
880
880
|
height: f,
|
|
881
881
|
bottom: this.sumHeight
|
|
882
|
-
}), e += 1,
|
|
882
|
+
}), e += 1, h && c && i(o.children);
|
|
883
883
|
});
|
|
884
884
|
};
|
|
885
885
|
this.rowIndexRowKeyMap.clear();
|
|
@@ -1035,7 +1035,7 @@ class ii {
|
|
|
1035
1035
|
});
|
|
1036
1036
|
});
|
|
1037
1037
|
let a = [];
|
|
1038
|
-
const
|
|
1038
|
+
const h = i.map((f) => {
|
|
1039
1039
|
const d = this.ctx.database.getRowDataItemForRowKey(f.rowKey);
|
|
1040
1040
|
return {
|
|
1041
1041
|
rowKey: f.rowKey,
|
|
@@ -1047,10 +1047,10 @@ class ii {
|
|
|
1047
1047
|
s.forEach((f) => {
|
|
1048
1048
|
a.push(this.ctx.database.getRowDataItemForRowKey(f));
|
|
1049
1049
|
});
|
|
1050
|
-
const c =
|
|
1050
|
+
const c = h.map(({ rowKey: f, key: d }) => this.getValidator(f, d));
|
|
1051
1051
|
Promise.all(c).then(() => {
|
|
1052
1052
|
this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
|
|
1053
|
-
}), this.ctx.emit("change",
|
|
1053
|
+
}), this.ctx.emit("change", h, a), e && this.ctx.history.pushState({
|
|
1054
1054
|
changeList: i,
|
|
1055
1055
|
scrollX: this.ctx.scrollX,
|
|
1056
1056
|
scrollY: this.ctx.scrollY,
|
|
@@ -1071,15 +1071,15 @@ class ii {
|
|
|
1071
1071
|
if (!this.rowKeyMap.has(t))
|
|
1072
1072
|
return {};
|
|
1073
1073
|
const { item: a } = this.rowKeyMap.get(t);
|
|
1074
|
-
let
|
|
1074
|
+
let h = a[e];
|
|
1075
1075
|
if (this.ctx.database.getReadonly(t, e))
|
|
1076
1076
|
return {
|
|
1077
|
-
oldValue:
|
|
1078
|
-
newValue:
|
|
1077
|
+
oldValue: h,
|
|
1078
|
+
newValue: h
|
|
1079
1079
|
};
|
|
1080
|
-
a[e] !== null && typeof a[e] == "object" && (
|
|
1080
|
+
a[e] !== null && typeof a[e] == "object" && (h = JSON.parse(JSON.stringify(a[e])));
|
|
1081
1081
|
const c = `${t}_${e}`;
|
|
1082
|
-
this.originalDataMap.has(c) || this.originalDataMap.set(c,
|
|
1082
|
+
this.originalDataMap.has(c) || this.originalDataMap.set(c, h);
|
|
1083
1083
|
const f = this.originalDataMap.get(c);
|
|
1084
1084
|
let d = i;
|
|
1085
1085
|
if (o) {
|
|
@@ -1108,7 +1108,7 @@ class ii {
|
|
|
1108
1108
|
}), this.ctx.emit("change", [g], [u]), this.ctx.emit("editChange", {
|
|
1109
1109
|
rowKey: t,
|
|
1110
1110
|
key: e,
|
|
1111
|
-
oldValue:
|
|
1111
|
+
oldValue: h,
|
|
1112
1112
|
value: d,
|
|
1113
1113
|
originalValue: f,
|
|
1114
1114
|
row: u
|
|
@@ -1118,7 +1118,7 @@ class ii {
|
|
|
1118
1118
|
return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
|
|
1119
1119
|
rowKey: t,
|
|
1120
1120
|
key: e,
|
|
1121
|
-
oldValue:
|
|
1121
|
+
oldValue: h,
|
|
1122
1122
|
value: d,
|
|
1123
1123
|
originalValue: this.originalDataMap.get(c),
|
|
1124
1124
|
row: this.ctx.database.getRowDataItemForRowKey(t)
|
|
@@ -1130,12 +1130,12 @@ class ii {
|
|
|
1130
1130
|
{
|
|
1131
1131
|
rowKey: t,
|
|
1132
1132
|
key: e,
|
|
1133
|
-
oldValue:
|
|
1133
|
+
oldValue: h,
|
|
1134
1134
|
newValue: d
|
|
1135
1135
|
}
|
|
1136
1136
|
]
|
|
1137
1137
|
}), r && this.ctx.emit("draw"), {
|
|
1138
|
-
oldValue:
|
|
1138
|
+
oldValue: h,
|
|
1139
1139
|
newValue: d
|
|
1140
1140
|
};
|
|
1141
1141
|
}
|
|
@@ -1162,8 +1162,8 @@ class ii {
|
|
|
1162
1162
|
return !1;
|
|
1163
1163
|
const { item: s } = this.rowKeyMap.get(t), r = s[i];
|
|
1164
1164
|
this.checkboxKeyMap.has(r) && this.checkboxKeyMap.get(r).forEach((a) => {
|
|
1165
|
-
const
|
|
1166
|
-
|
|
1165
|
+
const h = this.rowKeyMap.get(a);
|
|
1166
|
+
h.check = e;
|
|
1167
1167
|
});
|
|
1168
1168
|
}
|
|
1169
1169
|
}
|
|
@@ -1346,7 +1346,7 @@ class ii {
|
|
|
1346
1346
|
getValidator(t, e) {
|
|
1347
1347
|
return new Promise((i) => {
|
|
1348
1348
|
const s = this.rowKeyMap.get(t), r = this.headerMap.get(e), { BODY_CELL_RULES_METHOD: o } = this.ctx.config, a = r.column;
|
|
1349
|
-
let
|
|
1349
|
+
let h = a.rules;
|
|
1350
1350
|
if (typeof o == "function") {
|
|
1351
1351
|
const f = o({
|
|
1352
1352
|
row: s.item,
|
|
@@ -1355,12 +1355,12 @@ class ii {
|
|
|
1355
1355
|
column: a,
|
|
1356
1356
|
value: this.getItemValue(t, e)
|
|
1357
1357
|
});
|
|
1358
|
-
f && (
|
|
1358
|
+
f && (h = f);
|
|
1359
1359
|
}
|
|
1360
|
-
if (
|
|
1360
|
+
if (h) {
|
|
1361
1361
|
let c = {}, f = {};
|
|
1362
|
-
if (f[e] = this.getItemValue(t, e), Array.isArray(
|
|
1363
|
-
const x =
|
|
1362
|
+
if (f[e] = this.getItemValue(t, e), Array.isArray(h) && h.length) {
|
|
1363
|
+
const x = h.map((u) => ({
|
|
1364
1364
|
...u,
|
|
1365
1365
|
row: s.item,
|
|
1366
1366
|
column: a,
|
|
@@ -1370,7 +1370,7 @@ class ii {
|
|
|
1370
1370
|
c[e] = x;
|
|
1371
1371
|
} else
|
|
1372
1372
|
c[e] = {
|
|
1373
|
-
...
|
|
1373
|
+
...h,
|
|
1374
1374
|
row: s.item,
|
|
1375
1375
|
column: a,
|
|
1376
1376
|
rowIndex: s.rowIndex,
|
|
@@ -1429,20 +1429,22 @@ class ii {
|
|
|
1429
1429
|
}
|
|
1430
1430
|
class si {
|
|
1431
1431
|
constructor(t) {
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1432
|
+
l(this, "ctx");
|
|
1433
|
+
l(this, "history", []);
|
|
1434
|
+
l(this, "historyIndex", -1);
|
|
1435
1435
|
this.ctx = t, this.init();
|
|
1436
1436
|
}
|
|
1437
1437
|
init() {
|
|
1438
1438
|
this.ctx.on("keydown", (t) => {
|
|
1439
|
-
if (
|
|
1440
|
-
t.
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
t.
|
|
1445
|
-
|
|
1439
|
+
if (!this.ctx.editing) {
|
|
1440
|
+
if (t.ctrlKey && !t.shiftKey && t.code === "KeyZ" || t.metaKey && !t.shiftKey && t.code === "KeyZ") {
|
|
1441
|
+
t.preventDefault(), this.ctx.clearSelector(), this.ctx.clearAutofill(), this.backState();
|
|
1442
|
+
return;
|
|
1443
|
+
}
|
|
1444
|
+
if (t.ctrlKey && t.code === "KeyY" || t.ctrlKey && t.shiftKey && t.code === "KeyZ" || t.metaKey && t.shiftKey && t.code === "KeyZ") {
|
|
1445
|
+
t.preventDefault(), this.ctx.clearSelector(), this.ctx.clearAutofill(), this.forwardState();
|
|
1446
|
+
return;
|
|
1447
|
+
}
|
|
1446
1448
|
}
|
|
1447
1449
|
});
|
|
1448
1450
|
}
|
|
@@ -1453,14 +1455,12 @@ class si {
|
|
|
1453
1455
|
// 回退
|
|
1454
1456
|
backState() {
|
|
1455
1457
|
if (this.historyIndex >= 0) {
|
|
1456
|
-
const { changeList: t, scrollX: e, scrollY: i } = this.history[this.historyIndex], s = t.map(
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
})
|
|
1463
|
-
);
|
|
1458
|
+
const { changeList: t, scrollX: e, scrollY: i } = this.history[this.historyIndex], s = t.map((r) => ({
|
|
1459
|
+
rowKey: r.rowKey,
|
|
1460
|
+
key: r.key,
|
|
1461
|
+
value: r.oldValue,
|
|
1462
|
+
row: {}
|
|
1463
|
+
}));
|
|
1464
1464
|
this.ctx.setScroll(e, i), this.ctx.database.batchSetItemValue(s, !1), this.historyIndex -= 1;
|
|
1465
1465
|
}
|
|
1466
1466
|
}
|
|
@@ -1468,14 +1468,12 @@ class si {
|
|
|
1468
1468
|
forwardState() {
|
|
1469
1469
|
if (this.historyIndex < this.history.length - 1) {
|
|
1470
1470
|
this.historyIndex += 1;
|
|
1471
|
-
const { changeList: t } = this.history[this.historyIndex], e = t.map(
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
})
|
|
1478
|
-
);
|
|
1471
|
+
const { changeList: t } = this.history[this.historyIndex], e = t.map((i) => ({
|
|
1472
|
+
rowKey: i.rowKey,
|
|
1473
|
+
key: i.key,
|
|
1474
|
+
value: i.newValue,
|
|
1475
|
+
row: {}
|
|
1476
|
+
}));
|
|
1479
1477
|
this.ctx.database.batchSetItemValue(e, !1);
|
|
1480
1478
|
}
|
|
1481
1479
|
}
|
|
@@ -1486,8 +1484,8 @@ class si {
|
|
|
1486
1484
|
}
|
|
1487
1485
|
class ri {
|
|
1488
1486
|
constructor(t) {
|
|
1489
|
-
|
|
1490
|
-
|
|
1487
|
+
l(this, "eventTasks", /* @__PURE__ */ new Map());
|
|
1488
|
+
l(this, "ctx");
|
|
1491
1489
|
this.ctx = t, this.init();
|
|
1492
1490
|
}
|
|
1493
1491
|
init() {
|
|
@@ -1541,7 +1539,7 @@ class ri {
|
|
|
1541
1539
|
}
|
|
1542
1540
|
class oi {
|
|
1543
1541
|
constructor() {
|
|
1544
|
-
|
|
1542
|
+
l(this, "events", /* @__PURE__ */ new Map());
|
|
1545
1543
|
}
|
|
1546
1544
|
has(t) {
|
|
1547
1545
|
return this.events.has(t);
|
|
@@ -1579,7 +1577,7 @@ class oi {
|
|
|
1579
1577
|
}
|
|
1580
1578
|
class ni {
|
|
1581
1579
|
constructor(t) {
|
|
1582
|
-
|
|
1580
|
+
l(this, "ctx");
|
|
1583
1581
|
const e = t.getContext("2d");
|
|
1584
1582
|
if (!e) throw new Error("canvas context not found");
|
|
1585
1583
|
this.ctx = e;
|
|
@@ -1613,21 +1611,21 @@ class ni {
|
|
|
1613
1611
|
* @param {string} color - 阴影的颜色
|
|
1614
1612
|
*/
|
|
1615
1613
|
drawShadow(t, e, i, s, r) {
|
|
1616
|
-
const { fillColor: o, side: a, shadowWidth:
|
|
1614
|
+
const { fillColor: o, side: a, shadowWidth: h, colorStart: c, colorEnd: f } = r;
|
|
1617
1615
|
this.ctx.save(), o && (this.ctx.fillStyle = o, this.ctx.fillRect(t, e, i, s));
|
|
1618
1616
|
let d;
|
|
1619
1617
|
switch (a) {
|
|
1620
1618
|
case "left":
|
|
1621
|
-
d = this.ctx.createLinearGradient(t -
|
|
1619
|
+
d = this.ctx.createLinearGradient(t - h, e, t, e), d.addColorStop(0, c), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t - h, e, h, s);
|
|
1622
1620
|
break;
|
|
1623
1621
|
case "right":
|
|
1624
|
-
d = this.ctx.createLinearGradient(t + i, e, t + i +
|
|
1622
|
+
d = this.ctx.createLinearGradient(t + i, e, t + i + h, e), d.addColorStop(0, c), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t + i, e, h, s);
|
|
1625
1623
|
break;
|
|
1626
1624
|
case "top":
|
|
1627
|
-
d = this.ctx.createLinearGradient(t, e -
|
|
1625
|
+
d = this.ctx.createLinearGradient(t, e - h, t, e), d.addColorStop(0, c), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t, e - h, i, h);
|
|
1628
1626
|
break;
|
|
1629
1627
|
case "bottom":
|
|
1630
|
-
d = this.ctx.createLinearGradient(t, e + s, t, e + s +
|
|
1628
|
+
d = this.ctx.createLinearGradient(t, e + s, t, e + s + h), d.addColorStop(0, c), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t, e + s, i, h);
|
|
1631
1629
|
break;
|
|
1632
1630
|
default:
|
|
1633
1631
|
console.error("Invalid side specified for shadow");
|
|
@@ -1648,11 +1646,11 @@ class ni {
|
|
|
1648
1646
|
drawImage(t, e, i, s, r) {
|
|
1649
1647
|
this.ctx.save(), this.ctx.drawImage(t, e, i, s, r), this.ctx.restore();
|
|
1650
1648
|
}
|
|
1651
|
-
drawRect(t, e, i, s, { borderWidth: r = 1, borderColor: o, fillColor: a, radius:
|
|
1652
|
-
if (this.ctx.save(), this.ctx.beginPath(), a !== void 0 && (this.ctx.fillStyle = a), o !== void 0 && (this.ctx.lineWidth = r, this.ctx.strokeStyle = o),
|
|
1649
|
+
drawRect(t, e, i, s, { borderWidth: r = 1, borderColor: o, fillColor: a, radius: h = 0 } = {}) {
|
|
1650
|
+
if (this.ctx.save(), this.ctx.beginPath(), a !== void 0 && (this.ctx.fillStyle = a), o !== void 0 && (this.ctx.lineWidth = r, this.ctx.strokeStyle = o), h === 0)
|
|
1653
1651
|
this.ctx.rect(t - 0.5, e - 0.5, i, s);
|
|
1654
1652
|
else {
|
|
1655
|
-
const [c, f, d, x] = typeof
|
|
1653
|
+
const [c, f, d, x] = typeof h == "number" ? [h, h, h, h] : h;
|
|
1656
1654
|
this.ctx.moveTo(t + c, e), this.ctx.arcTo(t + i, e, t + i, e + f, f), this.ctx.arcTo(t + i, e + s, t + i - d, e + s, d), this.ctx.arcTo(t, e + s, t, e + s - x, x), this.ctx.arcTo(t, e, t + c, e, c);
|
|
1657
1655
|
}
|
|
1658
1656
|
a !== void 0 && this.ctx.fill(), o !== void 0 && this.ctx.stroke(), this.ctx.restore();
|
|
@@ -1671,16 +1669,16 @@ class ni {
|
|
|
1671
1669
|
this.ctx.save();
|
|
1672
1670
|
const {
|
|
1673
1671
|
font: a = "12px Arial",
|
|
1674
|
-
align:
|
|
1672
|
+
align: h = "center",
|
|
1675
1673
|
color: c = "#495060",
|
|
1676
1674
|
padding: f = 0,
|
|
1677
1675
|
verticalAlign: d = "middle"
|
|
1678
1676
|
} = o;
|
|
1679
|
-
this.ctx.font = a, this.ctx.fillStyle = c, this.ctx.textBaseline = d, this.ctx.textAlign =
|
|
1677
|
+
this.ctx.font = a, this.ctx.fillStyle = c, this.ctx.textBaseline = d, this.ctx.textAlign = h;
|
|
1680
1678
|
let x = 0;
|
|
1681
1679
|
d === "top" ? x = i + f : d === "bottom" ? x = i + r - f : x = i + (r + 1) / 2;
|
|
1682
1680
|
let u = 0;
|
|
1683
|
-
|
|
1681
|
+
h === "left" ? u = e + f : h === "right" ? u = e + s - f : u = e + s / 2;
|
|
1684
1682
|
const { _text: g, ellipsis: w } = this.handleEllipsis(t, s, f, a);
|
|
1685
1683
|
return this.ctx.fillText(g, u, x), this.ctx.restore(), w;
|
|
1686
1684
|
}
|
|
@@ -1691,8 +1689,8 @@ class ni {
|
|
|
1691
1689
|
_text: "",
|
|
1692
1690
|
ellipsis: r
|
|
1693
1691
|
};
|
|
1694
|
-
const a = this.ctx.measureText("...").width,
|
|
1695
|
-
if (
|
|
1692
|
+
const a = this.ctx.measureText("...").width, h = this.ctx.measureText(t).width;
|
|
1693
|
+
if (h && h + a >= e - i * 2) {
|
|
1696
1694
|
r = !0;
|
|
1697
1695
|
let c = 0;
|
|
1698
1696
|
for (let f = 0; f < t.length; f++)
|
|
@@ -1709,131 +1707,131 @@ class ni {
|
|
|
1709
1707
|
}
|
|
1710
1708
|
class Wt {
|
|
1711
1709
|
constructor(t) {
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1710
|
+
l(this, "PROCESSOR_NUM", 50);
|
|
1711
|
+
l(this, "CSS_PREFIX", "e-virt-table");
|
|
1712
|
+
l(this, "ICONS", []);
|
|
1713
|
+
l(this, "ROW_KEY", "");
|
|
1714
|
+
l(this, "HEADER_FONT", "12px normal Arial");
|
|
1715
|
+
l(this, "BODY_FONT", "12px normal Arial");
|
|
1716
|
+
l(this, "BORDER_COLOR", "#e1e6eb");
|
|
1717
|
+
l(this, "WIDTH", 0);
|
|
1718
|
+
l(this, "RESIZE_MIN_WIDTH", 40);
|
|
1719
|
+
l(this, "HEIGHT", 0);
|
|
1720
|
+
l(this, "EMPTY_BODY_HEIGHT", 120);
|
|
1721
|
+
l(this, "EMPTY_CUSTOM_STYLE", {});
|
|
1722
|
+
l(this, "EMPTY_TEXT", "暂无数据");
|
|
1723
|
+
l(this, "MAX_HEIGHT", 1e3);
|
|
1724
|
+
l(this, "BORDER_RADIUS", 8);
|
|
1725
|
+
l(this, "ENABLE_OFFSET_HEIGHT", !1);
|
|
1726
|
+
l(this, "OFFSET_HEIGHT", 0);
|
|
1727
|
+
l(this, "HEADER_HEIGHT", 36);
|
|
1728
|
+
l(this, "ENABLE_HEADER_STICKY", !1);
|
|
1731
1729
|
// 启用头部固定,需要外面实现覆盖层,或者所有表头都要是元素
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1730
|
+
l(this, "HEADER_BG_COLOR", "#F8FAFF");
|
|
1731
|
+
l(this, "BODY_BG_COLOR", "#FFF");
|
|
1732
|
+
l(this, "HEADER_TEXT_COLOR", "#1D2129");
|
|
1733
|
+
l(this, "LOADING_ICON_SVG", "");
|
|
1734
|
+
l(this, "LOADING_ICON_COLOR", "#4E5969");
|
|
1735
|
+
l(this, "EXPAND_ICON_SVG", "");
|
|
1736
|
+
l(this, "SHRINK_ICON_SVG", "");
|
|
1737
|
+
l(this, "EXPAND_ICON_COLOR", "#4E5969");
|
|
1738
|
+
l(this, "SHRINK_ICON_COLOR", "#4E5969");
|
|
1739
|
+
l(this, "ERROR_TIP_ICON_COLOR", "red");
|
|
1740
|
+
l(this, "ERROR_TIP_ICON_SIZE", 6);
|
|
1741
|
+
l(this, "EXPAND_LAZY", !0);
|
|
1742
|
+
l(this, "DEFAULT_EXPAND_ALL", !1);
|
|
1743
|
+
l(this, "CELL_WIDTH", 100);
|
|
1744
|
+
l(this, "CELL_HEIGHT", 36);
|
|
1745
|
+
l(this, "CELL_PADDING", 8);
|
|
1746
|
+
l(this, "CELL_HOVER_ICON_SIZE", 20);
|
|
1747
|
+
l(this, "SCROLLER_TRACK_SIZE", 14);
|
|
1748
|
+
l(this, "SCROLLER_SIZE", 8);
|
|
1749
|
+
l(this, "SCROLLER_COLOR", "#dee0e3");
|
|
1750
|
+
l(this, "SCROLLER_TRACK_COLOR", "#fff");
|
|
1751
|
+
l(this, "SCROLLER_FOCUS_COLOR", "#bbbec4");
|
|
1752
|
+
l(this, "SELECT_BORDER_COLOR", "rgb(82,146,247)");
|
|
1753
|
+
l(this, "SELECT_AREA_COLOR", "rgba(82,146,247,0.1)");
|
|
1754
|
+
l(this, "SELECT_BG_COLOR", "rgba(82,146,247,0.1)");
|
|
1755
|
+
l(this, "EDIT_BG_COLOR", "#fcf6ed");
|
|
1756
|
+
l(this, "CHECKBOX_KEY", "");
|
|
1757
|
+
l(this, "CHECKBOX_COLOR", "rgb(82,146,247)");
|
|
1758
|
+
l(this, "CHECKBOX_SIZE", 20);
|
|
1759
|
+
l(this, "CHECKBOX_DISABLED_SVG", "");
|
|
1760
|
+
l(this, "CHECKBOX_CHECK_SVG", "");
|
|
1761
|
+
l(this, "CHECKBOX_UNCHECK_SVG", "");
|
|
1762
|
+
l(this, "CHECKBOX_INDETERMINATE_SVG", "");
|
|
1763
|
+
l(this, "READONLY_COLOR", "#fff");
|
|
1764
|
+
l(this, "READONLY_TEXT_COLOR", "#4E5969");
|
|
1765
|
+
l(this, "ERROR_TIP_COLOR", "#ED3F14");
|
|
1766
|
+
l(this, "FOOTER_BG_COLOR", "#fafafa");
|
|
1767
|
+
l(this, "FOOTER_FIXED", !0);
|
|
1768
|
+
l(this, "CELL_FOOTER_HEIGHT", 36);
|
|
1769
|
+
l(this, "ENABLE_SELECTOR", !1);
|
|
1770
|
+
l(this, "ENABLE_EDIT_SINGLE_CLICK", !1);
|
|
1773
1771
|
// 启用单点击立马编辑
|
|
1774
|
-
|
|
1772
|
+
l(this, "ENABLE_EDIT_CLICK_SELECTOR", !0);
|
|
1775
1773
|
// 启用点击选择器编辑
|
|
1776
|
-
|
|
1774
|
+
l(this, "SELECTOR_AREA_MIN_X", 0);
|
|
1777
1775
|
// 选择器X最小范围
|
|
1778
|
-
|
|
1776
|
+
l(this, "SELECTOR_AREA_MAX_X_OFFSET", 0);
|
|
1779
1777
|
// 选择器X最大范围colMax - offset
|
|
1780
|
-
|
|
1778
|
+
l(this, "SELECTOR_AREA_MAX_X", 0);
|
|
1781
1779
|
// 选择器X最大范围,0默认最大colMax
|
|
1782
|
-
|
|
1780
|
+
l(this, "SELECTOR_AREA_MIN_Y", 0);
|
|
1783
1781
|
// 选择器Y最小范围
|
|
1784
|
-
|
|
1782
|
+
l(this, "SELECTOR_AREA_MAX_Y", 0);
|
|
1785
1783
|
// 选择器Y最大范围,0默认rowMax
|
|
1786
|
-
|
|
1784
|
+
l(this, "SELECTOR_AREA_MAX_Y_OFFSET", 0);
|
|
1787
1785
|
// 选择器Y最大范围,0默认rowMax
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1786
|
+
l(this, "ENABLE_SELECTOR_SINGLE", !1);
|
|
1787
|
+
l(this, "ENABLE_SELECTOR_SPAN_COL", !0);
|
|
1788
|
+
l(this, "ENABLE_SELECTOR_SPAN_ROW", !0);
|
|
1789
|
+
l(this, "ENABLE_SELECTOR_ALL_ROWS", !0);
|
|
1790
|
+
l(this, "ENABLE_SELECTOR_ALL_COLS", !0);
|
|
1791
|
+
l(this, "ENABLE_AUTOFILL", !1);
|
|
1792
|
+
l(this, "ENABLE_CONTEXT_MENU", !1);
|
|
1793
|
+
l(this, "ENABLE_COPY", !0);
|
|
1794
|
+
l(this, "ENABLE_PASTER", !0);
|
|
1795
|
+
l(this, "ENABLE_RESIZE_ROW", !0);
|
|
1796
|
+
l(this, "ENABLE_RESIZE_COLUMN", !0);
|
|
1797
|
+
l(this, "RESIZE_ROW_LINE_COLOR", "#e1e6eb");
|
|
1798
|
+
l(this, "RESIZE_COLUMN_LINE_COLOR", "#e1e6eb");
|
|
1799
|
+
l(this, "RESIZE_ROW_MIN_HEIGHT", 36);
|
|
1800
|
+
l(this, "RESIZE_COLUMN_MIN_WIDTH", 40);
|
|
1801
|
+
l(this, "ENABLE_KEYBOARD", !0);
|
|
1802
|
+
l(this, "ENABLE_HISTORY", !1);
|
|
1803
|
+
l(this, "ENABLE_VALIDATOR_IMMEDIATE", !0);
|
|
1804
|
+
l(this, "HISTORY_NUM", 50);
|
|
1805
|
+
l(this, "HIGHLIGHT_HOVER_ROW", !1);
|
|
1806
|
+
l(this, "HIGHLIGHT_HOVER_ROW_COLOR", "rgba(186,203,231,0.1)");
|
|
1807
|
+
l(this, "HIGHLIGHT_SELECTED_ROW", !1);
|
|
1808
|
+
l(this, "HIGHLIGHT_SELECTED_ROW_COLOR", "rgba(82,146,247,0.1)");
|
|
1809
|
+
l(this, "TOOLTIP_BG_COLOR", "#303133");
|
|
1810
|
+
l(this, "TOOLTIP_TEXT_COLOR", "#fff");
|
|
1811
|
+
l(this, "TOOLTIP_ZINDEX", 3e3);
|
|
1812
|
+
l(this, "TOOLTIP_CUSTOM_STYLE", {});
|
|
1813
|
+
l(this, "CONTEXT_MENU", [
|
|
1816
1814
|
{ label: "复制", value: "copy" },
|
|
1817
1815
|
{ label: "剪切", value: "cut" },
|
|
1818
1816
|
{ label: "粘贴", value: "paste" },
|
|
1819
1817
|
{ label: "清空选中内容", value: "clearSelected" }
|
|
1820
1818
|
]);
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1819
|
+
l(this, "HEADER_CELL_STYLE_METHOD");
|
|
1820
|
+
l(this, "BODY_CELL_STYLE_METHOD");
|
|
1821
|
+
l(this, "FOOTER_CELL_STYLE_METHOD");
|
|
1822
|
+
l(this, "BODY_CELL_READONLY_METHOD");
|
|
1823
|
+
l(this, "BODY_CELL_FORMATTER_METHOD");
|
|
1824
|
+
l(this, "BODY_CELL_RULES_METHOD");
|
|
1825
|
+
l(this, "BODY_CELL_TYPE_METHOD");
|
|
1826
|
+
l(this, "BODY_CELL_EDITOR_TYPE_METHOD");
|
|
1827
|
+
l(this, "BODY_CELL_RENDER_METHOD");
|
|
1828
|
+
l(this, "BODY_CELL_HOVER_ICON_METHOD");
|
|
1829
|
+
l(this, "SPAN_METHOD");
|
|
1830
|
+
l(this, "SELECTABLE_METHOD");
|
|
1831
|
+
l(this, "EXPAND_LAZY_METHOD");
|
|
1832
|
+
l(this, "BEFORE_VALUE_CHANGE_METHOD");
|
|
1833
|
+
l(this, "BEFORE_PASTE_CHANGE_METHOD");
|
|
1834
|
+
l(this, "BEFORE_AUTOFILL_CHANGE_METHOD");
|
|
1837
1835
|
Object.assign(this, t);
|
|
1838
1836
|
}
|
|
1839
1837
|
init(t) {
|
|
@@ -1842,8 +1840,8 @@ class Wt {
|
|
|
1842
1840
|
}
|
|
1843
1841
|
class ai {
|
|
1844
1842
|
constructor(t) {
|
|
1845
|
-
|
|
1846
|
-
|
|
1843
|
+
l(this, "ctx");
|
|
1844
|
+
l(this, "list", [
|
|
1847
1845
|
{
|
|
1848
1846
|
name: "loading",
|
|
1849
1847
|
configName: "LOADING_ICON_SVG",
|
|
@@ -1905,7 +1903,7 @@ class ai {
|
|
|
1905
1903
|
color: ""
|
|
1906
1904
|
}
|
|
1907
1905
|
]);
|
|
1908
|
-
|
|
1906
|
+
l(this, "icons", /* @__PURE__ */ new Map());
|
|
1909
1907
|
this.ctx = t, this.init();
|
|
1910
1908
|
}
|
|
1911
1909
|
async init() {
|
|
@@ -1939,8 +1937,8 @@ class ai {
|
|
|
1939
1937
|
});
|
|
1940
1938
|
const o = new Image(), a = new Blob([new XMLSerializer().serializeToString(r)], {
|
|
1941
1939
|
type: "image/svg+xml"
|
|
1942
|
-
}),
|
|
1943
|
-
return o.src =
|
|
1940
|
+
}), h = URL.createObjectURL(a);
|
|
1941
|
+
return o.src = h, new Promise((c, f) => {
|
|
1944
1942
|
o.onerror = () => f(new Error("Failed to load image")), o.onload = () => {
|
|
1945
1943
|
c(o);
|
|
1946
1944
|
};
|
|
@@ -1952,13 +1950,13 @@ class ai {
|
|
|
1952
1950
|
}
|
|
1953
1951
|
class te {
|
|
1954
1952
|
constructor(t, e, i, s, r, o, a) {
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1953
|
+
l(this, "ctx");
|
|
1954
|
+
l(this, "x", 0);
|
|
1955
|
+
l(this, "y", 0);
|
|
1956
|
+
l(this, "width", 0);
|
|
1957
|
+
l(this, "height", 0);
|
|
1958
|
+
l(this, "fixed");
|
|
1959
|
+
l(this, "cellType");
|
|
1962
1960
|
this.ctx = t, this.x = e, this.y = i, this.width = s, this.height = r, this.fixed = a, this.cellType = o;
|
|
1963
1961
|
}
|
|
1964
1962
|
isHorizontalVisible() {
|
|
@@ -1997,57 +1995,57 @@ class te {
|
|
|
1997
1995
|
}
|
|
1998
1996
|
}
|
|
1999
1997
|
class ee extends te {
|
|
2000
|
-
constructor(e, i, s, r, o, a,
|
|
2001
|
-
super(e, r, o, a,
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
1998
|
+
constructor(e, i, s, r, o, a, h, c, f, d = "body") {
|
|
1999
|
+
super(e, r, o, a, h, d, c.fixed);
|
|
2000
|
+
l(this, "formatter");
|
|
2001
|
+
l(this, "formatterFooter");
|
|
2002
|
+
l(this, "hoverIconName", "");
|
|
2003
|
+
l(this, "operation", !1);
|
|
2004
|
+
l(this, "align");
|
|
2005
|
+
l(this, "verticalAlign");
|
|
2006
|
+
l(this, "fixed");
|
|
2007
|
+
l(this, "type");
|
|
2008
|
+
l(this, "editorType");
|
|
2009
|
+
l(this, "cellType");
|
|
2010
|
+
l(this, "level");
|
|
2011
|
+
l(this, "colspan", 1);
|
|
2012
|
+
l(this, "rowspan", 1);
|
|
2013
|
+
l(this, "key");
|
|
2014
|
+
l(this, "column");
|
|
2015
|
+
l(this, "rowIndex");
|
|
2016
|
+
l(this, "colIndex");
|
|
2017
|
+
l(this, "rowKey");
|
|
2018
|
+
l(this, "row");
|
|
2019
|
+
l(this, "value");
|
|
2020
|
+
l(this, "render");
|
|
2021
|
+
l(this, "renderFooter");
|
|
2022
|
+
l(this, "style", {});
|
|
2023
|
+
l(this, "rules", {});
|
|
2024
|
+
l(this, "message", "");
|
|
2025
|
+
l(this, "text", "");
|
|
2026
|
+
l(this, "displayText", "");
|
|
2027
|
+
l(this, "visibleWidth", 0);
|
|
2028
|
+
l(this, "visibleHeight", 0);
|
|
2029
|
+
l(this, "isHasChanged", !1);
|
|
2030
|
+
l(this, "drawX", 0);
|
|
2031
|
+
l(this, "drawY", 0);
|
|
2032
|
+
l(this, "drawCellBgColor", "");
|
|
2033
|
+
l(this, "drawCellSkyBgColor", "");
|
|
2034
|
+
l(this, "drawTextColor", "");
|
|
2035
|
+
l(this, "drawTextX", 0);
|
|
2036
|
+
l(this, "drawTextY", 0);
|
|
2037
|
+
l(this, "drawImageX", 0);
|
|
2038
|
+
l(this, "drawImageY", 0);
|
|
2039
|
+
l(this, "drawImageWidth", 0);
|
|
2040
|
+
l(this, "drawImageHeight", 0);
|
|
2041
|
+
l(this, "drawImageName", "");
|
|
2042
|
+
l(this, "drawImageSource");
|
|
2043
|
+
l(this, "ellipsis", !1);
|
|
2044
|
+
l(this, "rowExpand", !1);
|
|
2045
|
+
l(this, "rowHasChildren", !1);
|
|
2046
|
+
l(this, "overflowTooltipShow", !0);
|
|
2047
|
+
l(this, "overflowTooltipMaxWidth", 500);
|
|
2048
|
+
l(this, "overflowTooltipPlacement", "top");
|
|
2051
2049
|
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = c.key, this.type = c.type || "", this.editorType = c.editorType || "text", this.cellType = d, this.align = c.align || "center", this.verticalAlign = c.verticalAlign || "middle", this.fixed = c.fixed, this.level = c.level || 0, this.operation = c.operation || !1, this.column = c, this.rules = c.rules || {}, this.row = f, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = c.render, this.overflowTooltipShow = c.overflowTooltipShow !== !1, this.overflowTooltipMaxWidth = c.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = c.overflowTooltipPlacement || "top", this.renderFooter = c.renderFooter, this.hoverIconName = c.hoverIconName, this.formatter = c.formatter, this.formatterFooter = c.formatterFooter, this.update();
|
|
2052
2050
|
}
|
|
2053
2051
|
getValidationMessage() {
|
|
@@ -2142,7 +2140,7 @@ class ee extends te {
|
|
|
2142
2140
|
const { CELL_PADDING: e = 0 } = this.ctx.config, { rowKey: i, cellType: s } = this;
|
|
2143
2141
|
let r, o = 0, a = "";
|
|
2144
2142
|
if (this.type === "tree" && s === "body") {
|
|
2145
|
-
const
|
|
2143
|
+
const h = this.ctx.database.getRowForRowKey(i), { expand: c = !1, hasChildren: f = !1, expandLoading: d = !1, level: x = 0 } = h || {};
|
|
2146
2144
|
if (this.rowExpand = c, this.rowHasChildren = f, d) {
|
|
2147
2145
|
const u = this.ctx.icons.get("loading");
|
|
2148
2146
|
a = "loading", r = u, o = x * 8;
|
|
@@ -2165,7 +2163,7 @@ class ee extends te {
|
|
|
2165
2163
|
FOOTER_CELL_STYLE_METHOD: r,
|
|
2166
2164
|
READONLY_TEXT_COLOR: o,
|
|
2167
2165
|
FOOTER_BG_COLOR: a,
|
|
2168
|
-
HIGHLIGHT_SELECTED_ROW:
|
|
2166
|
+
HIGHLIGHT_SELECTED_ROW: h,
|
|
2169
2167
|
HIGHLIGHT_SELECTED_ROW_COLOR: c,
|
|
2170
2168
|
HIGHLIGHT_HOVER_ROW: f,
|
|
2171
2169
|
HIGHLIGHT_HOVER_ROW_COLOR: d
|
|
@@ -2187,7 +2185,7 @@ class ee extends te {
|
|
|
2187
2185
|
}
|
|
2188
2186
|
let x = "transparent";
|
|
2189
2187
|
const u = this.ctx.focusCell, g = this.ctx.hoverCell;
|
|
2190
|
-
f && (g == null ? void 0 : g.rowKey) === this.rowKey && (x = d),
|
|
2188
|
+
f && (g == null ? void 0 : g.rowKey) === this.rowKey && (x = d), h && (u == null ? void 0 : u.rowKey) === this.rowKey && (x = c), this.drawCellSkyBgColor = x;
|
|
2191
2189
|
let w = e, p = o;
|
|
2192
2190
|
if (["index", "index-selection", "selection"].includes(this.type)) {
|
|
2193
2191
|
this.drawCellBgColor = e, this.drawTextColor = o;
|
|
@@ -2207,24 +2205,24 @@ class ee extends te {
|
|
|
2207
2205
|
this.drawCellBgColor = w, this.drawTextColor = p;
|
|
2208
2206
|
}
|
|
2209
2207
|
updateSelection() {
|
|
2210
|
-
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type: a, rowIndex:
|
|
2208
|
+
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type: a, rowIndex: h, rowKey: c } = this;
|
|
2211
2209
|
if (!(s === 0 || r === 0) && o !== "footer" && ["index-selection", "selection"].includes(a)) {
|
|
2212
2210
|
const f = this.ctx.database.getRowSelection(c), d = this.ctx.database.getRowSelectable(c), { CHECKBOX_SIZE: x = 0 } = this.ctx.config, u = this.drawX + (e - x) / 2, g = this.drawY + (i - x) / 2;
|
|
2213
2211
|
let w = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck";
|
|
2214
|
-
f && d ? (w = this.ctx.icons.get("checkbox-check"), p = "checkbox-check") : f && d ? (w = this.ctx.icons.get("checkbox-check-disabled"), p = "checkbox-check-disabled") : !f && d ? (w = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck") : (w = this.ctx.icons.get("checkbox-disabled"), p = "checkbox-disabled"), w && a == "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex ===
|
|
2212
|
+
f && d ? (w = this.ctx.icons.get("checkbox-check"), p = "checkbox-check") : f && d ? (w = this.ctx.icons.get("checkbox-check-disabled"), p = "checkbox-check-disabled") : !f && d ? (w = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck") : (w = this.ctx.icons.get("checkbox-disabled"), p = "checkbox-disabled"), w && a == "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === h || ["checkbox-disabled", "checkbox-check"].includes(p)) && (this.drawImageX = u, this.drawImageY = g, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = p, this.drawImageSource = w) : w && a === "selection" && (this.drawImageX = u, this.drawImageY = g, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = p, this.drawImageSource = w);
|
|
2215
2213
|
}
|
|
2216
2214
|
}
|
|
2217
2215
|
updateHoverIcon() {
|
|
2218
2216
|
const { BODY_CELL_HOVER_ICON_METHOD: e, CELL_HOVER_ICON_SIZE: i, CELL_PADDING: s } = this.ctx.config;
|
|
2219
2217
|
if (typeof e == "function") {
|
|
2220
|
-
const
|
|
2218
|
+
const h = e({
|
|
2221
2219
|
row: this.row,
|
|
2222
2220
|
rowIndex: this.rowIndex,
|
|
2223
2221
|
colIndex: this.colIndex,
|
|
2224
2222
|
column: this.column,
|
|
2225
2223
|
value: this.getValue()
|
|
2226
2224
|
});
|
|
2227
|
-
|
|
2225
|
+
h !== void 0 && (this.hoverIconName = h);
|
|
2228
2226
|
}
|
|
2229
2227
|
const r = this.drawX + this.width - i - s, o = this.drawY + (this.height - i) / 2;
|
|
2230
2228
|
if (this.hoverIconName && this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === this.rowIndex) {
|
|
@@ -2348,8 +2346,8 @@ class ee extends te {
|
|
|
2348
2346
|
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s } = this.ctx.config;
|
|
2349
2347
|
if (!s || !i)
|
|
2350
2348
|
return;
|
|
2351
|
-
const { xArr: r, yArr: o } = this.ctx.selector, a = r[1],
|
|
2352
|
-
c === a && f ===
|
|
2349
|
+
const { xArr: r, yArr: o } = this.ctx.selector, a = r[1], h = o[1], { colIndex: c, rowIndex: f, drawX: d, drawY: x } = this;
|
|
2350
|
+
c === a && f === h && this.ctx.paint.drawRect(d + this.width - 6, x + this.height - 6, 6, 6, {
|
|
2353
2351
|
borderColor: "#fff",
|
|
2354
2352
|
fillColor: e
|
|
2355
2353
|
});
|
|
@@ -2404,31 +2402,31 @@ class ee extends te {
|
|
|
2404
2402
|
}
|
|
2405
2403
|
drawBorder(e) {
|
|
2406
2404
|
const { drawX: i, drawY: s, width: r, rowIndex: o, colIndex: a } = this;
|
|
2407
|
-
let
|
|
2408
|
-
o === 0 && (c = this.y + 1, f = f - 1), a === this.ctx.maxColIndex && (
|
|
2405
|
+
let h = i + 0.5, c = s + 0.5, f = this.height;
|
|
2406
|
+
o === 0 && (c = this.y + 1, f = f - 1), a === this.ctx.maxColIndex && (h = h - 1);
|
|
2409
2407
|
const { xArr: d, yArr: x, lineDash: u = [], borderWidth: g = 1, borderColor: w, fillColor: p } = e, y = d[0], b = d[1], m = x[0], E = x[1];
|
|
2410
|
-
a >= y && a <= b && o === m && this.ctx.paint.drawLine([
|
|
2408
|
+
a >= y && a <= b && o === m && this.ctx.paint.drawLine([h, c, h + r - 2, c], {
|
|
2411
2409
|
borderColor: w,
|
|
2412
2410
|
fillColor: p,
|
|
2413
2411
|
borderWidth: g,
|
|
2414
2412
|
lineCap: "round",
|
|
2415
2413
|
lineJoin: "round",
|
|
2416
2414
|
lineDash: u
|
|
2417
|
-
}), a >= y && a <= b && o === E && this.ctx.paint.drawLine([
|
|
2415
|
+
}), a >= y && a <= b && o === E && this.ctx.paint.drawLine([h, c + f - 1.5, h + r, c + f - 1.5], {
|
|
2418
2416
|
borderColor: w,
|
|
2419
2417
|
fillColor: p,
|
|
2420
2418
|
borderWidth: g,
|
|
2421
2419
|
lineCap: "round",
|
|
2422
2420
|
lineJoin: "round",
|
|
2423
2421
|
lineDash: u
|
|
2424
|
-
}), a === y && o >= m && o <= E && this.ctx.paint.drawLine([
|
|
2422
|
+
}), a === y && o >= m && o <= E && this.ctx.paint.drawLine([h, c, h, c + f - 1], {
|
|
2425
2423
|
borderColor: w,
|
|
2426
2424
|
fillColor: p,
|
|
2427
2425
|
borderWidth: g,
|
|
2428
2426
|
lineCap: "round",
|
|
2429
2427
|
lineJoin: "round",
|
|
2430
2428
|
lineDash: u
|
|
2431
|
-
}), a === b && o >= m && o <= E && this.ctx.paint.drawLine([
|
|
2429
|
+
}), a === b && o >= m && o <= E && this.ctx.paint.drawLine([h + r - 1.5, c, h + r - 1.5, c + f - 1.5], {
|
|
2432
2430
|
borderColor: w,
|
|
2433
2431
|
fillColor: p,
|
|
2434
2432
|
borderWidth: g,
|
|
@@ -2439,42 +2437,43 @@ class ee extends te {
|
|
|
2439
2437
|
}
|
|
2440
2438
|
}
|
|
2441
2439
|
class ie extends te {
|
|
2442
|
-
constructor(e, i, s, r, o, a,
|
|
2443
|
-
super(e, s, r, o, a, "header",
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2440
|
+
constructor(e, i, s, r, o, a, h) {
|
|
2441
|
+
super(e, s, r, o, a, "header", h.fixed);
|
|
2442
|
+
l(this, "align");
|
|
2443
|
+
l(this, "verticalAlign", "middle");
|
|
2444
|
+
l(this, "fixed");
|
|
2445
|
+
l(this, "widthFillDisable");
|
|
2446
|
+
l(this, "type");
|
|
2447
|
+
l(this, "operation", !1);
|
|
2448
|
+
l(this, "editorType");
|
|
2449
|
+
l(this, "level");
|
|
2450
|
+
l(this, "text");
|
|
2451
|
+
l(this, "displayText", "");
|
|
2452
|
+
l(this, "colspan");
|
|
2453
|
+
l(this, "rowspan");
|
|
2454
|
+
l(this, "row");
|
|
2455
|
+
l(this, "key");
|
|
2456
|
+
l(this, "required", !1);
|
|
2457
|
+
l(this, "readonly", !1);
|
|
2458
|
+
l(this, "children", []);
|
|
2459
|
+
l(this, "column");
|
|
2460
|
+
l(this, "colIndex");
|
|
2461
|
+
l(this, "rowKey");
|
|
2462
|
+
l(this, "rules");
|
|
2463
|
+
l(this, "hasChildren");
|
|
2464
|
+
l(this, "render");
|
|
2465
|
+
l(this, "style", {});
|
|
2466
|
+
l(this, "drawX", 0);
|
|
2467
|
+
l(this, "drawY", 0);
|
|
2468
|
+
l(this, "drawCellBgColor", "");
|
|
2469
|
+
l(this, "drawTextColor", "");
|
|
2470
|
+
l(this, "drawImageX", 0);
|
|
2471
|
+
l(this, "drawImageY", 0);
|
|
2472
|
+
l(this, "drawImageWidth", 0);
|
|
2473
|
+
l(this, "drawImageHeight", 0);
|
|
2474
|
+
l(this, "drawImageName", "");
|
|
2475
|
+
l(this, "drawImageSource");
|
|
2476
|
+
this.ctx = e, this.x = s, this.y = r, this.width = o, this.height = a, this.colIndex = i, this.key = h.key, this.type = h.type || "", this.editorType = h.editorType || "text", this.align = h.align || "center", this.verticalAlign = h.verticalAlign || "middle", this.fixed = h.fixed, this.level = h.level || 0, this.operation = h.operation || !1, this.text = h.title, this.column = h, this.colspan = h.colspan || 1, this.widthFillDisable = h.widthFillDisable || !1, this.rowspan = h.rowspan || 1, this.rules = h.rules, this.readonly = h.readonly || !1, this.required = h.required || !1, this.rowKey = Ut(), this.hasChildren = h.children && h.children.length > 0 || !1, this.render = h.renderHeader;
|
|
2478
2477
|
}
|
|
2479
2478
|
/**
|
|
2480
2479
|
* 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
|
|
@@ -2494,11 +2493,11 @@ class ie extends te {
|
|
|
2494
2493
|
const { HEADER_CELL_STYLE_METHOD: e, HEADER_BG_COLOR: i, HEADER_TEXT_COLOR: s } = this.ctx.config;
|
|
2495
2494
|
let r = i, o = s;
|
|
2496
2495
|
if (typeof e == "function") {
|
|
2497
|
-
const a = e, { backgroundColor:
|
|
2496
|
+
const a = e, { backgroundColor: h, color: c } = a({
|
|
2498
2497
|
colIndex: this.colIndex,
|
|
2499
2498
|
column: this.column
|
|
2500
2499
|
}) || {};
|
|
2501
|
-
|
|
2500
|
+
h && (r = h), c && (o = c);
|
|
2502
2501
|
}
|
|
2503
2502
|
this.drawCellBgColor = r, this.drawTextColor = o;
|
|
2504
2503
|
}
|
|
@@ -2509,11 +2508,11 @@ class ie extends te {
|
|
|
2509
2508
|
const {
|
|
2510
2509
|
paint: e,
|
|
2511
2510
|
config: { BORDER_COLOR: i, CELL_PADDING: s, HEADER_FONT: r }
|
|
2512
|
-
} = this.ctx, { drawX: o, drawY: a, displayText:
|
|
2511
|
+
} = this.ctx, { drawX: o, drawY: a, displayText: h } = this;
|
|
2513
2512
|
e.drawRect(o, a, this.width, this.height, {
|
|
2514
2513
|
borderColor: i,
|
|
2515
2514
|
fillColor: this.drawCellBgColor
|
|
2516
|
-
}), e.drawText(
|
|
2515
|
+
}), e.drawText(h, o, a, this.width, this.height, {
|
|
2517
2516
|
font: r,
|
|
2518
2517
|
padding: s,
|
|
2519
2518
|
color: this.drawTextColor,
|
|
@@ -2524,9 +2523,9 @@ class ie extends te {
|
|
|
2524
2523
|
drawSelection() {
|
|
2525
2524
|
const { width: e, height: i, type: s } = this;
|
|
2526
2525
|
if (["index-selection", "selection"].includes(s)) {
|
|
2527
|
-
const { indeterminate: r, check: o, selectable: a } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE:
|
|
2526
|
+
const { indeterminate: r, check: o, selectable: a } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: h = 0 } = this.ctx.config, c = this.drawX + (e - h) / 2, f = this.drawY + (i - h) / 2;
|
|
2528
2527
|
let d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck";
|
|
2529
|
-
r ? (d = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : o && a ? (d = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : o && a ? (d = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !o && a ? (d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck") : (d = this.ctx.icons.get("checkbox-disabled"), x = "checkbox-disabled"), d && (this.drawImageX = c, this.drawImageY = f, this.drawImageWidth =
|
|
2528
|
+
r ? (d = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : o && a ? (d = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : o && a ? (d = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !o && a ? (d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck") : (d = this.ctx.icons.get("checkbox-disabled"), x = "checkbox-disabled"), d && (this.drawImageX = c, this.drawImageY = f, this.drawImageWidth = h, this.drawImageHeight = h, this.drawImageName = x, this.drawImageSource = d, this.ctx.paint.drawImage(
|
|
2530
2529
|
this.drawImageSource,
|
|
2531
2530
|
this.drawImageX,
|
|
2532
2531
|
this.drawImageY,
|
|
@@ -2555,11 +2554,11 @@ class ie extends te {
|
|
|
2555
2554
|
};
|
|
2556
2555
|
}
|
|
2557
2556
|
}
|
|
2558
|
-
class
|
|
2557
|
+
class li {
|
|
2559
2558
|
constructor(t) {
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2559
|
+
l(this, "ctx");
|
|
2560
|
+
l(this, "visibleHoverCell");
|
|
2561
|
+
l(this, "resizeObserver");
|
|
2563
2562
|
this.ctx = t, this.init();
|
|
2564
2563
|
}
|
|
2565
2564
|
init() {
|
|
@@ -2649,10 +2648,10 @@ class hi {
|
|
|
2649
2648
|
colIndex: t.colIndex,
|
|
2650
2649
|
column: t.column,
|
|
2651
2650
|
value: t.getValue()
|
|
2652
|
-
}).then((
|
|
2653
|
-
this.ctx.database.setExpandChildren(t.rowKey,
|
|
2654
|
-
}).catch((
|
|
2655
|
-
this.ctx.database.expandLoading(t.rowKey, !1), console.error(
|
|
2651
|
+
}).then((h) => {
|
|
2652
|
+
this.ctx.database.setExpandChildren(t.rowKey, h), this.ctx.database.expandLoading(t.rowKey, !1), this.ctx.emit("expandChange", this.ctx.database.getExpandRowKeys());
|
|
2653
|
+
}).catch((h) => {
|
|
2654
|
+
this.ctx.database.expandLoading(t.rowKey, !1), console.error(h);
|
|
2656
2655
|
}));
|
|
2657
2656
|
else {
|
|
2658
2657
|
const a = this.ctx.database.getIsExpand(t.rowKey);
|
|
@@ -2679,15 +2678,15 @@ class hi {
|
|
|
2679
2678
|
handleBodyEvent(t, e, i, s, r = !1) {
|
|
2680
2679
|
for (const o of i) {
|
|
2681
2680
|
const a = o.fixedCells.concat(o.noFixedCells);
|
|
2682
|
-
for (const
|
|
2683
|
-
const c =
|
|
2681
|
+
for (const h of a) {
|
|
2682
|
+
const c = h.getDrawX(), f = h.getDrawY();
|
|
2684
2683
|
if (r) {
|
|
2685
|
-
if (t > c && t < c +
|
|
2686
|
-
s(
|
|
2684
|
+
if (t > c && t < c + h.visibleWidth && e > f && e < f + h.visibleHeight) {
|
|
2685
|
+
s(h);
|
|
2687
2686
|
return;
|
|
2688
2687
|
}
|
|
2689
|
-
} else if (t > c && t < c +
|
|
2690
|
-
s(
|
|
2688
|
+
} else if (t > c && t < c + h.width && e > f && e < f + h.height) {
|
|
2689
|
+
s(h);
|
|
2691
2690
|
return;
|
|
2692
2691
|
}
|
|
2693
2692
|
}
|
|
@@ -2706,55 +2705,55 @@ class hi {
|
|
|
2706
2705
|
this.resizeObserver.unobserve(this.ctx.stageElement);
|
|
2707
2706
|
}
|
|
2708
2707
|
}
|
|
2709
|
-
class
|
|
2708
|
+
class hi {
|
|
2710
2709
|
constructor(t, e) {
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2710
|
+
l(this, "eventBus");
|
|
2711
|
+
l(this, "eventBrowser");
|
|
2712
|
+
l(this, "eventTable");
|
|
2713
|
+
l(this, "containerElement");
|
|
2714
|
+
l(this, "stageElement");
|
|
2715
|
+
l(this, "canvasElement");
|
|
2716
|
+
l(this, "overlayerElement");
|
|
2717
|
+
l(this, "editorElement");
|
|
2718
|
+
l(this, "emptyElement");
|
|
2719
|
+
l(this, "contextMenuElement");
|
|
2720
|
+
l(this, "stageWidth", 0);
|
|
2721
|
+
l(this, "stageHeight", 0);
|
|
2722
|
+
l(this, "paint");
|
|
2723
|
+
l(this, "icons");
|
|
2724
|
+
l(this, "isInsideTargetContainer", !1);
|
|
2725
|
+
l(this, "mousedown", !1);
|
|
2726
|
+
l(this, "isPointer", !1);
|
|
2727
|
+
l(this, "rowResizing", !1);
|
|
2729
2728
|
// 行调整大小中
|
|
2730
|
-
|
|
2729
|
+
l(this, "columnResizing", !1);
|
|
2731
2730
|
// 列调整大小中
|
|
2732
|
-
|
|
2731
|
+
l(this, "scrollerMove", !1);
|
|
2733
2732
|
// 滚动条移动中
|
|
2734
|
-
|
|
2733
|
+
l(this, "scrollerFocus", !1);
|
|
2735
2734
|
// 滚动条focus中
|
|
2736
|
-
|
|
2735
|
+
l(this, "autofillMove", !1);
|
|
2737
2736
|
// 自动填充移动中
|
|
2738
|
-
|
|
2737
|
+
l(this, "selectorMove", !1);
|
|
2739
2738
|
// 选择器移动中
|
|
2740
|
-
|
|
2739
|
+
l(this, "adjustPositioning", !1);
|
|
2741
2740
|
// 调整位置中
|
|
2742
|
-
|
|
2741
|
+
l(this, "editing", !1);
|
|
2743
2742
|
// 编辑中
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2743
|
+
l(this, "scrollY", 0);
|
|
2744
|
+
l(this, "scrollX", 0);
|
|
2745
|
+
l(this, "fixedLeftWidth", 0);
|
|
2746
|
+
l(this, "fixedRightWidth", 0);
|
|
2747
|
+
l(this, "maxColIndex", 0);
|
|
2748
|
+
l(this, "maxRowIndex", 0);
|
|
2749
|
+
l(this, "hoverRow");
|
|
2750
|
+
l(this, "clickCell");
|
|
2751
|
+
l(this, "focusCell");
|
|
2752
|
+
l(this, "hoverCell");
|
|
2753
|
+
l(this, "clickCellHeader");
|
|
2754
|
+
l(this, "focusCellHeader");
|
|
2755
|
+
l(this, "hoverCellHeader");
|
|
2756
|
+
l(this, "body", {
|
|
2758
2757
|
x: 0,
|
|
2759
2758
|
y: 0,
|
|
2760
2759
|
width: 0,
|
|
@@ -2767,7 +2766,7 @@ class li {
|
|
|
2767
2766
|
renderRows: [],
|
|
2768
2767
|
data: []
|
|
2769
2768
|
});
|
|
2770
|
-
|
|
2769
|
+
l(this, "footer", {
|
|
2771
2770
|
x: 0,
|
|
2772
2771
|
y: 0,
|
|
2773
2772
|
width: 0,
|
|
@@ -2776,7 +2775,7 @@ class li {
|
|
|
2776
2775
|
visibleWidth: 0,
|
|
2777
2776
|
renderRows: []
|
|
2778
2777
|
});
|
|
2779
|
-
|
|
2778
|
+
l(this, "header", {
|
|
2780
2779
|
x: 0,
|
|
2781
2780
|
y: 0,
|
|
2782
2781
|
width: 0,
|
|
@@ -2791,31 +2790,31 @@ class li {
|
|
|
2791
2790
|
fixedRightCellHeaders: [],
|
|
2792
2791
|
renderCenterCellHeaders: []
|
|
2793
2792
|
});
|
|
2794
|
-
|
|
2793
|
+
l(this, "selector", {
|
|
2795
2794
|
enable: !1,
|
|
2796
2795
|
xArr: [-1, -1],
|
|
2797
2796
|
yArr: [-1, -1],
|
|
2798
2797
|
xArrCopy: [-1, -1],
|
|
2799
2798
|
yArrCopy: [-1, -1]
|
|
2800
2799
|
});
|
|
2801
|
-
|
|
2800
|
+
l(this, "autofill", {
|
|
2802
2801
|
enable: !1,
|
|
2803
2802
|
xArr: [-1, -1],
|
|
2804
2803
|
yArr: [-1, -1]
|
|
2805
2804
|
});
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2805
|
+
l(this, "database");
|
|
2806
|
+
l(this, "history");
|
|
2807
|
+
l(this, "config");
|
|
2809
2808
|
const {
|
|
2810
2809
|
containerElement: i,
|
|
2811
2810
|
stageElement: s,
|
|
2812
2811
|
canvasElement: r,
|
|
2813
2812
|
overlayerElement: o,
|
|
2814
2813
|
editorElement: a,
|
|
2815
|
-
emptyElement:
|
|
2814
|
+
emptyElement: h,
|
|
2816
2815
|
contextMenuElement: c
|
|
2817
2816
|
} = t;
|
|
2818
|
-
this.containerElement = i, s.tabIndex = 0, this.stageElement = s, this.canvasElement = r, this.overlayerElement = o, this.editorElement = a, this.emptyElement =
|
|
2817
|
+
this.containerElement = i, s.tabIndex = 0, this.stageElement = s, this.canvasElement = r, this.overlayerElement = o, this.editorElement = a, this.emptyElement = h, this.contextMenuElement = c, this.config = new Wt(e.config || {}), this.eventBus = new oi(), this.eventBrowser = new ri(this), this.eventTable = new li(this), this.paint = new ni(this.canvasElement), this.database = new ii(this, e), this.history = new si(this), this.icons = new ai(this);
|
|
2819
2818
|
}
|
|
2820
2819
|
setConfig(t) {
|
|
2821
2820
|
this.config = new Wt(t);
|
|
@@ -2850,7 +2849,7 @@ class li {
|
|
|
2850
2849
|
for (let r = 0; r <= e[1] - e[0]; r++) {
|
|
2851
2850
|
const o = [];
|
|
2852
2851
|
for (let a = 0; a <= i[1] - i[0]; a++) {
|
|
2853
|
-
const
|
|
2852
|
+
const h = r + e[0], c = a + i[0], f = this.database.getItemValueForRowIndexAndColIndex(h, c);
|
|
2854
2853
|
f && o.push(f.value);
|
|
2855
2854
|
}
|
|
2856
2855
|
s += `${o.join(" ")}\r`, t.push(o);
|
|
@@ -2912,29 +2911,29 @@ class li {
|
|
|
2912
2911
|
}
|
|
2913
2912
|
class Pt {
|
|
2914
2913
|
constructor(t, e) {
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2914
|
+
l(this, "ctx");
|
|
2915
|
+
l(this, "type");
|
|
2916
|
+
l(this, "isFocus", !1);
|
|
2917
|
+
l(this, "trackX", 0);
|
|
2918
|
+
l(this, "trackY", 0);
|
|
2919
|
+
l(this, "trackWidth", 0);
|
|
2920
|
+
l(this, "trackHeight", 0);
|
|
2921
|
+
l(this, "splitPoints", []);
|
|
2923
2922
|
//分割线
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2923
|
+
l(this, "barX", 0);
|
|
2924
|
+
l(this, "barY", 0);
|
|
2925
|
+
l(this, "barWidth", 0);
|
|
2926
|
+
l(this, "barHeight", 0);
|
|
2927
|
+
l(this, "distance", 0);
|
|
2929
2928
|
// 滚动条的长度
|
|
2930
|
-
|
|
2929
|
+
l(this, "visibleDistance", 0);
|
|
2931
2930
|
//可见区域的长度
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2931
|
+
l(this, "clientX", 0);
|
|
2932
|
+
l(this, "clientY", 0);
|
|
2933
|
+
l(this, "dragStart", 0);
|
|
2935
2934
|
// 拖拽开始的位置
|
|
2936
|
-
|
|
2937
|
-
|
|
2935
|
+
l(this, "isDragging", !1);
|
|
2936
|
+
l(this, "scroll", 0);
|
|
2938
2937
|
this.ctx = t, this.type = e, this.type === "vertical" ? this.scroll = this.ctx.scrollY : this.scroll = this.ctx.scrollX;
|
|
2939
2938
|
}
|
|
2940
2939
|
onWheel(t) {
|
|
@@ -2948,7 +2947,7 @@ class Pt {
|
|
|
2948
2947
|
const { offsetX: e, offsetY: i, clientX: s, clientY: r } = t;
|
|
2949
2948
|
if (!(s == this.clientX && r == this.clientY)) {
|
|
2950
2949
|
if (this.isOnScrollbar(e, i))
|
|
2951
|
-
this.clientX = s, this.clientY = r, this.isDragging = !0, this.ctx.scrollerMove = !0, this.isFocus = !0, this.dragStart = this.scroll;
|
|
2950
|
+
this.clientX = s, this.clientY = r, this.isDragging = !0, this.ctx.scrollerMove = !0, this.isFocus = !0, this.dragStart = this.scroll, t.preventDefault();
|
|
2952
2951
|
else if (this.isOnTrack(e, i)) {
|
|
2953
2952
|
let o = 0;
|
|
2954
2953
|
this.type === "vertical" ? o = (i - this.ctx.header.height - this.barHeight / 2) / (this.visibleDistance - this.barHeight) * this.distance : o = (e - this.barWidth / 2) / (this.visibleDistance - this.barWidth) * this.distance, this.scroll = Math.max(0, Math.min(o, this.distance));
|
|
@@ -2990,19 +2989,19 @@ class Pt {
|
|
|
2990
2989
|
stageHeight: i,
|
|
2991
2990
|
stageWidth: s,
|
|
2992
2991
|
config: { SCROLLER_TRACK_SIZE: r = 0, SCROLLER_SIZE: o = 0 }
|
|
2993
|
-
} = this.ctx, a = s,
|
|
2992
|
+
} = this.ctx, a = s, h = i, c = e.height, f = e.width, d = t.height, x = this.ctx.footer.height;
|
|
2994
2993
|
if (this.type === "vertical") {
|
|
2995
|
-
this.visibleDistance =
|
|
2994
|
+
this.visibleDistance = h - r - c, this.distance = d - this.visibleDistance + x, this.trackX = a - r, this.trackY = 0, this.splitPoints = [this.trackX, c, this.trackX + r, c], this.trackWidth = r, this.trackHeight = h, this.barX = this.trackX - 0.5 + (r - o) / 2, this.barWidth = o;
|
|
2996
2995
|
const u = this.distance ? this.visibleDistance / d : 0;
|
|
2997
2996
|
let g = Math.floor(u * this.visibleDistance);
|
|
2998
2997
|
g < 30 ? g = 30 : g > this.visibleDistance && (g = 0), this.barHeight = g, this.barY = c + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
2999
2998
|
} else {
|
|
3000
2999
|
this.visibleDistance = a - r, this.distance = f - this.visibleDistance, this.splitPoints = [
|
|
3001
3000
|
a - r,
|
|
3002
|
-
|
|
3001
|
+
h - r,
|
|
3003
3002
|
a - r,
|
|
3004
|
-
|
|
3005
|
-
], this.trackX = 0, this.trackY =
|
|
3003
|
+
h
|
|
3004
|
+
], this.trackX = 0, this.trackY = h - r, this.trackWidth = a, this.trackHeight = r;
|
|
3006
3005
|
const u = this.distance ? this.visibleDistance / f : 0;
|
|
3007
3006
|
let g = Math.floor(u * this.visibleDistance);
|
|
3008
3007
|
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));
|
|
@@ -3026,9 +3025,9 @@ class Pt {
|
|
|
3026
3025
|
}
|
|
3027
3026
|
class ci {
|
|
3028
3027
|
constructor(t) {
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3028
|
+
l(this, "ctx");
|
|
3029
|
+
l(this, "verticalScrollbar");
|
|
3030
|
+
l(this, "horizontalScrollbar");
|
|
3032
3031
|
this.ctx = t, this.verticalScrollbar = new Pt(t, "vertical"), this.horizontalScrollbar = new Pt(t, "horizontal"), this.ctx.on("wheel", (e) => this.onWheel(e)), this.ctx.on("mousedown", (e) => this.onMouseDown(e)), this.ctx.on("mousemove", (e) => this.onMouseMove(e)), this.ctx.on("mouseup", () => this.onMouseUp()), this.ctx.on("setScroll", (e, i) => {
|
|
3033
3032
|
this.setScroll(e, i);
|
|
3034
3033
|
}), this.ctx.on("setScrollX", (e) => {
|
|
@@ -3082,41 +3081,41 @@ class ci {
|
|
|
3082
3081
|
}
|
|
3083
3082
|
class di {
|
|
3084
3083
|
constructor(t) {
|
|
3085
|
-
|
|
3084
|
+
l(this, "ctx");
|
|
3086
3085
|
// 上下文
|
|
3087
|
-
|
|
3086
|
+
l(this, "x", 0);
|
|
3088
3087
|
// x坐标
|
|
3089
|
-
|
|
3088
|
+
l(this, "y", 0);
|
|
3090
3089
|
// y坐标
|
|
3091
|
-
|
|
3090
|
+
l(this, "width", 0);
|
|
3092
3091
|
// 宽度
|
|
3093
|
-
|
|
3092
|
+
l(this, "height", 0);
|
|
3094
3093
|
// 高度
|
|
3095
|
-
|
|
3094
|
+
l(this, "resizeTarget", null);
|
|
3096
3095
|
//调整表头
|
|
3097
|
-
|
|
3096
|
+
l(this, "resizeNum", 0);
|
|
3098
3097
|
// 调整列的数量
|
|
3099
|
-
|
|
3098
|
+
l(this, "isResizing", !1);
|
|
3100
3099
|
// 是否移动中
|
|
3101
|
-
|
|
3100
|
+
l(this, "clientX", 0);
|
|
3102
3101
|
// 鼠标按下时的x轴位置
|
|
3103
|
-
|
|
3102
|
+
l(this, "resizeDiff", 0);
|
|
3104
3103
|
// 是否移动中
|
|
3105
|
-
|
|
3106
|
-
|
|
3104
|
+
l(this, "columnIndex", 0);
|
|
3105
|
+
l(this, "isMouseDown", !1);
|
|
3107
3106
|
// 是否按下
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3107
|
+
l(this, "columns");
|
|
3108
|
+
l(this, "visibleLeafColumns", []);
|
|
3109
|
+
l(this, "visibleHeight", 0);
|
|
3110
|
+
l(this, "visibleWidth", 0);
|
|
3111
|
+
l(this, "allCellHeaders", []);
|
|
3112
|
+
l(this, "leafCellHeaders", []);
|
|
3113
|
+
l(this, "renderLeafCellHeaders", []);
|
|
3114
|
+
l(this, "fixedLeftCellHeaders", []);
|
|
3115
|
+
l(this, "centerCellHeaders", []);
|
|
3116
|
+
l(this, "fixedRightCellHeaders", []);
|
|
3117
|
+
l(this, "renderCenterCellHeaders", []);
|
|
3118
|
+
l(this, "renderFixedCellHeaders", []);
|
|
3120
3119
|
this.ctx = t, this.ctx.on(
|
|
3121
3120
|
"resetHeader",
|
|
3122
3121
|
Zt(() => {
|
|
@@ -3135,9 +3134,9 @@ class di {
|
|
|
3135
3134
|
this.columnIndex = 0, this.resizeNum = 0, this.render(o, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
3136
3135
|
const a = this.ctx.containerElement.getBoundingClientRect();
|
|
3137
3136
|
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;
|
|
3138
|
-
const
|
|
3139
|
-
if (this.resizeNum &&
|
|
3140
|
-
const d = Math.floor(
|
|
3137
|
+
const h = this.visibleWidth - this.width;
|
|
3138
|
+
if (this.resizeNum && h > 0) {
|
|
3139
|
+
const d = Math.floor(h / this.resizeNum * 100) / 100;
|
|
3141
3140
|
this.resizeAllColumn(d);
|
|
3142
3141
|
}
|
|
3143
3142
|
const c = this.fixedLeftCellHeaders.filter((d) => !d.hasChildren);
|
|
@@ -3170,9 +3169,9 @@ class di {
|
|
|
3170
3169
|
this.ctx.stageElement.style.cursor === "col-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3171
3170
|
const r = [...this.renderFixedCellHeaders, ...this.renderCenterCellHeaders];
|
|
3172
3171
|
for (const o of r) {
|
|
3173
|
-
const { offsetX: a, offsetY:
|
|
3172
|
+
const { offsetX: a, offsetY: h } = this.ctx.getOffset(e), c = a, f = o.getDrawX();
|
|
3174
3173
|
c > f + o.width - 5 && c < f + o.width + 4 && c < i - 4 && // 视窗中最后一列不允许调整宽
|
|
3175
|
-
o.colspan <= 1 && this.ctx.isTarget() &&
|
|
3174
|
+
o.colspan <= 1 && this.ctx.isTarget() && h <= this.height && (this.ctx.stageElement.style.cursor = "col-resize", this.resizeTarget = o);
|
|
3176
3175
|
}
|
|
3177
3176
|
}
|
|
3178
3177
|
}));
|
|
@@ -3226,10 +3225,10 @@ class di {
|
|
|
3226
3225
|
let s = e;
|
|
3227
3226
|
const { HEADER_HEIGHT: r = 0 } = this.ctx.config;
|
|
3228
3227
|
for (let o = 0; o < i; o++) {
|
|
3229
|
-
const a = t[o],
|
|
3228
|
+
const a = t[o], h = r * (a.rowspan || 0), c = r * (a.level || 0);
|
|
3230
3229
|
let f = a.width || 100;
|
|
3231
3230
|
a.children && (f = _t(a.children).reduce((u, g) => u + ((g == null ? void 0 : g.width) || 100), 0));
|
|
3232
|
-
const d = new ie(this.ctx, this.columnIndex, s, c, f,
|
|
3231
|
+
const d = new ie(this.ctx, this.columnIndex, s, c, f, h, a);
|
|
3233
3232
|
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;
|
|
3234
3233
|
}
|
|
3235
3234
|
}
|
|
@@ -3261,8 +3260,8 @@ class di {
|
|
|
3261
3260
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3262
3261
|
colorEnd: "rgba(0,0,0,0)"
|
|
3263
3262
|
}), i < Math.floor(s.width - r - 1) && e !== a) {
|
|
3264
|
-
const
|
|
3265
|
-
this.ctx.paint.drawShadow(
|
|
3263
|
+
const h = s.width - (this.x + this.width) + r - e;
|
|
3264
|
+
this.ctx.paint.drawShadow(h + 1, this.y, e, this.height, {
|
|
3266
3265
|
fillColor: o,
|
|
3267
3266
|
side: "left",
|
|
3268
3267
|
shadowWidth: 4,
|
|
@@ -3290,20 +3289,20 @@ class di {
|
|
|
3290
3289
|
}
|
|
3291
3290
|
}
|
|
3292
3291
|
class se {
|
|
3293
|
-
constructor(t, e, i = 0, s = 0, r = 0, o = 0, a,
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
this.ctx = t, this.x = i, this.y = s, this.width = r, this.height = o, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e), this.rowType =
|
|
3292
|
+
constructor(t, e, i = 0, s = 0, r = 0, o = 0, a, h = "body") {
|
|
3293
|
+
l(this, "ctx");
|
|
3294
|
+
l(this, "x", 0);
|
|
3295
|
+
l(this, "y", 0);
|
|
3296
|
+
l(this, "width", 0);
|
|
3297
|
+
l(this, "height");
|
|
3298
|
+
l(this, "cells", []);
|
|
3299
|
+
l(this, "fixedCells", []);
|
|
3300
|
+
l(this, "noFixedCells", []);
|
|
3301
|
+
l(this, "rowIndex", 0);
|
|
3302
|
+
l(this, "rowKey", "");
|
|
3303
|
+
l(this, "rowType", "body");
|
|
3304
|
+
l(this, "data");
|
|
3305
|
+
this.ctx = t, this.x = i, this.y = s, this.width = r, this.height = o, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e), this.rowType = h, this.data = a, this.update();
|
|
3307
3306
|
}
|
|
3308
3307
|
update() {
|
|
3309
3308
|
const { header: t } = this.ctx, e = [], i = [], s = [];
|
|
@@ -3343,28 +3342,28 @@ class se {
|
|
|
3343
3342
|
}
|
|
3344
3343
|
class fi {
|
|
3345
3344
|
constructor(t) {
|
|
3346
|
-
|
|
3345
|
+
l(this, "resizeTarget", null);
|
|
3347
3346
|
//调整行大小的目标
|
|
3348
|
-
|
|
3347
|
+
l(this, "isMouseDown", !1);
|
|
3349
3348
|
// 是否按下
|
|
3350
|
-
|
|
3349
|
+
l(this, "resizeDiff", 0);
|
|
3351
3350
|
// 是否移动中
|
|
3352
|
-
|
|
3351
|
+
l(this, "clientY", 0);
|
|
3353
3352
|
// 鼠标按下时的y轴位置
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3353
|
+
l(this, "ctx");
|
|
3354
|
+
l(this, "x", 0);
|
|
3355
|
+
l(this, "y", 0);
|
|
3356
|
+
l(this, "width", 0);
|
|
3357
|
+
l(this, "height", 0);
|
|
3358
|
+
l(this, "headIndex", 0);
|
|
3359
|
+
l(this, "tailIndex", 0);
|
|
3360
|
+
l(this, "isResizing", !1);
|
|
3362
3361
|
//是否正在调整大小
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3362
|
+
l(this, "renderRows", []);
|
|
3363
|
+
l(this, "visibleRows", []);
|
|
3364
|
+
l(this, "visibleHeight", 0);
|
|
3365
|
+
l(this, "visibleWidth", 0);
|
|
3366
|
+
l(this, "data", []);
|
|
3368
3367
|
this.ctx = t, this.init(), this.initResizeRow();
|
|
3369
3368
|
}
|
|
3370
3369
|
init() {
|
|
@@ -3377,7 +3376,7 @@ class fi {
|
|
|
3377
3376
|
SCROLLER_TRACK_SIZE: r = 0,
|
|
3378
3377
|
HEIGHT: o,
|
|
3379
3378
|
EMPTY_BODY_HEIGHT: a = 0,
|
|
3380
|
-
MAX_HEIGHT:
|
|
3379
|
+
MAX_HEIGHT: h = 0,
|
|
3381
3380
|
ENABLE_OFFSET_HEIGHT: c = 0,
|
|
3382
3381
|
OFFSET_HEIGHT: f = 0
|
|
3383
3382
|
}
|
|
@@ -3406,7 +3405,7 @@ class fi {
|
|
|
3406
3405
|
let y = 0;
|
|
3407
3406
|
this.data.length && c ? (y = window.innerHeight - u - f, y < 0 && (y = 32, console.error(
|
|
3408
3407
|
"There is an error in the height calculation ENABLE_OFFSET_HEIGHT and OFFSET_HEIGHT are invalid"
|
|
3409
|
-
))) : this.data.length && o ? y = o : this.data.length &&
|
|
3408
|
+
))) : this.data.length && o ? y = o : this.data.length && h && p > h ? y = h : y = p, y > 0 && (this.ctx.stageHeight = Math.floor(y), this.ctx.stageElement.style.height = `${this.ctx.stageHeight - 0.5}px`);
|
|
3410
3409
|
let b = this.ctx.stageHeight - e.height - r;
|
|
3411
3410
|
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;
|
|
3412
3411
|
const m = window.devicePixelRatio || 1, E = this.ctx.stageWidth * m, C = this.ctx.stageHeight * m;
|
|
@@ -3429,7 +3428,7 @@ class fi {
|
|
|
3429
3428
|
}), this.ctx.on("mousemove", (e) => {
|
|
3430
3429
|
if (this.ctx.editing) return;
|
|
3431
3430
|
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), r = i, o = s, a = e.clientY, {
|
|
3432
|
-
stageHeight:
|
|
3431
|
+
stageHeight: h,
|
|
3433
3432
|
scrollY: c,
|
|
3434
3433
|
config: { RESIZE_ROW_MIN_HEIGHT: f = 0 }
|
|
3435
3434
|
} = this.ctx;
|
|
@@ -3443,7 +3442,7 @@ class fi {
|
|
|
3443
3442
|
this.ctx.stageElement.style.cursor === "row-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3444
3443
|
for (let d = 0; d < this.renderRows.length; d++) {
|
|
3445
3444
|
const x = this.renderRows[d];
|
|
3446
|
-
if (r > x.y - c + x.height - 1.5 && r < x.y - c + x.height + 1.5 && r <
|
|
3445
|
+
if (r > x.y - c + x.height - 1.5 && r < x.y - c + x.height + 1.5 && r < h - 4)
|
|
3447
3446
|
for (let g = 0; g < x.cells.length; g++) {
|
|
3448
3447
|
const w = x.cells[g];
|
|
3449
3448
|
o > w.drawX + 10 && o < w.drawX + w.width - 10 && w.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = x);
|
|
@@ -3492,8 +3491,8 @@ class fi {
|
|
|
3492
3491
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3493
3492
|
colorEnd: "rgba(0,0,0,0)"
|
|
3494
3493
|
}), i < Math.floor(s.width - r - 1) && e !== a) {
|
|
3495
|
-
const
|
|
3496
|
-
this.ctx.paint.drawShadow(
|
|
3494
|
+
const h = s.width - (this.x + this.width) + r - e;
|
|
3495
|
+
this.ctx.paint.drawShadow(h + 1, this.y, e, this.height, {
|
|
3497
3496
|
fillColor: o,
|
|
3498
3497
|
side: "left",
|
|
3499
3498
|
shadowWidth: 4,
|
|
@@ -3517,8 +3516,8 @@ class fi {
|
|
|
3517
3516
|
const { header: t, database: e, scrollY: i } = this.ctx, s = i, { data: r, positions: o } = e.getData();
|
|
3518
3517
|
this.ctx.maxRowIndex = r.length - 1;
|
|
3519
3518
|
const a = this.binarySearch(o, s);
|
|
3520
|
-
let
|
|
3521
|
-
|
|
3519
|
+
let h = this.binarySearch(o, s + this.visibleHeight);
|
|
3520
|
+
h === -1 && (h = r.length), this.headIndex = Math.max(0, a), this.tailIndex = Math.min(this.ctx.maxRowIndex, h + 1), this.visibleRows = r.slice(this.headIndex, this.tailIndex + 1), this.ctx.body.headIndex = this.headIndex, this.ctx.body.tailIndex = this.tailIndex, this.ctx.body.visibleRows = this.visibleRows;
|
|
3522
3521
|
const c = [];
|
|
3523
3522
|
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
3524
3523
|
const d = this.headIndex + f, x = this.visibleRows[f], { height: u, top: g } = this.ctx.database.getPositionForRowIndex(d), w = new se(this.ctx, d, 0, g + this.y, t.width, u, x);
|
|
@@ -3536,15 +3535,15 @@ class fi {
|
|
|
3536
3535
|
}
|
|
3537
3536
|
class xi {
|
|
3538
3537
|
constructor(t) {
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3538
|
+
l(this, "ctx");
|
|
3539
|
+
l(this, "renderRows", []);
|
|
3540
|
+
l(this, "data", []);
|
|
3541
|
+
l(this, "x", 0);
|
|
3542
|
+
l(this, "y", 0);
|
|
3543
|
+
l(this, "width", 0);
|
|
3544
|
+
l(this, "height", 0);
|
|
3545
|
+
l(this, "visibleWidth", 0);
|
|
3546
|
+
l(this, "visibleHeight", 0);
|
|
3548
3547
|
this.ctx = t, this.init();
|
|
3549
3548
|
}
|
|
3550
3549
|
init() {
|
|
@@ -3565,8 +3564,8 @@ class xi {
|
|
|
3565
3564
|
stageWidth: r,
|
|
3566
3565
|
config: { HEADER_BG_COLOR: o, SCROLLER_TRACK_SIZE: a }
|
|
3567
3566
|
} = this.ctx;
|
|
3568
|
-
let
|
|
3569
|
-
if (this.ctx.config.FOOTER_FIXED || (
|
|
3567
|
+
let h = this.y;
|
|
3568
|
+
if (this.ctx.config.FOOTER_FIXED || (h = this.y - this.ctx.scrollY), i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, h, t, this.height, {
|
|
3570
3569
|
fillColor: o,
|
|
3571
3570
|
side: "right",
|
|
3572
3571
|
shadowWidth: 4,
|
|
@@ -3574,7 +3573,7 @@ class xi {
|
|
|
3574
3573
|
colorEnd: "rgba(0,0,0,0)"
|
|
3575
3574
|
}), i < Math.floor(s.width - r - 1) && e !== a) {
|
|
3576
3575
|
const c = s.width - (this.x + this.width) + r - e;
|
|
3577
|
-
this.ctx.paint.drawShadow(c + 1,
|
|
3576
|
+
this.ctx.paint.drawShadow(c + 1, h, e, this.height, {
|
|
3578
3577
|
fillColor: o,
|
|
3579
3578
|
side: "left",
|
|
3580
3579
|
shadowWidth: 4,
|
|
@@ -3613,15 +3612,15 @@ class xi {
|
|
|
3613
3612
|
class ui {
|
|
3614
3613
|
// 垂直滚动定时器
|
|
3615
3614
|
constructor(t) {
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3615
|
+
l(this, "isCut", !1);
|
|
3616
|
+
l(this, "isMultipleRow", !1);
|
|
3617
|
+
l(this, "mousedownHeader", !1);
|
|
3618
|
+
l(this, "ctx");
|
|
3619
|
+
l(this, "adjustPositionX", "");
|
|
3620
|
+
l(this, "adjustPositionY", "");
|
|
3621
|
+
l(this, "timerX", 0);
|
|
3623
3622
|
// 水平滚动定时器
|
|
3624
|
-
|
|
3623
|
+
l(this, "timerY", 0);
|
|
3625
3624
|
this.ctx = t, this.init();
|
|
3626
3625
|
}
|
|
3627
3626
|
init() {
|
|
@@ -3645,7 +3644,7 @@ class ui {
|
|
|
3645
3644
|
this.isMultipleRow = !0, this.selectRows(t);
|
|
3646
3645
|
return;
|
|
3647
3646
|
}
|
|
3648
|
-
this.isMultipleRow = !1, this.click(e.shiftKey);
|
|
3647
|
+
e.preventDefault(), this.isMultipleRow = !1, this.click(e.shiftKey);
|
|
3649
3648
|
}
|
|
3650
3649
|
}), this.ctx.on("mouseup", () => {
|
|
3651
3650
|
this.mousedownHeader = !1;
|
|
@@ -3654,42 +3653,44 @@ class ui {
|
|
|
3654
3653
|
}, 0);
|
|
3655
3654
|
}), this.ctx.on("cellHeaderHoverChange", (t) => {
|
|
3656
3655
|
this.ctx.mousedown && this.selectCols(t);
|
|
3657
|
-
}), this.ctx.on("cellHeaderMousedown", (t) => {
|
|
3658
|
-
this.ctx.stageElement.style.cursor !== "pointer" && (this.ctx.isPointer || (this.mousedownHeader = !0, this.selectCols(t)));
|
|
3656
|
+
}), this.ctx.on("cellHeaderMousedown", (t, e) => {
|
|
3657
|
+
this.ctx.stageElement.style.cursor !== "pointer" && (this.ctx.isPointer || (e.preventDefault(), this.mousedownHeader = !0, this.selectCols(t)));
|
|
3659
3658
|
}), this.ctx.on("keydown", (t) => {
|
|
3660
|
-
if (
|
|
3661
|
-
t.
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
t.
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
t.
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
t.preventDefault(), this.
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
t.
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
t.
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
t.
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
t.
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3659
|
+
if (!this.ctx.editing) {
|
|
3660
|
+
if (t.ctrlKey && t.code === "KeyV" || t.metaKey && t.code === "KeyV") {
|
|
3661
|
+
t.preventDefault(), this.paste();
|
|
3662
|
+
return;
|
|
3663
|
+
}
|
|
3664
|
+
if (t.ctrlKey && t.code === "KeyC" || t.metaKey && t.code === "KeyC") {
|
|
3665
|
+
t.preventDefault(), this.copy(), this.isCut = !1;
|
|
3666
|
+
return;
|
|
3667
|
+
}
|
|
3668
|
+
if (t.ctrlKey && t.code === "KeyX" || t.metaKey && t.code === "KeyX") {
|
|
3669
|
+
t.preventDefault(), this.isCut = !0, this.copy();
|
|
3670
|
+
return;
|
|
3671
|
+
}
|
|
3672
|
+
if ((t.ctrlKey && t.code === "KeyA" || t.metaKey && t.code === "KeyA") && (t.preventDefault(), this.selectAll()), t.code === "ArrowLeft") {
|
|
3673
|
+
t.preventDefault(), this.moveFocus("LEFT");
|
|
3674
|
+
return;
|
|
3675
|
+
}
|
|
3676
|
+
if (t.code === "ArrowUp") {
|
|
3677
|
+
t.preventDefault(), this.moveFocus("TOP");
|
|
3678
|
+
return;
|
|
3679
|
+
}
|
|
3680
|
+
if (t.code === "ArrowRight" || t.code === "Tab") {
|
|
3681
|
+
t.preventDefault(), this.moveFocus("RIGHT");
|
|
3682
|
+
return;
|
|
3683
|
+
}
|
|
3684
|
+
if (t.code === "ArrowDown") {
|
|
3685
|
+
t.preventDefault(), this.moveFocus("BOTTOM");
|
|
3686
|
+
return;
|
|
3687
|
+
}
|
|
3688
|
+
if (t.code === "Delete" || t.code === "Backspace") {
|
|
3689
|
+
t.preventDefault(), console.log("删除");
|
|
3690
|
+
const { xArr: e, yArr: i } = this.ctx.selector;
|
|
3691
|
+
this.clearSelectedData(e, i);
|
|
3692
|
+
return;
|
|
3693
|
+
}
|
|
3693
3694
|
}
|
|
3694
3695
|
}), this.ctx.on("contextMenuClearSelected", () => {
|
|
3695
3696
|
const { xArr: t, yArr: e } = this.ctx.selector;
|
|
@@ -3721,12 +3722,12 @@ class ui {
|
|
|
3721
3722
|
this.ctx.mousedown && (this.ctx.selectorMove = !0), this.ctx.selector.enable = !0;
|
|
3722
3723
|
const {
|
|
3723
3724
|
SELECTOR_AREA_MIN_X: a,
|
|
3724
|
-
SELECTOR_AREA_MAX_X:
|
|
3725
|
+
SELECTOR_AREA_MAX_X: h,
|
|
3725
3726
|
SELECTOR_AREA_MIN_Y: c,
|
|
3726
3727
|
SELECTOR_AREA_MAX_Y: f,
|
|
3727
3728
|
SELECTOR_AREA_MAX_X_OFFSET: d,
|
|
3728
3729
|
SELECTOR_AREA_MAX_Y_OFFSET: x
|
|
3729
|
-
} = this.ctx.config, u = a, g =
|
|
3730
|
+
} = this.ctx.config, u = a, g = h || this.ctx.maxColIndex - d, w = c, p = f || this.ctx.maxRowIndex - x;
|
|
3730
3731
|
let [y, b] = r, [m, E] = o;
|
|
3731
3732
|
if (y < u || b > g || m < w || E > p)
|
|
3732
3733
|
return;
|
|
@@ -3744,15 +3745,15 @@ class ui {
|
|
|
3744
3745
|
if (this.ctx.mousedown && this.ctx.focusCellHeader) {
|
|
3745
3746
|
const { colIndex: a } = this.ctx.focusCellHeader;
|
|
3746
3747
|
if (this.ctx.clearSelector(), t.colIndex >= a) {
|
|
3747
|
-
const
|
|
3748
|
-
this.setSelector(
|
|
3748
|
+
const h = [a, t.colIndex + t.colspan - 1], c = [r, o];
|
|
3749
|
+
this.setSelector(h, c);
|
|
3749
3750
|
} else {
|
|
3750
|
-
const
|
|
3751
|
-
this.setSelector(
|
|
3751
|
+
const h = [t.colIndex, a], c = [r, o];
|
|
3752
|
+
this.setSelector(h, c);
|
|
3752
3753
|
}
|
|
3753
3754
|
} else {
|
|
3754
|
-
const a = [t.colIndex, t.colIndex + t.colspan - 1],
|
|
3755
|
-
this.setSelector(a,
|
|
3755
|
+
const a = [t.colIndex, t.colIndex + t.colspan - 1], h = [r, o];
|
|
3756
|
+
this.setSelector(a, h);
|
|
3756
3757
|
}
|
|
3757
3758
|
}
|
|
3758
3759
|
selectAll() {
|
|
@@ -3766,8 +3767,8 @@ class ui {
|
|
|
3766
3767
|
SELECTOR_AREA_MIN_Y: r,
|
|
3767
3768
|
SELECTOR_AREA_MAX_Y: o,
|
|
3768
3769
|
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
3769
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
3770
|
-
} = this.ctx.config, c = i, f = s || this.ctx.maxColIndex - a, d = r, x = o || this.ctx.maxRowIndex -
|
|
3770
|
+
SELECTOR_AREA_MAX_Y_OFFSET: h
|
|
3771
|
+
} = this.ctx.config, c = i, f = s || this.ctx.maxColIndex - a, d = r, x = o || this.ctx.maxRowIndex - h, u = [c, f], g = [d, x];
|
|
3771
3772
|
this.setSelector(u, g);
|
|
3772
3773
|
}
|
|
3773
3774
|
}
|
|
@@ -3777,16 +3778,16 @@ class ui {
|
|
|
3777
3778
|
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;
|
|
3778
3779
|
if (e) {
|
|
3779
3780
|
this.ctx.setFocusCell(t);
|
|
3780
|
-
const
|
|
3781
|
-
this.setSelector(
|
|
3781
|
+
const h = [a, o], c = [t.rowIndex, t.rowIndex];
|
|
3782
|
+
this.setSelector(h, c);
|
|
3782
3783
|
}
|
|
3783
3784
|
if (this.ctx.focusCell && this.ctx.mousedown) {
|
|
3784
|
-
const { rowIndex:
|
|
3785
|
-
if (t.rowIndex >=
|
|
3786
|
-
const c = [a, o], f = [
|
|
3785
|
+
const { rowIndex: h } = this.ctx.focusCell;
|
|
3786
|
+
if (t.rowIndex >= h) {
|
|
3787
|
+
const c = [a, o], f = [h, t.rowIndex];
|
|
3787
3788
|
this.setSelector(c, f);
|
|
3788
3789
|
} else {
|
|
3789
|
-
const c = [a, o], f = [t.rowIndex,
|
|
3790
|
+
const c = [a, o], f = [t.rowIndex, h];
|
|
3790
3791
|
this.setSelector(c, f);
|
|
3791
3792
|
}
|
|
3792
3793
|
}
|
|
@@ -3796,7 +3797,7 @@ class ui {
|
|
|
3796
3797
|
return;
|
|
3797
3798
|
const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
|
|
3798
3799
|
if (t && e && i) {
|
|
3799
|
-
const { rowIndex: s, colIndex: r } = e, o = Math.min(i.colIndex, r), a = Math.max(i.colIndex, r),
|
|
3800
|
+
const { rowIndex: s, colIndex: r } = e, o = Math.min(i.colIndex, r), a = Math.max(i.colIndex, r), h = Math.min(i.rowIndex, s), c = Math.max(i.rowIndex, s), f = [o, a], d = [h, c];
|
|
3800
3801
|
this.setSelector(f, d);
|
|
3801
3802
|
}
|
|
3802
3803
|
}
|
|
@@ -3804,7 +3805,7 @@ class ui {
|
|
|
3804
3805
|
const { focusCell: e, clickCell: i } = this.ctx;
|
|
3805
3806
|
if (e && this.isInSettingRange(e.rowIndex, e.colIndex))
|
|
3806
3807
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
3807
|
-
const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: a } = e,
|
|
3808
|
+
const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: a } = e, h = Math.min(o, s), c = Math.max(o, s), f = Math.min(a, r), d = Math.max(a, r), x = [h, c], u = [f, d];
|
|
3808
3809
|
this.setSelector(x, u);
|
|
3809
3810
|
} else {
|
|
3810
3811
|
this.ctx.emit("cellSelectedClick", e);
|
|
@@ -3845,8 +3846,8 @@ class ui {
|
|
|
3845
3846
|
let s = [];
|
|
3846
3847
|
const r = /* @__PURE__ */ new Set();
|
|
3847
3848
|
for (let a = 0; a <= e[1] - e[0]; a++)
|
|
3848
|
-
for (let
|
|
3849
|
-
const c = a + e[0], f =
|
|
3849
|
+
for (let h = 0; h <= t[1] - t[0]; h++) {
|
|
3850
|
+
const c = a + e[0], f = h + t[0], d = this.ctx.database.getItemValueForRowIndexAndColIndex(c, f);
|
|
3850
3851
|
if (d) {
|
|
3851
3852
|
const { rowKey: x, key: u } = d;
|
|
3852
3853
|
this.ctx.database.getReadonly(x, u) || (r.add(x), s.push({
|
|
@@ -3910,9 +3911,9 @@ class ui {
|
|
|
3910
3911
|
}
|
|
3911
3912
|
if (!a.length)
|
|
3912
3913
|
return;
|
|
3913
|
-
const { BEFORE_PASTE_CHANGE_METHOD:
|
|
3914
|
-
if (typeof
|
|
3915
|
-
const f =
|
|
3914
|
+
const { BEFORE_PASTE_CHANGE_METHOD: h } = this.ctx.config;
|
|
3915
|
+
if (typeof h == "function") {
|
|
3916
|
+
const f = h, d = a.map((x) => ({
|
|
3916
3917
|
rowKey: x.rowKey,
|
|
3917
3918
|
key: x.key,
|
|
3918
3919
|
value: x.value,
|
|
@@ -3941,7 +3942,7 @@ class ui {
|
|
|
3941
3942
|
if (!e)
|
|
3942
3943
|
return;
|
|
3943
3944
|
let { colIndex: i = 0, rowIndex: s = 0 } = e;
|
|
3944
|
-
const r = 0, o = 0, a = this.ctx.maxColIndex,
|
|
3945
|
+
const r = 0, o = 0, a = this.ctx.maxColIndex, h = this.ctx.maxRowIndex;
|
|
3945
3946
|
switch (t) {
|
|
3946
3947
|
case "LEFT":
|
|
3947
3948
|
i > r && i--;
|
|
@@ -3953,7 +3954,7 @@ class ui {
|
|
|
3953
3954
|
i < a && i++;
|
|
3954
3955
|
break;
|
|
3955
3956
|
case "BOTTOM":
|
|
3956
|
-
s <
|
|
3957
|
+
s < h && s++;
|
|
3957
3958
|
break;
|
|
3958
3959
|
}
|
|
3959
3960
|
const c = [i, i], f = [s, s], d = this.getCell(s, i);
|
|
@@ -3970,8 +3971,8 @@ class ui {
|
|
|
3970
3971
|
SELECTOR_AREA_MIN_Y: r,
|
|
3971
3972
|
SELECTOR_AREA_MAX_Y: o,
|
|
3972
3973
|
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
3973
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
3974
|
-
} = this.ctx.config, c = i, f = s || this.ctx.maxColIndex - a, d = r, x = o || this.ctx.maxRowIndex -
|
|
3974
|
+
SELECTOR_AREA_MAX_Y_OFFSET: h
|
|
3975
|
+
} = this.ctx.config, c = i, f = s || this.ctx.maxColIndex - a, d = r, x = o || this.ctx.maxRowIndex - h;
|
|
3975
3976
|
return !(e < c || e > f || t < d || t > x);
|
|
3976
3977
|
}
|
|
3977
3978
|
/**
|
|
@@ -3985,7 +3986,7 @@ class ui {
|
|
|
3985
3986
|
let a = 10 * (s === "left" ? -1 : 1);
|
|
3986
3987
|
this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
|
|
3987
3988
|
a *= 1.5;
|
|
3988
|
-
const { scrollX:
|
|
3989
|
+
const { scrollX: h } = this.ctx, c = h + a;
|
|
3989
3990
|
(c < 0 || c > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(c);
|
|
3990
3991
|
}, 100);
|
|
3991
3992
|
}
|
|
@@ -3994,7 +3995,7 @@ class ui {
|
|
|
3994
3995
|
let a = 10 * (r === "top" ? -1 : 1);
|
|
3995
3996
|
this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
|
|
3996
3997
|
a *= 1.5;
|
|
3997
|
-
const { scrollY:
|
|
3998
|
+
const { scrollY: h } = this.ctx, c = h + a;
|
|
3998
3999
|
(c < 0 || c > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(c);
|
|
3999
4000
|
}, 100);
|
|
4000
4001
|
}
|
|
@@ -4011,7 +4012,7 @@ class ui {
|
|
|
4011
4012
|
fixedLeftWidth: r,
|
|
4012
4013
|
header: o,
|
|
4013
4014
|
footer: a,
|
|
4014
|
-
body:
|
|
4015
|
+
body: h,
|
|
4015
4016
|
scrollX: c,
|
|
4016
4017
|
scrollY: f,
|
|
4017
4018
|
config: { SCROLLER_TRACK_SIZE: d, FOOTER_FIXED: x }
|
|
@@ -4020,7 +4021,7 @@ class ui {
|
|
|
4020
4021
|
return;
|
|
4021
4022
|
const u = r - i.drawX + 1, g = i.drawX + i.width - (e - s) + 1, w = o.height - i.drawY;
|
|
4022
4023
|
let p = i.height;
|
|
4023
|
-
p >
|
|
4024
|
+
p > h.visibleHeight && (p = h.visibleHeight);
|
|
4024
4025
|
let y = 0;
|
|
4025
4026
|
x && (y = a.visibleHeight);
|
|
4026
4027
|
const b = i.drawY + p - (t - y - d);
|
|
@@ -4033,14 +4034,14 @@ class ui {
|
|
|
4033
4034
|
}
|
|
4034
4035
|
class gi {
|
|
4035
4036
|
constructor(t) {
|
|
4036
|
-
|
|
4037
|
+
l(this, "ctx");
|
|
4037
4038
|
this.ctx = t, this.init();
|
|
4038
4039
|
}
|
|
4039
4040
|
init() {
|
|
4040
4041
|
this.ctx.on("cellMouseenter", (t, e) => {
|
|
4041
4042
|
this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default");
|
|
4042
|
-
const { offsetX: i, offsetY: s } = this.ctx.getOffset(e), { xArr: r, yArr: o } = this.ctx.selector, a = r[1],
|
|
4043
|
-
if (this.ctx.config.ENABLE_AUTOFILL && c === a && f ===
|
|
4043
|
+
const { offsetX: i, offsetY: s } = this.ctx.getOffset(e), { xArr: r, yArr: o } = this.ctx.selector, a = r[1], h = o[1], { colIndex: c, rowIndex: f, drawX: d, drawY: x, width: u, height: g } = t;
|
|
4044
|
+
if (this.ctx.config.ENABLE_AUTOFILL && c === a && f === h) {
|
|
4044
4045
|
const p = d + u - 6, y = x + g - 6;
|
|
4045
4046
|
i > p && s > y && (this.ctx.stageElement.style.cursor = "crosshair");
|
|
4046
4047
|
}
|
|
@@ -4073,22 +4074,22 @@ class gi {
|
|
|
4073
4074
|
return;
|
|
4074
4075
|
let o = t, a = e;
|
|
4075
4076
|
if (!r) {
|
|
4076
|
-
const [
|
|
4077
|
-
a = [
|
|
4077
|
+
const [h] = a;
|
|
4078
|
+
a = [h, h];
|
|
4078
4079
|
}
|
|
4079
4080
|
if (!s) {
|
|
4080
|
-
const [
|
|
4081
|
-
o = [
|
|
4081
|
+
const [h] = o;
|
|
4082
|
+
o = [h, h];
|
|
4082
4083
|
}
|
|
4083
4084
|
if (JSON.stringify(this.ctx.autofill.xArr) !== JSON.stringify(o) || JSON.stringify(this.ctx.autofill.yArr) !== JSON.stringify(a)) {
|
|
4084
4085
|
const {
|
|
4085
|
-
SELECTOR_AREA_MIN_X:
|
|
4086
|
+
SELECTOR_AREA_MIN_X: h,
|
|
4086
4087
|
SELECTOR_AREA_MAX_X: c,
|
|
4087
4088
|
SELECTOR_AREA_MIN_Y: f,
|
|
4088
4089
|
SELECTOR_AREA_MAX_Y: d,
|
|
4089
4090
|
SELECTOR_AREA_MAX_X_OFFSET: x,
|
|
4090
4091
|
SELECTOR_AREA_MAX_Y_OFFSET: u
|
|
4091
|
-
} = this.ctx.config, g =
|
|
4092
|
+
} = this.ctx.config, g = h, w = c || this.ctx.maxColIndex - x, p = f, y = d || this.ctx.maxRowIndex - u;
|
|
4092
4093
|
let [b, m] = o, [E, C] = a;
|
|
4093
4094
|
if (b < g || E < p)
|
|
4094
4095
|
return;
|
|
@@ -4105,11 +4106,11 @@ class gi {
|
|
|
4105
4106
|
const g = x + e.yArr[0], w = u + e.xArr[0];
|
|
4106
4107
|
i.set(`${g}-${w}`, !0);
|
|
4107
4108
|
}
|
|
4108
|
-
const { value: s } = e, r = s[0].length, o = s.length, a = this.ctx.autofill.xArr,
|
|
4109
|
+
const { value: s } = e, r = s[0].length, o = s.length, a = this.ctx.autofill.xArr, h = this.ctx.autofill.yArr;
|
|
4109
4110
|
let c = [];
|
|
4110
|
-
for (let x = 0; x <=
|
|
4111
|
+
for (let x = 0; x <= h[1] - h[0]; x++)
|
|
4111
4112
|
for (let u = 0; u <= a[1] - a[0]; u++) {
|
|
4112
|
-
const g = u + a[0], w = x +
|
|
4113
|
+
const g = u + a[0], w = x + h[0], p = s[x % o][u % r], y = this.ctx.database.getItemValueForRowIndexAndColIndex(w, g), b = `${w}-${g}`;
|
|
4113
4114
|
if (y && !i.has(b)) {
|
|
4114
4115
|
const { rowKey: m, key: E } = y;
|
|
4115
4116
|
this.ctx.database.getReadonly(m, E) || (t.add(m), c.push({
|
|
@@ -4172,7 +4173,7 @@ function at(n, t) {
|
|
|
4172
4173
|
function q(n) {
|
|
4173
4174
|
return n.split("-")[0];
|
|
4174
4175
|
}
|
|
4175
|
-
function
|
|
4176
|
+
function lt(n) {
|
|
4176
4177
|
return n.split("-")[1];
|
|
4177
4178
|
}
|
|
4178
4179
|
function re(n) {
|
|
@@ -4189,7 +4190,7 @@ function Mt(n) {
|
|
|
4189
4190
|
}
|
|
4190
4191
|
function yi(n, t, e) {
|
|
4191
4192
|
e === void 0 && (e = !1);
|
|
4192
|
-
const i =
|
|
4193
|
+
const i = lt(n), s = Mt(n), r = Lt(s);
|
|
4193
4194
|
let o = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
|
|
4194
4195
|
return t.reference[r] > t.floating[r] && (o = xt(o)), [o, xt(o)];
|
|
4195
4196
|
}
|
|
@@ -4214,7 +4215,7 @@ function Ei(n, t, e) {
|
|
|
4214
4215
|
}
|
|
4215
4216
|
}
|
|
4216
4217
|
function bi(n, t, e, i) {
|
|
4217
|
-
const s =
|
|
4218
|
+
const s = lt(n);
|
|
4218
4219
|
let r = Ei(q(n), e === "start", i);
|
|
4219
4220
|
return s && (r = r.map((o) => o + "-" + s), t && (r = r.concat(r.map(Ot)))), r;
|
|
4220
4221
|
}
|
|
@@ -4261,9 +4262,9 @@ function Vt(n, t, e) {
|
|
|
4261
4262
|
reference: i,
|
|
4262
4263
|
floating: s
|
|
4263
4264
|
} = n;
|
|
4264
|
-
const r = J(t), o = Mt(t), a = Lt(o),
|
|
4265
|
+
const r = J(t), o = Mt(t), a = Lt(o), h = q(t), c = r === "y", f = i.x + i.width / 2 - s.width / 2, d = i.y + i.height / 2 - s.height / 2, x = i[a] / 2 - s[a] / 2;
|
|
4265
4266
|
let u;
|
|
4266
|
-
switch (
|
|
4267
|
+
switch (h) {
|
|
4267
4268
|
case "top":
|
|
4268
4269
|
u = {
|
|
4269
4270
|
x: f,
|
|
@@ -4294,7 +4295,7 @@ function Vt(n, t, e) {
|
|
|
4294
4295
|
y: i.y
|
|
4295
4296
|
};
|
|
4296
4297
|
}
|
|
4297
|
-
switch (
|
|
4298
|
+
switch (lt(t)) {
|
|
4298
4299
|
case "start":
|
|
4299
4300
|
u[o] -= x * (e && c ? -1 : 1);
|
|
4300
4301
|
break;
|
|
@@ -4310,7 +4311,7 @@ const vi = async (n, t, e) => {
|
|
|
4310
4311
|
strategy: s = "absolute",
|
|
4311
4312
|
middleware: r = [],
|
|
4312
4313
|
platform: o
|
|
4313
|
-
} = e, a = r.filter(Boolean),
|
|
4314
|
+
} = e, a = r.filter(Boolean), h = await (o.isRTL == null ? void 0 : o.isRTL(t));
|
|
4314
4315
|
let c = await o.getElementRects({
|
|
4315
4316
|
reference: n,
|
|
4316
4317
|
floating: t,
|
|
@@ -4318,7 +4319,7 @@ const vi = async (n, t, e) => {
|
|
|
4318
4319
|
}), {
|
|
4319
4320
|
x: f,
|
|
4320
4321
|
y: d
|
|
4321
|
-
} = Vt(c, i,
|
|
4322
|
+
} = Vt(c, i, h), x = i, u = {}, g = 0;
|
|
4322
4323
|
for (let w = 0; w < a.length; w++) {
|
|
4323
4324
|
const {
|
|
4324
4325
|
name: p,
|
|
@@ -4355,7 +4356,7 @@ const vi = async (n, t, e) => {
|
|
|
4355
4356
|
}) : C.rects), {
|
|
4356
4357
|
x: f,
|
|
4357
4358
|
y: d
|
|
4358
|
-
} = Vt(c, x,
|
|
4359
|
+
} = Vt(c, x, h)), w = -1);
|
|
4359
4360
|
}
|
|
4360
4361
|
return {
|
|
4361
4362
|
x: f,
|
|
@@ -4374,7 +4375,7 @@ async function ne(n, t) {
|
|
|
4374
4375
|
platform: r,
|
|
4375
4376
|
rects: o,
|
|
4376
4377
|
elements: a,
|
|
4377
|
-
strategy:
|
|
4378
|
+
strategy: h
|
|
4378
4379
|
} = n, {
|
|
4379
4380
|
boundary: c = "clippingAncestors",
|
|
4380
4381
|
rootBoundary: f = "viewport",
|
|
@@ -4385,7 +4386,7 @@ async function ne(n, t) {
|
|
|
4385
4386
|
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)),
|
|
4386
4387
|
boundary: c,
|
|
4387
4388
|
rootBoundary: f,
|
|
4388
|
-
strategy:
|
|
4389
|
+
strategy: h
|
|
4389
4390
|
})), b = d === "floating" ? {
|
|
4390
4391
|
x: i,
|
|
4391
4392
|
y: s,
|
|
@@ -4401,7 +4402,7 @@ async function ne(n, t) {
|
|
|
4401
4402
|
elements: a,
|
|
4402
4403
|
rect: b,
|
|
4403
4404
|
offsetParent: m,
|
|
4404
|
-
strategy:
|
|
4405
|
+
strategy: h
|
|
4405
4406
|
}) : b);
|
|
4406
4407
|
return {
|
|
4407
4408
|
top: (y.top - C.top + g.top) / E.y,
|
|
@@ -4421,7 +4422,7 @@ const Ri = (n) => ({
|
|
|
4421
4422
|
rects: r,
|
|
4422
4423
|
platform: o,
|
|
4423
4424
|
elements: a,
|
|
4424
|
-
middlewareData:
|
|
4425
|
+
middlewareData: h
|
|
4425
4426
|
} = t, {
|
|
4426
4427
|
element: c,
|
|
4427
4428
|
padding: f = 0
|
|
@@ -4434,7 +4435,7 @@ const Ri = (n) => ({
|
|
|
4434
4435
|
}, u = Mt(s), g = Lt(u), w = await o.getDimensions(c), p = u === "y", y = p ? "top" : "left", b = p ? "bottom" : "right", m = p ? "clientHeight" : "clientWidth", E = r.reference[g] + r.reference[u] - x[u] - r.floating[g], C = x[u] - r.reference[u], R = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(c));
|
|
4435
4436
|
let T = R ? R[m] : 0;
|
|
4436
4437
|
(!T || !await (o.isElement == null ? void 0 : o.isElement(R))) && (T = a.floating[m] || r.floating[g]);
|
|
4437
|
-
const A = E / 2 - C / 2, L = T / 2 - w[g] / 2 - 1, D = rt(d[y], L), B = rt(d[b], L), I = D, S = T - w[g] - B, O = T / 2 - w[g] / 2 + A, G = It(I, O, S), K = !
|
|
4438
|
+
const A = E / 2 - C / 2, L = T / 2 - w[g] / 2 - 1, D = rt(d[y], L), B = rt(d[b], L), I = D, S = T - w[g] - B, O = T / 2 - w[g] / 2 + A, G = It(I, O, S), K = !h.arrow && lt(s) != null && O !== G && r.reference[g] / 2 - (O < I ? D : B) - w[g] / 2 < 0, k = K ? O < I ? O - I : O - S : 0;
|
|
4438
4439
|
return {
|
|
4439
4440
|
[u]: x[u] + k,
|
|
4440
4441
|
data: {
|
|
@@ -4458,7 +4459,7 @@ const Ri = (n) => ({
|
|
|
4458
4459
|
middlewareData: r,
|
|
4459
4460
|
rects: o,
|
|
4460
4461
|
initialPlacement: a,
|
|
4461
|
-
platform:
|
|
4462
|
+
platform: h,
|
|
4462
4463
|
elements: c
|
|
4463
4464
|
} = t, {
|
|
4464
4465
|
mainAxis: f = !0,
|
|
@@ -4471,7 +4472,7 @@ const Ri = (n) => ({
|
|
|
4471
4472
|
} = at(n, t);
|
|
4472
4473
|
if ((e = r.arrow) != null && e.alignmentOffset)
|
|
4473
4474
|
return {};
|
|
4474
|
-
const y = q(s), b = J(a), m = q(a) === a, E = await (
|
|
4475
|
+
const y = q(s), b = J(a), m = q(a) === a, E = await (h.isRTL == null ? void 0 : h.isRTL(c.floating)), C = x || (m || !w ? [xt(a)] : mi(a)), R = g !== "none";
|
|
4475
4476
|
!x && R && C.push(...bi(a, w, g, E));
|
|
4476
4477
|
const T = [a, ...C], A = await ne(t, p), L = [];
|
|
4477
4478
|
let D = ((i = r.flip) == null ? void 0 : i.overflows) || [];
|
|
@@ -4532,7 +4533,7 @@ async function Ii(n, t) {
|
|
|
4532
4533
|
placement: e,
|
|
4533
4534
|
platform: i,
|
|
4534
4535
|
elements: s
|
|
4535
|
-
} = n, r = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), o = q(e), a =
|
|
4536
|
+
} = n, r = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), o = q(e), a = lt(e), h = J(e) === "y", c = ["left", "top"].includes(o) ? -1 : 1, f = r && h ? -1 : 1, d = at(t, n);
|
|
4536
4537
|
let {
|
|
4537
4538
|
mainAxis: x,
|
|
4538
4539
|
crossAxis: u,
|
|
@@ -4546,7 +4547,7 @@ async function Ii(n, t) {
|
|
|
4546
4547
|
crossAxis: d.crossAxis || 0,
|
|
4547
4548
|
alignmentAxis: d.alignmentAxis
|
|
4548
4549
|
};
|
|
4549
|
-
return a && typeof g == "number" && (u = a === "end" ? g * -1 : g),
|
|
4550
|
+
return a && typeof g == "number" && (u = a === "end" ? g * -1 : g), h ? {
|
|
4550
4551
|
x: u * f,
|
|
4551
4552
|
y: x * c
|
|
4552
4553
|
} : {
|
|
@@ -4565,12 +4566,12 @@ const Oi = function(n) {
|
|
|
4565
4566
|
y: r,
|
|
4566
4567
|
placement: o,
|
|
4567
4568
|
middlewareData: a
|
|
4568
|
-
} = t,
|
|
4569
|
+
} = t, h = await Ii(t, n);
|
|
4569
4570
|
return o === ((e = a.offset) == null ? void 0 : e.placement) && (i = a.arrow) != null && i.alignmentOffset ? {} : {
|
|
4570
|
-
x: s +
|
|
4571
|
-
y: r +
|
|
4571
|
+
x: s + h.x,
|
|
4572
|
+
y: r + h.y,
|
|
4572
4573
|
data: {
|
|
4573
|
-
...
|
|
4574
|
+
...h,
|
|
4574
4575
|
placement: o
|
|
4575
4576
|
}
|
|
4576
4577
|
};
|
|
@@ -4600,11 +4601,11 @@ const Oi = function(n) {
|
|
|
4600
4601
|
};
|
|
4601
4602
|
}
|
|
4602
4603
|
},
|
|
4603
|
-
...
|
|
4604
|
+
...h
|
|
4604
4605
|
} = at(n, t), c = {
|
|
4605
4606
|
x: e,
|
|
4606
4607
|
y: i
|
|
4607
|
-
}, f = await ne(t,
|
|
4608
|
+
}, f = await ne(t, h), d = J(q(s)), x = re(d);
|
|
4608
4609
|
let u = c[x], g = c[d];
|
|
4609
4610
|
if (r) {
|
|
4610
4611
|
const p = x === "y" ? "top" : "left", y = x === "y" ? "bottom" : "right", b = u + f[p], m = u - f[y];
|
|
@@ -4659,7 +4660,7 @@ function N(n) {
|
|
|
4659
4660
|
function zt(n) {
|
|
4660
4661
|
return !gt() || typeof ShadowRoot > "u" ? !1 : n instanceof ShadowRoot || n instanceof H(n).ShadowRoot;
|
|
4661
4662
|
}
|
|
4662
|
-
function
|
|
4663
|
+
function ht(n) {
|
|
4663
4664
|
const {
|
|
4664
4665
|
overflow: t,
|
|
4665
4666
|
overflowX: e,
|
|
@@ -4725,24 +4726,24 @@ function z(n) {
|
|
|
4725
4726
|
);
|
|
4726
4727
|
return zt(t) ? t.host : t;
|
|
4727
4728
|
}
|
|
4728
|
-
function
|
|
4729
|
+
function le(n) {
|
|
4729
4730
|
const t = z(n);
|
|
4730
|
-
return Q(t) ? n.ownerDocument ? n.ownerDocument.body : n.body : N(t) &&
|
|
4731
|
+
return Q(t) ? n.ownerDocument ? n.ownerDocument.body : n.body : N(t) && ht(t) ? t : le(t);
|
|
4731
4732
|
}
|
|
4732
4733
|
function Tt(n, t, e) {
|
|
4733
4734
|
var i;
|
|
4734
4735
|
t === void 0 && (t = []), e === void 0 && (e = !0);
|
|
4735
|
-
const s =
|
|
4736
|
+
const s = le(n), r = s === ((i = n.ownerDocument) == null ? void 0 : i.body), o = H(s);
|
|
4736
4737
|
if (r) {
|
|
4737
4738
|
const a = St(o);
|
|
4738
|
-
return t.concat(o, o.visualViewport || [],
|
|
4739
|
+
return t.concat(o, o.visualViewport || [], ht(s) ? s : [], a && e ? Tt(a) : []);
|
|
4739
4740
|
}
|
|
4740
4741
|
return t.concat(s, Tt(s, [], e));
|
|
4741
4742
|
}
|
|
4742
4743
|
function St(n) {
|
|
4743
4744
|
return n.parent && Object.getPrototypeOf(n.parent) ? n.frameElement : null;
|
|
4744
4745
|
}
|
|
4745
|
-
function
|
|
4746
|
+
function he(n) {
|
|
4746
4747
|
const t = X(n);
|
|
4747
4748
|
let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
|
|
4748
4749
|
const s = N(n), r = s ? n.offsetWidth : e, o = s ? n.offsetHeight : i, a = ft(e) !== r || ft(i) !== o;
|
|
@@ -4763,7 +4764,7 @@ function Z(n) {
|
|
|
4763
4764
|
width: i,
|
|
4764
4765
|
height: s,
|
|
4765
4766
|
$: r
|
|
4766
|
-
} =
|
|
4767
|
+
} = he(t);
|
|
4767
4768
|
let o = (r ? ft(e.width) : e.width) / i, a = (r ? ft(e.height) : e.height) / s;
|
|
4768
4769
|
return (!o || !Number.isFinite(o)) && (o = 1), (!a || !Number.isFinite(a)) && (a = 1), {
|
|
4769
4770
|
x: o,
|
|
@@ -4787,19 +4788,19 @@ function ot(n, t, e, i) {
|
|
|
4787
4788
|
let o = V(1);
|
|
4788
4789
|
t && (i ? F(i) && (o = Z(i)) : o = Z(n));
|
|
4789
4790
|
const a = Mi(r, e, i) ? de(r) : V(0);
|
|
4790
|
-
let
|
|
4791
|
+
let h = (s.left + a.x) / o.x, c = (s.top + a.y) / o.y, f = s.width / o.x, d = s.height / o.y;
|
|
4791
4792
|
if (r) {
|
|
4792
4793
|
const x = H(r), u = i && F(i) ? H(i) : i;
|
|
4793
4794
|
let g = x, w = St(g);
|
|
4794
4795
|
for (; w && i && u !== g; ) {
|
|
4795
4796
|
const p = Z(w), y = w.getBoundingClientRect(), b = X(w), m = y.left + (w.clientLeft + parseFloat(b.paddingLeft)) * p.x, E = y.top + (w.clientTop + parseFloat(b.paddingTop)) * p.y;
|
|
4796
|
-
|
|
4797
|
+
h *= p.x, c *= p.y, f *= p.x, d *= p.y, h += m, c += E, g = H(w), w = St(g);
|
|
4797
4798
|
}
|
|
4798
4799
|
}
|
|
4799
4800
|
return ut({
|
|
4800
4801
|
width: f,
|
|
4801
4802
|
height: d,
|
|
4802
|
-
x:
|
|
4803
|
+
x: h,
|
|
4803
4804
|
y: c
|
|
4804
4805
|
});
|
|
4805
4806
|
}
|
|
@@ -4813,20 +4814,20 @@ function Hi(n) {
|
|
|
4813
4814
|
const r = s === "fixed", o = Y(i), a = t ? wt(t.floating) : !1;
|
|
4814
4815
|
if (i === o || a && r)
|
|
4815
4816
|
return e;
|
|
4816
|
-
let
|
|
4817
|
+
let h = {
|
|
4817
4818
|
scrollLeft: 0,
|
|
4818
4819
|
scrollTop: 0
|
|
4819
4820
|
}, c = V(1);
|
|
4820
4821
|
const f = V(0), d = N(i);
|
|
4821
|
-
if ((d || !d && !r) && ((tt(i) !== "body" ||
|
|
4822
|
+
if ((d || !d && !r) && ((tt(i) !== "body" || ht(o)) && (h = pt(i)), N(i))) {
|
|
4822
4823
|
const x = ot(i);
|
|
4823
4824
|
c = Z(i), f.x = x.x + i.clientLeft, f.y = x.y + i.clientTop;
|
|
4824
4825
|
}
|
|
4825
4826
|
return {
|
|
4826
4827
|
width: e.width * c.x,
|
|
4827
4828
|
height: e.height * c.y,
|
|
4828
|
-
x: e.x * c.x -
|
|
4829
|
-
y: e.y * c.y -
|
|
4829
|
+
x: e.x * c.x - h.scrollLeft * c.x + f.x,
|
|
4830
|
+
y: e.y * c.y - h.scrollTop * c.y + f.y
|
|
4830
4831
|
};
|
|
4831
4832
|
}
|
|
4832
4833
|
function Di(n) {
|
|
@@ -4849,25 +4850,25 @@ function Fi(n) {
|
|
|
4849
4850
|
}
|
|
4850
4851
|
function Xi(n, t) {
|
|
4851
4852
|
const e = H(n), i = Y(n), s = e.visualViewport;
|
|
4852
|
-
let r = i.clientWidth, o = i.clientHeight, a = 0,
|
|
4853
|
+
let r = i.clientWidth, o = i.clientHeight, a = 0, h = 0;
|
|
4853
4854
|
if (s) {
|
|
4854
4855
|
r = s.width, o = s.height;
|
|
4855
4856
|
const c = Dt();
|
|
4856
|
-
(!c || c && t === "fixed") && (a = s.offsetLeft,
|
|
4857
|
+
(!c || c && t === "fixed") && (a = s.offsetLeft, h = s.offsetTop);
|
|
4857
4858
|
}
|
|
4858
4859
|
return {
|
|
4859
4860
|
width: r,
|
|
4860
4861
|
height: o,
|
|
4861
4862
|
x: a,
|
|
4862
|
-
y:
|
|
4863
|
+
y: h
|
|
4863
4864
|
};
|
|
4864
4865
|
}
|
|
4865
4866
|
function ki(n, t) {
|
|
4866
|
-
const e = ot(n, !0, t === "fixed"), i = e.top + n.clientTop, s = e.left + n.clientLeft, r = N(n) ? Z(n) : V(1), o = n.clientWidth * r.x, a = n.clientHeight * r.y,
|
|
4867
|
+
const e = ot(n, !0, t === "fixed"), i = e.top + n.clientTop, s = e.left + n.clientLeft, r = N(n) ? Z(n) : V(1), o = n.clientWidth * r.x, a = n.clientHeight * r.y, h = s * r.x, c = i * r.y;
|
|
4867
4868
|
return {
|
|
4868
4869
|
width: o,
|
|
4869
4870
|
height: a,
|
|
4870
|
-
x:
|
|
4871
|
+
x: h,
|
|
4871
4872
|
y: c
|
|
4872
4873
|
};
|
|
4873
4874
|
}
|
|
@@ -4901,8 +4902,8 @@ function Ni(n, t) {
|
|
|
4901
4902
|
const r = X(n).position === "fixed";
|
|
4902
4903
|
let o = r ? z(n) : n;
|
|
4903
4904
|
for (; F(o) && !Q(o); ) {
|
|
4904
|
-
const a = X(o),
|
|
4905
|
-
!
|
|
4905
|
+
const a = X(o), h = Ht(o);
|
|
4906
|
+
!h && a.position === "fixed" && (s = null), (r ? !h && !s : !h && a.position === "static" && !!s && ["absolute", "fixed"].includes(s.position) || ht(o) && !h && fe(n, o)) ? i = i.filter((f) => f !== o) : s = a, o = z(o);
|
|
4906
4907
|
}
|
|
4907
4908
|
return t.set(n, i), i;
|
|
4908
4909
|
}
|
|
@@ -4913,22 +4914,22 @@ function Ki(n) {
|
|
|
4913
4914
|
rootBoundary: i,
|
|
4914
4915
|
strategy: s
|
|
4915
4916
|
} = n;
|
|
4916
|
-
const o = [...e === "clippingAncestors" ? wt(t) ? [] : Ni(t, this._c) : [].concat(e), i], a = o[0],
|
|
4917
|
+
const o = [...e === "clippingAncestors" ? wt(t) ? [] : Ni(t, this._c) : [].concat(e), i], a = o[0], h = o.reduce((c, f) => {
|
|
4917
4918
|
const d = $t(t, f, s);
|
|
4918
4919
|
return c.top = U(d.top, c.top), c.right = rt(d.right, c.right), c.bottom = rt(d.bottom, c.bottom), c.left = U(d.left, c.left), c;
|
|
4919
4920
|
}, $t(t, a, s));
|
|
4920
4921
|
return {
|
|
4921
|
-
width:
|
|
4922
|
-
height:
|
|
4923
|
-
x:
|
|
4924
|
-
y:
|
|
4922
|
+
width: h.right - h.left,
|
|
4923
|
+
height: h.bottom - h.top,
|
|
4924
|
+
x: h.left,
|
|
4925
|
+
y: h.top
|
|
4925
4926
|
};
|
|
4926
4927
|
}
|
|
4927
4928
|
function Yi(n) {
|
|
4928
4929
|
const {
|
|
4929
4930
|
width: t,
|
|
4930
4931
|
height: e
|
|
4931
|
-
} =
|
|
4932
|
+
} = he(n);
|
|
4932
4933
|
return {
|
|
4933
4934
|
width: t,
|
|
4934
4935
|
height: e
|
|
@@ -4940,19 +4941,19 @@ function Bi(n, t, e) {
|
|
|
4940
4941
|
scrollLeft: 0,
|
|
4941
4942
|
scrollTop: 0
|
|
4942
4943
|
};
|
|
4943
|
-
const
|
|
4944
|
+
const h = V(0);
|
|
4944
4945
|
if (i || !i && !r)
|
|
4945
|
-
if ((tt(t) !== "body" ||
|
|
4946
|
+
if ((tt(t) !== "body" || ht(s)) && (a = pt(t)), i) {
|
|
4946
4947
|
const u = ot(t, !0, r, t);
|
|
4947
|
-
|
|
4948
|
-
} else s && (
|
|
4948
|
+
h.x = u.x + t.clientLeft, h.y = u.y + t.clientTop;
|
|
4949
|
+
} else s && (h.x = At(s));
|
|
4949
4950
|
let c = 0, f = 0;
|
|
4950
4951
|
if (s && !i && !r) {
|
|
4951
4952
|
const u = s.getBoundingClientRect();
|
|
4952
4953
|
f = u.top + a.scrollTop, c = u.left + a.scrollLeft - // RTL <body> scrollbar.
|
|
4953
4954
|
At(s, u);
|
|
4954
4955
|
}
|
|
4955
|
-
const d = o.left + a.scrollLeft -
|
|
4956
|
+
const d = o.left + a.scrollLeft - h.x - c, x = o.top + a.scrollTop - h.y - f;
|
|
4956
4957
|
return {
|
|
4957
4958
|
x: d,
|
|
4958
4959
|
y: x,
|
|
@@ -5030,11 +5031,11 @@ const Vi = {
|
|
|
5030
5031
|
};
|
|
5031
5032
|
let $i = class {
|
|
5032
5033
|
constructor(t) {
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5034
|
+
l(this, "ctx");
|
|
5035
|
+
l(this, "enable", !1);
|
|
5036
|
+
l(this, "contentEl");
|
|
5037
|
+
l(this, "floatingEl");
|
|
5038
|
+
l(this, "arrowEl");
|
|
5038
5039
|
this.ctx = t;
|
|
5039
5040
|
const { TOOLTIP_BG_COLOR: e, TOOLTIP_TEXT_COLOR: i, TOOLTIP_ZINDEX: s, TOOLTIP_CUSTOM_STYLE: r, CSS_PREFIX: o } = this.ctx.config;
|
|
5040
5041
|
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`;
|
|
@@ -5049,7 +5050,7 @@ let $i = class {
|
|
|
5049
5050
|
borderRadius: "4px",
|
|
5050
5051
|
fontSize: "12px",
|
|
5051
5052
|
...r
|
|
5052
|
-
},
|
|
5053
|
+
}, h = {
|
|
5053
5054
|
position: "absolute",
|
|
5054
5055
|
width: "10px",
|
|
5055
5056
|
height: "10px",
|
|
@@ -5058,7 +5059,7 @@ let $i = class {
|
|
|
5058
5059
|
transform: "rotate(45deg)",
|
|
5059
5060
|
zIndex: a.zIndex
|
|
5060
5061
|
};
|
|
5061
|
-
Object.assign(this.arrowEl.style,
|
|
5062
|
+
Object.assign(this.arrowEl.style, h), Object.assign(this.floatingEl.style, a), this.floatingEl.appendChild(this.contentEl), this.floatingEl.appendChild(this.arrowEl), this.ctx.containerElement.appendChild(this.floatingEl), this.init();
|
|
5062
5063
|
}
|
|
5063
5064
|
init() {
|
|
5064
5065
|
this.ctx.on("mousemove", (t) => {
|
|
@@ -5083,7 +5084,7 @@ let $i = class {
|
|
|
5083
5084
|
const i = this.ctx.containerElement.getBoundingClientRect();
|
|
5084
5085
|
if (!i)
|
|
5085
5086
|
return;
|
|
5086
|
-
this.enable = !0, this.contentEl.style.maxWidth = `${t.overflowTooltipMaxWidth || 500}px`, this.contentEl.style.width = "100%", this.contentEl.style.display = "inline-block", this.contentEl.style.wordBreak = "break-all", this.contentEl.style.lineHeight = "1.5", this.contentEl.innerText = e;
|
|
5087
|
+
this.enable = !0, this.contentEl.style.maxWidth = `${t.overflowTooltipMaxWidth || 500}px`, this.contentEl.style.minWidth = "100px", this.contentEl.style.width = "100%", this.contentEl.style.display = "inline-block", this.contentEl.style.wordBreak = "break-all", this.contentEl.style.lineHeight = "1.5", this.contentEl.innerText = e;
|
|
5087
5088
|
const s = t.drawX + i.x, r = t.drawY + i.y;
|
|
5088
5089
|
pe({
|
|
5089
5090
|
getBoundingClientRect() {
|
|
@@ -5102,10 +5103,10 @@ let $i = class {
|
|
|
5102
5103
|
placement: t.overflowTooltipPlacement,
|
|
5103
5104
|
middleware: [ge(), we(), ue(6), zi({ element: this.arrowEl })]
|
|
5104
5105
|
}).then((a) => {
|
|
5105
|
-
const { x:
|
|
5106
|
+
const { x: h, y: c, placement: f, middlewareData: d } = a;
|
|
5106
5107
|
if (Object.assign(this.floatingEl.style, {
|
|
5107
5108
|
top: `${c}px`,
|
|
5108
|
-
left: `${
|
|
5109
|
+
left: `${h}px`
|
|
5109
5110
|
}), d.arrow) {
|
|
5110
5111
|
const x = d.arrow;
|
|
5111
5112
|
["left", "left-start", "left-end"].includes(f) ? Object.assign(this.arrowEl.style, {
|
|
@@ -5141,13 +5142,13 @@ let $i = class {
|
|
|
5141
5142
|
};
|
|
5142
5143
|
class qi {
|
|
5143
5144
|
constructor(t) {
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5145
|
+
l(this, "editorEl");
|
|
5146
|
+
l(this, "inputEl");
|
|
5147
|
+
l(this, "enable", !1);
|
|
5148
|
+
l(this, "cellTarget", null);
|
|
5149
|
+
l(this, "ctx");
|
|
5150
|
+
l(this, "drawY", 0);
|
|
5151
|
+
l(this, "drawX", 0);
|
|
5151
5152
|
this.ctx = t, this.initTextEditor(), this.init();
|
|
5152
5153
|
}
|
|
5153
5154
|
init() {
|
|
@@ -5232,12 +5233,12 @@ class qi {
|
|
|
5232
5233
|
this.drawX = r, this.drawY = o;
|
|
5233
5234
|
let { height: a } = t;
|
|
5234
5235
|
const {
|
|
5235
|
-
config: { CELL_PADDING:
|
|
5236
|
+
config: { CELL_PADDING: h },
|
|
5236
5237
|
header: c
|
|
5237
5238
|
} = this.ctx;
|
|
5238
5239
|
let f = this.ctx.body.visibleHeight;
|
|
5239
|
-
if (a > f && (a = f), this.editorEl.style.left = `${r - 1}px`, this.editorEl.style.top = `${o - 1}px`, this.editorEl.style.bottom = "auto", this.editorEl.style.maxHeight = `${f}px`, s === "text") {
|
|
5240
|
-
this.inputEl.style.display = "block", this.inputEl.style.minWidth = `${i - 1}px`, this.inputEl.style.minHeight = `${a - 1}px`, this.inputEl.style.maxHeight = `${f}px`, this.inputEl.style.width = `${i - 1}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${
|
|
5240
|
+
if (a > f && (a = f), this.editorEl.style.display = "inline-block", this.editorEl.style.left = `${r - 1}px`, this.editorEl.style.top = `${o - 1}px`, this.editorEl.style.bottom = "auto", this.editorEl.style.maxHeight = `${f}px`, s === "text") {
|
|
5241
|
+
this.inputEl.style.display = "block", this.inputEl.style.minWidth = `${i - 1}px`, this.inputEl.style.minHeight = `${a - 1}px`, this.inputEl.style.maxHeight = `${f}px`, this.inputEl.style.width = `${i - 1}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${h}px`, e !== null && (this.inputEl.value = e), this.inputEl.focus();
|
|
5241
5242
|
const d = this.inputEl.value.length;
|
|
5242
5243
|
this.inputEl.setSelectionRange(d, d);
|
|
5243
5244
|
} else
|
|
@@ -5245,7 +5246,7 @@ class qi {
|
|
|
5245
5246
|
(this.inputEl.scrollHeight > a || o < c.height) && this.autoSize();
|
|
5246
5247
|
}
|
|
5247
5248
|
doneEditByInput() {
|
|
5248
|
-
if (this.cellTarget && (this.editorEl.style.
|
|
5249
|
+
if (this.cellTarget && (this.editorEl.style.display = "none", this.cellTarget.editorType === "text")) {
|
|
5249
5250
|
const { rowKey: t, key: e } = this.cellTarget, i = this.cellTarget.getValue(), s = this.inputEl.value;
|
|
5250
5251
|
s !== i && !(s === "" && i === null) && this.ctx.database.setItemValue(t, e, s, !0, !0, !0), this.inputEl.value = "";
|
|
5251
5252
|
}
|
|
@@ -5271,8 +5272,8 @@ class qi {
|
|
|
5271
5272
|
const r = this.ctx.focusCell;
|
|
5272
5273
|
if (!r || ["index", "index-selection", "selection"].includes(r.type) || this.enable)
|
|
5273
5274
|
return;
|
|
5274
|
-
const { rowKey: o, key: a } = r,
|
|
5275
|
-
r && !
|
|
5275
|
+
const { rowKey: o, key: a } = r, h = this.ctx.database.getReadonly(o, a);
|
|
5276
|
+
r && !h && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = r, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
5276
5277
|
}
|
|
5277
5278
|
doneEdit() {
|
|
5278
5279
|
this.enable && (this.doneEditByInput(), this.ctx.emit("doneEdit", this.cellTarget), this.enable = !1, this.ctx.stageElement.focus(), this.ctx.editing = !1);
|
|
@@ -5284,18 +5285,18 @@ class qi {
|
|
|
5284
5285
|
}
|
|
5285
5286
|
class Gi {
|
|
5286
5287
|
constructor(t) {
|
|
5287
|
-
|
|
5288
|
-
|
|
5288
|
+
l(this, "ctx");
|
|
5289
|
+
l(this, "emptyEl");
|
|
5289
5290
|
this.ctx = t;
|
|
5290
5291
|
const { EMPTY_TEXT: e, EMPTY_CUSTOM_STYLE: i } = this.ctx.config;
|
|
5291
5292
|
this.ctx.emptyElement ? this.emptyEl = this.ctx.emptyElement : (this.emptyEl = document.createElement("div"), this.emptyEl.innerText = e), this.emptyEl.className = "e-virt-table-empty", this.emptyEl.style.display = "none", this.ctx.containerElement.appendChild(this.emptyEl), this.ctx.on("emptyChange", ({ type: s, headerHeight: r, bodyHeight: o, footerHeight: a }) => {
|
|
5292
|
-
const
|
|
5293
|
+
const h = r + (o + a) / 2, c = {
|
|
5293
5294
|
display: s === "empty" ? "block" : "none",
|
|
5294
5295
|
position: "absolute",
|
|
5295
5296
|
fontSize: "14px",
|
|
5296
5297
|
color: "#666",
|
|
5297
5298
|
left: "50%",
|
|
5298
|
-
top: `${
|
|
5299
|
+
top: `${h}px`,
|
|
5299
5300
|
transform: "translate(-50%, -50%)",
|
|
5300
5301
|
...i
|
|
5301
5302
|
};
|
|
@@ -5308,7 +5309,7 @@ class Gi {
|
|
|
5308
5309
|
}
|
|
5309
5310
|
class ji {
|
|
5310
5311
|
constructor(t) {
|
|
5311
|
-
|
|
5312
|
+
l(this, "ctx");
|
|
5312
5313
|
this.ctx = t;
|
|
5313
5314
|
}
|
|
5314
5315
|
draw() {
|
|
@@ -5335,9 +5336,9 @@ class ji {
|
|
|
5335
5336
|
fixedRightWidth: e,
|
|
5336
5337
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
5337
5338
|
} = this.ctx, { visibleWidth: r, visibleHeight: o, renderCellHeaders: a } = this.ctx.header;
|
|
5338
|
-
let
|
|
5339
|
+
let h = [], c = [], f = [];
|
|
5339
5340
|
a.forEach((p) => {
|
|
5340
|
-
p.render && (p.fixed === "left" ? c.push(p) : p.fixed === "right" ? f.push(p) :
|
|
5341
|
+
p.render && (p.fixed === "left" ? c.push(p) : p.fixed === "right" ? f.push(p) : h.push(p));
|
|
5341
5342
|
});
|
|
5342
5343
|
const d = e - i, x = {
|
|
5343
5344
|
key: "left",
|
|
@@ -5360,7 +5361,7 @@ class ji {
|
|
|
5360
5361
|
width: `${r - t - d + 1}px`,
|
|
5361
5362
|
height: `${o}px`
|
|
5362
5363
|
},
|
|
5363
|
-
cells:
|
|
5364
|
+
cells: h
|
|
5364
5365
|
}, g = {
|
|
5365
5366
|
key: "right",
|
|
5366
5367
|
style: {
|
|
@@ -5396,7 +5397,7 @@ class ji {
|
|
|
5396
5397
|
const {
|
|
5397
5398
|
fixedLeftWidth: r,
|
|
5398
5399
|
fixedRightWidth: o,
|
|
5399
|
-
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX:
|
|
5400
|
+
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX: h }
|
|
5400
5401
|
} = this.ctx, { visibleWidth: c, visibleHeight: f } = this.ctx.body, d = o - a, x = {
|
|
5401
5402
|
key: "left",
|
|
5402
5403
|
style: {
|
|
@@ -5433,7 +5434,7 @@ class ji {
|
|
|
5433
5434
|
};
|
|
5434
5435
|
return {
|
|
5435
5436
|
type: "body",
|
|
5436
|
-
class: `${
|
|
5437
|
+
class: `${h}-overlayer-body`,
|
|
5437
5438
|
style: {
|
|
5438
5439
|
position: "relative",
|
|
5439
5440
|
overflow: "hidden",
|
|
@@ -5454,7 +5455,7 @@ class ji {
|
|
|
5454
5455
|
fixedLeftWidth: s,
|
|
5455
5456
|
fixedRightWidth: r,
|
|
5456
5457
|
config: { SCROLLER_TRACK_SIZE: o, CSS_PREFIX: a }
|
|
5457
|
-
} = this.ctx, { visibleWidth:
|
|
5458
|
+
} = this.ctx, { visibleWidth: h, visibleHeight: c } = this.ctx.footer, f = r - o, d = {
|
|
5458
5459
|
key: "left",
|
|
5459
5460
|
style: {
|
|
5460
5461
|
position: "absolute",
|
|
@@ -5472,7 +5473,7 @@ class ji {
|
|
|
5472
5473
|
top: `${0.5}px`,
|
|
5473
5474
|
left: `${s - 0.5}px`,
|
|
5474
5475
|
overflow: "hidden",
|
|
5475
|
-
width: `${
|
|
5476
|
+
width: `${h - s - f}px`,
|
|
5476
5477
|
height: `${c}px`
|
|
5477
5478
|
},
|
|
5478
5479
|
cells: t
|
|
@@ -5494,7 +5495,7 @@ class ji {
|
|
|
5494
5495
|
style: {
|
|
5495
5496
|
position: "relative",
|
|
5496
5497
|
overflow: "hidden",
|
|
5497
|
-
width: `${
|
|
5498
|
+
width: `${h}px`,
|
|
5498
5499
|
height: `${c}px`
|
|
5499
5500
|
},
|
|
5500
5501
|
views: [d, x, u]
|
|
@@ -5503,17 +5504,17 @@ class ji {
|
|
|
5503
5504
|
}
|
|
5504
5505
|
class Ui {
|
|
5505
5506
|
constructor(t) {
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5507
|
+
l(this, "ctx");
|
|
5508
|
+
l(this, "contextMenuEl");
|
|
5509
|
+
l(this, "custom", !1);
|
|
5509
5510
|
this.ctx = t, this.ctx.contextMenuElement ? (this.custom = !0, this.contextMenuEl = this.ctx.contextMenuElement) : (this.custom = !1, this.contextMenuEl = document.createElement("div")), this.createContextMenu(), this.init();
|
|
5510
5511
|
}
|
|
5511
5512
|
init() {
|
|
5512
5513
|
this.ctx.on("cellContextMenuClick", (t, e) => {
|
|
5513
5514
|
if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
|
|
5514
5515
|
e.preventDefault();
|
|
5515
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [a,
|
|
5516
|
-
c >= a && c <=
|
|
5516
|
+
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [a, h] = s, { rowIndex: c, colIndex: f } = t;
|
|
5517
|
+
c >= a && c <= h && f >= r && f <= o || this.ctx.emit("setSelectorCell", t, e);
|
|
5517
5518
|
const x = {
|
|
5518
5519
|
getBoundingClientRect: () => ({
|
|
5519
5520
|
width: 0,
|
|
@@ -5587,19 +5588,19 @@ class Ui {
|
|
|
5587
5588
|
}
|
|
5588
5589
|
class Qi {
|
|
5589
5590
|
constructor(t, e) {
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5591
|
+
l(this, "options");
|
|
5592
|
+
l(this, "scroller");
|
|
5593
|
+
l(this, "header");
|
|
5594
|
+
l(this, "body");
|
|
5595
|
+
l(this, "footer");
|
|
5596
|
+
l(this, "selector");
|
|
5597
|
+
l(this, "autofill");
|
|
5598
|
+
l(this, "tooltip");
|
|
5599
|
+
l(this, "editor");
|
|
5600
|
+
l(this, "empty");
|
|
5601
|
+
l(this, "overlayer");
|
|
5602
|
+
l(this, "contextMenu");
|
|
5603
|
+
l(this, "ctx");
|
|
5603
5604
|
this.options = e;
|
|
5604
5605
|
const { overlayerElement: i, editorElement: s, emptyElement: r, contextMenuElement: o } = e, a = this.createContainer(
|
|
5605
5606
|
t,
|
|
@@ -5608,7 +5609,7 @@ class Qi {
|
|
|
5608
5609
|
r,
|
|
5609
5610
|
o
|
|
5610
5611
|
);
|
|
5611
|
-
this.ctx = new
|
|
5612
|
+
this.ctx = new hi(a, this.options), this.header = new di(this.ctx), this.body = new fi(this.ctx), this.footer = new xi(this.ctx), this.scroller = new ci(this.ctx), this.selector = new ui(this.ctx), this.autofill = new gi(this.ctx), this.tooltip = new $i(this.ctx), this.empty = new Gi(this.ctx), this.editor = new qi(this.ctx), this.overlayer = new ji(this.ctx), this.contextMenu = new Ui(this.ctx), this.ctx.on("draw", () => {
|
|
5612
5613
|
this.draw();
|
|
5613
5614
|
}), this.ctx.on("drawView", () => {
|
|
5614
5615
|
this.draw(!0);
|
|
@@ -5616,16 +5617,16 @@ class Qi {
|
|
|
5616
5617
|
}
|
|
5617
5618
|
createContainer(t, e, i, s, r) {
|
|
5618
5619
|
t.className = "e-virt-table-container";
|
|
5619
|
-
const o = document.createElement("div"), a = document.createElement("canvas"),
|
|
5620
|
-
o.className = "e-virt-table-stage", a.className = "e-virt-table-canvas",
|
|
5620
|
+
const o = document.createElement("div"), a = document.createElement("canvas"), h = e || document.createElement("div");
|
|
5621
|
+
o.className = "e-virt-table-stage", a.className = "e-virt-table-canvas", h.className = "e-virt-table-overlayer";
|
|
5621
5622
|
const c = i || document.createElement("div");
|
|
5622
5623
|
c.className = "e-virt-table-editor";
|
|
5623
5624
|
const f = s, d = r;
|
|
5624
|
-
return o.appendChild(a), o.appendChild(
|
|
5625
|
+
return o.appendChild(a), o.appendChild(h), t.appendChild(o), {
|
|
5625
5626
|
containerElement: t,
|
|
5626
5627
|
stageElement: o,
|
|
5627
5628
|
canvasElement: a,
|
|
5628
|
-
overlayerElement:
|
|
5629
|
+
overlayerElement: h,
|
|
5629
5630
|
editorElement: c,
|
|
5630
5631
|
emptyElement: f,
|
|
5631
5632
|
contextMenuElement: d
|
|
@@ -5696,8 +5697,8 @@ class Qi {
|
|
|
5696
5697
|
if (t && Array.isArray(s) && s.length) {
|
|
5697
5698
|
const [r] = s;
|
|
5698
5699
|
if (Array.isArray(r) && r.length) {
|
|
5699
|
-
const [o] = r, { rowKey: a, key:
|
|
5700
|
-
this.scrollToRowkey(a), this.scrollToColkey(
|
|
5700
|
+
const [o] = r, { rowKey: a, key: h } = o;
|
|
5701
|
+
this.scrollToRowkey(a), this.scrollToColkey(h);
|
|
5701
5702
|
}
|
|
5702
5703
|
}
|
|
5703
5704
|
i(s);
|
|
@@ -5722,7 +5723,7 @@ class Qi {
|
|
|
5722
5723
|
let r = [];
|
|
5723
5724
|
for (let o = 0; o < i.length; o++)
|
|
5724
5725
|
for (let a = 0; a < s.length; a++) {
|
|
5725
|
-
const
|
|
5726
|
+
const h = this.ctx.database.getRowKeyByItem(i[o]), f = s[a].key, d = await this.ctx.database.getValidator(h, f);
|
|
5726
5727
|
Array.isArray(d) && d.length && r.push(d);
|
|
5727
5728
|
}
|
|
5728
5729
|
r.length ? (e(r), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
|