e-virt-table 0.1.4 → 0.1.5
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 +690 -692
- 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/Database.js +8 -8
- package/dist/lib/Database.js.map +1 -1
- package/dist/lib/EVirtTable.js +0 -2
- package/dist/lib/EVirtTable.js.map +1 -1
- package/dist/lib/Selector.d.ts +0 -1
- package/dist/lib/Selector.js +28 -32
- package/dist/lib/Selector.js.map +1 -1
- 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:10px}.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:10}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--e-virt-table-color-white);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--e-virt-table-text-color-regular);background-color:var(--e-virt-table-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--e-virt-table-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:8px 24px;color:var(--e-virt-table-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--e-virt-table-color-primary);background-color:#f5f7fa}')),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
2
|
var me = Object.defineProperty;
|
|
3
3
|
var Ee = (n, t, e) => t in n ? me(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
4
|
-
var
|
|
4
|
+
var h = (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 l = Function.bind.apply(s, a), c = new l();
|
|
43
43
|
return o && st(c, o.prototype), c;
|
|
44
44
|
}, dt.apply(null, arguments);
|
|
45
45
|
}
|
|
@@ -157,7 +157,7 @@ var Ft = /* @__PURE__ */ function(n) {
|
|
|
157
157
|
}
|
|
158
158
|
return t;
|
|
159
159
|
}(/* @__PURE__ */ bt(Error));
|
|
160
|
-
function
|
|
160
|
+
function Se(n, t, e, i, s) {
|
|
161
161
|
if (t.first) {
|
|
162
162
|
var r = new Promise(function(x, u) {
|
|
163
163
|
var g = function(y) {
|
|
@@ -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), l = 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 === l)
|
|
175
175
|
return i(f), f.length ? u(new Ft(f, Ct(f))) : x(s);
|
|
176
176
|
};
|
|
177
177
|
a.length || (i(f), x(s)), a.forEach(function(w) {
|
|
@@ -183,7 +183,7 @@ function Te(n, t, e, i, s) {
|
|
|
183
183
|
return x;
|
|
184
184
|
}), d;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function Te(n) {
|
|
187
187
|
return !!(n && n.message !== void 0);
|
|
188
188
|
}
|
|
189
189
|
function Ae(n, t) {
|
|
@@ -197,7 +197,7 @@ function Ae(n, t) {
|
|
|
197
197
|
function kt(n, t) {
|
|
198
198
|
return function(e) {
|
|
199
199
|
var i;
|
|
200
|
-
return n.fullFields ? i = Ae(t, n.fullFields) : i = t[e.field || n.fullField],
|
|
200
|
+
return n.fullFields ? i = Ae(t, n.fullFields) : i = t[e.field || n.fullField], Te(e) ? (e.field = e.field || n.fullField, e.fieldValue = i, e) : {
|
|
201
201
|
message: typeof e == "function" ? e() : e,
|
|
202
202
|
fieldValue: i,
|
|
203
203
|
field: e.field || n.fullField
|
|
@@ -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 + "$"), l = 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
|
+
l.v4 = function(m) {
|
|
241
241
|
return m && m.exact ? o : new RegExp("" + t(m) + e + t(m), "g");
|
|
242
|
-
},
|
|
242
|
+
}, l.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 = l.v4().source, x = l.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
|
}, Yt = {
|
|
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", l = 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 && !l && f < t.min ? s.push(M(r.messages[d].min, t.fullField, t.min)) : l && !a && f > t.max ? s.push(M(r.messages[d].max, t.fullField, t.max)) : a && l && (f < t.min || f > t.max) && s.push(M(r.messages[d].range, t.fullField, t.min, t.max));
|
|
307
307
|
}, j = "enum", Xe = function(t, e, i, s, r) {
|
|
308
308
|
t[j] = Array.isArray(t[j]) ? t[j] : [], t[j].indexOf(e) === -1 && s.push(M(r.messages[j], t.fullField, t[j].join(", ")));
|
|
309
309
|
}, Fe = function(t, e, i, s, r) {
|
|
@@ -416,8 +416,8 @@ var 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 l;
|
|
420
|
+
e instanceof Date ? l = e : l = new Date(e), v.type(t, l, s, o, r), l && v.range(t, l.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 = [], l = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
429
|
+
if (l) {
|
|
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, l = s, c = r;
|
|
537
|
+
if (typeof l == "function" && (c = l, l = {}), !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 (l.messages) {
|
|
553
553
|
var d = this.messages();
|
|
554
|
-
d === Rt && (d = vt()), Nt(d,
|
|
554
|
+
d === Rt && (d = vt()), Nt(d, l.messages), l.messages = d;
|
|
555
555
|
} else
|
|
556
|
-
|
|
557
|
-
var x = {}, u =
|
|
556
|
+
l.messages = this.messages();
|
|
557
|
+
var x = {}, u = l.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,51 +570,51 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
570
570
|
});
|
|
571
571
|
});
|
|
572
572
|
var g = {};
|
|
573
|
-
return
|
|
573
|
+
return Se(x, l, 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
|
-
function m(R,
|
|
577
|
-
return $({},
|
|
576
|
+
function m(R, S) {
|
|
577
|
+
return $({}, S, {
|
|
578
578
|
fullField: y.fullField + "." + R,
|
|
579
579
|
fullFields: y.fullFields ? [].concat(y.fullFields, [R]) : [R]
|
|
580
580
|
});
|
|
581
581
|
}
|
|
582
582
|
function E(R) {
|
|
583
583
|
R === void 0 && (R = []);
|
|
584
|
-
var
|
|
585
|
-
!
|
|
586
|
-
var A =
|
|
587
|
-
if (
|
|
584
|
+
var S = Array.isArray(R) ? R : [R];
|
|
585
|
+
!l.suppressWarning && S.length && n.warning("async-validator:", S), S.length && y.message !== void 0 && (S = [].concat(y.message));
|
|
586
|
+
var A = S.map(kt(y, a));
|
|
587
|
+
if (l.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)) : l.error && (A = [l.error(y, M(l.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;
|
|
597
597
|
}), L = $({}, L, w.rule.fields);
|
|
598
598
|
var D = {};
|
|
599
599
|
Object.keys(L).forEach(function(I) {
|
|
600
|
-
var
|
|
600
|
+
var T = L[I], O = Array.isArray(T) ? T : [T];
|
|
601
601
|
D[I] = O.map(m.bind(null, I));
|
|
602
602
|
});
|
|
603
603
|
var B = new n(D);
|
|
604
|
-
B.messages(
|
|
605
|
-
var
|
|
606
|
-
A && A.length &&
|
|
604
|
+
B.messages(l.messages), w.rule.options && (w.rule.options.messages = l.messages, w.rule.options.error = l.error), B.validate(w.value, w.rule.options || l, function(I) {
|
|
605
|
+
var T = [];
|
|
606
|
+
A && A.length && T.push.apply(T, A), I && I.length && T.push.apply(T, I), p(T.length ? T : null);
|
|
607
607
|
});
|
|
608
608
|
}
|
|
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, l);
|
|
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, l);
|
|
616
616
|
} catch (R) {
|
|
617
|
-
console.error == null || console.error(R),
|
|
617
|
+
console.error == null || console.error(R), l.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 l = n.slice(0, 1);
|
|
728
|
+
l === '"' && (o += 1), r += l, 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, (l) => new Array(Math.floor(l.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
|
+
h(this, "loading", !1);
|
|
754
|
+
h(this, "ctx");
|
|
755
|
+
h(this, "data");
|
|
756
|
+
h(this, "columns");
|
|
757
|
+
h(this, "footerData", []);
|
|
758
|
+
h(this, "rowKeyMap", /* @__PURE__ */ new Map());
|
|
759
|
+
h(this, "colIndexKeyMap", /* @__PURE__ */ new Map());
|
|
760
|
+
h(this, "headerMap", /* @__PURE__ */ new Map());
|
|
761
|
+
h(this, "rowIndexRowKeyMap", /* @__PURE__ */ new Map());
|
|
762
|
+
h(this, "checkboxKeyMap", /* @__PURE__ */ new Map());
|
|
763
|
+
h(this, "originalDataMap", /* @__PURE__ */ new Map());
|
|
764
|
+
h(this, "changedDataMap", /* @__PURE__ */ new Map());
|
|
765
|
+
h(this, "validationErrorMap", /* @__PURE__ */ new Map());
|
|
766
|
+
h(this, "itemRowKeyMap", /* @__PURE__ */ new WeakMap());
|
|
767
|
+
h(this, "bufferData", []);
|
|
768
|
+
h(this, "sumHeight", 0);
|
|
769
|
+
h(this, "filterMethod");
|
|
770
|
+
h(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 = !1;
|
|
792
792
|
Array.isArray(i.children) && (r = !0, this.initData(i.children, e + 1));
|
|
793
|
-
const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: a, CELL_HEIGHT:
|
|
793
|
+
const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: a, CELL_HEIGHT: l, SELECTABLE_METHOD: c, CHECKBOX_KEY: f } = this.ctx.config, d = i[o], x = d ?? Ut();
|
|
794
794
|
this.itemRowKeyMap.set(i, x);
|
|
795
|
-
const u = i._height ||
|
|
795
|
+
const u = i._height || l, 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: l, 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, l && c && i(o.children);
|
|
883
883
|
});
|
|
884
884
|
};
|
|
885
885
|
this.rowIndexRowKeyMap.clear();
|
|
@@ -1002,7 +1002,7 @@ class ii {
|
|
|
1002
1002
|
let i = [];
|
|
1003
1003
|
const s = /* @__PURE__ */ new Set();
|
|
1004
1004
|
t.forEach((a) => {
|
|
1005
|
-
const { value:
|
|
1005
|
+
const { value: l, rowKey: c, key: f } = a, { oldValue: d, newValue: x } = this.setItemValue(c, f, l);
|
|
1006
1006
|
s.add(c), i.push({
|
|
1007
1007
|
rowKey: c,
|
|
1008
1008
|
key: f,
|
|
@@ -1012,12 +1012,12 @@ class ii {
|
|
|
1012
1012
|
});
|
|
1013
1013
|
let r = [];
|
|
1014
1014
|
const o = i.map((a) => {
|
|
1015
|
-
const
|
|
1015
|
+
const l = this.ctx.database.getRowDataItemForRowKey(a.rowKey);
|
|
1016
1016
|
return {
|
|
1017
1017
|
rowKey: a.rowKey,
|
|
1018
1018
|
key: a.key,
|
|
1019
1019
|
value: a.newValue,
|
|
1020
|
-
row:
|
|
1020
|
+
row: l
|
|
1021
1021
|
};
|
|
1022
1022
|
});
|
|
1023
1023
|
return s.forEach((a) => {
|
|
@@ -1043,15 +1043,15 @@ class ii {
|
|
|
1043
1043
|
if (!this.rowKeyMap.has(t))
|
|
1044
1044
|
return {};
|
|
1045
1045
|
const { item: a } = this.rowKeyMap.get(t);
|
|
1046
|
-
let
|
|
1046
|
+
let l = a[e];
|
|
1047
1047
|
if (this.ctx.database.getReadonly(t, e))
|
|
1048
1048
|
return {
|
|
1049
|
-
oldValue:
|
|
1050
|
-
newValue:
|
|
1049
|
+
oldValue: l,
|
|
1050
|
+
newValue: l
|
|
1051
1051
|
};
|
|
1052
|
-
a[e] !== null && typeof a[e] == "object" && (
|
|
1053
|
-
const c = `${t}_${e}`;
|
|
1054
|
-
if (this.originalDataMap.has(c) || this.originalDataMap.set(c,
|
|
1052
|
+
a[e] !== null && typeof a[e] == "object" && (l = JSON.parse(JSON.stringify(a[e])));
|
|
1053
|
+
const c = `${t}_${e}`;
|
|
1054
|
+
if (this.originalDataMap.has(c) || this.originalDataMap.set(c, l), this.changedDataMap.set(c, i), a[e] = i, o) {
|
|
1055
1055
|
const f = this.ctx.database.getRowDataItemForRowKey(t), d = {
|
|
1056
1056
|
rowKey: t,
|
|
1057
1057
|
key: e,
|
|
@@ -1061,7 +1061,7 @@ class ii {
|
|
|
1061
1061
|
this.ctx.emit("change", [d], [f]), this.ctx.emit("editChange", {
|
|
1062
1062
|
rowKey: t,
|
|
1063
1063
|
key: e,
|
|
1064
|
-
oldValue:
|
|
1064
|
+
oldValue: l,
|
|
1065
1065
|
value: i,
|
|
1066
1066
|
originalValue: this.originalDataMap.get(c),
|
|
1067
1067
|
row: f
|
|
@@ -1070,7 +1070,7 @@ class ii {
|
|
|
1070
1070
|
return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
|
|
1071
1071
|
rowKey: t,
|
|
1072
1072
|
key: e,
|
|
1073
|
-
oldValue:
|
|
1073
|
+
oldValue: l,
|
|
1074
1074
|
value: i,
|
|
1075
1075
|
originalValue: this.originalDataMap.get(c),
|
|
1076
1076
|
row: this.ctx.database.getRowDataItemForRowKey(t)
|
|
@@ -1082,12 +1082,12 @@ class ii {
|
|
|
1082
1082
|
{
|
|
1083
1083
|
rowKey: t,
|
|
1084
1084
|
key: e,
|
|
1085
|
-
oldValue:
|
|
1085
|
+
oldValue: l,
|
|
1086
1086
|
newValue: i
|
|
1087
1087
|
}
|
|
1088
1088
|
]
|
|
1089
1089
|
}), this.getValidator(t, e), r && this.ctx.emit("draw"), {
|
|
1090
|
-
oldValue:
|
|
1090
|
+
oldValue: l,
|
|
1091
1091
|
newValue: i
|
|
1092
1092
|
};
|
|
1093
1093
|
}
|
|
@@ -1114,8 +1114,8 @@ class ii {
|
|
|
1114
1114
|
return !1;
|
|
1115
1115
|
const { item: s } = this.rowKeyMap.get(t), r = s[i];
|
|
1116
1116
|
this.checkboxKeyMap.has(r) && this.checkboxKeyMap.get(r).forEach((a) => {
|
|
1117
|
-
const
|
|
1118
|
-
|
|
1117
|
+
const l = this.rowKeyMap.get(a);
|
|
1118
|
+
l.check = e;
|
|
1119
1119
|
});
|
|
1120
1120
|
}
|
|
1121
1121
|
}
|
|
@@ -1230,7 +1230,7 @@ class ii {
|
|
|
1230
1230
|
getChangedData() {
|
|
1231
1231
|
let t = [];
|
|
1232
1232
|
return this.changedDataMap.forEach((e, i) => {
|
|
1233
|
-
const s = this.originalDataMap.get(i), r = i.split("_")[0], o = i.split("_")[1];
|
|
1233
|
+
const s = this.originalDataMap.get(i), r = i.split("_")[0], o = i.split("_")[1];
|
|
1234
1234
|
s !== e && t.push({
|
|
1235
1235
|
rowKey: r,
|
|
1236
1236
|
colKey: o,
|
|
@@ -1243,7 +1243,7 @@ class ii {
|
|
|
1243
1243
|
getChangedRows() {
|
|
1244
1244
|
const t = /* @__PURE__ */ new Set();
|
|
1245
1245
|
this.changedDataMap.forEach((i, s) => {
|
|
1246
|
-
const r = this.originalDataMap.get(s), o = s.split("_")[0];
|
|
1246
|
+
const r = this.originalDataMap.get(s), o = s.split("_")[0];
|
|
1247
1247
|
r !== i && t.add(o);
|
|
1248
1248
|
});
|
|
1249
1249
|
let e = [];
|
|
@@ -1258,7 +1258,7 @@ class ii {
|
|
|
1258
1258
|
* @returns
|
|
1259
1259
|
*/
|
|
1260
1260
|
isHasChangedData(t, e) {
|
|
1261
|
-
const i = `${t}_${e}`;
|
|
1261
|
+
const i = `${t}_${e}`;
|
|
1262
1262
|
if (!this.changedDataMap.has(i))
|
|
1263
1263
|
return !1;
|
|
1264
1264
|
const s = this.originalDataMap.get(i), r = this.changedDataMap.get(i);
|
|
@@ -1295,7 +1295,7 @@ class ii {
|
|
|
1295
1295
|
getValidator(t, e) {
|
|
1296
1296
|
return new Promise((i) => {
|
|
1297
1297
|
const s = this.rowKeyMap.get(t), r = this.headerMap.get(e), { CELL_RULES_METHOD: o } = this.ctx.config, a = r.column;
|
|
1298
|
-
let
|
|
1298
|
+
let l = a.rules;
|
|
1299
1299
|
if (typeof o == "function") {
|
|
1300
1300
|
const f = o({
|
|
1301
1301
|
row: s.item,
|
|
@@ -1304,12 +1304,12 @@ class ii {
|
|
|
1304
1304
|
column: a,
|
|
1305
1305
|
value: this.getItemValue(t, e)
|
|
1306
1306
|
});
|
|
1307
|
-
f && (
|
|
1307
|
+
f && (l = f);
|
|
1308
1308
|
}
|
|
1309
|
-
if (
|
|
1309
|
+
if (l) {
|
|
1310
1310
|
let c = {}, f = {};
|
|
1311
|
-
if (f[e] = this.getItemValue(t, e), Array.isArray(
|
|
1312
|
-
const x =
|
|
1311
|
+
if (f[e] = this.getItemValue(t, e), Array.isArray(l) && l.length) {
|
|
1312
|
+
const x = l.map((u) => ({
|
|
1313
1313
|
...u,
|
|
1314
1314
|
row: s.item,
|
|
1315
1315
|
column: a,
|
|
@@ -1319,7 +1319,7 @@ class ii {
|
|
|
1319
1319
|
c[e] = x;
|
|
1320
1320
|
} else
|
|
1321
1321
|
c[e] = {
|
|
1322
|
-
...
|
|
1322
|
+
...l,
|
|
1323
1323
|
row: s.item,
|
|
1324
1324
|
column: a,
|
|
1325
1325
|
rowIndex: s.rowIndex,
|
|
@@ -1356,7 +1356,7 @@ class ii {
|
|
|
1356
1356
|
return this.loading;
|
|
1357
1357
|
}
|
|
1358
1358
|
setValidationErrorByRowIndex(t, e, i) {
|
|
1359
|
-
const r = `${this.rowIndexRowKeyMap.get(t)}_${e}`, o = [
|
|
1359
|
+
const r = `${this.rowIndexRowKeyMap.get(t)}_${e}`, o = [
|
|
1360
1360
|
{
|
|
1361
1361
|
message: i
|
|
1362
1362
|
}
|
|
@@ -1364,19 +1364,19 @@ class ii {
|
|
|
1364
1364
|
this.validationErrorMap.set(r, o);
|
|
1365
1365
|
}
|
|
1366
1366
|
setValidationError(t, e, i) {
|
|
1367
|
-
const s = `${t}_${e}`;
|
|
1367
|
+
const s = `${t}_${e}`;
|
|
1368
1368
|
this.validationErrorMap.set(s, i);
|
|
1369
1369
|
}
|
|
1370
1370
|
getValidationError(t, e) {
|
|
1371
|
-
const i = `${t}_${e}`;
|
|
1371
|
+
const i = `${t}_${e}`;
|
|
1372
1372
|
return this.validationErrorMap.get(i) || [];
|
|
1373
1373
|
}
|
|
1374
1374
|
}
|
|
1375
1375
|
class si {
|
|
1376
1376
|
constructor(t) {
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1377
|
+
h(this, "ctx");
|
|
1378
|
+
h(this, "history", []);
|
|
1379
|
+
h(this, "historyIndex", -1);
|
|
1380
1380
|
this.ctx = t, this.init();
|
|
1381
1381
|
}
|
|
1382
1382
|
init() {
|
|
@@ -1431,8 +1431,8 @@ class si {
|
|
|
1431
1431
|
}
|
|
1432
1432
|
class ri {
|
|
1433
1433
|
constructor(t) {
|
|
1434
|
-
|
|
1435
|
-
|
|
1434
|
+
h(this, "eventTasks", /* @__PURE__ */ new Map());
|
|
1435
|
+
h(this, "ctx");
|
|
1436
1436
|
this.ctx = t, this.init();
|
|
1437
1437
|
}
|
|
1438
1438
|
init() {
|
|
@@ -1486,7 +1486,7 @@ class ri {
|
|
|
1486
1486
|
}
|
|
1487
1487
|
class oi {
|
|
1488
1488
|
constructor() {
|
|
1489
|
-
|
|
1489
|
+
h(this, "events", /* @__PURE__ */ new Map());
|
|
1490
1490
|
}
|
|
1491
1491
|
has(t) {
|
|
1492
1492
|
return this.events.has(t);
|
|
@@ -1524,7 +1524,7 @@ class oi {
|
|
|
1524
1524
|
}
|
|
1525
1525
|
class ni {
|
|
1526
1526
|
constructor(t) {
|
|
1527
|
-
|
|
1527
|
+
h(this, "ctx");
|
|
1528
1528
|
const e = t.getContext("2d");
|
|
1529
1529
|
if (!e) throw new Error("canvas context not found");
|
|
1530
1530
|
this.ctx = e;
|
|
@@ -1558,21 +1558,21 @@ class ni {
|
|
|
1558
1558
|
* @param {string} color - 阴影的颜色
|
|
1559
1559
|
*/
|
|
1560
1560
|
drawShadow(t, e, i, s, r) {
|
|
1561
|
-
const { fillColor: o, side: a, shadowWidth:
|
|
1561
|
+
const { fillColor: o, side: a, shadowWidth: l, colorStart: c, colorEnd: f } = r;
|
|
1562
1562
|
this.ctx.save(), o && (this.ctx.fillStyle = o, this.ctx.fillRect(t, e, i, s));
|
|
1563
1563
|
let d;
|
|
1564
1564
|
switch (a) {
|
|
1565
1565
|
case "left":
|
|
1566
|
-
d = this.ctx.createLinearGradient(t -
|
|
1566
|
+
d = this.ctx.createLinearGradient(t - l, e, t, e), d.addColorStop(0, c), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t - l, e, l, s);
|
|
1567
1567
|
break;
|
|
1568
1568
|
case "right":
|
|
1569
|
-
d = this.ctx.createLinearGradient(t + i, e, t + i +
|
|
1569
|
+
d = this.ctx.createLinearGradient(t + i, e, t + i + l, e), d.addColorStop(0, c), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t + i, e, l, s);
|
|
1570
1570
|
break;
|
|
1571
1571
|
case "top":
|
|
1572
|
-
d = this.ctx.createLinearGradient(t, e -
|
|
1572
|
+
d = this.ctx.createLinearGradient(t, e - l, t, e), d.addColorStop(0, c), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t, e - l, i, l);
|
|
1573
1573
|
break;
|
|
1574
1574
|
case "bottom":
|
|
1575
|
-
d = this.ctx.createLinearGradient(t, e + s, t, e + s +
|
|
1575
|
+
d = this.ctx.createLinearGradient(t, e + s, t, e + s + l), d.addColorStop(0, c), d.addColorStop(1, f), this.ctx.fillStyle = d, this.ctx.fillRect(t, e + s, i, l);
|
|
1576
1576
|
break;
|
|
1577
1577
|
default:
|
|
1578
1578
|
console.error("Invalid side specified for shadow");
|
|
@@ -1593,11 +1593,11 @@ class ni {
|
|
|
1593
1593
|
drawImage(t, e, i, s, r) {
|
|
1594
1594
|
this.ctx.save(), this.ctx.drawImage(t, e, i, s, r), this.ctx.restore();
|
|
1595
1595
|
}
|
|
1596
|
-
drawRect(t, e, i, s, { borderWidth: r = 1, borderColor: o, fillColor: a, radius:
|
|
1597
|
-
if (this.ctx.save(), this.ctx.beginPath(), a !== void 0 && (this.ctx.fillStyle = a), o !== void 0 && (this.ctx.lineWidth = r, this.ctx.strokeStyle = o),
|
|
1596
|
+
drawRect(t, e, i, s, { borderWidth: r = 1, borderColor: o, fillColor: a, radius: l = 0 } = {}) {
|
|
1597
|
+
if (this.ctx.save(), this.ctx.beginPath(), a !== void 0 && (this.ctx.fillStyle = a), o !== void 0 && (this.ctx.lineWidth = r, this.ctx.strokeStyle = o), l === 0)
|
|
1598
1598
|
this.ctx.rect(t - 0.5, e - 0.5, i, s);
|
|
1599
1599
|
else {
|
|
1600
|
-
const [c, f, d, x] = typeof
|
|
1600
|
+
const [c, f, d, x] = typeof l == "number" ? [l, l, l, l] : l;
|
|
1601
1601
|
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);
|
|
1602
1602
|
}
|
|
1603
1603
|
a !== void 0 && this.ctx.fill(), o !== void 0 && this.ctx.stroke(), this.ctx.restore();
|
|
@@ -1616,16 +1616,16 @@ class ni {
|
|
|
1616
1616
|
this.ctx.save();
|
|
1617
1617
|
const {
|
|
1618
1618
|
font: a = "12px Arial",
|
|
1619
|
-
align:
|
|
1619
|
+
align: l = "center",
|
|
1620
1620
|
color: c = "#495060",
|
|
1621
1621
|
padding: f = 0,
|
|
1622
1622
|
verticalAlign: d = "middle"
|
|
1623
1623
|
} = o;
|
|
1624
|
-
this.ctx.font = a, this.ctx.fillStyle = c, this.ctx.textBaseline = d, this.ctx.textAlign =
|
|
1624
|
+
this.ctx.font = a, this.ctx.fillStyle = c, this.ctx.textBaseline = d, this.ctx.textAlign = l;
|
|
1625
1625
|
let x = 0;
|
|
1626
1626
|
d === "top" ? x = i + f : d === "bottom" ? x = i + r - f : x = i + (r + 1) / 2;
|
|
1627
1627
|
let u = 0;
|
|
1628
|
-
|
|
1628
|
+
l === "left" ? u = e + f : l === "right" ? u = e + s - f : u = e + s / 2;
|
|
1629
1629
|
const { _text: g, ellipsis: w } = this.handleEllipsis(t, s, f, a);
|
|
1630
1630
|
return this.ctx.fillText(g, u, x), this.ctx.restore(), w;
|
|
1631
1631
|
}
|
|
@@ -1636,8 +1636,8 @@ class ni {
|
|
|
1636
1636
|
_text: "",
|
|
1637
1637
|
ellipsis: r
|
|
1638
1638
|
};
|
|
1639
|
-
const a = this.ctx.measureText("...").width,
|
|
1640
|
-
if (
|
|
1639
|
+
const a = this.ctx.measureText("...").width, l = this.ctx.measureText(t).width;
|
|
1640
|
+
if (l && l + a >= e - i * 2) {
|
|
1641
1641
|
r = !0;
|
|
1642
1642
|
let c = 0;
|
|
1643
1643
|
for (let f = 0; f < t.length; f++)
|
|
@@ -1654,129 +1654,129 @@ class ni {
|
|
|
1654
1654
|
}
|
|
1655
1655
|
class Wt {
|
|
1656
1656
|
constructor(t) {
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1657
|
+
h(this, "PROCESSOR_NUM", 50);
|
|
1658
|
+
h(this, "CSS_PREFIX", "e-virt-table");
|
|
1659
|
+
h(this, "ICONS", []);
|
|
1660
|
+
h(this, "ROW_KEY", "");
|
|
1661
|
+
h(this, "HEADER_FONT", "12px normal Arial");
|
|
1662
|
+
h(this, "BODY_FONT", "12px normal Arial");
|
|
1663
|
+
h(this, "BORDER_COLOR", "#e1e6eb");
|
|
1664
|
+
h(this, "WIDTH", 0);
|
|
1665
|
+
h(this, "RESIZE_MIN_WIDTH", 40);
|
|
1666
|
+
h(this, "HEIGHT", 0);
|
|
1667
|
+
h(this, "EMPTY_BODY_HEIGHT", 120);
|
|
1668
|
+
h(this, "EMPTY_CUSTOM", !1);
|
|
1669
|
+
h(this, "EMPTY_CUSTOM_STYLE", {});
|
|
1670
|
+
h(this, "EMPTY_TEXT", "暂无数据");
|
|
1671
|
+
h(this, "MAX_HEIGHT", 1e3);
|
|
1672
|
+
h(this, "BORDER_RADIUS", 8);
|
|
1673
|
+
h(this, "ENABLE_OFFSET_HEIGHT", !1);
|
|
1674
|
+
h(this, "OFFSET_HEIGHT", 0);
|
|
1675
|
+
h(this, "HEADER_HEIGHT", 36);
|
|
1676
|
+
h(this, "ENABLE_HEADER_STICKY", !1);
|
|
1677
1677
|
// 启用头部固定,需要外面实现覆盖层,或者所有表头都要是元素
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1678
|
+
h(this, "HEADER_BG_COLOR", "#F8FAFF");
|
|
1679
|
+
h(this, "BODY_BG_COLOR", "#FFF");
|
|
1680
|
+
h(this, "HEADER_TEXT_COLOR", "#1D2129");
|
|
1681
|
+
h(this, "LOADING_ICON_SVG", "");
|
|
1682
|
+
h(this, "LOADING_ICON_COLOR", "#4E5969");
|
|
1683
|
+
h(this, "EXPAND_ICON_SVG", "");
|
|
1684
|
+
h(this, "SHRINK_ICON_SVG", "");
|
|
1685
|
+
h(this, "EXPAND_ICON_COLOR", "#4E5969");
|
|
1686
|
+
h(this, "SHRINK_ICON_COLOR", "#4E5969");
|
|
1687
|
+
h(this, "ERROR_TIP_ICON_COLOR", "red");
|
|
1688
|
+
h(this, "ERROR_TIP_ICON_SIZE", 6);
|
|
1689
|
+
h(this, "EXPAND_LAZY", !0);
|
|
1690
|
+
h(this, "DEFAULT_EXPAND_ALL", !1);
|
|
1691
|
+
h(this, "CELL_WIDTH", 100);
|
|
1692
|
+
h(this, "CELL_HEIGHT", 36);
|
|
1693
|
+
h(this, "CELL_PADDING", 8);
|
|
1694
|
+
h(this, "CELL_HOVER_ICON_SIZE", 20);
|
|
1695
|
+
h(this, "SCROLLER_TRACK_SIZE", 14);
|
|
1696
|
+
h(this, "SCROLLER_SIZE", 8);
|
|
1697
|
+
h(this, "SCROLLER_COLOR", "#dee0e3");
|
|
1698
|
+
h(this, "SCROLLER_TRACK_COLOR", "#fff");
|
|
1699
|
+
h(this, "SCROLLER_FOCUS_COLOR", "#bbbec4");
|
|
1700
|
+
h(this, "SELECT_BORDER_COLOR", "rgb(82,146,247)");
|
|
1701
|
+
h(this, "SELECT_AREA_COLOR", "rgba(82,146,247,0.1)");
|
|
1702
|
+
h(this, "SELECT_BG_COLOR", "rgba(82,146,247,0.1)");
|
|
1703
|
+
h(this, "EDIT_BG_COLOR", "#fcf6ed");
|
|
1704
|
+
h(this, "CHECKBOX_KEY", "");
|
|
1705
|
+
h(this, "CHECKBOX_COLOR", "rgb(82,146,247)");
|
|
1706
|
+
h(this, "CHECKBOX_SIZE", 20);
|
|
1707
|
+
h(this, "CHECKBOX_DISABLED_SVG", "");
|
|
1708
|
+
h(this, "CHECKBOX_CHECK_SVG", "");
|
|
1709
|
+
h(this, "CHECKBOX_UNCHECK_SVG", "");
|
|
1710
|
+
h(this, "CHECKBOX_INDETERMINATE_SVG", "");
|
|
1711
|
+
h(this, "READONLY_COLOR", "#fff");
|
|
1712
|
+
h(this, "READONLY_TEXT_COLOR", "#4E5969");
|
|
1713
|
+
h(this, "ERROR_TIP_COLOR", "#ED3F14");
|
|
1714
|
+
h(this, "FOOTER_BG_COLOR", "#fafafa");
|
|
1715
|
+
h(this, "FOOTER_FIXED", !0);
|
|
1716
|
+
h(this, "CELL_FOOTER_HEIGHT", 36);
|
|
1717
|
+
h(this, "ENABLE_SELECTOR", !1);
|
|
1718
|
+
h(this, "ENABLE_EDIT_SINGLE_CLICK", !1);
|
|
1719
1719
|
// 启用单点击立马编辑
|
|
1720
|
-
|
|
1720
|
+
h(this, "ENABLE_EDIT_CLICK_SELECTOR", !0);
|
|
1721
1721
|
// 启用点击选择器编辑
|
|
1722
|
-
|
|
1722
|
+
h(this, "SELECTOR_AREA_MIN_X", 0);
|
|
1723
1723
|
// 选择器X最小范围
|
|
1724
|
-
|
|
1724
|
+
h(this, "SELECTOR_AREA_MAX_X_OFFSET", 0);
|
|
1725
1725
|
// 选择器X最大范围colMax - offset
|
|
1726
|
-
|
|
1726
|
+
h(this, "SELECTOR_AREA_MAX_X", 0);
|
|
1727
1727
|
// 选择器X最大范围,0默认最大colMax
|
|
1728
|
-
|
|
1728
|
+
h(this, "SELECTOR_AREA_MIN_Y", 0);
|
|
1729
1729
|
// 选择器Y最小范围
|
|
1730
|
-
|
|
1730
|
+
h(this, "SELECTOR_AREA_MAX_Y", 0);
|
|
1731
1731
|
// 选择器Y最大范围,0默认rowMax
|
|
1732
|
-
|
|
1732
|
+
h(this, "SELECTOR_AREA_MAX_Y_OFFSET", 0);
|
|
1733
1733
|
// 选择器Y最大范围,0默认rowMax
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1734
|
+
h(this, "ENABLE_SELECTOR_SINGLE", !1);
|
|
1735
|
+
h(this, "ENABLE_SELECTOR_SPAN_COL", !0);
|
|
1736
|
+
h(this, "ENABLE_SELECTOR_SPAN_ROW", !0);
|
|
1737
|
+
h(this, "ENABLE_SELECTOR_ALL_ROWS", !0);
|
|
1738
|
+
h(this, "ENABLE_SELECTOR_ALL_COLS", !0);
|
|
1739
|
+
h(this, "ENABLE_AUTOFILL", !1);
|
|
1740
|
+
h(this, "ENABLE_CONTEXT_MENU", !1);
|
|
1741
|
+
h(this, "ENABLE_COPY", !0);
|
|
1742
|
+
h(this, "ENABLE_PASTER", !0);
|
|
1743
|
+
h(this, "ENABLE_RESIZE_ROW", !0);
|
|
1744
|
+
h(this, "ENABLE_RESIZE_COLUMN", !0);
|
|
1745
|
+
h(this, "RESIZE_ROW_LINE_COLOR", "#e1e6eb");
|
|
1746
|
+
h(this, "RESIZE_COLUMN_LINE_COLOR", "#e1e6eb");
|
|
1747
|
+
h(this, "RESIZE_ROW_MIN_HEIGHT", 36);
|
|
1748
|
+
h(this, "RESIZE_COLUMN_MIN_WIDTH", 40);
|
|
1749
|
+
h(this, "ENABLE_KEYBOARD", !0);
|
|
1750
|
+
h(this, "ENABLE_HISTORY", !1);
|
|
1751
|
+
h(this, "ENABLE_VALIDATOR_IMMEDIATE", !0);
|
|
1752
|
+
h(this, "HISTORY_NUM", 50);
|
|
1753
|
+
h(this, "HIGHLIGHT_HOVER_ROW", !1);
|
|
1754
|
+
h(this, "HIGHLIGHT_HOVER_ROW_COLOR", "rgba(186,203,231,0.1)");
|
|
1755
|
+
h(this, "HIGHLIGHT_SELECTED_ROW", !1);
|
|
1756
|
+
h(this, "HIGHLIGHT_SELECTED_ROW_COLOR", "rgba(82,146,247,0.1)");
|
|
1757
|
+
h(this, "TOOLTIP_BG_COLOR", "#303133");
|
|
1758
|
+
h(this, "TOOLTIP_TEXT_COLOR", "#fff");
|
|
1759
|
+
h(this, "TOOLTIP_ZINDEX", 3e3);
|
|
1760
|
+
h(this, "TOOLTIP_CUSTOM_STYLE", {});
|
|
1761
|
+
h(this, "CONTEXT_MENU", [
|
|
1762
1762
|
{ label: "复制", value: "copy" },
|
|
1763
1763
|
{ label: "剪切", value: "cut" },
|
|
1764
1764
|
{ label: "粘贴", value: "paste" },
|
|
1765
1765
|
{ label: "清空选中内容", value: "clearSelected" }
|
|
1766
1766
|
]);
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1767
|
+
h(this, "HEADER_CELL_STYLE_METHOD");
|
|
1768
|
+
h(this, "BODY_CELL_STYLE_METHOD");
|
|
1769
|
+
h(this, "FOOTER_CELL_STYLE_METHOD");
|
|
1770
|
+
h(this, "CELL_READONLY_METHOD");
|
|
1771
|
+
h(this, "CELL_FORMATTER_METHOD");
|
|
1772
|
+
h(this, "CELL_RULES_METHOD");
|
|
1773
|
+
h(this, "CELL_TYPE_METHOD");
|
|
1774
|
+
h(this, "CELL_EDITOR_TYPE_METHOD");
|
|
1775
|
+
h(this, "CELL_RENDER_METHOD");
|
|
1776
|
+
h(this, "CELL_HOVER_ICON_METHOD");
|
|
1777
|
+
h(this, "SPAN_METHOD");
|
|
1778
|
+
h(this, "SELECTABLE_METHOD");
|
|
1779
|
+
h(this, "EXPAND_LAZY_METHOD");
|
|
1780
1780
|
Object.assign(this, t);
|
|
1781
1781
|
}
|
|
1782
1782
|
init(t) {
|
|
@@ -1785,8 +1785,8 @@ class Wt {
|
|
|
1785
1785
|
}
|
|
1786
1786
|
class ai {
|
|
1787
1787
|
constructor(t) {
|
|
1788
|
-
|
|
1789
|
-
|
|
1788
|
+
h(this, "ctx");
|
|
1789
|
+
h(this, "list", [
|
|
1790
1790
|
{
|
|
1791
1791
|
name: "loading",
|
|
1792
1792
|
configName: "LOADING_ICON_SVG",
|
|
@@ -1848,7 +1848,7 @@ class ai {
|
|
|
1848
1848
|
color: ""
|
|
1849
1849
|
}
|
|
1850
1850
|
]);
|
|
1851
|
-
|
|
1851
|
+
h(this, "icons", /* @__PURE__ */ new Map());
|
|
1852
1852
|
this.ctx = t, this.init();
|
|
1853
1853
|
}
|
|
1854
1854
|
async init() {
|
|
@@ -1882,8 +1882,8 @@ class ai {
|
|
|
1882
1882
|
});
|
|
1883
1883
|
const o = new Image(), a = new Blob([new XMLSerializer().serializeToString(r)], {
|
|
1884
1884
|
type: "image/svg+xml"
|
|
1885
|
-
}),
|
|
1886
|
-
return o.src =
|
|
1885
|
+
}), l = URL.createObjectURL(a);
|
|
1886
|
+
return o.src = l, new Promise((c, f) => {
|
|
1887
1887
|
o.onerror = () => f(new Error("Failed to load image")), o.onload = () => {
|
|
1888
1888
|
c(o);
|
|
1889
1889
|
};
|
|
@@ -1895,13 +1895,13 @@ class ai {
|
|
|
1895
1895
|
}
|
|
1896
1896
|
class te {
|
|
1897
1897
|
constructor(t, e, i, s, r, o, a) {
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1898
|
+
h(this, "ctx");
|
|
1899
|
+
h(this, "x", 0);
|
|
1900
|
+
h(this, "y", 0);
|
|
1901
|
+
h(this, "width", 0);
|
|
1902
|
+
h(this, "height", 0);
|
|
1903
|
+
h(this, "fixed");
|
|
1904
|
+
h(this, "cellType");
|
|
1905
1905
|
this.ctx = t, this.x = e, this.y = i, this.width = s, this.height = r, this.fixed = o, this.cellType = a;
|
|
1906
1906
|
}
|
|
1907
1907
|
isHorizontalVisible() {
|
|
@@ -1940,55 +1940,55 @@ class te {
|
|
|
1940
1940
|
}
|
|
1941
1941
|
}
|
|
1942
1942
|
class ee extends te {
|
|
1943
|
-
constructor(e, i, s, r, o, a,
|
|
1944
|
-
super(e, r, o, a,
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1943
|
+
constructor(e, i, s, r, o, a, l, c, f, d = "body") {
|
|
1944
|
+
super(e, r, o, a, l, c.fixed, d);
|
|
1945
|
+
h(this, "formatter");
|
|
1946
|
+
h(this, "hoverIconName", "");
|
|
1947
|
+
h(this, "operation", !1);
|
|
1948
|
+
h(this, "align");
|
|
1949
|
+
h(this, "verticalAlign");
|
|
1950
|
+
h(this, "fixed");
|
|
1951
|
+
h(this, "type");
|
|
1952
|
+
h(this, "editorType");
|
|
1953
|
+
h(this, "cellType");
|
|
1954
|
+
h(this, "level");
|
|
1955
|
+
h(this, "colspan", 1);
|
|
1956
|
+
h(this, "rowspan", 1);
|
|
1957
|
+
h(this, "key");
|
|
1958
|
+
h(this, "column");
|
|
1959
|
+
h(this, "rowIndex");
|
|
1960
|
+
h(this, "colIndex");
|
|
1961
|
+
h(this, "rowKey");
|
|
1962
|
+
h(this, "row");
|
|
1963
|
+
h(this, "value");
|
|
1964
|
+
h(this, "render");
|
|
1965
|
+
h(this, "renderFooter");
|
|
1966
|
+
h(this, "style", {});
|
|
1967
|
+
h(this, "rules", {});
|
|
1968
|
+
h(this, "message", "");
|
|
1969
|
+
h(this, "text", "");
|
|
1970
|
+
h(this, "displayText", "");
|
|
1971
|
+
h(this, "visibleWidth", 0);
|
|
1972
|
+
h(this, "visibleHeight", 0);
|
|
1973
|
+
h(this, "drawX", 0);
|
|
1974
|
+
h(this, "drawY", 0);
|
|
1975
|
+
h(this, "drawCellBgColor", "");
|
|
1976
|
+
h(this, "drawCellSkyBgColor", "");
|
|
1977
|
+
h(this, "drawTextColor", "");
|
|
1978
|
+
h(this, "drawTextX", 0);
|
|
1979
|
+
h(this, "drawTextY", 0);
|
|
1980
|
+
h(this, "drawImageX", 0);
|
|
1981
|
+
h(this, "drawImageY", 0);
|
|
1982
|
+
h(this, "drawImageWidth", 0);
|
|
1983
|
+
h(this, "drawImageHeight", 0);
|
|
1984
|
+
h(this, "drawImageName", "");
|
|
1985
|
+
h(this, "drawImageSource");
|
|
1986
|
+
h(this, "ellipsis", !1);
|
|
1987
|
+
h(this, "rowExpand", !1);
|
|
1988
|
+
h(this, "rowHasChildren", !1);
|
|
1989
|
+
h(this, "overflowTooltipShow", !0);
|
|
1990
|
+
h(this, "overflowTooltipMaxWidth", 500);
|
|
1991
|
+
h(this, "overflowTooltipPlacement", "top");
|
|
1992
1992
|
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = c.key, this.type = c.type || "text", this.editorType = c.editorType || "text", this.cellType = d, this.align = c.align || "center", this.verticalAlign = c.verticalAlign || "middle", this.fixed = c.fixed, this.level = c.level, this.operation = c.operation || !1, this.column = c, this.rules = c.rules, this.row = f, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = c.render, this.overflowTooltipShow = c.overflowTooltipShow !== !1, this.overflowTooltipMaxWidth = c.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = c.overflowTooltipPlacement || "top", this.renderFooter = c.renderFooter, this.hoverIconName = c.hoverIconName, this.formatter = c.formatter, this.update();
|
|
1993
1993
|
}
|
|
1994
1994
|
getValidationMessage() {
|
|
@@ -2083,7 +2083,7 @@ class ee extends te {
|
|
|
2083
2083
|
const { CELL_PADDING: e = 0 } = this.ctx.config, { rowKey: i, cellType: s } = this;
|
|
2084
2084
|
let r, o = 0, a = "";
|
|
2085
2085
|
if (this.type === "tree" && s === "body") {
|
|
2086
|
-
const
|
|
2086
|
+
const l = this.ctx.database.getRowForRowKey(i), { expand: c = !1, hasChildren: f = !1, expandLoading: d = !1, level: x = 0 } = l || {};
|
|
2087
2087
|
if (this.rowExpand = c, this.rowHasChildren = f, d) {
|
|
2088
2088
|
const u = this.ctx.icons.get("loading");
|
|
2089
2089
|
a = "loading", r = u, o = x * 8;
|
|
@@ -2106,7 +2106,7 @@ class ee extends te {
|
|
|
2106
2106
|
FOOTER_CELL_STYLE_METHOD: r,
|
|
2107
2107
|
READONLY_TEXT_COLOR: o,
|
|
2108
2108
|
FOOTER_BG_COLOR: a,
|
|
2109
|
-
HIGHLIGHT_SELECTED_ROW:
|
|
2109
|
+
HIGHLIGHT_SELECTED_ROW: l,
|
|
2110
2110
|
HIGHLIGHT_SELECTED_ROW_COLOR: c,
|
|
2111
2111
|
HIGHLIGHT_HOVER_ROW: f,
|
|
2112
2112
|
HIGHLIGHT_HOVER_ROW_COLOR: d
|
|
@@ -2128,7 +2128,7 @@ class ee extends te {
|
|
|
2128
2128
|
}
|
|
2129
2129
|
let x = "transparent";
|
|
2130
2130
|
const u = this.ctx.focusCell, g = this.ctx.hoverCell;
|
|
2131
|
-
f && (g == null ? void 0 : g.rowKey) === this.rowKey && (x = d),
|
|
2131
|
+
f && (g == null ? void 0 : g.rowKey) === this.rowKey && (x = d), l && (u == null ? void 0 : u.rowKey) === this.rowKey && (x = c), this.drawCellSkyBgColor = x;
|
|
2132
2132
|
let w = e, p = o;
|
|
2133
2133
|
if (["index", "index-selection", "selection"].includes(this.type)) {
|
|
2134
2134
|
this.drawCellBgColor = e, this.drawTextColor = o;
|
|
@@ -2147,24 +2147,24 @@ class ee extends te {
|
|
|
2147
2147
|
this.drawCellBgColor = w, this.drawTextColor = p;
|
|
2148
2148
|
}
|
|
2149
2149
|
updateSelection() {
|
|
2150
|
-
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type: a, rowIndex:
|
|
2150
|
+
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type: a, rowIndex: l, rowKey: c } = this;
|
|
2151
2151
|
if (!(s === 0 || r === 0) && o !== "footer" && ["index-selection", "selection"].includes(a)) {
|
|
2152
2152
|
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;
|
|
2153
2153
|
let w = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck";
|
|
2154
|
-
f && d ? (w = this.ctx.icons.get("checkbox-check"), p = "checkbox-check") : f && d ? (w = this.ctx.icons.get("checkbox-check-disabled"), p = "checkbox-check-disabled") : !f && d ? (w = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck") : (w = this.ctx.icons.get("checkbox-disabled"), p = "checkbox-disabled"), w && a == "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex ===
|
|
2154
|
+
f && d ? (w = this.ctx.icons.get("checkbox-check"), p = "checkbox-check") : f && d ? (w = this.ctx.icons.get("checkbox-check-disabled"), p = "checkbox-check-disabled") : !f && d ? (w = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck") : (w = this.ctx.icons.get("checkbox-disabled"), p = "checkbox-disabled"), w && a == "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === l || ["checkbox-disabled", "checkbox-check"].includes(p)) && (this.drawImageX = u, this.drawImageY = g, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = p, this.drawImageSource = w) : w && a === "selection" && (this.drawImageX = u, this.drawImageY = g, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = p, this.drawImageSource = w);
|
|
2155
2155
|
}
|
|
2156
2156
|
}
|
|
2157
2157
|
updateHoverIcon() {
|
|
2158
2158
|
const { CELL_HOVER_ICON_METHOD: e, CELL_HOVER_ICON_SIZE: i, CELL_PADDING: s } = this.ctx.config;
|
|
2159
2159
|
if (typeof e == "function") {
|
|
2160
|
-
const
|
|
2160
|
+
const l = e({
|
|
2161
2161
|
row: this.row,
|
|
2162
2162
|
rowIndex: this.rowIndex,
|
|
2163
2163
|
colIndex: this.colIndex,
|
|
2164
2164
|
column: this.column,
|
|
2165
2165
|
value: this.getValue()
|
|
2166
2166
|
});
|
|
2167
|
-
|
|
2167
|
+
l !== void 0 && (this.hoverIconName = l);
|
|
2168
2168
|
}
|
|
2169
2169
|
const r = this.drawX + this.width - i - s, o = this.drawY + (this.height - i) / 2;
|
|
2170
2170
|
if (this.hoverIconName && this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === this.rowIndex) {
|
|
@@ -2280,8 +2280,8 @@ class ee extends te {
|
|
|
2280
2280
|
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s } = this.ctx.config;
|
|
2281
2281
|
if (!s || !i)
|
|
2282
2282
|
return;
|
|
2283
|
-
const { xArr: r, yArr: o } = this.ctx.selector, a = r[1],
|
|
2284
|
-
c === a && f ===
|
|
2283
|
+
const { xArr: r, yArr: o } = this.ctx.selector, a = r[1], l = o[1], { colIndex: c, rowIndex: f, drawX: d, drawY: x } = this;
|
|
2284
|
+
c === a && f === l && this.ctx.paint.drawRect(d + this.width - 6, x + this.height - 6, 6, 6, {
|
|
2285
2285
|
borderColor: "#fff",
|
|
2286
2286
|
fillColor: e
|
|
2287
2287
|
});
|
|
@@ -2336,31 +2336,31 @@ class ee extends te {
|
|
|
2336
2336
|
}
|
|
2337
2337
|
drawBorder(e) {
|
|
2338
2338
|
const { drawX: i, drawY: s, width: r, rowIndex: o, colIndex: a } = this;
|
|
2339
|
-
let
|
|
2340
|
-
o === 0 && (c = this.y + 1, f = f - 1), a === this.ctx.maxColIndex && (
|
|
2339
|
+
let l = i + 0.5, c = s + 0.5, f = this.height;
|
|
2340
|
+
o === 0 && (c = this.y + 1, f = f - 1), a === this.ctx.maxColIndex && (l = l - 1);
|
|
2341
2341
|
const { xArr: d, yArr: x, lineDash: u = [], borderWidth: g = 1, borderColor: w, fillColor: p } = e, y = d[0], b = d[1], m = x[0], E = x[1];
|
|
2342
|
-
a >= y && a <= b && o === m && this.ctx.paint.drawLine([
|
|
2342
|
+
a >= y && a <= b && o === m && this.ctx.paint.drawLine([l, c, l + r - 2, c], {
|
|
2343
2343
|
borderColor: w,
|
|
2344
2344
|
fillColor: p,
|
|
2345
2345
|
borderWidth: g,
|
|
2346
2346
|
lineCap: "round",
|
|
2347
2347
|
lineJoin: "round",
|
|
2348
2348
|
lineDash: u
|
|
2349
|
-
}), a >= y && a <= b && o === E && this.ctx.paint.drawLine([
|
|
2349
|
+
}), a >= y && a <= b && o === E && this.ctx.paint.drawLine([l, c + f - 1.5, l + r, c + f - 1.5], {
|
|
2350
2350
|
borderColor: w,
|
|
2351
2351
|
fillColor: p,
|
|
2352
2352
|
borderWidth: g,
|
|
2353
2353
|
lineCap: "round",
|
|
2354
2354
|
lineJoin: "round",
|
|
2355
2355
|
lineDash: u
|
|
2356
|
-
}), a === y && o >= m && o <= E && this.ctx.paint.drawLine([
|
|
2356
|
+
}), a === y && o >= m && o <= E && this.ctx.paint.drawLine([l, c, l, c + f - 1], {
|
|
2357
2357
|
borderColor: w,
|
|
2358
2358
|
fillColor: p,
|
|
2359
2359
|
borderWidth: g,
|
|
2360
2360
|
lineCap: "round",
|
|
2361
2361
|
lineJoin: "round",
|
|
2362
2362
|
lineDash: u
|
|
2363
|
-
}), a === b && o >= m && o <= E && this.ctx.paint.drawLine([
|
|
2363
|
+
}), a === b && o >= m && o <= E && this.ctx.paint.drawLine([l + r - 1.5, c, l + r - 1.5, c + f - 1.5], {
|
|
2364
2364
|
borderColor: w,
|
|
2365
2365
|
fillColor: p,
|
|
2366
2366
|
borderWidth: g,
|
|
@@ -2371,42 +2371,42 @@ class ee extends te {
|
|
|
2371
2371
|
}
|
|
2372
2372
|
}
|
|
2373
2373
|
class ie extends te {
|
|
2374
|
-
constructor(e, i, s, r, o, a,
|
|
2375
|
-
super(e, s, r, o, a,
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
this.ctx = e, this.x = s, this.y = r, this.width = o, this.height = a, this.colIndex = i, this.key =
|
|
2374
|
+
constructor(e, i, s, r, o, a, l) {
|
|
2375
|
+
super(e, s, r, o, a, l.fixed, "header");
|
|
2376
|
+
h(this, "align");
|
|
2377
|
+
h(this, "verticalAlign", "middle");
|
|
2378
|
+
h(this, "fixed");
|
|
2379
|
+
h(this, "widthFillDisable");
|
|
2380
|
+
h(this, "type");
|
|
2381
|
+
h(this, "operation", !1);
|
|
2382
|
+
h(this, "editorType");
|
|
2383
|
+
h(this, "level");
|
|
2384
|
+
h(this, "text");
|
|
2385
|
+
h(this, "displayText", "");
|
|
2386
|
+
h(this, "colspan");
|
|
2387
|
+
h(this, "rowspan");
|
|
2388
|
+
h(this, "key");
|
|
2389
|
+
h(this, "required", !1);
|
|
2390
|
+
h(this, "readonly", !1);
|
|
2391
|
+
h(this, "children", []);
|
|
2392
|
+
h(this, "column");
|
|
2393
|
+
h(this, "colIndex");
|
|
2394
|
+
h(this, "rowKey");
|
|
2395
|
+
h(this, "rules");
|
|
2396
|
+
h(this, "hasChildren");
|
|
2397
|
+
h(this, "render");
|
|
2398
|
+
h(this, "style", {});
|
|
2399
|
+
h(this, "drawX", 0);
|
|
2400
|
+
h(this, "drawY", 0);
|
|
2401
|
+
h(this, "drawCellBgColor", "");
|
|
2402
|
+
h(this, "drawTextColor", "");
|
|
2403
|
+
h(this, "drawImageX", 0);
|
|
2404
|
+
h(this, "drawImageY", 0);
|
|
2405
|
+
h(this, "drawImageWidth", 0);
|
|
2406
|
+
h(this, "drawImageHeight", 0);
|
|
2407
|
+
h(this, "drawImageName", "");
|
|
2408
|
+
h(this, "drawImageSource");
|
|
2409
|
+
this.ctx = e, this.x = s, this.y = r, this.width = o, this.height = a, this.colIndex = i, this.key = l.key, this.type = l.type, this.editorType = l.editorType || "text", this.align = l.align || "center", this.verticalAlign = l.verticalAlign || "middle", this.fixed = l.fixed, this.level = l.level, this.operation = l.operation || !1, this.text = l.title, this.column = l, this.colspan = l.colspan, this.widthFillDisable = l.widthFillDisable, this.rowspan = l.rowspan, this.rules = l.rules, this.readonly = l.readonly, this.required = l.required, this.rowKey = Ut(), this.hasChildren = l.children && l.children.length > 0 || !1, this.render = l.renderHeader;
|
|
2410
2410
|
}
|
|
2411
2411
|
/**
|
|
2412
2412
|
* 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
|
|
@@ -2426,11 +2426,11 @@ class ie extends te {
|
|
|
2426
2426
|
const { HEADER_CELL_STYLE_METHOD: e, HEADER_BG_COLOR: i, HEADER_TEXT_COLOR: s } = this.ctx.config;
|
|
2427
2427
|
let r = i, o = s;
|
|
2428
2428
|
if (typeof e == "function") {
|
|
2429
|
-
const a = e, { backgroundColor:
|
|
2429
|
+
const a = e, { backgroundColor: l, color: c } = a({
|
|
2430
2430
|
colIndex: this.colIndex,
|
|
2431
2431
|
column: this.column
|
|
2432
2432
|
}) || {};
|
|
2433
|
-
|
|
2433
|
+
l && (r = l), c && (o = c);
|
|
2434
2434
|
}
|
|
2435
2435
|
this.drawCellBgColor = r, this.drawTextColor = o;
|
|
2436
2436
|
}
|
|
@@ -2441,11 +2441,11 @@ class ie extends te {
|
|
|
2441
2441
|
const {
|
|
2442
2442
|
paint: e,
|
|
2443
2443
|
config: { BORDER_COLOR: i, CELL_PADDING: s, HEADER_FONT: r }
|
|
2444
|
-
} = this.ctx, { drawX: o, drawY: a, displayText:
|
|
2444
|
+
} = this.ctx, { drawX: o, drawY: a, displayText: l } = this;
|
|
2445
2445
|
e.drawRect(o, a, this.width, this.height, {
|
|
2446
2446
|
borderColor: i,
|
|
2447
2447
|
fillColor: this.drawCellBgColor
|
|
2448
|
-
}), e.drawText(
|
|
2448
|
+
}), e.drawText(l, o, a, this.width, this.height, {
|
|
2449
2449
|
font: r,
|
|
2450
2450
|
padding: s,
|
|
2451
2451
|
color: this.drawTextColor,
|
|
@@ -2456,9 +2456,9 @@ class ie extends te {
|
|
|
2456
2456
|
drawSelection() {
|
|
2457
2457
|
const { width: e, height: i, type: s } = this;
|
|
2458
2458
|
if (["index-selection", "selection"].includes(s)) {
|
|
2459
|
-
const { indeterminate: r, check: o, selectable: a } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE:
|
|
2459
|
+
const { indeterminate: r, check: o, selectable: a } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: l = 0 } = this.ctx.config, c = this.drawX + (e - l) / 2, f = this.drawY + (i - l) / 2;
|
|
2460
2460
|
let d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck";
|
|
2461
|
-
r ? (d = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : o && a ? (d = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : o && a ? (d = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !o && a ? (d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck") : (d = this.ctx.icons.get("checkbox-disabled"), x = "checkbox-disabled"), d && (this.drawImageX = c, this.drawImageY = f, this.drawImageWidth =
|
|
2461
|
+
r ? (d = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : o && a ? (d = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : o && a ? (d = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !o && a ? (d = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck") : (d = this.ctx.icons.get("checkbox-disabled"), x = "checkbox-disabled"), d && (this.drawImageX = c, this.drawImageY = f, this.drawImageWidth = l, this.drawImageHeight = l, this.drawImageName = x, this.drawImageSource = d, this.ctx.paint.drawImage(
|
|
2462
2462
|
this.drawImageSource,
|
|
2463
2463
|
this.drawImageX,
|
|
2464
2464
|
this.drawImageY,
|
|
@@ -2485,11 +2485,11 @@ class ie extends te {
|
|
|
2485
2485
|
};
|
|
2486
2486
|
}
|
|
2487
2487
|
}
|
|
2488
|
-
class
|
|
2488
|
+
class hi {
|
|
2489
2489
|
constructor(t) {
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2490
|
+
h(this, "ctx");
|
|
2491
|
+
h(this, "visibleHoverCell");
|
|
2492
|
+
h(this, "resizeObserver");
|
|
2493
2493
|
this.ctx = t, this.init();
|
|
2494
2494
|
}
|
|
2495
2495
|
init() {
|
|
@@ -2579,10 +2579,10 @@ class li {
|
|
|
2579
2579
|
colIndex: t.colIndex,
|
|
2580
2580
|
column: t.column,
|
|
2581
2581
|
value: t.getValue()
|
|
2582
|
-
}).then((
|
|
2583
|
-
this.ctx.database.setExpandChildren(t.rowKey,
|
|
2584
|
-
}).catch((
|
|
2585
|
-
this.ctx.database.expandLoading(t.rowKey, !1), console.error(
|
|
2582
|
+
}).then((l) => {
|
|
2583
|
+
this.ctx.database.setExpandChildren(t.rowKey, l), this.ctx.database.expandLoading(t.rowKey, !1);
|
|
2584
|
+
}).catch((l) => {
|
|
2585
|
+
this.ctx.database.expandLoading(t.rowKey, !1), console.error(l);
|
|
2586
2586
|
}));
|
|
2587
2587
|
else {
|
|
2588
2588
|
const a = this.ctx.database.getIsExpand(t.rowKey);
|
|
@@ -2609,15 +2609,15 @@ class li {
|
|
|
2609
2609
|
handleBodyEvent(t, e, i, s, r = !1) {
|
|
2610
2610
|
for (const o of i) {
|
|
2611
2611
|
const a = o.fixedCells.concat(o.noFixedCells);
|
|
2612
|
-
for (const
|
|
2613
|
-
const c =
|
|
2612
|
+
for (const l of a) {
|
|
2613
|
+
const c = l.getDrawX(), f = l.getDrawY();
|
|
2614
2614
|
if (r) {
|
|
2615
|
-
if (t > c && t < c +
|
|
2616
|
-
s(
|
|
2615
|
+
if (t > c && t < c + l.visibleWidth && e > f && e < f + l.visibleHeight) {
|
|
2616
|
+
s(l);
|
|
2617
2617
|
return;
|
|
2618
2618
|
}
|
|
2619
|
-
} else if (t > c && t < c +
|
|
2620
|
-
s(
|
|
2619
|
+
} else if (t > c && t < c + l.width && e > f && e < f + l.height) {
|
|
2620
|
+
s(l);
|
|
2621
2621
|
return;
|
|
2622
2622
|
}
|
|
2623
2623
|
}
|
|
@@ -2636,51 +2636,51 @@ class li {
|
|
|
2636
2636
|
this.resizeObserver.unobserve(this.ctx.stageElement);
|
|
2637
2637
|
}
|
|
2638
2638
|
}
|
|
2639
|
-
class
|
|
2639
|
+
class li {
|
|
2640
2640
|
constructor(t, e) {
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2641
|
+
h(this, "eventBus");
|
|
2642
|
+
h(this, "eventBrowser");
|
|
2643
|
+
h(this, "eventTable");
|
|
2644
|
+
h(this, "containerElement");
|
|
2645
|
+
h(this, "stageElement");
|
|
2646
|
+
h(this, "canvasElement");
|
|
2647
|
+
h(this, "overlayerElement");
|
|
2648
|
+
h(this, "editorElement");
|
|
2649
|
+
h(this, "stageWidth", 0);
|
|
2650
|
+
h(this, "stageHeight", 0);
|
|
2651
|
+
h(this, "paint");
|
|
2652
|
+
h(this, "icons");
|
|
2653
|
+
h(this, "isInsideTargetContainer", !1);
|
|
2654
|
+
h(this, "mousedown", !1);
|
|
2655
|
+
h(this, "isPointer", !1);
|
|
2656
|
+
h(this, "rowResizing", !1);
|
|
2657
2657
|
// 行调整大小中
|
|
2658
|
-
|
|
2658
|
+
h(this, "columnResizing", !1);
|
|
2659
2659
|
// 列调整大小中
|
|
2660
|
-
|
|
2660
|
+
h(this, "scrollerMove", !1);
|
|
2661
2661
|
// 滚动条移动中
|
|
2662
|
-
|
|
2662
|
+
h(this, "scrollerFocus", !1);
|
|
2663
2663
|
// 滚动条focus中
|
|
2664
|
-
|
|
2664
|
+
h(this, "autofillMove", !1);
|
|
2665
2665
|
// 自动填充移动中
|
|
2666
|
-
|
|
2666
|
+
h(this, "selectorMove", !1);
|
|
2667
2667
|
// 选择器移动中
|
|
2668
|
-
|
|
2668
|
+
h(this, "editing", !1);
|
|
2669
2669
|
// 编辑中
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2670
|
+
h(this, "scrollY", 0);
|
|
2671
|
+
h(this, "scrollX", 0);
|
|
2672
|
+
h(this, "fixedLeftWidth", 0);
|
|
2673
|
+
h(this, "fixedRightWidth", 0);
|
|
2674
|
+
h(this, "maxColIndex", 0);
|
|
2675
|
+
h(this, "maxRowIndex", 0);
|
|
2676
|
+
h(this, "hoverRow");
|
|
2677
|
+
h(this, "clickCell");
|
|
2678
|
+
h(this, "focusCell");
|
|
2679
|
+
h(this, "hoverCell");
|
|
2680
|
+
h(this, "clickCellHeader");
|
|
2681
|
+
h(this, "focusCellHeader");
|
|
2682
|
+
h(this, "hoverCellHeader");
|
|
2683
|
+
h(this, "body", {
|
|
2684
2684
|
x: 0,
|
|
2685
2685
|
y: 0,
|
|
2686
2686
|
width: 0,
|
|
@@ -2693,7 +2693,7 @@ class hi {
|
|
|
2693
2693
|
renderRows: [],
|
|
2694
2694
|
data: []
|
|
2695
2695
|
});
|
|
2696
|
-
|
|
2696
|
+
h(this, "footer", {
|
|
2697
2697
|
x: 0,
|
|
2698
2698
|
y: 0,
|
|
2699
2699
|
width: 0,
|
|
@@ -2702,7 +2702,7 @@ class hi {
|
|
|
2702
2702
|
visibleWidth: 0,
|
|
2703
2703
|
renderRows: []
|
|
2704
2704
|
});
|
|
2705
|
-
|
|
2705
|
+
h(this, "header", {
|
|
2706
2706
|
x: 0,
|
|
2707
2707
|
y: 0,
|
|
2708
2708
|
width: 0,
|
|
@@ -2717,23 +2717,23 @@ class hi {
|
|
|
2717
2717
|
fixedRightCellHeaders: [],
|
|
2718
2718
|
renderCenterCellHeaders: []
|
|
2719
2719
|
});
|
|
2720
|
-
|
|
2720
|
+
h(this, "selector", {
|
|
2721
2721
|
enable: !1,
|
|
2722
2722
|
xArr: [-1, -1],
|
|
2723
2723
|
yArr: [-1, -1],
|
|
2724
2724
|
xArrCopy: [-1, -1],
|
|
2725
2725
|
yArrCopy: [-1, -1]
|
|
2726
2726
|
});
|
|
2727
|
-
|
|
2727
|
+
h(this, "autofill", {
|
|
2728
2728
|
enable: !1,
|
|
2729
2729
|
xArr: [-1, -1],
|
|
2730
2730
|
yArr: [-1, -1]
|
|
2731
2731
|
});
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2732
|
+
h(this, "database");
|
|
2733
|
+
h(this, "history");
|
|
2734
|
+
h(this, "config");
|
|
2735
2735
|
const { containerElement: i, stageElement: s, canvasElement: r, overlayerElement: o, editorElement: a } = t;
|
|
2736
|
-
this.containerElement = i, this.stageElement = s, this.canvasElement = r, this.overlayerElement = o, this.editorElement = a, this.config = new Wt(e.config || {}), this.eventBus = new oi(), this.eventBrowser = new ri(this), this.eventTable = new
|
|
2736
|
+
this.containerElement = i, this.stageElement = s, this.canvasElement = r, this.overlayerElement = o, this.editorElement = a, this.config = new Wt(e.config || {}), this.eventBus = new oi(), this.eventBrowser = new ri(this), this.eventTable = new hi(this), this.paint = new ni(this.canvasElement), this.database = new ii(this, e), this.history = new si(this), this.icons = new ai(this);
|
|
2737
2737
|
}
|
|
2738
2738
|
setConfig(t) {
|
|
2739
2739
|
this.config = new Wt(t);
|
|
@@ -2768,7 +2768,7 @@ class hi {
|
|
|
2768
2768
|
for (let r = 0; r <= e[1] - e[0]; r++) {
|
|
2769
2769
|
const o = [];
|
|
2770
2770
|
for (let a = 0; a <= i[1] - i[0]; a++) {
|
|
2771
|
-
const
|
|
2771
|
+
const l = r + e[0], c = a + i[0], f = this.database.getItemValueForRowIndexAndColIndex(l, c);
|
|
2772
2772
|
f && o.push(f.value);
|
|
2773
2773
|
}
|
|
2774
2774
|
s += `${o.join(" ")}\r`, t.push(o);
|
|
@@ -2829,29 +2829,29 @@ class hi {
|
|
|
2829
2829
|
}
|
|
2830
2830
|
class Pt {
|
|
2831
2831
|
constructor(t, e) {
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2832
|
+
h(this, "ctx");
|
|
2833
|
+
h(this, "type");
|
|
2834
|
+
h(this, "isFocus", !1);
|
|
2835
|
+
h(this, "trackX", 0);
|
|
2836
|
+
h(this, "trackY", 0);
|
|
2837
|
+
h(this, "trackWidth", 0);
|
|
2838
|
+
h(this, "trackHeight", 0);
|
|
2839
|
+
h(this, "splitPoints", []);
|
|
2840
2840
|
//分割线
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2841
|
+
h(this, "barX", 0);
|
|
2842
|
+
h(this, "barY", 0);
|
|
2843
|
+
h(this, "barWidth", 0);
|
|
2844
|
+
h(this, "barHeight", 0);
|
|
2845
|
+
h(this, "distance", 0);
|
|
2846
2846
|
// 滚动条的长度
|
|
2847
|
-
|
|
2847
|
+
h(this, "visibleDistance", 0);
|
|
2848
2848
|
//可见区域的长度
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2849
|
+
h(this, "clientX", 0);
|
|
2850
|
+
h(this, "clientY", 0);
|
|
2851
|
+
h(this, "dragStart", 0);
|
|
2852
2852
|
// 拖拽开始的位置
|
|
2853
|
-
|
|
2854
|
-
|
|
2853
|
+
h(this, "isDragging", !1);
|
|
2854
|
+
h(this, "scroll", 0);
|
|
2855
2855
|
this.ctx = t, this.type = e, this.type === "vertical" ? this.scroll = this.ctx.scrollY : this.scroll = this.ctx.scrollX;
|
|
2856
2856
|
}
|
|
2857
2857
|
onWheel(t) {
|
|
@@ -2904,19 +2904,19 @@ class Pt {
|
|
|
2904
2904
|
stageHeight: i,
|
|
2905
2905
|
stageWidth: s,
|
|
2906
2906
|
config: { SCROLLER_TRACK_SIZE: r = 0, SCROLLER_SIZE: o = 0 }
|
|
2907
|
-
} = this.ctx, a = s,
|
|
2907
|
+
} = this.ctx, a = s, l = i, c = e.height, f = e.width, d = t.height, x = this.ctx.footer.height;
|
|
2908
2908
|
if (this.type === "vertical") {
|
|
2909
|
-
this.visibleDistance =
|
|
2909
|
+
this.visibleDistance = l - 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 = l, this.barX = this.trackX - 0.5 + (r - o) / 2, this.barWidth = o;
|
|
2910
2910
|
const u = this.distance ? this.visibleDistance / d : 0;
|
|
2911
2911
|
let g = Math.floor(u * this.visibleDistance);
|
|
2912
2912
|
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));
|
|
2913
2913
|
} else {
|
|
2914
2914
|
this.visibleDistance = a - r, this.distance = f - this.visibleDistance, this.splitPoints = [
|
|
2915
2915
|
a - r,
|
|
2916
|
-
|
|
2916
|
+
l - r,
|
|
2917
2917
|
a - r,
|
|
2918
|
-
|
|
2919
|
-
], this.trackX = 0, this.trackY =
|
|
2918
|
+
l
|
|
2919
|
+
], this.trackX = 0, this.trackY = l - r, this.trackWidth = a, this.trackHeight = r;
|
|
2920
2920
|
const u = this.distance ? this.visibleDistance / f : 0;
|
|
2921
2921
|
let g = Math.floor(u * this.visibleDistance);
|
|
2922
2922
|
this.barY = this.trackY - 0.5 + (r - o) / 2, g < 30 ? g = 30 : g >= this.visibleDistance && (g = 0), this.barWidth = g, this.barHeight = o, this.barX = this.scroll / this.distance * (this.visibleDistance - this.barWidth), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
@@ -2940,9 +2940,9 @@ class Pt {
|
|
|
2940
2940
|
}
|
|
2941
2941
|
class ci {
|
|
2942
2942
|
constructor(t) {
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2943
|
+
h(this, "ctx");
|
|
2944
|
+
h(this, "verticalScrollbar");
|
|
2945
|
+
h(this, "horizontalScrollbar");
|
|
2946
2946
|
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) => {
|
|
2947
2947
|
this.setScroll(e, i);
|
|
2948
2948
|
}), this.ctx.on("setScrollX", (e) => {
|
|
@@ -2996,41 +2996,41 @@ class ci {
|
|
|
2996
2996
|
}
|
|
2997
2997
|
class di {
|
|
2998
2998
|
constructor(t) {
|
|
2999
|
-
|
|
2999
|
+
h(this, "ctx");
|
|
3000
3000
|
// 上下文
|
|
3001
|
-
|
|
3001
|
+
h(this, "x", 0);
|
|
3002
3002
|
// x坐标
|
|
3003
|
-
|
|
3003
|
+
h(this, "y", 0);
|
|
3004
3004
|
// y坐标
|
|
3005
|
-
|
|
3005
|
+
h(this, "width", 0);
|
|
3006
3006
|
// 宽度
|
|
3007
|
-
|
|
3007
|
+
h(this, "height", 0);
|
|
3008
3008
|
// 高度
|
|
3009
|
-
|
|
3009
|
+
h(this, "resizeTarget", null);
|
|
3010
3010
|
//调整表头
|
|
3011
|
-
|
|
3011
|
+
h(this, "resizeNum", 0);
|
|
3012
3012
|
// 调整列的数量
|
|
3013
|
-
|
|
3013
|
+
h(this, "isResizing", !1);
|
|
3014
3014
|
// 是否移动中
|
|
3015
|
-
|
|
3015
|
+
h(this, "clientX", 0);
|
|
3016
3016
|
// 鼠标按下时的x轴位置
|
|
3017
|
-
|
|
3017
|
+
h(this, "resizeDiff", 0);
|
|
3018
3018
|
// 是否移动中
|
|
3019
|
-
|
|
3020
|
-
|
|
3019
|
+
h(this, "columnIndex", 0);
|
|
3020
|
+
h(this, "isMouseDown", !1);
|
|
3021
3021
|
// 是否按下
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3022
|
+
h(this, "columns");
|
|
3023
|
+
h(this, "visibleLeafColumns", []);
|
|
3024
|
+
h(this, "visibleHeight", 0);
|
|
3025
|
+
h(this, "visibleWidth", 0);
|
|
3026
|
+
h(this, "allCellHeaders", []);
|
|
3027
|
+
h(this, "leafCellHeaders", []);
|
|
3028
|
+
h(this, "renderLeafCellHeaders", []);
|
|
3029
|
+
h(this, "fixedLeftCellHeaders", []);
|
|
3030
|
+
h(this, "centerCellHeaders", []);
|
|
3031
|
+
h(this, "fixedRightCellHeaders", []);
|
|
3032
|
+
h(this, "renderCenterCellHeaders", []);
|
|
3033
|
+
h(this, "renderFixedCellHeaders", []);
|
|
3034
3034
|
this.ctx = t, this.ctx.on(
|
|
3035
3035
|
"resetHeader",
|
|
3036
3036
|
Zt(() => {
|
|
@@ -3049,9 +3049,9 @@ class di {
|
|
|
3049
3049
|
this.columnIndex = 0, this.resizeNum = 0, this.render(o, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
|
|
3050
3050
|
const a = this.ctx.containerElement.getBoundingClientRect();
|
|
3051
3051
|
this.resizeNum > 0 ? this.ctx.stageWidth = Math.floor(a.width) : this.ctx.stageWidth = Math.floor(this.width + e), this.ctx.stageElement.style.width = this.ctx.stageWidth - 0.5 + "px", this.visibleWidth = this.ctx.stageWidth - e;
|
|
3052
|
-
const
|
|
3053
|
-
if (this.resizeNum &&
|
|
3054
|
-
const d = Math.floor(
|
|
3052
|
+
const l = this.visibleWidth - this.width;
|
|
3053
|
+
if (this.resizeNum && l > 0) {
|
|
3054
|
+
const d = Math.floor(l / this.resizeNum * 100) / 100;
|
|
3055
3055
|
this.resizeAllColumn(d);
|
|
3056
3056
|
}
|
|
3057
3057
|
const c = this.fixedLeftCellHeaders.filter((d) => !d.hasChildren);
|
|
@@ -3084,9 +3084,9 @@ class di {
|
|
|
3084
3084
|
this.ctx.stageElement.style.cursor === "col-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3085
3085
|
const r = [...this.renderFixedCellHeaders, ...this.renderCenterCellHeaders];
|
|
3086
3086
|
for (const o of r) {
|
|
3087
|
-
const { offsetX: a, offsetY:
|
|
3087
|
+
const { offsetX: a, offsetY: l } = this.ctx.getOffset(e), c = a, f = o.getDrawX();
|
|
3088
3088
|
c > f + o.width - 5 && c < f + o.width + 4 && c < i - 4 && // 视窗中最后一列不允许调整宽
|
|
3089
|
-
o.colspan <= 1 && this.ctx.isTarget() &&
|
|
3089
|
+
o.colspan <= 1 && this.ctx.isTarget() && l <= this.height && (this.ctx.stageElement.style.cursor = "col-resize", this.resizeTarget = o);
|
|
3090
3090
|
}
|
|
3091
3091
|
}
|
|
3092
3092
|
}));
|
|
@@ -3140,10 +3140,10 @@ class di {
|
|
|
3140
3140
|
let s = e;
|
|
3141
3141
|
const { HEADER_HEIGHT: r = 0 } = this.ctx.config;
|
|
3142
3142
|
for (let o = 0; o < i; o++) {
|
|
3143
|
-
const a = t[o],
|
|
3143
|
+
const a = t[o], l = r * (a.rowspan || 1), c = r * a.level;
|
|
3144
3144
|
let f = a.width || 100;
|
|
3145
3145
|
a.children && (f = _t(a.children).reduce((u, g) => u + ((g == null ? void 0 : g.width) || 100), 0));
|
|
3146
|
-
const d = new ie(this.ctx, this.columnIndex, s, c, f,
|
|
3146
|
+
const d = new ie(this.ctx, this.columnIndex, s, c, f, l, a);
|
|
3147
3147
|
this.ctx.database.setHeader(a.key, d), this.allCellHeaders.push(d), a.children || (this.leafCellHeaders.push(d), d.column.widthFillDisable || this.resizeNum++), a.fixed === "left" ? this.fixedLeftCellHeaders.push(d) : a.fixed === "right" ? this.fixedRightCellHeaders.push(d) : this.centerCellHeaders.push(d), !a.children && this.columnIndex++, a.children && this.render(a.children, s), s += f;
|
|
3148
3148
|
}
|
|
3149
3149
|
}
|
|
@@ -3175,8 +3175,8 @@ class di {
|
|
|
3175
3175
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3176
3176
|
colorEnd: "rgba(0,0,0,0)"
|
|
3177
3177
|
}), i < Math.floor(s.width - r - 1) && e !== a) {
|
|
3178
|
-
const
|
|
3179
|
-
this.ctx.paint.drawShadow(
|
|
3178
|
+
const l = s.width - (this.x + this.width) + r - e;
|
|
3179
|
+
this.ctx.paint.drawShadow(l + 1, this.y, e, this.height, {
|
|
3180
3180
|
fillColor: o,
|
|
3181
3181
|
side: "left",
|
|
3182
3182
|
shadowWidth: 4,
|
|
@@ -3204,20 +3204,20 @@ class di {
|
|
|
3204
3204
|
}
|
|
3205
3205
|
}
|
|
3206
3206
|
class se {
|
|
3207
|
-
constructor(t, e, i = 0, s = 0, r = 0, o = 0, a,
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
this.ctx = t, this.x = i, this.y = s, this.width = r, this.height = o, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e), this.rowType =
|
|
3207
|
+
constructor(t, e, i = 0, s = 0, r = 0, o = 0, a, l = "body") {
|
|
3208
|
+
h(this, "ctx");
|
|
3209
|
+
h(this, "x", 0);
|
|
3210
|
+
h(this, "y", 0);
|
|
3211
|
+
h(this, "width", 0);
|
|
3212
|
+
h(this, "height");
|
|
3213
|
+
h(this, "cells", []);
|
|
3214
|
+
h(this, "fixedCells", []);
|
|
3215
|
+
h(this, "noFixedCells", []);
|
|
3216
|
+
h(this, "rowIndex", 0);
|
|
3217
|
+
h(this, "rowKey", "");
|
|
3218
|
+
h(this, "rowType", "body");
|
|
3219
|
+
h(this, "data");
|
|
3220
|
+
this.ctx = t, this.x = i, this.y = s, this.width = r, this.height = o, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e), this.rowType = l, this.data = a, this.update();
|
|
3221
3221
|
}
|
|
3222
3222
|
update() {
|
|
3223
3223
|
const { header: t } = this.ctx, e = [], i = [], s = [];
|
|
@@ -3257,28 +3257,28 @@ class se {
|
|
|
3257
3257
|
}
|
|
3258
3258
|
class fi {
|
|
3259
3259
|
constructor(t) {
|
|
3260
|
-
|
|
3260
|
+
h(this, "resizeTarget", null);
|
|
3261
3261
|
//调整行大小的目标
|
|
3262
|
-
|
|
3262
|
+
h(this, "isMouseDown", !1);
|
|
3263
3263
|
// 是否按下
|
|
3264
|
-
|
|
3264
|
+
h(this, "resizeDiff", 0);
|
|
3265
3265
|
// 是否移动中
|
|
3266
|
-
|
|
3266
|
+
h(this, "clientY", 0);
|
|
3267
3267
|
// 鼠标按下时的y轴位置
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3268
|
+
h(this, "ctx");
|
|
3269
|
+
h(this, "x", 0);
|
|
3270
|
+
h(this, "y", 0);
|
|
3271
|
+
h(this, "width", 0);
|
|
3272
|
+
h(this, "height", 0);
|
|
3273
|
+
h(this, "headIndex", 0);
|
|
3274
|
+
h(this, "tailIndex", 0);
|
|
3275
|
+
h(this, "isResizing", !1);
|
|
3276
3276
|
//是否正在调整大小
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3277
|
+
h(this, "renderRows", []);
|
|
3278
|
+
h(this, "visibleRows", []);
|
|
3279
|
+
h(this, "visibleHeight", 0);
|
|
3280
|
+
h(this, "visibleWidth", 0);
|
|
3281
|
+
h(this, "data", []);
|
|
3282
3282
|
this.ctx = t, this.init(), this.initResizeRow();
|
|
3283
3283
|
}
|
|
3284
3284
|
init() {
|
|
@@ -3291,7 +3291,7 @@ class fi {
|
|
|
3291
3291
|
SCROLLER_TRACK_SIZE: r = 0,
|
|
3292
3292
|
HEIGHT: o,
|
|
3293
3293
|
EMPTY_BODY_HEIGHT: a = 0,
|
|
3294
|
-
MAX_HEIGHT:
|
|
3294
|
+
MAX_HEIGHT: l = 0,
|
|
3295
3295
|
ENABLE_OFFSET_HEIGHT: c = 0,
|
|
3296
3296
|
OFFSET_HEIGHT: f = 0
|
|
3297
3297
|
}
|
|
@@ -3320,7 +3320,7 @@ class fi {
|
|
|
3320
3320
|
let y = 0;
|
|
3321
3321
|
this.data.length && c ? (y = window.innerHeight - u - f, y < 0 && (y = 32, console.error(
|
|
3322
3322
|
"There is an error in the height calculation ENABLE_OFFSET_HEIGHT and OFFSET_HEIGHT are invalid"
|
|
3323
|
-
))) : this.data.length && o ? y = o : this.data.length &&
|
|
3323
|
+
))) : this.data.length && o ? y = o : this.data.length && l && p > l ? y = l : y = p, y > 0 && (this.ctx.stageHeight = Math.floor(y), this.ctx.stageElement.style.height = `${this.ctx.stageHeight - 0.5}px`);
|
|
3324
3324
|
let b = this.ctx.stageHeight - e.height - r;
|
|
3325
3325
|
s ? this.visibleHeight = b - g : this.visibleHeight = b, this.ctx.body.x = this.x, this.ctx.body.y = this.y, this.ctx.body.width = this.width, this.ctx.body.height = this.height, this.ctx.body.visibleWidth = this.visibleWidth, this.ctx.body.visibleHeight = this.visibleHeight, this.ctx.body.data = d;
|
|
3326
3326
|
const m = window.devicePixelRatio || 1, E = this.ctx.stageWidth * m, C = this.ctx.stageHeight * m;
|
|
@@ -3343,7 +3343,7 @@ class fi {
|
|
|
3343
3343
|
}), this.ctx.on("mousemove", (e) => {
|
|
3344
3344
|
if (this.ctx.editing) return;
|
|
3345
3345
|
const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), r = i, o = s, a = e.clientY, {
|
|
3346
|
-
stageHeight:
|
|
3346
|
+
stageHeight: l,
|
|
3347
3347
|
scrollY: c,
|
|
3348
3348
|
config: { RESIZE_ROW_MIN_HEIGHT: f = 0 }
|
|
3349
3349
|
} = this.ctx;
|
|
@@ -3357,7 +3357,7 @@ class fi {
|
|
|
3357
3357
|
this.ctx.stageElement.style.cursor === "row-resize" && (this.ctx.stageElement.style.cursor = "default");
|
|
3358
3358
|
for (let d = 0; d < this.renderRows.length; d++) {
|
|
3359
3359
|
const x = this.renderRows[d];
|
|
3360
|
-
if (r > x.y - c + x.height - 1.5 && r < x.y - c + x.height + 1.5 && r <
|
|
3360
|
+
if (r > x.y - c + x.height - 1.5 && r < x.y - c + x.height + 1.5 && r < l - 4)
|
|
3361
3361
|
for (let g = 0; g < x.cells.length; g++) {
|
|
3362
3362
|
const w = x.cells[g];
|
|
3363
3363
|
o > w.drawX + 10 && o < w.drawX + w.width - 10 && w.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = x);
|
|
@@ -3406,8 +3406,8 @@ class fi {
|
|
|
3406
3406
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3407
3407
|
colorEnd: "rgba(0,0,0,0)"
|
|
3408
3408
|
}), i < Math.floor(s.width - r - 1) && e !== a) {
|
|
3409
|
-
const
|
|
3410
|
-
this.ctx.paint.drawShadow(
|
|
3409
|
+
const l = s.width - (this.x + this.width) + r - e;
|
|
3410
|
+
this.ctx.paint.drawShadow(l + 1, this.y, e, this.height, {
|
|
3411
3411
|
fillColor: o,
|
|
3412
3412
|
side: "left",
|
|
3413
3413
|
shadowWidth: 4,
|
|
@@ -3431,8 +3431,8 @@ class fi {
|
|
|
3431
3431
|
const { header: t, database: e, scrollY: i } = this.ctx, s = i, { data: r, positions: o } = e.getData();
|
|
3432
3432
|
this.ctx.maxRowIndex = r.length - 1;
|
|
3433
3433
|
const a = this.binarySearch(o, s);
|
|
3434
|
-
let
|
|
3435
|
-
|
|
3434
|
+
let l = this.binarySearch(o, s + this.visibleHeight);
|
|
3435
|
+
l === -1 && (l = r.length), this.headIndex = Math.max(0, a), this.tailIndex = Math.min(this.ctx.maxRowIndex, l + 1), this.visibleRows = r.slice(this.headIndex, this.tailIndex + 1), this.ctx.body.headIndex = this.headIndex, this.ctx.body.tailIndex = this.tailIndex, this.ctx.body.visibleRows = this.visibleRows;
|
|
3436
3436
|
const c = [];
|
|
3437
3437
|
for (let f = 0; f < this.visibleRows.length; f++) {
|
|
3438
3438
|
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);
|
|
@@ -3450,15 +3450,15 @@ class fi {
|
|
|
3450
3450
|
}
|
|
3451
3451
|
class xi {
|
|
3452
3452
|
constructor(t) {
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3453
|
+
h(this, "ctx");
|
|
3454
|
+
h(this, "renderRows", []);
|
|
3455
|
+
h(this, "data", []);
|
|
3456
|
+
h(this, "x", 0);
|
|
3457
|
+
h(this, "y", 0);
|
|
3458
|
+
h(this, "width", 0);
|
|
3459
|
+
h(this, "height", 0);
|
|
3460
|
+
h(this, "visibleWidth", 0);
|
|
3461
|
+
h(this, "visibleHeight", 0);
|
|
3462
3462
|
this.ctx = t, this.init();
|
|
3463
3463
|
}
|
|
3464
3464
|
init() {
|
|
@@ -3479,8 +3479,8 @@ class xi {
|
|
|
3479
3479
|
stageWidth: r,
|
|
3480
3480
|
config: { HEADER_BG_COLOR: o, SCROLLER_TRACK_SIZE: a }
|
|
3481
3481
|
} = this.ctx;
|
|
3482
|
-
let
|
|
3483
|
-
if (this.ctx.config.FOOTER_FIXED || (
|
|
3482
|
+
let l = this.y;
|
|
3483
|
+
if (this.ctx.config.FOOTER_FIXED || (l = this.y - this.ctx.scrollY), i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, l, t, this.height, {
|
|
3484
3484
|
fillColor: o,
|
|
3485
3485
|
side: "right",
|
|
3486
3486
|
shadowWidth: 4,
|
|
@@ -3488,7 +3488,7 @@ class xi {
|
|
|
3488
3488
|
colorEnd: "rgba(0,0,0,0)"
|
|
3489
3489
|
}), i < Math.floor(s.width - r - 1) && e !== a) {
|
|
3490
3490
|
const c = s.width - (this.x + this.width) + r - e;
|
|
3491
|
-
this.ctx.paint.drawShadow(c + 1,
|
|
3491
|
+
this.ctx.paint.drawShadow(c + 1, l, e, this.height, {
|
|
3492
3492
|
fillColor: o,
|
|
3493
3493
|
side: "left",
|
|
3494
3494
|
shadowWidth: 4,
|
|
@@ -3525,17 +3525,16 @@ class xi {
|
|
|
3525
3525
|
}
|
|
3526
3526
|
}
|
|
3527
3527
|
class ui {
|
|
3528
|
+
// 垂直滚动定时器
|
|
3528
3529
|
constructor(t) {
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3530
|
+
h(this, "isCut", !1);
|
|
3531
|
+
h(this, "isMultipleRow", !1);
|
|
3532
|
+
h(this, "ctx");
|
|
3533
|
+
h(this, "adjustPositionX", "");
|
|
3534
|
+
h(this, "adjustPositionY", "");
|
|
3535
|
+
h(this, "timerX", 0);
|
|
3535
3536
|
// 水平滚动定时器
|
|
3536
|
-
|
|
3537
|
-
// 垂直滚动定时器
|
|
3538
|
-
l(this, "adjustTimer", 0);
|
|
3537
|
+
h(this, "timerY", 0);
|
|
3539
3538
|
this.ctx = t, this.init();
|
|
3540
3539
|
}
|
|
3541
3540
|
init() {
|
|
@@ -3630,12 +3629,12 @@ class ui {
|
|
|
3630
3629
|
this.ctx.mousedown && (this.ctx.selectorMove = !0), this.ctx.selector.enable = !0;
|
|
3631
3630
|
const {
|
|
3632
3631
|
SELECTOR_AREA_MIN_X: a,
|
|
3633
|
-
SELECTOR_AREA_MAX_X:
|
|
3632
|
+
SELECTOR_AREA_MAX_X: l,
|
|
3634
3633
|
SELECTOR_AREA_MIN_Y: c,
|
|
3635
3634
|
SELECTOR_AREA_MAX_Y: f,
|
|
3636
3635
|
SELECTOR_AREA_MAX_X_OFFSET: d,
|
|
3637
3636
|
SELECTOR_AREA_MAX_Y_OFFSET: x
|
|
3638
|
-
} = this.ctx.config, u = a, g =
|
|
3637
|
+
} = this.ctx.config, u = a, g = l || this.ctx.maxColIndex - d, w = c, p = f || this.ctx.maxRowIndex - x;
|
|
3639
3638
|
let [y, b] = r, [m, E] = o;
|
|
3640
3639
|
if (y < u || b > g || m < w || E > p)
|
|
3641
3640
|
return;
|
|
@@ -3653,15 +3652,15 @@ class ui {
|
|
|
3653
3652
|
if (this.ctx.mousedown && this.ctx.focusCellHeader) {
|
|
3654
3653
|
const { colIndex: a } = this.ctx.focusCellHeader;
|
|
3655
3654
|
if (this.ctx.clearSelector(), t.colIndex >= a) {
|
|
3656
|
-
const
|
|
3657
|
-
this.setSelector(
|
|
3655
|
+
const l = [a, t.colIndex + t.colspan - 1], c = [r, o];
|
|
3656
|
+
this.setSelector(l, c);
|
|
3658
3657
|
} else {
|
|
3659
|
-
const
|
|
3660
|
-
this.setSelector(
|
|
3658
|
+
const l = [t.colIndex, a], c = [r, o];
|
|
3659
|
+
this.setSelector(l, c);
|
|
3661
3660
|
}
|
|
3662
3661
|
} else {
|
|
3663
|
-
const a = [t.colIndex, t.colIndex + t.colspan - 1],
|
|
3664
|
-
this.setSelector(a,
|
|
3662
|
+
const a = [t.colIndex, t.colIndex + t.colspan - 1], l = [r, o];
|
|
3663
|
+
this.setSelector(a, l);
|
|
3665
3664
|
}
|
|
3666
3665
|
}
|
|
3667
3666
|
selectAll() {
|
|
@@ -3675,8 +3674,8 @@ class ui {
|
|
|
3675
3674
|
SELECTOR_AREA_MIN_Y: r,
|
|
3676
3675
|
SELECTOR_AREA_MAX_Y: o,
|
|
3677
3676
|
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
3678
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
3679
|
-
} = this.ctx.config, c = i, f = s || this.ctx.maxColIndex - a, d = r, x = o || this.ctx.maxRowIndex -
|
|
3677
|
+
SELECTOR_AREA_MAX_Y_OFFSET: l
|
|
3678
|
+
} = this.ctx.config, c = i, f = s || this.ctx.maxColIndex - a, d = r, x = o || this.ctx.maxRowIndex - l, u = [c, f], g = [d, x];
|
|
3680
3679
|
this.setSelector(u, g);
|
|
3681
3680
|
}
|
|
3682
3681
|
}
|
|
@@ -3686,16 +3685,16 @@ class ui {
|
|
|
3686
3685
|
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;
|
|
3687
3686
|
if (e) {
|
|
3688
3687
|
this.ctx.setFocusCell(t);
|
|
3689
|
-
const
|
|
3690
|
-
this.setSelector(
|
|
3688
|
+
const l = [a, o], c = [t.rowIndex, t.rowIndex];
|
|
3689
|
+
this.setSelector(l, c);
|
|
3691
3690
|
}
|
|
3692
3691
|
if (this.ctx.focusCell && this.ctx.mousedown) {
|
|
3693
|
-
const { rowIndex:
|
|
3694
|
-
if (t.rowIndex >=
|
|
3695
|
-
const c = [a, o], f = [
|
|
3692
|
+
const { rowIndex: l } = this.ctx.focusCell;
|
|
3693
|
+
if (t.rowIndex >= l) {
|
|
3694
|
+
const c = [a, o], f = [l, t.rowIndex];
|
|
3696
3695
|
this.setSelector(c, f);
|
|
3697
3696
|
} else {
|
|
3698
|
-
const c = [a, o], f = [t.rowIndex,
|
|
3697
|
+
const c = [a, o], f = [t.rowIndex, l];
|
|
3699
3698
|
this.setSelector(c, f);
|
|
3700
3699
|
}
|
|
3701
3700
|
}
|
|
@@ -3705,7 +3704,7 @@ class ui {
|
|
|
3705
3704
|
return;
|
|
3706
3705
|
const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
|
|
3707
3706
|
if (t && e && i) {
|
|
3708
|
-
const { rowIndex: s, colIndex: r } = e, o = Math.min(i.colIndex, r), a = Math.max(i.colIndex, r),
|
|
3707
|
+
const { rowIndex: s, colIndex: r } = e, o = Math.min(i.colIndex, r), a = Math.max(i.colIndex, r), l = Math.min(i.rowIndex, s), c = Math.max(i.rowIndex, s), f = [o, a], d = [l, c];
|
|
3709
3708
|
this.setSelector(f, d);
|
|
3710
3709
|
}
|
|
3711
3710
|
}
|
|
@@ -3713,7 +3712,7 @@ class ui {
|
|
|
3713
3712
|
const { focusCell: e, clickCell: i } = this.ctx;
|
|
3714
3713
|
if (e && this.isInSettingRange(e.rowIndex, e.colIndex))
|
|
3715
3714
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
3716
|
-
const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: a } = e,
|
|
3715
|
+
const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: a } = e, l = Math.min(o, s), c = Math.max(o, s), f = Math.min(a, r), d = Math.max(a, r), x = [l, c], u = [f, d];
|
|
3717
3716
|
this.setSelector(x, u);
|
|
3718
3717
|
} else {
|
|
3719
3718
|
this.ctx.emit("cellSelectedClick", e);
|
|
@@ -3750,8 +3749,8 @@ class ui {
|
|
|
3750
3749
|
let s = [];
|
|
3751
3750
|
const r = /* @__PURE__ */ new Set();
|
|
3752
3751
|
for (let a = 0; a <= e[1] - e[0]; a++)
|
|
3753
|
-
for (let
|
|
3754
|
-
const c = a + e[0], f =
|
|
3752
|
+
for (let l = 0; l <= t[1] - t[0]; l++) {
|
|
3753
|
+
const c = a + e[0], f = l + t[0], d = this.ctx.database.getItemValueForRowIndexAndColIndex(c, f);
|
|
3755
3754
|
if (d) {
|
|
3756
3755
|
const { rowKey: x, key: u } = d;
|
|
3757
3756
|
this.ctx.database.getReadonly(x, u) || (r.add(x), s.push({
|
|
@@ -3816,10 +3815,10 @@ class ui {
|
|
|
3816
3815
|
if (!a.length)
|
|
3817
3816
|
return;
|
|
3818
3817
|
this.ctx.database.batchSetItemValue(a, !0);
|
|
3819
|
-
let
|
|
3818
|
+
let l = [];
|
|
3820
3819
|
s.forEach((c) => {
|
|
3821
|
-
|
|
3822
|
-
}), this.ctx.emit("pasteChange", a,
|
|
3820
|
+
l.push(this.ctx.database.getRowDataItemForRowKey(c));
|
|
3821
|
+
}), this.ctx.emit("pasteChange", a, l), this.clearCopyLine(), this.ctx.emit("drawView");
|
|
3823
3822
|
}).catch((r) => {
|
|
3824
3823
|
console.error("获取剪贴板内容失败:", r);
|
|
3825
3824
|
});
|
|
@@ -3835,7 +3834,7 @@ class ui {
|
|
|
3835
3834
|
if (!e)
|
|
3836
3835
|
return;
|
|
3837
3836
|
let { colIndex: i = 0, rowIndex: s = 0 } = e;
|
|
3838
|
-
const r = 0, o = 0, a = this.ctx.maxColIndex,
|
|
3837
|
+
const r = 0, o = 0, a = this.ctx.maxColIndex, l = this.ctx.maxRowIndex;
|
|
3839
3838
|
switch (t) {
|
|
3840
3839
|
case "LEFT":
|
|
3841
3840
|
i > r && i--;
|
|
@@ -3847,7 +3846,7 @@ class ui {
|
|
|
3847
3846
|
i < a && i++;
|
|
3848
3847
|
break;
|
|
3849
3848
|
case "BOTTOM":
|
|
3850
|
-
s <
|
|
3849
|
+
s < l && s++;
|
|
3851
3850
|
break;
|
|
3852
3851
|
}
|
|
3853
3852
|
const c = [i, i], f = [s, s], d = this.getCell(s, i);
|
|
@@ -3864,8 +3863,8 @@ class ui {
|
|
|
3864
3863
|
SELECTOR_AREA_MIN_Y: r,
|
|
3865
3864
|
SELECTOR_AREA_MAX_Y: o,
|
|
3866
3865
|
SELECTOR_AREA_MAX_X_OFFSET: a,
|
|
3867
|
-
SELECTOR_AREA_MAX_Y_OFFSET:
|
|
3868
|
-
} = this.ctx.config, c = i, f = s || this.ctx.maxColIndex - a, d = r, x = o || this.ctx.maxRowIndex -
|
|
3866
|
+
SELECTOR_AREA_MAX_Y_OFFSET: l
|
|
3867
|
+
} = this.ctx.config, c = i, f = s || this.ctx.maxColIndex - a, d = r, x = o || this.ctx.maxRowIndex - l;
|
|
3869
3868
|
return !(e < c || e > f || t < d || t > x);
|
|
3870
3869
|
}
|
|
3871
3870
|
/**
|
|
@@ -3879,7 +3878,7 @@ class ui {
|
|
|
3879
3878
|
let a = 10 * (s === "left" ? -1 : 1);
|
|
3880
3879
|
this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
|
|
3881
3880
|
a *= 1.5;
|
|
3882
|
-
const { scrollX:
|
|
3881
|
+
const { scrollX: l } = this.ctx, c = l + a;
|
|
3883
3882
|
(c < 0 || c > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(c);
|
|
3884
3883
|
}, 100);
|
|
3885
3884
|
}
|
|
@@ -3888,7 +3887,7 @@ class ui {
|
|
|
3888
3887
|
let a = 10 * (r === "top" ? -1 : 1);
|
|
3889
3888
|
this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
|
|
3890
3889
|
a *= 1.5;
|
|
3891
|
-
const { scrollY:
|
|
3890
|
+
const { scrollY: l } = this.ctx, c = l + a;
|
|
3892
3891
|
(c < 0 || c > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(c);
|
|
3893
3892
|
}, 100);
|
|
3894
3893
|
}
|
|
@@ -3905,18 +3904,17 @@ class ui {
|
|
|
3905
3904
|
fixedLeftWidth: r,
|
|
3906
3905
|
header: o,
|
|
3907
3906
|
footer: a,
|
|
3908
|
-
scrollX:
|
|
3909
|
-
scrollY: c
|
|
3907
|
+
scrollX: l,
|
|
3908
|
+
scrollY: c,
|
|
3909
|
+
config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED: d }
|
|
3910
3910
|
} = this.ctx;
|
|
3911
3911
|
if (!i || i.height > t)
|
|
3912
3912
|
return;
|
|
3913
|
-
const { SCROLLER_TRACK_SIZE: f = 0, FOOTER_FIXED: d } = this.ctx.config;
|
|
3914
3913
|
let x = 0;
|
|
3915
|
-
d && (x = a.visibleHeight)
|
|
3914
|
+
if (d && (x = a.visibleHeight), i.fixed || !(i.drawX < r || i.drawX + i.width > e - s || i.drawY < this.ctx.header.height || i.drawY + i.height > t - x - f))
|
|
3915
|
+
return;
|
|
3916
3916
|
const u = r - i.drawX + 1, g = i.drawX + i.width - (e - s) + 1, w = o.height - i.drawY, p = i.drawY + i.height - (t - x - f);
|
|
3917
|
-
this.
|
|
3918
|
-
this.ctx.editing || (g > 0 && !i.fixed ? this.ctx.setScrollX(h + g) : u > 0 && !i.fixed && this.ctx.setScrollX(h - u), w > 0 ? this.ctx.setScrollY(c - w) : p > 0 && this.ctx.setScrollY(c + p));
|
|
3919
|
-
}, 167);
|
|
3917
|
+
this.ctx.editing || (g > 0 && !i.fixed ? this.ctx.setScrollX(l + g) : u > 0 && !i.fixed && this.ctx.setScrollX(l - u), w > 0 ? this.ctx.setScrollY(c - w) : p > 0 && this.ctx.setScrollY(c + p));
|
|
3920
3918
|
}
|
|
3921
3919
|
destroy() {
|
|
3922
3920
|
this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
|
|
@@ -3924,14 +3922,14 @@ class ui {
|
|
|
3924
3922
|
}
|
|
3925
3923
|
class gi {
|
|
3926
3924
|
constructor(t) {
|
|
3927
|
-
|
|
3925
|
+
h(this, "ctx");
|
|
3928
3926
|
this.ctx = t, this.init();
|
|
3929
3927
|
}
|
|
3930
3928
|
init() {
|
|
3931
3929
|
this.ctx.on("cellMouseenter", (t, e) => {
|
|
3932
3930
|
this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default");
|
|
3933
|
-
const { offsetX: i, offsetY: s } = this.ctx.getOffset(e), { xArr: r, yArr: o } = this.ctx.selector, a = r[1],
|
|
3934
|
-
if (this.ctx.config.ENABLE_AUTOFILL && c === a && f ===
|
|
3931
|
+
const { offsetX: i, offsetY: s } = this.ctx.getOffset(e), { xArr: r, yArr: o } = this.ctx.selector, a = r[1], l = o[1], { colIndex: c, rowIndex: f, drawX: d, drawY: x, width: u, height: g } = t;
|
|
3932
|
+
if (this.ctx.config.ENABLE_AUTOFILL && c === a && f === l) {
|
|
3935
3933
|
const p = d + u - 6, y = x + g - 6;
|
|
3936
3934
|
i > p && s > y && (this.ctx.stageElement.style.cursor = "crosshair");
|
|
3937
3935
|
}
|
|
@@ -3964,22 +3962,22 @@ class gi {
|
|
|
3964
3962
|
return;
|
|
3965
3963
|
let o = t, a = e;
|
|
3966
3964
|
if (!r) {
|
|
3967
|
-
const [
|
|
3968
|
-
a = [
|
|
3965
|
+
const [l] = a;
|
|
3966
|
+
a = [l, l];
|
|
3969
3967
|
}
|
|
3970
3968
|
if (!s) {
|
|
3971
|
-
const [
|
|
3972
|
-
o = [
|
|
3969
|
+
const [l] = o;
|
|
3970
|
+
o = [l, l];
|
|
3973
3971
|
}
|
|
3974
3972
|
if (JSON.stringify(this.ctx.autofill.xArr) !== JSON.stringify(o) || JSON.stringify(this.ctx.autofill.yArr) !== JSON.stringify(a)) {
|
|
3975
3973
|
const {
|
|
3976
|
-
SELECTOR_AREA_MIN_X:
|
|
3974
|
+
SELECTOR_AREA_MIN_X: l,
|
|
3977
3975
|
SELECTOR_AREA_MAX_X: c,
|
|
3978
3976
|
SELECTOR_AREA_MIN_Y: f,
|
|
3979
3977
|
SELECTOR_AREA_MAX_Y: d,
|
|
3980
3978
|
SELECTOR_AREA_MAX_X_OFFSET: x,
|
|
3981
3979
|
SELECTOR_AREA_MAX_Y_OFFSET: u
|
|
3982
|
-
} = this.ctx.config, g =
|
|
3980
|
+
} = this.ctx.config, g = l, w = c || this.ctx.maxColIndex - x, p = f, y = d || this.ctx.maxRowIndex - u;
|
|
3983
3981
|
let [b, m] = o, [E, C] = a;
|
|
3984
3982
|
if (b < g || E < p)
|
|
3985
3983
|
return;
|
|
@@ -3996,11 +3994,11 @@ class gi {
|
|
|
3996
3994
|
const u = d + e.yArr[0], g = x + e.xArr[0];
|
|
3997
3995
|
i.set(`${u}-${g}`, !0);
|
|
3998
3996
|
}
|
|
3999
|
-
const { value: s } = e, r = s[0].length, o = s.length, a = this.ctx.autofill.xArr,
|
|
3997
|
+
const { value: s } = e, r = s[0].length, o = s.length, a = this.ctx.autofill.xArr, l = this.ctx.autofill.yArr;
|
|
4000
3998
|
let c = [];
|
|
4001
|
-
for (let d = 0; d <=
|
|
3999
|
+
for (let d = 0; d <= l[1] - l[0]; d++)
|
|
4002
4000
|
for (let x = 0; x <= a[1] - a[0]; x++) {
|
|
4003
|
-
const u = x + a[0], g = d +
|
|
4001
|
+
const u = x + a[0], g = d + l[0], w = s[d % o][x % r], p = this.ctx.database.getItemValueForRowIndexAndColIndex(g, u), y = `${g}-${u}`;
|
|
4004
4002
|
if (p && !i.has(y)) {
|
|
4005
4003
|
const { rowKey: b, key: m } = p;
|
|
4006
4004
|
this.ctx.database.getReadonly(b, m) || (t.add(b), c.push({
|
|
@@ -4052,7 +4050,7 @@ function at(n, t) {
|
|
|
4052
4050
|
function q(n) {
|
|
4053
4051
|
return n.split("-")[0];
|
|
4054
4052
|
}
|
|
4055
|
-
function
|
|
4053
|
+
function ht(n) {
|
|
4056
4054
|
return n.split("-")[1];
|
|
4057
4055
|
}
|
|
4058
4056
|
function re(n) {
|
|
@@ -4069,7 +4067,7 @@ function Mt(n) {
|
|
|
4069
4067
|
}
|
|
4070
4068
|
function yi(n, t, e) {
|
|
4071
4069
|
e === void 0 && (e = !1);
|
|
4072
|
-
const i =
|
|
4070
|
+
const i = ht(n), s = Mt(n), r = Lt(s);
|
|
4073
4071
|
let o = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
|
|
4074
4072
|
return t.reference[r] > t.floating[r] && (o = xt(o)), [o, xt(o)];
|
|
4075
4073
|
}
|
|
@@ -4094,7 +4092,7 @@ function Ei(n, t, e) {
|
|
|
4094
4092
|
}
|
|
4095
4093
|
}
|
|
4096
4094
|
function bi(n, t, e, i) {
|
|
4097
|
-
const s =
|
|
4095
|
+
const s = ht(n);
|
|
4098
4096
|
let r = Ei(q(n), e === "start", i);
|
|
4099
4097
|
return s && (r = r.map((o) => o + "-" + s), t && (r = r.concat(r.map(Ot)))), r;
|
|
4100
4098
|
}
|
|
@@ -4141,9 +4139,9 @@ function Vt(n, t, e) {
|
|
|
4141
4139
|
reference: i,
|
|
4142
4140
|
floating: s
|
|
4143
4141
|
} = n;
|
|
4144
|
-
const r = J(t), o = Mt(t), a = Lt(o),
|
|
4142
|
+
const r = J(t), o = Mt(t), a = Lt(o), l = 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;
|
|
4145
4143
|
let u;
|
|
4146
|
-
switch (
|
|
4144
|
+
switch (l) {
|
|
4147
4145
|
case "top":
|
|
4148
4146
|
u = {
|
|
4149
4147
|
x: f,
|
|
@@ -4174,7 +4172,7 @@ function Vt(n, t, e) {
|
|
|
4174
4172
|
y: i.y
|
|
4175
4173
|
};
|
|
4176
4174
|
}
|
|
4177
|
-
switch (
|
|
4175
|
+
switch (ht(t)) {
|
|
4178
4176
|
case "start":
|
|
4179
4177
|
u[o] -= x * (e && c ? -1 : 1);
|
|
4180
4178
|
break;
|
|
@@ -4190,7 +4188,7 @@ const vi = async (n, t, e) => {
|
|
|
4190
4188
|
strategy: s = "absolute",
|
|
4191
4189
|
middleware: r = [],
|
|
4192
4190
|
platform: o
|
|
4193
|
-
} = e, a = r.filter(Boolean),
|
|
4191
|
+
} = e, a = r.filter(Boolean), l = await (o.isRTL == null ? void 0 : o.isRTL(t));
|
|
4194
4192
|
let c = await o.getElementRects({
|
|
4195
4193
|
reference: n,
|
|
4196
4194
|
floating: t,
|
|
@@ -4198,7 +4196,7 @@ const vi = async (n, t, e) => {
|
|
|
4198
4196
|
}), {
|
|
4199
4197
|
x: f,
|
|
4200
4198
|
y: d
|
|
4201
|
-
} = Vt(c, i,
|
|
4199
|
+
} = Vt(c, i, l), x = i, u = {}, g = 0;
|
|
4202
4200
|
for (let w = 0; w < a.length; w++) {
|
|
4203
4201
|
const {
|
|
4204
4202
|
name: p,
|
|
@@ -4235,7 +4233,7 @@ const vi = async (n, t, e) => {
|
|
|
4235
4233
|
}) : C.rects), {
|
|
4236
4234
|
x: f,
|
|
4237
4235
|
y: d
|
|
4238
|
-
} = Vt(c, x,
|
|
4236
|
+
} = Vt(c, x, l)), w = -1);
|
|
4239
4237
|
}
|
|
4240
4238
|
return {
|
|
4241
4239
|
x: f,
|
|
@@ -4254,7 +4252,7 @@ async function ne(n, t) {
|
|
|
4254
4252
|
platform: r,
|
|
4255
4253
|
rects: o,
|
|
4256
4254
|
elements: a,
|
|
4257
|
-
strategy:
|
|
4255
|
+
strategy: l
|
|
4258
4256
|
} = n, {
|
|
4259
4257
|
boundary: c = "clippingAncestors",
|
|
4260
4258
|
rootBoundary: f = "viewport",
|
|
@@ -4265,7 +4263,7 @@ async function ne(n, t) {
|
|
|
4265
4263
|
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)),
|
|
4266
4264
|
boundary: c,
|
|
4267
4265
|
rootBoundary: f,
|
|
4268
|
-
strategy:
|
|
4266
|
+
strategy: l
|
|
4269
4267
|
})), b = d === "floating" ? {
|
|
4270
4268
|
x: i,
|
|
4271
4269
|
y: s,
|
|
@@ -4281,7 +4279,7 @@ async function ne(n, t) {
|
|
|
4281
4279
|
elements: a,
|
|
4282
4280
|
rect: b,
|
|
4283
4281
|
offsetParent: m,
|
|
4284
|
-
strategy:
|
|
4282
|
+
strategy: l
|
|
4285
4283
|
}) : b);
|
|
4286
4284
|
return {
|
|
4287
4285
|
top: (y.top - C.top + g.top) / E.y,
|
|
@@ -4301,7 +4299,7 @@ const Ri = (n) => ({
|
|
|
4301
4299
|
rects: r,
|
|
4302
4300
|
platform: o,
|
|
4303
4301
|
elements: a,
|
|
4304
|
-
middlewareData:
|
|
4302
|
+
middlewareData: l
|
|
4305
4303
|
} = t, {
|
|
4306
4304
|
element: c,
|
|
4307
4305
|
padding: f = 0
|
|
@@ -4312,9 +4310,9 @@ const Ri = (n) => ({
|
|
|
4312
4310
|
x: e,
|
|
4313
4311
|
y: i
|
|
4314
4312
|
}, 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));
|
|
4315
|
-
let
|
|
4316
|
-
(!
|
|
4317
|
-
const A = E / 2 - C / 2, L =
|
|
4313
|
+
let S = R ? R[m] : 0;
|
|
4314
|
+
(!S || !await (o.isElement == null ? void 0 : o.isElement(R))) && (S = a.floating[m] || r.floating[g]);
|
|
4315
|
+
const A = E / 2 - C / 2, L = S / 2 - w[g] / 2 - 1, D = rt(d[y], L), B = rt(d[b], L), I = D, T = S - w[g] - B, O = S / 2 - w[g] / 2 + A, G = It(I, O, T), Y = !l.arrow && ht(s) != null && O !== G && r.reference[g] / 2 - (O < I ? D : B) - w[g] / 2 < 0, k = Y ? O < I ? O - I : O - T : 0;
|
|
4318
4316
|
return {
|
|
4319
4317
|
[u]: x[u] + k,
|
|
4320
4318
|
data: {
|
|
@@ -4338,7 +4336,7 @@ const Ri = (n) => ({
|
|
|
4338
4336
|
middlewareData: r,
|
|
4339
4337
|
rects: o,
|
|
4340
4338
|
initialPlacement: a,
|
|
4341
|
-
platform:
|
|
4339
|
+
platform: l,
|
|
4342
4340
|
elements: c
|
|
4343
4341
|
} = t, {
|
|
4344
4342
|
mainAxis: f = !0,
|
|
@@ -4351,9 +4349,9 @@ const Ri = (n) => ({
|
|
|
4351
4349
|
} = at(n, t);
|
|
4352
4350
|
if ((e = r.arrow) != null && e.alignmentOffset)
|
|
4353
4351
|
return {};
|
|
4354
|
-
const y = q(s), b = J(a), m = q(a) === a, E = await (
|
|
4352
|
+
const y = q(s), b = J(a), m = q(a) === a, E = await (l.isRTL == null ? void 0 : l.isRTL(c.floating)), C = x || (m || !w ? [xt(a)] : mi(a)), R = g !== "none";
|
|
4355
4353
|
!x && R && C.push(...bi(a, w, g, E));
|
|
4356
|
-
const
|
|
4354
|
+
const S = [a, ...C], A = await ne(t, p), L = [];
|
|
4357
4355
|
let D = ((i = r.flip) == null ? void 0 : i.overflows) || [];
|
|
4358
4356
|
if (f && L.push(A[y]), d) {
|
|
4359
4357
|
const O = yi(s, o, E);
|
|
@@ -4364,7 +4362,7 @@ const Ri = (n) => ({
|
|
|
4364
4362
|
overflows: L
|
|
4365
4363
|
}], !L.every((O) => O <= 0)) {
|
|
4366
4364
|
var B, I;
|
|
4367
|
-
const O = (((B = r.flip) == null ? void 0 : B.index) || 0) + 1, G =
|
|
4365
|
+
const O = (((B = r.flip) == null ? void 0 : B.index) || 0) + 1, G = S[O];
|
|
4368
4366
|
if (G)
|
|
4369
4367
|
return {
|
|
4370
4368
|
data: {
|
|
@@ -4379,8 +4377,8 @@ const Ri = (n) => ({
|
|
|
4379
4377
|
if (!Y)
|
|
4380
4378
|
switch (u) {
|
|
4381
4379
|
case "bestFit": {
|
|
4382
|
-
var
|
|
4383
|
-
const k = (
|
|
4380
|
+
var T;
|
|
4381
|
+
const k = (T = D.filter((W) => {
|
|
4384
4382
|
if (R) {
|
|
4385
4383
|
const P = J(W.placement);
|
|
4386
4384
|
return P === b || // Create a bias to the `y` side axis due to horizontal
|
|
@@ -4388,7 +4386,7 @@ const Ri = (n) => ({
|
|
|
4388
4386
|
P === "y";
|
|
4389
4387
|
}
|
|
4390
4388
|
return !0;
|
|
4391
|
-
}).map((W) => [W.placement, W.overflows.filter((P) => P > 0).reduce((P, ye) => P + ye, 0)]).sort((W, P) => W[1] - P[1])[0]) == null ? void 0 :
|
|
4389
|
+
}).map((W) => [W.placement, W.overflows.filter((P) => P > 0).reduce((P, ye) => P + ye, 0)]).sort((W, P) => W[1] - P[1])[0]) == null ? void 0 : T[0];
|
|
4392
4390
|
k && (Y = k);
|
|
4393
4391
|
break;
|
|
4394
4392
|
}
|
|
@@ -4412,7 +4410,7 @@ async function Ii(n, t) {
|
|
|
4412
4410
|
placement: e,
|
|
4413
4411
|
platform: i,
|
|
4414
4412
|
elements: s
|
|
4415
|
-
} = n, r = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), o = q(e), a =
|
|
4413
|
+
} = n, r = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), o = q(e), a = ht(e), l = J(e) === "y", c = ["left", "top"].includes(o) ? -1 : 1, f = r && l ? -1 : 1, d = at(t, n);
|
|
4416
4414
|
let {
|
|
4417
4415
|
mainAxis: x,
|
|
4418
4416
|
crossAxis: u,
|
|
@@ -4426,7 +4424,7 @@ async function Ii(n, t) {
|
|
|
4426
4424
|
crossAxis: d.crossAxis || 0,
|
|
4427
4425
|
alignmentAxis: d.alignmentAxis
|
|
4428
4426
|
};
|
|
4429
|
-
return a && typeof g == "number" && (u = a === "end" ? g * -1 : g),
|
|
4427
|
+
return a && typeof g == "number" && (u = a === "end" ? g * -1 : g), l ? {
|
|
4430
4428
|
x: u * f,
|
|
4431
4429
|
y: x * c
|
|
4432
4430
|
} : {
|
|
@@ -4445,18 +4443,18 @@ const Oi = function(n) {
|
|
|
4445
4443
|
y: r,
|
|
4446
4444
|
placement: o,
|
|
4447
4445
|
middlewareData: a
|
|
4448
|
-
} = t,
|
|
4446
|
+
} = t, l = await Ii(t, n);
|
|
4449
4447
|
return o === ((e = a.offset) == null ? void 0 : e.placement) && (i = a.arrow) != null && i.alignmentOffset ? {} : {
|
|
4450
|
-
x: s +
|
|
4451
|
-
y: r +
|
|
4448
|
+
x: s + l.x,
|
|
4449
|
+
y: r + l.y,
|
|
4452
4450
|
data: {
|
|
4453
|
-
...
|
|
4451
|
+
...l,
|
|
4454
4452
|
placement: o
|
|
4455
4453
|
}
|
|
4456
4454
|
};
|
|
4457
4455
|
}
|
|
4458
4456
|
};
|
|
4459
|
-
},
|
|
4457
|
+
}, Si = function(n) {
|
|
4460
4458
|
return n === void 0 && (n = {}), {
|
|
4461
4459
|
name: "shift",
|
|
4462
4460
|
options: n,
|
|
@@ -4480,11 +4478,11 @@ const Oi = function(n) {
|
|
|
4480
4478
|
};
|
|
4481
4479
|
}
|
|
4482
4480
|
},
|
|
4483
|
-
...
|
|
4481
|
+
...l
|
|
4484
4482
|
} = at(n, t), c = {
|
|
4485
4483
|
x: e,
|
|
4486
4484
|
y: i
|
|
4487
|
-
}, f = await ne(t,
|
|
4485
|
+
}, f = await ne(t, l), d = J(q(s)), x = re(d);
|
|
4488
4486
|
let u = c[x], g = c[d];
|
|
4489
4487
|
if (r) {
|
|
4490
4488
|
const p = x === "y" ? "top" : "left", y = x === "y" ? "bottom" : "right", b = u + f[p], m = u - f[y];
|
|
@@ -4539,7 +4537,7 @@ function N(n) {
|
|
|
4539
4537
|
function zt(n) {
|
|
4540
4538
|
return !gt() || typeof ShadowRoot > "u" ? !1 : n instanceof ShadowRoot || n instanceof H(n).ShadowRoot;
|
|
4541
4539
|
}
|
|
4542
|
-
function
|
|
4540
|
+
function lt(n) {
|
|
4543
4541
|
const {
|
|
4544
4542
|
overflow: t,
|
|
4545
4543
|
overflowX: e,
|
|
@@ -4548,7 +4546,7 @@ function ht(n) {
|
|
|
4548
4546
|
} = F(n);
|
|
4549
4547
|
return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !["inline", "contents"].includes(s);
|
|
4550
4548
|
}
|
|
4551
|
-
function
|
|
4549
|
+
function Ti(n) {
|
|
4552
4550
|
return ["table", "td", "th"].includes(tt(n));
|
|
4553
4551
|
}
|
|
4554
4552
|
function wt(n) {
|
|
@@ -4605,24 +4603,24 @@ function z(n) {
|
|
|
4605
4603
|
);
|
|
4606
4604
|
return zt(t) ? t.host : t;
|
|
4607
4605
|
}
|
|
4608
|
-
function
|
|
4606
|
+
function he(n) {
|
|
4609
4607
|
const t = z(n);
|
|
4610
|
-
return Q(t) ? n.ownerDocument ? n.ownerDocument.body : n.body : N(t) &&
|
|
4608
|
+
return Q(t) ? n.ownerDocument ? n.ownerDocument.body : n.body : N(t) && lt(t) ? t : he(t);
|
|
4611
4609
|
}
|
|
4612
|
-
function
|
|
4610
|
+
function St(n, t, e) {
|
|
4613
4611
|
var i;
|
|
4614
4612
|
t === void 0 && (t = []), e === void 0 && (e = !0);
|
|
4615
|
-
const s =
|
|
4613
|
+
const s = he(n), r = s === ((i = n.ownerDocument) == null ? void 0 : i.body), o = H(s);
|
|
4616
4614
|
if (r) {
|
|
4617
|
-
const a =
|
|
4618
|
-
return t.concat(o, o.visualViewport || [],
|
|
4615
|
+
const a = Tt(o);
|
|
4616
|
+
return t.concat(o, o.visualViewport || [], lt(s) ? s : [], a && e ? St(a) : []);
|
|
4619
4617
|
}
|
|
4620
|
-
return t.concat(s,
|
|
4618
|
+
return t.concat(s, St(s, [], e));
|
|
4621
4619
|
}
|
|
4622
|
-
function
|
|
4620
|
+
function Tt(n) {
|
|
4623
4621
|
return n.parent && Object.getPrototypeOf(n.parent) ? n.frameElement : null;
|
|
4624
4622
|
}
|
|
4625
|
-
function
|
|
4623
|
+
function le(n) {
|
|
4626
4624
|
const t = F(n);
|
|
4627
4625
|
let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
|
|
4628
4626
|
const s = N(n), r = s ? n.offsetWidth : e, o = s ? n.offsetHeight : i, a = ft(e) !== r || ft(i) !== o;
|
|
@@ -4643,7 +4641,7 @@ function Z(n) {
|
|
|
4643
4641
|
width: i,
|
|
4644
4642
|
height: s,
|
|
4645
4643
|
$: r
|
|
4646
|
-
} =
|
|
4644
|
+
} = le(t);
|
|
4647
4645
|
let o = (r ? ft(e.width) : e.width) / i, a = (r ? ft(e.height) : e.height) / s;
|
|
4648
4646
|
return (!o || !Number.isFinite(o)) && (o = 1), (!a || !Number.isFinite(a)) && (a = 1), {
|
|
4649
4647
|
x: o,
|
|
@@ -4667,19 +4665,19 @@ function ot(n, t, e, i) {
|
|
|
4667
4665
|
let o = V(1);
|
|
4668
4666
|
t && (i ? X(i) && (o = Z(i)) : o = Z(n));
|
|
4669
4667
|
const a = Mi(r, e, i) ? de(r) : V(0);
|
|
4670
|
-
let
|
|
4668
|
+
let l = (s.left + a.x) / o.x, c = (s.top + a.y) / o.y, f = s.width / o.x, d = s.height / o.y;
|
|
4671
4669
|
if (r) {
|
|
4672
4670
|
const x = H(r), u = i && X(i) ? H(i) : i;
|
|
4673
|
-
let g = x, w =
|
|
4671
|
+
let g = x, w = Tt(g);
|
|
4674
4672
|
for (; w && i && u !== g; ) {
|
|
4675
4673
|
const p = Z(w), y = w.getBoundingClientRect(), b = F(w), m = y.left + (w.clientLeft + parseFloat(b.paddingLeft)) * p.x, E = y.top + (w.clientTop + parseFloat(b.paddingTop)) * p.y;
|
|
4676
|
-
|
|
4674
|
+
l *= p.x, c *= p.y, f *= p.x, d *= p.y, l += m, c += E, g = H(w), w = Tt(g);
|
|
4677
4675
|
}
|
|
4678
4676
|
}
|
|
4679
4677
|
return ut({
|
|
4680
4678
|
width: f,
|
|
4681
4679
|
height: d,
|
|
4682
|
-
x:
|
|
4680
|
+
x: l,
|
|
4683
4681
|
y: c
|
|
4684
4682
|
});
|
|
4685
4683
|
}
|
|
@@ -4693,20 +4691,20 @@ function Hi(n) {
|
|
|
4693
4691
|
const r = s === "fixed", o = K(i), a = t ? wt(t.floating) : !1;
|
|
4694
4692
|
if (i === o || a && r)
|
|
4695
4693
|
return e;
|
|
4696
|
-
let
|
|
4694
|
+
let l = {
|
|
4697
4695
|
scrollLeft: 0,
|
|
4698
4696
|
scrollTop: 0
|
|
4699
4697
|
}, c = V(1);
|
|
4700
4698
|
const f = V(0), d = N(i);
|
|
4701
|
-
if ((d || !d && !r) && ((tt(i) !== "body" ||
|
|
4699
|
+
if ((d || !d && !r) && ((tt(i) !== "body" || lt(o)) && (l = pt(i)), N(i))) {
|
|
4702
4700
|
const x = ot(i);
|
|
4703
4701
|
c = Z(i), f.x = x.x + i.clientLeft, f.y = x.y + i.clientTop;
|
|
4704
4702
|
}
|
|
4705
4703
|
return {
|
|
4706
4704
|
width: e.width * c.x,
|
|
4707
4705
|
height: e.height * c.y,
|
|
4708
|
-
x: e.x * c.x -
|
|
4709
|
-
y: e.y * c.y -
|
|
4706
|
+
x: e.x * c.x - l.scrollLeft * c.x + f.x,
|
|
4707
|
+
y: e.y * c.y - l.scrollTop * c.y + f.y
|
|
4710
4708
|
};
|
|
4711
4709
|
}
|
|
4712
4710
|
function Di(n) {
|
|
@@ -4729,25 +4727,25 @@ function Xi(n) {
|
|
|
4729
4727
|
}
|
|
4730
4728
|
function Fi(n, t) {
|
|
4731
4729
|
const e = H(n), i = K(n), s = e.visualViewport;
|
|
4732
|
-
let r = i.clientWidth, o = i.clientHeight, a = 0,
|
|
4730
|
+
let r = i.clientWidth, o = i.clientHeight, a = 0, l = 0;
|
|
4733
4731
|
if (s) {
|
|
4734
4732
|
r = s.width, o = s.height;
|
|
4735
4733
|
const c = Dt();
|
|
4736
|
-
(!c || c && t === "fixed") && (a = s.offsetLeft,
|
|
4734
|
+
(!c || c && t === "fixed") && (a = s.offsetLeft, l = s.offsetTop);
|
|
4737
4735
|
}
|
|
4738
4736
|
return {
|
|
4739
4737
|
width: r,
|
|
4740
4738
|
height: o,
|
|
4741
4739
|
x: a,
|
|
4742
|
-
y:
|
|
4740
|
+
y: l
|
|
4743
4741
|
};
|
|
4744
4742
|
}
|
|
4745
4743
|
function ki(n, t) {
|
|
4746
|
-
const e = ot(n, !0, t === "fixed"), i = e.top + n.clientTop, s = e.left + n.clientLeft, r = N(n) ? Z(n) : V(1), o = n.clientWidth * r.x, a = n.clientHeight * r.y,
|
|
4744
|
+
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, l = s * r.x, c = i * r.y;
|
|
4747
4745
|
return {
|
|
4748
4746
|
width: o,
|
|
4749
4747
|
height: a,
|
|
4750
|
-
x:
|
|
4748
|
+
x: l,
|
|
4751
4749
|
y: c
|
|
4752
4750
|
};
|
|
4753
4751
|
}
|
|
@@ -4777,12 +4775,12 @@ function Ni(n, t) {
|
|
|
4777
4775
|
const e = t.get(n);
|
|
4778
4776
|
if (e)
|
|
4779
4777
|
return e;
|
|
4780
|
-
let i =
|
|
4778
|
+
let i = St(n, [], !1).filter((a) => X(a) && tt(a) !== "body"), s = null;
|
|
4781
4779
|
const r = F(n).position === "fixed";
|
|
4782
4780
|
let o = r ? z(n) : n;
|
|
4783
4781
|
for (; X(o) && !Q(o); ) {
|
|
4784
|
-
const a = F(o),
|
|
4785
|
-
!
|
|
4782
|
+
const a = F(o), l = Ht(o);
|
|
4783
|
+
!l && a.position === "fixed" && (s = null), (r ? !l && !s : !l && a.position === "static" && !!s && ["absolute", "fixed"].includes(s.position) || lt(o) && !l && fe(n, o)) ? i = i.filter((f) => f !== o) : s = a, o = z(o);
|
|
4786
4784
|
}
|
|
4787
4785
|
return t.set(n, i), i;
|
|
4788
4786
|
}
|
|
@@ -4793,22 +4791,22 @@ function Yi(n) {
|
|
|
4793
4791
|
rootBoundary: i,
|
|
4794
4792
|
strategy: s
|
|
4795
4793
|
} = n;
|
|
4796
|
-
const o = [...e === "clippingAncestors" ? wt(t) ? [] : Ni(t, this._c) : [].concat(e), i], a = o[0],
|
|
4794
|
+
const o = [...e === "clippingAncestors" ? wt(t) ? [] : Ni(t, this._c) : [].concat(e), i], a = o[0], l = o.reduce((c, f) => {
|
|
4797
4795
|
const d = $t(t, f, s);
|
|
4798
4796
|
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;
|
|
4799
4797
|
}, $t(t, a, s));
|
|
4800
4798
|
return {
|
|
4801
|
-
width:
|
|
4802
|
-
height:
|
|
4803
|
-
x:
|
|
4804
|
-
y:
|
|
4799
|
+
width: l.right - l.left,
|
|
4800
|
+
height: l.bottom - l.top,
|
|
4801
|
+
x: l.left,
|
|
4802
|
+
y: l.top
|
|
4805
4803
|
};
|
|
4806
4804
|
}
|
|
4807
4805
|
function Ki(n) {
|
|
4808
4806
|
const {
|
|
4809
4807
|
width: t,
|
|
4810
4808
|
height: e
|
|
4811
|
-
} =
|
|
4809
|
+
} = le(n);
|
|
4812
4810
|
return {
|
|
4813
4811
|
width: t,
|
|
4814
4812
|
height: e
|
|
@@ -4820,19 +4818,19 @@ function Bi(n, t, e) {
|
|
|
4820
4818
|
scrollLeft: 0,
|
|
4821
4819
|
scrollTop: 0
|
|
4822
4820
|
};
|
|
4823
|
-
const
|
|
4821
|
+
const l = V(0);
|
|
4824
4822
|
if (i || !i && !r)
|
|
4825
|
-
if ((tt(t) !== "body" ||
|
|
4823
|
+
if ((tt(t) !== "body" || lt(s)) && (a = pt(t)), i) {
|
|
4826
4824
|
const u = ot(t, !0, r, t);
|
|
4827
|
-
|
|
4828
|
-
} else s && (
|
|
4825
|
+
l.x = u.x + t.clientLeft, l.y = u.y + t.clientTop;
|
|
4826
|
+
} else s && (l.x = At(s));
|
|
4829
4827
|
let c = 0, f = 0;
|
|
4830
4828
|
if (s && !i && !r) {
|
|
4831
4829
|
const u = s.getBoundingClientRect();
|
|
4832
4830
|
f = u.top + a.scrollTop, c = u.left + a.scrollLeft - // RTL <body> scrollbar.
|
|
4833
4831
|
At(s, u);
|
|
4834
4832
|
}
|
|
4835
|
-
const d = o.left + a.scrollLeft -
|
|
4833
|
+
const d = o.left + a.scrollLeft - l.x - c, x = o.top + a.scrollTop - l.y - f;
|
|
4836
4834
|
return {
|
|
4837
4835
|
x: d,
|
|
4838
4836
|
y: x,
|
|
@@ -4865,7 +4863,7 @@ function xe(n, t) {
|
|
|
4865
4863
|
return e;
|
|
4866
4864
|
}
|
|
4867
4865
|
let i = qt(n, t);
|
|
4868
|
-
for (; i &&
|
|
4866
|
+
for (; i && Ti(i) && mt(i); )
|
|
4869
4867
|
i = qt(i, t);
|
|
4870
4868
|
return i && Q(i) && mt(i) && !Ht(i) ? e : i || Ai(n) || e;
|
|
4871
4869
|
}
|
|
@@ -4895,7 +4893,7 @@ const Vi = {
|
|
|
4895
4893
|
getScale: Z,
|
|
4896
4894
|
isElement: X,
|
|
4897
4895
|
isRTL: Pi
|
|
4898
|
-
}, ue = Oi, ge =
|
|
4896
|
+
}, ue = Oi, ge = Si, we = _i, zi = Ri, pe = (n, t, e) => {
|
|
4899
4897
|
const i = /* @__PURE__ */ new Map(), s = {
|
|
4900
4898
|
platform: Vi,
|
|
4901
4899
|
...e
|
|
@@ -4910,11 +4908,11 @@ const Vi = {
|
|
|
4910
4908
|
};
|
|
4911
4909
|
let $i = class {
|
|
4912
4910
|
constructor(t) {
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4911
|
+
h(this, "ctx");
|
|
4912
|
+
h(this, "enable", !1);
|
|
4913
|
+
h(this, "contentEl");
|
|
4914
|
+
h(this, "floatingEl");
|
|
4915
|
+
h(this, "arrowEl");
|
|
4918
4916
|
this.ctx = t;
|
|
4919
4917
|
const { TOOLTIP_BG_COLOR: e, TOOLTIP_TEXT_COLOR: i, TOOLTIP_ZINDEX: s, TOOLTIP_CUSTOM_STYLE: r, CSS_PREFIX: o } = this.ctx.config;
|
|
4920
4918
|
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`;
|
|
@@ -4929,7 +4927,7 @@ let $i = class {
|
|
|
4929
4927
|
borderRadius: "4px",
|
|
4930
4928
|
fontSize: "12px",
|
|
4931
4929
|
...r
|
|
4932
|
-
},
|
|
4930
|
+
}, l = {
|
|
4933
4931
|
position: "absolute",
|
|
4934
4932
|
width: "10px",
|
|
4935
4933
|
height: "10px",
|
|
@@ -4938,7 +4936,7 @@ let $i = class {
|
|
|
4938
4936
|
transform: "rotate(45deg)",
|
|
4939
4937
|
zIndex: a.zIndex
|
|
4940
4938
|
};
|
|
4941
|
-
Object.assign(this.arrowEl.style,
|
|
4939
|
+
Object.assign(this.arrowEl.style, l), Object.assign(this.floatingEl.style, a), this.floatingEl.appendChild(this.contentEl), this.floatingEl.appendChild(this.arrowEl), this.ctx.containerElement.appendChild(this.floatingEl), this.init();
|
|
4942
4940
|
}
|
|
4943
4941
|
init() {
|
|
4944
4942
|
this.ctx.on("mousemove", (t) => {
|
|
@@ -4982,10 +4980,10 @@ let $i = class {
|
|
|
4982
4980
|
placement: t.overflowTooltipPlacement,
|
|
4983
4981
|
middleware: [ge(), we(), ue(6), zi({ element: this.arrowEl })]
|
|
4984
4982
|
}).then((a) => {
|
|
4985
|
-
const { x:
|
|
4983
|
+
const { x: l, y: c, placement: f, middlewareData: d } = a;
|
|
4986
4984
|
if (Object.assign(this.floatingEl.style, {
|
|
4987
4985
|
top: `${c}px`,
|
|
4988
|
-
left: `${
|
|
4986
|
+
left: `${l}px`
|
|
4989
4987
|
}), d.arrow) {
|
|
4990
4988
|
const x = d.arrow;
|
|
4991
4989
|
["left", "left-start", "left-end"].includes(f) ? Object.assign(this.arrowEl.style, {
|
|
@@ -5021,13 +5019,13 @@ let $i = class {
|
|
|
5021
5019
|
};
|
|
5022
5020
|
class qi {
|
|
5023
5021
|
constructor(t) {
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5022
|
+
h(this, "editorEl");
|
|
5023
|
+
h(this, "inputEl");
|
|
5024
|
+
h(this, "enable", !1);
|
|
5025
|
+
h(this, "cellTarget", null);
|
|
5026
|
+
h(this, "ctx");
|
|
5027
|
+
h(this, "drawY", 0);
|
|
5028
|
+
h(this, "drawX", 0);
|
|
5031
5029
|
this.ctx = t, this.initTextEditor(), this.init();
|
|
5032
5030
|
}
|
|
5033
5031
|
init() {
|
|
@@ -5111,12 +5109,12 @@ class qi {
|
|
|
5111
5109
|
this.drawX = r, this.drawY = o;
|
|
5112
5110
|
let { height: a } = t;
|
|
5113
5111
|
const {
|
|
5114
|
-
config: { CELL_PADDING:
|
|
5112
|
+
config: { CELL_PADDING: l },
|
|
5115
5113
|
header: c
|
|
5116
5114
|
} = this.ctx;
|
|
5117
5115
|
let f = this.ctx.body.visibleHeight;
|
|
5118
5116
|
if (a > f && (a = f), this.editorEl.style.left = `${r}px`, this.editorEl.style.top = `${o}px`, this.editorEl.style.bottom = "auto", this.editorEl.style.maxHeight = `${f}px`, s === "text") {
|
|
5119
|
-
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 = `${
|
|
5117
|
+
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 = `${l}px`, e !== null && (this.inputEl.value = e), this.inputEl.focus();
|
|
5120
5118
|
const d = this.inputEl.value.length;
|
|
5121
5119
|
this.inputEl.setSelectionRange(d, d);
|
|
5122
5120
|
} else
|
|
@@ -5150,8 +5148,8 @@ class qi {
|
|
|
5150
5148
|
const r = this.ctx.focusCell;
|
|
5151
5149
|
if (!r || ["index", "index-selection", "selection"].includes(r.type) || this.enable)
|
|
5152
5150
|
return;
|
|
5153
|
-
const { rowKey: o, key: a } = r,
|
|
5154
|
-
r && !
|
|
5151
|
+
const { rowKey: o, key: a } = r, l = this.ctx.database.getReadonly(o, a);
|
|
5152
|
+
r && !l && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = r, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
5155
5153
|
}
|
|
5156
5154
|
doneEdit() {
|
|
5157
5155
|
this.enable && this.cellTarget && (this.doneEditByInput(), this.ctx.emit("doneEdit", this.cellTarget), this.enable = !1, this.ctx.stageElement.focus(), this.ctx.editing = !1, this.cellTarget = null, this.ctx.emit("draw"));
|
|
@@ -5163,14 +5161,14 @@ class qi {
|
|
|
5163
5161
|
}
|
|
5164
5162
|
class Gi {
|
|
5165
5163
|
constructor(t) {
|
|
5166
|
-
|
|
5167
|
-
|
|
5164
|
+
h(this, "ctx");
|
|
5165
|
+
h(this, "emptyEl");
|
|
5168
5166
|
this.ctx = t;
|
|
5169
5167
|
const { EMPTY_TEXT: e, EMPTY_CUSTOM: i, EMPTY_CUSTOM_STYLE: s, CSS_PREFIX: r } = this.ctx.config;
|
|
5170
|
-
this.emptyEl = document.createElement("div"), this.emptyEl.className = `${r}-empty`, this.emptyEl.style.display = "none", this.emptyEl.innerText = e, this.ctx.containerElement.appendChild(this.emptyEl), this.ctx.on("emptyChange", ({ type: o, headerHeight: a, bodyHeight:
|
|
5168
|
+
this.emptyEl = document.createElement("div"), this.emptyEl.className = `${r}-empty`, this.emptyEl.style.display = "none", this.emptyEl.innerText = e, this.ctx.containerElement.appendChild(this.emptyEl), this.ctx.on("emptyChange", ({ type: o, headerHeight: a, bodyHeight: l, footerHeight: c }) => {
|
|
5171
5169
|
if (i)
|
|
5172
5170
|
return;
|
|
5173
|
-
const f = a + (
|
|
5171
|
+
const f = a + (l + c) / 2, d = {
|
|
5174
5172
|
display: o === "empty" ? "block" : "none",
|
|
5175
5173
|
position: "absolute",
|
|
5176
5174
|
fontSize: "14px",
|
|
@@ -5189,7 +5187,7 @@ class Gi {
|
|
|
5189
5187
|
}
|
|
5190
5188
|
class ji {
|
|
5191
5189
|
constructor(t) {
|
|
5192
|
-
|
|
5190
|
+
h(this, "ctx");
|
|
5193
5191
|
this.ctx = t;
|
|
5194
5192
|
}
|
|
5195
5193
|
draw() {
|
|
@@ -5216,9 +5214,9 @@ class ji {
|
|
|
5216
5214
|
fixedRightWidth: e,
|
|
5217
5215
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
5218
5216
|
} = this.ctx, { visibleWidth: r, visibleHeight: o, renderCellHeaders: a } = this.ctx.header;
|
|
5219
|
-
let
|
|
5217
|
+
let l = [], c = [], f = [];
|
|
5220
5218
|
a.forEach((p) => {
|
|
5221
|
-
p.render && (p.fixed === "left" ? c.push(p) : p.fixed === "right" ? f.push(p) :
|
|
5219
|
+
p.render && (p.fixed === "left" ? c.push(p) : p.fixed === "right" ? f.push(p) : l.push(p));
|
|
5222
5220
|
});
|
|
5223
5221
|
const d = e - i, x = {
|
|
5224
5222
|
key: "left",
|
|
@@ -5241,7 +5239,7 @@ class ji {
|
|
|
5241
5239
|
width: `${r - t - d + 1}px`,
|
|
5242
5240
|
height: `${o}px`
|
|
5243
5241
|
},
|
|
5244
|
-
cells:
|
|
5242
|
+
cells: l
|
|
5245
5243
|
}, g = {
|
|
5246
5244
|
key: "right",
|
|
5247
5245
|
style: {
|
|
@@ -5277,7 +5275,7 @@ class ji {
|
|
|
5277
5275
|
const {
|
|
5278
5276
|
fixedLeftWidth: r,
|
|
5279
5277
|
fixedRightWidth: o,
|
|
5280
|
-
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX:
|
|
5278
|
+
config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX: l }
|
|
5281
5279
|
} = this.ctx, { visibleWidth: c, visibleHeight: f } = this.ctx.body, d = o - a, x = {
|
|
5282
5280
|
key: "left",
|
|
5283
5281
|
style: {
|
|
@@ -5314,7 +5312,7 @@ class ji {
|
|
|
5314
5312
|
};
|
|
5315
5313
|
return {
|
|
5316
5314
|
type: "body",
|
|
5317
|
-
class: `${
|
|
5315
|
+
class: `${l}-overlayer-body`,
|
|
5318
5316
|
style: {
|
|
5319
5317
|
position: "relative",
|
|
5320
5318
|
overflow: "hidden",
|
|
@@ -5335,7 +5333,7 @@ class ji {
|
|
|
5335
5333
|
fixedLeftWidth: s,
|
|
5336
5334
|
fixedRightWidth: r,
|
|
5337
5335
|
config: { SCROLLER_TRACK_SIZE: o, CSS_PREFIX: a }
|
|
5338
|
-
} = this.ctx, { visibleWidth:
|
|
5336
|
+
} = this.ctx, { visibleWidth: l, visibleHeight: c } = this.ctx.footer, f = r - o, d = {
|
|
5339
5337
|
key: "left",
|
|
5340
5338
|
style: {
|
|
5341
5339
|
position: "absolute",
|
|
@@ -5353,7 +5351,7 @@ class ji {
|
|
|
5353
5351
|
top: `${0.5}px`,
|
|
5354
5352
|
left: `${s - 0.5}px`,
|
|
5355
5353
|
overflow: "hidden",
|
|
5356
|
-
width: `${
|
|
5354
|
+
width: `${l - s - f}px`,
|
|
5357
5355
|
height: `${c}px`
|
|
5358
5356
|
},
|
|
5359
5357
|
cells: t
|
|
@@ -5375,7 +5373,7 @@ class ji {
|
|
|
5375
5373
|
style: {
|
|
5376
5374
|
position: "relative",
|
|
5377
5375
|
overflow: "hidden",
|
|
5378
|
-
width: `${
|
|
5376
|
+
width: `${l}px`,
|
|
5379
5377
|
height: `${c}px`
|
|
5380
5378
|
},
|
|
5381
5379
|
views: [d, x, u]
|
|
@@ -5384,16 +5382,16 @@ class ji {
|
|
|
5384
5382
|
}
|
|
5385
5383
|
class Ui {
|
|
5386
5384
|
constructor(t) {
|
|
5387
|
-
|
|
5388
|
-
|
|
5385
|
+
h(this, "ctx");
|
|
5386
|
+
h(this, "contextMenuEl");
|
|
5389
5387
|
this.ctx = t, this.contextMenuEl = document.createElement("div"), this.createContextMenu(), this.init();
|
|
5390
5388
|
}
|
|
5391
5389
|
init() {
|
|
5392
5390
|
this.ctx.on("cellContextMenuClick", (t, e) => {
|
|
5393
5391
|
if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
|
|
5394
5392
|
e.preventDefault();
|
|
5395
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [a,
|
|
5396
|
-
c >= a && c <=
|
|
5393
|
+
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [a, l] = s, { rowIndex: c, colIndex: f } = t;
|
|
5394
|
+
c >= a && c <= l && f >= r && f <= o || this.ctx.emit("setSelectorCell", t, e);
|
|
5397
5395
|
const x = {
|
|
5398
5396
|
getBoundingClientRect: () => ({
|
|
5399
5397
|
width: 0,
|
|
@@ -5467,22 +5465,22 @@ class Ui {
|
|
|
5467
5465
|
}
|
|
5468
5466
|
class Qi {
|
|
5469
5467
|
constructor(t, e) {
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5468
|
+
h(this, "options");
|
|
5469
|
+
h(this, "scroller");
|
|
5470
|
+
h(this, "header");
|
|
5471
|
+
h(this, "body");
|
|
5472
|
+
h(this, "footer");
|
|
5473
|
+
h(this, "selector");
|
|
5474
|
+
h(this, "autofill");
|
|
5475
|
+
h(this, "tooltip");
|
|
5476
|
+
h(this, "editor");
|
|
5477
|
+
h(this, "empty");
|
|
5478
|
+
h(this, "overlayer");
|
|
5479
|
+
h(this, "contextMenu");
|
|
5480
|
+
h(this, "ctx");
|
|
5483
5481
|
this.options = e;
|
|
5484
5482
|
const { overlayerElement: i, editorElement: s } = e, r = this.createContainer(t, i, s);
|
|
5485
|
-
this.ctx = new
|
|
5483
|
+
this.ctx = new li(r, 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", () => {
|
|
5486
5484
|
this.draw();
|
|
5487
5485
|
}), this.ctx.on("drawView", () => {
|
|
5488
5486
|
this.draw(!0);
|
|
@@ -5563,8 +5561,8 @@ class Qi {
|
|
|
5563
5561
|
if (t && Array.isArray(s) && s.length) {
|
|
5564
5562
|
const [r] = s;
|
|
5565
5563
|
if (Array.isArray(r) && r.length) {
|
|
5566
|
-
const [o] = r, { rowKey: a, key:
|
|
5567
|
-
this.scrollToRowkey(a), this.scrollToColkey(
|
|
5564
|
+
const [o] = r, { rowKey: a, key: l } = o;
|
|
5565
|
+
this.scrollToRowkey(a), this.scrollToColkey(l);
|
|
5568
5566
|
}
|
|
5569
5567
|
}
|
|
5570
5568
|
i(s);
|
|
@@ -5589,7 +5587,7 @@ class Qi {
|
|
|
5589
5587
|
let r = [];
|
|
5590
5588
|
for (let o = 0; o < i.length; o++)
|
|
5591
5589
|
for (let a = 0; a < s.length; a++) {
|
|
5592
|
-
const
|
|
5590
|
+
const l = this.ctx.database.getRowKeyByItem(i[o]), f = s[a].key, d = await this.ctx.database.getValidator(l, f);
|
|
5593
5591
|
Array.isArray(d) && d.length && r.push(d);
|
|
5594
5592
|
}
|
|
5595
5593
|
r.length ? (e(r), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
|