e-virt-table 0.0.7 → 0.0.8
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 +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +375 -376
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/Scroller.js +17 -13
- package/dist/lib/Scroller.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -39,8 +39,8 @@ function dt(a, t, e) {
|
|
|
39
39
|
return Ee() ? dt = Reflect.construct.bind() : dt = function(s, r, o) {
|
|
40
40
|
var n = [null];
|
|
41
41
|
n.push.apply(n, r);
|
|
42
|
-
var
|
|
43
|
-
return o && st(
|
|
42
|
+
var l = Function.bind.apply(s, n), h = new l();
|
|
43
|
+
return o && st(h, o.prototype), h;
|
|
44
44
|
}, dt.apply(null, arguments);
|
|
45
45
|
}
|
|
46
46
|
function be(a) {
|
|
@@ -169,9 +169,9 @@ function Oe(a, t, e, i, s) {
|
|
|
169
169
|
return x;
|
|
170
170
|
}), r;
|
|
171
171
|
}
|
|
172
|
-
var o = t.firstFields === !0 ? Object.keys(a) : t.firstFields || [], n = Object.keys(a),
|
|
172
|
+
var o = t.firstFields === !0 ? Object.keys(a) : t.firstFields || [], n = Object.keys(a), l = n.length, h = 0, d = [], f = new Promise(function(x, u) {
|
|
173
173
|
var y = function(w) {
|
|
174
|
-
if (d.push.apply(d, w),
|
|
174
|
+
if (d.push.apply(d, w), h++, h === l)
|
|
175
175
|
return i(d), d.length ? u(new Xt(d, Ct(d))) : x(s);
|
|
176
176
|
};
|
|
177
177
|
n.length || (i(d), x(s)), n.forEach(function(g) {
|
|
@@ -218,9 +218,9 @@ var Gt = function(t, e, i, s, r, o) {
|
|
|
218
218
|
t.required && (!i.hasOwnProperty(t.field) || I(e, o || t.type)) && s.push(H(r.messages.required, t.fullField));
|
|
219
219
|
}, Se = function(t, e, i, s, r) {
|
|
220
220
|
(/^\s+$/.test(e) || e === "") && s.push(H(r.messages.whitespace, t.fullField));
|
|
221
|
-
},
|
|
222
|
-
if (
|
|
223
|
-
return
|
|
221
|
+
}, ht, Le = function() {
|
|
222
|
+
if (ht)
|
|
223
|
+
return ht;
|
|
224
224
|
var a = "[a-fA-F\\d:]", t = function(b) {
|
|
225
225
|
return b && b.includeBoundaries ? "(?:(?<=\\s|^)(?=" + a + ")|(?<=" + a + ")(?=\\s|$))" : "";
|
|
226
226
|
}, e = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}", i = "[a-fA-F\\d]{1,4}", s = (`
|
|
@@ -234,16 +234,16 @@ var Gt = 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 + "$"), n = new RegExp("^" + s + "$"),
|
|
237
|
+
`).replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(), r = new RegExp("(?:^" + e + "$)|(?:^" + s + "$)"), o = new RegExp("^" + e + "$"), n = new RegExp("^" + s + "$"), l = function(b) {
|
|
238
238
|
return b && b.exact ? r : new RegExp("(?:" + t(b) + e + t(b) + ")|(?:" + t(b) + s + t(b) + ")", "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 ? n : new RegExp("" + t(m) + s + t(m), "g");
|
|
244
244
|
};
|
|
245
|
-
var
|
|
246
|
-
return
|
|
245
|
+
var h = "(?:(?:[a-z]+:)?//)", d = "(?:\\S+(?::\\S*)?@)?", f = l.v4().source, x = l.v6().source, u = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)", y = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*", g = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))", w = "(?::\\d{2,5})?", p = '(?:[/?#][^\\s"]*)?', E = "(?:" + h + "|www\\.)" + d + "(?:localhost|" + f + "|" + x + "|" + u + y + g + ")" + w + p;
|
|
246
|
+
return ht = new RegExp("(?:^" + E + "$)", "i"), ht;
|
|
247
247
|
}, Yt = {
|
|
248
248
|
// http://emailregex.com/
|
|
249
249
|
email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,
|
|
@@ -300,10 +300,10 @@ var Gt = function(t, e, i, s, r, o) {
|
|
|
300
300
|
var o = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"], n = t.type;
|
|
301
301
|
o.indexOf(n) > -1 ? et[n](e) || s.push(H(r.messages.types[n], t.fullField, t.type)) : n && typeof e !== t.type && s.push(H(r.messages.types[n], t.fullField, t.type));
|
|
302
302
|
}, He = function(t, e, i, s, r) {
|
|
303
|
-
var o = typeof t.len == "number", n = typeof t.min == "number",
|
|
303
|
+
var o = typeof t.len == "number", n = typeof t.min == "number", l = typeof t.max == "number", h = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, d = e, f = null, x = typeof e == "number", u = typeof e == "string", y = Array.isArray(e);
|
|
304
304
|
if (x ? f = "number" : u ? f = "string" : y && (f = "array"), !f)
|
|
305
305
|
return !1;
|
|
306
|
-
y && (d = e.length), u && (d = e.replace(
|
|
306
|
+
y && (d = e.length), u && (d = e.replace(h, "_").length), o ? d !== t.len && s.push(H(r.messages[f].len, t.fullField, t.len)) : n && !l && d < t.min ? s.push(H(r.messages[f].min, t.fullField, t.min)) : l && !n && d > t.max ? s.push(H(r.messages[f].max, t.fullField, t.max)) : n && l && (d < t.min || d > t.max) && s.push(H(r.messages[f].range, t.fullField, t.min, t.max));
|
|
307
307
|
}, j = "enum", Me = function(t, e, i, s, r) {
|
|
308
308
|
t[j] = Array.isArray(t[j]) ? t[j] : [], t[j].indexOf(e) === -1 && s.push(H(r.messages[j], t.fullField, t[j].join(", ")));
|
|
309
309
|
}, De = function(t, e, i, s, r) {
|
|
@@ -416,8 +416,8 @@ var Gt = function(t, e, i, s, r, o) {
|
|
|
416
416
|
if (I(e, "date") && !t.required)
|
|
417
417
|
return i();
|
|
418
418
|
if (v.required(t, e, s, o, r), !I(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 Gt = function(t, e, i, s, r, o) {
|
|
|
425
425
|
var o = [], n = Array.isArray(e) ? "array" : typeof e;
|
|
426
426
|
v.required(t, e, s, o, r, n), i(o);
|
|
427
427
|
}, yt = function(t, e, i, s, r) {
|
|
428
|
-
var o = t.type, n = [],
|
|
429
|
-
if (
|
|
428
|
+
var o = t.type, n = [], l = t.required || !t.required && s.hasOwnProperty(t.field);
|
|
429
|
+
if (l) {
|
|
430
430
|
if (I(e, o) && !t.required)
|
|
431
431
|
return i();
|
|
432
432
|
v.required(t, e, s, n, r, o), I(e, o) || v.type(t, e, s, n, r);
|
|
@@ -533,9 +533,9 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
533
533
|
var o = this;
|
|
534
534
|
s === void 0 && (s = {}), r === void 0 && (r = function() {
|
|
535
535
|
});
|
|
536
|
-
var n = i,
|
|
537
|
-
if (typeof
|
|
538
|
-
return
|
|
536
|
+
var n = i, l = s, h = r;
|
|
537
|
+
if (typeof l == "function" && (h = l, l = {}), !this.rules || Object.keys(this.rules).length === 0)
|
|
538
|
+
return h && h(null, n), Promise.resolve(n);
|
|
539
539
|
function d(g) {
|
|
540
540
|
var w = [], p = {};
|
|
541
541
|
function E(b) {
|
|
@@ -547,14 +547,14 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
547
547
|
}
|
|
548
548
|
for (var m = 0; m < g.length; m++)
|
|
549
549
|
E(g[m]);
|
|
550
|
-
w.length ? (p = Ct(w),
|
|
550
|
+
w.length ? (p = Ct(w), h(w, p)) : h(null, n);
|
|
551
551
|
}
|
|
552
|
-
if (
|
|
552
|
+
if (l.messages) {
|
|
553
553
|
var f = this.messages();
|
|
554
|
-
f === Rt && (f = vt()), Kt(f,
|
|
554
|
+
f === Rt && (f = vt()), Kt(f, l.messages), l.messages = f;
|
|
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(g) {
|
|
559
559
|
var w = o.rules[g], p = n[g];
|
|
560
560
|
w.forEach(function(E) {
|
|
@@ -570,7 +570,7 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
570
570
|
});
|
|
571
571
|
});
|
|
572
572
|
var y = {};
|
|
573
|
-
return Oe(x,
|
|
573
|
+
return Oe(x, l, function(g, w) {
|
|
574
574
|
var p = g.rule, E = (p.type === "object" || p.type === "array") && (typeof p.fields == "object" || typeof p.defaultField == "object");
|
|
575
575
|
E = E && (p.required || !p.required && g.value), p.field = g.field;
|
|
576
576
|
function m(R, S) {
|
|
@@ -582,15 +582,15 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
582
582
|
function b(R) {
|
|
583
583
|
R === void 0 && (R = []);
|
|
584
584
|
var S = Array.isArray(R) ? R : [R];
|
|
585
|
-
!
|
|
585
|
+
!l.suppressWarning && S.length && a.warning("async-validator:", S), S.length && p.message !== void 0 && (S = [].concat(p.message));
|
|
586
586
|
var L = S.map(Nt(p, n));
|
|
587
|
-
if (
|
|
587
|
+
if (l.first && L.length)
|
|
588
588
|
return y[p.field] = 1, w(L);
|
|
589
589
|
if (!E)
|
|
590
590
|
w(L);
|
|
591
591
|
else {
|
|
592
592
|
if (p.required && !g.value)
|
|
593
|
-
return p.message !== void 0 ? L = [].concat(p.message).map(Nt(p, n)) :
|
|
593
|
+
return p.message !== void 0 ? L = [].concat(p.message).map(Nt(p, n)) : l.error && (L = [l.error(p, H(l.messages.required, p.field))]), w(L);
|
|
594
594
|
var A = {};
|
|
595
595
|
p.defaultField && Object.keys(g.value).map(function(O) {
|
|
596
596
|
A[O] = p.defaultField;
|
|
@@ -601,7 +601,7 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
601
601
|
D[O] = _.map(m.bind(null, O));
|
|
602
602
|
});
|
|
603
603
|
var B = new a(D);
|
|
604
|
-
B.messages(
|
|
604
|
+
B.messages(l.messages), g.rule.options && (g.rule.options.messages = l.messages, g.rule.options.error = l.error), B.validate(g.value, g.rule.options || l, function(O) {
|
|
605
605
|
var T = [];
|
|
606
606
|
L && L.length && T.push.apply(T, L), O && O.length && T.push.apply(T, O), w(T.length ? T : null);
|
|
607
607
|
});
|
|
@@ -609,12 +609,12 @@ var Rt = vt(), nt = /* @__PURE__ */ function() {
|
|
|
609
609
|
}
|
|
610
610
|
var C;
|
|
611
611
|
if (p.asyncValidator)
|
|
612
|
-
C = p.asyncValidator(p, g.value, b, g.source,
|
|
612
|
+
C = p.asyncValidator(p, g.value, b, g.source, l);
|
|
613
613
|
else if (p.validator) {
|
|
614
614
|
try {
|
|
615
|
-
C = p.validator(p, g.value, b, g.source,
|
|
615
|
+
C = p.validator(p, g.value, b, g.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), b(R.message);
|
|
620
620
|
}
|
|
@@ -751,11 +751,11 @@ class Ze {
|
|
|
751
751
|
t.forEach((i, s) => {
|
|
752
752
|
let r = !1;
|
|
753
753
|
Array.isArray(i.children) && (r = !0, this.initData(i.children, e + 1));
|
|
754
|
-
const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: n, CELL_HEIGHT:
|
|
754
|
+
const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: n, CELL_HEIGHT: l, SELECTABLE_METHOD: h, CHECKBOX_KEY: d } = this.ctx.config, f = i[o], x = f ?? At();
|
|
755
755
|
this.itemRowKeyMap.set(i, x);
|
|
756
|
-
const u = i._height ||
|
|
756
|
+
const u = i._height || l, y = i._readonly;
|
|
757
757
|
let g = !0;
|
|
758
|
-
if (typeof
|
|
758
|
+
if (typeof h == "function" && (g = h), d) {
|
|
759
759
|
const w = i[d];
|
|
760
760
|
if (this.checkboxKeyMap.has(w)) {
|
|
761
761
|
const p = this.checkboxKeyMap.get(w);
|
|
@@ -835,12 +835,12 @@ class Ze {
|
|
|
835
835
|
const i = (r) => {
|
|
836
836
|
r.forEach((o) => {
|
|
837
837
|
t.push(o);
|
|
838
|
-
const n = this.itemRowKeyMap.get(o), { expand:
|
|
838
|
+
const n = this.itemRowKeyMap.get(o), { expand: l, hasChildren: h, height: d } = this.rowKeyMap.get(n), f = this.sumHeight;
|
|
839
839
|
this.sumHeight += d, this.rowIndexRowKeyMap.set(e, n), this.positions.push({
|
|
840
840
|
top: f,
|
|
841
841
|
height: d,
|
|
842
842
|
bottom: this.sumHeight
|
|
843
|
-
}), e += 1,
|
|
843
|
+
}), e += 1, l && h && i(o.children);
|
|
844
844
|
});
|
|
845
845
|
};
|
|
846
846
|
this.rowIndexRowKeyMap.clear();
|
|
@@ -963,9 +963,9 @@ class Ze {
|
|
|
963
963
|
let i = [];
|
|
964
964
|
const s = /* @__PURE__ */ new Set();
|
|
965
965
|
t.forEach((n) => {
|
|
966
|
-
const { value:
|
|
967
|
-
s.add(
|
|
968
|
-
rowKey:
|
|
966
|
+
const { value: l, rowKey: h, key: d } = n, { oldValue: f, newValue: x } = this.setItemValue(h, d, l);
|
|
967
|
+
s.add(h), i.push({
|
|
968
|
+
rowKey: h,
|
|
969
969
|
key: d,
|
|
970
970
|
oldValue: f,
|
|
971
971
|
newValue: x
|
|
@@ -973,12 +973,12 @@ class Ze {
|
|
|
973
973
|
});
|
|
974
974
|
let r = [];
|
|
975
975
|
const o = i.map((n) => {
|
|
976
|
-
const
|
|
976
|
+
const l = this.ctx.database.getRowDataItemForRowKey(n.rowKey);
|
|
977
977
|
return {
|
|
978
978
|
rowKey: n.rowKey,
|
|
979
979
|
key: n.key,
|
|
980
980
|
value: n.newValue,
|
|
981
|
-
row:
|
|
981
|
+
row: l
|
|
982
982
|
};
|
|
983
983
|
});
|
|
984
984
|
return s.forEach((n) => {
|
|
@@ -1004,15 +1004,15 @@ class Ze {
|
|
|
1004
1004
|
if (!this.rowKeyMap.has(t))
|
|
1005
1005
|
return {};
|
|
1006
1006
|
const { item: n } = this.rowKeyMap.get(t);
|
|
1007
|
-
let
|
|
1007
|
+
let l = n[e];
|
|
1008
1008
|
if (this.ctx.database.getReadonly(t, e))
|
|
1009
1009
|
return {
|
|
1010
|
-
oldValue:
|
|
1011
|
-
newValue:
|
|
1010
|
+
oldValue: l,
|
|
1011
|
+
newValue: l
|
|
1012
1012
|
};
|
|
1013
|
-
n[e] !== null && typeof n[e] == "object" && (
|
|
1014
|
-
const
|
|
1015
|
-
if (this.originalDataMap.has(
|
|
1013
|
+
n[e] !== null && typeof n[e] == "object" && (l = JSON.parse(JSON.stringify(n[e])));
|
|
1014
|
+
const h = `${t}_${e}`;
|
|
1015
|
+
if (this.originalDataMap.has(h) || this.originalDataMap.set(h, l), this.changedDataMap.set(h, i), n[e] = i, o) {
|
|
1016
1016
|
const d = this.ctx.database.getRowDataItemForRowKey(t), f = {
|
|
1017
1017
|
rowKey: t,
|
|
1018
1018
|
key: e,
|
|
@@ -1022,18 +1022,18 @@ class Ze {
|
|
|
1022
1022
|
this.ctx.emit("change", [f], [d]), this.ctx.emit("editChange", {
|
|
1023
1023
|
rowKey: t,
|
|
1024
1024
|
key: e,
|
|
1025
|
-
oldValue:
|
|
1025
|
+
oldValue: l,
|
|
1026
1026
|
value: i,
|
|
1027
|
-
originalValue: this.originalDataMap.get(
|
|
1027
|
+
originalValue: this.originalDataMap.get(h),
|
|
1028
1028
|
row: d
|
|
1029
1029
|
});
|
|
1030
1030
|
}
|
|
1031
1031
|
return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
|
|
1032
1032
|
rowKey: t,
|
|
1033
1033
|
key: e,
|
|
1034
|
-
oldValue:
|
|
1034
|
+
oldValue: l,
|
|
1035
1035
|
value: i,
|
|
1036
|
-
originalValue: this.originalDataMap.get(
|
|
1036
|
+
originalValue: this.originalDataMap.get(h),
|
|
1037
1037
|
row: this.ctx.database.getRowDataItemForRowKey(t)
|
|
1038
1038
|
}), s && this.ctx.history.pushState({
|
|
1039
1039
|
type: "single",
|
|
@@ -1043,12 +1043,12 @@ class Ze {
|
|
|
1043
1043
|
{
|
|
1044
1044
|
rowKey: t,
|
|
1045
1045
|
key: e,
|
|
1046
|
-
oldValue:
|
|
1046
|
+
oldValue: l,
|
|
1047
1047
|
newValue: i
|
|
1048
1048
|
}
|
|
1049
1049
|
]
|
|
1050
1050
|
}), r && this.ctx.emit("draw"), {
|
|
1051
|
-
oldValue:
|
|
1051
|
+
oldValue: l,
|
|
1052
1052
|
newValue: i
|
|
1053
1053
|
};
|
|
1054
1054
|
}
|
|
@@ -1075,8 +1075,8 @@ class Ze {
|
|
|
1075
1075
|
return !1;
|
|
1076
1076
|
const { item: s } = this.rowKeyMap.get(t), r = s[i];
|
|
1077
1077
|
this.checkboxKeyMap.has(r) && this.checkboxKeyMap.get(r).forEach((n) => {
|
|
1078
|
-
const
|
|
1079
|
-
|
|
1078
|
+
const l = this.rowKeyMap.get(n);
|
|
1079
|
+
l.check = e;
|
|
1080
1080
|
});
|
|
1081
1081
|
}
|
|
1082
1082
|
}
|
|
@@ -1238,15 +1238,15 @@ class Ze {
|
|
|
1238
1238
|
getReadonly(t, e) {
|
|
1239
1239
|
const i = this.rowKeyMap.get(t), s = this.headerMap.get(e), r = i == null ? void 0 : i.readonly, o = s == null ? void 0 : s.readonly, { CELL_READONLY_METHOD: n } = this.ctx.config;
|
|
1240
1240
|
if (typeof n == "function") {
|
|
1241
|
-
const
|
|
1241
|
+
const h = n({
|
|
1242
1242
|
row: i.item,
|
|
1243
1243
|
rowIndex: i.rowIndex,
|
|
1244
1244
|
colIndex: s.colIndex,
|
|
1245
1245
|
column: s.column,
|
|
1246
1246
|
value: this.getItemValue(t, e)
|
|
1247
1247
|
});
|
|
1248
|
-
if (
|
|
1249
|
-
return
|
|
1248
|
+
if (h !== void 0)
|
|
1249
|
+
return h;
|
|
1250
1250
|
}
|
|
1251
1251
|
return o || r;
|
|
1252
1252
|
}
|
|
@@ -1256,7 +1256,7 @@ class Ze {
|
|
|
1256
1256
|
getValidator(t, e) {
|
|
1257
1257
|
return new Promise((i) => {
|
|
1258
1258
|
const s = this.rowKeyMap.get(t), r = this.headerMap.get(e), { CELL_RULES_METHOD: o } = this.ctx.config, n = r.column;
|
|
1259
|
-
let
|
|
1259
|
+
let l = n.rules;
|
|
1260
1260
|
if (typeof o == "function") {
|
|
1261
1261
|
const d = o({
|
|
1262
1262
|
row: s.item,
|
|
@@ -1265,28 +1265,28 @@ class Ze {
|
|
|
1265
1265
|
column: n,
|
|
1266
1266
|
value: this.getItemValue(t, e)
|
|
1267
1267
|
});
|
|
1268
|
-
d && (
|
|
1268
|
+
d && (l = d);
|
|
1269
1269
|
}
|
|
1270
|
-
if (
|
|
1271
|
-
let
|
|
1272
|
-
if (d[e] = this.getItemValue(t, e), Array.isArray(
|
|
1273
|
-
const x =
|
|
1270
|
+
if (l) {
|
|
1271
|
+
let h = {}, d = {};
|
|
1272
|
+
if (d[e] = this.getItemValue(t, e), Array.isArray(l) && l.length) {
|
|
1273
|
+
const x = l.map((u) => ({
|
|
1274
1274
|
...u,
|
|
1275
1275
|
row: s.item,
|
|
1276
1276
|
column: n,
|
|
1277
1277
|
rowIndex: s.rowIndex,
|
|
1278
1278
|
colIndex: r.colIndex
|
|
1279
1279
|
}));
|
|
1280
|
-
|
|
1280
|
+
h[e] = x;
|
|
1281
1281
|
} else
|
|
1282
|
-
|
|
1283
|
-
...
|
|
1282
|
+
h[e] = {
|
|
1283
|
+
...l,
|
|
1284
1284
|
row: s.item,
|
|
1285
1285
|
column: n,
|
|
1286
1286
|
rowIndex: s.rowIndex,
|
|
1287
1287
|
colIndex: r.colIndex
|
|
1288
1288
|
};
|
|
1289
|
-
new nt(
|
|
1289
|
+
new nt(h).validate(d).then(() => {
|
|
1290
1290
|
this.setValidationError(t, e, []), i([]);
|
|
1291
1291
|
}).catch(({ errors: x }) => {
|
|
1292
1292
|
const u = x.map((y) => ({
|
|
@@ -1512,31 +1512,31 @@ class ei {
|
|
|
1512
1512
|
* @param {string} color - 阴影的颜色
|
|
1513
1513
|
*/
|
|
1514
1514
|
drawShadow(t, e, i, s, r) {
|
|
1515
|
-
const { fillColor: o, side: n, shadowWidth:
|
|
1515
|
+
const { fillColor: o, side: n, shadowWidth: l, colorStart: h, colorEnd: d } = r;
|
|
1516
1516
|
this.ctx.save(), o && (this.ctx.fillStyle = o, this.ctx.fillRect(t, e, i, s));
|
|
1517
1517
|
let f;
|
|
1518
1518
|
switch (n) {
|
|
1519
1519
|
case "left":
|
|
1520
|
-
f = this.ctx.createLinearGradient(t -
|
|
1520
|
+
f = this.ctx.createLinearGradient(t - l, e, t, e), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t - l, e, l, s);
|
|
1521
1521
|
break;
|
|
1522
1522
|
case "right":
|
|
1523
1523
|
f = this.ctx.createLinearGradient(
|
|
1524
1524
|
t + i,
|
|
1525
1525
|
e,
|
|
1526
|
-
t + i +
|
|
1526
|
+
t + i + l,
|
|
1527
1527
|
e
|
|
1528
|
-
), f.addColorStop(0,
|
|
1528
|
+
), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t + i, e, l, s);
|
|
1529
1529
|
break;
|
|
1530
1530
|
case "top":
|
|
1531
|
-
f = this.ctx.createLinearGradient(t, e -
|
|
1531
|
+
f = this.ctx.createLinearGradient(t, e - l, t, e), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t, e - l, i, l);
|
|
1532
1532
|
break;
|
|
1533
1533
|
case "bottom":
|
|
1534
1534
|
f = this.ctx.createLinearGradient(
|
|
1535
1535
|
t,
|
|
1536
1536
|
e + s,
|
|
1537
1537
|
t,
|
|
1538
|
-
e + s +
|
|
1539
|
-
), f.addColorStop(0,
|
|
1538
|
+
e + s + l
|
|
1539
|
+
), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t, e + s, i, l);
|
|
1540
1540
|
break;
|
|
1541
1541
|
default:
|
|
1542
1542
|
console.error("Invalid side specified for shadow");
|
|
@@ -1557,12 +1557,12 @@ class ei {
|
|
|
1557
1557
|
drawImage(t, e, i, s, r) {
|
|
1558
1558
|
this.ctx.save(), this.ctx.drawImage(t, e, i, s, r), this.ctx.restore();
|
|
1559
1559
|
}
|
|
1560
|
-
drawRect(t, e, i, s, { borderWidth: r = 1, borderColor: o, fillColor: n, radius:
|
|
1561
|
-
if (this.ctx.save(), this.ctx.beginPath(), n !== void 0 && (this.ctx.fillStyle = n), o !== void 0 && (this.ctx.lineWidth = r, this.ctx.strokeStyle = o),
|
|
1560
|
+
drawRect(t, e, i, s, { borderWidth: r = 1, borderColor: o, fillColor: n, radius: l = 0 } = {}) {
|
|
1561
|
+
if (this.ctx.save(), this.ctx.beginPath(), n !== void 0 && (this.ctx.fillStyle = n), o !== void 0 && (this.ctx.lineWidth = r, this.ctx.strokeStyle = o), l === 0)
|
|
1562
1562
|
this.ctx.rect(t + 0.5, e + 0.5, i, s);
|
|
1563
1563
|
else {
|
|
1564
|
-
const [
|
|
1565
|
-
this.ctx.moveTo(t +
|
|
1564
|
+
const [h, d, f, x] = typeof l == "number" ? [l, l, l, l] : l;
|
|
1565
|
+
this.ctx.moveTo(t + h, e), this.ctx.arcTo(t + i, e, t + i, e + d, d), this.ctx.arcTo(t + i, e + s, t + i - f, e + s, f), this.ctx.arcTo(t, e + s, t, e + s - x, x), this.ctx.arcTo(t, e, t + h, e, h);
|
|
1566
1566
|
}
|
|
1567
1567
|
n !== void 0 && this.ctx.fill(), o !== void 0 && this.ctx.stroke(), this.ctx.restore();
|
|
1568
1568
|
}
|
|
@@ -1580,16 +1580,16 @@ class ei {
|
|
|
1580
1580
|
this.ctx.save();
|
|
1581
1581
|
const {
|
|
1582
1582
|
font: n = "12px Arial",
|
|
1583
|
-
align:
|
|
1584
|
-
color:
|
|
1583
|
+
align: l = "center",
|
|
1584
|
+
color: h = "#495060",
|
|
1585
1585
|
padding: d = 0,
|
|
1586
1586
|
verticalAlign: f = "middle"
|
|
1587
1587
|
} = o;
|
|
1588
|
-
this.ctx.font = n, this.ctx.fillStyle =
|
|
1588
|
+
this.ctx.font = n, this.ctx.fillStyle = h, this.ctx.textBaseline = f, this.ctx.textAlign = l;
|
|
1589
1589
|
let x = 0;
|
|
1590
1590
|
f === "top" ? x = i + d : f === "bottom" ? x = i + r - d : x = i + (r + d) / 2;
|
|
1591
1591
|
let u = 0;
|
|
1592
|
-
|
|
1592
|
+
l === "left" ? u = e + d : l === "right" ? u = e + s - d : u = e + s / 2;
|
|
1593
1593
|
const { _text: y, ellipsis: g } = this.handleEllipsis(t, s, d);
|
|
1594
1594
|
return this.ctx.fillText(y, u, x), this.ctx.restore(), g;
|
|
1595
1595
|
}
|
|
@@ -1603,10 +1603,10 @@ class ei {
|
|
|
1603
1603
|
const o = this.ctx.measureText("...").width, n = this.ctx.measureText(t).width;
|
|
1604
1604
|
if (n && n + o >= e - i * 2) {
|
|
1605
1605
|
s = !0;
|
|
1606
|
-
let
|
|
1607
|
-
for (let
|
|
1608
|
-
if (
|
|
1609
|
-
r = t.slice(0,
|
|
1606
|
+
let l = 0;
|
|
1607
|
+
for (let h = 0; h < t.length; h++)
|
|
1608
|
+
if (l += this.ctx.measureText(t[h]).width, l >= e - i * 2 - o) {
|
|
1609
|
+
r = t.slice(0, h) + "...";
|
|
1610
1610
|
break;
|
|
1611
1611
|
}
|
|
1612
1612
|
}
|
|
@@ -1829,15 +1829,15 @@ class ii {
|
|
|
1829
1829
|
}
|
|
1830
1830
|
async createImageFromSVG(t, e) {
|
|
1831
1831
|
const r = new DOMParser().parseFromString(t, "image/svg+xml").documentElement;
|
|
1832
|
-
e && r.querySelectorAll("*").forEach((
|
|
1833
|
-
|
|
1832
|
+
e && r.querySelectorAll("*").forEach((h) => {
|
|
1833
|
+
h.setAttribute("fill", e);
|
|
1834
1834
|
});
|
|
1835
1835
|
const o = new Image(), n = new Blob([new XMLSerializer().serializeToString(r)], {
|
|
1836
1836
|
type: "image/svg+xml"
|
|
1837
|
-
}),
|
|
1838
|
-
return o.src =
|
|
1837
|
+
}), l = URL.createObjectURL(n);
|
|
1838
|
+
return o.src = l, new Promise((h, d) => {
|
|
1839
1839
|
o.onerror = () => d(new Error("Failed to load image")), o.onload = () => {
|
|
1840
|
-
|
|
1840
|
+
h(o);
|
|
1841
1841
|
};
|
|
1842
1842
|
});
|
|
1843
1843
|
}
|
|
@@ -1883,8 +1883,8 @@ class Jt {
|
|
|
1883
1883
|
}
|
|
1884
1884
|
}
|
|
1885
1885
|
class Qt extends Jt {
|
|
1886
|
-
constructor(e, i, s, r, o, n,
|
|
1887
|
-
super(e, r, o, n,
|
|
1886
|
+
constructor(e, i, s, r, o, n, l, h, d, f = "body") {
|
|
1887
|
+
super(e, r, o, n, l, h.fixed, f);
|
|
1888
1888
|
c(this, "formatter");
|
|
1889
1889
|
c(this, "hoverIconName", "");
|
|
1890
1890
|
c(this, "align");
|
|
@@ -1929,7 +1929,7 @@ class Qt extends Jt {
|
|
|
1929
1929
|
c(this, "overflowTooltipShow", !0);
|
|
1930
1930
|
c(this, "overflowTooltipMaxWidth", 500);
|
|
1931
1931
|
c(this, "overflowTooltipPlacement", "top");
|
|
1932
|
-
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key =
|
|
1932
|
+
this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = h.key, this.type = h.type || "text", this.editorType = h.editorType || "text", this.cellType = f, this.align = h.align || "center", this.verticalAlign = h.verticalAlign || "middle", this.fixed = h.fixed, this.level = h.level, this.column = h, this.rules = h.rules, this.row = d, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = h.render, this.overflowTooltipShow = h.overflowTooltipShow !== !1, this.overflowTooltipMaxWidth = h.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = h.overflowTooltipPlacement || "top", this.renderFooter = h.renderFooter, this.hoverIconName = h.hoverIconName, this.formatter = h.formatter, this.update();
|
|
1933
1933
|
}
|
|
1934
1934
|
getValidationMessage() {
|
|
1935
1935
|
const e = this.ctx.database.getValidationError(this.rowKey, this.key);
|
|
@@ -2023,13 +2023,13 @@ class Qt extends Jt {
|
|
|
2023
2023
|
const { CELL_PADDING: e = 0 } = this.ctx.config, { rowKey: i, cellType: s } = this;
|
|
2024
2024
|
let r, o = 0, n = "";
|
|
2025
2025
|
if (this.type === "tree" && s === "body") {
|
|
2026
|
-
const
|
|
2026
|
+
const l = this.ctx.database.getRowForRowKey(i), { expand: h = !1, hasChildren: d = !1, expandLoading: f = !1, level: x = 0 } = l || {};
|
|
2027
2027
|
if (f) {
|
|
2028
2028
|
const u = this.ctx.icons.get("loading");
|
|
2029
2029
|
n = "loading", r = u, o = x * 8;
|
|
2030
2030
|
} else if (d) {
|
|
2031
2031
|
const u = this.ctx.icons.get("expand"), y = this.ctx.icons.get("shrink");
|
|
2032
|
-
r =
|
|
2032
|
+
r = h ? y : u, n = h ? "shrink" : "expand", o = x * 8;
|
|
2033
2033
|
} else
|
|
2034
2034
|
o = x * 8;
|
|
2035
2035
|
if (r) {
|
|
@@ -2046,8 +2046,8 @@ class Qt extends Jt {
|
|
|
2046
2046
|
FOOTER_CELL_STYLE_METHOD: r,
|
|
2047
2047
|
READONLY_TEXT_COLOR: o,
|
|
2048
2048
|
FOOTER_BG_COLOR: n,
|
|
2049
|
-
HIGHLIGHT_SELECTED_ROW:
|
|
2050
|
-
HIGHLIGHT_SELECTED_ROW_COLOR:
|
|
2049
|
+
HIGHLIGHT_SELECTED_ROW: l,
|
|
2050
|
+
HIGHLIGHT_SELECTED_ROW_COLOR: h,
|
|
2051
2051
|
HIGHLIGHT_HOVER_ROW: d,
|
|
2052
2052
|
HIGHLIGHT_HOVER_ROW_COLOR: f
|
|
2053
2053
|
} = this.ctx.config;
|
|
@@ -2068,7 +2068,7 @@ class Qt extends Jt {
|
|
|
2068
2068
|
}
|
|
2069
2069
|
let x = "transparent";
|
|
2070
2070
|
const u = this.ctx.focusCell, y = this.ctx.hoverCell;
|
|
2071
|
-
d && (y == null ? void 0 : y.rowKey) === this.rowKey && (x = f),
|
|
2071
|
+
d && (y == null ? void 0 : y.rowKey) === this.rowKey && (x = f), l && (u == null ? void 0 : u.rowKey) === this.rowKey && (x = h), this.drawCellSkyBgColor = x;
|
|
2072
2072
|
let g = e, w = o;
|
|
2073
2073
|
if (["index", "index-selection", "selection"].includes(this.type)) {
|
|
2074
2074
|
this.drawCellBgColor = e, this.drawTextColor = o;
|
|
@@ -2087,24 +2087,24 @@ class Qt extends Jt {
|
|
|
2087
2087
|
this.drawCellBgColor = g, this.drawTextColor = w;
|
|
2088
2088
|
}
|
|
2089
2089
|
updateSelection() {
|
|
2090
|
-
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type: n, rowIndex:
|
|
2090
|
+
const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: r, cellType: o, type: n, rowIndex: l, rowKey: h } = this;
|
|
2091
2091
|
if (!(s === 0 || r === 0) && o !== "footer" && ["index-selection", "selection"].includes(n)) {
|
|
2092
|
-
const d = this.ctx.database.getRowSelection(
|
|
2092
|
+
const d = this.ctx.database.getRowSelection(h), f = this.ctx.database.getRowSelectable(h), { CHECKBOX_SIZE: x = 0 } = this.ctx.config, u = this.drawX + (e - x) / 2, y = this.drawY + (i - x) / 2;
|
|
2093
2093
|
let g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck";
|
|
2094
|
-
d && f ? (g = this.ctx.icons.get("checkbox-check"), w = "checkbox-check") : d && f ? (g = this.ctx.icons.get("checkbox-check-disabled"), w = "checkbox-check-disabled") : !d && f ? (g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), w = "checkbox-disabled"), g && n == "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex ===
|
|
2094
|
+
d && f ? (g = this.ctx.icons.get("checkbox-check"), w = "checkbox-check") : d && f ? (g = this.ctx.icons.get("checkbox-check-disabled"), w = "checkbox-check-disabled") : !d && f ? (g = this.ctx.icons.get("checkbox-uncheck"), w = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), w = "checkbox-disabled"), g && n == "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === l || ["checkbox-disabled", "checkbox-check"].includes(w)) && (this.drawImageX = u, this.drawImageY = y, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = w, this.drawImageSource = g) : g && n === "selection" && (this.drawImageX = u, this.drawImageY = y, this.drawImageWidth = x, this.drawImageHeight = x, this.drawImageName = w, this.drawImageSource = g);
|
|
2095
2095
|
}
|
|
2096
2096
|
}
|
|
2097
2097
|
updateHoverIcon() {
|
|
2098
2098
|
const { CELL_HOVER_ICON_METHOD: e, CELL_HOVER_ICON_SIZE: i, CELL_PADDING: s } = this.ctx.config;
|
|
2099
2099
|
if (typeof e == "function") {
|
|
2100
|
-
const
|
|
2100
|
+
const l = e({
|
|
2101
2101
|
row: this.row,
|
|
2102
2102
|
rowIndex: this.rowIndex,
|
|
2103
2103
|
colIndex: this.colIndex,
|
|
2104
2104
|
column: this.column,
|
|
2105
2105
|
value: this.getValue()
|
|
2106
2106
|
});
|
|
2107
|
-
|
|
2107
|
+
l !== void 0 && (this.hoverIconName = l);
|
|
2108
2108
|
}
|
|
2109
2109
|
const r = this.drawX + this.width - i - s, o = this.drawY + (this.height - i) / 2;
|
|
2110
2110
|
if (this.hoverIconName && this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === this.rowIndex) {
|
|
@@ -2221,8 +2221,8 @@ class Qt extends Jt {
|
|
|
2221
2221
|
const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s } = this.ctx.config;
|
|
2222
2222
|
if (!s || !i)
|
|
2223
2223
|
return;
|
|
2224
|
-
const { xArr: r, yArr: o } = this.ctx.selector, n = r[1],
|
|
2225
|
-
|
|
2224
|
+
const { xArr: r, yArr: o } = this.ctx.selector, n = r[1], l = o[1], { colIndex: h, rowIndex: d, drawX: f, drawY: x } = this;
|
|
2225
|
+
h === n && d === l && this.ctx.paint.drawRect(f + this.width - 6, x + this.height - 6, 6, 6, {
|
|
2226
2226
|
borderColor: "#fff",
|
|
2227
2227
|
fillColor: e
|
|
2228
2228
|
});
|
|
@@ -2276,32 +2276,32 @@ class Qt extends Jt {
|
|
|
2276
2276
|
});
|
|
2277
2277
|
}
|
|
2278
2278
|
drawBorder(e) {
|
|
2279
|
-
const { drawX: i, drawY: s, width: r, rowIndex: o, colIndex: n } = this,
|
|
2280
|
-
let
|
|
2281
|
-
o === 0 && (
|
|
2279
|
+
const { drawX: i, drawY: s, width: r, rowIndex: o, colIndex: n } = this, l = i + 0.5;
|
|
2280
|
+
let h = s + 0.5, d = this.height;
|
|
2281
|
+
o === 0 && (h = this.y + 1, d = d - 1);
|
|
2282
2282
|
const { xArr: f, yArr: x, lineDash: u = [], borderWidth: y = 1, borderColor: g, fillColor: w } = e, p = f[0], E = f[1], m = x[0], b = x[1];
|
|
2283
|
-
n >= p && n <= E && o === m && this.ctx.paint.drawLine([h, l
|
|
2283
|
+
n >= p && n <= E && o === m && this.ctx.paint.drawLine([l, h, l + r - 2, h], {
|
|
2284
2284
|
borderColor: g,
|
|
2285
2285
|
fillColor: w,
|
|
2286
2286
|
borderWidth: y,
|
|
2287
2287
|
lineCap: "round",
|
|
2288
2288
|
lineJoin: "round",
|
|
2289
2289
|
lineDash: u
|
|
2290
|
-
}), n >= p && n <= E && o === b && this.ctx.paint.drawLine([
|
|
2290
|
+
}), n >= p && n <= E && o === b && this.ctx.paint.drawLine([l, h + d - 1.5, l + r, h + d - 1.5], {
|
|
2291
2291
|
borderColor: g,
|
|
2292
2292
|
fillColor: w,
|
|
2293
2293
|
borderWidth: y,
|
|
2294
2294
|
lineCap: "round",
|
|
2295
2295
|
lineJoin: "round",
|
|
2296
2296
|
lineDash: u
|
|
2297
|
-
}), n === p && o >= m && o <= b && this.ctx.paint.drawLine([h, l, h
|
|
2297
|
+
}), n === p && o >= m && o <= b && this.ctx.paint.drawLine([l, h, l, h + d - 1], {
|
|
2298
2298
|
borderColor: g,
|
|
2299
2299
|
fillColor: w,
|
|
2300
2300
|
borderWidth: y,
|
|
2301
2301
|
lineCap: "round",
|
|
2302
2302
|
lineJoin: "round",
|
|
2303
2303
|
lineDash: u
|
|
2304
|
-
}), n === E && o >= m && o <= b && this.ctx.paint.drawLine([
|
|
2304
|
+
}), n === E && o >= m && o <= b && this.ctx.paint.drawLine([l + r - 1, h, l + r - 1, h + d - 1], {
|
|
2305
2305
|
borderColor: g,
|
|
2306
2306
|
fillColor: w,
|
|
2307
2307
|
borderWidth: y,
|
|
@@ -2312,8 +2312,8 @@ class Qt extends Jt {
|
|
|
2312
2312
|
}
|
|
2313
2313
|
}
|
|
2314
2314
|
class te extends Jt {
|
|
2315
|
-
constructor(e, i, s, r, o, n,
|
|
2316
|
-
super(e, s, r, o, n,
|
|
2315
|
+
constructor(e, i, s, r, o, n, l) {
|
|
2316
|
+
super(e, s, r, o, n, l.fixed, "header");
|
|
2317
2317
|
c(this, "align");
|
|
2318
2318
|
c(this, "verticalAlign", "middle");
|
|
2319
2319
|
c(this, "fixed");
|
|
@@ -2346,7 +2346,7 @@ class te extends Jt {
|
|
|
2346
2346
|
c(this, "drawImageHeight", 0);
|
|
2347
2347
|
c(this, "drawImageName", "");
|
|
2348
2348
|
c(this, "drawImageSource");
|
|
2349
|
-
this.ctx = e, this.x = s, this.y = r, this.width = o, this.height = n, this.colIndex = i, this.key =
|
|
2349
|
+
this.ctx = e, this.x = s, this.y = r, this.width = o, this.height = n, 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.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 = At(), this.hasChildren = l.children && l.children.length > 0 || !1, this.render = l.renderHeader;
|
|
2350
2350
|
}
|
|
2351
2351
|
/**
|
|
2352
2352
|
* 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
|
|
@@ -2366,11 +2366,11 @@ class te extends Jt {
|
|
|
2366
2366
|
const { HEADER_CELL_STYLE_METHOD: e, HEADER_BG_COLOR: i, HEADER_TEXT_COLOR: s } = this.ctx.config;
|
|
2367
2367
|
let r = i, o = s;
|
|
2368
2368
|
if (typeof e == "function") {
|
|
2369
|
-
const n = e, { backgroundColor:
|
|
2369
|
+
const n = e, { backgroundColor: l, color: h } = n({
|
|
2370
2370
|
colIndex: this.colIndex,
|
|
2371
2371
|
column: this.column
|
|
2372
2372
|
}) || {};
|
|
2373
|
-
|
|
2373
|
+
l && (r = l), h && (o = h);
|
|
2374
2374
|
}
|
|
2375
2375
|
this.drawCellBgColor = r, this.drawTextColor = o;
|
|
2376
2376
|
}
|
|
@@ -2381,11 +2381,11 @@ class te extends Jt {
|
|
|
2381
2381
|
const {
|
|
2382
2382
|
paint: e,
|
|
2383
2383
|
config: { BORDER_COLOR: i, CELL_PADDING: s, HEADER_FONT: r }
|
|
2384
|
-
} = this.ctx, { drawX: o, drawY: n, displayText:
|
|
2384
|
+
} = this.ctx, { drawX: o, drawY: n, displayText: l } = this;
|
|
2385
2385
|
e.drawRect(o, n, this.width, this.height, {
|
|
2386
2386
|
borderColor: i,
|
|
2387
2387
|
fillColor: this.drawCellBgColor
|
|
2388
|
-
}), e.drawText(
|
|
2388
|
+
}), e.drawText(l, o, n, this.width, this.height, {
|
|
2389
2389
|
font: r,
|
|
2390
2390
|
padding: s,
|
|
2391
2391
|
color: this.drawTextColor,
|
|
@@ -2396,9 +2396,9 @@ class te extends Jt {
|
|
|
2396
2396
|
drawSelection() {
|
|
2397
2397
|
const { width: e, height: i, type: s } = this;
|
|
2398
2398
|
if (["index-selection", "selection"].includes(s)) {
|
|
2399
|
-
const { indeterminate: r, check: o, selectable: n } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE:
|
|
2399
|
+
const { indeterminate: r, check: o, selectable: n } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: l = 0 } = this.ctx.config, h = this.drawX + (e - l) / 2, d = this.drawY + (i - l) / 2;
|
|
2400
2400
|
let f = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck";
|
|
2401
|
-
r ? (f = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : o && n ? (f = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : o && n ? (f = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !o && n ? (f = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck") : (f = this.ctx.icons.get("checkbox-disabled"), x = "checkbox-disabled"), f && (this.drawImageX =
|
|
2401
|
+
r ? (f = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : o && n ? (f = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : o && n ? (f = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !o && n ? (f = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck") : (f = this.ctx.icons.get("checkbox-disabled"), x = "checkbox-disabled"), f && (this.drawImageX = h, this.drawImageY = d, this.drawImageWidth = l, this.drawImageHeight = l, this.drawImageName = x, this.drawImageSource = f, this.ctx.paint.drawImage(
|
|
2402
2402
|
this.drawImageSource,
|
|
2403
2403
|
this.drawImageX,
|
|
2404
2404
|
this.drawImageY,
|
|
@@ -2441,8 +2441,8 @@ class si {
|
|
|
2441
2441
|
return;
|
|
2442
2442
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2443
2443
|
for (const o of s) {
|
|
2444
|
-
const n = o.getDrawX(),
|
|
2445
|
-
if (i > n && i < n + o.width && e >
|
|
2444
|
+
const n = o.getDrawX(), l = o.getDrawY();
|
|
2445
|
+
if (i > n && i < n + o.width && e > l && e < l + o.height) {
|
|
2446
2446
|
this.ctx.focusCellHeader = o, this.ctx.emit("cellHeaderMousedown", o, t);
|
|
2447
2447
|
return;
|
|
2448
2448
|
}
|
|
@@ -2450,10 +2450,10 @@ class si {
|
|
|
2450
2450
|
const r = this.ctx.body.renderRows;
|
|
2451
2451
|
for (const o of r) {
|
|
2452
2452
|
const n = o.fixedCells.concat(o.noFixedCells);
|
|
2453
|
-
for (const
|
|
2454
|
-
const
|
|
2455
|
-
if (i >
|
|
2456
|
-
this.ctx.setFocusCell(
|
|
2453
|
+
for (const l of n) {
|
|
2454
|
+
const h = l.getDrawX(), d = l.getDrawY();
|
|
2455
|
+
if (i > h && i < h + l.width && e > d && e < d + l.height) {
|
|
2456
|
+
this.ctx.setFocusCell(l), this.ctx.emit("cellMousedown", l, t);
|
|
2457
2457
|
return;
|
|
2458
2458
|
}
|
|
2459
2459
|
}
|
|
@@ -2463,8 +2463,8 @@ class si {
|
|
|
2463
2463
|
return;
|
|
2464
2464
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2465
2465
|
for (const o of s) {
|
|
2466
|
-
const n = o.getDrawX(),
|
|
2467
|
-
if (i > n && i < n + o.width && e >
|
|
2466
|
+
const n = o.getDrawX(), l = o.getDrawY();
|
|
2467
|
+
if (i > n && i < n + o.width && e > l && e < l + o.height) {
|
|
2468
2468
|
this.ctx.clickCellHeader = o, this.ctx.emit("cellHeaderClick", o, t), this.selectionClick(o);
|
|
2469
2469
|
return;
|
|
2470
2470
|
}
|
|
@@ -2472,10 +2472,10 @@ class si {
|
|
|
2472
2472
|
const r = this.ctx.body.renderRows;
|
|
2473
2473
|
for (const o of r) {
|
|
2474
2474
|
const n = o.fixedCells.concat(o.noFixedCells);
|
|
2475
|
-
for (const
|
|
2476
|
-
const
|
|
2477
|
-
if (i >
|
|
2478
|
-
this.ctx.clickCell =
|
|
2475
|
+
for (const l of n) {
|
|
2476
|
+
const h = l.getDrawX(), d = l.getDrawY();
|
|
2477
|
+
if (i > h && i < h + l.width && e > d && e < d + l.height) {
|
|
2478
|
+
this.ctx.clickCell = l, this.ctx.emit("cellClick", l, t), this.selectionClick(l), this.treeClick(l);
|
|
2479
2479
|
return;
|
|
2480
2480
|
}
|
|
2481
2481
|
}
|
|
@@ -2485,8 +2485,8 @@ class si {
|
|
|
2485
2485
|
return;
|
|
2486
2486
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2487
2487
|
for (const o of s) {
|
|
2488
|
-
const n = o.getDrawX(),
|
|
2489
|
-
if (i > n && i < n + o.width && e >
|
|
2488
|
+
const n = o.getDrawX(), l = o.getDrawY();
|
|
2489
|
+
if (i > n && i < n + o.width && e > l && e < l + o.height) {
|
|
2490
2490
|
this.ctx.emit("cellHeaderContextMenuClick", o, t);
|
|
2491
2491
|
return;
|
|
2492
2492
|
}
|
|
@@ -2494,10 +2494,10 @@ class si {
|
|
|
2494
2494
|
const r = this.ctx.body.renderRows;
|
|
2495
2495
|
for (const o of r) {
|
|
2496
2496
|
const n = o.fixedCells.concat(o.noFixedCells);
|
|
2497
|
-
for (const
|
|
2498
|
-
const
|
|
2499
|
-
if (i >
|
|
2500
|
-
this.ctx.emit("cellContextMenuClick",
|
|
2497
|
+
for (const l of n) {
|
|
2498
|
+
const h = l.getDrawX(), d = l.getDrawY();
|
|
2499
|
+
if (i > h && i < h + l.width && e > d && e < d + l.height) {
|
|
2500
|
+
this.ctx.emit("cellContextMenuClick", l, t);
|
|
2501
2501
|
return;
|
|
2502
2502
|
}
|
|
2503
2503
|
}
|
|
@@ -2508,8 +2508,8 @@ class si {
|
|
|
2508
2508
|
return;
|
|
2509
2509
|
const e = t.offsetY, i = t.offsetX, s = this.ctx.header.renderCellHeaders;
|
|
2510
2510
|
for (const n of s) {
|
|
2511
|
-
const
|
|
2512
|
-
if (i >
|
|
2511
|
+
const l = n.getDrawX(), h = n.getDrawY();
|
|
2512
|
+
if (i > l && i < l + n.width && e > h && e < h + n.height) {
|
|
2513
2513
|
if (this.ctx.emit("cellHeaderMouseenter", n, t), this.ctx.hoverCellHeader && this.ctx.hoverCellHeader !== n && this.ctx.emit("cellHeaderMouseleave", this.ctx.hoverCellHeader, t), this.imageEnterAndLeave(n, t), this.ctx.hoverCellHeader === n)
|
|
2514
2514
|
return;
|
|
2515
2515
|
this.ctx.hoverCellHeader = n, this.ctx.emit("cellHeaderHoverChange", n);
|
|
@@ -2518,12 +2518,12 @@ class si {
|
|
|
2518
2518
|
}
|
|
2519
2519
|
const r = this.ctx.body.renderRows;
|
|
2520
2520
|
for (const n of r) {
|
|
2521
|
-
const
|
|
2522
|
-
for (const
|
|
2523
|
-
const d =
|
|
2524
|
-
if (i > d && i < d +
|
|
2525
|
-
if (this.ctx.emit("cellMouseenter",
|
|
2526
|
-
((o = this.ctx.hoverCell) == null ? void 0 : o.rowKey) !==
|
|
2521
|
+
const l = n.fixedCells.concat(n.noFixedCells);
|
|
2522
|
+
for (const h of l) {
|
|
2523
|
+
const d = h.getDrawX(), f = h.getDrawY();
|
|
2524
|
+
if (i > d && i < d + h.visibleWidth && e > f && e < f + h.visibleHeight && (this.imageEnterAndLeave(h, t), this.visibleHoverCell !== h && (this.ctx.emit("visibleCellMouseleave", h, t), this.visibleHoverCell = h, this.ctx.emit("visibleCellHoverChange", h, t))), i > d && i < d + h.width && e > f && e < f + h.height) {
|
|
2525
|
+
if (this.ctx.emit("cellMouseenter", h, t), this.ctx.hoverCell && this.ctx.hoverCell !== h && this.ctx.emit("cellMouseleave", this.ctx.hoverCell, t), this.ctx.hoverCell === h) return;
|
|
2526
|
+
((o = this.ctx.hoverCell) == null ? void 0 : o.rowKey) !== h.rowKey && (this.ctx.hoverCell = h, this.ctx.hoverRow = this.ctx.body.renderRows.find((x) => x.rowKey === h.rowKey), this.ctx.emit("rowHoverChange", this.ctx.hoverRow, h, t), this.ctx.emit("draw")), this.ctx.hoverCell = h, this.ctx.emit("cellHoverChange", h, t);
|
|
2527
2527
|
return;
|
|
2528
2528
|
}
|
|
2529
2529
|
}
|
|
@@ -2558,10 +2558,10 @@ class si {
|
|
|
2558
2558
|
colIndex: t.colIndex,
|
|
2559
2559
|
column: t.column,
|
|
2560
2560
|
value: t.getValue()
|
|
2561
|
-
}).then((
|
|
2562
|
-
this.ctx.database.setExpandChildren(t.rowKey,
|
|
2563
|
-
}).catch((
|
|
2564
|
-
this.ctx.database.expandLoading(t.rowKey, !1), console.error(
|
|
2561
|
+
}).then((l) => {
|
|
2562
|
+
this.ctx.database.setExpandChildren(t.rowKey, l), this.ctx.database.expandLoading(t.rowKey, !1);
|
|
2563
|
+
}).catch((l) => {
|
|
2564
|
+
this.ctx.database.expandLoading(t.rowKey, !1), console.error(l);
|
|
2565
2565
|
}));
|
|
2566
2566
|
else {
|
|
2567
2567
|
const n = this.ctx.database.getIsExpand(t.rowKey);
|
|
@@ -2715,7 +2715,7 @@ class ri {
|
|
|
2715
2715
|
for (let r = 0; r <= e[1] - e[0]; r++) {
|
|
2716
2716
|
const o = [];
|
|
2717
2717
|
for (let n = 0; n <= i[1] - i[0]; n++) {
|
|
2718
|
-
const
|
|
2718
|
+
const l = r + e[0], h = n + i[0], d = this.database.getItemValueForRowIndexAndColIndex(l, h);
|
|
2719
2719
|
d && o.push(d.value);
|
|
2720
2720
|
}
|
|
2721
2721
|
s += `${o.join(" ")}\r`, t.push(o);
|
|
@@ -2788,8 +2788,8 @@ class Wt {
|
|
|
2788
2788
|
// 滚动条的长度
|
|
2789
2789
|
c(this, "visibleDistance", 0);
|
|
2790
2790
|
//可见区域的长度
|
|
2791
|
-
c(this, "
|
|
2792
|
-
c(this, "
|
|
2791
|
+
c(this, "clientX", 0);
|
|
2792
|
+
c(this, "clientY", 0);
|
|
2793
2793
|
c(this, "dragStart", 0);
|
|
2794
2794
|
// 拖拽开始的位置
|
|
2795
2795
|
c(this, "isDragging", !1);
|
|
@@ -2800,26 +2800,26 @@ class Wt {
|
|
|
2800
2800
|
this.updateScroll(t);
|
|
2801
2801
|
}
|
|
2802
2802
|
onMouseDown(t) {
|
|
2803
|
-
const { offsetX: e, offsetY: i } = t;
|
|
2804
|
-
if (!(
|
|
2803
|
+
const { offsetX: e, offsetY: i, clientX: s, clientY: r } = t;
|
|
2804
|
+
if (!(s == this.clientX && r == this.clientY)) {
|
|
2805
2805
|
if (this.isOnScrollbar(e, i))
|
|
2806
|
-
this.
|
|
2806
|
+
this.clientX = s, this.clientY = r, this.isDragging = !0, this.ctx.scrollerMove = !0, this.isFocus = !0, this.dragStart = this.scroll;
|
|
2807
2807
|
else if (this.isOnTrack(e, i)) {
|
|
2808
|
-
let
|
|
2809
|
-
this.type === "vertical" ?
|
|
2808
|
+
let o = 0;
|
|
2809
|
+
this.type === "vertical" ? o = (i - this.ctx.header.height - this.barHeight / 2) / (this.visibleDistance - this.barHeight) * this.distance : o = (e - this.barWidth / 2) / (this.visibleDistance - this.barWidth) * this.distance, this.scroll = Math.max(0, Math.min(o, this.distance));
|
|
2810
2810
|
}
|
|
2811
2811
|
}
|
|
2812
2812
|
}
|
|
2813
2813
|
onMouseUp() {
|
|
2814
|
-
this.isDragging = !1, this.isFocus = !1, this.
|
|
2814
|
+
this.isDragging = !1, this.isFocus = !1, this.clientX = 0, this.clientY = 0;
|
|
2815
2815
|
}
|
|
2816
2816
|
onMouseMove(t) {
|
|
2817
|
-
const { offsetX: e, offsetY: i } = t;
|
|
2818
|
-
if (this.isOnScrollbar(e, i) && t.target === this.ctx.target ? this.isFocus = !0 : this.isFocus = !1,
|
|
2819
|
-
let
|
|
2820
|
-
if (this.type === "horizontal" ?
|
|
2821
|
-
let
|
|
2822
|
-
this.type === "vertical" ?
|
|
2817
|
+
const { offsetX: e, offsetY: i, clientX: s, clientY: r } = t;
|
|
2818
|
+
if (this.isOnScrollbar(e, i) && t.target === this.ctx.target ? this.isFocus = !0 : this.isFocus = !1, s == this.clientX && r == this.clientY) return;
|
|
2819
|
+
let o = 0;
|
|
2820
|
+
if (this.type === "horizontal" ? o = s - this.clientX : o = r - this.clientY, this.isDragging && o !== 0) {
|
|
2821
|
+
let n = 0;
|
|
2822
|
+
this.type === "vertical" ? n = this.dragStart + o / (this.visibleDistance - this.barHeight) * this.distance : n = this.dragStart + o / (this.visibleDistance - this.barWidth) * this.distance, this.scroll = Math.max(0, Math.min(n, this.distance));
|
|
2823
2823
|
}
|
|
2824
2824
|
}
|
|
2825
2825
|
isPointInElement(t, e, i, s, r, o) {
|
|
@@ -2832,29 +2832,28 @@ class Wt {
|
|
|
2832
2832
|
return this.isPointInElement(t, e, this.trackX, this.trackY, this.trackWidth, this.trackHeight);
|
|
2833
2833
|
}
|
|
2834
2834
|
updateScroll(t) {
|
|
2835
|
-
t.preventDefault();
|
|
2836
2835
|
const e = t.deltaX, i = t.deltaY;
|
|
2837
|
-
this.type === "vertical" && t.shiftKey === !1 ? this.scroll = Math.max(0, Math.min(this.scroll + i, this.distance)) : this.type === "horizontal" && (t.shiftKey ? this.scroll = Math.max(0, Math.min(this.scroll + i, this.distance)) : this.scroll = Math.max(0, Math.min(this.scroll + e, this.distance)));
|
|
2836
|
+
this.type === "vertical" && t.shiftKey === !1 ? (this.scroll === 0 && i < 0 || this.scroll === this.distance && i > 0 || t.preventDefault(), this.scroll = Math.max(0, Math.min(this.scroll + i, this.distance))) : this.type === "horizontal" && (t.shiftKey ? (console.log("jinlai"), this.scroll = Math.max(0, Math.min(this.scroll + i, this.distance))) : this.scroll = Math.max(0, Math.min(this.scroll + e, this.distance)));
|
|
2838
2837
|
}
|
|
2839
2838
|
updatedSize() {
|
|
2840
2839
|
const {
|
|
2841
2840
|
body: t,
|
|
2842
2841
|
header: e,
|
|
2843
2842
|
config: { SCROLLER_TRACK_SIZE: i = 0, SCROLLER_SIZE: s = 0 }
|
|
2844
|
-
} = this.ctx, r = this.ctx.target.width + 1, o = this.ctx.target.height, n = e.height,
|
|
2843
|
+
} = this.ctx, r = this.ctx.target.width + 1, o = this.ctx.target.height, n = e.height, l = e.width, h = t.height, d = this.ctx.footer.height;
|
|
2845
2844
|
if (this.type === "vertical") {
|
|
2846
|
-
this.visibleDistance = o - i - n, this.distance =
|
|
2847
|
-
const f = this.distance ? this.visibleDistance /
|
|
2845
|
+
this.visibleDistance = o - i - n, this.distance = h - this.visibleDistance + d, this.trackX = r - i, this.trackY = 0, this.splitPoints = [this.trackX, n, this.trackX + i, n], this.trackWidth = i, this.trackHeight = o, this.barX = this.trackX + (i - s) / 2, this.barWidth = s;
|
|
2846
|
+
const f = this.distance ? this.visibleDistance / h : 0;
|
|
2848
2847
|
let x = Math.floor(f * this.visibleDistance);
|
|
2849
2848
|
x < 30 ? x = 30 : x > this.visibleDistance && (x = 0), this.barHeight = x, this.barY = n + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
2850
2849
|
} else {
|
|
2851
|
-
this.visibleDistance = r - i, this.distance =
|
|
2850
|
+
this.visibleDistance = r - i, this.distance = l - this.visibleDistance, this.splitPoints = [
|
|
2852
2851
|
r - i,
|
|
2853
2852
|
o - i,
|
|
2854
2853
|
r - i,
|
|
2855
2854
|
o
|
|
2856
2855
|
], this.trackX = 0, this.trackY = o - i, this.trackWidth = r, this.trackHeight = i;
|
|
2857
|
-
const f = this.distance ? this.visibleDistance /
|
|
2856
|
+
const f = this.distance ? this.visibleDistance / l : 0;
|
|
2858
2857
|
let x = Math.floor(f * this.visibleDistance);
|
|
2859
2858
|
this.barY = this.trackY + 0.5 + (i - s) / 2, x < 30 ? x = 30 : x >= this.visibleDistance && (x = 0), this.barWidth = x, this.barHeight = s, this.barX = this.scroll / this.distance * (this.visibleDistance - this.barWidth), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
|
|
2860
2859
|
}
|
|
@@ -2992,17 +2991,17 @@ class ni {
|
|
|
2992
2991
|
const d = this.visibleWidth - this.width, f = Math.floor(d / this.resizeNum * 100) / 100;
|
|
2993
2992
|
this.resizeAllColumn(f);
|
|
2994
2993
|
}
|
|
2995
|
-
const
|
|
2994
|
+
const l = this.fixedLeftCellHeaders.filter(
|
|
2996
2995
|
(d) => !d.hasChildren
|
|
2997
2996
|
);
|
|
2998
|
-
this.ctx.fixedLeftWidth =
|
|
2997
|
+
this.ctx.fixedLeftWidth = l.reduce(
|
|
2999
2998
|
(d, f) => d + f.width,
|
|
3000
2999
|
0
|
|
3001
3000
|
);
|
|
3002
|
-
const
|
|
3001
|
+
const h = this.fixedRightCellHeaders.filter(
|
|
3003
3002
|
(d) => !d.hasChildren
|
|
3004
3003
|
);
|
|
3005
|
-
this.ctx.fixedRightWidth =
|
|
3004
|
+
this.ctx.fixedRightWidth = h.reduce(
|
|
3006
3005
|
(d, f) => d + f.width,
|
|
3007
3006
|
e
|
|
3008
3007
|
), this.ctx.maxColIndex = this.leafCellHeaders.length - 1, this.ctx.header.x = this.x, this.ctx.header.y = this.y, this.ctx.header.width = this.width, this.ctx.header.height = this.height, this.ctx.header.visibleWidth = this.visibleWidth, this.ctx.header.visibleHeight = this.visibleHeight;
|
|
@@ -3035,8 +3034,8 @@ class ni {
|
|
|
3035
3034
|
...this.renderCenterCellHeaders
|
|
3036
3035
|
];
|
|
3037
3036
|
for (const o of r) {
|
|
3038
|
-
const n = e.layerX,
|
|
3039
|
-
n >
|
|
3037
|
+
const n = e.layerX, l = o.getDrawX();
|
|
3038
|
+
n > l + o.width - 5 && n < l + o.width + 4 && n < i.width - 4 && // 视窗中最后一列不允许调整宽
|
|
3040
3039
|
o.colspan <= 1 && e.target instanceof HTMLCanvasElement && this.ctx.isTarget(e.target) && e.layerY <= this.height && (this.ctx.target.style.cursor = "col-resize", this.resizeTarget = o);
|
|
3041
3040
|
}
|
|
3042
3041
|
}
|
|
@@ -3091,16 +3090,16 @@ class ni {
|
|
|
3091
3090
|
let s = e;
|
|
3092
3091
|
const { HEADER_HEIGHT: r = 0 } = this.ctx.config;
|
|
3093
3092
|
for (let o = 0; o < i; o++) {
|
|
3094
|
-
const n = t[o],
|
|
3093
|
+
const n = t[o], l = r * (n.rowspan || 1), h = r * n.level;
|
|
3095
3094
|
let d = n.width || 100;
|
|
3096
3095
|
n.children && (d = It(n.children).reduce((u, y) => u + ((y == null ? void 0 : y.width) || 100), 0));
|
|
3097
3096
|
const f = new te(
|
|
3098
3097
|
this.ctx,
|
|
3099
3098
|
this.columnIndex,
|
|
3100
3099
|
s,
|
|
3101
|
-
l,
|
|
3102
|
-
d,
|
|
3103
3100
|
h,
|
|
3101
|
+
d,
|
|
3102
|
+
l,
|
|
3104
3103
|
n
|
|
3105
3104
|
);
|
|
3106
3105
|
this.ctx.database.setHeader(n.key, f), this.allCellHeaders.push(f), n.children || (this.leafCellHeaders.push(f), f.column.widthFillDisable || this.resizeNum++), n.fixed === "left" ? this.fixedLeftCellHeaders.push(f) : n.fixed === "right" ? this.fixedRightCellHeaders.push(f) : this.centerCellHeaders.push(f), !n.children && this.columnIndex++, n.children && this.render(n.children, s), s += d;
|
|
@@ -3134,8 +3133,8 @@ class ni {
|
|
|
3134
3133
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3135
3134
|
colorEnd: "rgba(0,0,0,0)"
|
|
3136
3135
|
}), i < Math.floor(s.width - s.visibleWidth - 1) && e !== n) {
|
|
3137
|
-
const
|
|
3138
|
-
this.ctx.paint.drawShadow(
|
|
3136
|
+
const l = s.width - (this.x + this.width) + r.width - e;
|
|
3137
|
+
this.ctx.paint.drawShadow(l + 1, this.y, e, this.height, {
|
|
3139
3138
|
fillColor: o,
|
|
3140
3139
|
side: "left",
|
|
3141
3140
|
shadowWidth: 4,
|
|
@@ -3169,7 +3168,7 @@ class ni {
|
|
|
3169
3168
|
}
|
|
3170
3169
|
}
|
|
3171
3170
|
class ee {
|
|
3172
|
-
constructor(t, e, i = 0, s = 0, r = 0, o = 0, n,
|
|
3171
|
+
constructor(t, e, i = 0, s = 0, r = 0, o = 0, n, l = "body") {
|
|
3173
3172
|
c(this, "ctx");
|
|
3174
3173
|
c(this, "x", 0);
|
|
3175
3174
|
c(this, "y", 0);
|
|
@@ -3182,7 +3181,7 @@ class ee {
|
|
|
3182
3181
|
c(this, "rowKey", "");
|
|
3183
3182
|
c(this, "rowType", "body");
|
|
3184
3183
|
c(this, "data");
|
|
3185
|
-
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 =
|
|
3184
|
+
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 = n, this.update();
|
|
3186
3185
|
}
|
|
3187
3186
|
update() {
|
|
3188
3187
|
const { header: t } = this.ctx, e = [], i = [], s = [];
|
|
@@ -3256,8 +3255,8 @@ class ai {
|
|
|
3256
3255
|
SCROLLER_TRACK_SIZE: r = 0,
|
|
3257
3256
|
BORDER_COLOR: o,
|
|
3258
3257
|
BORDER_RADIUS: n,
|
|
3259
|
-
HEIGHT:
|
|
3260
|
-
EMPTY_BODY_HEIGHT:
|
|
3258
|
+
HEIGHT: l,
|
|
3259
|
+
EMPTY_BODY_HEIGHT: h = 0,
|
|
3261
3260
|
MAX_HEIGHT: d = 0,
|
|
3262
3261
|
ENABLE_OFFSET_HEIGHT: f = 0,
|
|
3263
3262
|
OFFSET_HEIGHT: x = 0
|
|
@@ -3271,7 +3270,7 @@ class ai {
|
|
|
3271
3270
|
const { top: g } = t.getBoundingClientRect();
|
|
3272
3271
|
this.width = e.width, this.visibleWidth = t.width - r;
|
|
3273
3272
|
const w = this.ctx.footer.height;
|
|
3274
|
-
this.data.length || (this.height =
|
|
3273
|
+
this.data.length || (this.height = h);
|
|
3275
3274
|
const p = this.data.length ? "not-empty" : "empty";
|
|
3276
3275
|
this.ctx.emit("emptyChange", {
|
|
3277
3276
|
isEmpty: p,
|
|
@@ -3280,14 +3279,14 @@ class ai {
|
|
|
3280
3279
|
bodyHeight: this.height,
|
|
3281
3280
|
footerHeight: w,
|
|
3282
3281
|
width: this.width,
|
|
3283
|
-
height: this.data.length ? 0 :
|
|
3282
|
+
height: this.data.length ? 0 : h + w
|
|
3284
3283
|
});
|
|
3285
3284
|
let E = this.height + e.height + r;
|
|
3286
3285
|
E += w;
|
|
3287
3286
|
let m = 0;
|
|
3288
3287
|
this.data.length && f ? (m = window.innerHeight - g - x, m < 0 && (m = 32, console.error(
|
|
3289
3288
|
"There is an error in the height calculation ENABLE_OFFSET_HEIGHT and OFFSET_HEIGHT are invalid"
|
|
3290
|
-
))) : this.data.length &&
|
|
3289
|
+
))) : this.data.length && l ? m = l : this.data.length && d && E > d ? m = d : m = E, m > 0 && (this.ctx.target.height = m);
|
|
3291
3290
|
let b = t.height - e.height - r;
|
|
3292
3291
|
s ? this.visibleHeight = b - w : 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 = u, this.ctx.target.setAttribute(
|
|
3293
3292
|
"style",
|
|
@@ -3313,19 +3312,19 @@ class ai {
|
|
|
3313
3312
|
config: { RESIZE_ROW_MIN_HEIGHT: n = 0 }
|
|
3314
3313
|
} = this.ctx;
|
|
3315
3314
|
if (this.isResizing && this.resizeTarget) {
|
|
3316
|
-
const
|
|
3317
|
-
let
|
|
3318
|
-
|
|
3315
|
+
const l = this.resizeTarget.height;
|
|
3316
|
+
let h = i - this.offsetY;
|
|
3317
|
+
h + l < n && (h = -(l - n)), this.resizeDiff = h, this.ctx.emit("draw");
|
|
3319
3318
|
} else {
|
|
3320
3319
|
if (this.resizeTarget = null, this.isMouseDown || this.ctx.target.style.cursor === "crosshair")
|
|
3321
3320
|
return;
|
|
3322
3321
|
this.ctx.target.style.cursor === "row-resize" && (this.ctx.target.style.cursor = "default");
|
|
3323
|
-
for (let
|
|
3324
|
-
const
|
|
3325
|
-
if (i >
|
|
3326
|
-
for (let f = 0; f <
|
|
3327
|
-
const x =
|
|
3328
|
-
s > x.drawX + 10 && s < x.drawX + x.width - 10 && x.rowspan === 1 && (this.ctx.target.style.cursor = "row-resize", this.resizeTarget =
|
|
3322
|
+
for (let l = 0; l < this.renderRows.length; l++) {
|
|
3323
|
+
const h = this.renderRows[l];
|
|
3324
|
+
if (i > h.y - o + h.height - 1.5 && i < h.y - o + h.height + 1.5 && i < r.height - 4)
|
|
3325
|
+
for (let f = 0; f < h.cells.length; f++) {
|
|
3326
|
+
const x = h.cells[f];
|
|
3327
|
+
s > x.drawX + 10 && s < x.drawX + x.width - 10 && x.rowspan === 1 && (this.ctx.target.style.cursor = "row-resize", this.resizeTarget = h);
|
|
3329
3328
|
}
|
|
3330
3329
|
}
|
|
3331
3330
|
}
|
|
@@ -3371,8 +3370,8 @@ class ai {
|
|
|
3371
3370
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3372
3371
|
colorEnd: "rgba(0,0,0,0)"
|
|
3373
3372
|
}), i < Math.floor(s.width - s.visibleWidth - 1) && e !== n) {
|
|
3374
|
-
const
|
|
3375
|
-
this.ctx.paint.drawShadow(
|
|
3373
|
+
const l = s.width - (this.x + this.width) + r.width - e;
|
|
3374
|
+
this.ctx.paint.drawShadow(l + 1, this.y, e, this.height, {
|
|
3376
3375
|
fillColor: o,
|
|
3377
3376
|
side: "left",
|
|
3378
3377
|
shadowWidth: 4,
|
|
@@ -3396,14 +3395,14 @@ class ai {
|
|
|
3396
3395
|
const { header: t, database: e, scrollY: i } = this.ctx, s = i, { data: r, positions: o } = e.getData();
|
|
3397
3396
|
this.ctx.maxRowIndex = r.length - 1;
|
|
3398
3397
|
const n = this.binarySearch(o, s);
|
|
3399
|
-
let
|
|
3400
|
-
|
|
3401
|
-
const
|
|
3398
|
+
let l = this.binarySearch(o, s + this.visibleHeight);
|
|
3399
|
+
l === -1 && (l = r.length), this.headIndex = Math.max(0, n), 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;
|
|
3400
|
+
const h = [];
|
|
3402
3401
|
for (let d = 0; d < this.visibleRows.length; d++) {
|
|
3403
3402
|
const f = this.headIndex + d, x = this.visibleRows[d], { height: u, top: y } = this.ctx.database.getPositionForRowIndex(f), g = new ee(this.ctx, f, 0, y + this.y, t.width, u, x);
|
|
3404
|
-
|
|
3403
|
+
h.push(g);
|
|
3405
3404
|
}
|
|
3406
|
-
this.renderRows =
|
|
3405
|
+
this.renderRows = h, this.ctx.body.renderRows = h;
|
|
3407
3406
|
}
|
|
3408
3407
|
draw() {
|
|
3409
3408
|
this.renderRows.forEach((t) => {
|
|
@@ -3444,16 +3443,16 @@ class ci {
|
|
|
3444
3443
|
target: r,
|
|
3445
3444
|
config: { HEADER_BG_COLOR: o, SCROLLER_TRACK_SIZE: n }
|
|
3446
3445
|
} = this.ctx;
|
|
3447
|
-
let
|
|
3448
|
-
if (this.ctx.config.FOOTER_FIXED || (
|
|
3446
|
+
let l = this.y;
|
|
3447
|
+
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, {
|
|
3449
3448
|
fillColor: o,
|
|
3450
3449
|
side: "right",
|
|
3451
3450
|
shadowWidth: 4,
|
|
3452
3451
|
colorStart: "rgba(0,0,0,0.1)",
|
|
3453
3452
|
colorEnd: "rgba(0,0,0,0)"
|
|
3454
3453
|
}), i < Math.floor(s.width - s.visibleWidth - 1) && e !== n) {
|
|
3455
|
-
const
|
|
3456
|
-
this.ctx.paint.drawShadow(
|
|
3454
|
+
const h = s.width - (this.x + this.width) + r.width - e;
|
|
3455
|
+
this.ctx.paint.drawShadow(h + 1, l, e, this.height, {
|
|
3457
3456
|
fillColor: o,
|
|
3458
3457
|
side: "left",
|
|
3459
3458
|
shadowWidth: 4,
|
|
@@ -3489,7 +3488,7 @@ class ci {
|
|
|
3489
3488
|
});
|
|
3490
3489
|
}
|
|
3491
3490
|
}
|
|
3492
|
-
class
|
|
3491
|
+
class li {
|
|
3493
3492
|
// 垂直滚动定时器
|
|
3494
3493
|
constructor(t) {
|
|
3495
3494
|
c(this, "isCut", !1);
|
|
@@ -3619,8 +3618,8 @@ class hi {
|
|
|
3619
3618
|
return;
|
|
3620
3619
|
const { ENABLE_SELECTOR_ALL_ROWS: t, ENABLE_SELECTOR_ALL_COLS: e } = this.ctx.config;
|
|
3621
3620
|
if (t && e) {
|
|
3622
|
-
const s = this.ctx.maxColIndex, r = 0, o = this.ctx.maxRowIndex, n = [1, s],
|
|
3623
|
-
this.setSelector(n,
|
|
3621
|
+
const s = this.ctx.maxColIndex, r = 0, o = this.ctx.maxRowIndex, n = [1, s], l = [r, o];
|
|
3622
|
+
this.setSelector(n, l);
|
|
3624
3623
|
}
|
|
3625
3624
|
}
|
|
3626
3625
|
selectRows(t, e = !0) {
|
|
@@ -3648,7 +3647,7 @@ class hi {
|
|
|
3648
3647
|
return;
|
|
3649
3648
|
const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
|
|
3650
3649
|
if (t && e && i) {
|
|
3651
|
-
const { rowIndex: s, colIndex: r } = e, o = Math.min(i.colIndex, r), n = Math.max(i.colIndex, r),
|
|
3650
|
+
const { rowIndex: s, colIndex: r } = e, o = Math.min(i.colIndex, r), n = Math.max(i.colIndex, r), l = Math.min(i.rowIndex, s), h = Math.max(i.rowIndex, s), d = [o, n], f = [l, h];
|
|
3652
3651
|
this.setSelector(d, f);
|
|
3653
3652
|
}
|
|
3654
3653
|
}
|
|
@@ -3656,7 +3655,7 @@ class hi {
|
|
|
3656
3655
|
const { focusCell: e, clickCell: i } = this.ctx;
|
|
3657
3656
|
if (e)
|
|
3658
3657
|
if (this.ctx.selector.enable = !0, i && t) {
|
|
3659
|
-
const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: n } = e,
|
|
3658
|
+
const { colIndex: s, rowIndex: r } = i, { colIndex: o, rowIndex: n } = e, l = Math.min(o, s), h = Math.max(o, s), d = Math.min(n, r), f = Math.max(n, r), x = [l, h], u = [d, f];
|
|
3660
3659
|
this.setSelector(x, u);
|
|
3661
3660
|
} else {
|
|
3662
3661
|
this.ctx.emit("cellSelectedClick", e);
|
|
@@ -3693,8 +3692,8 @@ class hi {
|
|
|
3693
3692
|
let s = [];
|
|
3694
3693
|
const r = /* @__PURE__ */ new Set();
|
|
3695
3694
|
for (let n = 0; n <= e[1] - e[0]; n++)
|
|
3696
|
-
for (let
|
|
3697
|
-
const
|
|
3695
|
+
for (let l = 0; l <= t[1] - t[0]; l++) {
|
|
3696
|
+
const h = n + e[0], d = l + t[0], f = this.ctx.database.getItemValueForRowIndexAndColIndex(h, d);
|
|
3698
3697
|
if (f) {
|
|
3699
3698
|
const { rowKey: x, key: u } = f;
|
|
3700
3699
|
this.ctx.database.getReadonly(x, u) || (r.add(x), s.push({
|
|
@@ -3729,7 +3728,7 @@ class hi {
|
|
|
3729
3728
|
const n = r.split("\r");
|
|
3730
3729
|
n.length === 1 ? o = n[0].split(`
|
|
3731
3730
|
`).map((f) => f.split(" ")) : o = n.map((d) => d.split(" "));
|
|
3732
|
-
let
|
|
3731
|
+
let l = [];
|
|
3733
3732
|
for (let d = 0; d <= o.length - 1; d++) {
|
|
3734
3733
|
const f = o[d].length;
|
|
3735
3734
|
for (let x = 0; x <= f - 1; x++) {
|
|
@@ -3739,7 +3738,7 @@ class hi {
|
|
|
3739
3738
|
);
|
|
3740
3739
|
if (w) {
|
|
3741
3740
|
const { rowKey: p, key: E } = w;
|
|
3742
|
-
this.ctx.database.getReadonly(p, E) || (s.add(p),
|
|
3741
|
+
this.ctx.database.getReadonly(p, E) || (s.add(p), l.push({
|
|
3743
3742
|
rowKey: p,
|
|
3744
3743
|
key: E,
|
|
3745
3744
|
value: g,
|
|
@@ -3755,18 +3754,18 @@ class hi {
|
|
|
3755
3754
|
this.ctx.selector.yArrCopy,
|
|
3756
3755
|
!0
|
|
3757
3756
|
// 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
|
|
3758
|
-
), f =
|
|
3757
|
+
), f = l.map((x) => `${x.rowKey}-${x.key}`);
|
|
3759
3758
|
d.forEach((x) => {
|
|
3760
|
-
f.includes(`${x.rowKey}-${x.key}`) ||
|
|
3759
|
+
f.includes(`${x.rowKey}-${x.key}`) || l.unshift(x);
|
|
3761
3760
|
}), this.isCut = !1;
|
|
3762
3761
|
}
|
|
3763
|
-
if (!
|
|
3762
|
+
if (!l.length)
|
|
3764
3763
|
return;
|
|
3765
|
-
this.ctx.database.batchSetItemValue(
|
|
3766
|
-
let
|
|
3764
|
+
this.ctx.database.batchSetItemValue(l, !0);
|
|
3765
|
+
let h = [];
|
|
3767
3766
|
s.forEach((d) => {
|
|
3768
|
-
|
|
3769
|
-
}), this.ctx.emit("pasteChange",
|
|
3767
|
+
h.push(this.ctx.database.getRowDataItemForRowKey(d));
|
|
3768
|
+
}), this.ctx.emit("pasteChange", l, h), this.clearCopyLine(), this.ctx.emit("draw");
|
|
3770
3769
|
}).catch((r) => {
|
|
3771
3770
|
console.error("获取剪贴板内容失败:", r);
|
|
3772
3771
|
});
|
|
@@ -3782,7 +3781,7 @@ class hi {
|
|
|
3782
3781
|
if (!e)
|
|
3783
3782
|
return;
|
|
3784
3783
|
let { colIndex: i = 0, rowIndex: s = 0 } = e;
|
|
3785
|
-
const r = 0, o = 0, n = this.ctx.maxColIndex,
|
|
3784
|
+
const r = 0, o = 0, n = this.ctx.maxColIndex, l = this.ctx.maxRowIndex;
|
|
3786
3785
|
switch (t) {
|
|
3787
3786
|
case "LEFT":
|
|
3788
3787
|
i > r && i--;
|
|
@@ -3794,16 +3793,16 @@ class hi {
|
|
|
3794
3793
|
i < n && i++;
|
|
3795
3794
|
break;
|
|
3796
3795
|
case "BOTTOM":
|
|
3797
|
-
s <
|
|
3796
|
+
s < l && s++;
|
|
3798
3797
|
break;
|
|
3799
3798
|
}
|
|
3800
|
-
const
|
|
3799
|
+
const h = [i, i], d = [s, s], f = this.getCell(s, i);
|
|
3801
3800
|
if (f) {
|
|
3802
3801
|
if (["index", "index-selection", "selection"].includes(f.type))
|
|
3803
3802
|
return;
|
|
3804
3803
|
this.ctx.setFocusCell(f);
|
|
3805
3804
|
}
|
|
3806
|
-
this.setSelector(
|
|
3805
|
+
this.setSelector(h, d), this.adjustBoundaryPosition(), this.ctx.emit("draw");
|
|
3807
3806
|
}
|
|
3808
3807
|
stopAdjustPosition() {
|
|
3809
3808
|
this.adjustPositionX = "", this.adjustPositionY = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerY && (clearInterval(this.timerY), this.timerY = 0);
|
|
@@ -3819,8 +3818,8 @@ class hi {
|
|
|
3819
3818
|
let n = 10 * (s === "left" ? -1 : 1);
|
|
3820
3819
|
this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
|
|
3821
3820
|
n *= 1.5;
|
|
3822
|
-
const { scrollX:
|
|
3823
|
-
(
|
|
3821
|
+
const { scrollX: l } = this.ctx, h = l + n;
|
|
3822
|
+
(h < 0 || h > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(h);
|
|
3824
3823
|
}, 100);
|
|
3825
3824
|
}
|
|
3826
3825
|
if (r && this.adjustPositionY !== r) {
|
|
@@ -3828,8 +3827,8 @@ class hi {
|
|
|
3828
3827
|
let n = 10 * (r === "top" ? -1 : 1);
|
|
3829
3828
|
this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
|
|
3830
3829
|
n *= 1.5;
|
|
3831
|
-
const { scrollY:
|
|
3832
|
-
(
|
|
3830
|
+
const { scrollY: l } = this.ctx, h = l + n;
|
|
3831
|
+
(h < 0 || h > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(h);
|
|
3833
3832
|
}, 100);
|
|
3834
3833
|
}
|
|
3835
3834
|
}
|
|
@@ -3837,20 +3836,20 @@ class hi {
|
|
|
3837
3836
|
* 调整滚动条位置,让焦点单元格始终出现在可视区域内
|
|
3838
3837
|
*/
|
|
3839
3838
|
adjustBoundaryPosition() {
|
|
3840
|
-
const { target: t, focusCell: e, fixedRightWidth: i, fixedLeftWidth: s, header: r, footer: o, scrollX: n, scrollY:
|
|
3839
|
+
const { target: t, focusCell: e, fixedRightWidth: i, fixedLeftWidth: s, header: r, footer: o, scrollX: n, scrollY: l } = this.ctx;
|
|
3841
3840
|
if (!e)
|
|
3842
3841
|
return;
|
|
3843
|
-
const { SCROLLER_TRACK_SIZE:
|
|
3842
|
+
const { SCROLLER_TRACK_SIZE: h = 0, FOOTER_FIXED: d } = this.ctx.config;
|
|
3844
3843
|
let f = 0;
|
|
3845
3844
|
d && (f = o.visibleHeight);
|
|
3846
|
-
const x = s - e.drawX + 1, u = e.drawX + e.width - (t.width - i) + 1, y = r.height - e.drawY, g = e.drawY + e.height - (t.height - f -
|
|
3847
|
-
u > 0 && !e.fixed ? this.ctx.setScrollX(n + u) : x > 0 && !e.fixed && this.ctx.setScrollX(n - x), y > 0 ? this.ctx.setScrollY(
|
|
3845
|
+
const x = s - e.drawX + 1, u = e.drawX + e.width - (t.width - i) + 1, y = r.height - e.drawY, g = e.drawY + e.height - (t.height - f - h);
|
|
3846
|
+
u > 0 && !e.fixed ? this.ctx.setScrollX(n + u) : x > 0 && !e.fixed && this.ctx.setScrollX(n - x), y > 0 ? this.ctx.setScrollY(l - y) : g > 0 && this.ctx.setScrollY(l + g);
|
|
3848
3847
|
}
|
|
3849
3848
|
destroy() {
|
|
3850
3849
|
this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
|
|
3851
3850
|
}
|
|
3852
3851
|
}
|
|
3853
|
-
class
|
|
3852
|
+
class hi {
|
|
3854
3853
|
constructor(t) {
|
|
3855
3854
|
c(this, "ctx");
|
|
3856
3855
|
this.ctx = t, this.init();
|
|
@@ -3858,9 +3857,9 @@ class li {
|
|
|
3858
3857
|
init() {
|
|
3859
3858
|
this.ctx.on("cellMouseenter", (t, e) => {
|
|
3860
3859
|
this.ctx.target.style.cursor === "crosshair" && (this.ctx.target.style.cursor = "default");
|
|
3861
|
-
const { xArr: i, yArr: s } = this.ctx.selector, r = i[1], o = s[1], { colIndex: n, rowIndex:
|
|
3862
|
-
if (this.ctx.config.ENABLE_AUTOFILL && n === r &&
|
|
3863
|
-
const y =
|
|
3860
|
+
const { xArr: i, yArr: s } = this.ctx.selector, r = i[1], o = s[1], { colIndex: n, rowIndex: l, drawX: h, drawY: d, width: f, height: x } = t;
|
|
3861
|
+
if (this.ctx.config.ENABLE_AUTOFILL && n === r && l === o) {
|
|
3862
|
+
const y = h + f - 6, g = d + x - 6;
|
|
3864
3863
|
e.offsetX > y && e.offsetY > g && (this.ctx.target.style.cursor = "crosshair");
|
|
3865
3864
|
}
|
|
3866
3865
|
this.mouseenter(t);
|
|
@@ -3896,12 +3895,12 @@ class li {
|
|
|
3896
3895
|
return;
|
|
3897
3896
|
let o = t, n = e;
|
|
3898
3897
|
if (!r) {
|
|
3899
|
-
const [
|
|
3900
|
-
n = [
|
|
3898
|
+
const [l] = n;
|
|
3899
|
+
n = [l, l];
|
|
3901
3900
|
}
|
|
3902
3901
|
if (!s) {
|
|
3903
|
-
const [
|
|
3904
|
-
o = [
|
|
3902
|
+
const [l] = o;
|
|
3903
|
+
o = [l, l];
|
|
3905
3904
|
}
|
|
3906
3905
|
(JSON.stringify(this.ctx.autofill.xArr) !== JSON.stringify(o) || JSON.stringify(this.ctx.autofill.yArr) !== JSON.stringify(n)) && (this.ctx.autofill.xArr = o, this.ctx.autofill.yArr = n, this.ctx.emit("setAutofill", this.ctx.autofill), this.ctx.emit("draw"));
|
|
3907
3906
|
}
|
|
@@ -3915,17 +3914,17 @@ class li {
|
|
|
3915
3914
|
const u = f + e.yArr[0], y = x + e.xArr[0];
|
|
3916
3915
|
i.set(`${u}-${y}`, !0);
|
|
3917
3916
|
}
|
|
3918
|
-
const { value: s } = e, r = s[0].length, o = s.length, n = this.ctx.autofill.xArr,
|
|
3919
|
-
let
|
|
3920
|
-
for (let f = 0; f <=
|
|
3917
|
+
const { value: s } = e, r = s[0].length, o = s.length, n = this.ctx.autofill.xArr, l = this.ctx.autofill.yArr;
|
|
3918
|
+
let h = [];
|
|
3919
|
+
for (let f = 0; f <= l[1] - l[0]; f++)
|
|
3921
3920
|
for (let x = 0; x <= n[1] - n[0]; x++) {
|
|
3922
|
-
const u = x + n[0], y = f +
|
|
3921
|
+
const u = x + n[0], y = f + l[0], g = s[f % o][x % r], w = this.ctx.database.getItemValueForRowIndexAndColIndex(
|
|
3923
3922
|
y,
|
|
3924
3923
|
u
|
|
3925
3924
|
), p = `${y}-${u}`;
|
|
3926
3925
|
if (w && !i.has(p)) {
|
|
3927
3926
|
const { rowKey: E, key: m } = w;
|
|
3928
|
-
this.ctx.database.getReadonly(E, m) || (t.add(E),
|
|
3927
|
+
this.ctx.database.getReadonly(E, m) || (t.add(E), h.push({
|
|
3929
3928
|
rowKey: E,
|
|
3930
3929
|
key: m,
|
|
3931
3930
|
value: g,
|
|
@@ -3933,13 +3932,13 @@ class li {
|
|
|
3933
3932
|
}));
|
|
3934
3933
|
}
|
|
3935
3934
|
}
|
|
3936
|
-
if (!
|
|
3935
|
+
if (!h.length)
|
|
3937
3936
|
return;
|
|
3938
|
-
this.ctx.database.batchSetItemValue(
|
|
3937
|
+
this.ctx.database.batchSetItemValue(h, !0);
|
|
3939
3938
|
let d = [];
|
|
3940
3939
|
t.forEach((f) => {
|
|
3941
3940
|
d.push(this.ctx.database.getRowDataItemForRowKey(f));
|
|
3942
|
-
}), this.ctx.emit("autofillChange",
|
|
3941
|
+
}), this.ctx.emit("autofillChange", h, d), this.ctx.selector.xArr = this.ctx.autofill.xArr, this.ctx.selector.yArr = this.ctx.autofill.yArr, this.ctx.emit("draw");
|
|
3943
3942
|
}
|
|
3944
3943
|
mouseenter(t) {
|
|
3945
3944
|
if (["index", "selection", "index-selection"].includes(t.type))
|
|
@@ -4063,9 +4062,9 @@ function Pt(a, t, e) {
|
|
|
4063
4062
|
reference: i,
|
|
4064
4063
|
floating: s
|
|
4065
4064
|
} = a;
|
|
4066
|
-
const r = J(t), o = Mt(t), n = Ht(o),
|
|
4065
|
+
const r = J(t), o = Mt(t), n = Ht(o), l = q(t), h = r === "y", d = i.x + i.width / 2 - s.width / 2, f = i.y + i.height / 2 - s.height / 2, x = i[n] / 2 - s[n] / 2;
|
|
4067
4066
|
let u;
|
|
4068
|
-
switch (
|
|
4067
|
+
switch (l) {
|
|
4069
4068
|
case "top":
|
|
4070
4069
|
u = {
|
|
4071
4070
|
x: d,
|
|
@@ -4098,10 +4097,10 @@ function Pt(a, t, e) {
|
|
|
4098
4097
|
}
|
|
4099
4098
|
switch (ct(t)) {
|
|
4100
4099
|
case "start":
|
|
4101
|
-
u[o] -= x * (e &&
|
|
4100
|
+
u[o] -= x * (e && h ? -1 : 1);
|
|
4102
4101
|
break;
|
|
4103
4102
|
case "end":
|
|
4104
|
-
u[o] += x * (e &&
|
|
4103
|
+
u[o] += x * (e && h ? -1 : 1);
|
|
4105
4104
|
break;
|
|
4106
4105
|
}
|
|
4107
4106
|
return u;
|
|
@@ -4112,15 +4111,15 @@ const yi = async (a, t, e) => {
|
|
|
4112
4111
|
strategy: s = "absolute",
|
|
4113
4112
|
middleware: r = [],
|
|
4114
4113
|
platform: o
|
|
4115
|
-
} = e, n = r.filter(Boolean),
|
|
4116
|
-
let
|
|
4114
|
+
} = e, n = r.filter(Boolean), l = await (o.isRTL == null ? void 0 : o.isRTL(t));
|
|
4115
|
+
let h = await o.getElementRects({
|
|
4117
4116
|
reference: a,
|
|
4118
4117
|
floating: t,
|
|
4119
4118
|
strategy: s
|
|
4120
4119
|
}), {
|
|
4121
4120
|
x: d,
|
|
4122
4121
|
y: f
|
|
4123
|
-
} = Pt(
|
|
4122
|
+
} = Pt(h, i, l), x = i, u = {}, y = 0;
|
|
4124
4123
|
for (let g = 0; g < n.length; g++) {
|
|
4125
4124
|
const {
|
|
4126
4125
|
name: w,
|
|
@@ -4137,7 +4136,7 @@ const yi = async (a, t, e) => {
|
|
|
4137
4136
|
placement: x,
|
|
4138
4137
|
strategy: s,
|
|
4139
4138
|
middlewareData: u,
|
|
4140
|
-
rects:
|
|
4139
|
+
rects: h,
|
|
4141
4140
|
platform: o,
|
|
4142
4141
|
elements: {
|
|
4143
4142
|
reference: a,
|
|
@@ -4150,14 +4149,14 @@ const yi = async (a, t, e) => {
|
|
|
4150
4149
|
...u[w],
|
|
4151
4150
|
...b
|
|
4152
4151
|
}
|
|
4153
|
-
}, C && y <= 50 && (y++, typeof C == "object" && (C.placement && (x = C.placement), C.rects && (
|
|
4152
|
+
}, C && y <= 50 && (y++, typeof C == "object" && (C.placement && (x = C.placement), C.rects && (h = C.rects === !0 ? await o.getElementRects({
|
|
4154
4153
|
reference: a,
|
|
4155
4154
|
floating: t,
|
|
4156
4155
|
strategy: s
|
|
4157
4156
|
}) : C.rects), {
|
|
4158
4157
|
x: d,
|
|
4159
4158
|
y: f
|
|
4160
|
-
} = Pt(
|
|
4159
|
+
} = Pt(h, x, l)), g = -1);
|
|
4161
4160
|
}
|
|
4162
4161
|
return {
|
|
4163
4162
|
x: d,
|
|
@@ -4176,18 +4175,18 @@ async function re(a, t) {
|
|
|
4176
4175
|
platform: r,
|
|
4177
4176
|
rects: o,
|
|
4178
4177
|
elements: n,
|
|
4179
|
-
strategy:
|
|
4178
|
+
strategy: l
|
|
4180
4179
|
} = a, {
|
|
4181
|
-
boundary:
|
|
4180
|
+
boundary: h = "clippingAncestors",
|
|
4182
4181
|
rootBoundary: d = "viewport",
|
|
4183
4182
|
elementContext: f = "floating",
|
|
4184
4183
|
altBoundary: x = !1,
|
|
4185
4184
|
padding: u = 0
|
|
4186
4185
|
} = at(t, a), y = se(u), w = n[x ? f === "floating" ? "reference" : "floating" : f], p = ut(await r.getClippingRect({
|
|
4187
4186
|
element: (e = await (r.isElement == null ? void 0 : r.isElement(w))) == null || e ? w : w.contextElement || await (r.getDocumentElement == null ? void 0 : r.getDocumentElement(n.floating)),
|
|
4188
|
-
boundary:
|
|
4187
|
+
boundary: h,
|
|
4189
4188
|
rootBoundary: d,
|
|
4190
|
-
strategy:
|
|
4189
|
+
strategy: l
|
|
4191
4190
|
})), E = f === "floating" ? {
|
|
4192
4191
|
x: i,
|
|
4193
4192
|
y: s,
|
|
@@ -4203,7 +4202,7 @@ async function re(a, t) {
|
|
|
4203
4202
|
elements: n,
|
|
4204
4203
|
rect: E,
|
|
4205
4204
|
offsetParent: m,
|
|
4206
|
-
strategy:
|
|
4205
|
+
strategy: l
|
|
4207
4206
|
}) : E);
|
|
4208
4207
|
return {
|
|
4209
4208
|
top: (p.top - C.top + y.top) / b.y,
|
|
@@ -4223,20 +4222,20 @@ const mi = (a) => ({
|
|
|
4223
4222
|
rects: r,
|
|
4224
4223
|
platform: o,
|
|
4225
4224
|
elements: n,
|
|
4226
|
-
middlewareData:
|
|
4225
|
+
middlewareData: l
|
|
4227
4226
|
} = t, {
|
|
4228
|
-
element:
|
|
4227
|
+
element: h,
|
|
4229
4228
|
padding: d = 0
|
|
4230
4229
|
} = at(a, t) || {};
|
|
4231
|
-
if (
|
|
4230
|
+
if (h == null)
|
|
4232
4231
|
return {};
|
|
4233
4232
|
const f = se(d), x = {
|
|
4234
4233
|
x: e,
|
|
4235
4234
|
y: i
|
|
4236
|
-
}, u = Mt(s), y = Ht(u), g = await o.getDimensions(
|
|
4235
|
+
}, u = Mt(s), y = Ht(u), g = await o.getDimensions(h), w = u === "y", p = w ? "top" : "left", E = w ? "bottom" : "right", m = w ? "clientHeight" : "clientWidth", b = r.reference[y] + r.reference[u] - x[u] - r.floating[y], C = x[u] - r.reference[u], R = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(h));
|
|
4237
4236
|
let S = R ? R[m] : 0;
|
|
4238
4237
|
(!S || !await (o.isElement == null ? void 0 : o.isElement(R))) && (S = n.floating[m] || r.floating[y]);
|
|
4239
|
-
const L = b / 2 - C / 2, A = S / 2 - g[y] / 2 - 1, D = rt(f[p], A), B = rt(f[E], A), O = D, T = S - g[y] - B, _ = S / 2 - g[y] / 2 + L, G = Ot(O, _, T), K = !
|
|
4238
|
+
const L = b / 2 - C / 2, A = S / 2 - g[y] / 2 - 1, D = rt(f[p], A), B = rt(f[E], A), O = D, T = S - g[y] - B, _ = S / 2 - g[y] / 2 + L, G = Ot(O, _, T), K = !l.arrow && ct(s) != null && _ !== G && r.reference[y] / 2 - (_ < O ? D : B) - g[y] / 2 < 0, X = K ? _ < O ? _ - O : _ - T : 0;
|
|
4240
4239
|
return {
|
|
4241
4240
|
[u]: x[u] + X,
|
|
4242
4241
|
data: {
|
|
@@ -4260,8 +4259,8 @@ const mi = (a) => ({
|
|
|
4260
4259
|
middlewareData: r,
|
|
4261
4260
|
rects: o,
|
|
4262
4261
|
initialPlacement: n,
|
|
4263
|
-
platform:
|
|
4264
|
-
elements:
|
|
4262
|
+
platform: l,
|
|
4263
|
+
elements: h
|
|
4265
4264
|
} = t, {
|
|
4266
4265
|
mainAxis: d = !0,
|
|
4267
4266
|
crossAxis: f = !0,
|
|
@@ -4273,7 +4272,7 @@ const mi = (a) => ({
|
|
|
4273
4272
|
} = at(a, t);
|
|
4274
4273
|
if ((e = r.arrow) != null && e.alignmentOffset)
|
|
4275
4274
|
return {};
|
|
4276
|
-
const p = q(s), E = J(n), m = q(n) === n, b = await (
|
|
4275
|
+
const p = q(s), E = J(n), m = q(n) === n, b = await (l.isRTL == null ? void 0 : l.isRTL(h.floating)), C = x || (m || !g ? [xt(n)] : ui(n)), R = y !== "none";
|
|
4277
4276
|
!x && R && C.push(...wi(n, g, y, b));
|
|
4278
4277
|
const S = [n, ...C], L = await re(t, w), A = [];
|
|
4279
4278
|
let D = ((i = r.flip) == null ? void 0 : i.overflows) || [];
|
|
@@ -4334,7 +4333,7 @@ async function bi(a, t) {
|
|
|
4334
4333
|
placement: e,
|
|
4335
4334
|
platform: i,
|
|
4336
4335
|
elements: s
|
|
4337
|
-
} = a, r = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), o = q(e), n = ct(e),
|
|
4336
|
+
} = a, r = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), o = q(e), n = ct(e), l = J(e) === "y", h = ["left", "top"].includes(o) ? -1 : 1, d = r && l ? -1 : 1, f = at(t, a);
|
|
4338
4337
|
let {
|
|
4339
4338
|
mainAxis: x,
|
|
4340
4339
|
crossAxis: u,
|
|
@@ -4348,11 +4347,11 @@ async function bi(a, t) {
|
|
|
4348
4347
|
crossAxis: f.crossAxis || 0,
|
|
4349
4348
|
alignmentAxis: f.alignmentAxis
|
|
4350
4349
|
};
|
|
4351
|
-
return n && typeof y == "number" && (u = n === "end" ? y * -1 : y),
|
|
4350
|
+
return n && typeof y == "number" && (u = n === "end" ? y * -1 : y), l ? {
|
|
4352
4351
|
x: u * d,
|
|
4353
|
-
y: x *
|
|
4352
|
+
y: x * h
|
|
4354
4353
|
} : {
|
|
4355
|
-
x: x *
|
|
4354
|
+
x: x * h,
|
|
4356
4355
|
y: u * d
|
|
4357
4356
|
};
|
|
4358
4357
|
}
|
|
@@ -4367,12 +4366,12 @@ const Ci = function(a) {
|
|
|
4367
4366
|
y: r,
|
|
4368
4367
|
placement: o,
|
|
4369
4368
|
middlewareData: n
|
|
4370
|
-
} = t,
|
|
4369
|
+
} = t, l = await bi(t, a);
|
|
4371
4370
|
return o === ((e = n.offset) == null ? void 0 : e.placement) && (i = n.arrow) != null && i.alignmentOffset ? {} : {
|
|
4372
|
-
x: s +
|
|
4373
|
-
y: r +
|
|
4371
|
+
x: s + l.x,
|
|
4372
|
+
y: r + l.y,
|
|
4374
4373
|
data: {
|
|
4375
|
-
...
|
|
4374
|
+
...l,
|
|
4376
4375
|
placement: o
|
|
4377
4376
|
}
|
|
4378
4377
|
};
|
|
@@ -4402,12 +4401,12 @@ const Ci = function(a) {
|
|
|
4402
4401
|
};
|
|
4403
4402
|
}
|
|
4404
4403
|
},
|
|
4405
|
-
...
|
|
4406
|
-
} = at(a, t),
|
|
4404
|
+
...l
|
|
4405
|
+
} = at(a, t), h = {
|
|
4407
4406
|
x: e,
|
|
4408
4407
|
y: i
|
|
4409
|
-
}, d = await re(t,
|
|
4410
|
-
let u =
|
|
4408
|
+
}, d = await re(t, l), f = J(q(s)), x = ie(f);
|
|
4409
|
+
let u = h[x], y = h[f];
|
|
4411
4410
|
if (r) {
|
|
4412
4411
|
const w = x === "y" ? "top" : "left", p = x === "y" ? "bottom" : "right", E = u + d[w], m = u - d[p];
|
|
4413
4412
|
u = Ot(E, u, m);
|
|
@@ -4461,7 +4460,7 @@ function N(a) {
|
|
|
4461
4460
|
function Vt(a) {
|
|
4462
4461
|
return !gt() || typeof ShadowRoot > "u" ? !1 : a instanceof ShadowRoot || a instanceof M(a).ShadowRoot;
|
|
4463
4462
|
}
|
|
4464
|
-
function
|
|
4463
|
+
function lt(a) {
|
|
4465
4464
|
const {
|
|
4466
4465
|
overflow: t,
|
|
4467
4466
|
overflowX: e,
|
|
@@ -4529,7 +4528,7 @@ function z(a) {
|
|
|
4529
4528
|
}
|
|
4530
4529
|
function ne(a) {
|
|
4531
4530
|
const t = z(a);
|
|
4532
|
-
return Q(t) ? a.ownerDocument ? a.ownerDocument.body : a.body : N(t) &&
|
|
4531
|
+
return Q(t) ? a.ownerDocument ? a.ownerDocument.body : a.body : N(t) && lt(t) ? t : ne(t);
|
|
4533
4532
|
}
|
|
4534
4533
|
function Tt(a, t, e) {
|
|
4535
4534
|
var i;
|
|
@@ -4537,7 +4536,7 @@ function Tt(a, t, e) {
|
|
|
4537
4536
|
const s = ne(a), r = s === ((i = a.ownerDocument) == null ? void 0 : i.body), o = M(s);
|
|
4538
4537
|
if (r) {
|
|
4539
4538
|
const n = St(o);
|
|
4540
|
-
return t.concat(o, o.visualViewport || [],
|
|
4539
|
+
return t.concat(o, o.visualViewport || [], lt(s) ? s : [], n && e ? Tt(n) : []);
|
|
4541
4540
|
}
|
|
4542
4541
|
return t.concat(s, Tt(s, [], e));
|
|
4543
4542
|
}
|
|
@@ -4573,7 +4572,7 @@ function Z(a) {
|
|
|
4573
4572
|
};
|
|
4574
4573
|
}
|
|
4575
4574
|
const Oi = /* @__PURE__ */ V(0);
|
|
4576
|
-
function
|
|
4575
|
+
function le(a) {
|
|
4577
4576
|
const t = M(a);
|
|
4578
4577
|
return !kt() || !t.visualViewport ? Oi : {
|
|
4579
4578
|
x: t.visualViewport.offsetLeft,
|
|
@@ -4588,21 +4587,21 @@ function ot(a, t, e, i) {
|
|
|
4588
4587
|
const s = a.getBoundingClientRect(), r = ce(a);
|
|
4589
4588
|
let o = V(1);
|
|
4590
4589
|
t && (i ? k(i) && (o = Z(i)) : o = Z(a));
|
|
4591
|
-
const n = _i(r, e, i) ?
|
|
4592
|
-
let
|
|
4590
|
+
const n = _i(r, e, i) ? le(r) : V(0);
|
|
4591
|
+
let l = (s.left + n.x) / o.x, h = (s.top + n.y) / o.y, d = s.width / o.x, f = s.height / o.y;
|
|
4593
4592
|
if (r) {
|
|
4594
4593
|
const x = M(r), u = i && k(i) ? M(i) : i;
|
|
4595
4594
|
let y = x, g = St(y);
|
|
4596
4595
|
for (; g && i && u !== y; ) {
|
|
4597
4596
|
const w = Z(g), p = g.getBoundingClientRect(), E = F(g), m = p.left + (g.clientLeft + parseFloat(E.paddingLeft)) * w.x, b = p.top + (g.clientTop + parseFloat(E.paddingTop)) * w.y;
|
|
4598
|
-
|
|
4597
|
+
l *= w.x, h *= w.y, d *= w.x, f *= w.y, l += m, h += b, y = M(g), g = St(y);
|
|
4599
4598
|
}
|
|
4600
4599
|
}
|
|
4601
4600
|
return ut({
|
|
4602
4601
|
width: d,
|
|
4603
4602
|
height: f,
|
|
4604
|
-
x:
|
|
4605
|
-
y:
|
|
4603
|
+
x: l,
|
|
4604
|
+
y: h
|
|
4606
4605
|
});
|
|
4607
4606
|
}
|
|
4608
4607
|
function Ti(a) {
|
|
@@ -4615,20 +4614,20 @@ function Ti(a) {
|
|
|
4615
4614
|
const r = s === "fixed", o = Y(i), n = t ? wt(t.floating) : !1;
|
|
4616
4615
|
if (i === o || n && r)
|
|
4617
4616
|
return e;
|
|
4618
|
-
let
|
|
4617
|
+
let l = {
|
|
4619
4618
|
scrollLeft: 0,
|
|
4620
4619
|
scrollTop: 0
|
|
4621
|
-
},
|
|
4620
|
+
}, h = V(1);
|
|
4622
4621
|
const d = V(0), f = N(i);
|
|
4623
|
-
if ((f || !f && !r) && ((tt(i) !== "body" ||
|
|
4622
|
+
if ((f || !f && !r) && ((tt(i) !== "body" || lt(o)) && (l = pt(i)), N(i))) {
|
|
4624
4623
|
const x = ot(i);
|
|
4625
|
-
|
|
4624
|
+
h = Z(i), d.x = x.x + i.clientLeft, d.y = x.y + i.clientTop;
|
|
4626
4625
|
}
|
|
4627
4626
|
return {
|
|
4628
|
-
width: e.width *
|
|
4629
|
-
height: e.height *
|
|
4630
|
-
x: e.x *
|
|
4631
|
-
y: e.y *
|
|
4627
|
+
width: e.width * h.x,
|
|
4628
|
+
height: e.height * h.y,
|
|
4629
|
+
x: e.x * h.x - l.scrollLeft * h.x + d.x,
|
|
4630
|
+
y: e.y * h.y - l.scrollTop * h.y + d.y
|
|
4632
4631
|
};
|
|
4633
4632
|
}
|
|
4634
4633
|
function Si(a) {
|
|
@@ -4651,26 +4650,26 @@ function Li(a) {
|
|
|
4651
4650
|
}
|
|
4652
4651
|
function Ai(a, t) {
|
|
4653
4652
|
const e = M(a), i = Y(a), s = e.visualViewport;
|
|
4654
|
-
let r = i.clientWidth, o = i.clientHeight, n = 0,
|
|
4653
|
+
let r = i.clientWidth, o = i.clientHeight, n = 0, l = 0;
|
|
4655
4654
|
if (s) {
|
|
4656
4655
|
r = s.width, o = s.height;
|
|
4657
|
-
const
|
|
4658
|
-
(!
|
|
4656
|
+
const h = kt();
|
|
4657
|
+
(!h || h && t === "fixed") && (n = s.offsetLeft, l = s.offsetTop);
|
|
4659
4658
|
}
|
|
4660
4659
|
return {
|
|
4661
4660
|
width: r,
|
|
4662
4661
|
height: o,
|
|
4663
4662
|
x: n,
|
|
4664
|
-
y:
|
|
4663
|
+
y: l
|
|
4665
4664
|
};
|
|
4666
4665
|
}
|
|
4667
4666
|
function Hi(a, t) {
|
|
4668
|
-
const e = ot(a, !0, t === "fixed"), i = e.top + a.clientTop, s = e.left + a.clientLeft, r = N(a) ? Z(a) : V(1), o = a.clientWidth * r.x, n = a.clientHeight * r.y,
|
|
4667
|
+
const e = ot(a, !0, t === "fixed"), i = e.top + a.clientTop, s = e.left + a.clientLeft, r = N(a) ? Z(a) : V(1), o = a.clientWidth * r.x, n = a.clientHeight * r.y, l = s * r.x, h = i * r.y;
|
|
4669
4668
|
return {
|
|
4670
4669
|
width: o,
|
|
4671
4670
|
height: n,
|
|
4672
|
-
x:
|
|
4673
|
-
y:
|
|
4671
|
+
x: l,
|
|
4672
|
+
y: h
|
|
4674
4673
|
};
|
|
4675
4674
|
}
|
|
4676
4675
|
function zt(a, t, e) {
|
|
@@ -4682,7 +4681,7 @@ function zt(a, t, e) {
|
|
|
4682
4681
|
else if (k(t))
|
|
4683
4682
|
i = Hi(t, e);
|
|
4684
4683
|
else {
|
|
4685
|
-
const s =
|
|
4684
|
+
const s = le(a);
|
|
4686
4685
|
i = {
|
|
4687
4686
|
...t,
|
|
4688
4687
|
x: t.x - s.x,
|
|
@@ -4691,9 +4690,9 @@ function zt(a, t, e) {
|
|
|
4691
4690
|
}
|
|
4692
4691
|
return ut(i);
|
|
4693
4692
|
}
|
|
4694
|
-
function
|
|
4693
|
+
function he(a, t) {
|
|
4695
4694
|
const e = z(a);
|
|
4696
|
-
return e === t || !k(e) || Q(e) ? !1 : F(e).position === "fixed" ||
|
|
4695
|
+
return e === t || !k(e) || Q(e) ? !1 : F(e).position === "fixed" || he(e, t);
|
|
4697
4696
|
}
|
|
4698
4697
|
function Mi(a, t) {
|
|
4699
4698
|
const e = t.get(a);
|
|
@@ -4703,8 +4702,8 @@ function Mi(a, t) {
|
|
|
4703
4702
|
const r = F(a).position === "fixed";
|
|
4704
4703
|
let o = r ? z(a) : a;
|
|
4705
4704
|
for (; k(o) && !Q(o); ) {
|
|
4706
|
-
const n = F(o),
|
|
4707
|
-
!
|
|
4705
|
+
const n = F(o), l = Dt(o);
|
|
4706
|
+
!l && n.position === "fixed" && (s = null), (r ? !l && !s : !l && n.position === "static" && !!s && ["absolute", "fixed"].includes(s.position) || lt(o) && !l && he(a, o)) ? i = i.filter((d) => d !== o) : s = n, o = z(o);
|
|
4708
4707
|
}
|
|
4709
4708
|
return t.set(a, i), i;
|
|
4710
4709
|
}
|
|
@@ -4715,15 +4714,15 @@ function Di(a) {
|
|
|
4715
4714
|
rootBoundary: i,
|
|
4716
4715
|
strategy: s
|
|
4717
4716
|
} = a;
|
|
4718
|
-
const o = [...e === "clippingAncestors" ? wt(t) ? [] : Mi(t, this._c) : [].concat(e), i], n = o[0],
|
|
4717
|
+
const o = [...e === "clippingAncestors" ? wt(t) ? [] : Mi(t, this._c) : [].concat(e), i], n = o[0], l = o.reduce((h, d) => {
|
|
4719
4718
|
const f = zt(t, d, s);
|
|
4720
|
-
return
|
|
4719
|
+
return h.top = U(f.top, h.top), h.right = rt(f.right, h.right), h.bottom = rt(f.bottom, h.bottom), h.left = U(f.left, h.left), h;
|
|
4721
4720
|
}, zt(t, n, s));
|
|
4722
4721
|
return {
|
|
4723
|
-
width:
|
|
4724
|
-
height:
|
|
4725
|
-
x:
|
|
4726
|
-
y:
|
|
4722
|
+
width: l.right - l.left,
|
|
4723
|
+
height: l.bottom - l.top,
|
|
4724
|
+
x: l.left,
|
|
4725
|
+
y: l.top
|
|
4727
4726
|
};
|
|
4728
4727
|
}
|
|
4729
4728
|
function ki(a) {
|
|
@@ -4742,19 +4741,19 @@ function Fi(a, t, e) {
|
|
|
4742
4741
|
scrollLeft: 0,
|
|
4743
4742
|
scrollTop: 0
|
|
4744
4743
|
};
|
|
4745
|
-
const
|
|
4744
|
+
const l = V(0);
|
|
4746
4745
|
if (i || !i && !r)
|
|
4747
|
-
if ((tt(t) !== "body" ||
|
|
4746
|
+
if ((tt(t) !== "body" || lt(s)) && (n = pt(t)), i) {
|
|
4748
4747
|
const u = ot(t, !0, r, t);
|
|
4749
|
-
|
|
4750
|
-
} else s && (
|
|
4751
|
-
let
|
|
4748
|
+
l.x = u.x + t.clientLeft, l.y = u.y + t.clientTop;
|
|
4749
|
+
} else s && (l.x = Lt(s));
|
|
4750
|
+
let h = 0, d = 0;
|
|
4752
4751
|
if (s && !i && !r) {
|
|
4753
4752
|
const u = s.getBoundingClientRect();
|
|
4754
|
-
d = u.top + n.scrollTop,
|
|
4753
|
+
d = u.top + n.scrollTop, h = u.left + n.scrollLeft - // RTL <body> scrollbar.
|
|
4755
4754
|
Lt(s, u);
|
|
4756
4755
|
}
|
|
4757
|
-
const f = o.left + n.scrollLeft -
|
|
4756
|
+
const f = o.left + n.scrollLeft - l.x - h, x = o.top + n.scrollTop - l.y - d;
|
|
4758
4757
|
return {
|
|
4759
4758
|
x: f,
|
|
4760
4759
|
y: x,
|
|
@@ -4851,7 +4850,7 @@ let Bi = class {
|
|
|
4851
4850
|
borderRadius: "4px",
|
|
4852
4851
|
fontSize: "12px",
|
|
4853
4852
|
...r
|
|
4854
|
-
},
|
|
4853
|
+
}, l = {
|
|
4855
4854
|
position: "absolute",
|
|
4856
4855
|
width: "10px",
|
|
4857
4856
|
height: "10px",
|
|
@@ -4860,7 +4859,7 @@ let Bi = class {
|
|
|
4860
4859
|
transform: "rotate(45deg)",
|
|
4861
4860
|
zIndex: n.zIndex
|
|
4862
4861
|
};
|
|
4863
|
-
Object.assign(this.arrowEl.style,
|
|
4862
|
+
Object.assign(this.arrowEl.style, l), Object.assign(this.floatingEl.style, n), this.floatingEl.appendChild(this.contentEl), this.floatingEl.appendChild(this.arrowEl), this.ctx.targetContainer.appendChild(this.floatingEl), this.init();
|
|
4864
4863
|
}
|
|
4865
4864
|
init() {
|
|
4866
4865
|
this.ctx.on("mousemove", (t) => {
|
|
@@ -4902,10 +4901,10 @@ let Bi = class {
|
|
|
4902
4901
|
placement: t.overflowTooltipPlacement,
|
|
4903
4902
|
middleware: [xe(), ue(), fe(6), Yi({ element: this.arrowEl })]
|
|
4904
4903
|
}).then((n) => {
|
|
4905
|
-
const { x:
|
|
4904
|
+
const { x: l, y: h, placement: d, middlewareData: f } = n;
|
|
4906
4905
|
if (Object.assign(this.floatingEl.style, {
|
|
4907
|
-
top: `${
|
|
4908
|
-
left: `${
|
|
4906
|
+
top: `${h}px`,
|
|
4907
|
+
left: `${l}px`
|
|
4909
4908
|
}), f.arrow) {
|
|
4910
4909
|
const x = f.arrow;
|
|
4911
4910
|
["left", "left-start", "left-end"].includes(d) ? Object.assign(this.arrowEl.style, {
|
|
@@ -5043,8 +5042,8 @@ class Wi {
|
|
|
5043
5042
|
return;
|
|
5044
5043
|
const e = t.getValue(), { width: i, height: s } = t, r = t.getDrawX(), o = t.getDrawY(), { CELL_PADDING: n } = this.ctx.config;
|
|
5045
5044
|
this.editorEl.style.left = `${r}px`, this.editorEl.style.top = `${o}px`, this.inputEl.style.minWidth = `${i - 1}px`, this.inputEl.style.minHeight = `${s - 1}px`, this.inputEl.style.padding = `${n}px`, e !== null && (this.inputEl.textContent = e), this.inputEl.focus();
|
|
5046
|
-
const
|
|
5047
|
-
|
|
5045
|
+
const l = window.getSelection();
|
|
5046
|
+
l == null || l.selectAllChildren(this.inputEl), l == null || l.collapseToEnd();
|
|
5048
5047
|
}
|
|
5049
5048
|
doneEditByInput() {
|
|
5050
5049
|
if (!this.cellTarget || this.cellTarget.editorType !== "text")
|
|
@@ -5063,18 +5062,18 @@ class Wi {
|
|
|
5063
5062
|
e && !r && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = e, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
5064
5063
|
}
|
|
5065
5064
|
editCell(t, e) {
|
|
5066
|
-
const i = this.ctx.body.renderRows.find((
|
|
5065
|
+
const i = this.ctx.body.renderRows.find((h) => h.rowIndex === t);
|
|
5067
5066
|
if (!i)
|
|
5068
5067
|
return;
|
|
5069
|
-
const s = i.cells.find((
|
|
5068
|
+
const s = i.cells.find((h) => h.colIndex === e);
|
|
5070
5069
|
if (!s)
|
|
5071
5070
|
return;
|
|
5072
5071
|
this.ctx.emit("setSelectorCell", s);
|
|
5073
5072
|
const r = this.ctx.focusCell;
|
|
5074
5073
|
if (!r || ["index", "index-selection", "selection"].includes(r.type) || this.enable)
|
|
5075
5074
|
return;
|
|
5076
|
-
const { rowKey: o, key: n } = r,
|
|
5077
|
-
r && !
|
|
5075
|
+
const { rowKey: o, key: n } = r, l = this.ctx.database.getReadonly(o, n);
|
|
5076
|
+
r && !l && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = r, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
|
|
5078
5077
|
}
|
|
5079
5078
|
doneEdit() {
|
|
5080
5079
|
this.enable && this.cellTarget && (this.ctx.emit("doneEdit", this.cellTarget), this.doneEditByInput(), this.enable = !1, this.ctx.target.focus(), this.ctx.editing = !1, this.cellTarget = null, this.ctx.emit("draw"));
|
|
@@ -5088,10 +5087,10 @@ class Pi {
|
|
|
5088
5087
|
c(this, "emptyEl");
|
|
5089
5088
|
this.ctx = t;
|
|
5090
5089
|
const { EMPTY_TEXT: e, EMPTY_CUSTOM: i, EMPTY_CUSTOM_STYLE: s, CSS_PREFIX: r } = this.ctx.config;
|
|
5091
|
-
this.emptyEl = document.createElement("div"), this.emptyEl.className = `${r}-empty`, this.emptyEl.style.display = "none", this.emptyEl.innerText = e, this.ctx.targetContainer.appendChild(this.emptyEl), this.ctx.on("emptyChange", ({ type: o, headerHeight: n, bodyHeight:
|
|
5090
|
+
this.emptyEl = document.createElement("div"), this.emptyEl.className = `${r}-empty`, this.emptyEl.style.display = "none", this.emptyEl.innerText = e, this.ctx.targetContainer.appendChild(this.emptyEl), this.ctx.on("emptyChange", ({ type: o, headerHeight: n, bodyHeight: l, footerHeight: h }) => {
|
|
5092
5091
|
if (i)
|
|
5093
5092
|
return;
|
|
5094
|
-
const d = n + (
|
|
5093
|
+
const d = n + (l + h) / 2, f = {
|
|
5095
5094
|
display: o === "empty" ? "block" : "none",
|
|
5096
5095
|
position: "absolute",
|
|
5097
5096
|
fontSize: "14px",
|
|
@@ -5128,9 +5127,9 @@ class Vi {
|
|
|
5128
5127
|
target: t,
|
|
5129
5128
|
config: { SCROLLER_TRACK_SIZE: e }
|
|
5130
5129
|
} = this.ctx, i = t.width - e, s = t.height - e, r = this.getHeader(), o = this.getBody(), n = this.getFooter();
|
|
5131
|
-
let
|
|
5132
|
-
const { FOOTER_FIXED:
|
|
5133
|
-
return
|
|
5130
|
+
let l = [r, o, n];
|
|
5131
|
+
const { FOOTER_FIXED: h } = this.ctx.config;
|
|
5132
|
+
return h || (l = [r, o]), {
|
|
5134
5133
|
style: {
|
|
5135
5134
|
position: "absolute",
|
|
5136
5135
|
left: "0px",
|
|
@@ -5140,7 +5139,7 @@ class Vi {
|
|
|
5140
5139
|
width: `${i}px`,
|
|
5141
5140
|
height: `${s}px`
|
|
5142
5141
|
},
|
|
5143
|
-
views:
|
|
5142
|
+
views: l
|
|
5144
5143
|
};
|
|
5145
5144
|
}
|
|
5146
5145
|
getHeader() {
|
|
@@ -5149,9 +5148,9 @@ class Vi {
|
|
|
5149
5148
|
fixedRightWidth: e,
|
|
5150
5149
|
config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
|
|
5151
5150
|
} = this.ctx, { visibleWidth: r, visibleHeight: o, renderCellHeaders: n } = this.ctx.header;
|
|
5152
|
-
let
|
|
5151
|
+
let l = [], h = [], d = [];
|
|
5153
5152
|
n.forEach((w) => {
|
|
5154
|
-
w.render && (w.fixed === "left" ?
|
|
5153
|
+
w.render && (w.fixed === "left" ? h.push(w) : w.fixed === "right" ? d.push(w) : l.push(w));
|
|
5155
5154
|
});
|
|
5156
5155
|
const f = e - i, x = {
|
|
5157
5156
|
key: "left",
|
|
@@ -5163,7 +5162,7 @@ class Vi {
|
|
|
5163
5162
|
width: `${t}px`,
|
|
5164
5163
|
height: `${o}px`
|
|
5165
5164
|
},
|
|
5166
|
-
cells:
|
|
5165
|
+
cells: h
|
|
5167
5166
|
}, u = {
|
|
5168
5167
|
key: "center",
|
|
5169
5168
|
style: {
|
|
@@ -5174,7 +5173,7 @@ class Vi {
|
|
|
5174
5173
|
width: `${r - t - f}px`,
|
|
5175
5174
|
height: `${o}px`
|
|
5176
5175
|
},
|
|
5177
|
-
cells:
|
|
5176
|
+
cells: l
|
|
5178
5177
|
}, y = {
|
|
5179
5178
|
key: "right",
|
|
5180
5179
|
style: {
|
|
@@ -5210,8 +5209,8 @@ class Vi {
|
|
|
5210
5209
|
const {
|
|
5211
5210
|
fixedLeftWidth: r,
|
|
5212
5211
|
fixedRightWidth: o,
|
|
5213
|
-
config: { SCROLLER_TRACK_SIZE: n, CSS_PREFIX:
|
|
5214
|
-
} = this.ctx, { visibleWidth:
|
|
5212
|
+
config: { SCROLLER_TRACK_SIZE: n, CSS_PREFIX: l }
|
|
5213
|
+
} = this.ctx, { visibleWidth: h, visibleHeight: d } = this.ctx.body, f = o - n, x = {
|
|
5215
5214
|
key: "left",
|
|
5216
5215
|
style: {
|
|
5217
5216
|
position: "absolute",
|
|
@@ -5229,7 +5228,7 @@ class Vi {
|
|
|
5229
5228
|
top: `${0.5}px`,
|
|
5230
5229
|
left: `${r + 0.5}px`,
|
|
5231
5230
|
overflow: "hidden",
|
|
5232
|
-
width: `${
|
|
5231
|
+
width: `${h - r - f}px`,
|
|
5233
5232
|
height: `${d}px`
|
|
5234
5233
|
},
|
|
5235
5234
|
cells: t
|
|
@@ -5247,11 +5246,11 @@ class Vi {
|
|
|
5247
5246
|
};
|
|
5248
5247
|
return {
|
|
5249
5248
|
type: "body",
|
|
5250
|
-
class: `${
|
|
5249
|
+
class: `${l}-overlayer-body`,
|
|
5251
5250
|
style: {
|
|
5252
5251
|
position: "relative",
|
|
5253
5252
|
overflow: "hidden",
|
|
5254
|
-
width: `${
|
|
5253
|
+
width: `${h}px`,
|
|
5255
5254
|
height: `${d}px`
|
|
5256
5255
|
},
|
|
5257
5256
|
views: [x, u, y]
|
|
@@ -5268,7 +5267,7 @@ class Vi {
|
|
|
5268
5267
|
fixedLeftWidth: s,
|
|
5269
5268
|
fixedRightWidth: r,
|
|
5270
5269
|
config: { SCROLLER_TRACK_SIZE: o, CSS_PREFIX: n }
|
|
5271
|
-
} = this.ctx, { visibleWidth:
|
|
5270
|
+
} = this.ctx, { visibleWidth: l, visibleHeight: h } = this.ctx.footer, d = r - o, f = {
|
|
5272
5271
|
key: "left",
|
|
5273
5272
|
style: {
|
|
5274
5273
|
position: "absolute",
|
|
@@ -5276,7 +5275,7 @@ class Vi {
|
|
|
5276
5275
|
left: `${0.5}px`,
|
|
5277
5276
|
overflow: "hidden",
|
|
5278
5277
|
width: `${s}px`,
|
|
5279
|
-
height: `${
|
|
5278
|
+
height: `${h}px`
|
|
5280
5279
|
},
|
|
5281
5280
|
cells: e
|
|
5282
5281
|
}, x = {
|
|
@@ -5286,8 +5285,8 @@ class Vi {
|
|
|
5286
5285
|
top: `${0.5}px`,
|
|
5287
5286
|
left: `${s + 0.5}px`,
|
|
5288
5287
|
overflow: "hidden",
|
|
5289
|
-
width: `${
|
|
5290
|
-
height: `${
|
|
5288
|
+
width: `${l - s - d}px`,
|
|
5289
|
+
height: `${h}px`
|
|
5291
5290
|
},
|
|
5292
5291
|
cells: t
|
|
5293
5292
|
}, u = {
|
|
@@ -5298,7 +5297,7 @@ class Vi {
|
|
|
5298
5297
|
right: `${0.5}px`,
|
|
5299
5298
|
overflow: "hidden",
|
|
5300
5299
|
width: `${d}px`,
|
|
5301
|
-
height: `${
|
|
5300
|
+
height: `${h}px`
|
|
5302
5301
|
},
|
|
5303
5302
|
cells: i
|
|
5304
5303
|
};
|
|
@@ -5308,8 +5307,8 @@ class Vi {
|
|
|
5308
5307
|
style: {
|
|
5309
5308
|
position: "relative",
|
|
5310
5309
|
overflow: "hidden",
|
|
5311
|
-
width: `${
|
|
5312
|
-
height: `${
|
|
5310
|
+
width: `${l}px`,
|
|
5311
|
+
height: `${h}px`
|
|
5313
5312
|
},
|
|
5314
5313
|
views: [f, x, u]
|
|
5315
5314
|
};
|
|
@@ -5325,8 +5324,8 @@ class zi {
|
|
|
5325
5324
|
this.ctx.on("cellContextMenuClick", (t, e) => {
|
|
5326
5325
|
if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
|
|
5327
5326
|
e.preventDefault();
|
|
5328
|
-
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [n,
|
|
5329
|
-
|
|
5327
|
+
const { xArr: i, yArr: s } = this.ctx.selector, [r, o] = i, [n, l] = s, { rowIndex: h, colIndex: d } = t;
|
|
5328
|
+
h >= n && h <= l && d >= r && d <= o || this.ctx.emit("setSelectorCell", t, e);
|
|
5330
5329
|
const x = {
|
|
5331
5330
|
getBoundingClientRect: () => ({
|
|
5332
5331
|
width: 0,
|
|
@@ -5415,7 +5414,7 @@ class Gi {
|
|
|
5415
5414
|
c(this, "overlayer");
|
|
5416
5415
|
c(this, "contextMenu");
|
|
5417
5416
|
c(this, "ctx");
|
|
5418
|
-
this.target = document.createElement("canvas"), this.targetContainer = t, this.targetContainer.style.position = "relative", this.targetContainer.appendChild(this.target), this.options = e, this.ctx = new ri(this.targetContainer, this.target, this.options), this.header = new ni(this.ctx), this.body = new ai(this.ctx), this.footer = new ci(this.ctx), this.scroller = new oi(this.ctx), this.selector = new
|
|
5417
|
+
this.target = document.createElement("canvas"), this.targetContainer = t, this.targetContainer.style.position = "relative", this.targetContainer.appendChild(this.target), this.options = e, this.ctx = new ri(this.targetContainer, this.target, this.options), this.header = new ni(this.ctx), this.body = new ai(this.ctx), this.footer = new ci(this.ctx), this.scroller = new oi(this.ctx), this.selector = new li(this.ctx), this.autofill = new hi(this.ctx), this.tooltip = new Bi(this.ctx), this.empty = new Pi(this.ctx), this.editor = new Wi(this.ctx), this.overlayer = new Vi(this.ctx), this.contextMenu = new zi(this.ctx), this.ctx.on("draw", this.draw.bind(this)), this.draw();
|
|
5419
5418
|
}
|
|
5420
5419
|
draw() {
|
|
5421
5420
|
requestAnimationFrame(() => {
|
|
@@ -5479,8 +5478,8 @@ class Gi {
|
|
|
5479
5478
|
if (t && Array.isArray(s) && s.length) {
|
|
5480
5479
|
const [r] = s;
|
|
5481
5480
|
if (Array.isArray(r) && r.length) {
|
|
5482
|
-
const [o] = r, { rowKey: n, key:
|
|
5483
|
-
this.scrollToRowkey(n), this.scrollToColkey(
|
|
5481
|
+
const [o] = r, { rowKey: n, key: l } = o;
|
|
5482
|
+
this.scrollToRowkey(n), this.scrollToColkey(l);
|
|
5484
5483
|
}
|
|
5485
5484
|
}
|
|
5486
5485
|
i(s);
|
|
@@ -5505,7 +5504,7 @@ class Gi {
|
|
|
5505
5504
|
let r = [];
|
|
5506
5505
|
for (let o = 0; o < i.length; o++)
|
|
5507
5506
|
for (let n = 0; n < s.length; n++) {
|
|
5508
|
-
const
|
|
5507
|
+
const l = this.ctx.database.getRowKeyByItem(i[o]), d = s[n].key, f = await this.ctx.database.getValidator(l, d);
|
|
5509
5508
|
Array.isArray(f) && f.length && r.push(f);
|
|
5510
5509
|
}
|
|
5511
5510
|
r.length ? (e(r), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
|